id
int32
0
252k
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
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
42,800
Robpol86/libnl
libnl/msg.py
nlmsg_convert
def nlmsg_convert(hdr): """Convert a Netlink message received from a Netlink socket to an nl_msg. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L382 Allocates a new Netlink message and copies all of the data in `hdr` into the new message object. Positional arguments: hdr -- Netlink ...
python
def nlmsg_convert(hdr): """Convert a Netlink message received from a Netlink socket to an nl_msg. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L382 Allocates a new Netlink message and copies all of the data in `hdr` into the new message object. Positional arguments: hdr -- Netlink ...
[ "def", "nlmsg_convert", "(", "hdr", ")", ":", "nm", "=", "nlmsg_alloc", "(", "hdr", ".", "nlmsg_len", ")", "if", "not", "nm", ":", "return", "None", "nm", ".", "nm_nlh", ".", "bytearray", "=", "hdr", ".", "bytearray", ".", "copy", "(", ")", "[", ":...
Convert a Netlink message received from a Netlink socket to an nl_msg. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L382 Allocates a new Netlink message and copies all of the data in `hdr` into the new message object. Positional arguments: hdr -- Netlink message received from netlink s...
[ "Convert", "a", "Netlink", "message", "received", "from", "a", "Netlink", "socket", "to", "an", "nl_msg", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L276-L293
42,801
Robpol86/libnl
libnl/msg.py
nlmsg_reserve
def nlmsg_reserve(n, len_, pad): """Reserve room for additional data in a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L407 Reserves room for additional data at the tail of the an existing netlink message. Eventual padding required will be zeroed out. bytearray_ptr...
python
def nlmsg_reserve(n, len_, pad): """Reserve room for additional data in a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L407 Reserves room for additional data at the tail of the an existing netlink message. Eventual padding required will be zeroed out. bytearray_ptr...
[ "def", "nlmsg_reserve", "(", "n", ",", "len_", ",", "pad", ")", ":", "nlmsg_len_", "=", "n", ".", "nm_nlh", ".", "nlmsg_len", "tlen", "=", "len_", "if", "not", "pad", "else", "(", "(", "len_", "+", "(", "pad", "-", "1", ")", ")", "&", "~", "(",...
Reserve room for additional data in a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L407 Reserves room for additional data at the tail of the an existing netlink message. Eventual padding required will be zeroed out. bytearray_ptr() at the start of additional data or No...
[ "Reserve", "room", "for", "additional", "data", "in", "a", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L296-L318
42,802
Robpol86/libnl
libnl/msg.py
nlmsg_append
def nlmsg_append(n, data, len_, pad): """Append data to tail of a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L442 Extends the Netlink message as needed and appends the data of given length to the message. Positional arguments: n -- Netlink message (nl_msg class i...
python
def nlmsg_append(n, data, len_, pad): """Append data to tail of a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L442 Extends the Netlink message as needed and appends the data of given length to the message. Positional arguments: n -- Netlink message (nl_msg class i...
[ "def", "nlmsg_append", "(", "n", ",", "data", ",", "len_", ",", "pad", ")", ":", "tmp", "=", "nlmsg_reserve", "(", "n", ",", "len_", ",", "pad", ")", "if", "tmp", "is", "None", ":", "return", "-", "NLE_NOMEM", "tmp", "[", ":", "len_", "]", "=", ...
Append data to tail of a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L442 Extends the Netlink message as needed and appends the data of given length to the message. Positional arguments: n -- Netlink message (nl_msg class instance). data -- data to add. len_ -...
[ "Append", "data", "to", "tail", "of", "a", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L321-L342
42,803
Robpol86/libnl
libnl/msg.py
nlmsg_put
def nlmsg_put(n, pid, seq, type_, payload, flags): """Add a Netlink message header to a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L503 Adds or overwrites the Netlink message header in an existing message object. Positional arguments: n -- Netlink message (nl_msg...
python
def nlmsg_put(n, pid, seq, type_, payload, flags): """Add a Netlink message header to a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L503 Adds or overwrites the Netlink message header in an existing message object. Positional arguments: n -- Netlink message (nl_msg...
[ "def", "nlmsg_put", "(", "n", ",", "pid", ",", "seq", ",", "type_", ",", "payload", ",", "flags", ")", ":", "if", "n", ".", "nm_nlh", ".", "nlmsg_len", "<", "libnl", ".", "linux_private", ".", "netlink", ".", "NLMSG_HDRLEN", ":", "raise", "BUG", "nlh...
Add a Netlink message header to a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L503 Adds or overwrites the Netlink message header in an existing message object. Positional arguments: n -- Netlink message (nl_msg class instance). pid -- Netlink process id or NL_AUTO...
[ "Add", "a", "Netlink", "message", "header", "to", "a", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L345-L377
42,804
Robpol86/libnl
libnl/msg.py
nl_nlmsg_flags2str
def nl_nlmsg_flags2str(flags, buf, _=None): """Netlink Message Flags Translations. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L664 Positional arguments: flags -- integer. buf -- bytearray(). Keyword arguments: _ -- unused. Returns: Reference to `buf`. """ ...
python
def nl_nlmsg_flags2str(flags, buf, _=None): """Netlink Message Flags Translations. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L664 Positional arguments: flags -- integer. buf -- bytearray(). Keyword arguments: _ -- unused. Returns: Reference to `buf`. """ ...
[ "def", "nl_nlmsg_flags2str", "(", "flags", ",", "buf", ",", "_", "=", "None", ")", ":", "del", "buf", "[", ":", "]", "all_flags", "=", "(", "(", "'REQUEST'", ",", "libnl", ".", "linux_private", ".", "netlink", ".", "NLM_F_REQUEST", ")", ",", "(", "'M...
Netlink Message Flags Translations. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L664 Positional arguments: flags -- integer. buf -- bytearray(). Keyword arguments: _ -- unused. Returns: Reference to `buf`.
[ "Netlink", "Message", "Flags", "Translations", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L445-L483
42,805
Robpol86/libnl
libnl/msg.py
dump_hex
def dump_hex(ofd, start, len_, prefix=0): """Convert `start` to hex and logs it, 16 bytes per log statement. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L760 Positional arguments: ofd -- function to call with arguments similar to `logging.debug`. start -- bytearray() or bytearray_p...
python
def dump_hex(ofd, start, len_, prefix=0): """Convert `start` to hex and logs it, 16 bytes per log statement. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L760 Positional arguments: ofd -- function to call with arguments similar to `logging.debug`. start -- bytearray() or bytearray_p...
[ "def", "dump_hex", "(", "ofd", ",", "start", ",", "len_", ",", "prefix", "=", "0", ")", ":", "prefix_whitespaces", "=", "' '", "*", "prefix", "limit", "=", "16", "-", "(", "prefix", "*", "2", ")", "start_", "=", "start", "[", ":", "len_", "]", "...
Convert `start` to hex and logs it, 16 bytes per log statement. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L760 Positional arguments: ofd -- function to call with arguments similar to `logging.debug`. start -- bytearray() or bytearray_ptr() instance. len_ -- size of `start` (integ...
[ "Convert", "start", "to", "hex", "and", "logs", "it", "16", "bytes", "per", "log", "statement", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L486-L510
42,806
Robpol86/libnl
libnl/msg.py
nl_msg_dump
def nl_msg_dump(msg, ofd=_LOGGER.debug): """Dump message in human readable format to callable. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L970 Positional arguments: msg -- message to print (nl_msg class instance). Keyword arguments: ofd -- function to call with arguments simi...
python
def nl_msg_dump(msg, ofd=_LOGGER.debug): """Dump message in human readable format to callable. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L970 Positional arguments: msg -- message to print (nl_msg class instance). Keyword arguments: ofd -- function to call with arguments simi...
[ "def", "nl_msg_dump", "(", "msg", ",", "ofd", "=", "_LOGGER", ".", "debug", ")", ":", "hdr", "=", "nlmsg_hdr", "(", "msg", ")", "ofd", "(", "'-------------------------- BEGIN NETLINK MESSAGE ---------------------------'", ")", "ofd", "(", "' [NETLINK HEADER] %d oct...
Dump message in human readable format to callable. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L970 Positional arguments: msg -- message to print (nl_msg class instance). Keyword arguments: ofd -- function to call with arguments similar to `logging.debug`.
[ "Dump", "message", "in", "human", "readable", "format", "to", "callable", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L683-L706
42,807
Robpol86/libnl
libnl/object.py
nl_object_alloc
def nl_object_alloc(ops): """Allocate a new object of kind specified by the operations handle. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/object.c#L54 Positional arguments: ops -- cache operations handle (nl_object_ops class instance). Returns: New nl_object class instance or None....
python
def nl_object_alloc(ops): """Allocate a new object of kind specified by the operations handle. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/object.c#L54 Positional arguments: ops -- cache operations handle (nl_object_ops class instance). Returns: New nl_object class instance or None....
[ "def", "nl_object_alloc", "(", "ops", ")", ":", "new", "=", "nl_object", "(", ")", "nl_init_list_head", "(", "new", ".", "ce_list", ")", "new", ".", "ce_ops", "=", "ops", "if", "ops", ".", "oo_constructor", ":", "ops", ".", "oo_constructor", "(", "new", ...
Allocate a new object of kind specified by the operations handle. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/object.c#L54 Positional arguments: ops -- cache operations handle (nl_object_ops class instance). Returns: New nl_object class instance or None.
[ "Allocate", "a", "new", "object", "of", "kind", "specified", "by", "the", "operations", "handle", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/object.py#L19-L36
42,808
Robpol86/libnl
libnl/genl/mngt.py
genl_register_family
def genl_register_family(ops): """Register Generic Netlink family and associated commands. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L164 Registers the specified Generic Netlink family definition together with all associated commands. After registration, received Generic Netlin...
python
def genl_register_family(ops): """Register Generic Netlink family and associated commands. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L164 Registers the specified Generic Netlink family definition together with all associated commands. After registration, received Generic Netlin...
[ "def", "genl_register_family", "(", "ops", ")", ":", "if", "not", "ops", ".", "o_name", "or", "(", "ops", ".", "o_cmds", "and", "ops", ".", "o_ncmds", "<=", "0", ")", ":", "return", "-", "NLE_INVAL", "if", "ops", ".", "o_id", "and", "lookup_family", ...
Register Generic Netlink family and associated commands. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L164 Registers the specified Generic Netlink family definition together with all associated commands. After registration, received Generic Netlink messages can be passed to genl_handl...
[ "Register", "Generic", "Netlink", "family", "and", "associated", "commands", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/mngt.py#L206-L232
42,809
Robpol86/libnl
libnl/genl/mngt.py
genl_register
def genl_register(ops): """Register Generic Netlink family backed cache. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L241 Same as genl_register_family() but additionally registers the specified cache operations using nl_cache_mngt_register() and associates it with the Generic Net...
python
def genl_register(ops): """Register Generic Netlink family backed cache. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L241 Same as genl_register_family() but additionally registers the specified cache operations using nl_cache_mngt_register() and associates it with the Generic Net...
[ "def", "genl_register", "(", "ops", ")", ":", "if", "ops", ".", "co_protocol", "!=", "NETLINK_GENERIC", ":", "return", "-", "NLE_PROTO_MISMATCH", "if", "ops", ".", "co_hdrsize", "<", "GENL_HDRSIZE", "(", "0", ")", ":", "return", "-", "NLE_INVAL", "if", "op...
Register Generic Netlink family backed cache. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L241 Same as genl_register_family() but additionally registers the specified cache operations using nl_cache_mngt_register() and associates it with the Generic Netlink family. Positional ar...
[ "Register", "Generic", "Netlink", "family", "backed", "cache", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/mngt.py#L235-L265
42,810
joeferraro/mm
mm/request.py
MavensMateRequestHandler.__setup_connection
def __setup_connection(self): """ each operation requested represents a session the session holds information about the plugin running it and establishes a project object """ if self.payload != None and type(self.payload) is dict and 'settings' in ...
python
def __setup_connection(self): """ each operation requested represents a session the session holds information about the plugin running it and establishes a project object """ if self.payload != None and type(self.payload) is dict and 'settings' in ...
[ "def", "__setup_connection", "(", "self", ")", ":", "if", "self", ".", "payload", "!=", "None", "and", "type", "(", "self", ".", "payload", ")", "is", "dict", "and", "'settings'", "in", "self", ".", "payload", ":", "config", ".", "plugin_client_settings", ...
each operation requested represents a session the session holds information about the plugin running it and establishes a project object
[ "each", "operation", "requested", "represents", "a", "session", "the", "session", "holds", "information", "about", "the", "plugin", "running", "it", "and", "establishes", "a", "project", "object" ]
43dce48a2249faab4d872c228ada9fbdbeec147b
https://github.com/joeferraro/mm/blob/43dce48a2249faab4d872c228ada9fbdbeec147b/mm/request.py#L45-L62
42,811
joeferraro/mm
mm/request.py
MavensMateRequestHandler.execute
def execute(self): """ Executes requested command """ try: self.__setup_connection() #if the arg switch argument is included, the request is to launch the out of box #MavensMate UI, so we generate the HTML for the UI and launch the process ...
python
def execute(self): """ Executes requested command """ try: self.__setup_connection() #if the arg switch argument is included, the request is to launch the out of box #MavensMate UI, so we generate the HTML for the UI and launch the process ...
[ "def", "execute", "(", "self", ")", ":", "try", ":", "self", ".", "__setup_connection", "(", ")", "#if the arg switch argument is included, the request is to launch the out of box", "#MavensMate UI, so we generate the HTML for the UI and launch the process", "#example: mm -o new_projec...
Executes requested command
[ "Executes", "requested", "command" ]
43dce48a2249faab4d872c228ada9fbdbeec147b
https://github.com/joeferraro/mm/blob/43dce48a2249faab4d872c228ada9fbdbeec147b/mm/request.py#L64-L95
42,812
dvdme/forecastiopy
forecastiopy/FIOAlerts.py
FIOAlerts.get_alert
def get_alert(self, alert): """ Recieves a day as an argument and returns the prediction for that alert if is available. If not, function will return None. """ if alert > self.alerts_count() or self.alerts_count() is None: return None else: return ...
python
def get_alert(self, alert): """ Recieves a day as an argument and returns the prediction for that alert if is available. If not, function will return None. """ if alert > self.alerts_count() or self.alerts_count() is None: return None else: return ...
[ "def", "get_alert", "(", "self", ",", "alert", ")", ":", "if", "alert", ">", "self", ".", "alerts_count", "(", ")", "or", "self", ".", "alerts_count", "(", ")", "is", "None", ":", "return", "None", "else", ":", "return", "self", ".", "get", "(", ")...
Recieves a day as an argument and returns the prediction for that alert if is available. If not, function will return None.
[ "Recieves", "a", "day", "as", "an", "argument", "and", "returns", "the", "prediction", "for", "that", "alert", "if", "is", "available", ".", "If", "not", "function", "will", "return", "None", "." ]
3cc81a078da655369b8ba3ac416f8b58f7293b4e
https://github.com/dvdme/forecastiopy/blob/3cc81a078da655369b8ba3ac416f8b58f7293b4e/forecastiopy/FIOAlerts.py#L36-L44
42,813
dvdme/forecastiopy
forecastiopy/ForecastIO.py
ForecastIO.get_forecast
def get_forecast(self, latitude, longitude): """ Gets the weather data from darksky api and stores it in the respective dictionaries if available. This function should be used to fetch weather information. """ reply = self.http_get(self.url_builder(latitude, longitude)) ...
python
def get_forecast(self, latitude, longitude): """ Gets the weather data from darksky api and stores it in the respective dictionaries if available. This function should be used to fetch weather information. """ reply = self.http_get(self.url_builder(latitude, longitude)) ...
[ "def", "get_forecast", "(", "self", ",", "latitude", ",", "longitude", ")", ":", "reply", "=", "self", ".", "http_get", "(", "self", ".", "url_builder", "(", "latitude", ",", "longitude", ")", ")", "self", ".", "forecast", "=", "json", ".", "loads", "(...
Gets the weather data from darksky api and stores it in the respective dictionaries if available. This function should be used to fetch weather information.
[ "Gets", "the", "weather", "data", "from", "darksky", "api", "and", "stores", "it", "in", "the", "respective", "dictionaries", "if", "available", ".", "This", "function", "should", "be", "used", "to", "fetch", "weather", "information", "." ]
3cc81a078da655369b8ba3ac416f8b58f7293b4e
https://github.com/dvdme/forecastiopy/blob/3cc81a078da655369b8ba3ac416f8b58f7293b4e/forecastiopy/ForecastIO.py#L88-L98
42,814
dvdme/forecastiopy
forecastiopy/ForecastIO.py
ForecastIO.get_forecast_fromstr
def get_forecast_fromstr(self, reply): """ Gets the weather data from a darksky api response string and stores it in the respective dictionaries if available. This function should be used to fetch weather information. """ self.forecast = json.loads(reply) for ite...
python
def get_forecast_fromstr(self, reply): """ Gets the weather data from a darksky api response string and stores it in the respective dictionaries if available. This function should be used to fetch weather information. """ self.forecast = json.loads(reply) for ite...
[ "def", "get_forecast_fromstr", "(", "self", ",", "reply", ")", ":", "self", ".", "forecast", "=", "json", ".", "loads", "(", "reply", ")", "for", "item", "in", "self", ".", "forecast", ".", "keys", "(", ")", ":", "setattr", "(", "self", ",", "item", ...
Gets the weather data from a darksky api response string and stores it in the respective dictionaries if available. This function should be used to fetch weather information.
[ "Gets", "the", "weather", "data", "from", "a", "darksky", "api", "response", "string", "and", "stores", "it", "in", "the", "respective", "dictionaries", "if", "available", ".", "This", "function", "should", "be", "used", "to", "fetch", "weather", "information"...
3cc81a078da655369b8ba3ac416f8b58f7293b4e
https://github.com/dvdme/forecastiopy/blob/3cc81a078da655369b8ba3ac416f8b58f7293b4e/forecastiopy/ForecastIO.py#L100-L109
42,815
dvdme/forecastiopy
forecastiopy/ForecastIO.py
ForecastIO.url_builder
def url_builder(self, latitude, longitude): """ This function is used to build the correct url to make the request to the forecast.io api. Recieves the latitude and the longitude. Return a string with the url. """ try: float(latitude) float...
python
def url_builder(self, latitude, longitude): """ This function is used to build the correct url to make the request to the forecast.io api. Recieves the latitude and the longitude. Return a string with the url. """ try: float(latitude) float...
[ "def", "url_builder", "(", "self", ",", "latitude", ",", "longitude", ")", ":", "try", ":", "float", "(", "latitude", ")", "float", "(", "longitude", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "'Latitude (%s) and Longitude (%s) must be a float num...
This function is used to build the correct url to make the request to the forecast.io api. Recieves the latitude and the longitude. Return a string with the url.
[ "This", "function", "is", "used", "to", "build", "the", "correct", "url", "to", "make", "the", "request", "to", "the", "forecast", ".", "io", "api", ".", "Recieves", "the", "latitude", "and", "the", "longitude", ".", "Return", "a", "string", "with", "the...
3cc81a078da655369b8ba3ac416f8b58f7293b4e
https://github.com/dvdme/forecastiopy/blob/3cc81a078da655369b8ba3ac416f8b58f7293b4e/forecastiopy/ForecastIO.py#L111-L149
42,816
dvdme/forecastiopy
forecastiopy/ForecastIO.py
ForecastIO.http_get
def http_get(self, request_url): """ This function recieves the request url and it is used internally to get the information via http. Returns the response content. Raises Timeout, TooManyRedirects, RequestException. Raises KeyError if headers are not present. Rai...
python
def http_get(self, request_url): """ This function recieves the request url and it is used internally to get the information via http. Returns the response content. Raises Timeout, TooManyRedirects, RequestException. Raises KeyError if headers are not present. Rai...
[ "def", "http_get", "(", "self", ",", "request_url", ")", ":", "try", ":", "headers", "=", "{", "'Accept-Encoding'", ":", "'gzip, deflate'", "}", "response", "=", "requests", ".", "get", "(", "request_url", ",", "headers", "=", "headers", ")", "except", "re...
This function recieves the request url and it is used internally to get the information via http. Returns the response content. Raises Timeout, TooManyRedirects, RequestException. Raises KeyError if headers are not present. Raises HTTPError if responde code is not 200.
[ "This", "function", "recieves", "the", "request", "url", "and", "it", "is", "used", "internally", "to", "get", "the", "information", "via", "http", ".", "Returns", "the", "response", "content", ".", "Raises", "Timeout", "TooManyRedirects", "RequestException", "....
3cc81a078da655369b8ba3ac416f8b58f7293b4e
https://github.com/dvdme/forecastiopy/blob/3cc81a078da655369b8ba3ac416f8b58f7293b4e/forecastiopy/ForecastIO.py#L160-L205
42,817
zeehio/parmap
parmap/parmap.py
_map_or_starmap
def _map_or_starmap(function, iterable, args, kwargs, map_or_starmap): """ Shared function between parmap.map and parmap.starmap. Refer to those functions for details. """ arg_newarg = (("parallel", "pm_parallel"), ("chunksize", "pm_chunksize"), ("pool", "pm_pool"), ("processes", "...
python
def _map_or_starmap(function, iterable, args, kwargs, map_or_starmap): """ Shared function between parmap.map and parmap.starmap. Refer to those functions for details. """ arg_newarg = (("parallel", "pm_parallel"), ("chunksize", "pm_chunksize"), ("pool", "pm_pool"), ("processes", "...
[ "def", "_map_or_starmap", "(", "function", ",", "iterable", ",", "args", ",", "kwargs", ",", "map_or_starmap", ")", ":", "arg_newarg", "=", "(", "(", "\"parallel\"", ",", "\"pm_parallel\"", ")", ",", "(", "\"chunksize\"", ",", "\"pm_chunksize\"", ")", ",", "...
Shared function between parmap.map and parmap.starmap. Refer to those functions for details.
[ "Shared", "function", "between", "parmap", ".", "map", "and", "parmap", ".", "starmap", ".", "Refer", "to", "those", "functions", "for", "details", "." ]
368b77e1a49ff30aef9de2274ad430ad43a3f617
https://github.com/zeehio/parmap/blob/368b77e1a49ff30aef9de2274ad430ad43a3f617/parmap/parmap.py#L220-L273
42,818
zeehio/parmap
parmap/parmap.py
_map_or_starmap_async
def _map_or_starmap_async(function, iterable, args, kwargs, map_or_starmap): """ Shared function between parmap.map_async and parmap.starmap_async. Refer to those functions for details. """ arg_newarg = (("parallel", "pm_parallel"), ("chunksize", "pm_chunksize"), ("pool", "pm_pool"...
python
def _map_or_starmap_async(function, iterable, args, kwargs, map_or_starmap): """ Shared function between parmap.map_async and parmap.starmap_async. Refer to those functions for details. """ arg_newarg = (("parallel", "pm_parallel"), ("chunksize", "pm_chunksize"), ("pool", "pm_pool"...
[ "def", "_map_or_starmap_async", "(", "function", ",", "iterable", ",", "args", ",", "kwargs", ",", "map_or_starmap", ")", ":", "arg_newarg", "=", "(", "(", "\"parallel\"", ",", "\"pm_parallel\"", ")", ",", "(", "\"chunksize\"", ",", "\"pm_chunksize\"", ")", ",...
Shared function between parmap.map_async and parmap.starmap_async. Refer to those functions for details.
[ "Shared", "function", "between", "parmap", ".", "map_async", "and", "parmap", ".", "starmap_async", ".", "Refer", "to", "those", "functions", "for", "details", "." ]
368b77e1a49ff30aef9de2274ad430ad43a3f617
https://github.com/zeehio/parmap/blob/368b77e1a49ff30aef9de2274ad430ad43a3f617/parmap/parmap.py#L386-L428
42,819
zeehio/parmap
parmap/parmap.py
map_async
def map_async(function, iterable, *args, **kwargs): """This function is the multiprocessing.Pool.map_async version that supports multiple arguments. >>> [function(x, args[0], args[1],...) for x in iterable] :param pm_parallel: Force parallelization on/off. If False, the ...
python
def map_async(function, iterable, *args, **kwargs): """This function is the multiprocessing.Pool.map_async version that supports multiple arguments. >>> [function(x, args[0], args[1],...) for x in iterable] :param pm_parallel: Force parallelization on/off. If False, the ...
[ "def", "map_async", "(", "function", ",", "iterable", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_map_or_starmap_async", "(", "function", ",", "iterable", ",", "args", ",", "kwargs", ",", "\"map\"", ")" ]
This function is the multiprocessing.Pool.map_async version that supports multiple arguments. >>> [function(x, args[0], args[1],...) for x in iterable] :param pm_parallel: Force parallelization on/off. If False, the function won't be asynchronous. :type pm_paral...
[ "This", "function", "is", "the", "multiprocessing", ".", "Pool", ".", "map_async", "version", "that", "supports", "multiple", "arguments", "." ]
368b77e1a49ff30aef9de2274ad430ad43a3f617
https://github.com/zeehio/parmap/blob/368b77e1a49ff30aef9de2274ad430ad43a3f617/parmap/parmap.py#L431-L453
42,820
zeehio/parmap
parmap/parmap.py
starmap_async
def starmap_async(function, iterables, *args, **kwargs): """This function is the multiprocessing.Pool.starmap_async version that supports multiple arguments. >>> return ([function(x1,x2,x3,..., args[0], args[1],...) for >>> (x1,x2,x3...) in iterable]) :param pm_parall...
python
def starmap_async(function, iterables, *args, **kwargs): """This function is the multiprocessing.Pool.starmap_async version that supports multiple arguments. >>> return ([function(x1,x2,x3,..., args[0], args[1],...) for >>> (x1,x2,x3...) in iterable]) :param pm_parall...
[ "def", "starmap_async", "(", "function", ",", "iterables", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_map_or_starmap_async", "(", "function", ",", "iterables", ",", "args", ",", "kwargs", ",", "\"starmap\"", ")" ]
This function is the multiprocessing.Pool.starmap_async version that supports multiple arguments. >>> return ([function(x1,x2,x3,..., args[0], args[1],...) for >>> (x1,x2,x3...) in iterable]) :param pm_parallel: Force parallelization on/off. If False, the ...
[ "This", "function", "is", "the", "multiprocessing", ".", "Pool", ".", "starmap_async", "version", "that", "supports", "multiple", "arguments", "." ]
368b77e1a49ff30aef9de2274ad430ad43a3f617
https://github.com/zeehio/parmap/blob/368b77e1a49ff30aef9de2274ad430ad43a3f617/parmap/parmap.py#L456-L478
42,821
iclab/centinel
centinel/primitives/dnslib.py
lookup_domain
def lookup_domain(domain, nameservers=[], rtype="A", exclude_nameservers=[], timeout=2): """Wrapper for DNSQuery method""" dns_exp = DNSQuery(domains=[domain], nameservers=nameservers, rtype=rtype, exclude_nameservers=exclude_nameservers, timeout=timeout) return dns_...
python
def lookup_domain(domain, nameservers=[], rtype="A", exclude_nameservers=[], timeout=2): """Wrapper for DNSQuery method""" dns_exp = DNSQuery(domains=[domain], nameservers=nameservers, rtype=rtype, exclude_nameservers=exclude_nameservers, timeout=timeout) return dns_...
[ "def", "lookup_domain", "(", "domain", ",", "nameservers", "=", "[", "]", ",", "rtype", "=", "\"A\"", ",", "exclude_nameservers", "=", "[", "]", ",", "timeout", "=", "2", ")", ":", "dns_exp", "=", "DNSQuery", "(", "domains", "=", "[", "domain", "]", ...
Wrapper for DNSQuery method
[ "Wrapper", "for", "DNSQuery", "method" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/dnslib.py#L21-L26
42,822
iclab/centinel
centinel/primitives/dnslib.py
parse_out_ips
def parse_out_ips(message): """Given a message, parse out the ips in the answer""" ips = [] for entry in message.answer: for rdata in entry.items: ips.append(rdata.to_text()) return ips
python
def parse_out_ips(message): """Given a message, parse out the ips in the answer""" ips = [] for entry in message.answer: for rdata in entry.items: ips.append(rdata.to_text()) return ips
[ "def", "parse_out_ips", "(", "message", ")", ":", "ips", "=", "[", "]", "for", "entry", "in", "message", ".", "answer", ":", "for", "rdata", "in", "entry", ".", "items", ":", "ips", ".", "append", "(", "rdata", ".", "to_text", "(", ")", ")", "retur...
Given a message, parse out the ips in the answer
[ "Given", "a", "message", "parse", "out", "the", "ips", "in", "the", "answer" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/dnslib.py#L264-L271
42,823
iclab/centinel
centinel/primitives/dnslib.py
DNSQuery.send_chaos_queries
def send_chaos_queries(self): """Send chaos queries to identify the DNS server and its manufacturer Note: we send 2 queries for BIND stuff per RFC 4892 and 1 query per RFC 6304 Note: we are not waiting on a second response because we shouldn't be getting injected packets here ...
python
def send_chaos_queries(self): """Send chaos queries to identify the DNS server and its manufacturer Note: we send 2 queries for BIND stuff per RFC 4892 and 1 query per RFC 6304 Note: we are not waiting on a second response because we shouldn't be getting injected packets here ...
[ "def", "send_chaos_queries", "(", "self", ")", ":", "names", "=", "[", "\"HOSTNAME.BIND\"", ",", "\"VERSION.BIND\"", ",", "\"ID.SERVER\"", "]", "self", ".", "results", "=", "{", "'exp-name'", ":", "\"chaos-queries\"", "}", "for", "name", "in", "names", ":", ...
Send chaos queries to identify the DNS server and its manufacturer Note: we send 2 queries for BIND stuff per RFC 4892 and 1 query per RFC 6304 Note: we are not waiting on a second response because we shouldn't be getting injected packets here
[ "Send", "chaos", "queries", "to", "identify", "the", "DNS", "server", "and", "its", "manufacturer" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/dnslib.py#L77-L105
42,824
iclab/centinel
centinel/primitives/dnslib.py
DNSQuery.lookup_domains
def lookup_domains(self): """More complex DNS primitive that looks up domains concurrently Note: if you want to lookup multiple domains, you should use this function """ thread_error = False thread_wait_timeout = 200 ind = 1 total_item_count = len(self.do...
python
def lookup_domains(self): """More complex DNS primitive that looks up domains concurrently Note: if you want to lookup multiple domains, you should use this function """ thread_error = False thread_wait_timeout = 200 ind = 1 total_item_count = len(self.do...
[ "def", "lookup_domains", "(", "self", ")", ":", "thread_error", "=", "False", "thread_wait_timeout", "=", "200", "ind", "=", "1", "total_item_count", "=", "len", "(", "self", ".", "domains", ")", "for", "domain", "in", "self", ".", "domains", ":", "for", ...
More complex DNS primitive that looks up domains concurrently Note: if you want to lookup multiple domains, you should use this function
[ "More", "complex", "DNS", "primitive", "that", "looks", "up", "domains", "concurrently" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/dnslib.py#L107-L157
42,825
iclab/centinel
centinel/command.py
Command.start
def start(self, timeout=None): """Start running the command""" self.thread.start() start_time = time.time() if not timeout: timeout = self.timeout # every second, check the condition of the thread and return # control to the user if appropriate while ...
python
def start(self, timeout=None): """Start running the command""" self.thread.start() start_time = time.time() if not timeout: timeout = self.timeout # every second, check the condition of the thread and return # control to the user if appropriate while ...
[ "def", "start", "(", "self", ",", "timeout", "=", "None", ")", ":", "self", ".", "thread", ".", "start", "(", ")", "start_time", "=", "time", ".", "time", "(", ")", "if", "not", "timeout", ":", "timeout", "=", "self", ".", "timeout", "# every second,...
Start running the command
[ "Start", "running", "the", "command" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/command.py#L49-L64
42,826
iclab/centinel
centinel/command.py
Command.stop
def stop(self, timeout=None): """Stop the given command""" if not timeout: timeout = self.timeout self.kill_switch() # Send the signal to all the process groups self.process.kill() self.thread.join(timeout) try: os.killpg(os.getpgid(self.p...
python
def stop(self, timeout=None): """Stop the given command""" if not timeout: timeout = self.timeout self.kill_switch() # Send the signal to all the process groups self.process.kill() self.thread.join(timeout) try: os.killpg(os.getpgid(self.p...
[ "def", "stop", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "self", ".", "timeout", "self", ".", "kill_switch", "(", ")", "# Send the signal to all the process groups", "self", ".", "process", ".", "kill", ...
Stop the given command
[ "Stop", "the", "given", "command" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/command.py#L66-L82
42,827
iclab/centinel
centinel/primitives/traceroute.py
traceroute_batch
def traceroute_batch(input_list, results={}, method="udp", cmd_arguments=None, delay_time=0.1, max_threads=100): """ This is a parallel version of the traceroute primitive. :param input_list: the input is a list of domain names :param method: the packet type used for traceroute, UD...
python
def traceroute_batch(input_list, results={}, method="udp", cmd_arguments=None, delay_time=0.1, max_threads=100): """ This is a parallel version of the traceroute primitive. :param input_list: the input is a list of domain names :param method: the packet type used for traceroute, UD...
[ "def", "traceroute_batch", "(", "input_list", ",", "results", "=", "{", "}", ",", "method", "=", "\"udp\"", ",", "cmd_arguments", "=", "None", ",", "delay_time", "=", "0.1", ",", "max_threads", "=", "100", ")", ":", "threads", "=", "[", "]", "thread_erro...
This is a parallel version of the traceroute primitive. :param input_list: the input is a list of domain names :param method: the packet type used for traceroute, UDP by default :param cmd_arguments: the list of arguments that need to be passed to traceroute. :param delay_time: ...
[ "This", "is", "a", "parallel", "version", "of", "the", "traceroute", "primitive", "." ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/traceroute.py#L148-L207
42,828
iclab/centinel
centinel/primitives/traceroute.py
_traceroute_callback
def _traceroute_callback(self, line, kill_switch): """ Callback function to handle traceroute. :param self: :param line: :param kill_switch: :return: """ line = line.lower() if "traceroute to" in line: self.started = True # need to run as root but not running as root. ...
python
def _traceroute_callback(self, line, kill_switch): """ Callback function to handle traceroute. :param self: :param line: :param kill_switch: :return: """ line = line.lower() if "traceroute to" in line: self.started = True # need to run as root but not running as root. ...
[ "def", "_traceroute_callback", "(", "self", ",", "line", ",", "kill_switch", ")", ":", "line", "=", "line", ".", "lower", "(", ")", "if", "\"traceroute to\"", "in", "line", ":", "self", ".", "started", "=", "True", "# need to run as root but not running as root....
Callback function to handle traceroute. :param self: :param line: :param kill_switch: :return:
[ "Callback", "function", "to", "handle", "traceroute", "." ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/traceroute.py#L210-L233
42,829
iclab/centinel
centinel/vpn/openvpn.py
OpenVPN.output_callback
def output_callback(self, line, kill_switch): """Set status of openvpn according to what we process""" self.notifications += line + "\n" if "Initialization Sequence Completed" in line: self.started = True if "ERROR:" in line or "Cannot resolve host address:" in line: ...
python
def output_callback(self, line, kill_switch): """Set status of openvpn according to what we process""" self.notifications += line + "\n" if "Initialization Sequence Completed" in line: self.started = True if "ERROR:" in line or "Cannot resolve host address:" in line: ...
[ "def", "output_callback", "(", "self", ",", "line", ",", "kill_switch", ")", ":", "self", ".", "notifications", "+=", "line", "+", "\"\\n\"", "if", "\"Initialization Sequence Completed\"", "in", "line", ":", "self", ".", "started", "=", "True", "if", "\"ERROR:...
Set status of openvpn according to what we process
[ "Set", "status", "of", "openvpn", "according", "to", "what", "we", "process" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/vpn/openvpn.py#L57-L66
42,830
iclab/centinel
centinel/client.py
Client.load_experiments
def load_experiments(self): """This function will return the list of experiments. """ logging.debug("Loading experiments.") # look for experiments in experiments directory exp_dir = self.config['dirs']['experiments_dir'] for path in glob.glob(os.path.join(exp_dir, '[!_]*....
python
def load_experiments(self): """This function will return the list of experiments. """ logging.debug("Loading experiments.") # look for experiments in experiments directory exp_dir = self.config['dirs']['experiments_dir'] for path in glob.glob(os.path.join(exp_dir, '[!_]*....
[ "def", "load_experiments", "(", "self", ")", ":", "logging", ".", "debug", "(", "\"Loading experiments.\"", ")", "# look for experiments in experiments directory", "exp_dir", "=", "self", ".", "config", "[", "'dirs'", "]", "[", "'experiments_dir'", "]", "for", "path...
This function will return the list of experiments.
[ "This", "function", "will", "return", "the", "list", "of", "experiments", "." ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/client.py#L83-L106
42,831
iclab/centinel
centinel/primitives/tcpdump.py
_tcpdump_callback
def _tcpdump_callback(self, line, kill_switch): """Callback function to handle tcpdump""" line = line.lower() if ("listening" in line) or ("reading" in line): self.started = True if ("no suitable device" in line): self.error = True self.kill_switch() if "by kernel" in line: ...
python
def _tcpdump_callback(self, line, kill_switch): """Callback function to handle tcpdump""" line = line.lower() if ("listening" in line) or ("reading" in line): self.started = True if ("no suitable device" in line): self.error = True self.kill_switch() if "by kernel" in line: ...
[ "def", "_tcpdump_callback", "(", "self", ",", "line", ",", "kill_switch", ")", ":", "line", "=", "line", ".", "lower", "(", ")", "if", "(", "\"listening\"", "in", "line", ")", "or", "(", "\"reading\"", "in", "line", ")", ":", "self", ".", "started", ...
Callback function to handle tcpdump
[ "Callback", "function", "to", "handle", "tcpdump" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/tcpdump.py#L78-L88
42,832
iclab/centinel
centinel/cli.py
_run
def _run(): """Entry point for package and cli uses""" args = parse_args() # parse custom parameters custom_meta = None if args.custom_meta: print "Adding custom parameters:" custom_meta = {} try: for item in args.custom_meta.split(','): key, val...
python
def _run(): """Entry point for package and cli uses""" args = parse_args() # parse custom parameters custom_meta = None if args.custom_meta: print "Adding custom parameters:" custom_meta = {} try: for item in args.custom_meta.split(','): key, val...
[ "def", "_run", "(", ")", ":", "args", "=", "parse_args", "(", ")", "# parse custom parameters", "custom_meta", "=", "None", "if", "args", ".", "custom_meta", ":", "print", "\"Adding custom parameters:\"", "custom_meta", "=", "{", "}", "try", ":", "for", "item"...
Entry point for package and cli uses
[ "Entry", "point", "for", "package", "and", "cli", "uses" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/cli.py#L114-L201
42,833
iclab/centinel
centinel/primitives/tls.py
get_fingerprint_batch
def get_fingerprint_batch(input_list, results={}, default_port=443, delay_time=0.5, max_threads=100): """ This is a parallel version of the TLS fingerprint primitive. :param input_list: the input is a list of host:ports. :param default_port: default port to use when no port sp...
python
def get_fingerprint_batch(input_list, results={}, default_port=443, delay_time=0.5, max_threads=100): """ This is a parallel version of the TLS fingerprint primitive. :param input_list: the input is a list of host:ports. :param default_port: default port to use when no port sp...
[ "def", "get_fingerprint_batch", "(", "input_list", ",", "results", "=", "{", "}", ",", "default_port", "=", "443", ",", "delay_time", "=", "0.5", ",", "max_threads", "=", "100", ")", ":", "threads", "=", "[", "]", "thread_error", "=", "False", "thread_wait...
This is a parallel version of the TLS fingerprint primitive. :param input_list: the input is a list of host:ports. :param default_port: default port to use when no port specified :param delay_time: delay before starting each thread :param max_threads: maximum number of concurrent threads :return:
[ "This", "is", "a", "parallel", "version", "of", "the", "TLS", "fingerprint", "primitive", "." ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/tls.py#L90-L157
42,834
iclab/centinel
centinel/primitives/http.py
meta_redirect
def meta_redirect(content): """ Returns redirecting URL if there is a HTML refresh meta tag, returns None otherwise :param content: HTML content """ decoded = content.decode("utf-8", errors="replace") try: soup = BeautifulSoup.BeautifulSoup(decoded) except Exception as e: ...
python
def meta_redirect(content): """ Returns redirecting URL if there is a HTML refresh meta tag, returns None otherwise :param content: HTML content """ decoded = content.decode("utf-8", errors="replace") try: soup = BeautifulSoup.BeautifulSoup(decoded) except Exception as e: ...
[ "def", "meta_redirect", "(", "content", ")", ":", "decoded", "=", "content", ".", "decode", "(", "\"utf-8\"", ",", "errors", "=", "\"replace\"", ")", "try", ":", "soup", "=", "BeautifulSoup", ".", "BeautifulSoup", "(", "decoded", ")", "except", "Exception", ...
Returns redirecting URL if there is a HTML refresh meta tag, returns None otherwise :param content: HTML content
[ "Returns", "redirecting", "URL", "if", "there", "is", "a", "HTML", "refresh", "meta", "tag", "returns", "None", "otherwise" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/http.py#L17-L43
42,835
iclab/centinel
centinel/primitives/http.py
_get_http_request
def _get_http_request(netloc, path="/", headers=None, ssl=False): """ Actually gets the http. Moved this to it's own private method since it is called several times for following redirects :param host: :param path: :param headers: :param ssl: :return: """ if ssl: port = ...
python
def _get_http_request(netloc, path="/", headers=None, ssl=False): """ Actually gets the http. Moved this to it's own private method since it is called several times for following redirects :param host: :param path: :param headers: :param ssl: :return: """ if ssl: port = ...
[ "def", "_get_http_request", "(", "netloc", ",", "path", "=", "\"/\"", ",", "headers", "=", "None", ",", "ssl", "=", "False", ")", ":", "if", "ssl", ":", "port", "=", "443", "else", ":", "port", "=", "80", "host", "=", "netloc", "if", "len", "(", ...
Actually gets the http. Moved this to it's own private method since it is called several times for following redirects :param host: :param path: :param headers: :param ssl: :return:
[ "Actually", "gets", "the", "http", ".", "Moved", "this", "to", "it", "s", "own", "private", "method", "since", "it", "is", "called", "several", "times", "for", "following", "redirects" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/http.py#L46-L98
42,836
iclab/centinel
centinel/primitives/http.py
get_requests_batch
def get_requests_batch(input_list, results={}, delay_time=0.5, max_threads=100): """ This is a parallel version of the HTTP GET primitive. :param input_list: the input is a list of either dictionaries containing query information, or just domain names (and NOT URLs). :param delay...
python
def get_requests_batch(input_list, results={}, delay_time=0.5, max_threads=100): """ This is a parallel version of the HTTP GET primitive. :param input_list: the input is a list of either dictionaries containing query information, or just domain names (and NOT URLs). :param delay...
[ "def", "get_requests_batch", "(", "input_list", ",", "results", "=", "{", "}", ",", "delay_time", "=", "0.5", ",", "max_threads", "=", "100", ")", ":", "threads", "=", "[", "]", "thread_error", "=", "False", "thread_wait_timeout", "=", "200", "ind", "=", ...
This is a parallel version of the HTTP GET primitive. :param input_list: the input is a list of either dictionaries containing query information, or just domain names (and NOT URLs). :param delay_time: delay before starting each thread :param max_threads: maximum number of concurrent...
[ "This", "is", "a", "parallel", "version", "of", "the", "HTTP", "GET", "primitive", "." ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/http.py#L244-L344
42,837
iclab/centinel
centinel/daemonize.py
create_script_for_location
def create_script_for_location(content, destination): """Create a script with the given content, mv it to the destination, and make it executable Parameters: content- the content to put in the script destination- the directory to copy to Note: due to constraints on os.rename, destination must ...
python
def create_script_for_location(content, destination): """Create a script with the given content, mv it to the destination, and make it executable Parameters: content- the content to put in the script destination- the directory to copy to Note: due to constraints on os.rename, destination must ...
[ "def", "create_script_for_location", "(", "content", ",", "destination", ")", ":", "temp", "=", "tempfile", ".", "NamedTemporaryFile", "(", "mode", "=", "'w'", ",", "delete", "=", "False", ")", "temp", ".", "write", "(", "content", ")", "temp", ".", "close...
Create a script with the given content, mv it to the destination, and make it executable Parameters: content- the content to put in the script destination- the directory to copy to Note: due to constraints on os.rename, destination must be an absolute path to a file, not just a directory
[ "Create", "a", "script", "with", "the", "given", "content", "mv", "it", "to", "the", "destination", "and", "make", "it", "executable" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/daemonize.py#L11-L29
42,838
iclab/centinel
centinel/daemonize.py
daemonize
def daemonize(package, bin_loc, user): """Create crontab entries to run centinel every hour and autoupdate every day Parameters: package- name of the currently installed package (will be used for autoupdate). If this parameter is None, the autoupdater will not be used bin_loc- loc...
python
def daemonize(package, bin_loc, user): """Create crontab entries to run centinel every hour and autoupdate every day Parameters: package- name of the currently installed package (will be used for autoupdate). If this parameter is None, the autoupdater will not be used bin_loc- loc...
[ "def", "daemonize", "(", "package", ",", "bin_loc", ",", "user", ")", ":", "path", "=", "\"/etc/cron.hourly/centinel-\"", "+", "user", "if", "user", "!=", "\"root\"", ":", "# create a script to run centinel every hour as the current user", "hourly", "=", "\"\"", ".", ...
Create crontab entries to run centinel every hour and autoupdate every day Parameters: package- name of the currently installed package (will be used for autoupdate). If this parameter is None, the autoupdater will not be used bin_loc- location of the centinel binary/script. Note...
[ "Create", "crontab", "entries", "to", "run", "centinel", "every", "hour", "and", "autoupdate", "every", "day" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/daemonize.py#L32-L79
42,839
iclab/centinel
centinel/vpn/hma.py
create_config_files
def create_config_files(directory): """Create all available VPN configuration files in the given directory Note: I am basically just following along with what their script client does """ # get the config file template template_url = ("https://securenetconnection.com/vpnconfig/" ...
python
def create_config_files(directory): """Create all available VPN configuration files in the given directory Note: I am basically just following along with what their script client does """ # get the config file template template_url = ("https://securenetconnection.com/vpnconfig/" ...
[ "def", "create_config_files", "(", "directory", ")", ":", "# get the config file template", "template_url", "=", "(", "\"https://securenetconnection.com/vpnconfig/\"", "\"openvpn-template.ovpn\"", ")", "resp", "=", "requests", ".", "get", "(", "template_url", ")", "resp", ...
Create all available VPN configuration files in the given directory Note: I am basically just following along with what their script client does
[ "Create", "all", "available", "VPN", "configuration", "files", "in", "the", "given", "directory" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/vpn/hma.py#L10-L56
42,840
iclab/centinel
centinel/backend.py
User.sync_scheduler
def sync_scheduler(self): """Download the scheduler.info file and perform a smart comparison with what we currently have so that we don't overwrite the last_run timestamp To do a smart comparison, we go over each entry in the server's scheduler file. If a scheduler entry is not ...
python
def sync_scheduler(self): """Download the scheduler.info file and perform a smart comparison with what we currently have so that we don't overwrite the last_run timestamp To do a smart comparison, we go over each entry in the server's scheduler file. If a scheduler entry is not ...
[ "def", "sync_scheduler", "(", "self", ")", ":", "# get the server scheduler.info file", "url", "=", "\"%s/%s/%s\"", "%", "(", "self", ".", "config", "[", "'server'", "]", "[", "'server_url'", "]", ",", "\"experiments\"", ",", "\"scheduler.info\"", ")", "try", ":...
Download the scheduler.info file and perform a smart comparison with what we currently have so that we don't overwrite the last_run timestamp To do a smart comparison, we go over each entry in the server's scheduler file. If a scheduler entry is not present in the server copy, w...
[ "Download", "the", "scheduler", ".", "info", "file", "and", "perform", "a", "smart", "comparison", "with", "what", "we", "currently", "have", "so", "that", "we", "don", "t", "overwrite", "the", "last_run", "timestamp" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/backend.py#L105-L170
42,841
iclab/centinel
centinel/backend.py
User.informed_consent
def informed_consent(self): """Create a URL for the user to give their consent through""" if self.typeable_handle is None: consent_url = [self.config['server']['server_url'], "/get_initial_consent?username="] consent_url.append(urlsafe_b64encode(self.us...
python
def informed_consent(self): """Create a URL for the user to give their consent through""" if self.typeable_handle is None: consent_url = [self.config['server']['server_url'], "/get_initial_consent?username="] consent_url.append(urlsafe_b64encode(self.us...
[ "def", "informed_consent", "(", "self", ")", ":", "if", "self", ".", "typeable_handle", "is", "None", ":", "consent_url", "=", "[", "self", ".", "config", "[", "'server'", "]", "[", "'server_url'", "]", ",", "\"/get_initial_consent?username=\"", "]", "consent_...
Create a URL for the user to give their consent through
[ "Create", "a", "URL", "for", "the", "user", "to", "give", "their", "consent", "through" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/backend.py#L277-L292
42,842
iclab/centinel
centinel/vpn/cli.py
return_abs_path
def return_abs_path(directory, path): """ Unfortunately, Python is not smart enough to return an absolute path with tilde expansion, so I writing functionality to do this :param directory: :param path: :return: """ if directory is None or path is None: return directory = os....
python
def return_abs_path(directory, path): """ Unfortunately, Python is not smart enough to return an absolute path with tilde expansion, so I writing functionality to do this :param directory: :param path: :return: """ if directory is None or path is None: return directory = os....
[ "def", "return_abs_path", "(", "directory", ",", "path", ")", ":", "if", "directory", "is", "None", "or", "path", "is", "None", ":", "return", "directory", "=", "os", ".", "path", ".", "expanduser", "(", "directory", ")", "return", "os", ".", "path", "...
Unfortunately, Python is not smart enough to return an absolute path with tilde expansion, so I writing functionality to do this :param directory: :param path: :return:
[ "Unfortunately", "Python", "is", "not", "smart", "enough", "to", "return", "an", "absolute", "path", "with", "tilde", "expansion", "so", "I", "writing", "functionality", "to", "do", "this" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/vpn/cli.py#L369-L381
42,843
iclab/centinel
centinel/vpn/cli.py
_run
def _run(): """Entry point for all uses of centinel""" args = parse_args() # register signal handler signal.signal(signal.SIGTERM, signal_handler) signal.signal(signal.SIGINT, signal_handler) # set up logging log_formatter = logging.Formatter("%(asctime)s %(filename)s(line %(lineno)d) " ...
python
def _run(): """Entry point for all uses of centinel""" args = parse_args() # register signal handler signal.signal(signal.SIGTERM, signal_handler) signal.signal(signal.SIGINT, signal_handler) # set up logging log_formatter = logging.Formatter("%(asctime)s %(filename)s(line %(lineno)d) " ...
[ "def", "_run", "(", ")", ":", "args", "=", "parse_args", "(", ")", "# register signal handler", "signal", ".", "signal", "(", "signal", ".", "SIGTERM", ",", "signal_handler", ")", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "signal_handler", ...
Entry point for all uses of centinel
[ "Entry", "point", "for", "all", "uses", "of", "centinel" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/vpn/cli.py#L508-L566
42,844
iclab/centinel
centinel/config.py
Configuration.parse_config
def parse_config(self, config_file): """ Given a configuration file, read in and interpret the results :param config_file: :return: """ with open(config_file, 'r') as f: config = json.load(f) self.params = config if self.params['proxy']['prox...
python
def parse_config(self, config_file): """ Given a configuration file, read in and interpret the results :param config_file: :return: """ with open(config_file, 'r') as f: config = json.load(f) self.params = config if self.params['proxy']['prox...
[ "def", "parse_config", "(", "self", ",", "config_file", ")", ":", "with", "open", "(", "config_file", ",", "'r'", ")", "as", "f", ":", "config", "=", "json", ".", "load", "(", "f", ")", "self", ".", "params", "=", "config", "if", "self", ".", "para...
Given a configuration file, read in and interpret the results :param config_file: :return:
[ "Given", "a", "configuration", "file", "read", "in", "and", "interpret", "the", "results" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/config.py#L82-L95
42,845
iclab/centinel
centinel/config.py
Configuration.update
def update(self, old, backup_path=None): """ Update the old configuration file with new values. :param old: old configuration to update. :param backup_path: path to write a backup of the old config file. :return: """ for category in old.params.keys(): ...
python
def update(self, old, backup_path=None): """ Update the old configuration file with new values. :param old: old configuration to update. :param backup_path: path to write a backup of the old config file. :return: """ for category in old.params.keys(): ...
[ "def", "update", "(", "self", ",", "old", ",", "backup_path", "=", "None", ")", ":", "for", "category", "in", "old", ".", "params", ".", "keys", "(", ")", ":", "for", "parameter", "in", "old", ".", "params", "[", "category", "]", ".", "keys", "(", ...
Update the old configuration file with new values. :param old: old configuration to update. :param backup_path: path to write a backup of the old config file. :return:
[ "Update", "the", "old", "configuration", "file", "with", "new", "values", "." ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/config.py#L97-L132
42,846
iclab/centinel
centinel/config.py
Configuration.write_out_config
def write_out_config(self, config_file): """ Write out the configuration file :param config_file: :return: Note: this will erase all comments from the config file """ with open(config_file, 'w') as f: json.dump(self.params, f, indent=2, ...
python
def write_out_config(self, config_file): """ Write out the configuration file :param config_file: :return: Note: this will erase all comments from the config file """ with open(config_file, 'w') as f: json.dump(self.params, f, indent=2, ...
[ "def", "write_out_config", "(", "self", ",", "config_file", ")", ":", "with", "open", "(", "config_file", ",", "'w'", ")", "as", "f", ":", "json", ".", "dump", "(", "self", ".", "params", ",", "f", ",", "indent", "=", "2", ",", "separators", "=", "...
Write out the configuration file :param config_file: :return: Note: this will erase all comments from the config file
[ "Write", "out", "the", "configuration", "file" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/config.py#L134-L146
42,847
iclab/centinel
centinel/primitives/headless_browser.py
HeadlessBrowser.divide_url
def divide_url(self, url): """ divide url into host and path two parts """ if 'https://' in url: host = url[8:].split('/')[0] path = url[8 + len(host):] elif 'http://' in url: host = url[7:].split('/')[0] path = url[7 + len(host):] ...
python
def divide_url(self, url): """ divide url into host and path two parts """ if 'https://' in url: host = url[8:].split('/')[0] path = url[8 + len(host):] elif 'http://' in url: host = url[7:].split('/')[0] path = url[7 + len(host):] ...
[ "def", "divide_url", "(", "self", ",", "url", ")", ":", "if", "'https://'", "in", "url", ":", "host", "=", "url", "[", "8", ":", "]", ".", "split", "(", "'/'", ")", "[", "0", "]", "path", "=", "url", "[", "8", "+", "len", "(", "host", ")", ...
divide url into host and path two parts
[ "divide", "url", "into", "host", "and", "path", "two", "parts" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/primitives/headless_browser.py#L145-L158
42,848
iclab/centinel
centinel/utils.py
hash_folder
def hash_folder(folder, regex='[!_]*'): """ Get the md5 sum of each file in the folder and return to the user :param folder: the folder to compute the sums over :param regex: an expression to limit the files we match :return: Note: by default we will hash every file in the folder Note: we...
python
def hash_folder(folder, regex='[!_]*'): """ Get the md5 sum of each file in the folder and return to the user :param folder: the folder to compute the sums over :param regex: an expression to limit the files we match :return: Note: by default we will hash every file in the folder Note: we...
[ "def", "hash_folder", "(", "folder", ",", "regex", "=", "'[!_]*'", ")", ":", "file_hashes", "=", "{", "}", "for", "path", "in", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "folder", ",", "regex", ")", ")", ":", "# exclude folders",...
Get the md5 sum of each file in the folder and return to the user :param folder: the folder to compute the sums over :param regex: an expression to limit the files we match :return: Note: by default we will hash every file in the folder Note: we will not match anything that starts with an undersc...
[ "Get", "the", "md5", "sum", "of", "each", "file", "in", "the", "folder", "and", "return", "to", "the", "user" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/utils.py#L31-L55
42,849
iclab/centinel
centinel/utils.py
compute_files_to_download
def compute_files_to_download(client_hashes, server_hashes): """ Given a dictionary of file hashes from the client and the server, specify which files should be downloaded from the server :param client_hashes: a dictionary where the filenames are keys and the values are md5 ha...
python
def compute_files_to_download(client_hashes, server_hashes): """ Given a dictionary of file hashes from the client and the server, specify which files should be downloaded from the server :param client_hashes: a dictionary where the filenames are keys and the values are md5 ha...
[ "def", "compute_files_to_download", "(", "client_hashes", ",", "server_hashes", ")", ":", "to_dload", ",", "to_delete", "=", "[", "]", ",", "[", "]", "for", "filename", "in", "server_hashes", ":", "if", "filename", "not", "in", "client_hashes", ":", "to_dload"...
Given a dictionary of file hashes from the client and the server, specify which files should be downloaded from the server :param client_hashes: a dictionary where the filenames are keys and the values are md5 hashes as strings :param server_hashes: a dictionary where the filename...
[ "Given", "a", "dictionary", "of", "file", "hashes", "from", "the", "client", "and", "the", "server", "specify", "which", "files", "should", "be", "downloaded", "from", "the", "server" ]
9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4
https://github.com/iclab/centinel/blob/9a25dcf30c6a1db3c046f7ccb8ab8873e455c1a4/centinel/utils.py#L58-L90
42,850
click-contrib/click-spinner
click_spinner/__init__.py
spinner
def spinner(beep=False, disable=False, force=False): """This function creates a context manager that is used to display a spinner on stdout as long as the context has not exited. The spinner is created only if stdout is not redirected, or if the spinner is forced using the `force` parameter. Param...
python
def spinner(beep=False, disable=False, force=False): """This function creates a context manager that is used to display a spinner on stdout as long as the context has not exited. The spinner is created only if stdout is not redirected, or if the spinner is forced using the `force` parameter. Param...
[ "def", "spinner", "(", "beep", "=", "False", ",", "disable", "=", "False", ",", "force", "=", "False", ")", ":", "return", "Spinner", "(", "beep", ",", "disable", ",", "force", ")" ]
This function creates a context manager that is used to display a spinner on stdout as long as the context has not exited. The spinner is created only if stdout is not redirected, or if the spinner is forced using the `force` parameter. Parameters ---------- beep : bool Beep when spinn...
[ "This", "function", "creates", "a", "context", "manager", "that", "is", "used", "to", "display", "a", "spinner", "on", "stdout", "as", "long", "as", "the", "context", "has", "not", "exited", "." ]
5cd08058f87a6cceef0ec6de60a73a400d35ef55
https://github.com/click-contrib/click-spinner/blob/5cd08058f87a6cceef0ec6de60a73a400d35ef55/click_spinner/__init__.py#L52-L76
42,851
xray7224/PyPump
docs/examples/pypump-post-note.py
App.verifier
def verifier(self, url): """ Will ask user to click link to accept app and write code """ webbrowser.open(url) print('A browser should have opened up with a link to allow us to access') print('your account, follow the instructions on the link and paste the verifier') print('Code ...
python
def verifier(self, url): """ Will ask user to click link to accept app and write code """ webbrowser.open(url) print('A browser should have opened up with a link to allow us to access') print('your account, follow the instructions on the link and paste the verifier') print('Code ...
[ "def", "verifier", "(", "self", ",", "url", ")", ":", "webbrowser", ".", "open", "(", "url", ")", "print", "(", "'A browser should have opened up with a link to allow us to access'", ")", "print", "(", "'your account, follow the instructions on the link and paste the verifier...
Will ask user to click link to accept app and write code
[ "Will", "ask", "user", "to", "click", "link", "to", "accept", "app", "and", "write", "code" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/docs/examples/pypump-post-note.py#L74-L82
42,852
xray7224/PyPump
docs/examples/pypump-post-note.py
App.write_config
def write_config(self): """ Write config to file """ if not os.path.exists(os.path.dirname(self.config_file)): os.makedirs(os.path.dirname(self.config_file)) with open(self.config_file, 'w') as f: f.write(json.dumps(self.config)) f.close()
python
def write_config(self): """ Write config to file """ if not os.path.exists(os.path.dirname(self.config_file)): os.makedirs(os.path.dirname(self.config_file)) with open(self.config_file, 'w') as f: f.write(json.dumps(self.config)) f.close()
[ "def", "write_config", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "self", ".", "config_file", ")", ")", ":", "os", ".", "makedirs", "(", "os", ".", "path", ".", "dirname", "(...
Write config to file
[ "Write", "config", "to", "file" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/docs/examples/pypump-post-note.py#L84-L90
42,853
xray7224/PyPump
docs/examples/pypump-post-note.py
App.read_config
def read_config(self): """ Read config from file """ try: with open(self.config_file, 'r') as f: self.config = json.loads(f.read()) f.close() except IOError: return False return True
python
def read_config(self): """ Read config from file """ try: with open(self.config_file, 'r') as f: self.config = json.loads(f.read()) f.close() except IOError: return False return True
[ "def", "read_config", "(", "self", ")", ":", "try", ":", "with", "open", "(", "self", ".", "config_file", ",", "'r'", ")", "as", "f", ":", "self", ".", "config", "=", "json", ".", "loads", "(", "f", ".", "read", "(", ")", ")", "f", ".", "close"...
Read config from file
[ "Read", "config", "from", "file" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/docs/examples/pypump-post-note.py#L92-L100
42,854
xray7224/PyPump
docs/examples/pypump-post-note.py
App.post_note
def post_note(self): """ Post note and return the URL of the posted note """ if self.args.note_title: note_title = self.args.note_title else: note_title = None note_content = self.args.note_content mynote = self.pump.Note(display_name=note_title, content=...
python
def post_note(self): """ Post note and return the URL of the posted note """ if self.args.note_title: note_title = self.args.note_title else: note_title = None note_content = self.args.note_content mynote = self.pump.Note(display_name=note_title, content=...
[ "def", "post_note", "(", "self", ")", ":", "if", "self", ".", "args", ".", "note_title", ":", "note_title", "=", "self", ".", "args", ".", "note_title", "else", ":", "note_title", "=", "None", "note_content", "=", "self", ".", "args", ".", "note_content"...
Post note and return the URL of the posted note
[ "Post", "note", "and", "return", "the", "URL", "of", "the", "posted", "note" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/docs/examples/pypump-post-note.py#L102-L115
42,855
xray7224/PyPump
pypump/models/feed.py
ItemList.get_obj_id
def get_obj_id(self, item): """ Get the id of a PumpObject. :param item: id string or PumpObject """ if item is not None: if isinstance(item, six.string_types): return item elif hasattr(item, 'id'): return item.id
python
def get_obj_id(self, item): """ Get the id of a PumpObject. :param item: id string or PumpObject """ if item is not None: if isinstance(item, six.string_types): return item elif hasattr(item, 'id'): return item.id
[ "def", "get_obj_id", "(", "self", ",", "item", ")", ":", "if", "item", "is", "not", "None", ":", "if", "isinstance", "(", "item", ",", "six", ".", "string_types", ")", ":", "return", "item", "elif", "hasattr", "(", "item", ",", "'id'", ")", ":", "r...
Get the id of a PumpObject. :param item: id string or PumpObject
[ "Get", "the", "id", "of", "a", "PumpObject", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L80-L89
42,856
xray7224/PyPump
pypump/models/feed.py
ItemList.get_page
def get_page(self, url): """ Get a page of items from API """ if url: data = self.feed._request(url, offset=self._offset, since=self._since, before=self._before) # set values to False to avoid using them for next request self._before = False if self._before is not No...
python
def get_page(self, url): """ Get a page of items from API """ if url: data = self.feed._request(url, offset=self._offset, since=self._since, before=self._before) # set values to False to avoid using them for next request self._before = False if self._before is not No...
[ "def", "get_page", "(", "self", ",", "url", ")", ":", "if", "url", ":", "data", "=", "self", ".", "feed", ".", "_request", "(", "url", ",", "offset", "=", "self", ".", "_offset", ",", "since", "=", "self", ".", "_since", ",", "before", "=", "self...
Get a page of items from API
[ "Get", "a", "page", "of", "items", "from", "API" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L91-L107
42,857
xray7224/PyPump
pypump/models/feed.py
ItemList.done
def done(self): """ Check if we should stop returning objects """ if self._done: return self._done if self._limit is None: self._done = False elif self.itemcount >= self._limit: self._done = True return self._done
python
def done(self): """ Check if we should stop returning objects """ if self._done: return self._done if self._limit is None: self._done = False elif self.itemcount >= self._limit: self._done = True return self._done
[ "def", "done", "(", "self", ")", ":", "if", "self", ".", "_done", ":", "return", "self", ".", "_done", "if", "self", ".", "_limit", "is", "None", ":", "self", ".", "_done", "=", "False", "elif", "self", ".", "itemcount", ">=", "self", ".", "_limit"...
Check if we should stop returning objects
[ "Check", "if", "we", "should", "stop", "returning", "objects" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L164-L174
42,858
xray7224/PyPump
pypump/models/feed.py
ItemList._build_cache
def _build_cache(self): """ Build a list of objects from feed's cached items or API page""" self.cache = [] if self.done: return for i in (self.get_cached() if self._cached else self.get_page(self.url)): if not self._cached: # some objects don't h...
python
def _build_cache(self): """ Build a list of objects from feed's cached items or API page""" self.cache = [] if self.done: return for i in (self.get_cached() if self._cached else self.get_page(self.url)): if not self._cached: # some objects don't h...
[ "def", "_build_cache", "(", "self", ")", ":", "self", ".", "cache", "=", "[", "]", "if", "self", ".", "done", ":", "return", "for", "i", "in", "(", "self", ".", "get_cached", "(", ")", "if", "self", ".", "_cached", "else", "self", ".", "get_page", ...
Build a list of objects from feed's cached items or API page
[ "Build", "a", "list", "of", "objects", "from", "feed", "s", "cached", "items", "or", "API", "page" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L176-L212
42,859
xray7224/PyPump
pypump/models/feed.py
Feed.items
def items(self, offset=None, limit=20, since=None, before=None, *args, **kwargs): """ Get a feed's items. :param offset: Amount of items to skip before returning data :param since: Return items added after this id (ordered old -> new) :param before: Return items added before this id (o...
python
def items(self, offset=None, limit=20, since=None, before=None, *args, **kwargs): """ Get a feed's items. :param offset: Amount of items to skip before returning data :param since: Return items added after this id (ordered old -> new) :param before: Return items added before this id (o...
[ "def", "items", "(", "self", ",", "offset", "=", "None", ",", "limit", "=", "20", ",", "since", "=", "None", ",", "before", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "ItemList", "(", "self", ",", "offset", "=", ...
Get a feed's items. :param offset: Amount of items to skip before returning data :param since: Return items added after this id (ordered old -> new) :param before: Return items added before this id (ordered new -> old) :param limit: Amount of items to return
[ "Get", "a", "feed", "s", "items", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L335-L343
42,860
xray7224/PyPump
pypump/models/feed.py
Inbox.direct
def direct(self): """ Direct inbox feed, contains activities addressed directly to the owner of the inbox. """ url = self._subfeed("direct") if "direct" in self.url or "major" in self.url or "minor" in self.url: return self if self._direct is None: ...
python
def direct(self): """ Direct inbox feed, contains activities addressed directly to the owner of the inbox. """ url = self._subfeed("direct") if "direct" in self.url or "major" in self.url or "minor" in self.url: return self if self._direct is None: ...
[ "def", "direct", "(", "self", ")", ":", "url", "=", "self", ".", "_subfeed", "(", "\"direct\"", ")", "if", "\"direct\"", "in", "self", ".", "url", "or", "\"major\"", "in", "self", ".", "url", "or", "\"minor\"", "in", "self", ".", "url", ":", "return"...
Direct inbox feed, contains activities addressed directly to the owner of the inbox.
[ "Direct", "inbox", "feed", "contains", "activities", "addressed", "directly", "to", "the", "owner", "of", "the", "inbox", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L444-L453
42,861
xray7224/PyPump
pypump/models/feed.py
Inbox.major
def major(self): """ Major inbox feed, contains major activities such as notes and images. """ url = self._subfeed("major") if "major" in self.url or "minor" in self.url: return self if self._major is None: self._major = self.__class__(url, pypump=self._pump) ...
python
def major(self): """ Major inbox feed, contains major activities such as notes and images. """ url = self._subfeed("major") if "major" in self.url or "minor" in self.url: return self if self._major is None: self._major = self.__class__(url, pypump=self._pump) ...
[ "def", "major", "(", "self", ")", ":", "url", "=", "self", ".", "_subfeed", "(", "\"major\"", ")", "if", "\"major\"", "in", "self", ".", "url", "or", "\"minor\"", "in", "self", ".", "url", ":", "return", "self", "if", "self", ".", "_major", "is", "...
Major inbox feed, contains major activities such as notes and images.
[ "Major", "inbox", "feed", "contains", "major", "activities", "such", "as", "notes", "and", "images", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L456-L463
42,862
xray7224/PyPump
pypump/models/feed.py
Inbox.minor
def minor(self): """ Minor inbox feed, contains minor activities such as likes, shares and follows. """ url = self._subfeed("minor") if "minor" in self.url or "major" in self.url: return self if self._minor is None: self._minor = self.__class__(url, pypump=self._p...
python
def minor(self): """ Minor inbox feed, contains minor activities such as likes, shares and follows. """ url = self._subfeed("minor") if "minor" in self.url or "major" in self.url: return self if self._minor is None: self._minor = self.__class__(url, pypump=self._p...
[ "def", "minor", "(", "self", ")", ":", "url", "=", "self", ".", "_subfeed", "(", "\"minor\"", ")", "if", "\"minor\"", "in", "self", ".", "url", "or", "\"major\"", "in", "self", ".", "url", ":", "return", "self", "if", "self", ".", "_minor", "is", "...
Minor inbox feed, contains minor activities such as likes, shares and follows.
[ "Minor", "inbox", "feed", "contains", "minor", "activities", "such", "as", "likes", "shares", "and", "follows", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/feed.py#L466-L473
42,863
xray7224/PyPump
pypump/models/note.py
Note.serialize
def serialize(self): """ Converts the post to something compatible with `json.dumps` """ data = super(Note, self).serialize() data.update({ "verb": "post", "object": { "objectType": self.object_type, "content": self.content, } ...
python
def serialize(self): """ Converts the post to something compatible with `json.dumps` """ data = super(Note, self).serialize() data.update({ "verb": "post", "object": { "objectType": self.object_type, "content": self.content, } ...
[ "def", "serialize", "(", "self", ")", ":", "data", "=", "super", "(", "Note", ",", "self", ")", ".", "serialize", "(", ")", "data", ".", "update", "(", "{", "\"verb\"", ":", "\"post\"", ",", "\"object\"", ":", "{", "\"objectType\"", ":", "self", ".",...
Converts the post to something compatible with `json.dumps`
[ "Converts", "the", "post", "to", "something", "compatible", "with", "json", ".", "dumps" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/note.py#L50-L63
42,864
xray7224/PyPump
pypump/client.py
Client.context
def context(self): """ Provides request context """ type = "client_associate" if self.key is None else "client_update" data = { "type": type, "application_type": self.type, } # is this an update? if self.key: data["client_id"] = self.k...
python
def context(self): """ Provides request context """ type = "client_associate" if self.key is None else "client_update" data = { "type": type, "application_type": self.type, } # is this an update? if self.key: data["client_id"] = self.k...
[ "def", "context", "(", "self", ")", ":", "type", "=", "\"client_associate\"", "if", "self", ".", "key", "is", "None", "else", "\"client_update\"", "data", "=", "{", "\"type\"", ":", "type", ",", "\"application_type\"", ":", "self", ".", "type", ",", "}", ...
Provides request context
[ "Provides", "request", "context" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L95-L123
42,865
xray7224/PyPump
pypump/client.py
Client.request
def request(self, server=None): """ Sends the request """ request = { "headers": {"Content-Type": "application/json"}, "timeout": self._pump.timeout, "data": self.context, } url = "{proto}://{server}/{endpoint}".format( proto=self._pump.pr...
python
def request(self, server=None): """ Sends the request """ request = { "headers": {"Content-Type": "application/json"}, "timeout": self._pump.timeout, "data": self.context, } url = "{proto}://{server}/{endpoint}".format( proto=self._pump.pr...
[ "def", "request", "(", "self", ",", "server", "=", "None", ")", ":", "request", "=", "{", "\"headers\"", ":", "{", "\"Content-Type\"", ":", "\"application/json\"", "}", ",", "\"timeout\"", ":", "self", ".", "_pump", ".", "timeout", ",", "\"data\"", ":", ...
Sends the request
[ "Sends", "the", "request" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L125-L155
42,866
xray7224/PyPump
pypump/client.py
Client.register
def register(self, server=None): """ Registers the client with the Pump API retrieving the id and secret """ if (self.key or self.secret): return self.update() server_data = self.request(server) self.key = server_data["client_id"] self.secret = server_data["client_s...
python
def register(self, server=None): """ Registers the client with the Pump API retrieving the id and secret """ if (self.key or self.secret): return self.update() server_data = self.request(server) self.key = server_data["client_id"] self.secret = server_data["client_s...
[ "def", "register", "(", "self", ",", "server", "=", "None", ")", ":", "if", "(", "self", ".", "key", "or", "self", ".", "secret", ")", ":", "return", "self", ".", "update", "(", ")", "server_data", "=", "self", ".", "request", "(", "server", ")", ...
Registers the client with the Pump API retrieving the id and secret
[ "Registers", "the", "client", "with", "the", "Pump", "API", "retrieving", "the", "id", "and", "secret" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L157-L166
42,867
xray7224/PyPump
pypump/client.py
Client.update
def update(self): """ Updates the information the Pump server has about the client """ error = "" if self.key is None: error = "To update a client you need to provide a key" if self.secret is None: error = "To update a client you need to provide the secret" ...
python
def update(self): """ Updates the information the Pump server has about the client """ error = "" if self.key is None: error = "To update a client you need to provide a key" if self.secret is None: error = "To update a client you need to provide the secret" ...
[ "def", "update", "(", "self", ")", ":", "error", "=", "\"\"", "if", "self", ".", "key", "is", "None", ":", "error", "=", "\"To update a client you need to provide a key\"", "if", "self", ".", "secret", "is", "None", ":", "error", "=", "\"To update a client you...
Updates the information the Pump server has about the client
[ "Updates", "the", "information", "the", "Pump", "server", "has", "about", "the", "client" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L168-L181
42,868
commx/python-rrdtool
setup.py
compile_extensions
def compile_extensions(macros, compat=False): """ Compiler subroutine to test whether some functions are available on the target system. Since the rrdtool headers shipped with most packages do not disclose any versioning information, we cannot test whether a given function is available that way. Ins...
python
def compile_extensions(macros, compat=False): """ Compiler subroutine to test whether some functions are available on the target system. Since the rrdtool headers shipped with most packages do not disclose any versioning information, we cannot test whether a given function is available that way. Ins...
[ "def", "compile_extensions", "(", "macros", ",", "compat", "=", "False", ")", ":", "import", "distutils", ".", "sysconfig", "import", "distutils", ".", "ccompiler", "import", "tempfile", "import", "shutil", "from", "textwrap", "import", "dedent", "# common vars", ...
Compiler subroutine to test whether some functions are available on the target system. Since the rrdtool headers shipped with most packages do not disclose any versioning information, we cannot test whether a given function is available that way. Instead, use this to manually try to compile code and see...
[ "Compiler", "subroutine", "to", "test", "whether", "some", "functions", "are", "available", "on", "the", "target", "system", ".", "Since", "the", "rrdtool", "headers", "shipped", "with", "most", "packages", "do", "not", "disclose", "any", "versioning", "informat...
74b7dee35c17a2558da475369699ef63408b7b6c
https://github.com/commx/python-rrdtool/blob/74b7dee35c17a2558da475369699ef63408b7b6c/setup.py#L42-L119
42,869
xray7224/PyPump
pypump/models/collection.py
Collection.add
def add(self, obj): """ Adds a member to the collection. :param obj: Object to add. Example: >>> mycollection.add(pump.Person('bob@example.org')) """ activity = { "verb": "add", "object": { "objectType": obj.object_type, ...
python
def add(self, obj): """ Adds a member to the collection. :param obj: Object to add. Example: >>> mycollection.add(pump.Person('bob@example.org')) """ activity = { "verb": "add", "object": { "objectType": obj.object_type, ...
[ "def", "add", "(", "self", ",", "obj", ")", ":", "activity", "=", "{", "\"verb\"", ":", "\"add\"", ",", "\"object\"", ":", "{", "\"objectType\"", ":", "obj", ".", "object_type", ",", "\"id\"", ":", "obj", ".", "id", "}", ",", "\"target\"", ":", "{", ...
Adds a member to the collection. :param obj: Object to add. Example: >>> mycollection.add(pump.Person('bob@example.org'))
[ "Adds", "a", "member", "to", "the", "collection", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/collection.py#L58-L81
42,870
xray7224/PyPump
pypump/models/collection.py
Collection.remove
def remove(self, obj): """ Removes a member from the collection. :param obj: Object to remove. Example: >>> mycollection.remove(pump.Person('bob@example.org')) """ activity = { "verb": "remove", "object": { "objectType": obj.o...
python
def remove(self, obj): """ Removes a member from the collection. :param obj: Object to remove. Example: >>> mycollection.remove(pump.Person('bob@example.org')) """ activity = { "verb": "remove", "object": { "objectType": obj.o...
[ "def", "remove", "(", "self", ",", "obj", ")", ":", "activity", "=", "{", "\"verb\"", ":", "\"remove\"", ",", "\"object\"", ":", "{", "\"objectType\"", ":", "obj", ".", "object_type", ",", "\"id\"", ":", "obj", ".", "id", "}", ",", "\"target\"", ":", ...
Removes a member from the collection. :param obj: Object to remove. Example: >>> mycollection.remove(pump.Person('bob@example.org'))
[ "Removes", "a", "member", "from", "the", "collection", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/collection.py#L83-L106
42,871
xray7224/PyPump
pypump/models/__init__.py
PumpObject._post_activity
def _post_activity(self, activity, unserialize=True): """ Posts a activity to feed """ # I think we always want to post to feed feed_url = "{proto}://{server}/api/user/{username}/feed".format( proto=self._pump.protocol, server=self._pump.client.server, usernam...
python
def _post_activity(self, activity, unserialize=True): """ Posts a activity to feed """ # I think we always want to post to feed feed_url = "{proto}://{server}/api/user/{username}/feed".format( proto=self._pump.protocol, server=self._pump.client.server, usernam...
[ "def", "_post_activity", "(", "self", ",", "activity", ",", "unserialize", "=", "True", ")", ":", "# I think we always want to post to feed", "feed_url", "=", "\"{proto}://{server}/api/user/{username}/feed\"", ".", "format", "(", "proto", "=", "self", ".", "_pump", "....
Posts a activity to feed
[ "Posts", "a", "activity", "to", "feed" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L100-L132
42,872
xray7224/PyPump
pypump/models/__init__.py
PumpObject._add_links
def _add_links(self, links, key="href", proxy_key="proxyURL", endpoints=None): """ Parses and adds block of links """ if endpoints is None: endpoints = ["likes", "replies", "shares", "self", "followers", "following", "lists", "favorites", "members"] if links...
python
def _add_links(self, links, key="href", proxy_key="proxyURL", endpoints=None): """ Parses and adds block of links """ if endpoints is None: endpoints = ["likes", "replies", "shares", "self", "followers", "following", "lists", "favorites", "members"] if links...
[ "def", "_add_links", "(", "self", ",", "links", ",", "key", "=", "\"href\"", ",", "proxy_key", "=", "\"proxyURL\"", ",", "endpoints", "=", "None", ")", ":", "if", "endpoints", "is", "None", ":", "endpoints", "=", "[", "\"likes\"", ",", "\"replies\"", ","...
Parses and adds block of links
[ "Parses", "and", "adds", "block", "of", "links" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L156-L184
42,873
xray7224/PyPump
pypump/models/__init__.py
Addressable._set_people
def _set_people(self, people): """ Sets who the object is sent to """ if hasattr(people, "object_type"): people = [people] elif hasattr(people, "__iter__"): people = list(people) return people
python
def _set_people(self, people): """ Sets who the object is sent to """ if hasattr(people, "object_type"): people = [people] elif hasattr(people, "__iter__"): people = list(people) return people
[ "def", "_set_people", "(", "self", ",", "people", ")", ":", "if", "hasattr", "(", "people", ",", "\"object_type\"", ")", ":", "people", "=", "[", "people", "]", "elif", "hasattr", "(", "people", ",", "\"__iter__\"", ")", ":", "people", "=", "list", "("...
Sets who the object is sent to
[ "Sets", "who", "the", "object", "is", "sent", "to" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L493-L500
42,874
xray7224/PyPump
pypump/models/__init__.py
Uploadable.from_file
def from_file(self, filename): """ Uploads a file from a filename on your system. :param filename: Path to file on your system. Example: >>> myimage.from_file('/path/to/dinner.png') """ mimetype = mimetypes.guess_type(filename)[0] or "application/octal-stream" ...
python
def from_file(self, filename): """ Uploads a file from a filename on your system. :param filename: Path to file on your system. Example: >>> myimage.from_file('/path/to/dinner.png') """ mimetype = mimetypes.guess_type(filename)[0] or "application/octal-stream" ...
[ "def", "from_file", "(", "self", ",", "filename", ")", ":", "mimetype", "=", "mimetypes", ".", "guess_type", "(", "filename", ")", "[", "0", "]", "or", "\"application/octal-stream\"", "headers", "=", "{", "\"Content-Type\"", ":", "mimetype", ",", "\"Content-Le...
Uploads a file from a filename on your system. :param filename: Path to file on your system. Example: >>> myimage.from_file('/path/to/dinner.png')
[ "Uploads", "a", "file", "from", "a", "filename", "on", "your", "system", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L604-L652
42,875
xray7224/PyPump
pypump/models/activity.py
Activity.unserialize
def unserialize(self, data): """ From JSON -> Activity object """ # copy activity attributes into object if "author" not in data["object"]: data["object"]["author"] = data["actor"] for key in ["to", "cc", "bto", "bcc"]: if key not in data["object"] and key in dat...
python
def unserialize(self, data): """ From JSON -> Activity object """ # copy activity attributes into object if "author" not in data["object"]: data["object"]["author"] = data["actor"] for key in ["to", "cc", "bto", "bcc"]: if key not in data["object"] and key in dat...
[ "def", "unserialize", "(", "self", ",", "data", ")", ":", "# copy activity attributes into object", "if", "\"author\"", "not", "in", "data", "[", "\"object\"", "]", ":", "data", "[", "\"object\"", "]", "[", "\"author\"", "]", "=", "data", "[", "\"actor\"", "...
From JSON -> Activity object
[ "From", "JSON", "-", ">", "Activity", "object" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/activity.py#L59-L72
42,876
xray7224/PyPump
pypump/pypump.py
PyPump.create_store
def create_store(self): """ Creates store object """ if self.store_class is not None: return self.store_class.load(self.client.webfinger, self) raise NotImplementedError("You need to specify PyPump.store_class or override PyPump.create_store method.")
python
def create_store(self): """ Creates store object """ if self.store_class is not None: return self.store_class.load(self.client.webfinger, self) raise NotImplementedError("You need to specify PyPump.store_class or override PyPump.create_store method.")
[ "def", "create_store", "(", "self", ")", ":", "if", "self", ".", "store_class", "is", "not", "None", ":", "return", "self", ".", "store_class", ".", "load", "(", "self", ".", "client", ".", "webfinger", ",", "self", ")", "raise", "NotImplementedError", "...
Creates store object
[ "Creates", "store", "object" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L151-L156
42,877
xray7224/PyPump
pypump/pypump.py
PyPump._build_url
def _build_url(self, endpoint): """ Returns a fully qualified URL """ server = None if "://" in endpoint: # looks like an url, let's break it down server, endpoint = self._deconstruct_url(endpoint) endpoint = endpoint.lstrip("/") url = "{proto}://{server}...
python
def _build_url(self, endpoint): """ Returns a fully qualified URL """ server = None if "://" in endpoint: # looks like an url, let's break it down server, endpoint = self._deconstruct_url(endpoint) endpoint = endpoint.lstrip("/") url = "{proto}://{server}...
[ "def", "_build_url", "(", "self", ",", "endpoint", ")", ":", "server", "=", "None", "if", "\"://\"", "in", "endpoint", ":", "# looks like an url, let's break it down", "server", ",", "endpoint", "=", "self", ".", "_deconstruct_url", "(", "endpoint", ")", "endpoi...
Returns a fully qualified URL
[ "Returns", "a", "fully", "qualified", "URL" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L175-L188
42,878
xray7224/PyPump
pypump/pypump.py
PyPump._deconstruct_url
def _deconstruct_url(self, url): """ Breaks down URL and returns server and endpoint """ url = url.split("://", 1)[-1] server, endpoint = url.split("/", 1) return (server, endpoint)
python
def _deconstruct_url(self, url): """ Breaks down URL and returns server and endpoint """ url = url.split("://", 1)[-1] server, endpoint = url.split("/", 1) return (server, endpoint)
[ "def", "_deconstruct_url", "(", "self", ",", "url", ")", ":", "url", "=", "url", ".", "split", "(", "\"://\"", ",", "1", ")", "[", "-", "1", "]", "server", ",", "endpoint", "=", "url", ".", "split", "(", "\"/\"", ",", "1", ")", "return", "(", "...
Breaks down URL and returns server and endpoint
[ "Breaks", "down", "URL", "and", "returns", "server", "and", "endpoint" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L190-L194
42,879
xray7224/PyPump
pypump/pypump.py
PyPump._add_client
def _add_client(self, url, key=None, secret=None): """ Creates Client object with key and secret for server and adds it to _server_cache if it doesnt already exist """ if "://" in url: server, endpoint = self._deconstruct_url(url) else: server = url if s...
python
def _add_client(self, url, key=None, secret=None): """ Creates Client object with key and secret for server and adds it to _server_cache if it doesnt already exist """ if "://" in url: server, endpoint = self._deconstruct_url(url) else: server = url if s...
[ "def", "_add_client", "(", "self", ",", "url", ",", "key", "=", "None", ",", "secret", "=", "None", ")", ":", "if", "\"://\"", "in", "url", ":", "server", ",", "endpoint", "=", "self", ".", "_deconstruct_url", "(", "url", ")", "else", ":", "server", ...
Creates Client object with key and secret for server and adds it to _server_cache if it doesnt already exist
[ "Creates", "Client", "object", "with", "key", "and", "secret", "for", "server", "and", "adds", "it", "to", "_server_cache", "if", "it", "doesnt", "already", "exist" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L196-L224
42,880
xray7224/PyPump
pypump/pypump.py
PyPump.request
def request(self, endpoint, method="GET", data="", raw=False, params=None, retries=None, client=None, headers=None, timeout=None, **kwargs): """ Make request to endpoint with OAuth. Returns dictionary with response data. :param endpoint: endpoint path, or a fully...
python
def request(self, endpoint, method="GET", data="", raw=False, params=None, retries=None, client=None, headers=None, timeout=None, **kwargs): """ Make request to endpoint with OAuth. Returns dictionary with response data. :param endpoint: endpoint path, or a fully...
[ "def", "request", "(", "self", ",", "endpoint", ",", "method", "=", "\"GET\"", ",", "data", "=", "\"\"", ",", "raw", "=", "False", ",", "params", "=", "None", ",", "retries", "=", "None", ",", "client", "=", "None", ",", "headers", "=", "None", ","...
Make request to endpoint with OAuth. Returns dictionary with response data. :param endpoint: endpoint path, or a fully qualified URL if raw=True. :param method: GET (default), POST or DELETE. :param data: data to send in the request body. :param raw: use endpoint as entered with...
[ "Make", "request", "to", "endpoint", "with", "OAuth", ".", "Returns", "dictionary", "with", "response", "data", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L226-L343
42,881
xray7224/PyPump
pypump/pypump.py
PyPump.oauth_request
def oauth_request(self): """ Makes a oauth connection """ # get tokens from server and make a dict of them. self._server_tokens = self.request_token() self.store["oauth-request-token"] = self._server_tokens["token"] self.store["oauth-request-secret"] = self._server_tokens["token...
python
def oauth_request(self): """ Makes a oauth connection """ # get tokens from server and make a dict of them. self._server_tokens = self.request_token() self.store["oauth-request-token"] = self._server_tokens["token"] self.store["oauth-request-secret"] = self._server_tokens["token...
[ "def", "oauth_request", "(", "self", ")", ":", "# get tokens from server and make a dict of them.", "self", ".", "_server_tokens", "=", "self", ".", "request_token", "(", ")", "self", ".", "store", "[", "\"oauth-request-token\"", "]", "=", "self", ".", "_server_toke...
Makes a oauth connection
[ "Makes", "a", "oauth", "connection" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L377-L388
42,882
xray7224/PyPump
pypump/pypump.py
PyPump.construct_oauth_url
def construct_oauth_url(self): """ Constructs verifier OAuth URL """ response = self._requester(requests.head, "{0}://{1}/".format(self.protocol, self.client.server), allow_redirects=False ) ...
python
def construct_oauth_url(self): """ Constructs verifier OAuth URL """ response = self._requester(requests.head, "{0}://{1}/".format(self.protocol, self.client.server), allow_redirects=False ) ...
[ "def", "construct_oauth_url", "(", "self", ")", ":", "response", "=", "self", ".", "_requester", "(", "requests", ".", "head", ",", "\"{0}://{1}/\"", ".", "format", "(", "self", ".", "protocol", ",", "self", ".", "client", ".", "server", ")", ",", "allow...
Constructs verifier OAuth URL
[ "Constructs", "verifier", "OAuth", "URL" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L390-L407
42,883
xray7224/PyPump
pypump/pypump.py
PyPump.setup_oauth_client
def setup_oauth_client(self, url=None): """ Sets up client for requests to pump """ if url and "://" in url: server, endpoint = self._deconstruct_url(url) else: server = self.client.server if server not in self._server_cache: self._add_client(server) ...
python
def setup_oauth_client(self, url=None): """ Sets up client for requests to pump """ if url and "://" in url: server, endpoint = self._deconstruct_url(url) else: server = self.client.server if server not in self._server_cache: self._add_client(server) ...
[ "def", "setup_oauth_client", "(", "self", ",", "url", "=", "None", ")", ":", "if", "url", "and", "\"://\"", "in", "url", ":", "server", ",", "endpoint", "=", "self", ".", "_deconstruct_url", "(", "url", ")", "else", ":", "server", "=", "self", ".", "...
Sets up client for requests to pump
[ "Sets", "up", "client", "for", "requests", "to", "pump" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L413-L435
42,884
xray7224/PyPump
pypump/pypump.py
PyPump.request_token
def request_token(self): """ Gets OAuth request token """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, callback_uri=self.callback, ) request = {"auth": client} ...
python
def request_token(self): """ Gets OAuth request token """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, callback_uri=self.callback, ) request = {"auth": client} ...
[ "def", "request_token", "(", "self", ")", ":", "client", "=", "OAuth1", "(", "client_key", "=", "self", ".", "_server_cache", "[", "self", ".", "client", ".", "server", "]", ".", "key", ",", "client_secret", "=", "self", ".", "_server_cache", "[", "self"...
Gets OAuth request token
[ "Gets", "OAuth", "request", "token" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L437-L458
42,885
xray7224/PyPump
pypump/pypump.py
PyPump.request_access
def request_access(self, verifier): """ Get OAuth access token so we can make requests """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, resource_owner_key=self.store["oauth-request...
python
def request_access(self, verifier): """ Get OAuth access token so we can make requests """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, resource_owner_key=self.store["oauth-request...
[ "def", "request_access", "(", "self", ",", "verifier", ")", ":", "client", "=", "OAuth1", "(", "client_key", "=", "self", ".", "_server_cache", "[", "self", ".", "client", ".", "server", "]", ".", "key", ",", "client_secret", "=", "self", ".", "_server_c...
Get OAuth access token so we can make requests
[ "Get", "OAuth", "access", "token", "so", "we", "can", "make", "requests" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L460-L481
42,886
xray7224/PyPump
pypump/pypump.py
WebPump.logged_in
def logged_in(self): """ Return boolean if is logged in """ if "oauth-access-token" not in self.store: return False response = self.request("/api/whoami", allow_redirects=False) # It should response with a redirect to our profile if it's logged in if response.status...
python
def logged_in(self): """ Return boolean if is logged in """ if "oauth-access-token" not in self.store: return False response = self.request("/api/whoami", allow_redirects=False) # It should response with a redirect to our profile if it's logged in if response.status...
[ "def", "logged_in", "(", "self", ")", ":", "if", "\"oauth-access-token\"", "not", "in", "self", ".", "store", ":", "return", "False", "response", "=", "self", ".", "request", "(", "\"/api/whoami\"", ",", "allow_redirects", "=", "False", ")", "# It should respo...
Return boolean if is logged in
[ "Return", "boolean", "if", "is", "logged", "in" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L516-L531
42,887
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreate
def cudnnCreate(): """ Initialize cuDNN. Initializes cuDNN and returns a handle to the cuDNN context. Returns ------- handle : cudnnHandle cuDNN context """ handle = ctypes.c_void_p() status = _libcudnn.cudnnCreate(ctypes.byref(handle)) cudnnCheckStatus(status) re...
python
def cudnnCreate(): """ Initialize cuDNN. Initializes cuDNN and returns a handle to the cuDNN context. Returns ------- handle : cudnnHandle cuDNN context """ handle = ctypes.c_void_p() status = _libcudnn.cudnnCreate(ctypes.byref(handle)) cudnnCheckStatus(status) re...
[ "def", "cudnnCreate", "(", ")", ":", "handle", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreate", "(", "ctypes", ".", "byref", "(", "handle", ")", ")", "cudnnCheckStatus", "(", "status", ")", "return", "handle", "."...
Initialize cuDNN. Initializes cuDNN and returns a handle to the cuDNN context. Returns ------- handle : cudnnHandle cuDNN context
[ "Initialize", "cuDNN", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L288-L304
42,888
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnDestroy
def cudnnDestroy(handle): """ Release cuDNN resources. Release hardware resources used by cuDNN. Parameters ---------- handle : cudnnHandle cuDNN context. """ status = _libcudnn.cudnnDestroy(ctypes.c_void_p(handle)) cudnnCheckStatus(status)
python
def cudnnDestroy(handle): """ Release cuDNN resources. Release hardware resources used by cuDNN. Parameters ---------- handle : cudnnHandle cuDNN context. """ status = _libcudnn.cudnnDestroy(ctypes.c_void_p(handle)) cudnnCheckStatus(status)
[ "def", "cudnnDestroy", "(", "handle", ")", ":", "status", "=", "_libcudnn", ".", "cudnnDestroy", "(", "ctypes", ".", "c_void_p", "(", "handle", ")", ")", "cudnnCheckStatus", "(", "status", ")" ]
Release cuDNN resources. Release hardware resources used by cuDNN. Parameters ---------- handle : cudnnHandle cuDNN context.
[ "Release", "cuDNN", "resources", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L308-L321
42,889
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetStream
def cudnnSetStream(handle, id): """ Set current cuDNN library stream. Parameters ---------- handle : cudnnHandle cuDNN context. id : cudaStream Stream Id. """ status = _libcudnn.cudnnSetStream(handle, id) cudnnCheckStatus(status)
python
def cudnnSetStream(handle, id): """ Set current cuDNN library stream. Parameters ---------- handle : cudnnHandle cuDNN context. id : cudaStream Stream Id. """ status = _libcudnn.cudnnSetStream(handle, id) cudnnCheckStatus(status)
[ "def", "cudnnSetStream", "(", "handle", ",", "id", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetStream", "(", "handle", ",", "id", ")", "cudnnCheckStatus", "(", "status", ")" ]
Set current cuDNN library stream. Parameters ---------- handle : cudnnHandle cuDNN context. id : cudaStream Stream Id.
[ "Set", "current", "cuDNN", "library", "stream", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L325-L338
42,890
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetStream
def cudnnGetStream(handle): """ Get current cuDNN library stream. Parameters ---------- handle : int cuDNN context. Returns ------- id : int Stream ID. """ id = ctypes.c_void_p() status = _libcudnn.cudnnGetStream(handle, ctypes.byref(id)) cudnnCheckStat...
python
def cudnnGetStream(handle): """ Get current cuDNN library stream. Parameters ---------- handle : int cuDNN context. Returns ------- id : int Stream ID. """ id = ctypes.c_void_p() status = _libcudnn.cudnnGetStream(handle, ctypes.byref(id)) cudnnCheckStat...
[ "def", "cudnnGetStream", "(", "handle", ")", ":", "id", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnGetStream", "(", "handle", ",", "ctypes", ".", "byref", "(", "id", ")", ")", "cudnnCheckStatus", "(", "status", ")", ...
Get current cuDNN library stream. Parameters ---------- handle : int cuDNN context. Returns ------- id : int Stream ID.
[ "Get", "current", "cuDNN", "library", "stream", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L342-L360
42,891
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreateTensorDescriptor
def cudnnCreateTensorDescriptor(): """ Create a Tensor descriptor object. Allocates a cudnnTensorDescriptor_t structure and returns a pointer to it. Returns ------- tensor_descriptor : int Tensor descriptor. """ tensor = ctypes.c_void_p() status = _libcudnn.cudnnCreateTens...
python
def cudnnCreateTensorDescriptor(): """ Create a Tensor descriptor object. Allocates a cudnnTensorDescriptor_t structure and returns a pointer to it. Returns ------- tensor_descriptor : int Tensor descriptor. """ tensor = ctypes.c_void_p() status = _libcudnn.cudnnCreateTens...
[ "def", "cudnnCreateTensorDescriptor", "(", ")", ":", "tensor", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreateTensorDescriptor", "(", "ctypes", ".", "byref", "(", "tensor", ")", ")", "cudnnCheckStatus", "(", "status", ")...
Create a Tensor descriptor object. Allocates a cudnnTensorDescriptor_t structure and returns a pointer to it. Returns ------- tensor_descriptor : int Tensor descriptor.
[ "Create", "a", "Tensor", "descriptor", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L364-L379
42,892
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetTensor4dDescriptor
def cudnnSetTensor4dDescriptor(tensorDesc, format, dataType, n, c, h, w): """ Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that...
python
def cudnnSetTensor4dDescriptor(tensorDesc, format, dataType, n, c, h, w): """ Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that...
[ "def", "cudnnSetTensor4dDescriptor", "(", "tensorDesc", ",", "format", ",", "dataType", ",", "n", ",", "c", ",", "h", ",", "w", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetTensor4dDescriptor", "(", "tensorDesc", ",", "format", ",", "dataType", ",", ...
Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that the data is contiguous in memory with no padding between dimensions. Paramet...
[ "Initialize", "a", "previously", "created", "Tensor", "4D", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L386-L414
42,893
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetTensor4dDescriptorEx
def cudnnSetTensor4dDescriptorEx(tensorDesc, dataType, n, c, h, w, nStride, cStride, hStride, wStride): """" Initialize a Tensor descriptor object with strides. This function initializes a previously created generic Tensor descriptor object into a 4D tensor, similarly to cudnnSetTensor4dDescriptor but ...
python
def cudnnSetTensor4dDescriptorEx(tensorDesc, dataType, n, c, h, w, nStride, cStride, hStride, wStride): """" Initialize a Tensor descriptor object with strides. This function initializes a previously created generic Tensor descriptor object into a 4D tensor, similarly to cudnnSetTensor4dDescriptor but ...
[ "def", "cudnnSetTensor4dDescriptorEx", "(", "tensorDesc", ",", "dataType", ",", "n", ",", "c", ",", "h", ",", "w", ",", "nStride", ",", "cStride", ",", "hStride", ",", "wStride", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetTensor4dDescriptorEx", "(",...
Initialize a Tensor descriptor object with strides. This function initializes a previously created generic Tensor descriptor object into a 4D tensor, similarly to cudnnSetTensor4dDescriptor but with the strides explicitly passed as parameters. This can be used to lay out the 4D tensor in any order or simpl...
[ "Initialize", "a", "Tensor", "descriptor", "object", "with", "strides", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L420-L455
42,894
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetTensor4dDescriptor
def cudnnGetTensor4dDescriptor(tensorDesc): """" Get parameters of a Tensor descriptor object. This function queries the parameters of the previouly initialized Tensor4D descriptor object. Parameters ---------- tensorDesc : cudnnTensorDescriptor Handle to a previously initialized t...
python
def cudnnGetTensor4dDescriptor(tensorDesc): """" Get parameters of a Tensor descriptor object. This function queries the parameters of the previouly initialized Tensor4D descriptor object. Parameters ---------- tensorDesc : cudnnTensorDescriptor Handle to a previously initialized t...
[ "def", "cudnnGetTensor4dDescriptor", "(", "tensorDesc", ")", ":", "dataType", "=", "ctypes", ".", "c_int", "(", ")", "n", "=", "ctypes", ".", "c_int", "(", ")", "c", "=", "ctypes", ".", "c_int", "(", ")", "h", "=", "ctypes", ".", "c_int", "(", ")", ...
Get parameters of a Tensor descriptor object. This function queries the parameters of the previouly initialized Tensor4D descriptor object. Parameters ---------- tensorDesc : cudnnTensorDescriptor Handle to a previously initialized tensor descriptor. Returns ------- dataType :...
[ "Get", "parameters", "of", "a", "Tensor", "descriptor", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L462-L513
42,895
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreateFilterDescriptor
def cudnnCreateFilterDescriptor(): """" Create a filter descriptor. This function creates a filter descriptor object by allocating the memory needed to hold its opaque structure. Parameters ---------- Returns ------- wDesc : cudnnFilterDescriptor Handle to a newly allocate...
python
def cudnnCreateFilterDescriptor(): """" Create a filter descriptor. This function creates a filter descriptor object by allocating the memory needed to hold its opaque structure. Parameters ---------- Returns ------- wDesc : cudnnFilterDescriptor Handle to a newly allocate...
[ "def", "cudnnCreateFilterDescriptor", "(", ")", ":", "wDesc", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreateFilterDescriptor", "(", "ctypes", ".", "byref", "(", "wDesc", ")", ")", "cudnnCheckStatus", "(", "status", ")",...
Create a filter descriptor. This function creates a filter descriptor object by allocating the memory needed to hold its opaque structure. Parameters ---------- Returns ------- wDesc : cudnnFilterDescriptor Handle to a newly allocated filter descriptor.
[ "Create", "a", "filter", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L686-L706
42,896
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetFilter4dDescriptor
def cudnnSetFilter4dDescriptor(wDesc, dataType, format, k, c, h, w): """" Initialize a filter descriptor. This function initializes a previously created filter descriptor object into a 4D filter. Filters layout must be contiguous in memory. Parameters ---------- wDesc : cudnnFilterDescript...
python
def cudnnSetFilter4dDescriptor(wDesc, dataType, format, k, c, h, w): """" Initialize a filter descriptor. This function initializes a previously created filter descriptor object into a 4D filter. Filters layout must be contiguous in memory. Parameters ---------- wDesc : cudnnFilterDescript...
[ "def", "cudnnSetFilter4dDescriptor", "(", "wDesc", ",", "dataType", ",", "format", ",", "k", ",", "c", ",", "h", ",", "w", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetFilter4dDescriptor", "(", "wDesc", ",", "dataType", ",", "format", ",", "k", ",...
Initialize a filter descriptor. This function initializes a previously created filter descriptor object into a 4D filter. Filters layout must be contiguous in memory. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. dataType : cudnnD...
[ "Initialize", "a", "filter", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L712-L738
42,897
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetFilter4dDescriptor
def cudnnGetFilter4dDescriptor(wDesc): """" Get parameters of filter descriptor. This function queries the parameters of the previouly initialized filter descriptor object. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. Return...
python
def cudnnGetFilter4dDescriptor(wDesc): """" Get parameters of filter descriptor. This function queries the parameters of the previouly initialized filter descriptor object. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. Return...
[ "def", "cudnnGetFilter4dDescriptor", "(", "wDesc", ")", ":", "dataType", "=", "ctypes", ".", "c_int", "(", ")", "format", "=", "ctypes", ".", "c_int", "(", ")", "k", "=", "ctypes", ".", "c_int", "(", ")", "c", "=", "ctypes", ".", "c_int", "(", ")", ...
Get parameters of filter descriptor. This function queries the parameters of the previouly initialized filter descriptor object. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. Returns ------- dataType : cudnnDataType D...
[ "Get", "parameters", "of", "filter", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L744-L784
42,898
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreateConvolutionDescriptor
def cudnnCreateConvolutionDescriptor(): """" Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolut...
python
def cudnnCreateConvolutionDescriptor(): """" Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolut...
[ "def", "cudnnCreateConvolutionDescriptor", "(", ")", ":", "convDesc", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreateConvolutionDescriptor", "(", "ctypes", ".", "byref", "(", "convDesc", ")", ")", "cudnnCheckStatus", "(", ...
Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolution descriptor.
[ "Create", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L804-L822
42,899
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetConvolution2dDescriptor
def cudnnSetConvolution2dDescriptor(convDesc, pad_h, pad_w, u, v, dilation_h, dilation_w, mode, computeType): """" Initialize a convolution descriptor. This function initializes a previously created convolution descriptor object into a 2D correlation. This function a...
python
def cudnnSetConvolution2dDescriptor(convDesc, pad_h, pad_w, u, v, dilation_h, dilation_w, mode, computeType): """" Initialize a convolution descriptor. This function initializes a previously created convolution descriptor object into a 2D correlation. This function a...
[ "def", "cudnnSetConvolution2dDescriptor", "(", "convDesc", ",", "pad_h", ",", "pad_w", ",", "u", ",", "v", ",", "dilation_h", ",", "dilation_w", ",", "mode", ",", "computeType", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetConvolution2dDescriptor", "(", ...
Initialize a convolution descriptor. This function initializes a previously created convolution descriptor object into a 2D correlation. This function assumes that the tensor and filter descriptors corresponds to the formard convolution path and checks if their settings are valid. That same convolution...
[ "Initialize", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L828-L866