src stringlengths 721 1.04M |
|---|
import pytest
import os
from flask import Flask
from typing import Generator
from commandment import create_app
from commandment.models import db as _db
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm import scoped_session
import sqlalchemy
from tests.client import MDMClient
from alembic.command import upgr... |
from elasticsearch import Elasticsearch
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.dates import AutoDateLocator, AutoDateFormatter
import numpy as np
import datetime as dt
import math
import json
with open('sites.json', 'r+') as txt:
sitesArray = json.load(... |
# Copyright 2021 Google 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 writing, ... |
##
# Copyright 2009-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... |
import sympy.physics.mechanics as me
import sympy as sm
import math as m
import numpy as np
x, y = me.dynamicsymbols('x y')
a, b = sm.symbols('a b', real=True)
e = a*(b*x+y)**2
m = sm.Matrix([e,e]).reshape(2, 1)
e = e.expand()
m = sm.Matrix([i.expand() for i in m]).reshape((m).shape[0], (m).shape[1])
e = sm.factor(e, ... |
from drfpasswordless.settings import api_settings
from django.urls import path
from drfpasswordless.views import (
ObtainEmailCallbackToken,
ObtainMobileCallbackToken,
ObtainAuthTokenFromCallbackToken,
VerifyAliasFromCallbackToken,
ObtainEmailVerificationCallbackToken,
ObtainMobileVerifica... |
def test_paginated_children(pad):
page1 = pad.get('/projects', page_num=1)
assert page1 is not None
assert page1['_model'] == 'projects'
assert page1['_template'] == 'projects.html'
assert page1.datamodel.pagination_config.per_page == 4
assert page1.children.count() == 8
assert page1.page... |
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
from django.core import exceptions as core_exceptions
from django.conf import settings
from . import exceptions
# Create your models here.
class TimeEntry(models.Model):
id = models.AutoField(primary_key=True... |
from Object import Object
from consts import *
import HeeksCNC
class Tool(Object):
def __init__(self, diameter = 3.0, title = None, tool_number = 0, type = TOOL_TYPE_SLOTCUTTER):
Object.__init__(self)
self.tool_number = tool_number
self.type = type
self.diameter = diameter
s... |
# -*- coding: UTF-8 -*-
import tornado.web
import tornado.httpserver
import tornado.ioloop
import wechat
from tornado.options import define, options
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/wechat_index", wechat.IndexHandler)
]
settings =... |
#!/usr/bin/python
"""A module containing the exception classes for the adldap module.
Copyright 2010 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... |
import smtplib
import base64
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email import encoders
from __builtin__ import file
import settings
import os
import datetime
def email_msg(sender, receiver, msg, ... |
# Copyright 2012 OpenStack Foundation
# 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 requ... |
import regex
from merc import errors
from merc import feature
from merc import message
MAX_NICKNAME_LENGTH = 12
NICKNAME_REGEX = regex.compile(r"^[\p{L}\p{So}_\[\]\\^{}|`][\p{L}\p{So}\p{N}_\[\]\\^{}|`-]*$")
class NickFeature(feature.Feature):
NAME = __name__
install = NickFeature.install
class _Nick(message.... |
# Renderer.py
# Various ways to format text output to players
class Renderer():
'''
A renderer component just contains methods for formatting text output in various ways
'''
def __init__(self, server):
self.owner = server
def formatMessage(self, message, width):
'''
splits a <message> string into lines th... |
# -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2015,
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... |
# Copyright 2011 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 required by applicable law or a... |
from mock import Mock, patch
import unittest
from contextio.lib.errors import ArgumentError
from contextio.lib.resources.connect_token import ConnectToken
from contextio.lib.resources.user import User
from contextio.lib.resources.email_account import EmailAccount
from contextio.lib.resources.webhook import WebHook
c... |
#
# ovirt-hosted-engine-setup -- ovirt hosted engine setup
# Copyright (C) 2013-2019 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, o... |
import io
import tempfile
import json
from urlparse import urlparse
import copy
import tarfile
import shutil
import logging
import os.path
import yaml
from cnrclient.discovery import ishosted, split_package_name
import kpm.registry as registry
import kpm.packager as packager
from kpm.utils import mkdir_p
from kpm.uti... |
import nibabel as nib
import numpy as np
from numpy import pi,sin,cos
from nipy.labs.spatial_models.discrete_domain import grid_domain_from_image
from scipy.spatial import cKDTree
from scipy import ndimage
from scipy.ndimage.morphology import binary_dilation
from scipy.ndimage import binary_fill_holes
def ellip... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: Brian Cherinka, José Sánchez-Gallego, and Brett Andrews
# @Date: 2018-07-24
# @Filename: test_rss.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
#
# @Last modified by: José Sánchez-Gallego (gallegoj@uw.edu)
# @Last modified time: ... |
from __future__ import unicode_literals
"""XML namespaces"""
admin = "http://moyaproject.com/admin"
auth = "http://moyaproject.com/auth"
blog = "http://moyaproject.com/blog"
comments = "http://moyaproject.com/comments"
db = "http://moyaproject.com/db"
default = "http://moyaproject.com"
email = "http://moyaproject.co... |
#!/usr/bin/env python
#
# Copyright 2016 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 requir... |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import copy
import warnings
import numpy as np
from ..io.pick import pick_channels_cov
from ..forwar... |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... |
# -*- coding: utf-8 -*-
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostAdminEnableEvent(vim, *args, **kwargs):
'''This event records that the administra... |
import json
import uuid
import hmac
import logging
import binascii
import urllib
import pytz
from collections import OrderedDict
from datetime import datetime
from hashlib import sha256
from decimal import Decimal, InvalidOperation
from django.db.models import Q
from django.utils.encoding import smart_str
from django.... |
import io
from typing import Dict, Optional
from .exceptions import CommandHelpException
from .parser import DefaultParser
class Command:
def __init__(self):
pass
def run(self, selector, argv):
raise Exception("not implemented")
class DecoratorCommand(Command):
def __init__(self, fn, doc=None, parse... |
# python -m memory_profiler
# dataset used for benchmark: X=(None, 500, 120)
# dataset used for benchmark: y=(None, 2)
from __future__ import print_function, division
import os
os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=cpu,floatX=float32"
import theano
from theano import tensor
import numpy as np
import sci... |
import json
import unittest
import mock
from django.http import HttpResponseBadRequest
from base import assert_auth_CREATE, assert_auth_DELETE, assert_auth_READ, assert_auth_UPDATE
from pulp.server.exceptions import (InvalidValue, MissingResource, MissingValue,
OperationPostponed, ... |
# 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 module provides functionality for the command-line build tool
# (mach). It is packaged as a module because everyt... |
from __future__ import absolute_import, division, print_function
import pytest
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from matplotlib.artist import Artist
from numpy.testing import assert_allclose
from matplotlib.backends.backend_agg import FigureCanvasAgg
from glue... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... |
# -*- coding: 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 field 'Winner.authentication_ip'
db.add_column('prizes_winner', 'authentication_ip',
... |
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
#!/usr/bin/env python
# (c) Stefan Countryman, 2016-2017
DESC="""Plot an IRIG-B signal read from stdin. Assumes that the timeseries
is a sequence of newline-delimited float literals."""
FAST_CHANNEL_BITRATE = 16384 # for IRIG-B, DuoTone, etc.
# THE REST OF THE IMPORTS ARE AFTER THIS IF STATEMENT.
# Quits immediately... |
#!/opt/mesosphere/bin/python
"""
The script allows to add network interfaces and ip addresses multiple times
ip command returns 2 as exit code if interface or ipaddr already exists [1]
dcos-net-setup.py checks output of ip command and returns success exit code [2]
[1] ExecStartPre=-/usr/bin/ip link add name type dumm... |
from tornado.testing import gen_test
from tornado.websocket import WebSocketHandler
from calm.testing import CalmWebSocketTestCase
from calm import Application
from calm.ex import DefinitionError
app = Application('testws', '1')
@app.websocket('/ws')
class SomeWebSocket(WebSocketHandler):
OPEN_MESSAGE = "some ... |
import urlparse
import os
import re
from upseto import run
from upseto import gitconfigparser
def originURLBasename(originURL):
originURLBasename = urlparse.urlparse(originURL).path.split("/")[-1]
if originURLBasename.endswith(".git"):
originURLBasename = originURLBasename[: - len(".git")] # pragma: ... |
#-------------------------------------------------
#------------------- Imports -------------------
#-------------------------------------------------
import os
#-------------------------------------------------
# --------- Sacar el enter de un STR -----------
#-------------------------------------------------
# c... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015 Metaswitch Networks
# 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/licen... |
#!/usr/bin/python
# This script changes the wallpaper of the current OSX desktop. It will change the wallpaper of the desktop on each screen but not each desktop.
from AppKit import NSWorkspace, NSScreen
from Foundation import NSURL
import os
import praw
import urllib
# Define the reddit object.
r = praw.Reddit(user... |
# -*- coding: utf-8 -*-
# Copyright 2018 Juca Crispim <juca@poraodojuca.net>
# This file is part of toxicbuild.
# toxicbuild 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 Lic... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Blockstack
~~~~~
copyright: (c) 2014-2015 by Halfmoon Labs, Inc.
copyright: (c) 2016 by Blockstack.org
This file is part of Blockstack
Blockstack is free software: you can redistribute it and/or modify
it under the terms of the GNU General... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import copy
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.utils import six
from rest_framework import serializers
from ..models import (ExceptionLog, Execution, ExecutionArgument, Ex... |
__author__ = 'Konstantin Dmitriev'
from renderchan.module import RenderChanModule
from renderchan.utils import is_true_string
from distutils.version import StrictVersion
import subprocess
import tempfile
import os
from xml.etree import ElementTree
class RenderChanPencil2dModule(RenderChanModule):
def __init__(s... |
'''
Created on 08.06.2015
@author: marinavidovic
'''
import os
import pdb
import utils_svm
import pickle
import numpy as np
import copy
import genQ
import makePOIM
import view
import matplotlib
matplotlib.use('Agg')
if __name__ == '__main__':
read_data = 1
datapath = "/home/mvidovic/POIM... |
# Copyright 2013 Metacloud
#
# 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, s... |
##################################################################################
# The MIT License - turboengine
#
# Copyright (c) Oct 2010 - Luis C. Cruz <carlitos.kyo@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... |
from django.utils.functional import curry
from django.core.cache import cache
from django.utils.encoding import smart_str
from django.utils.itercompat import is_iterable
def to_list(arg):
"""Converts `arg` to list"""
if is_iterable(arg) and not isinstance(arg, dict):
return list(arg)
else:
... |
from collections import namedtuple
Injection = namedtuple("Injection", ("token"))
def Inject(*args):
def wrap(token):
inj = getattr(token, '_injections', [])
for arg in args:
if not isinstance(arg, Injection):
arg = Injection(arg)
inj.append(arg)
tok... |
# -*- coding: utf-8 -*-
from django.utils import timezone
from django.utils.datastructures import SortedDict
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from unidecode import unidecode
import logging
import os
import sys
@python_2_unic... |
import os
import shutil
import tempfile
import httplib
import h5py
from pydvid import keyvalue
from mockserver.h5mockserver import H5MockServer, H5MockServerDataFile
class TestKeyValue(object):
@classmethod
def setupClass(cls):
"""
Override. Called by nosetests.
- Create an hdf5... |
__author__ = 'thorwhalen'
import ut.parse.util as parse_util
import re
import ut.pstr.trans as pstr_trans
import ut.parse.bsoup as parse_bsoup
pois_near_hotel_exp_0 = re.compile("(?<=\. )[\w ]+(?=- 0\.\d km / 0\.\d mi)")
pois_near_hotel_exp = re.compile("(.+)- (\d+[\.\d]*) km / (\d+[\.\d]*) mi")
def get_pois_near_... |
from distutils.core import setup, Extension
from subprocess import Popen, PIPE
def supports_av():
h = Popen("ld $LDFLAGS -ltoxav", shell=True, stderr=PIPE)
out, err = h.communicate()
return 'toxav' not in str(err)
sources = ["pytox/pytox.c", "pytox/core.c", "pytox/util.c"]
libraries = [
"opus",
"sodi... |
class Packet:
def __init__(self, name, args):
self.name = name
self.args = args
def get_header_fmt(self):
return """
function {name} (buffer) {{
this.id = {base_name}ID.{name} /* {packet_id} */;
if (buffer){{
buffer.ReadByte(); /* PacketID */
{ctor_fields_... |
# Abstract base classes for GUI classes
#
# Copyright (C) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is... |
# -*- coding: utf-8 -*-
"""
direct PAS
Python Application Services
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?pas;tasks_loader
The following license agreement remains valid unless any additions or
c... |
# coding: utf-8
from __future__ import unicode_literals
import datetime
from django.test import TestCase
from django.contrib.gis.gdal import OGRGeometry
from django.contrib.gis.geos import Point, GEOSGeometry
from boundaries.models import BoundarySet, Boundary, Geometry
class BoundaryTestCase(TestCase):
maxDiff... |
#!/usr/bin/env python
# Copyright 2017 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 a... |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... |
# Copyright (c) 2013 Mirantis 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 writ... |
# Author: Nic Wolfe <nic@wolfeden.ca>
# Author: Gordon Turner <gordonturner@gordonturner.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... |
# !/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2018, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
import time
import functools
from ..core.utils.log import logger
from .code import APIState
def check_modbus_baud(baud=20... |
# -*- coding: utf-8 -*-
import json
from datetime import datetime as dt
from sqlalchemy import Column
from sqlalchemy.types import Integer, DateTime, Text
from sqlalchemy.sql.expression import and_, desc
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import synonym
from tg import request
from... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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... |
__author__ = 'Ashish'
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.set_option('max_columns', 50)
# pass in column names for each CSV
u_cols = ['user_id', 'age', 'sex', 'occupation', 'zip_code']
users = pd.read_csv('Data\ml-100k\u.user', sep='|', names=u_cols)
r_cols = ['user_id', 'movie_i... |
# 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
# distributed under the Li... |
# $Id$
import sys
import os.path
import math
from itcc.molecule import read, write
from itcc.molecule.tools import neighbours, is_pyramid
from itcc.molecule import relalist
try:
sorted
except:
from itcc.core.tools import sorted_ as sorted
def mirrormol():
if len(sys.argv) != 2:
sys.stderr.write('U... |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... |
# Copyright 2011-2013 Facundo Batista
# All Rigths Reserved
"""The server and main app for kilink."""
import json
import logging
import time
from functools import update_wrapper
from flask import (
Flask,
jsonify,
make_response,
redirect,
render_template,
request,
)
from flask.ext.assets im... |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# $Id$
#
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software... |
# -*- coding: 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 unique constraint on 'QuestionnaireHolodeckKeys', fields ['questionnaire', 'metric']
db.create_uniq... |
import cv2
import numpy as np
from PIL import ImageGrab
def main():
while True:
stream = np.array(ImageGrab.grab(bbox=(0, 31, 1024, 751)))
cv2.imshow('AI Vision', cv2.cvtColor(stream, cv2.COLOR_BGR2RGB))
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
... |
# -*- test-case-name: go.apps.jsbox.tests.test_metrics -*-
# -*- coding: utf-8 -*-
"""Metrics for JS Box sandboxes"""
import re
from vxsandbox import SandboxResource
from vumi.blinkenlights.metrics import SUM, AVG, MIN, MAX, LAST
class MetricEventError(Exception):
"""Raised when a command cannot be converted ... |
from django import forms
from django.contrib import admin
from examples.models import Task, Status, Project, Priority
from richtemplates.forms import RestructuredTextAreaField
class TaskFormAdmin(forms.ModelForm):
content = RestructuredTextAreaField()
class Meta:
model = Task
class TaskAdmin(admin.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A tool to run a python function in a module from command line.
This tool import a function from command line arguments and run it.
It is helpful to test a function when you developing or just want
to run a function in module. If you want to test a function, please
use ... |
# Volatility
# Copyright (C) 2007,2008 Volatile Systems
#
# Volatools Basic
# Copyright (C) 2007 Komoku, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, o... |
import json
from django.db import transaction
from django.shortcuts import get_object_or_404
from rest_framework.permissions import AllowAny
from rest_framework.viewsets import ModelViewSet
import commonware.log
from mkt.api.authentication import (RestAnonymousAuthentication,
Rest... |
import csv
from loader import load_single_file
num_of_topics__criteria_for_cut_words = 20
num_of_appearance__criteria_for_cut_words = 10
output_num_of_words_per_topic = 50
def load_vocab():
vocab = {}
inverse_dict = load_single_file('keyword_table.csv')
num = max([int(x['unique']) for x in inverse_dict.values()])... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_blueprint_calculator.ui'
#
# Created: Sat Mar 19 14:47:54 2011
# by: pyside-uic 0.2.7 running on PySide 1.0.0~rc1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_BlueprintCalculato... |
# -*- coding: utf-8 -*-
"""Output module for the Excel Spreadsheet (XLSX) output format."""
from __future__ import unicode_literals
import datetime
import os
import re
import xlsxwriter
from plaso.output import dynamic
from plaso.output import interface
from plaso.output import manager
import pytz # pylint: disab... |
from ctypes import c_int, c_char
from warnings import warn
from . import _dll
class OpenMCError(Exception):
"""Root exception class for OpenMC."""
class GeometryError(OpenMCError):
"""Geometry-related error"""
class InvalidIDError(OpenMCError):
"""Use of an ID that is invalid."""
class AllocationEr... |
# Copyright 2012 Alvaro Vila
# alvarovmz@gmail.com
##########
# This file is part of PyLinkedIn.
##########
# PyLinkedIn is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of the License, ... |
#
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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 published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in th... |
'''
This file is part of the EdTech library project at Full Sail University.
Foobar 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... |
from django.conf import settings
from django.db import models
from .base import TYPE
from .base import ITEM_TYPE
from .base import EXPIRY_FACTOR
from .base import PER_TYPE
from .base import FREQUENCY_EXPIRED_REMINDER
from .base import REMINDER_BEFORE_EXPIRATION
class Checklist(models.Model):
"""
Stores a sing... |
import random
from django.db import models, transaction, IntegrityError
from django.conf import settings
from insekta.common.dblock import dblock
from insekta.network.utils import iterate_nets, int_to_ip
LOCK_NETWORK_ADDRESS = 947295
class NetworkError(Exception):
pass
class AddressManager(models.Manager):
... |
# coding: utf-8
from __future__ import unicode_literals
from collections import defaultdict
from django.contrib.admin import helpers
from django.contrib.admin.options import InlineModelAdmin, ModelAdmin
class SuperInlineModelAdmin(InlineModelAdmin):
inlines = ()
def get_inline_instances(self, request, obj=... |
""" Test the FilenamePlugin class"""
import unittest
from DIRAC.Resources.Catalog.ConditionPlugins.FilenamePlugin import FilenamePlugin
__RCSID__ = "$Id $"
class TestfilenamePlugin( unittest.TestCase ):
""" Test the FilenamePlugin class"""
def setUp(self):
self.lfns = [ '/lhcb/lfn1', '/lhcb/anotherlfn', '/o... |
# 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.
# --------------------------------------------------------------------... |
import httplib
import os
import socket
import ssl
import urllib
from hydna import core
from hydna import exceptions
def send(uri, data, origin=None, ua=core.DEFAULT_UA, priority=None):
"""Send `data` to `uri` and return `True` on successful request. Optional
arguments:
`origin` - origin of the reques... |
# Python Imports
# Django Imports
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
# Create your models here.
class TimeStampedModel(models.Model):
"""
An abstract base class for storing created/modified metadata with a model
"""
# T... |
# Author: Ivan Vilata i Balaguer
# Contact: ivan@selidor.net
# Revision: $Revision: 21817 $
# Date: $Date: 2005-07-21 13:39:57 -0700 (Thu, 21 Jul 2005) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.s... |
"""empty message
Revision ID: f17134fe3cc9
Revises:
Create Date: 2017-04-13 11:17:43.739703
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f17134fe3cc9'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
from Components.ActionMap import ActionMap
from Components.Button import Button
from Components.config import config
from Components.MenuList import MenuList
from Components.TimerList import TimerList
from Components.TimerSanityCheck import TimerSanityCheck
from Components.UsageConfig import preferredTimerPath
from Rec... |
#!/usr/bin/env python
#
# VMEncryption extension
#
# Copyright 2015 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... |
from datetime import datetime
from random import choice
from string import ascii_letters, digits
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.mixins import Perm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.