python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
gQuant/plugins/hrp_plugin/greenflow_hrp_plugin/transactionCostNode.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
gQuant/plugins/hrp_plugin/greenflow_hrp_plugin/logReturnNode.py
from setuptools import setup, find_packages setup( name='greenflow_dask_plugin', version='0.0.1', packages=find_packages(include=['greenflow_dask_plugin']), install_requires=[ "greenflow" ], entry_points={ 'greenflow.plugin': [ 'greenflow_dask_plugin = greenflow_dask...
fsi-samples-main
gQuant/plugins/dask_plugin/setup.py
from .daskComputeNode import DaskComputeNode from .persistNode import PersistNode from .simpleParallelNode import SimpleParallelNode __all__ = ["DaskComputeNode", "PersistNode", "SimpleParallelNode"]
fsi-samples-main
gQuant/plugins/dask_plugin/greenflow_dask_plugin/__init__.py
from greenflow.dataframe_flow import (ConfSchema, PortsSpecSchema) from greenflow.dataframe_flow.template_node_mixin import TemplateNodeMixin from greenflow.dataframe_flow import Node from dask.dataframe import DataFrame as DaskDataFrame import dask.distributed class DaskComputeNode(TemplateNodeMixin, Node): def...
fsi-samples-main
gQuant/plugins/dask_plugin/greenflow_dask_plugin/daskComputeNode.py
from greenflow.dataframe_flow import (ConfSchema, PortsSpecSchema) from greenflow.dataframe_flow.template_node_mixin import TemplateNodeMixin from greenflow.dataframe_flow import Node from dask.dataframe import DataFrame as DaskDataFrame import dask.distributed class PersistNode(TemplateNodeMixin, Node): def ini...
fsi-samples-main
gQuant/plugins/dask_plugin/greenflow_dask_plugin/persistNode.py
from greenflow.plugin_nodes import CompositeNode from greenflow.plugin_nodes import ContextCompositeNode from greenflow.dataframe_flow.portsSpecSchema import (ConfSchema, PortsSpecSchema, NodePorts) from greenflo...
fsi-samples-main
gQuant/plugins/dask_plugin/greenflow_dask_plugin/simpleParallelNode.py
############################################################################ ## ## Copyright (C) 2021 NVIDIA Corporation. All rights reserved. ## ## NVIDIA Sample Code ## ## Please refer to the NVIDIA end user license agreement (EULA) associated ## with this source code for terms and conditions that govern your use of...
fsi-samples-main
credit_default_risk/clfmodel.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
fsi-samples-main
federated_learning/train-tabformer/custom/tabformer_lstm_validator.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
fsi-samples-main
federated_learning/train-tabformer/custom/tabformer_dataset.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
fsi-samples-main
federated_learning/train-tabformer/custom/validation_json_generator.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
fsi-samples-main
federated_learning/train-tabformer/custom/pt_model_locator.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
fsi-samples-main
federated_learning/train-tabformer/custom/tabformer_lstm_trainer.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
fsi-samples-main
federated_learning/train-tabformer/custom/lstm_network.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
fsi-samples-main
federated_learning/train-tabformer/custom/pt_constants.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
nlp_demo_riva/webserver.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
nlp_demo_riva/tts_infer.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
nlp_demo_riva/qa_infer.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
nlp_demo_riva/wait_socket.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
nlp_demo_riva/wave_utils.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
nlp_demo_riva/asr_infer.py
""" //////////////////////////////////////////////////////////////////////////// // // Copyright (C) NVIDIA Corporation. All rights reserved. // // NVIDIA Sample Code // // Please refer to the NVIDIA end user license agreement (EULA) associated // with this source code for terms and conditions that govern your...
fsi-samples-main
nlp_demo_riva/models_infer.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
fsi-samples-main
nlp_demo_riva/riva/examples/transcribe_file_verbose.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
fsi-samples-main
nlp_demo_riva/riva/examples/transcribe_file.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
fsi-samples-main
nlp_demo_riva/riva/examples/transcribe_mic.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
fsi-samples-main
nlp_demo_riva/riva/examples/transcribe_file_offline.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
fsi-samples-main
nlp_demo_riva/riva/examples/transcribe_file_rt.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
fsi-samples-main
nlp_demo_riva/riva/examples/talk_stream.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
fsi-samples-main
nlp_demo_riva/riva/examples/talk.py
import wave import sys import grpc import time import argparse import riva_api.riva_audio_pb2 as ra import riva_api.riva_asr_pb2 as rasr import riva_api.riva_asr_pb2_grpc as rasr_srv def get_args(): parser = argparse.ArgumentParser(description="Streaming transcription via Riva AI Services") parser.add_argume...
fsi-samples-main
nlp_demo_riva/riva/examples/riva_streaming_asr_client.py
#!/usr/bin/python import sys import html5lib htmlfilename = sys.argv[1] htmlfile = open(htmlfilename) try: doc = html5lib.parse(htmlfile, treebuilder="dom") finally: htmlfile.close() def elementHasClass(el, classArg): """ Return true if and only if classArg is one of the classes of el """ cla...
WebGL-master
specs/latest/1.0/extract-idl.py
#!/usr/bin/python import sys import html5lib htmlfilename = sys.argv[1] htmlfile = open(htmlfilename) try: doc = html5lib.parse(htmlfile, treebuilder="dom") finally: htmlfile.close() def elementHasClass(el, classArg): """ Return true if and only if classArg is one of the classes of el """ cla...
WebGL-master
specs/latest/2.0/extract-idl.py
#!/usr/bin/python import sys import html5lib htmlfilename = sys.argv[1] htmlfile = open(htmlfilename) try: doc = html5lib.parse(htmlfile, treebuilder="dom") finally: htmlfile.close() def elementHasClass(el, classArg): """ Return true if and only if classArg is one of the classes of el """ cla...
WebGL-master
specs/1.0.3/extract-idl.py
#!/usr/bin/python import sys import html5lib htmlfilename = sys.argv[1] htmlfile = open(htmlfilename) try: doc = html5lib.parse(htmlfile, treebuilder="dom") finally: htmlfile.close() def elementHasClass(el, classArg): """ Return true if and only if classArg is one of the classes of el """ cla...
WebGL-master
specs/1.0.2/extract-idl.py
#!/usr/bin/python """generates tests from OpenGL ES 2.0 .run/.test files.""" import os import os.path import sys import re import json import shutil from optparse import OptionParser from xml.dom.minidom import parse if sys.version < '2.6': print 'Wrong Python Version !!!: Need >= 2.6' sys.exit(1) # each shad...
WebGL-master
conformance-suites/1.0.3/conformance/ogles/process-ogles2-tests.py
#!/usr/bin/python """generates tests from OpenGL ES 2.0 .run/.test files.""" import os import os.path import sys import re import json import shutil from optparse import OptionParser from xml.dom.minidom import parse if sys.version < '2.6': print 'Wrong Python Version !!!: Need >= 2.6' sys.exit(1) # each shad...
WebGL-master
conformance-suites/1.0.2/conformance/ogles/process-ogles2-tests.py
import codecs import re import types import sys from constants import EOF, spaceCharacters, asciiLetters, asciiUppercase from constants import encodings, ReparseException import utils #Non-unicode versions of constants for use in the pre-parser spaceCharactersBytes = frozenset([str(item) for item in spaceCharacters])...
WebGL-master
resources/html5lib/src/html5lib/inputstream.py
import re from xml.sax.saxutils import escape, unescape from tokenizer import HTMLTokenizer from constants import tokenTypes class HTMLSanitizerMixin(object): """ sanitization of XHTML+MathML+SVG and of inline style attributes.""" acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area', 'art...
WebGL-master
resources/html5lib/src/html5lib/sanitizer.py
import string, gettext _ = gettext.gettext try: frozenset except NameError: # Import from the sets module for python 2.3 from sets import Set as set from sets import ImmutableSet as frozenset EOF = None E = { "null-character": _(u"Null character in input stream, replaced with U+FFFD."), ...
WebGL-master
resources/html5lib/src/html5lib/constants.py
try: frozenset except NameError: # Import from the sets module for python 2.3 from sets import Set as set from sets import ImmutableSet as frozenset try: any except: # Implement 'any' for python 2.4 and previous def any(iterable): for element in iterable: if element: ...
WebGL-master
resources/html5lib/src/html5lib/html5parser.py
""" HTML parsing library based on the WHATWG "HTML5" specification. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage: import html5lib f = open("my_document.html") tree = h...
WebGL-master
resources/html5lib/src/html5lib/__init__.py
import re baseChar = """[#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] ...
WebGL-master
resources/html5lib/src/html5lib/ihatexml.py
try: frozenset except NameError: # Import from the sets module for python 2.3 from sets import Set as set from sets import ImmutableSet as frozenset try: from collections import deque except ImportError: from utils import deque from constants import spaceCharacters from constants import ent...
WebGL-master
resources/html5lib/src/html5lib/tokenizer.py
try: frozenset except NameError: #Import from the sets module for python 2.3 from sets import Set as set from sets import ImmutableSet as frozenset class MethodDispatcher(dict): """Dict with 2 special properties: On initiation, keys that are lists, sets or tuples are converted to multiple ...
WebGL-master
resources/html5lib/src/html5lib/utils.py
class Filter(object): def __init__(self, source): self.source = source def __iter__(self): return iter(self.source) def __getattr__(self, name): return getattr(self.source, name)
WebGL-master
resources/html5lib/src/html5lib/filters/_base.py
import _base from html5lib.sanitizer import HTMLSanitizerMixin class Filter(_base.Filter, HTMLSanitizerMixin): def __iter__(self): for token in _base.Filter.__iter__(self): token = self.sanitize_token(token) if token: yield token
WebGL-master
resources/html5lib/src/html5lib/filters/sanitizer.py
import _base class Filter(_base.Filter): def __init__(self, source, encoding): _base.Filter.__init__(self, source) self.encoding = encoding def __iter__(self): state = "pre_head" meta_found = (self.encoding is None) pending = [] for token in _base.Filter.__iter...
WebGL-master
resources/html5lib/src/html5lib/filters/inject_meta_charset.py
WebGL-master
resources/html5lib/src/html5lib/filters/__init__.py
# # The goal is to finally have a form filler where you pass data for # each form, using the algorithm for "Seeding a form with initial values" # See http://www.whatwg.org/specs/web-forms/current-work/#seeding # import _base from html5lib.constants import spaceCharacters spaceCharacters = u"".join(spaceCharacters) c...
WebGL-master
resources/html5lib/src/html5lib/filters/formfiller.py
import _base class Filter(_base.Filter): def slider(self): previous1 = previous2 = None for token in self.source: if previous1 is not None: yield previous2, previous1, token previous2 = previous1 previous1 = token yield previous2, previous...
WebGL-master
resources/html5lib/src/html5lib/filters/optionaltags.py
from gettext import gettext _ = gettext import _base from html5lib.constants import cdataElements, rcdataElements, voidElements from html5lib.constants import spaceCharacters spaceCharacters = u"".join(spaceCharacters) class LintError(Exception): pass class Filter(_base.Filter): def __iter__(self): open...
WebGL-master
resources/html5lib/src/html5lib/filters/lint.py
try: frozenset except NameError: # Import from the sets module for python 2.3 from sets import ImmutableSet as frozenset import re import _base from html5lib.constants import rcdataElements, spaceCharacters spaceCharacters = u"".join(spaceCharacters) SPACES_REGEX = re.compile(u"[%s]+" % spaceCharacters) ...
WebGL-master
resources/html5lib/src/html5lib/filters/whitespace.py
import gettext _ = gettext.gettext from html5lib.constants import voidElements, spaceCharacters spaceCharacters = u"".join(spaceCharacters) class TreeWalker(object): def __init__(self, tree): self.tree = tree def __iter__(self): raise NotImplementedError def error(self, msg): ret...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/_base.py
from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \ COMMENT, IGNORABLE_WHITESPACE, CHARACTERS import _base from html5lib.constants import voidElements class TreeWalker(_base.TreeWalker): def __iter__(self): ignore_until = None previous = None for event in self.tree: ...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/pulldom.py
from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT from genshi.output import NamespaceFlattener import _base from html5lib.constants import voidElements class TreeWalker(_base.TreeWalker): def __iter__(self): de...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/genshistream.py
"""A collection of modules for iterating through different kinds of tree, generating tokens identical to those produced by the tokenizer module. To create a tree walker for a new type of tree, you need to do implement a tree walker object (called TreeWalker by convention) that implements a 'serialize' method taking a ...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/__init__.py
import re import gettext _ = gettext.gettext from BeautifulSoup import BeautifulSoup, Declaration, Comment, Tag from html5lib.constants import namespaces import _base class TreeWalker(_base.NonRecursiveTreeWalker): doctype_regexp = re.compile( r'DOCTYPE\s+(?P<name>[^\s]*)(\s*PUBLIC\s*"(?P<publicId>.*)"\s*...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/soup.py
from lxml import etree from html5lib.treebuilders.etree import tag_regexp from gettext import gettext _ = gettext import _base from html5lib.constants import voidElements from html5lib import ihatexml class Root(object): def __init__(self, et): self.elementtree = et self.children = [] if...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/lxmletree.py
import gettext _ = gettext.gettext try: from types import ModuleType except: from new import module as ModuleType import copy import re import _base from html5lib.constants import voidElements tag_regexp = re.compile("{([^}]*)}(.*)") moduleCache = {} def getETreeModule(ElementTreeImplementation): name ...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/etree.py
import gettext _ = gettext.gettext import _base class TreeWalker(_base.NonRecursiveTreeWalker): """Given that simpletree has no performant way of getting a node's next sibling, this implementation returns "nodes" as tuples with the following content: 1. The parent Node (Element, Document or DocumentF...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/simpletree.py
from xml.dom import Node import gettext _ = gettext.gettext import _base from html5lib.constants import voidElements class TreeWalker(_base.NonRecursiveTreeWalker): def getNodeDetails(self, node): if node.nodeType == Node.DOCUMENT_TYPE_NODE: return _base.DOCTYPE, node.name, node.publicId, nod...
WebGL-master
resources/html5lib/src/html5lib/treewalkers/dom.py
from htmlserializer import HTMLSerializer class XHTMLSerializer(HTMLSerializer): quote_attr_values = True minimize_boolean_attributes = False use_trailing_solidus = True escape_lt_in_attrs = True omit_optional_tags = False escape_rcdata = True
WebGL-master
resources/html5lib/src/html5lib/serializer/xhtmlserializer.py
try: frozenset except NameError: # Import from the sets module for python 2.3 from sets import ImmutableSet as frozenset import gettext _ = gettext.gettext from html5lib.constants import voidElements, booleanAttributes, spaceCharacters from html5lib.constants import rcdataElements, entities, xmlEntities f...
WebGL-master
resources/html5lib/src/html5lib/serializer/htmlserializer.py
from html5lib import treewalkers from htmlserializer import HTMLSerializer from xhtmlserializer import XHTMLSerializer def serialize(input, tree="simpletree", format="html", encoding=None, **serializer_opts): # XXX: Should we cache this? walker = treewalkers.getTreeWalker(tree) if format =...
WebGL-master
resources/html5lib/src/html5lib/serializer/__init__.py
from html5lib.constants import scopingElements, tableInsertModeElements, namespaces try: frozenset except NameError: # Import from the sets module for python 2.3 from sets import Set as set from sets import ImmutableSet as frozenset # The scope markers are inserted when entering object elements, # marq...
WebGL-master
resources/html5lib/src/html5lib/treebuilders/_base.py
import warnings import re import _base from html5lib.constants import DataLossWarning import html5lib.constants as constants import etree as etree_builders from html5lib import ihatexml try: import lxml.etree as etree except ImportError: pass fullTree = True tag_regexp = re.compile("{([^}]*)}(.*)") """Modul...
WebGL-master
resources/html5lib/src/html5lib/treebuilders/etree_lxml.py
"""A collection of modules for building different kinds of tree from HTML documents. To create a treebuilder for a new type of tree, you need to do implement several things: 1) A set of classes for various types of elements: Document, Doctype, Comment, Element. These must implement the interface of _base.treebuilders...
WebGL-master
resources/html5lib/src/html5lib/treebuilders/__init__.py
import warnings warnings.warn("BeautifulSoup 3.x (as of 3.1) is not fully compatible with html5lib and support will be removed in the future", DeprecationWarning) from BeautifulSoup import BeautifulSoup, Tag, NavigableString, Comment, Declaration import _base from html5lib.constants import namespaces, DataLossWarnin...
WebGL-master
resources/html5lib/src/html5lib/treebuilders/soup.py
try: from types import ModuleType except: from new import module as ModuleType import re import types import _base from html5lib import ihatexml from html5lib import constants from html5lib.constants import namespaces tag_regexp = re.compile("{([^}]*)}(.*)") moduleCache = {} def getETreeModule(ElementTreeIm...
WebGL-master
resources/html5lib/src/html5lib/treebuilders/etree.py
import _base from html5lib.constants import voidElements, namespaces, prefixes from xml.sax.saxutils import escape # Really crappy basic implementation of a DOM-core like thing class Node(_base.Node): type = -1 def __init__(self, name): self.name = name self.parent = None self.value = N...
WebGL-master
resources/html5lib/src/html5lib/treebuilders/simpletree.py
from xml.dom import minidom, Node, XML_NAMESPACE, XMLNS_NAMESPACE try: from types import ModuleType except: from new import module as ModuleType import re import weakref import _base from html5lib import constants, ihatexml from html5lib.constants import namespaces moduleCache = {} def getDomModule(DomImple...
WebGL-master
resources/html5lib/src/html5lib/treebuilders/dom.py
import os import sys import traceback import StringIO import warnings import re warnings.simplefilter("error") from support import html5lib_test_files as data_files from support import TestData, convert, convertExpected import html5lib from html5lib import html5parser, treebuilders, constants treeTypes = {"simpletre...
WebGL-master
resources/html5lib/src/html5lib/tests/test_parser.py
import sys import os import glob import unittest #Allow us to import the parent module os.chdir(os.path.split(os.path.abspath(__file__))[0]) sys.path.insert(0, os.path.abspath(os.curdir)) sys.path.insert(0, os.path.abspath(os.pardir)) sys.path.insert(0, os.path.join(os.path.abspath(os.pardir), "src")) def buildTestSu...
WebGL-master
resources/html5lib/src/html5lib/tests/runparsertests.py
import os import sys import StringIO import unittest import warnings warnings.simplefilter("error") from support import html5lib_test_files, TestData, convertExpected from html5lib import html5parser, treewalkers, treebuilders, constants from html5lib.filters.lint import Filter as LintFilter, LintError def PullDOMA...
WebGL-master
resources/html5lib/src/html5lib/tests/test_treewalkers.py
import support from html5lib import html5parser from html5lib.constants import namespaces from html5lib.treebuilders import dom import unittest # tests that aren't autogenerated from text files class MoreParserTests(unittest.TestCase): def test_assertDoctypeCloneable(self): parser = html5parser.HTMLParser(tree...
WebGL-master
resources/html5lib/src/html5lib/tests/test_parser2.py
import unittest from html5lib.filters.whitespace import Filter from html5lib.constants import spaceCharacters spaceCharacters = u"".join(spaceCharacters) class TestCase(unittest.TestCase): def runTest(self, input, expected): output = list(Filter(input)) errorMsg = "\n".join(["\n\nInput:", str(inpu...
WebGL-master
resources/html5lib/src/html5lib/tests/test_whitespace_filter.py
import os import sys import codecs import glob base_path = os.path.split(__file__)[0] if os.path.exists(os.path.join(base_path, 'testdata')): #release test_dir = os.path.join(base_path, 'testdata') else: #development test_dir = os.path.abspath( os.path.join(base_path, os.p...
WebGL-master
resources/html5lib/src/html5lib/tests/support.py
import sys import os import unittest import cStringIO import warnings import re try: import json except ImportError: import simplejson as json from support import html5lib_test_files from html5lib.tokenizer import HTMLTokenizer from html5lib import constants class TokenizerTestParser(object): def __init_...
WebGL-master
resources/html5lib/src/html5lib/tests/test_tokenizer.py
import sys import unittest from html5lib.filters.formfiller import SimpleFilter class FieldStorage(dict): def getlist(self, name): l = self[name] if isinstance(l, list): return l elif isinstance(l, tuple) or hasattr(l, '__iter__'): return list(l) return [l] ...
WebGL-master
resources/html5lib/src/html5lib/tests/test_formfiller.py
import os import unittest from support import html5lib_test_files try: import json except ImportError: import simplejson as json import html5lib from html5lib import html5parser, serializer, constants from html5lib.treewalkers._base import TreeWalker optionals_loaded = [] try: from lxml import etree ...
WebGL-master
resources/html5lib/src/html5lib/tests/test_serializer.py
import os import unittest from support import html5lib_test_files, TestData, test_dir from html5lib import HTMLParser, inputstream import re, unittest class Html5EncodingTestCase(unittest.TestCase): def test_codec_name(self): self.assertEquals(inputstream.codecName("utf-8"), "utf-8") self.assertE...
WebGL-master
resources/html5lib/src/html5lib/tests/test_encoding.py
import sys import os parent_path = os.path.abspath(os.path.join(os.path.split(__file__)[0], "..")) if not parent_path in sys.path: sys.path.insert(0, parent_path) del parent_path from runtests import buildTestSuite import support
WebGL-master
resources/html5lib/src/html5lib/tests/__init__.py
import sys import os if __name__ == '__main__': #Allow us to import from the src directory os.chdir(os.path.split(os.path.abspath(__file__))[0]) sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src"))) from tokenizer import HTMLTokenizer class HTMLParser(object): """ Fake parser to test to...
WebGL-master
resources/html5lib/src/html5lib/tests/mockParser.py
import os import sys import unittest try: import json except ImportError: import simplejson as json from html5lib import html5parser, sanitizer, constants def runSanitizerTest(name, expected, input): expected = ''.join([token.toxml() for token in html5parser.HTMLParser(). parseFr...
WebGL-master
resources/html5lib/src/html5lib/tests/test_sanitizer.py
import sys import os import json import re import html5lib import support import test_parser import test_tokenizer p = html5lib.HTMLParser() unnamespaceExpected = re.compile(r"^(\|\s*)<html ([^>]+)>", re.M).sub def main(out_path): if not os.path.exists(out_path): sys.stderr.write("Path %s does not exist...
WebGL-master
resources/html5lib/src/html5lib/tests/tokenizertotree.py
import sys import os import glob import unittest def buildTestSuite(): suite = unittest.TestSuite() for testcase in glob.glob('test_*.py'): module = os.path.splitext(testcase)[0] suite.addTest(__import__(module).buildTestSuite()) return suite def main(): results = unittest.TextTestRunn...
WebGL-master
resources/html5lib/src/html5lib/tests/runtests.py
import support import unittest, codecs from html5lib.inputstream import HTMLInputStream class HTMLInputStreamShortChunk(HTMLInputStream): _defaultChunkSize = 2 class HTMLInputStreamTest(unittest.TestCase): def test_char_ascii(self): stream = HTMLInputStream("'", encoding='ascii') self.assert...
WebGL-master
resources/html5lib/src/html5lib/tests/test_stream.py
def f1(): x = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" y = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" z = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" x += y + z def f2(): x = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" y = "ABCDEFGHIJKLMNOPQRSTUVW...
WebGL-master
resources/html5lib/src/html5lib/tests/performance/concatenation.py
''' Created on 23 Dec 2014 @author: Alberto Lopez Mobica LTD ''' ''' Python Script TO COMPILE JAVASCRIPTS WITH closure.jar locally in the selected directory STEPS: - paste a copy of the compiler.jar found on https://developers.google.com/closure/compiler/docs/gettingstarted_app - execute/paste this sc...
WebGL-master
sdk/tests/deqp/compile-shaders-local.py
import os import re # Generate an HTML file for each .test file in the current directory # TEST_LIST_FILE = '00_test_list.txt'; TEMPLATE = 'template.html'; def genHTML(template, test): contents = re.sub('___TEST_NAME___', "'" + test + "'", template); filename = test + '.html'; print "Generating " + filename; wit...
WebGL-master
sdk/tests/deqp/genHTMLfromTest.py
#!/usr/bin/python """generates tests from OpenGL ES 2.0 .run/.test files.""" import os import os.path import sys import re import json import shutil from optparse import OptionParser from xml.dom.minidom import parse if sys.version < '2.6': print 'Wrong Python Version !!!: Need >= 2.6' sys.exit(1) # each shad...
WebGL-master
sdk/tests/conformance/ogles/process-ogles2-tests.py
#!/usr/bin/env python us = [float(f) for f in file('mine.txt')] them = [float(f) for f in file('them.txt')] assert len(us) == len(them) for i, (a, b) in enumerate(zip(us, them)): diff = a - b if diff > 2./65536: vert, coord = divmod(i, 3) round, vert = divmod(vert, 6) print "%d:%d:%d" % (round, vert,...
WebGL-master
sdk/demos/google/san-angeles/gles/bob/compare.py
"""Modulus Project Configurator"""
modulus-toolchain-master
mpc/__init__.py
from bottle import run, request, post, get import json @get("/info") def index(): return {"a": 3} @post("/infer") def index(): postdata = json.loads(request.body.read()) print(postdata) # this goes to log file only, not to client return "Hi {name}".format(name=postdata["name"]) run(host="localhos...
modulus-toolchain-master
mpc/rest_api.py
modulus-toolchain-master
mpc/rest_server/__init__.py
import sys, os from subprocess import Popen, PIPE, check_call, run CMD = "python -m mpc.rest_server.launcher_subprocess".split() stageid = sys.argv[1] path = f"infer" print(os.getcwd(), path) print(CMD) p = Popen(CMD, stderr=PIPE, stdin=PIPE, stdout=PIPE, universal_newlines=True) p.stdin.write(f"load-infer-functio...
modulus-toolchain-master
mpc/rest_server/start.py
""" This module receives commands from sys.stdin, one line at a time and loads infer() functions. This module is inside the sub-process specific to a infer.py (a stage-specific sub-process) Valid commands: load-infer-function [path] info infer exit """ import sys import importlib import time import numpy as np n ...
modulus-toolchain-master
mpc/rest_server/launcher_subprocess.py
import ipyleaflet as ipl class BaseMap: def __init__(self): self._m = ipl.Map(layers=[], crs=ipl.projections.Simple)
modulus-toolchain-master
mpc/nvapp/mapcomponent.py
modulus-toolchain-master
mpc/nvapp/__init__.py
import os, sys import importlib # RELOAD_PATHS = ["/home/pavel/work/repos/L2RPN/individual/pavel/topo-sim/"] def should_reload(m, RELOAD_PATHS): if m is None: return False try: for rp in RELOAD_PATHS: if "__file__" in dir(m) and rp in m.__file__: return True e...
modulus-toolchain-master
mpc/nvapp/common.py