src
stringlengths
721
1.04M
from __future__ import absolute_import import os os.environ['DJANGO_SETTINGS_MODULE'] = 'viceroy.tests.djangoapp.settings' import django from django.test.runner import setup_databases from viceroy.api import build_test_case from viceroy.contrib.django import ViceroyDjangoTestCase from .utils import ViceroyScanner r...
#!/usr/bin/python from gevent import monkey monkey.patch_all() import logging import gevent from gevent.coros import BoundedSemaphore from kafka import KafkaClient, KeyedProducer, SimpleConsumer, common from uveserver import UVEServer import os import json import copy import traceback import uuid import struct import ...
import os import sys import urllib import time import logging import json import pytest import mock def pytest_addoption(parser): parser.addoption("--slow", action='store_true', default=False, help="Also run slow tests") # Config if sys.platform == "win32": PHANTOMJS_PATH = "tools/phantomjs/bin/phantomjs.ex...
# bin/usr/python # Setting up GPIO pins from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) # Identifies the pin numbers to the pi GPIO.setwarnings(False) GPIO.setup(3, GPIO.OUT) # Should sets pin #3 as an output...but doesnt work yet GPIO.setup(3, GPIO.LOW) # Turns initial output for pin 3 off ...
__author__ = 'tjhunter' import build import json import pylab as pl from matplotlib.collections import LineCollection # Draws the network as a pdf and SVG file. def draw_network(ax, fd, link_style): def decode_line(l): #print l dct = json.loads(l) lats = dct['lats'] lons = dct['lons'] return zi...
from django import forms from django.contrib.auth.models import User from .models import Department class NewUserTicket(forms.Form): username = forms.CharField(label='Username', max_length=32) password = forms.CharField(label='Password', widget=forms.PasswordInput) firstname = forms.CharField(label='First...
#!/usr/bin/env python """Unit test driver for checkout_externals Note: this script assume the path to the checkout_externals.py module is already in the python path. """ # pylint: disable=too-many-lines,protected-access from __future__ import absolute_import from __future__ import unicode_literals from __future__ i...
#!/usr/bin/python # -*- coding: utf-8 -*- import requests import json import re import subprocess import multiprocessing #Generate environment with: #pex -r requests -r multiprocessing -e inject:main -o warc-inject -s '.' --no-wheel #pex -r requests -r multiprocessing -o warc-inject def injectItem(item): metad...
# -*- coding: utf-8 -*- # # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.view...
from PyQt4.Qt import * from collections import namedtuple import contextlib from ..core.key import SimpleKeySequence from ..core.color import Color from ..abstract.textview import KeyEvent from ..core.responder import Responder from .. import api import abc import math def set_tab_order(parent, widgets): for f...
#! /usr/bin/env python # -*- coding: utf-8 -*- # Andrés Aguirre Dorelo # MINA/INCO/UDELAR # # Datatype for the individual genetic material # # 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; eithe...
# Copyright (c) 2017 Ansible Tower by Red Hat # All Rights Reserved. from awx.main.utils.insights import filter_insights_api_response from awx.main.tests.data.insights import TEST_INSIGHTS_HOSTS, TEST_INSIGHTS_PLANS, TEST_INSIGHTS_REMEDIATIONS def test_filter_insights_api_response(): actual = filter_insights_ap...
import markdown from markdown.extensions.toc import TocExtension from bs4 import BeautifulSoup from os import path #@@author A0135817B files = { "DeveloperGuide": { "title": "Developer Guide", "toc": [3, 4, 5, 15, 18, 19, 20, 22, 23, 27, 28, 29, 30], }, "UserGuide": { "title": "Use...
import re import pytest import sys from canvas import Canvas from code_tracer import CodeTracer from test_report_builder import trim_report @pytest.fixture(name='is_matplotlib_cleared') def clear_matplotlib(): for should_yield in (True, False): to_delete = [module_name for module_na...
# Copyright 2019 The TensorFlow 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 applica...
#!/usr/bin/env python # coding: utf8 """ A simple example for training a part-of-speech tagger with a custom tag map. To allow us to update the tag map with our custom one, this example starts off with a blank Language class and modifies its defaults. For more details, see the documentation: * Training: https://spacy.i...
# coding: utf-8 import argparse import os from HTMLParser import HTMLParser import lxml import jieba import jieba.analyse from lxml.html.clean import Cleaner # strip off html tags. def processDir(data_dir, output_dir): if not os.path.exists(output_dir): os.makedirs(output_dir) # process every html document. ...
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # python-quilt - A Python implementation of the quilt patch system # # Copyright (C) 2012 - 2017 Björn Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of python-quilt for details. from quilt.cli.meta import Command from quilt.cli.parser import Optio...
import os from fluidity_tools import stat_parser from sympy import * from numpy import array,max,abs meshtemplate=''' Point(1) = {0.0,0.0,0,0.1}; Extrude {1,0,0} { Point{1}; Layers{<layers>}; } Extrude {0,1,0} { Line{1}; Layers{<layers>}; } Extrude {0,0,1} { Surface{5}; Layers{<layers>}; } //Z-normal surface, z=...
# Copyright (c) 2008-2012 by Enthought, Inc. # All rights reserved. from os.path import join from numpy import get_include from setuptools import setup, Extension, find_packages info = {} execfile(join('chaco', '__init__.py'), info) numpy_include_dir = get_include() # Register Python extensions contour = Extension...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Flask-Generic-Views documentation build configuration file, created by # sphinx-quickstart on Wed Dec 30 04:16:44 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present ...
import pytest import gitlab def test_create_project(gl, user): # Moved from group tests chunk in legacy tests, TODO cleanup admin_project = gl.projects.create({"name": "admin_project"}) assert isinstance(admin_project, gitlab.v4.objects.Project) assert len(gl.projects.list(search="admin")) == 1 ...
# Copyright 2021 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 agreed to in writing, ...
import json from django.conf import settings from elasticsearch import Elasticsearch from so import cache_keys from so.cache import redis_cache from so.constant import constant from so.models import ( Website, WebsiteAllowedDomain, WebsiteUrlPattern, WebsiteSelector, SpiderTask, ) test_data = { ...
import datetime import time import os import re import os.path import GangaCore.Utility.logging import GangaCore.Utility.Config import GangaCore.Utility.Virtualization from GangaCore.GPIDev.Adapters.IBackend import IBackend from GangaCore.GPIDev.Base.Proxy import isType, getName, stripProxy from GangaCore.GPIDev.Sche...
# core/hacks.py # Copyright (C) 2018 Alex Mair. All rights reserved. # This file is part of dmclient. # # dmclient 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 2 of the License. # # dmclient is dist...
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel 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 ...
""" Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. ![Image1](https://assets.leetcode.com/uploads/2018/10/12/histogram.png) Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3]. ![...
from taskplus.apps.rest import models from taskplus.apps.rest.database import db_session from taskplus.core.domain import TaskStatus from taskplus.core.shared.repository import Repository from taskplus.core.shared.exceptions import ( NoResultFound, NotUnique, CannotBeDeleted, DbError) from sqlalchemy import exc c...
import asyncio from aio_pika import connect, IncomingMessage, ExchangeType loop = asyncio.get_event_loop() def on_message(message: IncomingMessage): with message.process(): print("[x] %r" % message.body) async def main(): # Perform connection connection = await connect("amqp://guest:guest@local...
# This file is part of Buildbot. Buildbot 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 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
# -*- coding: utf-8 -*- # # Copyright (C) 2008,2009 Andrew Resch <andrewresch@gmail.com> # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # "...
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 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...
# Copyright 2019 The TensorFlow 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 applica...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Script to remove links that are being or have been spammed. Usage: spamremove.py www.spammedsite.com It will use Special:Linksearch to find the pages on the wiki that link to that site, then for each page make a proposed change consisting of removing all the lines where ...
"""Packaging settings.""" from codecs import open from os.path import abspath, dirname, join from subprocess import call from setuptools import Command, find_packages, setup from kitchen import __version__ this_dir = abspath(dirname(__file__)) with open(join(this_dir, 'README.md'), encoding='utf-8') as file: ...
# Maintain a live constrained delaunay triangulation of the grid. # designed as a mixin import traceback import sys import pdb import orthomaker,trigrid from collections import Iterable import numpy as np class MissingConstraint(Exception): pass def distance_left_of_line(pnt, qp1, qp2): # return the signed ...
from pybitcointools import * import hmac, hashlib ### Electrum wallets def electrum_stretch(seed): return slowsha(seed) # Accepts seed or stretched seed, returns master public key def electrum_mpk(seed): if len(seed) == 32: seed = electrum_stretch(seed) return privkey_to_pubkey(seed)[2:] # Accepts (seed or ...
#!/usr/bin/env python import json import os import sys import subprocess import tempfile def run_command(cmd): p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (so, se) = p.communicate() return (p.returncode, so, se) def which(cmd): ''' Get the path for a command...
""" recipy test case runner. Run tests to check that recipy logs information on input and output functions invoked by scripts which use packages that recipy has been configured to log. Tests are specified using a [YAML](http://yaml.org/) (YAML Ain't Markup Language) configuration file. YAML syntax is: * `---` indica...
#!/usr/bin/python # -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Copyright (c) 2012 Michael Hull. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
#! /usr/bin/env python from setuptools import setup CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Pytho...
from datetime import date, time, timedelta, datetime from django.conf import settings from script.models import Script, ScriptProgress from rapidsms.models import Connection from unregister.models import Blacklist roster = getattr(settings, 'POLL_DATES', {}) groups = getattr(settings, 'GROUPS', {}) def upcoming(dates...
# -*- 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 2 of the License, or # (at your option) any later version. import os from quodlibet import app from tests...
# -*- coding: utf-8 -*- ''' Utility functions for :mod:`skosprovider_heritagedata`. ''' import requests from skosprovider.skos import ( Concept, Label, Note, ConceptScheme) from skosprovider.exceptions import ProviderUnavailableException import logging import sys import requests log = logging.getLogg...
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** # ...
""" A wrapper around Flask's send_file implementing the 206 partial protocol. """ from flask import Response, request, send_file import mimetypes import os import re def send(path): """Returns a file via the 206 partial protocol.""" range_header = request.headers.get('Range', None) if not range_header: ...
# -*- coding: utf-8 -*- """ Created on Feb 20, 2014 @author: Aaron Ponti """ import re from MicroscopyCompositeDatasetConfig import MicroscopyCompositeDatasetConfig from LeicaTIFFSeriesMaximumIntensityProjectionGenerationAlgorithm import LeicaTIFFSeriesMaximumIntensityProjectionGenerationAlgorithm from ch.systemsx.c...
import sys import ray import pytest from ray.test_utils import ( generate_system_config_map, wait_for_condition, wait_for_pid_to_exit, ) @ray.remote class Increase: def method(self, x): return x + 2 @ray.remote def increase(x): return x + 1 @pytest.mark.parametrize( "ray_start_reg...
# -*- coding: utf-8 -*- from odoo import models, fields, api, _ from odoo.tools.safe_eval import safe_eval from odoo.exceptions import UserError class AccountInvoiceRefund(models.TransientModel): """Refunds invoice""" _name = "account.invoice.refund" _description = "Invoice Refund" @api.model d...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2016-2018 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 ...
# -*- 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...
#!/usr/bin/env python2 # Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org) # The author disclaims copyright to this source code. import sys import struct import socket import time import select import re from optparse import OptionParser options = OptionParser(usage='%prog se...
from __future__ import unicode_literals from datetime import datetime import json try: from unittest.mock import patch except ImportError: from mock import patch from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site ...
"""Operator classes for eval. """ import operator as op from functools import partial from datetime import datetime import numpy as np import pandas as pd from pandas.compat import PY3, string_types, text_type import pandas.core.common as com import pandas.lib as lib from pandas.core.base import StringMixin from pan...
from django.core.mail import send_mail, mail_managers from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.db.models import Count from datetime import datetime, timedelta from collections import namedtuple import locale import math from ...
import sys from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * from PIL import Image class MyPyOpenGLTest: def __init__(self, width=640, height=480, title='MyPyOpenGLTest'.encode()): glutInit(sys.argv) glutInitDisplayMode(GLU...
import os import sys import httplib2 from oauth2client.file import Storage from apiclient import discovery from oauth2client.client import OAuth2WebServerFlow from wunderous.config import config OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive' SHEETS_OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive https://ww...
# Copyright 2020 NXP # SPDX-License-Identifier: MIT from urllib.parse import urlparse import os from PIL import Image import pyarmnn as ann import numpy as np import requests import argparse import warnings def parse_command_line(desc: str = ""): """Adds arguments to the script. Args: desc(str): Scr...
#!/usr/bin/env python2 import numpy as np from time import time from eft_calculator import EFT_calculator import tools def load_coordinates(name): lines = open('random/'+name).readlines()[-7:-1] coors = [[float(item) for item in line.split()[2:5]] for line in lines] return np.array(coors) def test_rand...
# A map GUI thing # +---------+ # |####|****| # |####|****| # |####|****| # |----+----| # |::::|$$$$| # |::::|$$$$| # |::::|$$$$| # +---------+ print "+-----------+" print "| U = Up |" print "| D = Down |" print "| R = Right |" print "| L = Left |" print "| Q = Quit |" print "+-----------+" mainmap = [] coords ...
""" Base classes that define the interface that the back-end specific retrieval classes must expose. Each read-only property includes inline epydoc describing what is to be returned and what type (string, int, an object) each property must return when called. How a subclass caches attributes or performs lazy evaluati...
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- """CherryPy Server to provide recommendations of semantic similarity.""" import os import json import codecs import cherrypy import argparse import configparser from gensim.models import Word2Vec from nltk.tokenize import word_tokenize from jinja2 import Environment, Fi...
#!/usr/bin/env python3 #!/usr/bin/python3 #--------------------------------------------------------------------------- # # Copyright (c) 2015, Baptiste Saleil. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditi...
# Copyright (c) 2018 PaddlePaddle 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 app...
import xmlrpclib import pickle ''' network layer wrapper for xmlrpc code ''' class BadLogin(Exception): def __init__(self, msg): self.msg = msg class NoDataFile(Exception): def __init__(self, msg): self.msg = msg class Session_manager(object): def __init__(self, url, user, pw): url...
#!/usr/bin/env python # Copyright (C) 2001 Alexander S. Guy <a7r@andern.org> # Andern Research Labs # # 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 ...
""" Module simplifying manipulation of XML described at http://libvirt.org/formatnode.html """ import os from virttest.libvirt_xml import base, xcepts, accessors class CAPXML(base.LibvirtXMLBase): """ The base class for capability. """ def get_sysfs_sub_path(self): """ return the su...
""" Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com> This file is part of RockStor. RockStor is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any la...
from pymongo import MongoClient from lxml import etree from dateutil.parser import parse import pickle from time import gmtime, strftime import os import re data_dir = '../../../bin/so_data_/' file_name = 'PostHistory.xml' db_name = 'kesh' coll_name = 'post_history' client = MongoClient() db = client[db_name] coll =...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
from peewee import * from playhouse.hybrid import * from .base import ModelTestCase from .base import TestModel from .base import get_in_memory_db class Interval(TestModel): start = IntegerField() end = IntegerField() @hybrid_property def length(self): return self.end - self.start @hybr...
# coding: utf8 import re import logging def cleanDate(date): "Clean date format from yyyy[/]mm[/]dd" date = date.split(' ')[0] if date != '': try: query = r'([0-9]|0[1-9]|[12][0-9]|3[01])/([0-9]|0[1-9]|1[012])/((19|20)[0-9][0-9]|1[0-9])' date = re.match(query, date).group(...
#!/usr/bin/python """ bind.py: Bind mount example This creates hosts with private directories that the user specifies. These hosts may have persistent directories that will be available across multiple mininet session, or temporary directories that will only last for one mininet session. To specify a persistent direc...
#!/usr/bin/env python """ Assignment 1, Exercise 3, INF1340, Fall, 2015. Troubleshooting Car Issues. This module contains one function diagnose_car(). It is an expert system to interactive diagnose car issues. """ __author__ = 'Susan Sim' __email__ = "ses@drsusansim.org" __copyright__ = "2015 Susan Sim" __license__...
# # # Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Google 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 2 of the License, or # (at your option) any later...
import io from zipfile import ZipFile from nose.tools import istest, assert_equal from mammoth.docx.style_map import write_style_map, read_style_map from mammoth.zips import open_zip from mammoth.docx import xmlparser as xml @istest def reading_embedded_style_map_on_document_without_embedded_style_map_returns_none(...
#!/usr/bin/env python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or https://www.opensource.org/licenses/mit-license.php . ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the directo...
import os import json import time import calendar import datetime import dateutil.parser import sys print(sys.version) import subprocess dev = False if dev: dev_release_suffix = "_dev" base_incremental_path = '/user/skaraman/data/images_incremental_update_dev/' else: dev_release_suffix = "_release" b...
# -*- 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...
# Copyright (c) 2014 Adafruit Industries # Author: Tony DiCola # # 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, c...
# -*- coding: utf-8 -*- from setuptools import setup, find_packages long_desc = ''' This package contains the traclinks Sphinx extension. .. add description here .. ''' requires = ['Sphinx>=0.6'] setup( name='traclinks', version='0.1', url='http://bitbucket.org/birkenfeld/sphinx-contrib'...
# -*- coding: utf-8 -*- """ Tests for msvc support module (msvc14 unit tests). """ import os from distutils.errors import DistutilsPlatformError import pytest import sys @pytest.mark.skipif(sys.platform != "win32", reason="These tests are only for win32") class TestMSVC14: """Python 3.8 "dist...
from django import forms from edc_constants.constants import OTHER, ALIVE, DEAD, YES, UNKNOWN from edc_constants.constants import PARTICIPANT, NO from edc_form_validators import FormValidator from edc_form_validators.base_form_validator import REQUIRED_ERROR,\ INVALID_ERROR from ..constants import MISSED_VISIT, LO...
import json,urllib2,csv,time,smtplib,string,os os.chdir('/home/ian/Documents') # Buy and sell urls sell_url = "https://coinbase.com/api/v1/sells" buy_url = "https://coinbase.com/api/v1/buys" sell_price_url = "https://coinbase.com/api/v1/prices/sell" buy_price_url = "https://coinbase.com/api/v1/prices/buy" headers = {...
import os import pandas as pd import utils # Prepare the dataset for the analysis sem_path = r"0_Sem_2014" sem1_path = r"1_Sem_2014.csv" sem2_path = r"2_Sem_2014.csv" if not os.path.isfile(sem_path): utils.join_dataframes(sem_path, sem1_path, sem2_path) dataset = pd.read_pickle(sem_path) # Assign correct values ...
from ndreg import * boss_config_file = 'C:\\Users\\ben\\Documents\\repos\\ndreg\\ndreg\\neurodata.cfg' # intern rmt = BossRemote(boss_config_file) collection = 'ben_dev' experiment = 'rand_dev' channel = 'image' x_size = 500 y_size = 200 bit_width = 16 dtype = 'uint' + str(bit_width) exp_setup, coord_actual, chan_a...
import os from datetime import datetime from pathlib import Path import pytest from notifications_python_client import NotificationsAPIClient from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary from config import config, setup_shared_config from tests.pages.pages import ...
#!/usr/bin/env python from mininet.net import Mininet from mininet.cli import CLI from mininet.log import setLogLevel ''' h1 -- r1 -- r2 -- r3 -- h3 | h2 h1 - r1 : 10.0.1.0/24 h2 - r2 : 10.0.2.0/24 h3 - r3 : 10.0.3.0/24 r1 - r2 : 192.168.1.0/24 r2 - r3 : 192.168.2.0/24 ''' if '__main__' == __...
# -*- coding: utf-8 *-* """ board.py The generic connect four board object. Encodes the rules of the connect four game (i.e. checks for legal moves and for victory conditions). It also provides a method for encoding board configurations with a unique ID. """ """ Copyright 2012 Michael Bell This file is part of conne...
# -*- coding: utf-8 -*- # # Copyright (C) 2021 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 2 # of the License, or (at your option) any later version. # # This ...
from urllib.parse import urljoin, urlparse from flask import request def get_or_create(model, **kwargs): """ Gets or creates an instance of model. Args: model: SQLAlchemy model **kwargs: Model properties Returns: An instance of model and True if it was created, False if it w...
""" The MIT License Copyright (c) 2007 Leah Culver 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, publis...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. """ High-level objects for fields. """ from collections import OrderedDict, defaultdict from datetime import date, datetime from functools import partial from operator import attrgetter import itertools import logging ...
""" =============================================================================== The code for all get methods =============================================================================== """ from numpy import dot from pydlm.core._dlm import _dlm class _dlmGet(_dlm): """ The class containing all get metho...
VERSION = '0.1.2.0' PROGRAM = 'dsame' DESCRIPTION = 'dsame is a program to decode EAS/SAME alert messages' COPYRIGHT = 'Copyright (C) 2015 Joseph W. Metcalf' TEST_STRING = 'EAS: ZCZC-WXR-RWT-055027-055039-055047-055117-055131-055137-055139-055015-055071+0030-0771800-KMKX/NWS-' MSG__TEXT={ 'EN' : {'MSG1' :...
import abc import fedmsg.utils def load_handlers(config): """ Import and instantiate all handlers listed in the given config. """ for import_path in config['pdcupdater.handlers']: cls = fedmsg.utils.load_class(import_path) handler = cls(config) yield handler class BaseHandler(object...
import logging from multiprocessing import Process from bc import BCMain from fcp.CommunicationQueues import comm def run_create_first_block(queues, *args): global comm comm.set(queues=queues) try: logging.getLogger().setLevel(logging.DEBUG) # logging.getLogger().addHandler(comm.get_handl...
#!/usr/bin/env python __all__ = ['tumblr_download'] from ..common import * from .universal import * from .dailymotion import dailymotion_download from .vimeo import vimeo_download from .vine import vine_download def tumblr_download(url, output_dir='.', merge=True, info_only=False, **kwargs): if re.match(r'https?...
from django.db import models from django.contrib.contenttypes.models import ContentType from django.conf import settings class KeyValueManager(models.Manager): def __dynamic_key(self, name): """ If the setting to create Key instances that don't exist is set to True, then we create a Key in...