src stringlengths 721 1.04M |
|---|
from ideFoam.ofCase import OfCase
class OfMesher( OfCase ):
additionalFiles = [
"blockMeshDict",
"snappyHexMeshDict",
"extrudeMeshDict",
"surfaceFeatureExtractDict"
]
handledFiles = OfCase... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 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/lice... |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
#!/usr/bin/python
import sys
class CycleFound (Exception):
def __init__(self, path, labels):
self.path = path
self.labels = labels
def __str__(self):
l = len(self.labels)
result = ""
for i in range(0, l):
result = "%s%s %s " % (result, self.path[i], self.lab... |
# -*- coding: utf-8 -*-
#
# django-pgcryptoauth documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 21 01:32:47 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... |
""" Tests the duct component. """
import unittest
import os
import numpy as np
from openmdao.api import Problem, Group
from openmdao.utils.assert_utils import assert_near_equal, assert_check_partials
from pycycle.mp_cycle import Cycle
from pycycle.elements.duct import Duct
from pycycle.elements.flow_start import Fl... |
# Copyright Anne M. Archibald 2008
# Released under the scipy license
from __future__ import division, print_function, absolute_import
from numpy.testing import (assert_equal, assert_array_equal,
assert_almost_equal, assert_array_almost_equal, assert_,
assert_raises)
import numpy as np
from scipy.spatial imp... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This ... |
# 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, s... |
from django.http import HttpResponseRedirect
from django.views.generic.edit import CreateView, UpdateView
from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DateDetailView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decora... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free soft... |
# -*- coding: utf-8 -*-
# yavuzhan sahibinden.com Ford Focus webscrap & write to csv
import urllib.parse
import urllib.request
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
import re
filename1 = "S_sahibinden.csv"
f = open(filename1, "w") # for write
headers = "year,km,cc,f... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import os
import shutil
from makerUpdateSandboxedProjects import UpdateSandboxedProjects as theUpdater
import makerUpdateSandboxedProjects
import sys
from makerUtilities import writeDataToFile, readDataFromFile
import wx
class MakerTest(unittest.TestCase):
... |
## ###
# IP: GHIDRA
#
# 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 writin... |
"""This module provides the DiscreteTimeDomainExpression class to
represent discrete-time expressions.
Copyright 2020--2021 Michael Hayes, UCECE
"""
from __future__ import division
from .domains import DiscreteTimeDomain
from .sequence import Sequence
from .functions import exp
from .sym import j, oo, pi, fsym, oo
f... |
#!/usr/bin/env python
"""This module contains tests for flows-related API renderers."""
from grr.gui import api_test_lib
from grr.gui.api_plugins import flow as flow_plugin
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow
from grr.lib import flow_runner
from grr.lib import output_plugin
... |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import enumfields
from dja... |
# -*- coding: utf-8 -*-
"""
Utilities
-------
Utility module for Folium helper functions.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import math
import zlib
import struct
import json
import base64
from jinja2 import Environment, Packa... |
# -*- coding: utf-8 -*-
import json
URL_HOME = 'http://bulbapedia.bulbagarden.net'
URL_LIST = '/wiki/List_of_Pokémon_by_Kanto_Pokédex_number'
HIDDEN_STYLE = [ 'display:none;' , 'display: none;' ]
SLEEP_TIME = 15 # seconds
MAX_CHUNK = 10
DATA_DIR = '../data/'
DESC_FILE = '%sdata.json' % DATA_DIR
RULES_FILE = '%sgene... |
"""Models related to domains management."""
import datetime
from django.db import models
from django.db.models.manager import Manager
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible, smart_text
from django.utils.functional import cached_property
from django.utils.transl... |
from GenericMeasure import GenericMeasure
from GenericAvgMeasure import GenericAvgMeasure
import Units
class ReceivedMessages(GenericMeasure):
def __init__(self, period, simulationTime, broadcastTable):
GenericMeasure.__init__(self, r"DEBUG .*? - Peer .*? received packet .*?(\(.*?\)) .*?([0-9]+\,[0-9]+).*?", peri... |
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
def crossdomain(origin=None, methods=None, headers=None,
max_age=21600, attach_to_all=True,
automatic_options=True):
if methods is not None:
methods = '... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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 v... |
"""
Copyright (c) 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os
import subprocess
import tempfile
from atomic_reactor.build import BuildResult
from atomic_reactor.constants import (PLUGIN_SOURCE_... |
## numpy-oldnumeric calls replaced by custom script; 09/06/2016
## Automatically adapted for numpy-oldnumeric Mar 26, 2007 by alter_code1.py
## class ChainSeperator:
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## This program is... |
"""
This module provides utility functions for the Scan Op
See scan.py for details on scan
"""
from __future__ import print_function
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"Frederic Bastien "
"James Bergstra "
"Pascal Lamblin "
"... |
# Generated by Django 2.1.2 on 2019-02-25 03:13
from django.db import migrations, models
import django.db.models.deletion
import economy.models
class Migration(migrations.Migration):
dependencies = [
('grants', '0013_subscription_amount_per_period_usdt'),
]
operations = [
migrations.Cre... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import sys
import numpy as np
try:
from skbuild import setup
except ImportError:
print('scikit-build is required to build from source.', file=sys.stderr)
print('Please run:', file=sys.stderr)
print('', file=sys.stderr)
print(' ... |
# coding=utf-8
"""
.. module:: wolk
This module provides connection to WolkAbout IoT Platform.
To start publishing data to the platform
create an instance of Device class with credentials obtained from the platform
and pass it to an instance of WolkConnect class.
For more information about module features visit:
htt... |
from validx import Dict, List
from .protos import DataObject
from .palette import Palette
from .utils.parser import BinaryParser
from .utils.validator import UInt8
from .utils.types import Remappings, Remapping
class PaletteMapping(DataObject):
__slots__ = (
"colors",
"remaps",
)
schema ... |
# coding=utf-8
"""
The Collector class is a base class for all metric collectors.
"""
import os
import socket
import platform
import logging
import configobj
import time
import re
import subprocess
import signal
from diamond.metric import Metric
from diamond.utils.config import load_config
from error import DiamondE... |
import intmaniac
from intmaniac import output
from intmaniac.output.teamcity import TeamcityOutput
from intmaniac.output.base import GenericOutput
from tests.mocksetup import *
from tests.configsetup import *
import unittest
class TestOutput(unittest.TestCase):
def test_init_output_exception(self):
with... |
from CommandTemplate import CommandTemplate
from IrcMessage import IrcMessage
import GlobalStore
class Command(CommandTemplate):
triggers = ['lastmessage']
helptext = "Stores the last message for each channel the bot is in, so other modules can retrieve it through a commandfunction"
# Stores the last message. Key... |
# Tracing of function calls. Use @TraceCalls() as a decorator on functions.
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
import sys
from functools import wraps
class TraceCalls(object):
""" Use as a decorator on functions that should be traced. Several
functions ca... |
# Copyright 2018 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, ... |
'''
Collection of tests to verify preset paths loading
'''
from nose.tools import raises, eq_
from tempfile import NamedTemporaryFile, mkdtemp
from shutil import rmtree
from presets.presetManager import PresetException
import json
import os
from presets.presetManager import PresetManager
minimalBody = { "id": "id_te... |
#!/usr/bin/env python
from __future__ import print_function
import re
import numpy as np
import numpy.testing as npt
import logging
logging.basicConfig(level=logging.DEBUG)
import unittest
# import the module
import tomographer.tools.densedm
import tomographer.tools.densedm.mle
import tomographer
import tomographe... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import json
import frappe
import frappe.handler
import frappe.client
from frappe.utils.response import build_response
from frappe import _
from urlparse import urlparse
from urlli... |
import numpy as np
from pele.takestep import TakestepInterface
__all__ = ["AdaptiveStepsizeTemperature"]
class AdaptiveStepsizeTemperature(TakestepInterface):
"""
adjust both the stepsize and the temperature adaptively
Parameters
----------
stepclass :
the step taking class
... |
"""parses configuration and returns useful things"""
#pylint: disable=relative-import
from etl_framework.utilities.DataTable import DataRow
from functools import reduce
class FieldMappingsMixin(object):
"""stuff"""
def map_fields(self, row):
"""stuff"""
mapped_row = DataRow()
for tra... |
#!/usr/bin/env python
import os, sys, tempfile
assert sys.version_info[:2] >= ( 2, 4 )
def __main__():
# Read parms.
input_name = sys.argv[1]
output_name = sys.argv[2]
attribute_name = sys.argv[3]
# Create temp files.
tmp_name1 = tempfile.NamedTemporaryFile().name
tmp_name2 = tempfile... |
from perfrunner.helpers import local
from perfrunner.helpers.cbmonitor import timeit, with_stats
from perfrunner.tests import PerfTest
class DCPThroughputTest(PerfTest):
def _report_kpi(self, time_elapsed: float):
self.reporter.post(
*self.metrics.dcp_throughput(time_elapsed)
)
@... |
from Bio.PDB.PDBParser import PDBParser
import argparse
parser = argparse.ArgumentParser(description="Compute Rg of pdb")
parser.add_argument("pdb", help="pdb file")
args = parser.parse_args()
def computeRg(pdb_file, chain="A"):
# compute Radius of gyration
# pdb_file = f"/Users/weilu/Research/server/feb_2019/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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... |
#
# content.py
#
# script to be invoked via
#
# cd <your-buildout-root-dir>
# bin/instance run src/pcp.rctsync/src/pcp/rctsync/people.py
#
# run with --help to see available options
# This is very specific as it includes the logic according
# to which the rct.contactdata and auth.user models of the
# RCT are merged... |
"""
Contains classes and functions pertaining to buildings.
"""
import os, pygame
from qnd import *
####CONSTANTS####
#Calculating file paths
BASEPATH = os.path.abspath(__file__)
BASEPATH = BASEPATH[:BASEPATH.index('src')]
#Images to use for buildings
SPRITES = [
load_image('building1.png'),
load_image('building2.p... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
#!/usr/bin/env python
# **************************************** #
#############
# IMPORTS #
#############
# standard python packages
import ConfigParser, copy, inspect, logging, os, string, sys
from Node import Node
if not os.path.abspath( __file__ + "/../../../lib/iapyx/src" ) in sys.path :
sys.path.append( os... |
# -*- coding: utf-8 -*-
import re
from openerp import models, fields, api, _
from openerp import SUPERUSER_ID
from openerp.addons.website.models.website import slug
class event(models.Model):
_name = 'event.event'
_inherit = ['event.event', 'website.seo.metadata', 'website.published.mixin']
_track = {
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# findata documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... |
import numpy as np
import warnings
from ._unwrap_1d import unwrap_1d
from ._unwrap_2d import unwrap_2d
from ._unwrap_3d import unwrap_3d
from .._shared.six import string_types
def unwrap_phase(image, wrap_around=False):
'''From ``image``, wrapped to lie in the interval [-pi, pi), recover the
original, unwrap... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Ecogwiki OAuth client
`ecog` is a python client that talks with [ecogwiki](http://www.ecogwiki.com/). It is configurable to talk with any other ecogwiki hosts.
See https://github.com/jangxyz/ecogwiki-client for details.
"""
from setuptools import setup... |
# 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 ... |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2021 PyMeasure Developers
#
# 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 limit... |
# 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
# d... |
from . import constants
from .map import Map
from .html import HTMLLayout
from ..utils.utils import get_center, get_credentials
from ..utils.metrics import send_metrics
from .kuviz import KuvizPublisher
class Layout:
"""Create a layout of visualizations in order to compare them.
Args:
maps (list of :... |
# http://stackoverflow.com/a/22434262/398968
import os
import sys
import contextlib
def fileno(file_or_fd):
fd = getattr(file_or_fd, 'fileno', lambda: file_or_fd)()
if not isinstance(fd, int):
raise ValueError("Expected a file (`.fileno()`) or a file descriptor")
return fd
@contextlib.contextmana... |
# vim:ts=4:sts=4:et:nowrap:tw=77
# -*- coding: utf-8 -*-
import os
import pygame
from pygame.locals import *
import constants
import common
from activity import Activity
from icons import Icons
class Finger(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
path = os.p... |
import pytest
from tests_python.debugger_unittest import IS_PY36_OR_GREATER, IS_CPYTHON
from tests_python.debug_constants import TEST_CYTHON
pytestmark = pytest.mark.skipif(not IS_PY36_OR_GREATER or not IS_CPYTHON or not TEST_CYTHON, reason='Requires CPython >= 3.6')
import sys
import unittest
from _pydevd_fram... |
from test_fena.test_common import test_cmd
def test_teams():
test_cmd("team add _team team_test", "team add fena.team team_test")
test_cmd("team add _team team test", "team add fena.team team test")
test_cmd("team empty _team", "team empty fena.team")
test_cmd("team _team + @a", "team ... |
from __future__ import division
import datetime
import math
__author__ = 'Ryan W. Howe'
class SunStat:
def __init__(self, latitude, longitude, year, month, day, utcoffset=0):
"""SunStat class is able to provide the sunset, sunrise, or noon time for the Sun at a provided date.
DISCLAIMER These cal... |
import time
import math
from scipy import signal
class Oscillator(object):
def __init__(self, signal=None, period=2000, amplitude=50, phase=0, offset=0):
self.period = period
self.amplitude = amplitude
self.phase = phase
self.offset = offset
self.stop = False
self... |
import os
try:
import OpenGL.GL as GL
import OpenGL.GLU as GLU
except ImportError:
raise ImportError, "OpenGL must be installed to use these functionalities"
import numpy
try:
from PyMca import spslut
except:
import spslut
try:
from PyMca.Object3D import Object3DFileDialogs
from PyMca.Objec... |
import unittest
import os
from shutil import rmtree
from tempfile import mkdtemp
from mercurial_repo import MercurialRepo
from repo_factory import RepositoryNotFoundException
from repo_factory import RepoFactory
class TestRepoFactory(unittest.TestCase):
def setUp(self):
self.directory = mkdtemp('-flypap... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
VERSION = (1, 8, 0, 'alpha', 3)
RELEASE = False
def get_version(version=None, release=None):
"""Derives a PEP386-compliant version number from VER... |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2014 by the mediaTUM authors
:license: GPL3, see COPYING for details
"""
import schema.schema
from core.test.fixtures import editor_user
def test_filter_masks(content_node_with_mdt):
node = content_node_with_mdt
masks = node.metadatatype.filter_masks().all()
... |
# Copyright (c) 2014-2020 VMware, 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 req... |
# -*- coding: utf-8 -*-
"""
tipfy
~~~~~
Minimalist WSGI application and utilities for App Engine.
:copyright: 2010 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
import logging
import os
from wsgiref.handlers import CGIHandler
# Werkzeug swiss knife.
# Need to import werkzeug ... |
from ._stateful import Stateful
class Repo(Stateful):
'''
:ivar str slug:
Repository slug.
:ivar str description:
Description on |github|.
:ivar int last_build_id:
Build ID of the last executed build.
:ivar str last_build_number:
Build number of the last executed... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-25 15:52
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hnfp', '0010_auto_20171024_1648'),
]
ope... |
from repESP.equivalence import Equivalence
from repESP.types import *
from repESP.respin_format import Respin
from repESP.respin_generation import prepare_respin
from repESP.respin_generation import RespStage1RespinGenerator, RespStage2RespinGenerator
from repESP.respin_generation import FitHydrogensOnlyRespinGenerator... |
# -*- coding: utf-8 -*-
#
# DECaF CLI documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 3 16:24:56 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
p = dict()
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def main():
# 420 / 4 = 105
p[1] = 1
m = 2
maxv = 2*10**7
while m * m < maxv:
n = m - 1
while n > 0 and n*n-m*m+2*n*m > 0:
if gcd(n, m) != 1:
n -= 1
cont... |
from morsel.panda import *
from morsel.nodes.node import Node
from morsel.nodes.ode.object import Object
from morsel.nodes.facade import Mesh as _Mesh
from morsel.nodes.ode.solid import Solid
#-------------------------------------------------------------------------------
class Mesh(Solid):
def __init__(self, **kar... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Concept',
fields=[
... |
import datetime
import io
import json
import re
import tarfile
from connexion import request
import anchore_engine.apis
import anchore_engine.common
import anchore_engine.common.images
import anchore_engine.configuration.localconfig
import anchore_engine.subsys.metrics
from anchore_engine import utils
from anchore_en... |
import datetime
from haystack.indexes import *
from haystack import site
from transifex.projects.models import Project
class ProjectIndex(RealTimeSearchIndex):
text = CharField(document=True, use_template=True)
slug = CharField(model_attr='slug', null=False)
name = CharField(model_attr='name', null... |
import unittest as ut
from musicvisualizer.pipeline.ir import (IntermediateRepr, AudioRepr, ParametricRepr,
ModelledRepr, PhaseVocPR)
from musicvisualizer.pipeline.mp3_to_wav import mp3_to_wav
import os
class TestIR(ut.TestCase):
def test_constructor(self):
try:
i... |
import logging
from http import cookiejar
import asyncio
import tornado.web
from tornado.testing import AsyncHTTPSTestCase
import tornado.ioloop
from wpull.testing.async import AsyncTestCase
from wpull.testing.badapp import BadAppTestCase
from wpull.testing.ftp import FTPTestCase
from wpull.testing.goodapp import Goo... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import hashlib
import http.server
import os
import socketserver
import unittest
from buil... |
import os
from collections import OrderedDict
from functools import reduce
from random import sample
from django.core.cache import cache
from django.db.models import Q, Sum
from django.db.models.aggregates import Count
from kolibri.content import models, serializers
from kolibri.content.content_db_router import get_ac... |
import math
import sys
import py
from six.moves import zip
from _pytest.compat import isclass
from _pytest.outcomes import fail
import _pytest._code
def _cmp_raises_type_error(self, other):
"""__cmp__ implementation which raises TypeError. Used
by Approx base classes to implement only == and != and raise a
... |
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
# Copyright (C) 2012 - fossfreedom
# Copyright (C) 2012 - Agustin Carrasco
## adapted from artsearch plugin - Copyright (C) 2012 Jonathan Matthew
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of t... |
import ast
from contextlib import contextmanager
def add_scope_context(node):
"""Provide to scope context to all nodes"""
return ScopeTransformer().visit(node)
class ScopeMixin(object):
"""
Adds a scope property with the current scope (function, module)
a node is part of.
"""
scopes = []... |
#!/usr/bin/env python
"""A test runner based on multiprocessing.
This program will run all the tests in separate processes to speed things up.
"""
import curses
import os
import StringIO
import subprocess
import sys
import time
import unittest
import psutil
# These need to register plugins so,
# pylint: disable=unu... |
import py9p
def _checkLen(x, l):
if len(x) != l:
raise py9p.Error("Wrong length %d, expected %d: %r" % (len(x), l, x))
def _checkSize(v, mask):
if v != v & mask:
raise py9p.Error("Invalid value %d" % v)
def _splitFmt(fmt):
"""Split up a format string."""
idx = 0
r = []
whil... |
import json
import datetime
import re
import os
import psycopg2 as dbapi2
from flask import Flask
from flask import render_template
from flask import redirect
from flask import request
from flask.helpers import url_for
class Dil:
def __init__(self, name, ulkesi, photo, bilenler):
self.name = name
... |
'''
The kernel installer.
Run `python -m ai.backend.integration.jupyter.install` to use Backend.AI in your Jupyter notebooks.
'''
import argparse
import json
import os
import sys
import webbrowser
from jupyter_client.kernelspec import KernelSpecManager
from IPython.utils.tempdir import TemporaryDirectory
from .kerne... |
__author__ = 'kgeorge'
from optparse import OptionParser
from PIL import Image
import os
def main():
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="imagefilename", metavar="FILE")
(options, args) = parser.parse_args()
print options.filename
src... |
# 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
# distributed under t... |
#!//usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import getopt
import os
from os.path import *
import glob
from xml.dom import minidom
import re
import struct
import codecs
from StringIO import StringIO
import toolkit
from lexMap import *
from observation import *
from semantics import *
######################... |
#
# Sivakumar Kailasam and lowliet
#
import sublime, sublime_plugin
class RepeatMacroCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().show_input_panel("Repeat count or [Enter] to run till end of file", "", self.__execute, None, None)
def __execute(self, text):
if... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
import re
import requests
import urllib
import urllib2
import redis
redis_pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
redis_context = redis.Redis(connection_pool=redis_pool)
from django.conf import settings
from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
# Built-in modules #
# Internal modules #
# First party modules #
from autopaths.file_path import FilePath
################################################################################
def... |
import tensorflow as tf
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
def sin(x, T=100):
return np.sin(2.0*np.pi*x/T)
def problem(T=100,ampl=0.05):
x = np.arange(0,2*T+1)
noise = ampl*np.random.uniform(low=-1.0,high=1.0,size=len(x))
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2021, Nigel Small
#
# 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
#
# Unle... |
# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
def banner():
print "[***] pCAP processing p56 [***]"
def http_assembler(pcap_file):
carved_images = o
faced_detected = 0
a = rdpcap(pacap_file)
sessions = a.sessions()
for session in sesions:
http_payload = ""
for packet in sessions[session]:
try:
if packet[TCP].dport == 80 or packet[TCP].sport ==... |
from bitmovin.errors import InvalidTypeError
from bitmovin.resources.enums import CloudRegion, EncoderVersion
from bitmovin.utils import Serializable
from bitmovin.resources.models import AbstractModel
from bitmovin.resources import AbstractNameDescriptionResource
from .infrastructure import Infrastructure
class Enc... |
# -*- coding: utf-8 -*-
import json
import sys
import textwrap
from .exceptions import YeastException
from .validators import validate_optional_fields
from .validators import validate_percentage
from .validators import validate_required_fields
__all__ = [u"Yeast"]
class Yeast(object):
"""
A representation o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.