content
stringlengths 7
1.05M
|
|---|
class R1DataCheckSpecificDto:
def __init__(self, id_r1_data_check_specific=None, init_event=None, end_event=None, init_pixel=None, end_pixel=None,
init_sample=None, end_sample=None,
init_subrun=None, end_subrun=None, type_of_gap_calc=None, list_of_module_in_detail=None):
self.__id_r1_data_check_specific = id_r1_data_check_specific
self.__init_event = init_event
self.__end_event = end_event
self.__init_pixel = init_pixel
self.__end_pixel = end_pixel
self.__init_sample = init_sample
self.__end_sample = end_sample
self.__init_subrun = init_subrun
self.__end_subrun = end_subrun
self.__type_of_gap_calc = type_of_gap_calc
self.__list_of_module_in_detail = list_of_module_in_detail
@property
def id_r1_data_check_specific(self):
return self.__id_r1_data_check_specific
@property
def init_event(self):
return self.__init_event
@property
def end_event(self):
return self.__end_event
@property
def init_pixel(self):
return self.__init_pixel
@property
def end_pixel(self):
return self.__end_pixel
@property
def init_sample(self):
return self.__init_sample
@property
def end_sample(self):
return self.__end_sample
@property
def init_subrun(self):
return self.__init_subrun
@property
def end_subrun(self):
return self.__end_subrun
@property
def type_of_gap_calc(self):
return self.__type_of_gap_calc
@property
def list_of_module_in_detail(self):
return self.__list_of_module_in_detail
@id_r1_data_check_specific.setter
def id_r1_data_check_specific(self, value):
self.__id_r1_data_check_specific = value
@init_event.setter
def init_event(self, value):
self.__init_event = value
@end_event.setter
def end_event(self, value):
self.__end_event = value
@init_pixel.setter
def init_pixel(self, value):
self.__init_pixel = value
@end_pixel.setter
def end_pixel(self, value):
self.__end_pixel = value
@init_sample.setter
def init_sample(self, value):
self.__init_sample = value
@end_sample.setter
def end_sample(self, value):
self.__end_sample = value
@init_subrun.setter
def init_subrun(self, value):
self.__init_subrun = value
@end_subrun.setter
def end_subrun(self, value):
self.__end_subrun = value
@type_of_gap_calc.setter
def type_of_gap_calc(self, value):
self.__type_of_gap_calc = value
@list_of_module_in_detail.setter
def list_of_module_in_detail(self, value):
self.__list_of_module_in_detail = value
def create_r1_data_check_specific(id_r1_data_check_specific, init_event, end_event, init_pixel, end_pixel, init_sample,
end_sample,
init_subrun, end_subrun, type_of_gap_calc, list_of_module_in_detail):
dto = R1DataCheckSpecificDto()
dto.id_r1_data_check_specific = id_r1_data_check_specific
dto.init_event = init_event
dto.end_event = end_event
dto.init_pixel = init_pixel
dto.end_pixel = end_pixel
dto.init_sample = init_sample
dto.end_sample = end_sample
dto.init_subrun = init_subrun
dto.end_subrun = end_subrun
dto.type_of_gap_calc = type_of_gap_calc
dto.list_of_module_in_detail = list_of_module_in_detail
return dto
|
def takethis():
fullspeed()
i01.moveHead(14,90)
i01.moveArm("left",13,45,95,10)
i01.moveArm("right",5,90,30,10)
i01.moveHand("left",2,2,2,2,2,60)
i01.moveHand("right",81,66,82,60,105,113)
i01.moveTorso(85,76,90)
sleep(3)
closelefthand()
i01.moveTorso(110,90,90)
sleep(2)
isitaball()
i01.mouth.speak("what is it")
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-05-18 23:29:05
# @Author : Ivy Mong (davy0328meng@gmail.com)
arr1 = [1, 3, 4, 6, 10]
arr2 = [2, 5, 8, 11]
ind = 0
ans = arr1.copy()
for i in range(len(arr2)):
while ind < len(arr1):
if arr2[i] <= arr1[ind]:
ans.insert(ind+i, arr2[i])
break
else:
ind += 1
else:
ans = ans + arr2[i:]
print(ans)
|
print('Dratuti!')
print('Hello!')
print('Hello, Georgios!')
print('Hello, Pupa!')
|
# Copyright (C) 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or 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.
# Repository rule to download, extract and patch breakpad.
_BASE = "https://chromium.googlesource.com/breakpad/breakpad";
def _breakpad_impl(repository_ctx):
repository_ctx.download_and_extract(
url = _BASE + "/+archive/" + repository_ctx.attr.commit + ".tar.gz",
output = ".",
)
repository_ctx.symlink(Label("@gapid//tools/build/third_party/breakpad:breakpad.BUILD"), "BUILD")
if repository_ctx.os.name.startswith("windows"):
# Patch up breakpad on windows and add the dump_syms src.
repository_ctx.symlink(Label("@gapid//tools/build/third_party/breakpad:windows.patch"), "windows.patch")
repository_ctx.symlink(Label("@gapid//tools/build/third_party/breakpad:dump_syms_pe.cc"), "src/tools/windows/dump_syms/dump_syms_pe.cc")
bash_exe = repository_ctx.os.environ["BAZEL_SH"] if "BAZEL_SH" in repository_ctx.os.environ else "c:/tools/msys64/usr/bin/bash.exe"
result = repository_ctx.execute([bash_exe, "-c",
"cd {} && /usr/bin/patch -p1 -i windows.patch".format(repository_ctx.path("."))])
if result.return_code:
fail("Failed to apply patch: (%d)\n%s" % (result.return_code, result.stderr))
breakpad = repository_rule(
implementation = _breakpad_impl,
attrs = {
"commit": attr.string(mandatory = True),
},
)
|
DEBUG = True
SECRET_KEY = "iECgbYWReMNxkRprrzMo5KAQYnb2UeZ3bwvReTSt+VSESW0OB8zbglT+6rEcDW9X"
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:999999@127.0.0.1:3306/fisher"
|
class RebarContainerItem(object,IDisposable):
""" Provides implementation for Rebar stored in RebarContainer. """
def CanApplyPresentationMode(self,dBView):
"""
CanApplyPresentationMode(self: RebarContainerItem,dBView: View) -> bool
Checks if a presentation mode can be applied for this rebar in the given view.
dBView: The view in which presentation mode will be applied.
Returns: True if presentation mode can be applied for this view,false otherwise.
"""
pass
def CanUseHookType(self,proposedHookId):
"""
CanUseHookType(self: RebarContainerItem,proposedHookId: ElementId) -> bool
Checks if the specified RebarHookType id is of a valid RebarHookType for the
Rebar's RebarBarType
proposedHookId: The Id of the RebarHookType
Returns: Returns true if the id is of a valid RebarHookType for the Rebar element.
"""
pass
def ClearPresentationMode(self,dBView):
"""
ClearPresentationMode(self: RebarContainerItem,dBView: View)
Sets the presentation mode for this rebar set to the default (either for a
single view,or for all views).
dBView: The view where the presentation mode will be cleared. NULL for all views
"""
pass
def ComputeDrivingCurves(self):
"""
ComputeDrivingCurves(self: RebarContainerItem) -> IList[Curve]
Compute the driving curves.
Returns: Returns an empty array if an error is encountered.
"""
pass
def Dispose(self):
""" Dispose(self: RebarContainerItem) """
pass
def DoesBarExistAtPosition(self,barPosition):
"""
DoesBarExistAtPosition(self: RebarContainerItem,barPosition: int) -> bool
Checks whether a bar exists at the specified position.
barPosition: A bar position index between 0 and NumberOfBarPositions-1.
"""
pass
def FindMatchingPredefinedPresentationMode(self,dBView):
"""
FindMatchingPredefinedPresentationMode(self: RebarContainerItem,dBView: View) -> RebarPresentationMode
Determines if there is a matching RebarPresentationMode for the current set of
selected hidden and unhidden bars assigned to the given view.
dBView: The view.
Returns: The presentation mode that matches the current set of selected hidden and
unhidden bars.
If there is no better match,this returns
RebarPresentationMode.Select.
"""
pass
def GetBarPositionTransform(self,barPositionIndex):
"""
GetBarPositionTransform(self: RebarContainerItem,barPositionIndex: int) -> Transform
Return a transform representing the relative position of any
individual bar
in the set.
barPositionIndex: An index between 0 and (NumberOfBarPositions-1).
Returns: The position of a bar in the set relative to the first position.
"""
pass
def GetBendData(self):
"""
GetBendData(self: RebarContainerItem) -> RebarBendData
Gets the RebarBendData,containing bar and hook information,of the instance.
"""
pass
def GetCenterlineCurves(self,adjustForSelfIntersection,suppressHooks,suppressBendRadius,multiplanarOption=None):
"""
GetCenterlineCurves(self: RebarContainerItem,adjustForSelfIntersection: bool,suppressHooks: bool,suppressBendRadius: bool) -> IList[Curve]
A chain of curves representing the centerline of the rebar.
adjustForSelfIntersection: If the curves overlap,as in a planar stirrup,this parameter controls
whether they should be adjusted to avoid intersection (as in fine views),
or kept in a single plane for simplicity (as in coarse views).
suppressHooks: Identifies if the chain will include hooks curves.
suppressBendRadius: Identifies if the connected chain will include unfilleted curves.
Returns: The centerline curves or empty array if the curves cannot be computed because
the parameters values are inconsistent
with the constraints of the
RebarShape definition.
GetCenterlineCurves(self: RebarContainerItem,adjustForSelfIntersection: bool,suppressHooks: bool,suppressBendRadius: bool,multiplanarOption: MultiplanarOption) -> IList[Curve]
A chain of curves representing the centerline of the rebar.
adjustForSelfIntersection: If the curves overlap,as in a planar stirrup,this parameter controls
whether they should be adjusted to avoid intersection (as in fine views),
or kept in a single plane for simplicity (as in coarse views).
suppressHooks: Identifies if the chain will include hooks curves.
suppressBendRadius: Identifies if the connected chain will include unfilleted curves.
multiplanarOption: If the Rebar is a multi-planar shape,this parameter controls whether to
generate only
the curves in the primary plane (IncludeOnlyPlanarCurves),or
to generate all curves,
(IncludeAllMultiplanarCurves) including the
out-of-plane connector segments as well as
multi-planar copies of the
primary plane curves.
This argument is ignored for planar shapes.
Returns: The centerline curves or empty array if the curves cannot be computed because
the parameters values are inconsistent
with the constraints of the
RebarShape definition.
"""
pass
def GetDistributionPath(self):
"""
GetDistributionPath(self: RebarContainerItem) -> Line
The distribution path of a rebar set.
Returns: A line beginning at (0,0,0) and representing the direction and
length of
the set.
"""
pass
def GetHookOrientation(self,iEnd):
"""
GetHookOrientation(self: RebarContainerItem,iEnd: int) -> RebarHookOrientation
Returns the orientation of the hook plane at the start or at the end of the
rebar with respect to the orientation of the first or the last curve and the
plane normal.
iEnd: 0 for the start hook,1 for the end hook.
Returns: Value=Right: The hook is on your right as you stand at the end of the bar,
with the bar behind you,taking the bar's normal as "up."
Value=Left:
The hook is on your left as you stand at the end of the bar,
with the bar
behind you,taking the bar's normal as "up."
"""
pass
def GetHookTypeId(self,end):
"""
GetHookTypeId(self: RebarContainerItem,end: int) -> ElementId
Get the id of the RebarHookType to be applied to the rebar.
end: 0 for the start hook,1 for the end hook.
Returns: The id of a RebarHookType,or invalidElementId if the rebar has
no hook at
the specified end.
"""
pass
def GetPresentationMode(self,dBView):
"""
GetPresentationMode(self: RebarContainerItem,dBView: View) -> RebarPresentationMode
Gets the presentaion mode for this rebar set when displayed in the given view.
dBView: The view.
Returns: The presentation mode.
"""
pass
def HasPresentationOverrides(self,dBView):
"""
HasPresentationOverrides(self: RebarContainerItem,dBView: View) -> bool
Identifies if this rebar set has overridden default presentation settings for
the given view.
dBView: The view.
Returns: True if this rebar set has overriden default presentation settings,false
otherwise.
"""
pass
def IsBarHidden(self,view,barIndex):
"""
IsBarHidden(self: RebarContainerItem,view: View,barIndex: int) -> bool
Identifies if a given bar in this rebar set is hidden in this view.
view: The view.
barIndex: The index of the bar from this rebar set.
Returns: True if the bar is hidden in this view,false otherwise.
"""
pass
def IsRebarInSection(self,dBView):
"""
IsRebarInSection(self: RebarContainerItem,dBView: View) -> bool
Identifies if this rebar set is shown as a cross-section in the given view.
dBView: The view.
Returns: True if this rebar set is shown as a cross-section,false otherwise.
"""
pass
def ReleaseUnmanagedResources(self,*args):
""" ReleaseUnmanagedResources(self: RebarContainerItem,disposing: bool) """
pass
def SetBarHiddenStatus(self,view,barIndex,hide):
"""
SetBarHiddenStatus(self: RebarContainerItem,view: View,barIndex: int,hide: bool)
Sets the bar in this rebar set to be hidden or unhidden in the given view.
view: The view.
barIndex: The index of the bar from this set.
hide: True to hide this bar in the view,false to unhide the bar.
"""
pass
def SetFromCurves(self,style,barType,startHook,endHook,norm,curves,startHookOrient,endHookOrient,useExistingShapeIfPossible,createNewShape):
""" SetFromCurves(self: RebarContainerItem,style: RebarStyle,barType: RebarBarType,startHook: RebarHookType,endHook: RebarHookType,norm: XYZ,curves: IList[Curve],startHookOrient: RebarHookOrientation,endHookOrient: RebarHookOrientation,useExistingShapeIfPossible: bool,createNewShape: bool) """
pass
def SetFromCurvesAndShape(self,rebarShape,barType,startHook,endHook,norm,curves,startHookOrient,endHookOrient):
""" SetFromCurvesAndShape(self: RebarContainerItem,rebarShape: RebarShape,barType: RebarBarType,startHook: RebarHookType,endHook: RebarHookType,norm: XYZ,curves: IList[Curve],startHookOrient: RebarHookOrientation,endHookOrient: RebarHookOrientation) """
pass
def SetFromRebar(self,rebar):
"""
SetFromRebar(self: RebarContainerItem,rebar: Rebar)
Set an instance of a RebarContainerItem element according to a Rebar parameters.
rebar: The Rebar.
"""
pass
def SetFromRebarShape(self,rebarShape,barType,origin,xVec,yVec):
"""
SetFromRebarShape(self: RebarContainerItem,rebarShape: RebarShape,barType: RebarBarType,origin: XYZ,xVec: XYZ,yVec: XYZ)
Set an instance of a RebarContainerItem element,as an instance of a
RebarShape.
The instance will have the default shape parameters from the
RebarShape,
and its location is based on the bounding box of the shape in
the shape definition.
Hooks are removed from the shape before computing its
bounding box.
If appropriate hooks can be found in the document,they will
be assigned arbitrarily.
rebarShape: A RebarShape element that defines the shape of the rebar.
barType: A RebarBarType element that defines bar diameter,bend radius and material of
the rebar.
origin: The lower-left corner of the shape's bounding box will be placed at this point
in the project.
xVec: The x-axis in the shape definition will be mapped to this direction in the
project.
yVec: The y-axis in the shape definition will be mapped to this direction in the
project.
"""
pass
def SetHookOrientation(self,iEnd,hookOrientation):
"""
SetHookOrientation(self: RebarContainerItem,iEnd: int,hookOrientation: RebarHookOrientation)
Defines the orientation of the hook plane at the start or at the end of the
rebar with respect to the orientation of the first or the last curve and the
plane normal.
iEnd: 0 for the start hook,1 for the end hook.
hookOrientation: Only two values are permitted:
Value=Right: The hook is on your right as
you stand at the end of the bar,
with the bar behind you,taking the bar's
normal as "up."
Value=Left: The hook is on your left as you stand at the
end of the bar,
with the bar behind you,taking the bar's normal as "up."
"""
pass
def SetHookTypeId(self,end,hookTypeId):
"""
SetHookTypeId(self: RebarContainerItem,end: int,hookTypeId: ElementId)
Set the id of the RebarHookType to be applied to the rebar.
end: 0 for the start hook,1 for the end hook.
hookTypeId: The id of a RebarHookType element,or invalidElementId if
the rebar should
have no hook at the specified end.
"""
pass
def SetLayoutAsFixedNumber(self,numberOfBarPositions,arrayLength,barsOnNormalSide,includeFirstBar,includeLastBar):
"""
SetLayoutAsFixedNumber(self: RebarContainerItem,numberOfBarPositions: int,arrayLength: float,barsOnNormalSide: bool,includeFirstBar: bool,includeLastBar: bool)
Sets the Layout Rule property of rebar set to FixedNumber.
numberOfBarPositions: The number of bar positions in rebar set
arrayLength: The distribution length of rebar set
barsOnNormalSide: Identifies if the bars of the rebar set are on the same side of the rebar plane
indicated by the normal
includeFirstBar: Identifies if the first bar in rebar set is shown
includeLastBar: Identifies if the last bar in rebar set is shown
"""
pass
def SetLayoutAsMaximumSpacing(self,spacing,arrayLength,barsOnNormalSide,includeFirstBar,includeLastBar):
"""
SetLayoutAsMaximumSpacing(self: RebarContainerItem,spacing: float,arrayLength: float,barsOnNormalSide: bool,includeFirstBar: bool,includeLastBar: bool)
Sets the Layout Rule property of rebar set to MaximumSpacing
spacing: The maximum spacing between rebar in rebar set
arrayLength: The distribution length of rebar set
barsOnNormalSide: Identifies if the bars of the rebar set are on the same side of the rebar plane
indicated by the normal
includeFirstBar: Identifies if the first bar in rebar set is shown
includeLastBar: Identifies if the last bar in rebar set is shown
"""
pass
def SetLayoutAsMinimumClearSpacing(self,spacing,arrayLength,barsOnNormalSide,includeFirstBar,includeLastBar):
"""
SetLayoutAsMinimumClearSpacing(self: RebarContainerItem,spacing: float,arrayLength: float,barsOnNormalSide: bool,includeFirstBar: bool,includeLastBar: bool)
Sets the Layout Rule property of rebar set to MinimumClearSpacing
spacing: The maximum spacing between rebar in rebar set
arrayLength: The distribution length of rebar set
barsOnNormalSide: Identifies if the bars of the rebar set are on the same side of the rebar plane
indicated by the normal
includeFirstBar: Identifies if the first bar in rebar set is shown
includeLastBar: Identifies if the last bar in rebar set is shown
"""
pass
def SetLayoutAsNumberWithSpacing(self,numberOfBarPositions,spacing,barsOnNormalSide,includeFirstBar,includeLastBar):
"""
SetLayoutAsNumberWithSpacing(self: RebarContainerItem,numberOfBarPositions: int,spacing: float,barsOnNormalSide: bool,includeFirstBar: bool,includeLastBar: bool)
Sets the Layout Rule property of rebar set to NumberWithSpacing
numberOfBarPositions: The number of bar positions in rebar set
spacing: The maximum spacing between rebar in rebar set
barsOnNormalSide: Identifies if the bars of the rebar set are on the same side of the rebar plane
indicated by the normal
includeFirstBar: Identifies if the first bar in rebar set is shown
includeLastBar: Identifies if the last bar in rebar set is shown
"""
pass
def SetLayoutAsSingle(self):
"""
SetLayoutAsSingle(self: RebarContainerItem)
Sets the Layout Rule property of rebar set to Single.
"""
pass
def SetPresentationMode(self,dBView,presentationMode):
"""
SetPresentationMode(self: RebarContainerItem,dBView: View,presentationMode: RebarPresentationMode)
Sets the presentation mode for this rebar set when displayed in the given view.
dBView: The view.
presentationMode: The presentation mode.
"""
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
ArrayLength=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Identifies the distribution path length of rebar set.
Get: ArrayLength(self: RebarContainerItem) -> float
Set: ArrayLength(self: RebarContainerItem)=value
"""
BarsOnNormalSide=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Identifies if the bars of the rebar set are on the same side of the rebar plane indicated by the normal.
Get: BarsOnNormalSide(self: RebarContainerItem) -> bool
Set: BarsOnNormalSide(self: RebarContainerItem)=value
"""
BarTypeId=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The identifier of the rebar bar type.
Get: BarTypeId(self: RebarContainerItem) -> ElementId
"""
BaseFinishingTurns=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""For a spiral,the number of finishing turns at the lower end of the spiral.
Get: BaseFinishingTurns(self: RebarContainerItem) -> int
Set: BaseFinishingTurns(self: RebarContainerItem)=value
"""
Height=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""For a spiral,the overall height.
Get: Height(self: RebarContainerItem) -> float
Set: Height(self: RebarContainerItem)=value
"""
IncludeFirstBar=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Identifies if the first bar in rebar set is shown.
Get: IncludeFirstBar(self: RebarContainerItem) -> bool
Set: IncludeFirstBar(self: RebarContainerItem)=value
"""
IncludeLastBar=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Identifies if the last bar in rebar set is shown.
Get: IncludeLastBar(self: RebarContainerItem) -> bool
Set: IncludeLastBar(self: RebarContainerItem)=value
"""
IsValidObject=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Specifies whether the .NET object represents a valid Revit entity.
Get: IsValidObject(self: RebarContainerItem) -> bool
"""
ItemIndex=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The index of this item in its associated RebarContainer.
Get: ItemIndex(self: RebarContainerItem) -> int
"""
LayoutRule=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Identifies the layout rule of rebar set.
Get: LayoutRule(self: RebarContainerItem) -> RebarLayoutRule
"""
MaxSpacing=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Identifies the maximum spacing between rebar in rebar set.
Get: MaxSpacing(self: RebarContainerItem) -> float
Set: MaxSpacing(self: RebarContainerItem)=value
"""
MultiplanarDepth=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""For a multiplanar rebar,the depth of the instance.
Get: MultiplanarDepth(self: RebarContainerItem) -> float
Set: MultiplanarDepth(self: RebarContainerItem)=value
"""
Normal=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""A unit-length vector normal to the plane of the rebar
Get: Normal(self: RebarContainerItem) -> XYZ
"""
NumberOfBarPositions=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The number of potential bars in the set.
Get: NumberOfBarPositions(self: RebarContainerItem) -> int
Set: NumberOfBarPositions(self: RebarContainerItem)=value
"""
Pitch=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""For a spiral,the pitch,or vertical distance traveled in one rotation.
Get: Pitch(self: RebarContainerItem) -> float
Set: Pitch(self: RebarContainerItem)=value
"""
Quantity=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Identifies the number of bars in rebar set.
Get: Quantity(self: RebarContainerItem) -> int
"""
RebarShapeId=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The RebarShape element that defines the shape of the rebar.
Get: RebarShapeId(self: RebarContainerItem) -> ElementId
Set: RebarShapeId(self: RebarContainerItem)=value
"""
TopFinishingTurns=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""For a spiral,the number of finishing turns at the upper end of the spiral.
Get: TopFinishingTurns(self: RebarContainerItem) -> int
Set: TopFinishingTurns(self: RebarContainerItem)=value
"""
TotalLength=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The length of an individual bar multiplied by Quantity.
Get: TotalLength(self: RebarContainerItem) -> float
"""
Volume=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The volume of an individual bar multiplied by Quantity.
Get: Volume(self: RebarContainerItem) -> float
"""
|
def test_shib_redirect(client, app):
r = client.get("/login/shib")
assert r.status_code == 302
def test_shib_login(app, client):
r = client.get(
"/login/shib/login", headers={app.config["SHIBBOLETH_HEADER"]: "test"}
)
assert r.status_code == 200
def test_shib_login_redirect(app, client):
r = client.get("/login/shib?redirect=http://localhost")
r = client.get(
"/login/shib/login", headers={app.config["SHIBBOLETH_HEADER"]: "test"}
)
assert r.status_code == 302
assert r.headers["Location"] == "http://localhost"
def test_shib_login_fail(client):
r = client.get("/login/shib/login")
assert r.status_code == 401
|
siblings = int(input())
popsicles = int(input())
#your code goes here
if((popsicles % siblings)==0):
print("give away")
else:
print("eat them yourself")
|
# encoding: utf-8
# module System.Text calls itself Text
# from mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089,System,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class Encoding(object,ICloneable):
""" Represents a character encoding. """
def Clone(self):
"""
Clone(self: Encoding) -> object
When overridden in a derived class,creates a shallow copy of the current
System.Text.Encoding object.
Returns: A copy of the current System.Text.Encoding object.
"""
pass
@staticmethod
def Convert(srcEncoding,dstEncoding,bytes,index=None,count=None):
"""
Convert(srcEncoding: Encoding,dstEncoding: Encoding,bytes: Array[Byte],index: int,count: int) -> Array[Byte]
Converts a range of bytes in a byte array from one encoding to another.
srcEncoding: The encoding of the source array,bytes.
dstEncoding: The encoding of the output array.
bytes: The array of bytes to convert.
index: The index of the first element of bytes to convert.
count: The number of bytes to convert.
Returns: An array of type System.Byte containing the result of converting a range of
bytes in bytes from srcEncoding to dstEncoding.
Convert(srcEncoding: Encoding,dstEncoding: Encoding,bytes: Array[Byte]) -> Array[Byte]
Converts an entire byte array from one encoding to another.
srcEncoding: The encoding format of bytes.
dstEncoding: The target encoding format.
bytes: The bytes to convert.
Returns: An array of type System.Byte containing the results of converting bytes from
srcEncoding to dstEncoding.
"""
pass
def Equals(self,value):
"""
Equals(self: Encoding,value: object) -> bool
Determines whether the specified System.Object is equal to the current instance.
value: The System.Object to compare with the current instance.
Returns: true if value is an instance of System.Text.Encoding and is equal to the
current instance; otherwise,false.
"""
pass
def GetByteCount(self,*__args):
"""
GetByteCount(self: Encoding,chars: Array[Char],index: int,count: int) -> int
When overridden in a derived class,calculates the number of bytes produced by
encoding a set of characters from the specified character array.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: Encoding,chars: Char*,count: int) -> int
When overridden in a derived class,calculates the number of bytes produced by
encoding a set of characters starting at the specified character pointer.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: Encoding,chars: Array[Char]) -> int
When overridden in a derived class,calculates the number of bytes produced by
encoding all the characters in the specified character array.
chars: The character array containing the characters to encode.
Returns: The number of bytes produced by encoding all the characters in the specified
character array.
GetByteCount(self: Encoding,s: str) -> int
When overridden in a derived class,calculates the number of bytes produced by
encoding the characters in the specified string.
s: The string containing the set of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
"""
pass
def GetBytes(self,*__args):
"""
GetBytes(self: Encoding,s: str) -> Array[Byte]
When overridden in a derived class,encodes all the characters in the specified
string into a sequence of bytes.
s: The string containing the characters to encode.
Returns: A byte array containing the results of encoding the specified set of characters.
GetBytes(self: Encoding,s: str,charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
When overridden in a derived class,encodes a set of characters from the
specified string into the specified byte array.
s: The string containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
GetBytes(self: Encoding,chars: Char*,charCount: int,bytes: Byte*,byteCount: int) -> int
When overridden in a derived class,encodes a set of characters starting at the
specified character pointer into a sequence of bytes that are stored starting
at the specified byte pointer.
chars: A pointer to the first character to encode.
charCount: The number of characters to encode.
bytes: A pointer to the location at which to start writing the resulting sequence of
bytes.
byteCount: The maximum number of bytes to write.
Returns: The actual number of bytes written at the location indicated by the bytes
parameter.
GetBytes(self: Encoding,chars: Array[Char]) -> Array[Byte]
When overridden in a derived class,encodes all the characters in the specified
character array into a sequence of bytes.
chars: The character array containing the characters to encode.
Returns: A byte array containing the results of encoding the specified set of characters.
GetBytes(self: Encoding,chars: Array[Char],index: int,count: int) -> Array[Byte]
When overridden in a derived class,encodes a set of characters from the
specified character array into a sequence of bytes.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
Returns: A byte array containing the results of encoding the specified set of characters.
GetBytes(self: Encoding,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
When overridden in a derived class,encodes a set of characters from the
specified character array into the specified byte array.
chars: The character array containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
"""
pass
def GetCharCount(self,bytes,*__args):
"""
GetCharCount(self: Encoding,bytes: Byte*,count: int) -> int
When overridden in a derived class,calculates the number of characters
produced by decoding a sequence of bytes starting at the specified byte
pointer.
bytes: A pointer to the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
GetCharCount(self: Encoding,bytes: Array[Byte],index: int,count: int) -> int
When overridden in a derived class,calculates the number of characters
produced by decoding a sequence of bytes from the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
GetCharCount(self: Encoding,bytes: Array[Byte]) -> int
When overridden in a derived class,calculates the number of characters
produced by decoding all the bytes in the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
"""
pass
def GetChars(self,bytes,*__args):
"""
GetChars(self: Encoding,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int) -> int
When overridden in a derived class,decodes a sequence of bytes from the
specified byte array into the specified character array.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
Returns: The actual number of characters written into chars.
GetChars(self: Encoding,bytes: Byte*,byteCount: int,chars: Char*,charCount: int) -> int
When overridden in a derived class,decodes a sequence of bytes starting at the
specified byte pointer into a set of characters that are stored starting at the
specified character pointer.
bytes: A pointer to the first byte to decode.
byteCount: The number of bytes to decode.
chars: A pointer to the location at which to start writing the resulting set of
characters.
charCount: The maximum number of characters to write.
Returns: The actual number of characters written at the location indicated by the chars
parameter.
GetChars(self: Encoding,bytes: Array[Byte]) -> Array[Char]
When overridden in a derived class,decodes all the bytes in the specified byte
array into a set of characters.
bytes: The byte array containing the sequence of bytes to decode.
Returns: A character array containing the results of decoding the specified sequence of
bytes.
GetChars(self: Encoding,bytes: Array[Byte],index: int,count: int) -> Array[Char]
When overridden in a derived class,decodes a sequence of bytes from the
specified byte array into a set of characters.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: A character array containing the results of decoding the specified sequence of
bytes.
"""
pass
def GetDecoder(self):
"""
GetDecoder(self: Encoding) -> Decoder
When overridden in a derived class,obtains a decoder that converts an encoded
sequence of bytes into a sequence of characters.
Returns: A System.Text.Decoder that converts an encoded sequence of bytes into a
sequence of characters.
"""
pass
def GetEncoder(self):
"""
GetEncoder(self: Encoding) -> Encoder
When overridden in a derived class,obtains an encoder that converts a sequence
of Unicode characters into an encoded sequence of bytes.
Returns: A System.Text.Encoder that converts a sequence of Unicode characters into an
encoded sequence of bytes.
"""
pass
@staticmethod
def GetEncoding(*__args):
"""
GetEncoding(name: str) -> Encoding
Returns the encoding associated with the specified code page name.
name: The code page name of the preferred encoding. Any value returned by the
System.Text.Encoding.WebName property is valid. Possible values are listed in
the Name column of the table that appears in the System.Text.Encoding class
topic.
Returns: The encoding associated with the specified code page.
GetEncoding(name: str,encoderFallback: EncoderFallback,decoderFallback: DecoderFallback) -> Encoding
Returns the encoding associated with the specified code page name. Parameters
specify an error handler for characters that cannot be encoded and byte
sequences that cannot be decoded.
name: The code page name of the preferred encoding. Any value returned by the
System.Text.Encoding.WebName property is valid. Possible values are listed in
the Name column of the table that appears in the System.Text.Encoding class
topic.
encoderFallback: An object that provides an error-handling procedure when a character cannot be
encoded with the current encoding.
decoderFallback: An object that provides an error-handling procedure when a byte sequence cannot
be decoded with the current encoding.
Returns: The encoding that is associated with the specified code page.
GetEncoding(codepage: int) -> Encoding
Returns the encoding associated with the specified code page identifier.
codepage: The code page identifier of the preferred encoding. Possible values are listed
in the Code Page column of the table that appears in the System.Text.Encoding
class topic.-or- 0 (zero),to use the default encoding.
Returns: The encoding that is associated with the specified code page.
GetEncoding(codepage: int,encoderFallback: EncoderFallback,decoderFallback: DecoderFallback) -> Encoding
Returns the encoding associated with the specified code page identifier.
Parameters specify an error handler for characters that cannot be encoded and
byte sequences that cannot be decoded.
codepage: The code page identifier of the preferred encoding. Possible values are listed
in the Code Page column of the table that appears in the System.Text.Encoding
class topic.-or- 0 (zero),to use the default encoding.
encoderFallback: An object that provides an error-handling procedure when a character cannot be
encoded with the current encoding.
decoderFallback: An object that provides an error-handling procedure when a byte sequence cannot
be decoded with the current encoding.
Returns: The encoding that is associated with the specified code page.
"""
pass
@staticmethod
def GetEncodings():
"""
GetEncodings() -> Array[EncodingInfo]
Returns an array that contains all encodings.
Returns: An array that contains all encodings.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: Encoding) -> int
Returns the hash code for the current instance.
Returns: The hash code for the current instance.
"""
pass
def GetMaxByteCount(self,charCount):
"""
GetMaxByteCount(self: Encoding,charCount: int) -> int
When overridden in a derived class,calculates the maximum number of bytes
produced by encoding the specified number of characters.
charCount: The number of characters to encode.
Returns: The maximum number of bytes produced by encoding the specified number of
characters.
"""
pass
def GetMaxCharCount(self,byteCount):
"""
GetMaxCharCount(self: Encoding,byteCount: int) -> int
When overridden in a derived class,calculates the maximum number of characters
produced by decoding the specified number of bytes.
byteCount: The number of bytes to decode.
Returns: The maximum number of characters produced by decoding the specified number of
bytes.
"""
pass
def GetPreamble(self):
"""
GetPreamble(self: Encoding) -> Array[Byte]
When overridden in a derived class,returns a sequence of bytes that specifies
the encoding used.
Returns: A byte array containing a sequence of bytes that specifies the encoding
used.-or- A byte array of length zero,if a preamble is not required.
"""
pass
def GetString(self,bytes,*__args):
"""
GetString(self: Encoding,bytes: Array[Byte],index: int,count: int) -> str
When overridden in a derived class,decodes a sequence of bytes from the
specified byte array into a string.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: A System.String containing the results of decoding the specified sequence of
bytes.
GetString(self: Encoding,bytes: Array[Byte]) -> str
When overridden in a derived class,decodes all the bytes in the specified byte
array into a string.
bytes: The byte array containing the sequence of bytes to decode.
Returns: A System.String containing the results of decoding the specified sequence of
bytes.
GetString(self: Encoding,bytes: Byte*,byteCount: int) -> str
"""
pass
def IsAlwaysNormalized(self,form=None):
"""
IsAlwaysNormalized(self: Encoding,form: NormalizationForm) -> bool
When overridden in a derived class,gets a value indicating whether the current
encoding is always normalized,using the specified normalization form.
form: One of the System.Text.NormalizationForm values.
Returns: true if the current System.Text.Encoding object is always normalized using the
specified System.Text.NormalizationForm value; otherwise,false. The default is
false.
IsAlwaysNormalized(self: Encoding) -> bool
Gets a value indicating whether the current encoding is always normalized,
using the default normalization form.
Returns: true if the current System.Text.Encoding is always normalized; otherwise,
false. The default is false.
"""
pass
@staticmethod
def RegisterProvider(provider):
""" RegisterProvider(provider: EncodingProvider) """
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,*args): #cannot find CLR constructor
"""
__new__(cls: type)
__new__(cls: type,codePage: int)
__new__(cls: type,codePage: int,encoderFallback: EncoderFallback,decoderFallback: DecoderFallback)
"""
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
BodyName=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a name for the current encoding that can be used with mail agent body tags.
Get: BodyName(self: Encoding) -> str
"""
CodePage=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the code page identifier of the current System.Text.Encoding.
Get: CodePage(self: Encoding) -> int
"""
DecoderFallback=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the System.Text.DecoderFallback object for the current System.Text.Encoding object.
Get: DecoderFallback(self: Encoding) -> DecoderFallback
Set: DecoderFallback(self: Encoding)=value
"""
EncoderFallback=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the System.Text.EncoderFallback object for the current System.Text.Encoding object.
Get: EncoderFallback(self: Encoding) -> EncoderFallback
Set: EncoderFallback(self: Encoding)=value
"""
EncodingName=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the human-readable description of the current encoding.
Get: EncodingName(self: Encoding) -> str
"""
HeaderName=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a name for the current encoding that can be used with mail agent header tags.
Get: HeaderName(self: Encoding) -> str
"""
IsBrowserDisplay=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current encoding can be used by browser clients for displaying content.
Get: IsBrowserDisplay(self: Encoding) -> bool
"""
IsBrowserSave=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current encoding can be used by browser clients for saving content.
Get: IsBrowserSave(self: Encoding) -> bool
"""
IsMailNewsDisplay=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current encoding can be used by mail and news clients for displaying content.
Get: IsMailNewsDisplay(self: Encoding) -> bool
"""
IsMailNewsSave=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current encoding can be used by mail and news clients for saving content.
Get: IsMailNewsSave(self: Encoding) -> bool
"""
IsReadOnly=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current encoding is read-only.
Get: IsReadOnly(self: Encoding) -> bool
"""
IsSingleByte=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current encoding uses single-byte code points.
Get: IsSingleByte(self: Encoding) -> bool
"""
WebName=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the name registered with the Internet Assigned Numbers Authority (IANA) for the current encoding.
Get: WebName(self: Encoding) -> str
"""
WindowsCodePage=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the Windows operating system code page that most closely corresponds to the current encoding.
Get: WindowsCodePage(self: Encoding) -> int
"""
ASCII=None
BigEndianUnicode=None
Default=None
Unicode=None
UTF32=None
UTF7=None
UTF8=None
class ASCIIEncoding(Encoding,ICloneable):
"""
Represents an ASCII character encoding of Unicode characters.
ASCIIEncoding()
"""
def GetByteCount(self,chars,*__args):
"""
GetByteCount(self: ASCIIEncoding,chars: Char*,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters
starting at the specified character pointer.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: ASCIIEncoding,chars: str) -> int
Calculates the number of bytes produced by encoding the characters in the
specified System.String.
chars: The System.String containing the set of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: ASCIIEncoding,chars: Array[Char],index: int,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters from
the specified character array.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
"""
pass
def GetBytes(self,*__args):
"""
GetBytes(self: ASCIIEncoding,chars: Char*,charCount: int,bytes: Byte*,byteCount: int) -> int
Encodes a set of characters starting at the specified character pointer into a
sequence of bytes that are stored starting at the specified byte pointer.
chars: A pointer to the first character to encode.
charCount: The number of characters to encode.
bytes: A pointer to the location at which to start writing the resulting sequence of
bytes.
byteCount: The maximum number of bytes to write.
Returns: The actual number of bytes written at the location indicated by bytes.
GetBytes(self: ASCIIEncoding,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified character array into the
specified byte array.
chars: The character array containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
GetBytes(self: ASCIIEncoding,chars: str,charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified System.String into the specified
byte array.
chars: The System.String containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
"""
pass
def GetCharCount(self,bytes,*__args):
"""
GetCharCount(self: ASCIIEncoding,bytes: Byte*,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
starting at the specified byte pointer.
bytes: A pointer to the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
GetCharCount(self: ASCIIEncoding,bytes: Array[Byte],index: int,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
from the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
"""
pass
def GetChars(self,bytes,*__args):
"""
GetChars(self: ASCIIEncoding,bytes: Byte*,byteCount: int,chars: Char*,charCount: int) -> int
Decodes a sequence of bytes starting at the specified byte pointer into a set
of characters that are stored starting at the specified character pointer.
bytes: A pointer to the first byte to decode.
byteCount: The number of bytes to decode.
chars: A pointer to the location at which to start writing the resulting set of
characters.
charCount: The maximum number of characters to write.
Returns: The actual number of characters written at the location indicated by chars.
GetChars(self: ASCIIEncoding,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int) -> int
Decodes a sequence of bytes from the specified byte array into the specified
character array.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
Returns: The actual number of characters written into chars.
"""
pass
def GetDecoder(self):
"""
GetDecoder(self: ASCIIEncoding) -> Decoder
Obtains a decoder that converts an ASCII encoded sequence of bytes into a
sequence of Unicode characters.
Returns: A System.Text.Decoder that converts an ASCII encoded sequence of bytes into a
sequence of Unicode characters.
"""
pass
def GetEncoder(self):
"""
GetEncoder(self: ASCIIEncoding) -> Encoder
Obtains an encoder that converts a sequence of Unicode characters into an ASCII
encoded sequence of bytes.
Returns: An System.Text.Encoder that converts a sequence of Unicode characters into an
ASCII encoded sequence of bytes.
"""
pass
def GetMaxByteCount(self,charCount):
"""
GetMaxByteCount(self: ASCIIEncoding,charCount: int) -> int
Calculates the maximum number of bytes produced by encoding the specified
number of characters.
charCount: The number of characters to encode.
Returns: The maximum number of bytes produced by encoding the specified number of
characters.
"""
pass
def GetMaxCharCount(self,byteCount):
"""
GetMaxCharCount(self: ASCIIEncoding,byteCount: int) -> int
Calculates the maximum number of characters produced by decoding the specified
number of bytes.
byteCount: The number of bytes to decode.
Returns: The maximum number of characters produced by decoding the specified number of
bytes.
"""
pass
def GetString(self,bytes,*__args):
"""
GetString(self: ASCIIEncoding,bytes: Array[Byte],byteIndex: int,byteCount: int) -> str
Decodes a range of bytes from a byte array into a string.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
Returns: A System.String containing the results of decoding the specified sequence of
bytes.
"""
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __reduce_ex__(self,*args):
pass
IsSingleByte=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value indicating whether the current encoding uses single-byte code points.
Get: IsSingleByte(self: ASCIIEncoding) -> bool
"""
class Decoder(object):
""" Converts a sequence of encoded bytes into a set of characters. """
def Convert(self,bytes,*__args):
"""
Convert(self: Decoder,bytes: Byte*,byteCount: int,chars: Char*,charCount: int,flush: bool) -> (int,int,bool)
Converts a buffer of encoded bytes to UTF-16 encoded characters and stores the
result in another buffer.
bytes: The address of a buffer that contains the byte sequences to convert.
byteCount: The number of bytes in bytes to convert.
chars: The address of a buffer to store the converted characters.
charCount: The maximum number of characters in chars to use in the conversion.
flush: true to indicate no further data is to be converted; otherwise,false.
Convert(self: Decoder,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int,charCount: int,flush: bool) -> (int,int,bool)
Converts an array of encoded bytes to UTF-16 encoded characters and stores the
result in a byte array.
bytes: A byte array to convert.
byteIndex: The first element of bytes to convert.
byteCount: The number of elements of bytes to convert.
chars: An array to store the converted characters.
charIndex: The first element of chars in which data is stored.
charCount: The maximum number of elements of chars to use in the conversion.
flush: true to indicate that no further data is to be converted; otherwise,false.
"""
pass
def GetCharCount(self,bytes,*__args):
"""
GetCharCount(self: Decoder,bytes: Byte*,count: int,flush: bool) -> int
When overridden in a derived class,calculates the number of characters
produced by decoding a sequence of bytes starting at the specified byte
pointer. A parameter indicates whether to clear the internal state of the
decoder after the calculation.
bytes: A pointer to the first byte to decode.
count: The number of bytes to decode.
flush: true to simulate clearing the internal state of the encoder after the
calculation; otherwise,false.
Returns: The number of characters produced by decoding the specified sequence of bytes
and any bytes in the internal buffer.
GetCharCount(self: Decoder,bytes: Array[Byte],index: int,count: int,flush: bool) -> int
When overridden in a derived class,calculates the number of characters
produced by decoding a sequence of bytes from the specified byte array. A
parameter indicates whether to clear the internal state of the decoder after
the calculation.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
flush: true to simulate clearing the internal state of the encoder after the
calculation; otherwise,false.
Returns: The number of characters produced by decoding the specified sequence of bytes
and any bytes in the internal buffer.
GetCharCount(self: Decoder,bytes: Array[Byte],index: int,count: int) -> int
When overridden in a derived class,calculates the number of characters
produced by decoding a sequence of bytes from the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes
and any bytes in the internal buffer.
"""
pass
def GetChars(self,bytes,*__args):
"""
GetChars(self: Decoder,bytes: Byte*,byteCount: int,chars: Char*,charCount: int,flush: bool) -> int
When overridden in a derived class,decodes a sequence of bytes starting at the
specified byte pointer and any bytes in the internal buffer into a set of
characters that are stored starting at the specified character pointer. A
parameter indicates whether to clear the internal state of the decoder after
the conversion.
bytes: A pointer to the first byte to decode.
byteCount: The number of bytes to decode.
chars: A pointer to the location at which to start writing the resulting set of
characters.
charCount: The maximum number of characters to write.
flush: true to clear the internal state of the decoder after the conversion;
otherwise,false.
Returns: The actual number of characters written at the location indicated by the chars
parameter.
GetChars(self: Decoder,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int,flush: bool) -> int
When overridden in a derived class,decodes a sequence of bytes from the
specified byte array and any bytes in the internal buffer into the specified
character array. A parameter indicates whether to clear the internal state of
the decoder after the conversion.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
flush: true to clear the internal state of the decoder after the conversion;
otherwise,false.
Returns: The actual number of characters written into the chars parameter.
GetChars(self: Decoder,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int) -> int
When overridden in a derived class,decodes a sequence of bytes from the
specified byte array and any bytes in the internal buffer into the specified
character array.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
Returns: The actual number of characters written into chars.
"""
pass
def Reset(self):
"""
Reset(self: Decoder)
When overridden in a derived class,sets the decoder back to its initial state.
"""
pass
Fallback=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a System.Text.DecoderFallback object for the current System.Text.Decoder object.
Get: Fallback(self: Decoder) -> DecoderFallback
Set: Fallback(self: Decoder)=value
"""
FallbackBuffer=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the System.Text.DecoderFallbackBuffer object associated with the current System.Text.Decoder object.
Get: FallbackBuffer(self: Decoder) -> DecoderFallbackBuffer
"""
class DecoderFallback(object):
""" Provides a failure-handling mechanism,called a fallback,for an encoded input byte sequence that cannot be converted to an output character. """
def CreateFallbackBuffer(self):
"""
CreateFallbackBuffer(self: DecoderFallback) -> DecoderFallbackBuffer
When overridden in a derived class,initializes a new instance of the
System.Text.DecoderFallbackBuffer class.
Returns: An object that provides a fallback buffer for a decoder.
"""
pass
MaxCharCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the maximum number of characters the current System.Text.DecoderFallback object can return.
Get: MaxCharCount(self: DecoderFallback) -> int
"""
ExceptionFallback=None
ReplacementFallback=None
class DecoderExceptionFallback(DecoderFallback):
"""
Throws System.Text.DecoderFallbackException if an encoded input byte sequence cannot be converted to a decoded output character. This class cannot be inherited.
DecoderExceptionFallback()
"""
def CreateFallbackBuffer(self):
"""
CreateFallbackBuffer(self: DecoderExceptionFallback) -> DecoderFallbackBuffer
Initializes a new instance of the System.Text.DecoderExceptionFallback class.
Returns: A System.Text.DecoderFallbackBuffer object.
"""
pass
def Equals(self,value):
"""
Equals(self: DecoderExceptionFallback,value: object) -> bool
Indicates whether the current System.Text.DecoderExceptionFallback object and a
specified object are equal.
value: An object that derives from the System.Text.DecoderExceptionFallback class.
Returns: true if value is not null and is a System.Text.DecoderExceptionFallback object;
otherwise,false.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: DecoderExceptionFallback) -> int
Retrieves the hash code for this instance.
Returns: The return value is always the same arbitrary value,and has no special
significance.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __ne__(self,*args):
pass
MaxCharCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the maximum number of characters this instance can return.
Get: MaxCharCount(self: DecoderExceptionFallback) -> int
"""
class DecoderFallbackBuffer(object):
""" Provides a buffer that allows a fallback handler to return an alternate string to a decoder when it cannot decode an input byte sequence. """
def Fallback(self,bytesUnknown,index):
"""
Fallback(self: DecoderFallbackBuffer,bytesUnknown: Array[Byte],index: int) -> bool
When overridden in a derived class,prepares the fallback buffer to handle the
specified input byte sequence.
bytesUnknown: An input array of bytes.
index: The index position of a byte in bytesUnknown.
Returns: true if the fallback buffer can process bytesUnknown; false if the fallback
buffer ignores bytesUnknown.
"""
pass
def GetNextChar(self):
"""
GetNextChar(self: DecoderFallbackBuffer) -> Char
When overridden in a derived class,retrieves the next character in the
fallback buffer.
Returns: The next character in the fallback buffer.
"""
pass
def MovePrevious(self):
"""
MovePrevious(self: DecoderFallbackBuffer) -> bool
When overridden in a derived class,causes the next call to the
System.Text.DecoderFallbackBuffer.GetNextChar method to access the data buffer
character position that is prior to the current character position.
Returns: true if the System.Text.DecoderFallbackBuffer.MovePrevious operation was
successful; otherwise,false.
"""
pass
def Reset(self):
"""
Reset(self: DecoderFallbackBuffer)
Initializes all data and state information pertaining to this fallback buffer.
"""
pass
Remaining=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the number of characters in the current System.Text.DecoderFallbackBuffer object that remain to be processed.
Get: Remaining(self: DecoderFallbackBuffer) -> int
"""
class DecoderExceptionFallbackBuffer(DecoderFallbackBuffer):
"""
Throws System.Text.DecoderFallbackException when an encoded input byte sequence cannot be converted to a decoded output character. This class cannot be inherited.
DecoderExceptionFallbackBuffer()
"""
def Fallback(self,bytesUnknown,index):
"""
Fallback(self: DecoderExceptionFallbackBuffer,bytesUnknown: Array[Byte],index: int) -> bool
Throws System.Text.DecoderFallbackException when the input byte sequence cannot
be decoded. The nominal return value is not used.
bytesUnknown: An input array of bytes.
index: The index position of a byte in the input.
Returns: None. No value is returned because the
System.Text.DecoderExceptionFallbackBuffer.Fallback(System.Byte[],System.Int32)
method always throws an exception. The nominal return value is true. A return
value is defined,although it is unchanging,because this method implements an
abstract method.
"""
pass
def GetNextChar(self):
"""
GetNextChar(self: DecoderExceptionFallbackBuffer) -> Char
Retrieves the next character in the exception data buffer.
Returns: The return value is always the Unicode character NULL (U+0000). A return value
is defined,although it is unchanging,because this method implements an
abstract method.
"""
pass
def MovePrevious(self):
"""
MovePrevious(self: DecoderExceptionFallbackBuffer) -> bool
Causes the next call to System.Text.DecoderExceptionFallbackBuffer.GetNextChar
to access the exception data buffer character position that is prior to the
current position.
Returns: The return value is always false. A return value is defined,although it is
unchanging,because this method implements an abstract method.
"""
pass
Remaining=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of characters in the current System.Text.DecoderExceptionFallbackBuffer object that remain to be processed.
Get: Remaining(self: DecoderExceptionFallbackBuffer) -> int
"""
class DecoderFallbackException(ArgumentException,ISerializable,_Exception):
"""
The exception that is thrown when a decoder fallback operation fails. This class cannot be inherited.
DecoderFallbackException()
DecoderFallbackException(message: str)
DecoderFallbackException(message: str,innerException: Exception)
DecoderFallbackException(message: str,bytesUnknown: Array[Byte],index: int)
"""
def add_SerializeObjectState(self,*args):
""" add_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def remove_SerializeObjectState(self,*args):
""" remove_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,message=None,*__args):
"""
__new__(cls: type)
__new__(cls: type,message: str)
__new__(cls: type,message: str,innerException: Exception)
__new__(cls: type,message: str,bytesUnknown: Array[Byte],index: int)
"""
pass
def __reduce_ex__(self,*args):
pass
def __str__(self,*args):
pass
BytesUnknown=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the input byte sequence that caused the exception.
Get: BytesUnknown(self: DecoderFallbackException) -> Array[Byte]
"""
Index=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the index position in the input byte sequence of the byte that caused the exception.
Get: Index(self: DecoderFallbackException) -> int
"""
class DecoderReplacementFallback(DecoderFallback):
"""
Provides a failure-handling mechanism,called a fallback,for an encoded input byte sequence that cannot be converted to an output character. The fallback emits a user-specified replacement string instead of a decoded input byte sequence. This class cannot be inherited.
DecoderReplacementFallback()
DecoderReplacementFallback(replacement: str)
"""
def CreateFallbackBuffer(self):
"""
CreateFallbackBuffer(self: DecoderReplacementFallback) -> DecoderFallbackBuffer
Creates a System.Text.DecoderFallbackBuffer object that is initialized with the
replacement string of this System.Text.DecoderReplacementFallback object.
Returns: A System.Text.DecoderFallbackBuffer object that specifies a string to use
instead of the original decoding operation input.
"""
pass
def Equals(self,value):
"""
Equals(self: DecoderReplacementFallback,value: object) -> bool
Indicates whether the value of a specified object is equal to the
System.Text.DecoderReplacementFallback object.
value: A System.Text.DecoderReplacementFallback object.
Returns: true if value is a System.Text.DecoderReplacementFallback object having a
System.Text.DecoderReplacementFallback.DefaultString property that is equal to
the System.Text.DecoderReplacementFallback.DefaultString property of the
current System.Text.DecoderReplacementFallback object; otherwise,false.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: DecoderReplacementFallback) -> int
Retrieves the hash code for the value of the
System.Text.DecoderReplacementFallback object.
Returns: The hash code of the value of the object.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
@staticmethod
def __new__(self,replacement=None):
"""
__new__(cls: type)
__new__(cls: type,replacement: str)
"""
pass
def __ne__(self,*args):
pass
DefaultString=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the replacement string that is the value of the System.Text.DecoderReplacementFallback object.
Get: DefaultString(self: DecoderReplacementFallback) -> str
"""
MaxCharCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of characters in the replacement string for the System.Text.DecoderReplacementFallback object.
Get: MaxCharCount(self: DecoderReplacementFallback) -> int
"""
class DecoderReplacementFallbackBuffer(DecoderFallbackBuffer):
"""
Represents a substitute output string that is emitted when the original input byte sequence cannot be decoded. This class cannot be inherited.
DecoderReplacementFallbackBuffer(fallback: DecoderReplacementFallback)
"""
def Fallback(self,bytesUnknown,index):
"""
Fallback(self: DecoderReplacementFallbackBuffer,bytesUnknown: Array[Byte],index: int) -> bool
Prepares the replacement fallback buffer to use the current replacement string.
bytesUnknown: An input byte sequence. This parameter is ignored unless an exception is thrown.
index: The index position of the byte in bytesUnknown. This parameter is ignored in
this operation.
Returns: true if the replacement string is not empty; false if the replacement string is
empty.
"""
pass
def GetNextChar(self):
"""
GetNextChar(self: DecoderReplacementFallbackBuffer) -> Char
Retrieves the next character in the replacement fallback buffer.
Returns: The next character in the replacement fallback buffer.
"""
pass
def MovePrevious(self):
"""
MovePrevious(self: DecoderReplacementFallbackBuffer) -> bool
Causes the next call to
System.Text.DecoderReplacementFallbackBuffer.GetNextChar to access the
character position in the replacement fallback buffer prior to the current
character position.
Returns: true if the System.Text.DecoderReplacementFallbackBuffer.MovePrevious operation
was successful; otherwise,false.
"""
pass
def Reset(self):
"""
Reset(self: DecoderReplacementFallbackBuffer)
Initializes all internal state information and data in the
System.Text.DecoderReplacementFallbackBuffer object.
"""
pass
@staticmethod
def __new__(self,fallback):
""" __new__(cls: type,fallback: DecoderReplacementFallback) """
pass
Remaining=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of characters in the replacement fallback buffer that remain to be processed.
Get: Remaining(self: DecoderReplacementFallbackBuffer) -> int
"""
class Encoder(object):
""" Converts a set of characters into a sequence of bytes. """
def Convert(self,chars,*__args):
"""
Convert(self: Encoder,chars: Char*,charCount: int,bytes: Byte*,byteCount: int,flush: bool) -> (int,int,bool)
Converts a buffer of Unicode characters to an encoded byte sequence and stores
the result in another buffer.
chars: The address of a string of UTF-16 encoded characters to convert.
charCount: The number of characters in chars to convert.
bytes: The address of a buffer to store the converted bytes.
byteCount: The maximum number of bytes in bytes to use in the conversion.
flush: true to indicate no further data is to be converted; otherwise,false.
Convert(self: Encoder,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int,byteCount: int,flush: bool) -> (int,int,bool)
Converts an array of Unicode characters to an encoded byte sequence and stores
the result in an array of bytes.
chars: An array of characters to convert.
charIndex: The first element of chars to convert.
charCount: The number of elements of chars to convert.
bytes: An array where the converted bytes are stored.
byteIndex: The first element of bytes in which data is stored.
byteCount: The maximum number of elements of bytes to use in the conversion.
flush: true to indicate no further data is to be converted; otherwise,false.
"""
pass
def GetByteCount(self,chars,*__args):
"""
GetByteCount(self: Encoder,chars: Char*,count: int,flush: bool) -> int
When overridden in a derived class,calculates the number of bytes produced by
encoding a set of characters starting at the specified character pointer. A
parameter indicates whether to clear the internal state of the encoder after
the calculation.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
flush: true to simulate clearing the internal state of the encoder after the
calculation; otherwise,false.
Returns: The number of bytes produced by encoding the specified characters and any
characters in the internal buffer.
GetByteCount(self: Encoder,chars: Array[Char],index: int,count: int,flush: bool) -> int
When overridden in a derived class,calculates the number of bytes produced by
encoding a set of characters from the specified character array. A parameter
indicates whether to clear the internal state of the encoder after the
calculation.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
flush: true to simulate clearing the internal state of the encoder after the
calculation; otherwise,false.
Returns: The number of bytes produced by encoding the specified characters and any
characters in the internal buffer.
"""
pass
def GetBytes(self,chars,*__args):
"""
GetBytes(self: Encoder,chars: Char*,charCount: int,bytes: Byte*,byteCount: int,flush: bool) -> int
When overridden in a derived class,encodes a set of characters starting at the
specified character pointer and any characters in the internal buffer into a
sequence of bytes that are stored starting at the specified byte pointer. A
parameter indicates whether to clear the internal state of the encoder after
the conversion.
chars: A pointer to the first character to encode.
charCount: The number of characters to encode.
bytes: A pointer to the location at which to start writing the resulting sequence of
bytes.
byteCount: The maximum number of bytes to write.
flush: true to clear the internal state of the encoder after the conversion;
otherwise,false.
Returns: The actual number of bytes written at the location indicated by the bytes
parameter.
GetBytes(self: Encoder,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int,flush: bool) -> int
When overridden in a derived class,encodes a set of characters from the
specified character array and any characters in the internal buffer into the
specified byte array. A parameter indicates whether to clear the internal state
of the encoder after the conversion.
chars: The character array containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
flush: true to clear the internal state of the encoder after the conversion;
otherwise,false.
Returns: The actual number of bytes written into bytes.
"""
pass
def Reset(self):
"""
Reset(self: Encoder)
When overridden in a derived class,sets the encoder back to its initial state.
"""
pass
Fallback=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a System.Text.EncoderFallback object for the current System.Text.Encoder object.
Get: Fallback(self: Encoder) -> EncoderFallback
Set: Fallback(self: Encoder)=value
"""
FallbackBuffer=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the System.Text.EncoderFallbackBuffer object associated with the current System.Text.Encoder object.
Get: FallbackBuffer(self: Encoder) -> EncoderFallbackBuffer
"""
class EncoderFallback(object):
""" Provides a failure-handling mechanism,called a fallback,for an input character that cannot be converted to an encoded output byte sequence. """
def CreateFallbackBuffer(self):
"""
CreateFallbackBuffer(self: EncoderFallback) -> EncoderFallbackBuffer
When overridden in a derived class,initializes a new instance of the
System.Text.EncoderFallbackBuffer class.
Returns: An object that provides a fallback buffer for an encoder.
"""
pass
MaxCharCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the maximum number of characters the current System.Text.EncoderFallback object can return.
Get: MaxCharCount(self: EncoderFallback) -> int
"""
ExceptionFallback=None
ReplacementFallback=None
class EncoderExceptionFallback(EncoderFallback):
"""
Throws a System.Text.EncoderFallbackException if an input character cannot be converted to an encoded output byte sequence. This class cannot be inherited.
EncoderExceptionFallback()
"""
def CreateFallbackBuffer(self):
"""
CreateFallbackBuffer(self: EncoderExceptionFallback) -> EncoderFallbackBuffer
Initializes a new instance of the System.Text.EncoderExceptionFallback class.
Returns: A System.Text.EncoderFallbackBuffer object.
"""
pass
def Equals(self,value):
"""
Equals(self: EncoderExceptionFallback,value: object) -> bool
Indicates whether the current System.Text.EncoderExceptionFallback object and a
specified object are equal.
value: An object that derives from the System.Text.EncoderExceptionFallback class.
Returns: true if value is not null (Nothing in Visual Basic .NET) and is a
System.Text.EncoderExceptionFallback object; otherwise,false.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: EncoderExceptionFallback) -> int
Retrieves the hash code for this instance.
Returns: The return value is always the same arbitrary value,and has no special
significance.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __ne__(self,*args):
pass
MaxCharCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the maximum number of characters this instance can return.
Get: MaxCharCount(self: EncoderExceptionFallback) -> int
"""
class EncoderFallbackBuffer(object):
""" Provides a buffer that allows a fallback handler to return an alternate string to an encoder when it cannot encode an input character. """
def Fallback(self,*__args):
"""
Fallback(self: EncoderFallbackBuffer,charUnknownHigh: Char,charUnknownLow: Char,index: int) -> bool
When overridden in a derived class,prepares the fallback buffer to handle the
specified surrogate pair.
charUnknownHigh: The high surrogate of the input pair.
charUnknownLow: The low surrogate of the input pair.
index: The index position of the surrogate pair in the input buffer.
Returns: true if the fallback buffer can process charUnknownHigh and charUnknownLow;
false if the fallback buffer ignores the surrogate pair.
Fallback(self: EncoderFallbackBuffer,charUnknown: Char,index: int) -> bool
When overridden in a derived class,prepares the fallback buffer to handle the
specified input character.
charUnknown: An input character.
index: The index position of the character in the input buffer.
Returns: true if the fallback buffer can process charUnknown; false if the fallback
buffer ignores charUnknown.
"""
pass
def GetNextChar(self):
"""
GetNextChar(self: EncoderFallbackBuffer) -> Char
When overridden in a derived class,retrieves the next character in the
fallback buffer.
Returns: The next character in the fallback buffer.
"""
pass
def MovePrevious(self):
"""
MovePrevious(self: EncoderFallbackBuffer) -> bool
When overridden in a derived class,causes the next call to the
System.Text.EncoderFallbackBuffer.GetNextChar method to access the data buffer
character position that is prior to the current character position.
Returns: true if the System.Text.EncoderFallbackBuffer.MovePrevious operation was
successful; otherwise,false.
"""
pass
def Reset(self):
"""
Reset(self: EncoderFallbackBuffer)
Initializes all data and state information pertaining to this fallback buffer.
"""
pass
Remaining=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the number of characters in the current System.Text.EncoderFallbackBuffer object that remain to be processed.
Get: Remaining(self: EncoderFallbackBuffer) -> int
"""
class EncoderExceptionFallbackBuffer(EncoderFallbackBuffer):
"""
Throws System.Text.EncoderFallbackException when an input character cannot be converted to an encoded output byte sequence. This class cannot be inherited.
EncoderExceptionFallbackBuffer()
"""
def Fallback(self,*__args):
"""
Fallback(self: EncoderExceptionFallbackBuffer,charUnknownHigh: Char,charUnknownLow: Char,index: int) -> bool
Throws an exception because the input character cannot be encoded. Parameters
specify the value and index position of the surrogate pair in the input,and
the nominal return value is not used.
charUnknownHigh: The high surrogate of the input pair.
charUnknownLow: The low surrogate of the input pair.
index: The index position of the surrogate pair in the input buffer.
Returns: None. No value is returned because the
System.Text.EncoderExceptionFallbackBuffer.Fallback(System.Char,System.Char,Syst
em.Int32) method always throws an exception.
Fallback(self: EncoderExceptionFallbackBuffer,charUnknown: Char,index: int) -> bool
Throws an exception because the input character cannot be encoded. Parameters
specify the value and index position of the character that cannot be converted.
charUnknown: An input character.
index: The index position of the character in the input buffer.
Returns: None. No value is returned because the
System.Text.EncoderExceptionFallbackBuffer.Fallback(System.Char,System.Int32)
method always throws an exception.
"""
pass
def GetNextChar(self):
"""
GetNextChar(self: EncoderExceptionFallbackBuffer) -> Char
Retrieves the next character in the exception fallback buffer.
Returns: The return value is always the Unicode character,NULL (U+0000). A return value
is defined,although it is unchanging,because this method implements an
abstract method.
"""
pass
def MovePrevious(self):
"""
MovePrevious(self: EncoderExceptionFallbackBuffer) -> bool
Causes the next call to the
System.Text.EncoderExceptionFallbackBuffer.GetNextChar method to access the
exception data buffer character position that is prior to the current position.
Returns: The return value is always false.A return value is defined,although it is
unchanging,because this method implements an abstract method.
"""
pass
Remaining=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of characters in the current System.Text.EncoderExceptionFallbackBuffer object that remain to be processed.
Get: Remaining(self: EncoderExceptionFallbackBuffer) -> int
"""
class EncoderFallbackException(ArgumentException,ISerializable,_Exception):
"""
The exception that is thrown when an encoder fallback operation fails. This class cannot be inherited.
EncoderFallbackException()
EncoderFallbackException(message: str)
EncoderFallbackException(message: str,innerException: Exception)
"""
def add_SerializeObjectState(self,*args):
""" add_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def IsUnknownSurrogate(self):
"""
IsUnknownSurrogate(self: EncoderFallbackException) -> bool
Indicates whether the input that caused the exception is a surrogate pair.
Returns: true if the input was a surrogate pair; otherwise,false.
"""
pass
def remove_SerializeObjectState(self,*args):
""" remove_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,message=None,innerException=None):
"""
__new__(cls: type)
__new__(cls: type,message: str)
__new__(cls: type,message: str,innerException: Exception)
"""
pass
def __reduce_ex__(self,*args):
pass
def __str__(self,*args):
pass
CharUnknown=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the input character that caused the exception.
Get: CharUnknown(self: EncoderFallbackException) -> Char
"""
CharUnknownHigh=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the high component character of the surrogate pair that caused the exception.
Get: CharUnknownHigh(self: EncoderFallbackException) -> Char
"""
CharUnknownLow=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the low component character of the surrogate pair that caused the exception.
Get: CharUnknownLow(self: EncoderFallbackException) -> Char
"""
Index=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the index position in the input buffer of the character that caused the exception.
Get: Index(self: EncoderFallbackException) -> int
"""
class EncoderReplacementFallback(EncoderFallback):
"""
Provides a failure handling mechanism,called a fallback,for an input character that cannot be converted to an output byte sequence. The fallback uses a user-specified replacement string instead of the original input character. This class cannot be inherited.
EncoderReplacementFallback()
EncoderReplacementFallback(replacement: str)
"""
def CreateFallbackBuffer(self):
"""
CreateFallbackBuffer(self: EncoderReplacementFallback) -> EncoderFallbackBuffer
Creates a System.Text.EncoderFallbackBuffer object that is initialized with the
replacement string of this System.Text.EncoderReplacementFallback object.
Returns: A System.Text.EncoderFallbackBuffer object equal to this
System.Text.EncoderReplacementFallback object.
"""
pass
def Equals(self,value):
"""
Equals(self: EncoderReplacementFallback,value: object) -> bool
Indicates whether the value of a specified object is equal to the
System.Text.EncoderReplacementFallback object.
value: A System.Text.EncoderReplacementFallback object.
Returns: true if the value parameter specifies an System.Text.EncoderReplacementFallback
object and the replacement string of that object is equal to the replacement
string of this System.Text.EncoderReplacementFallback object; otherwise,false.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: EncoderReplacementFallback) -> int
Retrieves the hash code for the value of the
System.Text.EncoderReplacementFallback object.
Returns: The hash code of the value of the object.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
@staticmethod
def __new__(self,replacement=None):
"""
__new__(cls: type)
__new__(cls: type,replacement: str)
"""
pass
def __ne__(self,*args):
pass
DefaultString=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the replacement string that is the value of the System.Text.EncoderReplacementFallback object.
Get: DefaultString(self: EncoderReplacementFallback) -> str
"""
MaxCharCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of characters in the replacement string for the System.Text.EncoderReplacementFallback object.
Get: MaxCharCount(self: EncoderReplacementFallback) -> int
"""
class EncoderReplacementFallbackBuffer(EncoderFallbackBuffer):
"""
Represents a substitute input string that is used when the original input character cannot be encoded. This class cannot be inherited.
EncoderReplacementFallbackBuffer(fallback: EncoderReplacementFallback)
"""
def Fallback(self,*__args):
"""
Fallback(self: EncoderReplacementFallbackBuffer,charUnknownHigh: Char,charUnknownLow: Char,index: int) -> bool
Indicates whether a replacement string can be used when an input surrogate pair
cannot be encoded,or whether the surrogate pair can be ignored. Parameters
specify the surrogate pair and the index position of the pair in the input.
charUnknownHigh: The high surrogate of the input pair.
charUnknownLow: The low surrogate of the input pair.
index: The index position of the surrogate pair in the input buffer.
Returns: true if the replacement string is not empty; false if the replacement string is
empty.
Fallback(self: EncoderReplacementFallbackBuffer,charUnknown: Char,index: int) -> bool
Prepares the replacement fallback buffer to use the current replacement string.
charUnknown: An input character. This parameter is ignored in this operation unless an
exception is thrown.
index: The index position of the character in the input buffer. This parameter is
ignored in this operation.
Returns: true if the replacement string is not empty; false if the replacement string is
empty.
"""
pass
def GetNextChar(self):
"""
GetNextChar(self: EncoderReplacementFallbackBuffer) -> Char
Retrieves the next character in the replacement fallback buffer.
Returns: The next Unicode character in the replacement fallback buffer that the
application can encode.
"""
pass
def MovePrevious(self):
"""
MovePrevious(self: EncoderReplacementFallbackBuffer) -> bool
Causes the next call to the
System.Text.EncoderReplacementFallbackBuffer.GetNextChar method to access the
character position in the replacement fallback buffer prior to the current
character position.
Returns: true if the System.Text.EncoderReplacementFallbackBuffer.MovePrevious operation
was successful; otherwise,false.
"""
pass
def Reset(self):
"""
Reset(self: EncoderReplacementFallbackBuffer)
Initializes all internal state information and data in this instance of
System.Text.EncoderReplacementFallbackBuffer.
"""
pass
@staticmethod
def __new__(self,fallback):
""" __new__(cls: type,fallback: EncoderReplacementFallback) """
pass
Remaining=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of characters in the replacement fallback buffer that remain to be processed.
Get: Remaining(self: EncoderReplacementFallbackBuffer) -> int
"""
class EncodingInfo(object):
""" Provides basic information about an encoding. """
def Equals(self,value):
"""
Equals(self: EncodingInfo,value: object) -> bool
Gets a value indicating whether the specified object is equal to the current
System.Text.EncodingInfo object.
value: An object to compare to the current System.Text.EncodingInfo object.
Returns: true if value is a System.Text.EncodingInfo object and is equal to the current
System.Text.EncodingInfo object; otherwise,false.
"""
pass
def GetEncoding(self):
"""
GetEncoding(self: EncodingInfo) -> Encoding
Returns a System.Text.Encoding object that corresponds to the current
System.Text.EncodingInfo object.
Returns: A System.Text.Encoding object that corresponds to the current
System.Text.EncodingInfo object.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: EncodingInfo) -> int
Returns the hash code for the current System.Text.EncodingInfo object.
Returns: A 32-bit signed integer hash code.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __ne__(self,*args):
pass
CodePage=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the code page identifier of the encoding.
Get: CodePage(self: EncodingInfo) -> int
"""
DisplayName=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the human-readable description of the encoding.
Get: DisplayName(self: EncodingInfo) -> str
"""
Name=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the name registered with the Internet Assigned Numbers Authority (IANA) for the encoding.
Get: Name(self: EncodingInfo) -> str
"""
class EncodingProvider(object):
""" EncodingProvider() """
def GetEncoding(self,*__args):
"""
GetEncoding(self: EncodingProvider,name: str,encoderFallback: EncoderFallback,decoderFallback: DecoderFallback) -> Encoding
GetEncoding(self: EncodingProvider,codepage: int,encoderFallback: EncoderFallback,decoderFallback: DecoderFallback) -> Encoding
GetEncoding(self: EncodingProvider,name: str) -> Encoding
GetEncoding(self: EncodingProvider,codepage: int) -> Encoding
"""
pass
class NormalizationForm(Enum,IComparable,IFormattable,IConvertible):
"""
Defines the type of normalization to perform.
enum NormalizationForm,values: FormC (1),FormD (2),FormKC (5),FormKD (6)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self,*args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self,*args):
pass
def __gt__(self,*args):
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self,*args):
pass
def __lt__(self,*args):
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
def __str__(self,*args):
pass
FormC=None
FormD=None
FormKC=None
FormKD=None
value__=None
class StringBuilder(object,ISerializable):
"""
Represents a mutable string of characters. This class cannot be inherited.
StringBuilder()
StringBuilder(capacity: int)
StringBuilder(value: str)
StringBuilder(value: str,capacity: int)
StringBuilder(value: str,startIndex: int,length: int,capacity: int)
StringBuilder(capacity: int,maxCapacity: int)
"""
def Append(self,value,*__args):
"""
Append(self: StringBuilder,value: Decimal) -> StringBuilder
Appends the string representation of a specified decimal number to this
instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: UInt16) -> StringBuilder
Appends the string representation of a specified 16-bit unsigned integer to
this instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: float) -> StringBuilder
Appends the string representation of a specified double-precision
floating-point number to this instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Int64) -> StringBuilder
Appends the string representation of a specified 64-bit signed integer to this
instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Single) -> StringBuilder
Appends the string representation of a specified single-precision
floating-point number to this instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Array[Char]) -> StringBuilder
Appends the string representation of the Unicode characters in a specified
array to this instance.
value: The array of characters to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Char*,valueCount: int) -> StringBuilder
Append(self: StringBuilder,value: object) -> StringBuilder
Appends the string representation of a specified object to this instance.
value: The object to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: UInt32) -> StringBuilder
Appends the string representation of a specified 32-bit unsigned integer to
this instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: UInt64) -> StringBuilder
Appends the string representation of a specified 64-bit unsigned integer to
this instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: str,startIndex: int,count: int) -> StringBuilder
Appends a copy of a specified substring to this instance.
value: The string that contains the substring to append.
startIndex: The starting position of the substring within value.
count: The number of characters in value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: bool) -> StringBuilder
Appends the string representation of a specified Boolean value to this instance.
value: The Boolean value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: str) -> StringBuilder
Appends a copy of the specified string to this instance.
value: The string to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Char,repeatCount: int) -> StringBuilder
Appends a specified number of copies of the string representation of a Unicode
character to this instance.
value: The character to append.
repeatCount: The number of times to append value.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Array[Char],startIndex: int,charCount: int) -> StringBuilder
Appends the string representation of a specified subarray of Unicode characters
to this instance.
value: A character array.
startIndex: The starting position in value.
charCount: The number of characters to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Int16) -> StringBuilder
Appends the string representation of a specified 16-bit signed integer to this
instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: int) -> StringBuilder
Appends the string representation of a specified 32-bit signed integer to this
instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Char) -> StringBuilder
Appends the string representation of a specified Unicode character to this
instance.
value: The Unicode character to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: SByte) -> StringBuilder
Appends the string representation of a specified 8-bit signed integer to this
instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
Append(self: StringBuilder,value: Byte) -> StringBuilder
Appends the string representation of a specified 8-bit unsigned integer to this
instance.
value: The value to append.
Returns: A reference to this instance after the append operation has completed.
"""
pass
def AppendFormat(self,*__args):
"""
AppendFormat(self: StringBuilder,provider: IFormatProvider,format: str,arg0: object,arg1: object) -> StringBuilder
AppendFormat(self: StringBuilder,provider: IFormatProvider,format: str,arg0: object) -> StringBuilder
AppendFormat(self: StringBuilder,provider: IFormatProvider,format: str,*args: Array[object]) -> StringBuilder
Appends the string returned by processing a composite format string,which
contains zero or more format items,to this instance. Each format item is
replaced by the string representation of a corresponding argument in a
parameter array using a specified format provider.
provider: An object that supplies culture-specific formatting information.
format: A composite format string (see Remarks).
args: An array of objects to format.
Returns: A reference to this instance after the append operation has completed. After
the append operation,this instance contains any data that existed before the
operation,suffixed by a copy of format where any format specification is
replaced by the string representation of the corresponding object argument.
AppendFormat(self: StringBuilder,provider: IFormatProvider,format: str,arg0: object,arg1: object,arg2: object) -> StringBuilder
AppendFormat(self: StringBuilder,format: str,arg0: object,arg1: object) -> StringBuilder
Appends the string returned by processing a composite format string,which
contains zero or more format items,to this instance. Each format item is
replaced by the string representation of either of two arguments.
format: A composite format string (see Remarks).
arg0: The first object to format.
arg1: The second object to format.
Returns: A reference to this instance with format appended. Each format item in format
is replaced by the string representation of the corresponding object argument.
AppendFormat(self: StringBuilder,format: str,arg0: object) -> StringBuilder
Appends the string returned by processing a composite format string,which
contains zero or more format items,to this instance. Each format item is
replaced by the string representation of a single argument.
format: A composite format string (see Remarks).
arg0: An object to format.
Returns: A reference to this instance with format appended. Each format item in format
is replaced by the string representation of arg0.
AppendFormat(self: StringBuilder,format: str,*args: Array[object]) -> StringBuilder
Appends the string returned by processing a composite format string,which
contains zero or more format items,to this instance. Each format item is
replaced by the string representation of a corresponding argument in a
parameter array.
format: A composite format string (see Remarks).
args: An array of objects to format.
Returns: A reference to this instance with format appended. Each format item in format
is replaced by the string representation of the corresponding object argument.
AppendFormat(self: StringBuilder,format: str,arg0: object,arg1: object,arg2: object) -> StringBuilder
Appends the string returned by processing a composite format string,which
contains zero or more format items,to this instance. Each format item is
replaced by the string representation of either of three arguments.
format: A composite format string (see Remarks).
arg0: The first object to format.
arg1: The second object to format.
arg2: The third object to format.
Returns: A reference to this instance with format appended. Each format item in format
is replaced by the string representation of the corresponding object argument.
"""
pass
def AppendLine(self,value=None):
"""
AppendLine(self: StringBuilder,value: str) -> StringBuilder
Appends a copy of the specified string followed by the default line terminator
to the end of the current System.Text.StringBuilder object.
value: The string to append.
Returns: A reference to this instance after the append operation has completed.
AppendLine(self: StringBuilder) -> StringBuilder
Appends the default line terminator to the end of the current
System.Text.StringBuilder object.
Returns: A reference to this instance after the append operation has completed.
"""
pass
def Clear(self):
"""
Clear(self: StringBuilder) -> StringBuilder
Removes all characters from the current System.Text.StringBuilder instance.
Returns: An object whose System.Text.StringBuilder.Length is 0 (zero).
"""
pass
def CopyTo(self,sourceIndex,destination,destinationIndex,count):
"""
CopyTo(self: StringBuilder,sourceIndex: int,destination: Array[Char],destinationIndex: int,count: int)
Copies the characters from a specified segment of this instance to a specified
segment of a destination System.Char array.
sourceIndex: The starting position in this instance where characters will be copied from.
The index is zero-based.
destination: The array where characters will be copied.
destinationIndex: The starting position in destination where characters will be copied. The index
is zero-based.
count: The number of characters to be copied.
"""
pass
def EnsureCapacity(self,capacity):
"""
EnsureCapacity(self: StringBuilder,capacity: int) -> int
Ensures that the capacity of this instance of System.Text.StringBuilder is at
least the specified value.
capacity: The minimum capacity to ensure.
Returns: The new capacity of this instance.
"""
pass
def Equals(self,*__args):
"""
Equals(self: StringBuilder,sb: StringBuilder) -> bool
Returns a value indicating whether this instance is equal to a specified object.
sb: An object to compare with this instance,or null.
Returns: true if this instance and sb have equal string,
System.Text.StringBuilder.Capacity,and System.Text.StringBuilder.MaxCapacity
values; otherwise,false.
"""
pass
def Insert(self,index,value,*__args):
"""
Insert(self: StringBuilder,index: int,value: Single) -> StringBuilder
Inserts the string representation of a single-precision floating point number
into this instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: float) -> StringBuilder
Inserts the string representation of a double-precision floating-point number
into this instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: int) -> StringBuilder
Inserts the string representation of a specified 32-bit signed integer into
this instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: Int64) -> StringBuilder
Inserts the string representation of a 64-bit signed integer into this instance
at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: Decimal) -> StringBuilder
Inserts the string representation of a decimal number into this instance at the
specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: UInt64) -> StringBuilder
Inserts the string representation of a 64-bit unsigned integer into this
instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: object) -> StringBuilder
Inserts the string representation of an object into this instance at the
specified character position.
index: The position in this instance where insertion begins.
value: The object to insert,or null.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: UInt16) -> StringBuilder
Inserts the string representation of a 16-bit unsigned integer into this
instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: UInt32) -> StringBuilder
Inserts the string representation of a 32-bit unsigned integer into this
instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: bool) -> StringBuilder
Inserts the string representation of a Boolean value into this instance at the
specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: SByte) -> StringBuilder
Inserts the string representation of a specified 8-bit signed integer into this
instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: str,count: int) -> StringBuilder
Inserts one or more copies of a specified string into this instance at the
specified character position.
index: The position in this instance where insertion begins.
value: The string to insert.
count: The number of times to insert value.
Returns: A reference to this instance after insertion has completed.
Insert(self: StringBuilder,index: int,value: str) -> StringBuilder
Inserts a string into this instance at the specified character position.
index: The position in this instance where insertion begins.
value: The string to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: Byte) -> StringBuilder
Inserts the string representation of a specified 8-bit unsigned integer into
this instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: Array[Char]) -> StringBuilder
Inserts the string representation of a specified array of Unicode characters
into this instance at the specified character position.
index: The position in this instance where insertion begins.
value: The character array to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: Array[Char],startIndex: int,charCount: int) -> StringBuilder
Inserts the string representation of a specified subarray of Unicode characters
into this instance at the specified character position.
index: The position in this instance where insertion begins.
value: A character array.
startIndex: The starting index within value.
charCount: The number of characters to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: Int16) -> StringBuilder
Inserts the string representation of a specified 16-bit signed integer into
this instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
Insert(self: StringBuilder,index: int,value: Char) -> StringBuilder
Inserts the string representation of a specified Unicode character into this
instance at the specified character position.
index: The position in this instance where insertion begins.
value: The value to insert.
Returns: A reference to this instance after the insert operation has completed.
"""
pass
def Remove(self,startIndex,length):
"""
Remove(self: StringBuilder,startIndex: int,length: int) -> StringBuilder
Removes the specified range of characters from this instance.
startIndex: The zero-based position in this instance where removal begins.
length: The number of characters to remove.
Returns: A reference to this instance after the excise operation has completed.
"""
pass
def Replace(self,*__args):
"""
Replace(self: StringBuilder,oldChar: Char,newChar: Char) -> StringBuilder
Replaces all occurrences of a specified character in this instance with another
specified character.
oldChar: The character to replace.
newChar: The character that replaces oldChar.
Returns: A reference to this instance with oldChar replaced by newChar.
Replace(self: StringBuilder,oldChar: Char,newChar: Char,startIndex: int,count: int) -> StringBuilder
Replaces,within a substring of this instance,all occurrences of a specified
character with another specified character.
oldChar: The character to replace.
newChar: The character that replaces oldChar.
startIndex: The position in this instance where the substring begins.
count: The length of the substring.
Returns: A reference to this instance with oldChar replaced by newChar in the range from
startIndex to startIndex + count -1.
Replace(self: StringBuilder,oldValue: str,newValue: str) -> StringBuilder
Replaces all occurrences of a specified string in this instance with another
specified string.
oldValue: The string to replace.
newValue: The string that replaces oldValue,or null.
Returns: A reference to this instance with all instances of oldValue replaced by
newValue.
Replace(self: StringBuilder,oldValue: str,newValue: str,startIndex: int,count: int) -> StringBuilder
Replaces,within a substring of this instance,all occurrences of a specified
string with another specified string.
oldValue: The string to replace.
newValue: The string that replaces oldValue,or null.
startIndex: The position in this instance where the substring begins.
count: The length of the substring.
Returns: A reference to this instance with all instances of oldValue replaced by
newValue in the range from startIndex to startIndex + count - 1.
"""
pass
def ToString(self,startIndex=None,length=None):
"""
ToString(self: StringBuilder,startIndex: int,length: int) -> str
Converts the value of a substring of this instance to a System.String.
startIndex: The starting position of the substring in this instance.
length: The length of the substring.
Returns: A string whose value is the same as the specified substring of this instance.
ToString(self: StringBuilder) -> str
Converts the value of this instance to a System.String.
Returns: A string whose value is the same as this instance.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __getitem__(self,*args):
""" x.__getitem__(y) <==> x[y] """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,*__args):
"""
__new__(cls: type)
__new__(cls: type,capacity: int)
__new__(cls: type,value: str)
__new__(cls: type,value: str,capacity: int)
__new__(cls: type,value: str,startIndex: int,length: int,capacity: int)
__new__(cls: type,capacity: int,maxCapacity: int)
"""
pass
def __reduce_ex__(self,*args):
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
def __setitem__(self,*args):
""" x.__setitem__(i,y) <==> x[i]= """
pass
def __str__(self,*args):
pass
Capacity=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the maximum number of characters that can be contained in the memory allocated by the current instance.
Get: Capacity(self: StringBuilder) -> int
Set: Capacity(self: StringBuilder)=value
"""
Length=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the length of the current System.Text.StringBuilder object.
Get: Length(self: StringBuilder) -> int
Set: Length(self: StringBuilder)=value
"""
MaxCapacity=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the maximum capacity of this instance.
Get: MaxCapacity(self: StringBuilder) -> int
"""
class UnicodeEncoding(Encoding,ICloneable):
"""
Represents a UTF-16 encoding of Unicode characters.
UnicodeEncoding()
UnicodeEncoding(bigEndian: bool,byteOrderMark: bool)
UnicodeEncoding(bigEndian: bool,byteOrderMark: bool,throwOnInvalidBytes: bool)
"""
def Equals(self,value):
"""
Equals(self: UnicodeEncoding,value: object) -> bool
Determines whether the specified System.Object is equal to the current
System.Text.UnicodeEncoding object.
value: The System.Object to compare with the current object.
Returns: true if value is an instance of System.Text.UnicodeEncoding and is equal to the
current object; otherwise,false.
"""
pass
def GetByteCount(self,*__args):
"""
GetByteCount(self: UnicodeEncoding,chars: Char*,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters
starting at the specified character pointer.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UnicodeEncoding,s: str) -> int
Calculates the number of bytes produced by encoding the characters in the
specified System.String.
s: The System.String containing the set of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UnicodeEncoding,chars: Array[Char],index: int,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters from
the specified character array.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
"""
pass
def GetBytes(self,*__args):
"""
GetBytes(self: UnicodeEncoding,chars: Char*,charCount: int,bytes: Byte*,byteCount: int) -> int
Encodes a set of characters starting at the specified character pointer into a
sequence of bytes that are stored starting at the specified byte pointer.
chars: A pointer to the first character to encode.
charCount: The number of characters to encode.
bytes: A pointer to the location at which to start writing the resulting sequence of
bytes.
byteCount: The maximum number of bytes to write.
Returns: The actual number of bytes written at the location indicated by the bytes
parameter.
GetBytes(self: UnicodeEncoding,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified character array into the
specified byte array.
chars: The character array containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
GetBytes(self: UnicodeEncoding,s: str,charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified System.String into the specified
byte array.
s: The System.String containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
"""
pass
def GetCharCount(self,bytes,*__args):
"""
GetCharCount(self: UnicodeEncoding,bytes: Byte*,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
starting at the specified byte pointer.
bytes: A pointer to the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
GetCharCount(self: UnicodeEncoding,bytes: Array[Byte],index: int,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
from the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
"""
pass
def GetChars(self,bytes,*__args):
"""
GetChars(self: UnicodeEncoding,bytes: Byte*,byteCount: int,chars: Char*,charCount: int) -> int
Decodes a sequence of bytes starting at the specified byte pointer into a set
of characters that are stored starting at the specified character pointer.
bytes: A pointer to the first byte to decode.
byteCount: The number of bytes to decode.
chars: A pointer to the location at which to start writing the resulting set of
characters.
charCount: The maximum number of characters to write.
Returns: The actual number of characters written at the location indicated by the chars
parameter.
GetChars(self: UnicodeEncoding,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int) -> int
Decodes a sequence of bytes from the specified byte array into the specified
character array.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
Returns: The actual number of characters written into chars.
"""
pass
def GetDecoder(self):
"""
GetDecoder(self: UnicodeEncoding) -> Decoder
Obtains a decoder that converts a UTF-16 encoded sequence of bytes into a
sequence of Unicode characters.
Returns: A System.Text.Decoder that converts a UTF-16 encoded sequence of bytes into a
sequence of Unicode characters.
"""
pass
def GetEncoder(self):
"""
GetEncoder(self: UnicodeEncoding) -> Encoder
Obtains an encoder that converts a sequence of Unicode characters into a UTF-16
encoded sequence of bytes.
Returns: A System.Text.Encoder object that converts a sequence of Unicode characters
into a UTF-16 encoded sequence of bytes.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: UnicodeEncoding) -> int
Returns the hash code for the current instance.
Returns: The hash code for the current System.Text.UnicodeEncoding object.
"""
pass
def GetMaxByteCount(self,charCount):
"""
GetMaxByteCount(self: UnicodeEncoding,charCount: int) -> int
Calculates the maximum number of bytes produced by encoding the specified
number of characters.
charCount: The number of characters to encode.
Returns: The maximum number of bytes produced by encoding the specified number of
characters.
"""
pass
def GetMaxCharCount(self,byteCount):
"""
GetMaxCharCount(self: UnicodeEncoding,byteCount: int) -> int
Calculates the maximum number of characters produced by decoding the specified
number of bytes.
byteCount: The number of bytes to decode.
Returns: The maximum number of characters produced by decoding the specified number of
bytes.
"""
pass
def GetPreamble(self):
"""
GetPreamble(self: UnicodeEncoding) -> Array[Byte]
Returns a Unicode byte order mark encoded in UTF-16 format,if the constructor
for this instance requests a byte order mark.
Returns: A byte array containing the Unicode byte order mark,if the constructor for
this instance requests a byte order mark. Otherwise,this method returns a byte
array of length zero.
"""
pass
def GetString(self,bytes,*__args):
"""
GetString(self: UnicodeEncoding,bytes: Array[Byte],index: int,count: int) -> str
Decodes a range of bytes from a byte array into a string.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: A System.String object containing the results of decoding the specified
sequence of bytes.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,bigEndian=None,byteOrderMark=None,throwOnInvalidBytes=None):
"""
__new__(cls: type)
__new__(cls: type,bigEndian: bool,byteOrderMark: bool)
__new__(cls: type,bigEndian: bool,byteOrderMark: bool,throwOnInvalidBytes: bool)
"""
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
CharSize=2
class UTF32Encoding(Encoding,ICloneable):
"""
Represents a UTF-32 encoding of Unicode characters.
UTF32Encoding()
UTF32Encoding(bigEndian: bool,byteOrderMark: bool)
UTF32Encoding(bigEndian: bool,byteOrderMark: bool,throwOnInvalidCharacters: bool)
"""
def Equals(self,value):
"""
Equals(self: UTF32Encoding,value: object) -> bool
Determines whether the specified System.Object is equal to the current
System.Text.UTF32Encoding object.
value: The System.Object to compare with the current object.
Returns: true if value is an instance of System.Text.UTF32Encoding and is equal to the
current object; otherwise,false.
"""
pass
def GetByteCount(self,*__args):
"""
GetByteCount(self: UTF32Encoding,chars: Char*,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters
starting at the specified character pointer.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UTF32Encoding,s: str) -> int
Calculates the number of bytes produced by encoding the characters in the
specified System.String.
s: The System.String containing the set of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UTF32Encoding,chars: Array[Char],index: int,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters from
the specified character array.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
"""
pass
def GetBytes(self,*__args):
"""
GetBytes(self: UTF32Encoding,chars: Char*,charCount: int,bytes: Byte*,byteCount: int) -> int
Encodes a set of characters starting at the specified character pointer into a
sequence of bytes that are stored starting at the specified byte pointer.
chars: A pointer to the first character to encode.
charCount: The number of characters to encode.
bytes: A pointer to the location at which to start writing the resulting sequence of
bytes.
byteCount: The maximum number of bytes to write.
Returns: The actual number of bytes written at the location indicated by the bytes
parameter.
GetBytes(self: UTF32Encoding,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified character array into the
specified byte array.
chars: The character array containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
GetBytes(self: UTF32Encoding,s: str,charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified System.String into the specified
byte array.
s: The System.String containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
"""
pass
def GetCharCount(self,bytes,*__args):
"""
GetCharCount(self: UTF32Encoding,bytes: Byte*,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
starting at the specified byte pointer.
bytes: A pointer to the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
GetCharCount(self: UTF32Encoding,bytes: Array[Byte],index: int,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
from the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
"""
pass
def GetChars(self,bytes,*__args):
"""
GetChars(self: UTF32Encoding,bytes: Byte*,byteCount: int,chars: Char*,charCount: int) -> int
Decodes a sequence of bytes starting at the specified byte pointer into a set
of characters that are stored starting at the specified character pointer.
bytes: A pointer to the first byte to decode.
byteCount: The number of bytes to decode.
chars: A pointer to the location at which to start writing the resulting set of
characters.
charCount: The maximum number of characters to write.
Returns: The actual number of characters written at the location indicated by chars.
GetChars(self: UTF32Encoding,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int) -> int
Decodes a sequence of bytes from the specified byte array into the specified
character array.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
Returns: The actual number of characters written into chars.
"""
pass
def GetDecoder(self):
"""
GetDecoder(self: UTF32Encoding) -> Decoder
Obtains a decoder that converts a UTF-32 encoded sequence of bytes into a
sequence of Unicode characters.
Returns: A System.Text.Decoder that converts a UTF-32 encoded sequence of bytes into a
sequence of Unicode characters.
"""
pass
def GetEncoder(self):
"""
GetEncoder(self: UTF32Encoding) -> Encoder
Obtains an encoder that converts a sequence of Unicode characters into a UTF-32
encoded sequence of bytes.
Returns: A System.Text.Encoder that converts a sequence of Unicode characters into a
UTF-32 encoded sequence of bytes.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: UTF32Encoding) -> int
Returns the hash code for the current instance.
Returns: The hash code for the current System.Text.UTF32Encoding object.
"""
pass
def GetMaxByteCount(self,charCount):
"""
GetMaxByteCount(self: UTF32Encoding,charCount: int) -> int
Calculates the maximum number of bytes produced by encoding the specified
number of characters.
charCount: The number of characters to encode.
Returns: The maximum number of bytes produced by encoding the specified number of
characters.
"""
pass
def GetMaxCharCount(self,byteCount):
"""
GetMaxCharCount(self: UTF32Encoding,byteCount: int) -> int
Calculates the maximum number of characters produced by decoding the specified
number of bytes.
byteCount: The number of bytes to decode.
Returns: The maximum number of characters produced by decoding the specified number of
bytes.
"""
pass
def GetPreamble(self):
"""
GetPreamble(self: UTF32Encoding) -> Array[Byte]
Returns a Unicode byte order mark encoded in UTF-32 format,if the constructor
for this instance requests a byte order mark.
Returns: A byte array containing the Unicode byte order mark,if the constructor for
this instance requests a byte order mark. Otherwise,this method returns a byte
array of length zero.
"""
pass
def GetString(self,bytes,*__args):
"""
GetString(self: UTF32Encoding,bytes: Array[Byte],index: int,count: int) -> str
Decodes a range of bytes from a byte array into a string.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: A System.String containing the results of decoding the specified sequence of
bytes.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,bigEndian=None,byteOrderMark=None,throwOnInvalidCharacters=None):
"""
__new__(cls: type)
__new__(cls: type,bigEndian: bool,byteOrderMark: bool)
__new__(cls: type,bigEndian: bool,byteOrderMark: bool,throwOnInvalidCharacters: bool)
"""
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
class UTF7Encoding(Encoding,ICloneable):
"""
Represents a UTF-7 encoding of Unicode characters.
UTF7Encoding()
UTF7Encoding(allowOptionals: bool)
"""
def Equals(self,value):
"""
Equals(self: UTF7Encoding,value: object) -> bool
Gets a value indicating whether the specified object is equal to the current
System.Text.UTF7Encoding object.
value: An object to compare to the current System.Text.UTF7Encoding object.
Returns: true if value is a System.Text.UTF7Encoding object and is equal to the current
System.Text.UTF7Encoding object; otherwise,false.
"""
pass
def GetByteCount(self,*__args):
"""
GetByteCount(self: UTF7Encoding,chars: Char*,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters
starting at the specified character pointer.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UTF7Encoding,s: str) -> int
Calculates the number of bytes produced by encoding the characters in the
specified System.String object.
s: The System.String object containing the set of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UTF7Encoding,chars: Array[Char],index: int,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters from
the specified character array.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
"""
pass
def GetBytes(self,*__args):
"""
GetBytes(self: UTF7Encoding,chars: Char*,charCount: int,bytes: Byte*,byteCount: int) -> int
Encodes a set of characters starting at the specified character pointer into a
sequence of bytes that are stored starting at the specified byte pointer.
chars: A pointer to the first character to encode.
charCount: The number of characters to encode.
bytes: A pointer to the location at which to start writing the resulting sequence of
bytes.
byteCount: The maximum number of bytes to write.
Returns: The actual number of bytes written at the location indicated by bytes.
GetBytes(self: UTF7Encoding,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified character array into the
specified byte array.
chars: The character array containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
GetBytes(self: UTF7Encoding,s: str,charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified System.String into the specified
byte array.
s: The System.String containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
"""
pass
def GetCharCount(self,bytes,*__args):
"""
GetCharCount(self: UTF7Encoding,bytes: Byte*,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
starting at the specified byte pointer.
bytes: A pointer to the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
GetCharCount(self: UTF7Encoding,bytes: Array[Byte],index: int,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
from the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
"""
pass
def GetChars(self,bytes,*__args):
"""
GetChars(self: UTF7Encoding,bytes: Byte*,byteCount: int,chars: Char*,charCount: int) -> int
Decodes a sequence of bytes starting at the specified byte pointer into a set
of characters that are stored starting at the specified character pointer.
bytes: A pointer to the first byte to decode.
byteCount: The number of bytes to decode.
chars: A pointer to the location at which to start writing the resulting set of
characters.
charCount: The maximum number of characters to write.
Returns: The actual number of characters written at the location indicated by chars.
GetChars(self: UTF7Encoding,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int) -> int
Decodes a sequence of bytes from the specified byte array into the specified
character array.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
Returns: The actual number of characters written into chars.
"""
pass
def GetDecoder(self):
"""
GetDecoder(self: UTF7Encoding) -> Decoder
Obtains a decoder that converts a UTF-7 encoded sequence of bytes into a
sequence of Unicode characters.
Returns: A System.Text.Decoder that converts a UTF-7 encoded sequence of bytes into a
sequence of Unicode characters.
"""
pass
def GetEncoder(self):
"""
GetEncoder(self: UTF7Encoding) -> Encoder
Obtains an encoder that converts a sequence of Unicode characters into a UTF-7
encoded sequence of bytes.
Returns: A System.Text.Encoder that converts a sequence of Unicode characters into a
UTF-7 encoded sequence of bytes.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: UTF7Encoding) -> int
Returns the hash code for the current System.Text.UTF7Encoding object.
Returns: A 32-bit signed integer hash code.
"""
pass
def GetMaxByteCount(self,charCount):
"""
GetMaxByteCount(self: UTF7Encoding,charCount: int) -> int
Calculates the maximum number of bytes produced by encoding the specified
number of characters.
charCount: The number of characters to encode.
Returns: The maximum number of bytes produced by encoding the specified number of
characters.
"""
pass
def GetMaxCharCount(self,byteCount):
"""
GetMaxCharCount(self: UTF7Encoding,byteCount: int) -> int
Calculates the maximum number of characters produced by decoding the specified
number of bytes.
byteCount: The number of bytes to decode.
Returns: The maximum number of characters produced by decoding the specified number of
bytes.
"""
pass
def GetString(self,bytes,*__args):
"""
GetString(self: UTF7Encoding,bytes: Array[Byte],index: int,count: int) -> str
Decodes a range of bytes from a byte array into a string.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: A System.String containing the results of decoding the specified sequence of
bytes.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,allowOptionals=None):
"""
__new__(cls: type)
__new__(cls: type,allowOptionals: bool)
"""
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
class UTF8Encoding(Encoding,ICloneable):
"""
Represents a UTF-8 encoding of Unicode characters.
UTF8Encoding()
UTF8Encoding(encoderShouldEmitUTF8Identifier: bool)
UTF8Encoding(encoderShouldEmitUTF8Identifier: bool,throwOnInvalidBytes: bool)
"""
def Equals(self,value):
"""
Equals(self: UTF8Encoding,value: object) -> bool
Determines whether the specified System.Object is equal to the current
System.Text.UTF8Encoding object.
value: The System.Object to compare with the current instance.
Returns: true if value is an instance of System.Text.UTF8Encoding and is equal to the
current object; otherwise,false.
"""
pass
def GetByteCount(self,chars,*__args):
"""
GetByteCount(self: UTF8Encoding,chars: Char*,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters
starting at the specified character pointer.
chars: A pointer to the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UTF8Encoding,chars: str) -> int
Calculates the number of bytes produced by encoding the characters in the
specified System.String.
chars: The System.String containing the set of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
GetByteCount(self: UTF8Encoding,chars: Array[Char],index: int,count: int) -> int
Calculates the number of bytes produced by encoding a set of characters from
the specified character array.
chars: The character array containing the set of characters to encode.
index: The index of the first character to encode.
count: The number of characters to encode.
Returns: The number of bytes produced by encoding the specified characters.
"""
pass
def GetBytes(self,*__args):
"""
GetBytes(self: UTF8Encoding,chars: Char*,charCount: int,bytes: Byte*,byteCount: int) -> int
Encodes a set of characters starting at the specified character pointer into a
sequence of bytes that are stored starting at the specified byte pointer.
chars: A pointer to the first character to encode.
charCount: The number of characters to encode.
bytes: A pointer to the location at which to start writing the resulting sequence of
bytes.
byteCount: The maximum number of bytes to write.
Returns: The actual number of bytes written at the location indicated by bytes.
GetBytes(self: UTF8Encoding,chars: Array[Char],charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified character array into the
specified byte array.
chars: The character array containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
GetBytes(self: UTF8Encoding,s: str,charIndex: int,charCount: int,bytes: Array[Byte],byteIndex: int) -> int
Encodes a set of characters from the specified System.String into the specified
byte array.
s: The System.String containing the set of characters to encode.
charIndex: The index of the first character to encode.
charCount: The number of characters to encode.
bytes: The byte array to contain the resulting sequence of bytes.
byteIndex: The index at which to start writing the resulting sequence of bytes.
Returns: The actual number of bytes written into bytes.
"""
pass
def GetCharCount(self,bytes,*__args):
"""
GetCharCount(self: UTF8Encoding,bytes: Byte*,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
starting at the specified byte pointer.
bytes: A pointer to the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
GetCharCount(self: UTF8Encoding,bytes: Array[Byte],index: int,count: int) -> int
Calculates the number of characters produced by decoding a sequence of bytes
from the specified byte array.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: The number of characters produced by decoding the specified sequence of bytes.
"""
pass
def GetChars(self,bytes,*__args):
"""
GetChars(self: UTF8Encoding,bytes: Byte*,byteCount: int,chars: Char*,charCount: int) -> int
Decodes a sequence of bytes starting at the specified byte pointer into a set
of characters that are stored starting at the specified character pointer.
bytes: A pointer to the first byte to decode.
byteCount: The number of bytes to decode.
chars: A pointer to the location at which to start writing the resulting set of
characters.
charCount: The maximum number of characters to write.
Returns: The actual number of characters written at the location indicated by chars.
GetChars(self: UTF8Encoding,bytes: Array[Byte],byteIndex: int,byteCount: int,chars: Array[Char],charIndex: int) -> int
Decodes a sequence of bytes from the specified byte array into the specified
character array.
bytes: The byte array containing the sequence of bytes to decode.
byteIndex: The index of the first byte to decode.
byteCount: The number of bytes to decode.
chars: The character array to contain the resulting set of characters.
charIndex: The index at which to start writing the resulting set of characters.
Returns: The actual number of characters written into chars.
"""
pass
def GetDecoder(self):
"""
GetDecoder(self: UTF8Encoding) -> Decoder
Obtains a decoder that converts a UTF-8 encoded sequence of bytes into a
sequence of Unicode characters.
Returns: A System.Text.Decoder that converts a UTF-8 encoded sequence of bytes into a
sequence of Unicode characters.
"""
pass
def GetEncoder(self):
"""
GetEncoder(self: UTF8Encoding) -> Encoder
Obtains an encoder that converts a sequence of Unicode characters into a UTF-8
encoded sequence of bytes.
Returns: A System.Text.Encoder that converts a sequence of Unicode characters into a
UTF-8 encoded sequence of bytes.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: UTF8Encoding) -> int
Returns the hash code for the current instance.
Returns: The hash code for the current instance.
"""
pass
def GetMaxByteCount(self,charCount):
"""
GetMaxByteCount(self: UTF8Encoding,charCount: int) -> int
Calculates the maximum number of bytes produced by encoding the specified
number of characters.
charCount: The number of characters to encode.
Returns: The maximum number of bytes produced by encoding the specified number of
characters.
"""
pass
def GetMaxCharCount(self,byteCount):
"""
GetMaxCharCount(self: UTF8Encoding,byteCount: int) -> int
Calculates the maximum number of characters produced by decoding the specified
number of bytes.
byteCount: The number of bytes to decode.
Returns: The maximum number of characters produced by decoding the specified number of
bytes.
"""
pass
def GetPreamble(self):
"""
GetPreamble(self: UTF8Encoding) -> Array[Byte]
Returns a Unicode byte order mark encoded in UTF-8 format,if the constructor
for this instance requests a byte order mark.
Returns: A byte array containing the Unicode byte order mark,if the constructor for
this instance requests a byte order mark. Otherwise,this method returns a byte
array of length zero.
"""
pass
def GetString(self,bytes,*__args):
"""
GetString(self: UTF8Encoding,bytes: Array[Byte],index: int,count: int) -> str
Decodes a range of bytes from a byte array into a string.
bytes: The byte array containing the sequence of bytes to decode.
index: The index of the first byte to decode.
count: The number of bytes to decode.
Returns: A System.String containing the results of decoding the specified sequence of
bytes.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,encoderShouldEmitUTF8Identifier=None,throwOnInvalidBytes=None):
"""
__new__(cls: type)
__new__(cls: type,encoderShouldEmitUTF8Identifier: bool)
__new__(cls: type,encoderShouldEmitUTF8Identifier: bool,throwOnInvalidBytes: bool)
"""
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
# variables with complex values
|
E = str(input("Digite a expressão: "))
P = []
for S in E:
if S == "(":
P.append("(")
elif S == ")":
if len(P) > 0:
P.pop()
else:
P.append(")")
break
if len(P) == 0:
print("Sua expressão é válida!!")
else:
print("Sua expressão é invalida!!")
|
"""
* Assignment: Exception Raise One
* Required: yes
* Complexity: easy
* Lines of code: 2 lines
* Time: 3 min
English:
1. Validate value passed to a `result` function:
a. If `value` is less than zero, raise `ValueError`
2. Non-functional requirements:
a. Write solution inside `result` function
b. Mind the indentation level
3. Run doctests - all must succeed
Polish:
1. Sprawdź poprawność wartości przekazanej do funckji `result`:
a. Jeżeli `value` jest mniejsze niż zero, podnieś wyjątek `ValueError`
2. Wymagania niefunkcjonalne:
a. Rozwiązanie zapisz wewnątrz funkcji `result`
b. Zwróć uwagę na poziom wcięć
3. Uruchom doctesty - wszystkie muszą się powieść
Hints:
* `if`
* `raise`
Tests:
>>> import sys; sys.tracebacklimit = 0
>>> result(1)
>>> result(0)
>>> result(-1)
Traceback (most recent call last):
ValueError
"""
def result(value):
if value < 0:
raise ValueError()
|
class Solution:
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
minHeap = [] # store end times of each room
for start, end in sorted(intervals):
if minHeap and start >= minHeap[0]:
heapq.heappop(minHeap)
heapq.heappush(minHeap, end)
return len(minHeap)
|
class custom_range:
def __init__(self, start, end, step=1):
self.start = start
self.end = end
self.step = step
self.increment = 1
if self.step < 0:
self.start, self.end = self.end, self.start
self.increment = -1
def __iter__(self):
return self
def __next__(self):
if self.increment > 0:
if self.start > self.end:
raise StopIteration()
else:
if self.start < self.end:
raise StopIteration()
temp = self.start
self.start += self.step
return temp
one_to_ten = custom_range(1, 10)
for num in one_to_ten:
print(num)
|
digits = "0123456789abcdefghijklmnopqrstuvwxyz"
def baseN(num,b):
return (((num == 0) and "0" )
or ( baseN(num // b, b).lstrip("0")
+ digits[num % b]))
# alternatively:
def baseN(num,b):
if num == 0: return "0"
result = ""
while num != 0:
num, d = divmod(num, b)
result += digits[d]
return result[::-1] # reverse
k = 26
s = baseN(k,16) # returns the string 1a
|
class Event:
""" The base for all Lavalink events. """
pass
class QueueEndEvent(Event):
""" This event is dispatched when there are no more songs in the queue. """
def __init__(self, player):
self.player = player
class TrackStuckEvent(Event):
""" This event is dispatched when the currently playing song is stuck. """
def __init__(self, player, track, threshold):
self.player = player
self.track = track
self.threshold = threshold
class TrackExceptionEvent(Event):
""" This event is dispatched when an exception occurs while playing a track. """
def __init__(self, player, track, exception):
self.exception = exception
self.player = player
self.track = track
class TrackEndEvent(Event):
""" This event is dispatched when the player finished playing a track. """
def __init__(self, player, track, reason):
self.reason = reason
self.player = player
self.track = track
class TrackStartEvent(Event):
""" This event is dispatched when the player starts to play a track. """
def __init__(self, player, track):
self.player = player
self.track = track
class PlayerUpdateEvent(Event):
""" This event is dispatched when the player's progress changes """
def __init__(self, player, position: int, timestamp: int):
self.player = player
self.position = position
self.timestamp = timestamp
class NodeDisconnectedEvent(Event):
""" This event is dispatched when a node disconnects and becomes unavailable """
def __init__(self, node, code: int, reason: str):
self.node = node
self.code = code
self.reason = reason
class NodeConnectedEvent(Event):
""" This event is dispatched when Lavalink.py successfully connects to a node """
def __init__(self, node):
self.node = node
class NodeChangedEvent(Event):
"""
This event is dispatched when a player changes to another node.
Keep in mind this event can be dispatched multiple times if a node
disconnects and the load balancer moves players to a new node.
Parameters
----------
player: BasePlayer
The player whose node was changed.
old_node: Node
The node the player was moved from.
new_node: Node
The node the player was moved to.
"""
def __init__(self, player, old_node, new_node):
self.player = player
self.old_node = old_node
self.new_node = new_node
# TODO: The above needs their parameters documented.
|
class Counter:
"This is a counter class"
def __init__(self):
self.value = 0
def increment(self):
"Increments the counter"
self.value = self.value + 1
def decrement(self):
"Decrements the counter"
self.value = self.value - 1
|
# Find Fractional Number
# https://www.acmicpc.net/problem/1193
n = int(input())
i = 1
while True:
sums = int((1 + i) * i * 0.5)
if sums >= n:
if (i%2) == 0:
x = i - (sums - n)
y = (sums - n) + 1
else:
x = (sums - n) + 1
y = i - (sums - n)
print(str(x)+'/'+str(y))
break
i = i + 1
|
def for_l():
for row in range(6):
for col in range(4):
if col==1 and row<5or (row==5 and (col==0 or col==2 or col==3)) :
print("*",end=" ")
else:
print(" ",end=" ")
print()
def while_l():
row=0
while row<6:
col=0
while col<4:
if col==1 and row<5or (row==5 and (col==0 or col==2 or col==3)) :
print("*",end=" ")
else:
print(" ",end=" ")
col+=1
row+=1
print()
|
#
# 120. Triangle
#
# Q: https://leetcode.com/problems/triangle/
# A: https://leetcode.com/problems/triangle/discuss/38726/Kt-Js-Py3-Cpp-The-ART-of-Dynamic-Programming
#
# TopDown
class Solution:
def minimumTotal(self, A: List[List[int]]) -> int:
N = len(A)
def go(i = 0, j = 0):
if i == N:
return 0
return A[i][j] + min(go(i + 1, j), go(i + 1, j + 1))
return go()
# TopDownMemo
class Solution:
def minimumTotal(self, A: List[List[int]]) -> int:
N = len(A)
@cache
def go(i = 0, j = 0):
if i == N:
return 0
return A[i][j] + min(go(i + 1, j), go(i + 1, j + 1))
return go()
# BottomUp
class Solution:
def minimumTotal(self, A: List[List[int]]) -> int:
N = len(A)
for i in range(N - 2, -1, -1):
for j in range(0, len(A[i])):
A[i][j] += min(A[i + 1][j], A[i + 1][j + 1])
return A[0][0]
|
def remove_duplicates_v2(arr):
dedupe_arr = []
for i in arr:
if i not in dedupe_arr:
dedupe_arr.append(i)
return dedupe_arr
result = remove_duplicates([0,0,0,1,1,2,2,3,4,5])
print(result)
|
dimensions = (200, 50)
print(dimensions[0])
print(dimensions[1])
for dimension in dimensions:
print(dimension)
|
class Config():
def __init__(self):
pass
def to_dict(self):
res_dict = dict()
for key, value in self.__dict__.items():
if isinstance(value, Config):
res_dict.update(value.to_dict())
else:
res_dict[key] = value
return res_dict
class OptimizerConfig(Config):
def __init__(self):
pass
def create_optimizer(self):
raise NotImplementedError()
class MemoryConfig(Config):
def __init__(self):
pass
|
def lazy(func):
fnattr = "__lazy_" + func.__name__
@property
def wrapper(*args, **kwargs):
if not hasattr(func, fnattr):
setattr(func, fnattr, func(*args, **kwargs))
return getattr(func, fnattr)
return wrapper
|
#def recursion():
#return recursion()
#def factorial(n):
# rslt = n
# for i in range(1, n):
# rslt *= i
# return rslt
"""
def factorial(n):
if n == 1:
return 1
else:
return n * factorial(n-1)
print(factorial(3))"""
"""
def pow(x, n):
rslt = 1
for i in range(n):
rslt *= x
return rslt
print(pow(3, 2))"""
def pow(x, n):
if n == 0:
return 1
else:
return x * pow(x, n-1)
print(pow(20, 9))
"""num = [2, 4, 6, 23, 65, 89, 43, 12]
print(map(lambda n: 2*n, num))
print(map(chr, num))
print(map(ord, "hello, World"))"""
|
class Profiles(object):
"""
A class to manage V2 API's for AirWatch Profiles Management
"""
def __init__(self, client):
self.client = client
def search(self, **kwargs):
"""
Returns the Profile information matching the search parameters.
/api/mdm/profiles/search?{params}
PARAMS:
type={type}
profilename={profilename}
organizationgroupid={organizationgroupid}
platform={platform}
status={status}
ownership={ownership}
"""
response = self._get(path="/profiles/search", params=kwargs)
page = 1
while (
isinstance(response, dict)
and page * response["PageSize"] < response["Total"]
):
kwargs["page"] = page
new_page = self._get(path="/profiles/search", params=kwargs)
if isinstance(new_page, dict):
response["Profiles"].append(new_page.get("Profiles", []))
response["Page"] = page
page += 1
return response
def _get(self, module="mdm", path=None, version=None, params=None, header=None):
"""GET requests for the /MDM/Profiles module."""
response = self.client.get(
module=module, path=path, version=version, params=params, header=header
)
return response
def _post(
self,
module="mdm",
path=None,
version=None,
params=None,
data=None,
json=None,
header=None,
):
"""POST requests for the /MDM/Profiles module."""
response = self.client.post(
module=module,
path=path,
version=version,
params=params,
data=data,
json=json,
header=header,
)
return response
|
"""
Given an integer number n, define a function named printDict() which can print a dictionary where the keys are numbers between 1 and n (both included) and the values are square of keys.
The function printDict() doesn't take any argument.
Input Format:
The first line contains the number n.
Output Format:
Print the dictionary in one line.
Example:
Input:
5
Output:
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
NOTE: You are supposed to write the code for the function printDict() only. The function has already been called in the main part of the code.
"""
def printDict():
n = int(input())
d = {}
for i in range(n):
d[i+1] = (i+1)**2
print(d, end = " ")
printDict()
|
class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
xor = 0
for num in nums:
xor ^= num
xor = xor & -xor
a, b = 0, 0
for num in nums:
if num & xor:
a ^= num
else:
b ^= num
return a, b
|
#
# PySNMP MIB module CXFrameRelay-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXFrameRelay-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:17:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint")
cxModuleHwPhysSlot, = mibBuilder.importSymbols("CXModuleHardware-MIB", "cxModuleHwPhysSlot")
SapIndex, Alias, cxFrameRelay = mibBuilder.importSymbols("CXProduct-SMI", "SapIndex", "Alias", "cxFrameRelay")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Gauge32, iso, NotificationType, TimeTicks, IpAddress, MibIdentifier, Counter64, NotificationType, ModuleIdentity, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Bits, ObjectIdentity, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "iso", "NotificationType", "TimeTicks", "IpAddress", "MibIdentifier", "Counter64", "NotificationType", "ModuleIdentity", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Bits", "ObjectIdentity", "Unsigned32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
class DLCI(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 1022)
frpSapTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1), )
if mibBuilder.loadTexts: frpSapTable.setStatus('mandatory')
frpSapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1), ).setIndexNames((0, "CXFrameRelay-MIB", "frpSapNumber"))
if mibBuilder.loadTexts: frpSapEntry.setStatus('mandatory')
frpSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 1), SapIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapNumber.setStatus('mandatory')
frpSapRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapRowStatus.setStatus('mandatory')
frpSapAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 3), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapAlias.setStatus('mandatory')
frpSapCompanionAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 4), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapCompanionAlias.setStatus('mandatory')
frpSapType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("lower", 1), ("upper", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapType.setStatus('mandatory')
frpSapAddressLength = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3, 4))).clone(namedValues=NamedValues(("two-octets", 2), ("three-octets", 3), ("four-octets", 4))).clone('two-octets')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapAddressLength.setStatus('mandatory')
frpSapMaxSupportedVCs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1022))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapMaxSupportedVCs.setStatus('deprecated')
frpSapVCBase = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1022))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapVCBase.setStatus('deprecated')
frpSapOutCongestionManagement = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapOutCongestionManagement.setStatus('mandatory')
frpSapResourceAllocation = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(80)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapResourceAllocation.setStatus('mandatory')
frpSapLinkManagement = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("none", 1), ("frameRelayForum", 2), ("ansiAnnexD", 3), ("ccittAnnexA", 4), ("dama1", 5), ("dama2", 6), ("auto", 7))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapLinkManagement.setStatus('mandatory')
frpSapInterfaceType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("uniUser", 1), ("uniNetwork", 2), ("nni", 3))).clone('uniUser')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapInterfaceType.setStatus('mandatory')
frpSapPollingInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(5, 30)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapPollingInterval.setStatus('mandatory')
frpSapPollingVerification = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(5, 30)).clone(15)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapPollingVerification.setStatus('mandatory')
frpSapFullEnquiryInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)).clone(6)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapFullEnquiryInterval.setStatus('mandatory')
frpSapErrorThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapErrorThreshold.setStatus('mandatory')
frpSapMonitoredEvents = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10)).clone(4)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapMonitoredEvents.setStatus('mandatory')
frpSapMode = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("frameRelay", 1), ("transparent", 2), ("frameRelayAtmNIwf", 3))).clone('frameRelay')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapMode.setStatus('mandatory')
frpSapPrioQueue1HitRatio = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 19), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapPrioQueue1HitRatio.setStatus('mandatory')
frpSapPrioQueue2HitRatio = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 20), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapPrioQueue2HitRatio.setStatus('mandatory')
frpSapPrioQueue3HitRatio = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 21), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapPrioQueue3HitRatio.setStatus('mandatory')
frpSapPrioQueue4HitRatio = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 22), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapPrioQueue4HitRatio.setStatus('mandatory')
frpSapDialEntry = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapDialEntry.setStatus('mandatory')
frpSapFilterBitMap = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapFilterBitMap.setStatus('mandatory')
frpSapLmiFlavor = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("strict", 2), ("tolerant", 3))).clone('tolerant')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapLmiFlavor.setStatus('mandatory')
frpSapGenerator = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2), ("retrigger", 3))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapGenerator.setStatus('mandatory')
frpSapGeneratorDlciNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 34), DLCI().clone(16)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapGeneratorDlciNumber.setStatus('mandatory')
frpSapGeneratorFrameSize = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 35), Integer32().subtype(subtypeSpec=ValueRangeConstraint(32, 4096)).clone(32)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapGeneratorFrameSize.setStatus('mandatory')
frpSapGeneratorNumberOfFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 36), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 200)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapGeneratorNumberOfFrames.setStatus('mandatory')
frpSapGeneratorInterFrameDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 37), Integer32().subtype(subtypeSpec=ValueRangeConstraint(50, 60000)).clone(50)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapGeneratorInterFrameDelay.setStatus('mandatory')
frpSapBillingTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 38), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 525600)).clone(1440)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapBillingTimer.setStatus('mandatory')
frpSapSdLmMessageInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 39), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 65535)).clone(50)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapSdLmMessageInterval.setStatus('obsolete')
frpSapSdLmActiveTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 40), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 65535)).clone(1000)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSapSdLmActiveTimer.setStatus('obsolete')
frpSaptrapTrap1 = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 48), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpSaptrapTrap1.setStatus('mandatory')
frpSapControl = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 53), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("retriggerBillingTimer", 1)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: frpSapControl.setStatus('mandatory')
frpSapControlStats = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 54), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("clearSapStats", 1), ("clearAllCircuitStats", 2)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: frpSapControlStats.setStatus('mandatory')
frpSapstatLinkManagementState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 55), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("linkDown", 1), ("linkUp", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatLinkManagementState.setStatus('mandatory')
frpSapstatCurrentLinkManagementType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 56), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("none", 1), ("frameRelayForum", 2), ("ansiAnnexD", 3), ("ccittAnnexA", 4), ("dama1", 5), ("dama2", 6), ("discovering", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatCurrentLinkManagementType.setStatus('mandatory')
frpSapstatTxDataFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 61), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatTxDataFrames.setStatus('mandatory')
frpSapstatRxDataFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 62), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxDataFrames.setStatus('mandatory')
frpSapstatTxDataOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 63), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatTxDataOctets.setStatus('mandatory')
frpSapstatRxDataOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 64), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxDataOctets.setStatus('mandatory')
frpSapstatTxLmiFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 65), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatTxLmiFrames.setStatus('mandatory')
frpSapstatRxLmiFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 66), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxLmiFrames.setStatus('mandatory')
frpSapstatTxQueuedDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 67), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatTxQueuedDiscards.setStatus('mandatory')
frpSapstatRxCIRExceededDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 79), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxCIRExceededDiscards.setStatus('mandatory')
frpSapstatRxSysCongestionDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 80), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxSysCongestionDiscards.setStatus('mandatory')
frpSapstatRxUnavailInboundDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 81), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxUnavailInboundDiscards.setStatus('mandatory')
frpSapstatRxUnavailOutboundDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 82), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxUnavailOutboundDiscards.setStatus('mandatory')
frpSapstatRxInvalidVCDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 83), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxInvalidVCDiscards.setStatus('mandatory')
frpSapstatRxBadStatusDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 84), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxBadStatusDiscards.setStatus('mandatory')
frpSapstatRxMiscellaneousDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 85), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxMiscellaneousDiscards.setStatus('mandatory')
frpSapstatRxCIRExceeds = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 86), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxCIRExceeds.setStatus('mandatory')
frpSapstatRxShortFrameDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 87), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatRxShortFrameDiscards.setStatus('mandatory')
frpSapstatLmiInvalidFieldDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 97), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatLmiInvalidFieldDiscards.setStatus('mandatory')
frpSapstatLmiInvalidSequenceDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 98), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatLmiInvalidSequenceDiscards.setStatus('mandatory')
frpSapstatLmiTimeouts = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 99), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatLmiTimeouts.setStatus('mandatory')
frpSapstatLmiInvalidStatusDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 100), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatLmiInvalidStatusDiscards.setStatus('mandatory')
frpSapstatLmiInvalidStatusEnqDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 101), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatLmiInvalidStatusEnqDiscards.setStatus('mandatory')
frpSapstatLmiInvalidUpdStatusDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 1, 1, 102), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpSapstatLmiInvalidUpdStatusDiscards.setStatus('mandatory')
frpCircuitTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2), )
if mibBuilder.loadTexts: frpCircuitTable.setStatus('mandatory')
frpCircuitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1), ).setIndexNames((0, "CXFrameRelay-MIB", "frpCircuitSapNumber"), (0, "CXFrameRelay-MIB", "frpCircuitDlci"))
if mibBuilder.loadTexts: frpCircuitEntry.setStatus('mandatory')
frpCircuitSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 1), SapIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitSapNumber.setStatus('mandatory')
frpCircuitDlci = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 2), DLCI()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitDlci.setStatus('mandatory')
frpCircuitRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitRowStatus.setStatus('mandatory')
frpCircuitPriorityLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("veryHigh", 1), ("high", 2), ("medium", 3), ("low", 4))).clone('medium')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitPriorityLevel.setStatus('mandatory')
frpCircuitCommittedBurst = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitCommittedBurst.setStatus('mandatory')
frpCircuitExcessBurst = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitExcessBurst.setStatus('mandatory')
frpCircuitCommittedInformationRate = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 7), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitCommittedInformationRate.setStatus('mandatory')
frpCircuitCIRManagement = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("disabled", 1), ("enabled-inbound", 2), ("monitor-inbound", 3), ("enabled-outbound", 4))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitCIRManagement.setStatus('mandatory')
frpCircuitMultiProtEncaps = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitMultiProtEncaps.setStatus('mandatory')
frpCircuitHighPriorityBurst = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 10), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitHighPriorityBurst.setStatus('mandatory')
frpCircuitLowPriorityBurst = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 11), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitLowPriorityBurst.setStatus('mandatory')
frpCircuitFragmentationSize = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 18), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitFragmentationSize.setStatus('mandatory')
frpCircuitAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 19), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitAlias.setStatus('mandatory')
frpCircuitCompanionSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 20), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitCompanionSapNumber.setStatus('mandatory')
frpCircuitCompanionDlci = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 21), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitCompanionDlci.setStatus('mandatory')
frpCircuitAlternateSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 22), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitAlternateSapNumber.setStatus('mandatory')
frpCircuitAlternateDlci = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 23), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitAlternateDlci.setStatus('mandatory')
frpCircuitMulticastGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitMulticastGroupId.setStatus('mandatory')
frpCircuitMulticastType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("noMulticastAssociation", 1), ("rootOneWay", 2), ("leafOneWay", 3), ("rootTwoWay", 4), ("leafTwoWay", 5), ("rootNWay", 6), ("rootTwoWaySinglePass", 7), ("leafTwoWaySinglePass", 8))).clone('noMulticastAssociation')).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitMulticastType.setStatus('mandatory')
frpCircuitCompressionPort = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 26), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitCompressionPort.setStatus('mandatory')
frpCircuitExpressService = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuitExpressService.setStatus('mandatory')
frpCircuittrapTrap1 = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuittrapTrap1.setStatus('mandatory')
frpCircuittrapTrap2 = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpCircuittrapTrap2.setStatus('mandatory')
frpCircuitControlStats = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 39), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("clearCircuitStats", 1)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: frpCircuitControlStats.setStatus('mandatory')
frpCircuitstatReportedState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 40), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notReported", 1), ("reportedActive", 2), ("reportedInactive", 3))).clone('notReported')).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatReportedState.setStatus('mandatory')
frpCircuitstatRouteState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 41), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("noRoute", 1), ("routeNotOperational", 2), ("routeOperational", 3))).clone('noRoute')).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRouteState.setStatus('mandatory')
frpCircuitstatAlternateRouteState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 42), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("noRoute", 1), ("routeNotOperational", 2), ("routeOperational", 3), ("alternateCircuit", 4))).clone('noRoute')).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatAlternateRouteState.setStatus('mandatory')
frpCircuitstatLocalCreationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 47), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatLocalCreationTime.setStatus('mandatory')
frpCircuitstatRemoteCreationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 48), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRemoteCreationTime.setStatus('mandatory')
frpCircuitstatTxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 49), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatTxFrames.setStatus('mandatory')
frpCircuitstatRxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 50), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxFrames.setStatus('mandatory')
frpCircuitstatTxOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 51), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatTxOctets.setStatus('mandatory')
frpCircuitstatRxOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 52), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxOctets.setStatus('mandatory')
frpCircuitstatTxFECNs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 53), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatTxFECNs.setStatus('mandatory')
frpCircuitstatRxFECNs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 54), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxFECNs.setStatus('mandatory')
frpCircuitstatTxBECNs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 55), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatTxBECNs.setStatus('mandatory')
frpCircuitstatRxBECNs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 56), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxBECNs.setStatus('mandatory')
frpCircuitstatTxQueuedDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 63), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatTxQueuedDiscards.setStatus('mandatory')
frpCircuitstatRxCIRExceededDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 70), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxCIRExceededDiscards.setStatus('mandatory')
frpCircuitstatRxSysCongestionDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 71), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxSysCongestionDiscards.setStatus('mandatory')
frpCircuitstatRxUnavailInboundDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 72), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxUnavailInboundDiscards.setStatus('mandatory')
frpCircuitstatRxUnavailOutboundDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 73), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxUnavailOutboundDiscards.setStatus('mandatory')
frpCircuitstatRxCIRExceeds = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 74), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatRxCIRExceeds.setStatus('mandatory')
frpCircuitstatFragmentationFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 75), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatFragmentationFailures.setStatus('mandatory')
frpCircuitstatDeFragmentationFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 2, 1, 76), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpCircuitstatDeFragmentationFailures.setStatus('mandatory')
frpReportedPvcTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 3), )
if mibBuilder.loadTexts: frpReportedPvcTable.setStatus('mandatory')
frpReportedPvcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 3, 1), ).setIndexNames((0, "CXFrameRelay-MIB", "frpReportedPvcSapNumber"))
if mibBuilder.loadTexts: frpReportedPvcEntry.setStatus('mandatory')
frpReportedPvcSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 3, 1, 1), SapIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpReportedPvcSapNumber.setStatus('mandatory')
frpReportedPvcDlci = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 3, 1, 2), DLCI()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpReportedPvcDlci.setStatus('mandatory')
frpReportedPvcLocallyConfigured = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 3, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpReportedPvcLocallyConfigured.setStatus('mandatory')
frpReportedPvcStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("inactive", 1), ("active", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpReportedPvcStatus.setStatus('mandatory')
frpMulticastTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4), )
if mibBuilder.loadTexts: frpMulticastTable.setStatus('mandatory')
frpMulticastEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1), ).setIndexNames((0, "CXFrameRelay-MIB", "frpMulticastGroupId"), (0, "CXFrameRelay-MIB", "frpMulticastSapNumber"), (0, "CXFrameRelay-MIB", "frpMulticastDlci"))
if mibBuilder.loadTexts: frpMulticastEntry.setStatus('mandatory')
frpMulticastGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpMulticastGroupId.setStatus('mandatory')
frpMulticastSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1, 2), SapIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpMulticastSapNumber.setStatus('mandatory')
frpMulticastDlci = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1, 3), DLCI()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpMulticastDlci.setStatus('mandatory')
frpMulticastRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpMulticastRowStatus.setStatus('mandatory')
frpMulticastMemberType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("root", 1), ("leaf", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpMulticastMemberType.setStatus('mandatory')
frpMulticastServiceType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("oneWay", 1), ("twoWay", 2), ("nWay", 3), ("twoWaySinglePass", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: frpMulticastServiceType.setStatus('mandatory')
frpMulticastMemberStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("inactive", 1), ("active", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpMulticastMemberStatus.setStatus('mandatory')
frpMibLevel = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: frpMibLevel.setStatus('mandatory')
frpSapInterfaceStatusChange = NotificationType((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3) + (0,1)).setObjects(("CXModuleHardware-MIB", "cxModuleHwPhysSlot"), ("CXFrameRelay-MIB", "frpSapNumber"), ("CXFrameRelay-MIB", "frpSapstatLinkManagementState"))
frpPvcReportedStatusChange = NotificationType((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3) + (0,2)).setObjects(("CXModuleHardware-MIB", "cxModuleHwPhysSlot"), ("CXFrameRelay-MIB", "frpCircuitSapNumber"), ("CXFrameRelay-MIB", "frpCircuitDlci"), ("CXFrameRelay-MIB", "frpCircuitstatReportedState"))
frpPvcBillingStats = NotificationType((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 3) + (0,3)).setObjects(("CXModuleHardware-MIB", "cxModuleHwPhysSlot"), ("CXFrameRelay-MIB", "frpCircuitSapNumber"), ("CXFrameRelay-MIB", "frpCircuitDlci"), ("CXFrameRelay-MIB", "frpCircuitstatTxFrames"), ("CXFrameRelay-MIB", "frpCircuitstatRxFrames"), ("CXFrameRelay-MIB", "frpCircuitstatTxOctets"), ("CXFrameRelay-MIB", "frpCircuitstatRxOctets"))
mibBuilder.exportSymbols("CXFrameRelay-MIB", frpCircuitstatRxCIRExceededDiscards=frpCircuitstatRxCIRExceededDiscards, frpSapGenerator=frpSapGenerator, frpSapstatLinkManagementState=frpSapstatLinkManagementState, frpPvcBillingStats=frpPvcBillingStats, frpSapInterfaceType=frpSapInterfaceType, frpMulticastTable=frpMulticastTable, frpCircuitstatRxBECNs=frpCircuitstatRxBECNs, frpSapstatRxUnavailOutboundDiscards=frpSapstatRxUnavailOutboundDiscards, frpSapstatLmiTimeouts=frpSapstatLmiTimeouts, frpSapControlStats=frpSapControlStats, frpCircuitstatRouteState=frpCircuitstatRouteState, frpCircuitstatRemoteCreationTime=frpCircuitstatRemoteCreationTime, frpSapSdLmMessageInterval=frpSapSdLmMessageInterval, frpCircuitstatDeFragmentationFailures=frpCircuitstatDeFragmentationFailures, frpSapPrioQueue1HitRatio=frpSapPrioQueue1HitRatio, frpSapTable=frpSapTable, frpSapstatRxDataOctets=frpSapstatRxDataOctets, frpCircuitLowPriorityBurst=frpCircuitLowPriorityBurst, frpMulticastDlci=frpMulticastDlci, frpCircuitCompanionSapNumber=frpCircuitCompanionSapNumber, frpSapGeneratorFrameSize=frpSapGeneratorFrameSize, frpReportedPvcEntry=frpReportedPvcEntry, frpSapControl=frpSapControl, frpSapGeneratorInterFrameDelay=frpSapGeneratorInterFrameDelay, frpMibLevel=frpMibLevel, frpSapGeneratorNumberOfFrames=frpSapGeneratorNumberOfFrames, frpMulticastRowStatus=frpMulticastRowStatus, frpSapstatLmiInvalidUpdStatusDiscards=frpSapstatLmiInvalidUpdStatusDiscards, frpMulticastGroupId=frpMulticastGroupId, frpSapPollingInterval=frpSapPollingInterval, frpSapstatRxLmiFrames=frpSapstatRxLmiFrames, frpSapNumber=frpSapNumber, frpSapFilterBitMap=frpSapFilterBitMap, frpCircuitFragmentationSize=frpCircuitFragmentationSize, frpCircuitstatAlternateRouteState=frpCircuitstatAlternateRouteState, frpSapMode=frpSapMode, frpSapLinkManagement=frpSapLinkManagement, frpCircuitstatRxOctets=frpCircuitstatRxOctets, frpCircuittrapTrap2=frpCircuittrapTrap2, frpSapstatRxMiscellaneousDiscards=frpSapstatRxMiscellaneousDiscards, frpSapRowStatus=frpSapRowStatus, frpCircuitRowStatus=frpCircuitRowStatus, frpSapstatRxSysCongestionDiscards=frpSapstatRxSysCongestionDiscards, frpSapPrioQueue4HitRatio=frpSapPrioQueue4HitRatio, frpSapstatRxDataFrames=frpSapstatRxDataFrames, frpSapOutCongestionManagement=frpSapOutCongestionManagement, frpSapstatTxDataFrames=frpSapstatTxDataFrames, frpCircuitExpressService=frpCircuitExpressService, frpCircuitAlternateSapNumber=frpCircuitAlternateSapNumber, frpCircuitCompanionDlci=frpCircuitCompanionDlci, frpSapAddressLength=frpSapAddressLength, frpSapPollingVerification=frpSapPollingVerification, frpCircuitCommittedBurst=frpCircuitCommittedBurst, frpCircuitSapNumber=frpCircuitSapNumber, frpPvcReportedStatusChange=frpPvcReportedStatusChange, frpReportedPvcDlci=frpReportedPvcDlci, frpSapstatRxCIRExceededDiscards=frpSapstatRxCIRExceededDiscards, frpSapPrioQueue3HitRatio=frpSapPrioQueue3HitRatio, frpReportedPvcTable=frpReportedPvcTable, frpCircuitstatRxFrames=frpCircuitstatRxFrames, frpCircuitExcessBurst=frpCircuitExcessBurst, frpCircuitstatFragmentationFailures=frpCircuitstatFragmentationFailures, frpCircuitstatLocalCreationTime=frpCircuitstatLocalCreationTime, frpSapstatLmiInvalidStatusEnqDiscards=frpSapstatLmiInvalidStatusEnqDiscards, frpSapstatTxLmiFrames=frpSapstatTxLmiFrames, frpReportedPvcStatus=frpReportedPvcStatus, frpSapGeneratorDlciNumber=frpSapGeneratorDlciNumber, frpMulticastServiceType=frpMulticastServiceType, frpSapMonitoredEvents=frpSapMonitoredEvents, frpReportedPvcSapNumber=frpReportedPvcSapNumber, frpSaptrapTrap1=frpSaptrapTrap1, frpSapstatLmiInvalidStatusDiscards=frpSapstatLmiInvalidStatusDiscards, frpCircuitCommittedInformationRate=frpCircuitCommittedInformationRate, frpCircuittrapTrap1=frpCircuittrapTrap1, frpReportedPvcLocallyConfigured=frpReportedPvcLocallyConfigured, frpCircuitstatRxSysCongestionDiscards=frpCircuitstatRxSysCongestionDiscards, frpMulticastMemberType=frpMulticastMemberType, frpSapstatLmiInvalidFieldDiscards=frpSapstatLmiInvalidFieldDiscards, frpSapstatRxBadStatusDiscards=frpSapstatRxBadStatusDiscards, frpSapstatCurrentLinkManagementType=frpSapstatCurrentLinkManagementType, frpSapstatRxCIRExceeds=frpSapstatRxCIRExceeds, frpSapErrorThreshold=frpSapErrorThreshold, frpSapAlias=frpSapAlias, frpSapMaxSupportedVCs=frpSapMaxSupportedVCs, frpCircuitstatTxFECNs=frpCircuitstatTxFECNs, frpSapResourceAllocation=frpSapResourceAllocation, frpSapBillingTimer=frpSapBillingTimer, frpSapEntry=frpSapEntry, frpSapstatRxInvalidVCDiscards=frpSapstatRxInvalidVCDiscards, frpSapstatTxDataOctets=frpSapstatTxDataOctets, frpSapVCBase=frpSapVCBase, frpCircuitAlias=frpCircuitAlias, frpCircuitstatRxFECNs=frpCircuitstatRxFECNs, frpSapstatLmiInvalidSequenceDiscards=frpSapstatLmiInvalidSequenceDiscards, frpCircuitstatReportedState=frpCircuitstatReportedState, frpMulticastEntry=frpMulticastEntry, DLCI=DLCI, frpMulticastSapNumber=frpMulticastSapNumber, frpCircuitstatRxUnavailOutboundDiscards=frpCircuitstatRxUnavailOutboundDiscards, frpMulticastMemberStatus=frpMulticastMemberStatus, frpCircuitMulticastType=frpCircuitMulticastType, frpCircuitMultiProtEncaps=frpCircuitMultiProtEncaps, frpSapPrioQueue2HitRatio=frpSapPrioQueue2HitRatio, frpCircuitTable=frpCircuitTable, frpCircuitCIRManagement=frpCircuitCIRManagement, frpSapstatTxQueuedDiscards=frpSapstatTxQueuedDiscards, frpCircuitstatRxCIRExceeds=frpCircuitstatRxCIRExceeds, frpSapSdLmActiveTimer=frpSapSdLmActiveTimer, frpCircuitPriorityLevel=frpCircuitPriorityLevel, frpCircuitHighPriorityBurst=frpCircuitHighPriorityBurst, frpCircuitstatRxUnavailInboundDiscards=frpCircuitstatRxUnavailInboundDiscards, frpSapInterfaceStatusChange=frpSapInterfaceStatusChange, frpSapFullEnquiryInterval=frpSapFullEnquiryInterval, frpSapCompanionAlias=frpSapCompanionAlias, frpCircuitAlternateDlci=frpCircuitAlternateDlci, frpCircuitMulticastGroupId=frpCircuitMulticastGroupId, frpCircuitControlStats=frpCircuitControlStats, frpCircuitEntry=frpCircuitEntry, frpCircuitstatTxOctets=frpCircuitstatTxOctets, frpCircuitstatTxFrames=frpCircuitstatTxFrames, frpSapstatRxShortFrameDiscards=frpSapstatRxShortFrameDiscards, frpSapDialEntry=frpSapDialEntry, frpCircuitDlci=frpCircuitDlci, frpCircuitstatTxQueuedDiscards=frpCircuitstatTxQueuedDiscards, frpSapstatRxUnavailInboundDiscards=frpSapstatRxUnavailInboundDiscards, frpCircuitstatTxBECNs=frpCircuitstatTxBECNs, frpSapLmiFlavor=frpSapLmiFlavor, frpSapType=frpSapType, frpCircuitCompressionPort=frpCircuitCompressionPort)
|
# Note that this file is multi-lingual and can be used in both Python
# and POSIX shell.
# This file should define a variable VERSION which we use as the
# debugger version number.
VERSION = '2.9.0'
|
"""
This module calculate Jaccard's distance score
parameters:
x : (numpy array) first string sequence
y : (numpy array) second string sequence
return:
(float) : Jaccard's distance socre (1 - Jaccard's similarlity)
"""
def jaccard_seq(x, y):
len_x = len(x)
len_y = len(y)
fst, snd = (x, y) if len_x < len_y else (y, x)
num_intersect = len(set(fst).intersection(snd))
return 1 - (num_intersect / (len_x + len_y - num_intersect))
|
def reverse(input):
#reverse as string
return input[::-1]
#An alternative approach I wass using - string to list
'''myinput = input
mylist = list(myinput)
#print (mylist)
mylist.reverse()
return (mylist)'''
'''while True:
if input == None:
print (None)
break
else:
#find length of list
l=len(mylist)-1
#while loop to reverse
while l >= 0:
print (mylist[l])
l -= 1
#actual reverse function happens here
#return(mylist)
#not working: '' input and '' puctuated sentence.'''
reverse(input = 'robot')
reverse(input = 'Ramen')
reverse(input = 'I\'m hungry!')
reverse(input = 'racecar')
|
# Similar to longest substring with k different characters, with k = 2
class Solution:
def totalFruit(self, tree: List[int]) -> int:
if not tree or len(tree) == 0:
return 0
left = 0
ans = 0
baskets = {}
# Use the dictionary to store the last index all fruits/letters in the array
for t, fruit in enumerate(tree):
baskets[fruit] = t
if len(baskets) > 2:
left = min(baskets.values())
del baskets[tree[left]]
left += 1
ans = max(ans, t - left + 1)
return ans
|
'''
Return Permutations of a String
Given a string, find and return all the possible permutations of the input string.
Note : The order of permutations are not important.
Sample Input :
abc
Sample Output :
abc
acb
bac
bca
cab
cba
'''
def permutations(string):
#Implement Your Code Here
if len(string) == 1:
return [string]
temp = permutations(string[1:])
output = []
for i in temp:
for j in range(len(i)+1):
smallString = i[:j] + string[0] + i[j:]
output.append(smallString)
return output
string = input()
ans = permutations(string)
for s in ans:
print(s)
|
def get_hours_since_midnight(seconds):
'''
Type the code to calculate total hours given n(number) of seconds
For example, given 3800 seconds the total hours is 1
'''
return (seconds//3600)
'''
IF YOU ARE OK WITH A GRADE OF 70 FOR THIS ASSIGNMENT STOP HERE.
'''
def get_minutes(seconds):
'''
Type the code to calculate total minutes less whole hour given n(number) of seconds
For example, given 3800 seconds the total minutes is 3
'''
seconds_left = (seconds % 3600)
return (seconds_left // 60)
def get_seconds(seconds):
'''
Type the code to calculate total minutes less whole hour given n(number) of seconds
For example, given 3800 seconds the total minutes is 20
'''
seconds_left = (seconds % 3600)
return (seconds_left % 60)
# used the // to get the amount of minutes left and the % to get the remaining seconds.
|
class BingoBoard:
def __init__(self) -> None:
self.board = []
self.markedNums = 0
def __repr__(self) -> str:
ret = ''
for line in self.board:
for num in line:
ret += num + ' '
ret += '\n'
return ret
def check_value(self, val: str):
r = 0
c = 0
found = 0
for row in self.board:
for num in row:
if num == val:
row.pop(c)
row.insert(c, '-1')
found = 1
break
c += 1
if found:
break
r += 1
c = 0
if found:
self.markedNums += 1
# check if we have a winner
winner = 0
if self.markedNums >= 5 and found:
# check row
for i in range(5):
if self.board[r][i] == '-1':
winner = 1
else:
winner = 0
break
if winner:
return 1
# check column
for j in range(5):
if self.board[j][c] == '-1':
winner = 1
else:
winner = 0
break
if winner:
return 1
else:
return 0
def calculate_winning_score(self):
sum = 0
for row in self.board:
for num in row:
if num != '-1':
sum += int(num)
return sum
def getInput(numbers, boards):
lineNum = 0
with open('4.in', 'r') as file:
curr_board = None
for line in file:
if lineNum == 0:
numbers.extend(line.strip('\n').split(','))
else:
if line == '\n' and curr_board:
boards.append(curr_board)
curr_board = BingoBoard()
elif line == '\n':
curr_board = BingoBoard()
else:
curr_board.board.append(line.strip('\n').split())
lineNum += 1
boards.append(curr_board)
def solution():
numbers = []
boards = []
getInput(numbers, boards)
numberOfBoards = len(boards)
winningBoards = []
for num in numbers:
boardNum = 0
for board in boards:
if boardNum in winningBoards:
pass
else:
winnerBool = board.check_value(num)
if winnerBool:
if len(winningBoards) != numberOfBoards - 1:
winningBoards.append(boardNum)
else:
# calculate score
sum = board.calculate_winning_score()
print(int(num) * sum)
return 0
boardNum += 1
solution()
|
#! /usr/bin/env python3
# coding: utf-8
def main():
with open('sample1.txt','r') as f:
content = f.read()
content = content.upper()
with open('sample2.txt','w') as f:
f.write(content)
if __name__ =='__main__':
main()
|
f_chr6 = open("/hwfssz1/ST_BIOCHEM/P18Z10200N0032/liyiyan/SV_Caller/HG002/chr6_reads.fastq")
liness = f_chr6.readlines()
reads_list = []
for i in range(1,len(liness),4):
reads_list.append(liness[i])
res = min(reads_list, key=len,default='')
print(len(res)-1)
|
qtd = 0
soma = 0
for i in range(1, 101, 1):
if i % 2 == 0:
qtd += 1
soma += i
media = soma / qtd
print('A media dos pares de 1 ate 100 e de {} '.format(media))
|
# Calcula a soma entre todos os ímpares que são múltiplos de três
soma_impar = 0
cont = 0
for c in range(1, 501, 2):
if (c % 3) == 0:
cont += 1
soma_impar += c
print('A soma dos {} ímpares múltiplos de 3 de 0 a 500 é {}'.format(cont, soma_impar))
|
names = ["Adam", "Alex", "Mariah", "Martine", "Columbus"]
for word in names:
print(word)
|
#
# PySNMP MIB module HPNSAECC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPNSAECC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:42:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Counter64, MibIdentifier, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, NotificationType, iso, Integer32, Gauge32, IpAddress, enterprises, Unsigned32, ObjectIdentity, NotificationType, ModuleIdentity, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "MibIdentifier", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "NotificationType", "iso", "Integer32", "Gauge32", "IpAddress", "enterprises", "Unsigned32", "ObjectIdentity", "NotificationType", "ModuleIdentity", "TimeTicks")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
hp = MibIdentifier((1, 3, 6, 1, 4, 1, 11))
nm = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2))
hpnsa = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 23))
hpnsaECC = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 23, 6))
hpnsaEccMibRev = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 1))
hpnsaEccAgent = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 2))
hpnsaEccLog = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3))
hpnsaEccMibRevMajor = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccMibRevMajor.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccMibRevMajor.setDescription('The major revision level of the MIB.')
hpnsaEccMibRevMinor = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccMibRevMinor.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccMibRevMinor.setDescription('The minor revision level of the MIB.')
hpnsaEccAgentTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 2, 1), )
if mibBuilder.loadTexts: hpnsaEccAgentTable.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccAgentTable.setDescription('A table of SNMP Agents that satisfy requests for this MIB.')
hpnsaEccAgentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 2, 1, 1), ).setIndexNames((0, "HPNSAECC-MIB", "hpnsaEccAgentIndex"))
if mibBuilder.loadTexts: hpnsaEccAgentEntry.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccAgentEntry.setDescription('A description of the agents that access ECC Memory related information.')
hpnsaEccAgentIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccAgentIndex.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccAgentIndex.setDescription('A unique index for this module description.')
hpnsaEccAgentName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 2, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccAgentName.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccAgentName.setDescription('Name of the Agent/Agents satisfying SNMP requests for this MIB.')
hpnsaEccAgentVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 2, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 5))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccAgentVersion.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccAgentVersion.setDescription('Version number of the Agent/Agents satisfying SNMP requests for this MIB.')
hpnsaEccAgentDate = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 2, 1, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccAgentDate.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccAgentDate.setDescription('The date on which this Agent was created. field octets contents range _________________________________________________ 1 1 years since 1900 0..255 2 2 month 1..12 3 3 day 1..31 4 4 hour 0..23 5 5 minute 0..59 6 6 second 0..59 ')
hpnsaEccStatus = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notSupported", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccStatus.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccStatus.setDescription('ECC memory system tracking status: 1 - ECC memory is not supported in this machine 2 - ECC memory logging is disabled due to some errors (example, too many single or multiple bits error occurred in a short period of time) 3 - ECC memory logging is enabled and functioning.')
hpnsaEccEraseLog = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnsaEccEraseLog.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccEraseLog.setDescription("Set this variable to integer value 1234 and without changing it again before hpnsaEccPollTime expired, will erase the system's Log area.")
hpnsaEccTotalErrCorrected = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccTotalErrCorrected.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccTotalErrCorrected.setDescription('Total number of ECC memory error had occurred and been corrected.')
hpnsaEccTrapEnable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("trapOn", 1), ("trapOff", 0)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnsaEccTrapEnable.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccTrapEnable.setDescription('Set this variable to 1, the ECC memory errors are forwarded as SNMP traps. No trap are generated if this variable is set to 0.')
hpnsaEccTrapDelay = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 5000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnsaEccTrapDelay.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccTrapDelay.setDescription('Delay in milliseconds between the sending of ECC traps.')
hpnsaEccPollTime = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(60, 2592000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnsaEccPollTime.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccPollTime.setDescription('Seconds between checking of ECC memory error.')
hpnsaEccMemErrTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 7), )
if mibBuilder.loadTexts: hpnsaEccMemErrTable.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccMemErrTable.setDescription('A table of ECC memory error descriptions.')
hpnsaEccMemErrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 7, 1), ).setIndexNames((0, "HPNSAECC-MIB", "hpnsaEccMemErrIndex"))
if mibBuilder.loadTexts: hpnsaEccMemErrEntry.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccMemErrEntry.setDescription('ECC memory error description.')
hpnsaEccMemErrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 7, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccMemErrIndex.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccMemErrIndex.setDescription('A unique index for the ECC memory error log.')
hpnsaEccMemErrTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 7, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccMemErrTime.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccMemErrTime.setDescription('The Server local time when the ECC memory error occurred.')
hpnsaEccMemErrDesc = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 23, 6, 3, 7, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnsaEccMemErrDesc.setStatus('mandatory')
if mibBuilder.loadTexts: hpnsaEccMemErrDesc.setDescription('A string indicating the SIMM location when ECC memory error occurred.')
hpnsaEccErrorCorrected = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 23, 6) + (0,4353))
if mibBuilder.loadTexts: hpnsaEccErrorCorrected.setDescription('An ECC single-bit error has been corrected in one of the memory modules')
hpnsaEccSBEOverflow = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 23, 6) + (0,4354))
if mibBuilder.loadTexts: hpnsaEccSBEOverflow.setDescription("Error logging for ECC single-bit errors has been disabled due to too many SBE's detected in a short time period")
hpnsaEccMemoryResize = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 23, 6) + (0,4355))
if mibBuilder.loadTexts: hpnsaEccMemoryResize.setDescription('ECC Memory size has been adjusted during the Power-On-Self-Test during the last boot due to a failed memory module')
hpnsaEccMultiBitError = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 23, 6) + (0,4357))
if mibBuilder.loadTexts: hpnsaEccMultiBitError.setDescription('An ECC double-bit error has occurred in one of the memory modules')
hpnsaEccMultiBitErrorOverflow = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 23, 6) + (0,4358))
if mibBuilder.loadTexts: hpnsaEccMultiBitErrorOverflow.setDescription("Error logging for ECC multiple-bit errors has been disabled due to too many MBE's detected in a short time period")
mibBuilder.exportSymbols("HPNSAECC-MIB", hpnsa=hpnsa, hpnsaEccMemErrDesc=hpnsaEccMemErrDesc, hpnsaEccAgentVersion=hpnsaEccAgentVersion, hp=hp, hpnsaEccMibRevMajor=hpnsaEccMibRevMajor, hpnsaEccMemErrTable=hpnsaEccMemErrTable, hpnsaEccLog=hpnsaEccLog, hpnsaEccAgentEntry=hpnsaEccAgentEntry, hpnsaEccAgentDate=hpnsaEccAgentDate, hpnsaEccAgentIndex=hpnsaEccAgentIndex, hpnsaEccMibRev=hpnsaEccMibRev, hpnsaEccMibRevMinor=hpnsaEccMibRevMinor, hpnsaEccMemErrEntry=hpnsaEccMemErrEntry, hpnsaEccErrorCorrected=hpnsaEccErrorCorrected, hpnsaEccAgent=hpnsaEccAgent, hpnsaEccMemErrTime=hpnsaEccMemErrTime, hpnsaEccMemErrIndex=hpnsaEccMemErrIndex, hpnsaEccMemoryResize=hpnsaEccMemoryResize, hpnsaEccMultiBitErrorOverflow=hpnsaEccMultiBitErrorOverflow, hpnsaEccMultiBitError=hpnsaEccMultiBitError, hpnsaEccTrapEnable=hpnsaEccTrapEnable, hpnsaEccAgentTable=hpnsaEccAgentTable, hpnsaEccTrapDelay=hpnsaEccTrapDelay, hpnsaEccEraseLog=hpnsaEccEraseLog, hpnsaEccSBEOverflow=hpnsaEccSBEOverflow, hpnsaEccTotalErrCorrected=hpnsaEccTotalErrCorrected, hpnsaEccAgentName=hpnsaEccAgentName, hpnsaEccPollTime=hpnsaEccPollTime, hpnsaEccStatus=hpnsaEccStatus, hpnsaECC=hpnsaECC, nm=nm)
|
"""
return the taker/maker commission rate
"""
class CommissionRate:
def __init__(self):
self.symbol = ""
self.makerCommissionRate = 0.0
self.takerCommissionRate = 0.0
@staticmethod
def json_parse(json_data):
result = CommissionRate()
result.symbol = json_data.get_string("symbol")
result.makerCommissionRate = json_data.get_float("makerCommissionRate")
result.takerCommissionRate = json_data.get_float("takerCommissionRate")
return result
|
# status: testado com exemplos da prova
if __name__ == '__main__':
n = int(input())
cubes = [int(x) for x in input().split()]
ways = 0
for x in range(0, n):
x_sum = cubes[x]
for y in range(x, n):
if x == y:
if cubes[y] % 8 == 0:
ways += 1
else:
x_sum += cubes[y]
if x_sum % 8 == 0:
ways += 1
print(ways)
|
""" Write an efficient algorithm that searches for a value in an m x n matrix.
This matrix has the following properties:
Integers in each row are sorted in ascending from left to right. Integers in
each column are sorted in ascending from top to bottom.
"""
class Solution240:
pass
|
def albumFromID(id:int):
return f'https://www.jiosaavn.com/api.php?__call=content.getAlbumDetails&_format=json&cc=in&_marker=0%3F_marker=0&albumid={id}'
def albumsearchFromSTRING(query:str):
return f'https://www.jiosaavn.com/api.php?__call=autocomplete.get&_format=json&_marker=0&cc=in&includeMetaTags=1&query={"+".join(query.split(" "))}'
def songFromID(id:str):
return f'https://www.jiosaavn.com/api.php?__call=song.getDetails&cc=in&_marker=0%3F_marker%3D0&_format=json&pids={id}'
def songsearchFromSTRING(query:str,p:int,n:int):
return f'https://www.jiosaavn.com/api.php?p={p}&_format=json&_marker=0&api_version=4&ctx=wap6dot0&n={n}&__call=search.getResults&q={"+".join(query.split(" "))}'
def lyricsFromID(id:str):
return f'https://www.jiosaavn.com/api.php?__call=lyrics.getLyrics&ctx=web6dot0&api_version=4&_format=json&_marker=0%3F_marker=0&lyrics_id={id}'
def playlistFromID(id:str):
return f'https://www.jiosaavn.com/api.php?__call=playlist.getDetails&_format=json&cc=in&_marker=0%3F_marker%3D0&listid={id}'
|
def normalize_inputs(data):
"""
Normalizes the inputs to [-1, 1]
:param data: input data array
:return: normalized data to [-1, 1]
"""
data = (data - 127.5) / 127.5
return data
|
def samesign(a, b):
return a * b > 0
def bisect(func, low, high):
'Find root of continuous function where f(low) and f(high) have opposite signs'
assert not samesign(func(low), func(high))
for i in range(54):
midpoint = (low + high) / 2.0
if samesign(func(low), func(midpoint)):
low = midpoint
else:
high = midpoint
return midpoint
def f(x):
return x**3 + x - 1
x = bisect(f, 0, 1)
print(x, f(x))
|
i = 1
while i <= 9:
j = 1
while j <= i:
print("{}x{}={}\t".format(j, i, i * j), end='')
j += 1
print()
i += 1
|
'''
Default quantization scheme
The options are:
iteration: Specify numbers of images for quantization
use_avg: Whether to use AVG method to calculate scale
data_scale: Specify data_scale to scale Min and Max
mean: When firstconv need mean preprocess input
std: When fistconv need std preprocess input
per_channel: Whether to quantize weight for each channel
'''
mlu_qscheme = {
'iteration' : 1,
'use_avg' : False,
'data_scale': 1.0,
'mean' : [0,0,0],
'std' : [1,1,1],
'firstconv' : True,
'per_channel': False
}
CONV_HYPER_PARAMS = {
'alpha' : 0.04,
'beta' : 0.1,
'gamma' : 2,
'delta' : 100,
'th' : 0.03,
}
LINEAR_HYPER_PARAMS = {
'alpha' : 0.04,
'beta' : 0.1,
'gamma' : 2,
'delta' : 100,
'th' : 0.01,
}
class QuantifyParams(object):
r"""Base class for all quantify module params."""
def __init__(self):
self.init_bitwidth = 8
self.max_bitwidth = 31
self.quantify_rate = 0.01
self.alpha = 0.04
self.beta = 0.1
self.gamma = 2
self.delta = 100
self.th = 0.03
self.steps_per_epoch = 10000
def set_bitwidth(self,
init_bitwidth = 8,
max_bitwidth = 31):
self.init_bitwidth = init_bitwidth
self.max_bitwidth = max_bitwidth
def set_hyperparam(self,
quantify_rate = 0.01,
alpha = 0.04,
beta = 0.1,
gamma = 2,
delta = 100,
th = 0.03):
self.quantify_rate = quantify_rate
self.alpha = alpha
self.beta = beta
self.gamma = gamma
self.delta = delta
self.th = th
class MatmulQuantifyParams(QuantifyParams):
def __init__(self):
super(QuantifyParams, self).__init__()
self.set_hyperparam(th = 0.01)
class ConvQuantifyParams(QuantifyParams):
def __init__(self):
super(QuantifyParams, self).__init__()
self.set_hyperparam(th = 0.03)
|
class StateMachine(object):
"""
Abstract character-driven finite state machine implementation, used to
chop down and transform strings.
Useful for implementig simple transpilators, compressors and so on.
Important: when implementing this class, you must set the :attr:`current`
attribute to a key defined in :attr:`jumps` dict.
"""
jumps = {} # finite state machine jumps
start = "" # character which started current state
current = "" # current state (an initial value must be set)
pending = "" # unprocessed remaining data
streaming = False # stream mode toggle
@property
def nearest(self):
"""
Get the next state jump.
The next jump is calculated looking at :attr:`current` state
and its possible :attr:`jumps` to find the nearest and bigger
option in :attr:`pending` data.
If none is found, the returned next state label will be None.
:returns: tuple with index, substring and next state label
:rtype: tuple
"""
try:
options = self.jumps[self.current]
except KeyError:
raise KeyError(
"Current state %r not defined in %s.jumps."
% (self.current, self.__class__)
)
offset = len(self.start)
index = len(self.pending)
if self.streaming:
index -= max(map(len, options))
key = (index, 1)
result = (index, "", None)
for amark, anext in options.items():
asize = len(amark)
aindex = self.pending.find(amark, offset, index + asize)
if aindex > -1:
index = aindex
akey = (aindex, -asize)
if akey < key:
key = akey
result = (aindex, amark, anext)
return result
def __init__(self, data=""):
"""
:param data: content will be added to pending data
:type data: str
"""
self.pending += data
def __iter__(self):
"""
Yield over result chunks, consuming :attr:`pending` data.
On :attr:`streaming` mode, yield only finished states.
On non :attr:`streaming` mode, yield last state's result chunk
even if unfinished, consuming all pending data.
:yields: transformation result chunka
:ytype: str
"""
index, mark, next = self.nearest
while next is not None:
data = self.transform(self.pending[:index], mark, next)
self.start = mark
self.current = next
self.pending = self.pending[index:]
if data:
yield data
index, mark, next = self.nearest
if not self.streaming:
data = self.transform(self.pending, mark, next)
self.start = ""
self.pending = ""
if data:
yield data
def transform(self, data, mark, next):
"""
Apply the appropriate transformation function on current state data,
which is supposed to end at this point.
It is expected transformation logic makes use of :attr:`start`,
:attr:`current` and :attr:`streaming` instance attributes to
bettee know the state is being left.
:param data: string to transform (includes start)
:type data: str
:param mark: string producing the new state jump
:type mark: str
:param next: state is about to star, None on finish
:type next: str or None
:returns: transformed data
:rtype: str
"""
method = getattr(self, "transform_%s" % self.current, None)
return method(data, mark, next) if method else data
def feed(self, data=""):
"""
Optionally add pending data, switch into streaming mode, and yield
result chunks.
:yields: result chunks
:ytype: str
"""
self.streaming = True
self.pending += data
for i in self:
yield i
def finish(self, data=""):
"""
Optionally add pending data, turn off streaming mode, and yield
result chunks, which implies all pending data will be consumed.
:yields: result chunks
:ytype: str
"""
self.pending += data
self.streaming = False
for i in self:
yield i
|
"""
Utility functions for i3 blocks formatting
"""
################################################################################
def _to_sRGB(component):
"""
Convert linear Color to sRGB
"""
component = 12.92 * component if component <= 0.0031308 else (1.055 * (component**(1/2.4))) - 0.055
return int(255.9999 * component)
def _from_sRGB(component):
"""
Linearize sRGB color
"""
component /= 255.0
return component / 12.92 if component <= 0.04045 else ((component+0.055)/1.055)**2.4
def _from_Hex(color):
"""
Converts #RRGGBB hex code into (r,g,b) tuple
"""
color = color.lstrip('#')
return [int(color[i:i+2], 16) for i in range(0, 6, 2)]
def _to_Hex(color):
"""
Converts (r,g,b) tuple into #RRGGBB hex code
"""
return "".join(f"{component:02x}" for component in color)
def gradient_at(gradient, mix, gamma=0.43):
"""
Calculates color at specified point in gradient.
Parameters
-----------
gradient : list
list of (<hex code>, <stop>) tuples sorted by stop
mix : float
position on the gradient
Returns
-------
tuple
(r,g,b)-tuple containing color at point
"""
# Get first two tuples (<hex code1>, <stop1>), (<hex_code2>, <stop2>) where stop2 > mix
color1, color2 = next((a,b) for a,b in
(gradient[i:i+2] for i
in range(len(gradient)-1))
if b[1] >= mix)
color1, stop1 = color1
color2, stop2 = color2
# Scale mix to interval [stop1, stop2]
mix = (mix - stop1) / (stop2 - stop1)
# Convert both colors from hex codes to (r,g,b)-tuples
color1 = _from_Hex(color1)
color2 = _from_Hex(color2)
# Convert both colors to linear representation
color1 = [_from_sRGB(component) for component in color1]
color2 = [_from_sRGB(component) for component in color2]
# Calculate color brightnesses
bright1 = sum(color1)**gamma
bright2 = sum(color2)**gamma
# Interpolate Colors
lerp = lambda a,b,t: a*(1-t) + b*t
intensity = lerp(bright1, bright2, mix)**(1/gamma)
color = [lerp(component1, component2, mix) for
component1, component2 in
zip(color1, color2)]
if sum(color) != 0:
color = tuple((component * intensity / sum(color)) for component in color)
# Return hex code for color
return _to_Hex(_to_sRGB(component) for component in color)
def span(text, font=None, fg=None, bg=None):
"""
Generate pango formatting span around text
"""
return ("<span" +
(f" font='{font}'" if font else "") +
(f" foreground='#{fg}'" if fg else "") +
(f" background='#{bg}'" if bg else "") +
f">{text}</span>")
def fa(codepoint):
"""
Generate formatting for Font Awesome Icond
"""
return f"<span font='Font Awesome Heavy'>&#x{codepoint};</span>"
|
def test_preamble(l: list) -> bool:
t = l.pop()
for i in range(len(l) - 1):
if t - l[i] in l[i + 1:]:
return True
return False
def find_preamble(s: str, p: int) -> int:
l = [int(l) for l in s.splitlines()]
for i in range(len(l) - p):
if not test_preamble(l[i:i + p + 1]):
return l[i + p]
def run_tests():
test_input = """35
20
15
25
47
40
62
55
65
95
102
117
150
182
127
219
299
277
309
576"""
test_output = 127
assert find_preamble(test_input, 5) == test_output
def run() -> int:
with open("inputs/input_09.txt") as file:
data = file.read()
return find_preamble(data, 25)
if __name__ == "__main__":
run_tests()
print(run())
|
load("//bazel/macros:toolchains.bzl", "parse_toolchain_file")
def _archive_rule(provider):
additional = ""
if provider.archive_opts != None:
additional = "\n strip_prefix = \"%s\"," % (provider.archive_opts)
return """
http_archive(
name = "{name}",
url = "{url}",
sha256 = "{sha256}",
build_file_content = OPEN_FILE_ARCHIVE, {kwargs}
)""".format(
name = provider.archive,
url = provider.urls[0],
sha256 = provider.sha256,
kwargs = additional,
)
def _toolchain_rules(provider):
return """toolchain(
name = "{name}",
exec_compatible_with = {exec_compatible_with},
target_compatible_with = {target_compatible_with},
toolchain = ":{info}",
toolchain_type = ":toolchain_type",
)
externally_managed_toolchain(
name = "{info}",
tool = "{tool}",
)
""".format(
name = provider.toolchain,
exec_compatible_with = provider.exec_compatible_with,
target_compatible_with = provider.target_compatible_with,
info = "{}info".format(provider.toolchain),
tool = provider.tool,
)
def _register_external_toolchain_impl(repository_ctx):
toolchain_path = repository_ctx.path(repository_ctx.attr.toolchain)
tool = parse_toolchain_file(repository_ctx, toolchain_path)
providers = tool.toolchains
toolchain_rules = []
tool_archive_rules = []
for provider in providers:
toolchain_rule = _toolchain_rules(provider)
toolchain_rules.append(toolchain_rule)
tool_archive_rule = _archive_rule(provider)
tool_archive_rules.append(tool_archive_rule)
repository_ctx.file(
"BUILD.bazel",
"""load("@bazel-external-toolchain-rules//bazel/macros:http_toolchain.bzl", "externally_managed_toolchain")
package(default_visibility = ["//visibility:public"])
toolchain_type(name = "toolchain_type")
{rules}
""".format(rules = "\n".join(toolchain_rules)),
)
repository_ctx.file(
"deps.bzl",
"""load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
OPEN_FILE_ARCHIVE = \"\"\"
package(default_visibility = ["//visibility:public"])
filegroup(
name = "files",
srcs = glob(["*","**/*"]),
)
\"\"\"
def install_toolchain():
native.register_toolchains(
{toolchains}
)
{rules}
""".format(
rules = "\n".join(tool_archive_rules),
toolchains = ",\n ".join([
'"@{}//:{}"'.format(repository_ctx.name, toolchain.toolchain)
for toolchain in providers
]),
),
)
register_external_toolchain = repository_rule(
_register_external_toolchain_impl,
attrs = {
"toolchain": attr.label(
mandatory = True,
allow_single_file = True,
),
},
)
ExternallyManagedToolExecutableInfo = provider(
doc = "Externally managed toolchain through use of file.",
fields = {"tool": ""},
)
def _externally_managed_toolchain_impl(ctx):
toolchain_info = platform_common.ToolchainInfo(
toolinfo = ExternallyManagedToolExecutableInfo(
tool = ctx.file.tool,
),
)
return [toolchain_info]
externally_managed_toolchain = rule(
implementation = _externally_managed_toolchain_impl,
attrs = {
"tool": attr.label(
executable = True,
allow_single_file = True,
mandatory = True,
cfg = "host",
),
},
)
|
print('Hello my dear') #comments are essential but I am always to lazy
print ('what is your name?')
myName = input()
print('it is nice to meet you,' + myName)
print('the length of you name is :')
print(len(myName))
print ('what is your age?')
myAge = input ()
print('you will be ' + str(int(myAge) +1) +' in a year')
|
#encoding:utf-8
subreddit = 'HermitCraft'
t_channel = '@r_HermitCraft'
def send_post(submission, r2t):
return r2t.send_simple(submission, min_upvotes_limit=100)
|
# exc. 7.1.4
def squared_numbers(start, stop):
while start <= stop:
print(start**2)
start += 1
def main():
start = -3
stop = 3
squared_numbers(start, stop)
if __name__ == "__main__":
main()
|
lado = float(input())
altura = float(input())
numero = int(input())
area_1 = lado * altura
area_2 = 0
erro_max = 0
# Fazer o somatorio porposto pelo exercicio
for x in range(-50,51):
atual = numero + x
for j in range (0,atual):
area_2 += lado * (altura/(atual))
modulo_dif = abs(area_1 - area_2)
# Pegar o maior erro maximo
if erro_max < modulo_dif:
erro_max = modulo_dif
num = atual
# resetar o somatorio
area_2 = 0
print("n_max = {0:d}\nerro_maximo = {1:.14f}".format(num,erro_max))
|
# Important class
class ImportantClass:
def __init__(self, var):
# Instance variable
self.var = var
# Important function
def importantFunction(self, old_var, new_var):
return old_var + new_var
# Make users happy
def makeUsersHappy(self, users):
print("Success!")
|
def en_even(r):
return r[0] == "en" and len(r[1]) % 2 == 0
def en_odd(r):
return r[0] == "en" and len(r[1]) % 2 == 1
def predict(w):
def result(r):
return (r[0],r[1], np.dot(w.T, r[2])[0][0], r[3])
return result
train = rdd.filter(en_even)
test = rdd.filter(en_odd)
nxxt = train.map(x_xtranspose)
nres = nxxt.reduce(np.add)
nxy = train.map(xy_scale)
nres2 = nxy.reduce(np.add)
nweights = np.dot(np.linalg.inv(nres), nres2.T)
# Make predictions on test with our train weights
pred = test.map(predict(nweights))
# Because we already filtered by code "en"
pred = pred.filter(lambda r: r[1] == "yahoo")
|
class InvalidAgencyNumber(Exception):
def __init__(self, agency_number=None):
self.message = 'Agência inválida.'
if agency_number is not None:
self.message = f'A agência deve conter {agency_number} números. Complete com zeros a esquerda se necessário.'
super().__init__(self.message)
def __str__(self):
return f'{self.message}'
class InvalidDigitAgencyNumber(Exception):
def __init__(self):
self.message = f'Dígito da agência inválido.'
super().__init__(self.message)
def __str__(self):
return f'{self.message}'
class InvalidAccountNumber(Exception):
def __init__(self, account_number=None):
self.message = 'Conta inválida'
if account_number is not None:
self.message = f'A conta corrente deve conter {account_number} números. Complete com zeros a esquerda se necessário'
super().__init__(self.message)
def __str__(self):
return f'{self.message}'
class InvalidDigitAccountNumber(Exception):
def __init__(self, digit_account=None):
self.message = 'Dígito da conta não corresponde ao número da conta/agência preenchido'
super().__init__(self.message)
def __str__(self):
return f'{self.message}'
class InvalidCodeBank(Exception):
def __init__(self):
self.message = 'Banco inválido'
super().__init__(self.message)
def __str__(self):
return f'{self.message}'
|
class DHFetchPlugin(object):
""" Drill-Hawkプラグイン
"""
def get_es_source(self):
""" メトリクスのElasticSearchでデータをsearchするときに、
_sourceに指定する項目のリストを返す
:return: _sourcesに指定するElasticSearch上の項目のリスト (string list)
"""
raise NotImplementedError()
def build(self, cwl_workflow_data):
""" cwl_workflow_dataにプラグインが必要とするデータを追加する。
:param cwl_workflow_data: メトリクスのElasticSearchから取得したworkflow情報
:return: 引数のcwl_workflow_dataに情報追加したデータ。
.. note::
cwl_workflow_data の標準は、以下のドキュメントを参照
<https://github.com/inutano/cwl-metrics/tree/master/docs>
cwl_workflow_data の例は以下の通りである。
.. code-block:: none
:linenos:
{'workflow':
{
'prepare': {
'start_time': '2020-05-05T14:22:15',
'end_date': '2020-05-05T15:06:28',
'end_time': '2020-05-05T14:22:22'
},
...
'steps': {
'HISAT2-3': {
'stepname': 'HISAT2-3',
'start_date': '2020-05-05T14:24:37',
'end_date': '2020-05-05T14:54:06',
'reconf': {
'start_time': '2020-05-05T14:22:23',
'end_time': '2020-05-05T14:24:36',
'ra': {'start_time': '2020-05-05T14:22:23.409770',
'end_time': '2020-05-05T14:24:29.092136'}
},
},
...
"""
raise NotImplementedError()
class DHGraphPlugin(object):
def build(self, workflow_data, graph_data, steps, total_keys):
""" グラフデータにプラグインが付加したいデータを追加する。
graph_dataには以下のプレフィックスをステップ名につけたものをキーとして、
グラフ化するデータ(実行時間、利用料金)が入っている。
* ``id-`` : ステップ名
* ``time-`` : 実行時間(秒)
* ``cost-`` : 利用料金(USD)
* ``start-`` : 開始時刻
* ``end-`` : 終了時刻
:param workflow_data: DHFetchPluginで処理した後のデータ
:param graph_data: グラフ(d3)用データ
:param steps: ステップごとのデータ
:param total_keys: 全てのworkflowで出現するステップをソートしたリスト
:return: 加工後の (graph_data, steps, total_keys)
"""
raise NotImplementedError()
class DHTablePlugin(object):
def build(self, workflow_table_data):
""" テーブルのセルを加工し、セルごとにHTMLデータに変換する。
workflow_table_data["ext_columns"] にプラグインでの追加カラムを入れること
各カラムの値はstepにカラム名のフィールドを追加し、そこに入れること。
.. code-block:: python
:linenos:
workflow_table_data["ext_columns"].append(column_name)
template = jinja2_env.from_string(reconf_cell_template)
for step in workflow_table_data["steps"]:
step[column_name] = template.render(step=step, content=workflow_table_data)
:param workflow_table_data: テーブル化する対象のデータ
:return: 加工後の workflow_table_data (dict)
"""
raise NotImplementedError()
class DHPlugin(object):
""" pluginのpythonモジュールに ``create_plugin(*args, **kwargs)`` を定義し
その関数でpluginインスタンスを返すように実装すること。
.. code-block:: python
:linenos:
def create_plugin(*args, **kwargs):
plugin = base.DHPlugin(fetch=FetchPlugin(),
table=TablePlugin(),
graph=GraphPlugin())
return plugin
"""
def __init__(self, fetch=None, table=None, graph=None):
""" Pluginのインスタンスを作成する
:params fetch: DHFetchPluginのインスタンス
:params table: DHFTablePluginのインスタンス
:params graph: DHGraphPluginのインスタンス
"""
self.fetch = fetch
self.table = table
self.graph = graph
|
rsa_key_data = [
"9cf7192b51a574d1ad3ccb08ba09b87f228573893eee355529ff243e90fd4b86f79a82097cc7922c0485bed1616b1656a9b0b19ef78ea8ec34c384019adc5d5bf4db2d2a0a2d9cf14277bdcb7056f48b81214e3f7f7742231e29673966f9b1106862112cc798dba8d4a138bb5abfc6d4c12d53a5d39b2f783da916da20852ee139bbafda61d429caf2a4f30847ce7e7ae32ab4061e27dd9e4d00d60910249db8d8559dd85f7ca59659ef400c8f6318700f4e97f0c6f4165de80641490433c88da8682befe68eb311f54af2b07d97ac74edb5399cf054764211694fbb8d1d333f3269f235abe025067f811ff83a2224826219b309ea3e6c968f42b3e52f245dc9",
"010001",
"b5ab7b159220b18e363258f61ebde08bae83d6ce2dbfe4adc143628c527887acde9de09bf9b49f438019004d71855f30c2d69b6c29bb9882ab641b3387409fe9199464a7faa4b5230c56d9e17cd9ed074bc00180ebed62bae3af28e6ff2ac2654ad968834c5d5c88f8d9d3cc5e167b10453b049d4e454a5761fb0ac717185907",
"dd2fffa9814296156a6926cd17b65564187e424dcadce9b032246ad7e46448bb0f9e0ff3c64f987424b1a40bc694e2e9ac4fb1930d163582d7acf20653a1c44b97846c1c5fd8a7b19bb225fb39c30e25410483deaf8c2538d222b748c4d8103b11cec04f666a5c0dbcbf5d5f625f158f65746c3fafe6418145f7cffa5fadeeaf"
]
|
def main():
data = open("day3/input.txt", "r")
data = [line.strip() for line in data.readlines()]
tree_counter = 0
x = 0
for line in data:
if x >= len(line):
x = x % (len(line))
if line[x] == "#":
tree_counter += 1
x += 3
print(tree_counter)
if __name__ == "__main__":
main()
|
iterations = 1
generations_list = [500]
populations_list = [30]
elitism_list = [0.2, 0.8]
mutables_list = [1]
|
# -*- coding: utf-8 -*-
"""
converters package.
"""
|
{
'variables': { 'target_arch%': 'ia32', 'naclversion': '0.4.5' },
'targets': [
{
'target_name': 'sodium',
'sources': [
'sodium.cc',
],
"dependencies": [
"<(module_root_dir)/deps/libsodium.gyp:libsodium"
],
'include_dirs': [
'./deps/libsodium-<(naclversion)/src/libsodium/include'
],
'cflags!': [ '-fno-exceptions' ],
}
]
}
|
l, r = int(input()), int(input()) / 100
count = 1
result = 0
while True:
l = int(l*r)
if l <= 5:
break
result += (2**count)*l
count += 1
print(result)
|
# Given a collection of numbers that might contain duplicates, return all possible unique permutations.
# For example,
# [1,1,2] have the following unique permutations:
# [1,1,2], [1,2,1], and [2,1,1].
class Solution:
# @param {integer[]} nums
# @return {integer[][]}
def permuteUnique(self, nums):
if not nums:
return nums
res = {(nums[0],)}
for i in range(1, len(nums)):
tmp = set()
while res:
base = res.pop()
for j in range(len(base)+ 1):
tmp.add(tuple(base[:j]) + (nums[i],) + tuple(base[j:]))
res = tmp
return [ list(t) for t in res ]
# dic = {str([nums[0]]):1}
# res = [[nums[0]]]
# for i in range(1, len(nums)):
# for j in range(len(res)):
# base = res.pop(0)
# dic.pop(str(base))
# for k in range(len(base)+ 1):
# tmp = base[:k] + [nums[i]] + base[k:]
# if str(tmp) not in dic:
# res.append(base[:k] + [nums[i]] + base[k:])
# dic[str(tmp)] = 1
# return res
|
class Person:
'''
This class represents a person
'''
def __init__(self, id, firstname, lastname, dob):
self.id = id
self.firstname = firstname
self.lastname = lastname
self.dob = dob
def __str__(self):
return "University ID Number: " + self.id + "\nName: " + self.firstname + " " + self.lastname
def __repr__(self):
return self.firstname + " " + self.lastname
def get_salary(self):
return 0
class Student(Person):
'''
This class represents a Student
'''
def __init__(self, id, firstname, lastname, dob, start_year):
self.start_year = start_year
self.courses = []
# invoking the __init__ of the parent class
# Person.__init__(self, firstname, lastname, dob)
# or better call super()
super().__init__(id, firstname, lastname, dob)
def add_course(self, course_id):
self.courses.append(course_id)
def get_courses():
return self.courses
def __str__(self):
return super().__str__() + ". This student has the following courses on records: " + str(list(self.courses))
# A student has no salary.
def get_salary(self):
return 0
class Professor(Person):
'''
This class represents a Professor in the university system.
'''
def __init__(self, id, firstname, lastname, dob, hiring_year, salary):
self.hiring_year = hiring_year
self.salary = salary
self.courses = set()
self.research_projects = set()
super().__init__(id, firstname, lastname, dob)
def __str__(self):
return super().__str__() + ". This Professor is the instructor of record of following courses : " + str(
list(self.courses))
def add_course(self, course_id):
self.courses.add(course_id)
def add_courses(self, courses):
for course in courses:
self.courses.add(course)
def get_courses():
return self.courses
def get_salary(self):
return self.salary
class Staff(Person):
'''
This class represents a staff member.
'''
def __init__(self, id, firstname, lastname, dob, hiring_year, salary):
self.hiring_year = hiring_year
self.salary = salary
super().__init__(id, firstname, lastname, dob)
def __str__(self):
return super().__str__() + ". This Staff memeber has a salary of " + str(self.salary)
def get_salary(self):
return self.salary
class Teaching_Assistant(Staff, Student):
'''
A Teaching Assistant is a student and is a staff member.
'''
def __init__(self, id, firstname, lastname, dob, start_year, hiring_year, salary):
Student.__init__(self, id, firstname, lastname, dob, start_year)
self.hiring_year = hiring_year
self.salary = salary
# Staff().__init__(self, id, firstname, lastname, dob, hiring_year, salary)
def __str__(self):
return Student.__str__(self) + Staff.__str__(self)
|
## CamelCase Method
## 6 kyu
## https://www.codewars.com//kata/587731fda577b3d1b0001196
def camel_case(string):
return ''.join([word.title() for word in string.split()])
|
#
# PySNMP MIB module Juniper-E2-Registry (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-E2-Registry
# Produced by pysmi-0.3.4 at Mon Apr 29 19:51:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
juniAdmin, = mibBuilder.importSymbols("Juniper-Registry", "juniAdmin")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
iso, Integer32, Unsigned32, ModuleIdentity, Bits, MibIdentifier, TimeTicks, ObjectIdentity, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Counter32, Counter64, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "Integer32", "Unsigned32", "ModuleIdentity", "Bits", "MibIdentifier", "TimeTicks", "ObjectIdentity", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Counter32", "Counter64", "Gauge32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
juniE2Registry = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3))
juniE2Registry.setRevisions(('2004-05-19 17:42', '2003-08-18 20:27',))
if mibBuilder.loadTexts: juniE2Registry.setLastUpdated('200405191742Z')
if mibBuilder.loadTexts: juniE2Registry.setOrganization('Juniper Networks, Inc.')
juniE2EntPhysicalType = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1))
e2Chassis = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 1))
if mibBuilder.loadTexts: e2Chassis.setStatus('current')
e320Chassis = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 1, 1))
if mibBuilder.loadTexts: e320Chassis.setStatus('current')
e2FanAssembly = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 2))
if mibBuilder.loadTexts: e2FanAssembly.setStatus('current')
e320PrimaryFanAssembly = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 2, 1))
if mibBuilder.loadTexts: e320PrimaryFanAssembly.setStatus('current')
e320AuxiliaryFanAssembly = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 2, 2))
if mibBuilder.loadTexts: e320AuxiliaryFanAssembly.setStatus('current')
e2PowerInput = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 3))
if mibBuilder.loadTexts: e2PowerInput.setStatus('current')
e320PowerDistributionModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 3, 1))
if mibBuilder.loadTexts: e320PowerDistributionModule.setStatus('current')
e2Midplane = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 4))
if mibBuilder.loadTexts: e2Midplane.setStatus('current')
e320Midplane = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 4, 1))
if mibBuilder.loadTexts: e320Midplane.setStatus('current')
e2SrpModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 5))
if mibBuilder.loadTexts: e2SrpModule.setStatus('current')
e320Srp100Module = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 5, 1))
if mibBuilder.loadTexts: e320Srp100Module.setStatus('current')
e320Srp320Module = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 5, 99))
if mibBuilder.loadTexts: e320Srp320Module.setStatus('current')
e2SwitchFabricModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 6))
if mibBuilder.loadTexts: e2SwitchFabricModule.setStatus('current')
e320FabricSlice100Module = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 6, 1))
if mibBuilder.loadTexts: e320FabricSlice100Module.setStatus('current')
e320FabricSlice320Module = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 6, 99))
if mibBuilder.loadTexts: e320FabricSlice320Module.setStatus('current')
e2SrpIoa = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 7))
if mibBuilder.loadTexts: e2SrpIoa.setStatus('current')
e320SrpIoa = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 7, 1))
if mibBuilder.loadTexts: e320SrpIoa.setStatus('current')
e2ForwardingModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 8))
if mibBuilder.loadTexts: e2ForwardingModule.setStatus('current')
e3204gLeModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 8, 1))
if mibBuilder.loadTexts: e3204gLeModule.setStatus('current')
e320Ge4PortModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 8, 2))
if mibBuilder.loadTexts: e320Ge4PortModule.setStatus('current')
e320Oc48Pos1PortModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 8, 3))
if mibBuilder.loadTexts: e320Oc48Pos1PortModule.setStatus('current')
e320Oc48RPos1PortModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 8, 4))
if mibBuilder.loadTexts: e320Oc48RPos1PortModule.setStatus('current')
e320OcXModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 8, 5))
if mibBuilder.loadTexts: e320OcXModule.setStatus('current')
e320MfgSerdesTestModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 8, 99))
if mibBuilder.loadTexts: e320MfgSerdesTestModule.setStatus('current')
e2ForwardingIoa = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 9))
if mibBuilder.loadTexts: e2ForwardingIoa.setStatus('current')
e3204GeIoa = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 9, 1))
if mibBuilder.loadTexts: e3204GeIoa.setStatus('current')
e320Oc48PosIoa = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 9, 2))
if mibBuilder.loadTexts: e320Oc48PosIoa.setStatus('current')
e320Oc48RPosIoa = ObjectIdentity((1, 3, 6, 1, 4, 1, 4874, 4, 2, 3, 1, 9, 3))
if mibBuilder.loadTexts: e320Oc48RPosIoa.setStatus('current')
mibBuilder.exportSymbols("Juniper-E2-Registry", e320PrimaryFanAssembly=e320PrimaryFanAssembly, e320FabricSlice320Module=e320FabricSlice320Module, juniE2Registry=juniE2Registry, e320Midplane=e320Midplane, e2SrpIoa=e2SrpIoa, e320Srp100Module=e320Srp100Module, e2PowerInput=e2PowerInput, e3204GeIoa=e3204GeIoa, e2SwitchFabricModule=e2SwitchFabricModule, e320Oc48Pos1PortModule=e320Oc48Pos1PortModule, e320Srp320Module=e320Srp320Module, e320FabricSlice100Module=e320FabricSlice100Module, e320OcXModule=e320OcXModule, e320SrpIoa=e320SrpIoa, e320AuxiliaryFanAssembly=e320AuxiliaryFanAssembly, PYSNMP_MODULE_ID=juniE2Registry, e320PowerDistributionModule=e320PowerDistributionModule, e2FanAssembly=e2FanAssembly, e320Oc48RPosIoa=e320Oc48RPosIoa, e320Chassis=e320Chassis, e2Chassis=e2Chassis, e320Oc48RPos1PortModule=e320Oc48RPos1PortModule, e2ForwardingModule=e2ForwardingModule, e320MfgSerdesTestModule=e320MfgSerdesTestModule, e2SrpModule=e2SrpModule, e2ForwardingIoa=e2ForwardingIoa, e320Ge4PortModule=e320Ge4PortModule, juniE2EntPhysicalType=juniE2EntPhysicalType, e3204gLeModule=e3204gLeModule, e320Oc48PosIoa=e320Oc48PosIoa, e2Midplane=e2Midplane)
|
#https://leetcode.com/problems/time-needed-to-inform-all-employees/
#Source: https://leetcode.com/problems/time-needed-to-inform-all-employees/discuss/532560/JavaC%2B%2BPython-DFS
class Solution:
def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
children = [[] for i in range(n)]
for i, m in enumerate(manager):
if m >= 0: children[m].append(i)
def dfs(value):
"""
We have use "or [0]" to avoid ValueError: max() arg is an empty sequence return max( ) error for leaf nodes with no adjacent elements.
"""
return max( [dfs(i) for i in children[value]] or [0] )+informTime[value]
return dfs(headID)
|
#validation of fields that are required
def validate_required(row, variable, metadata, formater,pre_checks=[]):
"""
:param row:
:param variable:
:param metadata:
:param formater:
:param pre_checks:
:return:
"""
errors=[]
for fun in pre_checks:
if fun(row,variable,metadata)==False:
return errors
if metadata.get_is_required(variable) is True:
if row[variable] is None:
errors.append(formater(row, variable, error_type="Required", message="'{}' is required".format(metadata.get_label(variable))))
return errors
# validation of fields that are not required but have no entries
def validate_no_entry(row,variable,metadata,formater,pre_checks=[]):
errors=[]
for fun in pre_checks:
if fun(row,variable,metadata)==False:
return errors
if metadata.get_is_required(variable) is None:
if row[variable] == '':
errors.append(formater(row, variable, error_type="No entry", message="'{}' has no data!".format(metadata.get_label(variable))))
return errors
# validation of range
def validate_range(row, variable, metadata,formater,pre_checks=[]):
"""
:param row:
:param variable:
:param metadata:
:param formater:
:param pre_checks:
:return: whether or not a value falls into the required range
"""
errors = []
for fun in pre_checks:
if fun(row,variable,metadata)==False:
return errors
l = row[variable]
if l is None:
return errors
if metadata.get_valid_range(variable) is not None:
min, max = metadata.get_valid_range(variable)
if(min is not None):
if (l<min): errors.append(formater(row, variable, error_type="is_below_minimum", message="'{}' is below minimum.".format(metadata.get_label(variable))))
if (max is not None):
if (l> max):errors.append(formater(row, variable, error_type="is_above_maximum", message="'{}' is above maximum.".format(metadata.get_label(variable))))
return errors
|
load("@bazel_skylib//lib:dicts.bzl", _dicts = "dicts")
load(
"//rules/scala_proto:private/core.bzl",
_scala_proto_library_implementation = "scala_proto_library_implementation",
_scala_proto_library_private_attributes = "scala_proto_library_private_attributes",
)
scala_proto_library = rule(
attrs = _dicts.add(
_scala_proto_library_private_attributes,
{
"deps": attr.label_list(
doc = "The proto_library targets you wish to generate Scala from",
providers = [ProtoInfo],
),
"_zipper": attr.label(cfg = "host", default = "@bazel_tools//tools/zip:zipper", executable = True),
},
),
doc = """
Generates Scala code from proto sources. The output is a `.srcjar` that can be passed into other rules for compilation.
See example use in [/tests/proto/BUILD](/tests/proto/BUILD)
""",
toolchains = [
"@rules_scala_annex//rules/scala_proto:compiler_toolchain_type",
],
outputs = {
"srcjar": "%{name}.srcjar",
},
implementation = _scala_proto_library_implementation,
)
def _scala_proto_toolchain_implementation(ctx):
return [platform_common.ToolchainInfo(
compiler = ctx.attr.compiler,
compiler_supports_workers = ctx.attr.compiler_supports_workers,
)]
scala_proto_toolchain = rule(
attrs = {
"compiler": attr.label(
doc = "The compiler to use to generate Scala form proto sources",
allow_files = True,
executable = True,
cfg = "host",
),
"compiler_supports_workers": attr.bool(default = False),
},
doc = """
Specifies a toolchain of the `@rules_scala_annex//rules/scala_proto:compiler_toolchain_type` toolchain type.
This rule should be used with an accompanying `toolchain` that binds it and specifies constraints
(See the official documentation for more info on [Bazel Toolchains](https://docs.bazel.build/versions/master/toolchains.html))
For example:
```python
scala_proto_toolchain(
name = "scalapb_toolchain_example",
compiler = ":worker",
compiler_supports_workers = True,
visibility = ["//visibility:public"],
)
toolchain(
name = "scalapb_toolchain_example_linux",
toolchain = ":scalapb_toolchain_example",
toolchain_type = "@rules_scala_annex//rules/scala_proto:compiler_toolchain_type",
exec_compatible_with = [
"@bazel_tools//platforms:linux",
"@bazel_tools//platforms:x86_64",
],
target_compatible_with = [
"@bazel_tools//platforms:linux",
"@bazel_tools//platforms:x86_64",
],
visibility = ["//visibility:public"],
)
```
""",
implementation = _scala_proto_toolchain_implementation,
)
|
# -*- coding: utf-8 -*-
class Scope(object):
"""
A base scope.
This indicates a permission access.
The `identifier` should be unique.
"""
identifier = None
def __init__(self, identifier):
self.identifier = identifier
def get_description(self):
return None
def __str__(self):
return "Base scope: {}".format(self.identifier)
|
class Node:
"""链表节点类"""
def __init__(self):
self.data = 0
self.next = None
class LinkedListStack:
"""链表结构堆栈类"""
def __init__(self):
"""初始化堆栈的属性"""
self.head = Node()
self.top = self.head # 堆栈的顶端,当前表示堆栈为空
def is_empty(self):
"""判断堆栈是否为空"""
if self.top == self.head:
return True
else:
return False
def push(self, data):
"""向堆栈中存入数据"""
new_node = Node()
new_node.data = data
self.top.next = new_node
self.top = new_node
print("成功存入数据")
def pop(self):
"""从堆栈中取出数据"""
if self.is_empty():
print("堆栈已空,不能再取数据")
else:
print("取出:%s" % self.top.data)
ptr = self.head
while True:
if ptr.next == self.top:
ptr.next = None
self.top = ptr
break
ptr = ptr.next
def show(self):
"""堆栈展示"""
if self.top == self.head:
print('堆栈为空')
else:
ptr = self.head.next
li = []
while True:
li.append(ptr.data)
if ptr.next is None:
break
ptr = ptr.next
width = 10
for data in li[::-1]:
str_data = str(data)
if len(str_data) >= width:
show_str = '|' + str_data + '|'
else:
space_num = width - len(str_data)
if space_num % 2 == 1:
left_space_num = space_num // 2 + 1
right_space_num = space_num // 2
else:
left_space_num = right_space_num = space_num // 2
show_str = '|' + ' ' * left_space_num + str_data + ' ' * right_space_num + '|'
print(show_str)
print('-' * (width + 2))
if __name__ == '__main__':
list_stack = LinkedListStack()
while True:
num = input("1.存入数据 2.取出数据 3.查看数据 4.退出\n请输入:")
if num == '1':
try:
data = int(input("输入存入数据:"))
except ValueError:
print("输入数据错误")
continue
list_stack.push(data)
elif num == '2':
list_stack.pop()
elif num == '3':
list_stack.show()
elif num == '4':
print("成功退出")
break
else:
print("输入选项错误,请重新输入")
|
class Error(Exception):
"""Base class for other exceptions"""
pass
class InvalidSpecies(Error):
"""Species out of bounds of legitimate species"""
pass
class InvalidForm(Error):
"""Form is invalid"""
pass
class APIError(Error):
"""Something wrong with the API"""
pass
|
class Solution:
def XXX(self, height: List[int]) -> int:
left = 0
right = len(height)-1
temp = 0
while left<right:
temp = max(temp,min(height[left],height[right])*(right-left))
if height[left] < height[right]:
left+=1
else:
right-=1
return temp
|
'''
core exception module
'''
class ConversionUnitNotImplemented(Exception):
'''
raises when tring can not convert a TemperatureUnit
'''
def __init__(self, unit_name: str):
super().__init__('Conversion unit %s not implemented' % unit_name)
|
line, k = input(), int(input())
iterator = line.__iter__()
iterators = zip(*([iterator] * k))
for word in iterators:
d = dict()
result = ''.join([d.setdefault(letter, letter) for letter in word if letter not in d])
print(result)
|
e_h,K = map(int,input().split())
h,m,s,e_m,e_s,ans = 0,0,0,59,59,0
while e_h != h or e_m != m or e_s != s:
z = "%02d%02d%02d" % (h,m,s)
if z.count(str(K)) >0:
# print(z)
ans+=1
s+=1
if s==60:
m+=1
s=0
if m==60:
h+=1
m=0
z = "%02d%02d%02d" % (h,m,s)
if z.count(str(K)) >0:
ans+=1
print(ans)
|
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""Contains tweakable constants for quality dashboard utility scripts."""
__author__ = 'phoglund@webrtc.org (Patrik Höglund)'
# This identifies our application using the information we got when we
# registered the application on Google appengine.
DASHBOARD_SERVER = 'webrtc-dashboard.appspot.com'
DASHBOARD_SERVER_HTTP = 'http://' + DASHBOARD_SERVER
CONSUMER_KEY = DASHBOARD_SERVER
CONSUMER_SECRET_FILE = 'consumer.secret'
ACCESS_TOKEN_FILE = 'access.token'
# OAuth URL:s.
REQUEST_TOKEN_URL = DASHBOARD_SERVER_HTTP + '/_ah/OAuthGetRequestToken'
AUTHORIZE_TOKEN_URL = DASHBOARD_SERVER_HTTP + '/_ah/OAuthAuthorizeToken'
ACCESS_TOKEN_URL = DASHBOARD_SERVER_HTTP + '/_ah/OAuthGetAccessToken'
# The build master URL.
BUILD_MASTER_SERVER = 'webrtc-cb-linux-master.cbf.corp.google.com:8010'
BUILD_MASTER_TRANSPOSED_GRID_URL = '/tgrid'
# Build bot constants.
BUILD_BOT_COVERAGE_WWW_DIRECTORY = '/var/www/coverage'
# Dashboard data input URLs.
ADD_COVERAGE_DATA_URL = DASHBOARD_SERVER_HTTP + '/add_coverage_data'
ADD_BUILD_STATUS_DATA_URL = DASHBOARD_SERVER_HTTP + '/add_build_status_data'
|
"""
Please write assert statements to verify that every number in the list [2,4,6,8] is even.
data = [2,4,5,6]
for i in data:
assert i%2 == 0, "{} is not an even number".format(i)
"""
"""
Please write a program which accepts basic mathematic expression from console and print the evaluation result.
Example: If the following n is given as input to the program:
35 + 3
Then, the output of the program should be:
38
expression = input()
ans = eval(expression)
print(ans)
"""
"""
Please write a binary search function which searches an item in a sorted list.
The function should return the index of element to be searched in the list.
def binary_search(lst, item):
low = 0
high = len(lst) - 1
while low <= high:
mid = round((low + high) / 2)
if lst[mid] == item:
return mid
elif lst[mid] > item:
high = mid - 1
else:
low = mid + 1
return None
lst = [1,3,5,7,]
print(binary_search(lst, 5))
"""
"""
Please generate a random float where the value is between 10 and 100 using Python module.
import random
print(random.random(10,100))
"""
"""
Please generate a random float where the value is between 5 and 95 using Python module.
import random
print(random.uniform(5,95))
"""
|
# # 9608/22/PRE/O/N/2020
# The code below declares the variables and arrays that are supposed to be pre-populated.
ItemCode = ["1001", "6056", "5557", "2568", "4458"]
ItemDescription = ["Pencil", "Pen", "Notebook", "Ruler", "Compass"]
Price = [1.0, 10.0, 100.0, 20.0, 30.0]
NumberInStock = [100, 100, 50, 20, 20]
n = len(ItemCode)
# ## TASK 1.4
# Write program code to produce a report displaying all the information stored about each item for which the number in stock is below a given level. The planning and identifier table are in the pasudocode file and the markdown respectively.
ThresholdLevel = int(input("Enter the minumum stock level: "))
for Counter in range(n):
if NumberInStock[Counter] < ThresholdLevel:
print("\nItem Code:", ItemCode[Counter])
print("Item Description:", ItemDescription[Counter])
print("Price:", Price[Counter])
print("Number in stock:", NumberInStock[Counter])
# ## TASK 2.2
# Design an algorithm to input the four pieces of data about a stock item, form a string according to your format design, and write the string to the text file. <br> First draw a program flowchart, then write the equivalent pseudocode.
RecordsFile = "Item Records.txt"
FileObject = open(RecordsFile, "a+")
WriteString = ""
NewItemCode = int(input("\nEnter item code: "))
WriteString = ':' + str(NewItemCode)
NewItemDescription = input("Enter item description: ")
WriteString += ':' + NewItemDescription
NewPrice = float(input("Enter new price: "))
WriteString += ':' + str(NewPrice)
NewNumberInStock = int(input("Enter the number of items in stock: "))
WriteString += ':' + str(NewNumberInStock) + '\n'
FileObject.write(WriteString)
FileObject.close()
# ## TASK 2.4
# The code below defines the sub-routines which will be used by more than of the tasks.
def GetItemCode():
TestItemCode = int(input("Enter the code of the item: "))
while not (TestItemCode > 1000 and TestItemCode < 9999):
TestItemCode = int(input("Re-enter the code of the item: "))
return TestItemCode
def GetNumberInStock():
TestNumberInStock = int(input("Enter the number of the item in stock: "))
while not (TestNumberInStock >= 0):
TestNumberInStock = int(input("Re-enter the number of the item in stock: "))
return TestNumberInStock
def GetPrice():
TestPrice = float(input("Enter the price of the item: "))
while not (TestPrice >= 0):
TestPrice = float(input("Re-enter the price of the item: "))
return TestPrice
def ExtractDetails(RecordString, Details):
Position = 0
SearchString = RecordString.strip() + ':'
if RecordString != "":
for Counter in range(4):
Position += 1
CurrentCharacter = SearchString[Position : Position + 1]
while CurrentCharacter != ':':
Details[Counter] += CurrentCharacter
Position += 1
CurrentCharacter = SearchString[Position : Position + 1]
print ("")
# ## TASK 2.4 (1)
# Add a new stock item to the text file. Include validation of the different pieces of information as appropriate. For example item code data may be a fixed format.
WriteString = ""
WriteString = ':' + str(GetItemCode())
NewItemDescription = input("Enter item description: ")
WriteString += ':' + NewItemDescription
WriteString += ':' + str(GetPrice())
WriteString += ':' + str(GetNumberInStock()) + '\n'
FileObject = open(RecordsFile, "a+")
FileObject.write(WriteString)
FileObject.close()
# ## TASK 2.4 (2)
# Search for a stock item with a specific item code. Output the other pieces of data together with suitable supporting text.
Found = False
CurrentRecord = ""
print("\nEnter the code of the item you want to search for.")
DesiredItemCode = GetItemCode()
FileObject = open(RecordsFile, "r+")
FileData = FileObject.readlines()
FileObject.close()
for record in FileData:
CurrentRecord = record
if CurrentRecord[1:5] == str(DesiredItemCode):
Found = True
break
if Found:
DetailsOfRecord = ["" for i in range(4)]
ExtractDetails(CurrentRecord, DetailsOfRecord)
print("\nItem Code: " + str(DetailsOfRecord[0]))
print("Item Description: " + DetailsOfRecord[1])
print("Price of item: " + str(DetailsOfRecord[2]))
print("Number of the item in stock: " + str(DetailsOfRecord[3]))
else:
print("Item not found.")
# ## TASK 2.4 (3)
# Search for all stock items with a specific item description, with output as for task 2.
DesiredItemDescription = input("\nEnter the description of the item you want to search for: ")
FileObject = open(RecordsFile, "r+")
FileData = FileObject.readlines()
FileObject.close()
for record in FileData:
DetailsOfRecord = ["" for i in range(4)]
ExtractDetails(record, DetailsOfRecord)
if DetailsOfRecord[1] == DesiredItemDescription:
print("\nItem Code: " + str(DetailsOfRecord[0]))
print("Item Description: " + DetailsOfRecord[1])
print("Price of item: " + str(DetailsOfRecord[2]))
print("Number of the item in stock: " + str(DetailsOfRecord[3]))
# ## TASK 2.4 (4)
# Output a list of all stock items with a price greater than a given amount.
print ("\nEnter the maximum threshold price.")
ThresholdPrice = GetPrice()
FileObject = open(RecordsFile, "r+")
FileData = FileObject.readlines()
FileObject.close()
30
for record in FileData:
DetailsOfRecord = ["" for i in range(4)]
ExtractDetails(record, DetailsOfRecord)
if float(DetailsOfRecord[2]) < ThresholdPrice:
print("\nItem Code: " + str(DetailsOfRecord[0]))
print("Item Description: " + DetailsOfRecord[1])
print("Price of item: " + str(DetailsOfRecord[2]))
print("Number of the item in stock: " + str(DetailsOfRecord[3]))
|
def discover_fields(layout):
"""Discover all fields defined in a layout object
This is used to avoid defining the field list in two places --
the layout object is instead inspected to determine the list
"""
fields = []
try:
comps = list(layout)
except TypeError:
return fields
for comp in comps:
if isinstance(comp, str):
fields.append(comp)
else:
fields.extend(discover_fields(comp))
return fields
|
"""
После дрессировки черепашка научилась понимать и запоминать указания биологов следующего вида:
север 10
запад 20
юг 30
восток 40
где первое слово — это направление, в котором должна двигаться черепашка, а число после слова — это положительное
расстояние в сантиметрах, которое должна пройти черепашка.
Но команды даются быстро, а черепашка ползёт медленно, и программисты догадались, что можно написать программу,
которая определит, куда в итоге биологи приведут черепашку.
Для этого программисты просят вас написать программу, которая выведет точку,
в которой окажется черепашка после всех команд. Для простоты они решили считать, что движение начинается в точке (0, 0),
и движение на восток увеличивает первую координату, а на север — вторую.
Программе подаётся на вход число команд n, которые нужно выполнить черепашке, после чего n строк с самими командами.
Вывести нужно два числа в одну строку: первую и вторую координату конечной точки черепашки.
Все координаты целочисленные.
"""
n = int(input())
lst = []
for i in range(n):
lst.append(input().split())
# lst = [['север', '10'], ['запад', '20'], ['юг', '30'], ['восток', '40']]
x = 0
y = 0
for i in lst:
if i[0] == 'север':
y += int(i[-1])
elif i[0] == 'юг':
y -= int(i[-1])
elif i[0] == 'восток':
x += int(i[-1])
else:
x -= int(i[-1])
print(f"{x} {y}")
|
# 4.04 Lists
# Purpose: learning how to use lists
#
# Author@ Shawn Velsor
# Date: 1/8/2021
electronics = ["computer", "cellphone", "laptop", "headphones"]
mutualItem = False
print("Hello, these are the items I like:")
count = 1
for i in electronics:
print(str(count) + ".", i)
count += 1
print()
def main():
item = input("What type of electronic device do you like? ").lower()
for i in electronics:
if(item == i):
print("Same, I like " + item + " also.")
mutualItem = True
if(mutualItem == False):
print("Oh, that's something I don't like...")
while True:
main()
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Peter Mounce <public@neverrunwithscissors.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_webpicmd
version_added: "2.0"
short_description: Installs packages using Web Platform Installer command-line
description:
- Installs packages using Web Platform Installer command-line (http://www.iis.net/learn/install/web-platform-installer/web-platform-installer-v4-command-line-webpicmdexe-rtw-release).
- Must be installed and present in PATH (see win_chocolatey module; 'webpicmd' is the package name, and you must install 'lessmsi' first too)
- Install IIS first (see win_feature module)
notes:
- accepts EULAs and suppresses reboot - you will need to check manage reboots yourself (see win_reboot module)
options:
name:
description:
- Name of the package to be installed
required: true
author: Peter Mounce
'''
EXAMPLES = r'''
# Install URLRewrite2.
win_webpicmd:
name: URLRewrite2
'''
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Определение общих символов в двух строках, введенных с клавиатуры.
if __name__ == "__main__":
print('Введитите 1 строку')
s1 = set(input())
print('Введитите 2 строку')
s2 = set(input())
# Нахождение пересечений
a = s1.intersection(s2)
print(a)
print(len(a))
|
# ==== PATHS ===================
PATH_TO_DATASET = "houseprice.csv"
OUTPUT_SCALER_PATH = 'scaler.pkl'
OUTPUT_MODEL_PATH = 'lasso_regression.pkl'
# ======= PARAMETERS ===============
# imputation parameters
LOTFRONTAGE_MODE = 60
# encoding parameters
FREQUENT_LABELS = {
'MSZoning': ['FV', 'RH', 'RL', 'RM'],
'Neighborhood': ['Blmngtn', 'BrDale', 'BrkSide', 'ClearCr', 'CollgCr',
'Crawfor', 'Edwards', 'Gilbert', 'IDOTRR', 'MeadowV',
'Mitchel', 'NAmes', 'NWAmes', 'NoRidge', 'NridgHt',
'OldTown', 'SWISU', 'Sawyer', 'SawyerW', 'Somerst',
'StoneBr', 'Timber'],
'RoofStyle': ['Gable', 'Hip'],
'MasVnrType': ['BrkFace', 'None', 'Stone'],
'BsmtQual': ['Ex', 'Fa', 'Gd', 'Missing', 'TA'],
'BsmtExposure': ['Av', 'Gd', 'Missing', 'Mn', 'No'],
'HeatingQC': ['Ex', 'Fa', 'Gd', 'TA'],
'CentralAir': ['N', 'Y'],
'KitchenQual': ['Ex', 'Fa', 'Gd', 'TA'],
'FireplaceQu': ['Ex', 'Fa', 'Gd', 'Missing', 'Po', 'TA'],
'GarageType': ['Attchd', 'Basment', 'BuiltIn', 'Detchd', 'Missing'],
'GarageFinish': ['Fin', 'Missing', 'RFn', 'Unf'],
'PavedDrive': ['N', 'P', 'Y']}
ENCODING_MAPPINGS = {'MSZoning': {'Rare': 0, 'RM': 1, 'RH': 2, 'RL': 3, 'FV': 4},
'Neighborhood': {'IDOTRR': 0, 'MeadowV': 1, 'BrDale': 2, 'Edwards': 3,
'BrkSide': 4, 'OldTown': 5, 'Sawyer': 6, 'SWISU': 7, 'NAmes': 8,
'Mitchel': 9, 'SawyerW': 10, 'Rare': 11, 'NWAmes': 12, 'Gilbert': 13,
'Blmngtn': 14, 'CollgCr': 15, 'Crawfor': 16, 'ClearCr': 17, 'Somerst': 18,
'Timber': 19, 'StoneBr': 20, 'NridgHt': 21, 'NoRidge': 22},
'RoofStyle': {'Gable': 0, 'Rare': 1, 'Hip': 2},
'MasVnrType': {'None': 0, 'Rare': 1, 'BrkFace': 2, 'Stone': 3},
'BsmtQual': {'Missing': 0, 'Fa': 1, 'TA': 2, 'Gd': 3, 'Ex': 4},
'BsmtExposure': {'Missing': 0, 'No': 1, 'Mn': 2, 'Av': 3, 'Gd': 4},
'HeatingQC': {'Rare': 0, 'Fa': 1, 'TA': 2, 'Gd': 3, 'Ex': 4},
'CentralAir': {'N': 0, 'Y': 1},
'KitchenQual': {'Fa': 0, 'TA': 1, 'Gd': 2, 'Ex': 3},
'FireplaceQu': {'Po': 0, 'Missing': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},
'GarageType': {'Missing': 0, 'Rare': 1, 'Detchd': 2, 'Basment': 3, 'Attchd': 4, 'BuiltIn': 5},
'GarageFinish': {'Missing': 0, 'Unf': 1, 'RFn': 2, 'Fin': 3},
'PavedDrive': {'N': 0, 'P': 1, 'Y': 2}}
# ======= FEATURE GROUPS =============
# variable groups for engineering steps
TARGET = 'SalePrice'
CATEGORICAL_TO_IMPUTE = ['MasVnrType', 'BsmtQual', 'BsmtExposure',
'FireplaceQu', 'GarageType', 'GarageFinish']
NUMERICAL_TO_IMPUTE = 'LotFrontage'
YEAR_VARIABLE = 'YearRemodAdd'
# variables to transofmr
NUMERICAL_LOG = ['LotFrontage', '1stFlrSF', 'GrLivArea', 'SalePrice']
# variables to encode
CATEGORICAL_ENCODE = ['MSZoning', 'Neighborhood', 'RoofStyle',
'MasVnrType', 'BsmtQual', 'BsmtExposure',
'HeatingQC', 'CentralAir', 'KitchenQual',
'FireplaceQu', 'GarageType', 'GarageFinish',
'PavedDrive']
# selected features for training
FEATURES = ['MSSubClass', 'MSZoning', 'Neighborhood', 'OverallQual',
'OverallCond', 'YearRemodAdd', 'RoofStyle', 'MasVnrType',
'BsmtQual', 'BsmtExposure', 'HeatingQC', 'CentralAir',
'1stFlrSF', 'GrLivArea', 'BsmtFullBath', 'KitchenQual',
'Fireplaces', 'FireplaceQu', 'GarageType', 'GarageFinish',
'GarageCars', 'PavedDrive', 'LotFrontage']
|
__title__ = 'plinn'
__description__ = "Partition Like It's 1999"
__url__ = 'https://github.com/giannitedesco/plinn'
__author__ = 'Gianni Tedesco'
__author_email__ = 'gianni@scaramanga.co.uk'
__copyright__ = 'Copyright 2020 Gianni Tedesco'
__license__ = 'Apache 2.0'
__version__ = '0.0.2'
|
# 2. Write Python code to find the cost of the minimum-energy seam in a list of lists.
energies = [[24, 22, 30, 15, 18, 19],
[12, 23, 15, 23, 10, 15],
[11, 13, 22, 13, 21, 14],
[13, 15, 17, 28, 19, 21],
[17, 17, 7, 27, 20, 19]]
energies2 = [[24, 22, 30, 15, 18, 19],
[12, 23, 15, 23, 10, 15],
[11, 13, 22, 13, 21, 14],
[13, 15, 17, 28, 19, 21],
[17, 17, 29, 27, 20, 19]]
# The correct output for the given energies data is 15+10+13+17+7 = 62.
def min_energy(energies):
cost = []
for i in range(len(energies)):
cost.append([0]*len(energies[0]))
for i in range(len(energies[0])):
cost[0][i] = energies[0][i]
for i in range(1, len(energies)):
for j in range(len(energies[0])):
if j == 0:
cost[i][j] = energies[i][j] + min(cost[i-1][j], cost[i-1][j+1])
elif j == len(energies[0]) - 1:
cost[i][j] = energies[i][j] + min(cost[i-1][j], cost[i-1][j-1])
else:
cost[i][j] = energies[i][j] + min(cost[i-1][j-1], cost[i-1][j], cost[i-1][j+1])
for i in range(len(cost)):
print(cost[i])
return min(cost[-1])
min_energy(energies)
|
mqtt_host = "IP_OR_DOMAIN"
mqtt_port = 1883
mqtt_topic = "screen/rpi"
mqtt_username = "USERNAME"
mqtt_password = "PASSWORD"
# Raspberry Pi
power_on_command = "vcgencmd display_power 1"
power_off_command = "vcgencmd display_power 0"
# Other HDMI linux devices
# power_on_command = "xset -display :0 dpms force on"
# power_off_command = "xset -display :0 dpms force off"
|
"""
Dictionary Comprehension
Se quiseremos criar uma lista fazemos:
lista = [1, 2, 3, 4]
Se quiseremos criar uma tupla:
tupla = (1, 2, 3, 4) # 1, 2, 3, 4
Se quisermos criar um set (conjunto):
conjunto = {1, 2, 3, 4}
Se quisermos criar um dicionário:
dicionario = {'a': 1, 'b': 2, 'c': 3, 'd': 3}
# Sintaxe
{chave: valor for valor in interável}
# Exemplos
numeros = {'a': 1, 'b': 2, 'c': 3, 'd': 3, 'e': 5}
quadrado = {chave: valor ** 2 for chave, valor in numeros.items()}
print(quadrado)
# {'a': 1, 'b': 4, 'c': 9, 'd': 9, 'e': 25}
numeros = [1, 1, 2, 3, 4, 5, 5]
quadrado = {valor: valor ** 2 for valor in numeros}
print(quadrado)
# {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
chaves = 'abcde'
valores = [1, 2, 3, 4, 5]
mistura = {chaves[i]: valores[i] for i in range(0, len(chaves))}
print(mistura)
# {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
"""
# Exemplo com lógica condicional
numeros = [1, 2, 3, 4, 5]
res = {num: ('Par' if num % 2 == 0 else 'Impar') for num in numeros}
print(res)
|
"""
Implements mainly the Vector class. See its documentation.
"""
class VectorError(Exception):
"""
An exception to use with Vector
"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return repr(self.value)
class Vector(tuple):
"""
A vector.
"""
def __init__(self,seq):
tuple.__init__(seq)
def __add__(self, other):
if not(isinstance(other,Vector)):
raise VectorError("right hand side is not a Vector")
return Vector(map(lambda x,y: x+y, self, other))
def __neg__(self):
return Vector(map(lambda x: -x, self))
def __pos__(self):
return self
def __sub__(self, other):
return Vector(map(lambda x,y: x-y, self, other))
def __mul__(self, other):
if not(isinstance(other,int) or isinstance(other,float)):
raise VectorError("right hand side is illegal")
return Vector(map(lambda x: x*other, self))
def __rmul__(self, other):
return (self*other)
def __div__(self, other):
if not(isinstance(other,int) or isinstance(other,float)):
raise VectorError("right hand side is illegal")
return Vector(map(lambda x: x/other, self))
def __rdiv__(self, other):
raise VectorError("you sick pervert! you tried to divide something by a vector!")
def __and__(self,other):
"""
this is a dot product, done like this: a&b
must use () around it because of fucked up operator precedence.
"""
if not(isinstance(other,Vector)):
raise VectorError("trying to do dot product of Vector with non-Vector")
"""
if self.dim()!=other.dim():
raise("trying to do dot product of Vectors of unequal dimension!")
"""
d=self.dim()
s=0.
for i in range(d):
s+=self[i]*other[i]
return s
def __rand__(self,other):
return self&other
def __or__(self,other):
"""
cross product, defined only for 3D Vectors. goes like this: a|b
don't try this on non-3d Vectors. must use () around it because of fucked up operator precedence.
"""
a=self
b=other
return Vector([a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]])
def __ror__(self,other):
return -(self|other)
def __abs__(self):
s=0.
for x in self:
s+=x**2
return s**(1.0/2)
def __iadd__(self,other):
self=self+other
return self
def __isub__(self,other):
self=self-other
return self
def __imul__(self,other):
self=self*other
return self
def __idiv__(self,other):
self=self/other
return self
def __iand__(self,other):
raise VectorError("please don't do &= with my Vectors, it confuses me")
def __ior__(self,other):
self=self|other
return self
def __repr__(self):
return "Vector("+tuple.__repr__(self)+")"
def norm(self):
"""
gives the Vector, normalized
"""
return self/abs(self)
def dim(self):
return len(self)
def copy(self):
return Vector(self)
################################################################################################
def zeros(n):
"""
Returns a zero Vector of length n.
"""
return Vector(map(lambda x: 0., range(n)))
def ones(n):
"""
Returns a Vector of length n with all ones.
"""
return Vector(map(lambda x: 1., range(n)))
|
class Token:
TOP_LEFT = "┌"
TOP_RIGHT = "┐"
BOTTOM_LEFT = "└"
BOTTOM_RIGHT = "┘"
HORIZONTAL = "─"
BOX_START = TOP_LEFT + HORIZONTAL
VERTICAL = "│"
INPUT_PORT = "┼"
OUTPUT_PORT = "┼"
FUNCTION = "ƒ"
COMMENT = "/*...*/"
SINGLE_QUOTE = "'"
DOUBLE_QUOTE = '"'
LEFT_PAREN = "("
FUNCTION_START = FUNCTION + LEFT_PAREN
RIGHT_PAREN = ")"
KEYWORD_BRANCH = "[Branch]"
KEYWORD_FOR_LOOP = "[For Loop]"
KEYWORD_FOR_EACH = "[For Each]"
KEYWORD_WHILE_LOOP = "[While Loop]"
KEYWORD_RETURN = "[Return]"
KEYWORD_BREAK = "[Break]"
KEYWORD_CONTINUE = "[Continue]"
KEYWORD_SET = "[Set]"
DATA_FLOW_PORT = "○"
CONTROL_FLOW_PORT = "►"
|
# Child Prime is such a prime number which can be obtained by summing up the square of the digit of its parent prime number.
# For example, 23 is a prime. If we calculate 2^2+3^2 = 4+9 = 13, which is also a prime no. then we call 13 as a child prime of 23.
ul = int(input("Enter Upper Limit: "))
gt = int(input("Generation Thresold :"))
def is_prime(m):
q = len(factors(m))
if q == 2:
return True
else:
return False
def sep(num):
res = list(map(int, str(num)))
return res
def factors(n):
flist = []
for i in range(1,n+1):
if n%i == 0:
flist.append(i)
return flist
def primesum(num):
if is_prime(num):
a = sep(num)
sum = 0
for i in range(len(a)):
sum = sum + a[i]**2
return sum
def generation(num):
gen = [num]
g = num
q = 1
while q > 0:
if is_prime(primesum(g)):
g = primesum(g)
gen.append(g)
else:
q = q*(-1)
return gen
for i in range(ul):
if is_prime(i):
pg = generation(i)
gn = len(pg)
if gn >= gt:
print(pg)
|
class MissingVariableError(Exception):
def __init__(self, name):
self.name = name
self.message = f'The required variable "{self.name}" is missing'
super().__init__(self.message)
class ReservedVariableError(Exception):
def __init__(self, name):
self.name = name
self.message = (
f'The variable"{self.name}" is reserved and should only be set by combine'
)
super().__init__(self.message)
|
def main():
# input
a, b, c = map(int, input().split())
# compute
cnt = 0
for i in range(a, b+1):
if c%i == 0:
cnt += 1
# output
print(cnt)
if __name__ == "__main__":
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.