src stringlengths 721 1.04M |
|---|
import re
from string import *
import sys
from nltk import *
import locale
from wikitools import wiki
from wikitools import api
from wikitools import page
from wikitools import category
wikiAPI = {
'en': "http://en.wikipedia.org/w/api.php"}
site = wiki.Wiki(wikiAPI['en'])
def generateDemonym(place, add, repl... |
from __future__ import absolute_import
from django import template
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from six.moves.urllib.parse import urlencode
from sentry.models import User, UserAvatar
from sentry.utils.avatar import get_ema... |
# -*- coding: utf-8 -*-
import inspect
import os
import sys
import uuid
from mock import Mock
# Add the lambda directory to the python library search path
lambda_dir = os.path.join(
os.path.dirname(inspect.getfile(inspect.currentframe())), '..', '..')
sys.path.append(lambda_dir)
import pytest
from humilis_fhrsc.... |
import sys
import os
mappings = {
"a": [4, "@"],
"b": ["13"],
"c": ["("],
"d": ["[)"],
"e": [3],
#"f": ["|="],
"g": [6],
#"h": ["|-|"],
"i": [1, '!', "|"],
#"j": [".]"],
"k": ["|<"],
"l": [1],
"m": ['|Y|'],
#"n": ["/\\/"],
"o": [0],
#"p": ["|>"],
"q":... |
from django.forms import ModelForm, Textarea
from django.forms.models import inlineformset_factory
import re
from crispy_forms.helper import FormHelper
from .models import Target, Initiative, Perspective, Resource, InCharge, Committee
from indicators.models import Indicator, MainIndicator, Parameter
class BasicFor... |
import re
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from mptt.fields import TreeForeignKey
from mptt.models import MPTTModel
from judge.models.problem import Problem
from judge.mo... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... |
import os
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard import exceptions
DEBUG = False
TEMPLATE_DEBUG = DEBUG
COMPRESS_OFFLINE = True
ALLOWED_HOSTS = ['*']
# Set SSL proxy settings:
# For Django 1.4+ pass this header from the proxy after terminating the SSL,
# and don't forget ... |
# Copyright 2017 Become Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from wfuzz.externals.moduleman.plugin import moduleman_plugin
from wfuzz.plugin_api.base import BasePayload
from wfuzz.exception import FuzzExceptBadOptions
from wfuzz.fuzzobjects import FuzzWordType
@moduleman_plugin
class hexrange(BasePayload):
name = "hexrange"
author = (
"Carlos del Ojo",
... |
""" Problem Set 01 starter code
Please make sure your code runs on Python version 3.5.0
Due date: 2016-02-05 13:00
"""
import numpy as np
from scipy import spatial
from scipy.stats import norm
def my_knn(X, y, k=1):
""" Basic k-nearest neighbor functionality
k-nearest neighbor regression for a numeric test... |
"""
Simple example:
.. UIExample:: 75
from flexx import app, ui
class Example(ui.Widget):
def init(self):
with ui.html.UL():
ui.html.LI(text='foo')
ui.html.LI(text='bar')
.. UIExample:: 150
from flexx import app, ui, ev... |
# -*- coding: utf-8
from yade import ymport,utils,pack,export,qt,bodiesHandling
import gts,os
# for plotting
from math import *
from yade import plot
############################
### DEFINING PARAMETERS ###
############################
#GEOMETRIC :dimension of the rectangular box
a=.2 # side dimension
h=.1 # h... |
"""
External code required for param/tkinter interface.
* odict: an ordered dictionary
* tilewrapper: a wrapper for Tile/ttk widgets
Note that an ordered dictionary and a wrapper for ttk widgets are both
available in Python 2.7.
"""
from __future__ import generators
# odict.py
# An Ordered Dictionary object
# Copyr... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... |
# Zulip's main Markdown implementation. See docs/subsystems/markdown.md for
# detailed documentation on our Markdown syntax.
import datetime
import functools
import html
import logging
import re
import time
import urllib
import urllib.parse
from collections import defaultdict, deque
from dataclasses import dataclass
f... |
import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
import xray
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
from matplotlib import animation
import matplotlib as mpl
import collections
import pandas as ... |
# 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... |
import chainer
def depthwise_convolution_2d(x, W, b=None, stride=1, pad=0):
"""Two-dimensional depthwise convolution function.
This is an implementation of two-dimensional depthwise convolution.
It takes two or three variables: the input image ``x``, the filter weight
``W``, and optionally, the bias ... |
# -*- coding: utf-8 -*-
"""
httpbin.core
~~~~~~~~~~~~
This module provides the core HttpBin experience.
"""
import base64
import json
import os
import random
import time
import uuid
from bustard.app import Bustard
from bustard.http import (
Response, Headers, jsonify as bustard_jsonify, redirect
)
from bustard.... |
#*******************************************************************************
# plot.py
#
# Zac Hester <zac.hester@gmail.com>
# 2012-07-27
#
# Minimal plotting reference using numpy + matplotlib
#
#*******************************************************************************
import matplotlib
import matplotlib... |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free software... |
# -*- coding: UTF-8 -*-
from posixpath import join as pjoin
from collections import namedtuple
from mcm.cmdpathtypes import MENU_PATHS
CmdPath = namedtuple('CmdPath', ('absolute', 'type', 'keys', 'modord', 'strategy'))
def make_cmdpath(path, strategy):
attrs = dict()
attrs['absolute'] = pjoin('/', path ).... |
from __future__ import unicode_literals, division, absolute_import
import logging
from math import ceil
from flask import jsonify
from sqlalchemy import desc
from flexget.api import api, APIResource
from flexget.plugins.output.history import History
log = logging.getLogger('history')
history_api = api.namespace('h... |
"""Module that defines mutable stable zigzag pairing heap."""
from pep_3140 import Deque
from pep_3140 import List
from sorted_using_heap import sorted_using_mutable_stable_heap
from mutable_priority_queue import MutablePriorityQueue
class MutableStableLazyZigzagPairingHeap(MutablePriorityQueue):
"""A heap that ... |
import re
import datetime as dt
from collections import defaultdict
import pytz
from pupa.scrape import Scraper, Bill, VoteEvent as Vote
from openstates.nh.legacyBills import NHLegacyBillScraper
body_code = {"lower": "H", "upper": "S"}
bill_type_map = {
"B": "bill",
"R": "resolution",
"CR": "concurrent ... |
# RUN: %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-BASIC %s
# CHECK-BASIC: Testing: 5 tests
# Check that we exit with an error if we do not discover any tests, even with --allow-empty-runs.
#
# RUN: not %{lit} %{inputs}/nonexistent 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s
#... |
##################### DIVERSITY #####################
# DIVERSITY is a tool to explore multiple ways of protein-DNA
# binding in the genome. More information can be found in the README file.
# Copyright (C) 2015 Sneha Mitra, Anushua Biswas and Leelavati Narlikar
# DIVERSITY is free software: you can redi... |
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from tabbox import TabBox
from utils import TextBoxLabel
# ============================================================================
class MessageTextInput(TextInpu... |
"""Base class copy from sklearn.base."""
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Romain Trachel <trachelr@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
im... |
###############################################################################
# Name: testSyntaxDataBase.py #
# Purpose: Unit tests for syntax.syndata Base Class #
# Author: Cody Precord <cprecord@editra.org> #
... |
# Copyright 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
###############################################################################
# Define everything needed to do per-commit coverage testing on Linux
###############################################################################
import os
run_coverage_cmd = """
using Pkg
Pkg.activate("CoverageBase")
using CoverageBas... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ErrorReport'
db.create_table('jhouston_errorreport', (
('id', self.gf('django.... |
# coding: utf-8
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
# 蛇运动的场地长宽
HEIGHT = 10
WIDTH = 20
FIELD_SIZE = HEIGHT * WIDTH
# 蛇头总是位于snake数组的第一个元素
HEAD = 0
# 用来代表不同东西的数字,由于矩阵上每个格子会处理成到达食物的路径长度,
# 因此这三个变量间需要有足够大的间隔(>HEIGHT*WIDTH)
FOOD = 0
UNDEFINED = (HEIGHT + 1) * ... |
import logging
import os
import sys
PROJECT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DATA_ROOT = os.path.join(PROJECT_DIR, '.gaedata')
# Overrides for os.environ
env_ext = {'DJANGO_SETTINGS_MODULE': 'settings'}
def setup_env():
"""Configures app engine environment for command-line apps."... |
# Copyright 2020 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 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... |
"""Raw representations of every data type in the AWS CodeCommit service.
See Also:
`AWS developer guide for CodeCommit
<https://docs.aws.amazon.com/codecommit/latest/userguide/index.html>`_
This file is automatically generated, and should not be directly edited.
"""
from attr import attrib
from attr import a... |
"""Feature descriptors usefull in bag of features approaches.
These are applied to numpy.arrays representing images.
"""
import numpy
from skimage import feature
def hog(parameters):
"""Extracts histograms of oriented gradients.
It wraps `skimage.feature.hog`. The `visualise` and `normalise` options
ar... |
#from web import app
from web.dao import getNodeFromAddress, getNodeInformation, getTransations, groupByAllDistribution, groupbyNode, \
groupbyAmount, groupbyDate
from flask import *
import re
import csv
import io
from datetime import datetime, timedelta
app = Flask(__name__)
@app.route('/',methods=['POST', 'G... |
# -*- coding: utf-8 -*-
#
# Copyright 2012 Manuel Stocker <mensi@mensi.ch>
#
# This file is part of Cydra.
#
# Cydra 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 yo... |
import sys
import os.path
import modelx as mx
import modelx.tests.testdata
import pytest
import pathlib
datadir = pathlib.Path(os.path.dirname(mx.tests.testdata.__file__))
@pytest.fixture
def reloadtest(tmp_path):
with open(tmp_path / "__init__.py", "w") as f:
f.write("")
sys.path.insert(0, str(tmp... |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os
from collections import OrderedDict, namedtuple
from functools impo... |
"""
Holds user settings and various helper objects.
"""
# Copyright (C) 2011, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from zeroinstall import _
import os
from logging import info, warn
import ConfigParser
from zeroinstall import zerostore
from zeroinstall.injector.model import... |
""" Contains the definition of the ChangeGAN architecture. """
import multiprocessing
import tensorflow as tf
from gan_utils import encoder, decoder, transformer, discriminator, preprocess_image
slim = tf.contrib.slim
default_image_size = 256
def model_fn(inputs_a, inputs_b, learning_rate, num_blocks=9, is_traini... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2011, Monash e-Research Centre
# (Monash University, Australia)
# Copyright (c) 2010-2011, VeRSI Consortium
# (Victorian eResearch Strategic Initiative, Australia)
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modificatio... |
import os
import sys
import errno
import atexit
import signal
import logging
import tempfile
from .utils import (
determine_pid_directory,
effective_access,
)
try:
from contextlib import ContextDecorator as BaseObject
except ImportError:
BaseObject = object
DEFAULT_PID_DIR = determine_pid_directory()
... |
# 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 ... |
# -*- coding: utf-8 -*-
"""
Extensible permission system for pybbm
"""
from django.utils.importlib import import_module
from django.db.models import Q
from pybb import defaults
def _resolve_class(name):
""" resolves a class function given as string, returning the function """
if not name: return False
mo... |
from flask_sqlalchemy import Model
from sqlalchemy import exc as core_exc
from sqlalchemy.orm import exc
class Result(object):
"""
Classe que recebe o resultado
"""
def __init__(self, status, message):
self.status = status
self.message = message
class BaseModel(Model):
"""
... |
# -*- coding: utf-8 -*-
import sqlite3 as lite
import os
class Database:
"""
Handles db connection
"""
def __init__(self, **kwargs):
self.log = None
if "log" in kwargs:
self.log = kwargs["log"]
if "path" in kwargs:
path = kwargs["path"]
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import uuid
class Migration(migrations.Migration):
dependencies = [
('authtools', '0003_auto_20160128_0912'),
]
operations = [
migrations.CreateModel... |
import math
import time
t1 = time.time()
# using all the numbers
# the sub pairs cover the exact original set
def exactsub(oset):
l = len(oset)
if l == 2:
return [[[oset[0]],[oset[1]]]]
result = []
f = oset[0]
rest = oset[1:]
result.append([[f],rest])
for i in exactsub(rest):
... |
#!/usr/bin/env python
import shutil
import random
import md5
import unittest
import os
import subprocess
def sanitize(path):
path = os.path.expanduser(path)
path = os.path.expandvars(path)
path = os.path.normpath(path)
path = os.path.abspath(path)
return path
def run_make(Makefile=None, targets=N... |
import filecmp
import logging
import os
import tempfile
from galaxy.tools import Tool
from galaxy.tools import parameters
from galaxy.tools.parameters import dynamic_options
from tool_shed.tools import data_table_manager
from tool_shed.util import basic_util
from tool_shed.util import hg_util
from tool_shed.util imp... |
import platform
import matplotlib
if platform.system() == 'Darwin':
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.patches import Circle, Arc
# tkinter for the display
from tkinter import *
from tkinter import Canvas
fro... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
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... |
import xbmc,xbmcgui,xbmcaddon,xbmcplugin
import urllib
import thesportsdb
import datetime
import os
import re
import threading
from random import randint
from centerutils.common_variables import *
from centerutils.datemanipulation import *
import competlist as competlist
import teamview as teamview
import contextmenubu... |
import sys
from setuptools import setup, Command
with open('VERSION', 'r') as v:
__version__ = v.read().rstrip()
class Tox(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
@classmethod
def run(cls):
import tox
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from random import randint
from time import sleep
class Navio:
pass
def __init__(self, nome):
self.nome = nome
self.vivo = True
def posiciona(self, linha, coluna):
self.linha = linha
self.coluna = coluna
def ... |
import subprocess
import sys
import setup_util
import os
def start(args, logfile, errfile):
setup_util.replace_text('dart-stream/postgresql.yaml', 'host: .*', 'host: ' + args.database_host)
setup_util.replace_text('dart-stream/mongodb.yaml', 'host: .*', 'host: ' + args.database_host)
try:
#
# install dar... |
import os
import shutil
import tempfile
from twisted.internet import defer
from twisted.python import failure
from twisted.trial.unittest import TestCase
from .. import http as asgihttp
from ..http import ASGIHTTPResource
from ..utils import sleep
from .utils import DummyApplication, DummyRequest
class TestASGIHTTP... |
## Create a network trace using specified distribution for packet intervals
import numpy
import os
import random
import sys
UPLINK_TRACE_SIZE = 30000
DOWNLINK_TRACE_SIZE = 350000
TRACES_PATH = 'cleaned_traces'
def create_trace(d_name, d_function, mode):
intervals = [int(round(abs(d_function()))) for _ in range(... |
import re,collections,operator
import networkx as nx
from privacy_level import privacy_level_generator
from numpy.random import zipf
from math import ceil
class ReadGraph():
extension = []
G = nx.Graph()
properties = {}
nodes = []
edges = []
privacy_level = []
sorted_degree_sequence = []
... |
##########################################################################
#
# MRC FGU Computational Genomics Group
#
# $Id$
#
# Copyright (C) 2009 Andreas Heger
#
# 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 ... |
# -*- coding: utf-8 -*-
# YAFF is yet another force-field code.
# Copyright (C) 2011 Toon Verstraelen <Toon.Verstraelen@UGent.be>,
# Louis Vanduyfhuys <Louis.Vanduyfhuys@UGent.be>, Center for Molecular Modeling
# (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise
# stated.
#
# This file is pa... |
%autoindent
import numpy
import theano
from theano import tensor
def numpy_floatX(data):
return numpy.asarray(data, dtype=theano.config.floatX)
num_timesteps = 10
num_sequences = 3
num_dim = 2
num_components = 3
x_n = (numpy.arange(num_timesteps * num_sequences * num_dim,
dtype=th... |
import pytest
import os
import ctypes
from pathlib import Path
from spacy.about import __version__ as spacy_version
from spacy import util
from spacy import prefer_gpu, require_gpu, require_cpu
from spacy.ml._precomputable_affine import PrecomputableAffine
from spacy.ml._precomputable_affine import _backprop_precomputa... |
#!/usr/bin/env python
import numpy as np
import tensorflow as tf
import cv2
import os.path
DEBUG = False
class CnnHeadPoseEstimator:
def __init__(self, tf_session):
""" Init the class
@param tf_session An external tensorflow session
"""
self._sess = tf_session
def print_al... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
"""
Learn Python the Hard Way - Exercise 35
Branches and Functions
This is pretty similar to what's in the book, but I added another room and toyed
around for a bit with exception handling. The new death function is pretty
cool, too.
"""
from sys import exit
def start():
"... |
#!/usr/bin/env python
__author__ = 'Kurt Schwehr'
__version__ = '$Revision: 2275 $'.split()[1]
__revision__ = __version__ # For pylint
__date__ = '$Date: 2006-07-10 16:22:35 -0400 (Mon, 10 Jul 2006) $'.split()[1]
__copyright__ = '2008'
__license__ = 'GPL v3'
__contact__ = 'kurt at ccom.unh.edu'
__doc__='''
Connec... |
# -*- Mode: Python; coding: iso-8859-1 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Stoqdrivers
## Copyright (C) 2005-2007 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as pub... |
import logging
import math
import os
import time
from typing import List
import requests
import vk.exceptions
from vk_app import App
from vk_app.app import captchured
from vk_app.models import VKPhoto, VKPhotoAlbum, VKVideo, VKPost
from vk_app.utils import make_delayed
from vk_scheduler.settings import (CONFIGURATION... |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class UserhostCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name = "UserhostCommand"
core = Tru... |
#!/usr/bin/env python
import modo
import lx
import lxu.command
import lxu.select
import traceback
import Tila_BatchExportModule as t
from Tila_BatchExportModule import user_value
from Tila_BatchExportModule import batch_export
class CmdBatchExport(lxu.command.BasicCommand):
def __init__(self):
lxu.comman... |
"""SqueezeNet 1.1 modified for LSTM regression."""
import logging
import torch
import torch.nn as nn
import torch.nn.init as init
from torch.autograd import Variable
logging.basicConfig(filename='training.log', level=logging.DEBUG)
# from Parameters import ARGS
class Fire(nn.Module): # pylint: disable=too-few-pu... |
# Converts STD_BANDPASSES_Y3A1_FGCM_20170630_extend3000.fits to
# y3a2_std_passband_extend3000_ugrizYatm.csv
#
# To run (bash):
# python origBandpass_FITSToCSV.py > origBandpass_FITSToCSV.log 2>&1 &
#
# To run (tcsh):
# python origBandpass_FITSToCSV.py >& origBandpass_FITSToCSV.log &
#
# DLT, 2017-06-30
# bas... |
#!/usr/bin/env python3
# XXX: Refactor to a comand line tool and remove pylint disable
"""NGS reads demultiplexer."""
import argparse
import gzip
import json
import os
import subprocess
import sys
from resolwe_runtime_utils import error, export_file, progress, run, save, send_message
from six import iteritems
parser... |
from mezzanine.pages.page_processors import processor_for
from crispy_forms.layout import Layout, HTML
from hs_core import page_processors
from hs_core.views import add_generic_context
from forms import UrlBaseForm, VersionForm, SupportedResTypesForm, ToolIconForm, \
SupportedSharingStatusForm, AppH... |
# coding: utf-8
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.db import connections
from django.utils.six import string_types
from .cache import cachalot_caches
from .settings import cachalot_settings
from .signals import post_invalidation
from .tra... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-03-24 08:13
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... |
import gtk
import ns3
from visualizer.base import InformationWindow
NODE_STATISTICS_MEMORY = 10
class StatisticsCollector(object):
"""
Collects interface statistics for all nodes.
"""
class NetDevStats(object):
__slots__ = ['rxPackets', 'rxBytes', 'txPackets', 'txBytes',
... |
#!/usr/bin/env vpython
# Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import datetime
import sys
import unittest
from test_support import test_env
test_env.setup_test_env()
from google.appeng... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 27 11:26:31 2017
@author: daniele
"""
import os
import pandas as pd
import numpy as np
def all_image_paths(folderpath):
"""
Returns a list of filenames containing 'jpg'. The returned list has
sublists with filenames, where each sublis... |
import gobject
import gtk
from dfeet.dbus_introspector import BusWatch
from busnameview import BusNameView
class BusNameBox(gtk.VBox):
__gsignals__ = {
'busname-selected' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
(gobject.TYPE_PYOBJECT,))
}
def _... |
from six import python_2_unicode_compatible
from .base import Ref, QuickbooksManagedObject, QuickbooksTransactionEntity, LinkedTxnMixin, AttachableRef
@python_2_unicode_compatible
class TimeActivity(QuickbooksManagedObject, QuickbooksTransactionEntity, LinkedTxnMixin):
"""
QBO definition: The TimeActivity ent... |
import logging
import os
import shutil
from django.conf import settings
from readthedocs.builds.constants import LATEST
from readthedocs.doc_builder.config import ConfigWrapper
from readthedocs.doc_builder.loader import get_builder_class
from readthedocs.projects.constants import LOG_TEMPLATE
log = logging.getLogger... |
import inspect
import copy
from .exceptions import RuleGroupError
from .rule import Rule
class BaseMeta:
"""Base class for RuleGroup "Meta" class."""
app_label = None
source_model = None
source_fk = None
rules = None
def __init__(self, group_name, **meta_attrs):
for k, v in meta_att... |
"""
Yanker
Usage:
yanker [--threads=<tnum>]
"""
__version__ = '1.0.1'
import Queue
import threading
import youtube_dl as ydl
import pyperclip as clip
import time
from docopt import docopt
class ErrLogger(object):
def debug(self, msg):
pass
def warning(self, msg):
pass
def error(sel... |
"""
mfriv module. Contains the ModflowRiv class. Note that the user can access
the ModflowRiv class as `flopy.modflow.ModflowRiv`.
Additional information for this MODFLOW package can be found at the `Online
MODFLOW Guide
<http://water.usgs.gov/ogw/modflow/MODFLOW-2005-Guide/index.html?riv.htm>`_.
"""
import... |
from gmp.options import *
import subprocess
import tempfile
import os
class ScreenExecutor:
instance = None
def __init__(self):
self.screen_fd, self.screen_path = tempfile.mkstemp()
self.counter = 0
self.screen_fd = os.fdopen(self.screen_fd, "w")
def get():
if not ScreenExe... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import xbmcaddon, xbmc, xbmcgui, xbmcplugin
import sys
import os
import traceback
from resources.lib.debug import RemoteDebug
import resources.lib.series as hdout_series
import resources.lib.episodes as hdout_episodes
import resources.lib.common as hdout_common
debug = Remot... |
# -*- coding: utf-8 -*-
__author__ = 'Dennis Rump'
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Dennis Rump
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation... |
# 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/.
"""This library parses dotlang files migrated over from the old PHP
system.
It caches them using the dj... |
# Copyright 2018 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 sys, os
import argparse
import urllib3, urllib
import re
# Modules
from libs.colors import *
from libs.selectChoice import select_choice
Parser = argparse.ArgumentParser(prog='whoUR.py', description='Tool for information gathering')
'''
this has been use in the future
Parser.add_argument('-d', '--dic-path', he... |
#!/usr/bin/env python
"""
Problem Definition :
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle n... |
#Todo: Write tests
import pytest
# QtApplication needs to be imported first to prevent import errors.
from UM.Qt.QtApplication import QtApplication
from cura.MachineAction import MachineAction
from cura.MachineActionManager import MachineActionManager, NotUniqueMachineActionError, UnknownMachineActionError
class Mac... |
#!/usr/bin/python2
'''
Perform basic ELF security checks on a series of executables.
Exit status will be 0 if succesful, and the program will be silent.
Otherwise the exit status will be 1 and it will log which executables failed which checks.
Needs `readelf` (for ELF) and `objdump` (for PE).
'''
from __future__ import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.