repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
CTPUG/wafer
wafer/schedule/admin.py
check_schedule
def check_schedule(): """Helper routine to easily test if the schedule is valid""" all_items = prefetch_schedule_items() for validator, _type, _msg in SCHEDULE_ITEM_VALIDATORS: if validator(all_items): return False all_slots = prefetch_slots() for validator, _type, _msg in SLOT_...
python
def check_schedule(): """Helper routine to easily test if the schedule is valid""" all_items = prefetch_schedule_items() for validator, _type, _msg in SCHEDULE_ITEM_VALIDATORS: if validator(all_items): return False all_slots = prefetch_slots() for validator, _type, _msg in SLOT_...
[ "def", "check_schedule", "(", ")", ":", "all_items", "=", "prefetch_schedule_items", "(", ")", "for", "validator", ",", "_type", ",", "_msg", "in", "SCHEDULE_ITEM_VALIDATORS", ":", "if", "validator", "(", "all_items", ")", ":", "return", "False", "all_slots", ...
Helper routine to easily test if the schedule is valid
[ "Helper", "routine", "to", "easily", "test", "if", "the", "schedule", "is", "valid" ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/schedule/admin.py#L196-L207
train
CTPUG/wafer
wafer/schedule/admin.py
validate_schedule
def validate_schedule(): """Helper routine to report issues with the schedule""" all_items = prefetch_schedule_items() errors = [] for validator, _type, msg in SCHEDULE_ITEM_VALIDATORS: if validator(all_items): errors.append(msg) all_slots = prefetch_slots() for validator, _...
python
def validate_schedule(): """Helper routine to report issues with the schedule""" all_items = prefetch_schedule_items() errors = [] for validator, _type, msg in SCHEDULE_ITEM_VALIDATORS: if validator(all_items): errors.append(msg) all_slots = prefetch_slots() for validator, _...
[ "def", "validate_schedule", "(", ")", ":", "all_items", "=", "prefetch_schedule_items", "(", ")", "errors", "=", "[", "]", "for", "validator", ",", "_type", ",", "msg", "in", "SCHEDULE_ITEM_VALIDATORS", ":", "if", "validator", "(", "all_items", ")", ":", "er...
Helper routine to report issues with the schedule
[ "Helper", "routine", "to", "report", "issues", "with", "the", "schedule" ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/schedule/admin.py#L210-L222
train
CTPUG/wafer
wafer/schedule/admin.py
SlotAdmin.get_form
def get_form(self, request, obj=None, **kwargs): """Change the form depending on whether we're adding or editing the slot.""" if obj is None: # Adding a new Slot kwargs['form'] = SlotAdminAddForm return super(SlotAdmin, self).get_form(request, obj, **kwargs)
python
def get_form(self, request, obj=None, **kwargs): """Change the form depending on whether we're adding or editing the slot.""" if obj is None: # Adding a new Slot kwargs['form'] = SlotAdminAddForm return super(SlotAdmin, self).get_form(request, obj, **kwargs)
[ "def", "get_form", "(", "self", ",", "request", ",", "obj", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "obj", "is", "None", ":", "# Adding a new Slot", "kwargs", "[", "'form'", "]", "=", "SlotAdminAddForm", "return", "super", "(", "SlotAdmin",...
Change the form depending on whether we're adding or editing the slot.
[ "Change", "the", "form", "depending", "on", "whether", "we", "re", "adding", "or", "editing", "the", "slot", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/schedule/admin.py#L457-L463
train
CTPUG/wafer
wafer/menu.py
get_cached_menus
def get_cached_menus(): """Return the menus from the cache or generate them if needed.""" items = cache.get(CACHE_KEY) if items is None: menu = generate_menu() cache.set(CACHE_KEY, menu.items) else: menu = Menu(items) return menu
python
def get_cached_menus(): """Return the menus from the cache or generate them if needed.""" items = cache.get(CACHE_KEY) if items is None: menu = generate_menu() cache.set(CACHE_KEY, menu.items) else: menu = Menu(items) return menu
[ "def", "get_cached_menus", "(", ")", ":", "items", "=", "cache", ".", "get", "(", "CACHE_KEY", ")", "if", "items", "is", "None", ":", "menu", "=", "generate_menu", "(", ")", "cache", ".", "set", "(", "CACHE_KEY", ",", "menu", ".", "items", ")", "else...
Return the menus from the cache or generate them if needed.
[ "Return", "the", "menus", "from", "the", "cache", "or", "generate", "them", "if", "needed", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/menu.py#L12-L20
train
CTPUG/wafer
wafer/menu.py
maybe_obj
def maybe_obj(str_or_obj): """If argument is not a string, return it. Otherwise import the dotted name and return that. """ if not isinstance(str_or_obj, six.string_types): return str_or_obj parts = str_or_obj.split(".") mod, modname = None, None for p in parts: modname = p ...
python
def maybe_obj(str_or_obj): """If argument is not a string, return it. Otherwise import the dotted name and return that. """ if not isinstance(str_or_obj, six.string_types): return str_or_obj parts = str_or_obj.split(".") mod, modname = None, None for p in parts: modname = p ...
[ "def", "maybe_obj", "(", "str_or_obj", ")", ":", "if", "not", "isinstance", "(", "str_or_obj", ",", "six", ".", "string_types", ")", ":", "return", "str_or_obj", "parts", "=", "str_or_obj", ".", "split", "(", "\".\"", ")", "mod", ",", "modname", "=", "No...
If argument is not a string, return it. Otherwise import the dotted name and return that.
[ "If", "argument", "is", "not", "a", "string", "return", "it", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/menu.py#L44-L64
train
CTPUG/wafer
wafer/menu.py
generate_menu
def generate_menu(): """Generate a new list of menus.""" root_menu = Menu(list(copy.deepcopy(settings.WAFER_MENUS))) for dynamic_menu_func in settings.WAFER_DYNAMIC_MENUS: dynamic_menu_func = maybe_obj(dynamic_menu_func) dynamic_menu_func(root_menu) return root_menu
python
def generate_menu(): """Generate a new list of menus.""" root_menu = Menu(list(copy.deepcopy(settings.WAFER_MENUS))) for dynamic_menu_func in settings.WAFER_DYNAMIC_MENUS: dynamic_menu_func = maybe_obj(dynamic_menu_func) dynamic_menu_func(root_menu) return root_menu
[ "def", "generate_menu", "(", ")", ":", "root_menu", "=", "Menu", "(", "list", "(", "copy", ".", "deepcopy", "(", "settings", ".", "WAFER_MENUS", ")", ")", ")", "for", "dynamic_menu_func", "in", "settings", ".", "WAFER_DYNAMIC_MENUS", ":", "dynamic_menu_func", ...
Generate a new list of menus.
[ "Generate", "a", "new", "list", "of", "menus", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/menu.py#L67-L73
train
codenerix/django-codenerix
codenerix/lib/pylock.py
pylock.lock
def lock(self): ''' Try to get locked the file - the function will wait until the file is unlocked if 'wait' was defined as locktype - the funciton will raise AlreadyLocked exception if 'lock' was defined as locktype ''' # Open file self.__fd = open(self.__lockfi...
python
def lock(self): ''' Try to get locked the file - the function will wait until the file is unlocked if 'wait' was defined as locktype - the funciton will raise AlreadyLocked exception if 'lock' was defined as locktype ''' # Open file self.__fd = open(self.__lockfi...
[ "def", "lock", "(", "self", ")", ":", "# Open file", "self", ".", "__fd", "=", "open", "(", "self", ".", "__lockfile", ",", "\"w\"", ")", "# Get it locked", "if", "self", ".", "__locktype", "==", "\"wait\"", ":", "# Try to get it locked until ready", "fcntl", ...
Try to get locked the file - the function will wait until the file is unlocked if 'wait' was defined as locktype - the funciton will raise AlreadyLocked exception if 'lock' was defined as locktype
[ "Try", "to", "get", "locked", "the", "file", "-", "the", "function", "will", "wait", "until", "the", "file", "is", "unlocked", "if", "wait", "was", "defined", "as", "locktype", "-", "the", "funciton", "will", "raise", "AlreadyLocked", "exception", "if", "l...
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/lib/pylock.py#L70-L89
train
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
_make_handler
def _make_handler(state_token, done_function): ''' Makes a a handler class to use inside the basic python HTTP server. state_token is the expected state token. done_function is a function that is called, with the code passed to it. ''' class LocalServerHandler(BaseHTTPServer.BaseHTTPRequestHan...
python
def _make_handler(state_token, done_function): ''' Makes a a handler class to use inside the basic python HTTP server. state_token is the expected state token. done_function is a function that is called, with the code passed to it. ''' class LocalServerHandler(BaseHTTPServer.BaseHTTPRequestHan...
[ "def", "_make_handler", "(", "state_token", ",", "done_function", ")", ":", "class", "LocalServerHandler", "(", "BaseHTTPServer", ".", "BaseHTTPRequestHandler", ")", ":", "def", "error_response", "(", "self", ",", "msg", ")", ":", "logging", ".", "warn", "(", ...
Makes a a handler class to use inside the basic python HTTP server. state_token is the expected state token. done_function is a function that is called, with the code passed to it.
[ "Makes", "a", "a", "handler", "class", "to", "use", "inside", "the", "basic", "python", "HTTP", "server", "." ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L105-L151
train
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
configuration
def configuration(): 'Loads configuration from the file system.' defaults = ''' [oauth2] hostname = localhost port = 9876 api_endpoint = https://api.coursera.org auth_endpoint = https://accounts.coursera.org/oauth2/v1/auth token_endpoint = https://accounts.coursera.org/oauth2/v1/token verify_tls = True token_ca...
python
def configuration(): 'Loads configuration from the file system.' defaults = ''' [oauth2] hostname = localhost port = 9876 api_endpoint = https://api.coursera.org auth_endpoint = https://accounts.coursera.org/oauth2/v1/auth token_endpoint = https://accounts.coursera.org/oauth2/v1/token verify_tls = True token_ca...
[ "def", "configuration", "(", ")", ":", "defaults", "=", "'''\n[oauth2]\nhostname = localhost\nport = 9876\napi_endpoint = https://api.coursera.org\nauth_endpoint = https://accounts.coursera.org/oauth2/v1/auth\ntoken_endpoint = https://accounts.coursera.org/oauth2/v1/token\nverify_tls = True\ntoken_cac...
Loads configuration from the file system.
[ "Loads", "configuration", "from", "the", "file", "system", "." ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L522-L551
train
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
CourseraOAuth2._load_token_cache
def _load_token_cache(self): 'Reads the local fs cache for pre-authorized access tokens' try: logging.debug('About to read from local file cache file %s', self.token_cache_file) with open(self.token_cache_file, 'rb') as f: fs_cached = cPi...
python
def _load_token_cache(self): 'Reads the local fs cache for pre-authorized access tokens' try: logging.debug('About to read from local file cache file %s', self.token_cache_file) with open(self.token_cache_file, 'rb') as f: fs_cached = cPi...
[ "def", "_load_token_cache", "(", "self", ")", ":", "try", ":", "logging", ".", "debug", "(", "'About to read from local file cache file %s'", ",", "self", ".", "token_cache_file", ")", "with", "open", "(", "self", ".", "token_cache_file", ",", "'rb'", ")", "as",...
Reads the local fs cache for pre-authorized access tokens
[ "Reads", "the", "local", "fs", "cache", "for", "pre", "-", "authorized", "access", "tokens" ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L230-L253
train
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
CourseraOAuth2._save_token_cache
def _save_token_cache(self, new_cache): 'Write out to the filesystem a cache of the OAuth2 information.' logging.debug('Looking to write to local authentication cache...') if not self._check_token_cache_type(new_cache): logging.error('Attempt to save a bad value: %s', new_cache) ...
python
def _save_token_cache(self, new_cache): 'Write out to the filesystem a cache of the OAuth2 information.' logging.debug('Looking to write to local authentication cache...') if not self._check_token_cache_type(new_cache): logging.error('Attempt to save a bad value: %s', new_cache) ...
[ "def", "_save_token_cache", "(", "self", ",", "new_cache", ")", ":", "logging", ".", "debug", "(", "'Looking to write to local authentication cache...'", ")", "if", "not", "self", ".", "_check_token_cache_type", "(", "new_cache", ")", ":", "logging", ".", "error", ...
Write out to the filesystem a cache of the OAuth2 information.
[ "Write", "out", "to", "the", "filesystem", "a", "cache", "of", "the", "OAuth2", "information", "." ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L255-L270
train
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
CourseraOAuth2._check_token_cache_type
def _check_token_cache_type(self, cache_value): ''' Checks the cache_value for appropriate type correctness. Pass strict=True for strict validation to ensure the latest types are being written. Returns true is correct type, False otherwise. ''' def check_string_...
python
def _check_token_cache_type(self, cache_value): ''' Checks the cache_value for appropriate type correctness. Pass strict=True for strict validation to ensure the latest types are being written. Returns true is correct type, False otherwise. ''' def check_string_...
[ "def", "_check_token_cache_type", "(", "self", ",", "cache_value", ")", ":", "def", "check_string_value", "(", "name", ")", ":", "return", "(", "isinstance", "(", "cache_value", "[", "name", "]", ",", "str", ")", "or", "isinstance", "(", "cache_value", "[", ...
Checks the cache_value for appropriate type correctness. Pass strict=True for strict validation to ensure the latest types are being written. Returns true is correct type, False otherwise.
[ "Checks", "the", "cache_value", "for", "appropriate", "type", "correctness", "." ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L272-L300
train
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
CourseraOAuth2._authorize_new_tokens
def _authorize_new_tokens(self): ''' Stands up a new localhost http server and retrieves new OAuth2 access tokens from the Coursera OAuth2 server. ''' logging.info('About to request new OAuth2 tokens from Coursera.') # Attempt to request new tokens from Coursera via the b...
python
def _authorize_new_tokens(self): ''' Stands up a new localhost http server and retrieves new OAuth2 access tokens from the Coursera OAuth2 server. ''' logging.info('About to request new OAuth2 tokens from Coursera.') # Attempt to request new tokens from Coursera via the b...
[ "def", "_authorize_new_tokens", "(", "self", ")", ":", "logging", ".", "info", "(", "'About to request new OAuth2 tokens from Coursera.'", ")", "# Attempt to request new tokens from Coursera via the browser.", "state_token", "=", "uuid", ".", "uuid4", "(", ")", ".", "hex", ...
Stands up a new localhost http server and retrieves new OAuth2 access tokens from the Coursera OAuth2 server.
[ "Stands", "up", "a", "new", "localhost", "http", "server", "and", "retrieves", "new", "OAuth2", "access", "tokens", "from", "the", "Coursera", "OAuth2", "server", "." ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L369-L415
train
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
CourseraOAuth2._exchange_refresh_tokens
def _exchange_refresh_tokens(self): 'Exchanges a refresh token for an access token' if self.token_cache is not None and 'refresh' in self.token_cache: # Attempt to use the refresh token to get a new access token. refresh_form = { 'grant_type': 'refresh_token', ...
python
def _exchange_refresh_tokens(self): 'Exchanges a refresh token for an access token' if self.token_cache is not None and 'refresh' in self.token_cache: # Attempt to use the refresh token to get a new access token. refresh_form = { 'grant_type': 'refresh_token', ...
[ "def", "_exchange_refresh_tokens", "(", "self", ")", ":", "if", "self", ".", "token_cache", "is", "not", "None", "and", "'refresh'", "in", "self", ".", "token_cache", ":", "# Attempt to use the refresh token to get a new access token.", "refresh_form", "=", "{", "'gra...
Exchanges a refresh token for an access token
[ "Exchanges", "a", "refresh", "token", "for", "an", "access", "token" ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L417-L434
train
codenerix/django-codenerix
codenerix/templatetags/codenerix_lists.py
foreignkey
def foreignkey(element, exceptions): ''' function to determine if each select field needs a create button or not ''' label = element.field.__dict__['label'] try: label = unicode(label) except NameError: pass if (not label) or (label in exceptions): return False el...
python
def foreignkey(element, exceptions): ''' function to determine if each select field needs a create button or not ''' label = element.field.__dict__['label'] try: label = unicode(label) except NameError: pass if (not label) or (label in exceptions): return False el...
[ "def", "foreignkey", "(", "element", ",", "exceptions", ")", ":", "label", "=", "element", ".", "field", ".", "__dict__", "[", "'label'", "]", "try", ":", "label", "=", "unicode", "(", "label", ")", "except", "NameError", ":", "pass", "if", "(", "not",...
function to determine if each select field needs a create button or not
[ "function", "to", "determine", "if", "each", "select", "field", "needs", "a", "create", "button", "or", "not" ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/templatetags/codenerix_lists.py#L218-L230
train
CTPUG/wafer
wafer/kv/utils.py
deserialize_by_field
def deserialize_by_field(value, field): """ Some types get serialized to JSON, as strings. If we know what they are supposed to be, we can deserialize them """ if isinstance(field, forms.DateTimeField): value = parse_datetime(value) elif isinstance(field, forms.DateField): value ...
python
def deserialize_by_field(value, field): """ Some types get serialized to JSON, as strings. If we know what they are supposed to be, we can deserialize them """ if isinstance(field, forms.DateTimeField): value = parse_datetime(value) elif isinstance(field, forms.DateField): value ...
[ "def", "deserialize_by_field", "(", "value", ",", "field", ")", ":", "if", "isinstance", "(", "field", ",", "forms", ".", "DateTimeField", ")", ":", "value", "=", "parse_datetime", "(", "value", ")", "elif", "isinstance", "(", "field", ",", "forms", ".", ...
Some types get serialized to JSON, as strings. If we know what they are supposed to be, we can deserialize them
[ "Some", "types", "get", "serialized", "to", "JSON", "as", "strings", ".", "If", "we", "know", "what", "they", "are", "supposed", "to", "be", "we", "can", "deserialize", "them" ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/kv/utils.py#L5-L16
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.hyperprior
def hyperprior(self): """Combined hyperprior for the kernel, noise kernel and (if present) mean function. """ hp = self.k.hyperprior * self.noise_k.hyperprior if self.mu is not None: hp *= self.mu.hyperprior return hp
python
def hyperprior(self): """Combined hyperprior for the kernel, noise kernel and (if present) mean function. """ hp = self.k.hyperprior * self.noise_k.hyperprior if self.mu is not None: hp *= self.mu.hyperprior return hp
[ "def", "hyperprior", "(", "self", ")", ":", "hp", "=", "self", ".", "k", ".", "hyperprior", "*", "self", ".", "noise_k", ".", "hyperprior", "if", "self", ".", "mu", "is", "not", "None", ":", "hp", "*=", "self", ".", "mu", ".", "hyperprior", "return...
Combined hyperprior for the kernel, noise kernel and (if present) mean function.
[ "Combined", "hyperprior", "for", "the", "kernel", "noise", "kernel", "and", "(", "if", "present", ")", "mean", "function", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L247-L253
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.fixed_params
def fixed_params(self): """Combined fixed hyperparameter flags for the kernel, noise kernel and (if present) mean function. """ fp = CombinedBounds(self.k.fixed_params, self.noise_k.fixed_params) if self.mu is not None: fp = CombinedBounds(fp, self.mu.fixed_params) re...
python
def fixed_params(self): """Combined fixed hyperparameter flags for the kernel, noise kernel and (if present) mean function. """ fp = CombinedBounds(self.k.fixed_params, self.noise_k.fixed_params) if self.mu is not None: fp = CombinedBounds(fp, self.mu.fixed_params) re...
[ "def", "fixed_params", "(", "self", ")", ":", "fp", "=", "CombinedBounds", "(", "self", ".", "k", ".", "fixed_params", ",", "self", ".", "noise_k", ".", "fixed_params", ")", "if", "self", ".", "mu", "is", "not", "None", ":", "fp", "=", "CombinedBounds"...
Combined fixed hyperparameter flags for the kernel, noise kernel and (if present) mean function.
[ "Combined", "fixed", "hyperparameter", "flags", "for", "the", "kernel", "noise", "kernel", "and", "(", "if", "present", ")", "mean", "function", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L261-L267
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.params
def params(self): """Combined hyperparameters for the kernel, noise kernel and (if present) mean function. """ p = CombinedBounds(self.k.params, self.noise_k.params) if self.mu is not None: p = CombinedBounds(p, self.mu.params) return p
python
def params(self): """Combined hyperparameters for the kernel, noise kernel and (if present) mean function. """ p = CombinedBounds(self.k.params, self.noise_k.params) if self.mu is not None: p = CombinedBounds(p, self.mu.params) return p
[ "def", "params", "(", "self", ")", ":", "p", "=", "CombinedBounds", "(", "self", ".", "k", ".", "params", ",", "self", ".", "noise_k", ".", "params", ")", "if", "self", ".", "mu", "is", "not", "None", ":", "p", "=", "CombinedBounds", "(", "p", ",...
Combined hyperparameters for the kernel, noise kernel and (if present) mean function.
[ "Combined", "hyperparameters", "for", "the", "kernel", "noise", "kernel", "and", "(", "if", "present", ")", "mean", "function", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L278-L284
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.param_names
def param_names(self): """Combined names for the hyperparameters for the kernel, noise kernel and (if present) mean function. """ pn = CombinedBounds(self.k.param_names, self.noise_k.param_names) if self.mu is not None: pn = CombinedBounds(pn, self.mu.param_names) ret...
python
def param_names(self): """Combined names for the hyperparameters for the kernel, noise kernel and (if present) mean function. """ pn = CombinedBounds(self.k.param_names, self.noise_k.param_names) if self.mu is not None: pn = CombinedBounds(pn, self.mu.param_names) ret...
[ "def", "param_names", "(", "self", ")", ":", "pn", "=", "CombinedBounds", "(", "self", ".", "k", ".", "param_names", ",", "self", ".", "noise_k", ".", "param_names", ")", "if", "self", ".", "mu", "is", "not", "None", ":", "pn", "=", "CombinedBounds", ...
Combined names for the hyperparameters for the kernel, noise kernel and (if present) mean function.
[ "Combined", "names", "for", "the", "hyperparameters", "for", "the", "kernel", "noise", "kernel", "and", "(", "if", "present", ")", "mean", "function", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L306-L312
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.free_params
def free_params(self): """Combined free hyperparameters for the kernel, noise kernel and (if present) mean function. """ p = CombinedBounds(self.k.free_params, self.noise_k.free_params) if self.mu is not None: p = CombinedBounds(p, self.mu.free_params) return p
python
def free_params(self): """Combined free hyperparameters for the kernel, noise kernel and (if present) mean function. """ p = CombinedBounds(self.k.free_params, self.noise_k.free_params) if self.mu is not None: p = CombinedBounds(p, self.mu.free_params) return p
[ "def", "free_params", "(", "self", ")", ":", "p", "=", "CombinedBounds", "(", "self", ".", "k", ".", "free_params", ",", "self", ".", "noise_k", ".", "free_params", ")", "if", "self", ".", "mu", "is", "not", "None", ":", "p", "=", "CombinedBounds", "...
Combined free hyperparameters for the kernel, noise kernel and (if present) mean function.
[ "Combined", "free", "hyperparameters", "for", "the", "kernel", "noise", "kernel", "and", "(", "if", "present", ")", "mean", "function", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L322-L328
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.free_params
def free_params(self, value): """Set the free parameters. Note that this bypasses enforce_bounds. """ value = scipy.asarray(value, dtype=float) self.K_up_to_date = False self.k.free_params = value[:self.k.num_free_params] self.noise_k.free_params = value[self.k.num_free_p...
python
def free_params(self, value): """Set the free parameters. Note that this bypasses enforce_bounds. """ value = scipy.asarray(value, dtype=float) self.K_up_to_date = False self.k.free_params = value[:self.k.num_free_params] self.noise_k.free_params = value[self.k.num_free_p...
[ "def", "free_params", "(", "self", ",", "value", ")", ":", "value", "=", "scipy", ".", "asarray", "(", "value", ",", "dtype", "=", "float", ")", "self", ".", "K_up_to_date", "=", "False", "self", ".", "k", ".", "free_params", "=", "value", "[", ":", ...
Set the free parameters. Note that this bypasses enforce_bounds.
[ "Set", "the", "free", "parameters", ".", "Note", "that", "this", "bypasses", "enforce_bounds", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L331-L339
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.free_param_bounds
def free_param_bounds(self): """Combined free hyperparameter bounds for the kernel, noise kernel and (if present) mean function. """ fpb = CombinedBounds(self.k.free_param_bounds, self.noise_k.free_param_bounds) if self.mu is not None: fpb = CombinedBounds(fpb, self.mu.free_p...
python
def free_param_bounds(self): """Combined free hyperparameter bounds for the kernel, noise kernel and (if present) mean function. """ fpb = CombinedBounds(self.k.free_param_bounds, self.noise_k.free_param_bounds) if self.mu is not None: fpb = CombinedBounds(fpb, self.mu.free_p...
[ "def", "free_param_bounds", "(", "self", ")", ":", "fpb", "=", "CombinedBounds", "(", "self", ".", "k", ".", "free_param_bounds", ",", "self", ".", "noise_k", ".", "free_param_bounds", ")", "if", "self", ".", "mu", "is", "not", "None", ":", "fpb", "=", ...
Combined free hyperparameter bounds for the kernel, noise kernel and (if present) mean function.
[ "Combined", "free", "hyperparameter", "bounds", "for", "the", "kernel", "noise", "kernel", "and", "(", "if", "present", ")", "mean", "function", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L342-L348
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.free_param_names
def free_param_names(self): """Combined free hyperparameter names for the kernel, noise kernel and (if present) mean function. """ p = CombinedBounds(self.k.free_param_names, self.noise_k.free_param_names) if self.mu is not None: p = CombinedBounds(p, self.mu.free_param_names...
python
def free_param_names(self): """Combined free hyperparameter names for the kernel, noise kernel and (if present) mean function. """ p = CombinedBounds(self.k.free_param_names, self.noise_k.free_param_names) if self.mu is not None: p = CombinedBounds(p, self.mu.free_param_names...
[ "def", "free_param_names", "(", "self", ")", ":", "p", "=", "CombinedBounds", "(", "self", ".", "k", ".", "free_param_names", ",", "self", ".", "noise_k", ".", "free_param_names", ")", "if", "self", ".", "mu", "is", "not", "None", ":", "p", "=", "Combi...
Combined free hyperparameter names for the kernel, noise kernel and (if present) mean function.
[ "Combined", "free", "hyperparameter", "names", "for", "the", "kernel", "noise", "kernel", "and", "(", "if", "present", ")", "mean", "function", "." ]
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L359-L365
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.add_data
def add_data(self, X, y, err_y=0, n=0, T=None): """Add data to the training data set of the GaussianProcess instance. Parameters ---------- X : array, (`M`, `D`) `M` input values of dimension `D`. y : array, (`M`,) `M` target values. er...
python
def add_data(self, X, y, err_y=0, n=0, T=None): """Add data to the training data set of the GaussianProcess instance. Parameters ---------- X : array, (`M`, `D`) `M` input values of dimension `D`. y : array, (`M`,) `M` target values. er...
[ "def", "add_data", "(", "self", ",", "X", ",", "y", ",", "err_y", "=", "0", ",", "n", "=", "0", ",", "T", "=", "None", ")", ":", "# Verify y has only one non-trivial dimension:", "y", "=", "scipy", ".", "atleast_1d", "(", "scipy", ".", "asarray", "(", ...
Add data to the training data set of the GaussianProcess instance. Parameters ---------- X : array, (`M`, `D`) `M` input values of dimension `D`. y : array, (`M`,) `M` target values. err_y : array, (`M`,) or scalar float, optional Non-...
[ "Add", "data", "to", "the", "training", "data", "set", "of", "the", "GaussianProcess", "instance", ".", "Parameters", "----------", "X", ":", "array", "(", "M", "D", ")", "M", "input", "values", "of", "dimension", "D", ".", "y", ":", "array", "(", "M",...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L376-L499
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.condense_duplicates
def condense_duplicates(self): """Condense duplicate points using a transformation matrix. This is useful if you have multiple non-transformed points at the same location or multiple transformed points that use the same quadrature points. Won't change the GP if ...
python
def condense_duplicates(self): """Condense duplicate points using a transformation matrix. This is useful if you have multiple non-transformed points at the same location or multiple transformed points that use the same quadrature points. Won't change the GP if ...
[ "def", "condense_duplicates", "(", "self", ")", ":", "unique", ",", "inv", "=", "unique_rows", "(", "scipy", ".", "hstack", "(", "(", "self", ".", "X", ",", "self", ".", "n", ")", ")", ",", "return_inverse", "=", "True", ")", "# Only proceed if there is ...
Condense duplicate points using a transformation matrix. This is useful if you have multiple non-transformed points at the same location or multiple transformed points that use the same quadrature points. Won't change the GP if all of the rows of [X, n] are unique. Will...
[ "Condense", "duplicate", "points", "using", "a", "transformation", "matrix", ".", "This", "is", "useful", "if", "you", "have", "multiple", "non", "-", "transformed", "points", "at", "the", "same", "location", "or", "multiple", "transformed", "points", "that", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L501-L537
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.remove_outliers
def remove_outliers(self, thresh=3, **predict_kwargs): """Remove outliers from the GP with very simplistic outlier detection. Removes points that are more than `thresh` * `err_y` away from the GP mean. Note that this is only very rough in that it ignores the uncertainty in the G...
python
def remove_outliers(self, thresh=3, **predict_kwargs): """Remove outliers from the GP with very simplistic outlier detection. Removes points that are more than `thresh` * `err_y` away from the GP mean. Note that this is only very rough in that it ignores the uncertainty in the G...
[ "def", "remove_outliers", "(", "self", ",", "thresh", "=", "3", ",", "*", "*", "predict_kwargs", ")", ":", "mean", "=", "self", ".", "predict", "(", "self", ".", "X", ",", "n", "=", "self", ".", "n", ",", "noise", "=", "False", ",", "return_std", ...
Remove outliers from the GP with very simplistic outlier detection. Removes points that are more than `thresh` * `err_y` away from the GP mean. Note that this is only very rough in that it ignores the uncertainty in the GP mean at any given point. But you should only be using th...
[ "Remove", "outliers", "from", "the", "GP", "with", "very", "simplistic", "outlier", "detection", ".", "Removes", "points", "that", "are", "more", "than", "thresh", "*", "err_y", "away", "from", "the", "GP", "mean", ".", "Note", "that", "this", "is", "only"...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L539-L617
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.optimize_hyperparameters
def optimize_hyperparameters(self, method='SLSQP', opt_kwargs={}, verbose=False, random_starts=None, num_proc=None, max_tries=1): r"""Optimize the hyperparameters by maximizing the log-posterior. Leaves the :py:class:`GaussianPro...
python
def optimize_hyperparameters(self, method='SLSQP', opt_kwargs={}, verbose=False, random_starts=None, num_proc=None, max_tries=1): r"""Optimize the hyperparameters by maximizing the log-posterior. Leaves the :py:class:`GaussianPro...
[ "def", "optimize_hyperparameters", "(", "self", ",", "method", "=", "'SLSQP'", ",", "opt_kwargs", "=", "{", "}", ",", "verbose", "=", "False", ",", "random_starts", "=", "None", ",", "num_proc", "=", "None", ",", "max_tries", "=", "1", ")", ":", "if", ...
r"""Optimize the hyperparameters by maximizing the log-posterior. Leaves the :py:class:`GaussianProcess` instance in the optimized state. If :py:func:`scipy.optimize.minimize` is not available (i.e., if your :py:mod:`scipy` version is older than 0.11.0) then :py:func:`fmin_slsq...
[ "r", "Optimize", "the", "hyperparameters", "by", "maximizing", "the", "log", "-", "posterior", ".", "Leaves", "the", ":", "py", ":", "class", ":", "GaussianProcess", "instance", "in", "the", "optimized", "state", ".", "If", ":", "py", ":", "func", ":", "...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L619-L777
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.predict
def predict(self, Xstar, n=0, noise=False, return_std=True, return_cov=False, full_output=False, return_samples=False, num_samples=1, samp_kwargs={}, return_mean_func=False, use_MCMC=False, full_MC=False, rejection_func=None, ddof=1, output_transform=None, ...
python
def predict(self, Xstar, n=0, noise=False, return_std=True, return_cov=False, full_output=False, return_samples=False, num_samples=1, samp_kwargs={}, return_mean_func=False, use_MCMC=False, full_MC=False, rejection_func=None, ddof=1, output_transform=None, ...
[ "def", "predict", "(", "self", ",", "Xstar", ",", "n", "=", "0", ",", "noise", "=", "False", ",", "return_std", "=", "True", ",", "return_cov", "=", "False", ",", "full_output", "=", "False", ",", "return_samples", "=", "False", ",", "num_samples", "="...
Predict the mean and covariance at the inputs `Xstar`. The order of the derivative is given by `n`. The keyword `noise` sets whether or not noise is included in the prediction. Parameters ---------- Xstar : array, (`M`, `D`) `M` test input values of ...
[ "Predict", "the", "mean", "and", "covariance", "at", "the", "inputs", "Xstar", ".", "The", "order", "of", "the", "derivative", "is", "given", "by", "n", ".", "The", "keyword", "noise", "sets", "whether", "or", "not", "noise", "is", "included", "in", "the...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L779-L1024
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.plot
def plot(self, X=None, n=0, ax=None, envelopes=[1, 3], base_alpha=0.375, return_prediction=False, return_std=True, full_output=False, plot_kwargs={}, **kwargs): """Plots the Gaussian process using the current hyperparameters. Only for num_dim <= 2. Parameters -...
python
def plot(self, X=None, n=0, ax=None, envelopes=[1, 3], base_alpha=0.375, return_prediction=False, return_std=True, full_output=False, plot_kwargs={}, **kwargs): """Plots the Gaussian process using the current hyperparameters. Only for num_dim <= 2. Parameters -...
[ "def", "plot", "(", "self", ",", "X", "=", "None", ",", "n", "=", "0", ",", "ax", "=", "None", ",", "envelopes", "=", "[", "1", ",", "3", "]", ",", "base_alpha", "=", "0.375", ",", "return_prediction", "=", "False", ",", "return_std", "=", "True"...
Plots the Gaussian process using the current hyperparameters. Only for num_dim <= 2. Parameters ---------- X : array-like (`M`,) or (`M`, `num_dim`), optional The values to evaluate the Gaussian process at. If None, then 100 points between the minimum and maximum...
[ "Plots", "the", "Gaussian", "process", "using", "the", "current", "hyperparameters", ".", "Only", "for", "num_dim", "<", "=", "2", ".", "Parameters", "----------", "X", ":", "array", "-", "like", "(", "M", ")", "or", "(", "M", "num_dim", ")", "optional",...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1026-L1143
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.draw_sample
def draw_sample(self, Xstar, n=0, num_samp=1, rand_vars=None, rand_type='standard normal', diag_factor=1e3, method='cholesky', num_eig=None, mean=None, cov=None, modify_sign=None, **kwargs): """Draw a sample evaluated at the given points `Xstar`. ...
python
def draw_sample(self, Xstar, n=0, num_samp=1, rand_vars=None, rand_type='standard normal', diag_factor=1e3, method='cholesky', num_eig=None, mean=None, cov=None, modify_sign=None, **kwargs): """Draw a sample evaluated at the given points `Xstar`. ...
[ "def", "draw_sample", "(", "self", ",", "Xstar", ",", "n", "=", "0", ",", "num_samp", "=", "1", ",", "rand_vars", "=", "None", ",", "rand_type", "=", "'standard normal'", ",", "diag_factor", "=", "1e3", ",", "method", "=", "'cholesky'", ",", "num_eig", ...
Draw a sample evaluated at the given points `Xstar`. Note that this function draws samples from the GP given the current values for the hyperparameters (which may be in a nonsense state if you just created the instance or called a method that performs MCMC sampling). If you want...
[ "Draw", "a", "sample", "evaluated", "at", "the", "given", "points", "Xstar", ".", "Note", "that", "this", "function", "draws", "samples", "from", "the", "GP", "given", "the", "current", "values", "for", "the", "hyperparameters", "(", "which", "may", "be", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1145-L1320
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.update_hyperparameters
def update_hyperparameters(self, new_params, hyper_deriv_handling='default', exit_on_bounds=True, inf_on_error=True): r"""Update the kernel's hyperparameters to the new parameters. This will call :py:meth:`compute_K_L_alpha_ll` to update the state accordingly. Note that...
python
def update_hyperparameters(self, new_params, hyper_deriv_handling='default', exit_on_bounds=True, inf_on_error=True): r"""Update the kernel's hyperparameters to the new parameters. This will call :py:meth:`compute_K_L_alpha_ll` to update the state accordingly. Note that...
[ "def", "update_hyperparameters", "(", "self", ",", "new_params", ",", "hyper_deriv_handling", "=", "'default'", ",", "exit_on_bounds", "=", "True", ",", "inf_on_error", "=", "True", ")", ":", "use_hyper_deriv", "=", "self", ".", "use_hyper_deriv", "if", "hyper_der...
r"""Update the kernel's hyperparameters to the new parameters. This will call :py:meth:`compute_K_L_alpha_ll` to update the state accordingly. Note that if this method crashes and the `hyper_deriv_handling` keyword was used, it may leave :py:attr:`use_hyper_deriv` in th...
[ "r", "Update", "the", "kernel", "s", "hyperparameters", "to", "the", "new", "parameters", ".", "This", "will", "call", ":", "py", ":", "meth", ":", "compute_K_L_alpha_ll", "to", "update", "the", "state", "accordingly", ".", "Note", "that", "if", "this", "m...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1322-L1405
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.compute_K_L_alpha_ll
def compute_K_L_alpha_ll(self): r"""Compute `K`, `L`, `alpha` and log-likelihood according to the first part of Algorithm 2.1 in R&W. Computes `K` and the noise portion of `K` using :py:meth:`compute_Kij`, computes `L` using :py:func:`scipy.linalg.cholesky`, then computes `alpha...
python
def compute_K_L_alpha_ll(self): r"""Compute `K`, `L`, `alpha` and log-likelihood according to the first part of Algorithm 2.1 in R&W. Computes `K` and the noise portion of `K` using :py:meth:`compute_Kij`, computes `L` using :py:func:`scipy.linalg.cholesky`, then computes `alpha...
[ "def", "compute_K_L_alpha_ll", "(", "self", ")", ":", "if", "not", "self", ".", "K_up_to_date", ":", "y", "=", "self", ".", "y", "err_y", "=", "self", ".", "err_y", "self", ".", "K", "=", "self", ".", "compute_Kij", "(", "self", ".", "X", ",", "Non...
r"""Compute `K`, `L`, `alpha` and log-likelihood according to the first part of Algorithm 2.1 in R&W. Computes `K` and the noise portion of `K` using :py:meth:`compute_Kij`, computes `L` using :py:func:`scipy.linalg.cholesky`, then computes `alpha` as `L.T\\(L\\y)`. Onl...
[ "r", "Compute", "K", "L", "alpha", "and", "log", "-", "likelihood", "according", "to", "the", "first", "part", "of", "Algorithm", "2", ".", "1", "in", "R&W", ".", "Computes", "K", "and", "the", "noise", "portion", "of", "K", "using", ":", "py", ":", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1407-L1511
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.compute_Kij
def compute_Kij(self, Xi, Xj, ni, nj, noise=False, hyper_deriv=None, k=None): r"""Compute covariance matrix between datasets `Xi` and `Xj`. Specify the orders of derivatives at each location with the `ni`, `nj` arrays. The `include_noise` flag is passed to the covariance kernel to ...
python
def compute_Kij(self, Xi, Xj, ni, nj, noise=False, hyper_deriv=None, k=None): r"""Compute covariance matrix between datasets `Xi` and `Xj`. Specify the orders of derivatives at each location with the `ni`, `nj` arrays. The `include_noise` flag is passed to the covariance kernel to ...
[ "def", "compute_Kij", "(", "self", ",", "Xi", ",", "Xj", ",", "ni", ",", "nj", ",", "noise", "=", "False", ",", "hyper_deriv", "=", "None", ",", "k", "=", "None", ")", ":", "if", "k", "is", "None", ":", "if", "not", "noise", ":", "k", "=", "s...
r"""Compute covariance matrix between datasets `Xi` and `Xj`. Specify the orders of derivatives at each location with the `ni`, `nj` arrays. The `include_noise` flag is passed to the covariance kernel to indicate whether noise is to be included (i.e., for evaluation of :math:`K+...
[ "r", "Compute", "covariance", "matrix", "between", "datasets", "Xi", "and", "Xj", ".", "Specify", "the", "orders", "of", "derivatives", "at", "each", "location", "with", "the", "ni", "nj", "arrays", ".", "The", "include_noise", "flag", "is", "passed", "to", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1524-L1594
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.compute_ll_matrix
def compute_ll_matrix(self, bounds, num_pts): """Compute the log likelihood over the (free) parameter space. Parameters ---------- bounds : 2-tuple or list of 2-tuples with length equal to the number of free parameters Bounds on the range to use for each of the param...
python
def compute_ll_matrix(self, bounds, num_pts): """Compute the log likelihood over the (free) parameter space. Parameters ---------- bounds : 2-tuple or list of 2-tuples with length equal to the number of free parameters Bounds on the range to use for each of the param...
[ "def", "compute_ll_matrix", "(", "self", ",", "bounds", ",", "num_pts", ")", ":", "present_free_params", "=", "self", ".", "free_params", "[", ":", "]", "bounds", "=", "scipy", ".", "atleast_2d", "(", "scipy", ".", "asarray", "(", "bounds", ",", "dtype", ...
Compute the log likelihood over the (free) parameter space. Parameters ---------- bounds : 2-tuple or list of 2-tuples with length equal to the number of free parameters Bounds on the range to use for each of the parameters. If a single 2-tuple is given, it will ...
[ "Compute", "the", "log", "likelihood", "over", "the", "(", "free", ")", "parameter", "space", ".", "Parameters", "----------", "bounds", ":", "2", "-", "tuple", "or", "list", "of", "2", "-", "tuples", "with", "length", "equal", "to", "the", "number", "of...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1596-L1642
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess._compute_ll_matrix
def _compute_ll_matrix(self, idx, param_vals, num_pts): """Recursive helper function for compute_ll_matrix. Parameters ---------- idx : int The index of the parameter for this layer of the recursion to work on. `idx` == len(`num_pts`) is the base case tha...
python
def _compute_ll_matrix(self, idx, param_vals, num_pts): """Recursive helper function for compute_ll_matrix. Parameters ---------- idx : int The index of the parameter for this layer of the recursion to work on. `idx` == len(`num_pts`) is the base case tha...
[ "def", "_compute_ll_matrix", "(", "self", ",", "idx", ",", "param_vals", ",", "num_pts", ")", ":", "if", "idx", ">=", "len", "(", "num_pts", ")", ":", "# Base case: All entries in param_vals should be scalars:", "return", "-", "1.0", "*", "self", ".", "update_hy...
Recursive helper function for compute_ll_matrix. Parameters ---------- idx : int The index of the parameter for this layer of the recursion to work on. `idx` == len(`num_pts`) is the base case that terminates the recursion. param_vals : List o...
[ "Recursive", "helper", "function", "for", "compute_ll_matrix", ".", "Parameters", "----------", "idx", ":", "int", "The", "index", "of", "the", "parameter", "for", "this", "layer", "of", "the", "recursion", "to", "work", "on", ".", "idx", "==", "len", "(", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1644-L1681
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.sample_hyperparameter_posterior
def sample_hyperparameter_posterior(self, nwalkers=200, nsamp=500, burn=0, thin=1, num_proc=None, sampler=None, plot_posterior=False, plot_chains=False, sampler_type='ensemble', ...
python
def sample_hyperparameter_posterior(self, nwalkers=200, nsamp=500, burn=0, thin=1, num_proc=None, sampler=None, plot_posterior=False, plot_chains=False, sampler_type='ensemble', ...
[ "def", "sample_hyperparameter_posterior", "(", "self", ",", "nwalkers", "=", "200", ",", "nsamp", "=", "500", ",", "burn", "=", "0", ",", "thin", "=", "1", ",", "num_proc", "=", "None", ",", "sampler", "=", "None", ",", "plot_posterior", "=", "False", ...
Produce samples from the posterior for the hyperparameters using MCMC. Returns the sampler created, because storing it stops the GP from being pickleable. To add more samples to a previous sampler, pass the sampler instance in the `sampler` keyword. Parameters -...
[ "Produce", "samples", "from", "the", "posterior", "for", "the", "hyperparameters", "using", "MCMC", ".", "Returns", "the", "sampler", "created", "because", "storing", "it", "stops", "the", "GP", "from", "being", "pickleable", ".", "To", "add", "more", "samples...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1683-L1827
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.compute_from_MCMC
def compute_from_MCMC(self, X, n=0, return_mean=True, return_std=True, return_cov=False, return_samples=False, return_mean_func=False, num_samples=1, noise=False, samp_kwargs={}, sampler=None, flat_trace=None, burn=0, ...
python
def compute_from_MCMC(self, X, n=0, return_mean=True, return_std=True, return_cov=False, return_samples=False, return_mean_func=False, num_samples=1, noise=False, samp_kwargs={}, sampler=None, flat_trace=None, burn=0, ...
[ "def", "compute_from_MCMC", "(", "self", ",", "X", ",", "n", "=", "0", ",", "return_mean", "=", "True", ",", "return_std", "=", "True", ",", "return_cov", "=", "False", ",", "return_samples", "=", "False", ",", "return_mean_func", "=", "False", ",", "num...
Compute desired quantities from MCMC samples of the hyperparameter posterior. The return will be a list with a number of rows equal to the number of hyperparameter samples. The columns depend on the state of the boolean flags, but will be some subset of (mean, stddev, cov, samples), in ...
[ "Compute", "desired", "quantities", "from", "MCMC", "samples", "of", "the", "hyperparameter", "posterior", ".", "The", "return", "will", "be", "a", "list", "with", "a", "number", "of", "rows", "equal", "to", "the", "number", "of", "hyperparameter", "samples", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1829-L1976
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.compute_l_from_MCMC
def compute_l_from_MCMC(self, X, n=0, sampler=None, flat_trace=None, burn=0, thin=1, **kwargs): """Compute desired quantities from MCMC samples of the hyperparameter posterior. The return will be a list with a number of rows equal to the number of hyperparameter samples. The columns wil...
python
def compute_l_from_MCMC(self, X, n=0, sampler=None, flat_trace=None, burn=0, thin=1, **kwargs): """Compute desired quantities from MCMC samples of the hyperparameter posterior. The return will be a list with a number of rows equal to the number of hyperparameter samples. The columns wil...
[ "def", "compute_l_from_MCMC", "(", "self", ",", "X", ",", "n", "=", "0", ",", "sampler", "=", "None", ",", "flat_trace", "=", "None", ",", "burn", "=", "0", ",", "thin", "=", "1", ",", "*", "*", "kwargs", ")", ":", "if", "flat_trace", "is", "None...
Compute desired quantities from MCMC samples of the hyperparameter posterior. The return will be a list with a number of rows equal to the number of hyperparameter samples. The columns will contain the covariance length scale function. Parameters ---------- ...
[ "Compute", "desired", "quantities", "from", "MCMC", "samples", "of", "the", "hyperparameter", "posterior", ".", "The", "return", "will", "be", "a", "list", "with", "a", "number", "of", "rows", "equal", "to", "the", "number", "of", "hyperparameter", "samples", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L1978-L2054
train
markchil/gptools
gptools/gaussian_process.py
GaussianProcess.predict_MCMC
def predict_MCMC(self, X, ddof=1, full_MC=False, rejection_func=None, **kwargs): """Make a prediction using MCMC samples. This is essentially a convenient wrapper of :py:meth:`compute_from_MCMC`, designed to act more or less interchangeably with :py:meth:`predict`. Comp...
python
def predict_MCMC(self, X, ddof=1, full_MC=False, rejection_func=None, **kwargs): """Make a prediction using MCMC samples. This is essentially a convenient wrapper of :py:meth:`compute_from_MCMC`, designed to act more or less interchangeably with :py:meth:`predict`. Comp...
[ "def", "predict_MCMC", "(", "self", ",", "X", ",", "ddof", "=", "1", ",", "full_MC", "=", "False", ",", "rejection_func", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return_std", "=", "kwargs", ".", "get", "(", "'return_std'", ",", "True", ")", ...
Make a prediction using MCMC samples. This is essentially a convenient wrapper of :py:meth:`compute_from_MCMC`, designed to act more or less interchangeably with :py:meth:`predict`. Computes the mean of the GP posterior marginalized over the hyperparameters using iterat...
[ "Make", "a", "prediction", "using", "MCMC", "samples", ".", "This", "is", "essentially", "a", "convenient", "wrapper", "of", ":", "py", ":", "meth", ":", "compute_from_MCMC", "designed", "to", "act", "more", "or", "less", "interchangeably", "with", ":", "py"...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/gaussian_process.py#L2133-L2243
train
coursera/courseraoauth2client
courseraoauth2client/main.py
build_parser
def build_parser(): "Build an argparse argument parser to parse the command line." parser = argparse.ArgumentParser( description="""Coursera OAuth2 client CLI. This tool helps users of the Coursera App Platform to programmatically access Coursera APIs.""", epilog="""Please file ...
python
def build_parser(): "Build an argparse argument parser to parse the command line." parser = argparse.ArgumentParser( description="""Coursera OAuth2 client CLI. This tool helps users of the Coursera App Platform to programmatically access Coursera APIs.""", epilog="""Please file ...
[ "def", "build_parser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"\"\"Coursera OAuth2 client CLI. This tool\n helps users of the Coursera App Platform to programmatically access\n Coursera APIs.\"\"\"", ",", "epilog", "=...
Build an argparse argument parser to parse the command line.
[ "Build", "an", "argparse", "argument", "parser", "to", "parse", "the", "command", "line", "." ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/main.py#L30-L53
train
coursera/courseraoauth2client
courseraoauth2client/main.py
main
def main(): "Boots up the command line tool" logging.captureWarnings(True) args = build_parser().parse_args() # Configure logging args.setup_logging(args) # Dispatch into the appropriate subcommand function. try: return args.func(args) except SystemExit: raise except:...
python
def main(): "Boots up the command line tool" logging.captureWarnings(True) args = build_parser().parse_args() # Configure logging args.setup_logging(args) # Dispatch into the appropriate subcommand function. try: return args.func(args) except SystemExit: raise except:...
[ "def", "main", "(", ")", ":", "logging", ".", "captureWarnings", "(", "True", ")", "args", "=", "build_parser", "(", ")", ".", "parse_args", "(", ")", "# Configure logging", "args", ".", "setup_logging", "(", "args", ")", "# Dispatch into the appropriate subcomm...
Boots up the command line tool
[ "Boots", "up", "the", "command", "line", "tool" ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/main.py#L56-L69
train
CTPUG/wafer
wafer/sponsors/models.py
sponsor_menu
def sponsor_menu( root_menu, menu="sponsors", label=_("Sponsors"), sponsors_item=_("Our sponsors"), packages_item=_("Sponsorship packages")): """Add sponsor menu links.""" root_menu.add_menu(menu, label, items=[]) for sponsor in ( Sponsor.objects.all() .order_...
python
def sponsor_menu( root_menu, menu="sponsors", label=_("Sponsors"), sponsors_item=_("Our sponsors"), packages_item=_("Sponsorship packages")): """Add sponsor menu links.""" root_menu.add_menu(menu, label, items=[]) for sponsor in ( Sponsor.objects.all() .order_...
[ "def", "sponsor_menu", "(", "root_menu", ",", "menu", "=", "\"sponsors\"", ",", "label", "=", "_", "(", "\"Sponsors\"", ")", ",", "sponsors_item", "=", "_", "(", "\"Our sponsors\"", ")", ",", "packages_item", "=", "_", "(", "\"Sponsorship packages\"", ")", "...
Add sponsor menu links.
[ "Add", "sponsor", "menu", "links", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/sponsors/models.py#L115-L141
train
codenerix/django-codenerix
codenerix/templatetags/codenerix_common.py
objectatrib
def objectatrib(instance, atrib): ''' this filter is going to be useful to execute an object method or get an object attribute dynamically. this method is going to take into account the atrib param can contains underscores ''' atrib = atrib.replace("__", ".") atribs = [] atribs = atrib.s...
python
def objectatrib(instance, atrib): ''' this filter is going to be useful to execute an object method or get an object attribute dynamically. this method is going to take into account the atrib param can contains underscores ''' atrib = atrib.replace("__", ".") atribs = [] atribs = atrib.s...
[ "def", "objectatrib", "(", "instance", ",", "atrib", ")", ":", "atrib", "=", "atrib", ".", "replace", "(", "\"__\"", ",", "\".\"", ")", "atribs", "=", "[", "]", "atribs", "=", "atrib", ".", "split", "(", "\".\"", ")", "obj", "=", "instance", "for", ...
this filter is going to be useful to execute an object method or get an object attribute dynamically. this method is going to take into account the atrib param can contains underscores
[ "this", "filter", "is", "going", "to", "be", "useful", "to", "execute", "an", "object", "method", "or", "get", "an", "object", "attribute", "dynamically", ".", "this", "method", "is", "going", "to", "take", "into", "account", "the", "atrib", "param", "can"...
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/templatetags/codenerix_common.py#L241-L262
train
codenerix/django-codenerix
codenerix/djng/angular_base.py
NgBoundField.as_widget
def as_widget(self, widget=None, attrs=None, only_initial=False): """ Renders the field. """ attrs = attrs or {} attrs.update(self.form.get_widget_attrs(self)) if hasattr(self.field, 'widget_css_classes'): css_classes = self.field.widget_css_classes el...
python
def as_widget(self, widget=None, attrs=None, only_initial=False): """ Renders the field. """ attrs = attrs or {} attrs.update(self.form.get_widget_attrs(self)) if hasattr(self.field, 'widget_css_classes'): css_classes = self.field.widget_css_classes el...
[ "def", "as_widget", "(", "self", ",", "widget", "=", "None", ",", "attrs", "=", "None", ",", "only_initial", "=", "False", ")", ":", "attrs", "=", "attrs", "or", "{", "}", "attrs", ".", "update", "(", "self", ".", "form", ".", "get_widget_attrs", "("...
Renders the field.
[ "Renders", "the", "field", "." ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/djng/angular_base.py#L166-L184
train
codenerix/django-codenerix
codenerix/djng/angular_base.py
NgFormBaseMixin.convert_widgets
def convert_widgets(self): """ During form initialization, some widgets have to be replaced by a counterpart suitable to be rendered the AngularJS way. """ for field in self.base_fields.values(): try: new_widget = field.get_converted_widget() ...
python
def convert_widgets(self): """ During form initialization, some widgets have to be replaced by a counterpart suitable to be rendered the AngularJS way. """ for field in self.base_fields.values(): try: new_widget = field.get_converted_widget() ...
[ "def", "convert_widgets", "(", "self", ")", ":", "for", "field", "in", "self", ".", "base_fields", ".", "values", "(", ")", ":", "try", ":", "new_widget", "=", "field", ".", "get_converted_widget", "(", ")", "except", "AttributeError", ":", "pass", "else",...
During form initialization, some widgets have to be replaced by a counterpart suitable to be rendered the AngularJS way.
[ "During", "form", "initialization", "some", "widgets", "have", "to", "be", "replaced", "by", "a", "counterpart", "suitable", "to", "be", "rendered", "the", "AngularJS", "way", "." ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/djng/angular_base.py#L291-L303
train
codenerix/django-codenerix
codenerix/helpers.py
epochdate
def epochdate(timestamp): ''' Convet an epoch date to a tuple in format ("yyyy-mm-dd","hh:mm:ss") Example: "1023456427" -> ("2002-06-07","15:27:07") Parameters: - `timestamp`: date in epoch format ''' dt = datetime.fromtimestamp(float(timestamp)).timetuple() fecha = "{0:d}-{1:02d}-{2:0...
python
def epochdate(timestamp): ''' Convet an epoch date to a tuple in format ("yyyy-mm-dd","hh:mm:ss") Example: "1023456427" -> ("2002-06-07","15:27:07") Parameters: - `timestamp`: date in epoch format ''' dt = datetime.fromtimestamp(float(timestamp)).timetuple() fecha = "{0:d}-{1:02d}-{2:0...
[ "def", "epochdate", "(", "timestamp", ")", ":", "dt", "=", "datetime", ".", "fromtimestamp", "(", "float", "(", "timestamp", ")", ")", ".", "timetuple", "(", ")", "fecha", "=", "\"{0:d}-{1:02d}-{2:02d}\"", ".", "format", "(", "dt", ".", "tm_year", ",", "...
Convet an epoch date to a tuple in format ("yyyy-mm-dd","hh:mm:ss") Example: "1023456427" -> ("2002-06-07","15:27:07") Parameters: - `timestamp`: date in epoch format
[ "Convet", "an", "epoch", "date", "to", "a", "tuple", "in", "format", "(", "yyyy", "-", "mm", "-", "dd", "hh", ":", "mm", ":", "ss", ")", "Example", ":", "1023456427", "-", ">", "(", "2002", "-", "06", "-", "07", "15", ":", "27", ":", "07", ")...
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L52-L64
train
codenerix/django-codenerix
codenerix/helpers.py
model_inspect
def model_inspect(obj): ''' Analize itself looking for special information, right now it returns: - Application name - Model name ''' # Prepare the information object info = {} if hasattr(obj, '_meta'): info['verbose_name'] = getattr(obj._meta,...
python
def model_inspect(obj): ''' Analize itself looking for special information, right now it returns: - Application name - Model name ''' # Prepare the information object info = {} if hasattr(obj, '_meta'): info['verbose_name'] = getattr(obj._meta,...
[ "def", "model_inspect", "(", "obj", ")", ":", "# Prepare the information object", "info", "=", "{", "}", "if", "hasattr", "(", "obj", ",", "'_meta'", ")", ":", "info", "[", "'verbose_name'", "]", "=", "getattr", "(", "obj", ".", "_meta", ",", "'verbose_nam...
Analize itself looking for special information, right now it returns: - Application name - Model name
[ "Analize", "itself", "looking", "for", "special", "information", "right", "now", "it", "returns", ":", "-", "Application", "name", "-", "Model", "name" ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L284-L312
train
codenerix/django-codenerix
codenerix/helpers.py
upload_path
def upload_path(instance, filename): ''' This method is created to return the path to upload files. This path must be different from any other to avoid problems. ''' path_separator = "/" date_separator = "-" ext_separator = "." empty_string = "" # get the model name model_name = ...
python
def upload_path(instance, filename): ''' This method is created to return the path to upload files. This path must be different from any other to avoid problems. ''' path_separator = "/" date_separator = "-" ext_separator = "." empty_string = "" # get the model name model_name = ...
[ "def", "upload_path", "(", "instance", ",", "filename", ")", ":", "path_separator", "=", "\"/\"", "date_separator", "=", "\"-\"", "ext_separator", "=", "\".\"", "empty_string", "=", "\"\"", "# get the model name", "model_name", "=", "model_inspect", "(", "instance",...
This method is created to return the path to upload files. This path must be different from any other to avoid problems.
[ "This", "method", "is", "created", "to", "return", "the", "path", "to", "upload", "files", ".", "This", "path", "must", "be", "different", "from", "any", "other", "to", "avoid", "problems", "." ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L315-L341
train
codenerix/django-codenerix
codenerix/helpers.py
remove_getdisplay
def remove_getdisplay(field_name): ''' for string 'get_FIELD_NAME_display' return 'FIELD_NAME' ''' str_ini = 'get_' str_end = '_display' if str_ini == field_name[0:len(str_ini)] and str_end == field_name[(-1) * len(str_end):]: field_name = field_name[len(str_ini):(-1) * len(str_end)] ...
python
def remove_getdisplay(field_name): ''' for string 'get_FIELD_NAME_display' return 'FIELD_NAME' ''' str_ini = 'get_' str_end = '_display' if str_ini == field_name[0:len(str_ini)] and str_end == field_name[(-1) * len(str_end):]: field_name = field_name[len(str_ini):(-1) * len(str_end)] ...
[ "def", "remove_getdisplay", "(", "field_name", ")", ":", "str_ini", "=", "'get_'", "str_end", "=", "'_display'", "if", "str_ini", "==", "field_name", "[", "0", ":", "len", "(", "str_ini", ")", "]", "and", "str_end", "==", "field_name", "[", "(", "-", "1"...
for string 'get_FIELD_NAME_display' return 'FIELD_NAME'
[ "for", "string", "get_FIELD_NAME_display", "return", "FIELD_NAME" ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L545-L553
train
codenerix/django-codenerix
codenerix/helpers.py
JSONEncoder_newdefault
def JSONEncoder_newdefault(kind=['uuid', 'datetime', 'time', 'decimal']): ''' JSON Encoder newdfeault is a wrapper capable of encoding several kinds Usage: from codenerix.helpers import JSONEncoder_newdefault JSONEncoder_newdefault() ''' JSONEncoder_olddefault = json.JSONEncoder.defa...
python
def JSONEncoder_newdefault(kind=['uuid', 'datetime', 'time', 'decimal']): ''' JSON Encoder newdfeault is a wrapper capable of encoding several kinds Usage: from codenerix.helpers import JSONEncoder_newdefault JSONEncoder_newdefault() ''' JSONEncoder_olddefault = json.JSONEncoder.defa...
[ "def", "JSONEncoder_newdefault", "(", "kind", "=", "[", "'uuid'", ",", "'datetime'", ",", "'time'", ",", "'decimal'", "]", ")", ":", "JSONEncoder_olddefault", "=", "json", ".", "JSONEncoder", ".", "default", "def", "JSONEncoder_wrapped", "(", "self", ",", "o",...
JSON Encoder newdfeault is a wrapper capable of encoding several kinds Usage: from codenerix.helpers import JSONEncoder_newdefault JSONEncoder_newdefault()
[ "JSON", "Encoder", "newdfeault", "is", "a", "wrapper", "capable", "of", "encoding", "several", "kinds", "Usage", ":", "from", "codenerix", ".", "helpers", "import", "JSONEncoder_newdefault", "JSONEncoder_newdefault", "()" ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L626-L648
train
codenerix/django-codenerix
codenerix/helpers.py
context_processors_update
def context_processors_update(context, request): ''' Update context with context_processors from settings Usage: from codenerix.helpers import context_processors_update context_processors_update(context, self.request) ''' for template in settings.TEMPLATES: for context_proces...
python
def context_processors_update(context, request): ''' Update context with context_processors from settings Usage: from codenerix.helpers import context_processors_update context_processors_update(context, self.request) ''' for template in settings.TEMPLATES: for context_proces...
[ "def", "context_processors_update", "(", "context", ",", "request", ")", ":", "for", "template", "in", "settings", ".", "TEMPLATES", ":", "for", "context_processor", "in", "template", "[", "'OPTIONS'", "]", "[", "'context_processors'", "]", ":", "path", "=", "...
Update context with context_processors from settings Usage: from codenerix.helpers import context_processors_update context_processors_update(context, self.request)
[ "Update", "context", "with", "context_processors", "from", "settings", "Usage", ":", "from", "codenerix", ".", "helpers", "import", "context_processors_update", "context_processors_update", "(", "context", "self", ".", "request", ")" ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L651-L665
train
codenerix/django-codenerix
codenerix/helpers.py
InMemoryZip.append
def append(self, filename_in_zip, file_contents): ''' Appends a file with name filename_in_zip and contents of file_contents to the in-memory zip. ''' # Set the file pointer to the end of the file self.in_memory_zip.seek(-1, io.SEEK_END) # Get a handle to the in-...
python
def append(self, filename_in_zip, file_contents): ''' Appends a file with name filename_in_zip and contents of file_contents to the in-memory zip. ''' # Set the file pointer to the end of the file self.in_memory_zip.seek(-1, io.SEEK_END) # Get a handle to the in-...
[ "def", "append", "(", "self", ",", "filename_in_zip", ",", "file_contents", ")", ":", "# Set the file pointer to the end of the file", "self", ".", "in_memory_zip", ".", "seek", "(", "-", "1", ",", "io", ".", "SEEK_END", ")", "# Get a handle to the in-memory zip in ap...
Appends a file with name filename_in_zip and contents of file_contents to the in-memory zip.
[ "Appends", "a", "file", "with", "name", "filename_in_zip", "and", "contents", "of", "file_contents", "to", "the", "in", "-", "memory", "zip", "." ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L491-L516
train
codenerix/django-codenerix
codenerix/helpers.py
InMemoryZip.writetofile
def writetofile(self, filename): '''Writes the in-memory zip to a file.''' f = open(filename, "w") f.write(self.read()) f.close()
python
def writetofile(self, filename): '''Writes the in-memory zip to a file.''' f = open(filename, "w") f.write(self.read()) f.close()
[ "def", "writetofile", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "\"w\"", ")", "f", ".", "write", "(", "self", ".", "read", "(", ")", ")", "f", ".", "close", "(", ")" ]
Writes the in-memory zip to a file.
[ "Writes", "the", "in", "-", "memory", "zip", "to", "a", "file", "." ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/helpers.py#L538-L542
train
CTPUG/wafer
wafer/sponsors/templatetags/sponsors.py
sponsor_image_url
def sponsor_image_url(sponsor, name): """Returns the corresponding url from the sponsors images""" if sponsor.files.filter(name=name).exists(): # We avoid worrying about multiple matches by always # returning the first one. return sponsor.files.filter(name=name).first().item.url retu...
python
def sponsor_image_url(sponsor, name): """Returns the corresponding url from the sponsors images""" if sponsor.files.filter(name=name).exists(): # We avoid worrying about multiple matches by always # returning the first one. return sponsor.files.filter(name=name).first().item.url retu...
[ "def", "sponsor_image_url", "(", "sponsor", ",", "name", ")", ":", "if", "sponsor", ".", "files", ".", "filter", "(", "name", "=", "name", ")", ".", "exists", "(", ")", ":", "# We avoid worrying about multiple matches by always", "# returning the first one.", "ret...
Returns the corresponding url from the sponsors images
[ "Returns", "the", "corresponding", "url", "from", "the", "sponsors", "images" ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/sponsors/templatetags/sponsors.py#L25-L31
train
CTPUG/wafer
wafer/sponsors/templatetags/sponsors.py
sponsor_tagged_image
def sponsor_tagged_image(sponsor, tag): """returns the corresponding url from the tagged image list.""" if sponsor.files.filter(tag_name=tag).exists(): return sponsor.files.filter(tag_name=tag).first().tagged_file.item.url return ''
python
def sponsor_tagged_image(sponsor, tag): """returns the corresponding url from the tagged image list.""" if sponsor.files.filter(tag_name=tag).exists(): return sponsor.files.filter(tag_name=tag).first().tagged_file.item.url return ''
[ "def", "sponsor_tagged_image", "(", "sponsor", ",", "tag", ")", ":", "if", "sponsor", ".", "files", ".", "filter", "(", "tag_name", "=", "tag", ")", ".", "exists", "(", ")", ":", "return", "sponsor", ".", "files", ".", "filter", "(", "tag_name", "=", ...
returns the corresponding url from the tagged image list.
[ "returns", "the", "corresponding", "url", "from", "the", "tagged", "image", "list", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/sponsors/templatetags/sponsors.py#L35-L39
train
codenerix/django-codenerix
codenerix/templatetags/codenerix_special.py
ifusergroup
def ifusergroup(parser, token): """ Check to see if the currently logged in user belongs to a specific group. Requires the Django authentication contrib app and middleware. Usage: {% ifusergroup Admins %} ... {% endifusergroup %}, or {% ifusergroup Admins Clients Sellers %} ... {% else %} ... {%...
python
def ifusergroup(parser, token): """ Check to see if the currently logged in user belongs to a specific group. Requires the Django authentication contrib app and middleware. Usage: {% ifusergroup Admins %} ... {% endifusergroup %}, or {% ifusergroup Admins Clients Sellers %} ... {% else %} ... {%...
[ "def", "ifusergroup", "(", "parser", ",", "token", ")", ":", "try", ":", "tokensp", "=", "token", ".", "split_contents", "(", ")", "groups", "=", "[", "]", "groups", "+=", "tokensp", "[", "1", ":", "]", "except", "ValueError", ":", "raise", "template",...
Check to see if the currently logged in user belongs to a specific group. Requires the Django authentication contrib app and middleware. Usage: {% ifusergroup Admins %} ... {% endifusergroup %}, or {% ifusergroup Admins Clients Sellers %} ... {% else %} ... {% endifusergroup %}
[ "Check", "to", "see", "if", "the", "currently", "logged", "in", "user", "belongs", "to", "a", "specific", "group", ".", "Requires", "the", "Django", "authentication", "contrib", "app", "and", "middleware", "." ]
1f5527b352141caaee902b37b2648791a06bd57d
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/templatetags/codenerix_special.py#L63-L87
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.OpenHandle
def OpenHandle(self): '''Gets a handle for use with other vSphere Guest API functions. The guest library handle provides a context for accessing information about the virtual machine. Virtual machine statistics and state data are associated with a particular guest library handl...
python
def OpenHandle(self): '''Gets a handle for use with other vSphere Guest API functions. The guest library handle provides a context for accessing information about the virtual machine. Virtual machine statistics and state data are associated with a particular guest library handl...
[ "def", "OpenHandle", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'handle'", ")", ":", "return", "self", ".", "handle", "else", ":", "handle", "=", "c_void_p", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_OpenHandle", "(", "byref", ...
Gets a handle for use with other vSphere Guest API functions. The guest library handle provides a context for accessing information about the virtual machine. Virtual machine statistics and state data are associated with a particular guest library handle, so using one handle does not a...
[ "Gets", "a", "handle", "for", "use", "with", "other", "vSphere", "Guest", "API", "functions", ".", "The", "guest", "library", "handle", "provides", "a", "context", "for", "accessing", "information", "about", "the", "virtual", "machine", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L114-L126
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.CloseHandle
def CloseHandle(self): '''Releases a handle acquired with VMGuestLib_OpenHandle''' if hasattr(self, 'handle'): ret = vmGuestLib.VMGuestLib_CloseHandle(self.handle.value) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) del(self.handle)
python
def CloseHandle(self): '''Releases a handle acquired with VMGuestLib_OpenHandle''' if hasattr(self, 'handle'): ret = vmGuestLib.VMGuestLib_CloseHandle(self.handle.value) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) del(self.handle)
[ "def", "CloseHandle", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'handle'", ")", ":", "ret", "=", "vmGuestLib", ".", "VMGuestLib_CloseHandle", "(", "self", ".", "handle", ".", "value", ")", "if", "ret", "!=", "VMGUESTLIB_ERROR_SUCCESS", ":"...
Releases a handle acquired with VMGuestLib_OpenHandle
[ "Releases", "a", "handle", "acquired", "with", "VMGuestLib_OpenHandle" ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L128-L133
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.UpdateInfo
def UpdateInfo(self): '''Updates information about the virtual machine. This information is associated with the VMGuestLibHandle. VMGuestLib_UpdateInfo requires similar CPU resources to a system call and therefore can affect performance. If you are concerned about performance, ...
python
def UpdateInfo(self): '''Updates information about the virtual machine. This information is associated with the VMGuestLibHandle. VMGuestLib_UpdateInfo requires similar CPU resources to a system call and therefore can affect performance. If you are concerned about performance, ...
[ "def", "UpdateInfo", "(", "self", ")", ":", "ret", "=", "vmGuestLib", ".", "VMGuestLib_UpdateInfo", "(", "self", ".", "handle", ".", "value", ")", "if", "ret", "!=", "VMGUESTLIB_ERROR_SUCCESS", ":", "raise", "VMGuestLibException", "(", "ret", ")" ]
Updates information about the virtual machine. This information is associated with the VMGuestLibHandle. VMGuestLib_UpdateInfo requires similar CPU resources to a system call and therefore can affect performance. If you are concerned about performance, minimize the number of...
[ "Updates", "information", "about", "the", "virtual", "machine", ".", "This", "information", "is", "associated", "with", "the", "VMGuestLibHandle", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L135-L147
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetSessionId
def GetSessionId(self): '''Retrieves the VMSessionID for the current session. Call this function after calling VMGuestLib_UpdateInfo. If VMGuestLib_UpdateInfo has never been called, VMGuestLib_GetSessionId returns VMGUESTLIB_ERROR_NO_INFO.''' sid = c_void_p() ret = vmGuestL...
python
def GetSessionId(self): '''Retrieves the VMSessionID for the current session. Call this function after calling VMGuestLib_UpdateInfo. If VMGuestLib_UpdateInfo has never been called, VMGuestLib_GetSessionId returns VMGUESTLIB_ERROR_NO_INFO.''' sid = c_void_p() ret = vmGuestL...
[ "def", "GetSessionId", "(", "self", ")", ":", "sid", "=", "c_void_p", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetSessionId", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "sid", ")", ")", "if", "ret", "!=", "VMGUESTLIB_ERROR_S...
Retrieves the VMSessionID for the current session. Call this function after calling VMGuestLib_UpdateInfo. If VMGuestLib_UpdateInfo has never been called, VMGuestLib_GetSessionId returns VMGUESTLIB_ERROR_NO_INFO.
[ "Retrieves", "the", "VMSessionID", "for", "the", "current", "session", ".", "Call", "this", "function", "after", "calling", "VMGuestLib_UpdateInfo", ".", "If", "VMGuestLib_UpdateInfo", "has", "never", "been", "called", "VMGuestLib_GetSessionId", "returns", "VMGUESTLIB_E...
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L149-L156
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetCpuLimitMHz
def GetCpuLimitMHz(self): '''Retrieves the upperlimit of processor use in MHz available to the virtual machine. For information about setting the CPU limit, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetCpuLimitMHz(self.handl...
python
def GetCpuLimitMHz(self): '''Retrieves the upperlimit of processor use in MHz available to the virtual machine. For information about setting the CPU limit, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetCpuLimitMHz(self.handl...
[ "def", "GetCpuLimitMHz", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetCpuLimitMHz", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTL...
Retrieves the upperlimit of processor use in MHz available to the virtual machine. For information about setting the CPU limit, see "Limits and Reservations" on page 14.
[ "Retrieves", "the", "upperlimit", "of", "processor", "use", "in", "MHz", "available", "to", "the", "virtual", "machine", ".", "For", "information", "about", "setting", "the", "CPU", "limit", "see", "Limits", "and", "Reservations", "on", "page", "14", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L158-L165
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetCpuReservationMHz
def GetCpuReservationMHz(self): '''Retrieves the minimum processing power in MHz reserved for the virtual machine. For information about setting a CPU reservation, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetCpuReservationM...
python
def GetCpuReservationMHz(self): '''Retrieves the minimum processing power in MHz reserved for the virtual machine. For information about setting a CPU reservation, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetCpuReservationM...
[ "def", "GetCpuReservationMHz", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetCpuReservationMHz", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=",...
Retrieves the minimum processing power in MHz reserved for the virtual machine. For information about setting a CPU reservation, see "Limits and Reservations" on page 14.
[ "Retrieves", "the", "minimum", "processing", "power", "in", "MHz", "reserved", "for", "the", "virtual", "machine", ".", "For", "information", "about", "setting", "a", "CPU", "reservation", "see", "Limits", "and", "Reservations", "on", "page", "14", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L167-L174
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetCpuShares
def GetCpuShares(self): '''Retrieves the number of CPU shares allocated to the virtual machine. For information about how an ESX server uses CPU shares to manage virtual machine priority, see the vSphere Resource Management Guide.''' counter = c_uint() ret = vmGuestLib.VMGu...
python
def GetCpuShares(self): '''Retrieves the number of CPU shares allocated to the virtual machine. For information about how an ESX server uses CPU shares to manage virtual machine priority, see the vSphere Resource Management Guide.''' counter = c_uint() ret = vmGuestLib.VMGu...
[ "def", "GetCpuShares", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetCpuShares", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTLIB_E...
Retrieves the number of CPU shares allocated to the virtual machine. For information about how an ESX server uses CPU shares to manage virtual machine priority, see the vSphere Resource Management Guide.
[ "Retrieves", "the", "number", "of", "CPU", "shares", "allocated", "to", "the", "virtual", "machine", ".", "For", "information", "about", "how", "an", "ESX", "server", "uses", "CPU", "shares", "to", "manage", "virtual", "machine", "priority", "see", "the", "v...
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L176-L183
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetCpuStolenMs
def GetCpuStolenMs(self): '''Retrieves the number of milliseconds that the virtual machine was in a ready state (able to transition to a run state), but was not scheduled to run.''' counter = c_uint64() ret = vmGuestLib.VMGuestLib_GetCpuStolenMs(self.handle.value, byref(counter)) ...
python
def GetCpuStolenMs(self): '''Retrieves the number of milliseconds that the virtual machine was in a ready state (able to transition to a run state), but was not scheduled to run.''' counter = c_uint64() ret = vmGuestLib.VMGuestLib_GetCpuStolenMs(self.handle.value, byref(counter)) ...
[ "def", "GetCpuStolenMs", "(", "self", ")", ":", "counter", "=", "c_uint64", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetCpuStolenMs", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUES...
Retrieves the number of milliseconds that the virtual machine was in a ready state (able to transition to a run state), but was not scheduled to run.
[ "Retrieves", "the", "number", "of", "milliseconds", "that", "the", "virtual", "machine", "was", "in", "a", "ready", "state", "(", "able", "to", "transition", "to", "a", "run", "state", ")", "but", "was", "not", "scheduled", "to", "run", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L185-L191
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetCpuUsedMs
def GetCpuUsedMs(self): '''Retrieves the number of milliseconds during which the virtual machine has used the CPU. This value includes the time used by the guest operating system and the time used by virtualization code for tasks for this virtual machine. You can combine this va...
python
def GetCpuUsedMs(self): '''Retrieves the number of milliseconds during which the virtual machine has used the CPU. This value includes the time used by the guest operating system and the time used by virtualization code for tasks for this virtual machine. You can combine this va...
[ "def", "GetCpuUsedMs", "(", "self", ")", ":", "counter", "=", "c_uint64", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetCpuUsedMs", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTLIB...
Retrieves the number of milliseconds during which the virtual machine has used the CPU. This value includes the time used by the guest operating system and the time used by virtualization code for tasks for this virtual machine. You can combine this value with the elapsed time ...
[ "Retrieves", "the", "number", "of", "milliseconds", "during", "which", "the", "virtual", "machine", "has", "used", "the", "CPU", ".", "This", "value", "includes", "the", "time", "used", "by", "the", "guest", "operating", "system", "and", "the", "time", "used...
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L193-L203
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetElapsedMs
def GetElapsedMs(self): '''Retrieves the number of milliseconds that have passed in the virtual machine since it last started running on the server. The count of elapsed time restarts each time the virtual machine is powered on, resumed, or migrated using VMotion. This value cou...
python
def GetElapsedMs(self): '''Retrieves the number of milliseconds that have passed in the virtual machine since it last started running on the server. The count of elapsed time restarts each time the virtual machine is powered on, resumed, or migrated using VMotion. This value cou...
[ "def", "GetElapsedMs", "(", "self", ")", ":", "counter", "=", "c_uint64", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetElapsedMs", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTLIB...
Retrieves the number of milliseconds that have passed in the virtual machine since it last started running on the server. The count of elapsed time restarts each time the virtual machine is powered on, resumed, or migrated using VMotion. This value counts milliseconds, regardless of ...
[ "Retrieves", "the", "number", "of", "milliseconds", "that", "have", "passed", "in", "the", "virtual", "machine", "since", "it", "last", "started", "running", "on", "the", "server", ".", "The", "count", "of", "elapsed", "time", "restarts", "each", "time", "th...
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L205-L218
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostCpuUsedMs
def GetHostCpuUsedMs(self): '''Undocumented.''' counter = c_uint64() ret = vmGuestLib.VMGuestLib_GetHostCpuUsedMs(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostCpuUsedMs(self): '''Undocumented.''' counter = c_uint64() ret = vmGuestLib.VMGuestLib_GetHostCpuUsedMs(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostCpuUsedMs", "(", "self", ")", ":", "counter", "=", "c_uint64", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostCpuUsedMs", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VM...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L221-L226
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemKernOvhdMB
def GetHostMemKernOvhdMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemKernOvhdMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemKernOvhdMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemKernOvhdMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemKernOvhdMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemKernOvhdMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=",...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L229-L234
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemMappedMB
def GetHostMemMappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemMappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemMappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemMappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemMappedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemMappedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L237-L242
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemPhysFreeMB
def GetHostMemPhysFreeMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemPhysFreeMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemPhysFreeMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemPhysFreeMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemPhysFreeMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemPhysFreeMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=",...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L245-L250
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemPhysMB
def GetHostMemPhysMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemPhysMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemPhysMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemPhysMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemPhysMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemPhysMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGU...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L253-L258
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemSharedMB
def GetHostMemSharedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemSharedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemSharedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemSharedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemSharedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemSharedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L261-L266
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemSwappedMB
def GetHostMemSwappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemSwappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemSwappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemSwappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemSwappedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemSwappedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", ...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L269-L274
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemUnmappedMB
def GetHostMemUnmappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemUnmappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemUnmappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemUnmappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemUnmappedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemUnmappedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=",...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L277-L282
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostMemUsedMB
def GetHostMemUsedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemUsedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostMemUsedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostMemUsedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostMemUsedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostMemUsedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGU...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L285-L290
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostNumCpuCores
def GetHostNumCpuCores(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostNumCpuCores(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetHostNumCpuCores(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostNumCpuCores(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetHostNumCpuCores", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostNumCpuCores", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L293-L298
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetHostProcessorSpeed
def GetHostProcessorSpeed(self): '''Retrieves the speed of the ESX system's physical CPU in MHz.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostProcessorSpeed(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return co...
python
def GetHostProcessorSpeed(self): '''Retrieves the speed of the ESX system's physical CPU in MHz.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetHostProcessorSpeed(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return co...
[ "def", "GetHostProcessorSpeed", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetHostProcessorSpeed", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=...
Retrieves the speed of the ESX system's physical CPU in MHz.
[ "Retrieves", "the", "speed", "of", "the", "ESX", "system", "s", "physical", "CPU", "in", "MHz", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L300-L305
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemActiveMB
def GetMemActiveMB(self): '''Retrieves the amount of memory the virtual machine is actively using its estimated working set size.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemActiveMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGue...
python
def GetMemActiveMB(self): '''Retrieves the amount of memory the virtual machine is actively using its estimated working set size.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemActiveMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGue...
[ "def", "GetMemActiveMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemActiveMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTL...
Retrieves the amount of memory the virtual machine is actively using its estimated working set size.
[ "Retrieves", "the", "amount", "of", "memory", "the", "virtual", "machine", "is", "actively", "using", "its", "estimated", "working", "set", "size", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L307-L313
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemBalloonedMB
def GetMemBalloonedMB(self): '''Retrieves the amount of memory that has been reclaimed from this virtual machine by the vSphere memory balloon driver (also referred to as the "vmmemctl" driver).''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemBalloonedMB(self.handle...
python
def GetMemBalloonedMB(self): '''Retrieves the amount of memory that has been reclaimed from this virtual machine by the vSphere memory balloon driver (also referred to as the "vmmemctl" driver).''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemBalloonedMB(self.handle...
[ "def", "GetMemBalloonedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemBalloonedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VM...
Retrieves the amount of memory that has been reclaimed from this virtual machine by the vSphere memory balloon driver (also referred to as the "vmmemctl" driver).
[ "Retrieves", "the", "amount", "of", "memory", "that", "has", "been", "reclaimed", "from", "this", "virtual", "machine", "by", "the", "vSphere", "memory", "balloon", "driver", "(", "also", "referred", "to", "as", "the", "vmmemctl", "driver", ")", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L315-L322
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemBalloonMaxMB
def GetMemBalloonMaxMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemBalloonMaxMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetMemBalloonMaxMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemBalloonMaxMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetMemBalloonMaxMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemBalloonMaxMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L325-L330
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemBalloonTargetMB
def GetMemBalloonTargetMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemBalloonTargetMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetMemBalloonTargetMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemBalloonTargetMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetMemBalloonTargetMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemBalloonTargetMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L333-L338
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemLimitMB
def GetMemLimitMB(self): '''Retrieves the upper limit of memory that is available to the virtual machine. For information about setting a memory limit, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemLimitMB(self.handle.valu...
python
def GetMemLimitMB(self): '''Retrieves the upper limit of memory that is available to the virtual machine. For information about setting a memory limit, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemLimitMB(self.handle.valu...
[ "def", "GetMemLimitMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemLimitMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTLIB...
Retrieves the upper limit of memory that is available to the virtual machine. For information about setting a memory limit, see "Limits and Reservations" on page 14.
[ "Retrieves", "the", "upper", "limit", "of", "memory", "that", "is", "available", "to", "the", "virtual", "machine", ".", "For", "information", "about", "setting", "a", "memory", "limit", "see", "Limits", "and", "Reservations", "on", "page", "14", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L340-L347
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemLLSwappedMB
def GetMemLLSwappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemLLSwappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetMemLLSwappedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemLLSwappedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetMemLLSwappedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemLLSwappedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VM...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L350-L355
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemMappedMB
def GetMemMappedMB(self): '''Retrieves the amount of memory that is allocated to the virtual machine. Memory that is ballooned, swapped, or has never been accessed is excluded.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemMappedMB(self.handle.value, byref(counter...
python
def GetMemMappedMB(self): '''Retrieves the amount of memory that is allocated to the virtual machine. Memory that is ballooned, swapped, or has never been accessed is excluded.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemMappedMB(self.handle.value, byref(counter...
[ "def", "GetMemMappedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemMappedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTL...
Retrieves the amount of memory that is allocated to the virtual machine. Memory that is ballooned, swapped, or has never been accessed is excluded.
[ "Retrieves", "the", "amount", "of", "memory", "that", "is", "allocated", "to", "the", "virtual", "machine", ".", "Memory", "that", "is", "ballooned", "swapped", "or", "has", "never", "been", "accessed", "is", "excluded", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L357-L364
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemOverheadMB
def GetMemOverheadMB(self): '''Retrieves the amount of "overhead" memory associated with this virtual machine that is currently consumed on the host system. Overhead memory is additional memory that is reserved for data structures required by the virtualization layer.''' ...
python
def GetMemOverheadMB(self): '''Retrieves the amount of "overhead" memory associated with this virtual machine that is currently consumed on the host system. Overhead memory is additional memory that is reserved for data structures required by the virtualization layer.''' ...
[ "def", "GetMemOverheadMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemOverheadMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGU...
Retrieves the amount of "overhead" memory associated with this virtual machine that is currently consumed on the host system. Overhead memory is additional memory that is reserved for data structures required by the virtualization layer.
[ "Retrieves", "the", "amount", "of", "overhead", "memory", "associated", "with", "this", "virtual", "machine", "that", "is", "currently", "consumed", "on", "the", "host", "system", ".", "Overhead", "memory", "is", "additional", "memory", "that", "is", "reserved",...
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L366-L374
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemReservationMB
def GetMemReservationMB(self): '''Retrieves the minimum amount of memory that is reserved for the virtual machine. For information about setting a memory reservation, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemReservati...
python
def GetMemReservationMB(self): '''Retrieves the minimum amount of memory that is reserved for the virtual machine. For information about setting a memory reservation, see "Limits and Reservations" on page 14.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemReservati...
[ "def", "GetMemReservationMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemReservationMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", ...
Retrieves the minimum amount of memory that is reserved for the virtual machine. For information about setting a memory reservation, see "Limits and Reservations" on page 14.
[ "Retrieves", "the", "minimum", "amount", "of", "memory", "that", "is", "reserved", "for", "the", "virtual", "machine", ".", "For", "information", "about", "setting", "a", "memory", "reservation", "see", "Limits", "and", "Reservations", "on", "page", "14", "." ...
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L376-L383
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemSharedMB
def GetMemSharedMB(self): '''Retrieves the amount of physical memory associated with this virtual machine that is copy-on-write (COW) shared on the host.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSharedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ER...
python
def GetMemSharedMB(self): '''Retrieves the amount of physical memory associated with this virtual machine that is copy-on-write (COW) shared on the host.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSharedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ER...
[ "def", "GetMemSharedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemSharedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTL...
Retrieves the amount of physical memory associated with this virtual machine that is copy-on-write (COW) shared on the host.
[ "Retrieves", "the", "amount", "of", "physical", "memory", "associated", "with", "this", "virtual", "machine", "that", "is", "copy", "-", "on", "-", "write", "(", "COW", ")", "shared", "on", "the", "host", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L385-L391
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemSharedSavedMB
def GetMemSharedSavedMB(self): '''Retrieves the estimated amount of physical memory on the host saved from copy-on-write (COW) shared guest physical memory.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSharedSavedMB(self.handle.value, byref(counter)) if ret != VMGUE...
python
def GetMemSharedSavedMB(self): '''Retrieves the estimated amount of physical memory on the host saved from copy-on-write (COW) shared guest physical memory.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSharedSavedMB(self.handle.value, byref(counter)) if ret != VMGUE...
[ "def", "GetMemSharedSavedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemSharedSavedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", ...
Retrieves the estimated amount of physical memory on the host saved from copy-on-write (COW) shared guest physical memory.
[ "Retrieves", "the", "estimated", "amount", "of", "physical", "memory", "on", "the", "host", "saved", "from", "copy", "-", "on", "-", "write", "(", "COW", ")", "shared", "guest", "physical", "memory", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L393-L399
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemShares
def GetMemShares(self): '''Retrieves the number of memory shares allocated to the virtual machine. For information about how an ESX server uses memory shares to manage virtual machine priority, see the vSphere Resource Management Guide.''' counter = c_uint() ret = vmGuestLi...
python
def GetMemShares(self): '''Retrieves the number of memory shares allocated to the virtual machine. For information about how an ESX server uses memory shares to manage virtual machine priority, see the vSphere Resource Management Guide.''' counter = c_uint() ret = vmGuestLi...
[ "def", "GetMemShares", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemShares", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTLIB_E...
Retrieves the number of memory shares allocated to the virtual machine. For information about how an ESX server uses memory shares to manage virtual machine priority, see the vSphere Resource Management Guide.
[ "Retrieves", "the", "number", "of", "memory", "shares", "allocated", "to", "the", "virtual", "machine", ".", "For", "information", "about", "how", "an", "ESX", "server", "uses", "memory", "shares", "to", "manage", "virtual", "machine", "priority", "see", "the"...
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L401-L408
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemSwappedMB
def GetMemSwappedMB(self): '''Retrieves the amount of memory that has been reclaimed from this virtual machine by transparently swapping guest memory to disk.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSwappedMB(self.handle.value, byref(counter)) if ret != VMGUEST...
python
def GetMemSwappedMB(self): '''Retrieves the amount of memory that has been reclaimed from this virtual machine by transparently swapping guest memory to disk.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSwappedMB(self.handle.value, byref(counter)) if ret != VMGUEST...
[ "def", "GetMemSwappedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemSwappedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUES...
Retrieves the amount of memory that has been reclaimed from this virtual machine by transparently swapping guest memory to disk.
[ "Retrieves", "the", "amount", "of", "memory", "that", "has", "been", "reclaimed", "from", "this", "virtual", "machine", "by", "transparently", "swapping", "guest", "memory", "to", "disk", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L410-L416
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemSwapTargetMB
def GetMemSwapTargetMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSwapTargetMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetMemSwapTargetMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemSwapTargetMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetMemSwapTargetMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemSwapTargetMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L419-L424
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemTargetSizeMB
def GetMemTargetSizeMB(self): '''Retrieves the size of the target memory allocation for this virtual machine.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemTargetSizeMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) ...
python
def GetMemTargetSizeMB(self): '''Retrieves the size of the target memory allocation for this virtual machine.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemTargetSizeMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) ...
[ "def", "GetMemTargetSizeMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemTargetSizeMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "...
Retrieves the size of the target memory allocation for this virtual machine.
[ "Retrieves", "the", "size", "of", "the", "target", "memory", "allocation", "for", "this", "virtual", "machine", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L426-L431
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemUsedMB
def GetMemUsedMB(self): '''Retrieves the estimated amount of physical host memory currently consumed for this virtual machine's physical memory.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemUsedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS...
python
def GetMemUsedMB(self): '''Retrieves the estimated amount of physical host memory currently consumed for this virtual machine's physical memory.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemUsedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS...
[ "def", "GetMemUsedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemUsedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTLIB_E...
Retrieves the estimated amount of physical host memory currently consumed for this virtual machine's physical memory.
[ "Retrieves", "the", "estimated", "amount", "of", "physical", "host", "memory", "currently", "consumed", "for", "this", "virtual", "machine", "s", "physical", "memory", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L433-L439
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemZippedMB
def GetMemZippedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemZippedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetMemZippedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemZippedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetMemZippedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemZippedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGUESTL...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L442-L447
train
dagwieers/vmguestlib
vmguestlib.py
VMGuestLib.GetMemZipSavedMB
def GetMemZipSavedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemZipSavedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
python
def GetMemZipSavedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemZipSavedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
[ "def", "GetMemZipSavedMB", "(", "self", ")", ":", "counter", "=", "c_uint", "(", ")", "ret", "=", "vmGuestLib", ".", "VMGuestLib_GetMemZipSavedMB", "(", "self", ".", "handle", ".", "value", ",", "byref", "(", "counter", ")", ")", "if", "ret", "!=", "VMGU...
Undocumented.
[ "Undocumented", "." ]
2ba9333a745628cf9e6b4c767427a5bd997a71ad
https://github.com/dagwieers/vmguestlib/blob/2ba9333a745628cf9e6b4c767427a5bd997a71ad/vmguestlib.py#L450-L455
train
markchil/gptools
gptools/splines.py
spev
def spev(t_int, C, deg, x, cov_C=None, M_spline=False, I_spline=False, n=0): """Evaluate a B-, M- or I-spline with the specified internal knots, order and coefficients. `deg` boundary knots are appended at both sides of the domain. The zeroth order basis functions are modified to ensure continuity...
python
def spev(t_int, C, deg, x, cov_C=None, M_spline=False, I_spline=False, n=0): """Evaluate a B-, M- or I-spline with the specified internal knots, order and coefficients. `deg` boundary knots are appended at both sides of the domain. The zeroth order basis functions are modified to ensure continuity...
[ "def", "spev", "(", "t_int", ",", "C", ",", "deg", ",", "x", ",", "cov_C", "=", "None", ",", "M_spline", "=", "False", ",", "I_spline", "=", "False", ",", "n", "=", "0", ")", ":", "C", "=", "scipy", ".", "asarray", "(", "C", ",", "dtype", "="...
Evaluate a B-, M- or I-spline with the specified internal knots, order and coefficients. `deg` boundary knots are appended at both sides of the domain. The zeroth order basis functions are modified to ensure continuity at the right-hand boundary. Note that the I-splines include the :math:...
[ "Evaluate", "a", "B", "-", "M", "-", "or", "I", "-", "spline", "with", "the", "specified", "internal", "knots", "order", "and", "coefficients", ".", "deg", "boundary", "knots", "are", "appended", "at", "both", "sides", "of", "the", "domain", ".", "The", ...
225db52bfe6baef1516529ad22177aa2cf7b71e4
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/splines.py#L5-L146
train
coursera/courseraoauth2client
courseraoauth2client/commands/version.py
parser
def parser(subparsers): "Build an argparse argument parser to parse the command line." # create the parser for the version subcommand. parser_version = subparsers.add_parser( 'version', help="Output the version of %(prog)s to the console.") parser_version.set_defaults(func=command_versi...
python
def parser(subparsers): "Build an argparse argument parser to parse the command line." # create the parser for the version subcommand. parser_version = subparsers.add_parser( 'version', help="Output the version of %(prog)s to the console.") parser_version.set_defaults(func=command_versi...
[ "def", "parser", "(", "subparsers", ")", ":", "# create the parser for the version subcommand.", "parser_version", "=", "subparsers", ".", "add_parser", "(", "'version'", ",", "help", "=", "\"Output the version of %(prog)s to the console.\"", ")", "parser_version", ".", "se...
Build an argparse argument parser to parse the command line.
[ "Build", "an", "argparse", "argument", "parser", "to", "parse", "the", "command", "line", "." ]
4edd991defe26bfc768ab28a30368cace40baf44
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/commands/version.py#L53-L62
train
CTPUG/wafer
wafer/registration/templatetags/wafer_crispy.py
wafer_form_helper
def wafer_form_helper(context, helper_name): ''' Find the specified Crispy FormHelper and instantiate it. Handy when you are crispyifying other apps' forms. ''' request = context.request module, class_name = helper_name.rsplit('.', 1) if module not in sys.modules: __import__(module) ...
python
def wafer_form_helper(context, helper_name): ''' Find the specified Crispy FormHelper and instantiate it. Handy when you are crispyifying other apps' forms. ''' request = context.request module, class_name = helper_name.rsplit('.', 1) if module not in sys.modules: __import__(module) ...
[ "def", "wafer_form_helper", "(", "context", ",", "helper_name", ")", ":", "request", "=", "context", ".", "request", "module", ",", "class_name", "=", "helper_name", ".", "rsplit", "(", "'.'", ",", "1", ")", "if", "module", "not", "in", "sys", ".", "modu...
Find the specified Crispy FormHelper and instantiate it. Handy when you are crispyifying other apps' forms.
[ "Find", "the", "specified", "Crispy", "FormHelper", "and", "instantiate", "it", ".", "Handy", "when", "you", "are", "crispyifying", "other", "apps", "forms", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/registration/templatetags/wafer_crispy.py#L8-L19
train
CTPUG/wafer
wafer/pages/models.py
page_menus
def page_menus(root_menu): """Add page menus.""" for page in Page.objects.filter(include_in_menu=True): path = page.get_path() menu = path[0] if len(path) > 1 else None try: root_menu.add_item(page.name, page.get_absolute_url(), menu=menu) except MenuError as e: ...
python
def page_menus(root_menu): """Add page menus.""" for page in Page.objects.filter(include_in_menu=True): path = page.get_path() menu = path[0] if len(path) > 1 else None try: root_menu.add_item(page.name, page.get_absolute_url(), menu=menu) except MenuError as e: ...
[ "def", "page_menus", "(", "root_menu", ")", ":", "for", "page", "in", "Page", ".", "objects", ".", "filter", "(", "include_in_menu", "=", "True", ")", ":", "path", "=", "page", ".", "get_path", "(", ")", "menu", "=", "path", "[", "0", "]", "if", "l...
Add page menus.
[ "Add", "page", "menus", "." ]
a20af3c399267f76373dc342f4d542a9bc457c35
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/pages/models.py#L162-L171
train