code stringlengths 1 18.2k |
|---|
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 API call (facebook, etc) :type service: str :return: dict of REST AP... |
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.request.DictResponse` :raises: :class:`~datasift.exceptions.DataSiftApiE... |
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 :type parameters: dict :param filter: An optional secondary filter :ty... |
def get(self, id, service='facebook'): """ Get the existing analysis for a given hash :param service: The service for this API call (facebook, etc) :type service: str :param id: The optional hash to get recordings with :type id: str :return: dict of REST API output with headers attached :rtype: :class:`~datasift.reques... |
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_page: int :param order_by: field to order by, default request_time :typ... |
def tags(self, id, service='facebook'): """ Get the existing analysis for a given hash :param id: The hash to get tag analysis for :type id: str :param service: The service for this API call (facebook, etc) :type service: str :return: dict of REST API output with headers attached :rtype: :class:`~datasift.request.DictR... |
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 :type start: int :param end: Determines time period of the sample data :... |
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: :class:`~datasift.request.DictResponse` :raises: :class:... |
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 of REST API output with headers attached :rtype: :class:... |
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's limit :param analyze_queries: The number of... |
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's limit :param analyze_queries: The number of... |
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 :rtype: :class:`~datasift.request.DictResponse` :raises: :... |
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 reloaded.') |
def _generate_processed_key_name(process_to, upload_name): """Returns a key name to use after processing based on timestamp and upload key name.""" timestamp = datetime.now().strftime('%Y%m%d%H%M%S%f') name, extension = os.path.splitext(upload_name) digest = md5(''.join([timestamp, upload_name])).hexdigest() return os.... |
def clean_bucket_name(self): """Validates that the bucket name in the provided data matches the bucket name from the storage backend.""" bucket_name = self.cleaned_data['bucket_name'] if not bucket_name == self.get_bucket_name(): raise forms.ValidationError('Bucket name does not validate.') return bucket_name |
def clean_key_name(self): """Validates that the key in the provided data starts with the required prefix, and that it exists in the bucket.""" key = self.cleaned_data['key_name'] # Ensure key starts with prefix if not key.startswith(self.get_key_prefix()): raise forms.ValidationError('Key does not have required prefix.... |
def get_processed_key_name(self): """Return the full path to use for the processed file.""" if not hasattr(self, '_processed_key_name'): path, upload_name = os.path.split(self.get_upload_key().name) key_name = self._generate_processed_key_name( self.process_to, upload_name) self._processed_key_name = os.path.join( self... |
def get_processed_path(self): """Returns the processed file path from the storage backend. :returns: File path from the storage backend. :rtype: :py:class:`unicode` """ location = self.get_storage().location return self.get_processed_key_name()[len(location):] |
def process_upload(self, set_content_type=True): """Process the uploaded file.""" metadata = self.get_upload_key_metadata() if set_content_type: content_type = self.get_upload_content_type() metadata.update({b'Content-Type': b'{0}'.format(content_type)}) upload_key = self.get_upload_key() processed_key_name = self.get_... |
def get_upload_content_type(self): """Determine the actual content type of the upload.""" if not hasattr(self, '_upload_content_type'): with self.get_storage().open(self.get_upload_path()) as upload: content_type = Magic(mime=True).from_buffer(upload.read(1024)) self._upload_content_type = content_type return self._upl... |
def get_upload_key(self): """Get the `Key` from the S3 bucket for the uploaded file. :returns: Key (object) of the uploaded file. :rtype: :py:class:`boto.s3.key.Key` """ if not hasattr(self, '_upload_key'): self._upload_key = self.get_storage().bucket.get_key( self.cleaned_data['key_name']) return self._upload_key |
def get_upload_key_metadata(self): """Generate metadata dictionary from a bucket key.""" key = self.get_upload_key() metadata = key.metadata.copy() # Some http header properties which are stored on the key need to be # copied to the metadata when updating headers = { # http header name, key attribute name 'Cache-Contro... |
def get_upload_path(self): """Returns the uploaded file path from the storage backend. :returns: File path from the storage backend. :rtype: :py:class:`unicode` """ location = self.get_storage().location return self.cleaned_data['key_name'][len(location):] |
def ask(question, escape=True): "Return the answer" answer = raw_input(question) if escape: answer.replace('"', '\\"') return answer.decode('utf') |
def update_state(self, cache=True): """Update the internal state of the Sesame.""" self.use_cached_state = cache endpoint = API_SESAME_ENDPOINT.format(self._device_id) response = self.account.request('GET', endpoint) if response is None or response.status_code != 200: return state = json.loads(response.text) self._nick... |
def lock(self): """Lock the Sesame. Return True on success, else False.""" endpoint = API_SESAME_CONTROL_ENDPOINT.format(self.device_id) payload = {'type': 'lock'} response = self.account.request('POST', endpoint, payload=payload) if response is None: return False if response.status_code == 200 or response.status_code ... |
def write_config_from_api(self, api, config_file=None, profile=None): ''' Create/update the config file from a DataAPI object Parameters ---------- api : object The :py:class:`datafs.DataAPI` object from which to create the config profile profile : str Name of the profile to use in the config file (default "default-pro... |
... database_name = 'MyDatabase', ... table_name = 'DataFiles') >>> >>> manager.create_archive_table( ... 'DataFiles', ... raise_on_err=False) >>> >>> api.attach_manager(manager) >>> >>> tmpdir = tempfile.mkdtemp() >>> local = OSFS(tmpdir) >>> >>> api.attach_authority('local', local) >>> >>> # Create a StringIO object ... |
object from the configuration file: .. code-block:: python >>> try: ... from StringIO import StringIO ... except ImportError: ... from io import StringIO ... >>> conf = StringIO(""" ... default-profile: my-api ... profiles: ... my-api: ... api: ... user_config: {contact: me@demo.com, username: My Name} ... authorities:... |
user_config: {contact: me@demo.com, username: My Name} authorities: local: args: [] service: TempFS kwargs: {} cache: args: [] service: TempFS kwargs: {} manager: args: [] class: MongoDBManager kwargs: client_kwargs: {} database_name: MyDatabase table_name: DataFiles <BLANKLINE> ''' if profile is None: profile = self.d... |
def save(self): """Saves pypirc file with new configuration information.""" for server, conf in self.servers.iteritems(): self._add_index_server() for conf_k, conf_v in conf.iteritems(): if not self.conf.has_section(server): self.conf.add_section(server) self.conf.set(server, conf_k, conf_v) with open(self.rc_file, 'wb... |
def _get_index_servers(self): """Gets index-servers current configured in pypirc.""" idx_srvs = [] if 'index-servers' in self.conf.options('distutils'): idx = self.conf.get('distutils', 'index-servers') idx_srvs = [srv.strip() for srv in idx.split('\n') if srv.strip()] return idx_srvs |
def _add_index_server(self): """Adds index-server to 'distutil's 'index-servers' param.""" index_servers = '\n\t'.join(self.servers.keys()) self.conf.set('distutils', 'index-servers', index_servers) |
def outputmap(self, data): """ Internal function used to traverse a data structure and map the contents onto python-friendly objects inplace. This uses recursion, so try not to pass in anything that's over 255 objects deep. :param data: data structure :type data: any :param prefix: endpoint family, eg. sources, histori... |
def TCA_select(bus, addr, channel): """ This function will write to the control register of the TCA module to select the channel that will be exposed on the TCA module. After doing this, the desired module can be used as it would be normally. (The caller should use the address of the I2C sensor module. The TCA module i... |
being accessed. If this is not done, there will be addressing conflicts. """ if addr < 0x70 or addr > 0x77: print("The TCA address(" + str(addr) + ") is invalid. Aborting") return False if channel == "off": bus.write_byte(addr, 0) elif channel < 0 or channel > 3: print("The requested channel does not exist.") return Fa... |
def get_ADC_value(bus, addr, channel): """ This method selects a channel and initiates conversion The ADC operates at 240 SPS (12 bits) with 1x gain One shot conversions are used, meaning a wait period is needed in order to acquire new data. This is done via a constant poll of the ready bit. Upon completion, a voltage ... |
= (data[2] & 0b10000000) >> 7 sign = data[0] & 0b00001000 val = ((data[0] & 0b0000111) << 8) | (data[1]) if (sign == 1): val = (val ^ 0x3ff) + 1 # compute 2s complement for 12 bit val # Convert val to a ratiomerical ADC reading return float(val) * 2.048 / float(2047) |
def IO_expander_output(bus, addr, bank, mask): """ Method for controlling the GPIO expander via I2C which accepts a bank - A(0) or B(1) and a mask to push to the pins of the expander. The method also assumes the the expander is operating in sequential mode. If this mode is not used, the register addresses will need to ... |
action is required.") return True bus.write_byte_data(addr, IO_direction, 0) bus.write_byte_data(addr, output_reg, mask) |
def get_IO_reg(bus, addr, bank): """ Method retrieves the register corresponding to respective bank (0 or 1) """ output_map = [0x14, 0x15] if (bank != 0) and (bank != 1): print() raise InvalidIOUsage("An invalid IO bank has been selected") output_reg = output_map[bank] current_status = bus.read_byte_data(addr, output_r... |
def import_i2c_addr(bus, opt="sensors"): """ import_i2c_addresses will return a list of the currently connected I2C devices. This can be used a means to automatically detect the number of connected sensor modules. Modules are between int(112) and int(119) By default, the method will return a list of sensor addresses. "... |
def speak(self, sentence): """ Speak a sentence using Google TTS. :param sentence: the sentence to speak. """ temp_dir = "/tmp/" filename = "gtts.mp3" file_path = "{}/{}".format(temp_dir, filename) if not os.path.exists(temp_dir): os.makedirs(temp_dir) def delete_file(): try: os.remove(file_path) if not os.listdir(temp... |
def get_lux_count(lux_byte): """ Method to convert data from the TSL2550D lux sensor into more easily usable ADC count values. """ LUX_VALID_MASK = 0b10000000 LUX_CHORD_MASK = 0b01110000 LUX_STEP_MASK = 0b00001111 valid = lux_byte & LUX_VALID_MASK if valid != 0: step_num = (lux_byte & LUX_STEP_MASK) # Shift to normaliz... |
def update_lux(self, extend=0): """ Communicates with the TSL2550D light sensor and returns a lux value. Note that this method contains approximately 1 second of total delay. This delay is necessary in order to obtain full resolution compensated lux values. Alternatively, the device could be put in extended mode, which... |
# Send command to initiate ADC on each channel # Read each channel after the new data is ready SensorCluster.bus.write_byte(SensorCluster.lux_addr, LUX_MODE) SensorCluster.bus.write_byte(SensorCluster.lux_addr, LUX_READ_CH0) sleep(delay) adc_ch0 = SensorCluster.bus.read_byte(SensorCluster.lux_addr) count0 = get_lux_cou... |
def update_humidity_temp(self): """ This method utilizes the HIH7xxx sensor to read humidity and temperature in one call. """ # Create mask for STATUS (first two bits of 64 bit wide result) STATUS = 0b11 << 6 TCA_select(SensorCluster.bus, self.mux_addr, SensorCluster.humidity_chan) SensorCluster.bus.write_quick(SensorC... |
to retrieve humidity") |
def update_soil_moisture(self): """ Method will select the ADC module, turn on the analog sensor, wait for voltage settle, and then digitize the sensor voltage. Voltage division/signal loss is accounted for by scaling up the sensor output. This may need to be adjusted if a different sensor is used """ SensorCluster.ana... |
def update_instance_sensors(self, opt=None): """ Method runs through all sensor modules and updates to the latest sensor values. After running through each sensor module, The sensor head (the I2C multiplexer), is disabled in order to avoid address conflicts. Usage: plant_sensor_object.updateAllSensors(bus_object) """ s... |
def sensor_values(self): """ Returns the values of all sensors for this cluster """ self.update_instance_sensors(opt="all") return { "light": self.lux, "water": self.soil_moisture, "humidity": self.humidity, "temperature": self.temp } |
def analog_sensor_power(cls, bus, operation): """ Method that turns on all of the analog sensor modules Includes all attached soil moisture sensors Note that all of the SensorCluster object should be attached in parallel and only 1 GPIO pin is available to toggle analog sensor power. The sensor power should be left on ... |
^ (1 << cls.analog_power_pin)) else: raise SensorError( "Invalid command used while enabling analog sensors") # Send updated IO mask to output IO_expander_output(bus, 0x20, cls.power_bank, reg_data) |
def get_water_level(cls): """ This method uses the ADC on the control module to measure the current water tank level and returns the water volume remaining in the tank. For this method, it is assumed that a simple voltage divider is used to interface the sensor to the ADC module. Testing shows that the sensor response ... |
and do an average # Fetch value from ADC (0x69 - ch1) val = get_ADC_value(cls.bus, 0x6c, 1) + val avg = val / 5 water_sensor_res = rref * avg/(vref - avg) depth_cm = water_sensor_res * \ (-.0163) + 28.127 # measured transfer adjusted offset if depth_cm < 1.0: # Below 1cm, the values should not be trusted. depth_cm = 0 ... |
def bump(self, kind=None, prerelease=None, inplace=True): ''' Increment the version and/or pre-release value Parameters ---------- kind : str Increment the version. Can be ``major``, ``minor``, or ``patch``, corresponding to the three segments of the version number (in order). A value of ``None`` will not increment the... |
>>> >>> v.bump('major') >>> v BumpableVersion ('2.0') >>> >>> v.bump('release') # doctest: +ELLIPSIS Traceback (most recent call last): ValueError: Bump kind "release" not understood The prerelease argument increments the pre-release value. If ``kind`` is not supplied simultaneously the version is bumped with a patch b... |
v.bump('patch', prerelease='beta') >>> v BumpableVersion ('3.0.1b1') >>> >>> v.bump('patch') >>> v BumpableVersion ('3.0.1') >>> >>> v.bump(prerelease='gamma') # doctest: +ELLIPSIS Traceback (most recent call last): ValueError: Prerelease type "gamma" not understood Releases cannot move from beta to alpha without a new... |
to pre-release, # increment version + prerelease if self.prerelease and prerelease: new_prerelease = self._increment_prerelease(None, prerelease) new_version = self._increment_version(self.version, kind) # if already in pre-release and we want to exit pre-release, # remove prerelease elif self.prerelease: new_prereleas... |
= new_version new.prerelease = new_prerelease return new |
def _imported_symbol(import_path): """Resolve a dotted path into a symbol, and return that. For example... >>> _imported_symbol('django.db.models.Model') <class 'django.db.models.base.Model'> Raise ImportError if there's no such module, AttributeError if no such symbol. """ module_name, symbol_name = import_path.rsplit... |
def Param(name, value=None, unit=None, ucd=None, dataType=None, utype=None, ac=True): """ 'Parameter', used as a general purpose key-value entry in the 'What' section. May be assembled into a :class:`Group`. NB ``name`` is not mandated by schema, but *is* mandated in full spec. Args: value(str): String representing par... |
For a list of valid UCDs, see: http://vocabularies.referata.com/wiki/Category:IVOA_UCD. dataType(str): Denotes type of ``value``; restricted to 3 options: ``string`` (default), ``int`` , or ``float``. (NB *not* to be confused with standard XML Datatypes, which have many more possible values.) utype(str): See http://wik... |
atts['value'] = func(value) return objectify.Element('Param', attrib=atts) |
def Group(params, name=None, type=None): """Groups together Params for adding under the 'What' section. Args: params(list of :func:`Param`): Parameter elements to go in this group. name(str): Group name. NB ``None`` is valid, since the group may be best identified by its type. type(str): Type of group, e.g. 'complex' (... |
def Reference(uri, meaning=None): """ Represents external information, typically original obs data and metadata. Args: uri(str): Uniform resource identifier for external data, e.g. FITS file. meaning(str): The nature of the document referenced, e.g. what instrument and filter was used to create the data? """ attrib = {... |
def Inference(probability=None, relation=None, name=None, concept=None): """Represents a probable cause / relation between this event and some prior. Args: probability(float): Value 0.0 to 1.0. relation(str): e.g. 'associated' or 'identified' (see Voevent spec) name(str): e.g. name of identified progenitor. concept(str... |
def EventIvorn(ivorn, cite_type): """ Used to cite earlier VOEvents. Use in conjunction with :func:`.add_citations` Args: ivorn(str): It is assumed this will be copied verbatim from elsewhere, and so these should have any prefix (e.g. 'ivo://','http://') already in place - the function will not alter the value. cite_ty... |
def Citation(ivorn, cite_type): """ Deprecated alias of :func:`.EventIvorn` """ import warnings warnings.warn( """ `Citation` class has been renamed `EventIvorn` to reflect naming conventions in the VOEvent standard. As such this class name is a deprecated alias and may be removed in a future release. """, FutureWarnin... |
def batch(self, source_id, data): """ Upload data to the given soruce :param source_id: The ID of the source to upload to :type source_id: str :param data: The data to upload to the source :type data: list :return: dict of REST API output with headers attached :rtype: :class:`~datasift.request.DictResponse` :raises: :c... |
def create_package_version(requirement): """Create a new PackageVersion from a requirement. Handles errors.""" try: PackageVersion(requirement=requirement).save() logger.info("Package '%s' added.", requirement.name) # noqa except IntegrityError: logger.info("Package '%s' already exists.", requirement.name) |
def local(): """Load local requirements file.""" logger.info("Loading requirements from local file.") with open(REQUIREMENTS_FILE, 'r') as f: requirements = parse(f) for r in requirements: logger.debug("Creating new package: %r", r) create_package_version(r) |
def remote(): """Update package info from PyPI.""" logger.info("Fetching latest data from PyPI.") results = defaultdict(list) packages = PackageVersion.objects.exclude(is_editable=True) for pv in packages: pv.update_from_pypi() results[pv.diff_status].append(pv) logger.debug("Updated package from PyPI: %r", pv) results... |
def handle(self, *args, **options): """Run the managemement command.""" if options['clean']: clean() if options['local']: local() if options['remote']: results = remote() render = lambda t: render_to_string(t, results) if options['notify']: send_mail( options['subject'], render('summary.txt'), options['from'], [options... |
def create(self, stream, start, parameters, sources, end=None): """ Create a hitorics preview job. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/previewcreate :param stream: hash of the CSDL filter to create the job for :type stream: str :param start: Unix timestamp for the start of the per... |
','.join(parameters)} if end: params['end'] = end return self.request.post('create', params) |
def get(self, preview_id): """ Retrieve a Historics preview job. Warning: previews expire after 24 hours. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/previewget :param preview_id: historics preview job hash of the job to retrieve :type preview_id: str :return: dict of REST API output with... |
def prepare(self, hash, start, end, name, sources, sample=None): """ Prepare a historics query which can later be started. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsprepare :param hash: The hash of a CSDL create the query for :type hash: str :param start: when to start querying... |
hash, 'start': start, 'end': end, 'name': name, 'sources': ','.join(sources)} if sample: params['sample'] = sample return self.request.post('prepare', params) |
def start(self, historics_id): """ Start the historics job with the given ID. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsstart :param historics_id: hash of the job to start :type historics_id: str :return: dict of REST API output with headers attached :rtype: :class:`~datasift.r... |
def update(self, historics_id, name): """ Update the name of the given Historics query. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsupdate :param historics_id: playback id of the job to start :type historics_id: str :param name: new name of the stream :type name: str :return: dic... |
def stop(self, historics_id, reason=''): """ Stop an existing Historics query. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsstop :param historics_id: playback id of the job to stop :type historics_id: str :param reason: optional reason for stopping the job :type reason: str :retur... |
def status(self, start, end, sources=None): """ Check the data coverage in the Historics archive for a given interval. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsstatus :param start: Unix timestamp for the start time :type start: int :param end: Unix timestamp for the start time... |
def delete(self, historics_id): """ Delete one specified playback query. If the query is currently running, stop it. status_code is set to 204 on success Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsdelete :param historics_id: playback id of the query to delete :type historics_id:... |
def get_for(self, historics_id, with_estimate=None): """ Get the historic query for the given ID Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsget :param historics_id: playback id of the query :type historics_id: str :return: dict of REST API output with headers attached :rtype: :c... |
def get(self, historics_id=None, maximum=None, page=None, with_estimate=None): """ Get the historics query with the given ID, if no ID is provided then get a list of historics queries. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsget :param historics_id: (optional) ID of the query... |
return self.request.get('get', params=params) |
def pause(self, historics_id, reason=""): """ Pause an existing Historics query. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicspause :param historics_id: id of the job to pause :type historics_id: str :param reason: optional reason for pausing it :type reason: str :return: dict of ... |
def resume(self, historics_id): """ Resume a paused Historics query. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsresume :param historics_id: id of the job to resume :type historics_id: str :return: dict of REST API output with headers attached :rtype: :class:`~datasift.request.Di... |
def remove(self, source_id, resource_ids): """ Remove one or more resources from a Managed Source Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/sourceresourceremove :param source_id: target Source ID :type source_id: str :param resources: An array of the resource IDs that you would like to ... |
def add(self, source_id, auth, validate=True): """ Add one or more sets of authorization credentials to a Managed Source Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/sourceauthadd :param source_id: target Source ID :type source_id: str :param auth: An array of the source-specific authoriza... |
def remove(self, source_id, auth_ids): """ Remove one or more sets of authorization credentials from a Managed Source Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/sourceauthremove :param source_id: target Source ID :type source_id: str :param resources: An array of the authorization creden... |
def create(self, source_type, name, resources, auth=None, parameters=None, validate=True): """ Create a managed source Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/sourcecreate :param source_type: data source name e.g. facebook_page, googleplus, instagram, yammer :type source_type: str :pa... |
resources, 'validate': validate } if auth: params['auth'] = auth if parameters: params['parameters'] = parameters return self.request.post('create', params) |
def update(self, source_id, source_type, name, resources, auth, parameters=None, validate=True): """ Update a managed source Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/sourceupdate :param source_type: data source name e.g. facebook_page, googleplus, instagram, yammer :type source_type: s... |
parameters: params['parameters'] = parameters return self.request.post('update', params) |
def log(self, source_id, page=None, per_page=None): """ Get the log for a specific Managed Source. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/sourcelog :param source_id: target Source ID :type source_id: str :param page: (optional) page number for pagination :type page: int :param per_pa... |
def get(self, source_id=None, source_type=None, page=None, per_page=None): """ Get a specific managed source or a list of them. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/sourceget :param source_id: (optional) target Source ID :type source_id: str :param source_type: (optional) data sour... |
def apply(self, localArray): """ Apply Laplacian stencil to data @param localArray local array @return new array on local proc """ # input dist array inp = gdaZeros(localArray.shape, localArray.dtype, numGhosts=1) # output array out = numpy.zeros(localArray.shape, localArray.dtype) # no displacement term weight = self.... |
def login(self, user_id, password, svctype = "Android NDrive App ver", auth = 0): """Log in Naver and get cookie Agrs: user_id: Naver account's login id password: Naver account's login password Returns: True: Login success False: Login failed Remarks: self.cookie is a dictionary with 5 keys: path, domain, NID_AUT, nid_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.