text
stringlengths
81
112k
Helper routine to easily test if the schedule is valid 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 = ...
Helper routine to report issues with the 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) ...
Change the form depending on whether we're adding or editing the slot. 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'] = SlotAdm...
Return the menus from the cache or generate them if needed. 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) ...
If argument is not a string, return it. Otherwise import the dotted name and return that. 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 part...
Generate a new list of menus. 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 ...
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 def lock(self): ''' Try to get locked the file - the function will wait until the ...
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. def _make_handler(state_token, done_function): ''' Makes a a handler class to use inside the basic python HTTP server. ...
Loads configuration from the file system. 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...
Reads the local fs cache for pre-authorized access tokens 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.to...
Write out to the filesystem a cache of the OAuth2 information. 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): ...
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_token_cache_type(self, cache_value): ''' Checks the cache_value for appropria...
Stands up a new localhost http server and retrieves new OAuth2 access tokens from the Coursera OAuth2 server. def _authorize_new_tokens(self): ''' Stands up a new localhost http server and retrieves new OAuth2 access tokens from the Coursera OAuth2 server. ''' logging.in...
Exchanges a refresh token for an access token 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 = { ...
function to determine if each select field needs a create button or not 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...
Some types get serialized to JSON, as strings. If we know what they are supposed to be, we can deserialize them 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, fo...
Combined hyperprior for the kernel, noise kernel and (if present) mean function. 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....
Combined fixed hyperparameter flags for the kernel, noise kernel and (if present) mean function. 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) ...
Combined hyperparameters for the kernel, noise kernel and (if present) mean function. 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: ...
Combined names for the hyperparameters for the kernel, noise kernel and (if present) mean function. 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)...
Combined free hyperparameters for the kernel, noise kernel and (if present) mean function. 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...
Set the free parameters. Note that this bypasses enforce_bounds. 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_...
Combined free hyperparameter bounds for the kernel, noise kernel and (if present) mean function. 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_...
Combined free hyperparameter names for the kernel, noise kernel and (if present) mean function. 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_...
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-...
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...
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...
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...
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 ...
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...
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...
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"""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 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+...
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 ...
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...
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 -...
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. The columns will contain the covariance length scale function. Parameters ---------- ...
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...
Build an argparse argument parser to parse the command line. 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 ac...
Boots up the command line tool 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 Syste...
Add sponsor menu links. 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....
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 def objectatrib(instance, atrib): ''' this filter is going to be useful to execute an object method or get an obje...
Renders the field. 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_cs...
During form initialization, some widgets have to be replaced by a counterpart suitable to be rendered the AngularJS way. def convert_widgets(self): """ During form initialization, some widgets have to be replaced by a counterpart suitable to be rendered the AngularJS way. """ ...
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 def epochdate(timestamp): ''' Convet an epoch date to a tuple in format ("yyyy-mm-dd","hh:mm:ss") Example: "1023456427" -> ("20...
Analize itself looking for special information, right now it returns: - Application name - Model name def model_inspect(obj): ''' Analize itself looking for special information, right now it returns: - Application name - Model name ''' # Prepare the infor...
This method is created to return the path to upload files. This path must be different from any other to avoid problems. 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_sep...
for string 'get_FIELD_NAME_display' return 'FIELD_NAME' 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):]: fiel...
JSON Encoder newdfeault is a wrapper capable of encoding several kinds Usage: from codenerix.helpers import JSONEncoder_newdefault JSONEncoder_newdefault() def JSONEncoder_newdefault(kind=['uuid', 'datetime', 'time', 'decimal']): ''' JSON Encoder newdfeault is a wrapper capable of encoding ...
Update context with context_processors from settings Usage: from codenerix.helpers import context_processors_update context_processors_update(context, self.request) def context_processors_update(context, request): ''' Update context with context_processors from settings Usage: f...
Appends a file with name filename_in_zip and contents of file_contents to the in-memory zip. 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 t...
Writes the in-memory zip to a file. def writetofile(self, filename): '''Writes the in-memory zip to a file.''' f = open(filename, "w") f.write(self.read()) f.close()
Returns the corresponding url from the sponsors images 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 s...
returns the corresponding url from the tagged image list. 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 ''
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 %} def ifusergroup(pars...
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...
Releases a handle acquired with VMGuestLib_OpenHandle 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 VMGuestLibExc...
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...
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. def GetSessionId(self): '''Retrieves the VMSessionID for the current session...
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. def GetCpuLimitMHz(self): '''Retrieves the upperlimit of processor use in MHz available to the virtual machi...
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. def GetCpuReservationMHz(self): '''Retrieves the minimum processing power in MHz reserved for the virtual m...
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. def GetCpuShares(self): '''Retrieves the number of CPU shares allocated to the virtua...
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. def GetCpuStolenMs(self): '''Retrieves the number of milliseconds that the virtual machine was in a ready state (able to transition to a ru...
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 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 ...
Undocumented. 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
Undocumented. 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
Undocumented. 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
Undocumented. 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
Undocumented. 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
Undocumented. 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
Undocumented. 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
Undocumented. 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
Undocumented. 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
Undocumented. 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
Retrieves the speed of the ESX system's physical CPU in MHz. 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_E...
Retrieves the amount of memory the virtual machine is actively using its estimated working set size. def GetMemActiveMB(self): '''Retrieves the amount of memory the virtual machine is actively using its estimated working set size.''' counter = c_uint() ret = vmGuestLib.VMG...
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). def GetMemBalloonedMB(self): '''Retrieves the amount of memory that has been reclaimed from this virtual machine by...
Undocumented. 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
Undocumented. 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
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. def GetMemLimitMB(self): '''Retrieves the upper limit of memory that is available to the virtual machine. For in...
Undocumented. 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
Retrieves the amount of memory that is allocated to the virtual machine. Memory that is ballooned, swapped, or has never been accessed is excluded. def GetMemMappedMB(self): '''Retrieves the amount of memory that is allocated to the virtual machine. Memory that is ballooned, sw...
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): '''Retrieves...
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. def GetMemReservationMB(self): '''Retrieves the minimum amount of memory that is reserved for the virtual ...
Retrieves the amount of physical memory associated with this virtual machine that is copy-on-write (COW) shared on the host. def GetMemSharedMB(self): '''Retrieves the amount of physical memory associated with this virtual machine that is copy-on-write (COW) shared on the host.''' ...
Retrieves the estimated amount of physical memory on the host saved from copy-on-write (COW) shared guest physical memory. def GetMemSharedSavedMB(self): '''Retrieves the estimated amount of physical memory on the host saved from copy-on-write (COW) shared guest physical memory.''' ...
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. def GetMemShares(self): '''Retrieves the number of memory shares allocated to t...
Retrieves the amount of memory that has been reclaimed from this virtual machine by transparently swapping guest memory to disk. def GetMemSwappedMB(self): '''Retrieves the amount of memory that has been reclaimed from this virtual machine by transparently swapping guest memory to disk.''...
Undocumented. 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
Retrieves the size of the target memory allocation for this virtual machine. 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)) ...
Retrieves the estimated amount of physical host memory currently consumed for this virtual machine's physical memory. def GetMemUsedMB(self): '''Retrieves the estimated amount of physical host memory currently consumed for this virtual machine's physical memory.''' counter = c_uin...
Undocumented. 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
Undocumented. 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
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:...
Build an argparse argument parser to parse the command line. 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...
Find the specified Crispy FormHelper and instantiate it. Handy when you are crispyifying other apps' forms. 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 ...
Add 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 Menu...