src stringlengths 721 1.04M |
|---|
from .match_position_finder_helpers import normalise_correlation, normalise_correlation_coefficient, calculate_squared_differences
from scipy.ndimage.measurements import label, find_objects
from scipy.signal import fftconvolve
import numpy as np
def to_rgb(im):
return np.dstack([im.astype(np.uint8)] * 3).copy(ord... |
#
# vsmtpd/tests/plugins/test_connection_time.py
#
# Copyright (C) 2011 Damien Churchill <damoxc@gmail.com>
#
# 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, or (at your option... |
import matplotlib.pyplot as plt
import matplotlib as mpl
import geopandas as gpd
import numpy as np
from pysal.lib.weights.contiguity import Queen
from pysal.lib.weights.spatial_lag import lag_spatial
import seaborn as sbn
from pysal.explore.esda.moran import (Moran_Local, Moran_Local_BV,
Moran,... |
"""
Unit tests for trust-region optimization routines.
To run it in its simplest form::
nosetests test_optimize.py
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (TestCase, assert_, assert_equal, assert_allclose,
run_modu... |
#! /usr/bin/env python3
import json
import os
import sys
import time
from urllib import request
from filter import Filter, FilterChain, Position, TimeRange
from filters import DrawBox, DrawText, Overlay
from resource import Resource, Resources
TMP_DIR = '/tmp'
FILTER_TYPES = {
'box': DrawBox,
'text': DrawTex... |
import logging
from collections import defaultdict
from datetime import datetime
import pkg_resources
from pylons import c, g, request
from paste.deploy.converters import asbool
from tg import expose, redirect, flash, validate, config
from tg.decorators import with_trailing_slash, without_trailing_slash
from webob imp... |
import random
import decimal
import time
import requests
import logging
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from datetime import datetime
from ..models import (
User,
Address
)
log = logging.getLogger(__name__)
custom_log = logging.getLogger('other.namespace.logg... |
"""
This file is part of python-webuntis
:copyright: (c) 2013 by Markus Unterwaditzer.
:license: BSD, see LICENSE for more details.
"""
import datetime
from webuntis.utils import datetime_utils, lazyproperty, \
timetable_utils
class Result(object):
"""Base class used to represent most API object... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Projects"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Project",
"description": _("Project master."),
},
{
"type": "doctype",
"name": "Task",
"des... |
#!/usr/bin/env python3
# to run this script :
# $ nosetest3
# or
# $ python3 test_reverse.py
import os
import sys
from time import time
from contextlib import redirect_stdout
from nose.tools import assert_equal
from pathlib import Path
from io import StringIO
from reverse.lib import GlobalContext
TESTS = Path('test... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import int_or_none
class MGTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mgtv\.com/(v|b)/(?:[^/]+/)*(?P<id>\d+)\.html'
IE_DESC = '芒果TV'
_TESTS = [{
'url': 'http://www.... |
import argparse
import datetime
import imutils
import time
import cv2
import RPi.GPIO as GPIO
import os
import smtplib
from servo import Servo
RESIZE_WIDTH = 500
RESIZE_HEIGHT = 375
THRESHOLD = 30
MAXPIXELVAL = 255
MORNINGTIME = 7
NIGHTTIME = 19
MIN_RECTANGLE = 2000
MAX_RECTANGLE = 90000
HARDDRIVE_LOCATION = "/media/p... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from setuptools import setup, find_packages
def long_description_from_readme():
with open('README.rst') as readme:
return readme.read()
setup(
name="CommanderKeen",
version="0.1",
packages=find_packages(),
scripts=['scripts/keen.py'],
author="Pedro Figueiredo",
author_email="pfig@... |
#!/usr/bin/env python3
# Server.py
import socket
import Chatbot # PyCharm seems to think this is an error, but it seems fine.
import random
__author__ = 'Peter Maar'
__version__ = '0.1.0'
def send(ip, port, message):
udp_ip = ip
udp_port = port
sock = socket.socket(socket.AF_INET, # Internet
... |
# -*- coding: utf-8
from django.db import models
from apps.subject.models import *
from apps.session.models import *
class Timetable(models.Model):
lectures = models.ManyToManyField(Lecture)
user = models.ForeignKey(UserProfile, related_name="timetables", on_delete=models.CASCADE, db_index=True)
year = mo... |
import numpy as np
from tqdm import tqdm
def generate(model, latent=None, batch=1, deterministic=False):
get_color = lambda model, pixels, cols, row, col, channel, latent=None: model.predict_on_batch(pixels if latent is None else [pixels, latent])[channel][:, row*cols+col]
normalize = lambda pixel: pixel/255
... |
"""Decorators for cross-domain CSRF. """
from django.utils.decorators import decorator_from_middleware
from django.views.decorators.csrf import ensure_csrf_cookie
from cors_csrf.middleware import CrossDomainCsrfViewMiddleware
def ensure_csrf_cookie_cross_domain(func):
"""View decorator for sending a cross-domain C... |
from OpenGL.GL import *
from .. GLGraphicsItem import GLGraphicsItem
from ... import QtGui
__all__ = ['GLGridItem']
class GLGridItem(GLGraphicsItem):
"""
**Bases:** :class:`GLGraphicsItem <pyqtgraph.opengl.GLGraphicsItem>`
Displays a wire-grame grid.
"""
def __init__(self, size=None, co... |
#!/home/qmarlats/Documents/Projets/utbm/pyquizz/env-3/bin/python3
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generated styles.odt for odtwriter use: Drop page size
... |
# Copyright 2015 Anybox S.A.S
# Copyright 2016-2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, exceptions, _
import odoo.addons.decimal_precision as dp
class ProductSetAdd(models.TransientModel):
_name = 'product.set.add'
_rec_name ... |
# -*- coding: utf-8 -*-
"""Adds django compatibility with / capability to use `CURRENT_TIMESTAMP` on DateTimeField objects."""
import logging
from psycopg2.extensions import ISQLQuote
__version__ = '0.2.4'
__author__ = 'Jay Taylor [@jtaylor]'
logger = logging.getLogger(__name__)
_current_timestamp_sql = 'CURRE... |
#!/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Fabio Falcinelli
#
# 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 late... |
#!/usr/bin/python
import os
import sys
import logging
from m3_common import m3_common
#m3_common.configure_root_logger()
#logger = logging.getLogger(__name__)
from m3_logging import get_logger
logger = get_logger(__name__)
class mbus_message_generator(m3_common):
TITLE = "MBus Message Generator"
def __ini... |
"""TODO: DOC."""
import mathutils
def generate_tree(aabb_tree, face_list, rlevel=0):
"""TODO: DOC."""
if (rlevel > 128):
print('Neverblender - ERROR: Could not generate aabb.\
Recursion level exceeds 100')
aabb_tree = []
return
if not face_list:
# We are fin... |
import io
from builtins import bytes, str
from fro._implementation import chompers
class Parser(object):
"""
An immutable parser.
"""
def __init__(self, chomper):
self._chomper = chomper
# public interface
def parse(self, lines, loud=True):
"""
Parse an iterable co... |
####################################################################################################
#
# @Project@ - @ProjectDescription@.
# Copyright (C) Fabrice Salvaire 2013
#
####################################################################################################
####################################... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... |
from rest_framework import exceptions
from rest_framework.authentication import (
get_authorization_header, BaseAuthentication,
)
from .models import MicroService
class MicroServiceSecretAuthentication(BaseAuthentication):
def authenticate(self, request):
auth = get_authorization_header(request).spl... |
#!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
# Copyright 2015 Hewlett-Packard
#
# 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, ... |
import os
import datetime
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_req... |
from qutepart.indenter.base import IndentAlgBase
class IndentAlgPython(IndentAlgBase):
"""Indenter for Python language.
"""
def computeSmartIndent(self, block, char):
prevIndent = self._prevNonEmptyBlockIndent(block)
prevNonEmptyBlock = self._prevNonEmptyBlock(block)
prevLineStrip... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GUI_final.ui'
#
# Created: Thu Mar 19 22:03:17 2015
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attr... |
# -*- coding: utf-8 -*-
"""
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... |
#
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE 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... |
# Copyright 2015.
# Michael A. DeJesus, Chaitra Ambadipudi, and Thomas R. Ioerger.
#
#
# This file is part of TRANSIT.
#
# TRANSIT 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 ... |
# Import a whole load of stuff
from System.IO import *
from System.Drawing import *
from System.Runtime.Remoting import *
from System.Threading import *
from System.Windows.Forms import *
from System.Xml.Serialization import *
from System import *
from Analysis.EDM import *
from DAQ.Environment import *
fro... |
#!/usr/bin/env python
import os
import sys
# Horrible boilerplate - there must be a better way :)
sys.path.append(
os.path.abspath(
os.path.dirname(__file__) + '../../..'
)
)
from pombola.core import models
from django.contrib.contenttypes.models import ContentType
import mp_contacts
phone_kind ... |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... |
#!/usr/bin/env python
import datetime
import time
import sys
sys.path.insert(0, '/home/pi/adhan/crontab')
from praytimes import PrayTimes
PT = PrayTimes()
from crontab import CronTab
system_cron = CronTab(user='pi')
now = datetime.datetime.now()
strPlayFajrAzaanMP3Command = 'omxplayer -o local /home/pi/adhan/Adhan... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005, TUBITAK/UEKAE
#
# 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.
#
# Plea... |
## Aditya Gilra, NCBS, Bangalore, 2012
"""
Inside the .../moose-examples/GranuleCell/ directory supplied with MOOSE, run
python testNeuroML_Gran98.py
(other channels and morph xml files are already present in this same directory).
The soma name below is hard coded for gran98, else any other file can be used by modifyi... |
import sys
import logging
import galsim
"""A simple Python test script to demonstrate use of the galsim.utilities.compare_dft_vs_photon_*
functions.
This script generates a model galaxy and PSF, and then compares the rendering of this object by both
photon shooting and DFT methods, by calling the GSObject `drawShoot(... |
"""
Copyright 2012 Jan Demter <jan@demter.de>
This file is part of LODStatsWWW.
LODStats 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.
L... |
"""
Integrates download callbacks with an external mainloop.
While things are being downloaded, Zero Install returns control to your program.
Your mainloop is responsible for monitoring the state of the downloads and notifying
Zero Install when they are complete.
To do this, you supply a L{Handler} to the L{policy}.
"... |
# -*- coding:utf-8 -*-
"""Models related to static pages"""
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
from postmarkup import render_bbcode
from uuslug import uuslug as slugify
from module.static_page.m... |
"""
homeassistant.components.zone
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows defintion of zones in Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zone/
"""
import logging
from homeassistant.const import (
ATTR_HIDDEN, ATTR_ICON, ATTR_LATI... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# This file is part of solus-sc
#
# Copyright © 2013-2018 Ikey Doherty <ikey@solus-project.com>
#
# 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 Founda... |
# Copyright (C) 2014 MediaMath, Inc. <http://www.mediamath.com>
#
# 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 appli... |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
import time
import numpy as np
import matplotlib.pyplot as plt
from TSatPy import Controller, State
from TSatPy import StateOperator as SO
from TSatPy.Clock import Metronome
from GradientDescent import GradientDescent
print("Test P - Attitude and Body Rate Control")
run_time = 60
speed = 20
c = Metronome()
c.set_spe... |
# coding:utf-8
#
# Copyright (c) 2010, guo.li <lycying@gmail.com>
# Site < http://code.google.com/p/seeking/ >
# All rights reserved.
# vim: set ft=python sw=2 ts=2 et:
#
from PyQt5.QtGui import QFont
from PyQt5.QtGui import QTextCharFormat
from PyQt5.QtGui import QSyntaxHighlighter
from PyQt5.QtCore import Qt
from Py... |
from math import radians, cos, sin, asin, sqrt
import time
current_milli_time = lambda: int(round(time.time() * 1000))
def haversine(point1, point2, miles = False):
AVG_EARTH_RADIUS = 6371
lat1, lng1 = point1
lat2, lng2 = point2
# convert all latitudes/longitudes from decimal degrees to radians
... |
#!/usr/bin/env python3
###############################################################################
# Module Imports
###############################################################################
import logging
import re
import time
import threading
import signal
import functools
import inspect
#################... |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
import argparse
import sys
import re
import json
import requests
from models import auth
import pprint
def create(config, args):
pp = pprint.PrettyPrinter()
url = config['url'] + "/api/testplan/"
data = {
"name": args['name'],
"description": args['description'],
}
token = auth.get... |
'''
Created on 24/11/2017
@author: chernomirdinmacuvele
'''
from PyQt5.Qt import QDialog, QStandardItemModel, QStandardItem, QComboBox,\
QModelIndex
import mixedModel
import QT_tblViewUtility
import CustomWidgets
import FuncSQL
import searchSimple
import pprint
class GenericCalculoEstim(QDialog):
def CBTe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# name: main.py
# author: Harold Bradley III
# email: harold@bradleystudio.net
# date: 12/11/2015
#
# description: A program for managing websites
#
from __future__ import absolute_import, print_function
try:
from ex... |
from __future__ import print_function
import ctypes
from nplab.instrument import Instrument
from ctypes import CDLL, c_char_p,byref,c_char, POINTER, ARRAY, WinDLL
import os
import numpy as np
import time
FILEPATH = os.path.realpath(__file__)
DIRPATH = os.path.dirname(FILEPATH)
ATTRS_PATH = "{0}\\{1}".format(DIRPATH,"... |
# Generated by Django 2.1.7 on 2019-06-04 15:47
from django.db import migrations, models
import django.db.models.deletion
import economy.models
class Migration(migrations.Migration):
dependencies = [
('grants', '0020_grant_description_rich'),
]
operations = [
migrations.CreateModel(
... |
from flask import Flask, render_template, request, redirect,jsonify, url_for, flash, make_response
from flask import session as login_session
from sqlalchemy import create_engine, asc
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Restaurant, MenuItem, User
from oauth2client.client import f... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... |
import datetime
import pymongo
from pymongo.mongo_client import MongoClient
import indexdata
def getIndexEntry( indexData ):
return indexData.getDictionary()
def getIndexDateEntry( indexData ):
return { "date": datetime.datetime(indexData.date.year,
indexData.date.mon... |
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from navigation.api import (register_links, register_multi_item_links,
register_sidebar_template, register_model_list_columns)
from documents.models import Document, DocumentType
from documents.permissions import PERMIS... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
from itertools import repeat, chain
import sys
import pytest
import rlp
from rlp.sedes import binary, CountableList
from rlp.exceptions import DecodingError, DeserializationError
try:
import pytest_benchmark # noqa: F401
except ImportError:
do_benchmark = False
else:
do_benchmark = True
# speed up setu... |
# Copyright 2015-present Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
# coding: utf-8
# 2009 © Václav Šmilauer <eudoxos@arcig.cz>
"Test and demonstrate use of PeriTriaxController."
from yade import *
from yade import pack,qt
O.periodic=True
O.cell.hSize=Matrix3(0.1, 0, 0,
0 ,0.1, 0,
0, 0, 0.1)
sp=pack.SpherePack()
radius=5e-3
num=sp.makeCloud(Vector3().Zero,O.cell.re... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Copyright 2013 dotCloud inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed t... |
#!/usr/bin/env python3
# Copyright (C) 2013-2017 Christian Thomas Jacobs.
# This file is part of PyQSO.
# PyQSO 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... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
projec... |
from functools import partial
import os
import shutil
from twisted.internet.defer import inlineCallbacks, returnValue, succeed, fail
from twisted.web.error import Error
from twisted.web.client import downloadPage
from juju.charm import get_charm_from_path
from juju.charm.bundle import CharmBundle
from juju.charm.publ... |
"""Tests for IRASA functions."""
import numpy as np
from neurodsp.tests.settings import FS, N_SECONDS_LONG, EXP1
from neurodsp.sim import sim_combined
from neurodsp.spectral import compute_spectrum, trim_spectrum
from neurodsp.aperiodic.irasa import *
###############################################################... |
from sympycore.core import Expr, Pair, heads, IntegerList
from sympycore.heads import *
class MyExpr(Expr):
@classmethod
def convert(cls, obj, typeerror=True):
if isinstance(obj, cls):
return obj
if isinstance(obj, (int, long, float, complex)):
return MyExpr(NUMBER, ob... |
import sys
import random
import itertools
from merge_sorted_arrays import merge_sorted_arrays
# @include
def sort_k_increasing_decreasing_array(A):
# Decomposes A into a set of sorted arrays.
sorted_subarrays = []
INCREASING, DECREASING = range(2)
subarray_type = INCREASING
start_idx = 0
for i... |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... |
# tensorflow no longer supports gpu.
# just another reason to jump to pytorch.
# with hardware given, I want to tttest AB again.
from modular.image_preparation import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets,transforms
from torch.... |
# -*- coding: utf-8 -*-
"""
Module containing mypy type checking coroutines.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the Lice... |
# fora
# class User
# Xu [xw901103@gmail.com] Copyright 2015
from fora.core.dbsession import (
DBSession,
OR
)
from fora.models.user import UserModel
import uuid
from datetime import datetime
class User(object):
""" This class contains core functionality of fora user manipulation.
"""
model = None... |
from django.conf.urls import url
from .views import add_recipe, IngredientAutocomplete, Ingredient, edit_recipe
from django.contrib.auth.decorators import login_required
from django.views.generic.detail import DetailView
from .models import Recipe
from .views import (
add_recipe,
FavoriteRecipesView,
Ingred... |
# -*- coding: utf-8 -*-
import unittest, json
TABLE_NAME = 'Table-HR'
TABLE_NAME_404 = 'Waldo'
TABLE_RT = 45
TABLE_WT = 123
TABLE_HK_NAME = u'hash_key'
TABLE_HK_TYPE = u'N'
TABLE_RK_NAME = u'range_key'
TABLE_RK_TYPE = u'S'
HK_VALUE = u'123'
RK_VALUE = u'Decode this data if you are a coder'
HK = {TABLE_HK_TYPE: HK_V... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2014 The python-semanticversion project
import codecs
import os
import re
import sys
from setuptools import setup
root_dir = os.path.abspath(os.path.dirname(__file__))
def get_version(package_name):
version_re = re.compile(r"^__version__ = [\"... |
from django.forms import widgets
from rest_framework import serializers
from silo.models import Silo, Read, ReadType, LabelValueStore, Tag
from django.contrib.auth.models import User
import json
class SiloSerializer(serializers.HyperlinkedModelSerializer):
data = serializers.SerializerMethodField()
class Meta:... |
from django.shortcuts import get_object_or_404
from rest_framework import viewsets, filters
from parking.models import Parking
from parking.serializers import ParkingSerializer, ParkingDetailSerializer
from parking.filters import FilterParking
class MultipleFieldLookupMixin(object):
def get_object(self):
... |
print("You enter a dark room with two doors. Do you go through door #1 or door #2?")
door = input("> ")
if door == "1":
print("There's a giant bear here eating a cheese cake. What do you do?")
print("1. Take the cake.")
print("2. Scream at the bear.")
bear = input("> ")
if bear == "1":
p... |
import re,os
def yank(text,tag,none=None):
if type(tag)==type(''):
tag=tagname2tagtup(tag)
try:
return text.split(tag[0])[1].split(tag[1])[0]
except IndexError:
return none
def yanks(text,tag):
if type(tag)==type(''):
tag=tagname2tagtup(tag)
return [ x.split(tag[1])[0] for x in text.split(tag[0])[1:]... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
"""
Unit tests for LMS instructor-initiated background tasks.
Runs tasks on answers to course problems to validate that code
paths actually work.
"""
from functools import partial
import json
from uuid import uuid4
from celery.states import SUCCESS, FAILURE
import ddt
from django.utils.translation import ugettext_no... |
# -*- coding: utf-8 -*-
#
#Copyright 2013 Xiangxiang Telecom Corporation.
#@author: liusha
"""This module contains implementations of sp models.
"""
from uuid import uuid1
from sqlalchemy import Column, String, DateTime
from com.zhwh.models.base import Base, MyBase
class PendingBill(Base, MyBase):
"""SP pending ... |
'''
Created on 8 Sep 2017
Root class for all the bss methods (scalability)
@author: Miguel Molina Romero, Techical University of Munich
@contact: miguel.molina@tum.de
@license: LPGL
'''
import nibabel as nib
import numpy as np
import dwybss.bss.utils as ut
import os
from joblib import Parallel, delayed
class BSS:
... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import gflags
import dynamixel
import time
import sys
import pygame
SERVO_STEP = 10
FLAGS = gflags.FLAGS
gflags.DEFINE_string( 'port', '/dev/ttyUSB0', 'dynamixel port' )
gflags.DEFINE_integer( 'baud', 1000000, 'baud rate' )
gflags.DEFINE_integer( 'min_id', 1, 'lowest dynamixel ID' )
gflags.DEFINE_integer( 'max_id', ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 2 14:15:50 2020
@author: Mack Pro
"""
import numpy as npy
import volmdlr as volmdlr
import volmdlr.primitives3D as primitives3D
import volmdlr.primitives2D as primitives2D
import matplotlib.pyplot as plt
import random
import math
rmin, rmax = 100, 1000
posmin, posmax =... |
# Copyright 2019 Google 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""
WSGI config for mysite project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... |
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
# -*- coding: utf-8 -*-
import numpy as np
import datetime
from dateutil import tz
from Tkinter import Tk
import inspect
import getpass, socket, platform #User and Host names
from warnings import warn
import collections
import __main__, os, sys
def get_zero_element(array):
try : array = array.flat.next... |
# Copyright 2019,2020,2021 Sony Corporation.
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.