src stringlengths 721 1.04M |
|---|
# -*- 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Tristan Fischer (sphere@dersphere.de)
#
# 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 ... |
import time
from geometry.utils import getNRandomPoints, getCircle
import BruteForceHull, QuickHull
from math import log
global fcount
fcount = 2
def outStr(a, b):
return "%i,%f" % (a, b)
def getBruteForceExecTime(points):
t1 = time.time()
BruteForceHull.computeHull(points)
t2 = time.time()
return t2-t1... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test:
cat data | map | sort | reduce
cat data | ./x.py -m | sort | ./x.py -r
hadoop jar /opt/cloudera/parcels/CDH/lib/hadoop-mapreduce/hadoop-streaming.jar \
-files x.py \
-mapper 'x.py -m' \
-reducer 'x.py -r' \
-input in \
-output out
@author: stevo
"""
fr... |
""" Captcha.Base
Base class for all types of CAPTCHA tests. All tests have one or
more solution, determined when the test is generated. Solutions
can be any python object,
All tests can be solved by presenting at least some preset number
of correct solutions. Some tests may only have one solution and require
one solu... |
import django_filters
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from dcim.models import DeviceRole, Platform, Region, Site
from tenancy.models import Tenant, TenantGroup
from .constants import CF_FILTER_DISABLED, CF_FILTER_EXACT, CF_TYPE_BOOLEAN, CF_TYPE_SELECT
from .mod... |
"""
Class for the state of the model
"""
import sys
import os
import importlib
import logging
from typing import Any, Dict, Sized # mypy
import numpy as np
from netCDF4 import Dataset, num2date
from .tracker import Tracker
from .gridforce import Grid, Forcing
# ------------------------
Config = Dict[str, Any]
c... |
#!/usr/bin/python
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(5000))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Control>Home"))
sequence.append(utils.AssertPresentationAction(
"1. Top o... |
try:
from space_age import SpaceAge
except ImportError:
raise SystemExit('Could not find space_age.py. Does it exist?')
import unittest
class SpaceAgeTest(unittest.TestCase):
def test_age_in_seconds(self):
age = SpaceAge(1e6)
self.assertEqual(1e6, age.seconds)
def test_age_in_earth_... |
#! /usr/bin/python -tt
import nose
from rhuilib.util import *
from rhuilib.rhui_testcase import *
from rhuilib.rhuimanager import *
from rhuilib.rhuimanager_cds import *
from rhuilib.rhuimanager_client import *
from rhuilib.rhuimanager_repo import *
from rhuilib.rhuimanager_sync import *
from rhuilib.rhuimanager_enti... |
from snooble import ratelimit
import time # used to monkeypatch this module
from unittest import mock
import pytest
class TestRatelimit(object):
def test_bursty(self):
limiter = ratelimit.RateLimiter(5, 1, bursty=False)
assert limiter.current_bucket == 1
assert limiter.refresh_period =... |
import datetime
from django.core.mail import EmailMessage, EmailMultiAlternatives
import olympia.core.logger
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.amo.celery import task
from olympia.amo.utils import get_email_backend
from olympia.bandwagon.models import Collection
from ... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import os
import stat
import sys
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/opt/ros/kinetic/share/catkin/cmake', 'catkinConfig.cmake.in')):
sys.... |
"""
Django settings for test_secretary project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Saas Manager
# Copyright (C) 2013 Sistemas ADHOC
# No email
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
... |
# 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 ... |
"""
This is a fake turtle module (with no relevant executable code, other than
a local docpicture parser included for testing) obtained through
severely amputating the original turtle module, for the purpose of
demonstrating the docpicture concept.
We start by including a drawing made with a docpicture "parser"
that i... |
"""Test class for ProvValidator service.
"""
# Copyright (c) 2015 University of Southampton
#
# 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 limitati... |
# This module contains functions related to file handling.
import os
from commands import getoutput
from pUtil import tolog, convert, readpar
def openFile(filename, mode):
""" Open and return a file pointer for the given mode """
# Note: caller needs to close the file
f = None
if os.path.exists(file... |
import logging
logger = logging.getLogger(__name__)
from bottle import route, get, post, delete
from bottle import request, response
def error(code, message):
response.status = code
message['status'] = code
return message
get_user_table = lambda db: db.get_table('users', primary_id='userid', primary_t... |
# framework/modules/dump_tables.py
#
# Copyright 2011 Spencer J. McIntyre <SMcIntyre [at] SecureState [dot] net>
#
# 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 Li... |
import urllib2
import operator
import os
from bs4 import BeautifulSoup
class Student:
def __init__(self, name, grade):
self._name = name
self._grade = grade
def __repr__(self):
return self._name + " " + str(self._grade)
if not os.path.exists('partial.html'):
response = urllib2.urlopen('https://docs.google.... |
#
# Copyright (C) 2013 EMBL - European Bioinformatics Institute
#
# 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 License, or (at your
# option) any later version.
#
# ... |
#! /usr/bin/env python
# _*_coding:utf-8_*_
import DataEncoding
import parameter
import json
import requests
import six
import time
class run_ad():
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
}
... |
"""
Ensure we can write to Vertica data sources.
"""
from __future__ import absolute_import
import textwrap
from unittest import TestCase
import luigi
import luigi.task
from mock import MagicMock, patch, sentinel
from edx.analytics.tasks.util.tests.target import FakeTarget
from edx.analytics.tasks.warehouse.run_vert... |
# PEEL is released under the GNU General Public License (see http://www.gnu.org/licenses/gpl.html).
# This code is currently being developed by Jeff Wagner (j5wagner [at] ucsd [dot] edu)
# If you have any questions, comments, or suggestions, please don't hesitate to contact Jeff.
# This code is very heavily based on Ja... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2019 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# ... |
import os
from unittest import mock
import pandas as pd
import pytest
from ruamel.yaml import YAML
import great_expectations.dataset.sqlalchemy_dataset
from great_expectations.core.batch import Batch
from great_expectations.core.expectation_suite import ExpectationSuite
from great_expectations.dataset import SqlAlche... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 Licen... |
import collections
from lib.logger import *
class HostAlertTemplate:
def __init__(self, homenet, alert):
self.homenet = homenet
self.alert = alert
self.subject = "A " + alert[6] + " alert was reported for host " + alert[7]
self.indicators = alert[8].replace('.', '[.]').split('|')
... |
# Copyright (c) 2017, John Skinner
import unittest
import unittest.mock as mock
import numpy as np
import pymongo.collection
import transforms3d as tf3d
import util.transform as tf
import database.client
import dataset.kitti.kitti_loader as kitti
class TestKITTILoader(unittest.TestCase):
def test_make_camera_pos... |
# Copyright 2018 The Cirq Developers
#
# 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 ... |
import logging
import time
from ibmsecurity.appliance.ibmappliance import IBMError
logger = logging.getLogger(__name__)
def restart(isamAppliance, check_mode=False, force=False):
"""
Restart LMI
"""
if check_mode is True:
return isamAppliance.create_return_object(changed=True)
else:
... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for mb.py."""
import json
import sys
import unittest
import mb
class FakeMBW(mb.MetaBuildWrapper):
def __init__(self):
super(FakeMBW, self... |
"""
Compute Bra-ket averaged Taylor expansion integrals over trajectories
traveling on adiabataic potentials
"""
import numpy as np
import nomad.compiled.nuclear_gaussian as nuclear
# Determines the Hamiltonian symmetry
hermitian = True
# Returns functional form of bra function ('dirac_delta', 'gaussian')
basis = 'g... |
import time
import numpy as np
import matplotlib.pyplot as plt
import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import CrossSection
# create a rectangular section
geometry = sections.RectangularSection(d=100, b=50)
# create a list of mesh sizes to analyse
mesh_sizes = [1... |
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (... |
# Copyright 2011, 2012 Keith Fancher
#
# This file is part of Blobulous.
#
# Blobulous 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 version.
... |
"""Tests related to embargoes of registrations"""
import datetime
from rest_framework import status as http_status
import json
import pytz
from django.core.exceptions import ValidationError
from django.utils import timezone
import mock
import pytest
from nose.tools import * # noqa
from tests.base import fake, OsfTe... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
#####################################
# ╔╗ ┬ ┬ ┬┌─┐ ╔╦╗┌─┐┌┬┐ #
# ╠╩╗│ │ │├┤ ║║│ │ │ #
# ╚═╝┴─┘└─┘└─┘ ═╩╝└─┘ ┴ #
# ╔═╗┌─┐┌─┐┌┬┐┬ ┬┌─┐┬─┐┌─┐ #
# ╚═╗│ │├┤ │ │││├─┤├┬┘├┤ #
# ╚═╝└─┘└ ┴ └┴┘┴ ┴┴└─└─┘ #
###... |
# Copyright (c) 2016 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 re... |
import os
import pytest
from rpmlint.checks.PolkitCheck import PolkitCheck
from rpmlint.filter import Filter
import Testing
from Testing import get_tested_package
def get_polkit_check(config_path):
from rpmlint.config import Config
if not os.path.isabs(config_path):
config_path = Testing.testpath()... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-03-02 18:17
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('libretto', '0047_source_t... |
from panda3d.core import *
from panda3d.direct import *
from toontown.toonbase.ToonPythonUtil import Enum, invertDictLossless
import math
from toontown.toonbase import ToontownGlobals
OurPetsMoodChangedKey = 'OurPetsMoodChanged'
ThinkPeriod = 1.5
MoodDriftPeriod = 300.0
MovePeriod = 1.0 / 4
PosBroadcastPeriod = 1.0 / 5... |
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013 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,
listed below:
@auth... |
""":mod:`kinsumer.config` --- Implements the configuration related objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import errno
import os
import types
from typing import Dict, Any
from typeguard import typechecked
from werkzeug.datastructures import ImmutableDict
from werkzeug.u... |
from ..remote import RemoteModel
class ManagementServerSectionGridRemote(RemoteModel):
"""
| ``DeviceID:`` none
| ``attribute type:`` string
| ``Network:`` none
| ``attribute type:`` string
| ``Collector:`` none
| ``attribute type:`` string
| ``DeviceIPDotted:`` none
|... |
# -*- coding: utf-8 -*-
"""
zine.utils.exceptions
~~~~~~~~~~~~~~~~~~~~~
Exception utility module.
:copyright: (c) 2010 by the Zine Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from zine.i18n import _
class ZineException(Exception):
"""Baseclass for all... |
# -*- coding: utf-8 -*-
from wego.exceptions import WeChatButtonError
'''
class BaseBtn(object):
pass
'''
class MenuBtn(object):
def __init__(self, name, *args):
self.json = {
'name': name,
'sub_button': [i.json for i in args]
}
class ClickBtn(object):
def __... |
import ConfigParser
import ast
import cPickle as pickle
import dpp
import numpy as np
import os
import shutil
import sys
import time
import uuid
def save_state(params, paramsFilename):
pickle.dump(params, open(paramsFilename, "wb"))
return 0
def rectified_linear(X):
return np.maximum(X, 0.0)
def d_rectified_l... |
# 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) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import hashlib
import configuration
import naclports
import package
EXTRA_KEYS = [ 'BIN_URL', 'BIN_SIZE', 'BIN_SHA1' ]
VALID_KEYS = nacl... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
"""Implements I/O streams over SSH.
Examples
--------
>>> with open('/proc/version_signature', host='1.2.3.4') as conn:
... print(conn.rea... |
#!/usr/bin/env python3#
import math
import time
#Create by Tsvetomir Gotsov
#tsvetomir.gotsov@gmail.com
#Ruse, Bulgaria
#A Program for compute Canadian Fire Weather Index
#
counter = 1
while 1:
#input variable
temperature = float(input("Temperature at 12:00, C: "))
humidity = float(input("Relative humidi... |
__author__ = 'Ed den Beer'
'''
Created on 19 november 2014
Version 0.0
@author: Ed den Beer - Rockwell Automation
'''
#import sys
import datetime
from gi.repository import Gtk
class Main():
def __init__(self):
self.builder = Gtk.Builder()
self.builder.add_from_file('glade/CiscoPortConnectionsDi... |
import os
import os.path
import sys
from fabric import Connection, Config
from click import echo, secho
from drift.management import get_ec2_instances
from drift.utils import get_config
EC2_USERNAME = 'ubuntu'
UWSGI_LOGFILE = "/var/log/uwsgi/uwsgi.log"
def get_options(parser):
parser.add_argument(
"--i... |
""" This module contains chunker and parser for USPTO APS
full-text used for patents granted 1976-2001.
"""
import re
import itertools
from uspto_tools.parse.patent import PatentClassification, USPatent,\
USReference, Inventor
from uspto_tools.parse.exceptions import ParseError
class Tag:
""" A single APS-ta... |
# -*- coding: utf-8 -*-
#
# APIx documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 12 13:45:25 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... |
import os
import pybedtools
import itertools
from collections import defaultdict
class BasePairClassifier(object):
def __init__(self, bed, annotations, genome, sample_name='sample',
names=None, prefix='split_'):
"""
Classifies files using bedtools multiinter.
The results ... |
import json
import os
import requests
from flask import Flask
from flask.ext.jsonpify import jsonify
from consts import GOODS
from consts import JSON_FILE
from consts import ROUTE_TYPES
from consts import SIZES
from utils import build_urls
from utils import build_urls_detail
from utils import create_vehicle_attrs
fro... |
from setuptools import setup, find_packages
import platform
platform_install_requires = []
if platform.system() == 'Darwin':
platform_install_requires += ['pyobjc-framework-CoreBluetooth']
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# G... |
from django.db import models
from wagtail.admin.edit_handlers import StreamFieldPanel
from wagtail.core.blocks import RichTextBlock
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail.search import index
from wagtail.search.queryset import SearchableQuerySetMixin
from wagtailm... |
"""
Publish/Subscribe tool
@author Paul Woods <paul@skytruth.org>
"""
import webapp2
from google.appengine.ext import db
from google.appengine.api import taskqueue
import json
import urllib2
import os
from taskqueue import TaskQueue
class Subscription (db.Model):
event = db.StringProperty()
url = db.S... |
import os, syslog
import pygame
import logging
class PyLcd :
screen = None;
colourBlack = (0, 0, 0)
def __init__(self):
"Ininitializes a new pygame screen using the framebuffer"
# Based on "Python GUI in Linux frame buffer"
# http://www.karoltomala.com/blog/?p=679
disp_no =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 Lice... |
'''
Created on 12 Jun 2009
@author: jdrumgoole
'''
import os
import itertools
from filetools.fileutils import FileOps
class TreeUtils :
def __init__(self ):
pass
def list(self, path, filesSelector=None, dirsSelector=None, topDown=True ):
if dir... |
import os, sys, gzip
import time
import math
import json
import cPickle as pickle
import numpy as np
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
from nn import create_optimization_updates, get_activation_by_name, sigmoid, linear
from nn import EmbeddingLayer, Layer, L... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import wagtail.wagtailcore.fields
from django.conf import settings
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('taggit', '0001_initial'),
migrations.sw... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.hr.doctype.leave_application.leave_application import LeaveDayBlockedError, OverlapError, NotAnOptionalHolid... |
import tensorflow as tf
import numpy as np
class NTM(object):
def __init__(self,session, mem_size, mem_dim,controller):
self.sess = session
self.memory_dim = mem_dim
self.memory_length = mem_size
# construct memory variables
self.memory = [tf.Variable(np.zeros(self.memory_dim).astype(np.float32)) for _ in ... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... |
# -*- coding: utf-8 -*-
def attachments():
owner_table = getlist(request.args, 0)
owner_key = getlist(request.args, 1)
if not (owner_table and owner_key):
response.view = 'others/gadget_error.html'
return dict(msg='attachments dont work!')
delete_id = request.vars... |
""" 2-input XOR example """
from __future__ import print_function
from neatsociety import nn, population, statistics, visualize
# Network inputs and expected outputs.
xor_inputs = [[0, 0], [0, 1], [1, 0], [1, 1]]
xor_outputs = [0, 1, 1, 0]
def eval_fitness(genomes):
for g in genomes:
net = nn.create_fee... |
# -*- coding:Latin-1 -*-
# Dessin d'un damier
from Tkinter import *
def damier():
"dessiner dix lignes de carrés avec décalage alterné"
y = 0
while y < 10:
if y % 2 == 0: # une fois sur deux, on
x = 0 # commencera la ligne de
else: ... |
#!/usr/bin/env python3
# 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... |
import json
import time
from django.template import RequestContext
from django.shortcuts import render_to_response
from social.models import *
from political.models import *
from political.api import *
from geo.models import Municipality
from django.core.urlresolvers import reverse
from django.core.mail import mail_ad... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-08-03 23:59
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... |
"""
Useful auxiliary data structures for query construction. Not useful outside
the SQL domain.
"""
from django.db.models.sql.constants import INNER, LOUTER
class EmptyResultSet(Exception):
pass
class MultiJoin(Exception):
"""
Used by join construction code to indicate the point at which a
... |
"""This module defines a linear response TDDFT-class.
"""
from math import sqrt
import sys
import numpy as np
from ase.units import Hartree
import _gpaw
import gpaw.mpi as mpi
MASTER = mpi.MASTER
from gpaw import debug
from gpaw.poisson import PoissonSolver
from gpaw.output import initialize_text_stream
from gpaw.lr... |
# Sentry
#
# This file is part of Sentry
#
# Sentry 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 version.
#
# Sentry is distrib... |
from django_evolution.tests.utils import test_sql_mapping
tests = r"""
>>> from django.db import models
>>> from django_evolution.mutations import ChangeField
>>> from django_evolution.tests.utils import test_proj_sig_multi, execute_test_sql, register_models_multi, deregister_models
>>> from django_evolution.diff imp... |
"""
This is a straight forward implementation of RFC 5869
HMAC-based Extract-and-Expand Key Derivation Function (HKDF)
http://tools.ietf.org/html/rfc5869
"""
import warnings
from Crypto.Hash import SHA512, HMAC
class HKDF:
"""
HMAC-based Extract-and-Expand Key Derivation Function (RFC 5869)
usage:
... |
"""
bridge to docker-compose
"""
import logging
from compose.container import Container
from compose.cli.command import get_project as compose_get_project, get_config_path_from_options
from compose.config.config import get_default_config_files
from compose.config.environment import Environment
def ps_(project):
"... |
# 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 ... |
#!/usr/bin/env python2
# Import system libraries and define helper functions
import time
import sys
import os
import os.path
from pprint import pformat
# First import the API class from the SDK
from facepp import API
from facepp import File
def print_result(hint, result):
def encode(obj):
if type(obj) is ... |
################################################################################
##
## Janus -- GUI Software for Processing Thermal-Ion Measurements from the
## Wind Spacecraft's Faraday Cups
##
## Copyright (C) 2016 Bennett A. Maruca (bmaruca@udel.edu)
##
## This program is free software: you can redistribute... |
# Support for the Numato Neso Artix 7 100T Board
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.soc.integration.soc_core import mem_decoder
from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import *
from litedram.modules import MT41K128M16
from ... |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... |
#!/usr/bin/env python
# encoding: utf-8
'''
File: DiscoJob.py
Author: NYU ITP team
Description: Disco Job Wrapper
'''
from disco.core import Job, result_iterator
from disco.worker.classic.worker import Params
from disco.worker.classic.modutil import locate_modules,find_modules
from mongodb_io import mongodb_output_str... |
from contextlib import ExitStack, contextmanager
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from argparse import Namespace
@contextmanager
def instrument(html_output=False):
"""Run a statistical profiler"""
try:
from pyinstrument import Profiler # pylint: disable=import-error
except ... |
#
# layers.py
# This file is part of ISOFT.
#
# Copyright 2018 Chris MacMackin <cmacmackin@gmail.com>
#
# 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 License,... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import print_function, unicode_literals
import posixpath
from flask import current_app, ... |
from __future__ import absolute_import
import re
from django.core.urlresolvers import reverse
from sentry.integrations.exceptions import ApiError, IntegrationError, ApiUnauthorized
from sentry.integrations.issues import IssueBasicMixin
from sentry.utils.http import absolute_uri
ISSUE_EXTERNAL_KEY_FORMAT = re.compile... |
from datetime import datetime
from rest_framework.exceptions import ValidationError
from uccaApp.models import Tabs, Constants, Roles
from django.db import models
from django.contrib.auth.models import User, Group
class Users(models.Model):
id = models.AutoField(primary_key=True)
user_auth = models.OneToOn... |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models, api
from opene... |
# -*- coding: utf-8 -*-
# 2014-11-18T22:48+08:00
import unittest
class OutOfRangeError(ValueError): pass
roman_numeral_map = (('M', 1000),
('CM', 900),
('D', 500),
('CD', 400),
('C', 100),
('XC', 90),
... |
# - LINKS - ALICE Bot
#
# By: traBpUkciP (2016)
import aiml # AI-Markup Language library
import datetime
import time
import urllib # library for dealing with web stuff through Python
import sys, os
path = os.path.dirname(os.path.abspath(sys.argv[0]))
BRAIN_FILE = path + "/bot_brain_ALICE.brn"
k = aiml.Kerne... |
# Copyright (c) 2016 Dell Inc. or its subsidiaries.
# 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
#
# ... |
import logging
from app import cache
from app.parser.v0_0_1.schema_parser import SchemaParser
from app.schema_loader.schema_loader import load_schema
logger = logging.getLogger(__name__)
def get_schema(metadata):
"""
Get the schema for the current user
:return: (json, schema) # Tuple of json and schema ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.