function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def parse_name(self, name):
name = name.xpath('//h1/text()').extract_first()
return name.strip() | iandees/all-the-places | [
379,
151,
379,
602,
1465952958
] |
def parse_phone(self, phone):
phone = phone.xpath('//div[@class="padding_hf_v sp_padding_qt_v"]/a/text()').extract_first()
if not phone:
return ""
return phone.strip() | iandees/all-the-places | [
379,
151,
379,
602,
1465952958
] |
def parse_store(self, response):
data = response.body_as_unicode()
name = self.parse_name(response)
address = self.parse_address(response)
phone = self.parse_phone(response)
lat, lon = self.parse_latlon(response)
properties = {
'ref': response.meta['ref'],
... | iandees/all-the-places | [
379,
151,
379,
602,
1465952958
] |
def __unicode__(self):
return self.symbol if self.symbol is not None else self.name | rodxavier/open-pse-initiative | [
10,
4,
10,
9,
1410356886
] |
def __str__(self):
return self.symbol if self.symbol is not None else self.name | rodxavier/open-pse-initiative | [
10,
4,
10,
9,
1410356886
] |
def readable_name(self):
if self.is_index:
return self.name[1:]
else:
return self.name | rodxavier/open-pse-initiative | [
10,
4,
10,
9,
1410356886
] |
def year_high(self):
today = datetime.now()
one_year = timedelta(days=52*7)
if today.isoweekday() == 6:
today = today - timedelta(days=1)
elif today.isoweekday() == 7:
today = today - timedelta(days=2)
last_year = today - one_year
quotes = self.quo... | rodxavier/open-pse-initiative | [
10,
4,
10,
9,
1410356886
] |
def year_low(self):
today = datetime.now()
one_year = timedelta(days=52*7)
if today.isoweekday() == 6:
today = today - timedelta(days=1)
elif today.isoweekday() == 7:
today = today - timedelta(days=2)
last_year = today - one_year
quotes = self.quot... | rodxavier/open-pse-initiative | [
10,
4,
10,
9,
1410356886
] |
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def begin_create_or_update(
self,
resource_group_name, # type: str
dscp_configuration_name, # type: str
parameters, # type: "_models.DscpConfiguration"
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('DscpConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _delete_initial(
self,
resource_group_name, # type: str
dscp_configuration_name, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def begin_delete(
self,
resource_group_name, # type: str
dscp_configuration_name, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {}) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get(
self,
resource_group_name, # type: str
dscp_configuration_name, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
resource_group_name, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadat... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=resp... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list_all(
self,
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_all.met... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=resp... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, data: int) -> None:
self.data = data
self.rank: int
self.parent: Node | TheAlgorithms/Python | [
154959,
39275,
154959,
147,
1468662241
] |
def make_set(x: Node) -> None:
"""
Make x as a set.
"""
# rank is the distance from x to its' parent
# root's rank is 0
x.rank = 0
x.parent = x | TheAlgorithms/Python | [
154959,
39275,
154959,
147,
1468662241
] |
def union_set(x: Node, y: Node) -> None:
"""
Union of two sets.
set with bigger rank should be parent, so that the
disjoint set tree will be more flat.
"""
x, y = find_set(x), find_set(y)
if x == y:
return | TheAlgorithms/Python | [
154959,
39275,
154959,
147,
1468662241
] |
def find_set(x: Node) -> Node:
"""
Return the parent of x
"""
if x != x.parent:
x.parent = find_set(x.parent)
return x.parent | TheAlgorithms/Python | [
154959,
39275,
154959,
147,
1468662241
] |
def find_python_set(node: Node) -> set:
"""
Return a Python Standard Library set that contains i.
"""
sets = ({0, 1, 2}, {3, 4, 5})
for s in sets:
if node.data in s:
return s
raise ValueError(f"{node.data} is not in {sets}") | TheAlgorithms/Python | [
154959,
39275,
154959,
147,
1468662241
] |
def test_disjoint_set() -> None:
"""
>>> test_disjoint_set()
"""
vertex = [Node(i) for i in range(6)]
for v in vertex:
make_set(v) | TheAlgorithms/Python | [
154959,
39275,
154959,
147,
1468662241
] |
def __init__(self):
self._output = '' | adaptive-learning/proso-apps | [
1,
8,
1,
33,
1409148971
] |
def print_line(self, x1, y1, x2, y2, color=0, width=1):
self.print_output(_svg_line(x1, y1, x2, y2, color=color, width=width)) | adaptive-learning/proso-apps | [
1,
8,
1,
33,
1409148971
] |
def print_square(self, x, y, a, color=0, width=1, border_color=0):
self.print_output(_svg_rectangle(x, y, a, a, color=color, width=width, border_color=border_color)) | adaptive-learning/proso-apps | [
1,
8,
1,
33,
1409148971
] |
def to_file(self, filename):
with open(filename, 'w') as f:
f.write(str(self)) | adaptive-learning/proso-apps | [
1,
8,
1,
33,
1409148971
] |
def _svg_line(x1, y1, x2, y2, color, width):
color = _svg_color(color)
return '<line x1="{}" y1="{}" x2="{}" y2="{}" style="stroke-linecap:round;stroke:{};stroke-width:{};" />\n'.format(x1, y1, x2, y2, color, width) | adaptive-learning/proso-apps | [
1,
8,
1,
33,
1409148971
] |
def _svg_rectangle(x, y, a, b, color, width, border_color):
color = _svg_color(color)
border_color = _svg_color(border_color)
return '<rect x="{}" y="{}" width="{}" height="{}" style="fill:{}; stroke:{}; stroke-width:{};" />\n'.format(x, y, a, b, color, border_color, width) | adaptive-learning/proso-apps | [
1,
8,
1,
33,
1409148971
] |
def __init__(self, device, chans=None):
"""When mapping initializes, it immediately grabs the scale and offset for each channel
specified in chans (or all channels if None). This means that the mapping is only valid
as long as these values have not changed."""
self.device = device
... | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def mapFromDaq(self, chan, data):
scale = self.scale[chan]
offset = self.offset[chan]
return (data + offset) * scale | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def __init__(self, dev, channel):
self.dev = dev
self.channel = channel | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def __init__(self, dm, config, name):
Device.__init__(self, dm, config, name)
self._DGLock = Mutex(Qt.QMutex.Recursive) ## protects access to _DGHolding, _DGConfig
## Do some sanity checks here on the configuration
# 'channels' key is expected; for backward compatibility we just use th... | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def mapFromDAQ(self, channel, data):
mapping = self.getMapping(chans=[channel])
return mapping.mapFromDaq(channel, data) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def createTask(self, cmd, parentTask):
return DAQGenericTask(self, cmd, parentTask) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def setChanHolding(self, channel, level=None, block=True, mapping=None):
"""Define and set the holding values for this channel
If *block* is True, then return only after the value has been set on the DAQ.
If *block* is False, then simply schedule the change to take place when the DAQ is availabl... | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def getChannelValue(self, channel, block=True, raw=False):
with self._DGLock:
daq = self._DGConfig[channel]['device']
chan = self._DGConfig[channel]['channel']
mode = self._DGConfig[channel].get('mode', None)
## release _DGLock before getChannelValue
daqDev =... | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def deviceInterface(self, win):
"""Return a widget with a UI to put in the device rack"""
return DAQDevGui(self) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def getDAQName(self, channel):
# return self._DGConfig[channel]['channel'][0]
with self._DGLock:
return self._DGConfig[channel]['device'] | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def setChanScale(self, ch, scale, update=True, block=True):
with self._DGLock:
self._DGConfig[ch]['scale'] = scale
if update and self.isOutput(ch): ## only set Holding for output channels
self.setChanHolding(ch, block=block) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def getChanScale(self, chan):
with self._DGLock:
## Scale defaults to 1.0
## - can be overridden in configuration
return self._DGConfig[chan].get('scale', 1.0) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def getChanUnits(self, ch):
with self._DGLock:
if 'units' in self._DGConfig[ch]:
return self._DGConfig[ch]['units']
else:
return None | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def listChannels(self):
with self._DGLock:
return dict([(ch, self._DGConfig[ch].copy()) for ch in self._DGConfig]) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def __init__(self, dev, cmd, parentTask):
DeviceTask.__init__(self, dev, cmd, parentTask)
self.daqTasks = {}
self.initialState = {}
self._DAQCmd = cmd
## Stores the list of channels that will generate or acquire buffered samples
self.bufferedChannels = [] | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def configure(self):
## Record initial state or set initial value
## NOTE:
## Subclasses should call this function only _after_ making any changes that will affect the mapping between
## physical values and channel voltages.
prof = Profiler('DAQGenericTask.configure', disabled=T... | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def getChanUnits(self, chan):
if 'units' in self._DAQCmd[chan]:
return self._DAQCmd[chan]['units']
else:
return self.dev.getChanUnits(chan) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def isDone(self):
## DAQ task handles this for us.
return True | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def getResult(self):
## Access data recorded from DAQ task
## create MetaArray and fill with MC state info
## Collect data and info for each channel in the command
result = {}
for ch in self.bufferedChannels:
result[ch] = self.daqTasks[ch].getData(self.dev._DGConfig[... | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def __init__(self, dev):
self.dev = dev
Qt.QWidget.__init__(self)
self.layout = Qt.QVBoxLayout()
self.setLayout(self.layout)
chans = self.dev.listChannels()
self.widgets = {}
# self.uis = {}
self.defaults = {}
for ch in chans:
wid = Qt.... | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def holdingSpinChanged(self, spin):
ch = spin.channel
self.dev.setChanHolding(ch, spin.value(), block=False) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def offsetSpinChanged(self, spin):
ch = spin.channel
self.dev.setChanOffset(ch, spin.value(), block=False) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def scaleDefaultBtnClicked(self):
ch = self.sender().channel
self.widgets[ch].scaleSpin.setValue(self.defaults[ch]['scale']) | acq4/acq4 | [
51,
39,
51,
31,
1385049034
] |
def deconstruct_packet(packet):
"""
Replaces every bytearray in packet with a numbered placeholder.
:param packet:
:return: dict with packet and list of buffers
"""
buffers = []
packet_data = packet.get('data', None)
def _deconstruct_packet(data):
... | shuoli84/gevent_socketio2 | [
4,
4,
4,
6,
1411211530
] |
def reconstruct_packet(packet, buffers):
def _reconstruct_packet(data):
if type(data) is dict:
if '_placeholder' in data:
buf = buffers[data['num']]
return buf
else:
for k, v in data.items():
... | shuoli84/gevent_socketio2 | [
4,
4,
4,
6,
1411211530
] |
def pytest_sessionstart(session):
global server_process
server_process = Process(target=start)
server_process.start() | pirate/bookmark-archiver | [
15274,
890,
15274,
180,
1493974214
] |
def pytest_sessionfinish(session):
if server_process is not None:
server_process.terminate()
server_process.join() | pirate/bookmark-archiver | [
15274,
890,
15274,
180,
1493974214
] |
def register_type(cls, typename, obj):
"""Adds the new class to the dict of understood types."""
cls.types[typename] = obj | ActiveState/code | [
1884,
686,
1884,
41,
1500923597
] |
def visit_Num(self, node):
self.output(json.dumps(node.n)) | iksteen/jaspyx | [
3,
1,
3,
2,
1368740942
] |
def visit_List(self, node):
self.group(node.elts, prefix='[', infix=', ', suffix=']') | iksteen/jaspyx | [
3,
1,
3,
2,
1368740942
] |
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def begin_delete(
self,
resource_group_name, # type: str
route_filter_name, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {}) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get(
self,
resource_group_name, # type: str
route_filter_name, # type: str
expand=None, # type: Optional[str]
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _create_or_update_initial(
self,
resource_group_name, # type: str
route_filter_name, # type: str
route_filter_parameters, # type: "_models.RouteFilter"
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def begin_create_or_update(
self,
resource_group_name, # type: str
route_filter_name, # type: str
route_filter_parameters, # type: "_models.RouteFilter"
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('RouteFilter', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def update_tags(
self,
resource_group_name, # type: str
route_filter_name, # type: str
parameters, # type: "_models.TagsObject"
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list_by_resource_group(
self,
resource_group_name, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_reso... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=resp... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadat... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=resp... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def join_web_url(self):
"""Meeting URL associated to the call. May not be available for a peerToPeer call record type."""
return self.properties.get("joinWebUrl", None) | vgrem/Office365-REST-Python-Client | [
816,
246,
816,
181,
1454945091
] |
def __init__(self, location, *args, **kwargs):
if not isinstance(location, (type(None), list, tuple)):
location = [location]
if location is not None:
kwargs.setdefault('headers', {})['Location'] = ', '.join(str(URI(uri)) for uri in location)
super(RedirectStatus, self).__init__(*args, **kwargs) | spaceone/httoop | [
17,
5,
17,
5,
1365534138
] |
def __init__(self, *args, **kwargs):
# don't set location
super(NOT_MODIFIED, self).__init__(None, *args, **kwargs) | spaceone/httoop | [
17,
5,
17,
5,
1365534138
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadat... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {}) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('InboundNatRule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def register_object_type(cls=None, vendor_id=0):
if _debug: register_object_type._debug("register_object_type %s vendor_id=%s", repr(cls), vendor_id)
# if cls isn't given, return a decorator
if not cls:
def _register(xcls):
if _debug: register_object_type._debug("_register %s (vendor_id... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def get_object_class(object_type, vendor_id=0):
"""Return the class associated with an object type."""
if _debug: get_object_class._debug("get_object_class %r vendor_id=%r", object_type, vendor_id)
# find the klass as given
cls = registered_object_types.get((object_type, vendor_id))
if _debug: get_... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def get_datatype(object_type, propid, vendor_id=0):
"""Return the datatype for the property of an object."""
if _debug: get_datatype._debug("get_datatype %r %r vendor_id=%r", object_type, propid, vendor_id)
# get the related class
cls = get_object_class(object_type, vendor_id)
if not cls:
r... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def __init__(self, identifier, datatype, default=None, optional=True, mutable=True):
if _debug:
Property._debug("__init__ %s %s default=%r optional=%r mutable=%r",
identifier, datatype, default, optional, mutable
)
# keep the arguments
self.identifier... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def WriteProperty(self, obj, value, arrayIndex=None, priority=None, direct=False):
if _debug:
Property._debug("WriteProperty(%s) %s %r arrayIndex=%r priority=%r direct=%r",
self.identifier, obj, value, arrayIndex, priority, direct
)
if direct:
if ... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def __init__(self, identifier, datatype, default=None, optional=True, mutable=True):
if _debug:
StandardProperty._debug("__init__ %s %s default=%r optional=%r mutable=%r",
identifier, datatype, default, optional, mutable
)
# use one of the subclasses
... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def __init__(self, identifier, datatype, default=None, optional=True, mutable=False):
if _debug:
OptionalProperty._debug("__init__ %s %s default=%r optional=%r mutable=%r",
identifier, datatype, default, optional, mutable
)
# continue with the initialization
... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def __init__(self, identifier, datatype, default=None, optional=False, mutable=False):
if _debug:
ReadableProperty._debug("__init__ %s %s default=%r optional=%r mutable=%r",
identifier, datatype, default, optional, mutable
)
# continue with the initialization... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def __init__(self, identifier, datatype, default=None, optional=False, mutable=True):
if _debug:
WritableProperty._debug("__init__ %s %s default=%r optional=%r mutable=%r",
identifier, datatype, default, optional, mutable
)
# continue with the initialization
... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def WriteProperty(self, obj, value, arrayIndex=None, priority=None, direct=False):
if _debug: ObjectIdentifierProperty._debug("WriteProperty %r %r arrayIndex=%r priority=%r", obj, value, arrayIndex, priority)
# make it easy to default
if value is None:
pass
elif isinstance(v... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def __init__(self, **kwargs):
"""Create an object, with default property values as needed."""
if _debug: Object._debug("__init__(%s) %r", self.__class__.__name__, kwargs)
# map the python names into property names and make sure they
# are appropriate for this object
initargs = {... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def __getattr__(self, attr):
if _debug: Object._debug("__getattr__ %r", attr)
# do not redirect private attrs or functions
if attr.startswith('_') or attr[0].isupper() or (attr == 'debug_contents'):
return object.__getattribute__(self, attr)
# defer to the property to get t... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def add_property(self, prop):
"""Add a property to an object. The property is an instance of
a Property or one of its derived classes. Adding a property
disconnects it from the collection of properties common to all of the
objects of its class."""
if _debug: Object._debug("add_... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def ReadProperty(self, propid, arrayIndex=None):
if _debug: Object._debug("ReadProperty %r arrayIndex=%r", propid, arrayIndex)
# get the property
prop = self._properties.get(propid)
if not prop:
raise PropertyError(propid)
# defer to the property to get the value
... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
def get_datatype(self, propid):
"""Return the datatype for the property of an object."""
if _debug: Object._debug("get_datatype %r", propid)
# get the property
prop = self._properties.get(propid)
if not prop:
raise PropertyError(propid)
# return the datatype... | JoelBender/bacpypes | [
243,
121,
243,
107,
1436992431
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.