src stringlengths 721 1.04M |
|---|
# encoding: 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 'FacebookProfile.facebook_open_graph'
db.add_column('django_facebook_facebookprofile', 'fac... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 1 19:20:31 2017
@author: au194693
"""
import pandas as pd
import numpy as np
# import matplotlib.pyplot as plt
from sklearn.model_selection import (StratifiedKFold, cross_val_score,
permutation_test_score)
fro... |
# -*- coding: utf-8 -*-
import requests
import bs4
import time
import codecs
class Tool:
def __init__(self,cityName):
self.rootUrl = 'http://www.anjuke.com/'
self.baseUrl = self.rootUrl + cityName + '/cm/'
self.checkHref = self.rootUrl + cityName + '/'
self.blUrlModle = 'http://'+cityName+'.anjuke.com/commu... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
max_pos = len(nums) - 1
posl = 0
posr = len(nums)
while posl < posr:
mid = (posl + posr) / 2
if nums[mid] <= n... |
#!/usr/bin/env python3
import os, os.path
import sys, subprocess
configure_args = sys.argv[1:]
x64 = True
while len(configure_args) > 0:
arg = configure_args[0]
if arg == '--64':
x64 = True
elif arg == '--32':
x64 = False
else:
break
configure_args.pop(0)
if x64:
hos... |
# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.
# 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) ... |
# -*- coding: utf-8 -*-
from bson import ObjectId
from enum import Enum
from models.base import BaseModel
class NotificationModel(BaseModel):
MONGO_COLLECTION = 'notification'
def __init__(self, *args, **kwargs):
super(NotificationModel, self).__init__(*args, **kwargs)
@property
def specif... |
# -*- coding: utf-8 -*-
"""
fabfile.py
~~~~~~
It provides a basic suite of operations for executing local
or remote shell commands, as well as auxiliary functionality
such as prompting the running user for input, or aborting
execution.
:copyright: (c) 2014 by @zizzamia
:license: BSD (See LICENSE for details)
"""
im... |
# Copyright 2018 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.
"""Implements commands for running and interacting with Fuchsia on QEMU."""
import boot_data
import common
import emu_target
import logging
import md5
impor... |
#!/usr/bin/env python
#
# rename.py GPytage module
#
############################################################################
# Copyright (C) 2009-2010 by Kenneth Prugh #
# ken69267@gmail.com #
# ... |
################################################################################
# gae_python_gcm/gcm.py
#
# In Python, for Google App Engine
# Originally ported from https://github.com/Instagram/node2dm
# Extended to support new GCM API.
# Greg Bayer <greg@gbayer.com>
#################################################... |
# -*- coding: utf-8 -*-
from datetime import datetime
import magento
import logging
import xmlrpclib
import socket
from trytond.pool import PoolMeta, Pool
from trytond.transaction import Transaction
from trytond.pyson import Eval
from trytond.model import ModelView, ModelSQL, fields
from .api import OrderConfig
__met... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
import csv
import datetime
import sys
def str_to_time_delta(string) -> datetime.timedelta:
"""
:param string: Input in format 0:01:37.083557
:return: datetime.timedelta
"""
flds = string.split(":")
hours = flds[0]
minutes = flds[1]
second... |
"""Apache plugin constants."""
import pkg_resources
from letsencrypt import le_util
CLI_DEFAULTS_DEBIAN = dict(
server_root="/etc/apache2",
vhost_root="/etc/apache2/sites-available",
vhost_files="*",
version_cmd=['apache2ctl', '-v'],
define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],
resta... |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2014 Peter Williams <peter@newton.cx> and collaborators.
# Licensed under the MIT License.
"""pwkit.bblocks - Bayesian Blocks analysis, with a few extensions.
Bayesian Blocks analysis for the "time tagged" case described by Scargle+
2013. Inspired by the bayesian_bloc... |
'''
Class to find and trim overlapping ends of a contig
Attributes:
-----------
fasta_file : input fasta file
working_directory : path to working directory (default to current working directory)
contigs : dict of contigs (instead of fasta file)
trim : trim overlaps (default true)
trim_reversed_overlaps: trims overlaps... |
import os
import unittest
import utils
import time
import string
import json
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
FIXTURES_DIR = os.path.join(CURRENT_DIR, "fixtures", "debian", "kafka-connect")
KAFKA_READY = "bash -c 'cub kafka-ready {brokers} 40 -z $KAFKA_ZOOKEEPER_CONNECT && echo PASS || echo FAI... |
# Copyright (c) 2011 Nokia
#
# 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, s... |
from datetime import date
from django import forms
from narratives.models import Narrative
from django.forms.extras.widgets import SelectDateWidget
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse
from django.core.exceptions import Permissio... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.test import TestCase
from django.core.cache import cache
from spotseeker_server.models import Spot
class SpotCacheTest(TestCase):
def test_spot_caching(self):
spot = Spot.objects.create(name='foo')
... |
# -*- encoding: utf-8 -*-
##################################################################################
#
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
#
# This program is free software: you can redistribute it and/o... |
#!/usr/bin/env python
'''
Created on Jun 8, 2013
@author: mmartin
'''
from gi.repository import Gtk
import sys
from handlers import Handlers
from CDMIConstants.constants import (
DEBUGPATH
)
from CDMISession import CDMISession
from UIMenu import UI_MENU
class CDMIMainWindow(object):
def __init__(self, ppa... |
# Network configuration proxy to NetworkManager
#
# Copyright (C) 2013 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 pr... |
import argparse
import importlib
import logging
import os
import os.path
import sys
import crosstex
import crosstex.style
logger = logging.getLogger('crosstex')
parser = argparse.ArgumentParser(prog='crosstex',
description='A modern, object-oriented bibliographic tool.')
#parser.add_... |
# Django settings for resume project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Administrator', 'li.tzuhsien@gmail.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'resumedb... |
import sys
import xbmc,xbmcaddon,xbmcvfs
import sqlite3
from subprocess import Popen
import datetime,time
# from vpnapi import VPNAPI
channel = sys.argv[1]
start = sys.argv[2]
ADDON = xbmcaddon.Addon(id='script.stargate.guide')
def adapt_datetime(ts):
# http://docs.python.org/2/library/sqlite3.html#registering-a... |
## HISTOGRAM COMPUTATIONS FOR REYNOLDS AND ROSSBY NUMBERS
from __future__ import print_function
# path
import os
path = os.path.dirname(os.getcwd()) + '/' # on level above
os.chdir(path) # change working directory
import numpy as np
from scipy import sparse
# OPTIONS
runfolder = [10]
p... |
import mimetypes
from email import (
charset as Charset, encoders as Encoders, generator, message_from_string,
)
from email.errors import HeaderParseError
from email.header import Header
from email.headerregistry import Address, parser
from email.message import Message
from email.mime.base import MIMEBase
from emai... |
# coding=utf-8
#
# Copyright 2015-2017 F5 Networks 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... |
"""
Copyright (c) 2017 Genome Research Ltd.
Authors:
* Christopher Harrison <ch12@sanger.ac.uk>
* Simon Beal <sb48@sanger.ac.uk>
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... |
import os
import sys
import shutil
import glob
from os.path import join, realpath, dirname, normpath, normcase
from operator import methodcaller
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import click
from pkg_resources import Requirement
try:
WindowsError
exc... |
# Class for finding general genepred matches
import sys, random, string
from GenePredBasics import GenePredEntry
from RangeBasics import Bed
import base64
# Similar to genepred but no requirement for exact borders
class FuzzyGenePred:
#set use_dir true if you want to use direction and make it direction specific
#s... |
import os
import difflib
import pytest
from jinja2 import Template
securedrop_test_vars = pytest.securedrop_test_vars
def test_app_iptables_rules(SystemInfo, Command, Sudo):
# Build a dict of variables to pass to jinja for iptables comparison
kwargs = dict(
mon_ip=securedrop_test_vars.mon_ip,
... |
# -*- coding: utf-8 -*-
"""Tests of Kwik file opening routines."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import os.path as op
import numpy as np
from numpy.testing import assert_array_... |
'''
Validates that the json has meaningful keys
'''
import itertools
a = {
'required' : [
{
'component': 'TextField',
'data': {
'display_name': 'filename',
'help_text': 'path to file you want to process',
'command_args': ['-f', '--infile']
}
},
{
'compone... |
#!/usr/bin/env python3
"""
Patterns generator for img2dat.py
"""
from itertools import combinations
from PIL import Image, ImageDraw, ImageFont, ImageFilter
from string import printable, ascii_letters, punctuation
from sys import argv, stderr
class GenPatts:
allowedHoles = 0 # how many colors are permitted to re... |
# pyOCD debugger
# Copyright (c) 2018 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
from django import forms
from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from qa.models import Question, Answer
class AskForm(forms.Form):
title = forms.CharField(max_length=255)
text = forms.CharField(widget=forms.Textare... |
#!/usr/bin/env python
"""
Copyright 2017 Matt Settles
Created June 8, 2017
"""
from optparse import OptionParser
from collectons import Counter
import os
import sys
import time
import traceback
import signal
from subprocess import Popen
from subprocess import PIPE
# Handle PE:
# logic:... |
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# change the font size
matplotlib.rc('xtick', labelsize=9)
matplotlib.rc('ytick', labelsize=9)
matplotlib.rc('font', size=14)
# time series tools
import statsmodels.api as sm
def period_mean(data, freq):
'''
Method t... |
"""System related functions."""
import grp
import pwd
import sys
from . import utils
def create_user(name, home=None):
"""Create a new system user."""
try:
pwd.getpwnam(name)
except KeyError:
pass
else:
extra_message = "."
if home:
extra_message = (
... |
# -*- coding: utf-8 -*-
""" crypto.passwords.passwordfactory
Python classes to create and recover passwords. Currently contains
simple password generation. <need to merge the dictionary based pws>
Copyright © (c) 2002 by Paul A. Lambert
Read LICENSE.txt for license information.
August 14, 2002
... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import division
from __future_... |
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import BaseUserManager, AbstractBaseUser
from django.utils.translation import ugettext_lazy as _
from .mixins.log_fields import LogFieldsMixin
class UserManager(Ba... |
"""
The asyncio code that maintains a consistent frame rate and runs the on-frame logic
"""
import math
import json
from datetime import datetime
import asyncio
import config
from aiLogic import tankAI
from . import clientData
from .logging import logPrint
running = True # The asyncio event loop will end wh... |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 21 23:45:40 2016
Library of circles evaluating relationships between nodes.
Ing.,Mgr. (MSc.) Jan Cimbálník
Biomedical engineering
International Clinical Research Center
St. Anne's University Hospital in Brno
Czech Republic
&
Mayo systems electrophysiology lab
Mayo Clinic... |
from littlepython.parser import Parser
from littlepython.tokenizer import Tokenizer
from tests import _if, ctrl, blk, _is, v, c, asg
def test_if():
ast = ctrl([_if(_is(v("a"), c(8)), blk([asg(v("b"), c(3))]))], blk())
parser = Parser(Tokenizer("if a is 8 { b = 3 }"))
assert parser.statement() == ast
def... |
# Blackbox tests for the smbcontrol fault injection commands
#
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2018
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the... |
import logging
import json
from flask_ask import Ask,request,session, question, statement
from flask import Flask
import requests
import datetime
SERVER_IP = "http://ec2-52-221-204-189.ap-southeast-1.compute.amazonaws.com:3000/"
THIS = "Saturn"
app = Flask(__name__)
ask = Ask(app, "/")
logging.getLogger('flask_ask').... |
#!/usr/bin/python
# *-* coding: utf-8 *-*
# Author: Thomas Martin <thomas.martin.1@ulaval.ca>
# File: io.py
## Copyright (c) 2010-2020 Thomas Martin <thomas.martin.1@ulaval.ca>
##
## This file is part of ORB
##
## ORB is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Pub... |
#!/usr/bin/python
# 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"... |
#!/usr/bin/env python
import numpy as np
import chainer
import chainer.links as L
import chainer.functions as F
from chainer.utils import conv
class ImageProcessNetwork(chainer.Chain):
def __init__(self,
I_colors, I_Xunit, I_Yunit, F_unit,
N_PLayers = 4,
P0C_... |
# -*- coding: utf-8 -*-
import os
from flask import Blueprint, render_template, send_from_directory, abort, flash
from flask import current_app as APP
from flask.ext.babel import gettext as _
from flask.ext.login import login_required, current_user
from lurcat.modules.message.forms import CreateMessageForm, Response... |
# Oefening: Vraag de geboortedatum van de gebruiker en zeg de leeftijd.
huidig_jaar = 2017
huidige_maand = 10
huidige_dag = 24
jaar = int(input("In welk jaar ben je geboren? "))
maand = int(input("En in welke maand? (getal) "))
# De dag moeten we pas weten als de geboortemaand deze maand is!
# Je kan het hier nat... |
import re
import zlib
from pathlib import Path
from urllib import parse
from jinja2 import Template
from loguru import logger
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_input import cached
from flexget.utils.soup import get_soup
logger = logge... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
import os
import sys
from collections import OrderedDict
from django.template.loader import render_to_string
from django.http import HttpResponse
from django.conf import settings
from . import db_table
from databas... |
#!/usr/bin/python2
""" A Python module wrapping nrepl to interact with a Leiningen Clojure REPL.
Some notes:
- All return values are unicode objects inside a dictionary.
- You need to explicitly kill the repl before exiting.
Example:
>>> import clojure
>>> repl = clojure.NREPL()
nREPL server started on port 57041 on... |
import copy
import json
import warnings
import numpy as np
import pytest
from gameanalysis import gameio
from gameanalysis import rsgame
from gameanalysis import utils
SERIAL = gameio.gameserializer(['role'], [['strat1', 'strat2']])
SERIAL2 = gameio.gameserializer(['a', 'b'], [['bar', 'foo'], ['baz']])
GAME = rsga... |
from fsui import Color, HorizontalLayout, Panel, TextField
from launcher.context import get_settings
from launcher.i18n import gettext
from launcher.ui2.configlistview import ConfigListView
from launcher.ui.newconfigbutton import NewConfigButton
from system.classes.configdispatch import ConfigDispatch
class SearchFie... |
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
#
# TODO: Convert non-ascii characters to UTF8
# TODO: What does ^ mean in Eclipse?
# TODO: What does #N mean in Eclipse?
# TODO: convert supported commands from Eclipse
"""Parsing an RTF/CRE dictionary.
RTF/CRE spec:
http://www.legalxml.org/workgroups/... |
import os
import bisect
from symsynd.libdebug import get_cpu_name, DebugInfo
from symsynd.exceptions import DebugInfoError
from symsynd.utils import timedsection, parse_addr
from symsynd._compat import string_types, itervalues
def get_image_cpu_name(image):
cpu_name = image.get('cpu_name')
if cpu_name is not... |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
"""
mbed
The mbed framework The mbed SDK has been designed to provide enough
hardware abstraction to be intuitive and concise, yet powerful enough to
build complex projects. It is built on the low-level ARM CMSIS APIs,
allowing you to code down... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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 v... |
import HaloRadio.TopWeb as TopWeb
class plugin(TopWeb.TopWeb):
def GetReqs(self):
return "amv"
def handler(self, context):
import HaloRadio.UserSongStatsListMaker as UserSongStatsListMaker
import HaloRadio.UserSongStats as UserSongStats
import HaloRadio.Song as Song
import HaloRadio.Use... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2013 ecdsa@github
#
# 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 li... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... |
import os
import tempfile
from rest_framework import status
from hs_core.hydroshare import resource
from .base import HSRESTTestCase
class TestPublicResourceFlagsEndpoint(HSRESTTestCase):
def setUp(self):
super(TestPublicResourceFlagsEndpoint, self).setUp()
self.tmp_dir = tempfile.mkdtemp()
... |
"""Reads the GloVe word embeddings
Visit: https://nlp.stanford.edu/projects/glove/"""
import os
import numpy as np
import anna.data.utils as utils
DESTINATION = "glove"
NAME = "glove.840B.300d"
TXT_NAME = NAME + ".txt"
ZIP_NAME = NAME + ".zip"
URL = "http://nlp.stanford.edu/data/" + ZIP_NAME
def fetch_and_parse(da... |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
# Copyright 2014-2016 Presslabs SRL
#
# 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... |
'''
Configuration file reading and access functions.
The configuration file is written in YAML and is supplied
by the user.
TODO: validation of config file input.
'''
import yaml
class Config(object):
def __init__(self, config_filename):
# Try to open and parse the YAML formatted config file
wi... |
#!/usr/bin/env python
import subprocess
import json
import urllib2, urllib
from notifications import HookableNotifications
class SlackNotification(HookableNotifications):
"""Slack Notification class"""
_webhook_service_name = 'slack'
def __init__(self, errors):
super(SlackNotification, sel... |
# Credit: https://github.com/pydata/patsy
import __future__
import sys
import numbers
import inspect
from functools import lru_cache
__all__ = ["EvalEnvironment"]
def _all_future_flags():
flags = 0
for feature_name in __future__.all_feature_names:
feature = getattr(__future__, feature_name)
... |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... |
from datetime import datetime
from dateutil import parser as dtparser, tz
from bson import ObjectId, json_util
from flask import g, request
from flask_restful import Resource
from service.StoreOrderService import StoreOrderService
from service.StoreService import StoreService
from foodbeazt.fapp import mongo, store_adm... |
import itertools
from django.views import generic
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedi... |
import sys
import zmq
import json
import pkg_resources
from logbook import Logger
from logbook.queues import ZeroMQHandler
from bottle import Bottle, run, response, redirect, static_file
from circus.client import CircusClient
from onitu.escalator.client import Escalator
from onitu.utils import get_fid, u, b, PY2, ge... |
import argparse
import numpy as np
import os
import shutil
import signal
import subprocess
import sys
import tempfile
import yaml
import yt
rsl_page_root = os.environ.get(
'RSL_PAGE_ROOT', os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def calculate_datasets(es, field, val_list, val_range, file_list... |
# -*- coding: utf-8 -*-
# * Authors:
# * TJEBBES Gaston <g.t@majerti.fr>
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
import datetime
from mock import MagicMock
import pytest
@pytest.fixture
def invoice_base_config(dbsession):
from autonomie.models.config import Config
... |
#!/usr/bin/python
import unittest
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from mannord import (ItemMixin, UserMixin, ActionMixin)
import mannord.hits as hits
import mannord as mnrd
Base = declarative_base()
class TestHIT... |
from graphspace.settings.base import *
# variables for setting up account through which GraphSpace emails
EMAIL_HOST = 'NONE'
EMAIL_HOST_USER = 'NONE'
EMAIL_HOST_PASSWORD = 'NONE'
# If error is thrown, display the error in the browser (ONLY FOR LOCAL MACHINES)
DEBUG = True
TEMPLATE_DEBUG = True
MAINTENANCE = False
#... |
#!/usr/bin/env python
"""A simple qsub based cluster submission script for SGE."""
__author__ = "Jens Reeder"
__copyright__ = "Copyright 2011-2013, The PICRUSt Project"
__credits__ = ["Jens Reeder",
"Rob Knight",
"Greg Caporaso",
"Morgan Langille"]
__license__ = "GPL"
__... |
from nltk.corpus import movie_reviews
from nltk.classify import NaiveBayesClassifier
from nltk.classify.util import accuracy as nltk_accuracy
def extract_features(words):
return dict([(word, True) for word in words])
if __name__=='__main__':
fileids_pos = movie_reviews.fileids('pos')
fileids_neg = movie... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 DAVY Guillaume
# 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
#... |
import math
import time
from hashlib import md5
from itertools import cycle
import random
import numpy as np
from spring.states import STATES, NUM_STATES
from fastdocgen import build_achievements
class Iterator(object):
def __init__(self):
self.prefix = None
def __iter__(self):
return sel... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os.path
import time
# Classe Arbre utilisée pour le dictionnaire
from binaire import Arbre
# Module colorama utilisé pour l'affichage de la grille
from colorama import init
from colorama import Fore, Back, Style
###
# Classe Lettre : représente une lettre ... |
#!/usr/bin/env python
#
# Copyright 2008,2009,2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at ... |
# -*- coding: utf-8 -*-
"""
documentation
"""
import sys
import argparse
import importlib
import warnings
from itertools import product
class ModuleHelper(object):
Exception = Exception
Warning = Warning
Ignore = 1
error_mode = Exception
prefixes = [""]
modules = {}
@classmethod
... |
"""
Copyright (c) 2012-2017 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... |
# 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 ... |
from __future__ import division
# Use the third order derivative tensor Gershgorin estimation method
def gcest(LT,UT,method):
# Get dimension
D = LT.shape[0]
# # Positivity/ Negativity tensor checks
# from numpy import all
# print('LT non-positive: %s') % all(LT <= 0)
# print('UT n... |
import asyncio
import contextlib
import inspect
import logging.config
import os
from collections import OrderedDict
from functools import wraps
from typing import (
Awaitable,
Callable,
FrozenSet,
Iterable,
List,
Mapping,
MutableMapping,
Optional,
Sequence,
Set,
Tuple,
Ty... |
# See https://github.com/bkidwell/wshare
import argparse
import subprocess
import re
import sys
from wshare_config import config
def getConnDict():
txt = subprocess.getoutput('net use')
if re.search(r'There are no entries in the list\.', txt):
return dict()
match = re.search(r'--------.*\n([\w\W]*... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from abc import ABCMeta, abstractmethod, abstractproperty
from argparse import ArgumentParser, SUPPRESS
from distutils.u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import argparse
import json
import math
parser = argparse.ArgumentParser()
parser.add_argument("--text", required=True, help="Input text")
parser.add_argument("--short", action='store_true')
args = parser.parse_args()
input_text = ... |
import struct
import pynais as ns
class Profile:
def __init__(self, uid=None, pwd=None):
self.uid = uid
self.pwd = pwd
def __str__(self):
return "Profile uid: [%s], pwd: [%s]" % (self.uid, self.pwd)
def set_protobuf(self, obj):
obj.uid = self.uid
obj.pwd = self... |
"""Defines some basic facilities for handling typed values.
It's quite basic and limited implementation tailored specifically for
use in the PyBDSM user-options and derived properties. For a user
option, one can define a group that is used when listing the options to
the screen. For a property (e.g., flux density), o... |
# -*- coding: utf-8 -*-
import time
import unittest
from selenium import webdriver
import settings
class ModifyPersonalInfo(unittest.TestCase):
def setUp(self):
self.driver = None
self.base_url = settings.test_parameters.get("bussiness_base_url")
def test_E73_modify_personal_information(s... |
"""perception URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.