text stringlengths 12 6.59M |
|---|
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... |
"""define current version"""
__version__ = '0.2.1'
|
""" Additional TileStache caches.
"""
import os
from os.path import exists
import hashlib
from wsgiref.headers import Headers
from TileStache.Core import TheTileLeftANote
from TileStache.Caches import Disk
class SparseCache(Disk):
""" Disk cache which 404s "empty" tiles.
"""
def __init__(self, empty_si... |
import zhinst.ziPython as zi
import zhinst.utils as zi_utils
import time
import json
import os
import numpy as np
from qcodes.instrument.base import Instrument
from qcodes.utils import validators as vals
from fnmatch import fnmatch
class UHFQC(Instrument):
'''
This is the qcodes driver for the 1.8 Gsample/s... |
import zhinst.ziPython as zi
import zhinst.utils as zi_utils
import time
import json
import os
import sys
import numpy as np
from qcodes.instrument.base import Instrument
from qcodes.utils import validators as vals
from fnmatch import fnmatch
from qcodes.instrument.parameter import ManualParameter
class UHFQC(Instru... |
processStarted = False
processExited = False
def __handleProcessStarted__(object):
global processStarted
processStarted = True
def __handleProcessExited__(object, exitCode):
global processExited
processExited = True
def openQmakeProject(projectPath):
invokeMenuItem("File", "Open File or Project..... |
#
# crawler.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT ANY... |
## $Id$
## OAI repository archive and management tool
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN.
##
## CDS Invenio 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 Fou... |
def openQmakeProject(projectPath):
invokeMenuItem("File", "Open File or Project...")
if platform.system()=="Darwin":
snooze(1)
nativeType("<Command+Shift+g>")
snooze(1)
nativeType(projectPath)
snooze(1)
nativeType("<Return>")
snooze(2)
nativeType("... |
#
# crawler.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT ANY... |
#!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
#!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
from devicehive import DeviceException
from devicehive import ApiResponseException
def list_notifications(device, **params):
notifications = device.list_notifications(**params)
return [notification for notification in notifications
if notification.notification()[0] != '$']
def test_list(test):
... |
import unittest
import numpy as np
from bsym import ColourOperation, Configuration
from unittest.mock import patch
class ColourOperationTestCase( unittest.TestCase ):
"""Tests for colour operation methods"""
def test_symmetry_operation_is_initialised_from_a_matrix( self ):
matrix = np.matrix( [ [ 1, 0... |
import unittest
from hamcrest import assert_that, is_
from ducktest.docstring_parser import read_file, docstring_positions
class TestParser(unittest.TestCase):
def test_some(self):
lines = read_file('parse_example.py')
positions = docstring_positions(lines)
assert_that(positions, is_({
... |
import sys
sys.path.append('../mantis')
import pytest
from kismetlogparser import *
pytest.fail("not implmenented")
def test_empty(plainmantis):
with pytest.raises(TypeError):
plainmantis.extract_snr_data()
def test_float(plainmantis):
with pytest.raises(TypeError):
plainmantis.extract_snr_... |
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
import unittest
from typing import Sequence
import mock
import pytest
from kubernetes.client import V1AWSElasticBlockStoreVolumeSource
from kubernetes.client import V1Container
from kubernetes.client import V1ContainerPort
from kubernetes.client import V1Deployment
from kubernetes.client import V1DeploymentSpec
from k... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2010 Asidev s.r.l.
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 unittest
from note_file_parser import note_file_parser
class NoteFileParserTest(unittest.TestCase):
"""Tests for note parsing from file"""
def parse_notes_test(self):
"""Parse notes from a file test"""
notes,durations,volumes = note_file_parser('tests/notefile.txt')
self.assertEq... |
# 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
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... |
# Django settings for test_project project
import os.path
settings_dir = os.path.abspath(os.path.dirname(__file__))
default_template_dir = os.path.join(settings_dir, 'templates')
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
MANAGERS = ADMINS
# We are not really using a relational database, but tests fail witho... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2017-2019
# (c) The University of Strathclude 2019
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@strath.ac.uk
#
# Leighton Pritchard,
# Strathclyde Institute of Pharmaceutical and Biomedical Sciences
# The University of Str... |
import os
import unittest
import multiprocessing
import time
from urllib.parse import urlparse
from werkzeug.security import generate_password_hash
from splinter import Browser
# Configure app to use the testing database
os.environ["CONFIG_PATH"] = "crossword.config.TravisConfig"
#os.environ["CONFIG_PATH"] = "crosswo... |
# 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... |
# -*- coding: utf-8 -*-
#
# This file is part of TinyIDS.
#
# TinyIDS is a distributed Intrusion Detection System (IDS) for Unix systems.
#
# Project development web site:
#
# http://www.codetrax.org/projects/tinyids
#
# Copyright (c) 2010 George Notaras, G-Loaded.eu, CodeTRAX.org
#
# Licensed under the Apac... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest2 as unittest
from nose.plugins.attrib import attr
from mock import patch, MagicMock
import os
from jnpr.junos import Device
from jnpr.junos.facts.swver import facts_software_version as software_version, version_info
from jnpr.jun... |
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
from salt.modules import pip
from salt.exceptions import CommandExecutionError
try:
from mock import MagicMock, patch
has_mock = True
except Impo... |
# Copyright 2015 Vladimir Rutsky <vladimir@rutsky.org>
#
# 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... |
import mock
from mock import call
from nose.tools import *
from shadow.proxy.web import ProxyConfigError
@raises(ProxyConfigError)
def test_no_true_servers():
from shadow.proxy.web import ProxyFlask
svc = mock.Mock()
app = ProxyFlask(
svc,
[],
['localhost']
)
@raises(ProxyCon... |
import os
import json
import tempfile
import base64
from mock import patch, call, create_autospec
import unit
from nose.tools import assert_equal, assert_in, assert_raises, assert_is_none, assert_is_not_none, \
assert_not_equals, assert_true
import synapseclient
from synapseclient import File, Folder, Team
from s... |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012-2013 by the SaltStack Team, see AUTHORS for more details
:license: Apache 2.0, see LICENSE for more details.
tests.unit.utils.event_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
# Import python libs
imp... |
#!/usr/bin/env python3
import os
from time import sleep
import fabric
from entrypoint2 import entrypoint
from path import Path
import vagrant
# from fabric.api import env, execute, task, run, sudo, settings
# pip3 install fabric vncdotool python-vagrant entrypoint2
DIR = Path(__file__).parent.parent.parent
clas... |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AddressProvider
class Provider(AddressProvider):
building_number_formats = ('#', '##', '###', '#', '##', '###',)
street_suffixes = (
'baan', 'boulevard', 'dreef', 'hof', 'laan', 'lei', 'pad',
'ring', 'singel', ... |
import copy
from operator import itemgetter
from pprint import pprint
from django.contrib.auth.mixins import PermissionRequiredMixin
from fo2.connections import db_cursor_so
from base.paginator import list_paginator_basic
from base.views import O2BaseGetPostView
from utils.classes import Perf
from utils.functions.di... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
import os
import subprocess
import logging
import numpy
import theano
import theanolm
import theanolm.trainers as trainers
from filetypes import TextFileType
def save_training_state(path, network, trainer):
"""Saves current neural network a... |
import time
import os
from uuid import uuid4
from django.contrib.auth.models import User, Group, Permission
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test import override_settings
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from sele... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "9e088effae5f1db520f24403233b908d31e0695a"
LLVM_SHA256 = "31849644712c05d3427a7d0528094080dc49a3ada621e78eb09911d22833d96c"
tf_http_archive(
... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "cc4bfd7f59d5a0024ada2a5c2a6f46d53290882b"
LLVM_SHA256 = "37536d911a0c82f6c5a0f3e3804c40781fac87f5f4457387cef9eaf9c8026f9f"
tfrt_http_archive(
... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "30628b0eccf89c36dbd176e925c7fc5c3bfa519d"
LLVM_SHA256 = "6939f97e58a6b6a172e5c0917278eff3e3b3142c7260a1ff963389defdf7a40b"
tfrt_http_archive(
... |
# coding=utf-8
"""
Collects Cassandra JMX metrics from the Jolokia Agent. Extends the
JolokiaCollector to interpret Histogram beans with information about the
distribution of request latencies.
#### Example Configuration
CassandraJolokiaCollector uses a regular expression to determine which
attributes represent hist... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "06da9b94ae374f81a0898b01608c1c3529dfa29a"
LLVM_SHA256 = "34ccea14525f60847a3906d887b03ee4d0b96b4918d3df8fabd76c56226a2ade"
tfrt_http_archive(
... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "026fac2a14cdf0b904ec83044d1f271e1ba2c5f9"
LLVM_SHA256 = "5ad28384c54fa6acfe4e624bd0bf9cf173bec7c542c416db08e7917f03ab1fc1"
tf_http_archive(
... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "acc9721e3866973544ad9315b8b1f1b29387e4c9"
LLVM_SHA256 = "4e93c4d62c92a9ddf2aa6dea324d950b78c5bb1af532c9e475d8eba58c1bb971"
tfrt_http_archive(
... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "c50eec400c0edc73eec3c9e97b5c030492cb787f"
LLVM_SHA256 = "9b7c03fffcbca3e71484dc3bf1060291f187bf18250df9aa18484ab58cf2ccd4"
tf_http_archive(
... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "d24e721debb074c68795c2b019cb51da690ab5f8"
LLVM_SHA256 = "c11b563bd5f4cce5fdbdbe1c2ac0b3c8fc0dac39ff76f073247cbe23ed2bec6b"
tfrt_http_archive(
... |
# Copyright 2015 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... |
# -*- coding: utf-8
"""Logic to add suggestions to exceptions."""
import keyword
import difflib
import re
import itertools
from didyoumean_re import UNBOUNDERROR_RE, NAMENOTDEFINED_RE,\
ATTRIBUTEERROR_RE, UNSUBSCRIBTABLE_RE, UNEXPECTED_KEYWORDARG_RE,\
NOMODULE_RE, CANNOTIMPORT_RE, INVALID_COMP_RE, OUTSIDE_FUNCT... |
"""Riak protocol buffers client.
Provides a couple interfaces to working with a Riak database.
The first is a lower-level Client object. It has methods for interacting with
the server, buckets, keys and values. The methods are more verbose and return
dense dictionaries of data.
The other interface is via Buckets. T... |
# Copyright 2018 D-Wave Systems 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... |
from ..core import (Dummy, Expr, Float, Integer, PoleError, Rational, Symbol,
nan, oo, sympify)
from ..functions.elementary.trigonometric import cos, sin
from .gruntz import limitinf
from .order import Order
def limit(expr, z, z0, dir="+"):
"""
Compute the directional limit of ``expr`` at ... |
import os
import re
from cStringIO import StringIO
# Try to import PIL in either of the two ways it can end up installed.
try:
from PIL import Image
except ImportError:
try:
import Image
except ImportError:
# Django seems to silently swallow the ImportError under certain
# circumstan... |
from rdflib import ConjunctiveGraph, Literal, URIRef, BNode, Namespace
from dipper.graph.Graph import Graph as DipperGraph
from dipper.utils.CurieUtil import CurieUtil
from dipper import curie_map
import re
import logging
logger = logging.getLogger(__name__)
class RDFGraph(ConjunctiveGraph, DipperGraph):
"""
... |
from random import random
import os
try:
from PIL import Image
except ImportError:
raise Exception, 'FeinCMS requires PIL to be installed'
from django import template
from django.conf import settings
register = template.Library()
def tryint(v):
try:
return int(v)
except ValueError:
... |
''' Streamline object '''
import numpy as np
class Volume(object):
def __init__(self, func):
self._func = func
def at_points(self, points):
return np.array([self._func(pt) for pt in points.T])
class PointVolume(Volume):
def __init__(self, points, values, out_value=np.nan):
self... |
'''
Created on 2 Jul. 2018
@author: brendan
'''
#from privatelib.msg_parser import MessageSystem
from privatelib.palette import \
FF_WHITE_HG, \
FF_RED_LG, \
FF_GREEN_LG, \
FF_COLD_BLUE_LG, \
FF_FREEZE_BLUE_LG, \
FF_YELLOW_LG
#FF_BLACK_LG, \
#FF_BLACK_MG, \
#FF_BLACK_HG, \
#FF_BLACK, \
#FF_WHITE_LG, \
#FF_WHITE, \
#... |
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from dipy.reconst.odf import OdfModel, OdfFit
from dipy.reconst.cache import Cache
from dipy.reconst.multi_voxel import multi_voxel_model
from dipy.reconst.shm import (sph_harm_ind_list,
rea... |
import logging
import uuid
from sqlalchemy import func
from sqlalchemy.engine.reflection import Inspector
from werkzeug.security import generate_password_hash
from .models import User, Permission, PermissionView, RegisterUser, ViewMenu, Role
from ..manager import BaseSecurityManager
from ...models.sqla.interface impor... |
#!/usr/bin/env python3
import sys
class Nobe:
def __init__(self, val):
self.val = val
self.next = None
def go(cur, map, N):
start3 = cur.next
last3 = start3.next.next
end3 = last3.next
cur.next = end3
up = [start3.val, start3.next.val, start3.next.next.val]
dest = cur.val... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... |
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import argparse
import sys
import xml.etree.ElementTree as et
import StringIO
import re
import json
from distutils.sysconfig import get_python_lib
sys.path.append(get_python_lib() + '/vnc_cfg_api_server')
from operator import ite... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy
from keyboard.msg import Key
from uav_arm.msg import jointAngles
from std_msgs.msg import string
mymsg = jointAngles()
mode = 0
class Servo:
def __init__(self, name):
self.name = name
pub = ... |
import numpy as np
import nibabel as nib
from dipy.segment.mask import median_otsu
import AFQ.registration as reg
import AFQ.utils.volume as auv
__all__ = ["MaskFile", "FullMask", "RoiMask", "B0Mask", "LabelledMaskFile",
"ThresholdedMaskFile", "ScalarMask", "ThresholdedScalarMask",
"CombinedMa... |
import pprint
import hashlib
import datetime
from collections import defaultdict
from sqlalchemy import func, or_
from sqlalchemy.exc import IntegrityError
from appcomposer import db
from appcomposer.application import app
from appcomposer.translator.languages import obtain_languages, obtain_groups
from appcomposer.t... |
import wx
import numpy as np
from FileHandler import ReadXYZ
from scipy.signal import butter, filtfilt
class Results():
def __init__(self):
"""EMPTY INITIATION"""
def updateAll(self, Data):
# Get Specifications
self.removeDC = Data.Specs.CheckboxDC.GetValue()
... |
import asyncio
import importlib
import inspect
import json
import logging
import re
import sys
import time
import aiohttp
import aioredis
import discord
from datetime import timedelta
class AngelBot(discord.Client):
def __init__(self):
super().__init__()
self.uptime = time.time()
self.com... |
#!/usr/bin/env python
# Licensed under the Apache 2.0 License
# Author Gary O'Neall gary@sourceauditor.com
"""
Primary web application to control the lightshowPi
Usage: sudo lightsite.py
Website can be accessed on port 5000
The file also contains the default configuration parameters
"""
from logging import handlers
im... |
from cement.core import controller
class baseController(controller.CementBaseController):
class Meta:
interface = controller.IController
label = 'base'
description = 'Bluetooth Reconnection'
config_defaults = {}
arguments = [
(['-r', '--remove'], dict(action='s... |
#!/usr/bin/python
## Binary Analysis Tool
## Copyright 2012 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This is a plugin for the Binary Analysis Tool. It generates images of results
of the ranking scan, like piecharts and version charts.
This ... |
import requests
from bs4 import BeautifulSoup
import time
def is_number(s):
"""
Check and parse entered value as a number
"""
try:
float(s)
return True
except ValueError:
return False
def cg_accumulate(year, dep, degree_choice, sg_cg_choice, user_cg, line_num = 0):
# L... |
#!/usr/bin/python
import argparse
import ConfigParser
import platform
import os
import sys
import time
import re
import string
import socket
import netifaces, netaddr
import subprocess
import fnmatch
import struct
import shutil
import json
from pprint import pformat
import xml.etree.ElementTree as ET
import platform
... |
import configparser
import os
import re
from tangled import converters
from tangled.util import abs_path, get_items_with_key_prefix
CONVERTER_KEY_RE = re.compile(r'^\((?P<converter>[a-z_]+)\)(?P<k>.+)$')
def parse_settings(settings, conversion_map={}, defaults={}, required=(),
prefix=None, strip... |
import os
from tasks.meta import OBSColumn, OBSTag, GEOM_REF, current_session
from tasks.util import (DownloadUnzipTask, GdbFeatureClass2TempTableTask, shell,
TagsTask, ColumnsTask, TableTask)
from tasks.tags import SubsectionTags, SectionTags, LicenseTags
from collections import OrderedDict
... |
from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path
from insteon_app.modular_input import Field, IntegerField, FieldValidationException, ModularInput
import logging
from logging import handlers
import sys
import time
import os
import splunk
import re
from insteon_app.pytomation.pyinsteon import *
fr... |
from __future__ import unicode_literals
import logging
import json
from context_processors import GroupPermWrapper
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.core import mail
from django.core.urlresolvers import reve... |
# Copyright 2012 OpenStack Foundation
# 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 requ... |
"""Various helpers not related to the Telegram API itself"""
import os
import struct
from hashlib import sha1, sha256
# region Multiple utilities
def generate_random_long(signed=True):
"""Generates a random long integer (8 bytes), which is optionally signed"""
return int.from_bytes(os.urandom(8), signed=sig... |
import os
import sys
import json
from django.http import HttpResponse
sys.path.append(os.path.join(os.path.dirname(__file__),"..", "tellina_learning_module"))
from bashlex import data_tools
## load the manpage expl file, note that the root should be before tellina
with open(os.path.join('tellina', 'manpage_expl.jso... |
import sys
import logging
# logging config needs to be before other imports
# in order not to be overwritten
LOGGING_TRACE_LVL = 5
logging.basicConfig(stream=sys.stdout, level=logging.INFO,
format='%(name)s (%(levelname)s): %(message)s')
from postcard_creator import postcard_creator
import base64
... |
from __future__ import absolute_import, unicode_literals
import json
import plivo
import pycountry
import regex
from collections import OrderedDict
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import authenticate, login
from django.contrib.auth... |
from copy import copy, deepcopy
from enum import Enum
from typing import List, Optional, Union
from .source import Source
from .token_kind import TokenKind
from ..pyutils import camel_to_snake, FrozenList
__all__ = [
"Location",
"Token",
"Node",
"NameNode",
"DocumentNode",
"DefinitionNode",
... |
# -*- coding: utf-8 -*-
import os
import logging
import codecs
import json
import re
from collections import defaultdict
from flask import Flask, request, jsonify, Response, stream_with_context, render_template
from pattern.en import wordnet as WN
import whoosh
from whoosh import index
from whoosh import qparser
fro... |
#!./venv/bin/python
# Flask specific imports
from flask import render_template, url_for, redirect, flash, send_from_directory, jsonify, request, Markup, Response, make_response
from flask.ext.cache import Cache
#HTML Minifier
from htmlmin.minify import html_minify
# mandrill emailing
from flask.ext.mandrill import M... |
# USAGE
# python demo_guided_optional.py --base-model $CAFFE_ROOT/models/bvlc_googlenet \
# --image initial_images/clouds.jpg \
# --guide-image initial_images/seed_images/starry_night.jpg \
# --output examples/output/seeded/clouds_and_starry_night.jpg
# import the necessary packages
from batcountry import BatCountry
f... |
from flask import Flask
from flask import request
import json
import requests
app = Flask(__name__)
APP_TOKEN = "EAAPGnoxDIZC8BAGJC26eKJnuOsHO95ZCqmDvxOY0OoLHUSjecSsZBUObB\
PYjpLhLzjjv8MdWrSvsYZAAkG6XO3Vx9S54OYHZCFe7nV04pBBhyYK8VPwehszO44W57l6s\
EbTemYEO4cesUW19ZB2GxAZB1CJuaguPfqlmrtLCzlplgZDZD"
FB_MESSAGES_ENDPOINT ... |
"""
verktyg.application
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2014 by Ben Mather.
:license: BSD, see LICENSE for more details.
"""
import sys
from werkzeug.local import Local, LocalManager
from werkzeug.utils import cached_property, redirect
from verktyg.exception_dispatch import (
ExceptionDispatc... |
import numpy as np
import tensorflow as tf
import tensor_train
import ops
import initializers
class TTTensorTest(tf.test.TestCase):
def testFullTensor2d(self):
np.random.seed(1)
for rank in [1, 2]:
a = np.random.rand(10, rank).astype(np.float32)
b = np.random.rand(rank, 9).astype(np.float32)
... |
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask import abort
from flask.ext.login import current_user
from viaduct import db
from viaduct.helpers import flash_form_errors
from viaduct.api.group import GroupPermissionAPI
from viaduct.models import user_group, Group, GroupPer... |
from __future__ import division, print_function
from collections import defaultdict
import sys
sys.path.append('') # need to import from base
from base.process import process
import numpy as np
from datetime import datetime, timedelta
from base.io_util import myopen
from Bio import SeqIO
from glob import glob
import o... |
#!/usr/bin/env python
"""
Comprehensive script to handle migrating PANDA's Solr indices to a larger EBS volume.
Handles all stages of device creation, attachment, file movement, etc.
It will work whether the indices are currently on another EBS or on local storage.
The only thing this script does not do is detach and... |
"""Simply get the name of defined methods."""
__all__ = ['pacstr']
def pacstr(idpac):
"""Return correspond methods string."""
# Pac methods :
if idpac[0] == 1:
method = 'Mean Vector Length'
elif idpac[0] == 2:
method = 'Kullback-Leiber divergence'
elif idpac[0] == 3:
metho... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... |
# -*- coding: utf-8 -*-
"""
Shortest path algorithms for weighed graphs.
"""
__author__ = """\n""".join(['Aric Hagberg <hagberg@lanl.gov>',
'Loïc Séguin-C. <loicseguin@gmail.com>',
'Dan Schult <dschult@colgate.edu>'])
# Copyright (C) 2004-2011 by
# Aric Hag... |
from __future__ import print_function
import sys
import re
from collections import defaultdict
import zipfile
import argparse
import itertools
import os
class ReutersCodes(object):
"""Index CoNLL docs by Retuers topic, country and indexing codes
The following will index Reuters docs by topic:
%(prog)... |
from .FittersChain import FittersChain
from .ModelFitter import ModelFitter
from .BruteForceFitter import BruteForceFitter
from .BGDFitter import BGDFitter
from .CoordinateDescentFitter import CoordinateDescentFitter
__all__ = [
'FittersChain',
'ModelFitter',
'BruteForceFitter',
'BGDFitter',
'Coord... |
#!/usr/bin/env python
"""renum_pdb_to_aln.py - Random assignment of nucleotides for non-typical characters in the sequence alignment
R = G A (purine)
Y = U C (pyrimidine)
K = G U (keto)
M = A C (amino)
S = G C (strong bonds)
W = A U (weak bonds)
B = G U C (all but A)
D = G A U (all but... |
from UM.Job import Job
from UM.Application import Application
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Message import Message
import os.path
## A Job subclass that performs mesh writing.
#
# The result of this Job is a MeshData object.
class WriteMeshJob(Job):
def __init__(se... |
""" Contains definitions for creation of external C/C++ build rules (for building external libraries
with CMake, configure/make, autotools)
"""
load("@bazel_skylib//lib:collections.bzl", "collections")
load("@rules_foreign_cc//tools/build_defs:version.bzl", "VERSION")
load(
":cc_toolchain_util.bzl",
"Librarie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.