repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
DinoTools/python-overpy | overpy/__init__.py | Result.append | def append(self, element):
"""
Append a new element to the result.
:param element: The element to append
:type element: overpy.Element
"""
if is_valid_type(element, Element):
self._class_collection_map[element.__class__].setdefault(element.id, element) | python | def append(self, element):
"""
Append a new element to the result.
:param element: The element to append
:type element: overpy.Element
"""
if is_valid_type(element, Element):
self._class_collection_map[element.__class__].setdefault(element.id, element) | Append a new element to the result.
:param element: The element to append
:type element: overpy.Element | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L289-L297 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_elements | def get_elements(self, filter_cls, elem_id=None):
"""
Get a list of elements from the result and filter the element type by a class.
:param filter_cls:
:param elem_id: ID of the object
:type elem_id: Integer
:return: List of available elements
:rtype: List
... | python | def get_elements(self, filter_cls, elem_id=None):
"""
Get a list of elements from the result and filter the element type by a class.
:param filter_cls:
:param elem_id: ID of the object
:type elem_id: Integer
:return: List of available elements
:rtype: List
... | Get a list of elements from the result and filter the element type by a class.
:param filter_cls:
:param elem_id: ID of the object
:type elem_id: Integer
:return: List of available elements
:rtype: List | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L299-L318 |
DinoTools/python-overpy | overpy/__init__.py | Result.from_json | def from_json(cls, data, api=None):
"""
Create a new instance and load data from json object.
:param data: JSON data returned by the Overpass API
:type data: Dict
:param api:
:type api: overpy.Overpass
:return: New instance of Result object
:rtype: overpy... | python | def from_json(cls, data, api=None):
"""
Create a new instance and load data from json object.
:param data: JSON data returned by the Overpass API
:type data: Dict
:param api:
:type api: overpy.Overpass
:return: New instance of Result object
:rtype: overpy... | Create a new instance and load data from json object.
:param data: JSON data returned by the Overpass API
:type data: Dict
:param api:
:type api: overpy.Overpass
:return: New instance of Result object
:rtype: overpy.Result | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L341-L359 |
DinoTools/python-overpy | overpy/__init__.py | Result.from_xml | def from_xml(cls, data, api=None, parser=None):
"""
Create a new instance and load data from xml data or object.
.. note::
If parser is set to None, the functions tries to find the best parse.
By default the SAX parser is chosen if a string is provided as data.
... | python | def from_xml(cls, data, api=None, parser=None):
"""
Create a new instance and load data from xml data or object.
.. note::
If parser is set to None, the functions tries to find the best parse.
By default the SAX parser is chosen if a string is provided as data.
... | Create a new instance and load data from xml data or object.
.. note::
If parser is set to None, the functions tries to find the best parse.
By default the SAX parser is chosen if a string is provided as data.
The parser is set to DOM if an xml.etree.ElementTree.Elem... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L362-L414 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_area | def get_area(self, area_id, resolve_missing=False):
"""
Get an area by its ID.
:param area_id: The area ID
:type area_id: Integer
:param resolve_missing: Query the Overpass API if the area is missing in the result set.
:return: The area
:rtype: overpy.Area
... | python | def get_area(self, area_id, resolve_missing=False):
"""
Get an area by its ID.
:param area_id: The area ID
:type area_id: Integer
:param resolve_missing: Query the Overpass API if the area is missing in the result set.
:return: The area
:rtype: overpy.Area
... | Get an area by its ID.
:param area_id: The area ID
:type area_id: Integer
:param resolve_missing: Query the Overpass API if the area is missing in the result set.
:return: The area
:rtype: overpy.Area
:raises overpy.exception.DataIncomplete: The requested way is not avai... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L416-L449 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_areas | def get_areas(self, area_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Area
:param area_id: The Id of the area
:type area_id: Integer
:return: List of elements
"""
return self.get_elements(Area, elem_id=area_id, **kwargs) | python | def get_areas(self, area_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Area
:param area_id: The Id of the area
:type area_id: Integer
:return: List of elements
"""
return self.get_elements(Area, elem_id=area_id, **kwargs) | Alias for get_elements() but filter the result by Area
:param area_id: The Id of the area
:type area_id: Integer
:return: List of elements | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L451-L459 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_node | def get_node(self, node_id, resolve_missing=False):
"""
Get a node by its ID.
:param node_id: The node ID
:type node_id: Integer
:param resolve_missing: Query the Overpass API if the node is missing in the result set.
:return: The node
:rtype: overpy.Node
... | python | def get_node(self, node_id, resolve_missing=False):
"""
Get a node by its ID.
:param node_id: The node ID
:type node_id: Integer
:param resolve_missing: Query the Overpass API if the node is missing in the result set.
:return: The node
:rtype: overpy.Node
... | Get a node by its ID.
:param node_id: The node ID
:type node_id: Integer
:param resolve_missing: Query the Overpass API if the node is missing in the result set.
:return: The node
:rtype: overpy.Node
:raises overpy.exception.DataIncomplete: At least one referenced node i... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L461-L494 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_nodes | def get_nodes(self, node_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Node()
:param node_id: The Id of the node
:type node_id: Integer
:return: List of elements
"""
return self.get_elements(Node, elem_id=node_id, **kwargs) | python | def get_nodes(self, node_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Node()
:param node_id: The Id of the node
:type node_id: Integer
:return: List of elements
"""
return self.get_elements(Node, elem_id=node_id, **kwargs) | Alias for get_elements() but filter the result by Node()
:param node_id: The Id of the node
:type node_id: Integer
:return: List of elements | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L496-L504 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_relation | def get_relation(self, rel_id, resolve_missing=False):
"""
Get a relation by its ID.
:param rel_id: The relation ID
:type rel_id: Integer
:param resolve_missing: Query the Overpass API if the relation is missing in the result set.
:return: The relation
:rtype: ov... | python | def get_relation(self, rel_id, resolve_missing=False):
"""
Get a relation by its ID.
:param rel_id: The relation ID
:type rel_id: Integer
:param resolve_missing: Query the Overpass API if the relation is missing in the result set.
:return: The relation
:rtype: ov... | Get a relation by its ID.
:param rel_id: The relation ID
:type rel_id: Integer
:param resolve_missing: Query the Overpass API if the relation is missing in the result set.
:return: The relation
:rtype: overpy.Relation
:raises overpy.exception.DataIncomplete: The requeste... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L506-L539 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_relations | def get_relations(self, rel_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Relation
:param rel_id: Id of the relation
:type rel_id: Integer
:return: List of elements
"""
return self.get_elements(Relation, elem_id=rel_id, **kwargs) | python | def get_relations(self, rel_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Relation
:param rel_id: Id of the relation
:type rel_id: Integer
:return: List of elements
"""
return self.get_elements(Relation, elem_id=rel_id, **kwargs) | Alias for get_elements() but filter the result by Relation
:param rel_id: Id of the relation
:type rel_id: Integer
:return: List of elements | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L541-L549 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_way | def get_way(self, way_id, resolve_missing=False):
"""
Get a way by its ID.
:param way_id: The way ID
:type way_id: Integer
:param resolve_missing: Query the Overpass API if the way is missing in the result set.
:return: The way
:rtype: overpy.Way
:raises ... | python | def get_way(self, way_id, resolve_missing=False):
"""
Get a way by its ID.
:param way_id: The way ID
:type way_id: Integer
:param resolve_missing: Query the Overpass API if the way is missing in the result set.
:return: The way
:rtype: overpy.Way
:raises ... | Get a way by its ID.
:param way_id: The way ID
:type way_id: Integer
:param resolve_missing: Query the Overpass API if the way is missing in the result set.
:return: The way
:rtype: overpy.Way
:raises overpy.exception.DataIncomplete: The requested way is not available in... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L551-L584 |
DinoTools/python-overpy | overpy/__init__.py | Result.get_ways | def get_ways(self, way_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Way
:param way_id: The Id of the way
:type way_id: Integer
:return: List of elements
"""
return self.get_elements(Way, elem_id=way_id, **kwargs) | python | def get_ways(self, way_id=None, **kwargs):
"""
Alias for get_elements() but filter the result by Way
:param way_id: The Id of the way
:type way_id: Integer
:return: List of elements
"""
return self.get_elements(Way, elem_id=way_id, **kwargs) | Alias for get_elements() but filter the result by Way
:param way_id: The Id of the way
:type way_id: Integer
:return: List of elements | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L586-L594 |
DinoTools/python-overpy | overpy/__init__.py | Element.get_center_from_json | def get_center_from_json(cls, data):
"""
Get center information from json data
:param data: json data
:return: tuple with two elements: lat and lon
:rtype: tuple
"""
center_lat = None
center_lon = None
center = data.get("center")
if isinst... | python | def get_center_from_json(cls, data):
"""
Get center information from json data
:param data: json data
:return: tuple with two elements: lat and lon
:rtype: tuple
"""
center_lat = None
center_lon = None
center = data.get("center")
if isinst... | Get center information from json data
:param data: json data
:return: tuple with two elements: lat and lon
:rtype: tuple | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L631-L649 |
DinoTools/python-overpy | overpy/__init__.py | Area.from_xml | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | python | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
:rtype: overpy.Way
:raises overpy.exception.Eleme... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L717-L758 |
DinoTools/python-overpy | overpy/__init__.py | Node.from_json | def from_json(cls, data, result=None):
"""
Create new Node element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Node
:rtype: over... | python | def from_json(cls, data, result=None):
"""
Create new Node element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Node
:rtype: over... | Create new Node element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Node
:rtype: overpy.Node
:raises overpy.exception.ElementDataWrongTy... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L788-L819 |
DinoTools/python-overpy | overpy/__init__.py | Node.from_xml | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | python | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
:rtype: overpy.Node
:raises overpy.exception.Elem... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L822-L868 |
DinoTools/python-overpy | overpy/__init__.py | Way.get_nodes | def get_nodes(self, resolve_missing=False):
"""
Get the nodes defining the geometry of the way
:param resolve_missing: Try to resolve missing nodes.
:type resolve_missing: Boolean
:return: List of nodes
:rtype: List of overpy.Node
:raises overpy.exception.DataInc... | python | def get_nodes(self, resolve_missing=False):
"""
Get the nodes defining the geometry of the way
:param resolve_missing: Try to resolve missing nodes.
:type resolve_missing: Boolean
:return: List of nodes
:rtype: List of overpy.Node
:raises overpy.exception.DataInc... | Get the nodes defining the geometry of the way
:param resolve_missing: Try to resolve missing nodes.
:type resolve_missing: Boolean
:return: List of nodes
:rtype: List of overpy.Node
:raises overpy.exception.DataIncomplete: At least one referenced node is not available in the re... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L909-L963 |
DinoTools/python-overpy | overpy/__init__.py | Way.from_json | def from_json(cls, data, result=None):
"""
Create new Way element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Way
:rtype: overpy... | python | def from_json(cls, data, result=None):
"""
Create new Way element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Way
:rtype: overpy... | Create new Way element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Way
:rtype: overpy.Way
:raises overpy.exception.ElementDataWrongType:... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L966-L1005 |
DinoTools/python-overpy | overpy/__init__.py | Way.from_xml | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | python | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
:rtype: overpy.Way
:raises overpy.exception.Eleme... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1008-L1061 |
DinoTools/python-overpy | overpy/__init__.py | Relation.from_json | def from_json(cls, data, result=None):
"""
Create new Relation element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Relation
:rty... | python | def from_json(cls, data, result=None):
"""
Create new Relation element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Relation
:rty... | Create new Relation element from JSON data
:param data: Element data from JSON
:type data: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of Relation
:rtype: overpy.Relation
:raises overpy.exception.Elemen... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1092-L1144 |
DinoTools/python-overpy | overpy/__init__.py | Relation.from_xml | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | python | def from_xml(cls, child, result=None):
"""
Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
... | Create new way element from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this node belongs to
:type result: overpy.Result
:return: New Way oject
:rtype: overpy.Relation
:raises overpy.exception.... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1147-L1211 |
DinoTools/python-overpy | overpy/__init__.py | RelationMember.from_json | def from_json(cls, data, result=None):
"""
Create new RelationMember element from JSON data
:param child: Element data from JSON
:type child: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of RelationMembe... | python | def from_json(cls, data, result=None):
"""
Create new RelationMember element from JSON data
:param child: Element data from JSON
:type child: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of RelationMembe... | Create new RelationMember element from JSON data
:param child: Element data from JSON
:type child: Dict
:param result: The result this element belongs to
:type result: overpy.Result
:return: New instance of RelationMember
:rtype: overpy.RelationMember
:raises ove... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1234-L1282 |
DinoTools/python-overpy | overpy/__init__.py | RelationMember.from_xml | def from_xml(cls, child, result=None):
"""
Create new RelationMember from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this element belongs to
:type result: overpy.Result
:return: New relation m... | python | def from_xml(cls, child, result=None):
"""
Create new RelationMember from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this element belongs to
:type result: overpy.Result
:return: New relation m... | Create new RelationMember from XML data
:param child: XML node to be parsed
:type child: xml.etree.ElementTree.Element
:param result: The result this element belongs to
:type result: overpy.Result
:return: New relation member oject
:rtype: overpy.RelationMember
:... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1285-L1333 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler.startElement | def startElement(self, name, attrs):
"""
Handle opening elements.
:param name: Name of the element
:type name: String
:param attrs: Attributes of the element
:type attrs: Dict
"""
if name in self.ignore_start:
return
try:
h... | python | def startElement(self, name, attrs):
"""
Handle opening elements.
:param name: Name of the element
:type name: String
:param attrs: Attributes of the element
:type attrs: Dict
"""
if name in self.ignore_start:
return
try:
h... | Handle opening elements.
:param name: Name of the element
:type name: String
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1405-L1420 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler.endElement | def endElement(self, name):
"""
Handle closing elements
:param name: Name of the element
:type name: String
"""
if name in self.ignore_end:
return
try:
handler = getattr(self, '_handle_end_%s' % name)
except AttributeError:
... | python | def endElement(self, name):
"""
Handle closing elements
:param name: Name of the element
:type name: String
"""
if name in self.ignore_end:
return
try:
handler = getattr(self, '_handle_end_%s' % name)
except AttributeError:
... | Handle closing elements
:param name: Name of the element
:type name: String | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1422-L1435 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_center | def _handle_start_center(self, attrs):
"""
Handle opening center element
:param attrs: Attributes of the element
:type attrs: Dict
"""
center_lat = attrs.get("lat")
center_lon = attrs.get("lon")
if center_lat is None or center_lon is None:
rai... | python | def _handle_start_center(self, attrs):
"""
Handle opening center element
:param attrs: Attributes of the element
:type attrs: Dict
"""
center_lat = attrs.get("lat")
center_lon = attrs.get("lon")
if center_lat is None or center_lon is None:
rai... | Handle opening center element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1437-L1449 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_tag | def _handle_start_tag(self, attrs):
"""
Handle opening tag element
:param attrs: Attributes of the element
:type attrs: Dict
"""
try:
tag_key = attrs['k']
except KeyError:
raise ValueError("Tag without name/key.")
self._curr['tags'... | python | def _handle_start_tag(self, attrs):
"""
Handle opening tag element
:param attrs: Attributes of the element
:type attrs: Dict
"""
try:
tag_key = attrs['k']
except KeyError:
raise ValueError("Tag without name/key.")
self._curr['tags'... | Handle opening tag element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1451-L1462 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_node | def _handle_start_node(self, attrs):
"""
Handle opening node element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'attributes': dict(attrs),
'lat': None,
'lon': None,
'node_id': None,
... | python | def _handle_start_node(self, attrs):
"""
Handle opening node element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'attributes': dict(attrs),
'lat': None,
'lon': None,
'node_id': None,
... | Handle opening node element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1464-L1486 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_end_node | def _handle_end_node(self):
"""
Handle closing node element
"""
self._result.append(Node(result=self._result, **self._curr))
self._curr = {} | python | def _handle_end_node(self):
"""
Handle closing node element
"""
self._result.append(Node(result=self._result, **self._curr))
self._curr = {} | Handle closing node element | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1488-L1493 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_way | def _handle_start_way(self, attrs):
"""
Handle opening way element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'center_lat': None,
'center_lon': None,
'attributes': dict(attrs),
'node_ids': ... | python | def _handle_start_way(self, attrs):
"""
Handle opening way element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'center_lat': None,
'center_lon': None,
'attributes': dict(attrs),
'node_ids': ... | Handle opening way element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1495-L1512 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_end_way | def _handle_end_way(self):
"""
Handle closing way element
"""
self._result.append(Way(result=self._result, **self._curr))
self._curr = {} | python | def _handle_end_way(self):
"""
Handle closing way element
"""
self._result.append(Way(result=self._result, **self._curr))
self._curr = {} | Handle closing way element | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1514-L1519 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_area | def _handle_start_area(self, attrs):
"""
Handle opening area element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'attributes': dict(attrs),
'tags': {},
'area_id': None
}
if attrs.get('id... | python | def _handle_start_area(self, attrs):
"""
Handle opening area element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'attributes': dict(attrs),
'tags': {},
'area_id': None
}
if attrs.get('id... | Handle opening area element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1521-L1535 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_end_area | def _handle_end_area(self):
"""
Handle closing area element
"""
self._result.append(Area(result=self._result, **self._curr))
self._curr = {} | python | def _handle_end_area(self):
"""
Handle closing area element
"""
self._result.append(Area(result=self._result, **self._curr))
self._curr = {} | Handle closing area element | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1537-L1542 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_nd | def _handle_start_nd(self, attrs):
"""
Handle opening nd element
:param attrs: Attributes of the element
:type attrs: Dict
"""
if isinstance(self.cur_relation_member, RelationWay):
if self.cur_relation_member.geometry is None:
self.cur_relatio... | python | def _handle_start_nd(self, attrs):
"""
Handle opening nd element
:param attrs: Attributes of the element
:type attrs: Dict
"""
if isinstance(self.cur_relation_member, RelationWay):
if self.cur_relation_member.geometry is None:
self.cur_relatio... | Handle opening nd element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1544-L1565 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_relation | def _handle_start_relation(self, attrs):
"""
Handle opening relation element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'attributes': dict(attrs),
'members': [],
'rel_id': None,
'tags': {}
... | python | def _handle_start_relation(self, attrs):
"""
Handle opening relation element
:param attrs: Attributes of the element
:type attrs: Dict
"""
self._curr = {
'attributes': dict(attrs),
'members': [],
'rel_id': None,
'tags': {}
... | Handle opening relation element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1567-L1582 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_end_relation | def _handle_end_relation(self):
"""
Handle closing relation element
"""
self._result.append(Relation(result=self._result, **self._curr))
self._curr = {} | python | def _handle_end_relation(self):
"""
Handle closing relation element
"""
self._result.append(Relation(result=self._result, **self._curr))
self._curr = {} | Handle closing relation element | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1584-L1589 |
DinoTools/python-overpy | overpy/__init__.py | OSMSAXHandler._handle_start_member | def _handle_start_member(self, attrs):
"""
Handle opening member element
:param attrs: Attributes of the element
:type attrs: Dict
"""
params = {
# ToDo: Parse attributes
'attributes': {},
'ref': None,
'result': self._resu... | python | def _handle_start_member(self, attrs):
"""
Handle opening member element
:param attrs: Attributes of the element
:type attrs: Dict
"""
params = {
# ToDo: Parse attributes
'attributes': {},
'ref': None,
'result': self._resu... | Handle opening member element
:param attrs: Attributes of the element
:type attrs: Dict | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1591-L1622 |
DinoTools/python-overpy | overpy/helper.py | get_street | def get_street(street, areacode, api=None):
"""
Retrieve streets in a given bounding area
:param overpy.Overpass api: First street of intersection
:param String street: Name of street
:param String areacode: The OSM id of the bounding area
:return: Parsed result
:raises overpy.exception.Ove... | python | def get_street(street, areacode, api=None):
"""
Retrieve streets in a given bounding area
:param overpy.Overpass api: First street of intersection
:param String street: Name of street
:param String areacode: The OSM id of the bounding area
:return: Parsed result
:raises overpy.exception.Ove... | Retrieve streets in a given bounding area
:param overpy.Overpass api: First street of intersection
:param String street: Name of street
:param String areacode: The OSM id of the bounding area
:return: Parsed result
:raises overpy.exception.OverPyException: If something bad happens. | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/helper.py#L6-L35 |
DinoTools/python-overpy | overpy/helper.py | get_intersection | def get_intersection(street1, street2, areacode, api=None):
"""
Retrieve intersection of two streets in a given bounding area
:param overpy.Overpass api: First street of intersection
:param String street1: Name of first street of intersection
:param String street2: Name of second street of intersec... | python | def get_intersection(street1, street2, areacode, api=None):
"""
Retrieve intersection of two streets in a given bounding area
:param overpy.Overpass api: First street of intersection
:param String street1: Name of first street of intersection
:param String street2: Name of second street of intersec... | Retrieve intersection of two streets in a given bounding area
:param overpy.Overpass api: First street of intersection
:param String street1: Name of first street of intersection
:param String street2: Name of second street of intersection
:param String areacode: The OSM id of the bounding area
:re... | https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/helper.py#L38-L64 |
clemtoy/pptree | pptree/pptree.py | print_tree | def print_tree(current_node, childattr='children', nameattr='name', indent='', last='updown'):
if hasattr(current_node, nameattr):
name = lambda node: getattr(node, nameattr)
else:
name = lambda node: str(node)
children = lambda node: getattr(node, childattr)
nb_children = lamb... | python | def print_tree(current_node, childattr='children', nameattr='name', indent='', last='updown'):
if hasattr(current_node, nameattr):
name = lambda node: getattr(node, nameattr)
else:
name = lambda node: str(node)
children = lambda node: getattr(node, childattr)
nb_children = lamb... | Creation of balanced lists for "up" branch and "down" branch. | https://github.com/clemtoy/pptree/blob/16099da42b1da6d03b3a0ed0e27d0b6e90947a54/pptree/pptree.py#L16-L55 |
architv/chcli | challenges/cli.py | check_platforms | def check_platforms(platforms):
"""Checks if the platforms have a valid platform code"""
if len(platforms) > 0:
return all(platform in PLATFORM_IDS for platform in platforms)
return True | python | def check_platforms(platforms):
"""Checks if the platforms have a valid platform code"""
if len(platforms) > 0:
return all(platform in PLATFORM_IDS for platform in platforms)
return True | Checks if the platforms have a valid platform code | https://github.com/architv/chcli/blob/e9e387b9a85c6b64bc74b1a7c5b85baa4d4ea7d7/challenges/cli.py#L17-L21 |
architv/chcli | challenges/cli.py | main | def main(active, upcoming, hiring, short, goto, platforms, time):
"""A CLI for active and upcoming programming challenges from various platforms"""
if not check_platforms(platforms):
raise IncorrectParametersException('Invlaid code for platform. Please check the platform ids')
try:
if active:
acti... | python | def main(active, upcoming, hiring, short, goto, platforms, time):
"""A CLI for active and upcoming programming challenges from various platforms"""
if not check_platforms(platforms):
raise IncorrectParametersException('Invlaid code for platform. Please check the platform ids')
try:
if active:
acti... | A CLI for active and upcoming programming challenges from various platforms | https://github.com/architv/chcli/blob/e9e387b9a85c6b64bc74b1a7c5b85baa4d4ea7d7/challenges/cli.py#L117-L164 |
architv/chcli | challenges/writers.py | colors | def colors():
"""Creates an enum for colors"""
enums = dict(
TIME_LEFT="red",
CONTEST_NAME="yellow",
HOST="green",
MISC="blue",
TIME_TO_START="green",
)
return type('Enum', (), enums) | python | def colors():
"""Creates an enum for colors"""
enums = dict(
TIME_LEFT="red",
CONTEST_NAME="yellow",
HOST="green",
MISC="blue",
TIME_TO_START="green",
)
return type('Enum', (), enums) | Creates an enum for colors | https://github.com/architv/chcli/blob/e9e387b9a85c6b64bc74b1a7c5b85baa4d4ea7d7/challenges/writers.py#L7-L17 |
architv/chcli | challenges/writers.py | challenge | def challenge():
"""Creates an enum for contest type"""
enums = dict(
ACTIVE="active",
UPCOMING="upcoming",
HIRING="hiring",
ALL="all",
SHORT="short",
)
return type('Enum', (), enums) | python | def challenge():
"""Creates an enum for contest type"""
enums = dict(
ACTIVE="active",
UPCOMING="upcoming",
HIRING="hiring",
ALL="all",
SHORT="short",
)
return type('Enum', (), enums) | Creates an enum for contest type | https://github.com/architv/chcli/blob/e9e387b9a85c6b64bc74b1a7c5b85baa4d4ea7d7/challenges/writers.py#L20-L30 |
architv/chcli | challenges/writers.py | get_time_string | def get_time_string(contest, contest_type):
"""Return a string with time for the contest to begin/end"""
if contest_type == challenge().ACTIVE:
time_diff = time_difference(contest["end"])
elif contest_type == challenge().UPCOMING:
time_diff = time_difference(contest["start"])
elif contest_type in [chal... | python | def get_time_string(contest, contest_type):
"""Return a string with time for the contest to begin/end"""
if contest_type == challenge().ACTIVE:
time_diff = time_difference(contest["end"])
elif contest_type == challenge().UPCOMING:
time_diff = time_difference(contest["start"])
elif contest_type in [chal... | Return a string with time for the contest to begin/end | https://github.com/architv/chcli/blob/e9e387b9a85c6b64bc74b1a7c5b85baa4d4ea7d7/challenges/writers.py#L52-L72 |
architv/chcli | challenges/utilities.py | time_difference | def time_difference(target_time):
"""Calculate the difference between the current time and the given time"""
TimeDiff = namedtuple("TimeDiff", ["days", "hours", "minutes", "seconds"])
time_diff = format_date(target_time) - datetime.utcnow()
hours, remainder = divmod(time_diff.seconds, 3600)
minutes, seconds =... | python | def time_difference(target_time):
"""Calculate the difference between the current time and the given time"""
TimeDiff = namedtuple("TimeDiff", ["days", "hours", "minutes", "seconds"])
time_diff = format_date(target_time) - datetime.utcnow()
hours, remainder = divmod(time_diff.seconds, 3600)
minutes, seconds =... | Calculate the difference between the current time and the given time | https://github.com/architv/chcli/blob/e9e387b9a85c6b64bc74b1a7c5b85baa4d4ea7d7/challenges/utilities.py#L12-L18 |
manjitkumar/drf-url-filters | filters/validations.py | IntegerLike | def IntegerLike(msg=None):
'''
Checks whether a value is:
- int, or
- long, or
- float without a fractional part, or
- str or unicode composed only of digits
'''
def fn(value):
if not any([
isinstance(value, numbers.Integral),
(isinstance(v... | python | def IntegerLike(msg=None):
'''
Checks whether a value is:
- int, or
- long, or
- float without a fractional part, or
- str or unicode composed only of digits
'''
def fn(value):
if not any([
isinstance(value, numbers.Integral),
(isinstance(v... | Checks whether a value is:
- int, or
- long, or
- float without a fractional part, or
- str or unicode composed only of digits | https://github.com/manjitkumar/drf-url-filters/blob/ebac358729bcd9aa70537247b2ccd6005f5678c1/filters/validations.py#L13-L32 |
manjitkumar/drf-url-filters | filters/validations.py | Alphanumeric | def Alphanumeric(msg=None):
'''
Checks whether a value is:
- int, or
- long, or
- float without a fractional part, or
- str or unicode composed only of alphanumeric characters
'''
def fn(value):
if not any([
isinstance(value, numbers.Integral),
... | python | def Alphanumeric(msg=None):
'''
Checks whether a value is:
- int, or
- long, or
- float without a fractional part, or
- str or unicode composed only of alphanumeric characters
'''
def fn(value):
if not any([
isinstance(value, numbers.Integral),
... | Checks whether a value is:
- int, or
- long, or
- float without a fractional part, or
- str or unicode composed only of alphanumeric characters | https://github.com/manjitkumar/drf-url-filters/blob/ebac358729bcd9aa70537247b2ccd6005f5678c1/filters/validations.py#L35-L54 |
manjitkumar/drf-url-filters | filters/validations.py | StrictlyAlphanumeric | def StrictlyAlphanumeric(msg=None):
'''
Checks whether a value is:
- str or unicode, and
- composed of both alphabets and digits
'''
def fn(value):
if not (
isinstance(value, basestring) and
value.isalnum() and not
value.isdigit() and not
... | python | def StrictlyAlphanumeric(msg=None):
'''
Checks whether a value is:
- str or unicode, and
- composed of both alphabets and digits
'''
def fn(value):
if not (
isinstance(value, basestring) and
value.isalnum() and not
value.isdigit() and not
... | Checks whether a value is:
- str or unicode, and
- composed of both alphabets and digits | https://github.com/manjitkumar/drf-url-filters/blob/ebac358729bcd9aa70537247b2ccd6005f5678c1/filters/validations.py#L57-L75 |
manjitkumar/drf-url-filters | filters/validations.py | DatetimeWithTZ | def DatetimeWithTZ(msg=None):
'''
Checks whether a value is :
- a valid castable datetime object with timezone.
'''
def fn(value):
try:
date = parse_datetime(value) or parse_date(value)
if date is not None:
return date
else:
... | python | def DatetimeWithTZ(msg=None):
'''
Checks whether a value is :
- a valid castable datetime object with timezone.
'''
def fn(value):
try:
date = parse_datetime(value) or parse_date(value)
if date is not None:
return date
else:
... | Checks whether a value is :
- a valid castable datetime object with timezone. | https://github.com/manjitkumar/drf-url-filters/blob/ebac358729bcd9aa70537247b2ccd6005f5678c1/filters/validations.py#L78-L92 |
manjitkumar/drf-url-filters | filters/validations.py | CSVofIntegers | def CSVofIntegers(msg=None):
'''
Checks whether a value is list of integers.
Returns list of integers or just one integer in
list if there is only one element in given CSV string.
'''
def fn(value):
try:
if isinstance(value, basestring):
if ',' in value:
... | python | def CSVofIntegers(msg=None):
'''
Checks whether a value is list of integers.
Returns list of integers or just one integer in
list if there is only one element in given CSV string.
'''
def fn(value):
try:
if isinstance(value, basestring):
if ',' in value:
... | Checks whether a value is list of integers.
Returns list of integers or just one integer in
list if there is only one element in given CSV string. | https://github.com/manjitkumar/drf-url-filters/blob/ebac358729bcd9aa70537247b2ccd6005f5678c1/filters/validations.py#L95-L121 |
manjitkumar/drf-url-filters | example_app/views.py | TeamsViewSet.get_queryset | def get_queryset(self):
"""
Optionally restricts the queryset by filtering against
query parameters in the URL.
"""
query_params = self.request.query_params
url_params = self.kwargs
# get queryset_filters from FilterMixin
queryset_filters = self.get_db_f... | python | def get_queryset(self):
"""
Optionally restricts the queryset by filtering against
query parameters in the URL.
"""
query_params = self.request.query_params
url_params = self.kwargs
# get queryset_filters from FilterMixin
queryset_filters = self.get_db_f... | Optionally restricts the queryset by filtering against
query parameters in the URL. | https://github.com/manjitkumar/drf-url-filters/blob/ebac358729bcd9aa70537247b2ccd6005f5678c1/example_app/views.py#L90-L112 |
nimbis/cmsplugin-newsplus | cmsplugin_newsplus/settings.py | get_setting | def get_setting(name, default):
"""
A little helper for fetching global settings with a common prefix.
"""
parent_name = "CMSPLUGIN_NEWS_{0}".format(name)
return getattr(django_settings, parent_name, default) | python | def get_setting(name, default):
"""
A little helper for fetching global settings with a common prefix.
"""
parent_name = "CMSPLUGIN_NEWS_{0}".format(name)
return getattr(django_settings, parent_name, default) | A little helper for fetching global settings with a common prefix. | https://github.com/nimbis/cmsplugin-newsplus/blob/1787fb674faa7800845f18ce782154e290f6be27/cmsplugin_newsplus/settings.py#L5-L10 |
nimbis/cmsplugin-newsplus | cmsplugin_newsplus/admin.py | NewsAdmin.make_published | def make_published(self, request, queryset):
"""
Marks selected news items as published
"""
rows_updated = queryset.update(is_published=True)
self.message_user(request,
ungettext('%(count)d newsitem was published',
... | python | def make_published(self, request, queryset):
"""
Marks selected news items as published
"""
rows_updated = queryset.update(is_published=True)
self.message_user(request,
ungettext('%(count)d newsitem was published',
... | Marks selected news items as published | https://github.com/nimbis/cmsplugin-newsplus/blob/1787fb674faa7800845f18ce782154e290f6be27/cmsplugin_newsplus/admin.py#L38-L46 |
nimbis/cmsplugin-newsplus | cmsplugin_newsplus/admin.py | NewsAdmin.make_unpublished | def make_unpublished(self, request, queryset):
"""
Marks selected news items as unpublished
"""
rows_updated = queryset.update(is_published=False)
self.message_user(request,
ungettext('%(count)d newsitem was unpublished',
... | python | def make_unpublished(self, request, queryset):
"""
Marks selected news items as unpublished
"""
rows_updated = queryset.update(is_published=False)
self.message_user(request,
ungettext('%(count)d newsitem was unpublished',
... | Marks selected news items as unpublished | https://github.com/nimbis/cmsplugin-newsplus/blob/1787fb674faa7800845f18ce782154e290f6be27/cmsplugin_newsplus/admin.py#L49-L57 |
nimbis/cmsplugin-newsplus | cmsplugin_newsplus/widgets/tinymce_widget.py | TinyMCEEditor.render | def render(self, name, value, attrs=None):
if value is None:
value = ''
value = smart_unicode(value)
final_attrs = self.build_attrs(attrs)
final_attrs['name'] = name
assert 'id' in final_attrs, \
"TinyMCE widget attributes must contain 'id'"
mce_co... | python | def render(self, name, value, attrs=None):
if value is None:
value = ''
value = smart_unicode(value)
final_attrs = self.build_attrs(attrs)
final_attrs['name'] = name
assert 'id' in final_attrs, \
"TinyMCE widget attributes must contain 'id'"
mce_co... | plugins = mce_config.get("plugins", "")
if len(plugins):
plugins += ","
plugins += "-cmsplugins"
mce_config['plugins'] = plugins
adv2 = mce_config.get('theme_advanced_buttons1', "")
if len(adv2):
adv2 = "," + adv2
adv2 = "cmsplugins,cmspluginsedit"... | https://github.com/nimbis/cmsplugin-newsplus/blob/1787fb674faa7800845f18ce782154e290f6be27/cmsplugin_newsplus/widgets/tinymce_widget.py#L48-L100 |
tutorcruncher/pydf | pydf/wkhtmltopdf.py | _execute_wk | def _execute_wk(*args, input=None):
"""
Generate path for the wkhtmltopdf binary and execute command.
:param args: args to pass straight to subprocess.Popen
:return: stdout, stderr
"""
wk_args = (WK_PATH,) + args
return subprocess.run(wk_args, input=input, stdout=subprocess.PIPE, stderr=sub... | python | def _execute_wk(*args, input=None):
"""
Generate path for the wkhtmltopdf binary and execute command.
:param args: args to pass straight to subprocess.Popen
:return: stdout, stderr
"""
wk_args = (WK_PATH,) + args
return subprocess.run(wk_args, input=input, stdout=subprocess.PIPE, stderr=sub... | Generate path for the wkhtmltopdf binary and execute command.
:param args: args to pass straight to subprocess.Popen
:return: stdout, stderr | https://github.com/tutorcruncher/pydf/blob/53dd030f02f112593ed6e2655160a40b892a23c0/pydf/wkhtmltopdf.py#L22-L30 |
tutorcruncher/pydf | pydf/wkhtmltopdf.py | generate_pdf | def generate_pdf(html, *,
cache_dir: Path=DFT_CACHE_DIR,
grayscale: bool=False,
lowquality: bool=False,
margin_bottom: str=None,
margin_left: str=None,
margin_right: str=None,
margin_top: str=None,
... | python | def generate_pdf(html, *,
cache_dir: Path=DFT_CACHE_DIR,
grayscale: bool=False,
lowquality: bool=False,
margin_bottom: str=None,
margin_left: str=None,
margin_right: str=None,
margin_top: str=None,
... | Generate a pdf from either a url or a html string.
After the html and url arguments all other arguments are
passed straight to wkhtmltopdf
For details on extra arguments see the output of get_help()
and get_extended_help()
All arguments whether specified or caught with extra_kwargs are converted
... | https://github.com/tutorcruncher/pydf/blob/53dd030f02f112593ed6e2655160a40b892a23c0/pydf/wkhtmltopdf.py#L78-L153 |
tutorcruncher/pydf | pydf/wkhtmltopdf.py | get_version | def get_version():
"""
Get version of pydf and wkhtmltopdf binary
:return: version string
"""
try:
wk_version = _string_execute('-V')
except Exception as e:
# we catch all errors here to make sure we get a version no matter what
wk_version = '%s: %s' % (e.__class__.__nam... | python | def get_version():
"""
Get version of pydf and wkhtmltopdf binary
:return: version string
"""
try:
wk_version = _string_execute('-V')
except Exception as e:
# we catch all errors here to make sure we get a version no matter what
wk_version = '%s: %s' % (e.__class__.__nam... | Get version of pydf and wkhtmltopdf binary
:return: version string | https://github.com/tutorcruncher/pydf/blob/53dd030f02f112593ed6e2655160a40b892a23c0/pydf/wkhtmltopdf.py#L160-L171 |
PiotrDabkowski/pyjsparser | pyjsparser/parser.py | PyJsParser._interpret_regexp | def _interpret_regexp(self, string, flags):
'''Perform sctring escape - for regexp literals'''
self.index = 0
self.length = len(string)
self.source = string
self.lineNumber = 0
self.lineStart = 0
octal = False
st = ''
inside_square = 0
whil... | python | def _interpret_regexp(self, string, flags):
'''Perform sctring escape - for regexp literals'''
self.index = 0
self.length = len(string)
self.source = string
self.lineNumber = 0
self.lineStart = 0
octal = False
st = ''
inside_square = 0
whil... | Perform sctring escape - for regexp literals | https://github.com/PiotrDabkowski/pyjsparser/blob/5465d037b30e334cb0997f2315ec1e451b8ad4c1/pyjsparser/parser.py#L518-L608 |
sckott/habanero | habanero/crossref/crossref.py | Crossref.works | def works(self, ids = None, query = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, select = None, cursor = None,
cursor_max = 5000, **kwargs):
'''
Search Crossref works
:param ids: [Array] DOIs ... | python | def works(self, ids = None, query = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, select = None, cursor = None,
cursor_max = 5000, **kwargs):
'''
Search Crossref works
:param ids: [Array] DOIs ... | Search Crossref works
:param ids: [Array] DOIs (digital object identifier) or other identifiers
:param query: [String] A query string
:param filter: [Hash] Filter options. See examples for usage.
Accepts a dict, with filter names and their values. For repeating filter names
... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/crossref/crossref.py#L171-L296 |
sckott/habanero | habanero/crossref/crossref.py | Crossref.prefixes | def prefixes(self, ids = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, works = False, select = None,
cursor = None, cursor_max = 5000, **kwargs):
'''
Search Crossref prefixes
:param ids: [Array... | python | def prefixes(self, ids = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, works = False, select = None,
cursor = None, cursor_max = 5000, **kwargs):
'''
Search Crossref prefixes
:param ids: [Array... | Search Crossref prefixes
:param ids: [Array] DOIs (digital object identifier) or other identifiers
:param filter: [Hash] Filter options. See examples for usage.
Accepts a dict, with filter names and their values. For repeating filter names
pass in a list of the values to that fi... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/crossref/crossref.py#L361-L430 |
sckott/habanero | habanero/crossref/crossref.py | Crossref.types | def types(self, ids = None, query = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, works = False, select = None,
cursor = None, cursor_max = 5000, **kwargs):
'''
Search Crossref types
:param ids... | python | def types(self, ids = None, query = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, works = False, select = None,
cursor = None, cursor_max = 5000, **kwargs):
'''
Search Crossref types
:param ids... | Search Crossref types
:param ids: [Array] Type identifier, e.g., journal
:param query: [String] A query string
:param filter: [Hash] Filter options. See examples for usage.
Accepts a dict, with filter names and their values. For repeating filter names
pass in a list of t... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/crossref/crossref.py#L573-L625 |
sckott/habanero | habanero/crossref/crossref.py | Crossref.licenses | def licenses(self, query = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, **kwargs):
'''
Search Crossref licenses
:param query: [String] A query string
:param offset: [Fixnum] Number of record to start at, from 1 to... | python | def licenses(self, query = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, **kwargs):
'''
Search Crossref licenses
:param query: [String] A query string
:param offset: [Fixnum] Number of record to start at, from 1 to... | Search Crossref licenses
:param query: [String] A query string
:param offset: [Fixnum] Number of record to start at, from 1 to 10000
:param limit: [Fixnum] Number of results to return. Not relevant when searching with specific dois. Default: 20. Max: 1000
:param sort: [String] Field to ... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/crossref/crossref.py#L627-L659 |
sckott/habanero | habanero/crossref/crossref.py | Crossref.registration_agency | def registration_agency(self, ids, **kwargs):
'''
Determine registration agency for DOIs
:param ids: [Array] DOIs (digital object identifier) or other identifiers
:param kwargs: additional named arguments passed on to `requests.get`, e.g., field
queries (see examples)
... | python | def registration_agency(self, ids, **kwargs):
'''
Determine registration agency for DOIs
:param ids: [Array] DOIs (digital object identifier) or other identifiers
:param kwargs: additional named arguments passed on to `requests.get`, e.g., field
queries (see examples)
... | Determine registration agency for DOIs
:param ids: [Array] DOIs (digital object identifier) or other identifiers
:param kwargs: additional named arguments passed on to `requests.get`, e.g., field
queries (see examples)
:return: list of DOI minting agencies
Usage::
... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/crossref/crossref.py#L661-L688 |
sckott/habanero | habanero/crossref/crossref.py | Crossref.random_dois | def random_dois(self, sample = 10, **kwargs):
'''
Get a random set of DOIs
:param sample: [Fixnum] Number of random DOIs to return. Default: 10. Max: 100
:param kwargs: additional named arguments passed on to `requests.get`, e.g., field
queries (see examples)
:retur... | python | def random_dois(self, sample = 10, **kwargs):
'''
Get a random set of DOIs
:param sample: [Fixnum] Number of random DOIs to return. Default: 10. Max: 100
:param kwargs: additional named arguments passed on to `requests.get`, e.g., field
queries (see examples)
:retur... | Get a random set of DOIs
:param sample: [Fixnum] Number of random DOIs to return. Default: 10. Max: 100
:param kwargs: additional named arguments passed on to `requests.get`, e.g., field
queries (see examples)
:return: [Array] of DOIs
Usage::
from habanero imp... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/crossref/crossref.py#L690-L712 |
sckott/habanero | habanero/cn/styles.py | csl_styles | def csl_styles(**kwargs):
'''
Get list of styles from https://github.com/citation-style-language/styles
:param kwargs: any additional arguments will be passed on to `requests.get`
:return: list, of CSL styles
Usage::
from habanero import cn
cn.csl_styles()
'''
base = "https://api.github.co... | python | def csl_styles(**kwargs):
'''
Get list of styles from https://github.com/citation-style-language/styles
:param kwargs: any additional arguments will be passed on to `requests.get`
:return: list, of CSL styles
Usage::
from habanero import cn
cn.csl_styles()
'''
base = "https://api.github.co... | Get list of styles from https://github.com/citation-style-language/styles
:param kwargs: any additional arguments will be passed on to `requests.get`
:return: list, of CSL styles
Usage::
from habanero import cn
cn.csl_styles() | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/cn/styles.py#L7-L33 |
sckott/habanero | habanero/cn/cn.py | content_negotiation | def content_negotiation(ids = None, format = "bibtex", style = 'apa',
locale = "en-US", url = None, **kwargs):
'''
Get citations in various formats from CrossRef
:param ids: [str] Search by a single DOI or many DOIs, each a string. If many
passed in, do so in a list
:param format: [str] Nam... | python | def content_negotiation(ids = None, format = "bibtex", style = 'apa',
locale = "en-US", url = None, **kwargs):
'''
Get citations in various formats from CrossRef
:param ids: [str] Search by a single DOI or many DOIs, each a string. If many
passed in, do so in a list
:param format: [str] Nam... | Get citations in various formats from CrossRef
:param ids: [str] Search by a single DOI or many DOIs, each a string. If many
passed in, do so in a list
:param format: [str] Name of the format. One of "rdf-xml", "turtle", "citeproc-json",
"citeproc-json-ish", "text", "ris", "bibtex" (Default), "... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/cn/cn.py#L4-L76 |
sckott/habanero | habanero/counts/counts.py | citation_count | def citation_count(doi, url = "http://www.crossref.org/openurl/",
key = "cboettig@ropensci.org", **kwargs):
'''
Get a citation count with a DOI
:param doi: [String] DOI, digital object identifier
:param url: [String] the API url for the function (should be left to default)
:param keyc: [String]... | python | def citation_count(doi, url = "http://www.crossref.org/openurl/",
key = "cboettig@ropensci.org", **kwargs):
'''
Get a citation count with a DOI
:param doi: [String] DOI, digital object identifier
:param url: [String] the API url for the function (should be left to default)
:param keyc: [String]... | Get a citation count with a DOI
:param doi: [String] DOI, digital object identifier
:param url: [String] the API url for the function (should be left to default)
:param keyc: [String] your API key
See http://labs.crossref.org/openurl/ for more info on this Crossref API service.
Usage::
f... | https://github.com/sckott/habanero/blob/a17d87070378786bbb138e1c9712ecad9aacf38e/habanero/counts/counts.py#L5-L30 |
alvinwan/tex2py | tex2py/tex2py.py | TreeOfContents.findHierarchy | def findHierarchy(self, max_subs=10):
"""Find hierarchy for the LaTeX source.
>>> TOC.fromLatex(r'\subsection{yo}\section{hello}').findHierarchy()
('section', 'subsection')
>>> TOC.fromLatex(
... r'\subsubsubsection{huh}\subsubsection{hah}').findHierarchy()
('subsubsecti... | python | def findHierarchy(self, max_subs=10):
"""Find hierarchy for the LaTeX source.
>>> TOC.fromLatex(r'\subsection{yo}\section{hello}').findHierarchy()
('section', 'subsection')
>>> TOC.fromLatex(
... r'\subsubsubsection{huh}\subsubsection{hah}').findHierarchy()
('subsubsecti... | Find hierarchy for the LaTeX source.
>>> TOC.fromLatex(r'\subsection{yo}\section{hello}').findHierarchy()
('section', 'subsection')
>>> TOC.fromLatex(
... r'\subsubsubsection{huh}\subsubsection{hah}').findHierarchy()
('subsubsection', 'subsubsubsection')
>>> TOC.fromLate... | https://github.com/alvinwan/tex2py/blob/85ce4a23ad8dbeb49a360171877dd14d099b3e9a/tex2py/tex2py.py#L69-L87 |
alvinwan/tex2py | tex2py/tex2py.py | TreeOfContents.getHeadingLevel | def getHeadingLevel(ts, hierarchy=default_hierarchy):
"""Extract heading level for a particular Tex element, given a specified
hierarchy.
>>> ts = TexSoup(r'\section{Hello}').section
>>> TOC.getHeadingLevel(ts)
2
>>> ts2 = TexSoup(r'\chapter{hello again}').chapter
... | python | def getHeadingLevel(ts, hierarchy=default_hierarchy):
"""Extract heading level for a particular Tex element, given a specified
hierarchy.
>>> ts = TexSoup(r'\section{Hello}').section
>>> TOC.getHeadingLevel(ts)
2
>>> ts2 = TexSoup(r'\chapter{hello again}').chapter
... | Extract heading level for a particular Tex element, given a specified
hierarchy.
>>> ts = TexSoup(r'\section{Hello}').section
>>> TOC.getHeadingLevel(ts)
2
>>> ts2 = TexSoup(r'\chapter{hello again}').chapter
>>> TOC.getHeadingLevel(ts2)
1
>>> ts3 = TexSou... | https://github.com/alvinwan/tex2py/blob/85ce4a23ad8dbeb49a360171877dd14d099b3e9a/tex2py/tex2py.py#L90-L115 |
alvinwan/tex2py | tex2py/tex2py.py | TreeOfContents.parseTopDepth | def parseTopDepth(self, descendants=()):
"""Parse tex for highest tag in hierarchy
>>> TOC.fromLatex('\\section{Hah}\\subsection{No}').parseTopDepth()
1
>>> s = '\\subsubsubsection{Yo}\\subsubsection{Hah}'
>>> TOC.fromLatex(s).parseTopDepth()
1
>>> h = ('section'... | python | def parseTopDepth(self, descendants=()):
"""Parse tex for highest tag in hierarchy
>>> TOC.fromLatex('\\section{Hah}\\subsection{No}').parseTopDepth()
1
>>> s = '\\subsubsubsection{Yo}\\subsubsection{Hah}'
>>> TOC.fromLatex(s).parseTopDepth()
1
>>> h = ('section'... | Parse tex for highest tag in hierarchy
>>> TOC.fromLatex('\\section{Hah}\\subsection{No}').parseTopDepth()
1
>>> s = '\\subsubsubsection{Yo}\\subsubsection{Hah}'
>>> TOC.fromLatex(s).parseTopDepth()
1
>>> h = ('section', 'subsubsection', 'subsubsubsection')
>>> T... | https://github.com/alvinwan/tex2py/blob/85ce4a23ad8dbeb49a360171877dd14d099b3e9a/tex2py/tex2py.py#L117-L133 |
alvinwan/tex2py | tex2py/tex2py.py | TreeOfContents.parseBranches | def parseBranches(self, descendants):
"""
Parse top level of latex
:param list elements: list of source objects
:return: list of filtered TreeOfContents objects
>>> toc = TOC.fromLatex(r'\section{h1}\subsection{subh1}\section{h2}\
... \subsection{subh2}')
>>> toc... | python | def parseBranches(self, descendants):
"""
Parse top level of latex
:param list elements: list of source objects
:return: list of filtered TreeOfContents objects
>>> toc = TOC.fromLatex(r'\section{h1}\subsection{subh1}\section{h2}\
... \subsection{subh2}')
>>> toc... | Parse top level of latex
:param list elements: list of source objects
:return: list of filtered TreeOfContents objects
>>> toc = TOC.fromLatex(r'\section{h1}\subsection{subh1}\section{h2}\
... \subsection{subh2}')
>>> toc.parseTopDepth(toc.descendants)
1
>>> toc.... | https://github.com/alvinwan/tex2py/blob/85ce4a23ad8dbeb49a360171877dd14d099b3e9a/tex2py/tex2py.py#L152-L177 |
alvinwan/tex2py | tex2py/tex2py.py | TreeOfContents.fromFile | def fromFile(path_or_buffer):
"""Creates abstraction using path to file
:param str path_or_buffer: path to tex file or buffer
:return: TreeOfContents object
"""
return TOC.fromLatex(open(path_or_buffer).read()
if isinstance(path_or_buffer, str)
... | python | def fromFile(path_or_buffer):
"""Creates abstraction using path to file
:param str path_or_buffer: path to tex file or buffer
:return: TreeOfContents object
"""
return TOC.fromLatex(open(path_or_buffer).read()
if isinstance(path_or_buffer, str)
... | Creates abstraction using path to file
:param str path_or_buffer: path to tex file or buffer
:return: TreeOfContents object | https://github.com/alvinwan/tex2py/blob/85ce4a23ad8dbeb49a360171877dd14d099b3e9a/tex2py/tex2py.py#L213-L221 |
alvinwan/tex2py | tex2py/tex2py.py | TreeOfContents.fromLatex | def fromLatex(tex, *args, **kwargs):
"""Creates abstraction using Latex
:param str tex: Latex
:return: TreeOfContents object
"""
source = TexSoup(tex)
return TOC('[document]', source=source,
descendants=list(source.descendants), *args, **kwargs) | python | def fromLatex(tex, *args, **kwargs):
"""Creates abstraction using Latex
:param str tex: Latex
:return: TreeOfContents object
"""
source = TexSoup(tex)
return TOC('[document]', source=source,
descendants=list(source.descendants), *args, **kwargs) | Creates abstraction using Latex
:param str tex: Latex
:return: TreeOfContents object | https://github.com/alvinwan/tex2py/blob/85ce4a23ad8dbeb49a360171877dd14d099b3e9a/tex2py/tex2py.py#L224-L232 |
mar10/pyftpsync | ftpsync/synchronizers.py | process_options | def process_options(opts):
"""Check and prepare options dict."""
# Convert match and exclude args into pattern lists
match = opts.get("match")
if match and type(match) is str:
opts["match"] = [pat.strip() for pat in match.split(",")]
elif match:
assert type(match) is list
else:
... | python | def process_options(opts):
"""Check and prepare options dict."""
# Convert match and exclude args into pattern lists
match = opts.get("match")
if match and type(match) is str:
opts["match"] = [pat.strip() for pat in match.split(",")]
elif match:
assert type(match) is list
else:
... | Check and prepare options dict. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L41-L59 |
mar10/pyftpsync | ftpsync/synchronizers.py | match_path | def match_path(entry, opts):
"""Return True if `path` matches `match` and `exclude` options."""
if entry.name in ALWAYS_OMIT:
return False
# TODO: currently we use fnmatch syntax and match against names.
# We also might allow glob syntax and match against the whole relative path instead
# pa... | python | def match_path(entry, opts):
"""Return True if `path` matches `match` and `exclude` options."""
if entry.name in ALWAYS_OMIT:
return False
# TODO: currently we use fnmatch syntax and match against names.
# We also might allow glob syntax and match against the whole relative path instead
# pa... | Return True if `path` matches `match` and `exclude` options. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L63-L88 |
mar10/pyftpsync | ftpsync/synchronizers.py | BaseSynchronizer._compare_file | def _compare_file(self, local, remote):
"""Byte compare two files (early out on first difference)."""
assert isinstance(local, FileEntry) and isinstance(remote, FileEntry)
if not local or not remote:
write(" Files cannot be compared ({} != {}).".format(local, remote))
... | python | def _compare_file(self, local, remote):
"""Byte compare two files (early out on first difference)."""
assert isinstance(local, FileEntry) and isinstance(remote, FileEntry)
if not local or not remote:
write(" Files cannot be compared ({} != {}).".format(local, remote))
... | Byte compare two files (early out on first difference). | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L231-L255 |
mar10/pyftpsync | ftpsync/synchronizers.py | BaseSynchronizer._tick | def _tick(self):
"""Write progress info and move cursor to beginning of line."""
if (self.verbose >= 3 and not IS_REDIRECTED) or self.options.get("progress"):
stats = self.get_stats()
prefix = DRY_RUN_PREFIX if self.dry_run else ""
sys.stdout.write(
"{... | python | def _tick(self):
"""Write progress info and move cursor to beginning of line."""
if (self.verbose >= 3 and not IS_REDIRECTED) or self.options.get("progress"):
stats = self.get_stats()
prefix = DRY_RUN_PREFIX if self.dry_run else ""
sys.stdout.write(
"{... | Write progress info and move cursor to beginning of line. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L437-L451 |
mar10/pyftpsync | ftpsync/synchronizers.py | BaseSynchronizer._sync_dir | def _sync_dir(self):
"""Traverse the local folder structure and remote peers.
This is the core algorithm that generates calls to self.sync_XXX()
handler methods.
_sync_dir() is called by self.run().
"""
local_entries = self.local.get_dir()
# Convert into a dict {... | python | def _sync_dir(self):
"""Traverse the local folder structure and remote peers.
This is the core algorithm that generates calls to self.sync_XXX()
handler methods.
_sync_dir() is called by self.run().
"""
local_entries = self.local.get_dir()
# Convert into a dict {... | Traverse the local folder structure and remote peers.
This is the core algorithm that generates calls to self.sync_XXX()
handler methods.
_sync_dir() is called by self.run(). | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L474-L596 |
mar10/pyftpsync | ftpsync/synchronizers.py | BaseSynchronizer.on_error | def on_error(self, e, pair):
"""Called for pairs that don't match `match` and `exclude` filters."""
RED = ansi_code("Fore.LIGHTRED_EX")
R = ansi_code("Style.RESET_ALL")
# any_entry = pair.any_entry
write((RED + "ERROR: {}\n {}" + R).format(e, pair))
# Return True to ig... | python | def on_error(self, e, pair):
"""Called for pairs that don't match `match` and `exclude` filters."""
RED = ansi_code("Fore.LIGHTRED_EX")
R = ansi_code("Style.RESET_ALL")
# any_entry = pair.any_entry
write((RED + "ERROR: {}\n {}" + R).format(e, pair))
# Return True to ig... | Called for pairs that don't match `match` and `exclude` filters. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L606-L616 |
mar10/pyftpsync | ftpsync/synchronizers.py | BaseSynchronizer.on_copy_local | def on_copy_local(self, pair):
"""Called when the local resource should be copied to remote."""
status = pair.remote_classification
self._log_action("copy", status, ">", pair.local) | python | def on_copy_local(self, pair):
"""Called when the local resource should be copied to remote."""
status = pair.remote_classification
self._log_action("copy", status, ">", pair.local) | Called when the local resource should be copied to remote. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L626-L629 |
mar10/pyftpsync | ftpsync/synchronizers.py | BaseSynchronizer.on_copy_remote | def on_copy_remote(self, pair):
"""Called when the remote resource should be copied to local."""
status = pair.local_classification
self._log_action("copy", status, "<", pair.remote) | python | def on_copy_remote(self, pair):
"""Called when the remote resource should be copied to local."""
status = pair.local_classification
self._log_action("copy", status, "<", pair.remote) | Called when the remote resource should be copied to local. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L631-L634 |
mar10/pyftpsync | ftpsync/synchronizers.py | BiDirSynchronizer.on_need_compare | def on_need_compare(self, pair):
"""Re-classify pair based on file attributes and options."""
# print("on_need_compare", pair)
# If no metadata is available, we could only classify file entries as
# 'existing'.
# Now we use peer information to improve this classification.
... | python | def on_need_compare(self, pair):
"""Re-classify pair based on file attributes and options."""
# print("on_need_compare", pair)
# If no metadata is available, we could only classify file entries as
# 'existing'.
# Now we use peer information to improve this classification.
... | Re-classify pair based on file attributes and options. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L871-L934 |
mar10/pyftpsync | ftpsync/synchronizers.py | BiDirSynchronizer.on_conflict | def on_conflict(self, pair):
"""Return False to prevent visiting of children."""
# self._log_action("skip", "conflict", "!", pair.local, min_level=2)
# print("on_conflict", pair)
any_entry = pair.any_entry
if not self._test_match_or_print(any_entry):
return
r... | python | def on_conflict(self, pair):
"""Return False to prevent visiting of children."""
# self._log_action("skip", "conflict", "!", pair.local, min_level=2)
# print("on_conflict", pair)
any_entry = pair.any_entry
if not self._test_match_or_print(any_entry):
return
r... | Return False to prevent visiting of children. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L936-L990 |
mar10/pyftpsync | ftpsync/synchronizers.py | UploadSynchronizer.on_mismatch | def on_mismatch(self, pair):
"""Called for pairs that don't match `match` and `exclude` filters.
If --delete-unmatched is on, remove the remote resource.
"""
remote_entry = pair.remote
if self.options.get("delete_unmatched") and remote_entry:
self._log_action("delete... | python | def on_mismatch(self, pair):
"""Called for pairs that don't match `match` and `exclude` filters.
If --delete-unmatched is on, remove the remote resource.
"""
remote_entry = pair.remote
if self.options.get("delete_unmatched") and remote_entry:
self._log_action("delete... | Called for pairs that don't match `match` and `exclude` filters.
If --delete-unmatched is on, remove the remote resource. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L1109-L1122 |
mar10/pyftpsync | ftpsync/synchronizers.py | DownloadSynchronizer._interactive_resolve | def _interactive_resolve(self, pair):
"""Return 'local', 'remote', or 'skip' to use local, remote resource or skip."""
if self.resolve_all:
if self.verbose >= 5:
self._print_pair_diff(pair)
return self.resolve_all
resolve = self.options.get("resolve", "sk... | python | def _interactive_resolve(self, pair):
"""Return 'local', 'remote', or 'skip' to use local, remote resource or skip."""
if self.resolve_all:
if self.verbose >= 5:
self._print_pair_diff(pair)
return self.resolve_all
resolve = self.options.get("resolve", "sk... | Return 'local', 'remote', or 'skip' to use local, remote resource or skip. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L1194-L1263 |
mar10/pyftpsync | ftpsync/synchronizers.py | DownloadSynchronizer.on_mismatch | def on_mismatch(self, pair):
"""Called for pairs that don't match `match` and `exclude` filters.
If --delete-unmatched is on, remove the remote resource.
"""
local_entry = pair.local
if self.options.get("delete_unmatched") and local_entry:
self._log_action("delete", ... | python | def on_mismatch(self, pair):
"""Called for pairs that don't match `match` and `exclude` filters.
If --delete-unmatched is on, remove the remote resource.
"""
local_entry = pair.local
if self.options.get("delete_unmatched") and local_entry:
self._log_action("delete", ... | Called for pairs that don't match `match` and `exclude` filters.
If --delete-unmatched is on, remove the remote resource. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/synchronizers.py#L1271-L1284 |
mar10/pyftpsync | ftpsync/run_command.py | handle_run_command | def handle_run_command(parser, args):
"""Implement `run` sub-command."""
MAX_LEVELS = 15
# --- Look for `pyftpsync.yaml` in current folder and parents ---
cur_level = 0
cur_folder = os.getcwd()
config_path = None
while cur_level < MAX_LEVELS:
path = os.path.join(cur_folder, CONFIG_... | python | def handle_run_command(parser, args):
"""Implement `run` sub-command."""
MAX_LEVELS = 15
# --- Look for `pyftpsync.yaml` in current folder and parents ---
cur_level = 0
cur_folder = os.getcwd()
config_path = None
while cur_level < MAX_LEVELS:
path = os.path.join(cur_folder, CONFIG_... | Implement `run` sub-command. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/run_command.py#L90-L216 |
mar10/pyftpsync | ftpsync/util.py | set_pyftpsync_logger | def set_pyftpsync_logger(logger=True):
"""Define target for common output.
Args:
logger (bool | None | logging.Logger):
Pass None to use `print()` to stdout instead of logging.
Pass True to create a simple standard logger.
"""
global _logger
prev_logger = _logger
... | python | def set_pyftpsync_logger(logger=True):
"""Define target for common output.
Args:
logger (bool | None | logging.Logger):
Pass None to use `print()` to stdout instead of logging.
Pass True to create a simple standard logger.
"""
global _logger
prev_logger = _logger
... | Define target for common output.
Args:
logger (bool | None | logging.Logger):
Pass None to use `print()` to stdout instead of logging.
Pass True to create a simple standard logger. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L31-L47 |
mar10/pyftpsync | ftpsync/util.py | write | def write(*args, **kwargs):
"""Redirectable wrapper for print statements."""
debug = kwargs.pop("debug", None)
warning = kwargs.pop("warning", None)
if _logger:
kwargs.pop("end", None)
kwargs.pop("file", None)
if debug:
_logger.debug(*args, **kwargs)
elif warn... | python | def write(*args, **kwargs):
"""Redirectable wrapper for print statements."""
debug = kwargs.pop("debug", None)
warning = kwargs.pop("warning", None)
if _logger:
kwargs.pop("end", None)
kwargs.pop("file", None)
if debug:
_logger.debug(*args, **kwargs)
elif warn... | Redirectable wrapper for print statements. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L54-L68 |
mar10/pyftpsync | ftpsync/util.py | write_error | def write_error(*args, **kwargs):
"""Redirectable wrapper for print sys.stderr statements."""
if _logger:
kwargs.pop("end", None)
kwargs.pop("file", None)
_logger.error(*args, **kwargs)
else:
print(*args, file=sys.stderr, **kwargs) | python | def write_error(*args, **kwargs):
"""Redirectable wrapper for print sys.stderr statements."""
if _logger:
kwargs.pop("end", None)
kwargs.pop("file", None)
_logger.error(*args, **kwargs)
else:
print(*args, file=sys.stderr, **kwargs) | Redirectable wrapper for print sys.stderr statements. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L71-L78 |
mar10/pyftpsync | ftpsync/util.py | namespace_to_dict | def namespace_to_dict(o):
"""Convert an argparse namespace object to a dictionary."""
d = {}
for k, v in o.__dict__.items():
if not callable(v):
d[k] = v
return d | python | def namespace_to_dict(o):
"""Convert an argparse namespace object to a dictionary."""
d = {}
for k, v in o.__dict__.items():
if not callable(v):
d[k] = v
return d | Convert an argparse namespace object to a dictionary. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L109-L115 |
mar10/pyftpsync | ftpsync/util.py | eps_compare | def eps_compare(f1, f2, eps):
"""Return true if |f1-f2| <= eps."""
res = f1 - f2
if abs(res) <= eps: # '<=',so eps == 0 works as expected
return 0
elif res < 0:
return -1
return 1 | python | def eps_compare(f1, f2, eps):
"""Return true if |f1-f2| <= eps."""
res = f1 - f2
if abs(res) <= eps: # '<=',so eps == 0 works as expected
return 0
elif res < 0:
return -1
return 1 | Return true if |f1-f2| <= eps. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L118-L125 |
mar10/pyftpsync | ftpsync/util.py | get_option | def get_option(env_name, section, opt_name, default=None):
"""Return a configuration setting from environment var or .pyftpsyncrc"""
val = os.environ.get(env_name)
if val is None:
try:
val = _pyftpsyncrc_parser.get(section, opt_name)
except (compat.configparser.NoSectionError, co... | python | def get_option(env_name, section, opt_name, default=None):
"""Return a configuration setting from environment var or .pyftpsyncrc"""
val = os.environ.get(env_name)
if val is None:
try:
val = _pyftpsyncrc_parser.get(section, opt_name)
except (compat.configparser.NoSectionError, co... | Return a configuration setting from environment var or .pyftpsyncrc | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L139-L149 |
mar10/pyftpsync | ftpsync/util.py | check_cli_verbose | def check_cli_verbose(default=3):
"""Check for presence of `--verbose`/`--quiet` or `-v`/`-q` without using argparse."""
args = sys.argv[1:]
verbose = default + args.count("--verbose") - args.count("--quiet")
for arg in args:
if arg.startswith("-") and not arg.startswith("--"):
verb... | python | def check_cli_verbose(default=3):
"""Check for presence of `--verbose`/`--quiet` or `-v`/`-q` without using argparse."""
args = sys.argv[1:]
verbose = default + args.count("--verbose") - args.count("--quiet")
for arg in args:
if arg.startswith("-") and not arg.startswith("--"):
verb... | Check for presence of `--verbose`/`--quiet` or `-v`/`-q` without using argparse. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L152-L161 |
mar10/pyftpsync | ftpsync/util.py | prompt_for_password | def prompt_for_password(url, user=None, default_user=None):
"""Prompt for username and password.
If a user name is passed, only prompt for a password.
Args:
url (str): hostname
user (str, optional):
Pass a valid name to skip prompting for a user name
default_user (str, o... | python | def prompt_for_password(url, user=None, default_user=None):
"""Prompt for username and password.
If a user name is passed, only prompt for a password.
Args:
url (str): hostname
user (str, optional):
Pass a valid name to skip prompting for a user name
default_user (str, o... | Prompt for username and password.
If a user name is passed, only prompt for a password.
Args:
url (str): hostname
user (str, optional):
Pass a valid name to skip prompting for a user name
default_user (str, optional):
Pass a valid name that is used as default whe... | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L169-L199 |
mar10/pyftpsync | ftpsync/util.py | get_credentials_for_url | def get_credentials_for_url(url, opts, force_user=None):
"""Lookup credentials for a given target in keyring and .netrc.
Optionally prompts for credentials if not found.
Returns:
2-tuple (username, password) or None
"""
creds = None
verbose = int(opts.get("verbose"))
force_prompt =... | python | def get_credentials_for_url(url, opts, force_user=None):
"""Lookup credentials for a given target in keyring and .netrc.
Optionally prompts for credentials if not found.
Returns:
2-tuple (username, password) or None
"""
creds = None
verbose = int(opts.get("verbose"))
force_prompt =... | Lookup credentials for a given target in keyring and .netrc.
Optionally prompts for credentials if not found.
Returns:
2-tuple (username, password) or None | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L202-L285 |
mar10/pyftpsync | ftpsync/util.py | save_password | def save_password(url, username, password):
"""Store credentials in keyring."""
if keyring:
if ":" in username:
raise RuntimeError(
"Unable to store credentials if username contains a ':' ({}).".format(
username
)
)
try... | python | def save_password(url, username, password):
"""Store credentials in keyring."""
if keyring:
if ":" in username:
raise RuntimeError(
"Unable to store credentials if username contains a ':' ({}).".format(
username
)
)
try... | Store credentials in keyring. | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L288-L316 |
mar10/pyftpsync | ftpsync/util.py | str_to_bool | def str_to_bool(val):
"""Return a boolean for '0', 'false', 'on', ..."""
val = str(val).lower().strip()
if val in ("1", "true", "on", "yes"):
return True
elif val in ("0", "false", "off", "no"):
return False
raise ValueError(
"Invalid value '{}'"
"(expected '1', '0', ... | python | def str_to_bool(val):
"""Return a boolean for '0', 'false', 'on', ..."""
val = str(val).lower().strip()
if val in ("1", "true", "on", "yes"):
return True
elif val in ("0", "false", "off", "no"):
return False
raise ValueError(
"Invalid value '{}'"
"(expected '1', '0', ... | Return a boolean for '0', 'false', 'on', ... | https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L319-L329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.