src stringlengths 721 1.04M |
|---|
#!/usr/local/bin/python
"""
Creating the report of top 50 domains for 30 days
It is assumed that mailing table is repopulated every day.
The report will display the top 50 domain sorting with their growth percentage.
"""
import MySQLdb
import datetime
mysqlconfig = {'host': 'localhost',
'username': 'r... |
# 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 u... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
import re
class Solution:
def recoverFromPreorder(self, S: str) -> TreeNode:
items = list(map(lambda x: [len(x[0]), x[1]], re.findall(r'(-*)(\... |
import datetime
import json
import os
import re
import tempfile
from collections import OrderedDict
from pprint import pformat
from infra_buddy.aws import s3
from infra_buddy.context.artifact_definition import ArtifactDefinition
from infra_buddy.context.monitor_definition import MonitorDefinition
from infra_buddy.cont... |
import email
import email.utils
from django.template.loader import get_template
from django.template import Context
from django.core.mail import EmailMessage, send_mail
from detention_notifier.models import Detention, DetentionMailer, DetentionCC, DetentionTo
from academics.models import AcademicYear, Enrollment, Stu... |
# encoding: utf-8
"""
RESTful API pipelines resources
--------------------------
"""
import logging
from flask_restplus import Resource, fields
from app.extensions.api import Namespace, abort, http_exceptions
from app.modules.common import *
from app.modules.common.pipelines import PipelineNotFoundError
log = loggin... |
import distutils.core
from distutils.command.install import install
import subprocess
class PyenvInstall(install):
def run(self):
print(subprocess.check_output(['bash', 'bin/pyenv-installer']))
with open('README.rst') as file:
long_description = file.read()
distutils.core.setup(
version='2015011... |
#!/usr/bin/env python
import re
import threading
import time
from datetime import datetime
import pytz
import logging
logging = logging.getLogger('alarmpi')
class Logs():
def __init__(self, wd, logfile, timezone):
self.wd = wd
self.logfile = logfile
try:
self.mytimezone = py... |
from typing import Sequence, Union, Any
from collections import OrderedDict
from numpy import Inf, exp
import pandas as pd
from hbayesdm.base import TaskModel
from hbayesdm.preprocess_funcs import dd_single_preprocess_func
__all__ = ['dd_hyperbolic_single']
class DdHyperbolicSingle(TaskModel):
def __init__(sel... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
from test_framework.mininode import *
from test_framework.test_framework imp... |
import os,sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)
import numpy as np
import matplotlib.pyplot as plt
from constants import Constants
import Icarus.Experiment as Experiment
if __name__ == "__main__":
"""
Runs power dependance.
"""
constants = ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 25 13:07:42 2015
@author: hanbre
"""
from __future__ import print_function
from math import *
import numpy as np
R=6378*1000 #Earth's radius
lat1=radians(12.31579) #latitude and longitude boundaries for the calculation
lat2=radians(16.10526)
lon1=268.5
lon2=272.5
P=29.7... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-23 23:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('isisdata', '0023_auto_20160621_1726'),
]
operations... |
import unittest
from hamcrest import *
from backdrop.read.validation import ParameterMustBeOneOfTheseValidator, MondayValidator, FirstOfMonthValidator, ParamDependencyValidator
# TODO: looked around and couldn't see any other validator tests
class TestValidators(unittest.TestCase):
def test_value_must_be_one_of... |
# Project: lnotify
# Description: A libnotify script for weechat. Uses
# subprocess.call to execute notify-send with arguments.
# Author: kevr <kevr@nixcode.us>
# License: GPL3
#
# 0.1.2
# added option to display weechat's icon by tomboy64
#
# 0.1.3
# changed the way that icon to WeeChat notification is specified.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pwn import *
#host = "10.211.55.6"
#port = 8888
host = "13.112.128.199"
port = 1337
for i in range(10):
r = remote(host,port)
def add(name,size,content):
r.recvuntil(":")
r.sendline("1")
r.recvuntil(":")
r.sendline(name)
... |
# Copyright 2020 - Nokia Networks.
#
# 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 a... |
# Copyright 2017 CodiLime
#
# 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, softwar... |
# -*- coding: utf-8 -*-
"""
pyte.screens
~~~~~~~~~~~~
This module provides classes for terminal screens, currently
it contains three screens with different features:
* :class:`~pyte.screens.Screen` -- base screen implementation,
which handles all the core escape sequences, recognized by
... |
#!/usr/bin/env python3
import argparse
import logging
import os
from lib import yn
def main():
args = parse_args()
if yn.URLBASE in args.start:
# record more
proceed_url(args.start)
else:
proceed_user(args.start, live_yes=args.yes, only_live=args.onlylive)
def proceed_user(usern... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Midokura Japan K.K.
# Copyright (C) 2013 Midokura PTE LTD
# 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 th... |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo 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 the Software with... |
from parametrix.core.signal_models import BaseSignalModel
import numpy as np
import scipy.linalg as lg
from scipy.stats import multivariate_normal
class M_Bayesian_L(BaseSignalModel):
""" Bayesian Linear Signal Model (Eq 10.26)[KAY93]_
.. math::
\\textbf{y}=\\textbf{H}\\textbf{x}... |
# -*- coding: utf-8 -*-
# [HARPIA PROJECT]
#
#
# S2i - Intelligent Industrial Systems
# DAS - Automation and Systems Department
# UFSC - Federal University of Santa Catarina
# Copyright: 2006 - 2007 Luis Carlos Dill Junges (lcdjunges@yahoo.com.br), Clovis Peruchi Scotti (scotti@ieee.org),
# Guilh... |
import os
from django.core.management.base import BaseCommand, CommandError
#from django.core.files import File as DjangoFile
from apps.cms.models import File
# TODO
# - remove stale files. or just pipe to xargs rm
# - rm: handle more than one arg
# /home/torkel/dev/python/examples/argparse2.py
class Command(BaseComm... |
"""
Used for testing the service locally
"""
import argparse
import hashlib
import hmac
import os
import requests
import json
GIT_SECRET = os.getenv("GIT_SECRET", "")
PORT_NUM = os.getenv("PORT_NUM", "43301")
IP_ADDRESS = os.getenv("IP_ADDRESS", "127.0.0.1")
def gen_signature(data):
"""
Generate the signatu... |
# -*- coding: utf-8 -*-
import os
import sys
from gluon import current
from gluon.storage import Storage
from s3compat import reload
__all__ = ("PluginLoader",
)
# Name of the plugin directory in modules
PLUGINS = "plugins"
# Module names to ignore when scanning for plugins
IGNORE = ("skeleton", "__ini... |
__author__ = 'chris'
import sys
import argparse
import platform
from twisted.internet import reactor
from twisted.python import log, logfile
from twisted.web.server import Site
from twisted.web.static import File
from daemon import Daemon
import stun
import requests
from autobahn.twisted.websocket import listenWS
imp... |
#!/Users/polizom/Django/pyfolio/venv/bin/python2.7
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
try:
from tkinter import *
except ImportError:
from Tkinter import *
from PIL import Image, ImageTk
import sys
# -----------------------------------------------------------------... |
import os
import sys
from Bio import Seq
from Bio import SeqIO
from Bio import SeqRecord
import pandas as pd
import numpy as np
import ms_module as ms
import re
############################
from Bio import Entrez
from Bio import SeqIO
from StringIO import StringIO
import time
from urllib2 import HTTPError # for Python... |
# -*- encoding: utf-8 -*-
from bluepy import btle
import logging
from math import isnan
class MiPlant(object):
def __init__(self, address, interface_index=0):
'''
Initializes the MiPlant -object.
Parameters
----------
address : string
The MAC-address of the dev... |
"""Commands for installer scripts"""
import multiprocessing
import os
import stat
import shutil
import shlex
import json
from gi.repository import GLib
from lutris.installer.errors import ScriptingError
from lutris import runtime
from lutris import settings
from lutris.util import extract, disks, system
from lutris.... |
"""
Test the importer views to make sure they work.
"""
from __future__ import unicode_literals
import json
import logging
import os
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.urlresolvers import resolve
import ui.urls
from learningresources.models import... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para yaske
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re, sys, urllib, urlparse
from core import config
... |
import datetime
import logging
import math
import random
import pandas as pd
logging.basicConfig(level=logging.INFO)
INPUT_FIELDS = ('holiday', 'workingday', 'temp', 'atemp', 'humidity',
'windspeed', 'hour', 'day_of_year', 'day_of_week')
PERIODICS = ('hour', 'day_of_year', 'day_of_week')
RESULT_FIE... |
# Copyright 2017 The Armada Authors.
#
# 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 w... |
#!/usr/bin/env python
"""This is the GRR client installer module.
GRR allows several installers to be registered as plugins. The
installers are executed when the client is deployed to a target system
in their specified order (according to the registry plugin system).
Installers are usually used to upgrade existing cl... |
#!/usr/bin/env python
# The software pyradbar is a bunch of programs to compute the homology of
# Sullivan diagrams.
# Copyright (C) 2015 - 2017 Felix Boes
#
# This file is part of pyradbar.
#
# pyradbar is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/logicNodeText.ui'
#
# Created: Sat Jul 25 12:16:46 2015
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
excep... |
#!/usr/bin/env python
"""
TODO: make it sparse.
Created on Thu Jan 16 15:09:36 2014
@author: Oren Freifeld
Email: freifeld@csail.mit.edu
"""
from of.utils import ObsoleteError
raise ObsoleteError
import numpy as np
from of.utils import *
#from scipy import sparse
def create_verts_and_H(nC, cells_multiidx, cells_ve... |
# 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 u... |
#
# 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 u... |
'''
The MIT License
Copyright (c) Bo Lopker, http://blopker.com
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, ... |
#!/usr/bin/env python
from appkit.api.v0_2_4.app import *
import os
import unittest
class AppKitUnitTest(unittest.TestCase):
def setUp(self):
app = App(__file__)
@app.route('^/$')
def index():
return '''
<html>
<head><title>Test App</tible></he... |
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp import fields
from openerp import models
class ProductTemplate(models.Model):
_inherit = 'product.template'
def _get_default_section_id(self):
return self.env.user.default_section_id
section_id = fields.Many2one('crm.case.sect... |
#!/usr/bin/env python
from __future__ import print_function
import os
from argparse import ArgumentParser
from contextlib import contextmanager
from copy import deepcopy
from difflib import ndiff
from pprint import pformat
import sys
import yaml
from jujupy import client_from_config
from utility import (
add_ar... |
# -*- coding: utf-8 -*-
import scrapy
from AjkSpider.items import AjkZsspiderItem
class AjkzsspiderSpider(scrapy.Spider):
name = "AjkZsSpider"
allowed_domains = ["zs.fang.anjuke.com"]
start_urls = ['http://zs.fang.anjuke.com/']
def parse(self, response):
subSelector = response.xpath('//div[@cl... |
# Copyright 2018 - Nokia
#
# 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... |
#!/usr/bin/env python3
import abc
import argparse
import distutils.util
import enum
import functools
import glob
import itertools
import logging
import multiprocessing
import os
import pathlib
import pyudev
import re
import shutil
import subprocess
import sys
import urllib.request
import yaml
import platform
import sh... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module is to make mobile test more easily
"""
from __future__ import absolute_import
import os
import sys
import signal
import pkg_resources
try:
version = pkg_resources.get_distribution("atx").version
except pkg_resources.DistributionNotFound:
version =... |
#!/usr/bin/env python
# class to convert/process modis data
#
# (c) Copyright Luca Delucchi 2010
# Authors: Luca Delucchi
# Email: luca dot delucchi at iasma dot it
#
##################################################################
#
# This MODIS Python class is licensed under the terms of GNU GPL 2.
# This pro... |
import numpy as np
import cv2
import time
import helloworld
def countNonZero(sum, i_j, x_y = None):
if x_y is None:
i = i_j[0]
j = i_j[1]
if i<0 or j<0:
return 0
return sum[i,j]
else:
i = i_j[0]
j = i_j[1]
x = x_y[0]
y = x_y[1]
... |
import os
import numpy as np
import tensorflow as tf
from sklearn import metrics
checkpoint_dir = "/tmp/voice/"
X_test = np.load("X_test.npy")
y_test = np.load("y_test.npy")
print("Test set size:", X_test.shape)
# To compute on test set, if you have trained the model, you should have
# a graph.pb file, we're going ... |
##########################################################################
# Copyright (c) 2012-2016 ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstr 6, CH... |
# -*- coding: utf-8 -*-
############################################################################
#
# Copyright (C) 2008-2015
# Christian Kohlöffel
# Vinzenz Schulz
# Jean-Paul Schouwstra
#
# This file is part of DXF2GCODE.
#
# DXF2GCODE is free software: you can redistribute it and/or mod... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... |
from django.shortcuts import render
# Create your views here.
from .models import Book, Author, BookInstance, Genre, Language
def index(request):
"""
View function for home page of site.
"""
# Generate counts of some of the main objects
num_books=Book.objects.all().count()
num_instances=BookI... |
import sys, os, csv, pprint, math
import argparse
import numpy as np
import random
import shutil
import time
## uncomment when running under CLI only version ##
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import scipy.stats
from matplotlib.colors im... |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# 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
# lis... |
from scout.build.user import build_user
def test_delete_user(adapter):
institutes = ["test-1", "test-2"]
## GIVEN an adapter with two users
for i, ins in enumerate(institutes, 1):
user_info = {
"email": "clark.kent{}@mail.com".format(i),
"id": "clke0" + str(i),
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Manufacturing',
'version': '2.0',
'website': 'https://www.odoo.com/page/manufacturing',
'category': 'Manufacturing/Manufacturing',
'sequence': 16,
'summary': 'Manufacturing Orders & BO... |
# Copyright 2017 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
#!/usr/bin/env python
# Copyright (C) 2017,2019, Yu Sheng Lin, johnjohnlys@media.ee.ntu.edu.tw
# This file is part of Nicotb.
# Nicotb 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 ... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2018 CERN.
#
# INSPIRE 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 ... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para wstream.video
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# by DrZ3r0
# ------------------------------------------------------------
import re
import time
from core import ... |
from __future__ import absolute_import
from typing import Text, Union, Optional, Dict, Any, List, Tuple
import os
import simplejson as json
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from django.shortcuts import redirect
from django.conf import settings
from ... |
# encoding: utf-8
def glamsTemplate(article, username=None, resources='', rightbar=''):
'''Wraps an article string in the html template'''
if username:
userLogin="""<a href="/home">""" + username +"""</a>"""
else:
userLogin="""<a href="/home/login/">Login</a>"""
webpage="""<!DOCTYPE HTM... |
"""rename tenant id indexes
Revision ID: 79b768afed65
Revises: 271cce54e15b
Create Date: 2015-05-20 21:39:19.348638
"""
# revision identifiers, used by Alembic.
revision = '79b768afed65'
down_revision = '271cce54e15b'
from alembic import op
import sqlalchemy as sa
from neutron.api.v2 import attributes as attr
_I... |
from pylayers.simul.link import *
from pylayers.antprop.channel import *
from pylayers.antprop.antenna import *
from pylayers.util.geomutil import *
plt.close('all')
# parameters settings RT
fmin = 31.8 # GHz
fmax = 33.4 # GHz
BGHz = fmax - fmin # bandwidth in GHz
Nf = 10001 ... |
import os
from .exceptions import *
GLOBAL_OPTS = set([
'help_is_utf8', 'mid', 'marking', 'asis', 'force', 'nolocks', 'nomodcheck', 'nocurdir',
'nobackups', 'nodeadjoe', 'break_hardlinks', 'break_links', 'lightoff', 'exask', 'beep',
'nosta', 'keepup', 'pg', 'undo_keep', 'csmode', 'backpath', 'floatmouse',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Requirements:
pip install gitpython click ubelt
"""
import re
from os.path import exists
from os.path import join
from os.path import dirname
from os.path import abspath
import ubelt as ub
import functools
class ShellException(Exception):
"""
Raised when s... |
'''
Created on Aug 26, 2013
Wrappers around tvtumbler access.
@author: dermot@buckley.ie
'''
import time
from sickbeard import helpers
from sickbeard import logger
try:
import json
except ImportError:
from lib import simplejson as json
UPDATE_INTERVAL = 432000 # 5 days
SHOW_LOOKUP_URL = 'http://show-api.t... |
# -*- coding: utf-8 -*-
import string
from datetime import datetime
def sanitize(buf):
return filter(lambda x: x in string.printable, buf)
def handle_userJoined(bot, user, channel):
"""Someone Joined, lets salute him"""
dbCursor.execute("SELECT * FROM tell WHERE tell_to = '%s' AND tell_channel = '%s'" ... |
import argparse
from coalib.misc import Constants
def default_arg_parser(formatter_class=None):
formatter_class = formatter_class or argparse.RawDescriptionHelpFormatter
arg_parser = argparse.ArgumentParser(
formatter_class=formatter_class,
prog="coala",
description="coala is a simple... |
# -*- coding: utf-8 -*-
"""
Production Configurations
- Use Redis for cache
"""
from __future__ import absolute_import, unicode_literals
from .common import * # noqa
# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/r... |
# -*- coding: utf8 -*-
import cv2
import numpy as np
import glob
import os
ASSETS_PATH = os.path.join(os.path.dirname(__file__), 'assets', 'calibrate')
calibrate_files = []
def preprocess_calibrate():
"""preprocess calibrate."""
global calibrate_files
for file in glob.glob(os.path.join(ASSETS_PATH, 'l... |
#!/usr/bin/env python
#coding:utf-8
# Author: mozman --<mozman@gmx.at>
# Purpose: test elementfactory
# Created: 15.10.2010
# Copyright (C) 2010, Manfred Moitzi
# License: MIT License
import sys
import unittest
from svgwrite.elementfactory import ElementFactory
from svgwrite.params import Parameter
class MockFactor... |
"""
pyexcel.plugins.sources.file_output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Representation of output file sources
:copyright: (c) 2015-2017 by Onni Software Ltd.
:license: New BSD License
"""
from pyexcel.internal import RENDERER
from pyexcel.source import AbstractSource
from pyexcel.plugins import... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'pyramid',
'pyramid_chameleon',
'pyramid_d... |
from mifiel import Document
from mifiellib import BaseMifielCase
import responses
import os.path
try:
import simplejson as json
except ImportError:
import json
class TestDocument(BaseMifielCase):
def setUp(self):
super(TestDocument, self).setUp()
self.doc = Document(self.client)
def mock_doc_respons... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Infrastructure
# Copyright (C) 2014 Ingenieria ADHOC
# No email
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License... |
# coding: utf-8
import datetime
import csv
from django.template import Context, loader
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.conf import settings
from django.shortcuts import render, get_list_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.views.d... |
"""Key handling
"""
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import ec, rsa, dsa
from cryptography.hazmat.primitives.hashes import SHA256, SHA384, SHA512
from cryptography.hazmat.primitives.serialization import (Encoding, PublicFormat)
from .ex... |
"""
Django settings for the admin project.
"""
import os
from urlparse import urlparse
from website import settings as osf_settings
from django.contrib import messages
from api.base.settings import * # noqa
# TODO ALL SETTINGS FROM API WILL BE IMPORTED AND WILL NEED TO BE OVERRRIDEN
# TODO THIS IS A STEP TOWARD INTEG... |
from django.shortcuts import render, redirect
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from users.models import AllUsers, ACL
from status.models import Status
from task.models import Task
im... |
import logging
import copy
from esgfpid.utils import loginfo, logdebug, logtrace, logerror, logwarn, log_every_x_times
from .exceptions import UnknownServerResponse
LOGGER = logging.getLogger(__name__)
LOGGER.addHandler(logging.NullHandler())
'''
=========
Confirmer
=========
The confirmer is responsible for handlin... |
from django.shortcuts import render
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt
from base.views_support import HttpJSONResponse
from base.models import Rove... |
import json
import os
import pprint
import random
import string
import struct
import sys
import time
import pika
_verbose = True
_broker_host = "127.0.0.1"
_broker_port = 21688
_broker_user = "guest"
_broker_password = "guest"
_broker_virtual_host = "/"
_handlers_exchange_identifier = "mosaic-http-requests"
_handle... |
import os
from lxml import etree
from click.testing import CliRunner
from pyqtcli.cli import pyqtcli
from pyqtcli.qrc import read_qrc
from pyqtcli import verbose as v
from pyqtcli.test.verbose import format_msg
def test_new_default(config):
runner = CliRunner()
result = runner.invoke(pyqtcli, ["new", "qrc",... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
import re
from functools import partial
from urllib import unquote, q... |
from future import standard_library
standard_library.install_aliases()
from builtins import object
import urllib.parse
import requests
import sys
PY3 = sys.version_info[0] == 3
from requests_oauthlib import OAuth1
from requests.exceptions import TooManyRedirects, HTTPError
class TumblrRequest(object):
"""
A... |
from sys import version_info
from setuptools import find_packages, setup
dependencies = [
"cryptography",
"Jinja2",
"Mako",
"passlib",
"pyyaml",
"requests >= 1.0.0",
"six",
]
if version_info < (3, 2, 0):
dependencies.append("futures")
setup(
name="bundlewrap",
version="3.3.0"... |
# Copyright 2014 NEC Corporation.
# 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... |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... |
import DXFtoSegments
import pdb
import dxfgrabber
import pickle
import sys
from c2d_premesh_v5 import *
import os
'''Jeff's notes:
Changed "Nodes" to "nodes" for Pexpect
Added path control for working directory
'''
if 'darwin' in sys.platform:
my_os = 'osx'
import pexpect
elif 'linux' in sys.p... |
#!/usr/bin/env python2
from setuptools import setup, find_packages
from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
import distutils.cmd
from distutils.command.build import build as _build
import os
import subprocess
class BuildSupport(distutils.cmd.Command):
"""A custom command to build the supp... |
def dot_product(self, left_column_names,right_column_names,dot_product_column_name,default_left_values=None,default_right_values=None):
"""
Calculate dot product for each row in current frame.
Parameters
----------
:param left_column_names: (List[str]) Names of columns used to create the left vect... |
import csv
import numpy as np
from sklearn import preprocessing
from sklearn.svm import LinearSVC
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import chi2
from sklearn.decomposition import PCA
def absHelper(data):
for i in range(len(data)):
for j in range(len(data[0])):... |
# source: https://github.com/yotsuba1022/web-crawler-practice/blob/master/ch4/tw_stock_exchange.py
import requests
import time
TWSE_URL = 'http://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json'
def get_web_content(stock_id, current_date):
resp = requests.get(TWSE_URL + '&date=' + current_date + '&stock... |
from codecs import open
import os.path
from setuptools import setup, find_packages
import sys
################################################################### yapf: disable
NAME = 'logfury'
VERSION = '0.1.2'
AUTHOR = 'Pawel Polewicz'
AUTHOR_EMAIL = 'p.polewicz@gmail.com'
DESCRIPTION = 'Toolki... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.