_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q41400
HTTPClient.prepare_http_request
train
def prepare_http_request(self, method_type, params, **kwargs): """ Prepares the HTTP REQUEST and returns it. Args: method_type: The HTTP method type params: Additional parameters for the HTTP request. kwargs: Any extra keyword arguements passed into a client ...
python
{ "resource": "" }
q41401
HTTPClient.call_api
train
def call_api(self, method_type, method_name, valid_status_codes, resource, data, uid, **kwargs): """ Make HTTP calls. Args: method_type: The HTTP method method_name: The name of the python method making the HTTP call valid_st...
python
{ "resource": "" }
q41402
HTTPClient._handle_response
train
def _handle_response(self, response, valid_status_codes, resource): """ Handles Response objects Args: response: An HTTP reponse object valid_status_codes: A tuple list of valid status codes resource: The resource class to build from this response re...
python
{ "resource": "" }
q41403
HTTPHypermediaClient._call_api_single_related_resource
train
def _call_api_single_related_resource(self, resource, full_resource_url, method_name, **kwargs): """ For HypermediaResource - make an API call to a known URL """ url = full_resource_url params = { 'headers': self.get_http_head...
python
{ "resource": "" }
q41404
HTTPHypermediaClient._call_api_many_related_resources
train
def _call_api_many_related_resources(self, resource, url_list, method_name, **kwargs): """ For HypermediaResource - make an API call to a list of known URLs """ responses = [] for url in url_list: params = { 'he...
python
{ "resource": "" }
q41405
BaseClient.assign_methods
train
def assign_methods(self, resource_class): """ Given a resource_class and it's Meta.methods tuple, assign methods for communicating with that resource. Args: resource_class: A single resource class """ assert all([ x.upper() in VALID_METHODS for x ...
python
{ "resource": "" }
q41406
BaseClient._assign_method
train
def _assign_method(self, resource_class, method_type): """ Using reflection, assigns a new method to this class. Args: resource_class: A resource class method_type: The HTTP method type """ """ If we assigned the same method to each method, it's ...
python
{ "resource": "" }
q41407
command
train
def command(state, args): """Purge all caches.""" state.cache_manager.teardown() state.cache_manager.setup() EpisodeTypes.forget(state.db) del state.file_picker
python
{ "resource": "" }
q41408
Results.append
train
def append(self, row): """Append a result row and check its length. >>> x = Results(['title', 'type']) >>> x.append(('Konosuba', 'TV')) >>> x Results(['title', 'type'], [('Konosuba', 'TV')]) >>> x.append(('Konosuba',)) Traceback (most recent call last): ...
python
{ "resource": "" }
q41409
Results.set
train
def set(self, results): """Set results. results is an iterable of tuples, where each tuple is a row of results. >>> x = Results(['title']) >>> x.set([('Konosuba',), ('Oreimo',)]) >>> x Results(['title'], [('Konosuba',), ('Oreimo',)]) """ self.results = ...
python
{ "resource": "" }
q41410
command
train
def command(state, args): """Unregister watching regexp for an anime.""" args = parser.parse_args(args[1:]) if args.complete: query.files.delete_regexp_complete(state.db) else: if args.aid is None: parser.print_help() else: aid = state.results.parse_aid(ar...
python
{ "resource": "" }
q41411
smooth_hanning
train
def smooth_hanning(x, size=11): """smooth a 1D array using a hanning window with requested size.""" if x.ndim != 1: raise ValueError, "smooth_hanning only accepts 1-D arrays." if x.size < size: raise ValueError, "Input vector needs to be bigger than window size." if size < 3: re...
python
{ "resource": "" }
q41412
vspht
train
def vspht(vsphere, nmax=None, mmax=None): """Returns a VectorCoefs object containt the vector spherical harmonic coefficients of the VectorPatternUniform object""" if nmax == None: nmax = vsphere.nrows - 2 mmax = int(vsphere.ncols / 2) - 1 elif mmax == None: mmax = ...
python
{ "resource": "" }
q41413
ScalarCoefs._reshape_n_vecs
train
def _reshape_n_vecs(self): """return list of arrays, each array represents a different m mode""" lst = [] sl = slice(None, None, None) lst.append(self.__getitem__((sl, 0))) for m in xrange(1, self.mmax + 1): lst.append(self.__getitem__((sl, -m))) ...
python
{ "resource": "" }
q41414
ScalarCoefs._reshape_m_vecs
train
def _reshape_m_vecs(self): """return list of arrays, each array represents a different n mode""" lst = [] for n in xrange(0, self.nmax + 1): mlst = [] if n <= self.mmax: nn = n else: nn = self.mmax ...
python
{ "resource": "" }
q41415
ScalarCoefs._scalar_coef_op_left
train
def _scalar_coef_op_left(func): """decorator for operator overloading when ScalarCoef is on the left""" @wraps(func) def verif(self, scoef): if isinstance(scoef, ScalarCoefs): if len(self._vec) == len(scoef._vec): return ScalarCoefs(...
python
{ "resource": "" }
q41416
ScalarCoefs._scalar_coef_op_right
train
def _scalar_coef_op_right(func): """decorator for operator overloading when ScalarCoef is on the right""" @wraps(func) def verif(self, scoef): if isinstance(scoef, numbers.Number): return ScalarCoefs(func(self, self._vec, scoef), ...
python
{ "resource": "" }
q41417
VectorCoefs._vector_coef_op_left
train
def _vector_coef_op_left(func): """decorator for operator overloading when VectorCoef is on the left""" @wraps(func) def verif(self, vcoef): if isinstance(vcoef, VectorCoefs): if len(vcoef.scoef1._vec) == len(vcoef.scoef1._vec): retu...
python
{ "resource": "" }
q41418
VectorCoefs._vector_coef_op_right
train
def _vector_coef_op_right(func): """decorator for operator overloading when VectorCoefs is on the right""" @wraps(func) def verif(self, vcoef): if isinstance(vcoef, numbers.Number): return VectorCoefs(func(self, self.scoef1._vec, vcoef), ...
python
{ "resource": "" }
q41419
ScalarPatternUniform._scalar_pattern_uniform_op_left
train
def _scalar_pattern_uniform_op_left(func): """Decorator for operator overloading when ScalarPatternUniform is on the left.""" @wraps(func) def verif(self, patt): if isinstance(patt, ScalarPatternUniform): if self._dsphere.shape == patt._dsphere.shape: ...
python
{ "resource": "" }
q41420
ScalarPatternUniform._scalar_pattern_uniform_op_right
train
def _scalar_pattern_uniform_op_right(func): """Decorator for operator overloading when ScalarPatternUniform is on the right.""" @wraps(func) def verif(self, patt): if isinstance(patt, numbers.Number): return ScalarPatternUniform(func(self, self._dsphere,...
python
{ "resource": "" }
q41421
TransversePatternUniform.single_val
train
def single_val(self): """return relative error of worst point that might make the data none symmetric. """ sv_t = self._sv(self._tdsphere) sv_p = self._sv(self._tdsphere) return (sv_t, sv_p)
python
{ "resource": "" }
q41422
TransversePatternUniform._vector_pattern_uniform_op_left
train
def _vector_pattern_uniform_op_left(func): """decorator for operator overloading when VectorPatternUniform is on the left""" @wraps(func) def verif(self, patt): if isinstance(patt, TransversePatternUniform): if self._tdsphere.shape == patt._tdsphere.sha...
python
{ "resource": "" }
q41423
TransversePatternUniform._vector_pattern_uniform_op_right
train
def _vector_pattern_uniform_op_right(func): """decorator for operator overloading when VectorPatternUniform is on the right""" @wraps(func) def verif(self, patt): if isinstance(patt, numbers.Number): return TransversePatternUniform(func(self, self._tdsph...
python
{ "resource": "" }
q41424
Device.async_set_port_poe_mode
train
async def async_set_port_poe_mode(self, port_idx, mode): """Set port poe mode. Auto, 24v, passthrough, off. Make sure to not overwrite any existing configs. """ no_existing_config = True for port_override in self.port_overrides: if port_idx == port_override['...
python
{ "resource": "" }
q41425
list_remotes
train
def list_remotes(device=None, address=None): """ List the available remotes. All parameters are passed to irsend. See the man page for irsend for details about their usage. Parameters ---------- device: str address: str Returns ------- [str] Notes ----- No att...
python
{ "resource": "" }
q41426
list_codes
train
def list_codes(remote, device=None, address=None): """ List the codes for a given remote. All parameters are passed to irsend. See the man page for irsend for details about their usage. Parameters ---------- remote: str device: str address: str Returns ------- [str] ...
python
{ "resource": "" }
q41427
check_updates
train
def check_updates(): """Check and display upgraded packages """ count, packages = fetch() message = "No news is good news !" if count > 0: message = ("{0} software updates are available\n".format(count)) return [message, count, packages]
python
{ "resource": "" }
q41428
_init_check_upodates
train
def _init_check_upodates(): """Sub function for init """ message, count, packages = check_updates() if count > 0: print(message) for pkg in packages: print("{0}".format(pkg)) else: print(message)
python
{ "resource": "" }
q41429
init
train
def init(): """Initialization , all begin from here """ su() args = sys.argv args.pop(0) cmd = "{0}sun_daemon".format(bin_path) if len(args) == 1: if args[0] == "start": print("Starting SUN daemon: {0} &".format(cmd)) subprocess.call("{0} &".format(cmd), shel...
python
{ "resource": "" }
q41430
cli
train
def cli(parser): ''' Uninstall inactive Python packages from all accessible site-packages directories. Inactive Python packages when multiple packages with the same name are installed ''' parser.add_argument('-n', '--dry-run', action='store_true', help='Print cleanup actions without running') ...
python
{ "resource": "" }
q41431
GtkStatusIcon.daemon_start
train
def daemon_start(self): """Start daemon when gtk loaded """ if daemon_status() == "SUN not running": subprocess.call("{0} &".format(self.cmd), shell=True)
python
{ "resource": "" }
q41432
GtkStatusIcon.sub_menu
train
def sub_menu(self): """Create daemon submenu """ submenu = gtk.Menu() self.start = gtk.ImageMenuItem("Start") self.stop = gtk.ImageMenuItem("Stop") self.restart = gtk.ImageMenuItem("Restart") self.status = gtk.ImageMenuItem("Status") self.start.show() ...
python
{ "resource": "" }
q41433
GtkStatusIcon.menu
train
def menu(self, event_button, event_time, data=None): """Create popup menu """ self.sub_menu() menu = gtk.Menu() menu.append(self.daemon) separator = gtk.SeparatorMenuItem() menu_Check = gtk.ImageMenuItem("Check updates") img_Check = gtk.image_new_from_st...
python
{ "resource": "" }
q41434
GtkStatusIcon.message
train
def message(self, data): """Function to display messages to the user """ msg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, data) msg.set_resizable(1) msg.set_title(self.dialog_title) self.img.set_from_file...
python
{ "resource": "" }
q41435
GtkStatusIcon.right_click
train
def right_click(self, data, event_button, event_time): """Right click handler """ self.menu(event_button, event_time, data)
python
{ "resource": "" }
q41436
IntentParser.parse
train
def parse(payload, candidate_classes): """ Parse a json response into an intent. :param payload: a JSON object representing an intent. :param candidate_classes: a list of classes representing various intents, each having their own `parse` ...
python
{ "resource": "" }
q41437
IntentParser.parse_instant_time
train
def parse_instant_time(slot): """ Parse a slot into an InstantTime object. Sample response: { "entity": "snips/datetime", "range": { "end": 36, "start": 28 }, "rawValue": "tomorrow", "slotName": "weatherForecastStartDate...
python
{ "resource": "" }
q41438
IntentParser.parse_time_interval
train
def parse_time_interval(slot): """ Parse a slot into a TimeInterval object. Sample response: { "entity": "snips/datetime", "range": { "end": 42, "start": 13 }, "rawValue": "between tomorrow and saturday", "slotName": "we...
python
{ "resource": "" }
q41439
CSViewer.csview
train
def csview(self, view=False): """View chemical shift values organized by amino acid residue. :param view: Open in default image viewer or save file in current working directory quietly. :type view: :py:obj:`True` or :py:obj:`False` :return: None :rtype: :py:obj:`None` ""...
python
{ "resource": "" }
q41440
DomainPartitionIter.getStringPartition
train
def getStringPartition(self): """ Get the string representation of the current partition @return string like ":-1,0:2" """ res = '' for s in self.partitions[self.index].getSlice(): start = '' stop = '' if s.start is not None: ...
python
{ "resource": "" }
q41441
urlopen
train
def urlopen(link): """Return urllib2 urlopen """ try: return urllib2.urlopen(link) except urllib2.URLError: pass except ValueError: return "" except KeyboardInterrupt: print("") raise SystemExit()
python
{ "resource": "" }
q41442
ins_packages
train
def ins_packages(): """Count installed Slackware packages """ count = 0 for pkg in os.listdir(pkg_path): if not pkg.startswith("."): count += 1 return count
python
{ "resource": "" }
q41443
read_config
train
def read_config(config): """Read config file and return uncomment line """ for line in config.splitlines(): line = line.lstrip() if line and not line.startswith("#"): return line return ""
python
{ "resource": "" }
q41444
mirror
train
def mirror(): """Get mirror from slackpkg mirrors file """ slack_mirror = read_config( read_file("{0}{1}".format(etc_slackpkg, "mirrors"))) if slack_mirror: return slack_mirror + changelog_txt else: print("\nYou do not have any mirror selected in /etc/slackpkg/mirrors" ...
python
{ "resource": "" }
q41445
fetch
train
def fetch(): """Get ChangeLog.txt file size and counts upgraded packages """ mir, r, slackpkg_last_date = mirror(), "", "" count, upgraded = 0, [] if mir: tar = urlopen(mir) try: r = tar.read() except AttributeError: print("sun: error: can't read mirro...
python
{ "resource": "" }
q41446
config
train
def config(): """Return sun configuration values """ conf_args = { "INTERVAL": 60, "STANDBY": 3 } config_file = read_file("{0}{1}".format(conf_path, "sun.conf")) for line in config_file.splitlines(): line = line.lstrip() if line and not line.startswith("#"): ...
python
{ "resource": "" }
q41447
os_info
train
def os_info(): """Get OS info """ stype = "" slack, ver = slack_ver() mir = mirror() if mir: if "current" in mir: stype = "Current" else: stype = "Stable" info = ( "User: {0}\n" "OS: {1}\n" "Version: {2}\n" "Type: {3}\n"...
python
{ "resource": "" }
q41448
getPrimeFactors
train
def getPrimeFactors(n): """ Get all the prime factor of given integer @param n integer @return list [1, ..., n] """ lo = [1] n2 = n // 2 k = 2 for k in range(2, n2 + 1): if (n // k)*k == n: lo.append(k) return lo + [n, ]
python
{ "resource": "" }
q41449
CubeDecomp.getNeighborProc
train
def getNeighborProc(self, proc, offset, periodic=None): """ Get the neighbor to a processor @param proc the reference processor rank @param offset displacement, e.g. (1, 0) for north, (0, -1) for west,... @param periodic boolean list of True/False values, True if axis is ...
python
{ "resource": "" }
q41450
CubeDecomp.__computeDecomp
train
def __computeDecomp(self): """ Compute optimal dedomposition, each sub-domain has the same volume in index space. @return list if successful, empty list if not successful """ primeNumbers = [getPrimeFactors(d) for d in self.globalDims] ns = [len(pns) for pns in p...
python
{ "resource": "" }
q41451
APIConstructor._generate_manager
train
def _generate_manager(manager_config): ''' Generate a manager from a manager_config dictionary Parameters ---------- manager_config : dict Configuration with keys class, args, and kwargs used to generate a new datafs.manager object Returns ...
python
{ "resource": "" }
q41452
APIConstructor._generate_service
train
def _generate_service(service_config): ''' Generate a service from a service_config dictionary Parameters ---------- service_config : dict Configuration with keys service, args, and kwargs used to generate a new fs service object Ret...
python
{ "resource": "" }
q41453
StencilOperator.addStencilBranch
train
def addStencilBranch(self, disp, weight): """ Set or overwrite the stencil weight for the given direction @param disp displacement vector @param weight stencil weight """ self.stencil[tuple(disp)] = weight self.__setPartionLogic(disp)
python
{ "resource": "" }
q41454
StencilOperator.apply
train
def apply(self, localArray): """ Apply stencil to data @param localArray local array @return new array on local proc """ # input dist array inp = daZeros(localArray.shape, localArray.dtype) inp[...] = localArray inp.setComm(self.comm) # o...
python
{ "resource": "" }
q41455
MultiArrayIter.getIndicesFromBigIndex
train
def getIndicesFromBigIndex(self, bigIndex): """ Get index set from given big index @param bigIndex @return index set @note no checks are performed to ensure that the returned big index is valid """ indices = numpy.array([0 for i in range(self.ndims)]) ...
python
{ "resource": "" }
q41456
MultiArrayIter.getBigIndexFromIndices
train
def getBigIndexFromIndices(self, indices): """ Get the big index from a given set of indices @param indices @return big index @note no checks are performed to ensure that the returned indices are valid """ return reduce(operator.add, [self.dimProd[i]*indic...
python
{ "resource": "" }
q41457
MultiArrayIter.areIndicesValid
train
def areIndicesValid(self, inds): """ Test if indices are valid @param inds index set @return True if valid, False otherwise """ return reduce(operator.and_, [0 <= inds[d] < self.dims[d] for d in range(self.ndims)], True)
python
{ "resource": "" }
q41458
get_setting
train
def get_setting(setting): """ Get the specified django setting, or it's default value """ defaults = { # The context to use for rendering fields 'TEMPLATE_FIELD_CONTEXT': {}, # When this is False, don't do any TemplateField rendering 'TEMPLATE_FIELD_RENDER': True } try: ...
python
{ "resource": "" }
q41459
Invoice.csv_line_items
train
def csv_line_items(self): ''' Invoices from lists omit csv-line-items ''' if not hasattr(self, '_csv_line_items'): url = '{}/{}'.format(self.base_url, self.id) self._csv_line_items = self.harvest._get_element_values(url, self.element_name).next().get('csv-line-it...
python
{ "resource": "" }
q41460
Harvest._create_getters
train
def _create_getters(self, klass): ''' This method creates both the singular and plural getters for various Harvest object classes. ''' flag_name = '_got_' + klass.element_name cache_name = '_' + klass.element_name setattr(self, cache_name, {}) setattr(sel...
python
{ "resource": "" }
q41461
IterableApi.track_purchase
train
def track_purchase(self, user, items, total, purchase_id= None, campaign_id=None, template_id=None, created_at=None, data_fields=None): """ The 'purchase_id' argument maps to 'id' for this API endpoint. This name is used to distinguish it from other instances where 'id' is a part of the API ...
python
{ "resource": "" }
q41462
IterableApi.get_experiment_metrics
train
def get_experiment_metrics(self, path, return_response_object= None, experiment_id=None, campaign_id=None, start_date_time=None, end_date_time=None ): """ This endpoint doesn't return a JSON object, instead it returns a series of rows, each its own object. Given this setup, it make...
python
{ "resource": "" }
q41463
IterableApi.delete_user_by_email
train
def delete_user_by_email(self, email): """ This call will delete a user from the Iterable database. This call requires a path parameter to be passed in, 'email' in this case, which is why we're just adding this to the 'call' argument that goes into the 'api_call' request. """ call = "/api/users/"+ ...
python
{ "resource": "" }
q41464
IterableApi.get_user_by_email
train
def get_user_by_email(self, email): """This function gets a user's data field and info""" call = "/api/users/"+ str(email) return self.api_call(call=call, method="GET")
python
{ "resource": "" }
q41465
IterableApi.bulk_update_user
train
def bulk_update_user(self, users): """ The Iterable 'Bulk User Update' api Bulk update user data or adds it if does not exist. Data is merged - missing fields are not deleted The body of the request takes 1 keys: 1. users -- in the form of an array -- which is the list of users that we're updating in ...
python
{ "resource": "" }
q41466
IterableApi.disable_device
train
def disable_device(self, token, email=None, user_id=None): """ This request manually disable pushes to a device until it comes online again. """ call = "/api/users/disableDevice" payload ={} payload["token"] = str(token) if email is not None: payload["email"] = str(email) if user_id is not N...
python
{ "resource": "" }
q41467
IterableApi.update_user
train
def update_user(self, email=None, data_fields=None, user_id=None, prefer_userId= None, merge_nested_objects=None): """ The Iterable 'User Update' api updates a user profile with new data fields. Missing fields are not deleted and new data is merged. The body of the request takes 4 keys: 1. email-- in...
python
{ "resource": "" }
q41468
cli
train
def cli( ctx, config_file=None, requirements=None, profile=None): ''' An abstraction layer for data storage systems DataFS is a package manager for data. It manages file versions, dependencies, and metadata for individual use or large organizations. For more informa...
python
{ "resource": "" }
q41469
create
train
def create( ctx, archive_name, authority_name, versioned=True, tag=None, helper=False): ''' Create an archive ''' tags = list(tag) _generate_api(ctx) args, kwargs = _parse_args_and_kwargs(ctx.args) assert len(args) == 0, 'Unrecognized argumen...
python
{ "resource": "" }
q41470
update
train
def update( ctx, archive_name, bumpversion='patch', prerelease=None, dependency=None, message=None, string=False, file=None): ''' Update an archive with new contents ''' _generate_api(ctx) args, kwargs = _parse_args_and_kwargs(ctx.arg...
python
{ "resource": "" }
q41471
update_metadata
train
def update_metadata(ctx, archive_name): ''' Update an archive's metadata ''' _generate_api(ctx) args, kwargs = _parse_args_and_kwargs(ctx.args) assert len(args) == 0, 'Unrecognized arguments: "{}"'.format(args) var = ctx.obj.api.get_archive(archive_name) var.update_metadata(metadata=k...
python
{ "resource": "" }
q41472
set_dependencies
train
def set_dependencies(ctx, archive_name, dependency=None): ''' Set the dependencies of an archive ''' _generate_api(ctx) kwargs = _parse_dependencies(dependency) var = ctx.obj.api.get_archive(archive_name) var.set_dependencies(dependencies=kwargs)
python
{ "resource": "" }
q41473
get_dependencies
train
def get_dependencies(ctx, archive_name, version): ''' List the dependencies of an archive ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) deps = [] dependencies = var.get_dependencies(version=version) for arch, dep in dependencies.items(): if dep is None: ...
python
{ "resource": "" }
q41474
get_tags
train
def get_tags(ctx, archive_name): ''' Print tags assigned to an archive ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) click.echo(' '.join(var.get_tags()), nl=False) print('')
python
{ "resource": "" }
q41475
download
train
def download(ctx, archive_name, filepath, version): ''' Download an archive ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) if version is None: version = var.get_default_version() var.download(filepath, version=version) archstr = var.archive_name +\ ...
python
{ "resource": "" }
q41476
cat
train
def cat(ctx, archive_name, version): ''' Echo the contents of an archive ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) with var.open('r', version=version) as f: for chunk in iter(lambda: f.read(1024 * 1024), ''): click.echo(chunk)
python
{ "resource": "" }
q41477
log
train
def log(ctx, archive_name): ''' Get the version log for an archive ''' _generate_api(ctx) ctx.obj.api.get_archive(archive_name).log()
python
{ "resource": "" }
q41478
metadata
train
def metadata(ctx, archive_name): ''' Get an archive's metadata ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) click.echo(pprint.pformat(var.get_metadata()))
python
{ "resource": "" }
q41479
history
train
def history(ctx, archive_name): ''' Get archive history ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) click.echo(pprint.pformat(var.get_history()))
python
{ "resource": "" }
q41480
versions
train
def versions(ctx, archive_name): ''' Get an archive's versions ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) click.echo(pprint.pformat(map(str, var.get_versions())))
python
{ "resource": "" }
q41481
filter_archives
train
def filter_archives(ctx, prefix, pattern, engine): ''' List all archives matching filter criteria ''' _generate_api(ctx) # want to achieve behavior like click.echo(' '.join(matches)) for i, match in enumerate(ctx.obj.api.filter( pattern, engine, prefix=prefix)): click.ech...
python
{ "resource": "" }
q41482
search
train
def search(ctx, tags, prefix=None): ''' List all archives matching tag search criteria ''' _generate_api(ctx) for i, match in enumerate(ctx.obj.api.search(*tags, prefix=prefix)): click.echo(match, nl=False) print('')
python
{ "resource": "" }
q41483
delete
train
def delete(ctx, archive_name): ''' Delete an archive ''' _generate_api(ctx) var = ctx.obj.api.get_archive(archive_name) var.delete() click.echo('deleted archive {}'.format(var))
python
{ "resource": "" }
q41484
MapExecutor.replaceInCommand
train
def replaceInCommand(self,command, pattern, replacement, replacementAtBeginning): """ This is in internal method that replaces a certain 'pattern' in the provided command with a 'replacement'. A different replacement can be specified when the pattern occurs right at the beginning...
python
{ "resource": "" }
q41485
MapExecutor.escapePlaceholders
train
def escapePlaceholders(self,inputString): """ This is an internal method that escapes all the placeholders defined in MapConstants.py. """ escaped = inputString.replace(MapConstants.placeholder,'\\'+MapConstants.placeholder) escaped = escaped.replace(MapConstants.placehol...
python
{ "resource": "" }
q41486
MapExecutor.buildCommand
train
def buildCommand(self,fileName,count,args): """ This is an internal method, building the command for a particular file. """ # Escape all placeholders in the file path: fileNameWithPath = self.escapePlaceholders(fileName) # The command is split into 'parts', which are separated ...
python
{ "resource": "" }
q41487
MapExecutor.runCommands
train
def runCommands(self,commands,args): """ Given a list of commands, runCommands executes them. This is one of the two key methods of MapExecutor. """ errorCounter = 0 if args.list: print '\n'.join(commands) else: # Each command is executed s...
python
{ "resource": "" }
q41488
Pylon.validate
train
def validate(self, csdl, service='facebook'): """ Validate the given CSDL :param csdl: The CSDL to be validated for analysis :type csdl: str :param service: The service for this API call (facebook, etc) :type service: str :return: dict of REST API out...
python
{ "resource": "" }
q41489
Pylon.start
train
def start(self, hash, name=None, service='facebook'): """ Start a recording for the provided hash :param hash: The hash to start recording with :type hash: str :param name: The name of the recording :type name: str :param service: The service for this...
python
{ "resource": "" }
q41490
Pylon.stop
train
def stop(self, id, service='facebook'): """ Stop the recording for the provided id :param id: The hash to start recording with :type id: str :param service: The service for this API call (facebook, etc) :type service: str :rtype: :class:`~datasift.req...
python
{ "resource": "" }
q41491
Pylon.analyze
train
def analyze(self, id, parameters, filter=None, start=None, end=None, service='facebook'): """ Analyze the recorded data for a given hash :param id: The id of the recording :type id: str :param parameters: To set settings such as threshold and target ...
python
{ "resource": "" }
q41492
Pylon.list
train
def list(self, page=None, per_page=None, order_by='created_at', order_dir='DESC', service='facebook'): """ List pylon recordings :param page: page number for pagination :type page: int :param per_page: number of items per page, default 20 :type per_...
python
{ "resource": "" }
q41493
Pylon.sample
train
def sample(self, id, count=None, start=None, end=None, filter=None, service='facebook'): """ Get sample interactions for a given hash :param id: The hash to get tag analysis for :type id: str :param start: Determines time period of the sample data ...
python
{ "resource": "" }
q41494
Limit.get
train
def get(self, identity_id, service): """ Get the limit for the given identity and service :param identity_id: The ID of the identity to retrieve :param service: The service that the limit is linked to :return: dict of REST API output with headers attached :rtype:...
python
{ "resource": "" }
q41495
Limit.list
train
def list(self, service, per_page=20, page=1): """ Get a list of limits for the given service :param service: The service that the limit is linked to :param per_page: The number of results per page returned :param page: The page number of the results :return: dict...
python
{ "resource": "" }
q41496
Limit.create
train
def create(self, identity_id, service, total_allowance=None, analyze_queries=None): """ Create the limit :param identity_id: The ID of the identity to retrieve :param service: The service that the token is linked to :param total_allowance: The total allowance for this token'...
python
{ "resource": "" }
q41497
Limit.update
train
def update(self, identity_id, service, total_allowance=None, analyze_queries=None): """ Update the limit :param identity_id: The ID of the identity to retrieve :param service: The service that the token is linked to :param total_allowance: The total allowance for this token'...
python
{ "resource": "" }
q41498
Limit.delete
train
def delete(self, identity_id, service): """ Delete the limit for the given identity and service :param identity_id: The ID of the identity to retrieve :param service: The service that the token is linked to :return: dict of REST API output with headers attached :...
python
{ "resource": "" }
q41499
reload
train
def reload(request): """Reload local requirements file.""" refresh_packages.clean() refresh_packages.local() refresh_packages.remote() url = request.META.get('HTTP_REFERER') if url: return HttpResponseRedirect(url) else: return HttpResponse('Local requirements list has been r...
python
{ "resource": "" }