src stringlengths 721 1.04M |
|---|
#
# Copyright (C) 2013 Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This ... |
#!/usr/bin/env python
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... |
# -*- 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 field 'Practice.wikipage'
db.add_column(u'project_practice', 'wi... |
import cv2
import cv2.cv as cv
import math
# Structuring element for morphing
def getStructuringElement(morphType, size):
return cv2.getStructuringElement(morphType, (2*size + 1, 2*size + 1), (size, size))
# Bounding rectangle for images
def getBoundingRectangle(img, kp, width, height, multiplier):
size = int(kp.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cv2.cv as cv
import os
import sys
import Image
import argparse
import time
def encodeChinese(msg):
type = sys.getfilesystemencoding()
return msg.decode('UTF-8').encode(type)
parser = argparse.ArgumentParser(description = encodeChinese('进行贴图相似度判断'))
parser.add_argume... |
"""public_submission
Revision ID: 530b45f11128
Revises: 282efa88cdbc
Create Date: 2013-10-02 18:31:40.722832
"""
#
# # SAUCE - System for AUtomated Code Evaluation
# # Copyright (C) 2013 Moritz Schlarb
# #
# # This program is free software: you can redistribute it and/or modify
# # it under the terms of the GNU Affer... |
import sys
import os
from .base import *
DEBUG = False
# Update database configuration with $DATABASE_URL.
import dj_database_url
db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)
SECRET_KEY = os.environ.get('SECRET_KEY')
# AWS S3 settings
DEFAULT_FILE_STORAGE = 'storages.backends.s3b... |
import sys
from kraken.ui.Qt import QtWidgets, QtGui, QtCore
from ..fe import FE
from ..widget_factory import EditorFactory
from ..base_editor import BaseValueEditor
class IntegerEditor(BaseValueEditor):
def __init__(self, valueController, parent=None):
super(IntegerEditor, self).__init__(valueControll... |
import pandas as pd
# TODO: Load up the dataset
# Ensuring you set the appropriate header column names
#
df = pd.read_csv('Datasets/servo.data', names=['motor', 'screw', 'pgain', 'vgain', 'class'])
print df.head()
# TODO: Create a slice that contains all entries
# having a vgain equal to 5. Then print the
# length ... |
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# 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 ... |
import numpy as np
import pandas as pd
import sys
INPUT_FILE_PATH = sys.argv[1]
OUTPUT_FILE_PATH = INPUT_FILE_PATH \
.replace('AnoAtual', 'current-year') \
.replace('AnoAnterior', 'last-year') \
.replace('AnosAnteriores', 'previous-years') \
.replace('.csv', '.xz')
data = pd.read_csv(INPUT_FILE_PATH,
... |
from django.db import models
from college.models import College, Player, Week, CollegeYear
RANKINGTYPE_CHOICES = (
('T', 'Team'),
('P', 'Player'),
)
CURRENT_SEASON = 2011
class RankingType(models.Model):
name = models.CharField(max_length=75)
slug = models.SlugField(max_length=75)
typename = mode... |
import calendar
import os
import time
from datetime import datetime
import pytest
from dateutil import tz
import arrow
from arrow import formatter, parser
from arrow.constants import MAX_TIMESTAMP_US
from arrow.parser import DateTimeParser, ParserError, ParserMatchError
from .utils import make_full_tz_list
@pytest... |
# Copyright (C) 2008 One Laptop Per Child
#
# 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.
#
# This program is distribu... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
from blazeweb.globals import rg
from blazeweb.content import getcontent
from blazeweb.utils import redirect
from blazeweb.views import View, forward, jsonify
from werkzeug.exceptions import ServiceUnavailable
from formencode.validators import UnicodeString, Int
class Rvb(View):
def default(self):
# this ... |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... |
from __future__ import division
from openfisca_tunisia.model.base import *
from openfisca_tunisia import entities
from numpy.ma.testutils import assert_not_equal
from urllib.request import Request
try:
from scipy.optimize import fsolve
except ImportError:
fsolve = None
def calculate_net_from(salaire_imposa... |
"""fontTools.pens.basePen.py -- Tools and base classes to build pen objects.
The Pen Protocol
A Pen is a kind of object that standardizes the way how to "draw" outlines:
it is a middle man between an outline and a drawing. In other words:
it is an abstraction for drawing outlines, making sure that outline objects
don... |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... |
# -*- coding: utf-8 -*-
#
# magic_circuit_simulator documentation build configuration file, created by
# sphinx-quickstart on Thu Aug 7 09:13:35 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
# autogener... |
import os
from datetime import datetime
from getpass import getpass
from lib.view import terminal
from lib.utils import constants, util
from lib.base_controller import CommandHelp
from distutils.version import LooseVersion
from .client.info import ASProtocolError
from .live_cluster_command_controller import LiveCluste... |
# coding: utf-8
from time import time, sleep
from .block import Block
from . import generator_path
from .._global import CrappyStop
class Generator(Block):
"""This block is used to generate a signal.
It can be used to drive a machine. This block can take inputs, and each path
can use these inputs to take dec... |
#!/usr/bin/env python
import logging
import random
import argparse
import StringIO
from Bio import SeqIO, Seq
logging.basicConfig(level=logging.INFO)
def disambiguate(fasta_file, seed=42, tbl_out=None):
records = list(SeqIO.parse(fasta_file, "fasta"))
output = StringIO.StringIO()
if seed != 0:
r... |
# 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
# d... |
from .view import View
from ..backends.matplotlib import MatplotlibBackend
from boadata import unwrap
import seaborn as sns
# @View.register_view
class HistogramView(View):
def accepts(cls, data_object):
return True
def create_widget(self, parent=None, xcol=None, bins=50, **kwargs):
if xcol i... |
"""
System commands
"""
import sys
import operator
import io
import time
import importlib_resources
import pmxbot.core
from pmxbot.core import command, Handler
@command(aliases='h')
def help(rest):
"""Help (this command)"""
rs = rest.strip()
if rs:
# give help for matching commands
for ... |
#!/usr/bin/env python
#
##
# Copyright (c) 2013-2015 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 ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 07 14:28:16 2018
@author: Alexander
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 27 15:01:09 2018
@author: abooth
"""
from xmlstats import xmlstats
import numpy as np
import pandas as pd
access_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... |
# 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 agreed to in... |
from clarifai import rest
from clarifai.rest import ClarifaiApp
import argparse
from urlparse import urlparse
import urllib2
import urllib
import json
import cam_discovery
MAPS_API_KEY = ""
OUTPUT_FILE_PATH = "/var/www/html/webeye/webeye.js"
def get_url_list_from_file(file_path):
file_to_read=open(file_path,'r')
r... |
from thespian.actors import requireCapability
class TestUnitRequireCapability(object):
@requireCapability('asdf')
class req1: pass
def test_oneReq(self):
capcheck = TestUnitRequireCapability.req1.actorSystemCapabilityCheck
assert not capcheck({}, 0)
assert not capcheck({'asdf':F... |
#!/usr/bin/python3
# bwCGI.py by Bill Weinman <http://bw.org/contact/>
# Copyright (c) 1995-2010 The BearHeart Group, LLC
#
from cgi import FieldStorage
import cgitb
import os
__version__ = '0.3.2'
_cookie_var = 'HTTP_COOKIE'
class bwCGI:
''' handy cgi stuff '''
_header_state = False # True after... |
"""Module grouping tests for the
pydov.types.interpretaties.GeotechnischeCodering class."""
from pydov.types.interpretaties import GeotechnischeCodering
from pydov.util.dovutil import build_dov_url
from tests.abstract import AbstractTestTypes
location_wfs_getfeature = \
'tests/data/types/interpretaties/geotechnisc... |
# Copyright 2021 The Flax 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 wri... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import sys
import os.path
import io3d
path_to_script = os.path.dirname(os.path.abspath(__file__))
#import featurevector
import unittest
from loguru import logger
# logger = logging.getLogger()
# import apdb
# apdb.set_trace();
# import sc... |
# This file is part of Epoptes, http://epoptes.org
# Copyright 2018 the Epoptes team, see AUTHORS.
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Define required gi package versions in a common place, and install gettext.
Rationale:
gi requires something like:
import gi
gi.require_version('Gtk', '3.0')
fr... |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... |
# -*- encoding: utf-8 -*-
"""Test class for Subnet UI
:Requirement: Subnet
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: UI
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_ipaddr, gen_netmask, gen_string
from nailgun import entities
from robottelo.da... |
# Copyright 2014 IBM Corp.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
# coding: UTF-8
'''
Created on Apr 16, 2014
@author: hernan
'''
from __future__ import absolute_import
import re
from usig_normalizador_amba.settings import CALLE_ALTURA, CALLE_Y_CALLE, INVALIDO
from usig_normalizador_amba.Calle import Calle
class Direccion:
'''
@ivar calle: Calle de la direccion
@type ... |
from flask import jsonify,request
from flask.ext.login import current_user
from mitra import app,db
from mitra.models.category import Category
@app.route('/_addCategory', methods=['PUT', 'POST'])
def AddCategory():
data = {}
# TODO Check for valid Userinput
if current_user.is_authenticated():
pars... |
from __future__ import print_function, unicode_literals
import logging
import os
import subprocess
import sys
import six
from rbtools.utils.encoding import force_unicode
def log_command_line(fmt, command):
"""Log a command line.
Args:
fmt (unicode):
A format string to use for the log m... |
# 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
# d... |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by
# Ansible still belong to the author of the module, and may assign their
# own license to the complete wo... |
from django.contrib import admin
from django.utils.safestring import mark_safe
from edc_base.modeladmin_mixins import audit_fieldset_tuple
from ..admin_site import bcpp_subject_admin
from ..forms import PositiveParticipantForm
from ..models import PositiveParticipant
from .modeladmin_mixins import CrfModelAdminMixin
... |
import sys
from voluptuous.error import LiteralInvalid, TypeInvalid, Invalid
from voluptuous.schema_builder import Schema, default_factory, raises
from voluptuous import validators
__author__ = 'tusharmakkar08'
def _fix_str(v):
if sys.version_info[0] == 2 and isinstance(v, unicode):
s = v
else:
... |
"""empty message
Revision ID: 3974d310ac43
Revises: edfc37a36914
Create Date: 2016-11-11 16:39:16.828429
"""
# revision identifiers, used by Alembic.
revision = '3974d310ac43'
down_revision = 'edfc37a36914'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 EMC Corporation.
# Copyright (c) 2012 OpenStack LLC.
# 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 Lic... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-21 08:42
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('action', '0001_initial'),
]
operations ... |
#!/usr/bin/env python3
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gio, Gdk, GdkPixbuf
import os
import sys
import detectHardware
import driverMatcher
import listboxHelper
import packagekitHelper
EXEC_FOLDER = os.path.realpath(os.path.dirname(__file__)) + "/"
builder = Gtk.Builder()
build... |
import gentestcases, cmdline, util, setup, report, convert, resfile
import os, string
true, false = 1,0
ext = ""
binext = ""
def execute(lang, type):
global ext, binext
#counter to indicate progress
total = 1
#os type
if util.IsWindowsOS() and os.environ.get('OSTYPE') == 'win32':
ext = "cpp"
bin... |
'''
Copyright (C) 2015 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful... |
from matchmaker import app
import datetime
from sqlalchemy import or_
from models import BotIdentity, MatchResult, BotSkill, BotRank
from util import serialize
from matchmaker import db
class PlayerData(object):
def __init__(self, user):
today = datetime.date.today()
self.bots = db.session.query... |
# -*- coding: utf-8 -*-
# #############################################################################
#
#
# Copyright (C) 2012 KMEE (http://www.kmee.com.br)
# @author Fernando Marcato Rodrigues
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... |
from setuptools import setup
def readme():
try:
with open("README.rst", encoding="UTF-8") as readme_file:
return readme_file.read()
except TypeError:
# Python 2.7 doesn't support encoding argument in builtin open
import io
with io.open("README.rst", encoding="UTF-8... |
#!/usr/bin/python
#coding=utf-8
import urllib2
import HTMLParser
import sys
import xml.dom.minidom as minidom
from htmlentitydefs import entitydefs
import glob
import requests.packages.urllib3.util.ssl_
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'ALL'
reload(sys)
sys.setdefaultencoding('utf-8')
class MyPar... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from flask import Flask, render_template, abort, request, jsonify, Response
from flask.ext.sqlalchemy import SQLAlchemy
from xml.etree.ElementTree import Element, SubElement, tostring
import xml.etree.ElementTree as ET
from models import *
app = Flask(__na... |
#!/usr/bin/env python
import subprocess
import sys
import os
import argparse
from glob import glob
parser = argparse.ArgumentParser(description='Generate v210/mov file from image sequence.'
'Written by Kieran O\'Leary.')
parser.add_argument('input', help='file path of parent director... |
# Copyright (C) 2009 Canonical Ltd
#
# 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.
#
# This program is distributed in ... |
#!/usr/bin/env python2
"""
Usage:
./scraper.py [options]
Options:
-h, --help Prints this help message
-o FILE, --output FILE Specifies output file
-c COLLEGE, --college COLLEGE Specifies a specific college
-l, --last-term-only Only ouputs the last term
... |
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos 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, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual('true value', result)
def test_if_... |
import os, sys
from PIL import Image, ExifTags
size = (128, 128)
for infile in os.listdir(sys.argv[1]):
inpath = os.path.join(sys.argv[1], infile)
pieces = os.path.splitext(inpath)
outpath = pieces[0] + ".thumb" + pieces[1]
if (inpath != outpath and not os.path.exists(outpath) and
'thumb' not ... |
#!/usr/bin/env python3
import re
import sys
import glob
import os.path
import xml.etree.ElementTree as ET
# Command-line arguments
config_root = ET.parse(sys.argv[1]).getroot()
rest_checkout = sys.argv[2]
main_namespace = sys.argv[3]
# Will keep the content of all the files we're generating
files = {}
# The templ... |
#!/usr/bin/env python
# Pack .m files into M[UMPS] routine transfer format (^%RO)
#
# python packRO.py *.m > routines.ro
#
# or
#
# ls *.m | python packRO.py > routines.ro
#
#---------------------------------------------------------------------------
# Copyright 2011 The Open Source Electronic Health Record Agent
#... |
# epaper.py main module for Embedded Artists' 2.7 inch E-paper Display.
# Peter Hinch
# version 0.9
# 17 Jun 2018 Adapted for VFS mount/unmount.
# 18 Mar 2016 Adafruit module and fast (partial) updates.
# 2 Mar 2016 Power control support removed. Support for fonts as persistent byte code
# 29th Jan 2016 Monospaced font... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from .models import Action
class ActionForm(forms.Form):
message_ = forms.CharField(
label=_('Message'),
... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... |
''' Copyright (c) 2013 Potential Ventures Ltd
Copyright (c) 2013 SolarFlare Communications Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above c... |
# 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... |
##########################################################################
# Author: rfriedlein, rfriedlein@coredial.com
# Date: February 4th, 2011
# Revised:
#
# BaytechPduBank object class
#
# This program can be used under the GNU General Public License version 2
# You can find full in... |
#!/usr/bin/env python
# *-* coding:utf-8 *-*
"""
:mod:`lab_objects` -- Objects in Python
=========================================
LAB Objects Learning Objective: Explore objects in Python and how everything in Python
is an object.
a. Fill in the series of functions below that determ... |
#!/usr/bin/env python
class Graph:
"Plot various graphs into burndown chart"
def __init__ (self, graph_data):
self.getGraphData(graph_data)
def getGraphData(self, graph_data):
self.x = graph_data['x']
self.y = graph_data['y']
self.xy_extra = 0
self.ymin = graph_data['ymin']
self.ymax = ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... |
import re
from visidata import *
from .git import GitSheet
from .diff import DifferSheet
option('vgit_show_ignored', False, '')
theme('color_vgit_staged_mod', 'green', 'files staged with modifications')
theme('color_vgit_staged_del', 'red', 'files staged for deletion')
theme('color_vgit_staged_add', 'green', 'files st... |
# -*- 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 unique constraint on 'Store', fields ['code']
db.create_unique('... |
#!/usr/bin/env python
# Copyright 2008 Google Inc. All Rights Reserved.
'''Tests for connection objects.'''
__author__ = 'Mark Roach (mrroach@google.com)'
import unittest
import urllib2
from StringIO import StringIO
from pyactiveresource import connection
from pyactiveresource import util
from pyactiveresource.test... |
# -*- coding: utf-8 -*-
#
# Copyright © 2015 Tiger Computing Ltd.
#
# 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 python2
# -*- coding: utf-8 -*-
"""
# Copyright (C) 2014 Tom Cloud
# 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) ... |
import os
from time import time
from libs.IO.input_generator import generate_input
def generate_name_file(kind, path):
"""
This function allows to generate sequential input file name
@param kind: int, 0 if input, 1 if output
@param path: string, the path where generate file
@return: string, the n... |
###############################################################################
#
# Copyright 2009-2011, Universitat Pompeu Fabra
#
# This file is part of Wok.
#
# Wok 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 6 19:43:08 2017
@author: m75380
Script to add SIRENE to API
"""
import argparse
import json
import os
from api_helpers import APIConnection
# =============================================================================
# Paths to configuration ... |
"""Controls selection of proper class based on the device type."""
from __future__ import unicode_literals
from netmiko.cisco import CiscoIosSSH
from netmiko.cisco import CiscoIosTelnet
from netmiko.cisco import CiscoAsaSSH
from netmiko.cisco import CiscoNxosSSH
from netmiko.cisco import CiscoXrSSH
from netmiko.cisco i... |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2014 Frederic Branczyk fbranczyk@gmail.com
# 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 ... |
from django import forms
from django.core.urlresolvers import reverse, get_urlconf, get_resolver, NoReverseMatch
from django.db import models
from django.db.models.query import QuerySet
from django.db.models.fields.related import RelatedField
from django.utils.encoding import smart_unicode
from djangorestframework.res... |
##
# Copyright 2013-2014 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... |
"""
A naive keyword extractor which just pulls out nouns and noun phrases.
Was using the PerceptronTagger is _way_ faster than NLTK's default tagger, and more accurate to boot.
See <http://stevenloria.com/tutorial-state-of-the-art-part-of-speech-tagging-in-textblob/>.
However, it complicates the library's installatio... |
from flask import Flask, render_template, url_for
from twitter import Twitter, OAuth
from re import findall
from dateutil import parser
from datetime import datetime
import pytz
CONSUMER_KEY = 'redacted'
CONSUMER_SECRET = 'redacted'
oauth_token = 'redacted'
oauth_secret = 'redacted'
app = Flask(__name__)
t = Twitter... |
# Copyright 2012 majgis Contributors
#
# Individuals comprising majgis Contributors are identified in
# the NOTICE file found in the root directory of this project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... |
"""Tests for selectors.py."""
import unittest
import unittest.mock
from asyncio import selectors
class FakeSelector(selectors._BaseSelectorImpl):
"""Trivial non-abstract subclass of BaseSelector."""
def select(self, timeout=None):
raise NotImplementedError
class _SelectorMappingTests(unittest.Tes... |
# -*- coding: utf-8 -*-
"""
Домен. Создает один процесс для одного домена openre. Получает и передает
спайки (pub), получает команды от сервера (req-rep) и пересылает результат
выполнения команды.
"""
from openre.agent.decorators import daemonize
from openre.agent.helpers import daemon_stop
import logging
import signal... |
import unittest
from decimal import Decimal
from lib.commands import Commands
class TestCommands(unittest.TestCase):
def test_setconfig_non_auth_number(self):
self.assertEqual(7777, Commands._setconfig_normalize_value('rpcport', "7777"))
self.assertEqual(7777, Commands._setconfig_normalize_value... |
import math
import pdb
class Golem(object):
def __init__(self, x, y, args, attractors,golem_number):
self.attractors=attractors
self.args=args
self.position=complex(x,y)
self.velocity=complex(0,0)
#self.acceleration_previous=self.attractors.get_force(self.position,self.veloc... |
#!/usr/bin/python
import gps
import math
import datetime
import threading
#import the adxl345 module
import adxl345
import time
import greatcircle
import numpy as np
import scipy.fftpack
lock = threading.Lock()
gpstime = ""
def gps_logger():
global inSync,gpstime
logging = False
# feet
threshold = 25
# L... |
#!/usr/bin/env python3
# ,---------, ____ _ __
# | ,-^-, | / __ )(_) /_______________ _____ ___
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# | / ,--´ | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Crazyflie control firmwar... |
#
# Module providing various facilities to other parts of the package
#
# multiprocessing/util.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
import sys
import functools
import os
import itertools
import weakref
import atexit
import threading # we want threading to ... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.