body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1 value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
e826d800677a519603d82b41940f82d450679354f42ff6d14e54cccd34d05b16 | def add_to_blacklist(self, rowid):
'\n Add row to blacklist.\n '
self.info('blacklisting: row=%d', rowid)
self.blacklist.add(rowid) | Add row to blacklist. | pydarkstar/auction/manager.py | add_to_blacklist | Korrbit/pydarkstar | 0 | python | def add_to_blacklist(self, rowid):
'\n \n '
self.info('blacklisting: row=%d', rowid)
self.blacklist.add(rowid) | def add_to_blacklist(self, rowid):
'\n \n '
self.info('blacklisting: row=%d', rowid)
self.blacklist.add(rowid)<|docstring|>Add row to blacklist.<|endoftext|> |
6d3b5700ef07c51c127200f1b9a9f8dffbc49fa0297cf92a70527845616255ea | def buy_items(self, itemdata):
'\n The main buy item loop.\n '
with self.scopped_session(fail=self.fail) as session:
q = session.query(AuctionHouse).filter((AuctionHouse.seller != self.seller.seller), (AuctionHouse.sell_date == 0), (AuctionHouse.sale == 0))
for row in q:
with self.capture(fail=self.fail):
if (row.id not in self.blacklist):
try:
data = itemdata[row.itemid]
except KeyError:
self.error('item missing from database: %d', row.itemid)
data = None
if (data is not None):
if row.stack:
if data.buy12:
if (row.price <= data.price12):
date = timeutils.timestamp(datetime.datetime.now())
self.buyer.buy_item(row, date, data.price12)
dboxCount = session.query(DeliveryBox).filter((DeliveryBox.charname == row.seller_name)).count()
dboxSend = DeliveryBox(charid=row.seller, charname=row.seller_name, box=1, slot=dboxCount, itemid=65535, itemsubid=0, quantity=row.sale, senderid=0, sender='AH-Jeuno', received=0, sent=0)
session.add(dboxSend)
else:
self.info('price too high! itemid=%d %d <= %d', row.itemid, row.price, data.price12)
self.add_to_blacklist(row.id)
else:
self.debug('not allowed to buy item! itemid=%d', row.itemid)
self.add_to_blacklist(row.id)
elif data.buy01:
if (row.price <= data.price01):
date = timeutils.timestamp(datetime.datetime.now())
self.buyer.buy_item(row, date, data.price01)
dboxCount = session.query(DeliveryBox).filter((DeliveryBox.charname == row.seller_name)).count()
dboxSend = DeliveryBox(charid=row.seller, charname=row.seller_name, box=1, slot=dboxCount, itemid=65535, itemsubid=0, quantity=row.sale, senderid=0, sender='AH-Jeuno', received=0, sent=0)
session.add(dboxSend)
else:
self.info('price too high! itemid=%d %d <= %d', row.itemid, row.price, data.price01)
self.add_to_blacklist(row.id)
else:
self.debug('not allowed to buy item! itemid=%d', row.itemid)
self.add_to_blacklist(row.id)
else:
self.add_to_blacklist(row.id)
else:
self.debug('skipping row %d', row.id) | The main buy item loop. | pydarkstar/auction/manager.py | buy_items | Korrbit/pydarkstar | 0 | python | def buy_items(self, itemdata):
'\n \n '
with self.scopped_session(fail=self.fail) as session:
q = session.query(AuctionHouse).filter((AuctionHouse.seller != self.seller.seller), (AuctionHouse.sell_date == 0), (AuctionHouse.sale == 0))
for row in q:
with self.capture(fail=self.fail):
if (row.id not in self.blacklist):
try:
data = itemdata[row.itemid]
except KeyError:
self.error('item missing from database: %d', row.itemid)
data = None
if (data is not None):
if row.stack:
if data.buy12:
if (row.price <= data.price12):
date = timeutils.timestamp(datetime.datetime.now())
self.buyer.buy_item(row, date, data.price12)
dboxCount = session.query(DeliveryBox).filter((DeliveryBox.charname == row.seller_name)).count()
dboxSend = DeliveryBox(charid=row.seller, charname=row.seller_name, box=1, slot=dboxCount, itemid=65535, itemsubid=0, quantity=row.sale, senderid=0, sender='AH-Jeuno', received=0, sent=0)
session.add(dboxSend)
else:
self.info('price too high! itemid=%d %d <= %d', row.itemid, row.price, data.price12)
self.add_to_blacklist(row.id)
else:
self.debug('not allowed to buy item! itemid=%d', row.itemid)
self.add_to_blacklist(row.id)
elif data.buy01:
if (row.price <= data.price01):
date = timeutils.timestamp(datetime.datetime.now())
self.buyer.buy_item(row, date, data.price01)
dboxCount = session.query(DeliveryBox).filter((DeliveryBox.charname == row.seller_name)).count()
dboxSend = DeliveryBox(charid=row.seller, charname=row.seller_name, box=1, slot=dboxCount, itemid=65535, itemsubid=0, quantity=row.sale, senderid=0, sender='AH-Jeuno', received=0, sent=0)
session.add(dboxSend)
else:
self.info('price too high! itemid=%d %d <= %d', row.itemid, row.price, data.price01)
self.add_to_blacklist(row.id)
else:
self.debug('not allowed to buy item! itemid=%d', row.itemid)
self.add_to_blacklist(row.id)
else:
self.add_to_blacklist(row.id)
else:
self.debug('skipping row %d', row.id) | def buy_items(self, itemdata):
'\n \n '
with self.scopped_session(fail=self.fail) as session:
q = session.query(AuctionHouse).filter((AuctionHouse.seller != self.seller.seller), (AuctionHouse.sell_date == 0), (AuctionHouse.sale == 0))
for row in q:
with self.capture(fail=self.fail):
if (row.id not in self.blacklist):
try:
data = itemdata[row.itemid]
except KeyError:
self.error('item missing from database: %d', row.itemid)
data = None
if (data is not None):
if row.stack:
if data.buy12:
if (row.price <= data.price12):
date = timeutils.timestamp(datetime.datetime.now())
self.buyer.buy_item(row, date, data.price12)
dboxCount = session.query(DeliveryBox).filter((DeliveryBox.charname == row.seller_name)).count()
dboxSend = DeliveryBox(charid=row.seller, charname=row.seller_name, box=1, slot=dboxCount, itemid=65535, itemsubid=0, quantity=row.sale, senderid=0, sender='AH-Jeuno', received=0, sent=0)
session.add(dboxSend)
else:
self.info('price too high! itemid=%d %d <= %d', row.itemid, row.price, data.price12)
self.add_to_blacklist(row.id)
else:
self.debug('not allowed to buy item! itemid=%d', row.itemid)
self.add_to_blacklist(row.id)
elif data.buy01:
if (row.price <= data.price01):
date = timeutils.timestamp(datetime.datetime.now())
self.buyer.buy_item(row, date, data.price01)
dboxCount = session.query(DeliveryBox).filter((DeliveryBox.charname == row.seller_name)).count()
dboxSend = DeliveryBox(charid=row.seller, charname=row.seller_name, box=1, slot=dboxCount, itemid=65535, itemsubid=0, quantity=row.sale, senderid=0, sender='AH-Jeuno', received=0, sent=0)
session.add(dboxSend)
else:
self.info('price too high! itemid=%d %d <= %d', row.itemid, row.price, data.price01)
self.add_to_blacklist(row.id)
else:
self.debug('not allowed to buy item! itemid=%d', row.itemid)
self.add_to_blacklist(row.id)
else:
self.add_to_blacklist(row.id)
else:
self.debug('skipping row %d', row.id)<|docstring|>The main buy item loop.<|endoftext|> |
d40ff52f583a7a4a764cc430fbe923a3e66938b98b505457513c79aac4d00e59 | def restock_items(self, itemdata):
'\n The main restock loop.\n '
for data in itemdata.items.values():
if data.sell01:
history_price = self.browser.get_price(itemid=data.itemid, stack=False, seller=self.seller.seller)
if ((history_price is None) or (history_price <= 0)):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.set_history(itemid=data.itemid, stack=False, price=data.price01, date=now, count=1)
stock = self.browser.get_stock(itemid=data.itemid, stack=False, seller=self.seller.seller)
while (stock < data.stock01):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.sell_item(itemid=data.itemid, stack=False, date=now, price=data.price01, count=1)
stock += 1
if data.sell12:
history_price = self.browser.get_price(itemid=data.itemid, stack=True, seller=self.seller.seller)
if ((history_price is None) or (history_price <= 0)):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.set_history(itemid=data.itemid, stack=True, price=data.price12, date=now, count=1)
stock = self.browser.get_stock(itemid=data.itemid, stack=True, seller=self.seller.seller)
while (stock < data.stock12):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.sell_item(itemid=data.itemid, stack=True, date=now, price=data.price12, count=1)
stock += 1 | The main restock loop. | pydarkstar/auction/manager.py | restock_items | Korrbit/pydarkstar | 0 | python | def restock_items(self, itemdata):
'\n \n '
for data in itemdata.items.values():
if data.sell01:
history_price = self.browser.get_price(itemid=data.itemid, stack=False, seller=self.seller.seller)
if ((history_price is None) or (history_price <= 0)):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.set_history(itemid=data.itemid, stack=False, price=data.price01, date=now, count=1)
stock = self.browser.get_stock(itemid=data.itemid, stack=False, seller=self.seller.seller)
while (stock < data.stock01):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.sell_item(itemid=data.itemid, stack=False, date=now, price=data.price01, count=1)
stock += 1
if data.sell12:
history_price = self.browser.get_price(itemid=data.itemid, stack=True, seller=self.seller.seller)
if ((history_price is None) or (history_price <= 0)):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.set_history(itemid=data.itemid, stack=True, price=data.price12, date=now, count=1)
stock = self.browser.get_stock(itemid=data.itemid, stack=True, seller=self.seller.seller)
while (stock < data.stock12):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.sell_item(itemid=data.itemid, stack=True, date=now, price=data.price12, count=1)
stock += 1 | def restock_items(self, itemdata):
'\n \n '
for data in itemdata.items.values():
if data.sell01:
history_price = self.browser.get_price(itemid=data.itemid, stack=False, seller=self.seller.seller)
if ((history_price is None) or (history_price <= 0)):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.set_history(itemid=data.itemid, stack=False, price=data.price01, date=now, count=1)
stock = self.browser.get_stock(itemid=data.itemid, stack=False, seller=self.seller.seller)
while (stock < data.stock01):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.sell_item(itemid=data.itemid, stack=False, date=now, price=data.price01, count=1)
stock += 1
if data.sell12:
history_price = self.browser.get_price(itemid=data.itemid, stack=True, seller=self.seller.seller)
if ((history_price is None) or (history_price <= 0)):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.set_history(itemid=data.itemid, stack=True, price=data.price12, date=now, count=1)
stock = self.browser.get_stock(itemid=data.itemid, stack=True, seller=self.seller.seller)
while (stock < data.stock12):
now = timeutils.timestamp(datetime.datetime(2099, 1, 1))
self.seller.sell_item(itemid=data.itemid, stack=True, date=now, price=data.price12, count=1)
stock += 1<|docstring|>The main restock loop.<|endoftext|> |
d30961e9cbb33e1f7a8cb1a6e3aaff1dac4e54bec912a95a7dc69cae0bf3f2c9 | def BeginInvoke(self, sender, e, callback, object):
' BeginInvoke(self: WebBrowserNavigatedEventHandler,sender: object,e: WebBrowserNavigatedEventArgs,callback: AsyncCallback,object: object) -> IAsyncResult '
pass | BeginInvoke(self: WebBrowserNavigatedEventHandler,sender: object,e: WebBrowserNavigatedEventArgs,callback: AsyncCallback,object: object) -> IAsyncResult | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | BeginInvoke | daddycocoaman/ironpython-stubs | 182 | python | def BeginInvoke(self, sender, e, callback, object):
' '
pass | def BeginInvoke(self, sender, e, callback, object):
' '
pass<|docstring|>BeginInvoke(self: WebBrowserNavigatedEventHandler,sender: object,e: WebBrowserNavigatedEventArgs,callback: AsyncCallback,object: object) -> IAsyncResult<|endoftext|> |
3e781a4d1e341c736a5f9fe72b707fb36972379e1905f3f44f9a1af217bff301 | def CombineImpl(self, *args):
'\n CombineImpl(self: MulticastDelegate,follow: Delegate) -> Delegate\n\n \n\n Combines this System.Delegate with the specified System.Delegate to form a new delegate.\n\n \n\n follow: The delegate to combine with this delegate.\n\n Returns: A delegate that is the new root of the System.MulticastDelegate invocation list.\n '
pass | CombineImpl(self: MulticastDelegate,follow: Delegate) -> Delegate
Combines this System.Delegate with the specified System.Delegate to form a new delegate.
follow: The delegate to combine with this delegate.
Returns: A delegate that is the new root of the System.MulticastDelegate invocation list. | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | CombineImpl | daddycocoaman/ironpython-stubs | 182 | python | def CombineImpl(self, *args):
'\n CombineImpl(self: MulticastDelegate,follow: Delegate) -> Delegate\n\n \n\n Combines this System.Delegate with the specified System.Delegate to form a new delegate.\n\n \n\n follow: The delegate to combine with this delegate.\n\n Returns: A delegate that is the new root of the System.MulticastDelegate invocation list.\n '
pass | def CombineImpl(self, *args):
'\n CombineImpl(self: MulticastDelegate,follow: Delegate) -> Delegate\n\n \n\n Combines this System.Delegate with the specified System.Delegate to form a new delegate.\n\n \n\n follow: The delegate to combine with this delegate.\n\n Returns: A delegate that is the new root of the System.MulticastDelegate invocation list.\n '
pass<|docstring|>CombineImpl(self: MulticastDelegate,follow: Delegate) -> Delegate
Combines this System.Delegate with the specified System.Delegate to form a new delegate.
follow: The delegate to combine with this delegate.
Returns: A delegate that is the new root of the System.MulticastDelegate invocation list.<|endoftext|> |
d9d0e2a8d5a2b907cac3ae995d6e7d46f18d95c3e2b12f34b66594dc12dac937 | def DynamicInvokeImpl(self, *args):
'\n DynamicInvokeImpl(self: Delegate,args: Array[object]) -> object\n\n \n\n Dynamically invokes (late-bound) the method represented by the current delegate.\n\n \n\n args: An array of objects that are the arguments to pass to the method represented by the current \n\n delegate.-or- null,if the method represented by the current delegate does not require \n\n arguments.\n\n \n\n Returns: The object returned by the method represented by the delegate.\n '
pass | DynamicInvokeImpl(self: Delegate,args: Array[object]) -> object
Dynamically invokes (late-bound) the method represented by the current delegate.
args: An array of objects that are the arguments to pass to the method represented by the current
delegate.-or- null,if the method represented by the current delegate does not require
arguments.
Returns: The object returned by the method represented by the delegate. | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | DynamicInvokeImpl | daddycocoaman/ironpython-stubs | 182 | python | def DynamicInvokeImpl(self, *args):
'\n DynamicInvokeImpl(self: Delegate,args: Array[object]) -> object\n\n \n\n Dynamically invokes (late-bound) the method represented by the current delegate.\n\n \n\n args: An array of objects that are the arguments to pass to the method represented by the current \n\n delegate.-or- null,if the method represented by the current delegate does not require \n\n arguments.\n\n \n\n Returns: The object returned by the method represented by the delegate.\n '
pass | def DynamicInvokeImpl(self, *args):
'\n DynamicInvokeImpl(self: Delegate,args: Array[object]) -> object\n\n \n\n Dynamically invokes (late-bound) the method represented by the current delegate.\n\n \n\n args: An array of objects that are the arguments to pass to the method represented by the current \n\n delegate.-or- null,if the method represented by the current delegate does not require \n\n arguments.\n\n \n\n Returns: The object returned by the method represented by the delegate.\n '
pass<|docstring|>DynamicInvokeImpl(self: Delegate,args: Array[object]) -> object
Dynamically invokes (late-bound) the method represented by the current delegate.
args: An array of objects that are the arguments to pass to the method represented by the current
delegate.-or- null,if the method represented by the current delegate does not require
arguments.
Returns: The object returned by the method represented by the delegate.<|endoftext|> |
535b77975afc60123504d0838ffc23bd7e4318eb41beff3f46d19c92a93be677 | def EndInvoke(self, result):
' EndInvoke(self: WebBrowserNavigatedEventHandler,result: IAsyncResult) '
pass | EndInvoke(self: WebBrowserNavigatedEventHandler,result: IAsyncResult) | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | EndInvoke | daddycocoaman/ironpython-stubs | 182 | python | def EndInvoke(self, result):
' '
pass | def EndInvoke(self, result):
' '
pass<|docstring|>EndInvoke(self: WebBrowserNavigatedEventHandler,result: IAsyncResult)<|endoftext|> |
75855a6539198420fcad89ba3b6ed1160095fb7feed925bd0e205dd6b28ac406 | def GetMethodImpl(self, *args):
'\n GetMethodImpl(self: MulticastDelegate) -> MethodInfo\n\n \n\n Returns a static method represented by the current System.MulticastDelegate.\n\n Returns: A static method represented by the current System.MulticastDelegate.\n '
pass | GetMethodImpl(self: MulticastDelegate) -> MethodInfo
Returns a static method represented by the current System.MulticastDelegate.
Returns: A static method represented by the current System.MulticastDelegate. | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | GetMethodImpl | daddycocoaman/ironpython-stubs | 182 | python | def GetMethodImpl(self, *args):
'\n GetMethodImpl(self: MulticastDelegate) -> MethodInfo\n\n \n\n Returns a static method represented by the current System.MulticastDelegate.\n\n Returns: A static method represented by the current System.MulticastDelegate.\n '
pass | def GetMethodImpl(self, *args):
'\n GetMethodImpl(self: MulticastDelegate) -> MethodInfo\n\n \n\n Returns a static method represented by the current System.MulticastDelegate.\n\n Returns: A static method represented by the current System.MulticastDelegate.\n '
pass<|docstring|>GetMethodImpl(self: MulticastDelegate) -> MethodInfo
Returns a static method represented by the current System.MulticastDelegate.
Returns: A static method represented by the current System.MulticastDelegate.<|endoftext|> |
25fa8f2cc2375b7fe06dd87e6511e9e63a085af3caf40566ffe73cfe16492fc5 | def Invoke(self, sender, e):
' Invoke(self: WebBrowserNavigatedEventHandler,sender: object,e: WebBrowserNavigatedEventArgs) '
pass | Invoke(self: WebBrowserNavigatedEventHandler,sender: object,e: WebBrowserNavigatedEventArgs) | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | Invoke | daddycocoaman/ironpython-stubs | 182 | python | def Invoke(self, sender, e):
' '
pass | def Invoke(self, sender, e):
' '
pass<|docstring|>Invoke(self: WebBrowserNavigatedEventHandler,sender: object,e: WebBrowserNavigatedEventArgs)<|endoftext|> |
4582985d8254d6229bffaf550edd2374b7065c8b751db05d77a1d74356bc66a4 | def RemoveImpl(self, *args):
'\n RemoveImpl(self: MulticastDelegate,value: Delegate) -> Delegate\n\n \n\n Removes an element from the invocation list of this System.MulticastDelegate that is equal to \n\n the specified delegate.\n\n \n\n \n\n value: The delegate to search for in the invocation list.\n\n Returns: If value is found in the invocation list for this instance,then a new System.Delegate without \n\n value in its invocation list; otherwise,this instance with its original invocation list.\n '
pass | RemoveImpl(self: MulticastDelegate,value: Delegate) -> Delegate
Removes an element from the invocation list of this System.MulticastDelegate that is equal to
the specified delegate.
value: The delegate to search for in the invocation list.
Returns: If value is found in the invocation list for this instance,then a new System.Delegate without
value in its invocation list; otherwise,this instance with its original invocation list. | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | RemoveImpl | daddycocoaman/ironpython-stubs | 182 | python | def RemoveImpl(self, *args):
'\n RemoveImpl(self: MulticastDelegate,value: Delegate) -> Delegate\n\n \n\n Removes an element from the invocation list of this System.MulticastDelegate that is equal to \n\n the specified delegate.\n\n \n\n \n\n value: The delegate to search for in the invocation list.\n\n Returns: If value is found in the invocation list for this instance,then a new System.Delegate without \n\n value in its invocation list; otherwise,this instance with its original invocation list.\n '
pass | def RemoveImpl(self, *args):
'\n RemoveImpl(self: MulticastDelegate,value: Delegate) -> Delegate\n\n \n\n Removes an element from the invocation list of this System.MulticastDelegate that is equal to \n\n the specified delegate.\n\n \n\n \n\n value: The delegate to search for in the invocation list.\n\n Returns: If value is found in the invocation list for this instance,then a new System.Delegate without \n\n value in its invocation list; otherwise,this instance with its original invocation list.\n '
pass<|docstring|>RemoveImpl(self: MulticastDelegate,value: Delegate) -> Delegate
Removes an element from the invocation list of this System.MulticastDelegate that is equal to
the specified delegate.
value: The delegate to search for in the invocation list.
Returns: If value is found in the invocation list for this instance,then a new System.Delegate without
value in its invocation list; otherwise,this instance with its original invocation list.<|endoftext|> |
32b5271afcd5ecc37febb67dd854fa2d1b2c4c68b2c41d2ec119d33157e9bbaa | 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 | 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 | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | __init__ | daddycocoaman/ironpython-stubs | 182 | python | def __init__(self, *args):
' '
pass | def __init__(self, *args):
' '
pass<|docstring|>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<|endoftext|> |
4719cf2f65d08466562a373ce4355c7fcebea5f18598a85f57e9716107bb466c | @staticmethod
def __new__(self, object, method):
' __new__(cls: type,object: object,method: IntPtr) '
pass | __new__(cls: type,object: object,method: IntPtr) | release/stubs.min/System/Windows/Forms/__init___parts/WebBrowserNavigatedEventHandler.py | __new__ | daddycocoaman/ironpython-stubs | 182 | python | @staticmethod
def __new__(self, object, method):
' '
pass | @staticmethod
def __new__(self, object, method):
' '
pass<|docstring|>__new__(cls: type,object: object,method: IntPtr)<|endoftext|> |
bf33a04327070c843a35ee0b45137233224c7e4284893b06ccfee009f8eccdad | def _get_grid_point_coords(model_name, first_row_in_full_grid, last_row_in_full_grid, first_column_in_full_grid, last_column_in_full_grid, grid_id=None, basemap_object=None):
"Returns x-y and lat-long coords for a subgrid of the full model grid.\n\n This method generates different x-y coordinates than\n `nwp_model_utils.get_xy_grid_point_matrices`, because (like\n `mpl_toolkits.basemap.Basemap`) this method sets false easting = false\n northing = 0 metres.\n\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param first_row_in_full_grid: Row 0 in the subgrid is row\n `first_row_in_full_grid` in the full grid.\n :param last_row_in_full_grid: Last row in the subgrid is row\n `last_row_in_full_grid` in the full grid. If you want last row in the\n subgrid to equal last row in the full grid, make this -1.\n :param first_column_in_full_grid: Column 0 in the subgrid is column\n `first_column_in_full_grid` in the full grid.\n :param last_column_in_full_grid: Last column in the subgrid is column\n `last_column_in_full_grid` in the full grid. If you want last column in\n the subgrid to equal last column in the full grid, make this -1.\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param basemap_object: Instance of `mpl_toolkits.basemap.Basemap` for the\n given NWP model. If you don't have one, no big deal -- leave this\n argument empty.\n :return: coordinate_dict: Dictionary with the following keys.\n coordinate_dict['grid_point_x_matrix_metres']: M-by-N numpy array of\n x-coordinates.\n coordinate_dict['grid_point_y_matrix_metres']: M-by-N numpy array of\n y-coordinates.\n coordinate_dict['grid_point_lat_matrix_deg']: M-by-N numpy array of\n latitudes (deg N).\n coordinate_dict['grid_point_lng_matrix_deg']: M-by-N numpy array of\n longitudes (deg E).\n "
(num_rows_in_full_grid, num_columns_in_full_grid) = nwp_model_utils.get_grid_dimensions(model_name=model_name, grid_name=grid_id)
error_checking.assert_is_integer(first_row_in_full_grid)
error_checking.assert_is_geq(first_row_in_full_grid, 0)
error_checking.assert_is_integer(last_row_in_full_grid)
if (last_row_in_full_grid < 0):
last_row_in_full_grid += num_rows_in_full_grid
error_checking.assert_is_greater(last_row_in_full_grid, first_row_in_full_grid)
error_checking.assert_is_less_than(last_row_in_full_grid, num_rows_in_full_grid)
error_checking.assert_is_integer(first_column_in_full_grid)
error_checking.assert_is_geq(first_column_in_full_grid, 0)
error_checking.assert_is_integer(last_column_in_full_grid)
if (last_column_in_full_grid < 0):
last_column_in_full_grid += num_columns_in_full_grid
error_checking.assert_is_greater(last_column_in_full_grid, first_column_in_full_grid)
error_checking.assert_is_less_than(last_column_in_full_grid, num_columns_in_full_grid)
(grid_point_lat_matrix_deg, grid_point_lng_matrix_deg) = nwp_model_utils.get_latlng_grid_point_matrices(model_name=model_name, grid_name=grid_id)
grid_point_lat_matrix_deg = grid_point_lat_matrix_deg[(first_row_in_full_grid:(last_row_in_full_grid + 1), first_column_in_full_grid:(last_column_in_full_grid + 1))]
grid_point_lng_matrix_deg = grid_point_lng_matrix_deg[(first_row_in_full_grid:(last_row_in_full_grid + 1), first_column_in_full_grid:(last_column_in_full_grid + 1))]
if (basemap_object is None):
(standard_latitudes_deg, central_longitude_deg) = nwp_model_utils.get_projection_params(model_name)
projection_object = projections.init_lcc_projection(standard_latitudes_deg=standard_latitudes_deg, central_longitude_deg=central_longitude_deg)
(grid_point_x_matrix_metres, grid_point_y_matrix_metres) = projections.project_latlng_to_xy(latitudes_deg=grid_point_lat_matrix_deg, longitudes_deg=grid_point_lng_matrix_deg, projection_object=projection_object, false_northing_metres=0.0, false_easting_metres=0.0)
else:
(grid_point_x_matrix_metres, grid_point_y_matrix_metres) = basemap_object(grid_point_lng_matrix_deg, grid_point_lat_matrix_deg)
return {X_COORD_MATRIX_KEY: grid_point_x_matrix_metres, Y_COORD_MATRIX_KEY: grid_point_y_matrix_metres, LATITUDE_MATRIX_KEY: grid_point_lat_matrix_deg, LONGITUDE_MATRIX_KEY: grid_point_lng_matrix_deg} | Returns x-y and lat-long coords for a subgrid of the full model grid.
This method generates different x-y coordinates than
`nwp_model_utils.get_xy_grid_point_matrices`, because (like
`mpl_toolkits.basemap.Basemap`) this method sets false easting = false
northing = 0 metres.
:param model_name: Name of NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param first_row_in_full_grid: Row 0 in the subgrid is row
`first_row_in_full_grid` in the full grid.
:param last_row_in_full_grid: Last row in the subgrid is row
`last_row_in_full_grid` in the full grid. If you want last row in the
subgrid to equal last row in the full grid, make this -1.
:param first_column_in_full_grid: Column 0 in the subgrid is column
`first_column_in_full_grid` in the full grid.
:param last_column_in_full_grid: Last column in the subgrid is column
`last_column_in_full_grid` in the full grid. If you want last column in
the subgrid to equal last column in the full grid, make this -1.
:param grid_id: Grid for NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param basemap_object: Instance of `mpl_toolkits.basemap.Basemap` for the
given NWP model. If you don't have one, no big deal -- leave this
argument empty.
:return: coordinate_dict: Dictionary with the following keys.
coordinate_dict['grid_point_x_matrix_metres']: M-by-N numpy array of
x-coordinates.
coordinate_dict['grid_point_y_matrix_metres']: M-by-N numpy array of
y-coordinates.
coordinate_dict['grid_point_lat_matrix_deg']: M-by-N numpy array of
latitudes (deg N).
coordinate_dict['grid_point_lng_matrix_deg']: M-by-N numpy array of
longitudes (deg E). | gewittergefahr/plotting/nwp_plotting.py | _get_grid_point_coords | dopplerchase/GewitterGefahr | 26 | python | def _get_grid_point_coords(model_name, first_row_in_full_grid, last_row_in_full_grid, first_column_in_full_grid, last_column_in_full_grid, grid_id=None, basemap_object=None):
"Returns x-y and lat-long coords for a subgrid of the full model grid.\n\n This method generates different x-y coordinates than\n `nwp_model_utils.get_xy_grid_point_matrices`, because (like\n `mpl_toolkits.basemap.Basemap`) this method sets false easting = false\n northing = 0 metres.\n\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param first_row_in_full_grid: Row 0 in the subgrid is row\n `first_row_in_full_grid` in the full grid.\n :param last_row_in_full_grid: Last row in the subgrid is row\n `last_row_in_full_grid` in the full grid. If you want last row in the\n subgrid to equal last row in the full grid, make this -1.\n :param first_column_in_full_grid: Column 0 in the subgrid is column\n `first_column_in_full_grid` in the full grid.\n :param last_column_in_full_grid: Last column in the subgrid is column\n `last_column_in_full_grid` in the full grid. If you want last column in\n the subgrid to equal last column in the full grid, make this -1.\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param basemap_object: Instance of `mpl_toolkits.basemap.Basemap` for the\n given NWP model. If you don't have one, no big deal -- leave this\n argument empty.\n :return: coordinate_dict: Dictionary with the following keys.\n coordinate_dict['grid_point_x_matrix_metres']: M-by-N numpy array of\n x-coordinates.\n coordinate_dict['grid_point_y_matrix_metres']: M-by-N numpy array of\n y-coordinates.\n coordinate_dict['grid_point_lat_matrix_deg']: M-by-N numpy array of\n latitudes (deg N).\n coordinate_dict['grid_point_lng_matrix_deg']: M-by-N numpy array of\n longitudes (deg E).\n "
(num_rows_in_full_grid, num_columns_in_full_grid) = nwp_model_utils.get_grid_dimensions(model_name=model_name, grid_name=grid_id)
error_checking.assert_is_integer(first_row_in_full_grid)
error_checking.assert_is_geq(first_row_in_full_grid, 0)
error_checking.assert_is_integer(last_row_in_full_grid)
if (last_row_in_full_grid < 0):
last_row_in_full_grid += num_rows_in_full_grid
error_checking.assert_is_greater(last_row_in_full_grid, first_row_in_full_grid)
error_checking.assert_is_less_than(last_row_in_full_grid, num_rows_in_full_grid)
error_checking.assert_is_integer(first_column_in_full_grid)
error_checking.assert_is_geq(first_column_in_full_grid, 0)
error_checking.assert_is_integer(last_column_in_full_grid)
if (last_column_in_full_grid < 0):
last_column_in_full_grid += num_columns_in_full_grid
error_checking.assert_is_greater(last_column_in_full_grid, first_column_in_full_grid)
error_checking.assert_is_less_than(last_column_in_full_grid, num_columns_in_full_grid)
(grid_point_lat_matrix_deg, grid_point_lng_matrix_deg) = nwp_model_utils.get_latlng_grid_point_matrices(model_name=model_name, grid_name=grid_id)
grid_point_lat_matrix_deg = grid_point_lat_matrix_deg[(first_row_in_full_grid:(last_row_in_full_grid + 1), first_column_in_full_grid:(last_column_in_full_grid + 1))]
grid_point_lng_matrix_deg = grid_point_lng_matrix_deg[(first_row_in_full_grid:(last_row_in_full_grid + 1), first_column_in_full_grid:(last_column_in_full_grid + 1))]
if (basemap_object is None):
(standard_latitudes_deg, central_longitude_deg) = nwp_model_utils.get_projection_params(model_name)
projection_object = projections.init_lcc_projection(standard_latitudes_deg=standard_latitudes_deg, central_longitude_deg=central_longitude_deg)
(grid_point_x_matrix_metres, grid_point_y_matrix_metres) = projections.project_latlng_to_xy(latitudes_deg=grid_point_lat_matrix_deg, longitudes_deg=grid_point_lng_matrix_deg, projection_object=projection_object, false_northing_metres=0.0, false_easting_metres=0.0)
else:
(grid_point_x_matrix_metres, grid_point_y_matrix_metres) = basemap_object(grid_point_lng_matrix_deg, grid_point_lat_matrix_deg)
return {X_COORD_MATRIX_KEY: grid_point_x_matrix_metres, Y_COORD_MATRIX_KEY: grid_point_y_matrix_metres, LATITUDE_MATRIX_KEY: grid_point_lat_matrix_deg, LONGITUDE_MATRIX_KEY: grid_point_lng_matrix_deg} | def _get_grid_point_coords(model_name, first_row_in_full_grid, last_row_in_full_grid, first_column_in_full_grid, last_column_in_full_grid, grid_id=None, basemap_object=None):
"Returns x-y and lat-long coords for a subgrid of the full model grid.\n\n This method generates different x-y coordinates than\n `nwp_model_utils.get_xy_grid_point_matrices`, because (like\n `mpl_toolkits.basemap.Basemap`) this method sets false easting = false\n northing = 0 metres.\n\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param first_row_in_full_grid: Row 0 in the subgrid is row\n `first_row_in_full_grid` in the full grid.\n :param last_row_in_full_grid: Last row in the subgrid is row\n `last_row_in_full_grid` in the full grid. If you want last row in the\n subgrid to equal last row in the full grid, make this -1.\n :param first_column_in_full_grid: Column 0 in the subgrid is column\n `first_column_in_full_grid` in the full grid.\n :param last_column_in_full_grid: Last column in the subgrid is column\n `last_column_in_full_grid` in the full grid. If you want last column in\n the subgrid to equal last column in the full grid, make this -1.\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param basemap_object: Instance of `mpl_toolkits.basemap.Basemap` for the\n given NWP model. If you don't have one, no big deal -- leave this\n argument empty.\n :return: coordinate_dict: Dictionary with the following keys.\n coordinate_dict['grid_point_x_matrix_metres']: M-by-N numpy array of\n x-coordinates.\n coordinate_dict['grid_point_y_matrix_metres']: M-by-N numpy array of\n y-coordinates.\n coordinate_dict['grid_point_lat_matrix_deg']: M-by-N numpy array of\n latitudes (deg N).\n coordinate_dict['grid_point_lng_matrix_deg']: M-by-N numpy array of\n longitudes (deg E).\n "
(num_rows_in_full_grid, num_columns_in_full_grid) = nwp_model_utils.get_grid_dimensions(model_name=model_name, grid_name=grid_id)
error_checking.assert_is_integer(first_row_in_full_grid)
error_checking.assert_is_geq(first_row_in_full_grid, 0)
error_checking.assert_is_integer(last_row_in_full_grid)
if (last_row_in_full_grid < 0):
last_row_in_full_grid += num_rows_in_full_grid
error_checking.assert_is_greater(last_row_in_full_grid, first_row_in_full_grid)
error_checking.assert_is_less_than(last_row_in_full_grid, num_rows_in_full_grid)
error_checking.assert_is_integer(first_column_in_full_grid)
error_checking.assert_is_geq(first_column_in_full_grid, 0)
error_checking.assert_is_integer(last_column_in_full_grid)
if (last_column_in_full_grid < 0):
last_column_in_full_grid += num_columns_in_full_grid
error_checking.assert_is_greater(last_column_in_full_grid, first_column_in_full_grid)
error_checking.assert_is_less_than(last_column_in_full_grid, num_columns_in_full_grid)
(grid_point_lat_matrix_deg, grid_point_lng_matrix_deg) = nwp_model_utils.get_latlng_grid_point_matrices(model_name=model_name, grid_name=grid_id)
grid_point_lat_matrix_deg = grid_point_lat_matrix_deg[(first_row_in_full_grid:(last_row_in_full_grid + 1), first_column_in_full_grid:(last_column_in_full_grid + 1))]
grid_point_lng_matrix_deg = grid_point_lng_matrix_deg[(first_row_in_full_grid:(last_row_in_full_grid + 1), first_column_in_full_grid:(last_column_in_full_grid + 1))]
if (basemap_object is None):
(standard_latitudes_deg, central_longitude_deg) = nwp_model_utils.get_projection_params(model_name)
projection_object = projections.init_lcc_projection(standard_latitudes_deg=standard_latitudes_deg, central_longitude_deg=central_longitude_deg)
(grid_point_x_matrix_metres, grid_point_y_matrix_metres) = projections.project_latlng_to_xy(latitudes_deg=grid_point_lat_matrix_deg, longitudes_deg=grid_point_lng_matrix_deg, projection_object=projection_object, false_northing_metres=0.0, false_easting_metres=0.0)
else:
(grid_point_x_matrix_metres, grid_point_y_matrix_metres) = basemap_object(grid_point_lng_matrix_deg, grid_point_lat_matrix_deg)
return {X_COORD_MATRIX_KEY: grid_point_x_matrix_metres, Y_COORD_MATRIX_KEY: grid_point_y_matrix_metres, LATITUDE_MATRIX_KEY: grid_point_lat_matrix_deg, LONGITUDE_MATRIX_KEY: grid_point_lng_matrix_deg}<|docstring|>Returns x-y and lat-long coords for a subgrid of the full model grid.
This method generates different x-y coordinates than
`nwp_model_utils.get_xy_grid_point_matrices`, because (like
`mpl_toolkits.basemap.Basemap`) this method sets false easting = false
northing = 0 metres.
:param model_name: Name of NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param first_row_in_full_grid: Row 0 in the subgrid is row
`first_row_in_full_grid` in the full grid.
:param last_row_in_full_grid: Last row in the subgrid is row
`last_row_in_full_grid` in the full grid. If you want last row in the
subgrid to equal last row in the full grid, make this -1.
:param first_column_in_full_grid: Column 0 in the subgrid is column
`first_column_in_full_grid` in the full grid.
:param last_column_in_full_grid: Last column in the subgrid is column
`last_column_in_full_grid` in the full grid. If you want last column in
the subgrid to equal last column in the full grid, make this -1.
:param grid_id: Grid for NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param basemap_object: Instance of `mpl_toolkits.basemap.Basemap` for the
given NWP model. If you don't have one, no big deal -- leave this
argument empty.
:return: coordinate_dict: Dictionary with the following keys.
coordinate_dict['grid_point_x_matrix_metres']: M-by-N numpy array of
x-coordinates.
coordinate_dict['grid_point_y_matrix_metres']: M-by-N numpy array of
y-coordinates.
coordinate_dict['grid_point_lat_matrix_deg']: M-by-N numpy array of
latitudes (deg N).
coordinate_dict['grid_point_lng_matrix_deg']: M-by-N numpy array of
longitudes (deg E).<|endoftext|> |
a02c5ff6e6c6bc2c7a0ee82f7590ccde35c5c2d3dd0b264d9f970075887932a9 | def latlng_limits_to_rowcol_limits(min_latitude_deg, max_latitude_deg, min_longitude_deg, max_longitude_deg, model_name, grid_id=None):
'Converts lat-long limits to row-column limits in the given model grid.\n\n :param min_latitude_deg: Minimum latitude (deg N).\n :param max_latitude_deg: Max latitude (deg N).\n :param min_longitude_deg: Minimum longitude (deg E).\n :param max_longitude_deg: Max longitude (deg E).\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :return: row_limits: length-2 numpy array, containing min and max rows in\n model grid, respectively.\n :return: column_limits: Same but for columns.\n '
error_checking.assert_is_valid_latitude(min_latitude_deg)
error_checking.assert_is_valid_latitude(max_latitude_deg)
error_checking.assert_is_greater(max_latitude_deg, min_latitude_deg)
both_longitudes_deg = numpy.array([min_longitude_deg, max_longitude_deg])
both_longitudes_deg = lng_conversion.convert_lng_positive_in_west(both_longitudes_deg)
min_longitude_deg = both_longitudes_deg[0]
max_longitude_deg = both_longitudes_deg[1]
error_checking.assert_is_greater(max_longitude_deg, min_longitude_deg)
(grid_point_lat_matrix_deg, grid_point_lng_matrix_deg) = nwp_model_utils.get_latlng_grid_point_matrices(model_name=model_name, grid_name=grid_id)
good_lat_flag_matrix = numpy.logical_and((grid_point_lat_matrix_deg >= min_latitude_deg), (grid_point_lat_matrix_deg <= max_latitude_deg))
good_lng_flag_matrix = numpy.logical_and((grid_point_lng_matrix_deg >= min_longitude_deg), (grid_point_lng_matrix_deg <= max_longitude_deg))
(good_row_indices, good_column_indices) = numpy.where(numpy.logical_and(good_lat_flag_matrix, good_lng_flag_matrix))
row_limits = numpy.array([numpy.min(good_row_indices), numpy.max(good_row_indices)], dtype=int)
column_limits = numpy.array([numpy.min(good_column_indices), numpy.max(good_column_indices)], dtype=int)
return (row_limits, column_limits) | Converts lat-long limits to row-column limits in the given model grid.
:param min_latitude_deg: Minimum latitude (deg N).
:param max_latitude_deg: Max latitude (deg N).
:param min_longitude_deg: Minimum longitude (deg E).
:param max_longitude_deg: Max longitude (deg E).
:param model_name: Name of NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param grid_id: Grid for NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:return: row_limits: length-2 numpy array, containing min and max rows in
model grid, respectively.
:return: column_limits: Same but for columns. | gewittergefahr/plotting/nwp_plotting.py | latlng_limits_to_rowcol_limits | dopplerchase/GewitterGefahr | 26 | python | def latlng_limits_to_rowcol_limits(min_latitude_deg, max_latitude_deg, min_longitude_deg, max_longitude_deg, model_name, grid_id=None):
'Converts lat-long limits to row-column limits in the given model grid.\n\n :param min_latitude_deg: Minimum latitude (deg N).\n :param max_latitude_deg: Max latitude (deg N).\n :param min_longitude_deg: Minimum longitude (deg E).\n :param max_longitude_deg: Max longitude (deg E).\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :return: row_limits: length-2 numpy array, containing min and max rows in\n model grid, respectively.\n :return: column_limits: Same but for columns.\n '
error_checking.assert_is_valid_latitude(min_latitude_deg)
error_checking.assert_is_valid_latitude(max_latitude_deg)
error_checking.assert_is_greater(max_latitude_deg, min_latitude_deg)
both_longitudes_deg = numpy.array([min_longitude_deg, max_longitude_deg])
both_longitudes_deg = lng_conversion.convert_lng_positive_in_west(both_longitudes_deg)
min_longitude_deg = both_longitudes_deg[0]
max_longitude_deg = both_longitudes_deg[1]
error_checking.assert_is_greater(max_longitude_deg, min_longitude_deg)
(grid_point_lat_matrix_deg, grid_point_lng_matrix_deg) = nwp_model_utils.get_latlng_grid_point_matrices(model_name=model_name, grid_name=grid_id)
good_lat_flag_matrix = numpy.logical_and((grid_point_lat_matrix_deg >= min_latitude_deg), (grid_point_lat_matrix_deg <= max_latitude_deg))
good_lng_flag_matrix = numpy.logical_and((grid_point_lng_matrix_deg >= min_longitude_deg), (grid_point_lng_matrix_deg <= max_longitude_deg))
(good_row_indices, good_column_indices) = numpy.where(numpy.logical_and(good_lat_flag_matrix, good_lng_flag_matrix))
row_limits = numpy.array([numpy.min(good_row_indices), numpy.max(good_row_indices)], dtype=int)
column_limits = numpy.array([numpy.min(good_column_indices), numpy.max(good_column_indices)], dtype=int)
return (row_limits, column_limits) | def latlng_limits_to_rowcol_limits(min_latitude_deg, max_latitude_deg, min_longitude_deg, max_longitude_deg, model_name, grid_id=None):
'Converts lat-long limits to row-column limits in the given model grid.\n\n :param min_latitude_deg: Minimum latitude (deg N).\n :param max_latitude_deg: Max latitude (deg N).\n :param min_longitude_deg: Minimum longitude (deg E).\n :param max_longitude_deg: Max longitude (deg E).\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :return: row_limits: length-2 numpy array, containing min and max rows in\n model grid, respectively.\n :return: column_limits: Same but for columns.\n '
error_checking.assert_is_valid_latitude(min_latitude_deg)
error_checking.assert_is_valid_latitude(max_latitude_deg)
error_checking.assert_is_greater(max_latitude_deg, min_latitude_deg)
both_longitudes_deg = numpy.array([min_longitude_deg, max_longitude_deg])
both_longitudes_deg = lng_conversion.convert_lng_positive_in_west(both_longitudes_deg)
min_longitude_deg = both_longitudes_deg[0]
max_longitude_deg = both_longitudes_deg[1]
error_checking.assert_is_greater(max_longitude_deg, min_longitude_deg)
(grid_point_lat_matrix_deg, grid_point_lng_matrix_deg) = nwp_model_utils.get_latlng_grid_point_matrices(model_name=model_name, grid_name=grid_id)
good_lat_flag_matrix = numpy.logical_and((grid_point_lat_matrix_deg >= min_latitude_deg), (grid_point_lat_matrix_deg <= max_latitude_deg))
good_lng_flag_matrix = numpy.logical_and((grid_point_lng_matrix_deg >= min_longitude_deg), (grid_point_lng_matrix_deg <= max_longitude_deg))
(good_row_indices, good_column_indices) = numpy.where(numpy.logical_and(good_lat_flag_matrix, good_lng_flag_matrix))
row_limits = numpy.array([numpy.min(good_row_indices), numpy.max(good_row_indices)], dtype=int)
column_limits = numpy.array([numpy.min(good_column_indices), numpy.max(good_column_indices)], dtype=int)
return (row_limits, column_limits)<|docstring|>Converts lat-long limits to row-column limits in the given model grid.
:param min_latitude_deg: Minimum latitude (deg N).
:param max_latitude_deg: Max latitude (deg N).
:param min_longitude_deg: Minimum longitude (deg E).
:param max_longitude_deg: Max longitude (deg E).
:param model_name: Name of NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param grid_id: Grid for NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:return: row_limits: length-2 numpy array, containing min and max rows in
model grid, respectively.
:return: column_limits: Same but for columns.<|endoftext|> |
2dc5088b599c02d439aa4684d390671a5b14c71075ec83f003fdd455f48fcbc5 | def init_basemap(model_name, grid_id=None, figure_width_inches=DEFAULT_FIGURE_WIDTH_INCHES, figure_height_inches=DEFAULT_FIGURE_HEIGHT_INCHES, resolution_string=DEFAULT_BOUNDARY_RESOLUTION_STRING, first_row_in_full_grid=0, last_row_in_full_grid=(- 1), first_column_in_full_grid=0, last_column_in_full_grid=(- 1)):
'Initializes basemap with the given model\'s projection.\n\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param figure_width_inches: Figure width.\n :param figure_height_inches: Figure height.\n :param resolution_string: Resolution for boundaries (e.g., coastlines and\n political borders). Options are "c" for crude, "l" for low, "i" for\n intermediate, "h" for high, and "f" for full. Keep in mind that higher-\n resolution boundaries take much longer to draw.\n :param first_row_in_full_grid: See doc for `_get_grid_point_coords`.\n :param last_row_in_full_grid: Same.\n :param first_column_in_full_grid: Same.\n :param last_column_in_full_grid: Same.\n :return: figure_object: Instance of `matplotlib.figure.Figure`.\n :return: axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.\n :return: basemap_object: Instance of `mpl_toolkits.basemap.Basemap`.\n '
error_checking.assert_is_greater(figure_width_inches, 0.0)
error_checking.assert_is_greater(figure_height_inches, 0.0)
error_checking.assert_is_string(resolution_string)
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=last_row_in_full_grid, first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=last_column_in_full_grid)
grid_point_x_matrix_metres = coordinate_dict[X_COORD_MATRIX_KEY]
x_spacing_metres = (grid_point_x_matrix_metres[(0, 1)] - grid_point_x_matrix_metres[(0, 0)])
x_min_metres = (grid_point_x_matrix_metres[(0, 0)] - (x_spacing_metres / 2))
x_max_metres = (grid_point_x_matrix_metres[((- 1), (- 1))] + (x_spacing_metres / 2))
grid_point_y_matrix_metres = coordinate_dict[Y_COORD_MATRIX_KEY]
y_spacing_metres = (grid_point_y_matrix_metres[(1, 0)] - grid_point_y_matrix_metres[(0, 0)])
y_min_metres = (grid_point_y_matrix_metres[(0, 0)] - (y_spacing_metres / 2))
y_max_metres = (grid_point_y_matrix_metres[((- 1), (- 1))] + (y_spacing_metres / 2))
(figure_object, axes_object) = pyplot.subplots(1, 1, figsize=(figure_width_inches, figure_height_inches))
(standard_latitudes_deg, central_longitude_deg) = nwp_model_utils.get_projection_params(model_name)
basemap_object = Basemap(projection='lcc', lat_1=standard_latitudes_deg[0], lat_2=standard_latitudes_deg[1], lon_0=central_longitude_deg, rsphere=projections.DEFAULT_EARTH_RADIUS_METRES, ellps='sphere', resolution=resolution_string, llcrnrx=x_min_metres, llcrnry=y_min_metres, urcrnrx=x_max_metres, urcrnry=y_max_metres)
return (figure_object, axes_object, basemap_object) | Initializes basemap with the given model's projection.
:param model_name: Name of NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param grid_id: Grid for NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param figure_width_inches: Figure width.
:param figure_height_inches: Figure height.
:param resolution_string: Resolution for boundaries (e.g., coastlines and
political borders). Options are "c" for crude, "l" for low, "i" for
intermediate, "h" for high, and "f" for full. Keep in mind that higher-
resolution boundaries take much longer to draw.
:param first_row_in_full_grid: See doc for `_get_grid_point_coords`.
:param last_row_in_full_grid: Same.
:param first_column_in_full_grid: Same.
:param last_column_in_full_grid: Same.
:return: figure_object: Instance of `matplotlib.figure.Figure`.
:return: axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.
:return: basemap_object: Instance of `mpl_toolkits.basemap.Basemap`. | gewittergefahr/plotting/nwp_plotting.py | init_basemap | dopplerchase/GewitterGefahr | 26 | python | def init_basemap(model_name, grid_id=None, figure_width_inches=DEFAULT_FIGURE_WIDTH_INCHES, figure_height_inches=DEFAULT_FIGURE_HEIGHT_INCHES, resolution_string=DEFAULT_BOUNDARY_RESOLUTION_STRING, first_row_in_full_grid=0, last_row_in_full_grid=(- 1), first_column_in_full_grid=0, last_column_in_full_grid=(- 1)):
'Initializes basemap with the given model\'s projection.\n\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param figure_width_inches: Figure width.\n :param figure_height_inches: Figure height.\n :param resolution_string: Resolution for boundaries (e.g., coastlines and\n political borders). Options are "c" for crude, "l" for low, "i" for\n intermediate, "h" for high, and "f" for full. Keep in mind that higher-\n resolution boundaries take much longer to draw.\n :param first_row_in_full_grid: See doc for `_get_grid_point_coords`.\n :param last_row_in_full_grid: Same.\n :param first_column_in_full_grid: Same.\n :param last_column_in_full_grid: Same.\n :return: figure_object: Instance of `matplotlib.figure.Figure`.\n :return: axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.\n :return: basemap_object: Instance of `mpl_toolkits.basemap.Basemap`.\n '
error_checking.assert_is_greater(figure_width_inches, 0.0)
error_checking.assert_is_greater(figure_height_inches, 0.0)
error_checking.assert_is_string(resolution_string)
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=last_row_in_full_grid, first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=last_column_in_full_grid)
grid_point_x_matrix_metres = coordinate_dict[X_COORD_MATRIX_KEY]
x_spacing_metres = (grid_point_x_matrix_metres[(0, 1)] - grid_point_x_matrix_metres[(0, 0)])
x_min_metres = (grid_point_x_matrix_metres[(0, 0)] - (x_spacing_metres / 2))
x_max_metres = (grid_point_x_matrix_metres[((- 1), (- 1))] + (x_spacing_metres / 2))
grid_point_y_matrix_metres = coordinate_dict[Y_COORD_MATRIX_KEY]
y_spacing_metres = (grid_point_y_matrix_metres[(1, 0)] - grid_point_y_matrix_metres[(0, 0)])
y_min_metres = (grid_point_y_matrix_metres[(0, 0)] - (y_spacing_metres / 2))
y_max_metres = (grid_point_y_matrix_metres[((- 1), (- 1))] + (y_spacing_metres / 2))
(figure_object, axes_object) = pyplot.subplots(1, 1, figsize=(figure_width_inches, figure_height_inches))
(standard_latitudes_deg, central_longitude_deg) = nwp_model_utils.get_projection_params(model_name)
basemap_object = Basemap(projection='lcc', lat_1=standard_latitudes_deg[0], lat_2=standard_latitudes_deg[1], lon_0=central_longitude_deg, rsphere=projections.DEFAULT_EARTH_RADIUS_METRES, ellps='sphere', resolution=resolution_string, llcrnrx=x_min_metres, llcrnry=y_min_metres, urcrnrx=x_max_metres, urcrnry=y_max_metres)
return (figure_object, axes_object, basemap_object) | def init_basemap(model_name, grid_id=None, figure_width_inches=DEFAULT_FIGURE_WIDTH_INCHES, figure_height_inches=DEFAULT_FIGURE_HEIGHT_INCHES, resolution_string=DEFAULT_BOUNDARY_RESOLUTION_STRING, first_row_in_full_grid=0, last_row_in_full_grid=(- 1), first_column_in_full_grid=0, last_column_in_full_grid=(- 1)):
'Initializes basemap with the given model\'s projection.\n\n :param model_name: Name of NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param grid_id: Grid for NWP model (must be accepted by\n `nwp_model_utils.check_grid_name`).\n :param figure_width_inches: Figure width.\n :param figure_height_inches: Figure height.\n :param resolution_string: Resolution for boundaries (e.g., coastlines and\n political borders). Options are "c" for crude, "l" for low, "i" for\n intermediate, "h" for high, and "f" for full. Keep in mind that higher-\n resolution boundaries take much longer to draw.\n :param first_row_in_full_grid: See doc for `_get_grid_point_coords`.\n :param last_row_in_full_grid: Same.\n :param first_column_in_full_grid: Same.\n :param last_column_in_full_grid: Same.\n :return: figure_object: Instance of `matplotlib.figure.Figure`.\n :return: axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.\n :return: basemap_object: Instance of `mpl_toolkits.basemap.Basemap`.\n '
error_checking.assert_is_greater(figure_width_inches, 0.0)
error_checking.assert_is_greater(figure_height_inches, 0.0)
error_checking.assert_is_string(resolution_string)
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=last_row_in_full_grid, first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=last_column_in_full_grid)
grid_point_x_matrix_metres = coordinate_dict[X_COORD_MATRIX_KEY]
x_spacing_metres = (grid_point_x_matrix_metres[(0, 1)] - grid_point_x_matrix_metres[(0, 0)])
x_min_metres = (grid_point_x_matrix_metres[(0, 0)] - (x_spacing_metres / 2))
x_max_metres = (grid_point_x_matrix_metres[((- 1), (- 1))] + (x_spacing_metres / 2))
grid_point_y_matrix_metres = coordinate_dict[Y_COORD_MATRIX_KEY]
y_spacing_metres = (grid_point_y_matrix_metres[(1, 0)] - grid_point_y_matrix_metres[(0, 0)])
y_min_metres = (grid_point_y_matrix_metres[(0, 0)] - (y_spacing_metres / 2))
y_max_metres = (grid_point_y_matrix_metres[((- 1), (- 1))] + (y_spacing_metres / 2))
(figure_object, axes_object) = pyplot.subplots(1, 1, figsize=(figure_width_inches, figure_height_inches))
(standard_latitudes_deg, central_longitude_deg) = nwp_model_utils.get_projection_params(model_name)
basemap_object = Basemap(projection='lcc', lat_1=standard_latitudes_deg[0], lat_2=standard_latitudes_deg[1], lon_0=central_longitude_deg, rsphere=projections.DEFAULT_EARTH_RADIUS_METRES, ellps='sphere', resolution=resolution_string, llcrnrx=x_min_metres, llcrnry=y_min_metres, urcrnrx=x_max_metres, urcrnry=y_max_metres)
return (figure_object, axes_object, basemap_object)<|docstring|>Initializes basemap with the given model's projection.
:param model_name: Name of NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param grid_id: Grid for NWP model (must be accepted by
`nwp_model_utils.check_grid_name`).
:param figure_width_inches: Figure width.
:param figure_height_inches: Figure height.
:param resolution_string: Resolution for boundaries (e.g., coastlines and
political borders). Options are "c" for crude, "l" for low, "i" for
intermediate, "h" for high, and "f" for full. Keep in mind that higher-
resolution boundaries take much longer to draw.
:param first_row_in_full_grid: See doc for `_get_grid_point_coords`.
:param last_row_in_full_grid: Same.
:param first_column_in_full_grid: Same.
:param last_column_in_full_grid: Same.
:return: figure_object: Instance of `matplotlib.figure.Figure`.
:return: axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.
:return: basemap_object: Instance of `mpl_toolkits.basemap.Basemap`.<|endoftext|> |
0a04e7f42e7470750206b819635c2860e36e65450d443a54ad9e25cdf8dc63cf | def plot_subgrid(field_matrix, model_name, axes_object, basemap_object, colour_map_object, colour_norm_object=None, min_colour_value=None, max_colour_value=None, grid_id=None, first_row_in_full_grid=0, first_column_in_full_grid=0, opacity=1.0):
'Plots colour map on subset of the full model grid.\n\n M = number of rows in subgrid\n N = number of columns in subgrid\n\n If `colour_norm_object is None`, both `min_colour_value` and\n `max_colour_value` must be specified.\n\n :param field_matrix: M-by-N numpy array of data values.\n :param model_name: See doc for `_get_grid_point_coords`.\n :param axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.\n Will plot on these axes.\n :param basemap_object: Instance of `mpl_toolkits.basemap.Basemap`. Will be\n used to convert between x-y and lat-long coordinates.\n :param colour_map_object: Instance of `matplotlib.pyplot.cm`. Determines\n colours in scheme.\n :param colour_norm_object: Instance of `matplotlib.colors.BoundaryNorm`.\n Determines boundaries in colour scheme.\n :param min_colour_value: [used only if `colour_norm_object is None`]\n Minimum data value in colour scheme.\n :param max_colour_value: [used only if `colour_norm_object is None`]\n Max data value in colour scheme.\n :param grid_id: See doc for `_get_grid_point_coords`.\n :param first_row_in_full_grid: Row offset. field_matrix[0, 0] is at row m\n in the full model grid, where m = `first_row_in_full_grid`.\n :param first_column_in_full_grid: Same but for columns.\n :param opacity: Opacity of colour map (in range 0...1).\n '
if (colour_norm_object is None):
error_checking.assert_is_greater(max_colour_value, min_colour_value)
colour_norm_object = matplotlib.colors.Normalize(vmin=min_colour_value, vmax=max_colour_value, clip=False)
error_checking.assert_is_real_numpy_array(field_matrix)
error_checking.assert_is_numpy_array(field_matrix, num_dimensions=2)
num_rows_in_subgrid = field_matrix.shape[0]
num_columns_in_subgrid = field_matrix.shape[1]
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=((first_row_in_full_grid + num_rows_in_subgrid) - 1), first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=((first_column_in_full_grid + num_columns_in_subgrid) - 1), basemap_object=basemap_object)
grid_point_x_matrix_metres = coordinate_dict[X_COORD_MATRIX_KEY]
grid_point_y_matrix_metres = coordinate_dict[Y_COORD_MATRIX_KEY]
x_spacing_metres = ((grid_point_x_matrix_metres[(0, (- 1))] - grid_point_x_matrix_metres[(0, 0)]) / (num_columns_in_subgrid - 1))
y_spacing_metres = ((grid_point_y_matrix_metres[((- 1), 0)] - grid_point_y_matrix_metres[(0, 0)]) / (num_rows_in_subgrid - 1))
(field_matrix_at_edges, grid_cell_edges_x_metres, grid_cell_edges_y_metres) = grids.xy_field_grid_points_to_edges(field_matrix=field_matrix, x_min_metres=grid_point_x_matrix_metres[(0, 0)], y_min_metres=grid_point_y_matrix_metres[(0, 0)], x_spacing_metres=x_spacing_metres, y_spacing_metres=y_spacing_metres)
field_matrix_at_edges = numpy.ma.masked_where(numpy.isnan(field_matrix_at_edges), field_matrix_at_edges)
if hasattr(colour_norm_object, 'boundaries'):
min_colour_value = colour_norm_object.boundaries[0]
max_colour_value = colour_norm_object.boundaries[(- 1)]
else:
min_colour_value = colour_norm_object.vmin
max_colour_value = colour_norm_object.vmax
basemap_object.pcolormesh(grid_cell_edges_x_metres, grid_cell_edges_y_metres, field_matrix_at_edges, cmap=colour_map_object, norm=colour_norm_object, vmin=min_colour_value, vmax=max_colour_value, shading='flat', edgecolors='None', ax=axes_object, zorder=(- 1000000000000.0), alpha=opacity) | Plots colour map on subset of the full model grid.
M = number of rows in subgrid
N = number of columns in subgrid
If `colour_norm_object is None`, both `min_colour_value` and
`max_colour_value` must be specified.
:param field_matrix: M-by-N numpy array of data values.
:param model_name: See doc for `_get_grid_point_coords`.
:param axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.
Will plot on these axes.
:param basemap_object: Instance of `mpl_toolkits.basemap.Basemap`. Will be
used to convert between x-y and lat-long coordinates.
:param colour_map_object: Instance of `matplotlib.pyplot.cm`. Determines
colours in scheme.
:param colour_norm_object: Instance of `matplotlib.colors.BoundaryNorm`.
Determines boundaries in colour scheme.
:param min_colour_value: [used only if `colour_norm_object is None`]
Minimum data value in colour scheme.
:param max_colour_value: [used only if `colour_norm_object is None`]
Max data value in colour scheme.
:param grid_id: See doc for `_get_grid_point_coords`.
:param first_row_in_full_grid: Row offset. field_matrix[0, 0] is at row m
in the full model grid, where m = `first_row_in_full_grid`.
:param first_column_in_full_grid: Same but for columns.
:param opacity: Opacity of colour map (in range 0...1). | gewittergefahr/plotting/nwp_plotting.py | plot_subgrid | dopplerchase/GewitterGefahr | 26 | python | def plot_subgrid(field_matrix, model_name, axes_object, basemap_object, colour_map_object, colour_norm_object=None, min_colour_value=None, max_colour_value=None, grid_id=None, first_row_in_full_grid=0, first_column_in_full_grid=0, opacity=1.0):
'Plots colour map on subset of the full model grid.\n\n M = number of rows in subgrid\n N = number of columns in subgrid\n\n If `colour_norm_object is None`, both `min_colour_value` and\n `max_colour_value` must be specified.\n\n :param field_matrix: M-by-N numpy array of data values.\n :param model_name: See doc for `_get_grid_point_coords`.\n :param axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.\n Will plot on these axes.\n :param basemap_object: Instance of `mpl_toolkits.basemap.Basemap`. Will be\n used to convert between x-y and lat-long coordinates.\n :param colour_map_object: Instance of `matplotlib.pyplot.cm`. Determines\n colours in scheme.\n :param colour_norm_object: Instance of `matplotlib.colors.BoundaryNorm`.\n Determines boundaries in colour scheme.\n :param min_colour_value: [used only if `colour_norm_object is None`]\n Minimum data value in colour scheme.\n :param max_colour_value: [used only if `colour_norm_object is None`]\n Max data value in colour scheme.\n :param grid_id: See doc for `_get_grid_point_coords`.\n :param first_row_in_full_grid: Row offset. field_matrix[0, 0] is at row m\n in the full model grid, where m = `first_row_in_full_grid`.\n :param first_column_in_full_grid: Same but for columns.\n :param opacity: Opacity of colour map (in range 0...1).\n '
if (colour_norm_object is None):
error_checking.assert_is_greater(max_colour_value, min_colour_value)
colour_norm_object = matplotlib.colors.Normalize(vmin=min_colour_value, vmax=max_colour_value, clip=False)
error_checking.assert_is_real_numpy_array(field_matrix)
error_checking.assert_is_numpy_array(field_matrix, num_dimensions=2)
num_rows_in_subgrid = field_matrix.shape[0]
num_columns_in_subgrid = field_matrix.shape[1]
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=((first_row_in_full_grid + num_rows_in_subgrid) - 1), first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=((first_column_in_full_grid + num_columns_in_subgrid) - 1), basemap_object=basemap_object)
grid_point_x_matrix_metres = coordinate_dict[X_COORD_MATRIX_KEY]
grid_point_y_matrix_metres = coordinate_dict[Y_COORD_MATRIX_KEY]
x_spacing_metres = ((grid_point_x_matrix_metres[(0, (- 1))] - grid_point_x_matrix_metres[(0, 0)]) / (num_columns_in_subgrid - 1))
y_spacing_metres = ((grid_point_y_matrix_metres[((- 1), 0)] - grid_point_y_matrix_metres[(0, 0)]) / (num_rows_in_subgrid - 1))
(field_matrix_at_edges, grid_cell_edges_x_metres, grid_cell_edges_y_metres) = grids.xy_field_grid_points_to_edges(field_matrix=field_matrix, x_min_metres=grid_point_x_matrix_metres[(0, 0)], y_min_metres=grid_point_y_matrix_metres[(0, 0)], x_spacing_metres=x_spacing_metres, y_spacing_metres=y_spacing_metres)
field_matrix_at_edges = numpy.ma.masked_where(numpy.isnan(field_matrix_at_edges), field_matrix_at_edges)
if hasattr(colour_norm_object, 'boundaries'):
min_colour_value = colour_norm_object.boundaries[0]
max_colour_value = colour_norm_object.boundaries[(- 1)]
else:
min_colour_value = colour_norm_object.vmin
max_colour_value = colour_norm_object.vmax
basemap_object.pcolormesh(grid_cell_edges_x_metres, grid_cell_edges_y_metres, field_matrix_at_edges, cmap=colour_map_object, norm=colour_norm_object, vmin=min_colour_value, vmax=max_colour_value, shading='flat', edgecolors='None', ax=axes_object, zorder=(- 1000000000000.0), alpha=opacity) | def plot_subgrid(field_matrix, model_name, axes_object, basemap_object, colour_map_object, colour_norm_object=None, min_colour_value=None, max_colour_value=None, grid_id=None, first_row_in_full_grid=0, first_column_in_full_grid=0, opacity=1.0):
'Plots colour map on subset of the full model grid.\n\n M = number of rows in subgrid\n N = number of columns in subgrid\n\n If `colour_norm_object is None`, both `min_colour_value` and\n `max_colour_value` must be specified.\n\n :param field_matrix: M-by-N numpy array of data values.\n :param model_name: See doc for `_get_grid_point_coords`.\n :param axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.\n Will plot on these axes.\n :param basemap_object: Instance of `mpl_toolkits.basemap.Basemap`. Will be\n used to convert between x-y and lat-long coordinates.\n :param colour_map_object: Instance of `matplotlib.pyplot.cm`. Determines\n colours in scheme.\n :param colour_norm_object: Instance of `matplotlib.colors.BoundaryNorm`.\n Determines boundaries in colour scheme.\n :param min_colour_value: [used only if `colour_norm_object is None`]\n Minimum data value in colour scheme.\n :param max_colour_value: [used only if `colour_norm_object is None`]\n Max data value in colour scheme.\n :param grid_id: See doc for `_get_grid_point_coords`.\n :param first_row_in_full_grid: Row offset. field_matrix[0, 0] is at row m\n in the full model grid, where m = `first_row_in_full_grid`.\n :param first_column_in_full_grid: Same but for columns.\n :param opacity: Opacity of colour map (in range 0...1).\n '
if (colour_norm_object is None):
error_checking.assert_is_greater(max_colour_value, min_colour_value)
colour_norm_object = matplotlib.colors.Normalize(vmin=min_colour_value, vmax=max_colour_value, clip=False)
error_checking.assert_is_real_numpy_array(field_matrix)
error_checking.assert_is_numpy_array(field_matrix, num_dimensions=2)
num_rows_in_subgrid = field_matrix.shape[0]
num_columns_in_subgrid = field_matrix.shape[1]
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=((first_row_in_full_grid + num_rows_in_subgrid) - 1), first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=((first_column_in_full_grid + num_columns_in_subgrid) - 1), basemap_object=basemap_object)
grid_point_x_matrix_metres = coordinate_dict[X_COORD_MATRIX_KEY]
grid_point_y_matrix_metres = coordinate_dict[Y_COORD_MATRIX_KEY]
x_spacing_metres = ((grid_point_x_matrix_metres[(0, (- 1))] - grid_point_x_matrix_metres[(0, 0)]) / (num_columns_in_subgrid - 1))
y_spacing_metres = ((grid_point_y_matrix_metres[((- 1), 0)] - grid_point_y_matrix_metres[(0, 0)]) / (num_rows_in_subgrid - 1))
(field_matrix_at_edges, grid_cell_edges_x_metres, grid_cell_edges_y_metres) = grids.xy_field_grid_points_to_edges(field_matrix=field_matrix, x_min_metres=grid_point_x_matrix_metres[(0, 0)], y_min_metres=grid_point_y_matrix_metres[(0, 0)], x_spacing_metres=x_spacing_metres, y_spacing_metres=y_spacing_metres)
field_matrix_at_edges = numpy.ma.masked_where(numpy.isnan(field_matrix_at_edges), field_matrix_at_edges)
if hasattr(colour_norm_object, 'boundaries'):
min_colour_value = colour_norm_object.boundaries[0]
max_colour_value = colour_norm_object.boundaries[(- 1)]
else:
min_colour_value = colour_norm_object.vmin
max_colour_value = colour_norm_object.vmax
basemap_object.pcolormesh(grid_cell_edges_x_metres, grid_cell_edges_y_metres, field_matrix_at_edges, cmap=colour_map_object, norm=colour_norm_object, vmin=min_colour_value, vmax=max_colour_value, shading='flat', edgecolors='None', ax=axes_object, zorder=(- 1000000000000.0), alpha=opacity)<|docstring|>Plots colour map on subset of the full model grid.
M = number of rows in subgrid
N = number of columns in subgrid
If `colour_norm_object is None`, both `min_colour_value` and
`max_colour_value` must be specified.
:param field_matrix: M-by-N numpy array of data values.
:param model_name: See doc for `_get_grid_point_coords`.
:param axes_object: Instance of `matplotlib.axes._subplots.AxesSubplot`.
Will plot on these axes.
:param basemap_object: Instance of `mpl_toolkits.basemap.Basemap`. Will be
used to convert between x-y and lat-long coordinates.
:param colour_map_object: Instance of `matplotlib.pyplot.cm`. Determines
colours in scheme.
:param colour_norm_object: Instance of `matplotlib.colors.BoundaryNorm`.
Determines boundaries in colour scheme.
:param min_colour_value: [used only if `colour_norm_object is None`]
Minimum data value in colour scheme.
:param max_colour_value: [used only if `colour_norm_object is None`]
Max data value in colour scheme.
:param grid_id: See doc for `_get_grid_point_coords`.
:param first_row_in_full_grid: Row offset. field_matrix[0, 0] is at row m
in the full model grid, where m = `first_row_in_full_grid`.
:param first_column_in_full_grid: Same but for columns.
:param opacity: Opacity of colour map (in range 0...1).<|endoftext|> |
0eb68c90ef12200b65d196b76e26d3ec9442e54ac72b301be52783d2caf0cd34 | def plot_wind_barbs_on_subgrid(u_wind_matrix_m_s01, v_wind_matrix_m_s01, model_name, axes_object, basemap_object, grid_id=None, first_row_in_full_grid=0, first_column_in_full_grid=0, plot_every_k_rows=1, plot_every_k_columns=1, barb_length=wind_plotting.DEFAULT_BARB_LENGTH, empty_barb_radius=wind_plotting.DEFAULT_EMPTY_BARB_RADIUS, fill_empty_barb=wind_plotting.FILL_EMPTY_BARB_DEFAULT, colour_map=wind_plotting.DEFAULT_COLOUR_MAP, colour_minimum_kt=wind_plotting.DEFAULT_COLOUR_MINIMUM_KT, colour_maximum_kt=wind_plotting.DEFAULT_COLOUR_MAXIMUM_KT):
'Plots wind barbs over subgrid.\n\n :param u_wind_matrix_m_s01: M-by-N numpy array of zonal wind speeds (metres\n per second).\n :param v_wind_matrix_m_s01: M-by-N numpy array of meridional wind speeds\n (metres per second).\n :param model_name: See doc for `plot_subgrid`.\n :param axes_object: Same.\n :param basemap_object: Same.\n :param grid_id: Same.\n :param first_row_in_full_grid: Row 0 in the subgrid (i.e., row 0 in\n `u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is row\n `first_row_in_full_grid` in the full grid).\n :param first_column_in_full_grid: Column 0 in the subgrid (i.e., column 0 in\n `u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is column\n `first_column_in_full_grid` in the full grid).\n :param plot_every_k_rows: Wind barbs will be plotted for every [k]th row in\n the subgrid, where k = `plot_every_k_rows`. For example, if\n `plot_every_k_rows = 2`, wind barbs will be plotted for rows 0, 2, 4,\n etc.\n :param plot_every_k_columns: Same as above, but for columns.\n :param barb_length: See doc for `wind_plotting.plot_wind_barbs`.\n :param empty_barb_radius: Same.\n :param fill_empty_barb: Same.\n :param colour_map: Same.\n :param colour_minimum_kt: Same.\n :param colour_maximum_kt: Same.\n '
error_checking.assert_is_real_numpy_array(u_wind_matrix_m_s01)
error_checking.assert_is_numpy_array(u_wind_matrix_m_s01, num_dimensions=2)
error_checking.assert_is_real_numpy_array(v_wind_matrix_m_s01)
these_expected_dim = numpy.array(u_wind_matrix_m_s01.shape, dtype=int)
error_checking.assert_is_numpy_array(v_wind_matrix_m_s01, exact_dimensions=these_expected_dim)
error_checking.assert_is_integer(plot_every_k_rows)
error_checking.assert_is_geq(plot_every_k_rows, 1)
error_checking.assert_is_integer(plot_every_k_columns)
error_checking.assert_is_geq(plot_every_k_columns, 1)
num_rows_in_subgrid = u_wind_matrix_m_s01.shape[0]
num_columns_in_subgrid = u_wind_matrix_m_s01.shape[1]
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=((first_row_in_full_grid + num_rows_in_subgrid) - 1), first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=((first_column_in_full_grid + num_columns_in_subgrid) - 1), basemap_object=basemap_object)
grid_point_lat_matrix_deg = coordinate_dict[LATITUDE_MATRIX_KEY]
grid_point_lng_matrix_deg = coordinate_dict[LONGITUDE_MATRIX_KEY]
u_wind_matrix_m_s01 = u_wind_matrix_m_s01[(::plot_every_k_rows, ::plot_every_k_columns)]
v_wind_matrix_m_s01 = v_wind_matrix_m_s01[(::plot_every_k_rows, ::plot_every_k_columns)]
grid_point_lat_matrix_deg = grid_point_lat_matrix_deg[(::plot_every_k_rows, ::plot_every_k_columns)]
grid_point_lng_matrix_deg = grid_point_lng_matrix_deg[(::plot_every_k_rows, ::plot_every_k_columns)]
num_wind_barbs = u_wind_matrix_m_s01.size
u_winds_m_s01 = numpy.reshape(u_wind_matrix_m_s01, num_wind_barbs)
v_winds_m_s01 = numpy.reshape(v_wind_matrix_m_s01, num_wind_barbs)
latitudes_deg = numpy.reshape(grid_point_lat_matrix_deg, num_wind_barbs)
longitudes_deg = numpy.reshape(grid_point_lng_matrix_deg, num_wind_barbs)
nan_flags = numpy.logical_or(numpy.isnan(u_winds_m_s01), numpy.isnan(v_winds_m_s01))
real_indices = numpy.where(numpy.invert(nan_flags))[0]
wind_plotting.plot_wind_barbs(basemap_object=basemap_object, axes_object=axes_object, latitudes_deg=latitudes_deg[real_indices], longitudes_deg=longitudes_deg[real_indices], u_winds_m_s01=u_winds_m_s01[real_indices], v_winds_m_s01=v_winds_m_s01[real_indices], barb_length=barb_length, empty_barb_radius=empty_barb_radius, fill_empty_barb=fill_empty_barb, colour_map=colour_map, colour_minimum_kt=colour_minimum_kt, colour_maximum_kt=colour_maximum_kt) | Plots wind barbs over subgrid.
:param u_wind_matrix_m_s01: M-by-N numpy array of zonal wind speeds (metres
per second).
:param v_wind_matrix_m_s01: M-by-N numpy array of meridional wind speeds
(metres per second).
:param model_name: See doc for `plot_subgrid`.
:param axes_object: Same.
:param basemap_object: Same.
:param grid_id: Same.
:param first_row_in_full_grid: Row 0 in the subgrid (i.e., row 0 in
`u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is row
`first_row_in_full_grid` in the full grid).
:param first_column_in_full_grid: Column 0 in the subgrid (i.e., column 0 in
`u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is column
`first_column_in_full_grid` in the full grid).
:param plot_every_k_rows: Wind barbs will be plotted for every [k]th row in
the subgrid, where k = `plot_every_k_rows`. For example, if
`plot_every_k_rows = 2`, wind barbs will be plotted for rows 0, 2, 4,
etc.
:param plot_every_k_columns: Same as above, but for columns.
:param barb_length: See doc for `wind_plotting.plot_wind_barbs`.
:param empty_barb_radius: Same.
:param fill_empty_barb: Same.
:param colour_map: Same.
:param colour_minimum_kt: Same.
:param colour_maximum_kt: Same. | gewittergefahr/plotting/nwp_plotting.py | plot_wind_barbs_on_subgrid | dopplerchase/GewitterGefahr | 26 | python | def plot_wind_barbs_on_subgrid(u_wind_matrix_m_s01, v_wind_matrix_m_s01, model_name, axes_object, basemap_object, grid_id=None, first_row_in_full_grid=0, first_column_in_full_grid=0, plot_every_k_rows=1, plot_every_k_columns=1, barb_length=wind_plotting.DEFAULT_BARB_LENGTH, empty_barb_radius=wind_plotting.DEFAULT_EMPTY_BARB_RADIUS, fill_empty_barb=wind_plotting.FILL_EMPTY_BARB_DEFAULT, colour_map=wind_plotting.DEFAULT_COLOUR_MAP, colour_minimum_kt=wind_plotting.DEFAULT_COLOUR_MINIMUM_KT, colour_maximum_kt=wind_plotting.DEFAULT_COLOUR_MAXIMUM_KT):
'Plots wind barbs over subgrid.\n\n :param u_wind_matrix_m_s01: M-by-N numpy array of zonal wind speeds (metres\n per second).\n :param v_wind_matrix_m_s01: M-by-N numpy array of meridional wind speeds\n (metres per second).\n :param model_name: See doc for `plot_subgrid`.\n :param axes_object: Same.\n :param basemap_object: Same.\n :param grid_id: Same.\n :param first_row_in_full_grid: Row 0 in the subgrid (i.e., row 0 in\n `u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is row\n `first_row_in_full_grid` in the full grid).\n :param first_column_in_full_grid: Column 0 in the subgrid (i.e., column 0 in\n `u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is column\n `first_column_in_full_grid` in the full grid).\n :param plot_every_k_rows: Wind barbs will be plotted for every [k]th row in\n the subgrid, where k = `plot_every_k_rows`. For example, if\n `plot_every_k_rows = 2`, wind barbs will be plotted for rows 0, 2, 4,\n etc.\n :param plot_every_k_columns: Same as above, but for columns.\n :param barb_length: See doc for `wind_plotting.plot_wind_barbs`.\n :param empty_barb_radius: Same.\n :param fill_empty_barb: Same.\n :param colour_map: Same.\n :param colour_minimum_kt: Same.\n :param colour_maximum_kt: Same.\n '
error_checking.assert_is_real_numpy_array(u_wind_matrix_m_s01)
error_checking.assert_is_numpy_array(u_wind_matrix_m_s01, num_dimensions=2)
error_checking.assert_is_real_numpy_array(v_wind_matrix_m_s01)
these_expected_dim = numpy.array(u_wind_matrix_m_s01.shape, dtype=int)
error_checking.assert_is_numpy_array(v_wind_matrix_m_s01, exact_dimensions=these_expected_dim)
error_checking.assert_is_integer(plot_every_k_rows)
error_checking.assert_is_geq(plot_every_k_rows, 1)
error_checking.assert_is_integer(plot_every_k_columns)
error_checking.assert_is_geq(plot_every_k_columns, 1)
num_rows_in_subgrid = u_wind_matrix_m_s01.shape[0]
num_columns_in_subgrid = u_wind_matrix_m_s01.shape[1]
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=((first_row_in_full_grid + num_rows_in_subgrid) - 1), first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=((first_column_in_full_grid + num_columns_in_subgrid) - 1), basemap_object=basemap_object)
grid_point_lat_matrix_deg = coordinate_dict[LATITUDE_MATRIX_KEY]
grid_point_lng_matrix_deg = coordinate_dict[LONGITUDE_MATRIX_KEY]
u_wind_matrix_m_s01 = u_wind_matrix_m_s01[(::plot_every_k_rows, ::plot_every_k_columns)]
v_wind_matrix_m_s01 = v_wind_matrix_m_s01[(::plot_every_k_rows, ::plot_every_k_columns)]
grid_point_lat_matrix_deg = grid_point_lat_matrix_deg[(::plot_every_k_rows, ::plot_every_k_columns)]
grid_point_lng_matrix_deg = grid_point_lng_matrix_deg[(::plot_every_k_rows, ::plot_every_k_columns)]
num_wind_barbs = u_wind_matrix_m_s01.size
u_winds_m_s01 = numpy.reshape(u_wind_matrix_m_s01, num_wind_barbs)
v_winds_m_s01 = numpy.reshape(v_wind_matrix_m_s01, num_wind_barbs)
latitudes_deg = numpy.reshape(grid_point_lat_matrix_deg, num_wind_barbs)
longitudes_deg = numpy.reshape(grid_point_lng_matrix_deg, num_wind_barbs)
nan_flags = numpy.logical_or(numpy.isnan(u_winds_m_s01), numpy.isnan(v_winds_m_s01))
real_indices = numpy.where(numpy.invert(nan_flags))[0]
wind_plotting.plot_wind_barbs(basemap_object=basemap_object, axes_object=axes_object, latitudes_deg=latitudes_deg[real_indices], longitudes_deg=longitudes_deg[real_indices], u_winds_m_s01=u_winds_m_s01[real_indices], v_winds_m_s01=v_winds_m_s01[real_indices], barb_length=barb_length, empty_barb_radius=empty_barb_radius, fill_empty_barb=fill_empty_barb, colour_map=colour_map, colour_minimum_kt=colour_minimum_kt, colour_maximum_kt=colour_maximum_kt) | def plot_wind_barbs_on_subgrid(u_wind_matrix_m_s01, v_wind_matrix_m_s01, model_name, axes_object, basemap_object, grid_id=None, first_row_in_full_grid=0, first_column_in_full_grid=0, plot_every_k_rows=1, plot_every_k_columns=1, barb_length=wind_plotting.DEFAULT_BARB_LENGTH, empty_barb_radius=wind_plotting.DEFAULT_EMPTY_BARB_RADIUS, fill_empty_barb=wind_plotting.FILL_EMPTY_BARB_DEFAULT, colour_map=wind_plotting.DEFAULT_COLOUR_MAP, colour_minimum_kt=wind_plotting.DEFAULT_COLOUR_MINIMUM_KT, colour_maximum_kt=wind_plotting.DEFAULT_COLOUR_MAXIMUM_KT):
'Plots wind barbs over subgrid.\n\n :param u_wind_matrix_m_s01: M-by-N numpy array of zonal wind speeds (metres\n per second).\n :param v_wind_matrix_m_s01: M-by-N numpy array of meridional wind speeds\n (metres per second).\n :param model_name: See doc for `plot_subgrid`.\n :param axes_object: Same.\n :param basemap_object: Same.\n :param grid_id: Same.\n :param first_row_in_full_grid: Row 0 in the subgrid (i.e., row 0 in\n `u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is row\n `first_row_in_full_grid` in the full grid).\n :param first_column_in_full_grid: Column 0 in the subgrid (i.e., column 0 in\n `u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is column\n `first_column_in_full_grid` in the full grid).\n :param plot_every_k_rows: Wind barbs will be plotted for every [k]th row in\n the subgrid, where k = `plot_every_k_rows`. For example, if\n `plot_every_k_rows = 2`, wind barbs will be plotted for rows 0, 2, 4,\n etc.\n :param plot_every_k_columns: Same as above, but for columns.\n :param barb_length: See doc for `wind_plotting.plot_wind_barbs`.\n :param empty_barb_radius: Same.\n :param fill_empty_barb: Same.\n :param colour_map: Same.\n :param colour_minimum_kt: Same.\n :param colour_maximum_kt: Same.\n '
error_checking.assert_is_real_numpy_array(u_wind_matrix_m_s01)
error_checking.assert_is_numpy_array(u_wind_matrix_m_s01, num_dimensions=2)
error_checking.assert_is_real_numpy_array(v_wind_matrix_m_s01)
these_expected_dim = numpy.array(u_wind_matrix_m_s01.shape, dtype=int)
error_checking.assert_is_numpy_array(v_wind_matrix_m_s01, exact_dimensions=these_expected_dim)
error_checking.assert_is_integer(plot_every_k_rows)
error_checking.assert_is_geq(plot_every_k_rows, 1)
error_checking.assert_is_integer(plot_every_k_columns)
error_checking.assert_is_geq(plot_every_k_columns, 1)
num_rows_in_subgrid = u_wind_matrix_m_s01.shape[0]
num_columns_in_subgrid = u_wind_matrix_m_s01.shape[1]
coordinate_dict = _get_grid_point_coords(model_name=model_name, grid_id=grid_id, first_row_in_full_grid=first_row_in_full_grid, last_row_in_full_grid=((first_row_in_full_grid + num_rows_in_subgrid) - 1), first_column_in_full_grid=first_column_in_full_grid, last_column_in_full_grid=((first_column_in_full_grid + num_columns_in_subgrid) - 1), basemap_object=basemap_object)
grid_point_lat_matrix_deg = coordinate_dict[LATITUDE_MATRIX_KEY]
grid_point_lng_matrix_deg = coordinate_dict[LONGITUDE_MATRIX_KEY]
u_wind_matrix_m_s01 = u_wind_matrix_m_s01[(::plot_every_k_rows, ::plot_every_k_columns)]
v_wind_matrix_m_s01 = v_wind_matrix_m_s01[(::plot_every_k_rows, ::plot_every_k_columns)]
grid_point_lat_matrix_deg = grid_point_lat_matrix_deg[(::plot_every_k_rows, ::plot_every_k_columns)]
grid_point_lng_matrix_deg = grid_point_lng_matrix_deg[(::plot_every_k_rows, ::plot_every_k_columns)]
num_wind_barbs = u_wind_matrix_m_s01.size
u_winds_m_s01 = numpy.reshape(u_wind_matrix_m_s01, num_wind_barbs)
v_winds_m_s01 = numpy.reshape(v_wind_matrix_m_s01, num_wind_barbs)
latitudes_deg = numpy.reshape(grid_point_lat_matrix_deg, num_wind_barbs)
longitudes_deg = numpy.reshape(grid_point_lng_matrix_deg, num_wind_barbs)
nan_flags = numpy.logical_or(numpy.isnan(u_winds_m_s01), numpy.isnan(v_winds_m_s01))
real_indices = numpy.where(numpy.invert(nan_flags))[0]
wind_plotting.plot_wind_barbs(basemap_object=basemap_object, axes_object=axes_object, latitudes_deg=latitudes_deg[real_indices], longitudes_deg=longitudes_deg[real_indices], u_winds_m_s01=u_winds_m_s01[real_indices], v_winds_m_s01=v_winds_m_s01[real_indices], barb_length=barb_length, empty_barb_radius=empty_barb_radius, fill_empty_barb=fill_empty_barb, colour_map=colour_map, colour_minimum_kt=colour_minimum_kt, colour_maximum_kt=colour_maximum_kt)<|docstring|>Plots wind barbs over subgrid.
:param u_wind_matrix_m_s01: M-by-N numpy array of zonal wind speeds (metres
per second).
:param v_wind_matrix_m_s01: M-by-N numpy array of meridional wind speeds
(metres per second).
:param model_name: See doc for `plot_subgrid`.
:param axes_object: Same.
:param basemap_object: Same.
:param grid_id: Same.
:param first_row_in_full_grid: Row 0 in the subgrid (i.e., row 0 in
`u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is row
`first_row_in_full_grid` in the full grid).
:param first_column_in_full_grid: Column 0 in the subgrid (i.e., column 0 in
`u_wind_matrix_m_s01` and `v_wind_matrix_m_s01` is column
`first_column_in_full_grid` in the full grid).
:param plot_every_k_rows: Wind barbs will be plotted for every [k]th row in
the subgrid, where k = `plot_every_k_rows`. For example, if
`plot_every_k_rows = 2`, wind barbs will be plotted for rows 0, 2, 4,
etc.
:param plot_every_k_columns: Same as above, but for columns.
:param barb_length: See doc for `wind_plotting.plot_wind_barbs`.
:param empty_barb_radius: Same.
:param fill_empty_barb: Same.
:param colour_map: Same.
:param colour_minimum_kt: Same.
:param colour_maximum_kt: Same.<|endoftext|> |
38c9b97003b4d356ff3675897014688fd1c00b24a877f0363eee0274a39326de | def _create_canvas(self, parent):
' Create the MPL canvas. '
mpl_canvas = FigureCanvas(self.value)
return mpl_canvas | Create the MPL canvas. | TraitsUI/matplotlib/traitsui_mpl_qt.py | _create_canvas | marshallmcdonnell/interactive_plotting | 0 | python | def _create_canvas(self, parent):
' '
mpl_canvas = FigureCanvas(self.value)
return mpl_canvas | def _create_canvas(self, parent):
' '
mpl_canvas = FigureCanvas(self.value)
return mpl_canvas<|docstring|>Create the MPL canvas.<|endoftext|> |
2f54602683b63182523dbaca74013068fa653798093a469a6199b30cf060ee9a | def __init__(self, parent_frame, db, *args, **kwargs):
' This panel provides user interaction to common settings '
super(SippicanPanel, self).__init__(*args, **kwargs)
self.parent_frame = parent_frame
self.settings_db = db
self.selected_profile_item = 0
main_box = wx.StaticBox(self)
main_box_szr = wx.StaticBoxSizer(main_box, wx.VERTICAL)
sippican_listen_port_szr = wx.BoxSizer(wx.HORIZONTAL)
sippican_listen_port_txt_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_port_txt = wx.StaticText(self, label='Listen Port', style=wx.ALIGN_CENTER)
sippican_listen_port_txt.Wrap(width=150)
sippican_listen_port_txt_szr.AddStretchSpacer()
sippican_listen_port_txt_szr.Add(sippican_listen_port_txt, 0, wx.EXPAND)
sippican_listen_port_txt_szr.AddStretchSpacer()
self.sippican_listen_port = intctrl.IntCtrl(main_box, min=0, max=999999, limited=True)
self.sippican_listen_port.Bind(wx.EVT_TEXT, self.on_sippican_listen_port_change)
lst_sippican_listen_port_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_port_btn = wx.Button(main_box, label='Apply', size=(80, (- 1)))
sippican_listen_port_btn.SetToolTipString('Apply the new value')
sippican_listen_port_btn.Bind(wx.EVT_BUTTON, self.on_apply_sippican_listen_port)
lst_sippican_listen_port_szr.Add(sippican_listen_port_btn, 0, wx.ALIGN_RIGHT)
sippican_listen_port_szr.Add(sippican_listen_port_txt_szr, 1, (wx.EXPAND | wx.ALL), 5)
sippican_listen_port_szr.Add(self.sippican_listen_port, 2, (wx.EXPAND | wx.ALL), 5)
sippican_listen_port_szr.Add(lst_sippican_listen_port_szr, 0, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr = wx.BoxSizer(wx.HORIZONTAL)
sippican_listen_timeout_txt_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_timeout_txt = wx.StaticText(self, label='Listen TimeOut', style=wx.ALIGN_CENTER)
sippican_listen_timeout_txt.Wrap(width=150)
sippican_listen_timeout_txt_szr.AddStretchSpacer()
sippican_listen_timeout_txt_szr.Add(sippican_listen_timeout_txt, 0, wx.EXPAND)
sippican_listen_timeout_txt_szr.AddStretchSpacer()
self.sippican_listen_timeout = intctrl.IntCtrl(main_box, min=0, max=999999, limited=True)
self.sippican_listen_timeout.Bind(wx.EVT_TEXT, self.on_sippican_listen_timeout_change)
lst_sippican_listen_timeout_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_timeout_btn = wx.Button(main_box, label='Apply', size=(80, (- 1)))
sippican_listen_timeout_btn.SetToolTipString('Apply the new value')
sippican_listen_timeout_btn.Bind(wx.EVT_BUTTON, self.on_apply_sippican_listen_timeout)
lst_sippican_listen_timeout_szr.Add(sippican_listen_timeout_btn, 0, wx.ALIGN_RIGHT)
sippican_listen_timeout_szr.Add(sippican_listen_timeout_txt_szr, 1, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr.Add(self.sippican_listen_timeout, 2, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr.Add(lst_sippican_listen_timeout_szr, 0, (wx.EXPAND | wx.ALL), 5)
main_box_szr.Add(sippican_listen_port_szr, 0, wx.EXPAND)
main_box_szr.Add(sippican_listen_timeout_szr, 0, wx.EXPAND)
self.SetSizer(main_box_szr)
self.Layout()
self.update_data() | This panel provides user interaction to common settings | hydroffice/ssp_settings/sippican_panel.py | __init__ | hydroffice/hyo_sspmanager | 0 | python | def __init__(self, parent_frame, db, *args, **kwargs):
' '
super(SippicanPanel, self).__init__(*args, **kwargs)
self.parent_frame = parent_frame
self.settings_db = db
self.selected_profile_item = 0
main_box = wx.StaticBox(self)
main_box_szr = wx.StaticBoxSizer(main_box, wx.VERTICAL)
sippican_listen_port_szr = wx.BoxSizer(wx.HORIZONTAL)
sippican_listen_port_txt_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_port_txt = wx.StaticText(self, label='Listen Port', style=wx.ALIGN_CENTER)
sippican_listen_port_txt.Wrap(width=150)
sippican_listen_port_txt_szr.AddStretchSpacer()
sippican_listen_port_txt_szr.Add(sippican_listen_port_txt, 0, wx.EXPAND)
sippican_listen_port_txt_szr.AddStretchSpacer()
self.sippican_listen_port = intctrl.IntCtrl(main_box, min=0, max=999999, limited=True)
self.sippican_listen_port.Bind(wx.EVT_TEXT, self.on_sippican_listen_port_change)
lst_sippican_listen_port_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_port_btn = wx.Button(main_box, label='Apply', size=(80, (- 1)))
sippican_listen_port_btn.SetToolTipString('Apply the new value')
sippican_listen_port_btn.Bind(wx.EVT_BUTTON, self.on_apply_sippican_listen_port)
lst_sippican_listen_port_szr.Add(sippican_listen_port_btn, 0, wx.ALIGN_RIGHT)
sippican_listen_port_szr.Add(sippican_listen_port_txt_szr, 1, (wx.EXPAND | wx.ALL), 5)
sippican_listen_port_szr.Add(self.sippican_listen_port, 2, (wx.EXPAND | wx.ALL), 5)
sippican_listen_port_szr.Add(lst_sippican_listen_port_szr, 0, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr = wx.BoxSizer(wx.HORIZONTAL)
sippican_listen_timeout_txt_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_timeout_txt = wx.StaticText(self, label='Listen TimeOut', style=wx.ALIGN_CENTER)
sippican_listen_timeout_txt.Wrap(width=150)
sippican_listen_timeout_txt_szr.AddStretchSpacer()
sippican_listen_timeout_txt_szr.Add(sippican_listen_timeout_txt, 0, wx.EXPAND)
sippican_listen_timeout_txt_szr.AddStretchSpacer()
self.sippican_listen_timeout = intctrl.IntCtrl(main_box, min=0, max=999999, limited=True)
self.sippican_listen_timeout.Bind(wx.EVT_TEXT, self.on_sippican_listen_timeout_change)
lst_sippican_listen_timeout_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_timeout_btn = wx.Button(main_box, label='Apply', size=(80, (- 1)))
sippican_listen_timeout_btn.SetToolTipString('Apply the new value')
sippican_listen_timeout_btn.Bind(wx.EVT_BUTTON, self.on_apply_sippican_listen_timeout)
lst_sippican_listen_timeout_szr.Add(sippican_listen_timeout_btn, 0, wx.ALIGN_RIGHT)
sippican_listen_timeout_szr.Add(sippican_listen_timeout_txt_szr, 1, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr.Add(self.sippican_listen_timeout, 2, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr.Add(lst_sippican_listen_timeout_szr, 0, (wx.EXPAND | wx.ALL), 5)
main_box_szr.Add(sippican_listen_port_szr, 0, wx.EXPAND)
main_box_szr.Add(sippican_listen_timeout_szr, 0, wx.EXPAND)
self.SetSizer(main_box_szr)
self.Layout()
self.update_data() | def __init__(self, parent_frame, db, *args, **kwargs):
' '
super(SippicanPanel, self).__init__(*args, **kwargs)
self.parent_frame = parent_frame
self.settings_db = db
self.selected_profile_item = 0
main_box = wx.StaticBox(self)
main_box_szr = wx.StaticBoxSizer(main_box, wx.VERTICAL)
sippican_listen_port_szr = wx.BoxSizer(wx.HORIZONTAL)
sippican_listen_port_txt_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_port_txt = wx.StaticText(self, label='Listen Port', style=wx.ALIGN_CENTER)
sippican_listen_port_txt.Wrap(width=150)
sippican_listen_port_txt_szr.AddStretchSpacer()
sippican_listen_port_txt_szr.Add(sippican_listen_port_txt, 0, wx.EXPAND)
sippican_listen_port_txt_szr.AddStretchSpacer()
self.sippican_listen_port = intctrl.IntCtrl(main_box, min=0, max=999999, limited=True)
self.sippican_listen_port.Bind(wx.EVT_TEXT, self.on_sippican_listen_port_change)
lst_sippican_listen_port_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_port_btn = wx.Button(main_box, label='Apply', size=(80, (- 1)))
sippican_listen_port_btn.SetToolTipString('Apply the new value')
sippican_listen_port_btn.Bind(wx.EVT_BUTTON, self.on_apply_sippican_listen_port)
lst_sippican_listen_port_szr.Add(sippican_listen_port_btn, 0, wx.ALIGN_RIGHT)
sippican_listen_port_szr.Add(sippican_listen_port_txt_szr, 1, (wx.EXPAND | wx.ALL), 5)
sippican_listen_port_szr.Add(self.sippican_listen_port, 2, (wx.EXPAND | wx.ALL), 5)
sippican_listen_port_szr.Add(lst_sippican_listen_port_szr, 0, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr = wx.BoxSizer(wx.HORIZONTAL)
sippican_listen_timeout_txt_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_timeout_txt = wx.StaticText(self, label='Listen TimeOut', style=wx.ALIGN_CENTER)
sippican_listen_timeout_txt.Wrap(width=150)
sippican_listen_timeout_txt_szr.AddStretchSpacer()
sippican_listen_timeout_txt_szr.Add(sippican_listen_timeout_txt, 0, wx.EXPAND)
sippican_listen_timeout_txt_szr.AddStretchSpacer()
self.sippican_listen_timeout = intctrl.IntCtrl(main_box, min=0, max=999999, limited=True)
self.sippican_listen_timeout.Bind(wx.EVT_TEXT, self.on_sippican_listen_timeout_change)
lst_sippican_listen_timeout_szr = wx.BoxSizer(wx.VERTICAL)
sippican_listen_timeout_btn = wx.Button(main_box, label='Apply', size=(80, (- 1)))
sippican_listen_timeout_btn.SetToolTipString('Apply the new value')
sippican_listen_timeout_btn.Bind(wx.EVT_BUTTON, self.on_apply_sippican_listen_timeout)
lst_sippican_listen_timeout_szr.Add(sippican_listen_timeout_btn, 0, wx.ALIGN_RIGHT)
sippican_listen_timeout_szr.Add(sippican_listen_timeout_txt_szr, 1, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr.Add(self.sippican_listen_timeout, 2, (wx.EXPAND | wx.ALL), 5)
sippican_listen_timeout_szr.Add(lst_sippican_listen_timeout_szr, 0, (wx.EXPAND | wx.ALL), 5)
main_box_szr.Add(sippican_listen_port_szr, 0, wx.EXPAND)
main_box_szr.Add(sippican_listen_timeout_szr, 0, wx.EXPAND)
self.SetSizer(main_box_szr)
self.Layout()
self.update_data()<|docstring|>This panel provides user interaction to common settings<|endoftext|> |
c4d43f2e9dee404a893f292d2b56ad6e0f0c5c000ae573628f303e8441119adc | def update_data(self, event=None):
' Update the data from the database '
self.sippican_listen_port.ChangeValue(self.settings_db.sippican_listen_port)
self.sippican_listen_port.SetColors(default_color=wx.BLACK)
self.sippican_listen_timeout.ChangeValue(self.settings_db.sippican_listen_timeout)
self.sippican_listen_timeout.SetColors(default_color=wx.BLACK) | Update the data from the database | hydroffice/ssp_settings/sippican_panel.py | update_data | hydroffice/hyo_sspmanager | 0 | python | def update_data(self, event=None):
' '
self.sippican_listen_port.ChangeValue(self.settings_db.sippican_listen_port)
self.sippican_listen_port.SetColors(default_color=wx.BLACK)
self.sippican_listen_timeout.ChangeValue(self.settings_db.sippican_listen_timeout)
self.sippican_listen_timeout.SetColors(default_color=wx.BLACK) | def update_data(self, event=None):
' '
self.sippican_listen_port.ChangeValue(self.settings_db.sippican_listen_port)
self.sippican_listen_port.SetColors(default_color=wx.BLACK)
self.sippican_listen_timeout.ChangeValue(self.settings_db.sippican_listen_timeout)
self.sippican_listen_timeout.SetColors(default_color=wx.BLACK)<|docstring|>Update the data from the database<|endoftext|> |
3fecb220913cecac95893375d0ad71fc5df617b028070710c96d754e631a3758 | def __init__(self, session, object_factory, request_validator):
'Initialize a new NetworkAccessDictionaryAttributesList\n object with the provided RestSession.\n\n Args:\n session(RestSession): The RESTful session object to be used for\n API calls to the Identity Services Engine service.\n\n Raises:\n TypeError: If the parameter types are incorrect.\n\n '
check_type(session, RestSession)
super(NetworkAccessDictionaryAttributesList, self).__init__()
self._session = session
self._object_factory = object_factory
self._request_validator = request_validator | Initialize a new NetworkAccessDictionaryAttributesList
object with the provided RestSession.
Args:
session(RestSession): The RESTful session object to be used for
API calls to the Identity Services Engine service.
Raises:
TypeError: If the parameter types are incorrect. | ciscoisesdk/api/v3_0_0/network_access_dictionary_attributes_list.py | __init__ | CiscoISE/ciscoisesdk | 36 | python | def __init__(self, session, object_factory, request_validator):
'Initialize a new NetworkAccessDictionaryAttributesList\n object with the provided RestSession.\n\n Args:\n session(RestSession): The RESTful session object to be used for\n API calls to the Identity Services Engine service.\n\n Raises:\n TypeError: If the parameter types are incorrect.\n\n '
check_type(session, RestSession)
super(NetworkAccessDictionaryAttributesList, self).__init__()
self._session = session
self._object_factory = object_factory
self._request_validator = request_validator | def __init__(self, session, object_factory, request_validator):
'Initialize a new NetworkAccessDictionaryAttributesList\n object with the provided RestSession.\n\n Args:\n session(RestSession): The RESTful session object to be used for\n API calls to the Identity Services Engine service.\n\n Raises:\n TypeError: If the parameter types are incorrect.\n\n '
check_type(session, RestSession)
super(NetworkAccessDictionaryAttributesList, self).__init__()
self._session = session
self._object_factory = object_factory
self._request_validator = request_validator<|docstring|>Initialize a new NetworkAccessDictionaryAttributesList
object with the provided RestSession.
Args:
session(RestSession): The RESTful session object to be used for
API calls to the Identity Services Engine service.
Raises:
TypeError: If the parameter types are incorrect.<|endoftext|> |
8ff2ef38130700121860ace97a7dfec8008e2a9f048b864a03e112fadaa5500d | def get_network_access_dictionaries_authentication(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n authentication.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = ('/api/v1/policy/network-' + 'access/dictionaries/authentication')
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_ab96d3d76de5d05bbac1f27feacb7b0_v3_0_0', _api_response) | Network Access Returns list of dictionary attributes for
authentication.
Args:
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestResponse: REST response with following properties:
- headers(MyDict): response headers.
- response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation
or the bracket notation.
- content(bytes): representation of the request's response
- text(str): representation of the request's response
Raises:
TypeError: If the parameter types are incorrect.
MalformedRequest: If the request body created is invalid.
ApiError: If the Identity Services Engine cloud returns an error. | ciscoisesdk/api/v3_0_0/network_access_dictionary_attributes_list.py | get_network_access_dictionaries_authentication | CiscoISE/ciscoisesdk | 36 | python | def get_network_access_dictionaries_authentication(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n authentication.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = ('/api/v1/policy/network-' + 'access/dictionaries/authentication')
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_ab96d3d76de5d05bbac1f27feacb7b0_v3_0_0', _api_response) | def get_network_access_dictionaries_authentication(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n authentication.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = ('/api/v1/policy/network-' + 'access/dictionaries/authentication')
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_ab96d3d76de5d05bbac1f27feacb7b0_v3_0_0', _api_response)<|docstring|>Network Access Returns list of dictionary attributes for
authentication.
Args:
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestResponse: REST response with following properties:
- headers(MyDict): response headers.
- response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation
or the bracket notation.
- content(bytes): representation of the request's response
- text(str): representation of the request's response
Raises:
TypeError: If the parameter types are incorrect.
MalformedRequest: If the request body created is invalid.
ApiError: If the Identity Services Engine cloud returns an error.<|endoftext|> |
33c82acb357716a300bd48ef36d3821831690aeb9db7bc807d292043b28ae7f8 | def get_all_authentication(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_authentication <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authentication>`_\n '
return self.get_network_access_dictionaries_authentication(headers=headers, **query_parameters) | Alias for `get_network_access_dictionaries_authentication <#ciscoisesdk.
api.v3_0_0.network_access_dictionary_attributes_list.
NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authentication>`_ | ciscoisesdk/api/v3_0_0/network_access_dictionary_attributes_list.py | get_all_authentication | CiscoISE/ciscoisesdk | 36 | python | def get_all_authentication(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_authentication <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authentication>`_\n '
return self.get_network_access_dictionaries_authentication(headers=headers, **query_parameters) | def get_all_authentication(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_authentication <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authentication>`_\n '
return self.get_network_access_dictionaries_authentication(headers=headers, **query_parameters)<|docstring|>Alias for `get_network_access_dictionaries_authentication <#ciscoisesdk.
api.v3_0_0.network_access_dictionary_attributes_list.
NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authentication>`_<|endoftext|> |
44b471a8d55545dc218f5a289fafedf28963f2cc63b8183fc581e478b17206b1 | def get_network_access_dictionaries_authorization(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n authorization.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = '/api/v1/policy/network-access/dictionaries/authorization'
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_f68aee0cdb425390b3ca90b0b46e6e2c_v3_0_0', _api_response) | Network Access Returns list of dictionary attributes for
authorization.
Args:
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestResponse: REST response with following properties:
- headers(MyDict): response headers.
- response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation
or the bracket notation.
- content(bytes): representation of the request's response
- text(str): representation of the request's response
Raises:
TypeError: If the parameter types are incorrect.
MalformedRequest: If the request body created is invalid.
ApiError: If the Identity Services Engine cloud returns an error. | ciscoisesdk/api/v3_0_0/network_access_dictionary_attributes_list.py | get_network_access_dictionaries_authorization | CiscoISE/ciscoisesdk | 36 | python | def get_network_access_dictionaries_authorization(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n authorization.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = '/api/v1/policy/network-access/dictionaries/authorization'
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_f68aee0cdb425390b3ca90b0b46e6e2c_v3_0_0', _api_response) | def get_network_access_dictionaries_authorization(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n authorization.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = '/api/v1/policy/network-access/dictionaries/authorization'
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_f68aee0cdb425390b3ca90b0b46e6e2c_v3_0_0', _api_response)<|docstring|>Network Access Returns list of dictionary attributes for
authorization.
Args:
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestResponse: REST response with following properties:
- headers(MyDict): response headers.
- response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation
or the bracket notation.
- content(bytes): representation of the request's response
- text(str): representation of the request's response
Raises:
TypeError: If the parameter types are incorrect.
MalformedRequest: If the request body created is invalid.
ApiError: If the Identity Services Engine cloud returns an error.<|endoftext|> |
9594adfbe910b6f82c84f698a68613e8ab29a5b2eee46b0617ff5b5f544135c2 | def get_all_authorization(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_authorization <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authorization>`_\n '
return self.get_network_access_dictionaries_authorization(headers=headers, **query_parameters) | Alias for `get_network_access_dictionaries_authorization <#ciscoisesdk.
api.v3_0_0.network_access_dictionary_attributes_list.
NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authorization>`_ | ciscoisesdk/api/v3_0_0/network_access_dictionary_attributes_list.py | get_all_authorization | CiscoISE/ciscoisesdk | 36 | python | def get_all_authorization(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_authorization <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authorization>`_\n '
return self.get_network_access_dictionaries_authorization(headers=headers, **query_parameters) | def get_all_authorization(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_authorization <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authorization>`_\n '
return self.get_network_access_dictionaries_authorization(headers=headers, **query_parameters)<|docstring|>Alias for `get_network_access_dictionaries_authorization <#ciscoisesdk.
api.v3_0_0.network_access_dictionary_attributes_list.
NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_authorization>`_<|endoftext|> |
ab37c813a80f8978c1a187176a3f58ec4c7f4d4dc8b76554725bdb29ff94a821 | def get_network_access_dictionaries_policy_set(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n policyset.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = '/api/v1/policy/network-access/dictionaries/policyset'
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_c53b22885f5e5d82fb8cadd0332136_v3_0_0', _api_response) | Network Access Returns list of dictionary attributes for
policyset.
Args:
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestResponse: REST response with following properties:
- headers(MyDict): response headers.
- response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation
or the bracket notation.
- content(bytes): representation of the request's response
- text(str): representation of the request's response
Raises:
TypeError: If the parameter types are incorrect.
MalformedRequest: If the request body created is invalid.
ApiError: If the Identity Services Engine cloud returns an error. | ciscoisesdk/api/v3_0_0/network_access_dictionary_attributes_list.py | get_network_access_dictionaries_policy_set | CiscoISE/ciscoisesdk | 36 | python | def get_network_access_dictionaries_policy_set(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n policyset.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = '/api/v1/policy/network-access/dictionaries/policyset'
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_c53b22885f5e5d82fb8cadd0332136_v3_0_0', _api_response) | def get_network_access_dictionaries_policy_set(self, headers=None, **query_parameters):
"Network Access Returns list of dictionary attributes for\n policyset.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query parameters (provides\n support for parameters that may be added in the future).\n\n Returns:\n\n RestResponse: REST response with following properties:\n\n - headers(MyDict): response headers.\n - response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation\n or the bracket notation.\n - content(bytes): representation of the request's response\n - text(str): representation of the request's response\n\n Raises:\n TypeError: If the parameter types are incorrect.\n MalformedRequest: If the request body created is invalid.\n ApiError: If the Identity Services Engine cloud returns an error.\n "
check_type(headers, dict)
if (headers is not None):
if ('X-Request-ID' in headers):
check_type(headers.get('X-Request-ID'), basestring)
with_custom_headers = False
_headers = (self._session.headers or {})
if headers:
_headers.update(dict_of_str(headers))
with_custom_headers = True
_params = {}
_params.update(query_parameters)
_params = dict_from_items_with_values(_params)
path_params = {}
e_url = '/api/v1/policy/network-access/dictionaries/policyset'
endpoint_full_url = apply_path_params(e_url, path_params)
if with_custom_headers:
_api_response = self._session.get(endpoint_full_url, params=_params, headers=_headers)
else:
_api_response = self._session.get(endpoint_full_url, params=_params)
return self._object_factory('bpm_c53b22885f5e5d82fb8cadd0332136_v3_0_0', _api_response)<|docstring|>Network Access Returns list of dictionary attributes for
policyset.
Args:
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestResponse: REST response with following properties:
- headers(MyDict): response headers.
- response(MyDict): response body as a MyDict object. Access the object's properties by using the dot notation
or the bracket notation.
- content(bytes): representation of the request's response
- text(str): representation of the request's response
Raises:
TypeError: If the parameter types are incorrect.
MalformedRequest: If the request body created is invalid.
ApiError: If the Identity Services Engine cloud returns an error.<|endoftext|> |
b4ca5eb4aaf9655afc56a774cd3941e5e783a37a26f0104270b0c69004f764b4 | def get_all_policy_set(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_policy_set <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_policy_set>`_\n '
return self.get_network_access_dictionaries_policy_set(headers=headers, **query_parameters) | Alias for `get_network_access_dictionaries_policy_set <#ciscoisesdk.
api.v3_0_0.network_access_dictionary_attributes_list.
NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_policy_set>`_ | ciscoisesdk/api/v3_0_0/network_access_dictionary_attributes_list.py | get_all_policy_set | CiscoISE/ciscoisesdk | 36 | python | def get_all_policy_set(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_policy_set <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_policy_set>`_\n '
return self.get_network_access_dictionaries_policy_set(headers=headers, **query_parameters) | def get_all_policy_set(self, headers=None, **query_parameters):
'Alias for `get_network_access_dictionaries_policy_set <#ciscoisesdk.\n api.v3_0_0.network_access_dictionary_attributes_list.\n NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_policy_set>`_\n '
return self.get_network_access_dictionaries_policy_set(headers=headers, **query_parameters)<|docstring|>Alias for `get_network_access_dictionaries_policy_set <#ciscoisesdk.
api.v3_0_0.network_access_dictionary_attributes_list.
NetworkAccessDictionaryAttributesList.get_network_access_dictionaries_policy_set>`_<|endoftext|> |
e89cd81de91550c379041076ccd137b29deb9e0ead8591dffc57c69471a9c26e | @classmethod
def name(cls) -> str:
'Returns the name of the Algorithm.'
return "Dijkstra's Algorithm" | Returns the name of the Algorithm. | search/algorithms/dijkstra.py | name | Dietr1ch/Search-py | 6 | python | @classmethod
def name(cls) -> str:
return "Dijkstra's Algorithm" | @classmethod
def name(cls) -> str:
return "Dijkstra's Algorithm"<|docstring|>Returns the name of the Algorithm.<|endoftext|> |
74d30c2c395ee5eb6594d18af1e863d5cff8e5c85e05503f3c5ee362ef023b69 | @classmethod
def create_open(cls) -> Open:
'Returns the container to use for the Open set.'
return Dijkstra.Open() | Returns the container to use for the Open set. | search/algorithms/dijkstra.py | create_open | Dietr1ch/Search-py | 6 | python | @classmethod
def create_open(cls) -> Open:
return Dijkstra.Open() | @classmethod
def create_open(cls) -> Open:
return Dijkstra.Open()<|docstring|>Returns the container to use for the Open set.<|endoftext|> |
7d94851bf4d079d8b80928c53b4a6b35caae88ed8d866ba0812c0afeefa412ca | def create_starting_node(self, state: Space.State) -> Node:
'Create an Starting Node.'
self.nodes_created += 1
return Dijkstra.DijkstraNode(state, action=None, parent=None, g=0) | Create an Starting Node. | search/algorithms/dijkstra.py | create_starting_node | Dietr1ch/Search-py | 6 | python | def create_starting_node(self, state: Space.State) -> Node:
self.nodes_created += 1
return Dijkstra.DijkstraNode(state, action=None, parent=None, g=0) | def create_starting_node(self, state: Space.State) -> Node:
self.nodes_created += 1
return Dijkstra.DijkstraNode(state, action=None, parent=None, g=0)<|docstring|>Create an Starting Node.<|endoftext|> |
f87a95c551c5a89e819ea4bf080ec36d5b3ac76025f2894eda4606c910e5c718 | def reach(self, state: Space.State, action: Space.Action, parent: DijkstraNode):
'Reaches a state and updates Open.'
g = (parent.g + action.cost(parent.state))
if (state not in self.open):
self.nodes_created += 1
self.open.insert(Dijkstra.DijkstraNode(state, action=action, parent=parent, g=g))
return
old_node = self.open[state]
if (g >= old_node.g):
return
self.nodes_updated += 1
old_node.action = action
old_node.parent = parent
old_node.g = g
self.open.sync_improvement(old_node) | Reaches a state and updates Open. | search/algorithms/dijkstra.py | reach | Dietr1ch/Search-py | 6 | python | def reach(self, state: Space.State, action: Space.Action, parent: DijkstraNode):
g = (parent.g + action.cost(parent.state))
if (state not in self.open):
self.nodes_created += 1
self.open.insert(Dijkstra.DijkstraNode(state, action=action, parent=parent, g=g))
return
old_node = self.open[state]
if (g >= old_node.g):
return
self.nodes_updated += 1
old_node.action = action
old_node.parent = parent
old_node.g = g
self.open.sync_improvement(old_node) | def reach(self, state: Space.State, action: Space.Action, parent: DijkstraNode):
g = (parent.g + action.cost(parent.state))
if (state not in self.open):
self.nodes_created += 1
self.open.insert(Dijkstra.DijkstraNode(state, action=action, parent=parent, g=g))
return
old_node = self.open[state]
if (g >= old_node.g):
return
self.nodes_updated += 1
old_node.action = action
old_node.parent = parent
old_node.g = g
self.open.sync_improvement(old_node)<|docstring|>Reaches a state and updates Open.<|endoftext|> |
8bf6eda308fb6c033e0ce37b9ea4aa59442de0b4bd486d2c25b75a601e6b89ed | def __str__(self) -> str:
'The string representation of this Node.'
parent_action = 'ø'
parent_state = 'ø'
if self.parent:
parent_action = str(self.action)
parent_state = str(self.parent.state)
return 'DijkstraNode[s={}, a={}, p.s={}, g={}]'.format(self.state, parent_action, parent_state, self.g) | The string representation of this Node. | search/algorithms/dijkstra.py | __str__ | Dietr1ch/Search-py | 6 | python | def __str__(self) -> str:
parent_action = 'ø'
parent_state = 'ø'
if self.parent:
parent_action = str(self.action)
parent_state = str(self.parent.state)
return 'DijkstraNode[s={}, a={}, p.s={}, g={}]'.format(self.state, parent_action, parent_state, self.g) | def __str__(self) -> str:
parent_action = 'ø'
parent_state = 'ø'
if self.parent:
parent_action = str(self.action)
parent_state = str(self.parent.state)
return 'DijkstraNode[s={}, a={}, p.s={}, g={}]'.format(self.state, parent_action, parent_state, self.g)<|docstring|>The string representation of this Node.<|endoftext|> |
4f792185dba77ce52d23e34cedb7518e9939dab8b407671c5544a6203d8d5a9c | def __lt__(self, other) -> bool:
'Returns < of "(f, h)" to perform informed/optimistic tie-breaking.'
return (self.g < other.g) | Returns < of "(f, h)" to perform informed/optimistic tie-breaking. | search/algorithms/dijkstra.py | __lt__ | Dietr1ch/Search-py | 6 | python | def __lt__(self, other) -> bool:
return (self.g < other.g) | def __lt__(self, other) -> bool:
return (self.g < other.g)<|docstring|>Returns < of "(f, h)" to perform informed/optimistic tie-breaking.<|endoftext|> |
b9c246789b7eedc62627a894f883a201d89d513e97e0a4ee675f3221ef6283e4 | def insert(self, node: Node):
'Appends a Node into the Open list.'
self.node_map[node.state] = node
self.heap.push(node) | Appends a Node into the Open list. | search/algorithms/dijkstra.py | insert | Dietr1ch/Search-py | 6 | python | def insert(self, node: Node):
self.node_map[node.state] = node
self.heap.push(node) | def insert(self, node: Node):
self.node_map[node.state] = node
self.heap.push(node)<|docstring|>Appends a Node into the Open list.<|endoftext|> |
1f58b8f96569ed1c69cab6490a66149ae131c5b9976dc9d03a5eaa476647349c | def pop(self) -> Node:
'Takes the first (oldest) Node from the Open list.'
node = self.heap.pop()
return self.node_map.pop(node.state) | Takes the first (oldest) Node from the Open list. | search/algorithms/dijkstra.py | pop | Dietr1ch/Search-py | 6 | python | def pop(self) -> Node:
node = self.heap.pop()
return self.node_map.pop(node.state) | def pop(self) -> Node:
node = self.heap.pop()
return self.node_map.pop(node.state)<|docstring|>Takes the first (oldest) Node from the Open list.<|endoftext|> |
03423da9290e1fb94f66e163ef5d5299c83ddec40f99deda5e6609b967ec535e | def __len__(self) -> int:
'Counts the Nodes in Open.'
return len(self.heap) | Counts the Nodes in Open. | search/algorithms/dijkstra.py | __len__ | Dietr1ch/Search-py | 6 | python | def __len__(self) -> int:
return len(self.heap) | def __len__(self) -> int:
return len(self.heap)<|docstring|>Counts the Nodes in Open.<|endoftext|> |
9884bf7ff2d90ddecf70918ddf101da745671156c1936495190b5303862d141c | def __bool__(self) -> bool:
"Checks if there's Nodes in Open."
return (len(self.heap) > 0) | Checks if there's Nodes in Open. | search/algorithms/dijkstra.py | __bool__ | Dietr1ch/Search-py | 6 | python | def __bool__(self) -> bool:
return (len(self.heap) > 0) | def __bool__(self) -> bool:
return (len(self.heap) > 0)<|docstring|>Checks if there's Nodes in Open.<|endoftext|> |
39b9274b4a23ab4a3f5067737bffc17b6fff94a3f290460318ab4a8a1e6dbfb2 | def __contains__(self, state: Space.State) -> bool:
"Checks if there's a Node for a state in Open."
return (state in self.node_map) | Checks if there's a Node for a state in Open. | search/algorithms/dijkstra.py | __contains__ | Dietr1ch/Search-py | 6 | python | def __contains__(self, state: Space.State) -> bool:
return (state in self.node_map) | def __contains__(self, state: Space.State) -> bool:
return (state in self.node_map)<|docstring|>Checks if there's a Node for a state in Open.<|endoftext|> |
8eb7c51c41351c6f9281fa5fdf7b5a495c5fb4b846f44c4572a802fe185e909c | def sync_improvement(self, node):
'Updates the internal heap to keep up with a node improvement.\n\n It must be called right after any node gets a better score.\n '
self.heap.sync_improvement(node) | Updates the internal heap to keep up with a node improvement.
It must be called right after any node gets a better score. | search/algorithms/dijkstra.py | sync_improvement | Dietr1ch/Search-py | 6 | python | def sync_improvement(self, node):
'Updates the internal heap to keep up with a node improvement.\n\n It must be called right after any node gets a better score.\n '
self.heap.sync_improvement(node) | def sync_improvement(self, node):
'Updates the internal heap to keep up with a node improvement.\n\n It must be called right after any node gets a better score.\n '
self.heap.sync_improvement(node)<|docstring|>Updates the internal heap to keep up with a node improvement.
It must be called right after any node gets a better score.<|endoftext|> |
3834fa0516797885fb31b8fe8b60e023f65731f4909bd11be6861063a3612a2a | def print_file_metadata(service, file_id):
"Print a file's metadata.\n\n Args:\n service: Drive API service instance.\n file_id: ID of the file to print metadata for.\n "
try:
file = service.files().get(fileId=file_id).execute()
print('Title: {}'.format(file['title']))
print('MIME type: {}'.format(file['mimeType']))
except errors.HttpError as error:
print('An error occurred: {}'.fromat(error)) | Print a file's metadata.
Args:
service: Drive API service instance.
file_id: ID of the file to print metadata for. | install_tools/download_config.py | print_file_metadata | yeahmatte/traefik-reversed-proxy | 0 | python | def print_file_metadata(service, file_id):
"Print a file's metadata.\n\n Args:\n service: Drive API service instance.\n file_id: ID of the file to print metadata for.\n "
try:
file = service.files().get(fileId=file_id).execute()
print('Title: {}'.format(file['title']))
print('MIME type: {}'.format(file['mimeType']))
except errors.HttpError as error:
print('An error occurred: {}'.fromat(error)) | def print_file_metadata(service, file_id):
"Print a file's metadata.\n\n Args:\n service: Drive API service instance.\n file_id: ID of the file to print metadata for.\n "
try:
file = service.files().get(fileId=file_id).execute()
print('Title: {}'.format(file['title']))
print('MIME type: {}'.format(file['mimeType']))
except errors.HttpError as error:
print('An error occurred: {}'.fromat(error))<|docstring|>Print a file's metadata.
Args:
service: Drive API service instance.
file_id: ID of the file to print metadata for.<|endoftext|> |
77f3e72ce760707c976400e044908042d416d75bc1b98681db96248fc14b1a0f | def print_file_content(service, file_id):
"Print a file's content.\n\n Args:\n service: Drive API service instance.\n file_id: ID of the file.\n Returns:\n File's content if successful, None otherwise.\n "
try:
print(service.files().get_media(fileId=file_id).execute())
except errors.HttpError as error:
print('An error occurred: {}'.format(error)) | Print a file's content.
Args:
service: Drive API service instance.
file_id: ID of the file.
Returns:
File's content if successful, None otherwise. | install_tools/download_config.py | print_file_content | yeahmatte/traefik-reversed-proxy | 0 | python | def print_file_content(service, file_id):
"Print a file's content.\n\n Args:\n service: Drive API service instance.\n file_id: ID of the file.\n Returns:\n File's content if successful, None otherwise.\n "
try:
print(service.files().get_media(fileId=file_id).execute())
except errors.HttpError as error:
print('An error occurred: {}'.format(error)) | def print_file_content(service, file_id):
"Print a file's content.\n\n Args:\n service: Drive API service instance.\n file_id: ID of the file.\n Returns:\n File's content if successful, None otherwise.\n "
try:
print(service.files().get_media(fileId=file_id).execute())
except errors.HttpError as error:
print('An error occurred: {}'.format(error))<|docstring|>Print a file's content.
Args:
service: Drive API service instance.
file_id: ID of the file.
Returns:
File's content if successful, None otherwise.<|endoftext|> |
e5e534112265030ca76c39dabdd00b817249d332d3b1e89e06a646cd159e1116 | def download_file(service, file_id, local_fd):
"Download a Drive file's content to the local filesystem.\n\n Args:\n service: Drive API Service instance.\n file_id: ID of the Drive file that will downloaded.\n local_fd: io.Base or file object, the stream that the Drive file's\n contents will be written to.\n "
request = service.files().get_media(fileId=file_id)
media_request = http.MediaIoBaseDownload(local_fd, request)
while True:
try:
(download_progress, done) = media_request.next_chunk()
except errors.HttpError as error:
print('An error occurred: {}'.format(error))
return
if download_progress:
print(('Download Progress: %d%%' % int((download_progress.progress() * 100))))
if done:
print('Download Complete')
return | Download a Drive file's content to the local filesystem.
Args:
service: Drive API Service instance.
file_id: ID of the Drive file that will downloaded.
local_fd: io.Base or file object, the stream that the Drive file's
contents will be written to. | install_tools/download_config.py | download_file | yeahmatte/traefik-reversed-proxy | 0 | python | def download_file(service, file_id, local_fd):
"Download a Drive file's content to the local filesystem.\n\n Args:\n service: Drive API Service instance.\n file_id: ID of the Drive file that will downloaded.\n local_fd: io.Base or file object, the stream that the Drive file's\n contents will be written to.\n "
request = service.files().get_media(fileId=file_id)
media_request = http.MediaIoBaseDownload(local_fd, request)
while True:
try:
(download_progress, done) = media_request.next_chunk()
except errors.HttpError as error:
print('An error occurred: {}'.format(error))
return
if download_progress:
print(('Download Progress: %d%%' % int((download_progress.progress() * 100))))
if done:
print('Download Complete')
return | def download_file(service, file_id, local_fd):
"Download a Drive file's content to the local filesystem.\n\n Args:\n service: Drive API Service instance.\n file_id: ID of the Drive file that will downloaded.\n local_fd: io.Base or file object, the stream that the Drive file's\n contents will be written to.\n "
request = service.files().get_media(fileId=file_id)
media_request = http.MediaIoBaseDownload(local_fd, request)
while True:
try:
(download_progress, done) = media_request.next_chunk()
except errors.HttpError as error:
print('An error occurred: {}'.format(error))
return
if download_progress:
print(('Download Progress: %d%%' % int((download_progress.progress() * 100))))
if done:
print('Download Complete')
return<|docstring|>Download a Drive file's content to the local filesystem.
Args:
service: Drive API Service instance.
file_id: ID of the Drive file that will downloaded.
local_fd: io.Base or file object, the stream that the Drive file's
contents will be written to.<|endoftext|> |
a4787c8c75220b891e2a069e158f4e90a0c3e0af5c44eed82eb5787a5ca96631 | def __init__(self, std_dev) -> None:
'\n std_dev will be interpreted as having units of the Instrument pixel size.\n Otherwise it can be describe in the description attribute of the PSF.\n '
psf_type = self.__class__.__name__
super().__init__(psf_type, std_dev=std_dev) | std_dev will be interpreted as having units of the Instrument pixel size.
Otherwise it can be describe in the description attribute of the PSF. | python/lensmodelapi/api/psf.py | __init__ | aymgal/LensModelAPI | 3 | python | def __init__(self, std_dev) -> None:
'\n std_dev will be interpreted as having units of the Instrument pixel size.\n Otherwise it can be describe in the description attribute of the PSF.\n '
psf_type = self.__class__.__name__
super().__init__(psf_type, std_dev=std_dev) | def __init__(self, std_dev) -> None:
'\n std_dev will be interpreted as having units of the Instrument pixel size.\n Otherwise it can be describe in the description attribute of the PSF.\n '
psf_type = self.__class__.__name__
super().__init__(psf_type, std_dev=std_dev)<|docstring|>std_dev will be interpreted as having units of the Instrument pixel size.
Otherwise it can be describe in the description attribute of the PSF.<|endoftext|> |
2e54c060722aa89c7ab36023b94b9a5543e5acbfcca06e6fd941c9a3e78ae6c4 | def euclidean_distance(geometry, source_crs, zoom, cell_type=CellType.FLOAT64):
'Calculates the Euclidean distance of a Shapely geometry.\n\n Args:\n geometry (shapely.geometry): The input geometry to compute the Euclidean distance\n for.\n source_crs (str or int): The CRS of the input geometry.\n zoom (int): The zoom level of the output raster.\n cell_type (str or :class:`~geopyspark.geotrellis.constants.CellType`, optional): The data\n type of the cells for the new layer. If not specified, then ``CellType.FLOAT64`` is used.\n\n Note:\n This function may run very slowly for polygonal inputs if they cover many cells of\n the output raster.\n\n Returns:\n :class:`~geopyspark.geotrellis.rdd.TiledRasterLayer`\n '
if isinstance(source_crs, int):
source_crs = str(source_crs)
pysc = get_spark_context()
srdd = pysc._gateway.jvm.geopyspark.geotrellis.SpatialTiledRasterLayer.euclideanDistance(pysc._jsc.sc(), shapely.wkb.dumps(geometry), source_crs, CellType(cell_type).value, zoom)
return TiledRasterLayer(LayerType.SPATIAL, srdd) | Calculates the Euclidean distance of a Shapely geometry.
Args:
geometry (shapely.geometry): The input geometry to compute the Euclidean distance
for.
source_crs (str or int): The CRS of the input geometry.
zoom (int): The zoom level of the output raster.
cell_type (str or :class:`~geopyspark.geotrellis.constants.CellType`, optional): The data
type of the cells for the new layer. If not specified, then ``CellType.FLOAT64`` is used.
Note:
This function may run very slowly for polygonal inputs if they cover many cells of
the output raster.
Returns:
:class:`~geopyspark.geotrellis.rdd.TiledRasterLayer` | geopyspark/geotrellis/euclidean_distance.py | euclidean_distance | lossyrob/geotrellis-python | 182 | python | def euclidean_distance(geometry, source_crs, zoom, cell_type=CellType.FLOAT64):
'Calculates the Euclidean distance of a Shapely geometry.\n\n Args:\n geometry (shapely.geometry): The input geometry to compute the Euclidean distance\n for.\n source_crs (str or int): The CRS of the input geometry.\n zoom (int): The zoom level of the output raster.\n cell_type (str or :class:`~geopyspark.geotrellis.constants.CellType`, optional): The data\n type of the cells for the new layer. If not specified, then ``CellType.FLOAT64`` is used.\n\n Note:\n This function may run very slowly for polygonal inputs if they cover many cells of\n the output raster.\n\n Returns:\n :class:`~geopyspark.geotrellis.rdd.TiledRasterLayer`\n '
if isinstance(source_crs, int):
source_crs = str(source_crs)
pysc = get_spark_context()
srdd = pysc._gateway.jvm.geopyspark.geotrellis.SpatialTiledRasterLayer.euclideanDistance(pysc._jsc.sc(), shapely.wkb.dumps(geometry), source_crs, CellType(cell_type).value, zoom)
return TiledRasterLayer(LayerType.SPATIAL, srdd) | def euclidean_distance(geometry, source_crs, zoom, cell_type=CellType.FLOAT64):
'Calculates the Euclidean distance of a Shapely geometry.\n\n Args:\n geometry (shapely.geometry): The input geometry to compute the Euclidean distance\n for.\n source_crs (str or int): The CRS of the input geometry.\n zoom (int): The zoom level of the output raster.\n cell_type (str or :class:`~geopyspark.geotrellis.constants.CellType`, optional): The data\n type of the cells for the new layer. If not specified, then ``CellType.FLOAT64`` is used.\n\n Note:\n This function may run very slowly for polygonal inputs if they cover many cells of\n the output raster.\n\n Returns:\n :class:`~geopyspark.geotrellis.rdd.TiledRasterLayer`\n '
if isinstance(source_crs, int):
source_crs = str(source_crs)
pysc = get_spark_context()
srdd = pysc._gateway.jvm.geopyspark.geotrellis.SpatialTiledRasterLayer.euclideanDistance(pysc._jsc.sc(), shapely.wkb.dumps(geometry), source_crs, CellType(cell_type).value, zoom)
return TiledRasterLayer(LayerType.SPATIAL, srdd)<|docstring|>Calculates the Euclidean distance of a Shapely geometry.
Args:
geometry (shapely.geometry): The input geometry to compute the Euclidean distance
for.
source_crs (str or int): The CRS of the input geometry.
zoom (int): The zoom level of the output raster.
cell_type (str or :class:`~geopyspark.geotrellis.constants.CellType`, optional): The data
type of the cells for the new layer. If not specified, then ``CellType.FLOAT64`` is used.
Note:
This function may run very slowly for polygonal inputs if they cover many cells of
the output raster.
Returns:
:class:`~geopyspark.geotrellis.rdd.TiledRasterLayer`<|endoftext|> |
60527c626450a02fa5ab7fb97f598a9dbc7a6eb0afc90e4d59ab1066073449f3 | def alleles(pop):
'\n Metodo estatico que recibe un dataframe y lo representa\n graficamente\n '
(labels, caption) = Plots.__populationInfo(pop)
alleles = pop.getDataFrame('alelos')
plt.style.use('ggplot')
plt.figure(figsize=(6, 4), constrained_layout=True)
plt.title('Change in allelic frequencies')
plt.xlabel('Generations')
plt.ylabel('p')
plt.ylim([0, 1.05])
plt.plot(alleles)
plt.legend(alleles.columns)
plt.xticks(rotation=45)
plt.show() | Metodo estatico que recibe un dataframe y lo representa
graficamente | populy/plots.py | alleles | R-mario/simuPy | 0 | python | def alleles(pop):
'\n Metodo estatico que recibe un dataframe y lo representa\n graficamente\n '
(labels, caption) = Plots.__populationInfo(pop)
alleles = pop.getDataFrame('alelos')
plt.style.use('ggplot')
plt.figure(figsize=(6, 4), constrained_layout=True)
plt.title('Change in allelic frequencies')
plt.xlabel('Generations')
plt.ylabel('p')
plt.ylim([0, 1.05])
plt.plot(alleles)
plt.legend(alleles.columns)
plt.xticks(rotation=45)
plt.show() | def alleles(pop):
'\n Metodo estatico que recibe un dataframe y lo representa\n graficamente\n '
(labels, caption) = Plots.__populationInfo(pop)
alleles = pop.getDataFrame('alelos')
plt.style.use('ggplot')
plt.figure(figsize=(6, 4), constrained_layout=True)
plt.title('Change in allelic frequencies')
plt.xlabel('Generations')
plt.ylabel('p')
plt.ylim([0, 1.05])
plt.plot(alleles)
plt.legend(alleles.columns)
plt.xticks(rotation=45)
plt.show()<|docstring|>Metodo estatico que recibe un dataframe y lo representa
graficamente<|endoftext|> |
a71734c9225b4716f16038532b6e96c0445df992ba326e65805904a926975219 | def __init__(self, email=None, first_name=None, last_name=None, role=None, external_data=None, language=None, sso_identifier=None, password=None, location=None):
'\n NewUser - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and the value is json key in definition.\n '
self.swagger_types = {'email': 'str', 'first_name': 'str', 'last_name': 'str', 'role': 'str', 'external_data': 'str', 'language': 'UserLanguage', 'sso_identifier': 'str', 'password': 'str', 'location': 'Location'}
self.attribute_map = {'email': 'email', 'first_name': 'firstName', 'last_name': 'lastName', 'role': 'role', 'external_data': 'externalData', 'language': 'language', 'sso_identifier': 'ssoIdentifier', 'password': 'password', 'location': 'location'}
self._email = email
self._first_name = first_name
self._last_name = last_name
self._role = role
self._external_data = external_data
self._language = language
self._sso_identifier = sso_identifier
self._password = password
self._location = location | NewUser - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition. | smartrecruiters_python_client/models/new_user.py | __init__ | roksela/smartrecruiters-python-client | 5 | python | def __init__(self, email=None, first_name=None, last_name=None, role=None, external_data=None, language=None, sso_identifier=None, password=None, location=None):
'\n NewUser - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and the value is json key in definition.\n '
self.swagger_types = {'email': 'str', 'first_name': 'str', 'last_name': 'str', 'role': 'str', 'external_data': 'str', 'language': 'UserLanguage', 'sso_identifier': 'str', 'password': 'str', 'location': 'Location'}
self.attribute_map = {'email': 'email', 'first_name': 'firstName', 'last_name': 'lastName', 'role': 'role', 'external_data': 'externalData', 'language': 'language', 'sso_identifier': 'ssoIdentifier', 'password': 'password', 'location': 'location'}
self._email = email
self._first_name = first_name
self._last_name = last_name
self._role = role
self._external_data = external_data
self._language = language
self._sso_identifier = sso_identifier
self._password = password
self._location = location | def __init__(self, email=None, first_name=None, last_name=None, role=None, external_data=None, language=None, sso_identifier=None, password=None, location=None):
'\n NewUser - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and the value is json key in definition.\n '
self.swagger_types = {'email': 'str', 'first_name': 'str', 'last_name': 'str', 'role': 'str', 'external_data': 'str', 'language': 'UserLanguage', 'sso_identifier': 'str', 'password': 'str', 'location': 'Location'}
self.attribute_map = {'email': 'email', 'first_name': 'firstName', 'last_name': 'lastName', 'role': 'role', 'external_data': 'externalData', 'language': 'language', 'sso_identifier': 'ssoIdentifier', 'password': 'password', 'location': 'location'}
self._email = email
self._first_name = first_name
self._last_name = last_name
self._role = role
self._external_data = external_data
self._language = language
self._sso_identifier = sso_identifier
self._password = password
self._location = location<|docstring|>NewUser - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.<|endoftext|> |
2f62b5ca985ebde03184f62f858aadba6e776fd55bcaa1313e5c1372d2dae106 | @property
def email(self):
'\n Gets the email of this NewUser.\n\n :return: The email of this NewUser.\n :rtype: str\n '
return self._email | Gets the email of this NewUser.
:return: The email of this NewUser.
:rtype: str | smartrecruiters_python_client/models/new_user.py | email | roksela/smartrecruiters-python-client | 5 | python | @property
def email(self):
'\n Gets the email of this NewUser.\n\n :return: The email of this NewUser.\n :rtype: str\n '
return self._email | @property
def email(self):
'\n Gets the email of this NewUser.\n\n :return: The email of this NewUser.\n :rtype: str\n '
return self._email<|docstring|>Gets the email of this NewUser.
:return: The email of this NewUser.
:rtype: str<|endoftext|> |
95b1a56358b985c557a29bb6ed0fafe1485ad08a0ce12b5a5d0ee4825fc129b3 | @email.setter
def email(self, email):
'\n Sets the email of this NewUser.\n\n :param email: The email of this NewUser.\n :type: str\n '
if (email is None):
raise ValueError('Invalid value for `email`, must not be `None`')
self._email = email | Sets the email of this NewUser.
:param email: The email of this NewUser.
:type: str | smartrecruiters_python_client/models/new_user.py | email | roksela/smartrecruiters-python-client | 5 | python | @email.setter
def email(self, email):
'\n Sets the email of this NewUser.\n\n :param email: The email of this NewUser.\n :type: str\n '
if (email is None):
raise ValueError('Invalid value for `email`, must not be `None`')
self._email = email | @email.setter
def email(self, email):
'\n Sets the email of this NewUser.\n\n :param email: The email of this NewUser.\n :type: str\n '
if (email is None):
raise ValueError('Invalid value for `email`, must not be `None`')
self._email = email<|docstring|>Sets the email of this NewUser.
:param email: The email of this NewUser.
:type: str<|endoftext|> |
2278a7ba415c78f45b53fa7795c96e9b4527d6ee12821502e5c86634f22c3479 | @property
def first_name(self):
'\n Gets the first_name of this NewUser.\n\n :return: The first_name of this NewUser.\n :rtype: str\n '
return self._first_name | Gets the first_name of this NewUser.
:return: The first_name of this NewUser.
:rtype: str | smartrecruiters_python_client/models/new_user.py | first_name | roksela/smartrecruiters-python-client | 5 | python | @property
def first_name(self):
'\n Gets the first_name of this NewUser.\n\n :return: The first_name of this NewUser.\n :rtype: str\n '
return self._first_name | @property
def first_name(self):
'\n Gets the first_name of this NewUser.\n\n :return: The first_name of this NewUser.\n :rtype: str\n '
return self._first_name<|docstring|>Gets the first_name of this NewUser.
:return: The first_name of this NewUser.
:rtype: str<|endoftext|> |
c74b0e60faa4b4c9e12f14c46f5021ecfbef3951deb8098569040fcad9111c95 | @first_name.setter
def first_name(self, first_name):
'\n Sets the first_name of this NewUser.\n\n :param first_name: The first_name of this NewUser.\n :type: str\n '
if (first_name is None):
raise ValueError('Invalid value for `first_name`, must not be `None`')
if ((first_name is not None) and (len(first_name) > 300)):
raise ValueError('Invalid value for `first_name`, length must be less than or equal to `300`')
if ((first_name is not None) and (len(first_name) < 1)):
raise ValueError('Invalid value for `first_name`, length must be greater than or equal to `1`')
self._first_name = first_name | Sets the first_name of this NewUser.
:param first_name: The first_name of this NewUser.
:type: str | smartrecruiters_python_client/models/new_user.py | first_name | roksela/smartrecruiters-python-client | 5 | python | @first_name.setter
def first_name(self, first_name):
'\n Sets the first_name of this NewUser.\n\n :param first_name: The first_name of this NewUser.\n :type: str\n '
if (first_name is None):
raise ValueError('Invalid value for `first_name`, must not be `None`')
if ((first_name is not None) and (len(first_name) > 300)):
raise ValueError('Invalid value for `first_name`, length must be less than or equal to `300`')
if ((first_name is not None) and (len(first_name) < 1)):
raise ValueError('Invalid value for `first_name`, length must be greater than or equal to `1`')
self._first_name = first_name | @first_name.setter
def first_name(self, first_name):
'\n Sets the first_name of this NewUser.\n\n :param first_name: The first_name of this NewUser.\n :type: str\n '
if (first_name is None):
raise ValueError('Invalid value for `first_name`, must not be `None`')
if ((first_name is not None) and (len(first_name) > 300)):
raise ValueError('Invalid value for `first_name`, length must be less than or equal to `300`')
if ((first_name is not None) and (len(first_name) < 1)):
raise ValueError('Invalid value for `first_name`, length must be greater than or equal to `1`')
self._first_name = first_name<|docstring|>Sets the first_name of this NewUser.
:param first_name: The first_name of this NewUser.
:type: str<|endoftext|> |
19552a967b322d9a185311f09fe2723227fb61fd55f44ef8b6740b02e0f9b1bd | @property
def last_name(self):
'\n Gets the last_name of this NewUser.\n\n :return: The last_name of this NewUser.\n :rtype: str\n '
return self._last_name | Gets the last_name of this NewUser.
:return: The last_name of this NewUser.
:rtype: str | smartrecruiters_python_client/models/new_user.py | last_name | roksela/smartrecruiters-python-client | 5 | python | @property
def last_name(self):
'\n Gets the last_name of this NewUser.\n\n :return: The last_name of this NewUser.\n :rtype: str\n '
return self._last_name | @property
def last_name(self):
'\n Gets the last_name of this NewUser.\n\n :return: The last_name of this NewUser.\n :rtype: str\n '
return self._last_name<|docstring|>Gets the last_name of this NewUser.
:return: The last_name of this NewUser.
:rtype: str<|endoftext|> |
e909a1e3e49a221bf62537088c3d6b9df0f58e3b5be1c1533bb34959fa07afaa | @last_name.setter
def last_name(self, last_name):
'\n Sets the last_name of this NewUser.\n\n :param last_name: The last_name of this NewUser.\n :type: str\n '
if (last_name is None):
raise ValueError('Invalid value for `last_name`, must not be `None`')
if ((last_name is not None) and (len(last_name) > 300)):
raise ValueError('Invalid value for `last_name`, length must be less than or equal to `300`')
if ((last_name is not None) and (len(last_name) < 1)):
raise ValueError('Invalid value for `last_name`, length must be greater than or equal to `1`')
self._last_name = last_name | Sets the last_name of this NewUser.
:param last_name: The last_name of this NewUser.
:type: str | smartrecruiters_python_client/models/new_user.py | last_name | roksela/smartrecruiters-python-client | 5 | python | @last_name.setter
def last_name(self, last_name):
'\n Sets the last_name of this NewUser.\n\n :param last_name: The last_name of this NewUser.\n :type: str\n '
if (last_name is None):
raise ValueError('Invalid value for `last_name`, must not be `None`')
if ((last_name is not None) and (len(last_name) > 300)):
raise ValueError('Invalid value for `last_name`, length must be less than or equal to `300`')
if ((last_name is not None) and (len(last_name) < 1)):
raise ValueError('Invalid value for `last_name`, length must be greater than or equal to `1`')
self._last_name = last_name | @last_name.setter
def last_name(self, last_name):
'\n Sets the last_name of this NewUser.\n\n :param last_name: The last_name of this NewUser.\n :type: str\n '
if (last_name is None):
raise ValueError('Invalid value for `last_name`, must not be `None`')
if ((last_name is not None) and (len(last_name) > 300)):
raise ValueError('Invalid value for `last_name`, length must be less than or equal to `300`')
if ((last_name is not None) and (len(last_name) < 1)):
raise ValueError('Invalid value for `last_name`, length must be greater than or equal to `1`')
self._last_name = last_name<|docstring|>Sets the last_name of this NewUser.
:param last_name: The last_name of this NewUser.
:type: str<|endoftext|> |
2df55632442e1fe318d8c4d7e63edf53fd752e04c2ab7f710c92fd05762e3e20 | @property
def role(self):
'\n Gets the role of this NewUser.\n\n :return: The role of this NewUser.\n :rtype: str\n '
return self._role | Gets the role of this NewUser.
:return: The role of this NewUser.
:rtype: str | smartrecruiters_python_client/models/new_user.py | role | roksela/smartrecruiters-python-client | 5 | python | @property
def role(self):
'\n Gets the role of this NewUser.\n\n :return: The role of this NewUser.\n :rtype: str\n '
return self._role | @property
def role(self):
'\n Gets the role of this NewUser.\n\n :return: The role of this NewUser.\n :rtype: str\n '
return self._role<|docstring|>Gets the role of this NewUser.
:return: The role of this NewUser.
:rtype: str<|endoftext|> |
b68cb7e236f6084832371eca090397183eebd6dfda0e7377b0091c345f88c5e7 | @role.setter
def role(self, role):
'\n Sets the role of this NewUser.\n\n :param role: The role of this NewUser.\n :type: str\n '
allowed_values = ['EMPLOYEE', 'RESTRICTED', 'STANDARD', 'EXTENDED', 'ADMINISTRATOR']
if (role not in allowed_values):
raise ValueError('Invalid value for `role` ({0}), must be one of {1}'.format(role, allowed_values))
self._role = role | Sets the role of this NewUser.
:param role: The role of this NewUser.
:type: str | smartrecruiters_python_client/models/new_user.py | role | roksela/smartrecruiters-python-client | 5 | python | @role.setter
def role(self, role):
'\n Sets the role of this NewUser.\n\n :param role: The role of this NewUser.\n :type: str\n '
allowed_values = ['EMPLOYEE', 'RESTRICTED', 'STANDARD', 'EXTENDED', 'ADMINISTRATOR']
if (role not in allowed_values):
raise ValueError('Invalid value for `role` ({0}), must be one of {1}'.format(role, allowed_values))
self._role = role | @role.setter
def role(self, role):
'\n Sets the role of this NewUser.\n\n :param role: The role of this NewUser.\n :type: str\n '
allowed_values = ['EMPLOYEE', 'RESTRICTED', 'STANDARD', 'EXTENDED', 'ADMINISTRATOR']
if (role not in allowed_values):
raise ValueError('Invalid value for `role` ({0}), must be one of {1}'.format(role, allowed_values))
self._role = role<|docstring|>Sets the role of this NewUser.
:param role: The role of this NewUser.
:type: str<|endoftext|> |
9c72ce67a9e41630674a010801752b5e2f987f4b9b1cdb91ab06980d495554ec | @property
def external_data(self):
'\n Gets the external_data of this NewUser.\n\n :return: The external_data of this NewUser.\n :rtype: str\n '
return self._external_data | Gets the external_data of this NewUser.
:return: The external_data of this NewUser.
:rtype: str | smartrecruiters_python_client/models/new_user.py | external_data | roksela/smartrecruiters-python-client | 5 | python | @property
def external_data(self):
'\n Gets the external_data of this NewUser.\n\n :return: The external_data of this NewUser.\n :rtype: str\n '
return self._external_data | @property
def external_data(self):
'\n Gets the external_data of this NewUser.\n\n :return: The external_data of this NewUser.\n :rtype: str\n '
return self._external_data<|docstring|>Gets the external_data of this NewUser.
:return: The external_data of this NewUser.
:rtype: str<|endoftext|> |
c046f1b4231101caaebbaae420120077a3e723a06ba0f74b1348738df0c32986 | @external_data.setter
def external_data(self, external_data):
'\n Sets the external_data of this NewUser.\n\n :param external_data: The external_data of this NewUser.\n :type: str\n '
self._external_data = external_data | Sets the external_data of this NewUser.
:param external_data: The external_data of this NewUser.
:type: str | smartrecruiters_python_client/models/new_user.py | external_data | roksela/smartrecruiters-python-client | 5 | python | @external_data.setter
def external_data(self, external_data):
'\n Sets the external_data of this NewUser.\n\n :param external_data: The external_data of this NewUser.\n :type: str\n '
self._external_data = external_data | @external_data.setter
def external_data(self, external_data):
'\n Sets the external_data of this NewUser.\n\n :param external_data: The external_data of this NewUser.\n :type: str\n '
self._external_data = external_data<|docstring|>Sets the external_data of this NewUser.
:param external_data: The external_data of this NewUser.
:type: str<|endoftext|> |
da26f5af36ba91dfc767c580e84959e1ed0f919b2c4e1ff84d09c801be2209eb | @property
def language(self):
'\n Gets the language of this NewUser.\n\n :return: The language of this NewUser.\n :rtype: UserLanguage\n '
return self._language | Gets the language of this NewUser.
:return: The language of this NewUser.
:rtype: UserLanguage | smartrecruiters_python_client/models/new_user.py | language | roksela/smartrecruiters-python-client | 5 | python | @property
def language(self):
'\n Gets the language of this NewUser.\n\n :return: The language of this NewUser.\n :rtype: UserLanguage\n '
return self._language | @property
def language(self):
'\n Gets the language of this NewUser.\n\n :return: The language of this NewUser.\n :rtype: UserLanguage\n '
return self._language<|docstring|>Gets the language of this NewUser.
:return: The language of this NewUser.
:rtype: UserLanguage<|endoftext|> |
8a3e3eed5f5b094ac21670f3229e9045ff8ea72c951b3d0c3a33500657f48bca | @language.setter
def language(self, language):
'\n Sets the language of this NewUser.\n\n :param language: The language of this NewUser.\n :type: UserLanguage\n '
self._language = language | Sets the language of this NewUser.
:param language: The language of this NewUser.
:type: UserLanguage | smartrecruiters_python_client/models/new_user.py | language | roksela/smartrecruiters-python-client | 5 | python | @language.setter
def language(self, language):
'\n Sets the language of this NewUser.\n\n :param language: The language of this NewUser.\n :type: UserLanguage\n '
self._language = language | @language.setter
def language(self, language):
'\n Sets the language of this NewUser.\n\n :param language: The language of this NewUser.\n :type: UserLanguage\n '
self._language = language<|docstring|>Sets the language of this NewUser.
:param language: The language of this NewUser.
:type: UserLanguage<|endoftext|> |
ff47bd6edfaaf2270c8f5ea931dd4596fe4c8a37fedf3344c553b52ffff5a75c | @property
def sso_identifier(self):
'\n Gets the sso_identifier of this NewUser.\n\n :return: The sso_identifier of this NewUser.\n :rtype: str\n '
return self._sso_identifier | Gets the sso_identifier of this NewUser.
:return: The sso_identifier of this NewUser.
:rtype: str | smartrecruiters_python_client/models/new_user.py | sso_identifier | roksela/smartrecruiters-python-client | 5 | python | @property
def sso_identifier(self):
'\n Gets the sso_identifier of this NewUser.\n\n :return: The sso_identifier of this NewUser.\n :rtype: str\n '
return self._sso_identifier | @property
def sso_identifier(self):
'\n Gets the sso_identifier of this NewUser.\n\n :return: The sso_identifier of this NewUser.\n :rtype: str\n '
return self._sso_identifier<|docstring|>Gets the sso_identifier of this NewUser.
:return: The sso_identifier of this NewUser.
:rtype: str<|endoftext|> |
035c43548144ed986ad1a5db063954b292c7dfc16d27ff0fe0ad979e93240eb0 | @sso_identifier.setter
def sso_identifier(self, sso_identifier):
'\n Sets the sso_identifier of this NewUser.\n\n :param sso_identifier: The sso_identifier of this NewUser.\n :type: str\n '
self._sso_identifier = sso_identifier | Sets the sso_identifier of this NewUser.
:param sso_identifier: The sso_identifier of this NewUser.
:type: str | smartrecruiters_python_client/models/new_user.py | sso_identifier | roksela/smartrecruiters-python-client | 5 | python | @sso_identifier.setter
def sso_identifier(self, sso_identifier):
'\n Sets the sso_identifier of this NewUser.\n\n :param sso_identifier: The sso_identifier of this NewUser.\n :type: str\n '
self._sso_identifier = sso_identifier | @sso_identifier.setter
def sso_identifier(self, sso_identifier):
'\n Sets the sso_identifier of this NewUser.\n\n :param sso_identifier: The sso_identifier of this NewUser.\n :type: str\n '
self._sso_identifier = sso_identifier<|docstring|>Sets the sso_identifier of this NewUser.
:param sso_identifier: The sso_identifier of this NewUser.
:type: str<|endoftext|> |
69f930f2be344cc86989683df037a1d2db39a3de4bb4273b0ecd4be69a56ae93 | @property
def password(self):
'\n Gets the password of this NewUser.\n\n :return: The password of this NewUser.\n :rtype: str\n '
return self._password | Gets the password of this NewUser.
:return: The password of this NewUser.
:rtype: str | smartrecruiters_python_client/models/new_user.py | password | roksela/smartrecruiters-python-client | 5 | python | @property
def password(self):
'\n Gets the password of this NewUser.\n\n :return: The password of this NewUser.\n :rtype: str\n '
return self._password | @property
def password(self):
'\n Gets the password of this NewUser.\n\n :return: The password of this NewUser.\n :rtype: str\n '
return self._password<|docstring|>Gets the password of this NewUser.
:return: The password of this NewUser.
:rtype: str<|endoftext|> |
62812eb8504b2aa027bcddb2e59202c9b451c8f55d9ccd5e6b9cf1c0f6d55be9 | @password.setter
def password(self, password):
'\n Sets the password of this NewUser.\n\n :param password: The password of this NewUser.\n :type: str\n '
self._password = password | Sets the password of this NewUser.
:param password: The password of this NewUser.
:type: str | smartrecruiters_python_client/models/new_user.py | password | roksela/smartrecruiters-python-client | 5 | python | @password.setter
def password(self, password):
'\n Sets the password of this NewUser.\n\n :param password: The password of this NewUser.\n :type: str\n '
self._password = password | @password.setter
def password(self, password):
'\n Sets the password of this NewUser.\n\n :param password: The password of this NewUser.\n :type: str\n '
self._password = password<|docstring|>Sets the password of this NewUser.
:param password: The password of this NewUser.
:type: str<|endoftext|> |
a5f84adc272abc3124c145e64378a8575a2213f2fa43aa26c1c47682ff1c6454 | @property
def location(self):
'\n Gets the location of this NewUser.\n\n :return: The location of this NewUser.\n :rtype: Location\n '
return self._location | Gets the location of this NewUser.
:return: The location of this NewUser.
:rtype: Location | smartrecruiters_python_client/models/new_user.py | location | roksela/smartrecruiters-python-client | 5 | python | @property
def location(self):
'\n Gets the location of this NewUser.\n\n :return: The location of this NewUser.\n :rtype: Location\n '
return self._location | @property
def location(self):
'\n Gets the location of this NewUser.\n\n :return: The location of this NewUser.\n :rtype: Location\n '
return self._location<|docstring|>Gets the location of this NewUser.
:return: The location of this NewUser.
:rtype: Location<|endoftext|> |
55d777704b2425a9923e3238ebf1dbb8df04c03e438a83b0083c17e0e2b9950b | @location.setter
def location(self, location):
'\n Sets the location of this NewUser.\n\n :param location: The location of this NewUser.\n :type: Location\n '
self._location = location | Sets the location of this NewUser.
:param location: The location of this NewUser.
:type: Location | smartrecruiters_python_client/models/new_user.py | location | roksela/smartrecruiters-python-client | 5 | python | @location.setter
def location(self, location):
'\n Sets the location of this NewUser.\n\n :param location: The location of this NewUser.\n :type: Location\n '
self._location = location | @location.setter
def location(self, location):
'\n Sets the location of this NewUser.\n\n :param location: The location of this NewUser.\n :type: Location\n '
self._location = location<|docstring|>Sets the location of this NewUser.
:param location: The location of this NewUser.
:type: Location<|endoftext|> |
f92515cd38effc7eee4069f2288d78a0f0836df932fb36a84e3b4f7e14233415 | def to_dict(self):
'\n Returns the model properties as a dict\n '
result = {}
for (attr, _) in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items()))
else:
result[attr] = value
return result | Returns the model properties as a dict | smartrecruiters_python_client/models/new_user.py | to_dict | roksela/smartrecruiters-python-client | 5 | python | def to_dict(self):
'\n \n '
result = {}
for (attr, _) in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items()))
else:
result[attr] = value
return result | def to_dict(self):
'\n \n '
result = {}
for (attr, _) in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items()))
else:
result[attr] = value
return result<|docstring|>Returns the model properties as a dict<|endoftext|> |
c373d87dd29c1e96dce460ab571bff86e58edb298ba83c85d8cc7603a6505de4 | def to_str(self):
'\n Returns the string representation of the model\n '
return pformat(self.to_dict()) | Returns the string representation of the model | smartrecruiters_python_client/models/new_user.py | to_str | roksela/smartrecruiters-python-client | 5 | python | def to_str(self):
'\n \n '
return pformat(self.to_dict()) | def to_str(self):
'\n \n '
return pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|> |
1034ff7dd2eef24d21e3c2fa7409b793ab5cbb8cd75a2eb0ab3e62604b26264d | def __repr__(self):
'\n For `print` and `pprint`\n '
return self.to_str() | For `print` and `pprint` | smartrecruiters_python_client/models/new_user.py | __repr__ | roksela/smartrecruiters-python-client | 5 | python | def __repr__(self):
'\n \n '
return self.to_str() | def __repr__(self):
'\n \n '
return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|> |
e769ce4da55e553c79c8eaaf9de92dc37a3bc322cb71b65176e34708fb0e08fe | def __eq__(self, other):
'\n Returns true if both objects are equal\n '
if (not isinstance(other, NewUser)):
return False
return (self.__dict__ == other.__dict__) | Returns true if both objects are equal | smartrecruiters_python_client/models/new_user.py | __eq__ | roksela/smartrecruiters-python-client | 5 | python | def __eq__(self, other):
'\n \n '
if (not isinstance(other, NewUser)):
return False
return (self.__dict__ == other.__dict__) | def __eq__(self, other):
'\n \n '
if (not isinstance(other, NewUser)):
return False
return (self.__dict__ == other.__dict__)<|docstring|>Returns true if both objects are equal<|endoftext|> |
e5050f8e1402e3a4c90d6c6e229c4c9e2b8ec61e0be457915ea9d976f7e6b0b4 | def __ne__(self, other):
'\n Returns true if both objects are not equal\n '
return (not (self == other)) | Returns true if both objects are not equal | smartrecruiters_python_client/models/new_user.py | __ne__ | roksela/smartrecruiters-python-client | 5 | python | def __ne__(self, other):
'\n \n '
return (not (self == other)) | def __ne__(self, other):
'\n \n '
return (not (self == other))<|docstring|>Returns true if both objects are not equal<|endoftext|> |
b6b8ac86a44b4adbd31f26af7f2e507daa5a400f57618bdc2d107167bd4f302f | def __init__(self, now):
'Creates and returns a new reconnect FSM with default settings. The\n FSM is initially disabled. The caller will likely want to call\n self.enable() and self.set_name() on the returned object.'
self.name = 'void'
self.min_backoff = 1000
self.max_backoff = 8000
self.probe_interval = 5000
self.passive = False
self.info_level = vlog.info
self.state = Reconnect.Void
self.state_entered = now
self.backoff = 0
self.last_activity = now
self.last_connected = None
self.last_disconnected = None
self.last_receive_attempt = now
self.max_tries = None
self.backoff_free_tries = 0
self.creation_time = now
self.n_attempted_connections = 0
self.n_successful_connections = 0
self.total_connected_duration = 0
self.seqno = 0 | Creates and returns a new reconnect FSM with default settings. The
FSM is initially disabled. The caller will likely want to call
self.enable() and self.set_name() on the returned object. | python/ovs/reconnect.py | __init__ | check-spelling/ovs | 2,919 | python | def __init__(self, now):
'Creates and returns a new reconnect FSM with default settings. The\n FSM is initially disabled. The caller will likely want to call\n self.enable() and self.set_name() on the returned object.'
self.name = 'void'
self.min_backoff = 1000
self.max_backoff = 8000
self.probe_interval = 5000
self.passive = False
self.info_level = vlog.info
self.state = Reconnect.Void
self.state_entered = now
self.backoff = 0
self.last_activity = now
self.last_connected = None
self.last_disconnected = None
self.last_receive_attempt = now
self.max_tries = None
self.backoff_free_tries = 0
self.creation_time = now
self.n_attempted_connections = 0
self.n_successful_connections = 0
self.total_connected_duration = 0
self.seqno = 0 | def __init__(self, now):
'Creates and returns a new reconnect FSM with default settings. The\n FSM is initially disabled. The caller will likely want to call\n self.enable() and self.set_name() on the returned object.'
self.name = 'void'
self.min_backoff = 1000
self.max_backoff = 8000
self.probe_interval = 5000
self.passive = False
self.info_level = vlog.info
self.state = Reconnect.Void
self.state_entered = now
self.backoff = 0
self.last_activity = now
self.last_connected = None
self.last_disconnected = None
self.last_receive_attempt = now
self.max_tries = None
self.backoff_free_tries = 0
self.creation_time = now
self.n_attempted_connections = 0
self.n_successful_connections = 0
self.total_connected_duration = 0
self.seqno = 0<|docstring|>Creates and returns a new reconnect FSM with default settings. The
FSM is initially disabled. The caller will likely want to call
self.enable() and self.set_name() on the returned object.<|endoftext|> |
6c294229310620c36762a4801b2184758953211d3a5c9d64eee20fbce72192e8 | def set_quiet(self, quiet):
"If 'quiet' is true, this object will log informational messages at\n debug level, by default keeping them out of log files. This is\n appropriate if the connection is one that is expected to be\n short-lived, so that the log messages are merely distracting.\n\n If 'quiet' is false, this object logs informational messages at info\n level. This is the default.\n\n This setting has no effect on the log level of debugging, warning, or\n error messages."
if quiet:
self.info_level = vlog.dbg
else:
self.info_level = vlog.info | If 'quiet' is true, this object will log informational messages at
debug level, by default keeping them out of log files. This is
appropriate if the connection is one that is expected to be
short-lived, so that the log messages are merely distracting.
If 'quiet' is false, this object logs informational messages at info
level. This is the default.
This setting has no effect on the log level of debugging, warning, or
error messages. | python/ovs/reconnect.py | set_quiet | check-spelling/ovs | 2,919 | python | def set_quiet(self, quiet):
"If 'quiet' is true, this object will log informational messages at\n debug level, by default keeping them out of log files. This is\n appropriate if the connection is one that is expected to be\n short-lived, so that the log messages are merely distracting.\n\n If 'quiet' is false, this object logs informational messages at info\n level. This is the default.\n\n This setting has no effect on the log level of debugging, warning, or\n error messages."
if quiet:
self.info_level = vlog.dbg
else:
self.info_level = vlog.info | def set_quiet(self, quiet):
"If 'quiet' is true, this object will log informational messages at\n debug level, by default keeping them out of log files. This is\n appropriate if the connection is one that is expected to be\n short-lived, so that the log messages are merely distracting.\n\n If 'quiet' is false, this object logs informational messages at info\n level. This is the default.\n\n This setting has no effect on the log level of debugging, warning, or\n error messages."
if quiet:
self.info_level = vlog.dbg
else:
self.info_level = vlog.info<|docstring|>If 'quiet' is true, this object will log informational messages at
debug level, by default keeping them out of log files. This is
appropriate if the connection is one that is expected to be
short-lived, so that the log messages are merely distracting.
If 'quiet' is false, this object logs informational messages at info
level. This is the default.
This setting has no effect on the log level of debugging, warning, or
error messages.<|endoftext|> |
0dbfe6f61705afa33e7e3f724835119141e4058d9cca41dfe293c81a547032db | def set_name(self, name):
'Sets this object\'s name to \'name\'. If \'name\' is None, then "void"\n is used instead.\n\n The name is used in log messages.'
if (name is None):
self.name = 'void'
else:
self.name = name | Sets this object's name to 'name'. If 'name' is None, then "void"
is used instead.
The name is used in log messages. | python/ovs/reconnect.py | set_name | check-spelling/ovs | 2,919 | python | def set_name(self, name):
'Sets this object\'s name to \'name\'. If \'name\' is None, then "void"\n is used instead.\n\n The name is used in log messages.'
if (name is None):
self.name = 'void'
else:
self.name = name | def set_name(self, name):
'Sets this object\'s name to \'name\'. If \'name\' is None, then "void"\n is used instead.\n\n The name is used in log messages.'
if (name is None):
self.name = 'void'
else:
self.name = name<|docstring|>Sets this object's name to 'name'. If 'name' is None, then "void"
is used instead.
The name is used in log messages.<|endoftext|> |
63ee64b23139ffd8ade99838f796beeba963f47f6e00cca230d8d09f6bb98e8c | def get_min_backoff(self):
'Return the minimum number of milliseconds to back off between\n consecutive connection attempts. The default is 1000 ms.'
return self.min_backoff | Return the minimum number of milliseconds to back off between
consecutive connection attempts. The default is 1000 ms. | python/ovs/reconnect.py | get_min_backoff | check-spelling/ovs | 2,919 | python | def get_min_backoff(self):
'Return the minimum number of milliseconds to back off between\n consecutive connection attempts. The default is 1000 ms.'
return self.min_backoff | def get_min_backoff(self):
'Return the minimum number of milliseconds to back off between\n consecutive connection attempts. The default is 1000 ms.'
return self.min_backoff<|docstring|>Return the minimum number of milliseconds to back off between
consecutive connection attempts. The default is 1000 ms.<|endoftext|> |
869d61cfd224b4203976522dc5720365c8a2e5962a19b9bea5142308954f6638 | def get_max_backoff(self):
'Return the maximum number of milliseconds to back off between\n consecutive connection attempts. The default is 8000 ms.'
return self.max_backoff | Return the maximum number of milliseconds to back off between
consecutive connection attempts. The default is 8000 ms. | python/ovs/reconnect.py | get_max_backoff | check-spelling/ovs | 2,919 | python | def get_max_backoff(self):
'Return the maximum number of milliseconds to back off between\n consecutive connection attempts. The default is 8000 ms.'
return self.max_backoff | def get_max_backoff(self):
'Return the maximum number of milliseconds to back off between\n consecutive connection attempts. The default is 8000 ms.'
return self.max_backoff<|docstring|>Return the maximum number of milliseconds to back off between
consecutive connection attempts. The default is 8000 ms.<|endoftext|> |
0bdde25daf790d2fad6a8bf4f3d44982db9956af28b3b066c7c1fdc2b1dbc506 | def get_probe_interval(self):
'Returns the "probe interval" in milliseconds. If this is zero, it\n disables the connection keepalive feature. If it is nonzero, then if\n the interval passes while the FSM is connected and without\n self.activity() being called, self.run() returns ovs.reconnect.PROBE.\n If the interval passes again without self.activity() being called,\n self.run() returns ovs.reconnect.DISCONNECT.'
return self.probe_interval | Returns the "probe interval" in milliseconds. If this is zero, it
disables the connection keepalive feature. If it is nonzero, then if
the interval passes while the FSM is connected and without
self.activity() being called, self.run() returns ovs.reconnect.PROBE.
If the interval passes again without self.activity() being called,
self.run() returns ovs.reconnect.DISCONNECT. | python/ovs/reconnect.py | get_probe_interval | check-spelling/ovs | 2,919 | python | def get_probe_interval(self):
'Returns the "probe interval" in milliseconds. If this is zero, it\n disables the connection keepalive feature. If it is nonzero, then if\n the interval passes while the FSM is connected and without\n self.activity() being called, self.run() returns ovs.reconnect.PROBE.\n If the interval passes again without self.activity() being called,\n self.run() returns ovs.reconnect.DISCONNECT.'
return self.probe_interval | def get_probe_interval(self):
'Returns the "probe interval" in milliseconds. If this is zero, it\n disables the connection keepalive feature. If it is nonzero, then if\n the interval passes while the FSM is connected and without\n self.activity() being called, self.run() returns ovs.reconnect.PROBE.\n If the interval passes again without self.activity() being called,\n self.run() returns ovs.reconnect.DISCONNECT.'
return self.probe_interval<|docstring|>Returns the "probe interval" in milliseconds. If this is zero, it
disables the connection keepalive feature. If it is nonzero, then if
the interval passes while the FSM is connected and without
self.activity() being called, self.run() returns ovs.reconnect.PROBE.
If the interval passes again without self.activity() being called,
self.run() returns ovs.reconnect.DISCONNECT.<|endoftext|> |
24ce377871076468d684225af52d0f379aa9fbf9abba576282153f68e2778937 | def set_max_tries(self, max_tries):
"Limits the maximum number of times that this object will ask the\n client to try to reconnect to 'max_tries'. None (the default) means an\n unlimited number of tries.\n\n After the number of tries has expired, the FSM will disable itself\n instead of backing off and retrying."
self.max_tries = max_tries | Limits the maximum number of times that this object will ask the
client to try to reconnect to 'max_tries'. None (the default) means an
unlimited number of tries.
After the number of tries has expired, the FSM will disable itself
instead of backing off and retrying. | python/ovs/reconnect.py | set_max_tries | check-spelling/ovs | 2,919 | python | def set_max_tries(self, max_tries):
"Limits the maximum number of times that this object will ask the\n client to try to reconnect to 'max_tries'. None (the default) means an\n unlimited number of tries.\n\n After the number of tries has expired, the FSM will disable itself\n instead of backing off and retrying."
self.max_tries = max_tries | def set_max_tries(self, max_tries):
"Limits the maximum number of times that this object will ask the\n client to try to reconnect to 'max_tries'. None (the default) means an\n unlimited number of tries.\n\n After the number of tries has expired, the FSM will disable itself\n instead of backing off and retrying."
self.max_tries = max_tries<|docstring|>Limits the maximum number of times that this object will ask the
client to try to reconnect to 'max_tries'. None (the default) means an
unlimited number of tries.
After the number of tries has expired, the FSM will disable itself
instead of backing off and retrying.<|endoftext|> |
ccbf93e4bcc75a76e561aa6af143d19cf496d7c143207b9624087d841257bedc | def get_max_tries(self):
'Returns the current remaining number of connection attempts,\n None if the number is unlimited.'
return self.max_tries | Returns the current remaining number of connection attempts,
None if the number is unlimited. | python/ovs/reconnect.py | get_max_tries | check-spelling/ovs | 2,919 | python | def get_max_tries(self):
'Returns the current remaining number of connection attempts,\n None if the number is unlimited.'
return self.max_tries | def get_max_tries(self):
'Returns the current remaining number of connection attempts,\n None if the number is unlimited.'
return self.max_tries<|docstring|>Returns the current remaining number of connection attempts,
None if the number is unlimited.<|endoftext|> |
4e89242ce720d09f261b7dac53ea47b8ac894b8859d252d59f992179a5de7204 | def set_backoff(self, min_backoff, max_backoff):
"Configures the backoff parameters for this FSM. 'min_backoff' is\n the minimum number of milliseconds, and 'max_backoff' is the maximum,\n between connection attempts.\n\n 'min_backoff' must be at least 1000, and 'max_backoff' must be greater\n than or equal to 'min_backoff'."
self.min_backoff = max(min_backoff, 1000)
if self.max_backoff:
self.max_backoff = max(max_backoff, 1000)
else:
self.max_backoff = 8000
if (self.min_backoff > self.max_backoff):
self.max_backoff = self.min_backoff
if ((self.state == Reconnect.Backoff) and (self.backoff > self.max_backoff)):
self.backoff = self.max_backoff | Configures the backoff parameters for this FSM. 'min_backoff' is
the minimum number of milliseconds, and 'max_backoff' is the maximum,
between connection attempts.
'min_backoff' must be at least 1000, and 'max_backoff' must be greater
than or equal to 'min_backoff'. | python/ovs/reconnect.py | set_backoff | check-spelling/ovs | 2,919 | python | def set_backoff(self, min_backoff, max_backoff):
"Configures the backoff parameters for this FSM. 'min_backoff' is\n the minimum number of milliseconds, and 'max_backoff' is the maximum,\n between connection attempts.\n\n 'min_backoff' must be at least 1000, and 'max_backoff' must be greater\n than or equal to 'min_backoff'."
self.min_backoff = max(min_backoff, 1000)
if self.max_backoff:
self.max_backoff = max(max_backoff, 1000)
else:
self.max_backoff = 8000
if (self.min_backoff > self.max_backoff):
self.max_backoff = self.min_backoff
if ((self.state == Reconnect.Backoff) and (self.backoff > self.max_backoff)):
self.backoff = self.max_backoff | def set_backoff(self, min_backoff, max_backoff):
"Configures the backoff parameters for this FSM. 'min_backoff' is\n the minimum number of milliseconds, and 'max_backoff' is the maximum,\n between connection attempts.\n\n 'min_backoff' must be at least 1000, and 'max_backoff' must be greater\n than or equal to 'min_backoff'."
self.min_backoff = max(min_backoff, 1000)
if self.max_backoff:
self.max_backoff = max(max_backoff, 1000)
else:
self.max_backoff = 8000
if (self.min_backoff > self.max_backoff):
self.max_backoff = self.min_backoff
if ((self.state == Reconnect.Backoff) and (self.backoff > self.max_backoff)):
self.backoff = self.max_backoff<|docstring|>Configures the backoff parameters for this FSM. 'min_backoff' is
the minimum number of milliseconds, and 'max_backoff' is the maximum,
between connection attempts.
'min_backoff' must be at least 1000, and 'max_backoff' must be greater
than or equal to 'min_backoff'.<|endoftext|> |
d2cec5aeeaec1e968ae47b350ad82536cefe234ad631ba64e7f8d0994b7d7519 | def set_backoff_free_tries(self, backoff_free_tries):
"Sets the number of connection attempts that will be made without\n backoff to 'backoff_free_tries'. Values 0 and 1 both\n represent a single attempt."
self.backoff_free_tries = backoff_free_tries | Sets the number of connection attempts that will be made without
backoff to 'backoff_free_tries'. Values 0 and 1 both
represent a single attempt. | python/ovs/reconnect.py | set_backoff_free_tries | check-spelling/ovs | 2,919 | python | def set_backoff_free_tries(self, backoff_free_tries):
"Sets the number of connection attempts that will be made without\n backoff to 'backoff_free_tries'. Values 0 and 1 both\n represent a single attempt."
self.backoff_free_tries = backoff_free_tries | def set_backoff_free_tries(self, backoff_free_tries):
"Sets the number of connection attempts that will be made without\n backoff to 'backoff_free_tries'. Values 0 and 1 both\n represent a single attempt."
self.backoff_free_tries = backoff_free_tries<|docstring|>Sets the number of connection attempts that will be made without
backoff to 'backoff_free_tries'. Values 0 and 1 both
represent a single attempt.<|endoftext|> |
cb362ce35baf75f4220ee2a6fdd8e75b35040ce5fbc1ea5456516cb66e4e1d76 | def set_probe_interval(self, probe_interval):
'Sets the "probe interval" to \'probe_interval\', in milliseconds. If\n this is zero, it disables the connection keepalive feature. If it is\n nonzero, then if the interval passes while this FSM is connected and\n without self.activity() being called, self.run() returns\n ovs.reconnect.PROBE. If the interval passes again without\n self.activity() being called, self.run() returns\n ovs.reconnect.DISCONNECT.\n\n If \'probe_interval\' is nonzero, then it will be forced to a value of at\n least 1000 ms.'
if probe_interval:
self.probe_interval = max(1000, probe_interval)
else:
self.probe_interval = 0 | Sets the "probe interval" to 'probe_interval', in milliseconds. If
this is zero, it disables the connection keepalive feature. If it is
nonzero, then if the interval passes while this FSM is connected and
without self.activity() being called, self.run() returns
ovs.reconnect.PROBE. If the interval passes again without
self.activity() being called, self.run() returns
ovs.reconnect.DISCONNECT.
If 'probe_interval' is nonzero, then it will be forced to a value of at
least 1000 ms. | python/ovs/reconnect.py | set_probe_interval | check-spelling/ovs | 2,919 | python | def set_probe_interval(self, probe_interval):
'Sets the "probe interval" to \'probe_interval\', in milliseconds. If\n this is zero, it disables the connection keepalive feature. If it is\n nonzero, then if the interval passes while this FSM is connected and\n without self.activity() being called, self.run() returns\n ovs.reconnect.PROBE. If the interval passes again without\n self.activity() being called, self.run() returns\n ovs.reconnect.DISCONNECT.\n\n If \'probe_interval\' is nonzero, then it will be forced to a value of at\n least 1000 ms.'
if probe_interval:
self.probe_interval = max(1000, probe_interval)
else:
self.probe_interval = 0 | def set_probe_interval(self, probe_interval):
'Sets the "probe interval" to \'probe_interval\', in milliseconds. If\n this is zero, it disables the connection keepalive feature. If it is\n nonzero, then if the interval passes while this FSM is connected and\n without self.activity() being called, self.run() returns\n ovs.reconnect.PROBE. If the interval passes again without\n self.activity() being called, self.run() returns\n ovs.reconnect.DISCONNECT.\n\n If \'probe_interval\' is nonzero, then it will be forced to a value of at\n least 1000 ms.'
if probe_interval:
self.probe_interval = max(1000, probe_interval)
else:
self.probe_interval = 0<|docstring|>Sets the "probe interval" to 'probe_interval', in milliseconds. If
this is zero, it disables the connection keepalive feature. If it is
nonzero, then if the interval passes while this FSM is connected and
without self.activity() being called, self.run() returns
ovs.reconnect.PROBE. If the interval passes again without
self.activity() being called, self.run() returns
ovs.reconnect.DISCONNECT.
If 'probe_interval' is nonzero, then it will be forced to a value of at
least 1000 ms.<|endoftext|> |
2c4c65c2b129d19d7839649f56c9351883deee0915efae6bac2fbcc54fa9f675 | def is_passive(self):
"Returns true if 'fsm' is in passive mode, false if 'fsm' is in\n active mode (the default)."
return self.passive | Returns true if 'fsm' is in passive mode, false if 'fsm' is in
active mode (the default). | python/ovs/reconnect.py | is_passive | check-spelling/ovs | 2,919 | python | def is_passive(self):
"Returns true if 'fsm' is in passive mode, false if 'fsm' is in\n active mode (the default)."
return self.passive | def is_passive(self):
"Returns true if 'fsm' is in passive mode, false if 'fsm' is in\n active mode (the default)."
return self.passive<|docstring|>Returns true if 'fsm' is in passive mode, false if 'fsm' is in
active mode (the default).<|endoftext|> |
65fd3d57bf7f031332d6f682914e3433a11c58d6e43874bbc2edde2fe30a43d9 | def set_passive(self, passive, now):
'Configures this FSM for active or passive mode. In active mode (the\n default), the FSM is attempting to connect to a remote host. In\n passive mode, the FSM is listening for connections from a remote\n host.'
if (self.passive != passive):
self.passive = passive
if ((passive and (self.state in (Reconnect.ConnectInProgress, Reconnect.Reconnect))) or ((not passive) and (self.state == Reconnect.Listening) and self.__may_retry())):
self._transition(now, Reconnect.Backoff)
self.backoff = 0 | Configures this FSM for active or passive mode. In active mode (the
default), the FSM is attempting to connect to a remote host. In
passive mode, the FSM is listening for connections from a remote
host. | python/ovs/reconnect.py | set_passive | check-spelling/ovs | 2,919 | python | def set_passive(self, passive, now):
'Configures this FSM for active or passive mode. In active mode (the\n default), the FSM is attempting to connect to a remote host. In\n passive mode, the FSM is listening for connections from a remote\n host.'
if (self.passive != passive):
self.passive = passive
if ((passive and (self.state in (Reconnect.ConnectInProgress, Reconnect.Reconnect))) or ((not passive) and (self.state == Reconnect.Listening) and self.__may_retry())):
self._transition(now, Reconnect.Backoff)
self.backoff = 0 | def set_passive(self, passive, now):
'Configures this FSM for active or passive mode. In active mode (the\n default), the FSM is attempting to connect to a remote host. In\n passive mode, the FSM is listening for connections from a remote\n host.'
if (self.passive != passive):
self.passive = passive
if ((passive and (self.state in (Reconnect.ConnectInProgress, Reconnect.Reconnect))) or ((not passive) and (self.state == Reconnect.Listening) and self.__may_retry())):
self._transition(now, Reconnect.Backoff)
self.backoff = 0<|docstring|>Configures this FSM for active or passive mode. In active mode (the
default), the FSM is attempting to connect to a remote host. In
passive mode, the FSM is listening for connections from a remote
host.<|endoftext|> |
609f49306de41d296ecb57d182e6b77358fb069f61d02d248d16be9a7b190878 | def is_enabled(self):
'Returns true if this FSM has been enabled with self.enable().\n Calling another function that indicates a change in connection state,\n such as self.disconnected() or self.force_reconnect(), will also enable\n a reconnect FSM.'
return (self.state != Reconnect.Void) | Returns true if this FSM has been enabled with self.enable().
Calling another function that indicates a change in connection state,
such as self.disconnected() or self.force_reconnect(), will also enable
a reconnect FSM. | python/ovs/reconnect.py | is_enabled | check-spelling/ovs | 2,919 | python | def is_enabled(self):
'Returns true if this FSM has been enabled with self.enable().\n Calling another function that indicates a change in connection state,\n such as self.disconnected() or self.force_reconnect(), will also enable\n a reconnect FSM.'
return (self.state != Reconnect.Void) | def is_enabled(self):
'Returns true if this FSM has been enabled with self.enable().\n Calling another function that indicates a change in connection state,\n such as self.disconnected() or self.force_reconnect(), will also enable\n a reconnect FSM.'
return (self.state != Reconnect.Void)<|docstring|>Returns true if this FSM has been enabled with self.enable().
Calling another function that indicates a change in connection state,
such as self.disconnected() or self.force_reconnect(), will also enable
a reconnect FSM.<|endoftext|> |
3334ddb1531bb21f3bc4197dee842825bf54988c58c97a00d3024b2a38fa7e67 | def enable(self, now):
"If this FSM is disabled (the default for newly created FSMs),\n enables it, so that the next call to reconnect_run() for 'fsm' will\n return ovs.reconnect.CONNECT.\n\n If this FSM is not disabled, this function has no effect."
if ((self.state == Reconnect.Void) and self.__may_retry()):
self._transition(now, Reconnect.Backoff)
self.backoff = 0 | If this FSM is disabled (the default for newly created FSMs),
enables it, so that the next call to reconnect_run() for 'fsm' will
return ovs.reconnect.CONNECT.
If this FSM is not disabled, this function has no effect. | python/ovs/reconnect.py | enable | check-spelling/ovs | 2,919 | python | def enable(self, now):
"If this FSM is disabled (the default for newly created FSMs),\n enables it, so that the next call to reconnect_run() for 'fsm' will\n return ovs.reconnect.CONNECT.\n\n If this FSM is not disabled, this function has no effect."
if ((self.state == Reconnect.Void) and self.__may_retry()):
self._transition(now, Reconnect.Backoff)
self.backoff = 0 | def enable(self, now):
"If this FSM is disabled (the default for newly created FSMs),\n enables it, so that the next call to reconnect_run() for 'fsm' will\n return ovs.reconnect.CONNECT.\n\n If this FSM is not disabled, this function has no effect."
if ((self.state == Reconnect.Void) and self.__may_retry()):
self._transition(now, Reconnect.Backoff)
self.backoff = 0<|docstring|>If this FSM is disabled (the default for newly created FSMs),
enables it, so that the next call to reconnect_run() for 'fsm' will
return ovs.reconnect.CONNECT.
If this FSM is not disabled, this function has no effect.<|endoftext|> |
d183aec52c119f96e709144563e999d722e3420af5ac35f3406f9511d4684369 | def disable(self, now):
"Disables this FSM. Until 'fsm' is enabled again, self.run() will\n always return 0."
if (self.state != Reconnect.Void):
self._transition(now, Reconnect.Void) | Disables this FSM. Until 'fsm' is enabled again, self.run() will
always return 0. | python/ovs/reconnect.py | disable | check-spelling/ovs | 2,919 | python | def disable(self, now):
"Disables this FSM. Until 'fsm' is enabled again, self.run() will\n always return 0."
if (self.state != Reconnect.Void):
self._transition(now, Reconnect.Void) | def disable(self, now):
"Disables this FSM. Until 'fsm' is enabled again, self.run() will\n always return 0."
if (self.state != Reconnect.Void):
self._transition(now, Reconnect.Void)<|docstring|>Disables this FSM. Until 'fsm' is enabled again, self.run() will
always return 0.<|endoftext|> |
32966660e80184022e5fb2b4fabf9f55ebf4462d300b28c6c324a632f7cae697 | def force_reconnect(self, now):
'If this FSM is enabled and currently connected (or attempting to\n connect), forces self.run() to return ovs.reconnect.DISCONNECT the next\n time it is called, which should cause the client to drop the connection\n (or attempt), back off, and then reconnect.'
if (self.state in (Reconnect.ConnectInProgress, Reconnect.Active, Reconnect.Idle)):
self._transition(now, Reconnect.Reconnect) | If this FSM is enabled and currently connected (or attempting to
connect), forces self.run() to return ovs.reconnect.DISCONNECT the next
time it is called, which should cause the client to drop the connection
(or attempt), back off, and then reconnect. | python/ovs/reconnect.py | force_reconnect | check-spelling/ovs | 2,919 | python | def force_reconnect(self, now):
'If this FSM is enabled and currently connected (or attempting to\n connect), forces self.run() to return ovs.reconnect.DISCONNECT the next\n time it is called, which should cause the client to drop the connection\n (or attempt), back off, and then reconnect.'
if (self.state in (Reconnect.ConnectInProgress, Reconnect.Active, Reconnect.Idle)):
self._transition(now, Reconnect.Reconnect) | def force_reconnect(self, now):
'If this FSM is enabled and currently connected (or attempting to\n connect), forces self.run() to return ovs.reconnect.DISCONNECT the next\n time it is called, which should cause the client to drop the connection\n (or attempt), back off, and then reconnect.'
if (self.state in (Reconnect.ConnectInProgress, Reconnect.Active, Reconnect.Idle)):
self._transition(now, Reconnect.Reconnect)<|docstring|>If this FSM is enabled and currently connected (or attempting to
connect), forces self.run() to return ovs.reconnect.DISCONNECT the next
time it is called, which should cause the client to drop the connection
(or attempt), back off, and then reconnect.<|endoftext|> |
c71a881ea799c17622587ca7d4e7a10d44f65cbc886bff5796191bf49e0abff4 | def disconnected(self, now, error):
"Tell this FSM that the connection dropped or that a connection\n attempt failed. 'error' specifies the reason: a positive value\n represents an errno value, EOF indicates that the connection was closed\n by the peer (e.g. read() returned 0), and 0 indicates no specific\n error.\n\n The FSM will back off, then reconnect."
if (self.state not in (Reconnect.Backoff, Reconnect.Void)):
if (self.state in (Reconnect.Active, Reconnect.Idle)):
if (error > 0):
vlog.warn(('%s: connection dropped (%s)' % (self.name, os.strerror(error))))
elif (error == EOF):
self.info_level(('%s: connection closed by peer' % self.name))
else:
self.info_level(('%s: connection dropped' % self.name))
elif (self.state == Reconnect.Listening):
if (error > 0):
vlog.warn(('%s: error listening for connections (%s)' % (self.name, os.strerror(error))))
else:
self.info_level(('%s: error listening for connections' % self.name))
elif (self.state == Reconnect.Reconnect):
self.info_level(('%s: connection closed by client' % self.name))
elif (self.backoff < self.max_backoff):
if self.passive:
type_ = 'listen'
else:
type_ = 'connection'
if (error > 0):
vlog.warn(('%s: %s attempt failed (%s)' % (self.name, type_, os.strerror(error))))
else:
self.info_level(('%s: %s attempt timed out' % (self.name, type_)))
if (self.state in (Reconnect.Active, Reconnect.Idle)):
self.last_disconnected = now
if (not self.__may_retry()):
self._transition(now, Reconnect.Void)
return
if (self.backoff_free_tries > 1):
self.backoff_free_tries -= 1
self.backoff = 0
elif ((self.state in (Reconnect.Active, Reconnect.Idle)) and (((self.last_activity - self.last_connected) >= self.backoff) or self.passive)):
if self.passive:
self.backoff = 0
else:
self.backoff = self.min_backoff
elif (self.backoff < self.min_backoff):
self.backoff = self.min_backoff
elif (self.backoff < (self.max_backoff / 2)):
self.backoff *= 2
if self.passive:
action = 'trying to listen again'
else:
action = 'reconnect'
self.info_level(('%s: waiting %.3g seconds before %s' % (self.name, (self.backoff / 1000.0), action)))
else:
if (self.backoff < self.max_backoff):
if self.passive:
action = 'try to listen'
else:
action = 'reconnect'
self.info_level(('%s: continuing to %s in the background but suppressing further logging' % (self.name, action)))
self.backoff = self.max_backoff
self._transition(now, Reconnect.Backoff) | Tell this FSM that the connection dropped or that a connection
attempt failed. 'error' specifies the reason: a positive value
represents an errno value, EOF indicates that the connection was closed
by the peer (e.g. read() returned 0), and 0 indicates no specific
error.
The FSM will back off, then reconnect. | python/ovs/reconnect.py | disconnected | check-spelling/ovs | 2,919 | python | def disconnected(self, now, error):
"Tell this FSM that the connection dropped or that a connection\n attempt failed. 'error' specifies the reason: a positive value\n represents an errno value, EOF indicates that the connection was closed\n by the peer (e.g. read() returned 0), and 0 indicates no specific\n error.\n\n The FSM will back off, then reconnect."
if (self.state not in (Reconnect.Backoff, Reconnect.Void)):
if (self.state in (Reconnect.Active, Reconnect.Idle)):
if (error > 0):
vlog.warn(('%s: connection dropped (%s)' % (self.name, os.strerror(error))))
elif (error == EOF):
self.info_level(('%s: connection closed by peer' % self.name))
else:
self.info_level(('%s: connection dropped' % self.name))
elif (self.state == Reconnect.Listening):
if (error > 0):
vlog.warn(('%s: error listening for connections (%s)' % (self.name, os.strerror(error))))
else:
self.info_level(('%s: error listening for connections' % self.name))
elif (self.state == Reconnect.Reconnect):
self.info_level(('%s: connection closed by client' % self.name))
elif (self.backoff < self.max_backoff):
if self.passive:
type_ = 'listen'
else:
type_ = 'connection'
if (error > 0):
vlog.warn(('%s: %s attempt failed (%s)' % (self.name, type_, os.strerror(error))))
else:
self.info_level(('%s: %s attempt timed out' % (self.name, type_)))
if (self.state in (Reconnect.Active, Reconnect.Idle)):
self.last_disconnected = now
if (not self.__may_retry()):
self._transition(now, Reconnect.Void)
return
if (self.backoff_free_tries > 1):
self.backoff_free_tries -= 1
self.backoff = 0
elif ((self.state in (Reconnect.Active, Reconnect.Idle)) and (((self.last_activity - self.last_connected) >= self.backoff) or self.passive)):
if self.passive:
self.backoff = 0
else:
self.backoff = self.min_backoff
elif (self.backoff < self.min_backoff):
self.backoff = self.min_backoff
elif (self.backoff < (self.max_backoff / 2)):
self.backoff *= 2
if self.passive:
action = 'trying to listen again'
else:
action = 'reconnect'
self.info_level(('%s: waiting %.3g seconds before %s' % (self.name, (self.backoff / 1000.0), action)))
else:
if (self.backoff < self.max_backoff):
if self.passive:
action = 'try to listen'
else:
action = 'reconnect'
self.info_level(('%s: continuing to %s in the background but suppressing further logging' % (self.name, action)))
self.backoff = self.max_backoff
self._transition(now, Reconnect.Backoff) | def disconnected(self, now, error):
"Tell this FSM that the connection dropped or that a connection\n attempt failed. 'error' specifies the reason: a positive value\n represents an errno value, EOF indicates that the connection was closed\n by the peer (e.g. read() returned 0), and 0 indicates no specific\n error.\n\n The FSM will back off, then reconnect."
if (self.state not in (Reconnect.Backoff, Reconnect.Void)):
if (self.state in (Reconnect.Active, Reconnect.Idle)):
if (error > 0):
vlog.warn(('%s: connection dropped (%s)' % (self.name, os.strerror(error))))
elif (error == EOF):
self.info_level(('%s: connection closed by peer' % self.name))
else:
self.info_level(('%s: connection dropped' % self.name))
elif (self.state == Reconnect.Listening):
if (error > 0):
vlog.warn(('%s: error listening for connections (%s)' % (self.name, os.strerror(error))))
else:
self.info_level(('%s: error listening for connections' % self.name))
elif (self.state == Reconnect.Reconnect):
self.info_level(('%s: connection closed by client' % self.name))
elif (self.backoff < self.max_backoff):
if self.passive:
type_ = 'listen'
else:
type_ = 'connection'
if (error > 0):
vlog.warn(('%s: %s attempt failed (%s)' % (self.name, type_, os.strerror(error))))
else:
self.info_level(('%s: %s attempt timed out' % (self.name, type_)))
if (self.state in (Reconnect.Active, Reconnect.Idle)):
self.last_disconnected = now
if (not self.__may_retry()):
self._transition(now, Reconnect.Void)
return
if (self.backoff_free_tries > 1):
self.backoff_free_tries -= 1
self.backoff = 0
elif ((self.state in (Reconnect.Active, Reconnect.Idle)) and (((self.last_activity - self.last_connected) >= self.backoff) or self.passive)):
if self.passive:
self.backoff = 0
else:
self.backoff = self.min_backoff
elif (self.backoff < self.min_backoff):
self.backoff = self.min_backoff
elif (self.backoff < (self.max_backoff / 2)):
self.backoff *= 2
if self.passive:
action = 'trying to listen again'
else:
action = 'reconnect'
self.info_level(('%s: waiting %.3g seconds before %s' % (self.name, (self.backoff / 1000.0), action)))
else:
if (self.backoff < self.max_backoff):
if self.passive:
action = 'try to listen'
else:
action = 'reconnect'
self.info_level(('%s: continuing to %s in the background but suppressing further logging' % (self.name, action)))
self.backoff = self.max_backoff
self._transition(now, Reconnect.Backoff)<|docstring|>Tell this FSM that the connection dropped or that a connection
attempt failed. 'error' specifies the reason: a positive value
represents an errno value, EOF indicates that the connection was closed
by the peer (e.g. read() returned 0), and 0 indicates no specific
error.
The FSM will back off, then reconnect.<|endoftext|> |
10a69b25e33e2b75ddeb38f152ceab1b27355e522bf575b755e04562be9d8a15 | def connecting(self, now):
'Tell this FSM that a connection or listening attempt is in progress.\n\n The FSM will start a timer, after which the connection or listening\n attempt will be aborted (by returning ovs.reconnect.DISCONNECT from\n self.run()).'
if (self.state != Reconnect.ConnectInProgress):
if self.passive:
self.info_level(('%s: listening...' % self.name))
elif (self.backoff < self.max_backoff):
self.info_level(('%s: connecting...' % self.name))
self._transition(now, Reconnect.ConnectInProgress) | Tell this FSM that a connection or listening attempt is in progress.
The FSM will start a timer, after which the connection or listening
attempt will be aborted (by returning ovs.reconnect.DISCONNECT from
self.run()). | python/ovs/reconnect.py | connecting | check-spelling/ovs | 2,919 | python | def connecting(self, now):
'Tell this FSM that a connection or listening attempt is in progress.\n\n The FSM will start a timer, after which the connection or listening\n attempt will be aborted (by returning ovs.reconnect.DISCONNECT from\n self.run()).'
if (self.state != Reconnect.ConnectInProgress):
if self.passive:
self.info_level(('%s: listening...' % self.name))
elif (self.backoff < self.max_backoff):
self.info_level(('%s: connecting...' % self.name))
self._transition(now, Reconnect.ConnectInProgress) | def connecting(self, now):
'Tell this FSM that a connection or listening attempt is in progress.\n\n The FSM will start a timer, after which the connection or listening\n attempt will be aborted (by returning ovs.reconnect.DISCONNECT from\n self.run()).'
if (self.state != Reconnect.ConnectInProgress):
if self.passive:
self.info_level(('%s: listening...' % self.name))
elif (self.backoff < self.max_backoff):
self.info_level(('%s: connecting...' % self.name))
self._transition(now, Reconnect.ConnectInProgress)<|docstring|>Tell this FSM that a connection or listening attempt is in progress.
The FSM will start a timer, after which the connection or listening
attempt will be aborted (by returning ovs.reconnect.DISCONNECT from
self.run()).<|endoftext|> |
44b92e810eb3ccc8a47f3f5d9471298b6e69b9b1e676bf9e14d0ca92f991eb52 | def listening(self, now):
'Tell this FSM that the client is listening for connection attempts.\n This state last indefinitely until the client reports some change.\n\n The natural progression from this state is for the client to report\n that a connection has been accepted or is in progress of being\n accepted, by calling self.connecting() or self.connected().\n\n The client may also report that listening failed (e.g. accept()\n returned an unexpected error such as ENOMEM) by calling\n self.listen_error(), in which case the FSM will back off and eventually\n return ovs.reconnect.CONNECT from self.run() to tell the client to try\n listening again.'
if (self.state != Reconnect.Listening):
self.info_level(('%s: listening...' % self.name))
self._transition(now, Reconnect.Listening) | Tell this FSM that the client is listening for connection attempts.
This state last indefinitely until the client reports some change.
The natural progression from this state is for the client to report
that a connection has been accepted or is in progress of being
accepted, by calling self.connecting() or self.connected().
The client may also report that listening failed (e.g. accept()
returned an unexpected error such as ENOMEM) by calling
self.listen_error(), in which case the FSM will back off and eventually
return ovs.reconnect.CONNECT from self.run() to tell the client to try
listening again. | python/ovs/reconnect.py | listening | check-spelling/ovs | 2,919 | python | def listening(self, now):
'Tell this FSM that the client is listening for connection attempts.\n This state last indefinitely until the client reports some change.\n\n The natural progression from this state is for the client to report\n that a connection has been accepted or is in progress of being\n accepted, by calling self.connecting() or self.connected().\n\n The client may also report that listening failed (e.g. accept()\n returned an unexpected error such as ENOMEM) by calling\n self.listen_error(), in which case the FSM will back off and eventually\n return ovs.reconnect.CONNECT from self.run() to tell the client to try\n listening again.'
if (self.state != Reconnect.Listening):
self.info_level(('%s: listening...' % self.name))
self._transition(now, Reconnect.Listening) | def listening(self, now):
'Tell this FSM that the client is listening for connection attempts.\n This state last indefinitely until the client reports some change.\n\n The natural progression from this state is for the client to report\n that a connection has been accepted or is in progress of being\n accepted, by calling self.connecting() or self.connected().\n\n The client may also report that listening failed (e.g. accept()\n returned an unexpected error such as ENOMEM) by calling\n self.listen_error(), in which case the FSM will back off and eventually\n return ovs.reconnect.CONNECT from self.run() to tell the client to try\n listening again.'
if (self.state != Reconnect.Listening):
self.info_level(('%s: listening...' % self.name))
self._transition(now, Reconnect.Listening)<|docstring|>Tell this FSM that the client is listening for connection attempts.
This state last indefinitely until the client reports some change.
The natural progression from this state is for the client to report
that a connection has been accepted or is in progress of being
accepted, by calling self.connecting() or self.connected().
The client may also report that listening failed (e.g. accept()
returned an unexpected error such as ENOMEM) by calling
self.listen_error(), in which case the FSM will back off and eventually
return ovs.reconnect.CONNECT from self.run() to tell the client to try
listening again.<|endoftext|> |
a24755b6186d592e3f67db8b246b0347858cdb719e55840e647cfc4dc988aa64 | def listen_error(self, now, error):
"Tell this FSM that the client's attempt to accept a connection\n failed (e.g. accept() returned an unexpected error such as ENOMEM).\n\n If the FSM is currently listening (self.listening() was called), it\n will back off and eventually return ovs.reconnect.CONNECT from\n self.run() to tell the client to try listening again. If there is an\n active connection, this will be delayed until that connection drops."
if (self.state == Reconnect.Listening):
self.disconnected(now, error) | Tell this FSM that the client's attempt to accept a connection
failed (e.g. accept() returned an unexpected error such as ENOMEM).
If the FSM is currently listening (self.listening() was called), it
will back off and eventually return ovs.reconnect.CONNECT from
self.run() to tell the client to try listening again. If there is an
active connection, this will be delayed until that connection drops. | python/ovs/reconnect.py | listen_error | check-spelling/ovs | 2,919 | python | def listen_error(self, now, error):
"Tell this FSM that the client's attempt to accept a connection\n failed (e.g. accept() returned an unexpected error such as ENOMEM).\n\n If the FSM is currently listening (self.listening() was called), it\n will back off and eventually return ovs.reconnect.CONNECT from\n self.run() to tell the client to try listening again. If there is an\n active connection, this will be delayed until that connection drops."
if (self.state == Reconnect.Listening):
self.disconnected(now, error) | def listen_error(self, now, error):
"Tell this FSM that the client's attempt to accept a connection\n failed (e.g. accept() returned an unexpected error such as ENOMEM).\n\n If the FSM is currently listening (self.listening() was called), it\n will back off and eventually return ovs.reconnect.CONNECT from\n self.run() to tell the client to try listening again. If there is an\n active connection, this will be delayed until that connection drops."
if (self.state == Reconnect.Listening):
self.disconnected(now, error)<|docstring|>Tell this FSM that the client's attempt to accept a connection
failed (e.g. accept() returned an unexpected error such as ENOMEM).
If the FSM is currently listening (self.listening() was called), it
will back off and eventually return ovs.reconnect.CONNECT from
self.run() to tell the client to try listening again. If there is an
active connection, this will be delayed until that connection drops.<|endoftext|> |
eba9f5871087e5cdac478ce7fea2baacfcbdb7d821950025c7df6cb8262326b2 | def connected(self, now):
'Tell this FSM that the connection was successful.\n\n The FSM will start the probe interval timer, which is reset by\n self.activity(). If the timer expires, a probe will be sent (by\n returning ovs.reconnect.PROBE from self.run(). If the timer expires\n again without being reset, the connection will be aborted (by returning\n ovs.reconnect.DISCONNECT from self.run().'
if (not self.state.is_connected):
self.connecting(now)
self.info_level(('%s: connected' % self.name))
self._transition(now, Reconnect.Active)
self.last_connected = now | Tell this FSM that the connection was successful.
The FSM will start the probe interval timer, which is reset by
self.activity(). If the timer expires, a probe will be sent (by
returning ovs.reconnect.PROBE from self.run(). If the timer expires
again without being reset, the connection will be aborted (by returning
ovs.reconnect.DISCONNECT from self.run(). | python/ovs/reconnect.py | connected | check-spelling/ovs | 2,919 | python | def connected(self, now):
'Tell this FSM that the connection was successful.\n\n The FSM will start the probe interval timer, which is reset by\n self.activity(). If the timer expires, a probe will be sent (by\n returning ovs.reconnect.PROBE from self.run(). If the timer expires\n again without being reset, the connection will be aborted (by returning\n ovs.reconnect.DISCONNECT from self.run().'
if (not self.state.is_connected):
self.connecting(now)
self.info_level(('%s: connected' % self.name))
self._transition(now, Reconnect.Active)
self.last_connected = now | def connected(self, now):
'Tell this FSM that the connection was successful.\n\n The FSM will start the probe interval timer, which is reset by\n self.activity(). If the timer expires, a probe will be sent (by\n returning ovs.reconnect.PROBE from self.run(). If the timer expires\n again without being reset, the connection will be aborted (by returning\n ovs.reconnect.DISCONNECT from self.run().'
if (not self.state.is_connected):
self.connecting(now)
self.info_level(('%s: connected' % self.name))
self._transition(now, Reconnect.Active)
self.last_connected = now<|docstring|>Tell this FSM that the connection was successful.
The FSM will start the probe interval timer, which is reset by
self.activity(). If the timer expires, a probe will be sent (by
returning ovs.reconnect.PROBE from self.run(). If the timer expires
again without being reset, the connection will be aborted (by returning
ovs.reconnect.DISCONNECT from self.run().<|endoftext|> |
869b1601c92bc548de6b2daff38b62a613ec49bcd91c2886c401097c94f1ca6b | def connect_failed(self, now, error):
'Tell this FSM that the connection attempt failed.\n\n The FSM will back off and attempt to reconnect.'
self.connecting(now)
self.disconnected(now, error) | Tell this FSM that the connection attempt failed.
The FSM will back off and attempt to reconnect. | python/ovs/reconnect.py | connect_failed | check-spelling/ovs | 2,919 | python | def connect_failed(self, now, error):
'Tell this FSM that the connection attempt failed.\n\n The FSM will back off and attempt to reconnect.'
self.connecting(now)
self.disconnected(now, error) | def connect_failed(self, now, error):
'Tell this FSM that the connection attempt failed.\n\n The FSM will back off and attempt to reconnect.'
self.connecting(now)
self.disconnected(now, error)<|docstring|>Tell this FSM that the connection attempt failed.
The FSM will back off and attempt to reconnect.<|endoftext|> |
0e4d6b6e1b85f6d448835de61ba6949d6dacbc88a28d426b6b47f743011606e8 | def activity(self, now):
'Tell this FSM that some activity occurred on the connection. This\n resets the probe interval timer, so that the connection is known not to\n be idle.'
if (self.state != Reconnect.Active):
self._transition(now, Reconnect.Active)
self.last_activity = now | Tell this FSM that some activity occurred on the connection. This
resets the probe interval timer, so that the connection is known not to
be idle. | python/ovs/reconnect.py | activity | check-spelling/ovs | 2,919 | python | def activity(self, now):
'Tell this FSM that some activity occurred on the connection. This\n resets the probe interval timer, so that the connection is known not to\n be idle.'
if (self.state != Reconnect.Active):
self._transition(now, Reconnect.Active)
self.last_activity = now | def activity(self, now):
'Tell this FSM that some activity occurred on the connection. This\n resets the probe interval timer, so that the connection is known not to\n be idle.'
if (self.state != Reconnect.Active):
self._transition(now, Reconnect.Active)
self.last_activity = now<|docstring|>Tell this FSM that some activity occurred on the connection. This
resets the probe interval timer, so that the connection is known not to
be idle.<|endoftext|> |
0ac05a13f94600a2961f79a4a0e55ce765f18b8b5fad106539c9f0e5ca44336f | def receive_attempted(self, now):
"Tell 'fsm' that some attempt to receive data on the connection was\n made at 'now'. The FSM only allows probe interval timer to expire when\n some attempt to receive data on the connection was received after the\n time when it should have expired. This helps in the case where there's\n a long delay in the poll loop and then reconnect_run() executes before\n the code to try to receive anything from the remote runs. (To disable\n this feature, pass None for 'now'.)"
self.last_receive_attempt = now | Tell 'fsm' that some attempt to receive data on the connection was
made at 'now'. The FSM only allows probe interval timer to expire when
some attempt to receive data on the connection was received after the
time when it should have expired. This helps in the case where there's
a long delay in the poll loop and then reconnect_run() executes before
the code to try to receive anything from the remote runs. (To disable
this feature, pass None for 'now'.) | python/ovs/reconnect.py | receive_attempted | check-spelling/ovs | 2,919 | python | def receive_attempted(self, now):
"Tell 'fsm' that some attempt to receive data on the connection was\n made at 'now'. The FSM only allows probe interval timer to expire when\n some attempt to receive data on the connection was received after the\n time when it should have expired. This helps in the case where there's\n a long delay in the poll loop and then reconnect_run() executes before\n the code to try to receive anything from the remote runs. (To disable\n this feature, pass None for 'now'.)"
self.last_receive_attempt = now | def receive_attempted(self, now):
"Tell 'fsm' that some attempt to receive data on the connection was\n made at 'now'. The FSM only allows probe interval timer to expire when\n some attempt to receive data on the connection was received after the\n time when it should have expired. This helps in the case where there's\n a long delay in the poll loop and then reconnect_run() executes before\n the code to try to receive anything from the remote runs. (To disable\n this feature, pass None for 'now'.)"
self.last_receive_attempt = now<|docstring|>Tell 'fsm' that some attempt to receive data on the connection was
made at 'now'. The FSM only allows probe interval timer to expire when
some attempt to receive data on the connection was received after the
time when it should have expired. This helps in the case where there's
a long delay in the poll loop and then reconnect_run() executes before
the code to try to receive anything from the remote runs. (To disable
this feature, pass None for 'now'.)<|endoftext|> |
0065d731b6ab9ae943096e9943a6d2e6514c72cb075bf2b3f0d4f2aa562338af | def run(self, now):
'Assesses whether any action should be taken on this FSM. The return\n value is one of:\n\n - None: The client need not take any action.\n\n - Active client, ovs.reconnect.CONNECT: The client should start a\n connection attempt and indicate this by calling\n self.connecting(). If the connection attempt has definitely\n succeeded, it should call self.connected(). If the connection\n attempt has definitely failed, it should call\n self.connect_failed().\n\n The FSM is smart enough to back off correctly after successful\n connections that quickly abort, so it is OK to call\n self.connected() after a low-level successful connection\n (e.g. connect()) even if the connection might soon abort due to a\n failure at a high-level (e.g. SSL negotiation failure).\n\n - Passive client, ovs.reconnect.CONNECT: The client should try to\n listen for a connection, if it is not already listening. It\n should call self.listening() if successful, otherwise\n self.connecting() or reconnected_connect_failed() if the attempt\n is in progress or definitely failed, respectively.\n\n A listening passive client should constantly attempt to accept a\n new connection and report an accepted connection with\n self.connected().\n\n - ovs.reconnect.DISCONNECT: The client should abort the current\n connection or connection attempt or listen attempt and call\n self.disconnected() or self.connect_failed() to indicate it.\n\n - ovs.reconnect.PROBE: The client should send some kind of request\n to the peer that will elicit a response, to ensure that the\n connection is indeed in working order. (This will only be\n returned if the "probe interval" is nonzero--see\n self.set_probe_interval()).'
deadline = self.state.deadline(self)
if ((deadline is not None) and (now >= deadline)):
return self.state.run(self, now)
else:
return None | Assesses whether any action should be taken on this FSM. The return
value is one of:
- None: The client need not take any action.
- Active client, ovs.reconnect.CONNECT: The client should start a
connection attempt and indicate this by calling
self.connecting(). If the connection attempt has definitely
succeeded, it should call self.connected(). If the connection
attempt has definitely failed, it should call
self.connect_failed().
The FSM is smart enough to back off correctly after successful
connections that quickly abort, so it is OK to call
self.connected() after a low-level successful connection
(e.g. connect()) even if the connection might soon abort due to a
failure at a high-level (e.g. SSL negotiation failure).
- Passive client, ovs.reconnect.CONNECT: The client should try to
listen for a connection, if it is not already listening. It
should call self.listening() if successful, otherwise
self.connecting() or reconnected_connect_failed() if the attempt
is in progress or definitely failed, respectively.
A listening passive client should constantly attempt to accept a
new connection and report an accepted connection with
self.connected().
- ovs.reconnect.DISCONNECT: The client should abort the current
connection or connection attempt or listen attempt and call
self.disconnected() or self.connect_failed() to indicate it.
- ovs.reconnect.PROBE: The client should send some kind of request
to the peer that will elicit a response, to ensure that the
connection is indeed in working order. (This will only be
returned if the "probe interval" is nonzero--see
self.set_probe_interval()). | python/ovs/reconnect.py | run | check-spelling/ovs | 2,919 | python | def run(self, now):
'Assesses whether any action should be taken on this FSM. The return\n value is one of:\n\n - None: The client need not take any action.\n\n - Active client, ovs.reconnect.CONNECT: The client should start a\n connection attempt and indicate this by calling\n self.connecting(). If the connection attempt has definitely\n succeeded, it should call self.connected(). If the connection\n attempt has definitely failed, it should call\n self.connect_failed().\n\n The FSM is smart enough to back off correctly after successful\n connections that quickly abort, so it is OK to call\n self.connected() after a low-level successful connection\n (e.g. connect()) even if the connection might soon abort due to a\n failure at a high-level (e.g. SSL negotiation failure).\n\n - Passive client, ovs.reconnect.CONNECT: The client should try to\n listen for a connection, if it is not already listening. It\n should call self.listening() if successful, otherwise\n self.connecting() or reconnected_connect_failed() if the attempt\n is in progress or definitely failed, respectively.\n\n A listening passive client should constantly attempt to accept a\n new connection and report an accepted connection with\n self.connected().\n\n - ovs.reconnect.DISCONNECT: The client should abort the current\n connection or connection attempt or listen attempt and call\n self.disconnected() or self.connect_failed() to indicate it.\n\n - ovs.reconnect.PROBE: The client should send some kind of request\n to the peer that will elicit a response, to ensure that the\n connection is indeed in working order. (This will only be\n returned if the "probe interval" is nonzero--see\n self.set_probe_interval()).'
deadline = self.state.deadline(self)
if ((deadline is not None) and (now >= deadline)):
return self.state.run(self, now)
else:
return None | def run(self, now):
'Assesses whether any action should be taken on this FSM. The return\n value is one of:\n\n - None: The client need not take any action.\n\n - Active client, ovs.reconnect.CONNECT: The client should start a\n connection attempt and indicate this by calling\n self.connecting(). If the connection attempt has definitely\n succeeded, it should call self.connected(). If the connection\n attempt has definitely failed, it should call\n self.connect_failed().\n\n The FSM is smart enough to back off correctly after successful\n connections that quickly abort, so it is OK to call\n self.connected() after a low-level successful connection\n (e.g. connect()) even if the connection might soon abort due to a\n failure at a high-level (e.g. SSL negotiation failure).\n\n - Passive client, ovs.reconnect.CONNECT: The client should try to\n listen for a connection, if it is not already listening. It\n should call self.listening() if successful, otherwise\n self.connecting() or reconnected_connect_failed() if the attempt\n is in progress or definitely failed, respectively.\n\n A listening passive client should constantly attempt to accept a\n new connection and report an accepted connection with\n self.connected().\n\n - ovs.reconnect.DISCONNECT: The client should abort the current\n connection or connection attempt or listen attempt and call\n self.disconnected() or self.connect_failed() to indicate it.\n\n - ovs.reconnect.PROBE: The client should send some kind of request\n to the peer that will elicit a response, to ensure that the\n connection is indeed in working order. (This will only be\n returned if the "probe interval" is nonzero--see\n self.set_probe_interval()).'
deadline = self.state.deadline(self)
if ((deadline is not None) and (now >= deadline)):
return self.state.run(self, now)
else:
return None<|docstring|>Assesses whether any action should be taken on this FSM. The return
value is one of:
- None: The client need not take any action.
- Active client, ovs.reconnect.CONNECT: The client should start a
connection attempt and indicate this by calling
self.connecting(). If the connection attempt has definitely
succeeded, it should call self.connected(). If the connection
attempt has definitely failed, it should call
self.connect_failed().
The FSM is smart enough to back off correctly after successful
connections that quickly abort, so it is OK to call
self.connected() after a low-level successful connection
(e.g. connect()) even if the connection might soon abort due to a
failure at a high-level (e.g. SSL negotiation failure).
- Passive client, ovs.reconnect.CONNECT: The client should try to
listen for a connection, if it is not already listening. It
should call self.listening() if successful, otherwise
self.connecting() or reconnected_connect_failed() if the attempt
is in progress or definitely failed, respectively.
A listening passive client should constantly attempt to accept a
new connection and report an accepted connection with
self.connected().
- ovs.reconnect.DISCONNECT: The client should abort the current
connection or connection attempt or listen attempt and call
self.disconnected() or self.connect_failed() to indicate it.
- ovs.reconnect.PROBE: The client should send some kind of request
to the peer that will elicit a response, to ensure that the
connection is indeed in working order. (This will only be
returned if the "probe interval" is nonzero--see
self.set_probe_interval()).<|endoftext|> |
3c29ea9c51b250cf2d197aae4fc4bc09eec8b3cd8e95d3f34bf9ba5c8fcad3e4 | def wait(self, poller, now):
'Causes the next call to poller.block() to wake up when self.run()\n should be called.'
timeout = self.timeout(now)
if ((timeout is not None) and (timeout >= 0)):
poller.timer_wait(timeout) | Causes the next call to poller.block() to wake up when self.run()
should be called. | python/ovs/reconnect.py | wait | check-spelling/ovs | 2,919 | python | def wait(self, poller, now):
'Causes the next call to poller.block() to wake up when self.run()\n should be called.'
timeout = self.timeout(now)
if ((timeout is not None) and (timeout >= 0)):
poller.timer_wait(timeout) | def wait(self, poller, now):
'Causes the next call to poller.block() to wake up when self.run()\n should be called.'
timeout = self.timeout(now)
if ((timeout is not None) and (timeout >= 0)):
poller.timer_wait(timeout)<|docstring|>Causes the next call to poller.block() to wake up when self.run()
should be called.<|endoftext|> |
dc0c2ba19cc79589d50a0e3ab2d49db6ab78a46b5a6414f6c7b4b9dd62ad884c | def timeout(self, now):
'Returns the number of milliseconds after which self.run() should be\n called if nothing else notable happens in the meantime, or None if this\n is currently unnecessary.'
deadline = self.state.deadline(self)
if (deadline is not None):
remaining = (deadline - now)
return max(0, remaining)
else:
return None | Returns the number of milliseconds after which self.run() should be
called if nothing else notable happens in the meantime, or None if this
is currently unnecessary. | python/ovs/reconnect.py | timeout | check-spelling/ovs | 2,919 | python | def timeout(self, now):
'Returns the number of milliseconds after which self.run() should be\n called if nothing else notable happens in the meantime, or None if this\n is currently unnecessary.'
deadline = self.state.deadline(self)
if (deadline is not None):
remaining = (deadline - now)
return max(0, remaining)
else:
return None | def timeout(self, now):
'Returns the number of milliseconds after which self.run() should be\n called if nothing else notable happens in the meantime, or None if this\n is currently unnecessary.'
deadline = self.state.deadline(self)
if (deadline is not None):
remaining = (deadline - now)
return max(0, remaining)
else:
return None<|docstring|>Returns the number of milliseconds after which self.run() should be
called if nothing else notable happens in the meantime, or None if this
is currently unnecessary.<|endoftext|> |
549e666b3850d664d18443b24ffd71fc8e5b17f5fe3588aa873667577b033d07 | def is_connected(self):
'Returns True if this FSM is currently believed to be connected, that\n is, if self.connected() was called more recently than any call to\n self.connect_failed() or self.disconnected() or self.disable(), and\n False otherwise.'
return self.state.is_connected | Returns True if this FSM is currently believed to be connected, that
is, if self.connected() was called more recently than any call to
self.connect_failed() or self.disconnected() or self.disable(), and
False otherwise. | python/ovs/reconnect.py | is_connected | check-spelling/ovs | 2,919 | python | def is_connected(self):
'Returns True if this FSM is currently believed to be connected, that\n is, if self.connected() was called more recently than any call to\n self.connect_failed() or self.disconnected() or self.disable(), and\n False otherwise.'
return self.state.is_connected | def is_connected(self):
'Returns True if this FSM is currently believed to be connected, that\n is, if self.connected() was called more recently than any call to\n self.connect_failed() or self.disconnected() or self.disable(), and\n False otherwise.'
return self.state.is_connected<|docstring|>Returns True if this FSM is currently believed to be connected, that
is, if self.connected() was called more recently than any call to
self.connect_failed() or self.disconnected() or self.disable(), and
False otherwise.<|endoftext|> |
8862dbb2ece5835f8341e498cad76d01e32aec68af4dba43042506384a1b424b | def get_last_connect_elapsed(self, now):
"Returns the number of milliseconds since 'fsm' was last connected\n to its peer. Returns None if never connected."
if self.last_connected:
return (now - self.last_connected)
else:
return None | Returns the number of milliseconds since 'fsm' was last connected
to its peer. Returns None if never connected. | python/ovs/reconnect.py | get_last_connect_elapsed | check-spelling/ovs | 2,919 | python | def get_last_connect_elapsed(self, now):
"Returns the number of milliseconds since 'fsm' was last connected\n to its peer. Returns None if never connected."
if self.last_connected:
return (now - self.last_connected)
else:
return None | def get_last_connect_elapsed(self, now):
"Returns the number of milliseconds since 'fsm' was last connected\n to its peer. Returns None if never connected."
if self.last_connected:
return (now - self.last_connected)
else:
return None<|docstring|>Returns the number of milliseconds since 'fsm' was last connected
to its peer. Returns None if never connected.<|endoftext|> |
c35241b66d67fd54dd094d76a4e1c7f8df47c5c9a234f649c78937a81ce457f2 | def get_last_disconnect_elapsed(self, now):
"Returns the number of milliseconds since 'fsm' was last disconnected\n from its peer. Returns None if never disconnected."
if self.last_disconnected:
return (now - self.last_disconnected)
else:
return None | Returns the number of milliseconds since 'fsm' was last disconnected
from its peer. Returns None if never disconnected. | python/ovs/reconnect.py | get_last_disconnect_elapsed | check-spelling/ovs | 2,919 | python | def get_last_disconnect_elapsed(self, now):
"Returns the number of milliseconds since 'fsm' was last disconnected\n from its peer. Returns None if never disconnected."
if self.last_disconnected:
return (now - self.last_disconnected)
else:
return None | def get_last_disconnect_elapsed(self, now):
"Returns the number of milliseconds since 'fsm' was last disconnected\n from its peer. Returns None if never disconnected."
if self.last_disconnected:
return (now - self.last_disconnected)
else:
return None<|docstring|>Returns the number of milliseconds since 'fsm' was last disconnected
from its peer. Returns None if never disconnected.<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.