src stringlengths 721 1.04M |
|---|
from __future__ import print_function
import atexit
import difflib
import imp
import os
import shlex
import sys
if hasattr(sys.version_info, "major") and sys.version_info.major >= 3:
from io import StringIO
else:
from StringIO import StringIO
_cleanup = []
def _import(name, path):
_cleanup.append(pat... |
# coding: utf-8
from dartcms.utils.loading import is_model_registered
from django.db.models.signals import post_save, pre_delete, pre_save
from .abstract_models import *
from .signals import *
__all__ = []
if not is_model_registered('shop', 'ProductCatalog'):
class ProductCatalog(AbstractProductCatalog):
... |
#! /usr/bin/env python
'''
auto_hmm.py
takes an list of GI numbers, downloads them, aligns them using MUSCLE,
then builds an HMM using HMMER and optionally presses the HMM
contact: jonathan.tietz@gmail.com
'''
# import modules
import csv, re, os, math, argparse, subprocess
from Bio import Entrez,... |
from sklearn import cross_validation
from sklearn.ensemble import RandomForestClassifier
from ml.metrics import BinaryClassifierMetricsFactory
from ml.vectorizers import prepare_dataset
class BinaryRandomForestClassifier(object):
def __init__(self, clf, vectorizer):
self._clf = clf
self._vectorize... |
"""
Created on Sun Sep 17 09:27:31 2017
@author: dariocorral
"""
import pandas as pd
from datetime import timedelta
from tickers import Tickers
from hourOffset import Hour
class Candles(object):
"""
OANDA Historical Rates ready to use with Pandas
"""
def __init__(self):
self.__... |
# Copyright IBM Corp. 2013 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 agr... |
# 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 ... |
# python join code
# Copyright Andrew Tridgell 2010
# Copyright Andrew Bartlett 2010
#
# 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 ... |
from twisted.protocols import basic
from frn.utils import parse_dict
class InvalidServerResponse(Exception):
pass
class InvalidClientRequest(Exception):
pass
class LineReceiver(basic.LineReceiver):
def decodedLineReceived(self, line):
"""Override this for when each line is received."""
... |
#!/usr/bin/env python
"""This file contains specialized renderers for semantic values.
Other files may also contain specialized renderers for semantic types relevant
to their function, but here we include the most basic and common renderers.
"""
import itertools
import urllib
import logging
from grr.gui import rend... |
#! /usr/bin/python2.7
# -*- coding: utf-8 -*-
import os
from . import utils
class CorpusLoader():
"""Loader for corpora.
For a complete list of corpora available in KoNLPy,
refer to :ref:`corpora`.
.. code-block:: python
>>> from konlpy.corpus import kolaw
>>> fids = kolaw.fileids(... |
#!/usr/bin/python3
# vim: et sw=4 ts=4
import sys
import struct
import datetime
import time
import binascii
import math
from xml.dom.minidom import parse
import xml.etree.ElementTree as ET
# Garmin-defined
epoch = datetime.datetime(1989, 12, 31, 0, 0, 0)
track_name = ""
laps = []
trackpoints = []
# FIT lat/lon unit... |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Taŭga Tecnologia
# Aristides Caldeira <aristides.caldeira@tauga.com.br>
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
#
from __future__ import division, print_function, unicode_literals
import logging
from odoo import api, fields, models, _
from odoo.except... |
from importlib import import_module
from .log import get_logger
logger = get_logger()
# For < Python 3.6
try:
ModuleNotFoundError
except NameError:
ModuleNotFoundError = ImportError
def preset_import(name, assert_success=False):
"""A unified importer for both regular and ``google3`` modules, according
... |
import argparse
import json
import pprint
from sys import exit
import uuid
import ast
def main():
parser = argparse.ArgumentParser(prog='Namelist Generator')
parser.add_argument('case_name')
# Optional Arguments for CGILS
parser.add_argument('--perturbed_temperature', default='False',
... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.shortcuts import get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import permission_re... |
#
# uchroma - Copyright (C) 2021 Stefanie Kondik
#
# This program 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, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WIT... |
# 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.
#
# This program is distributed in the hope that it will be useful,
# bu... |
"""
Copyright 2014 Quentin Kaiser
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
dis... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Evernote Corporation
#
# This file is part of Pootle.
#
# 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 ... |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... |
# -*- coding: utf-8 -*-
import numpy as np
import math
from scipy import integrate
from function import F, X
class MinSquares(object):
def __init__(s, n, a, b, m_koef, k_koef, q_koef, p_koef, alpha_koef, u, k, p, q, f):
s.n = n
s.a = a
s.b = b
s.m_koef = m_koef
s.k_koe... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: zengchunyun
"""
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozilla.org/MP... |
from django.conf.urls import url, include
from rest_framework import routers
from stationspinner.accounting.views import APIKeyViewset, LoginView, \
CapsulerViewset, LogoutView, MissingTrainingViewset, RevalidateKeyView, \
ObtainAuthTokenView, CheckAuthTokenView, RefreshAuthTokenView
router = routers.DefaultRo... |
###
# GPG - supybot plugin to authenticate users via GPG keys
# Copyright (C) 2011, Daniel Folkinshteyn <nanotube@users.sourceforge.net>
#
# 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, ... |
import rflib.ipc.RFProtocol as RFProtocol
import bson
import threading
import pymongo as mongo
import time
import sys
from rflib.ipc.Ipc import Ipc
from rflib.ipc.MongoUtils import MongoFactory
from rflib.defs import *
FIELD_NAME_ID = "_id"
FIELD_NAME_FROM = "from"
FIELD_NAME_TO = "to"
FIELD_NAME_TYPE = "type"
FIELD_... |
# -*- coding: utf-8 -*-
#
# editlive documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 26 00:48:01 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... |
import boto3
import cStringIO
import json
from config import Config
from PIL import Image
from datetime import datetime
from concurrent.futures import ThreadPoolExecutor
sqs = boto3.resource('sqs')
s3 = boto3.resource('s3')
bucket = s3.Bucket(Config.s3Bucket)
message_found = True
images_resized = 0
start_time = datet... |
#!/usr/bin/env python3
# coding: utf-8
# enable debugging
if __name__ == "__main__":
import cgi, cgitb, sys, os, locale, codecs, io, importlib
from datetime import datetime
from time import time
#cgitb.enable()
os.environ['CONFPATH'] = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+"/app/includ... |
import maya.cmds as cmds
import maya.mel as mel
import os
import ART_rigUtils as utils
reload(utils)
#The arm module, added as an extra rig module, needs a name, a prefix or suffix (but not both), and a parent to get started
class Arm():
#pass in items we need to know about (do we build a clavicle? What is the root... |
import argparse
import os
import sys
import urllib.request
from itertools import product
from ucca import layer1, convert
from uccaapp.download_task import TaskDownloader
desc = "Get all units according to a specified filter. Units that meet any of the filters are output."
CONSECUTIVE = "CONSECUTIVE"
SUBSEQUENCE = "... |
from django.test import TestCase
from pyparsing import ParseBaseException, ParseException, ParseFatalException
from decimal import Decimal
from collections import OrderedDict
from param_field.parser import parse_fields
from param_field.params import *
from param_field.conf import settings
class TestParserBase(TestC... |
# micro
# Copyright (C) 2021 micro contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# Lesser General Public License as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program ... |
# ELBE - Debian Based Embedded Rootfilesystem Builder
# Copyright (c) 2016-2017 John Ogness <john.ogness@linutronix.de>
# Copyright (c) 2016-2017 Manuel Traut <manut@linutronix.de>
# Copyright (c) 2017 Torben Hohn <torben.hohn@linutronix.de>
# Copyright (c) 2019 Olivier Dion <dion@linutronix.de>
#
# SPDX-License-Identi... |
# Copyright 2016 Infinite Connection
#
# 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 w... |
import uuid
from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class MyUserManager(BaseUserManager):
def _cr... |
import dataclasses
import warnings
from typing import *
from ..logging_utils import get_logger
logger = get_logger(__file__)
class FlattenedAccess:
""" Allows flattened access to the attributes of all children dataclasses.
This is meant to simplify the adoption of dataclasses for argument
hierarchies, r... |
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... |
#
# SSSD files domain tests
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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.
#
# T... |
# -*- coding: utf-8 -*-
import os
from django.contrib.auth import get_user_model
from rest_framework import status
from rest_framework.decorators import detail_route
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from knowledge_base.api.v1.routers import router
fr... |
# Copyright (C) 2007-2011 Andrea Francia Trivolzio(PV) Italy
from __future__ import absolute_import
version='0.12.10.3~'
import os
import logging
from .fstab import Fstab
logger=logging.getLogger('trashcli.trash')
logger.setLevel(logging.WARNING)
logger.addHandler(logging.StreamHandler())
# Error codes (from os on ... |
import os
import re
import sys
import fnmatch
# for command line options and supported environment variables, please
# see the end of 'setupinfo.py'
try:
import Cython
# may need to work around setuptools bug by providing a fake Pyrex
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "fake_pyrex"... |
import builtins
import datetime as dt
import io
import re
import sys
import tempfile
import typing as tg
import pytest
import typecheck as tc
import typecheck.framework as fw
from typecheck.testhelper import expected
# global TypeVars, used in various places:
X = tg.TypeVar('X')
Tb = tg.TypeVar('Tb', bound=dt.date... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: OpenDrive Ltda
# Copyright (c) 2013 Opendrive Ltda
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# cons... |
# coding=utf-8
########################################################################################################################
### Do not forget to adjust the following variables to your own plugin.
# The plugin's identifier, has to be unique
plugin_identifier = "Locbit"
# The plugin's python package, shoul... |
import glob
import os
import sys
sys.path.append('/var/www/')
sys.path.append('/home/bbm/')
import paramiko
import urllib2, ftplib
import time
import StringIO
import json
DEBUG = False
RETRIEVE_METHOD = "ssh" # or "ftp" or "urllib"
MAX_FTP_RETRIES = 5
HOST_PORT = 22
DEFAULT_PATH = "/usr/local/nice/server_data/experime... |
###############################################################################
# Language Modeling on Wikitext-2
#
# This file generates new sentences sampled from the language model
#
###############################################################################
# stdlib
import argparse
# third party
import torch
... |
#!/usr/bin/python3
# Copyright (C) 2016 Sayutin Dmitry.
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WIT... |
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.status import HTTP_500_INTERNAL_SERVER_ERROR
from treeherder.etl.common import fetch_j... |
#!/usr/bin/env python2.7
def knapsack(capacity, items):
"""Be greedy!
One item:
>>> knapsack(100, ((1, 1),))
[100]
>>> knapsack(100, ((100, 1),))
[1]
Two items:
>>> knapsack(100, ((1, 1), (3, 4)))
[1, 33]
>>> knapsack(100, ((60, 80), (50, 50)))
[1, 0]
Three items:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: ts=4:et:sw=4:
# ----------------------------------------------------------------------
# Copyleft (K), Jose M. Rodriguez-Rosa (a.k.a. Boriel)
#
# This program is Free Software and is released under the terms of
# the GNU General License
# ------------... |
# 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... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
#
# author: Cosmin Basca
#
# Copyright 2010 University of Zurich
#
# 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 a... |
import os
from ubi_io import leb_virtual_file
from ubifs import ubifs, walk, output
from ubifs.defines import PRINT_UBIFS_KEY_HASH, PRINT_UBIFS_COMPR
from ubi.defines import PRINT_VOL_TYPE_LIST, UBI_VTBL_AUTORESIZE_FLG
output_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'output'... |
import logging
from . import ExplorationTechnique
from ..knowledge_base import KnowledgeBase
from ..knowledge_plugins.functions import Function
l = logging.getLogger(name=__name__)
class LoopSeer(ExplorationTechnique):
"""
This exploration technique monitors exploration and maintains all
loop-related d... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Many functions need to use protected members of a base class
# pylint: disable=protected-access
# Attributes need to be defined in constructor before initialization
# pylint: disable=attribute-defined-outside-init
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.... |
# encoding: utf-8
"""
message.py
Created by Thomas Mangin on 2010-01-15.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from struct import pack
class _MessageCode(int):
NOP = 0x00 # . 0 - internal
OPEN = 0x01 # . 1
UPDATE = 0x02 # . ... |
#!/usr/bin/env python3
"""
A little program to check if there are later versions of packages I rely upon.
This may grow into a full fledged service, but not today.
"""
import subprocess
import re
import sys
class Program:
"""A known program that can be checked to see the installed version
number matches the... |
"""
Words/Ladder Graph
------------------
Generate an undirected graph over the 5757 5-letter words in the
datafile words_dat.txt.gz. Two words are connected by an edge
if they differ in one letter, resulting in 14,135 edges. This example
is described in Section 1.1 in Knuth's book [1]_,[2]_.
References
----------
..... |
import curses
import sys
import time
import os.path
import random
import pickle
from curses import wrapper
gamedims = [5,22]
currPos = [10,10]
currPosList = [1,3]
def main(stdscr):#{
curses.start_color()
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_BLACK, curses.COL... |
#-
# Copyright (c) 2014 Michael Roe
# 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@
#
# Licensed to BER... |
#!/usr/bin/env python
# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
#
# This file is part of Moa - http://github.com/mfiers/Moa
#
# Licensed under the GPL license (see 'COPYING')
#
"""
moa.utils
---------
A set of random utilities used by Moa
"""
from email.mime.text import MI... |
__doc__ = \
"""
Example of a script that perfoms histogram analysis of an activation
image, to estimate activation Z-score with various heuristics:
* Gamma-Gaussian model
* Gaussian mixture model
* Empirical normal null
This example is based on a (simplistic) simulated image.
Note : We do not want a 'zscore... |
from gcm.data import triggers as tr
from gcm import utils
import numpy as np
from os.path import join
_ROOT_ATTR_MAP = dict(time='time',
time_min='tstart', time_max='tend',
freq='frequency',
freq_min='fstart', freq_max='fend',
amp... |
# Copyright 2014, Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
# rights in this software.
# -*- coding: utf-8 -*-
#
# toyplot documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 18 18:22:53 2014.
#
# This ... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... |
"""Test python experiment API"""
import random
from uuid import UUID
import pytest
import dallinger
class TestAPI(object):
def test_uuid(self):
from dallinger.experiment import Experiment
exp_uuid = Experiment.make_uuid()
assert isinstance(UUID(exp_uuid, version=4), UUID)
def test_... |
# -*- coding:utf-8 -*-
"""
Description:
Transaction Basic Class
Usage:
from neo.Core.Transaction import Transaction
"""
from itertools import groupby
from neo.Blockchain import *
from neo.Core.TX.TransactionAttribute import *
from neocore.Fixed8 import Fixed8
from neo.Network.Inventory import Inventory
from neo... |
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 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 ... |
"""
We test against httpbin which doesn't return the request data in a
consistent way:
1. Non-form requests: the `data` field contains base64 encoded version of
our zlib-encoded request data.
2. Form requests: `form` contains a messed up version of the data.
"""
import base64
import zlib
from .fixtures import FILE_... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
ZMQ example using python3's asyncio
Dash should be started with the command line arguments:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright (C) 2006-2008 Néstor Arocha Rodríguez
#This file is part of pyrqt.
#
#pyrqt 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... |
import json, os, subprocess, getpass, shutil
import logging
from .USBFinder import attemptMount,transfer_file, get_usb_name
from hashlib import sha1
from django.http import HttpResponse,HttpResponseRedirect, JsonResponse
from django.views.decorators.csrf import ensure_csrf_cookie
from django.template import Context, l... |
from uuid import uuid1
from typing import Dict, Tuple, Optional, NamedTuple
import logging
from enum import Enum
try:
from opentrons import instruments
except ImportError:
pass
from opentrons.config import pipette_config, robot_configs, feature_flags
from opentrons.types import Mount, Point
from opentrons.hard... |
# ------------------------------------------------------------------------------------------------
# Copyright (c) 2016 Microsoft Corporation
#
# 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 Softw... |
# -*- coding: utf-8 -*-
'''
Module providing a simple management interface to a chronos cluster.
Currently this only works when run through a proxy minion.
.. versionadded:: 2015.8.2
'''
from __future__ import absolute_import
import json
import logging
import salt.utils
import salt.utils.http
__proxyenabled__ = ['... |
"""``tornado.gen`` implements generator-based coroutines.
.. note::
The "decorator and generator" approach in this module is a
precursor to native coroutines (using ``async def`` and ``await``)
which were introduced in Python 3.5. Applications that do not
require compatibility with older versions of Pytho... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-04-19 17:45
from __future__ import unicode_literals
import grouprise.core.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('gestalten'... |
#!/usr/bin/env python3
DIG_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def find_validator(dig_string, old_base):
dig_sum = sum_digits(dig_string, old_base)
return dig_sum[-1:].upper()
def sum_digits(dig_string, old_base):
int_sum = 0
while dig_string:
int_sum += int(dig_string[:1], base=... |
#
# Copyright (c) 2012 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
# $Revision$
# $Author$
# $Date$
#
"""Driver for the MySQL database"""
import decimal
import MySQLdb
import _mysql_exceptions
from weeutil.weeutil import to_bool
import weedb
def connect(host='l... |
from myuw.dao.affiliation import get_base_campus
from myuw.dao.enrollment import get_current_quarter_enrollment
from myuw.dao.gws import is_grad_student, is_undergrad_student
import logging
import json
import hashlib
logger = logging.getLogger('session')
def log_session(netid, session_key, request):
if session_k... |
'''
Canonical street names!
(To allow name matching between OSM and Portland City DB.)
'''
import re
import string
import pylev
# ratio of edit distance between strings to string length (= max number of edits possible)
def levenshtein_ratio(s1, s2):
assert len(s1) > 0 and len(s2) > 0
return pylev.levenshtein(... |
#!/usr/bin/env python3
"""Home Assistant setup script."""
from datetime import datetime as dt
from setuptools import find_packages, setup
import homeassistant.const as hass_const
PROJECT_NAME = "Home Assistant"
PROJECT_PACKAGE_NAME = "homeassistant"
PROJECT_LICENSE = "Apache License 2.0"
PROJECT_AUTHOR = "The Home A... |
from unittest import TestCase
from nose_parameterized import parameterized
from collections import OrderedDict
import os
import gzip
from pandas import (
Series,
DataFrame,
date_range,
Timestamp,
read_csv
)
from pandas.util.testing import assert_frame_equal
from numpy import (
arange,
zero... |
"""
Adopted from drf-tracking
https://github.com/aschn/drf-tracking
"""
from django.utils.timezone import now
from shub.apps.logs.models import APIRequestLog
from shub.apps.logs.utils import clean_data
from rest_framework.authtoken.models import Token
import traceback
class BaseLoggingMixin(object):
logging_me... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
import json
import requests
from lxml import html
from bs4 import BeautifulSoup
caltech_fixtures_json = open("/Volumes/SSD-Thomas/Documents/GitHub/csyllabus/webapp/backend/apps/csyllabusapi/fixtures"
"/caltech_fixtures_json.json", "w")
caltech_courses = []
fixtures = []
countr... |
import logging
import os
import time
import webbrowser
import PIL.Image
import PIL.ImageTk
from tkinter import *
from JDE.Interfaces import start
from Programs import jpad
from Programs import info
from Programs import imageViewer
from Programs import minesweeper
from Programs import terminal
from Programs.webEdit imp... |
import logging
import emission.core.wrapper.wrapperbase as ecwb
class Stop(ecwb.WrapperBase):
props = {"trip_id": ecwb.WrapperBase.Access.WORM, # trip_id of the parent trip
"enter_ts": ecwb.WrapperBase.Access.WORM, # the timestamp of entry (in secs)
"enter_local_dt": ecwb.WrapperBase.Acc... |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... |
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# 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/.
# ***** END LICENSE BLOCK *****
"""Purge/clobber support
"""
# F... |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-form-validation',
version='0... |
# -*- coding: utf-8 -*-
"""pydoas example script 1
Introductory script illustrating how to import data from DOASIS
resultfiles. The DOASIS result file format is specified as default in the
package data file "import_info.txt".
Creates a result data set using DOASIS example data and plots some examples
"""
import pyd... |
"""
Modified camshift tracker from opencv sample
"""
import math
import json
import socket
import cv
CAM_WINDOW = "CamShiftTracker"
HISTOGRAM_WINDOW = "Histogram"
STOP_CRITERIA = (cv.CV_TERMCRIT_EPS | cv.CV_TERMCRIT_ITER, 10, 1)
TARGET_ELLIPSE_COLOR = (255, 255, 0)
CENTROID_COLOR = (255, 0, 0)
def is_rect_nonzero(r):... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import time, sleep, asctime as _asctime
import sched
from random import randint
import logging
import logging.handlers
import sys,os
import readline
from readline import write_history_file, read_history_file
import zmq
from simplejson import dumps, load, loads
fr... |
# -*- coding: utf-8 -*-
"""Module containing worker functionality for the MDP implementation.
For the MDP specification see: http://rfc.zeromq.org/spec:7
"""
__license__ = """
This file is part of MDP.
MDP is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publ... |
#!/usr/bin/env python3
"""A dashboard for portfolio composition and changes.
"""
import argparse
import functools
import logging
from beancount.core.number import D
from beancount import loader
from beancount.ops import prices
from beancount.ops import holdings
from beancount.reports import holdings_reports
from beanc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.