text stringlengths 12 6.59M |
|---|
from __future__ import absolute_import
import numpy as np
import os
from astropy.convolution import convolve, Gaussian1DKernel, Box1DKernel
from astropy.io import fits
from astropy.modeling import models
from ccdproc import CCDData
from unittest import TestCase, skip
from ..wavelength import (WavelengthCalibration,
... |
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4
"""The commandline completion for vimiv."""
import os
import re
from itertools import takewhile
from string import digits
from gi import require_version
require_version('Gtk', '3.0')
from gi.repository import Gtk
from vimiv.helpers import listdir_wrapper
from vimiv.hel... |
from __future__ import absolute_import, division, unicode_literals
from future.builtins import int, open, str
from hashlib import md5
from json import loads
import os
try:
from urllib.request import urlopen
from urllib.parse import urlencode, quote, unquote
except ImportError:
from urllib import urlopen, u... |
import numpy as np
import yaml
import pandas as pd
from urbansim.utils import misc
from urbansim.models import RegressionModel, SegmentedRegressionModel, \
MNLLocationChoiceModel, SegmentedMNLLocationChoiceModel, \
GrowthRateTransition
def hedonic_estimate(df, cfgname):
"""
Parameters
----------
... |
import re
import sys
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import OrderedDict, defaultdict
from itertools import groupby, chain
from types import StringTypes
from sqlalchemy import create_engine
from sqlalchemy.exc import NoInspectionAvailable
from sqlalchemy.inspection import insp... |
def bigend_24b(b1, b2, b3):
b1 = int(b1, 16)
b2 = int(b2, 16)
b3 = int(b3, 16)
return (b1*256*256) + (256*b2) + b3
#return int(b1,16)*65536+int(b2,16)*256+int(b3,16)
class Parser(object):
def __init__(self, headset, stream):
self.headset = headset
self.stream = stream
... |
#
# Copyright (c) 2011 rPath, Inc.
#
# All Rights Reserved
#
from mint.django_rest.rbuilder.manager import basemanager
from mint.django_rest.rbuilder.packages import models
exposed = basemanager.exposed
class PackageManager(basemanager.BaseManager):
"""docstring for PackageManager"""
@exposed
def ge... |
import six
import ldap3
import user_sync.rules
import user_sync.connector.directory
import user_sync.sign_sync.connections.sign_connection
from user_sync.error import AssertionException
class Synchronize:
def __init__(self, logger, config_loader, connector):
# Create process, api, and error loggers for... |
import logging
import json
import subprocess
from logging import Formatter
from logging.handlers import TimedRotatingFileHandler
from flask import Flask, render_template
app = Flask(__name__)
def vnstat(basis, fmt='json'):
"""Call vnstat cmd in a subprocess
basis:
'h' => last 24 hours
'd' => last ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for IRAFStarFinder.
"""
import itertools
import os.path as op
from astropy.table import Table
from astropy.tests.helper import catch_warnings
import numpy as np
from numpy.testing import assert_allclose
import pytest
from ..irafstarfinder impo... |
#!/usr/bin/env python
#
#util used by wrapper tool for automation and env config.
#
import argparse
import handyman_main
#from handyman_main import *
import os
import subprocess
import ConfigParser
from configobj import ConfigObj
import feedparser
import logging
import inspect
from inspect import currentframe, getframe... |
from __future__ import absolute_import
from __future__ import unicode_literals
import contextlib
import errno
from socket import error as SocketError
from socket import SO_REUSEADDR
from socket import socket
from socket import SOL_SOCKET
LOCALHOST = '127.0.0.1'
def reserve(ip=LOCALHOST, port=0):
"""Bind to an e... |
import logging
from lxml import etree
from pkg_resources import resource_string, resource_listdir
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
from xmodule.modulestore.mongo import MongoModuleStore
from xmodule.modulestore.django import modulestore
from xmodule.contentstore.conten... |
# Standard library
from collections import OrderedDict
import copy
import os
import warnings
# Third-party
import astropy.units as u
from astropy.time import Time
from astropy.table import Table, QTable, Row, meta, serialize
from astropy.utils.decorators import deprecated_renamed_argument
import numpy as np
from twobo... |
"""
Created on Wed Jan 29 10:40:14 2014
@author: tom_barclay
The code will accept a file containing a minimum of two columns
RA Dec.
where RA and Dec are in decimal degrees
"""
from __future__ import division, print_function
import sys
try:
import numpy as np
except ImportError:
print('You need numpy instal... |
from tapiriik.settings import WEB_ROOT, HTTP_SOURCE_ADDR, GARMIN_CONNECT_USER_WATCH_ACCOUNTS
from tapiriik.services.service_base import ServiceAuthenticationType, ServiceBase
from tapiriik.services.service_record import ServiceRecord
from tapiriik.services.interchange import UploadedActivity, ActivityType, ActivityS... |
from __future__ import print_function
from libpicohttpparser import ffi, lib
NO_SEMANTICS = ["GET", "HEAD", "DELETE"]
class HttpRequest(object):
__slots__ = ('path', 'method', 'version', 'headers', 'body')
def __init__(self, method, path, version, headers):
self.path = path
self.method = m... |
"""File path utilities."""
__all__ = [
'PathGlob',
'get_caller_path',
]
import inspect
from pathlib import Path
from iga.error import IgaError
class PathGlob: pass
def get_caller_path(ancestor):
"""Return the file path of i-th ancestor of the caller.
The zero-th ancestor is the caller, first anc... |
#### PATTERN | WEB #################################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
############... |
import unittest
import os
from robot.utils.argumentparser import ArgumentParser
from robot.utils.asserts import *
from robot.errors import Information, DataError, FrameworkError
USAGE = """Example Tool -- Stuff before hyphens is considered name
Usage: robot.py [options] datafile
Version: <VERSION>
Options:
-d ... |
# Copyright 2014 Hewlett-Packard Development Company, L.P
# 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.... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 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://babel.edgewall.org/wiki/License.
#
# This software consists... |
from .browser import Browser
from urllib.parse import urlparse
from os.path import basename
# Attempt to import nbtools, if it's not installed create a dummy decorator that does nothing
try:
from nbtools import build_ui
except ImportError:
def build_ui(*args, **kwargs):
def decorator(func):
... |
import os
import shutil
from bson.json_util import dumps
import numpy as np
from pax import plugin, exceptions, datastructure
from pax.data_model import Model
from pax.formats import flat_data_formats
class TableWriter(plugin.OutputPlugin):
"""Output data to flat table formats
Convert our data structure to... |
from django.conf import settings
from django.contrib.auth.models import Permission as DjangoPermission
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.db.models.base import Model, ModelBase
from django.template.defaultfilters import slugify
from authority.exception... |
"""Automatically create python package version info based on git date and hash
This simple little module is intended to be included as a git submodule by
other python packages, and used by setup.py on installation. See the README at
<https://github.com/moble/auto_version> for more details and instructions on
how to u... |
# Copyright (c) 2008, Bruce M. Simpson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from reportlab.platypus import (
Paragraph as BaseParagraph,
Spacer,
)
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
styles = getSampleStyleSheet()
snormal = ParagraphStyle('normal')
def Paragraph(t... |
from collatex import *
from xml.dom import pulldom
import re
import glob
from datetime import datetime, date
# import pytz
# from tzlocal import get_localzone
# today = date.today()
# utc_dt = datetime(today, tzinfo=pytz.utc)
# dateTime = utc_dt.astimezone(get_localzone())
# strDateTime = str(dateTime)
now = datetime... |
# Copyright 2015 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 __future__ import print_function
import types
import warnings
from sys import exc_info
from twisted.internet.defer import Deferred, _DefGen_Return, CancelledError
from twisted.python import failure
from twisted.python.util import mergeFunctionMetadata
def _inlineCallbacks(result, g, deferred):
"""
See ... |
from __future__ import division, print_function, absolute_import
from .extraction import extract_sparse, extract, load_classifier
from .color import match_lightness
from . import image
#from .datasets import load_image_list
#from .checker import checker_main
VERSION = (0, 1, 1)
ISRELEASED = False
__version__ = '{0}.{... |
# Copyright 2016 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... |
import pandas as pd
from vectorize_text import vectorize_text
def x_transform(X,data):
# for a range of columns (two ints)
if type(X) == list:
if len(X) == 2:
if type(X[0]) == int:
x = data.ix[:,X[0]:X[1]]
status = 'ok'
# for multiple column index ... |
"""Automated rejection and repair of trials in M/EEG."""
# Authors: Mainak Jas <mainak.jas@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis A. Engemann <denis.engemann@gmail.com>
import os.path as op
from functools import partial
import numpy as np
from s... |
import sys,os,re, math
#[state, S0, Z0, S1, Z1]
# S0:S0/S0,S1/Z1
transition = {}
# Cell: {crossed-out, [(pairs)]}
print("Implication chart calculator v0.1")
print("MIT licensed.")
print("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES O... |
# Copyright 2015 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... |
# Copyright 2015 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... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.model.utils import get_fetch_... |
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.db import models
def get_null_user():
return get_user_model().objects.get_or_create(username='deleted')
class Post(models.Model):
created = models.DateTimeField(auto_now_add=True)
title = models.CharFie... |
# -*- coding: utf-8 -*-
import logging
from threading import Lock
import json
import ssl
import time
import paho.mqtt.client as mqtt
import certifi
from .thing import Thing
logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s',
datefmt='%Y-%m-%dT%H:%M:%S%z')
log = logging.getLogger... |
# We import matplotlib first, because we need control on the backend
# Indeed, if no DISPLAY variable is set, matplotlib 2.0 crashes (at the moment, 05/26/2017)
import pandas as pd
pd.set_option('max_columns', None)
import os
import warnings
if os.environ.get('DISPLAY') is None:
warnings.warn("No DISPLAY variab... |
# We import matplotlib first, because we need control on the backend
# Indeed, if no DISPLAY variable is set, matplotlib 2.0 crashes (at the moment, 05/26/2017)
import os
import warnings
if os.environ.get('DISPLAY') is None:
warnings.warn("No DISPLAY variable set. Using backend for graphics without display (Agg)"... |
"""
Gaussian Mixture Models.
This implementation corresponds to frequentist (non-Bayesian) formulation
of Gaussian Mixture Models.
"""
# Author: Ron Weiss <ronweiss@gmail.com>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Bertrand Thirion <bertrand.thirion@inria.fr>
import warnings
import numpy as... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
__version__ = "0.2.0"
|
from datetime import datetime
from sqlalchemy.exc import IntegrityError
from backend import db
from backend.models import CourseTee, Round, User
from backend.dates import str_to_date
def update_round(round_data):
try:
round_id = round_data.get('round_id')
if round_id:
round_ = Round.q... |
# -*- coding: utf-8 -*-
"""
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These
are supervised learning methods based on applying Bayes' theorem with strong
(naive) feature independence assumptions.
"""
# Author: Vincent Michel <vincent.michel@inria.fr>
# Minor fixes by Fabian Pedre... |
# -*- coding: utf-8 -*-
#
# backend - query/update graphs for the Commons Machinery metadata catalog
#
# Copyright 2014 Commons Machinery http://commonsmachinery.se/
#
# Authors: Artem Popov <artfwo@commonsmachinery.se>
#
# Distributed under an AGPLv3 license, please see LICENSE in the top dir.
import time
import re
i... |
from flask import Flask, session, redirect, url_for, escape, request, jsonify, render_template
from flask.ext.pymongo import PyMongo
from bson.objectid import ObjectId
from sh import find, cd
from pprint import pformat
app = Flask("tianguis")
mongo = PyMongo(app)
@app.route('/')
def index():
if 'username' in s... |
#!/usr/bin/python
import sys
import getopt
import re
from parsimonious.grammar import Grammar
class ISeq(object):
def first():
pass
def rest():
pass
def cons(n):
pass
class List(ISeq):
def __init__(self, head=None, tail=None):
self._head = head
self._tail = ... |
from ..base import ClassifierMixin, RegressorMixin
from ..feature_selection.selector_mixin import SelectorMixin
from .base import BaseLibLinear, BaseLibSVM
class LinearSVC(BaseLibLinear, ClassifierMixin, SelectorMixin):
"""Linear Support Vector Classification.
Similar to SVC with parameter kernel='linear', b... |
from mcapp import app
from decorators import crossdomain, apikey, jsonp
from flask import request, g
import rethinkdb as r
import error
import dmutil
import access
import args
@app.route('/processes/<process_id>', methods=['GET'])
@apikey
@jsonp
def get_process(process_id):
return dmutil.get_single_from_table('pr... |
from ticketing import conf
from django.db import models
def _conn_is_mysql(connection):
return (bool(connection) and
connection.settings_dict['ENGINE'] == 'django.db.backends.mysql')
class BigAutoField(models.AutoField):
def db_type(self, connection):
if _conn_is_mysql(connection):
... |
# Copyright (c) 2013 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.
"""Top-level presubmit script for Skia.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmi... |
"""
This module defines export functions for decision trees.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Dawe <noel@dawe.me>
# Satrajit Gosh <satrajit.ghosh@gmail.com>
# Trevor... |
# Copyright (c) 2013 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.
"""Top-level presubmit script for Skia.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmi... |
# Copyright (c) 2010 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.
"""Top-level presubmit script for Chromium.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presu... |
#coding: UTF-8
from glob import glob
import logging
import os
import re
import sys
import time
import traceback
from slackbot.utils import to_utf8, WorkerPool
logger = logging.getLogger(__name__)
AT_MESSAGE_MATCHER = re.compile(r'^\<@(\w+)\>:? (.*)$')
class MessageDispatcher(object):
def __init__(self, slackcl... |
"""distutils.cmd
Provides the Command class, the base class for the command classes
in the distutils.command package.
"""
# created 2000/04/03, Greg Ward
# (extricated from core.py; actually dates back to the beginning)
__revision__ = "$Id$"
import sys, os, string, re
from types import *
from distutils.errors impor... |
#
# encoding: utf-8
from __future__ import print_function, division
from fontTools.misc.py23 import *
import codecs
import math
import os
import re
from collections import OrderedDict
from datetime import datetime
from .utils import parseAltuni, parseAnchorPoint, parseColor, parseVersion, \
getFo... |
#! /usr/bin/env python3
"""
Usage:
python -m test [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
If no arguments or options are provided, finds all files matching
the pattern "test_*" in the Lib/test subdirectory and runs
them in alphabetical orde... |
#! /usr/bin/env python3
"""Test script for the dbm.open function based on testdumbdbm.py"""
import os
import unittest
import glob
import test.support
# Skip tests if dbm module doesn't exist.
dbm = test.support.import_module('dbm')
_fname = test.support.TESTFN
#
# Iterates over every database module supported by db... |
# Minimal tests for dis module
from test.test_support import run_unittest
import unittest
import sys
import dis
import StringIO
def _f(a):
print a
return 1
dis_f = """\
%-4d 0 LOAD_FAST 0 (a)
3 PRINT_ITEM
4 PRINT_NEWLINE
%-4d 5 LOAD_CONST ... |
"""
Utilities for UConnRCMPy
"""
# System imports
from datetime import datetime
import platform
# Third Party imports
if platform.system() == 'Windows':
import win32clipboard
elif platform.system() == 'Darwin':
import subprocess
def parse_alt_file_name(file_path):
"""Parse the file name of an experimenta... |
import os
import re
import pandas as pd
import numpy as np
from sklearn.externals import joblib
from functools import wraps
from datetime import datetime, timedelta
from flask import g, session, abort, redirect, url_for, request, Flask, render_template, jsonify, flash
from flask_bootstrap import Bootstrap
from titan... |
"""Helpers """
import errno
import json
import logging
import os
import os.path
from hashlib import md5
from filelock import FileLock
try:
FileNotFoundError
except NameError:
class FileNotFoundError(Exception):
pass
LOG = logging.getLogger(__name__)
class DiskCache(object):
"""Disk _cache that ... |
#!/usr/bin/python
"""
CSV SQLite Search
Copyright (C) 2015 Kyle Bloom
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 pro... |
#!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, 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... |
#!/usr/bin/python
import argparse
import difflib
import sys
from gevent import select, server, socket
COLORS = ['\033[1;%dm' % (30+i) for i in range(8)]
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = COLORS
RESET = "\033[0m"
BOLD = "\033[1m"
def proxy(client, address, reference_address, actual_address):
... |
"""
Extends the synchronisation objects of asyncio (e.g. Lock, Event, Condition, Semaphore, Queue) with Channels like in Go.
Channels can be used for asynchronous or synchronous message exchange.
The select() can be used to react on finished await-calls and thus also on sending or receiving with channels.
The helper go... |
"""
awslimitchecker/utils.py
The latest version of this package is available at:
<https://github.com/jantman/awslimitchecker>
##############################################################################
Copyright 2015 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of awslim... |
import argparse
import csv
import multiprocessing
import os
import sys
import time
import cloud_setup
# Change this AMI name to whatever AMI you have set up to run the computational tests
DEFAULT_AMI_NAME = "ami-42d42b54"
def create_instances(job, tags, instance_types, verbose=True):
"""
Simply create an in... |
#!/usr/bin/env python3
# Copyright 2022 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Provides helpers for writing shell-like scripts in Python.
It provides tools to execute commands with similar flexibility to s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2010 Asidev s.r.l.
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 app... |
# This file is part of azulejo
#
# Author: Pedro
#
# This code takes care of setting up or loading configurations.
# Do not edit this file directly. This is only used for bootstrap, once executed,
# this script will write configurations to ~/.azulejorc.js. If you want to
# personalize shortcuts and geometries, edit tha... |
#!/usr/bin/env python
# Copyright 2017 Stanford University, NVIDIA Corporation
#
# 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 r... |
#!/usr/bin/env python2
"""Standardize images."""
from __future__ import division
import argparse
import numpy as np
import scipy as sp
import dwi.dataset
import dwi.mask
import dwi.plot
import dwi.util
def parse_args():
"""Parse command-line arguments."""
p = argparse.ArgumentParser(description=__doc__)
... |
#!/bin/env python3
"""
Manage tasks interactively
Usage:
task_manage.py add
task_manage.py review [<filter>]
Options:
-h, --help Show this screen and exit.
Commands:
add Add new task
review Review tasks
"""
import sys
from docopt import docopt
from tasklib import TaskWarrior,Task
from prompt_... |
import abc
import argparse
import asyncio
from asyncio.subprocess import DEVNULL, PIPE
from collections import defaultdict
import contextlib
import datetime
import enum
import logging
from pathlib import Path
import sys
from typing import Any, Awaitable, Callable, Container, Dict, List, \
NamedTuple,... |
# -*- coding: utf-8 -*-
import re
import redis
import alias.config
email_re = re.compile(r'.*@.*\..*')
cfg = alias.config.AliasConfig()
user_db = redis.StrictRedis(host='localhost', port=6379, db=cfg.user_db)
email_db = redis.StrictRedis(host='localhost', port=6379, db=cfg.email_db)
nym_db = redis.StrictRedis(host=... |
import sublime
import sublime_plugin
import re, sys
import time
import threading
def input_parser(user_input):
m = re.match(r"(.+)/([lcr*()0-9]*)(f[0-9]*)?", user_input)
if m and (m.group(2) or m.group(3)):
regex = m.group(1)
option = m.group(2)
f = m.group(3)
else:
# print... |
#!/usr/bin/env python
#Copyright 2011, 2015, 2016, 2017 (c) Timothy Savannah under LGPLv2, All Rights Reserved. See LICENSE for more information
import glob
import multiprocessing
import os
import re
import shutil
import signal
import sys
import time
import traceback
import types
DEFAULT_MAX_RUNNERS = multiprocessing... |
#!/usr/bin/python
import sys
import argparse
import re
import urllib, urllib2
import time
from collections import namedtuple
audio_args = namedtuple('audio_args',['language','output'])
def audio_extract(input_text='',args=None):
# This accepts :
# a dict,
# an audio_args named tuple
# or arg pa... |
# -*- coding: utf8 -*-
from CharacterModel import CharacterModel
class Character:
@staticmethod
def searchByNameAndPlayer(name, player):
m = CharacterModel.loadByNameAndIdPlayer(
name, player.getModel().getPk()
)
return Character.loadFromModel(m)
@staticmethod
def searchByPlayer(player):
models = Cha... |
#Welcome to Self-Destruct
#Author: BJSGamingchannel
#Programming Language: Python
#Start of program.
import tkinter as Tk
from tkinter import *
import os as OS
import random as rand
import math as M
import time as time
font1 = ("Times New Roman", "30", "bold")
font2 = ("Times New Roman", "25", "bold")
def MasterFun... |
from __future__ import print_function
import unittest
import os
import requests
import time
from os import environ
import json
from deep_eq import deep_eq
import inspect
try:
from ConfigParser import ConfigParser # py2 @UnusedImport
except:
from configparser import ConfigParser # py3 @UnresolvedImport @Reim... |
import numpy as np
import pandas as pd
from scipy import sparse, ndimage as ndi
from scipy.sparse import csgraph
from scipy import spatial
import numba
from .nputil import pad, raveled_steps_to_neighbors
## CSGraph and Numba-based implementation
csr_spec = [
('indptr', numba.int32[:]),
('indices', numba.int... |
import numpy as np
import pandas as pd
from scipy import sparse, ndimage as ndi
from scipy.sparse import csgraph
import numba
from .nputil import pad, raveled_steps_to_neighbors
## CSGraph and Numba-based implementation
csr_spec = [
('indptr', numba.int32[:]),
('indices', numba.int32[:]),
('data', numba... |
#
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 18-09-2017 09:48
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
This toolbox models assembly mapping services between Ensembl and UCSC
"""
import abc
# Application imports
import config_manag... |
import os
import json
import matplotlib
matplotlib.use('TkAgg')
import tkinter as tk
import tkinter.filedialog
from tkinter import ttk
import click
from . import pre, pipe, __version__
STANDARD_MARGIN = (3, 3, 12, 12)
class Launch(tk.Tk):
def __init__(self, params_dict=None):
super().__init__()
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
class SQL:
"SQL front end."
version = '0.9'
def __init__(self, backend=None, *args, **kwargs):
if backend and self.chooseBackend(backend):
try:
self.connect(*args, **kwargs)
self.ATTACHED = True
exce... |
#!/usr/bin/env python
# coding: UTF-8
# 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 __future__ import print_function
import argparse
import os.path
import re
i... |
try:
from functools import total_ordering
except ImportError:
# Use Python 2.6 port
from total_ordering import total_ordering
__version__ = '1.1'
@total_ordering
class Infinity(object):
def __init__(self, positive=True):
self.positive = positive
def __neg__(self):
return Infinit... |
from __future__ import unicode_literals
from django.db import models
from django.core.exceptions import ValidationError
import urlparse
class Target(models.Model):
'''
A particular static target endpoint that the attack can apply to
e.g. gmail csrf, facebook message
'''
endpoint = models.CharFiel... |
# -*- coding: utf-8 -*-
import urllib2
import json
api_key='x57tjyenbds4489ffjmcgdx3'
data = """
Foreign military forces appear to have carried out a pre-dawn raid on a southern Somalian coastal town, apparently in pursuit of "a high-profile target" linked to the militant al-Shabaab group that was behind last month'... |
import logging
from tor.helpers.flair import flair
from tor.helpers.flair import flair_post
from tor.helpers.misc import _
from tor.helpers.reddit_ids import add_complete_post_id
from tor.helpers.reddit_ids import clean_id
from tor.helpers.reddit_ids import is_valid
from tor.strings.posts import rules_comment_unknown_... |
#!/usr/bin/env python
# Copyright (c) 2013 mogoweb. All rights reserved.
# Copyright (c) 2013 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script will do:
1. Setup src's git initialization.
2. Place .gclient f... |
import torch
import math
def make_grid(tensor, nrow=8, padding=2):
"""
Given a 4D mini-batch Tensor of shape (B x C x H x W),
or a list of images all of the same size,
makes a grid of images
"""
tensorlist = None
if isinstance(tensor, list):
tensorlist = tensor
numImages = ... |
#!/usr/bin/env python
import sys, sniper_lib
def generate_simout(jobid = None, resultsdir = None, output = sys.stdout, silent = False):
try:
res = sniper_lib.get_results(jobid = jobid, resultsdir = resultsdir)
except (KeyError, ValueError), e:
if not silent:
print 'Failed to generated sim.out:', e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.