src stringlengths 721 1.04M |
|---|
import ROOT
from itertools import izip
from matplotlib import cm
from rootpy.plotting.style.atlas.labels import ATLAS_label
from rootpy.memory.keepalive import keepalive
from .. import ATLAS_LABEL
def set_colors(hists, colors='jet'):
if isinstance(colors, basestring):
colors = cm.get_cmap(colors, len(hist... |
#!/usr/bin/env python
'''Generate a static version of oldnyc.org consisting entirely of JSON.'''
import chardet
from collections import defaultdict, OrderedDict
import csv
import json
import record
import re
from distutils.dir_util import copy_tree
from shutil import copyfile
import subprocess
import sys
import time
i... |
def p1(inp):
r = dict.fromkeys('abcd', 0)
r['a'] = 12
def getval(x):
return r[x] if x in r else int(x)
instrs = []
for line in inp:
parts = line.strip().split()
cmd = parts[0]
instrs.append([cmd, parts[1:]])
i = 0
c = 0
import pudb; pu.db # NOQA
wh... |
# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os
import cStringIO
from calibre.devices.usbms.driver import USBMS
HTC_BCDS = [0x100, 0x0222, 0x0224, 0x0226, 0x227, 0x228, 0x229, 0x0231, 0x9999]
class ANDROID(... |
from statsmodels.stats.outliers_influence import variance_inflation_factor as vif
import numpy as np
import sys
## Apply vif on every column of the matrix M
def vif_coeffs(M):
'''
Description:
Compute VIF on every column of the matrix M
Input arugments:
* M: 2D np.ndarray
Return:
* A list of VIF for each col... |
#!/usr/bin/env python2.7
import os
import time
import logging
import threading
from subprocess import Popen, PIPE
class External(threading.Thread):
def __init__(self, name="", args = [], log_name = "external", pid = 0, log_level = logging.INFO, wd=None):
threading.Thread.__init__(self)
self.n... |
try:
from __pypy__ import identity_dict as idict
except ImportError:
idict = None
from UserDict import DictMixin
class IdentityDictPurePython(object, DictMixin):
__slots__ = "_dict _keys".split()
def __init__(self):
self._dict = {}
self._keys = {} # id(obj) -> obj
def __getitem_... |
import unittest
import pokeher.cards as cards
import pokeher.constants as C
from arena.poker import PokerHand, Showdown
from arena_mocks import ScriptedArena
class BettingRoundTest(unittest.TestCase):
""""Tests that PokerHand can adjucate a full betting round"""
def build_run_hand(self, actions, all_ins=[], ... |
# riseset.py - Wrapper for celestial body rise/transit/set times
# Copyright (C) 2016 Shiva Iyer <shiva.iyer AT g m a i l DOT c o m>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either vers... |
from useragents import search_strings
class Middleware(object):
@staticmethod
def process_request(request):
"""Adds a "mobile" attribute to the request which is True or False
depending on whether the request should be considered to come from a
small-screen device such as a phone... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# 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 following d... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/tedlaz/python_work/meta_manager/fmeta_main2.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
exce... |
import urllib
import socket
import sys
import os
import config
import sqlite3
import json
db = "index.db"
table = "local"
# crawl a directory and find all files and folders
def find_files():
index = []
for path, dirs, files in os.walk(config.shared_directory):
for f in files:
if not f.star... |
# -*- coding:utf-8 -*-
import matplotlib.pyplot as plt
# 定义文本框和箭头格式
decisionNode = dict(boxstyle="round4", color='#3366FF') #定义判断结点形态
leafNode = dict(boxstyle="circle", color='#FF6633') #定义叶结点形态
arrow_args = dict(arrowstyle="<-", color='g') #定义箭头
#绘制带箭头的注释
def plotNode(nodeTxt, centerPt, parentPt, n... |
import re
import unittest
import datetime, time
import tempfile
import pickle
from sys import path, stdout
import os
import shutil
# if '../../' not in path:
# path.insert(0, '../../')
from BaseTestCloud import BaseTestCloud
from DKCloudCommandRunner import DKCloudCommandRunner
from DKActiveServingWatcher import *
... |
def swap(m, coord):
i0, j0 = coord[-1]
tmp = m[i0][j0]
for i, j in reversed(coord[:-1]):
m[i0][j0] = m[i][j]
i0, j0 = i, j
m[i0][j0] = tmp
def side_rotate(m, idx, size):
for k in range(size - 1):
coord = [(idx, idx + k),
(idx + k, idx + size - 1),
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Sof... |
#
# SecureDrop whistleblower submission system
# Copyright (C) 2017 Loic Dachary <loic@dachary.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... |
# Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
#/
# A rule context is a record of a single rule invocation. It knows
# which context invoked it, if any. If there is no paren... |
import asyncio
from collections import defaultdict
from functools import wraps
from pengbot import logger
from pengbot.context import Context
from pengbot.utils import isbound
class UnknownCommand(Exception):
pass
class BaseAdapter:
handlers = []
signals = {}
running = False
name = None
loo... |
from __future__ import division
'''
This data class is for working with similarity/dissimilarity matrices
'''
__author__ = ["Luke Chang"]
__license__ = "MIT"
import os
import pandas as pd
import numpy as np
import six
from copy import deepcopy
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.mani... |
# -*- coding: utf-8 -*-
"""A model of Infrastructure Virtual Machines area of CFME. This includes the VMs explorer tree,
quadicon lists, and VM details page.
"""
import re
from collections import namedtuple
from copy import copy
import attr
import fauxfactory
from navmazing import NavigateToAttribute
from navmazing i... |
from contextlib import contextmanager
import linecache
import os
from io import StringIO
import re
import sys
import textwrap
import unittest
from test import support
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.test_warnings.data import stacklevel as warning_tests
import w... |
from datetime import datetime
import pycron
from pytz import utc
import pendulum
import arrow
import udatetime
from delorean import Delorean
def test_minute():
def run(now):
assert pycron.is_now('* * * * *', now)
assert pycron.is_now('9 * * * *', now)
assert pycron.is_now('*/1 * * * *', no... |
"""
Models for User Information (students, staff, etc)
Migration Notes
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration student --auto description_of_... |
# Santa's Run - a Christmas game
# By Mike Cook - October 2020
import pygame
import time
import os
import random
import RPi.GPIO as io
def main():
global restart, santaState, coverTrack, santaDistance, targetRect, disInc
global santaL_R, delivered, santaHeight, drop, lastDistance, throwCount, distance
ini... |
import urllib2
import csv
from pygtrie import Trie
from pygtrie import PrefixSet
import pickle
import os
def _create_trie():
tsvs = ["https://www2.census.gov/topics/genealogy/1990surnames/dist.female.first",
"https://www2.census.gov/topics/genealogy/1990surnames/dist.male.first"]
# "https://www2.census.gov/topi... |
import six
import numpy as np
import xml.etree.ElementTree as et
import xml.dom.minidom as minidom
from . import utilities
# Note: matplotlib.delaunay is required for interpolation and triangulation.
# If it isn't available
class swfault(object):
def __init__(self, arg):
if isinstance(arg, six.string_types... |
import re
import urllib2
import json
def pager_response(text):
"""!oncall|!pager (add "link" for url to pager rotation page)"""
match = re.match('!oncall|!pager', text, re.IGNORECASE)
if not match:
return False
if "link" in match.string:
return "https://corpwiki.appnexus.com/x/xxsaAQ"
... |
# exercise 11
name = input("What's your name? ") # take the name from the keyboard
print ("Your name is {}".format(name))
# exercise 15
file_again = input("Type the filename again: > ") # read the file's name from the keyboard
txt_again = open(file_again) # open the file
print (txt_again.read()) # print the file's co... |
#########
# Copyright (c) 2013 GigaSpaces Technologies 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 the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
######################################################################################################################
# json Exporter module for WebTools
#
# Author: dane22, a Plex Community member
#
######################################################################################################################
... |
from __future__ import unicode_literals
import base64
import io
import itertools
import os
import time
import xml.etree.ElementTree as etree
from .common import FileDownloader
from .http import HttpFD
from ..compat import (
compat_urlparse,
)
from ..utils import (
struct_pack,
struct_unpack,
format_by... |
#!/usr/local/bin/python
#
# Simple Python (2.7.2) program that fetches bookmarks from your delicious account
# and imports it into your pinboard account.
#
# Created this (my first python program, so it probably sucks, but it works!) after
# getting repeated 'read failed' errors when trying to import my delicious ... |
#!/usr/bin/env python
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
created/forked from conferences.py by wesc on 2014 may 24
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
import httplib
import endpoints
from protor... |
"""
Methods for importing mediawiki pages, images via the simplemediawki
wrapper to the MediaWiki API.
Copyright (C) 2014 Angus Gratton
Licensed under New BSD License as described in the file LICENSE.
"""
from __future__ import print_function, unicode_literals, absolute_import, division
import simplemediawiki, simplej... |
#!/usr/bin/env python
#
# developed by Sergey Markelov (2013)
#
import random
import subprocess
from config import Config, BingRewardsReportItem
class EventsProcessor:
"""
Processes events declared in config.xml
"""
OK = 0
RETRY = 1
def __init__(self, config, reportItem):
if conf... |
# The Hazard Library
# Copyright (C) 2012-2021 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#... |
import json
import os
from distutils.dir_util import copy_tree
from shutil import copyfile, rmtree
import re
import requests
from datetime import datetime
from csproj_utils import *
from file_utils import *
class sample_metadata:
'''
This class represents a sample.
Use populate_from_* to populate from cont... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Joseph Gomes"
__copyright__ = "Copyright 2017, Stanford University"
__license__ = "MIT"
import os
import sys
import deepchem as dc
import numpy as np
import tensorflow as tf
sys.path.append("..... |
from __future__ import absolute_import
from datetime import datetime
import logging
import os
import os.path
import subprocess
import yaml
from cpcommon import cd
from .task import Task
class Package(object):
def src_path(self, *path):
return os.path.join(self.src_directory, *path)
def __init__(self, nam... |
# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from optparse import OptionParser
import os
import shlex
import shutil
import subprocess
import sys
import tempfile
import urllib
impo... |
# -*- coding: utf-8 -*-
# Copyright 2016-2020 The pyXem developers
#
# This file is part of pyXem.
#
# pyXem 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 optio... |
import argparse
import os
from os import path
import subprocess
import sys
import socket
import time
import warnings
from math import floor
import gc # garbage collector
import smtplib
import numpy as np
from scipy import signal, linalg
from matplotlib import pyplot as plt
import GPy
import classes as cls
import util... |
"""
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-
zero elements.
For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].
Note:
You must do this in-place without making a copy of the array.
Minim... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... |
import pysam
import argparse
import sys
import logging
import os
from asyncore import read
parser = argparse.ArgumentParser(description="Build soft clip position distribution in BAM file.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
DEBUG=False
NOT_DEBUG = not ... |
import abc
import logging
import subprocess # noqa: S404
from django.utils.functional import cached_property
from .structures import Quotas
logger = logging.getLogger(__name__)
class BatchError(Exception):
pass
class BaseBatchClient(metaclass=abc.ABCMeta):
def __init__(self, hostname, key_path, username... |
import config
import robinhood
import time
import httputil
import json
def get_api_request(request):
return httputil.get_json_object_from_url(config.SS_API_ENDPOINT + request)
def post_api_request(request, obj):
return httputil.post_object_to_url(config.SS_API_ENDPOINT + request, json.dumps(obj))
def get_... |
#
# Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 3 of the Lice... |
#!/usr/bin/env python2
#
# This file is part of Archivematica.
#
# Copyright 2010-2012 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation,... |
"""Stub file for methods invoked on strings
TODO make some arguments optional
"""
from typing import List
def capitalize(s: str) -> str:
"""Return a new string with the first letter capitalized"""
pass
def center(s: str, width: int, fillchar: str) -> str:
"""Returns a space-padded string with the origi... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import json
import os
import time
from common import file
from manage import whiptail
dialog = whiptail.Whiptail()
dialog.height = 15
dialog.backtitle = "SilverBlog management tool"
system_config = {
"Project_Name": "",
"Project_Description": "",
"Project_URL": ... |
#!/usr/bin/env python3
import argparse
from os import walk, rename, makedirs, listdir, rmdir
from os.path import join, sep
from sys import argv
from typing import Iterable, Callable
from vang.pio.rsr import _replace_in_file, _in
def file_content_replace_function(line: str, old: str, new: str) -> str:
line = line... |
# Copyright (c) 2013 Michael Bitzi
# Licensed under the MIT license http://opensource.org/licenses/MIT
from contextlib import contextmanager
from functools import wraps
import struct
from pwm.ffi.xcb import xcb
from pwm.config import config
import pwm.atom
import pwm.events
import pwm.workspaces
import pwm.color
impo... |
# -*- coding: utf-8 -*-
"""
Description:
Usage:
Author: YingzhiGou
Date: 24/10/2017
"""
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QGroupBox
from mtpy.gui.SmartMT.ui_asset.groupbox_station_select import Ui_GroupBox_Station_Select
class StationSelection(QGroupBox):
def __init__(s... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-24 16:30
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
depe... |
# This file is part of parallel-ssh.
#
# Copyright (C) 2014-2020 Panos Kittenis.
#
# 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, version 2.1.
#
# This library is distributed in the hope... |
import sys
import re
from mrjob.job import MRJob
from mrjob.step import MRStep
from mrjob.protocol import TextProtocol, TextValueProtocol
# Prevents broken pipe errors from using ... | head
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE,SIG_DFL)
def sum_hs(counts):
h_total, s_total = 0, 0
for h,... |
import pytest
from django.db import IntegrityError
from ..models import Book, BookSpecimen
from .factories import BookFactory, BookSpecimenFactory
from factory.fuzzy import FuzzyText
pytestmark = pytest.mark.django_db
def test_deleting_book_sould_delete_specimen_too(specimen):
assert BookSpecimen.objects.count... |
import re
import requests
from livestreamer.compat import urlparse
from livestreamer.exceptions import PluginError, NoStreamsError
from livestreamer.plugin import Plugin
from livestreamer.stream import RTMPStream
from livestreamer.utils import urlget, urlopen, res_json
AJAX_HEADERS = {
"Referer": "http://www.film... |
'''
Created on 01/02/2018
@author: chernomirdinmacuvele
'''
import ReportAPI
from ui_Relatorio_SaidasPorProvincia import Ui_Form
import FuncSQL
from PyQt5.Qt import QPlainTextEdit, QComboBox
class Relatorio_SaidasPorProvincia(ReportAPI.JasperReports, Ui_Form):
def __init__(self, parent=None, dbcon=None):
... |
from FeatureServer.DataSource import DataSource
from vectorformats.Feature import Feature
from FeatureServer.Exceptions.NoGeometryException import NoGeometryException
import md5
import urllib
from lxml import etree
from StringIO import StringIO
class Flickr (DataSource):
def __init__(self, name, api_key, api_se... |
from google.appengine.ext.db import BadValueError
from google.appengine.api import channel
from google.appengine.api import users
from google.appengine.ext import ndb
import webapp2
import jinja2
import os
import json
from datetime import datetime
import time
from models import Log
from models import System
JINJA_E... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import contextlib
import socket
from ..extern.six.moves import urllib
# save original socket method for restoration
# These are global so that re-calling the turn_off_internet function doesn't
# overwrite the... |
__author__ = 'Administrator'
from datable.web.columns import *
from datable.core.serializers import UnicodeSerializer
class ButtonColumn(Column):
formatter = 'button'
sortable = False
class IntegerColumn(Column):
formatter = 'integer'
sortable = True
class ButtonS3FileColumn(Column):
formatter = 'b... |
"""
Views related to operations on course objects
"""
import copy
import json
import logging
import random
import string # pylint: disable=deprecated-module
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.u... |
# -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class WhiteCastleSpider(scrapy.Spider):
name = "whitecastle"
allowed_domains = ["www.whitecastle.com"]
timeregex = re.compile('^([0-9:]+)(AM|PM)$')
start_urls = (
'https://www.whitecastle.c... |
#!/usr/bin/env python
#Author: Analabha Roy
from __future__ import division, print_function
from mpi4py import MPI
from reductions import Intracomm
from redirect_stdout import stdout_redirected
import sys
import copy
import random
import numpy as np
from scipy.signal import fftconvolve
from scipy.sparse import *
fro... |
#
# Copyright 2015 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 or agreed to in writing... |
r'''Allows the user to run the same code on different machines,
even though the location of the raw spectral data might change.
This is controlled by the ``~/.pyspecdata`` or ``~/_pyspecdata`` config file.
'''
import os, sys
import configparser
import platform
from .general_functions import process_kwargs, strm
import... |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# Copyright (c) 2009-2015 Richard Jones, Claudio Canepa
# All rights reserved.
#
# Redistribution and use in source and binary forms, with o... |
import os
import re
from .core import Argument
from .core import MultiCommand
from .core import Option
from .core import ParameterSource
from .parser import split_arg_string
from .utils import echo
def shell_complete(cli, ctx_args, prog_name, complete_var, instruction):
"""Perform shell completion for the given ... |
import os
import requests
from bs4 import BeautifulSoup
import json
import time
import date_converter
if not os.path.isfile('data/cookie.txt'):
cookie = raw_input("Please enter your cookie here: ")
f = open('data/cookie.txt', 'w')
f.write(cookie)
f.close()
else:
f = open('data/co... |
# 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... |
# -*- coding: utf-8 -*-
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
'''
K.I.S.T.I.E (Keep, It, Simple, Take, It, Easy)
Created on 1 Jan 2013
@author: Leonardo Bruni, leo.b2003@gmail.com
Kistie Maya Module Library
This Kistie implementation i's part of project 'Kistie_Autorig' by Leonardo Bruni, leo.b2003@gmail.com
'''
#ToDo: implement a debug mode for print or not
import pymel as pm ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Modified parameters file for the Hybrid LFP scheme, applying the methodology
with the model of:
Potjans, T. and Diesmann, M. "The Cell-Type Specific Cortical Microcircuit:
Relating Structure and Activity in a Full-Scale Spiking Network Model".
Cereb. Cortex (2014) 24 (... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Em Python os atributos de uma classe são armazenados em um `dict`, portanto
sua ordem não é preservada. Normalmente a ordem não é realmente importante.
Note no exemplo abaixo que a lista devolvida por `dir(l)` não preserva
a ordem em que foram declarados os atributo... |
#
# Copyright (C) 2015-2021 University of Oxford
#
# This file is part of msprime.
#
# msprime is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... |
# -*- coding: utf-8 -*-
import webtest
from webob import Request, Response, exc
def application(environ, start_response):
req = Request(environ)
if req.path_info == '/redirect':
req.path_info = '/path'
resp = exc.HTTPFound(location=req.path)
else:
resp = Response()
resp.body... |
#!/usr/bin/env python3
from copy import deepcopy
import sys
from asciimatics.exceptions import ResizeScreenError
from asciimatics.paths import Path
from asciimatics.renderers import StaticRenderer, ColourImageFile, FigletText
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.ef... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
from Constants import WEAR_AT_TURN, OXYGEN_AT_TURN, CARGO_WATER, CARGO_MINERALS
from SleepingGodObjects.GameObjects import GameObject
class Vessel(GameObject):
def __init__(
self,
pos_x,
pos_y,
char,
... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# Most Haunted Addon by coldkeys
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Based on code from youtube addon
#
# Author: coldkeys
#------------------------... |
__author__ = 'Matt Clarke-Lauer'
__email__ = 'matt@clarkelauer.com'
__credits__ = ['Matt Clarke-Lauer']
__date__ = 7 / 1 / 13
__version__ = '0.1'
__status__ = 'Development'
from datetime import datetime
import os,sys,profile,traceback
import pickle
import inspect
logString = "[DexScope:"
logLevel = {
0:{"Type":... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
try:
import __builtin__ as builtins
except ImportError:
import builtins
from storm import Storm
from storm.parsers.ssh_uri_parser import parse
from storm.utils import (get_formatted_message, colored)
from storm.kommandr import *... |
#!/usr/bin/env python
# pylint: disable=broad-except
import logging
import sys
import random
import string
import socket
import datetime
import platform
import time
import os
from reporting.exceptions import PluginInitialisationError
global_vars=None
def set_global(vars):
global global_vars
global_vars = va... |
"""
Contains all of the page view handlers for the app.
These handlers should be GET handlers indended for the serving of HTTP. AJAX or
otherwise action-based handlers should be stored in another module.
"""
import json
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.sho... |
import core.implant
import core.job
import string
import uuid
class DynWrapXShellcodeJob(core.job.Job):
def create(self):
self.fork32Bit = True
self.options.set("DLLUUID", uuid.uuid4().hex)
self.options.set("MANIFESTUUID", uuid.uuid4().hex)
self.options.set("SHELLCODEDECCSV", self.c... |
"""
Copyright (C) 2020 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
... |
# -*- coding: utf-8 -*-
# Import the reverse lookup function
from django.core.urlresolvers import reverse
# view imports
from django.views.generic import DetailView
from django.views.generic import RedirectView
from django.views.generic import UpdateView
from django.views.generic import ListView
# Only authenticated ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11a1 on 2017-02-09 12:59
from __future__ import unicode_literals
from django.db import migrations
from django.db.models import Q
from weblate.utils.hash import calculate_hash
def calculate_id_hash(apps, schema_editor):
Unit = apps.get_model('trans', 'Unit')
Co... |
from datetime import datetime, timedelta
import json
from django import template
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.datastructures import SortedDict
from django.utils.safestring import mark_safe
from django.... |
#!/usr/bin/env python
import argparse
import base64
import importlib
import logging
import os
import re
import socket
import time
from Cookie import SimpleCookie
from hashlib import sha1
from urlparse import parse_qs
from saml2 import BINDING_HTTP_ARTIFACT
from saml2 import BINDING_URI
from saml2 import BINDING_PAOS
... |
#!/usr/bin/python
#
import time
import string
import config
class Log:
"""
attempt to log all interesting stuff, namely, anything that hits
the network any error messages, package installs, etc
""" # " emacs sucks
def __init__(self):
self.app = "rhn client"
self.cfg = config.initUp... |
from __future__ import division
import numpy as np
from scipy import interpolate
import pandas as pd
def load_run(run_num, df):
"""Load in trial data.
Parameters
----------
run_num : int
Which run to load.
df : DataFrame
The DataFrame loaded from the original excel file.
Re... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
# -*- coding: utf-8 -*-
"""
Production Configurations
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis for cache
- Use sentry for error logging
"""
from __future__ import absolute_import, unicode_literals
import logging
from boto.s3.connection import OrdinaryC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.