src stringlengths 721 1.04M |
|---|
#!/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.
"""Generator for C++ structs from api json files.
The purpose of this tool is to remove the need for hand-written code that
conver... |
#!/usr/bin/python
"""
Unittests for utils_libvirtd module.
"""
import unittest
import common
from virttest import utils_selinux
from autotest.client import os_dep
class TestSelinux(unittest.TestCase):
"""
Class for unittests of utils_selinux.
"""
def test_sestatus(self):
"""
Test the me... |
# 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 agreed to in writing, ... |
# 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 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
###############################################################################
#
# VFR importer based on GDAL library
#
# Author: Martin Landa <landa.martin gmail.com>
#
# Licence: MIT/X
#
###############################################################################
import os
import sys
from .utils import read_fil... |
#!/usr/bin/env python
"""
splinter
http://splinter.cobrateam.info
"""
from time import sleep
from splinter.browser import Browser
#url = 'http://simile.mit.edu/crowbar/test.html'
#url = 'http://dl.dropbox.com/u/144888/hello_js.html'
url = 'http://www.ncbi.nlm.nih.gov/nuccore/CP002059.1'
#url = 'http://translate.go... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
"""
TR-55 Model Implementation
A mapping between variable/parameter names found in the TR-55 document
and variables used in this program are as follows:
* `precip` is referred to as P... |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Copyright (c) 2017-2018 The LitecoinZ developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the wallet keypool, and interaction with wallet ... |
# encoding: utf-8
# module PyKDE4.kdecore
# from /usr/lib/python3/dist-packages/PyKDE4/kdecore.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtNetwork as __PyQt4_QtNetwork
class KUser(): # skipped bases: <class 'sip.wrapper'>
# no doc
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
import sys
import json
import errno
import platform
import fileinput
import subprocess
from datetime import datetime, timezone
try:
import requests
except ImportError:
raise ImportError(
'Failed to import \'requests\', run \'pip instal... |
from datetime import datetime
from flask import current_app
from sqlalchemy.sql import func
from changes.config import db, queue
from changes.constants import Result, Status
from changes.db.utils import try_create
from changes.jobs.signals import fire_signal
from changes.models import Build, ItemStat, Job
from changes... |
from .views import send_message_all, send_message_to, send_message_location, send_message_event
from .views import get_activities, get_messages, get_messages_from, get_messages_from_all, get_notifications
from django.conf.urls import url
urlpatterns = [
url(r'^send/message/all/$', send_message_all, name='send_mes... |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.uic import *
from myPeaks import *
from myDetector import *
from peakEditDlg import *
class myPeakTableWidget (QTableWidget) :
numPeaks = 0
#headList = QString("Num;H;K;L;len(XYZ)^-1;2-theta;Gonio[5];nu").split(";... |
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change th... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MyUser'
db.create_table(u'myuser_myuser', (
(... |
import argparse
import copy
import logging
import os
import re
import boto3
from botocore.exceptions import ClientError
import requests
import sqlalchemy
import time
import yaml
from dart.config.config import configuration, get_secrets_config, dart_root_relative_path
from dart.deploy.deployment import DeploymentTool
fr... |
# -*- coding: utf-8 -*-
import re
from datetime import timedelta, date, datetime
import calendar
# Variations of dates that the parser can capture
year_variations = ['year', 'years', 'yrs']
day_variations = ['days', 'day']
minute_variations = ['minute', 'minutes', 'mins']
hour_variations = ['hrs', 'hours', 'hour']
wee... |
# -*- coding: utf-8 -*-
from __future__ import division
from numpy import (
allclose, asanyarray, cross, dot, errstate, isclose, mean, nan_to_num,
nanmean, newaxis, stack, zeros, zeros_like)
from numpy.linalg import det, norm
from .config import config
from .bound_vector import BoundVector
from .line_segment ... |
# -*- coding: utf-8 -*-
import os
import sys
from distutils.command.sdist import sdist
from setuptools import setup, find_packages
import setuptools.command.test
class TestCommand(setuptools.command.test.test):
def finalize_options(self):
setuptools.command.test.test.finalize_options(self)
self.t... |
testData = {u'name': u'Michels Office',
u'roomDeviceLabels': [u'Aeon SmartStrip 03',
u'Aeon Ss 01',
u'Aeon Ss 02',
u'SmartSense Motion/Temp Sensor 01'],
u'roomDevices': [{u'children': {u'device': {u'id': u'db91bd2b-b03e-40e5-9889-7fa74107c262',
... |
import logging,sys,os
logger = logging.getLogger(__name__)
from common import MessageReceiver,db_tools
from balsam import models
from django.conf import settings
from django.db import utils,connections,DEFAULT_DB_ALIAS
class BalsamJobReceiver(MessageReceiver.MessageReceiver):
''' subscribes to the input user job ... |
'''
Created on Jun 6, 2013
@author: Mirna Lerotic, 2nd Look Consulting
http://www.2ndlookconsulting.com/
Copyright (c) 2013, Stefan Vogt, Argonne National Laboratory
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the ... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Frédéric Magniette, Miguel Rubio-Roy
# This file is part of Pyrame.
#
# Pyrame 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, ei... |
class Semigroup:
"""
In mathematics, a semigroup is an algebraic structure
consisting of a set together with an associative binary operation.
A semigroup generalizes a monoid in that there might not exist an identity element.
It also (originally) generalized a group (a monoid with all inverses)
... |
#!/usr/bin/env python
"""Does...
Created on Aug 25, 2011
@author: paulross
"""
__author__ = 'Paul Ross'
__date__ = '2011-08-03'
__version__ = '0.1.0'
__rights__ = 'Copyright (c) 2011 Paul Ross.'
###################################
# The many ways of calling parrot()
###################################
def parr... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 1 10:51:48 2017
@author: Satoshi Nakamoto
names: Alex Levering and Hector Muro
Non-standard dependencies:
* Twython
* NLTK
* Folium
* Geocoder
* psycopg2
TO DO BEFOREHAND:
The following steps are non-automatable and have to be performed manually.
* Have the NLTK vader ... |
"""
This file holds the abstract CLI class used to create command line utilities
that interact with Eva.
Please use the local_cli.py or remote_cli.py to interact with Eva via the
command line.
"""
import time
from multiprocessing import Process
class CLI(object):
"""
Interface object used to create CLI-based... |
#!/usr/bin/env python
from numpy import *
from pylab import *
import matplotlib.pyplot as plt
from scipy import interpolate
from scipy.interpolate import griddata
from matplotlib.patches import Ellipse
import sys, os
mpl.rcParams['pdf.fonttype'] = 42
### command-line arguments
thermalFileToPlot = sys.argv[1]
resonan... |
# -*- coding: utf-8 -*-
import json
from django.db import models
class Person(models.Model):
ACTIVITY_1 = 'activity_1'
ACTIVITY_2 = 'activity_2'
HOTEL_56 = 'hotel_56'
HOTEL_57 = 'hotel_57'
CATEGORY_CHOICE = (
(ACTIVITY_1, u'活动一'),
(ACTIVITY_2, u'活动二'),
(HOTEL_56, u'5月6日住... |
# -*- coding: utf-8 -*-
"""
symbolator_sphinx
~~~~~~~~~~~~~~~~~
Allow symbolator-formatted graphs to be included in Sphinx-generated
documents inline.
Derived from sphinx.ext.graphviz.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE.Sphinx f... |
#! /usr/bin/python
'''
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
'''
from node_struct import ListNode
class Solution:
# @param head, a ListNode
# @return a boolean
def hasCycle(self, head):
"""
:type head: ListNode
:rtype: bool
... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use t... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... |
import itertools
import glob
import os
import json
import functools
from populus.utils import (
get_contracts_dir,
get_build_dir,
)
from populus.solidity import solc
def find_project_contracts(project_dir):
contracts_dir = get_contracts_dir(project_dir)
# TODO: support non-solidity based contract com... |
from datetime import date
from ..core import OrthodoxCalendar, MON, daterange, cleaned_date
from ..registry_tools import iso_register
@iso_register('RU')
class Russia(OrthodoxCalendar):
'Russia'
# Civil holidays
include_labour_day = True
FIXED_HOLIDAYS = OrthodoxCalendar.FIXED_HOLIDAYS + (
(... |
# Copyright 2014, Tresys Technology, LLC
# Copyright 2017, Chris PeBenito <pebenito@ieee.org>
#
# This file is part of SETools.
#
# SETools 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 t... |
import plistlib
import os
import datetime
def spacer(): #For readability in the console
for i in range(5):
print('.')
def spacer_small():
print('')
def setup(): #Asks ne... |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
[TestAction.create_mini_vm, 'vm1', 'cluster=cluster2'],
[TestAction.change_vm_ha, 'vm1'],
[TestAction.create_min... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014 Technische Universität Berlin,
Fakultät IV - Elektrotechnik und Informatik,
Fachgebiet Regelungssysteme,
Einsteinufer 17, D-10587 Berlin, Germany
This file is part of PaPI.
PaPI is free software: you can redistribute it and/or modify
it under the term... |
#!/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... |
# Copyright 2016 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 ... |
#Задача №10, Вариант 30
#Напишите программу "Генератор персонажей" для игры.Пользователю должно быть предоставлено 30 пунктов,
#которые можно распределить между четырьмя характеристиками: Сила, Здоровье, Мудрость и Ловкость.
#Надо сделать так, чтобы пользователь мог не только брать эти пункты из общего "пула", но ... |
##
# Copyright (c) 2010-2017 Apple 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 applicab... |
##written 9-6-2017
##by Anupam KP (c)
##anupam2221@yahoo.in
##
##
##preprocessing time- O(n loglogn)
##Tells if a prime number in O(1)
dexterprime=[0]*500
def akpprocess(n):
n=int(n)
global dexterprime
dexterprime=[0]*(n+1)
dexterprime[0]=dexterprime[1]=1
for i in range(2,n+... |
#-
# Copyright (c) 2011 Robert N. M. Watson
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# License... |
from setuptools import setup, find_packages
VERSION = "1.1.1"
LONG_DESCRIPTION = """
=================================
django-dynamic-setting
=================================
Django Dynamic Setting is a small module that allows you to create settings that can be edited
using the Django admin dashboard.
"""
setup(
... |
import ConfigParser
import os
import re
import yaml
from argyle import rabbitmq, postgres, nginx, system
from argyle.base import upload_template
from argyle.postgres import create_db_user, create_db
from argyle.supervisor import supervisor_command, upload_supervisor_app_conf
from argyle.system import service_command, ... |
# -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed u... |
# -*- 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 model 'BaseClient'
db.create_table('codemanagement_baseclient', (
('id', self.gf('djang... |
"""
This module contains classes that ...
"""
import logging
import copy
import gensim
import itertools
import numpy
# import safire.datasets.transformations
import safire.utils.transcorp
from safire.utils import IndexedTransformedCorpus, flatten_composite_item
__author__ = "Jan Hajic jr."
class Zipper(gensim.interf... |
# -*- coding: utf-8 -*-
''' TWSE stock no. '''
# Copyright (c) 2012, 2013, 2014 Toomore Chiang, http://toomore.net/
#
# 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, incl... |
#!/usr/bin/env python
# Draws a 150 px radius circle centered in an 800x600 px image
# Adapted from a scheme script-fu contributed by Simon Budig
from gimpfu import *
def draw_circle():
width = 600
height = 600
image = pdb.gimp_image_new(width, height, RGB)
layer = gimp.Layer(image, "layer", image.width, ... |
# Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from askbot.utils.console import ProgressBar
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
posts = orm['askbot.Post'].objec... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django_extensions.db.fields
import uuid
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name=... |
"""
Tests the performance of instantiating SpawnItem implemented inheriting from lists and using
for loop optimized in Cython.
https://github.com/RobertoPrevato/PythonLab
Copyright 2017, Roberto Prevato
https://robertoprevato.github.io
Licensed under the MIT license:
http://www.opensource.org/licenses/MIT
"""
... |
"""
MassOpenCloud / Hardware Isolation Layer (HIL)
Slurm Control Daemon - HIL Reservation Prolog
May 2017, Tim Donahue tpd001@gmail.com
"""
import argparse
import hostlist
import inspect
import logging
import os
import sys
from datetime import datetime, timedelta
from time import strftime
libdir = os.path.realpath(... |
try:
# newer Pythons do not support relative imports, OOo Python does not seem to support absolute import
import idphoto.extensioncore # non-"from" import gives more relevant error message (see uno.py)
from idphoto.extensioncore import *
except ImportError:
import extensioncore # non-"from" import gives more rel... |
# KlupuNG
# Copyright (C) 2013 Koodilehto Osk <http://koodilehto.fi>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ve... |
"""
TODO: send relevant signals when creating, deleting, unpublishing etc...
TODO: How to best connect various bit that we can read from the URLs?
"""
from __future__ import unicode_literals
from urlparse import urlparse
from webmentiontools.urlinfo import UrlInfo
from django.shortcuts import render, g... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
BiorecDialog
A QGIS plugin
FSC QGIS plugin for biological recorders
-------------------
begin : 2014-02-17
copyright ... |
"""Impact function based on Padang 2009 post earthquake survey
This impact function estimates percentual damage to buildings as a
function of ground shaking measured in MMI.
Buildings are currently assumed to be represented in OpenStreetMap with
attributes collected as during the July 2011 Indonesian mapping competiti... |
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Romain Bignon
#
# 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 3 of the License.
#
# This program is distributed in the hope that it will b... |
# Copyright (c) 2013 Hortonworks, 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 ... |
"""A class to encapsulate CoMet data"""
# Copyright 2012-2014 Anthony Beville
# 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
from ppclass import pp
import matplotlib.pyplot as mpl
import numpy as np
import ppplot
u = pp()
#u.file = "/home/aymeric/Big_Data/ustar.101x101x201.CaseA.w30_zipbl.nc"
u.file = "BIGLES10m_wind5_USTM_9-11.nc"
u.var = "USTM"
u.x = "0,1000"
u.y = "0,1000"
tttall = "0,1e10"
for yeah in [tttall]:
... |
# Definitions of extension to TimeSeries to store trajectory information
# All format specifications must be stored in dictionary "fs"
# "mnts2" is the "namespace" for this extension
# This extension explicitly specifies meaning for each column of dataset data
{"fs": {"mnts2": {
"info": {
"name": "Sabes lab data ... |
# Copyright (c) 2015 Charles University in Prague, Faculty of Arts,
# Institute of the Czech National Corpus
# Copyright (c) 2015 Tomas Machalek <tomas.machalek@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
#... |
import random
import zlib
import hashlib
import math
base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
S = 64
def md5hex(arr):
m = hashlib.md5()
m.update(str(bytearray(arr)))
return m.hexdigest()
def sha1hex(arr):
m = hashlib.sha1()
m.update(str(bytearray(arr)))
retu... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
from agenda.model import Occurrence, Event, Venue, Tag, EventTag
from agenda.forms import EventForm
from flask import render_template, request, redirect, url_for
from flask_security import login_required
from datetime import datetime
from agenda import app
@app.route('/')
@app.route('/events/')
def events():
page ... |
"""
The twistranet Fields
"""
import os
import urlparse
from django import forms
from django.core.validators import URL_VALIDATOR_USER_AGENT
from django.db import models
from django.core.validators import EMPTY_VALUES
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext as _
fro... |
"""
Utilities for building 2D histograms of spectroscopic data
Created on Mar 1, 2016
@author: Chris Smith -- cmsith55@utk.edu
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import sys
if sys.version_info.major == 3 and sys.version_info.minor >= 6:
disable_histogram = Tr... |
"""
Set operations for 1D numeric arrays based on sorting.
:Contains:
ediff1d,
unique,
intersect1d,
setxor1d,
in1d,
union1d,
setdiff1d
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in... |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from gym.spaces import Tuple, Discrete, Dict
import os
import logging
import numpy as np
import torch as th
import torch.nn as nn
from torch.optim import RMSprop
from torch.distributions import Categorical
imp... |
"""
`.` `.` ...` .... ...`
`;'', :##+ +##`#####, .######` +##.+####'
`'''', :#### +#########, .########` '#########,
;'';` `###' +###,``;###``###. `;##+ '###,``####
.'''` `### +##' ###,:##: ###`'##+ .###
.''' ###.+##, :##'###+++++###.'##, `###
.:::,,,... |
import logging
import datetime
from sqlalchemy import func, and_, or_, not_
from flask import url_for, session
from misc.mixins import myTemplateView, JSONView
from utils.arp_list import get_mac_by_ip
from models.all_models import InetEther, ARPCache
from models.session import session
from utils.server.http_client... |
"""
Flask-Fixtures
--------------
A fixtures library for testing Flask apps.
"""
import os
import subprocess
from setuptools import setup
root_dir = os.path.abspath(os.path.dirname(__file__))
package_dir = os.path.join(root_dir, 'flask_fixtures')
# Try to get the long description from the README file or the modul... |
"""KDDCUP 99 dataset.
A classic dataset for anomaly detection.
The dataset page is available from UCI Machine Learning Repository
https://archive.ics.uci.edu/ml/machine-learning-databases/kddcup99-mld/kddcup.data.gz
"""
import errno
from gzip import GzipFile
import logging
import os
from os.path import dirname, ex... |
# python
# This file is generated by a program (mib2py). Any edits will be lost.
from pycopia.aid import Enum
import pycopia.SMI.Basetypes
Range = pycopia.SMI.Basetypes.Range
Ranges = pycopia.SMI.Basetypes.Ranges
from pycopia.SMI.Objects import ColumnObject, MacroObject, NotificationObject, RowObject, ScalarObject, N... |
'''
FileChooser
===========
.. versionadded:: 1.0.5
.. versionchanged:: 1.2.0
In the chooser template, the `controller` is not a direct reference anymore
but a weak-reference.
You must update all the notation `root.controller.xxx` to
`root.controller().xxx`.
Simple example
--------------
main.py
.... |
from braces.views import LoginRequiredMixin
from django.contrib.auth import authenticate, login
from django.conf import settings
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.http import Http404
from django.shortcuts import render, redirect
from django.utils import time... |
"""
Copyright (c) 2016 Keith Sterling
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, distribute,... |
# PyIPCalc
#
# Copyright (c) 2017, Christiaan Frans Rademan.
# All rights reserved.
#
# LICENSE: (BSD3-Clause)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above ... |
# Copyright 2010 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... |
# Copyright 2016 Douban Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
import unittest
import logging
from .solution_service import SolutionService
from .naming_service import NamingService
from .data_reader import DataReader
class TestSolutionService(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.logger = logging.getLogger('services')
cls.logger.set... |
"""Swap edges in a graph.
"""
import math
from networkx.utils import py_random_state
import networkx as nx
__all__ = ["double_edge_swap", "connected_double_edge_swap"]
@py_random_state(3)
def double_edge_swap(G, nswap=1, max_tries=100, seed=None):
"""Swap two edges in the graph while keeping the node degrees f... |
import requests, logging, json, collections, six, logging
from functools import wraps
if six.PY3: basestring=str
logging.basicConfig()
def _processRequest(fn):
@wraps(fn)
def wrapper(self, tokens, *args, **kwargs):
request=fn(self, tokens, *args, **kwargs)
if request.status_code==requests.cod... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Flask-GoogleCharts documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 6 20:15:31 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present i... |
# 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 file is part of Invenio.
## Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 CERN.
##
## 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
## Lic... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2017 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... |
#!/usr/bin/env python2.7
"""
Last updated: 30/09/2015
"""
import os
import argparse
from collections import OrderedDict
import pysam
# delim object
class Delim(object):
def __init__(self,path,hea,dlm):
self.path = path
file_matrix = []
file_lines = []
header = "NA"
with ope... |
#!/usr/bin/python
import os
import sys
import time
import subprocess
import argparse
from collections import OrderedDict
def find_time_unit(t):
if t < 0.000001:
return 'ns'
if t < 0.001:
return '\xc2\xb5s'
if t < 0.1:
return 'ms'
return 's'
def convert_time(t, unit):
if un... |
#!/usr/bin/env python
# pep8.py - Check Python source code formatting, according to PEP 8
# Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
# Copyright (C) 2009-2014 Florent Xicluna <florent.xicluna@gmail.com>
# Copyright (C) 2014 Ian Lee <ianlee1521@gmail.com>
#
# Permission is hereby granted, free of c... |
import urllib2
from BeautifulSoup import BeautifulSoup
import sqlite3
import time
spoilerSite = 'http://www.spollywood.com/' #maybe move to main.py
def sqlStart():
return sqlite3.connect('moviespoilerbot.db')
def sqlConnection(sqlconn):
return sqlconn.cursor()
def sqlClose(conn):
conn.close()
def weirdTextFix(... |
# -*-coding:UTF-8-*-
import os
import tornado.web
import tornado.gen
from hashlib import md5
from bson import ObjectId
from app.user.model import UserModel
from ushio._base import BaseHandler
class ProfileHandler(BaseHandler):
def initialize(self):
super(ProfileHandler, self).initialize()
@tornado.w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.