repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
jssimporter/python-jss
jss/jssobject.py
JSSObject._set_xml_from_keys
def _set_xml_from_keys(self, root, item, **kwargs): """Create SubElements of root with kwargs. Args: root: Element to add SubElements to. item: Tuple key/value pair from self.data_keys to add. kwargs: For each item in self.data_keys, if it has a ...
python
def _set_xml_from_keys(self, root, item, **kwargs): """Create SubElements of root with kwargs. Args: root: Element to add SubElements to. item: Tuple key/value pair from self.data_keys to add. kwargs: For each item in self.data_keys, if it has a ...
[ "def", "_set_xml_from_keys", "(", "self", ",", "root", ",", "item", ",", "*", "*", "kwargs", ")", ":", "key", ",", "val", "=", "item", "target_key", "=", "root", ".", "find", "(", "key", ")", "if", "target_key", "is", "None", ":", "target_key", "=", ...
Create SubElements of root with kwargs. Args: root: Element to add SubElements to. item: Tuple key/value pair from self.data_keys to add. kwargs: For each item in self.data_keys, if it has a corresponding kwarg, create a SubElement at root wit...
[ "Create", "SubElements", "of", "root", "with", "kwargs", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L190-L228
train
27,800
jssimporter/python-jss
jss/jssobject.py
JSSObject.get_url
def get_url(cls, data): """Return the URL for a get request based on data type. Args: data: Accepts multiple types. Int: Generate URL to object with data ID. None: Get basic object GET URL (list). String/Unicode: Search for <data> with default...
python
def get_url(cls, data): """Return the URL for a get request based on data type. Args: data: Accepts multiple types. Int: Generate URL to object with data ID. None: Get basic object GET URL (list). String/Unicode: Search for <data> with default...
[ "def", "get_url", "(", "cls", ",", "data", ")", ":", "try", ":", "data", "=", "int", "(", "data", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "pass", "if", "isinstance", "(", "data", ",", "int", ")", ":", "return", "\"%s%s%s\"", "...
Return the URL for a get request based on data type. Args: data: Accepts multiple types. Int: Generate URL to object with data ID. None: Get basic object GET URL (list). String/Unicode: Search for <data> with default_search, usuall...
[ "Return", "the", "URL", "for", "a", "get", "request", "based", "on", "data", "type", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L239-L273
train
27,801
jssimporter/python-jss
jss/jssobject.py
JSSObject.url
def url(self): """Return the path subcomponent of the url to this object. For example: "/computers/id/451" """ if self.id: url = "%s%s%s" % (self._url, self.id_url, self.id) else: url = None return url
python
def url(self): """Return the path subcomponent of the url to this object. For example: "/computers/id/451" """ if self.id: url = "%s%s%s" % (self._url, self.id_url, self.id) else: url = None return url
[ "def", "url", "(", "self", ")", ":", "if", "self", ".", "id", ":", "url", "=", "\"%s%s%s\"", "%", "(", "self", ".", "_url", ",", "self", ".", "id_url", ",", "self", ".", "id", ")", "else", ":", "url", "=", "None", "return", "url" ]
Return the path subcomponent of the url to this object. For example: "/computers/id/451"
[ "Return", "the", "path", "subcomponent", "of", "the", "url", "to", "this", "object", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L281-L290
train
27,802
jssimporter/python-jss
jss/jssobject.py
JSSObject.delete
def delete(self, data=None): """Delete this object from the JSS.""" if not self.can_delete: raise JSSMethodNotAllowedError(self.__class__.__name__) if data: self.jss.delete(self.url, data) else: self.jss.delete(self.url)
python
def delete(self, data=None): """Delete this object from the JSS.""" if not self.can_delete: raise JSSMethodNotAllowedError(self.__class__.__name__) if data: self.jss.delete(self.url, data) else: self.jss.delete(self.url)
[ "def", "delete", "(", "self", ",", "data", "=", "None", ")", ":", "if", "not", "self", ".", "can_delete", ":", "raise", "JSSMethodNotAllowedError", "(", "self", ".", "__class__", ".", "__name__", ")", "if", "data", ":", "self", ".", "jss", ".", "delete...
Delete this object from the JSS.
[ "Delete", "this", "object", "from", "the", "JSS", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L301-L308
train
27,803
jssimporter/python-jss
jss/jssobject.py
JSSObject.save
def save(self): """Update or create a new object on the JSS. If this object is not yet on the JSS, this method will create a new object with POST, otherwise, it will try to update the existing object with PUT. Data validation is up to the client; The JSS in most cases will ...
python
def save(self): """Update or create a new object on the JSS. If this object is not yet on the JSS, this method will create a new object with POST, otherwise, it will try to update the existing object with PUT. Data validation is up to the client; The JSS in most cases will ...
[ "def", "save", "(", "self", ")", ":", "# Object probably exists if it has an ID (user can't assign", "# one). The only objects that don't have an ID are those that", "# cannot list.", "if", "self", ".", "can_put", "and", "(", "not", "self", ".", "can_list", "or", "self", "...
Update or create a new object on the JSS. If this object is not yet on the JSS, this method will create a new object with POST, otherwise, it will try to update the existing object with PUT. Data validation is up to the client; The JSS in most cases will at least give you some ...
[ "Update", "or", "create", "a", "new", "object", "on", "the", "JSS", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L310-L352
train
27,804
jssimporter/python-jss
jss/jssobject.py
JSSObject._handle_location
def _handle_location(self, location): """Return an element located at location with flexible args. Args: location: String xpath to use in an Element.find search OR an Element (which is simply returned). Returns: The found Element. Raises: ...
python
def _handle_location(self, location): """Return an element located at location with flexible args. Args: location: String xpath to use in an Element.find search OR an Element (which is simply returned). Returns: The found Element. Raises: ...
[ "def", "_handle_location", "(", "self", ",", "location", ")", ":", "if", "not", "isinstance", "(", "location", ",", "ElementTree", ".", "Element", ")", ":", "element", "=", "self", ".", "find", "(", "location", ")", "if", "element", "is", "None", ":", ...
Return an element located at location with flexible args. Args: location: String xpath to use in an Element.find search OR an Element (which is simply returned). Returns: The found Element. Raises: ValueError if the location is a string that...
[ "Return", "an", "element", "located", "at", "location", "with", "flexible", "args", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L369-L389
train
27,805
jssimporter/python-jss
jss/jssobject.py
JSSObject.set_bool
def set_bool(self, location, value): """Set a boolean value. Casper booleans in XML are string literals of "true" or "false". This method sets the text value of "location" to the correct string representation of a boolean. Args: location: Element or a string path ar...
python
def set_bool(self, location, value): """Set a boolean value. Casper booleans in XML are string literals of "true" or "false". This method sets the text value of "location" to the correct string representation of a boolean. Args: location: Element or a string path ar...
[ "def", "set_bool", "(", "self", ",", "location", ",", "value", ")", ":", "element", "=", "self", ".", "_handle_location", "(", "location", ")", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "True", "if", "value", ".", "up...
Set a boolean value. Casper booleans in XML are string literals of "true" or "false". This method sets the text value of "location" to the correct string representation of a boolean. Args: location: Element or a string path argument to find() value: Boolean or s...
[ "Set", "a", "boolean", "value", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L391-L411
train
27,806
jssimporter/python-jss
jss/jssobject.py
JSSObject.add_object_to_path
def add_object_to_path(self, obj, location): """Add an object of type JSSContainerObject to location. This method determines the correct list representation of an object and adds it to "location". For example, add a Computer to a ComputerGroup. The ComputerGroup will not have a child ...
python
def add_object_to_path(self, obj, location): """Add an object of type JSSContainerObject to location. This method determines the correct list representation of an object and adds it to "location". For example, add a Computer to a ComputerGroup. The ComputerGroup will not have a child ...
[ "def", "add_object_to_path", "(", "self", ",", "obj", ",", "location", ")", ":", "location", "=", "self", ".", "_handle_location", "(", "location", ")", "location", ".", "append", "(", "obj", ".", "as_list_data", "(", ")", ")", "results", "=", "[", "item...
Add an object of type JSSContainerObject to location. This method determines the correct list representation of an object and adds it to "location". For example, add a Computer to a ComputerGroup. The ComputerGroup will not have a child Computers/Computer tag with subelements "name" and...
[ "Add", "an", "object", "of", "type", "JSSContainerObject", "to", "location", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L413-L432
train
27,807
jssimporter/python-jss
jss/jssobject.py
JSSObject.remove_object_from_list
def remove_object_from_list(self, obj, list_element): """Remove an object from a list element. Args: obj: Accepts JSSObjects, id's, and names list_element: Accepts an Element or a string path to that element """ list_element = self._handle_locatio...
python
def remove_object_from_list(self, obj, list_element): """Remove an object from a list element. Args: obj: Accepts JSSObjects, id's, and names list_element: Accepts an Element or a string path to that element """ list_element = self._handle_locatio...
[ "def", "remove_object_from_list", "(", "self", ",", "obj", ",", "list_element", ")", ":", "list_element", "=", "self", ".", "_handle_location", "(", "list_element", ")", "if", "isinstance", "(", "obj", ",", "JSSObject", ")", ":", "results", "=", "[", "item",...
Remove an object from a list element. Args: obj: Accepts JSSObjects, id's, and names list_element: Accepts an Element or a string path to that element
[ "Remove", "an", "object", "from", "a", "list", "element", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L434-L456
train
27,808
jssimporter/python-jss
jss/jssobject.py
JSSObject.from_file
def from_file(cls, jss, filename): """Create a new JSSObject from an external XML file. Args: jss: A JSS object. filename: String path to an XML file. """ tree = ElementTree.parse(filename) root = tree.getroot() return cls(jss, root)
python
def from_file(cls, jss, filename): """Create a new JSSObject from an external XML file. Args: jss: A JSS object. filename: String path to an XML file. """ tree = ElementTree.parse(filename) root = tree.getroot() return cls(jss, root)
[ "def", "from_file", "(", "cls", ",", "jss", ",", "filename", ")", ":", "tree", "=", "ElementTree", ".", "parse", "(", "filename", ")", "root", "=", "tree", ".", "getroot", "(", ")", "return", "cls", "(", "jss", ",", "root", ")" ]
Create a new JSSObject from an external XML file. Args: jss: A JSS object. filename: String path to an XML file.
[ "Create", "a", "new", "JSSObject", "from", "an", "external", "XML", "file", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L472-L481
train
27,809
jssimporter/python-jss
jss/jssobject.py
JSSObject.from_string
def from_string(cls, jss, xml_string): """Creates a new JSSObject from an UTF-8 XML string. Args: jss: A JSS object. xml_string: String XML file data used to create object. """ root = ElementTree.fromstring(xml_string.encode('utf-8')) return cls(jss, root...
python
def from_string(cls, jss, xml_string): """Creates a new JSSObject from an UTF-8 XML string. Args: jss: A JSS object. xml_string: String XML file data used to create object. """ root = ElementTree.fromstring(xml_string.encode('utf-8')) return cls(jss, root...
[ "def", "from_string", "(", "cls", ",", "jss", ",", "xml_string", ")", ":", "root", "=", "ElementTree", ".", "fromstring", "(", "xml_string", ".", "encode", "(", "'utf-8'", ")", ")", "return", "cls", "(", "jss", ",", "root", ")" ]
Creates a new JSSObject from an UTF-8 XML string. Args: jss: A JSS object. xml_string: String XML file data used to create object.
[ "Creates", "a", "new", "JSSObject", "from", "an", "UTF", "-", "8", "XML", "string", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L484-L492
train
27,810
jssimporter/python-jss
jss/jssobject.py
JSSObject.to_file
def to_file(self, path): """Write object XML to path. Args: path: String file path to the file you wish to (over)write. Path will have ~ expanded prior to opening. """ with open(os.path.expanduser(path), "w") as ofile: ofile.write(self.__repr__())
python
def to_file(self, path): """Write object XML to path. Args: path: String file path to the file you wish to (over)write. Path will have ~ expanded prior to opening. """ with open(os.path.expanduser(path), "w") as ofile: ofile.write(self.__repr__())
[ "def", "to_file", "(", "self", ",", "path", ")", ":", "with", "open", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ",", "\"w\"", ")", "as", "ofile", ":", "ofile", ".", "write", "(", "self", ".", "__repr__", "(", ")", ")" ]
Write object XML to path. Args: path: String file path to the file you wish to (over)write. Path will have ~ expanded prior to opening.
[ "Write", "object", "XML", "to", "path", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L494-L502
train
27,811
jssimporter/python-jss
jss/jssobject.py
JSSContainerObject.as_list_data
def as_list_data(self): """Return an Element to be used in a list. Most lists want an element with tag of list_type, and subelements of id and name. Returns: Element: list representation of object. """ element = ElementTree.Element(self.list_type) id...
python
def as_list_data(self): """Return an Element to be used in a list. Most lists want an element with tag of list_type, and subelements of id and name. Returns: Element: list representation of object. """ element = ElementTree.Element(self.list_type) id...
[ "def", "as_list_data", "(", "self", ")", ":", "element", "=", "ElementTree", ".", "Element", "(", "self", ".", "list_type", ")", "id_", "=", "ElementTree", ".", "SubElement", "(", "element", ",", "\"id\"", ")", "id_", ".", "text", "=", "self", ".", "id...
Return an Element to be used in a list. Most lists want an element with tag of list_type, and subelements of id and name. Returns: Element: list representation of object.
[ "Return", "an", "Element", "to", "be", "used", "in", "a", "list", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L547-L561
train
27,812
jssimporter/python-jss
jss/jssobject.py
JSSGroupObject.add_criterion
def add_criterion(self, name, priority, and_or, search_type, value): # pylint: disable=too-many-arguments """Add a search criteria object to a smart group. Args: name: String Criteria type name (e.g. "Application Title") priority: Int or Str number priority of criterion. ...
python
def add_criterion(self, name, priority, and_or, search_type, value): # pylint: disable=too-many-arguments """Add a search criteria object to a smart group. Args: name: String Criteria type name (e.g. "Application Title") priority: Int or Str number priority of criterion. ...
[ "def", "add_criterion", "(", "self", ",", "name", ",", "priority", ",", "and_or", ",", "search_type", ",", "value", ")", ":", "# pylint: disable=too-many-arguments", "criterion", "=", "SearchCriteria", "(", "name", ",", "priority", ",", "and_or", ",", "search_ty...
Add a search criteria object to a smart group. Args: name: String Criteria type name (e.g. "Application Title") priority: Int or Str number priority of criterion. and_or: Str, either "and" or "or". search_type: String Criteria search type. (e.g. "is", "is ...
[ "Add", "a", "search", "criteria", "object", "to", "a", "smart", "group", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L567-L581
train
27,813
jssimporter/python-jss
jss/jssobject.py
JSSGroupObject.is_smart
def is_smart(self, value): """Set group is_smart property to value. Args: value: Boolean. """ self.set_bool("is_smart", value) if value is True: if self.find("criteria") is None: # pylint: disable=attribute-defined-outside-init ...
python
def is_smart(self, value): """Set group is_smart property to value. Args: value: Boolean. """ self.set_bool("is_smart", value) if value is True: if self.find("criteria") is None: # pylint: disable=attribute-defined-outside-init ...
[ "def", "is_smart", "(", "self", ",", "value", ")", ":", "self", ".", "set_bool", "(", "\"is_smart\"", ",", "value", ")", "if", "value", "is", "True", ":", "if", "self", ".", "find", "(", "\"criteria\"", ")", "is", "None", ":", "# pylint: disable=attribut...
Set group is_smart property to value. Args: value: Boolean.
[ "Set", "group", "is_smart", "property", "to", "value", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L592-L602
train
27,814
jssimporter/python-jss
jss/jssobject.py
JSSGroupObject.add_device
def add_device(self, device, container): """Add a device to a group. Wraps JSSObject.add_object_to_path. Args: device: A JSSObject to add (as list data), to this object. location: Element or a string path argument to find() """ # There is a size tag which the JSS...
python
def add_device(self, device, container): """Add a device to a group. Wraps JSSObject.add_object_to_path. Args: device: A JSSObject to add (as list data), to this object. location: Element or a string path argument to find() """ # There is a size tag which the JSS...
[ "def", "add_device", "(", "self", ",", "device", ",", "container", ")", ":", "# There is a size tag which the JSS manages for us, so we can", "# ignore it.", "if", "self", ".", "findtext", "(", "\"is_smart\"", ")", "==", "\"false\"", ":", "self", ".", "add_object_to_p...
Add a device to a group. Wraps JSSObject.add_object_to_path. Args: device: A JSSObject to add (as list data), to this object. location: Element or a string path argument to find()
[ "Add", "a", "device", "to", "a", "group", ".", "Wraps", "JSSObject", ".", "add_object_to_path", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L605-L619
train
27,815
jssimporter/python-jss
jss/jssobject.py
JSSGroupObject.has_member
def has_member(self, device_object): """Return bool whether group has a device as a member. Args: device_object (Computer or MobileDevice). Membership is determined by ID, as names can be shared amongst devices. """ if device_object.tag == "computer": ...
python
def has_member(self, device_object): """Return bool whether group has a device as a member. Args: device_object (Computer or MobileDevice). Membership is determined by ID, as names can be shared amongst devices. """ if device_object.tag == "computer": ...
[ "def", "has_member", "(", "self", ",", "device_object", ")", ":", "if", "device_object", ".", "tag", "==", "\"computer\"", ":", "container_search", "=", "\"computers/computer\"", "elif", "device_object", ".", "tag", "==", "\"mobile_device\"", ":", "container_search"...
Return bool whether group has a device as a member. Args: device_object (Computer or MobileDevice). Membership is determined by ID, as names can be shared amongst devices.
[ "Return", "bool", "whether", "group", "has", "a", "device", "as", "a", "member", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L621-L636
train
27,816
jssimporter/python-jss
jss/distribution_points.py
DistributionPoints.copy
def copy(self, filename, id_=-1, pre_callback=None, post_callback=None): """Copy a package or script to all repos. Determines appropriate location (for file shares) and type based on file extension. Args: filename: String path to the local file to copy. id_: Pac...
python
def copy(self, filename, id_=-1, pre_callback=None, post_callback=None): """Copy a package or script to all repos. Determines appropriate location (for file shares) and type based on file extension. Args: filename: String path to the local file to copy. id_: Pac...
[ "def", "copy", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ",", "pre_callback", "=", "None", ",", "post_callback", "=", "None", ")", ":", "for", "repo", "in", "self", ".", "_children", ":", "if", "is_package", "(", "filename", ")", ":", ...
Copy a package or script to all repos. Determines appropriate location (for file shares) and type based on file extension. Args: filename: String path to the local file to copy. id_: Package or Script object ID to target. For use with JDS and CDP DP's on...
[ "Copy", "a", "package", "or", "script", "to", "all", "repos", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_points.py#L198-L229
train
27,817
jssimporter/python-jss
jss/distribution_points.py
DistributionPoints.copy_pkg
def copy_pkg(self, filename, id_=-1): """Copy a pkg, dmg, or zip to all repositories. Args: filename: String path to the local file to copy. id_: Integer ID you wish to associate package with for a JDS or CDP only. Default is -1, which is used for creating ...
python
def copy_pkg(self, filename, id_=-1): """Copy a pkg, dmg, or zip to all repositories. Args: filename: String path to the local file to copy. id_: Integer ID you wish to associate package with for a JDS or CDP only. Default is -1, which is used for creating ...
[ "def", "copy_pkg", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ")", ":", "for", "repo", "in", "self", ".", "_children", ":", "repo", ".", "copy_pkg", "(", "filename", ",", "id_", ")" ]
Copy a pkg, dmg, or zip to all repositories. Args: filename: String path to the local file to copy. id_: Integer ID you wish to associate package with for a JDS or CDP only. Default is -1, which is used for creating a new package object in the database.
[ "Copy", "a", "pkg", "dmg", "or", "zip", "to", "all", "repositories", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_points.py#L231-L241
train
27,818
jssimporter/python-jss
jss/distribution_points.py
DistributionPoints.copy_script
def copy_script(self, filename, id_=-1): """Copy a script to all repositories. Takes into account whether a JSS has been migrated. See the individual DistributionPoint types for more information. Args: filename: String path to the local file to copy. id_: Intege...
python
def copy_script(self, filename, id_=-1): """Copy a script to all repositories. Takes into account whether a JSS has been migrated. See the individual DistributionPoint types for more information. Args: filename: String path to the local file to copy. id_: Intege...
[ "def", "copy_script", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ")", ":", "for", "repo", "in", "self", ".", "_children", ":", "repo", ".", "copy_script", "(", "filename", ",", "id_", ")" ]
Copy a script to all repositories. Takes into account whether a JSS has been migrated. See the individual DistributionPoint types for more information. Args: filename: String path to the local file to copy. id_: Integer ID you wish to associate script with for a JDS ...
[ "Copy", "a", "script", "to", "all", "repositories", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_points.py#L243-L256
train
27,819
jssimporter/python-jss
jss/distribution_points.py
DistributionPoints.delete
def delete(self, filename): """Delete a file from all repositories which support it. Individual repositories will determine correct location to delete from (Scripts vs. Packages). This will not remove the corresponding Package or Script object from the JSS's database! ...
python
def delete(self, filename): """Delete a file from all repositories which support it. Individual repositories will determine correct location to delete from (Scripts vs. Packages). This will not remove the corresponding Package or Script object from the JSS's database! ...
[ "def", "delete", "(", "self", ",", "filename", ")", ":", "for", "repo", "in", "self", ".", "_children", ":", "if", "hasattr", "(", "repo", ",", "\"delete\"", ")", ":", "repo", ".", "delete", "(", "filename", ")" ]
Delete a file from all repositories which support it. Individual repositories will determine correct location to delete from (Scripts vs. Packages). This will not remove the corresponding Package or Script object from the JSS's database! Args: filename: The filenam...
[ "Delete", "a", "file", "from", "all", "repositories", "which", "support", "it", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_points.py#L258-L273
train
27,820
jssimporter/python-jss
jss/distribution_points.py
DistributionPoints.umount
def umount(self, forced=True): """Umount all mountable distribution points. Defaults to using forced method. """ for child in self._children: if hasattr(child, "umount"): child.umount(forced)
python
def umount(self, forced=True): """Umount all mountable distribution points. Defaults to using forced method. """ for child in self._children: if hasattr(child, "umount"): child.umount(forced)
[ "def", "umount", "(", "self", ",", "forced", "=", "True", ")", ":", "for", "child", "in", "self", ".", "_children", ":", "if", "hasattr", "(", "child", ",", "\"umount\"", ")", ":", "child", ".", "umount", "(", "forced", ")" ]
Umount all mountable distribution points. Defaults to using forced method.
[ "Umount", "all", "mountable", "distribution", "points", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_points.py#L281-L288
train
27,821
jssimporter/python-jss
jss/distribution_points.py
DistributionPoints.exists
def exists(self, filename): """Report whether a file exists on all distribution points. Determines file type by extension. Args: filename: Filename you wish to check. (No path! e.g.: "AdobeFlashPlayer-14.0.0.176.pkg") Returns: Boolean ""...
python
def exists(self, filename): """Report whether a file exists on all distribution points. Determines file type by extension. Args: filename: Filename you wish to check. (No path! e.g.: "AdobeFlashPlayer-14.0.0.176.pkg") Returns: Boolean ""...
[ "def", "exists", "(", "self", ",", "filename", ")", ":", "result", "=", "True", "for", "repo", "in", "self", ".", "_children", ":", "if", "not", "repo", ".", "exists", "(", "filename", ")", ":", "result", "=", "False", "return", "result" ]
Report whether a file exists on all distribution points. Determines file type by extension. Args: filename: Filename you wish to check. (No path! e.g.: "AdobeFlashPlayer-14.0.0.176.pkg") Returns: Boolean
[ "Report", "whether", "a", "file", "exists", "on", "all", "distribution", "points", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_points.py#L290-L306
train
27,822
jssimporter/python-jss
jss/jss_prefs.py
_get_user_input
def _get_user_input(prompt, key_name, parent, input_func=raw_input): """Prompt the user for a value, and assign it to key_name.""" val = input_func(prompt) ElementTree.SubElement(parent, "key").text = key_name if isinstance(val, bool): string_val = "true" if val else "false" ElementTree....
python
def _get_user_input(prompt, key_name, parent, input_func=raw_input): """Prompt the user for a value, and assign it to key_name.""" val = input_func(prompt) ElementTree.SubElement(parent, "key").text = key_name if isinstance(val, bool): string_val = "true" if val else "false" ElementTree....
[ "def", "_get_user_input", "(", "prompt", ",", "key_name", ",", "parent", ",", "input_func", "=", "raw_input", ")", ":", "val", "=", "input_func", "(", "prompt", ")", "ElementTree", ".", "SubElement", "(", "parent", ",", "\"key\"", ")", ".", "text", "=", ...
Prompt the user for a value, and assign it to key_name.
[ "Prompt", "the", "user", "for", "a", "value", "and", "assign", "it", "to", "key_name", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jss_prefs.py#L257-L266
train
27,823
jssimporter/python-jss
jss/jss_prefs.py
_handle_dist_server
def _handle_dist_server(ds_type, repos_array): """Ask user for whether to use a type of dist server.""" if ds_type not in ("JDS", "CDP"): raise ValueError("Must be JDS or CDP") prompt = "Does your JSS use a %s? (Y|N): " % ds_type result = loop_until_valid_response(prompt) if result: ...
python
def _handle_dist_server(ds_type, repos_array): """Ask user for whether to use a type of dist server.""" if ds_type not in ("JDS", "CDP"): raise ValueError("Must be JDS or CDP") prompt = "Does your JSS use a %s? (Y|N): " % ds_type result = loop_until_valid_response(prompt) if result: ...
[ "def", "_handle_dist_server", "(", "ds_type", ",", "repos_array", ")", ":", "if", "ds_type", "not", "in", "(", "\"JDS\"", ",", "\"CDP\"", ")", ":", "raise", "ValueError", "(", "\"Must be JDS or CDP\"", ")", "prompt", "=", "\"Does your JSS use a %s? (Y|N): \"", "%"...
Ask user for whether to use a type of dist server.
[ "Ask", "user", "for", "whether", "to", "use", "a", "type", "of", "dist", "server", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jss_prefs.py#L269-L281
train
27,824
jssimporter/python-jss
jss/jss_prefs.py
JSSPrefs.parse_plist
def parse_plist(self, preferences_file): """Try to reset preferences from preference_file.""" preferences_file = os.path.expanduser(preferences_file) # Try to open using FoundationPlist. If it's not available, # fall back to plistlib and hope it's not binary encoded. try: ...
python
def parse_plist(self, preferences_file): """Try to reset preferences from preference_file.""" preferences_file = os.path.expanduser(preferences_file) # Try to open using FoundationPlist. If it's not available, # fall back to plistlib and hope it's not binary encoded. try: ...
[ "def", "parse_plist", "(", "self", ",", "preferences_file", ")", ":", "preferences_file", "=", "os", ".", "path", ".", "expanduser", "(", "preferences_file", ")", "# Try to open using FoundationPlist. If it's not available,", "# fall back to plistlib and hope it's not binary en...
Try to reset preferences from preference_file.
[ "Try", "to", "reset", "preferences", "from", "preference_file", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jss_prefs.py#L134-L167
train
27,825
jssimporter/python-jss
jss/jss_prefs.py
JSSPrefs.configure
def configure(self): """Prompt user for config and write to plist Uses preferences_file argument from JSSPrefs.__init__ as path to write. """ root = ElementTree.Element("dict") print ("It seems like you do not have a preferences file configured. " "Please ...
python
def configure(self): """Prompt user for config and write to plist Uses preferences_file argument from JSSPrefs.__init__ as path to write. """ root = ElementTree.Element("dict") print ("It seems like you do not have a preferences file configured. " "Please ...
[ "def", "configure", "(", "self", ")", ":", "root", "=", "ElementTree", ".", "Element", "(", "\"dict\"", ")", "print", "(", "\"It seems like you do not have a preferences file configured. \"", "\"Please answer the following questions to generate a plist at \"", "\"%s for use with ...
Prompt user for config and write to plist Uses preferences_file argument from JSSPrefs.__init__ as path to write.
[ "Prompt", "user", "for", "config", "and", "write", "to", "plist" ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jss_prefs.py#L169-L197
train
27,826
jssimporter/python-jss
jss/jss_prefs.py
JSSPrefs._handle_repos
def _handle_repos(self, root): """Handle repo configuration.""" ElementTree.SubElement(root, "key").text = "repos" repos_array = ElementTree.SubElement(root, "array") # Make a temporary jss object to try to pull repo information. jss_server = JSS(url=self.url, user=self.user, pa...
python
def _handle_repos(self, root): """Handle repo configuration.""" ElementTree.SubElement(root, "key").text = "repos" repos_array = ElementTree.SubElement(root, "array") # Make a temporary jss object to try to pull repo information. jss_server = JSS(url=self.url, user=self.user, pa...
[ "def", "_handle_repos", "(", "self", ",", "root", ")", ":", "ElementTree", ".", "SubElement", "(", "root", ",", "\"key\"", ")", ".", "text", "=", "\"repos\"", "repos_array", "=", "ElementTree", ".", "SubElement", "(", "root", ",", "\"array\"", ")", "# Make...
Handle repo configuration.
[ "Handle", "repo", "configuration", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jss_prefs.py#L199-L239
train
27,827
jssimporter/python-jss
jss/jss_prefs.py
JSSPrefs._write_plist
def _write_plist(self, root): """Write plist file based on our generated tree.""" # prettify the XML indent_xml(root) tree = ElementTree.ElementTree(root) with open(self.preferences_file, "w") as prefs_file: prefs_file.write( "<?xml version=\"1.0\" en...
python
def _write_plist(self, root): """Write plist file based on our generated tree.""" # prettify the XML indent_xml(root) tree = ElementTree.ElementTree(root) with open(self.preferences_file, "w") as prefs_file: prefs_file.write( "<?xml version=\"1.0\" en...
[ "def", "_write_plist", "(", "self", ",", "root", ")", ":", "# prettify the XML", "indent_xml", "(", "root", ")", "tree", "=", "ElementTree", ".", "ElementTree", "(", "root", ")", "with", "open", "(", "self", ".", "preferences_file", ",", "\"w\"", ")", "as"...
Write plist file based on our generated tree.
[ "Write", "plist", "file", "based", "on", "our", "generated", "tree", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jss_prefs.py#L241-L254
train
27,828
jssimporter/python-jss
jss/casper.py
Casper.update
def update(self): """Request an updated set of data from casper.jxml.""" response = self.jss.session.post(self.url, data=self.auth) response_xml = ElementTree.fromstring(response.text.encode("utf_8")) # Remove previous data, if any, and then add in response's XML. self.clear() ...
python
def update(self): """Request an updated set of data from casper.jxml.""" response = self.jss.session.post(self.url, data=self.auth) response_xml = ElementTree.fromstring(response.text.encode("utf_8")) # Remove previous data, if any, and then add in response's XML. self.clear() ...
[ "def", "update", "(", "self", ")", ":", "response", "=", "self", ".", "jss", ".", "session", ".", "post", "(", "self", ".", "url", ",", "data", "=", "self", ".", "auth", ")", "response_xml", "=", "ElementTree", ".", "fromstring", "(", "response", "."...
Request an updated set of data from casper.jxml.
[ "Request", "an", "updated", "set", "of", "data", "from", "casper", ".", "jxml", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/casper.py#L68-L76
train
27,829
jssimporter/python-jss
jss/contrib/mount_shares_better.py
mount_share_at_path
def mount_share_at_path(share_path, mount_path): """Mounts a share at the specified path Args: share_path: String URL with all auth info to connect to file share. mount_path: Path to mount share on. Returns: The mount point or raises an error """ sh_url = CFURLCreateWithStr...
python
def mount_share_at_path(share_path, mount_path): """Mounts a share at the specified path Args: share_path: String URL with all auth info to connect to file share. mount_path: Path to mount share on. Returns: The mount point or raises an error """ sh_url = CFURLCreateWithStr...
[ "def", "mount_share_at_path", "(", "share_path", ",", "mount_path", ")", ":", "sh_url", "=", "CFURLCreateWithString", "(", "None", ",", "share_path", ",", "None", ")", "mo_url", "=", "CFURLCreateWithString", "(", "None", ",", "mount_path", ",", "None", ")", "#...
Mounts a share at the specified path Args: share_path: String URL with all auth info to connect to file share. mount_path: Path to mount share on. Returns: The mount point or raises an error
[ "Mounts", "a", "share", "at", "the", "specified", "path" ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/contrib/mount_shares_better.py#L67-L94
train
27,830
jssimporter/python-jss
jss/distribution_point.py
auto_mounter
def auto_mounter(original): """Decorator for automatically mounting, if needed.""" def mounter(*args): """If not mounted, mount.""" self = args[0] if not self.is_mounted(): self.mount() return original(*args) return mounter
python
def auto_mounter(original): """Decorator for automatically mounting, if needed.""" def mounter(*args): """If not mounted, mount.""" self = args[0] if not self.is_mounted(): self.mount() return original(*args) return mounter
[ "def", "auto_mounter", "(", "original", ")", ":", "def", "mounter", "(", "*", "args", ")", ":", "\"\"\"If not mounted, mount.\"\"\"", "self", "=", "args", "[", "0", "]", "if", "not", "self", ".", "is_mounted", "(", ")", ":", "self", ".", "mount", "(", ...
Decorator for automatically mounting, if needed.
[ "Decorator", "for", "automatically", "mounting", "if", "needed", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L48-L56
train
27,831
jssimporter/python-jss
jss/distribution_point.py
FileRepository.copy_pkg
def copy_pkg(self, filename, _): """Copy a package to the repo's Package subdirectory. Args: filename: Path for file to copy. _: Ignored. Used for compatibility with JDS repos. """ basename = os.path.basename(filename) self._copy(filename, os.path.join(se...
python
def copy_pkg(self, filename, _): """Copy a package to the repo's Package subdirectory. Args: filename: Path for file to copy. _: Ignored. Used for compatibility with JDS repos. """ basename = os.path.basename(filename) self._copy(filename, os.path.join(se...
[ "def", "copy_pkg", "(", "self", ",", "filename", ",", "_", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "self", ".", "_copy", "(", "filename", ",", "os", ".", "path", ".", "join", "(", "self", ".", "connectio...
Copy a package to the repo's Package subdirectory. Args: filename: Path for file to copy. _: Ignored. Used for compatibility with JDS repos.
[ "Copy", "a", "package", "to", "the", "repo", "s", "Package", "subdirectory", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L107-L116
train
27,832
jssimporter/python-jss
jss/distribution_point.py
FileRepository.copy_script
def copy_script(self, filename, id_=-1): """Copy a script to the repo's Script subdirectory. Scripts are copied as files to a path, or, on a "migrated" JSS, are POSTed to the JSS (pass an id if you wish to associate the script with an existing Script object). Args: ...
python
def copy_script(self, filename, id_=-1): """Copy a script to the repo's Script subdirectory. Scripts are copied as files to a path, or, on a "migrated" JSS, are POSTed to the JSS (pass an id if you wish to associate the script with an existing Script object). Args: ...
[ "def", "copy_script", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ")", ":", "if", "(", "\"jss\"", "in", "self", ".", "connection", ".", "keys", "(", ")", "and", "self", ".", "connection", "[", "\"jss\"", "]", ".", "jss_migrated", ")", ...
Copy a script to the repo's Script subdirectory. Scripts are copied as files to a path, or, on a "migrated" JSS, are POSTed to the JSS (pass an id if you wish to associate the script with an existing Script object). Args: filename: Path for file to copy. id_: In...
[ "Copy", "a", "script", "to", "the", "repo", "s", "Script", "subdirectory", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L118-L136
train
27,833
jssimporter/python-jss
jss/distribution_point.py
FileRepository._copy_script_migrated
def _copy_script_migrated(self, filename, id_=-1, file_type=SCRIPT_FILE_TYPE): """Upload a script to a migrated JSS's database. On a "migrated" JSS, scripts are POSTed to the JSS. Pass an id if you wish to associate the script with an existing Script object...
python
def _copy_script_migrated(self, filename, id_=-1, file_type=SCRIPT_FILE_TYPE): """Upload a script to a migrated JSS's database. On a "migrated" JSS, scripts are POSTed to the JSS. Pass an id if you wish to associate the script with an existing Script object...
[ "def", "_copy_script_migrated", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ",", "file_type", "=", "SCRIPT_FILE_TYPE", ")", ":", "basefname", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "resource", "=", "open", "(", "filen...
Upload a script to a migrated JSS's database. On a "migrated" JSS, scripts are POSTed to the JSS. Pass an id if you wish to associate the script with an existing Script object, otherwise, it will create a new Script object. Args: filename: Path to script file. i...
[ "Upload", "a", "script", "to", "a", "migrated", "JSS", "s", "database", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L138-L159
train
27,834
jssimporter/python-jss
jss/distribution_point.py
FileRepository.delete
def delete(self, filename): """Delete a file from the repository. This method will not delete a script from a migrated JSS. Please remove migrated scripts with jss.Script.delete. Args: filename: String filename only (i.e. no path) of file to delete. Will han...
python
def delete(self, filename): """Delete a file from the repository. This method will not delete a script from a migrated JSS. Please remove migrated scripts with jss.Script.delete. Args: filename: String filename only (i.e. no path) of file to delete. Will han...
[ "def", "delete", "(", "self", ",", "filename", ")", ":", "folder", "=", "\"Packages\"", "if", "is_package", "(", "filename", ")", "else", "\"Scripts\"", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "connection", "[", "\"mount_point\"", ...
Delete a file from the repository. This method will not delete a script from a migrated JSS. Please remove migrated scripts with jss.Script.delete. Args: filename: String filename only (i.e. no path) of file to delete. Will handle deleting scripts vs. packages ...
[ "Delete", "a", "file", "from", "the", "repository", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L177-L193
train
27,835
jssimporter/python-jss
jss/distribution_point.py
FileRepository.exists
def exists(self, filename): """Report whether a file exists on the distribution point. Determines file type by extension. Args: filename: Filename you wish to check. (No path! e.g.: "AdobeFlashPlayer-14.0.0.176.pkg") """ if is_package(filename): ...
python
def exists(self, filename): """Report whether a file exists on the distribution point. Determines file type by extension. Args: filename: Filename you wish to check. (No path! e.g.: "AdobeFlashPlayer-14.0.0.176.pkg") """ if is_package(filename): ...
[ "def", "exists", "(", "self", ",", "filename", ")", ":", "if", "is_package", "(", "filename", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "self", ".", "connection", "[", "\"mount_point\"", "]", ",", "\"Packages\"", ",", "filename", ...
Report whether a file exists on the distribution point. Determines file type by extension. Args: filename: Filename you wish to check. (No path! e.g.: "AdobeFlashPlayer-14.0.0.176.pkg")
[ "Report", "whether", "a", "file", "exists", "on", "the", "distribution", "point", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L195-L210
train
27,836
jssimporter/python-jss
jss/distribution_point.py
MountedRepository.mount
def mount(self): """Mount the repository.""" if not self.is_mounted(): # OS X mounting is handled automagically in /Volumes: # DO NOT mkdir there! # For Linux, ensure the mountpoint exists. if not is_osx(): if not os.path.exists(self.connec...
python
def mount(self): """Mount the repository.""" if not self.is_mounted(): # OS X mounting is handled automagically in /Volumes: # DO NOT mkdir there! # For Linux, ensure the mountpoint exists. if not is_osx(): if not os.path.exists(self.connec...
[ "def", "mount", "(", "self", ")", ":", "if", "not", "self", ".", "is_mounted", "(", ")", ":", "# OS X mounting is handled automagically in /Volumes:", "# DO NOT mkdir there!", "# For Linux, ensure the mountpoint exists.", "if", "not", "is_osx", "(", ")", ":", "if", "n...
Mount the repository.
[ "Mount", "the", "repository", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L250-L259
train
27,837
jssimporter/python-jss
jss/distribution_point.py
MountedRepository.umount
def umount(self, forced=True): """Try to unmount our mount point. Defaults to using forced method. If OS is Linux, it will not delete the mount point. Args: forced: Bool whether to force the unmount. Default is True. """ if self.is_mounted(): if ...
python
def umount(self, forced=True): """Try to unmount our mount point. Defaults to using forced method. If OS is Linux, it will not delete the mount point. Args: forced: Bool whether to force the unmount. Default is True. """ if self.is_mounted(): if ...
[ "def", "umount", "(", "self", ",", "forced", "=", "True", ")", ":", "if", "self", ".", "is_mounted", "(", ")", ":", "if", "is_osx", "(", ")", ":", "cmd", "=", "[", "\"/usr/sbin/diskutil\"", ",", "\"unmount\"", ",", "self", ".", "connection", "[", "\"...
Try to unmount our mount point. Defaults to using forced method. If OS is Linux, it will not delete the mount point. Args: forced: Bool whether to force the unmount. Default is True.
[ "Try", "to", "unmount", "our", "mount", "point", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L265-L285
train
27,838
jssimporter/python-jss
jss/distribution_point.py
MountedRepository.is_mounted
def is_mounted(self): """Test for whether a mount point is mounted. If it is currently mounted, determine the path where it's mounted and update the connection's mount_point accordingly. """ mount_check = subprocess.check_output("mount").splitlines() # The mount command ...
python
def is_mounted(self): """Test for whether a mount point is mounted. If it is currently mounted, determine the path where it's mounted and update the connection's mount_point accordingly. """ mount_check = subprocess.check_output("mount").splitlines() # The mount command ...
[ "def", "is_mounted", "(", "self", ")", ":", "mount_check", "=", "subprocess", ".", "check_output", "(", "\"mount\"", ")", ".", "splitlines", "(", ")", "# The mount command returns lines like this on OS X...", "# //username@pretendco.com/JSS%20REPO on /Volumes/JSS REPO", "# (a...
Test for whether a mount point is mounted. If it is currently mounted, determine the path where it's mounted and update the connection's mount_point accordingly.
[ "Test", "for", "whether", "a", "mount", "point", "is", "mounted", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L287-L351
train
27,839
jssimporter/python-jss
jss/distribution_point.py
MountedRepository._get_valid_mount_strings
def _get_valid_mount_strings(self): """Return a tuple of potential mount strings. Casper Admin seems to mount in a number of ways: - hostname/share - fqdn/share Plus, there's the possibility of: - IPAddress/share Then factor in the possibility that th...
python
def _get_valid_mount_strings(self): """Return a tuple of potential mount strings. Casper Admin seems to mount in a number of ways: - hostname/share - fqdn/share Plus, there's the possibility of: - IPAddress/share Then factor in the possibility that th...
[ "def", "_get_valid_mount_strings", "(", "self", ")", ":", "results", "=", "set", "(", ")", "join", "=", "os", ".", "path", ".", "join", "url", "=", "self", ".", "connection", "[", "\"url\"", "]", "share_name", "=", "urllib", ".", "quote", "(", "self", ...
Return a tuple of potential mount strings. Casper Admin seems to mount in a number of ways: - hostname/share - fqdn/share Plus, there's the possibility of: - IPAddress/share Then factor in the possibility that the port is included too! This gives us a...
[ "Return", "a", "tuple", "of", "potential", "mount", "strings", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L353-L396
train
27,840
jssimporter/python-jss
jss/distribution_point.py
AFPDistributionPoint._mount
def _mount(self): """Mount based on which OS is running.""" # mount_afp "afp://scraig:<password>@address/share" <mnt_point> if is_osx(): if self.connection["jss"].verbose: print self.connection["mount_url"] if mount_share: self.connection["...
python
def _mount(self): """Mount based on which OS is running.""" # mount_afp "afp://scraig:<password>@address/share" <mnt_point> if is_osx(): if self.connection["jss"].verbose: print self.connection["mount_url"] if mount_share: self.connection["...
[ "def", "_mount", "(", "self", ")", ":", "# mount_afp \"afp://scraig:<password>@address/share\" <mnt_point>", "if", "is_osx", "(", ")", ":", "if", "self", ".", "connection", "[", "\"jss\"", "]", ".", "verbose", ":", "print", "self", ".", "connection", "[", "\"mou...
Mount based on which OS is running.
[ "Mount", "based", "on", "which", "OS", "is", "running", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L498-L523
train
27,841
jssimporter/python-jss
jss/distribution_point.py
DistributionServer._build_url
def _build_url(self): """Build the URL for POSTing files.""" self.connection["upload_url"] = ( "%s/%s" % (self.connection["jss"].base_url, "dbfileupload")) self.connection["delete_url"] = ( "%s/%s" % (self.connection["jss"].base_url, "casperAdminSav...
python
def _build_url(self): """Build the URL for POSTing files.""" self.connection["upload_url"] = ( "%s/%s" % (self.connection["jss"].base_url, "dbfileupload")) self.connection["delete_url"] = ( "%s/%s" % (self.connection["jss"].base_url, "casperAdminSav...
[ "def", "_build_url", "(", "self", ")", ":", "self", ".", "connection", "[", "\"upload_url\"", "]", "=", "(", "\"%s/%s\"", "%", "(", "self", ".", "connection", "[", "\"jss\"", "]", ".", "base_url", ",", "\"dbfileupload\"", ")", ")", "self", ".", "connecti...
Build the URL for POSTing files.
[ "Build", "the", "URL", "for", "POSTing", "files", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L642-L648
train
27,842
jssimporter/python-jss
jss/distribution_point.py
DistributionServer.copy_pkg
def copy_pkg(self, filename, id_=-1): """Copy a package to the distribution server. Bundle-style packages must be zipped prior to copying. Args: filename: Full path to file to upload. id_: ID of Package object to associate with, or -1 for new packages (d...
python
def copy_pkg(self, filename, id_=-1): """Copy a package to the distribution server. Bundle-style packages must be zipped prior to copying. Args: filename: Full path to file to upload. id_: ID of Package object to associate with, or -1 for new packages (d...
[ "def", "copy_pkg", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ")", ":", "self", ".", "_copy", "(", "filename", ",", "id_", "=", "id_", ",", "file_type", "=", "PKG_FILE_TYPE", ")" ]
Copy a package to the distribution server. Bundle-style packages must be zipped prior to copying. Args: filename: Full path to file to upload. id_: ID of Package object to associate with, or -1 for new packages (default).
[ "Copy", "a", "package", "to", "the", "distribution", "server", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L650-L660
train
27,843
jssimporter/python-jss
jss/distribution_point.py
DistributionServer.copy_script
def copy_script(self, filename, id_=-1): """Copy a script to the distribution server. Args: filename: Full path to file to upload. id_: ID of Script object to associate with, or -1 for new Script (default). """ self._copy(filename, id_=id_, file_t...
python
def copy_script(self, filename, id_=-1): """Copy a script to the distribution server. Args: filename: Full path to file to upload. id_: ID of Script object to associate with, or -1 for new Script (default). """ self._copy(filename, id_=id_, file_t...
[ "def", "copy_script", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ")", ":", "self", ".", "_copy", "(", "filename", ",", "id_", "=", "id_", ",", "file_type", "=", "SCRIPT_FILE_TYPE", ")" ]
Copy a script to the distribution server. Args: filename: Full path to file to upload. id_: ID of Script object to associate with, or -1 for new Script (default).
[ "Copy", "a", "script", "to", "the", "distribution", "server", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L662-L670
train
27,844
jssimporter/python-jss
jss/distribution_point.py
DistributionServer._copy
def _copy(self, filename, id_=-1, file_type=0): """Upload a file to the distribution server. Directories/bundle-style packages must be zipped prior to copying. """ if os.path.isdir(filename): raise JSSUnsupportedFileType( "Distribution Server type rep...
python
def _copy(self, filename, id_=-1, file_type=0): """Upload a file to the distribution server. Directories/bundle-style packages must be zipped prior to copying. """ if os.path.isdir(filename): raise JSSUnsupportedFileType( "Distribution Server type rep...
[ "def", "_copy", "(", "self", ",", "filename", ",", "id_", "=", "-", "1", ",", "file_type", "=", "0", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "filename", ")", ":", "raise", "JSSUnsupportedFileType", "(", "\"Distribution Server type repos do no...
Upload a file to the distribution server. Directories/bundle-style packages must be zipped prior to copying.
[ "Upload", "a", "file", "to", "the", "distribution", "server", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L672-L690
train
27,845
jssimporter/python-jss
jss/distribution_point.py
DistributionServer.delete_with_casper_admin_save
def delete_with_casper_admin_save(self, pkg): """Delete a pkg from the distribution server. Args: pkg: Can be a jss.Package object, an int ID of a package, or a filename. """ # The POST needs the package ID. if pkg.__class__.__name__ == "Package": ...
python
def delete_with_casper_admin_save(self, pkg): """Delete a pkg from the distribution server. Args: pkg: Can be a jss.Package object, an int ID of a package, or a filename. """ # The POST needs the package ID. if pkg.__class__.__name__ == "Package": ...
[ "def", "delete_with_casper_admin_save", "(", "self", ",", "pkg", ")", ":", "# The POST needs the package ID.", "if", "pkg", ".", "__class__", ".", "__name__", "==", "\"Package\"", ":", "package_to_delete", "=", "pkg", ".", "id", "elif", "isinstance", "(", "pkg", ...
Delete a pkg from the distribution server. Args: pkg: Can be a jss.Package object, an int ID of a package, or a filename.
[ "Delete", "a", "pkg", "from", "the", "distribution", "server", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L692-L713
train
27,846
jssimporter/python-jss
jss/distribution_point.py
DistributionServer.delete
def delete(self, filename): """Delete a package or script from the distribution server. This method simply finds the Package or Script object from the database with the API GET call and then deletes it. This will remove the file from the database blob. For setups which have fil...
python
def delete(self, filename): """Delete a package or script from the distribution server. This method simply finds the Package or Script object from the database with the API GET call and then deletes it. This will remove the file from the database blob. For setups which have fil...
[ "def", "delete", "(", "self", ",", "filename", ")", ":", "if", "is_package", "(", "filename", ")", ":", "self", ".", "connection", "[", "\"jss\"", "]", ".", "Package", "(", "filename", ")", ".", "delete", "(", ")", "else", ":", "self", ".", "connecti...
Delete a package or script from the distribution server. This method simply finds the Package or Script object from the database with the API GET call and then deletes it. This will remove the file from the database blob. For setups which have file share distribution points, you will ...
[ "Delete", "a", "package", "or", "script", "from", "the", "distribution", "server", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L716-L732
train
27,847
jssimporter/python-jss
jss/distribution_point.py
DistributionServer.exists
def exists(self, filename): """Check for the existence of a package or script. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is check for an...
python
def exists(self, filename): """Check for the existence of a package or script. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is check for an...
[ "def", "exists", "(", "self", ",", "filename", ")", ":", "# Technically, the results of the casper.jxml page list the", "# package files on the server. This is an undocumented", "# interface, however.", "result", "=", "False", "if", "is_package", "(", "filename", ")", ":", "p...
Check for the existence of a package or script. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is check for an object using the API /packages URL--JS...
[ "Check", "for", "the", "existence", "of", "a", "package", "or", "script", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L734-L768
train
27,848
jssimporter/python-jss
jss/distribution_point.py
DistributionServer.exists_using_casper
def exists_using_casper(self, filename): """Check for the existence of a package file. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is chec...
python
def exists_using_casper(self, filename): """Check for the existence of a package file. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is chec...
[ "def", "exists_using_casper", "(", "self", ",", "filename", ")", ":", "casper_results", "=", "casper", ".", "Casper", "(", "self", ".", "connection", "[", "\"jss\"", "]", ")", "distribution_servers", "=", "casper_results", ".", "find", "(", "\"distributionserver...
Check for the existence of a package file. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is check for an object using the API /packages URL--JSS.Pac...
[ "Check", "for", "the", "existence", "of", "a", "package", "file", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/distribution_point.py#L770-L808
train
27,849
jssimporter/python-jss
jss/jssobjects.py
CommandFlush.command_flush_for
def command_flush_for(self, id_type, command_id, status): """Flush commands for an individual device. Args: id_type (str): One of 'computers', 'computergroups', 'mobiledevices', or 'mobiledevicegroups'. id_value (str, int, list): ID value(s) for the devices to ...
python
def command_flush_for(self, id_type, command_id, status): """Flush commands for an individual device. Args: id_type (str): One of 'computers', 'computergroups', 'mobiledevices', or 'mobiledevicegroups'. id_value (str, int, list): ID value(s) for the devices to ...
[ "def", "command_flush_for", "(", "self", ",", "id_type", ",", "command_id", ",", "status", ")", ":", "id_types", "=", "(", "'computers'", ",", "'computergroups'", ",", "'mobiledevices'", ",", "'mobiledevicegroups'", ")", "status_types", "=", "(", "'Pending'", ",...
Flush commands for an individual device. Args: id_type (str): One of 'computers', 'computergroups', 'mobiledevices', or 'mobiledevicegroups'. id_value (str, int, list): ID value(s) for the devices to flush. More than one device should be passed as IDs ...
[ "Flush", "commands", "for", "an", "individual", "device", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L153-L179
train
27,850
jssimporter/python-jss
jss/jssobjects.py
Computer.mac_addresses
def mac_addresses(self): """Return a list of mac addresses for this device. Computers don't tell you which network device is which. """ mac_addresses = [self.findtext("general/mac_address")] if self.findtext("general/alt_mac_address"): mac_addresses.append(self.findt...
python
def mac_addresses(self): """Return a list of mac addresses for this device. Computers don't tell you which network device is which. """ mac_addresses = [self.findtext("general/mac_address")] if self.findtext("general/alt_mac_address"): mac_addresses.append(self.findt...
[ "def", "mac_addresses", "(", "self", ")", ":", "mac_addresses", "=", "[", "self", ".", "findtext", "(", "\"general/mac_address\"", ")", "]", "if", "self", ".", "findtext", "(", "\"general/alt_mac_address\"", ")", ":", "mac_addresses", ".", "append", "(", "self...
Return a list of mac addresses for this device. Computers don't tell you which network device is which.
[ "Return", "a", "list", "of", "mac", "addresses", "for", "this", "device", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L190-L198
train
27,851
jssimporter/python-jss
jss/jssobjects.py
FileUpload._set_upload_url
def _set_upload_url(self): """Generate the full URL for a POST.""" # pylint: disable=protected-access self._upload_url = "/".join( [self.jss._url, self._url, self.resource_type, self.id_type, str(self._id)])
python
def _set_upload_url(self): """Generate the full URL for a POST.""" # pylint: disable=protected-access self._upload_url = "/".join( [self.jss._url, self._url, self.resource_type, self.id_type, str(self._id)])
[ "def", "_set_upload_url", "(", "self", ")", ":", "# pylint: disable=protected-access", "self", ".", "_upload_url", "=", "\"/\"", ".", "join", "(", "[", "self", ".", "jss", ".", "_url", ",", "self", ".", "_url", ",", "self", ".", "resource_type", ",", "self...
Generate the full URL for a POST.
[ "Generate", "the", "full", "URL", "for", "a", "POST", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L430-L435
train
27,852
jssimporter/python-jss
jss/jssobjects.py
FileUpload.save
def save(self): """POST the object to the JSS.""" try: response = requests.post(self._upload_url, auth=self.jss.session.auth, verify=self.jss.session.verify, files=self.resource) ...
python
def save(self): """POST the object to the JSS.""" try: response = requests.post(self._upload_url, auth=self.jss.session.auth, verify=self.jss.session.verify, files=self.resource) ...
[ "def", "save", "(", "self", ")", ":", "try", ":", "response", "=", "requests", ".", "post", "(", "self", ".", "_upload_url", ",", "auth", "=", "self", ".", "jss", ".", "session", ".", "auth", ",", "verify", "=", "self", ".", "jss", ".", "session", ...
POST the object to the JSS.
[ "POST", "the", "object", "to", "the", "JSS", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L438-L456
train
27,853
jssimporter/python-jss
jss/jssobjects.py
LDAPServer.search_users
def search_users(self, user): """Search for LDAP users. Args: user: User to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPUsersResult object. Raises: ...
python
def search_users(self, user): """Search for LDAP users. Args: user: User to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPUsersResult object. Raises: ...
[ "def", "search_users", "(", "self", ",", "user", ")", ":", "user_url", "=", "\"%s/%s/%s\"", "%", "(", "self", ".", "url", ",", "\"user\"", ",", "user", ")", "response", "=", "self", ".", "jss", ".", "get", "(", "user_url", ")", "return", "LDAPUsersResu...
Search for LDAP users. Args: user: User to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPUsersResult object. Raises: Will raise a JSSGetError if no res...
[ "Search", "for", "LDAP", "users", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L486-L502
train
27,854
jssimporter/python-jss
jss/jssobjects.py
LDAPServer.search_groups
def search_groups(self, group): """Search for LDAP groups. Args: group: Group to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPGroupsResult object. Raises:...
python
def search_groups(self, group): """Search for LDAP groups. Args: group: Group to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPGroupsResult object. Raises:...
[ "def", "search_groups", "(", "self", ",", "group", ")", ":", "group_url", "=", "\"%s/%s/%s\"", "%", "(", "self", ".", "url", ",", "\"group\"", ",", "group", ")", "response", "=", "self", ".", "jss", ".", "get", "(", "group_url", ")", "return", "LDAPGro...
Search for LDAP groups. Args: group: Group to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPGroupsResult object. Raises: JSSGetError if no results are ...
[ "Search", "for", "LDAP", "groups", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L504-L520
train
27,855
jssimporter/python-jss
jss/jssobjects.py
LDAPServer.is_user_in_group
def is_user_in_group(self, user, group): """Test for whether a user is in a group. There is also the ability in the API to test for whether multiple users are members of an LDAP group, but you should just call is_user_in_group over an enumerated list of users. Args: ...
python
def is_user_in_group(self, user, group): """Test for whether a user is in a group. There is also the ability in the API to test for whether multiple users are members of an LDAP group, but you should just call is_user_in_group over an enumerated list of users. Args: ...
[ "def", "is_user_in_group", "(", "self", ",", "user", ",", "group", ")", ":", "search_url", "=", "\"%s/%s/%s/%s/%s\"", "%", "(", "self", ".", "url", ",", "\"group\"", ",", "group", ",", "\"user\"", ",", "user", ")", "response", "=", "self", ".", "jss", ...
Test for whether a user is in a group. There is also the ability in the API to test for whether multiple users are members of an LDAP group, but you should just call is_user_in_group over an enumerated list of users. Args: user: String username. group: String gr...
[ "Test", "for", "whether", "a", "user", "is", "in", "a", "group", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L522-L550
train
27,856
jssimporter/python-jss
jss/jssobjects.py
LogFlush.log_flush_with_xml
def log_flush_with_xml(self, data): """Flush logs for devices with a supplied xml string. From the Casper API docs: log, log_id, interval, and devices specified in an XML file. Sample file: <logflush> <log>policy</log> <log_id>2</log...
python
def log_flush_with_xml(self, data): """Flush logs for devices with a supplied xml string. From the Casper API docs: log, log_id, interval, and devices specified in an XML file. Sample file: <logflush> <log>policy</log> <log_id>2</log...
[ "def", "log_flush_with_xml", "(", "self", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "basestring", ")", ":", "data", "=", "ElementTree", ".", "tostring", "(", "data", ")", "response", "=", "self", ".", "delete", "(", "data", ")...
Flush logs for devices with a supplied xml string. From the Casper API docs: log, log_id, interval, and devices specified in an XML file. Sample file: <logflush> <log>policy</log> <log_id>2</log_id> <interval>THREE MONTHS</in...
[ "Flush", "logs", "for", "devices", "with", "a", "supplied", "xml", "string", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L607-L658
train
27,857
jssimporter/python-jss
jss/jssobjects.py
LogFlush.log_flush_for_interval
def log_flush_for_interval(self, log_type, interval): """Flush logs for an interval of time. Args: log_type (str): Only documented type is "policies". This will be applied by default if nothing is passed. interval (str): Combination of "Zero", "One", "Two", ...
python
def log_flush_for_interval(self, log_type, interval): """Flush logs for an interval of time. Args: log_type (str): Only documented type is "policies". This will be applied by default if nothing is passed. interval (str): Combination of "Zero", "One", "Two", ...
[ "def", "log_flush_for_interval", "(", "self", ",", "log_type", ",", "interval", ")", ":", "if", "not", "log_type", ":", "log_type", "=", "\"policies\"", "# The XML for the /logflush basic endpoint allows spaces", "# instead of \"+\", so do a replace here just in case.", "interv...
Flush logs for an interval of time. Args: log_type (str): Only documented type is "policies". This will be applied by default if nothing is passed. interval (str): Combination of "Zero", "One", "Two", "Three", "Six", and "Day", "Week", "Month", "Year". e....
[ "Flush", "logs", "for", "an", "interval", "of", "time", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L660-L692
train
27,858
jssimporter/python-jss
jss/jssobjects.py
LogFlush.log_flush_for_obj_for_interval
def log_flush_for_obj_for_interval(self, log_type, obj_id, interval): """Flush logs for an interval of time for a specific object. Please note, log_type is a variable according to the API docs, but acceptable values are not listed. Only "policies" is demonstrated as an acceptable value....
python
def log_flush_for_obj_for_interval(self, log_type, obj_id, interval): """Flush logs for an interval of time for a specific object. Please note, log_type is a variable according to the API docs, but acceptable values are not listed. Only "policies" is demonstrated as an acceptable value....
[ "def", "log_flush_for_obj_for_interval", "(", "self", ",", "log_type", ",", "obj_id", ",", "interval", ")", ":", "if", "not", "log_type", ":", "log_type", "=", "\"policies\"", "# The XML for the /logflush basic endpoint allows spaces", "# instead of \"+\", so do a replace her...
Flush logs for an interval of time for a specific object. Please note, log_type is a variable according to the API docs, but acceptable values are not listed. Only "policies" is demonstrated as an acceptable value. Args: log_type (str): Only documented type is "policies". T...
[ "Flush", "logs", "for", "an", "interval", "of", "time", "for", "a", "specific", "object", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L694-L731
train
27,859
jssimporter/python-jss
jss/jssobjects.py
Package._new
def _new(self, name, **kwargs): """Create a new Package from scratch. Args: name: String filename of the package to use for the Package object's Display Name (here, "name"). Will also be used as the "filename" value. Casper will let you specif...
python
def _new(self, name, **kwargs): """Create a new Package from scratch. Args: name: String filename of the package to use for the Package object's Display Name (here, "name"). Will also be used as the "filename" value. Casper will let you specif...
[ "def", "_new", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "# We want these to match, so circumvent the for loop.", "# ElementTree.SubElement(self, \"name\").text = name", "super", "(", "Package", ",", "self", ")", ".", "_new", "(", "name", ",", "*"...
Create a new Package from scratch. Args: name: String filename of the package to use for the Package object's Display Name (here, "name"). Will also be used as the "filename" value. Casper will let you specify different values, but it is not ...
[ "Create", "a", "new", "Package", "from", "scratch", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L860-L877
train
27,860
jssimporter/python-jss
jss/jssobjects.py
Package.set_category
def set_category(self, category): """Set package category Args: category: String of an existing category's name, or a Category object. """ # For some reason, packages only have the category name, not the # ID. if isinstance(category, Category)...
python
def set_category(self, category): """Set package category Args: category: String of an existing category's name, or a Category object. """ # For some reason, packages only have the category name, not the # ID. if isinstance(category, Category)...
[ "def", "set_category", "(", "self", ",", "category", ")", ":", "# For some reason, packages only have the category name, not the", "# ID.", "if", "isinstance", "(", "category", ",", "Category", ")", ":", "name", "=", "category", ".", "name", "else", ":", "name", "...
Set package category Args: category: String of an existing category's name, or a Category object.
[ "Set", "package", "category" ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L888-L901
train
27,861
jssimporter/python-jss
jss/jssobjects.py
Policy.add_object_to_scope
def add_object_to_scope(self, obj): """Add an object to the appropriate scope block. Args: obj: JSSObject to add to scope. Accepted subclasses are: Computer ComputerGroup Building Department Raises: TypeErr...
python
def add_object_to_scope(self, obj): """Add an object to the appropriate scope block. Args: obj: JSSObject to add to scope. Accepted subclasses are: Computer ComputerGroup Building Department Raises: TypeErr...
[ "def", "add_object_to_scope", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "Computer", ")", ":", "self", ".", "add_object_to_path", "(", "obj", ",", "\"scope/computers\"", ")", "elif", "isinstance", "(", "obj", ",", "ComputerGroup"...
Add an object to the appropriate scope block. Args: obj: JSSObject to add to scope. Accepted subclasses are: Computer ComputerGroup Building Department Raises: TypeError if invalid obj type is provided.
[ "Add", "an", "object", "to", "the", "appropriate", "scope", "block", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L1006-L1028
train
27,862
jssimporter/python-jss
jss/jssobjects.py
Policy.add_package
def add_package(self, pkg, action_type="Install"): """Add a Package object to the policy with action=install. Args: pkg: A Package object to add. action_type (str, optional): One of "Install", "Cache", or "Install Cached". Defaults to "Install". """ ...
python
def add_package(self, pkg, action_type="Install"): """Add a Package object to the policy with action=install. Args: pkg: A Package object to add. action_type (str, optional): One of "Install", "Cache", or "Install Cached". Defaults to "Install". """ ...
[ "def", "add_package", "(", "self", ",", "pkg", ",", "action_type", "=", "\"Install\"", ")", ":", "if", "isinstance", "(", "pkg", ",", "Package", ")", ":", "if", "action_type", "not", "in", "(", "\"Install\"", ",", "\"Cache\"", ",", "\"Install Cached\"", ")...
Add a Package object to the policy with action=install. Args: pkg: A Package object to add. action_type (str, optional): One of "Install", "Cache", or "Install Cached". Defaults to "Install".
[ "Add", "a", "Package", "object", "to", "the", "policy", "with", "action", "=", "install", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L1068-L1089
train
27,863
jssimporter/python-jss
jss/jssobjects.py
Policy.set_category
def set_category(self, category): """Set the policy's category. Args: category: A category object. """ pcategory = self.find("general/category") pcategory.clear() name = ElementTree.SubElement(pcategory, "name") if isinstance(category, Category): ...
python
def set_category(self, category): """Set the policy's category. Args: category: A category object. """ pcategory = self.find("general/category") pcategory.clear() name = ElementTree.SubElement(pcategory, "name") if isinstance(category, Category): ...
[ "def", "set_category", "(", "self", ",", "category", ")", ":", "pcategory", "=", "self", ".", "find", "(", "\"general/category\"", ")", "pcategory", ".", "clear", "(", ")", "name", "=", "ElementTree", ".", "SubElement", "(", "pcategory", ",", "\"name\"", "...
Set the policy's category. Args: category: A category object.
[ "Set", "the", "policy", "s", "category", "." ]
b95185d74e0c0531b0b563f280d4129e21d5fe5d
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L1099-L1113
train
27,864
brentp/cyvcf2
cyvcf2/cli.py
cyvcf2
def cyvcf2(context, vcf, include, exclude, chrom, start, end, loglevel, silent, individual, no_inds): """fast vcf parsing with cython + htslib""" coloredlogs.install(log_level=loglevel) start_parsing = datetime.now() log.info("Running cyvcf2 version %s", __version__) if include and exclu...
python
def cyvcf2(context, vcf, include, exclude, chrom, start, end, loglevel, silent, individual, no_inds): """fast vcf parsing with cython + htslib""" coloredlogs.install(log_level=loglevel) start_parsing = datetime.now() log.info("Running cyvcf2 version %s", __version__) if include and exclu...
[ "def", "cyvcf2", "(", "context", ",", "vcf", ",", "include", ",", "exclude", ",", "chrom", ",", "start", ",", "end", ",", "loglevel", ",", "silent", ",", "individual", ",", "no_inds", ")", ":", "coloredlogs", ".", "install", "(", "log_level", "=", "log...
fast vcf parsing with cython + htslib
[ "fast", "vcf", "parsing", "with", "cython", "+", "htslib" ]
57f2c0e58ae64d2ec5673d833233834a1157c665
https://github.com/brentp/cyvcf2/blob/57f2c0e58ae64d2ec5673d833233834a1157c665/cyvcf2/cli.py#L112-L182
train
27,865
brentp/cyvcf2
setup.py
get_version
def get_version(): """Get the version info from the mpld3 package without importing it""" import ast with open(os.path.join("cyvcf2", "__init__.py"), "r") as init_file: module = ast.parse(init_file.read()) version = (ast.literal_eval(node.value) for node in ast.walk(module) if isinstanc...
python
def get_version(): """Get the version info from the mpld3 package without importing it""" import ast with open(os.path.join("cyvcf2", "__init__.py"), "r") as init_file: module = ast.parse(init_file.read()) version = (ast.literal_eval(node.value) for node in ast.walk(module) if isinstanc...
[ "def", "get_version", "(", ")", ":", "import", "ast", "with", "open", "(", "os", ".", "path", ".", "join", "(", "\"cyvcf2\"", ",", "\"__init__.py\"", ")", ",", "\"r\"", ")", "as", "init_file", ":", "module", "=", "ast", ".", "parse", "(", "init_file", ...
Get the version info from the mpld3 package without importing it
[ "Get", "the", "version", "info", "from", "the", "mpld3", "package", "without", "importing", "it" ]
57f2c0e58ae64d2ec5673d833233834a1157c665
https://github.com/brentp/cyvcf2/blob/57f2c0e58ae64d2ec5673d833233834a1157c665/setup.py#L13-L26
train
27,866
nabla-c0d3/nassl
nassl/ocsp_response.py
OcspResponse.verify
def verify(self, verify_locations: str) -> None: """Verify that the OCSP response is trusted. Args: verify_locations: The file path to a trust store containing pem-formatted certificates, to be used for validating the OCSP response. Raises OcspResponseNotTrustedError if...
python
def verify(self, verify_locations: str) -> None: """Verify that the OCSP response is trusted. Args: verify_locations: The file path to a trust store containing pem-formatted certificates, to be used for validating the OCSP response. Raises OcspResponseNotTrustedError if...
[ "def", "verify", "(", "self", ",", "verify_locations", ":", "str", ")", "->", "None", ":", "# Ensure the file exists", "with", "open", "(", "verify_locations", ")", ":", "pass", "try", ":", "self", ".", "_ocsp_response", ".", "basic_verify", "(", "verify_locat...
Verify that the OCSP response is trusted. Args: verify_locations: The file path to a trust store containing pem-formatted certificates, to be used for validating the OCSP response. Raises OcspResponseNotTrustedError if the validation failed ie. the OCSP response is not trusted.
[ "Verify", "that", "the", "OCSP", "response", "is", "trusted", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ocsp_response.py#L41-L59
train
27,867
nabla-c0d3/nassl
nassl/ocsp_response.py
OcspResponse._parse_ocsp_response_from_openssl_text
def _parse_ocsp_response_from_openssl_text( cls, response_text: str, response_status: OcspResponseStatusEnum ) -> Dict[str, Any]: """Parse OpenSSL's text output and make a lot of assumptions. """ response_dict = { 'responseStatus': cls._get_val...
python
def _parse_ocsp_response_from_openssl_text( cls, response_text: str, response_status: OcspResponseStatusEnum ) -> Dict[str, Any]: """Parse OpenSSL's text output and make a lot of assumptions. """ response_dict = { 'responseStatus': cls._get_val...
[ "def", "_parse_ocsp_response_from_openssl_text", "(", "cls", ",", "response_text", ":", "str", ",", "response_status", ":", "OcspResponseStatusEnum", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "response_dict", "=", "{", "'responseStatus'", ":", "cls", ...
Parse OpenSSL's text output and make a lot of assumptions.
[ "Parse", "OpenSSL", "s", "text", "output", "and", "make", "a", "lot", "of", "assumptions", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ocsp_response.py#L65-L103
train
27,868
nabla-c0d3/nassl
nassl/ssl_client.py
SslClient._init_base_objects
def _init_base_objects(self, ssl_version: OpenSslVersionEnum, underlying_socket: Optional[socket.socket]) -> None: """Setup the socket and SSL_CTX objects. """ self._is_handshake_completed = False self._ssl_version = ssl_version self._ssl_ctx = self._NASSL_MODULE.SSL_CTX(ssl_vers...
python
def _init_base_objects(self, ssl_version: OpenSslVersionEnum, underlying_socket: Optional[socket.socket]) -> None: """Setup the socket and SSL_CTX objects. """ self._is_handshake_completed = False self._ssl_version = ssl_version self._ssl_ctx = self._NASSL_MODULE.SSL_CTX(ssl_vers...
[ "def", "_init_base_objects", "(", "self", ",", "ssl_version", ":", "OpenSslVersionEnum", ",", "underlying_socket", ":", "Optional", "[", "socket", ".", "socket", "]", ")", "->", "None", ":", "self", ".", "_is_handshake_completed", "=", "False", "self", ".", "_...
Setup the socket and SSL_CTX objects.
[ "Setup", "the", "socket", "and", "SSL_CTX", "objects", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ssl_client.py#L104-L112
train
27,869
nabla-c0d3/nassl
nassl/ssl_client.py
SslClient._init_server_authentication
def _init_server_authentication(self, ssl_verify: OpenSslVerifyEnum, ssl_verify_locations: Optional[str]) -> None: """Setup the certificate validation logic for authenticating the server. """ self._ssl_ctx.set_verify(ssl_verify.value) if ssl_verify_locations: # Ensure the fil...
python
def _init_server_authentication(self, ssl_verify: OpenSslVerifyEnum, ssl_verify_locations: Optional[str]) -> None: """Setup the certificate validation logic for authenticating the server. """ self._ssl_ctx.set_verify(ssl_verify.value) if ssl_verify_locations: # Ensure the fil...
[ "def", "_init_server_authentication", "(", "self", ",", "ssl_verify", ":", "OpenSslVerifyEnum", ",", "ssl_verify_locations", ":", "Optional", "[", "str", "]", ")", "->", "None", ":", "self", ".", "_ssl_ctx", ".", "set_verify", "(", "ssl_verify", ".", "value", ...
Setup the certificate validation logic for authenticating the server.
[ "Setup", "the", "certificate", "validation", "logic", "for", "authenticating", "the", "server", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ssl_client.py#L114-L122
train
27,870
nabla-c0d3/nassl
nassl/ssl_client.py
SslClient._init_client_authentication
def _init_client_authentication( self, client_certchain_file: Optional[str], client_key_file: Optional[str], client_key_type: OpenSslFileTypeEnum, client_key_password: str, ignore_client_authentication_requests: bool ) -> None: """Setup...
python
def _init_client_authentication( self, client_certchain_file: Optional[str], client_key_file: Optional[str], client_key_type: OpenSslFileTypeEnum, client_key_password: str, ignore_client_authentication_requests: bool ) -> None: """Setup...
[ "def", "_init_client_authentication", "(", "self", ",", "client_certchain_file", ":", "Optional", "[", "str", "]", ",", "client_key_file", ":", "Optional", "[", "str", "]", ",", "client_key_type", ":", "OpenSslFileTypeEnum", ",", "client_key_password", ":", "str", ...
Setup client authentication using the supplied certificate and key.
[ "Setup", "client", "authentication", "using", "the", "supplied", "certificate", "and", "key", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ssl_client.py#L124-L141
train
27,871
nabla-c0d3/nassl
nassl/ssl_client.py
SslClient.shutdown
def shutdown(self) -> None: """Close the TLS connection and the underlying network socket. """ self._is_handshake_completed = False try: self._flush_ssl_engine() except IOError: # Ensure shutting down the connection never raises an exception pa...
python
def shutdown(self) -> None: """Close the TLS connection and the underlying network socket. """ self._is_handshake_completed = False try: self._flush_ssl_engine() except IOError: # Ensure shutting down the connection never raises an exception pa...
[ "def", "shutdown", "(", "self", ")", "->", "None", ":", "self", ".", "_is_handshake_completed", "=", "False", "try", ":", "self", ".", "_flush_ssl_engine", "(", ")", "except", "IOError", ":", "# Ensure shutting down the connection never raises an exception", "pass", ...
Close the TLS connection and the underlying network socket.
[ "Close", "the", "TLS", "connection", "and", "the", "underlying", "network", "socket", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ssl_client.py#L282-L299
train
27,872
nabla-c0d3/nassl
nassl/ssl_client.py
SslClient._use_private_key
def _use_private_key( self, client_certchain_file: str, client_key_file: str, client_key_type: OpenSslFileTypeEnum, client_key_password: str ) -> None: """The certificate chain file must be in PEM format. Private method because it should be set via...
python
def _use_private_key( self, client_certchain_file: str, client_key_file: str, client_key_type: OpenSslFileTypeEnum, client_key_password: str ) -> None: """The certificate chain file must be in PEM format. Private method because it should be set via...
[ "def", "_use_private_key", "(", "self", ",", "client_certchain_file", ":", "str", ",", "client_key_file", ":", "str", ",", "client_key_type", ":", "OpenSslFileTypeEnum", ",", "client_key_password", ":", "str", ")", "->", "None", ":", "# Ensure the files exist", "wit...
The certificate chain file must be in PEM format. Private method because it should be set via the constructor.
[ "The", "certificate", "chain", "file", "must", "be", "in", "PEM", "format", ".", "Private", "method", "because", "it", "should", "be", "set", "via", "the", "constructor", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ssl_client.py#L327-L353
train
27,873
nabla-c0d3/nassl
nassl/ssl_client.py
SslClient.get_tlsext_status_ocsp_resp
def get_tlsext_status_ocsp_resp(self) -> Optional[OcspResponse]: """Retrieve the server's OCSP Stapling status. """ ocsp_response = self._ssl.get_tlsext_status_ocsp_resp() if ocsp_response: return OcspResponse(ocsp_response) else: return None
python
def get_tlsext_status_ocsp_resp(self) -> Optional[OcspResponse]: """Retrieve the server's OCSP Stapling status. """ ocsp_response = self._ssl.get_tlsext_status_ocsp_resp() if ocsp_response: return OcspResponse(ocsp_response) else: return None
[ "def", "get_tlsext_status_ocsp_resp", "(", "self", ")", "->", "Optional", "[", "OcspResponse", "]", ":", "ocsp_response", "=", "self", ".", "_ssl", ".", "get_tlsext_status_ocsp_resp", "(", ")", "if", "ocsp_response", ":", "return", "OcspResponse", "(", "ocsp_respo...
Retrieve the server's OCSP Stapling status.
[ "Retrieve", "the", "server", "s", "OCSP", "Stapling", "status", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/ssl_client.py#L367-L374
train
27,874
nabla-c0d3/nassl
build_tasks.py
BuildConfig.fetch_source
def fetch_source(self) -> None: """Download the tar archive that contains the source code for the library. """ import requests # Do not import at the top that this file can be imported by setup.py with TemporaryFile() as temp_file: # Download the source archive r...
python
def fetch_source(self) -> None: """Download the tar archive that contains the source code for the library. """ import requests # Do not import at the top that this file can be imported by setup.py with TemporaryFile() as temp_file: # Download the source archive r...
[ "def", "fetch_source", "(", "self", ")", "->", "None", ":", "import", "requests", "# Do not import at the top that this file can be imported by setup.py", "with", "TemporaryFile", "(", ")", "as", "temp_file", ":", "# Download the source archive", "request", "=", "requests",...
Download the tar archive that contains the source code for the library.
[ "Download", "the", "tar", "archive", "that", "contains", "the", "source", "code", "for", "the", "library", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/build_tasks.py#L79-L91
train
27,875
nabla-c0d3/nassl
nassl/legacy_ssl_client.py
LegacySslClient.do_renegotiate
def do_renegotiate(self) -> None: """Initiate an SSL renegotiation. """ if not self._is_handshake_completed: raise IOError('SSL Handshake was not completed; cannot renegotiate.') self._ssl.renegotiate() self.do_handshake()
python
def do_renegotiate(self) -> None: """Initiate an SSL renegotiation. """ if not self._is_handshake_completed: raise IOError('SSL Handshake was not completed; cannot renegotiate.') self._ssl.renegotiate() self.do_handshake()
[ "def", "do_renegotiate", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "_is_handshake_completed", ":", "raise", "IOError", "(", "'SSL Handshake was not completed; cannot renegotiate.'", ")", "self", ".", "_ssl", ".", "renegotiate", "(", ")", "self...
Initiate an SSL renegotiation.
[ "Initiate", "an", "SSL", "renegotiation", "." ]
7dce9a2235f4324191865d58dcbeec5c3a2097a3
https://github.com/nabla-c0d3/nassl/blob/7dce9a2235f4324191865d58dcbeec5c3a2097a3/nassl/legacy_ssl_client.py#L71-L78
train
27,876
jobovy/galpy
doc/source/examples/dierickx_eccentricities.py
_download_file_vizier
def _download_file_vizier(cat,filePath,catalogname='catalog.dat'): ''' Stolen from Jo Bovy's gaia_tools package! ''' sys.stdout.write('\r'+"Downloading file %s ...\r" \ % (os.path.basename(filePath))) sys.stdout.flush() try: # make all intermediate directories ...
python
def _download_file_vizier(cat,filePath,catalogname='catalog.dat'): ''' Stolen from Jo Bovy's gaia_tools package! ''' sys.stdout.write('\r'+"Downloading file %s ...\r" \ % (os.path.basename(filePath))) sys.stdout.flush() try: # make all intermediate directories ...
[ "def", "_download_file_vizier", "(", "cat", ",", "filePath", ",", "catalogname", "=", "'catalog.dat'", ")", ":", "sys", ".", "stdout", ".", "write", "(", "'\\r'", "+", "\"Downloading file %s ...\\r\"", "%", "(", "os", ".", "path", ".", "basename", "(", "file...
Stolen from Jo Bovy's gaia_tools package!
[ "Stolen", "from", "Jo", "Bovy", "s", "gaia_tools", "package!" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/doc/source/examples/dierickx_eccentricities.py#L133-L173
train
27,877
jobovy/galpy
doc/source/examples/dierickx_eccentricities.py
ensure_dir
def ensure_dir(f): """ Ensure a a file exists and if not make the relevant path """ d = os.path.dirname(f) if not os.path.exists(d): os.makedirs(d)
python
def ensure_dir(f): """ Ensure a a file exists and if not make the relevant path """ d = os.path.dirname(f) if not os.path.exists(d): os.makedirs(d)
[ "def", "ensure_dir", "(", "f", ")", ":", "d", "=", "os", ".", "path", ".", "dirname", "(", "f", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "d", ")", ":", "os", ".", "makedirs", "(", "d", ")" ]
Ensure a a file exists and if not make the relevant path
[ "Ensure", "a", "a", "file", "exists", "and", "if", "not", "make", "the", "relevant", "path" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/doc/source/examples/dierickx_eccentricities.py#L175-L179
train
27,878
jobovy/galpy
galpy/actionAngle/actionAngleIsochroneApprox.py
dePeriod
def dePeriod(arr): """make an array of periodic angles increase linearly""" diff= arr-nu.roll(arr,1,axis=1) w= diff < -6. addto= nu.cumsum(w.astype(int),axis=1) return arr+_TWOPI*addto
python
def dePeriod(arr): """make an array of periodic angles increase linearly""" diff= arr-nu.roll(arr,1,axis=1) w= diff < -6. addto= nu.cumsum(w.astype(int),axis=1) return arr+_TWOPI*addto
[ "def", "dePeriod", "(", "arr", ")", ":", "diff", "=", "arr", "-", "nu", ".", "roll", "(", "arr", ",", "1", ",", "axis", "=", "1", ")", "w", "=", "diff", "<", "-", "6.", "addto", "=", "nu", ".", "cumsum", "(", "w", ".", "astype", "(", "int",...
make an array of periodic angles increase linearly
[ "make", "an", "array", "of", "periodic", "angles", "increase", "linearly" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/actionAngle/actionAngleIsochroneApprox.py#L760-L765
train
27,879
jobovy/galpy
galpy/util/leung_dop853.py
hinit
def hinit(func, x, t, pos_neg, f0, iord, hmax, rtol, atol, args): """ Estimate initial step size """ sk = atol + rtol * np.fabs(x) dnf = np.sum(np.square(f0 / sk), axis=0) dny = np.sum(np.square(x / sk), axis=0) h = np.sqrt(dny / dnf) * 0.01 h = np.min([h, np.fabs(hmax)]) h = custo...
python
def hinit(func, x, t, pos_neg, f0, iord, hmax, rtol, atol, args): """ Estimate initial step size """ sk = atol + rtol * np.fabs(x) dnf = np.sum(np.square(f0 / sk), axis=0) dny = np.sum(np.square(x / sk), axis=0) h = np.sqrt(dny / dnf) * 0.01 h = np.min([h, np.fabs(hmax)]) h = custo...
[ "def", "hinit", "(", "func", ",", "x", ",", "t", ",", "pos_neg", ",", "f0", ",", "iord", ",", "hmax", ",", "rtol", ",", "atol", ",", "args", ")", ":", "sk", "=", "atol", "+", "rtol", "*", "np", ".", "fabs", "(", "x", ")", "dnf", "=", "np", ...
Estimate initial step size
[ "Estimate", "initial", "step", "size" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/leung_dop853.py#L211-L238
train
27,880
jobovy/galpy
galpy/util/leung_dop853.py
dense_output
def dense_output(t_current, t_old, h_current, rcont): """ Dense output function, basically extrapolatin """ # initialization s = (t_current - t_old) / h_current s1 = 1.0 - s return rcont[0] + s * (rcont[1] + s1 * ( rcont[2] + s * (rcont[3] + s1 * (rcont[4] + s * (rcont[5] + s1 *...
python
def dense_output(t_current, t_old, h_current, rcont): """ Dense output function, basically extrapolatin """ # initialization s = (t_current - t_old) / h_current s1 = 1.0 - s return rcont[0] + s * (rcont[1] + s1 * ( rcont[2] + s * (rcont[3] + s1 * (rcont[4] + s * (rcont[5] + s1 *...
[ "def", "dense_output", "(", "t_current", ",", "t_old", ",", "h_current", ",", "rcont", ")", ":", "# initialization", "s", "=", "(", "t_current", "-", "t_old", ")", "/", "h_current", "s1", "=", "1.0", "-", "s", "return", "rcont", "[", "0", "]", "+", "...
Dense output function, basically extrapolatin
[ "Dense", "output", "function", "basically", "extrapolatin" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/leung_dop853.py#L241-L250
train
27,881
jobovy/galpy
galpy/potential/DiskSCFPotential.py
phiME_dens
def phiME_dens(R,z,phi,dens,Sigma,dSigmadR,d2SigmadR2,hz,Hz,dHzdz,Sigma_amp): """The density corresponding to phi_ME""" r= numpy.sqrt(R**2.+z**2.) out= dens(R,z,phi) for a,s,ds,d2s,h,H,dH \ in zip(Sigma_amp,Sigma,dSigmadR,d2SigmadR2,hz,Hz,dHzdz): out-= a*(s(r)*h(z)+d2s(r)*H(z)+2./r*d...
python
def phiME_dens(R,z,phi,dens,Sigma,dSigmadR,d2SigmadR2,hz,Hz,dHzdz,Sigma_amp): """The density corresponding to phi_ME""" r= numpy.sqrt(R**2.+z**2.) out= dens(R,z,phi) for a,s,ds,d2s,h,H,dH \ in zip(Sigma_amp,Sigma,dSigmadR,d2SigmadR2,hz,Hz,dHzdz): out-= a*(s(r)*h(z)+d2s(r)*H(z)+2./r*d...
[ "def", "phiME_dens", "(", "R", ",", "z", ",", "phi", ",", "dens", ",", "Sigma", ",", "dSigmadR", ",", "d2SigmadR2", ",", "hz", ",", "Hz", ",", "dHzdz", ",", "Sigma_amp", ")", ":", "r", "=", "numpy", ".", "sqrt", "(", "R", "**", "2.", "+", "z", ...
The density corresponding to phi_ME
[ "The", "density", "corresponding", "to", "phi_ME" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/potential/DiskSCFPotential.py#L479-L486
train
27,882
jobovy/galpy
galpy/orbit/integratePlanarOrbit.py
_parse_integrator
def _parse_integrator(int_method): """parse the integrator method to pass to C""" #Pick integrator if int_method.lower() == 'rk4_c': int_method_c= 1 elif int_method.lower() == 'rk6_c': int_method_c= 2 elif int_method.lower() == 'symplec4_c': int_method_c= 3 elif int_metho...
python
def _parse_integrator(int_method): """parse the integrator method to pass to C""" #Pick integrator if int_method.lower() == 'rk4_c': int_method_c= 1 elif int_method.lower() == 'rk6_c': int_method_c= 2 elif int_method.lower() == 'symplec4_c': int_method_c= 3 elif int_metho...
[ "def", "_parse_integrator", "(", "int_method", ")", ":", "#Pick integrator", "if", "int_method", ".", "lower", "(", ")", "==", "'rk4_c'", ":", "int_method_c", "=", "1", "elif", "int_method", ".", "lower", "(", ")", "==", "'rk6_c'", ":", "int_method_c", "=", ...
parse the integrator method to pass to C
[ "parse", "the", "integrator", "method", "to", "pass", "to", "C" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/orbit/integratePlanarOrbit.py#L310-L327
train
27,883
jobovy/galpy
galpy/orbit/integratePlanarOrbit.py
_parse_tol
def _parse_tol(rtol,atol): """Parse the tolerance keywords""" #Process atol and rtol if rtol is None: rtol= -12.*nu.log(10.) else: #pragma: no cover rtol= nu.log(rtol) if atol is None: atol= -12.*nu.log(10.) else: #pragma: no cover atol= nu.log(atol) return (r...
python
def _parse_tol(rtol,atol): """Parse the tolerance keywords""" #Process atol and rtol if rtol is None: rtol= -12.*nu.log(10.) else: #pragma: no cover rtol= nu.log(rtol) if atol is None: atol= -12.*nu.log(10.) else: #pragma: no cover atol= nu.log(atol) return (r...
[ "def", "_parse_tol", "(", "rtol", ",", "atol", ")", ":", "#Process atol and rtol", "if", "rtol", "is", "None", ":", "rtol", "=", "-", "12.", "*", "nu", ".", "log", "(", "10.", ")", "else", ":", "#pragma: no cover", "rtol", "=", "nu", ".", "log", "(",...
Parse the tolerance keywords
[ "Parse", "the", "tolerance", "keywords" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/orbit/integratePlanarOrbit.py#L329-L340
train
27,884
jobovy/galpy
galpy/orbit/Orbit.py
_check_integrate_dt
def _check_integrate_dt(t,dt): """Check that the stepszie in t is an integer x dt""" if dt is None: return True mult= round((t[1]-t[0])/dt) if nu.fabs(mult*dt-t[1]+t[0]) < 10.**-10.: return True else: return False
python
def _check_integrate_dt(t,dt): """Check that the stepszie in t is an integer x dt""" if dt is None: return True mult= round((t[1]-t[0])/dt) if nu.fabs(mult*dt-t[1]+t[0]) < 10.**-10.: return True else: return False
[ "def", "_check_integrate_dt", "(", "t", ",", "dt", ")", ":", "if", "dt", "is", "None", ":", "return", "True", "mult", "=", "round", "(", "(", "t", "[", "1", "]", "-", "t", "[", "0", "]", ")", "/", "dt", ")", "if", "nu", ".", "fabs", "(", "m...
Check that the stepszie in t is an integer x dt
[ "Check", "that", "the", "stepszie", "in", "t", "is", "an", "integer", "x", "dt" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/orbit/Orbit.py#L3941-L3949
train
27,885
jobovy/galpy
galpy/potential/EllipsoidalPotential.py
_forceInt
def _forceInt(x,y,z,dens,b2,c2,i,glx=None,glw=None): """Integral that gives the force in x,y,z""" def integrand(s): t= 1/s**2.-1. return dens(numpy.sqrt(x**2./(1.+t)+y**2./(b2+t)+z**2./(c2+t)))\ *(x/(1.+t)*(i==0)+y/(b2+t)*(i==1)+z/(c2+t)*(i==2))\ /numpy.sqrt((1.+(b2-1.)*s...
python
def _forceInt(x,y,z,dens,b2,c2,i,glx=None,glw=None): """Integral that gives the force in x,y,z""" def integrand(s): t= 1/s**2.-1. return dens(numpy.sqrt(x**2./(1.+t)+y**2./(b2+t)+z**2./(c2+t)))\ *(x/(1.+t)*(i==0)+y/(b2+t)*(i==1)+z/(c2+t)*(i==2))\ /numpy.sqrt((1.+(b2-1.)*s...
[ "def", "_forceInt", "(", "x", ",", "y", ",", "z", ",", "dens", ",", "b2", ",", "c2", ",", "i", ",", "glx", "=", "None", ",", "glw", "=", "None", ")", ":", "def", "integrand", "(", "s", ")", ":", "t", "=", "1", "/", "s", "**", "2.", "-", ...
Integral that gives the force in x,y,z
[ "Integral", "that", "gives", "the", "force", "in", "x", "y", "z" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/potential/EllipsoidalPotential.py#L485-L495
train
27,886
jobovy/galpy
galpy/potential/EllipsoidalPotential.py
_2ndDerivInt
def _2ndDerivInt(x,y,z,dens,densDeriv,b2,c2,i,j,glx=None,glw=None): """Integral that gives the 2nd derivative of the potential in x,y,z""" def integrand(s): t= 1/s**2.-1. m= numpy.sqrt(x**2./(1.+t)+y**2./(b2+t)+z**2./(c2+t)) return (densDeriv(m) *(x/(1.+t)*(i==0)+y/(b2+t)...
python
def _2ndDerivInt(x,y,z,dens,densDeriv,b2,c2,i,j,glx=None,glw=None): """Integral that gives the 2nd derivative of the potential in x,y,z""" def integrand(s): t= 1/s**2.-1. m= numpy.sqrt(x**2./(1.+t)+y**2./(b2+t)+z**2./(c2+t)) return (densDeriv(m) *(x/(1.+t)*(i==0)+y/(b2+t)...
[ "def", "_2ndDerivInt", "(", "x", ",", "y", ",", "z", ",", "dens", ",", "densDeriv", ",", "b2", ",", "c2", ",", "i", ",", "j", ",", "glx", "=", "None", ",", "glw", "=", "None", ")", ":", "def", "integrand", "(", "s", ")", ":", "t", "=", "1",...
Integral that gives the 2nd derivative of the potential in x,y,z
[ "Integral", "that", "gives", "the", "2nd", "derivative", "of", "the", "potential", "in", "x", "y", "z" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/potential/EllipsoidalPotential.py#L497-L510
train
27,887
jobovy/galpy
galpy/potential/TwoPowerTriaxialPotential.py
TwoPowerTriaxialPotential._mdens
def _mdens(self,m): """Density as a function of m""" return (self.a/m)**self.alpha/(1.+m/self.a)**(self.betaminusalpha)
python
def _mdens(self,m): """Density as a function of m""" return (self.a/m)**self.alpha/(1.+m/self.a)**(self.betaminusalpha)
[ "def", "_mdens", "(", "self", ",", "m", ")", ":", "return", "(", "self", ".", "a", "/", "m", ")", "**", "self", ".", "alpha", "/", "(", "1.", "+", "m", "/", "self", ".", "a", ")", "**", "(", "self", ".", "betaminusalpha", ")" ]
Density as a function of m
[ "Density", "as", "a", "function", "of", "m" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/potential/TwoPowerTriaxialPotential.py#L128-L130
train
27,888
jobovy/galpy
galpy/orbit/FullOrbit.py
_fit_orbit
def _fit_orbit(orb,vxvv,vxvv_err,pot,radec=False,lb=False, customsky=False,lb_to_customsky=None, pmllpmbb_to_customsky=None, tintJ=100,ntintJ=1000,integrate_method='dopr54_c', ro=None,vo=None,obs=None,disp=False): """Fit an orbit to data in a given potenti...
python
def _fit_orbit(orb,vxvv,vxvv_err,pot,radec=False,lb=False, customsky=False,lb_to_customsky=None, pmllpmbb_to_customsky=None, tintJ=100,ntintJ=1000,integrate_method='dopr54_c', ro=None,vo=None,obs=None,disp=False): """Fit an orbit to data in a given potenti...
[ "def", "_fit_orbit", "(", "orb", ",", "vxvv", ",", "vxvv_err", ",", "pot", ",", "radec", "=", "False", ",", "lb", "=", "False", ",", "customsky", "=", "False", ",", "lb_to_customsky", "=", "None", ",", "pmllpmbb_to_customsky", "=", "None", ",", "tintJ", ...
Fit an orbit to data in a given potential
[ "Fit", "an", "orbit", "to", "data", "in", "a", "given", "potential" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/orbit/FullOrbit.py#L721-L757
train
27,889
jobovy/galpy
galpy/util/bovy_conversion.py
actionAngle_physical_input
def actionAngle_physical_input(method): """Decorator to convert inputs to actionAngle functions from physical to internal coordinates""" @wraps(method) def wrapper(*args,**kwargs): if len(args) < 3: # orbit input return method(*args,**kwargs) ro= kwargs.get('ro',None) ...
python
def actionAngle_physical_input(method): """Decorator to convert inputs to actionAngle functions from physical to internal coordinates""" @wraps(method) def wrapper(*args,**kwargs): if len(args) < 3: # orbit input return method(*args,**kwargs) ro= kwargs.get('ro',None) ...
[ "def", "actionAngle_physical_input", "(", "method", ")", ":", "@", "wraps", "(", "method", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "<", "3", ":", "# orbit input", "return", "method", ...
Decorator to convert inputs to actionAngle functions from physical to internal coordinates
[ "Decorator", "to", "convert", "inputs", "to", "actionAngle", "functions", "from", "physical", "to", "internal", "coordinates" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/bovy_conversion.py#L788-L824
train
27,890
jobovy/galpy
galpy/snapshot/directnbody.py
_direct_nbody_force
def _direct_nbody_force(q,m,t,pot,softening,softening_args): """Calculate the force""" #First do the particles #Calculate all the distances nq= len(q) dim= len(q[0]) dist_vec= nu.zeros((nq,nq,dim)) dist= nu.zeros((nq,nq)) for ii in range(nq): for jj in range(ii+1,nq): ...
python
def _direct_nbody_force(q,m,t,pot,softening,softening_args): """Calculate the force""" #First do the particles #Calculate all the distances nq= len(q) dim= len(q[0]) dist_vec= nu.zeros((nq,nq,dim)) dist= nu.zeros((nq,nq)) for ii in range(nq): for jj in range(ii+1,nq): ...
[ "def", "_direct_nbody_force", "(", "q", ",", "m", ",", "t", ",", "pot", ",", "softening", ",", "softening_args", ")", ":", "#First do the particles", "#Calculate all the distances", "nq", "=", "len", "(", "q", ")", "dim", "=", "len", "(", "q", "[", "0", ...
Calculate the force
[ "Calculate", "the", "force" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/snapshot/directnbody.py#L73-L100
train
27,891
jobovy/galpy
galpy/df/evolveddiskdf.py
_vmomentsurfaceIntegrand
def _vmomentsurfaceIntegrand(vR,vT,R,az,df,n,m,sigmaR1,sigmaT1,t,initvmoment): """Internal function that is the integrand for the velocity moment times surface mass integration""" o= Orbit([R,vR*sigmaR1,vT*sigmaT1,az]) return vR**n*vT**m*df(o,t)/initvmoment
python
def _vmomentsurfaceIntegrand(vR,vT,R,az,df,n,m,sigmaR1,sigmaT1,t,initvmoment): """Internal function that is the integrand for the velocity moment times surface mass integration""" o= Orbit([R,vR*sigmaR1,vT*sigmaT1,az]) return vR**n*vT**m*df(o,t)/initvmoment
[ "def", "_vmomentsurfaceIntegrand", "(", "vR", ",", "vT", ",", "R", ",", "az", ",", "df", ",", "n", ",", "m", ",", "sigmaR1", ",", "sigmaT1", ",", "t", ",", "initvmoment", ")", ":", "o", "=", "Orbit", "(", "[", "R", ",", "vR", "*", "sigmaR1", ",...
Internal function that is the integrand for the velocity moment times surface mass integration
[ "Internal", "function", "that", "is", "the", "integrand", "for", "the", "velocity", "moment", "times", "surface", "mass", "integration" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/evolveddiskdf.py#L2282-L2286
train
27,892
jobovy/galpy
galpy/df/evolveddiskdf.py
evolveddiskdf._vmomentsurfacemassGrid
def _vmomentsurfacemassGrid(self,n,m,grid): """Internal function to evaluate vmomentsurfacemass using a grid rather than direct integration""" if len(grid.df.shape) == 3: tlist= True else: tlist= False if tlist: nt= grid.df.shape[2] out= [] f...
python
def _vmomentsurfacemassGrid(self,n,m,grid): """Internal function to evaluate vmomentsurfacemass using a grid rather than direct integration""" if len(grid.df.shape) == 3: tlist= True else: tlist= False if tlist: nt= grid.df.shape[2] out= [] f...
[ "def", "_vmomentsurfacemassGrid", "(", "self", ",", "n", ",", "m", ",", "grid", ")", ":", "if", "len", "(", "grid", ".", "df", ".", "shape", ")", "==", "3", ":", "tlist", "=", "True", "else", ":", "tlist", "=", "False", "if", "tlist", ":", "nt", ...
Internal function to evaluate vmomentsurfacemass using a grid rather than direct integration
[ "Internal", "function", "to", "evaluate", "vmomentsurfacemass", "using", "a", "grid", "rather", "than", "direct", "integration" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/evolveddiskdf.py#L1826-L1840
train
27,893
jobovy/galpy
galpy/df/evolveddiskdf.py
evolveddiskdf._buildvgrid
def _buildvgrid(self,R,phi,nsigma,t,sigmaR1,sigmaT1,meanvR,meanvT, gridpoints,print_progress,integrate_method,deriv): """Internal function to grid the vDF at a given location""" out= evolveddiskdfGrid() out.sigmaR1= sigmaR1 out.sigmaT1= sigmaT1 out.meanvR= mea...
python
def _buildvgrid(self,R,phi,nsigma,t,sigmaR1,sigmaT1,meanvR,meanvT, gridpoints,print_progress,integrate_method,deriv): """Internal function to grid the vDF at a given location""" out= evolveddiskdfGrid() out.sigmaR1= sigmaR1 out.sigmaT1= sigmaT1 out.meanvR= mea...
[ "def", "_buildvgrid", "(", "self", ",", "R", ",", "phi", ",", "nsigma", ",", "t", ",", "sigmaR1", ",", "sigmaT1", ",", "meanvR", ",", "meanvT", ",", "gridpoints", ",", "print_progress", ",", "integrate_method", ",", "deriv", ")", ":", "out", "=", "evol...
Internal function to grid the vDF at a given location
[ "Internal", "function", "to", "grid", "the", "vDF", "at", "a", "given", "location" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/evolveddiskdf.py#L1842-L1883
train
27,894
jobovy/galpy
galpy/df/streamdf.py
_determine_stream_spread_single
def _determine_stream_spread_single(sigomatrixEig, thetasTrack, sigOmega, sigAngle, allinvjacsTrack): """sigAngle input may either be a function that returns the dispersion...
python
def _determine_stream_spread_single(sigomatrixEig, thetasTrack, sigOmega, sigAngle, allinvjacsTrack): """sigAngle input may either be a function that returns the dispersion...
[ "def", "_determine_stream_spread_single", "(", "sigomatrixEig", ",", "thetasTrack", ",", "sigOmega", ",", "sigAngle", ",", "allinvjacsTrack", ")", ":", "#Estimate the spread in all frequencies and angles", "sigObig2", "=", "sigOmega", "(", "thetasTrack", ")", "**", "2.", ...
sigAngle input may either be a function that returns the dispersion in perpendicular angle as a function of parallel angle, or a value
[ "sigAngle", "input", "may", "either", "be", "a", "function", "that", "returns", "the", "dispersion", "in", "perpendicular", "angle", "as", "a", "function", "of", "parallel", "angle", "or", "a", "value" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L3242-L3278
train
27,895
jobovy/galpy
galpy/df/streamdf.py
streamdf._progenitor_setup
def _progenitor_setup(self,progenitor,leading,useTMHessian): """The part of the setup relating to the progenitor's orbit""" #Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor self._progenitor= progenitor() #call to get new Orbit # Make sure we do not use phy...
python
def _progenitor_setup(self,progenitor,leading,useTMHessian): """The part of the setup relating to the progenitor's orbit""" #Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor self._progenitor= progenitor() #call to get new Orbit # Make sure we do not use phy...
[ "def", "_progenitor_setup", "(", "self", ",", "progenitor", ",", "leading", ",", "useTMHessian", ")", ":", "#Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor", "self", ".", "_progenitor", "=", "progenitor", "(", ")", "#call to get new Orbit", ...
The part of the setup relating to the progenitor's orbit
[ "The", "part", "of", "the", "setup", "relating", "to", "the", "progenitor", "s", "orbit" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L218-L257
train
27,896
jobovy/galpy
galpy/df/streamdf.py
streamdf._setup_progIsTrack
def _setup_progIsTrack(self): """If progIsTrack, the progenitor orbit that was passed to the streamdf initialization is the track at zero angle separation; this routine computes an actual progenitor position that gives the desired track given the parameters of the streamdf""" # ...
python
def _setup_progIsTrack(self): """If progIsTrack, the progenitor orbit that was passed to the streamdf initialization is the track at zero angle separation; this routine computes an actual progenitor position that gives the desired track given the parameters of the streamdf""" # ...
[ "def", "_setup_progIsTrack", "(", "self", ")", ":", "# We need to flip the sign of the offset, to go to the progenitor", "self", ".", "_sigMeanSign", "*=", "-", "1.", "# Use _determine_stream_track_single to calculate the track-progenitor", "# offset at zero angle separation", "prog_st...
If progIsTrack, the progenitor orbit that was passed to the streamdf initialization is the track at zero angle separation; this routine computes an actual progenitor position that gives the desired track given the parameters of the streamdf
[ "If", "progIsTrack", "the", "progenitor", "orbit", "that", "was", "passed", "to", "the", "streamdf", "initialization", "is", "the", "track", "at", "zero", "angle", "separation", ";", "this", "routine", "computes", "an", "actual", "progenitor", "position", "that"...
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L341-L367
train
27,897
jobovy/galpy
galpy/df/streamdf.py
streamdf._determine_nTrackIterations
def _determine_nTrackIterations(self,nTrackIterations): """Determine a good value for nTrackIterations based on the misalignment between stream and orbit; just based on some rough experience for now""" if not nTrackIterations is None: self.nTrackIterations= nTrackIterations retur...
python
def _determine_nTrackIterations(self,nTrackIterations): """Determine a good value for nTrackIterations based on the misalignment between stream and orbit; just based on some rough experience for now""" if not nTrackIterations is None: self.nTrackIterations= nTrackIterations retur...
[ "def", "_determine_nTrackIterations", "(", "self", ",", "nTrackIterations", ")", ":", "if", "not", "nTrackIterations", "is", "None", ":", "self", ".", "nTrackIterations", "=", "nTrackIterations", "return", "None", "if", "numpy", ".", "fabs", "(", "self", ".", ...
Determine a good value for nTrackIterations based on the misalignment between stream and orbit; just based on some rough experience for now
[ "Determine", "a", "good", "value", "for", "nTrackIterations", "based", "on", "the", "misalignment", "between", "stream", "and", "orbit", ";", "just", "based", "on", "some", "rough", "experience", "for", "now" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L912-L924
train
27,898
jobovy/galpy
galpy/df/streamdf.py
streamdf._interpolate_stream_track_aA
def _interpolate_stream_track_aA(self): """Build interpolations of the stream track in action-angle coordinates""" if hasattr(self,'_interpolatedObsTrackAA'): return None #Already did this #Calculate 1D meanOmega on a fine grid in angle and interpolate if not hasattr(self,'_i...
python
def _interpolate_stream_track_aA(self): """Build interpolations of the stream track in action-angle coordinates""" if hasattr(self,'_interpolatedObsTrackAA'): return None #Already did this #Calculate 1D meanOmega on a fine grid in angle and interpolate if not hasattr(self,'_i...
[ "def", "_interpolate_stream_track_aA", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_interpolatedObsTrackAA'", ")", ":", "return", "None", "#Already did this", "#Calculate 1D meanOmega on a fine grid in angle and interpolate", "if", "not", "hasattr", "(", "...
Build interpolations of the stream track in action-angle coordinates
[ "Build", "interpolations", "of", "the", "stream", "track", "in", "action", "-", "angle", "coordinates" ]
9c5b9fe65d58835624dffe432be282060918ee08
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L1428-L1452
train
27,899