text stringlengths 475 200k |
|---|
'''
Entry point module to start the interactive console.
'''
from _pydev_imps._pydev_saved_modules import thread
start_new_thread = thread.start_new_thread
try:
from code import InteractiveConsole
except ImportError:
from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
from code impo... |
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed in the hope that ... |
#!/usr/bin/python
import numpy as np
#a = np.linspace(0.,10.,100)
#b = np.sqrt(a)
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import csv
def import_text(filename, separator):
for line in csv.reader(open(filename), delimiter=separator,
skipinitialspace... |
from __future__ import division, print_function
from bm_tools import OnlineLogsumexp, sigmoid, log1pexp, logsumexp
import numpy
from scipy import linalg
TRAIN = "/home/mark/Projects/succotash/succotash/datasets/train_examples.npy"
TEST = "/home/mark/Projects/succotash/succotash/datasets/test_examples.npy"
X = numpy.l... |
from PIL import Image, ImageDraw
from math import floor, sqrt
from latex import build_pdf
import tempfile
from shapely.geometry import LineString, Point
from shapely import affinity
from concurrent.futures import ThreadPoolExecutor
class MapDownloader:
"""Base class for map providers with maps consisting of image... |
#!/usr/bin/env python3
# Copyright (c) 2012 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.
import idl_schema
import unittest
from json_parse import OrderedDict
def getFunction(schema, name):
for item in schema['functi... |
"""
LTI Provider view functions
"""
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import redirect_to_login
from django.core.urlresolvers import reverse
from django.http import HttpResponseBadRequest, HttpResponseForbidden
from django.views.dec... |
# -*- coding: utf-8 -*-
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... |
# -*- 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... |
from __abstractfetcher import AbstractFetcher
import logging
import time
import json
import urllib
class JsonRaw(AbstractFetcher):
def __init__(self, **config):
self.log = logging.getLogger("combaine")
self.filter = lambda x: True
try:
self.port = config.get('port', 81... |
# Author: Nic Wolfe <[EMAIL]>
# 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 Free Software Foundation, either version 3 of the License, or
... |
"""Tests for scraper base class."""
from unittest import TestCase
from statscraper import (BaseScraper, Dataset, Dimension, Result,
DimensionValue, Collection, ROOT, NoSuchItem)
class Scraper(BaseScraper):
"""A scraper with hardcoded yields."""
def _fetch_itemslist(self, item):
... |
# Copyright 2010 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... |
import numpy as np
import pandas as pd
import sys
import ast
class flow_grid():
"""
Container class for holding and manipulating gridded VIC routing data.
Can be instantiated with optional keyword arguments. These keyword
arguments will be used to add a dataset (dem, flowdir, accumulation)
... |
#!/usr/bin/python
#
# Copyright (c) 2017 Genome Research Ltd.
#
# Author: Joshua C. Randall <[EMAIL]>
#
# This file is part of hgi-systems.
#
# hgi-systems 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; eithe... |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from io import BytesIO
from openpyxl.compat import (
itervalues,
safe_string,
iteritems
)
from openpyxl.cell import (
column_index_from_string,
coordinate_from_string,
)
from openpyxl.xml.constants import (
REL_NS,
S... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__='ar'
import re
import sys
import os
import glob
import time
import json
import numpy as np
import skimage.io as io
import skimage.color as skcolor
import skimage.transform as sktransform
import matplotlib.pyplot as plt
from keras import backend as K
import keras
f... |
# -*- coding: utf-8 -*-
from django.db import transaction
import mailchimp
from framework import sentry
from framework.celery_tasks import app
from framework.celery_tasks.handlers import queued_task
from framework.auth.signals import user_confirmed
from osf.models import OSFUser as User
from website import settings
... |
import os
import shlex
import sys
import unittest
from unittest.mock import patch, MagicMock
import starfile_edit_argparse as s
ctf_starfile = '''
data_
loop_
_rlnVoltage #1
_rlnDefocusU #2
_rlnDefocusV #3
_rlnDefocusAngle #4
_rlnSphericalAberration #5
_rlnDetectorPixelSize #6
_rlnCtfFigureOfMerit #7
_rlnCtf... |
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
import re
import unicodedata
class ExtractContent(object):
# convert character to entity references
CHARREF = {
"nbsp": " ",
"lt": "<",
"gt": "<",
"amp": "&",
"laquo": '\x00\xc2\xab', # u"\x00\xab".encode("utf-8")
... |
# -*- 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 License, Version 2.0 (the
#... |
#!/usr/bin/env python
'''
extract mavlink mission from log
'''
import sys, time, os
from argparse import ArgumentParser
parser = ArgumentParser(description=__doc__)
parser.add_argument("--output", default='mission.txt', help="output file")
parser.add_argument("logs", metavar="LOG", nargs="+")
args = parser.parse_ar... |
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## 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
##
## ... |
# -*- coding: utf-8 -*-
""" Custom UI Widgets
@author: Michael Howden <[EMAIL]>
@author: Fran Boon <[EMAIL]>
@author: Dominic König <[EMAIL]>
@requires: U{B{I{gluon}} <http://web2py.com>}
@copyright: 2009-2011 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, fr... |
from functools import partial
import threading
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform
from kivy... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from openerp import api, fields, models, _
from openerp.exceptions import UserError
_logger = logging.getLogger(__name__)
class DeliveryCarrier(models.Model):
_name = 'delivery.carrier'
_inherit... |
"""Pseudo terminal utilities."""
# Bugs: No signal handling. Doesn't set slave termios and window size.
# Only tested on Linux.
# See: W. Richard Stevens. 1992. Advanced Programming in the
# UNIX Environment. Chapter 19.
# Author: Steen Lumholt -- with additions by Guido.
# 2016: Cornelius Diek... |
# MIT licensed code copied from https://bitbucket.org/chrisatlee/poster
"""Streaming HTTP uploads module.
This module extends the standard httplib and urllib2 objects so that
iterable objects can be used in the body of HTTP requests.
In most cases all one should have to do is call :func:`register_openers()`
to regist... |
# -*- coding: utf-8 -*-
"""
Instructor (2) dashboard page.
"""
from bok_choy.page_object import PageObject
from .course_page import CoursePage
import os
from bok_choy.promise import EmptyPromise, Promise
from ...tests.helpers import select_option_by_text, get_selected_option_text, get_options
class InstructorDashboa... |
#!/usr/bin/env python
"""
This module provides a simple but functional parser for the SIEVE
language used to filter emails.
This implementation is based on RFC 5228 (http://tools.ietf.org/html/rfc5228)
"""
import re
import sys
from sievelib.commands import (
get_command_instance, CommandError, RequireCommand)
... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
import json
import logging
import time
import requests
from flask import current_app
log = logging.getLogger(__name__)
# See http://docs.python-requests.org/en/latest/user/advanced/#timeouts
# We are waiting 3 sec for the connexion and 9 for the response.
TIMEOUT = (3.1, 9.1)
CONNECTION_ERROR_MSG = 'Unable to reach... |
import unittest
from ggame.logic import BoolSRFF, BoolAND, BoolNAND, BoolNOR, BoolNOT
from ggame.mathapp import MathApp
from ggame.inputpoint import MetalToggle, GlassButton
from ggame.indicator import LEDIndicator
import time
class TestLogicMethods(unittest.TestCase):
def test_gates(self):
IC1 = BoolNOT(... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
from myhdl import *
from mem import ram_sdp_ar
def fifo_speculative(rst, clk, full, we, din, empty, re, dout, wr_commit=None, wr_discard=None, rd_commit=None, rd_discard=None, afull=None, aempty=None, count=None, afull_th=None, aempty_th=None, ovf=None, udf=None, count_max=None, depth=None, width=None):
""" Spe... |
#!/usr/bin/env python
import config
# Google's AppEngine modules
import webapp2
from webapp2 import Route
from webapp2_extras import routes
from webapp2_extras.routes import DomainRoute
# Controllers and handlers
from controllers.auth import *
from controllers.users import *
from controllers.meetings import *
from c... |
import os
from PyQt4 import QtCore, QtGui
import common
class FileList(QtGui.QListWidget):
files_dropped = QtCore.pyqtSignal()
def __init__(self, parent=None):
super(FileList, self).__init__(parent)
self.setAcceptDrops(True)
self.setIconSize(QtCore.QSize(32, 32))
# drag and dr... |
# Copyright 2019 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
# coding=utf-8
# -----------------
# file : output_log.py
# date : 2012/11/11
# author : Victor Zarubkin
# contact : [EMAIL]
# copyright : Copyright (C) 2012 Victor Zarubkin
# license : This file is part of BehaviorStudio.
# :
# : BehaviorStudio is free software: you can r... |
from cherrypy.test import test
test.prefer_parent_path()
import sys
import cherrypy
from cherrypy.test import helper
def setup_server():
conf = cherrypy.config.copy()
def load_tut_module(name):
"""Import or reload tutorial module as needed."""
cherrypy.config.reset()
cherry... |
import os
import platform
import subprocess
MYPY = False
if MYPY:
# MYPY is set to True when run under Mypy.
from typing import Text
from typing import Callable
from typing import Any
from typing import Generic
from typing import TypeVar
from typing import Optional
T = TypeVar("T")
else... |
"""
Classes to support nib files.
:Author: James Taylor ([EMAIL]), Bob Harris ([EMAIL])
A nib sequence is a sequence of DNA, using the 10 character alphabet A,C,G,T,N
(upper and lower case). The file is packed as 4 bits per character.
nib file format
---------------
Fields can be in big- or little-endian format; ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
lasprecision.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
... |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Jakob Schnitzer.
#
# 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 ... |
# -*- coding: utf-8 -*-
# This file is part of IRIS: Infrastructure and Release Information System
#
# Copyright (C) 2013-2015 Intel Corporation
#
# IRIS is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2.0 as published by the Free Software Foundat... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 5 12:41:29 2016
@author: eman
"""
import os
import scipy.io
import spectral.io.envi as envi
import numpy as np
import pickle
def get_hsi(datatype='vcu', system='linux'):
# defining which system I am currently in
if system in ['linux']:
... |
# Copyright 2013 Red Hat, 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 agr... |
#
# Squeezebox client
#
# copyright (c) 2013 James Roberts <[EMAIL]>
# Using agoclient sample code as guidance!
import agoclient
import squeezeboxserver
import threading
import time
client = agoclient.AgoConnection("squeezebox")
# if you need to fetch any settings from config.ini, use the get_config_option call. The... |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# 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, mo... |
from uuid import UUID
import gzip
from ssl import SSLError
import StringIO
from boto.exception import S3ResponseError
from django.db.models import *
from django.db import IntegrityError
from simplejson import JSONDecodeError
from canvas import json, bgwork
from canvas.models import BaseCanvasModel
from canvas.notific... |
import struct
import time
import kafka.io
import kafka.request_type
class Consumer(kafka.io.IO):
CONSUME_REQUEST_TYPE = kafka.request_type.FETCH
MAX_SIZE = 1024 * 1024
# seconds.
DEFAULT_POLLING_INTERVAL = 2
def __init__(self, topic, partition=0, offset=0, host='localhost', port=9092):
kafka.io.IO._... |
__author__ = 'e0d'
"""
Retrieves AWS Auto-scaling lifecycle messages from and SQS queue and processes them. For
the LifeCycleTransition type of autoscaling:EC2_INSTANCE_TERMINATING, ec2 instances are inspected
for an ok_to_retire tag. If that tag exists, the termination state transition is continued, if not, the
lif... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from numpy import (abs, asarray, cos, floor, arange, pi, prod, roll, sin, sqrt, sum,
repeat, atleast_2d, tril)
from numpy.random import uniform
from .go_benchmark import Benchmark
class Salomon(Benchmark):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tool to validate artifact definitions."""
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import os
import sys
from artifacts import definitions
from artifacts import errors
from artifacts import reader
from... |
from test.test_support import findfile, run_unittest, TESTFN
import unittest
import os
import io
import aifc
class AIFCTest(unittest.TestCase):
def setUp(self):
self.f = self.fout = None
self.sndfilepath = findfile('Sine-1000Hz-300ms.aif')
def tearDown(self):
if self.... |
# Kdump configuration constants
#
# 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 distribu... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsComposition.
.. note:: 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, or
(at your option) any later version.
"""
__... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2016, Niklas Hauser
# Copyright (c) 2016, Fabian Greif
# All rights reserved.
import logging
from enum import Enum
from collections import OrderedDict
from modm_devices.device_identifier import MultiDeviceIdentifier
LOGGER = logging.getLogger('dfg.tree')
class Devi... |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2019 Laurent Monin
# Copyright (C) 2019-2020 Philipp Wolfer
#
# 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 Fou... |
'''
This file tests functions from io.py.
'''
import os
import shutil
import numpy as np
import infer_structcol
from infer_structcol.io import load_spectrum
from infer_structcol.format_converter import convert_data
from numpy.testing import assert_almost_equal
def test_io():
# convert the spectrum
filepath = ... |
# -*- 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 'Survey.anon'
db.add_column(u'survey_survey', 'anon',
self.gf('django.d... |
# MODULE: fiesta-components
# CLASS: taco-system
# CLASS: enchilada-system
# CLASS: south-bridge-sun-md1535d
import time
from sim_core import *
from components import *
from configuration import convert_to_pre_objects
from fiesta_nvram import register_nvram_commands, write_idprom_to_nvram
SIM_load_module('pci-com... |
from password_policies.models import PasswordHistory
def password_status(request):
"""
Adds a variable determining the state of a user's password
to the context if the user has authenticated:
* ``password_change_required``
Determines if the user needs to change his/her password.
Set to ``True`` if the u... |
import pygame
from pygame.locals import *
import os
from random import randint
class Mono(object):
def __init__(self):
ruta_mono = os.path.join('sources','monkey.png')
self.imagen = pygame.image.load(ruta_mono)
self.rect = self.imagen.get_rect()
self.iniciar()
de... |
"""
Views file for the Darklang Django App
"""
from __future__ import absolute_import
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.shortcuts import redirect
from django.template.loader import render_to_string
from django.utils.decorators import method_decorator
... |
import os
from tornado.options import options, define, parse_command_line
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.websocket
import tornado.gen
waiting_player = None
class PongWebSocket(tornado.websocket.WebSocketHandler):
def open(self):
global... |
# -*- coding: utf-8 -*-
from urlparse import urljoin
import bleach
import pytest
from cssselect.parser import SelectorSyntaxError
from jinja2 import escape, Markup
import mock
from pyquery import PyQuery as pq
import kuma.wiki.content
from kuma.core.tests import KumaTestCase, eq_, ok_
from kuma.users.tests import Use... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
# Ralf Habacker, 2006 (rh)
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_scc(conf):
"""
Detect the Sun C compiler
"""
v = conf.env
cc = conf.find_program('cc', var='CC')
try:
conf.cmd_and_log(cc + ['... |
# Copyright (c) 2014-2020 Matthias Geier
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
__all__ = ('UserManage... |
# -*- coding: utf-8 -*-
import attr
import importscan
import sentaku
from cfme.modeling.base import BaseCollection, BaseEntity
from cfme.utils.update import Updateable
@attr.s
class GenericObjectInstance(BaseEntity, Updateable, sentaku.modeling.ElementMixin):
"""Generic Objects class to context switch between R... |
from __future__ import print_function
import errno
import os
import tempfile
import textwrap
import shutil
import sys
import file_locks
from tracing import Tracing
import hashlib
def get_file_contents_if_exists(path, default=None):
with Tracing('BuckProject.get_file_contents_if_it_exists', args={'path': path}):
... |
# coding=utf-8
import unittest
"""600. Non-negative Integers without Consecutive Ones
https://leetcode.com/problems/non-negative-integers-without-consecutive-ones/description/
Given a positive integer n, find the number of **non-negative** integers less
than or equal to n, whose binary representations do NOT contain ... |
#XXX vsude - water station, container to water pot!
#=================================================================
# yawspi hardware configuration
#=================================================================
# hw adress is composed of two numbers - first one is index of the hw device,
# second one is pin num... |
# This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
#
# MAUS 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
'''
Manipulate DJB's Constant Databases. These are 2 level disk-based hash tables
that efficiently handle many keys, while remaining space-efficient.
http://cr.yp.to/cdb.html
When generated databases are only used with Python code, consider using hash()
rather than djb_hash() for a tidy spe... |
# -*- coding: utf-8 -*-
# This file is part of the Gedit LaTeX Plugin
#
# Copyright (C) 2010 Michael Zeising
# 2011 Ignacio Casal Quinteiro
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public Licence as published by the Free Software
# F... |
"""Helpers for commands related to manipulating files"""
import pathlib
import re
import shutil
import sys
import tempfile
import time
from versionner import vcs
from versionner.errors import ConfigError
def update_project_files(cfg, proj_version):
"""
Update version string in project files
:rtype : di... |
#! /usr/bin/env python
"""
Routines for creating the input files that are employed to perform the virtual screening
These routines were developed by:
Rodrigo Antonio Faccioli - [EMAIL] / [EMAIL]
Leandro Oliveira Bortot - [EMAIL] / [EMAIL]
"""
import os
import vina
import ConfigParser as configpar... |
"""Unit tests for assembly"""
# Copyright (C) 2011 Garth N. Wells
#
# This file is part of DOLFIN.
#
# DOLFIN 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, or
# (at y... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
#
# Kickstart handler for the subscription module.
#
# Copyright (C) 2020 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 ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************************... |
# Copyright (c) 2013 OpenStack Foundation
#
# 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 ... |
#!/usr/bin/python
#This is a python based script for configuring user-defined-log-statistics
# from commandline
# Usage :
# ./provision_user_defined_log_statistics.py --conf /etc/contrail/contrail-schema.conf --conf /etc/contrail/contrail-keystone-auth.conf -h
# usage: user_defined_log_statistics.py [-h] [-c FILE]
# ... |
from __future__ import unicode_literals
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from common.models import APPLY_STATUS
from common.models import User
class Announcement(models.Model):
KINDS = (
('offer', 'Oferta'),
('demand', 'Demanda')... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
import json
import frappe.defaults
from frappe.utils import cint, nowdate, nowtime, cstr, add_days, flt, today
from erpne... |
'''
convert Ereignisse.xlsx table to erignisse.json
run this scrips in the sam path as table
'''
import numpy as np
import pandas as pd
import copy,sys,pathlib
import collections
import xlrd,json
import datetime
import acoustics
path = 'EreignisListe.xlsx'
passby = {}
#open xls
wb = xlrd.open_workbook(path)
ws = wb.s... |
import os, filecmp, shutil, tempfile
import unittest
from test import test_support
class FileCompareTestCase(unittest.TestCase):
def setUp(self):
self.name = test_support.TESTFN
self.name_same = test_support.TESTFN + '-same'
self.name_diff = test_support.TESTFN + '-diff'
data = 'Co... |
from django.conf.urls import url
from . import views
urlpatterns = [
url('^save/(?P<name>[^/]+)', views.save, name='dashboard_save'),
url('^save_template/(?P<name>[^/]+)/(?P<key>[^/]+)',
views.save_template, name='dashboard_save_template'),
url('^load/(?P<name>[^/]+)', views.load, name='dashboard_l... |
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... |
from xenon.base.datatypes import Sweepable
from xenon.base.designsweeptypes import ExhaustiveSweep
import params
class Benchmark(Sweepable):
sweepable_params = [
params.cycle_time,
params.pipelining,
params.cache_size,
params.cache_assoc,
params.cache_hit_latency,
params.cache_li... |
#
# Copyright (c) 2009-2015 Tom Keffer <[EMAIL]>
#
# See the file LICENSE.txt for your full rights.
#
"""Routines for calculating a 16 bit CRC check. """
_table=[
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, # 0x00
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, ... |
"""
服务器主程序,用于监听各种事件然后分发处理回复
"""
from flask import Flask, request, abort, render_template, json, jsonify
from datetime import date
from itertools import groupby
import logging
import sys
import json
import time
import requests
sys.path += ["./lib", "./lib/wechat-python-sdk"]
import getip
import db
import WeChatButtons
... |
"""
Test the interaction with the learning_sequences app, where course outlines are
stored.
"""
from datetime import datetime, timezone
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.content.learning_sequences.api import get_course_outline
from openedx.core.djangoapps.content.learning_sequenc... |
from __future__ import print_function
import functools
import pytest
from jaraco.test import services
import pmxbot.util
def throws_exception(call, exceptions=[Exception]):
"""
Invoke the function and return True if it raises any of the
exceptions provided. Otherwise, return False.
"""
try:
call()
except tu... |
# 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 requir... |
#!/usr/bin/python
##
# build-test.py [--verbose]
#
# reads the output of exiv2 -v -V and inspects it for sanity
# inspect run-library libraries platform/compiler/{debug|release}{shared|static}
# TODO: 1 report loaded libraries that we didn't expect
# 2 mingw support
##
import os
import sys
import subprocess
##... |
## Greeter
def greeter(fn):
def wrapper():
print('Hello {}'.format(fn.__name__))
fn()
print('Bye {}'.format(fn.__name__))
# TypeError
# need to return wrapper
# TypeError
# x, y (not generic, move to *args, **kw)
# See None
# Need to return value
# val = fn(x, y)
# try/finally
# help(add... |
# Copyright (c) 2011-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
#
# Un... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.