text
stringlengths
12
6.59M
import matplotlib matplotlib.use('Agg') # ================> Python Standard and third-party <========== from functools import partial from noodles import (gather, schedule) from nac.common import ( Matrix, Vector, change_mol_units, getmass, retrieve_hdf5_data, triang2mtx) from nac.integrals.multipoleIntegrals...
#!/usr/bin/env python 'It test the backbone whole process' # Copyright 2009 Jose Blanca, Peio Ziarsolo, COMAV-Univ. Politecnica Valencia # This file is part of franklin. # franklin is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by th...
"""Level objects.""" from .bytes import Section, Magic from .base import Transform, BaseObject, Fragment, fragment_attrs from .levelfragments import ( material_attrs, GoldenSimplesFragment, GroupFragment, CustomNameFragment, BaseTeleporterEntrance, BaseTeleporterExit, TeleporterExitCheckpo...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2013-2014 Alex Forencich 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...
import datetime import itertools from django.db import connection, transaction from django.db.models import Count import commonware.log from celery.messaging import establish_connection from celeryutils import task import amo from amo.utils import chunked, slugify from bandwagon.models import (CollectionWatcher, ...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) 2014-2015 Didotech SRL (info at didotech.com) # All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the who...
""" This API can be used to send text messages to any Threema user, and to receive incoming messages and delivery receipts. There are two main modes of operation: * Basic mode (server-based encryption) - The server handles all encryption for you. - The server needs to know the private key associated with your...
""" MMRadar.py """ from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset, TextAsset import time import random import math weather = int(input("Any weather? (1 for custom, 0 for none)")) if weather == 1...
import os import sys import argparse import glob import textract import textparser def process_arguments(args): parser = argparse.ArgumentParser(description='convert pdfs to text and parse the texts properly') parser.add_argument('--input_path', action='store', help='path to folder with pdf files') pars...
import re import csv from statistics import mean from fuzzywuzzy import fuzz from datetime import datetime from collections import namedtuple # Classes and Functions for reading and parsing invoices InvRec = namedtuple('InvoiceRecord', ['NAMEDOSE', 'NAME', 'DOSE', 'COST', 'CATEGORY', 'ITEMNUM',\ 'REQDATE']) d...
#!/usr/bin/env python """ inputs: TxD matrix of observations T-number of coords D-dimensionality of each observation *Nans treated as missing observations type (specify the type of plot) see http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.plot for available options outputs: 1-, 2-, o...
import nameparser from django.db import models from django.db.models.signals import pre_save from django.dispatch import receiver from share.models.base import ShareObject from share.models.base import TypedShareObjectMeta from share.models.fields import ShareManyToManyField from share.util import ModelGenerator c...
from django.conf.urls import patterns, include, url from users import views from users.views import UsersIndexView, UserShowView from users.views import Login, Logout, SignUp, AccountView from django.contrib.auth.decorators import login_required urlpatterns = patterns('', url('^users/$', UsersIndexView.as_view()...
""" Linear mixed effects models for Statsmodels The data are partitioned into disjoint groups. The probability model for group i is: Y = X*beta + Z*gamma + epsilon where * n_i is the number of observations in group i * Y is a n_i dimensional response vector * X is a n_i x k_fe design matrix for the fixed effects *...
#!/usr/bin/env python # $Id$ """ A module for reading and writing FITS files and manipulating their contents. A module for reading and writing Flexible Image Transport System (FITS) files. This file format was endorsed by the International Astronomical Union in 1999 and mandated by NASA as the standard format for s...
from rest_framework import permissions from rest_framework.compat import is_authenticated class CustomGroupAPIPermission(permissions.BasePermission): """ Set custom permission for GroupAPI * GET : accessible by admin and user * POST : only accessible by admin """ def has_permission(self, r...
import Queue from multiprocessing import Process, Pipe from cPickle import loads, dumps from threading import Thread import zmq SETCOMMAND = 0 GETCOMMAND = 1 SHUTDOWNCOMMAND = -1 TRANSFERMEMORY = 2 def startMemoryTask(settings, logger, master): url_getBackend = "inproc://get_memory" + ("master" if master else...
''' PathwayGenie (c) GeneGenie Bioinformatics Ltd. 2018 PathwayGenie is licensed under the MIT License. To view a copy of this license, visit <http://opensource.org/licenses/MIT/>. @author: neilswainston ''' # pylint: disable=invalid-name # pylint: disable=no-member # pylint: disable=wrong-import-order from collect...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Views tests for the OSF.''' from __future__ import absolute_import import unittest import json import datetime as dt import mock import httplib as http from nose.tools import * # noqa PEP8 asserts from tests.test_features import requires_search from webtest.app import...
""" test_main.py -- contains py.test functions that test main.py """ from scrabble import main from scrabble import helpers def test_decrement_letter(): assert helpers.decrement_letter('d') == 'c' def test_increment_letter(): assert helpers.increment_letter('a') == 'b' def test_game_board(): game = main....
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 The HuggingFace Team 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-...
# Copyright (c) 2013 Spotify AB # # 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, s...
import asyncio from collections import defaultdict, deque from collections.abc import Mapping, Set from contextlib import suppress from datetime import timedelta from functools import partial import inspect import itertools import json import logging import math from numbers import Number import operator import os impo...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012 Alex Forencich 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 righ...
import io import math import re import subprocess import xml.etree.ElementTree as ET from itertools import chain from django.conf import settings from django.core.checks import Error, register from PIL import Image from shapely.affinity import scale, translate from shapely.ops import unary_union if settings.SVG_RENDE...
# -*- coding: utf-8 -*- # Copyright (c) 2012 Jiri "NoxArt" Petruzelka # # 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,...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) 2014 Didotech SRL (info at didotech.com) # All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole re...
#!/usr/bin/python # -*- coding: utf-8 -*- # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com timehome@corp.globo.com __version__ = "0.2.2"
""" MMRadar.py """ from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset, TextAsset import time import random import math SCREEN_WINDOWX = 1000 SCREEN_WINDOWY = 1000 # colors red = Color(0xff0000, 1.0...
#!/usr/bin/env python3 """Project Euler - Problem 71 Module""" from fractions import Fraction # Smallest Distance if 7 & new_d have no common devisors # 3/7 -> 3*5 / 7*5 -> 15 / 35 -> (closest) 14 / 35 = 2/5 # 3/7 -> 3*7 / 7*7 -> bad # 3/7 -> 3*3 / 7*3 -> 9 / 21 -> (closest) 7 / 21 = 1/3 # direction = {-1,1} == {le...
#!/usr/bin/env python import cgi import cgitb; cgitb.enable() import os, sys import magic # implement: # check filesize, disallow too-large filesizes # check for existing file with same name; if exists, add _1... # check filetype - whitelist? # any kind of DoS mitigation? use URL throttling? # thttpd(8) CGI : CGI pro...
import re import logging from lxml import etree from share.normalize import ctx, tools from share.normalize.parsers import Parser from share.normalize.normalizer import Normalizer from share.normalize.utils import format_doi_as_url logger = logging.getLogger(__name__) URL_REGEX = re.compile(r'(https?:\/\/\S*\.[^\s\...
# Sample Python client for AtomSpacePublisherModule # # Prerequisite: # sudo pip install pyzmq # python client.py # # For use with this module: # https://github.com/opencog/opencog/tree/master/opencog/persist/zmq/events __author__ = 'Cosmo Harrigan' IP_ADDRESS = '127.0.0.1' PORT = '5563' import zmq def ma...
""" Linear mixed effects models for Statsmodels The data are partitioned into disjoint groups. The probability model for group i is: Y = X*beta + Z*gamma + epsilon where * n_i is the number of observations in group i * Y is a n_i dimensional response vector * X is a n_i x k_fe design matrix for the fixed effects *...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from typing import Dict, List, Tuple, Any, Union import abc from collections import OrderedDict import numpy as np import pandas as pd from pandas import DataFrame from pyoptmat import Material class Sampling(metaclass=abc.ABCMeta): """A class provides sampl...
''' iOS target, based on kivy-ios project. (not working yet.) ''' import plistlib from buildozer import BuildozerCommandException from buildozer.target import Target from os.path import join, basename from getpass import getpass PHP_TEMPLATE = ''' <?php // credits goes to http://jeffreysambells.com/2010/06/22/ios-wir...
#!/usr/bin/env python # Standard packages import sys import argparse # Third-party packages from toil.job import Job # Package methods from ddb import configuration from ddb_ngsflow import gatk from ddb_ngsflow import annotation from ddb_ngsflow import pipeline from ddb_ngsflow.variation import variation if __name...
# -*- coding: utf-8 -*- import os import uuid from django.db import models from django.db.models.signals import post_delete from django.utils.translation import ugettext_lazy as _ from apps.gallery import settings as gallery_settings class UnhandledImage(models.Model): image = models.ImageField(upload_to=galle...
import collections import logging import snmpy.mibgen class Plugin(object): def __init__(self, conf): self.conf = conf self.name = conf['name'] def update(self): raise(NotImplementedError('plugin module is missing update() method')) class PluginItem(object): def __init__(self, oi...
from art_gripper import ArtGripper from brain_utils import ArtBrainErrors, ArtBrainErrorSeverities import abc import rospy from art_msgs.msg import InterfaceState, PickPlaceGoal import math from std_srvs.srv import TriggerRequest, TriggerResponse class ArtBrainRobotInterface: __metaclass__ = abc.ABCMeta def...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Views tests for the OSF.''' from __future__ import absolute_import import unittest import json import datetime as dt import mock import httplib as http from nose.tools import * # noqa PEP8 asserts from tests.test_features import requires_search from webtest.app import...
from collections import OrderedDict import os from pyquery import PyQuery class Article: def __init__(self, element, run_time): self.element = element self.slot = None self.run_time = run_time def serialize(self): return OrderedDict([ ('layout', self.layout), ...
# 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 # distribu...
import urlparse import urllib from decimal import Decimal, setcontext, ExtendedContext from SPARQLWrapper import SPARQLWrapper, JSON from flask import current_app as app from geoalchemy import WKTSpatialElement from sqlalchemy.exc import IntegrityError from cadorsfeed.models import Aerodrome from cadorsfeed import db...
# -*- coding: utf-8 -*- # Copyright (c) 2012 Jiri "NoxArt" Petruzelka # # 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,...
""" MMRadar.py """ from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset, TextAsset import time import random import math ''' weather = int(input("Any weather? (1 for custom, 0 for none)")) if weather =...
## ## Author(s): ## - Cedric GESTES <gestes@aldebaran-robotics.com> ## ## Copyright (C) 2009, 2010, 2011 Aldebaran Robotics ## import os import glob import platform import subprocess import logging import qitools.configstore import qitools.qiworktree import qibuild from qibuild.project import Project import q...
# -*- coding: utf-8 -*- # # LOFAR Transients Key Project # # discovery@transientskp.org # # # Source fitting algorithms # """ Source Extraction Helpers. These are used in conjunction with image.ImageData. """ import logging import math # DictMixin may need to be replaced using collections.MutableMapping; # see http:...
# Copyright (c) 2013, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import stix from stix.common import Identity import stix.bindings.stix_common as stix_common_binding import stix.bindings.extensions.identity.ciq_identity_3_0 as ciq_identity_binding # xml element tree crea...
# -*- coding: utf-8 -*- """PyMzn can also be used to dynamically change a model during runtime. For example, it can be useful to add constraints incrementally or change the solving statement dynamically. To dynamically modify a model, you can use the class ``MiniZincModel``, providing a template model file as input whi...
import os import csv import shutil import time import commonware import tarfile import tempfile import markdown import hashlib import codecs from copy import deepcopy from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db.models.signals import (pre_save, post_delete, post_save, ...
#!src/env/bin/python """Control the onramp REST server. Usage: ./onramp_service.py COMMAND [COMMAND_ARGS] Commands: start Starts the OnRamp PCE Server. stop Stops the OnRamp PCE Server. restart Restarts the OnRamp PCE Server. modtest TEST_CONFIG_FILE Tests the conten...
import logging import re from urllib.error import HTTPError, URLError from urllib.parse import quote, quote_plus, urlparse from django import forms from django.core.cache import cache from django.core.exceptions import ValidationError from django.template.loader import render_to_string from django.utils.encoding impor...
#!/usr/bin/env 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...
import warnings from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, override_settings from django.test.client import RequestFactory from django.utils import html from django_filters.filterset import FilterSet, filterset_factory from django_filters.views import FilterView from .m...
""" This module implements the FormRequest class which is a more covenient class (than Request) to generate Requests based on form data. See documentation in docs/topics/request-response.rst """ import urllib import lxml.html from scrapy.http.request import Request from scrapy.utils.python import unicode_to_str cla...
############################################################################ # Joshua R. Boverhof, LBNL # Monte M. Goode, LBNL # See LBNLCopyright for copyright notice! ########################################################################### import sys, re from xml.dom.ext import SplitQName from xml.ns import SOAP, ...
import os,platform class JBCliPy(): """Constructor""" def __init__(self,username=None,password=None,win_suppress=False): if username and password: self.connect = ' --user=' + username + ' --password=' + password else: self.connect = '' ...
from django.conf.urls import patterns, url, include from django.views.generic import TemplateView from profiles.forms import SignupFormExtra from comicsite.admin import projectadminsite urlpatterns = patterns('', url(r'^test/send_email/$','comicsite.views.send_email'), url(r'^test/throw_exception/$...
""" MMRadar.py """ from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset, TextAsset import time import random import math SCREEN_WINDOWX = 1000 SCREEN_WINDOWY = 1000 speed = 2 # colors red = Color(0xf...
import re, sys import numpy as np infile = sys.argv[1] filt = re.compile(r'^"?([^"]*)"?$') converter = lambda x: filt.match(x.strip()).group(1) data = np.recfromcsv(infile, delimiter=',') shapes = np.array(map(int, [converter(x) for x in data["shape_id"]])) lats = np.array(map(float, [converter(x) for x in data["shape_...
from datetime import timedelta from django.db.models import Avg, Q from django.utils import timezone from drf_haystack.viewsets import HaystackViewSet from drf_haystack.filters import HaystackHighlightFilter from rest_framework import mixins, permissions, status, viewsets from rest_framework.authentication import ( ...
# -*- encoding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the...
""" DynamoDB Models for PynamoDB """ import json import random import time import six import logging import warnings from inspect import getmembers from six import add_metaclass from pynamodb.expressions.condition import NotExists, Comparison from pynamodb.exceptions import DoesNotExist, TableDoesNotExist, TableError...
# -*- coding: utf-8 -*- import uuid from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.core.mail import send_mail from django.db import models from django.template.loader import render_to_string from ...
# Copyright (c) Charl P. Botha, TU Delft. # All rights reserved. # See COPYRIGHT for details. ################################################################### # the following programmes should either be on your path, or you # should specify the full paths here. # Microsoft utility to rebase files. REBASE = "rebase...
#!/usr/bin/python # -*- coding: utf-8 -*- ################################################################################ # # RMG - Reaction Mechanism Generator # # Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the # RMG Team (rmg_dev@mit.edu) # # Permission is hereby granted, free of c...
""" This module implements the FormRequest class which is a more convenient class (than Request) to generate Requests based on form data. See documentation in docs/topics/request-response.rst """ from typing import Optional, Type, TypeVar from urllib.parse import urljoin, urlencode import lxml.html from parsel.selec...
from datetime import datetime import requests import pymongo connection = pymongo.Connection('localhost', 27017) db = connection.windmobile stations_collection = db.jdc_stations def fetch_jdc_data(): print("Processing JDC data...") result = requests.get("http://meteo.jdc.ch/API/?Action=StationView&flags=unact...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse, copy, datetime, math, os, pickle, random,sys import astropy.time as time import chainer # from chainer import cuda import chainer.functions as F from chainer import optimizers import hashlib import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot a...
import django.db.models.manipulators import django.db.models.manager from django.core import validators from django.core.exceptions import ObjectDoesNotExist from django.db.models.fields import AutoField, ImageField, FieldDoesNotExist from django.db.models.fields.related import OneToOneRel, ManyToOneRel from django.db....
import os import sys import json import uuid from avro import schema, io import util import pkgutil NAMESPACE = "edu.berkeley.cs.local" SCHEMA_NAMES = schema.Names(default_namespace=NAMESPACE) SCHEMAS = [ # new extension types "uuid", "UnitofTime", "Duration", "ReadingType", "ReadingValue", ...
__author__ = 'Geir Istad' """ MPU6050 Python I2C Class Copyright (c) 2015 Geir Istad 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...
import waffle from django.conf import settings as project_settings from django.db.models import Q from django.utils import timezone from django_rq import job from drf_haystack.viewsets import HaystackViewSet from drf_haystack.filters import HaystackHighlightFilter from rest_framework import mixins, permissions, statu...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute...
import sys import numpy as np import cv2 import os from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap, QImage from PyQt5.QtWidgets import (QWidget, QLabel, QHBoxLayout, QVBoxLayout, QApplication, QPushButton, QSlider, QFileDialog) class Image(QWidget):...
"""Module with class representing jobs API.""" from api import * import time import datetime import json import botocore from botocore.exceptions import ClientError from componentgenerator import * class JobsApi(Api): """Class representing jobs API.""" def __init__(self, url, token): """Set the API e...
from nose.tools import * from lust import unix, log from mock import patch, Mock import sys import os import time import signal # These tests use mocks to avoid system calls, with testing that the # functionality works in the tests/server_tests.py using small server # that are launched and confirmed work. def test_ma...
"""Generate an integration.""" from pathlib import Path from .model import Info TEMPLATE_DIR = Path(__file__).parent / "templates" TEMPLATE_INTEGRATION = TEMPLATE_DIR / "integration" TEMPLATE_TESTS = TEMPLATE_DIR / "tests" def generate(template: str, info: Info) -> None: """Generate a template.""" print(f"S...
import copy import types import sys import os from itertools import izip try: set except NameError: from sets import Set as set # Python 2.3 fallback. import django.db.models.manager # Imported to register signal handler. from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, F...
# Copyright (c) 2015 Uber Technologies, Inc. # # 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, publ...
import asyncio import logging from aiohttp import web import django.db import jsonschema from vonx.indy.messages import \ ProofRequest as VonxProofRequest, \ ConstructedProof as VonxConstructedProof import vonx.web.views as vonx_views from tob_anchor.boot import indy_client, indy_holder_id, indy_verifier_id ...
import logging, os, praw, re, time, traceback, sys, urllib2; linked = []; linkedsrc = []; skipped = []; skippedsrc = []; ARCHIVE_TIME = 15778463; # currently 6 months (in seconds) CJ_HEADER = u"""This dank meme has been linked to from another place on le reddit."""; HEADER = u"""This thread has been linked to from an...
import sys import numpy as np import cv2 import os from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap, QImage from PyQt5.QtWidgets import (QWidget, QLabel, QHBoxLayout, QVBoxLayout, QApplication, QPushButton, QSlider, QFileDialog) class Image(QWidget):...
# Copyright 2014 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 agr...
from ..common import ( WebApiTestBase, WebClientError as ClientError, WebClientLoginError as ClientLoginError, compat_mock, compat_urllib_error ) class ClientTests(WebApiTestBase): """Tests for client related functions.""" @staticmethod def init_all(api): return [ { ...
from django.core import validators from django.core.exceptions import PermissionDenied from django.utils.html import escape from django.conf import settings from django.utils.translation import gettext, gettext_lazy, ngettext FORM_FIELD_ID_PREFIX = 'id_' class EmptyValue(Exception): "This is raised when empty dat...
""" Interfaces for Python. Yet another interface module for Python. Although duck typing is generally considered the Pythonic way of dealing with object compatibility, it's major problem is that it relies on syntactical compatibility to indicate semantic compatibility. Interfaces provide a way to indicate semantic co...
__version__ = "1.7.0"
# Copyright 2014 PerfKitBenchmarker 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 appli...
from django.core import validators from django.core.exceptions import PermissionDenied from django.utils.html import escape from django.conf import settings from django.utils.translation import gettext, gettext_lazy, ngettext FORM_FIELD_ID_PREFIX = 'id_' class EmptyValue(Exception): "This is raised when empty dat...
# --coding: UTF-8 -- import csv from django.contrib import admin from django.utils.encoding import smart_str, smart_unicode from django.http import HttpResponse from models import Guest, Event, GuestType, Registration from views import send_registration_email admin.site.register(GuestType) def resend_invoice_email(m...
""" Routine to create the light cones shells L1 L2 L3 u11 u12 u13 u21 u22 u23 u31 u32 u33 (periodicity) '5.9161', '0.4140', '0.4082', '5', '3', '1', '1', '1', '0', '0', '1', '0', '(1)' '2.4495', '0.7071', '0.5774', '2', '1', '1', '1', '1', '0', '0', '1', '0', '(1)' python3 create_light_cone_shells.py 10 MD10 ...
import scipy.signal import numpy as np import sys import os import matplotlib.pyplot as plt sys.path.append(os.path.abspath("../gunshots")) sys.path.append(os.path.abspath("../../IoTPy/core")) sys.path.append(os.path.abspath("../../IoTPy/helper_functions")) sys.path.append(os.path.abspath("../../IoTPy/agent_types")) fr...
#! /usr/bin/env python '''Fetch a bunch of feeds in quick succession''' # Based on the example at: # http://pycurl.cvs.sourceforge.net/pycurl/pycurl/examples/retriever-multi.py?view=markup import pyev import pycurl # We need to talk to curl import signal import socket import logging # Early integration of lo...
import unittest from robotd.vision.camera import Camera class CameraTestCase(unittest.TestCase): def test_invalid_camera(self): """ Test the camera errors when reading from an invalid camera""" cam = Camera("/", (1, 1), 1) with self.assertRaises(RuntimeError): cam.init()
import datetime from django.db import models from django.db import IntegrityError from django.db.utils import DatabaseError from django.db.models.signals import post_save from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.core.mail impor...
''' Split MS into single spectral channels ''' import os from taskinit import tb from .mytools import mymstransform def split_by_channel(vis, nchan=-1, start=1, spw=0, restfreq='1420.40575177MHz'): ''' Splits a MS by its spectral channels, according to the given ''' # Get the...
# coding: utf-8 from pupa.scrape import Scraper from utils import lxmlize, CanadianLegislator as Legislator from urlparse import urljoin import re COUNCIL_PAGE = 'http://www.cityofkingston.ca/city-hall/city-council/mayor-and-council' class KingstonPersonScraper(Scraper): def get_people(self): page = lxmliz...
import requests import datetime import config search="ICE 375" station="Basel SBB" def getLiveData(search,station): stations=requests.get("https://open-api.bahn.de/bin/rest.exe/location.name?authKey="+config.API_KEY+"&lang=de&input="+station+"&format=json").json() now = datetime.datetime.now() #print(sta...