id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
12,000
datascopeanalytics/scrubadub
scrubadub/scrubbers.py
Scrubber.clean
def clean(self, text, **kwargs): """This is the master method that cleans all of the filth out of the dirty dirty ``text``. All keyword arguments to this function are passed through to the ``Filth.replace_with`` method to fine-tune how the ``Filth`` is cleaned. """ if sys.version_info < (3, 0): # Only in Python 2. In 3 every string is a Python 2 unicode if not isinstance(text, unicode): raise exceptions.UnicodeRequired clean_chunks = [] filth = Filth() for next_filth in self.iter_filth(text): clean_chunks.append(text[filth.end:next_filth.beg]) clean_chunks.append(next_filth.replace_with(**kwargs)) filth = next_filth clean_chunks.append(text[filth.end:]) return u''.join(clean_chunks)
python
def clean(self, text, **kwargs): """This is the master method that cleans all of the filth out of the dirty dirty ``text``. All keyword arguments to this function are passed through to the ``Filth.replace_with`` method to fine-tune how the ``Filth`` is cleaned. """ if sys.version_info < (3, 0): # Only in Python 2. In 3 every string is a Python 2 unicode if not isinstance(text, unicode): raise exceptions.UnicodeRequired clean_chunks = [] filth = Filth() for next_filth in self.iter_filth(text): clean_chunks.append(text[filth.end:next_filth.beg]) clean_chunks.append(next_filth.replace_with(**kwargs)) filth = next_filth clean_chunks.append(text[filth.end:]) return u''.join(clean_chunks)
[ "def", "clean", "(", "self", ",", "text", ",", "*", "*", "kwargs", ")", ":", "if", "sys", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "# Only in Python 2. In 3 every string is a Python 2 unicode", "if", "not", "isinstance", "(", "text", ",", "unicode", ")", ":", "raise", "exceptions", ".", "UnicodeRequired", "clean_chunks", "=", "[", "]", "filth", "=", "Filth", "(", ")", "for", "next_filth", "in", "self", ".", "iter_filth", "(", "text", ")", ":", "clean_chunks", ".", "append", "(", "text", "[", "filth", ".", "end", ":", "next_filth", ".", "beg", "]", ")", "clean_chunks", ".", "append", "(", "next_filth", ".", "replace_with", "(", "*", "*", "kwargs", ")", ")", "filth", "=", "next_filth", "clean_chunks", ".", "append", "(", "text", "[", "filth", ".", "end", ":", "]", ")", "return", "u''", ".", "join", "(", "clean_chunks", ")" ]
This is the master method that cleans all of the filth out of the dirty dirty ``text``. All keyword arguments to this function are passed through to the ``Filth.replace_with`` method to fine-tune how the ``Filth`` is cleaned.
[ "This", "is", "the", "master", "method", "that", "cleans", "all", "of", "the", "filth", "out", "of", "the", "dirty", "dirty", "text", ".", "All", "keyword", "arguments", "to", "this", "function", "are", "passed", "through", "to", "the", "Filth", ".", "replace_with", "method", "to", "fine", "-", "tune", "how", "the", "Filth", "is", "cleaned", "." ]
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/scrubbers.py#L44-L62
12,001
datascopeanalytics/scrubadub
scrubadub/scrubbers.py
Scrubber.iter_filth
def iter_filth(self, text): """Iterate over the different types of filth that can exist. """ # currently doing this by aggregating all_filths and then sorting # inline instead of with a Filth.__cmp__ method, which is apparently # much slower http://stackoverflow.com/a/988728/564709 # # NOTE: we could probably do this in a more efficient way by iterating # over all detectors simultaneously. just trying to get something # working right now and we can worry about efficiency later all_filths = [] for detector in self._detectors.values(): for filth in detector.iter_filth(text): if not isinstance(filth, Filth): raise TypeError('iter_filth must always yield Filth') all_filths.append(filth) # Sort by start position. If two filths start in the same place then # return the longer one first all_filths.sort(key=lambda f: (f.beg, -f.end)) # this is where the Scrubber does its hard work and merges any # overlapping filths. if not all_filths: raise StopIteration filth = all_filths[0] for next_filth in all_filths[1:]: if filth.end < next_filth.beg: yield filth filth = next_filth else: filth = filth.merge(next_filth) yield filth
python
def iter_filth(self, text): """Iterate over the different types of filth that can exist. """ # currently doing this by aggregating all_filths and then sorting # inline instead of with a Filth.__cmp__ method, which is apparently # much slower http://stackoverflow.com/a/988728/564709 # # NOTE: we could probably do this in a more efficient way by iterating # over all detectors simultaneously. just trying to get something # working right now and we can worry about efficiency later all_filths = [] for detector in self._detectors.values(): for filth in detector.iter_filth(text): if not isinstance(filth, Filth): raise TypeError('iter_filth must always yield Filth') all_filths.append(filth) # Sort by start position. If two filths start in the same place then # return the longer one first all_filths.sort(key=lambda f: (f.beg, -f.end)) # this is where the Scrubber does its hard work and merges any # overlapping filths. if not all_filths: raise StopIteration filth = all_filths[0] for next_filth in all_filths[1:]: if filth.end < next_filth.beg: yield filth filth = next_filth else: filth = filth.merge(next_filth) yield filth
[ "def", "iter_filth", "(", "self", ",", "text", ")", ":", "# currently doing this by aggregating all_filths and then sorting", "# inline instead of with a Filth.__cmp__ method, which is apparently", "# much slower http://stackoverflow.com/a/988728/564709", "#", "# NOTE: we could probably do this in a more efficient way by iterating", "# over all detectors simultaneously. just trying to get something", "# working right now and we can worry about efficiency later", "all_filths", "=", "[", "]", "for", "detector", "in", "self", ".", "_detectors", ".", "values", "(", ")", ":", "for", "filth", "in", "detector", ".", "iter_filth", "(", "text", ")", ":", "if", "not", "isinstance", "(", "filth", ",", "Filth", ")", ":", "raise", "TypeError", "(", "'iter_filth must always yield Filth'", ")", "all_filths", ".", "append", "(", "filth", ")", "# Sort by start position. If two filths start in the same place then", "# return the longer one first", "all_filths", ".", "sort", "(", "key", "=", "lambda", "f", ":", "(", "f", ".", "beg", ",", "-", "f", ".", "end", ")", ")", "# this is where the Scrubber does its hard work and merges any", "# overlapping filths.", "if", "not", "all_filths", ":", "raise", "StopIteration", "filth", "=", "all_filths", "[", "0", "]", "for", "next_filth", "in", "all_filths", "[", "1", ":", "]", ":", "if", "filth", ".", "end", "<", "next_filth", ".", "beg", ":", "yield", "filth", "filth", "=", "next_filth", "else", ":", "filth", "=", "filth", ".", "merge", "(", "next_filth", ")", "yield", "filth" ]
Iterate over the different types of filth that can exist.
[ "Iterate", "over", "the", "different", "types", "of", "filth", "that", "can", "exist", "." ]
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/scrubbers.py#L64-L96
12,002
terrycain/aioboto3
aioboto3/s3/inject.py
download_file
async def download_file(self, Bucket, Key, Filename, ExtraArgs=None, Callback=None, Config=None): """Download an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt') Similar behavior as S3Transfer's download_file() method, except that parameters are capitalized. """ with open(Filename, 'wb') as open_file: await download_fileobj(self, Bucket, Key, open_file, ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)
python
async def download_file(self, Bucket, Key, Filename, ExtraArgs=None, Callback=None, Config=None): """Download an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt') Similar behavior as S3Transfer's download_file() method, except that parameters are capitalized. """ with open(Filename, 'wb') as open_file: await download_fileobj(self, Bucket, Key, open_file, ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)
[ "async", "def", "download_file", "(", "self", ",", "Bucket", ",", "Key", ",", "Filename", ",", "ExtraArgs", "=", "None", ",", "Callback", "=", "None", ",", "Config", "=", "None", ")", ":", "with", "open", "(", "Filename", ",", "'wb'", ")", "as", "open_file", ":", "await", "download_fileobj", "(", "self", ",", "Bucket", ",", "Key", ",", "open_file", ",", "ExtraArgs", "=", "ExtraArgs", ",", "Callback", "=", "Callback", ",", "Config", "=", "Config", ")" ]
Download an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt') Similar behavior as S3Transfer's download_file() method, except that parameters are capitalized.
[ "Download", "an", "S3", "object", "to", "a", "file", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L17-L30
12,003
terrycain/aioboto3
aioboto3/s3/inject.py
download_fileobj
async def download_fileobj(self, Bucket, Key, Fileobj, ExtraArgs=None, Callback=None, Config=None): """Download an object from S3 to a file-like object. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart download in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'wb') as data: s3.download_fileobj('mybucket', 'mykey', data) :type Fileobj: a file-like object :param Fileobj: A file-like object to download into. At a minimum, it must implement the `write` method and must accept bytes. :type Bucket: str :param Bucket: The name of the bucket to download from. :type Key: str :param Key: The name of the key to download from. :type ExtraArgs: dict :param ExtraArgs: Extra arguments that may be passed to the client operation. :type Callback: method :param Callback: A method which takes a number of bytes transferred to be periodically called during the download. :type Config: boto3.s3.transfer.TransferConfig :param Config: The transfer configuration to be used when performing the download. """ try: resp = await self.get_object(Bucket=Bucket, Key=Key) except ClientError as err: if err.response['Error']['Code'] == 'NoSuchKey': # Convert to 404 so it looks the same when boto3.download_file fails raise ClientError({'Error': {'Code': '404', 'Message': 'Not Found'}}, 'HeadObject') raise body = resp['Body'] while True: data = await body.read(4096) if data == b'': break if Callback: try: Callback(len(data)) except: # noqa: E722 pass Fileobj.write(data) await asyncio.sleep(0.0)
python
async def download_fileobj(self, Bucket, Key, Fileobj, ExtraArgs=None, Callback=None, Config=None): """Download an object from S3 to a file-like object. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart download in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'wb') as data: s3.download_fileobj('mybucket', 'mykey', data) :type Fileobj: a file-like object :param Fileobj: A file-like object to download into. At a minimum, it must implement the `write` method and must accept bytes. :type Bucket: str :param Bucket: The name of the bucket to download from. :type Key: str :param Key: The name of the key to download from. :type ExtraArgs: dict :param ExtraArgs: Extra arguments that may be passed to the client operation. :type Callback: method :param Callback: A method which takes a number of bytes transferred to be periodically called during the download. :type Config: boto3.s3.transfer.TransferConfig :param Config: The transfer configuration to be used when performing the download. """ try: resp = await self.get_object(Bucket=Bucket, Key=Key) except ClientError as err: if err.response['Error']['Code'] == 'NoSuchKey': # Convert to 404 so it looks the same when boto3.download_file fails raise ClientError({'Error': {'Code': '404', 'Message': 'Not Found'}}, 'HeadObject') raise body = resp['Body'] while True: data = await body.read(4096) if data == b'': break if Callback: try: Callback(len(data)) except: # noqa: E722 pass Fileobj.write(data) await asyncio.sleep(0.0)
[ "async", "def", "download_fileobj", "(", "self", ",", "Bucket", ",", "Key", ",", "Fileobj", ",", "ExtraArgs", "=", "None", ",", "Callback", "=", "None", ",", "Config", "=", "None", ")", ":", "try", ":", "resp", "=", "await", "self", ".", "get_object", "(", "Bucket", "=", "Bucket", ",", "Key", "=", "Key", ")", "except", "ClientError", "as", "err", ":", "if", "err", ".", "response", "[", "'Error'", "]", "[", "'Code'", "]", "==", "'NoSuchKey'", ":", "# Convert to 404 so it looks the same when boto3.download_file fails", "raise", "ClientError", "(", "{", "'Error'", ":", "{", "'Code'", ":", "'404'", ",", "'Message'", ":", "'Not Found'", "}", "}", ",", "'HeadObject'", ")", "raise", "body", "=", "resp", "[", "'Body'", "]", "while", "True", ":", "data", "=", "await", "body", ".", "read", "(", "4096", ")", "if", "data", "==", "b''", ":", "break", "if", "Callback", ":", "try", ":", "Callback", "(", "len", "(", "data", ")", ")", "except", ":", "# noqa: E722", "pass", "Fileobj", ".", "write", "(", "data", ")", "await", "asyncio", ".", "sleep", "(", "0.0", ")" ]
Download an object from S3 to a file-like object. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart download in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'wb') as data: s3.download_fileobj('mybucket', 'mykey', data) :type Fileobj: a file-like object :param Fileobj: A file-like object to download into. At a minimum, it must implement the `write` method and must accept bytes. :type Bucket: str :param Bucket: The name of the bucket to download from. :type Key: str :param Key: The name of the key to download from. :type ExtraArgs: dict :param ExtraArgs: Extra arguments that may be passed to the client operation. :type Callback: method :param Callback: A method which takes a number of bytes transferred to be periodically called during the download. :type Config: boto3.s3.transfer.TransferConfig :param Config: The transfer configuration to be used when performing the download.
[ "Download", "an", "object", "from", "S3", "to", "a", "file", "-", "like", "object", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L33-L95
12,004
terrycain/aioboto3
aioboto3/s3/inject.py
upload_fileobj
async def upload_fileobj(self, Fileobj: BinaryIO, Bucket: str, Key: str, ExtraArgs: Optional[Dict[str, Any]] = None, Callback: Optional[Callable[[int], None]] = None, Config: Optional[S3TransferConfig] = None): """Upload a file-like object to S3. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart upload in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'rb') as data: s3.upload_fileobj(data, 'mybucket', 'mykey') :type Fileobj: a file-like object :param Fileobj: A file-like object to upload. At a minimum, it must implement the `read` method, and must return bytes. :type Bucket: str :param Bucket: The name of the bucket to upload to. :type Key: str :param Key: The name of the key to upload to. :type ExtraArgs: dict :param ExtraArgs: Extra arguments that may be passed to the client operation. :type Callback: method :param Callback: A method which takes a number of bytes transferred to be periodically called during the upload. :type Config: boto3.s3.transfer.TransferConfig :param Config: The transfer configuration to be used when performing the upload. """ if not ExtraArgs: ExtraArgs = {} # I was debating setting up a queue etc... # If its too slow I'll then be bothered multipart_chunksize = 8388608 if Config is None else Config.multipart_chunksize io_chunksize = 262144 if Config is None else Config.io_chunksize # max_concurrency = 10 if Config is None else Config.max_concurrency # max_io_queue = 100 if config is None else Config.max_io_queue # Start multipart upload resp = await self.create_multipart_upload(Bucket=Bucket, Key=Key, **ExtraArgs) upload_id = resp['UploadId'] part = 0 parts = [] running = True sent_bytes = 0 try: while running: part += 1 multipart_payload = b'' while len(multipart_payload) < multipart_chunksize: if asyncio.iscoroutinefunction(Fileobj.read): # handles if we pass in aiofiles obj data = await Fileobj.read(io_chunksize) else: data = Fileobj.read(io_chunksize) if data == b'': # End of file running = False break multipart_payload += data # Submit part to S3 resp = await self.upload_part( Body=multipart_payload, Bucket=Bucket, Key=Key, PartNumber=part, UploadId=upload_id ) parts.append({'ETag': resp['ETag'], 'PartNumber': part}) sent_bytes += len(multipart_payload) try: Callback(sent_bytes) # Attempt to call the callback, if it fails, ignore, if no callback, ignore except: # noqa: E722 pass # By now the uploads must have been done await self.complete_multipart_upload( Bucket=Bucket, Key=Key, UploadId=upload_id, MultipartUpload={'Parts': parts} ) except: # noqa: E722 # Cancel multipart upload await self.abort_multipart_upload( Bucket=Bucket, Key=Key, UploadId=upload_id ) raise
python
async def upload_fileobj(self, Fileobj: BinaryIO, Bucket: str, Key: str, ExtraArgs: Optional[Dict[str, Any]] = None, Callback: Optional[Callable[[int], None]] = None, Config: Optional[S3TransferConfig] = None): """Upload a file-like object to S3. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart upload in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'rb') as data: s3.upload_fileobj(data, 'mybucket', 'mykey') :type Fileobj: a file-like object :param Fileobj: A file-like object to upload. At a minimum, it must implement the `read` method, and must return bytes. :type Bucket: str :param Bucket: The name of the bucket to upload to. :type Key: str :param Key: The name of the key to upload to. :type ExtraArgs: dict :param ExtraArgs: Extra arguments that may be passed to the client operation. :type Callback: method :param Callback: A method which takes a number of bytes transferred to be periodically called during the upload. :type Config: boto3.s3.transfer.TransferConfig :param Config: The transfer configuration to be used when performing the upload. """ if not ExtraArgs: ExtraArgs = {} # I was debating setting up a queue etc... # If its too slow I'll then be bothered multipart_chunksize = 8388608 if Config is None else Config.multipart_chunksize io_chunksize = 262144 if Config is None else Config.io_chunksize # max_concurrency = 10 if Config is None else Config.max_concurrency # max_io_queue = 100 if config is None else Config.max_io_queue # Start multipart upload resp = await self.create_multipart_upload(Bucket=Bucket, Key=Key, **ExtraArgs) upload_id = resp['UploadId'] part = 0 parts = [] running = True sent_bytes = 0 try: while running: part += 1 multipart_payload = b'' while len(multipart_payload) < multipart_chunksize: if asyncio.iscoroutinefunction(Fileobj.read): # handles if we pass in aiofiles obj data = await Fileobj.read(io_chunksize) else: data = Fileobj.read(io_chunksize) if data == b'': # End of file running = False break multipart_payload += data # Submit part to S3 resp = await self.upload_part( Body=multipart_payload, Bucket=Bucket, Key=Key, PartNumber=part, UploadId=upload_id ) parts.append({'ETag': resp['ETag'], 'PartNumber': part}) sent_bytes += len(multipart_payload) try: Callback(sent_bytes) # Attempt to call the callback, if it fails, ignore, if no callback, ignore except: # noqa: E722 pass # By now the uploads must have been done await self.complete_multipart_upload( Bucket=Bucket, Key=Key, UploadId=upload_id, MultipartUpload={'Parts': parts} ) except: # noqa: E722 # Cancel multipart upload await self.abort_multipart_upload( Bucket=Bucket, Key=Key, UploadId=upload_id ) raise
[ "async", "def", "upload_fileobj", "(", "self", ",", "Fileobj", ":", "BinaryIO", ",", "Bucket", ":", "str", ",", "Key", ":", "str", ",", "ExtraArgs", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ",", "Callback", ":", "Optional", "[", "Callable", "[", "[", "int", "]", ",", "None", "]", "]", "=", "None", ",", "Config", ":", "Optional", "[", "S3TransferConfig", "]", "=", "None", ")", ":", "if", "not", "ExtraArgs", ":", "ExtraArgs", "=", "{", "}", "# I was debating setting up a queue etc...", "# If its too slow I'll then be bothered", "multipart_chunksize", "=", "8388608", "if", "Config", "is", "None", "else", "Config", ".", "multipart_chunksize", "io_chunksize", "=", "262144", "if", "Config", "is", "None", "else", "Config", ".", "io_chunksize", "# max_concurrency = 10 if Config is None else Config.max_concurrency", "# max_io_queue = 100 if config is None else Config.max_io_queue", "# Start multipart upload", "resp", "=", "await", "self", ".", "create_multipart_upload", "(", "Bucket", "=", "Bucket", ",", "Key", "=", "Key", ",", "*", "*", "ExtraArgs", ")", "upload_id", "=", "resp", "[", "'UploadId'", "]", "part", "=", "0", "parts", "=", "[", "]", "running", "=", "True", "sent_bytes", "=", "0", "try", ":", "while", "running", ":", "part", "+=", "1", "multipart_payload", "=", "b''", "while", "len", "(", "multipart_payload", ")", "<", "multipart_chunksize", ":", "if", "asyncio", ".", "iscoroutinefunction", "(", "Fileobj", ".", "read", ")", ":", "# handles if we pass in aiofiles obj", "data", "=", "await", "Fileobj", ".", "read", "(", "io_chunksize", ")", "else", ":", "data", "=", "Fileobj", ".", "read", "(", "io_chunksize", ")", "if", "data", "==", "b''", ":", "# End of file", "running", "=", "False", "break", "multipart_payload", "+=", "data", "# Submit part to S3", "resp", "=", "await", "self", ".", "upload_part", "(", "Body", "=", "multipart_payload", ",", "Bucket", "=", "Bucket", ",", "Key", "=", "Key", ",", "PartNumber", "=", "part", ",", "UploadId", "=", "upload_id", ")", "parts", ".", "append", "(", "{", "'ETag'", ":", "resp", "[", "'ETag'", "]", ",", "'PartNumber'", ":", "part", "}", ")", "sent_bytes", "+=", "len", "(", "multipart_payload", ")", "try", ":", "Callback", "(", "sent_bytes", ")", "# Attempt to call the callback, if it fails, ignore, if no callback, ignore", "except", ":", "# noqa: E722", "pass", "# By now the uploads must have been done", "await", "self", ".", "complete_multipart_upload", "(", "Bucket", "=", "Bucket", ",", "Key", "=", "Key", ",", "UploadId", "=", "upload_id", ",", "MultipartUpload", "=", "{", "'Parts'", ":", "parts", "}", ")", "except", ":", "# noqa: E722", "# Cancel multipart upload", "await", "self", ".", "abort_multipart_upload", "(", "Bucket", "=", "Bucket", ",", "Key", "=", "Key", ",", "UploadId", "=", "upload_id", ")", "raise" ]
Upload a file-like object to S3. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart upload in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'rb') as data: s3.upload_fileobj(data, 'mybucket', 'mykey') :type Fileobj: a file-like object :param Fileobj: A file-like object to upload. At a minimum, it must implement the `read` method, and must return bytes. :type Bucket: str :param Bucket: The name of the bucket to upload to. :type Key: str :param Key: The name of the key to upload to. :type ExtraArgs: dict :param ExtraArgs: Extra arguments that may be passed to the client operation. :type Callback: method :param Callback: A method which takes a number of bytes transferred to be periodically called during the upload. :type Config: boto3.s3.transfer.TransferConfig :param Config: The transfer configuration to be used when performing the upload.
[ "Upload", "a", "file", "-", "like", "object", "to", "S3", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L98-L203
12,005
terrycain/aioboto3
aioboto3/s3/inject.py
upload_file
async def upload_file(self, Filename, Bucket, Key, ExtraArgs=None, Callback=None, Config=None): """Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt') Similar behavior as S3Transfer's upload_file() method, except that parameters are capitalized. """ with open(Filename, 'rb') as open_file: await upload_fileobj(self, open_file, Bucket, Key, ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)
python
async def upload_file(self, Filename, Bucket, Key, ExtraArgs=None, Callback=None, Config=None): """Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt') Similar behavior as S3Transfer's upload_file() method, except that parameters are capitalized. """ with open(Filename, 'rb') as open_file: await upload_fileobj(self, open_file, Bucket, Key, ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)
[ "async", "def", "upload_file", "(", "self", ",", "Filename", ",", "Bucket", ",", "Key", ",", "ExtraArgs", "=", "None", ",", "Callback", "=", "None", ",", "Config", "=", "None", ")", ":", "with", "open", "(", "Filename", ",", "'rb'", ")", "as", "open_file", ":", "await", "upload_fileobj", "(", "self", ",", "open_file", ",", "Bucket", ",", "Key", ",", "ExtraArgs", "=", "ExtraArgs", ",", "Callback", "=", "Callback", ",", "Config", "=", "Config", ")" ]
Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt') Similar behavior as S3Transfer's upload_file() method, except that parameters are capitalized.
[ "Upload", "a", "file", "to", "an", "S3", "object", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L206-L219
12,006
terrycain/aioboto3
aioboto3/resources.py
AIOBoto3ResourceFactory._create_action
def _create_action(factory_self, action_model, resource_name, service_context, is_load=False): """ Creates a new method which makes a request to the underlying AWS service. """ # Create the action in in this closure but before the ``do_action`` # method below is invoked, which allows instances of the resource # to share the ServiceAction instance. action = AIOServiceAction( action_model, factory=factory_self, service_context=service_context ) # A resource's ``load`` method is special because it sets # values on the resource instead of returning the response. if is_load: # We need a new method here because we want access to the # instance via ``self``. async def do_action(self, *args, **kwargs): # response = action(self, *args, **kwargs) response = await action.async_call(self, *args, **kwargs) self.meta.data = response # Create the docstring for the load/reload mehtods. lazy_docstring = docstring.LoadReloadDocstring( action_name=action_model.name, resource_name=resource_name, event_emitter=factory_self._emitter, load_model=action_model, service_model=service_context.service_model, include_signature=False ) else: # We need a new method here because we want access to the # instance via ``self``. async def do_action(self, *args, **kwargs): response = await action.async_call(self, *args, **kwargs) if hasattr(self, 'load'): # Clear cached data. It will be reloaded the next # time that an attribute is accessed. # TODO: Make this configurable in the future? self.meta.data = None return response lazy_docstring = docstring.ActionDocstring( resource_name=resource_name, event_emitter=factory_self._emitter, action_model=action_model, service_model=service_context.service_model, include_signature=False ) do_action.__name__ = str(action_model.name) do_action.__doc__ = lazy_docstring return do_action
python
def _create_action(factory_self, action_model, resource_name, service_context, is_load=False): """ Creates a new method which makes a request to the underlying AWS service. """ # Create the action in in this closure but before the ``do_action`` # method below is invoked, which allows instances of the resource # to share the ServiceAction instance. action = AIOServiceAction( action_model, factory=factory_self, service_context=service_context ) # A resource's ``load`` method is special because it sets # values on the resource instead of returning the response. if is_load: # We need a new method here because we want access to the # instance via ``self``. async def do_action(self, *args, **kwargs): # response = action(self, *args, **kwargs) response = await action.async_call(self, *args, **kwargs) self.meta.data = response # Create the docstring for the load/reload mehtods. lazy_docstring = docstring.LoadReloadDocstring( action_name=action_model.name, resource_name=resource_name, event_emitter=factory_self._emitter, load_model=action_model, service_model=service_context.service_model, include_signature=False ) else: # We need a new method here because we want access to the # instance via ``self``. async def do_action(self, *args, **kwargs): response = await action.async_call(self, *args, **kwargs) if hasattr(self, 'load'): # Clear cached data. It will be reloaded the next # time that an attribute is accessed. # TODO: Make this configurable in the future? self.meta.data = None return response lazy_docstring = docstring.ActionDocstring( resource_name=resource_name, event_emitter=factory_self._emitter, action_model=action_model, service_model=service_context.service_model, include_signature=False ) do_action.__name__ = str(action_model.name) do_action.__doc__ = lazy_docstring return do_action
[ "def", "_create_action", "(", "factory_self", ",", "action_model", ",", "resource_name", ",", "service_context", ",", "is_load", "=", "False", ")", ":", "# Create the action in in this closure but before the ``do_action``", "# method below is invoked, which allows instances of the resource", "# to share the ServiceAction instance.", "action", "=", "AIOServiceAction", "(", "action_model", ",", "factory", "=", "factory_self", ",", "service_context", "=", "service_context", ")", "# A resource's ``load`` method is special because it sets", "# values on the resource instead of returning the response.", "if", "is_load", ":", "# We need a new method here because we want access to the", "# instance via ``self``.", "async", "def", "do_action", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# response = action(self, *args, **kwargs)", "response", "=", "await", "action", ".", "async_call", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "meta", ".", "data", "=", "response", "# Create the docstring for the load/reload mehtods.", "lazy_docstring", "=", "docstring", ".", "LoadReloadDocstring", "(", "action_name", "=", "action_model", ".", "name", ",", "resource_name", "=", "resource_name", ",", "event_emitter", "=", "factory_self", ".", "_emitter", ",", "load_model", "=", "action_model", ",", "service_model", "=", "service_context", ".", "service_model", ",", "include_signature", "=", "False", ")", "else", ":", "# We need a new method here because we want access to the", "# instance via ``self``.", "async", "def", "do_action", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "await", "action", ".", "async_call", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "if", "hasattr", "(", "self", ",", "'load'", ")", ":", "# Clear cached data. It will be reloaded the next", "# time that an attribute is accessed.", "# TODO: Make this configurable in the future?", "self", ".", "meta", ".", "data", "=", "None", "return", "response", "lazy_docstring", "=", "docstring", ".", "ActionDocstring", "(", "resource_name", "=", "resource_name", ",", "event_emitter", "=", "factory_self", ".", "_emitter", ",", "action_model", "=", "action_model", ",", "service_model", "=", "service_context", ".", "service_model", ",", "include_signature", "=", "False", ")", "do_action", ".", "__name__", "=", "str", "(", "action_model", ".", "name", ")", "do_action", ".", "__doc__", "=", "lazy_docstring", "return", "do_action" ]
Creates a new method which makes a request to the underlying AWS service.
[ "Creates", "a", "new", "method", "which", "makes", "a", "request", "to", "the", "underlying", "AWS", "service", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/resources.py#L183-L240
12,007
terrycain/aioboto3
aioboto3/s3/cse.py
AsymmetricCryptoContext.from_der_private_key
def from_der_private_key(data: bytes, password: Optional[str] = None) -> _RSAPrivateKey: """ Convert private key in DER encoding to a Private key object :param data: private key bytes :param password: password the private key is encrypted with """ return serialization.load_der_private_key(data, password, default_backend())
python
def from_der_private_key(data: bytes, password: Optional[str] = None) -> _RSAPrivateKey: """ Convert private key in DER encoding to a Private key object :param data: private key bytes :param password: password the private key is encrypted with """ return serialization.load_der_private_key(data, password, default_backend())
[ "def", "from_der_private_key", "(", "data", ":", "bytes", ",", "password", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "_RSAPrivateKey", ":", "return", "serialization", ".", "load_der_private_key", "(", "data", ",", "password", ",", "default_backend", "(", ")", ")" ]
Convert private key in DER encoding to a Private key object :param data: private key bytes :param password: password the private key is encrypted with
[ "Convert", "private", "key", "in", "DER", "encoding", "to", "a", "Private", "key", "object" ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/cse.py#L149-L156
12,008
terrycain/aioboto3
aioboto3/s3/cse.py
S3CSE.get_object
async def get_object(self, Bucket: str, Key: str, **kwargs) -> dict: """ S3 GetObject. Takes same args as Boto3 documentation Decrypts any CSE :param Bucket: S3 Bucket :param Key: S3 Key (filepath) :return: returns same response as a normal S3 get_object """ if self._s3_client is None: await self.setup() # Ok so if we are doing a range get. We need to align the range start/end with AES block boundaries # 9223372036854775806 is 8EiB so I have no issue with hardcoding it. # We pass the actual start, desired start and desired end to the decrypt function so that it can # generate the correct IV's for starting decryption at that block and then chop off the start and end of the # AES block so it matches what the user is expecting. _range = kwargs.get('Range') actual_range_start = None desired_range_start = None desired_range_end = None if _range: range_match = RANGE_REGEX.match(_range) if not range_match: raise ValueError('Dont understand this range value {0}'.format(_range)) desired_range_start = int(range_match.group(1)) desired_range_end = range_match.group(2) if desired_range_end is None: desired_range_end = 9223372036854775806 else: desired_range_end = int(desired_range_end) actual_range_start, actual_range_end = _get_adjusted_crypto_range(desired_range_start, desired_range_end) # Update range with actual start_end kwargs['Range'] = 'bytes={0}-{1}'.format(actual_range_start, actual_range_end) s3_response = await self._s3_client.get_object(Bucket=Bucket, Key=Key, **kwargs) file_data = await s3_response['Body'].read() metadata = s3_response['Metadata'] whole_file_length = int(s3_response['ResponseMetadata']['HTTPHeaders']['content-length']) if 'x-amz-key' not in metadata and 'x-amz-key-v2' not in metadata: # No crypto return s3_response if 'x-amz-key' in metadata: # Crypto V1 body = await self._decrypt_v1(file_data, metadata, actual_range_start) else: # Crypto V2 body = await self._decrypt_v2(file_data, metadata, whole_file_length, actual_range_start, desired_range_start, desired_range_end) s3_response['Body'] = DummyAIOFile(body) return s3_response
python
async def get_object(self, Bucket: str, Key: str, **kwargs) -> dict: """ S3 GetObject. Takes same args as Boto3 documentation Decrypts any CSE :param Bucket: S3 Bucket :param Key: S3 Key (filepath) :return: returns same response as a normal S3 get_object """ if self._s3_client is None: await self.setup() # Ok so if we are doing a range get. We need to align the range start/end with AES block boundaries # 9223372036854775806 is 8EiB so I have no issue with hardcoding it. # We pass the actual start, desired start and desired end to the decrypt function so that it can # generate the correct IV's for starting decryption at that block and then chop off the start and end of the # AES block so it matches what the user is expecting. _range = kwargs.get('Range') actual_range_start = None desired_range_start = None desired_range_end = None if _range: range_match = RANGE_REGEX.match(_range) if not range_match: raise ValueError('Dont understand this range value {0}'.format(_range)) desired_range_start = int(range_match.group(1)) desired_range_end = range_match.group(2) if desired_range_end is None: desired_range_end = 9223372036854775806 else: desired_range_end = int(desired_range_end) actual_range_start, actual_range_end = _get_adjusted_crypto_range(desired_range_start, desired_range_end) # Update range with actual start_end kwargs['Range'] = 'bytes={0}-{1}'.format(actual_range_start, actual_range_end) s3_response = await self._s3_client.get_object(Bucket=Bucket, Key=Key, **kwargs) file_data = await s3_response['Body'].read() metadata = s3_response['Metadata'] whole_file_length = int(s3_response['ResponseMetadata']['HTTPHeaders']['content-length']) if 'x-amz-key' not in metadata and 'x-amz-key-v2' not in metadata: # No crypto return s3_response if 'x-amz-key' in metadata: # Crypto V1 body = await self._decrypt_v1(file_data, metadata, actual_range_start) else: # Crypto V2 body = await self._decrypt_v2(file_data, metadata, whole_file_length, actual_range_start, desired_range_start, desired_range_end) s3_response['Body'] = DummyAIOFile(body) return s3_response
[ "async", "def", "get_object", "(", "self", ",", "Bucket", ":", "str", ",", "Key", ":", "str", ",", "*", "*", "kwargs", ")", "->", "dict", ":", "if", "self", ".", "_s3_client", "is", "None", ":", "await", "self", ".", "setup", "(", ")", "# Ok so if we are doing a range get. We need to align the range start/end with AES block boundaries", "# 9223372036854775806 is 8EiB so I have no issue with hardcoding it.", "# We pass the actual start, desired start and desired end to the decrypt function so that it can", "# generate the correct IV's for starting decryption at that block and then chop off the start and end of the", "# AES block so it matches what the user is expecting.", "_range", "=", "kwargs", ".", "get", "(", "'Range'", ")", "actual_range_start", "=", "None", "desired_range_start", "=", "None", "desired_range_end", "=", "None", "if", "_range", ":", "range_match", "=", "RANGE_REGEX", ".", "match", "(", "_range", ")", "if", "not", "range_match", ":", "raise", "ValueError", "(", "'Dont understand this range value {0}'", ".", "format", "(", "_range", ")", ")", "desired_range_start", "=", "int", "(", "range_match", ".", "group", "(", "1", ")", ")", "desired_range_end", "=", "range_match", ".", "group", "(", "2", ")", "if", "desired_range_end", "is", "None", ":", "desired_range_end", "=", "9223372036854775806", "else", ":", "desired_range_end", "=", "int", "(", "desired_range_end", ")", "actual_range_start", ",", "actual_range_end", "=", "_get_adjusted_crypto_range", "(", "desired_range_start", ",", "desired_range_end", ")", "# Update range with actual start_end", "kwargs", "[", "'Range'", "]", "=", "'bytes={0}-{1}'", ".", "format", "(", "actual_range_start", ",", "actual_range_end", ")", "s3_response", "=", "await", "self", ".", "_s3_client", ".", "get_object", "(", "Bucket", "=", "Bucket", ",", "Key", "=", "Key", ",", "*", "*", "kwargs", ")", "file_data", "=", "await", "s3_response", "[", "'Body'", "]", ".", "read", "(", ")", "metadata", "=", "s3_response", "[", "'Metadata'", "]", "whole_file_length", "=", "int", "(", "s3_response", "[", "'ResponseMetadata'", "]", "[", "'HTTPHeaders'", "]", "[", "'content-length'", "]", ")", "if", "'x-amz-key'", "not", "in", "metadata", "and", "'x-amz-key-v2'", "not", "in", "metadata", ":", "# No crypto", "return", "s3_response", "if", "'x-amz-key'", "in", "metadata", ":", "# Crypto V1", "body", "=", "await", "self", ".", "_decrypt_v1", "(", "file_data", ",", "metadata", ",", "actual_range_start", ")", "else", ":", "# Crypto V2", "body", "=", "await", "self", ".", "_decrypt_v2", "(", "file_data", ",", "metadata", ",", "whole_file_length", ",", "actual_range_start", ",", "desired_range_start", ",", "desired_range_end", ")", "s3_response", "[", "'Body'", "]", "=", "DummyAIOFile", "(", "body", ")", "return", "s3_response" ]
S3 GetObject. Takes same args as Boto3 documentation Decrypts any CSE :param Bucket: S3 Bucket :param Key: S3 Key (filepath) :return: returns same response as a normal S3 get_object
[ "S3", "GetObject", ".", "Takes", "same", "args", "as", "Boto3", "documentation" ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/cse.py#L330-L389
12,009
terrycain/aioboto3
aioboto3/s3/cse.py
S3CSE.put_object
async def put_object(self, Body: Union[bytes, IO], Bucket: str, Key: str, Metadata: Dict = None, **kwargs): """ PutObject. Takes same args as Boto3 documentation Encrypts files :param: Body: File data :param Bucket: S3 Bucket :param Key: S3 Key (filepath) """ if self._s3_client is None: await self.setup() if hasattr(Body, 'read'): if inspect.iscoroutinefunction(Body.read): Body = await Body.read() else: Body = Body.read() # We do some different V2 stuff if using kms is_kms = isinstance(self._crypto_context, KMSCryptoContext) # noinspection PyUnresolvedReferences authenticated_crypto = is_kms and self._crypto_context.authenticated_encryption Metadata = Metadata if Metadata is not None else {} aes_key, matdesc_metadata, key_metadata = await self._crypto_context.get_encryption_aes_key() if is_kms and authenticated_crypto: Metadata['x-amz-cek-alg'] = 'AES/GCM/NoPadding' Metadata['x-amz-tag-len'] = str(AES_BLOCK_SIZE) iv = os.urandom(12) # 16byte 128bit authentication tag forced aesgcm = AESGCM(aes_key) result = await self._loop.run_in_executor(None, lambda: aesgcm.encrypt(iv, Body, None)) else: if is_kms: # V1 is always AES/CBC/PKCS5Padding Metadata['x-amz-cek-alg'] = 'AES/CBC/PKCS5Padding' iv = os.urandom(16) padder = PKCS7(AES.block_size).padder() padded_result = await self._loop.run_in_executor(None, lambda: (padder.update(Body) + padder.finalize())) aescbc = Cipher(AES(aes_key), CBC(iv), backend=self._backend).encryptor() result = await self._loop.run_in_executor(None, lambda: (aescbc.update(padded_result) + aescbc.finalize())) # For all V1 and V2 Metadata['x-amz-unencrypted-content-length'] = str(len(Body)) Metadata['x-amz-iv'] = base64.b64encode(iv).decode() Metadata['x-amz-matdesc'] = json.dumps(matdesc_metadata) if is_kms: Metadata['x-amz-wrap-alg'] = 'kms' Metadata['x-amz-key-v2'] = key_metadata else: Metadata['x-amz-key'] = key_metadata await self._s3_client.put_object( Bucket=Bucket, Key=Key, Body=result, Metadata=Metadata, **kwargs )
python
async def put_object(self, Body: Union[bytes, IO], Bucket: str, Key: str, Metadata: Dict = None, **kwargs): """ PutObject. Takes same args as Boto3 documentation Encrypts files :param: Body: File data :param Bucket: S3 Bucket :param Key: S3 Key (filepath) """ if self._s3_client is None: await self.setup() if hasattr(Body, 'read'): if inspect.iscoroutinefunction(Body.read): Body = await Body.read() else: Body = Body.read() # We do some different V2 stuff if using kms is_kms = isinstance(self._crypto_context, KMSCryptoContext) # noinspection PyUnresolvedReferences authenticated_crypto = is_kms and self._crypto_context.authenticated_encryption Metadata = Metadata if Metadata is not None else {} aes_key, matdesc_metadata, key_metadata = await self._crypto_context.get_encryption_aes_key() if is_kms and authenticated_crypto: Metadata['x-amz-cek-alg'] = 'AES/GCM/NoPadding' Metadata['x-amz-tag-len'] = str(AES_BLOCK_SIZE) iv = os.urandom(12) # 16byte 128bit authentication tag forced aesgcm = AESGCM(aes_key) result = await self._loop.run_in_executor(None, lambda: aesgcm.encrypt(iv, Body, None)) else: if is_kms: # V1 is always AES/CBC/PKCS5Padding Metadata['x-amz-cek-alg'] = 'AES/CBC/PKCS5Padding' iv = os.urandom(16) padder = PKCS7(AES.block_size).padder() padded_result = await self._loop.run_in_executor(None, lambda: (padder.update(Body) + padder.finalize())) aescbc = Cipher(AES(aes_key), CBC(iv), backend=self._backend).encryptor() result = await self._loop.run_in_executor(None, lambda: (aescbc.update(padded_result) + aescbc.finalize())) # For all V1 and V2 Metadata['x-amz-unencrypted-content-length'] = str(len(Body)) Metadata['x-amz-iv'] = base64.b64encode(iv).decode() Metadata['x-amz-matdesc'] = json.dumps(matdesc_metadata) if is_kms: Metadata['x-amz-wrap-alg'] = 'kms' Metadata['x-amz-key-v2'] = key_metadata else: Metadata['x-amz-key'] = key_metadata await self._s3_client.put_object( Bucket=Bucket, Key=Key, Body=result, Metadata=Metadata, **kwargs )
[ "async", "def", "put_object", "(", "self", ",", "Body", ":", "Union", "[", "bytes", ",", "IO", "]", ",", "Bucket", ":", "str", ",", "Key", ":", "str", ",", "Metadata", ":", "Dict", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_s3_client", "is", "None", ":", "await", "self", ".", "setup", "(", ")", "if", "hasattr", "(", "Body", ",", "'read'", ")", ":", "if", "inspect", ".", "iscoroutinefunction", "(", "Body", ".", "read", ")", ":", "Body", "=", "await", "Body", ".", "read", "(", ")", "else", ":", "Body", "=", "Body", ".", "read", "(", ")", "# We do some different V2 stuff if using kms", "is_kms", "=", "isinstance", "(", "self", ".", "_crypto_context", ",", "KMSCryptoContext", ")", "# noinspection PyUnresolvedReferences", "authenticated_crypto", "=", "is_kms", "and", "self", ".", "_crypto_context", ".", "authenticated_encryption", "Metadata", "=", "Metadata", "if", "Metadata", "is", "not", "None", "else", "{", "}", "aes_key", ",", "matdesc_metadata", ",", "key_metadata", "=", "await", "self", ".", "_crypto_context", ".", "get_encryption_aes_key", "(", ")", "if", "is_kms", "and", "authenticated_crypto", ":", "Metadata", "[", "'x-amz-cek-alg'", "]", "=", "'AES/GCM/NoPadding'", "Metadata", "[", "'x-amz-tag-len'", "]", "=", "str", "(", "AES_BLOCK_SIZE", ")", "iv", "=", "os", ".", "urandom", "(", "12", ")", "# 16byte 128bit authentication tag forced", "aesgcm", "=", "AESGCM", "(", "aes_key", ")", "result", "=", "await", "self", ".", "_loop", ".", "run_in_executor", "(", "None", ",", "lambda", ":", "aesgcm", ".", "encrypt", "(", "iv", ",", "Body", ",", "None", ")", ")", "else", ":", "if", "is_kms", ":", "# V1 is always AES/CBC/PKCS5Padding", "Metadata", "[", "'x-amz-cek-alg'", "]", "=", "'AES/CBC/PKCS5Padding'", "iv", "=", "os", ".", "urandom", "(", "16", ")", "padder", "=", "PKCS7", "(", "AES", ".", "block_size", ")", ".", "padder", "(", ")", "padded_result", "=", "await", "self", ".", "_loop", ".", "run_in_executor", "(", "None", ",", "lambda", ":", "(", "padder", ".", "update", "(", "Body", ")", "+", "padder", ".", "finalize", "(", ")", ")", ")", "aescbc", "=", "Cipher", "(", "AES", "(", "aes_key", ")", ",", "CBC", "(", "iv", ")", ",", "backend", "=", "self", ".", "_backend", ")", ".", "encryptor", "(", ")", "result", "=", "await", "self", ".", "_loop", ".", "run_in_executor", "(", "None", ",", "lambda", ":", "(", "aescbc", ".", "update", "(", "padded_result", ")", "+", "aescbc", ".", "finalize", "(", ")", ")", ")", "# For all V1 and V2", "Metadata", "[", "'x-amz-unencrypted-content-length'", "]", "=", "str", "(", "len", "(", "Body", ")", ")", "Metadata", "[", "'x-amz-iv'", "]", "=", "base64", ".", "b64encode", "(", "iv", ")", ".", "decode", "(", ")", "Metadata", "[", "'x-amz-matdesc'", "]", "=", "json", ".", "dumps", "(", "matdesc_metadata", ")", "if", "is_kms", ":", "Metadata", "[", "'x-amz-wrap-alg'", "]", "=", "'kms'", "Metadata", "[", "'x-amz-key-v2'", "]", "=", "key_metadata", "else", ":", "Metadata", "[", "'x-amz-key'", "]", "=", "key_metadata", "await", "self", ".", "_s3_client", ".", "put_object", "(", "Bucket", "=", "Bucket", ",", "Key", "=", "Key", ",", "Body", "=", "result", ",", "Metadata", "=", "Metadata", ",", "*", "*", "kwargs", ")" ]
PutObject. Takes same args as Boto3 documentation Encrypts files :param: Body: File data :param Bucket: S3 Bucket :param Key: S3 Key (filepath)
[ "PutObject", ".", "Takes", "same", "args", "as", "Boto3", "documentation" ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/cse.py#L482-L549
12,010
astrofrog/fast-histogram
fast_histogram/histogram.py
histogram1d
def histogram1d(x, bins, range, weights=None): """ Compute a 1D histogram assuming equally spaced bins. Parameters ---------- x : `~numpy.ndarray` The position of the points to bin in the 1D histogram bins : int The number of bins range : iterable The range as a tuple of (xmin, xmax) weights : `~numpy.ndarray` The weights of the points in the 1D histogram Returns ------- array : `~numpy.ndarray` The 1D histogram array """ nx = bins if not np.isscalar(bins): raise TypeError('bins should be an integer') xmin, xmax = range if not np.isfinite(xmin): raise ValueError("xmin should be finite") if not np.isfinite(xmax): raise ValueError("xmax should be finite") if xmax <= xmin: raise ValueError("xmax should be greater than xmin") if nx <= 0: raise ValueError("nx should be strictly positive") if weights is None: return _histogram1d(x, nx, xmin, xmax) else: return _histogram1d_weighted(x, weights, nx, xmin, xmax)
python
def histogram1d(x, bins, range, weights=None): """ Compute a 1D histogram assuming equally spaced bins. Parameters ---------- x : `~numpy.ndarray` The position of the points to bin in the 1D histogram bins : int The number of bins range : iterable The range as a tuple of (xmin, xmax) weights : `~numpy.ndarray` The weights of the points in the 1D histogram Returns ------- array : `~numpy.ndarray` The 1D histogram array """ nx = bins if not np.isscalar(bins): raise TypeError('bins should be an integer') xmin, xmax = range if not np.isfinite(xmin): raise ValueError("xmin should be finite") if not np.isfinite(xmax): raise ValueError("xmax should be finite") if xmax <= xmin: raise ValueError("xmax should be greater than xmin") if nx <= 0: raise ValueError("nx should be strictly positive") if weights is None: return _histogram1d(x, nx, xmin, xmax) else: return _histogram1d_weighted(x, weights, nx, xmin, xmax)
[ "def", "histogram1d", "(", "x", ",", "bins", ",", "range", ",", "weights", "=", "None", ")", ":", "nx", "=", "bins", "if", "not", "np", ".", "isscalar", "(", "bins", ")", ":", "raise", "TypeError", "(", "'bins should be an integer'", ")", "xmin", ",", "xmax", "=", "range", "if", "not", "np", ".", "isfinite", "(", "xmin", ")", ":", "raise", "ValueError", "(", "\"xmin should be finite\"", ")", "if", "not", "np", ".", "isfinite", "(", "xmax", ")", ":", "raise", "ValueError", "(", "\"xmax should be finite\"", ")", "if", "xmax", "<=", "xmin", ":", "raise", "ValueError", "(", "\"xmax should be greater than xmin\"", ")", "if", "nx", "<=", "0", ":", "raise", "ValueError", "(", "\"nx should be strictly positive\"", ")", "if", "weights", "is", "None", ":", "return", "_histogram1d", "(", "x", ",", "nx", ",", "xmin", ",", "xmax", ")", "else", ":", "return", "_histogram1d_weighted", "(", "x", ",", "weights", ",", "nx", ",", "xmin", ",", "xmax", ")" ]
Compute a 1D histogram assuming equally spaced bins. Parameters ---------- x : `~numpy.ndarray` The position of the points to bin in the 1D histogram bins : int The number of bins range : iterable The range as a tuple of (xmin, xmax) weights : `~numpy.ndarray` The weights of the points in the 1D histogram Returns ------- array : `~numpy.ndarray` The 1D histogram array
[ "Compute", "a", "1D", "histogram", "assuming", "equally", "spaced", "bins", "." ]
ace4f2444fba2e21fa3cd9dad966f6b65b60660f
https://github.com/astrofrog/fast-histogram/blob/ace4f2444fba2e21fa3cd9dad966f6b65b60660f/fast_histogram/histogram.py#L15-L58
12,011
astrofrog/fast-histogram
fast_histogram/histogram.py
histogram2d
def histogram2d(x, y, bins, range, weights=None): """ Compute a 2D histogram assuming equally spaced bins. Parameters ---------- x, y : `~numpy.ndarray` The position of the points to bin in the 2D histogram bins : int or iterable The number of bins in each dimension. If given as an integer, the same number of bins is used for each dimension. range : iterable The range to use in each dimention, as an iterable of value pairs, i.e. [(xmin, xmax), (ymin, ymax)] weights : `~numpy.ndarray` The weights of the points in the 1D histogram Returns ------- array : `~numpy.ndarray` The 2D histogram array """ if isinstance(bins, numbers.Integral): nx = ny = bins else: nx, ny = bins if not np.isscalar(nx) or not np.isscalar(ny): raise TypeError('bins should be an iterable of two integers') (xmin, xmax), (ymin, ymax) = range if not np.isfinite(xmin): raise ValueError("xmin should be finite") if not np.isfinite(xmax): raise ValueError("xmax should be finite") if not np.isfinite(ymin): raise ValueError("ymin should be finite") if not np.isfinite(ymax): raise ValueError("ymax should be finite") if xmax <= xmin: raise ValueError("xmax should be greater than xmin") if ymax <= ymin: raise ValueError("xmax should be greater than xmin") if nx <= 0: raise ValueError("nx should be strictly positive") if ny <= 0: raise ValueError("ny should be strictly positive") if weights is None: return _histogram2d(x, y, nx, xmin, xmax, ny, ymin, ymax) else: return _histogram2d_weighted(x, y, weights, nx, xmin, xmax, ny, ymin, ymax)
python
def histogram2d(x, y, bins, range, weights=None): """ Compute a 2D histogram assuming equally spaced bins. Parameters ---------- x, y : `~numpy.ndarray` The position of the points to bin in the 2D histogram bins : int or iterable The number of bins in each dimension. If given as an integer, the same number of bins is used for each dimension. range : iterable The range to use in each dimention, as an iterable of value pairs, i.e. [(xmin, xmax), (ymin, ymax)] weights : `~numpy.ndarray` The weights of the points in the 1D histogram Returns ------- array : `~numpy.ndarray` The 2D histogram array """ if isinstance(bins, numbers.Integral): nx = ny = bins else: nx, ny = bins if not np.isscalar(nx) or not np.isscalar(ny): raise TypeError('bins should be an iterable of two integers') (xmin, xmax), (ymin, ymax) = range if not np.isfinite(xmin): raise ValueError("xmin should be finite") if not np.isfinite(xmax): raise ValueError("xmax should be finite") if not np.isfinite(ymin): raise ValueError("ymin should be finite") if not np.isfinite(ymax): raise ValueError("ymax should be finite") if xmax <= xmin: raise ValueError("xmax should be greater than xmin") if ymax <= ymin: raise ValueError("xmax should be greater than xmin") if nx <= 0: raise ValueError("nx should be strictly positive") if ny <= 0: raise ValueError("ny should be strictly positive") if weights is None: return _histogram2d(x, y, nx, xmin, xmax, ny, ymin, ymax) else: return _histogram2d_weighted(x, y, weights, nx, xmin, xmax, ny, ymin, ymax)
[ "def", "histogram2d", "(", "x", ",", "y", ",", "bins", ",", "range", ",", "weights", "=", "None", ")", ":", "if", "isinstance", "(", "bins", ",", "numbers", ".", "Integral", ")", ":", "nx", "=", "ny", "=", "bins", "else", ":", "nx", ",", "ny", "=", "bins", "if", "not", "np", ".", "isscalar", "(", "nx", ")", "or", "not", "np", ".", "isscalar", "(", "ny", ")", ":", "raise", "TypeError", "(", "'bins should be an iterable of two integers'", ")", "(", "xmin", ",", "xmax", ")", ",", "(", "ymin", ",", "ymax", ")", "=", "range", "if", "not", "np", ".", "isfinite", "(", "xmin", ")", ":", "raise", "ValueError", "(", "\"xmin should be finite\"", ")", "if", "not", "np", ".", "isfinite", "(", "xmax", ")", ":", "raise", "ValueError", "(", "\"xmax should be finite\"", ")", "if", "not", "np", ".", "isfinite", "(", "ymin", ")", ":", "raise", "ValueError", "(", "\"ymin should be finite\"", ")", "if", "not", "np", ".", "isfinite", "(", "ymax", ")", ":", "raise", "ValueError", "(", "\"ymax should be finite\"", ")", "if", "xmax", "<=", "xmin", ":", "raise", "ValueError", "(", "\"xmax should be greater than xmin\"", ")", "if", "ymax", "<=", "ymin", ":", "raise", "ValueError", "(", "\"xmax should be greater than xmin\"", ")", "if", "nx", "<=", "0", ":", "raise", "ValueError", "(", "\"nx should be strictly positive\"", ")", "if", "ny", "<=", "0", ":", "raise", "ValueError", "(", "\"ny should be strictly positive\"", ")", "if", "weights", "is", "None", ":", "return", "_histogram2d", "(", "x", ",", "y", ",", "nx", ",", "xmin", ",", "xmax", ",", "ny", ",", "ymin", ",", "ymax", ")", "else", ":", "return", "_histogram2d_weighted", "(", "x", ",", "y", ",", "weights", ",", "nx", ",", "xmin", ",", "xmax", ",", "ny", ",", "ymin", ",", "ymax", ")" ]
Compute a 2D histogram assuming equally spaced bins. Parameters ---------- x, y : `~numpy.ndarray` The position of the points to bin in the 2D histogram bins : int or iterable The number of bins in each dimension. If given as an integer, the same number of bins is used for each dimension. range : iterable The range to use in each dimention, as an iterable of value pairs, i.e. [(xmin, xmax), (ymin, ymax)] weights : `~numpy.ndarray` The weights of the points in the 1D histogram Returns ------- array : `~numpy.ndarray` The 2D histogram array
[ "Compute", "a", "2D", "histogram", "assuming", "equally", "spaced", "bins", "." ]
ace4f2444fba2e21fa3cd9dad966f6b65b60660f
https://github.com/astrofrog/fast-histogram/blob/ace4f2444fba2e21fa3cd9dad966f6b65b60660f/fast_histogram/histogram.py#L61-L121
12,012
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.to_networkx
def to_networkx(self): """ Return this network in NetworkX graph object. :return: Network as NetworkX graph object """ return nx_util.to_networkx(self.session.get(self.__url).json())
python
def to_networkx(self): """ Return this network in NetworkX graph object. :return: Network as NetworkX graph object """ return nx_util.to_networkx(self.session.get(self.__url).json())
[ "def", "to_networkx", "(", "self", ")", ":", "return", "nx_util", ".", "to_networkx", "(", "self", ".", "session", ".", "get", "(", "self", ".", "__url", ")", ".", "json", "(", ")", ")" ]
Return this network in NetworkX graph object. :return: Network as NetworkX graph object
[ "Return", "this", "network", "in", "NetworkX", "graph", "object", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L46-L52
12,013
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.to_dataframe
def to_dataframe(self, extra_edges_columns=[]): """ Return this network in pandas DataFrame. :return: Network as DataFrame. This is equivalent to SIF. """ return df_util.to_dataframe( self.session.get(self.__url).json(), edges_attr_cols=extra_edges_columns )
python
def to_dataframe(self, extra_edges_columns=[]): """ Return this network in pandas DataFrame. :return: Network as DataFrame. This is equivalent to SIF. """ return df_util.to_dataframe( self.session.get(self.__url).json(), edges_attr_cols=extra_edges_columns )
[ "def", "to_dataframe", "(", "self", ",", "extra_edges_columns", "=", "[", "]", ")", ":", "return", "df_util", ".", "to_dataframe", "(", "self", ".", "session", ".", "get", "(", "self", ".", "__url", ")", ".", "json", "(", ")", ",", "edges_attr_cols", "=", "extra_edges_columns", ")" ]
Return this network in pandas DataFrame. :return: Network as DataFrame. This is equivalent to SIF.
[ "Return", "this", "network", "in", "pandas", "DataFrame", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L54-L63
12,014
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.add_node
def add_node(self, node_name, dataframe=False): """ Add a single node to the network. """ if node_name is None: return None return self.add_nodes([node_name], dataframe=dataframe)
python
def add_node(self, node_name, dataframe=False): """ Add a single node to the network. """ if node_name is None: return None return self.add_nodes([node_name], dataframe=dataframe)
[ "def", "add_node", "(", "self", ",", "node_name", ",", "dataframe", "=", "False", ")", ":", "if", "node_name", "is", "None", ":", "return", "None", "return", "self", ".", "add_nodes", "(", "[", "node_name", "]", ",", "dataframe", "=", "dataframe", ")" ]
Add a single node to the network.
[ "Add", "a", "single", "node", "to", "the", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L82-L86
12,015
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.add_nodes
def add_nodes(self, node_name_list, dataframe=False): """ Add new nodes to the network :param node_name_list: list of node names, e.g. ['a', 'b', 'c'] :param dataframe: If True, return a pandas dataframe instead of a dict. :return: A dict mapping names to SUIDs for the newly-created nodes. """ res = self.session.post(self.__url + 'nodes', data=json.dumps(node_name_list), headers=HEADERS) check_response(res) nodes = res.json() if dataframe: return pd.DataFrame(nodes).set_index(['SUID']) else: return {node['name']: node['SUID'] for node in nodes}
python
def add_nodes(self, node_name_list, dataframe=False): """ Add new nodes to the network :param node_name_list: list of node names, e.g. ['a', 'b', 'c'] :param dataframe: If True, return a pandas dataframe instead of a dict. :return: A dict mapping names to SUIDs for the newly-created nodes. """ res = self.session.post(self.__url + 'nodes', data=json.dumps(node_name_list), headers=HEADERS) check_response(res) nodes = res.json() if dataframe: return pd.DataFrame(nodes).set_index(['SUID']) else: return {node['name']: node['SUID'] for node in nodes}
[ "def", "add_nodes", "(", "self", ",", "node_name_list", ",", "dataframe", "=", "False", ")", ":", "res", "=", "self", ".", "session", ".", "post", "(", "self", ".", "__url", "+", "'nodes'", ",", "data", "=", "json", ".", "dumps", "(", "node_name_list", ")", ",", "headers", "=", "HEADERS", ")", "check_response", "(", "res", ")", "nodes", "=", "res", ".", "json", "(", ")", "if", "dataframe", ":", "return", "pd", ".", "DataFrame", "(", "nodes", ")", ".", "set_index", "(", "[", "'SUID'", "]", ")", "else", ":", "return", "{", "node", "[", "'name'", "]", ":", "node", "[", "'SUID'", "]", "for", "node", "in", "nodes", "}" ]
Add new nodes to the network :param node_name_list: list of node names, e.g. ['a', 'b', 'c'] :param dataframe: If True, return a pandas dataframe instead of a dict. :return: A dict mapping names to SUIDs for the newly-created nodes.
[ "Add", "new", "nodes", "to", "the", "network" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L88-L102
12,016
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.add_edge
def add_edge(self, source, target, interaction='-', directed=True, dataframe=True): """ Add a single edge from source to target. """ new_edge = { 'source': source, 'target': target, 'interaction': interaction, 'directed': directed } return self.add_edges([new_edge], dataframe=dataframe)
python
def add_edge(self, source, target, interaction='-', directed=True, dataframe=True): """ Add a single edge from source to target. """ new_edge = { 'source': source, 'target': target, 'interaction': interaction, 'directed': directed } return self.add_edges([new_edge], dataframe=dataframe)
[ "def", "add_edge", "(", "self", ",", "source", ",", "target", ",", "interaction", "=", "'-'", ",", "directed", "=", "True", ",", "dataframe", "=", "True", ")", ":", "new_edge", "=", "{", "'source'", ":", "source", ",", "'target'", ":", "target", ",", "'interaction'", ":", "interaction", ",", "'directed'", ":", "directed", "}", "return", "self", ".", "add_edges", "(", "[", "new_edge", "]", ",", "dataframe", "=", "dataframe", ")" ]
Add a single edge from source to target.
[ "Add", "a", "single", "edge", "from", "source", "to", "target", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L104-L112
12,017
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.get_views
def get_views(self): """ Get views as a list of SUIDs :return: """ url = self.__url + 'views' return self.session.get(url).json()
python
def get_views(self): """ Get views as a list of SUIDs :return: """ url = self.__url + 'views' return self.session.get(url).json()
[ "def", "get_views", "(", "self", ")", ":", "url", "=", "self", ".", "__url", "+", "'views'", "return", "self", ".", "session", ".", "get", "(", "url", ")", ".", "json", "(", ")" ]
Get views as a list of SUIDs :return:
[ "Get", "views", "as", "a", "list", "of", "SUIDs" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L304-L311
12,018
cytoscape/py2cytoscape
py2cytoscape/cyrest/diffusion.py
diffusion.diffuse_advanced
def diffuse_advanced(self, heatColumnName=None, time=None, verbose=False): """ Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculate network propagation. Results are returned and represented by columns in the node table. Columns are created for each execution of Diffusion and their names are returned in the response. :param heatColumnName (string, optional): A node column name intended to override the default table column 'diffusion_input'. This represents the query vector and corresponds to h in the diffusion equation. = ['HEKScore', 'JurkatScore', '(Use selected nodes)'] :param time (string, optional): The extent of spread over the network. This corresponds to t in the diffusion equation. :param verbose: print more """ PARAMS=set_param(["heatColumnName","time"],[heatColumnName,time]) response=api(url=self.__url+"/diffuse_advanced", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def diffuse_advanced(self, heatColumnName=None, time=None, verbose=False): """ Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculate network propagation. Results are returned and represented by columns in the node table. Columns are created for each execution of Diffusion and their names are returned in the response. :param heatColumnName (string, optional): A node column name intended to override the default table column 'diffusion_input'. This represents the query vector and corresponds to h in the diffusion equation. = ['HEKScore', 'JurkatScore', '(Use selected nodes)'] :param time (string, optional): The extent of spread over the network. This corresponds to t in the diffusion equation. :param verbose: print more """ PARAMS=set_param(["heatColumnName","time"],[heatColumnName,time]) response=api(url=self.__url+"/diffuse_advanced", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "diffuse_advanced", "(", "self", ",", "heatColumnName", "=", "None", ",", "time", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"heatColumnName\"", ",", "\"time\"", "]", ",", "[", "heatColumnName", ",", "time", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/diffuse_advanced\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculate network propagation. Results are returned and represented by columns in the node table. Columns are created for each execution of Diffusion and their names are returned in the response. :param heatColumnName (string, optional): A node column name intended to override the default table column 'diffusion_input'. This represents the query vector and corresponds to h in the diffusion equation. = ['HEKScore', 'JurkatScore', '(Use selected nodes)'] :param time (string, optional): The extent of spread over the network. This corresponds to t in the diffusion equation. :param verbose: print more
[ "Diffusion", "will", "send", "the", "selected", "network", "view", "and", "its", "selected", "nodes", "to", "a", "web", "-", "based", "REST", "service", "to", "calculate", "network", "propagation", ".", "Results", "are", "returned", "and", "represented", "by", "columns", "in", "the", "node", "table", ".", "Columns", "are", "created", "for", "each", "execution", "of", "Diffusion", "and", "their", "names", "are", "returned", "in", "the", "response", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/diffusion.py#L30-L48
12,019
cytoscape/py2cytoscape
py2cytoscape/util/util_networkx.py
to_networkx
def to_networkx(cyjs, directed=True): """ Convert Cytoscape.js-style JSON object into NetworkX object. By default, data will be handles as a directed graph. """ if directed: g = nx.MultiDiGraph() else: g = nx.MultiGraph() network_data = cyjs[DATA] if network_data is not None: for key in network_data.keys(): g.graph[key] = network_data[key] nodes = cyjs[ELEMENTS][NODES] edges = cyjs[ELEMENTS][EDGES] for node in nodes: data = node[DATA] g.add_node(data[ID], attr_dict=data) for edge in edges: data = edge[DATA] source = data[SOURCE] target = data[TARGET] g.add_edge(source, target, attr_dict=data) return g
python
def to_networkx(cyjs, directed=True): """ Convert Cytoscape.js-style JSON object into NetworkX object. By default, data will be handles as a directed graph. """ if directed: g = nx.MultiDiGraph() else: g = nx.MultiGraph() network_data = cyjs[DATA] if network_data is not None: for key in network_data.keys(): g.graph[key] = network_data[key] nodes = cyjs[ELEMENTS][NODES] edges = cyjs[ELEMENTS][EDGES] for node in nodes: data = node[DATA] g.add_node(data[ID], attr_dict=data) for edge in edges: data = edge[DATA] source = data[SOURCE] target = data[TARGET] g.add_edge(source, target, attr_dict=data) return g
[ "def", "to_networkx", "(", "cyjs", ",", "directed", "=", "True", ")", ":", "if", "directed", ":", "g", "=", "nx", ".", "MultiDiGraph", "(", ")", "else", ":", "g", "=", "nx", ".", "MultiGraph", "(", ")", "network_data", "=", "cyjs", "[", "DATA", "]", "if", "network_data", "is", "not", "None", ":", "for", "key", "in", "network_data", ".", "keys", "(", ")", ":", "g", ".", "graph", "[", "key", "]", "=", "network_data", "[", "key", "]", "nodes", "=", "cyjs", "[", "ELEMENTS", "]", "[", "NODES", "]", "edges", "=", "cyjs", "[", "ELEMENTS", "]", "[", "EDGES", "]", "for", "node", "in", "nodes", ":", "data", "=", "node", "[", "DATA", "]", "g", ".", "add_node", "(", "data", "[", "ID", "]", ",", "attr_dict", "=", "data", ")", "for", "edge", "in", "edges", ":", "data", "=", "edge", "[", "DATA", "]", "source", "=", "data", "[", "SOURCE", "]", "target", "=", "data", "[", "TARGET", "]", "g", ".", "add_edge", "(", "source", ",", "target", ",", "attr_dict", "=", "data", ")", "return", "g" ]
Convert Cytoscape.js-style JSON object into NetworkX object. By default, data will be handles as a directed graph.
[ "Convert", "Cytoscape", ".", "js", "-", "style", "JSON", "object", "into", "NetworkX", "object", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/util/util_networkx.py#L120-L151
12,020
cytoscape/py2cytoscape
py2cytoscape/cyrest/cybrowser.py
cybrowser.dialog
def dialog(self=None, wid=None, text=None, title=None, url=None, debug=False, verbose=False): """ Launch and HTML browser in a separate window. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param debug: Show debug tools. boolean :param verbose: print more """ PARAMS=set_param(["id","text","title","url","debug"],[wid,text,title,url,debug]) response=api(url=self.__url+"/dialog?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
python
def dialog(self=None, wid=None, text=None, title=None, url=None, debug=False, verbose=False): """ Launch and HTML browser in a separate window. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param debug: Show debug tools. boolean :param verbose: print more """ PARAMS=set_param(["id","text","title","url","debug"],[wid,text,title,url,debug]) response=api(url=self.__url+"/dialog?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
[ "def", "dialog", "(", "self", "=", "None", ",", "wid", "=", "None", ",", "text", "=", "None", ",", "title", "=", "None", ",", "url", "=", "None", ",", "debug", "=", "False", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"id\"", ",", "\"text\"", ",", "\"title\"", ",", "\"url\"", ",", "\"debug\"", "]", ",", "[", "wid", ",", "text", ",", "title", ",", "url", ",", "debug", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/dialog?\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"GET\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Launch and HTML browser in a separate window. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param debug: Show debug tools. boolean :param verbose: print more
[ "Launch", "and", "HTML", "browser", "in", "a", "separate", "window", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cybrowser.py#L13-L27
12,021
cytoscape/py2cytoscape
py2cytoscape/cyrest/cybrowser.py
cybrowser.hide
def hide(self, wid, verbose=False): """ Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more """ PARAMS={"id":wid} response=api(url=self.__url+"/hide?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
python
def hide(self, wid, verbose=False): """ Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more """ PARAMS={"id":wid} response=api(url=self.__url+"/hide?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
[ "def", "hide", "(", "self", ",", "wid", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "\"id\"", ":", "wid", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/hide?\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"GET\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more
[ "Hide", "and", "HTML", "browser", "in", "the", "Results", "Panel", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cybrowser.py#L29-L40
12,022
cytoscape/py2cytoscape
py2cytoscape/cyrest/cybrowser.py
cybrowser.show
def show(self, wid=None, text=None, title=None, url=None, verbose=False): """ Launch an HTML browser in the Results Panel. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param verbose: print more """ PARAMS={} for p,v in zip(["id","text","title","url"],[wid,text,title,url]): if v: PARAMS[p]=v response=api(url=self.__url+"/show?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
python
def show(self, wid=None, text=None, title=None, url=None, verbose=False): """ Launch an HTML browser in the Results Panel. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param verbose: print more """ PARAMS={} for p,v in zip(["id","text","title","url"],[wid,text,title,url]): if v: PARAMS[p]=v response=api(url=self.__url+"/show?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
[ "def", "show", "(", "self", ",", "wid", "=", "None", ",", "text", "=", "None", ",", "title", "=", "None", ",", "url", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "}", "for", "p", ",", "v", "in", "zip", "(", "[", "\"id\"", ",", "\"text\"", ",", "\"title\"", ",", "\"url\"", "]", ",", "[", "wid", ",", "text", ",", "title", ",", "url", "]", ")", ":", "if", "v", ":", "PARAMS", "[", "p", "]", "=", "v", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/show?\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"GET\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Launch an HTML browser in the Results Panel. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param verbose: print more
[ "Launch", "an", "HTML", "browser", "in", "the", "Results", "Panel", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cybrowser.py#L42-L59
12,023
cytoscape/py2cytoscape
py2cytoscape/data/util_http.py
check_response
def check_response(res): """ Check HTTP response and raise exception if response is not OK. """ try: res.raise_for_status() # Alternative is res.ok except Exception as exc: # Bad response code, e.g. if adding an edge with nodes that doesn't exist try: err_info = res.json() err_msg = err_info['message'] # or 'localizeMessage' except ValueError: err_msg = res.text[:40] # Take the first 40 chars of the response except KeyError: err_msg = res.text[:40] + ("(No 'message' in err_info dict: %s" % list(err_info.keys())) exc.args += (err_msg,) raise exc
python
def check_response(res): """ Check HTTP response and raise exception if response is not OK. """ try: res.raise_for_status() # Alternative is res.ok except Exception as exc: # Bad response code, e.g. if adding an edge with nodes that doesn't exist try: err_info = res.json() err_msg = err_info['message'] # or 'localizeMessage' except ValueError: err_msg = res.text[:40] # Take the first 40 chars of the response except KeyError: err_msg = res.text[:40] + ("(No 'message' in err_info dict: %s" % list(err_info.keys())) exc.args += (err_msg,) raise exc
[ "def", "check_response", "(", "res", ")", ":", "try", ":", "res", ".", "raise_for_status", "(", ")", "# Alternative is res.ok", "except", "Exception", "as", "exc", ":", "# Bad response code, e.g. if adding an edge with nodes that doesn't exist", "try", ":", "err_info", "=", "res", ".", "json", "(", ")", "err_msg", "=", "err_info", "[", "'message'", "]", "# or 'localizeMessage'", "except", "ValueError", ":", "err_msg", "=", "res", ".", "text", "[", ":", "40", "]", "# Take the first 40 chars of the response", "except", "KeyError", ":", "err_msg", "=", "res", ".", "text", "[", ":", "40", "]", "+", "(", "\"(No 'message' in err_info dict: %s\"", "%", "list", "(", "err_info", ".", "keys", "(", ")", ")", ")", "exc", ".", "args", "+=", "(", "err_msg", ",", ")", "raise", "exc" ]
Check HTTP response and raise exception if response is not OK.
[ "Check", "HTTP", "response", "and", "raise", "exception", "if", "response", "is", "not", "OK", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/util_http.py#L3-L18
12,024
cytoscape/py2cytoscape
py2cytoscape/util/util_dataframe.py
from_dataframe
def from_dataframe(df, source_col='source', target_col='target', interaction_col='interaction', name='From DataFrame', edge_attr_cols=[]): """ Utility to convert Pandas DataFrame object into Cytoscape.js JSON :param df: Dataframe to convert. :param source_col: Name of source column. :param target_col: Name of target column. :param interaction_col: Name of interaction column. :param name: Name of network. :param edge_attr_cols: List containing other columns to consider in df as edges' attributes. :return: Dictionary version of df. """ network = cyjs.get_empty_network(name=name) nodes = set() if edge_attr_cols is None: edge_attr_cols = [] for index, row in df.iterrows(): s = row[source_col] t = row[target_col] if s not in nodes: nodes.add(s) source = get_node(s) network['elements']['nodes'].append(source) if t not in nodes: nodes.add(t) target = get_node(t) network['elements']['nodes'].append(target) extra_values = {column: row[column] for column in edge_attr_cols if column in df.columns} network['elements']['edges'].append( get_edge(s, t, interaction=row[interaction_col], **extra_values) ) return network
python
def from_dataframe(df, source_col='source', target_col='target', interaction_col='interaction', name='From DataFrame', edge_attr_cols=[]): """ Utility to convert Pandas DataFrame object into Cytoscape.js JSON :param df: Dataframe to convert. :param source_col: Name of source column. :param target_col: Name of target column. :param interaction_col: Name of interaction column. :param name: Name of network. :param edge_attr_cols: List containing other columns to consider in df as edges' attributes. :return: Dictionary version of df. """ network = cyjs.get_empty_network(name=name) nodes = set() if edge_attr_cols is None: edge_attr_cols = [] for index, row in df.iterrows(): s = row[source_col] t = row[target_col] if s not in nodes: nodes.add(s) source = get_node(s) network['elements']['nodes'].append(source) if t not in nodes: nodes.add(t) target = get_node(t) network['elements']['nodes'].append(target) extra_values = {column: row[column] for column in edge_attr_cols if column in df.columns} network['elements']['edges'].append( get_edge(s, t, interaction=row[interaction_col], **extra_values) ) return network
[ "def", "from_dataframe", "(", "df", ",", "source_col", "=", "'source'", ",", "target_col", "=", "'target'", ",", "interaction_col", "=", "'interaction'", ",", "name", "=", "'From DataFrame'", ",", "edge_attr_cols", "=", "[", "]", ")", ":", "network", "=", "cyjs", ".", "get_empty_network", "(", "name", "=", "name", ")", "nodes", "=", "set", "(", ")", "if", "edge_attr_cols", "is", "None", ":", "edge_attr_cols", "=", "[", "]", "for", "index", ",", "row", "in", "df", ".", "iterrows", "(", ")", ":", "s", "=", "row", "[", "source_col", "]", "t", "=", "row", "[", "target_col", "]", "if", "s", "not", "in", "nodes", ":", "nodes", ".", "add", "(", "s", ")", "source", "=", "get_node", "(", "s", ")", "network", "[", "'elements'", "]", "[", "'nodes'", "]", ".", "append", "(", "source", ")", "if", "t", "not", "in", "nodes", ":", "nodes", ".", "add", "(", "t", ")", "target", "=", "get_node", "(", "t", ")", "network", "[", "'elements'", "]", "[", "'nodes'", "]", ".", "append", "(", "target", ")", "extra_values", "=", "{", "column", ":", "row", "[", "column", "]", "for", "column", "in", "edge_attr_cols", "if", "column", "in", "df", ".", "columns", "}", "network", "[", "'elements'", "]", "[", "'edges'", "]", ".", "append", "(", "get_edge", "(", "s", ",", "t", ",", "interaction", "=", "row", "[", "interaction_col", "]", ",", "*", "*", "extra_values", ")", ")", "return", "network" ]
Utility to convert Pandas DataFrame object into Cytoscape.js JSON :param df: Dataframe to convert. :param source_col: Name of source column. :param target_col: Name of target column. :param interaction_col: Name of interaction column. :param name: Name of network. :param edge_attr_cols: List containing other columns to consider in df as edges' attributes. :return: Dictionary version of df.
[ "Utility", "to", "convert", "Pandas", "DataFrame", "object", "into", "Cytoscape", ".", "js", "JSON" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/util/util_dataframe.py#L6-L49
12,025
cytoscape/py2cytoscape
py2cytoscape/util/util_dataframe.py
to_dataframe
def to_dataframe(network, interaction='interaction', default_interaction='-', edges_attr_cols=[]): """ Utility to convert a Cytoscape dictionary into a Pandas Dataframe. :param network: Dictionary to convert. :param interaction: Name of interaction column. :param default_interaction: Default value for missing interactions. :param edges_attr_cols: List containing other edges' attributes to include in the Dataframe, if present in network. :return: Converted Pandas Dataframe. """ edges = network['elements']['edges'] if edges_attr_cols is None: edges_attr_cols = [] edges_attr_cols = sorted(edges_attr_cols) network_array = [] # the set avoids duplicates valid_extra_cols = set() for edge in edges: edge_data = edge['data'] source = edge_data['source'] target = edge_data['target'] if interaction in edge_data: itr = edge_data[interaction] else: itr = default_interaction extra_values = [] for extra_column in edges_attr_cols: if extra_column in edge_data: extra_values.append(edge_data[extra_column]) valid_extra_cols.add(extra_column) row = tuple([source, itr, target] + extra_values) network_array.append(row) return pd.DataFrame( network_array, columns=['source', 'interaction', 'target'] + sorted(valid_extra_cols))
python
def to_dataframe(network, interaction='interaction', default_interaction='-', edges_attr_cols=[]): """ Utility to convert a Cytoscape dictionary into a Pandas Dataframe. :param network: Dictionary to convert. :param interaction: Name of interaction column. :param default_interaction: Default value for missing interactions. :param edges_attr_cols: List containing other edges' attributes to include in the Dataframe, if present in network. :return: Converted Pandas Dataframe. """ edges = network['elements']['edges'] if edges_attr_cols is None: edges_attr_cols = [] edges_attr_cols = sorted(edges_attr_cols) network_array = [] # the set avoids duplicates valid_extra_cols = set() for edge in edges: edge_data = edge['data'] source = edge_data['source'] target = edge_data['target'] if interaction in edge_data: itr = edge_data[interaction] else: itr = default_interaction extra_values = [] for extra_column in edges_attr_cols: if extra_column in edge_data: extra_values.append(edge_data[extra_column]) valid_extra_cols.add(extra_column) row = tuple([source, itr, target] + extra_values) network_array.append(row) return pd.DataFrame( network_array, columns=['source', 'interaction', 'target'] + sorted(valid_extra_cols))
[ "def", "to_dataframe", "(", "network", ",", "interaction", "=", "'interaction'", ",", "default_interaction", "=", "'-'", ",", "edges_attr_cols", "=", "[", "]", ")", ":", "edges", "=", "network", "[", "'elements'", "]", "[", "'edges'", "]", "if", "edges_attr_cols", "is", "None", ":", "edges_attr_cols", "=", "[", "]", "edges_attr_cols", "=", "sorted", "(", "edges_attr_cols", ")", "network_array", "=", "[", "]", "# the set avoids duplicates", "valid_extra_cols", "=", "set", "(", ")", "for", "edge", "in", "edges", ":", "edge_data", "=", "edge", "[", "'data'", "]", "source", "=", "edge_data", "[", "'source'", "]", "target", "=", "edge_data", "[", "'target'", "]", "if", "interaction", "in", "edge_data", ":", "itr", "=", "edge_data", "[", "interaction", "]", "else", ":", "itr", "=", "default_interaction", "extra_values", "=", "[", "]", "for", "extra_column", "in", "edges_attr_cols", ":", "if", "extra_column", "in", "edge_data", ":", "extra_values", ".", "append", "(", "edge_data", "[", "extra_column", "]", ")", "valid_extra_cols", ".", "add", "(", "extra_column", ")", "row", "=", "tuple", "(", "[", "source", ",", "itr", ",", "target", "]", "+", "extra_values", ")", "network_array", ".", "append", "(", "row", ")", "return", "pd", ".", "DataFrame", "(", "network_array", ",", "columns", "=", "[", "'source'", ",", "'interaction'", ",", "'target'", "]", "+", "sorted", "(", "valid_extra_cols", ")", ")" ]
Utility to convert a Cytoscape dictionary into a Pandas Dataframe. :param network: Dictionary to convert. :param interaction: Name of interaction column. :param default_interaction: Default value for missing interactions. :param edges_attr_cols: List containing other edges' attributes to include in the Dataframe, if present in network. :return: Converted Pandas Dataframe.
[ "Utility", "to", "convert", "a", "Cytoscape", "dictionary", "into", "a", "Pandas", "Dataframe", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/util/util_dataframe.py#L52-L91
12,026
cytoscape/py2cytoscape
py2cytoscape/cytoscapejs/viewer.py
render
def render(network, style=DEF_STYLE, layout_algorithm=DEF_LAYOUT, background=DEF_BACKGROUND_COLOR, height=DEF_HEIGHT, width=DEF_WIDTH, style_file=STYLE_FILE, def_nodes=DEF_NODES, def_edges=DEF_EDGES): """Render network data with embedded Cytoscape.js widget. :param network: dict (required) The network data should be in Cytoscape.js JSON format. :param style: str or dict If str, pick one of the preset style. [default: 'default'] If dict, it should be Cytoscape.js style CSS object :param layout_algorithm: str Name of Cytoscape.js layout algorithm :param background: str Background in CSS format :param height: int Height of the widget. :param width: int Width of the widget. :param style_file: a styles file. [default: 'default_style.json'] :param def_nodes: default: [ {'data': {'id': 'Network Data'}}, {'data': {'id': 'Empty'}} ] :param def_edges: default: [ {'data': {'id': 'is', 'source': 'Network Data', 'target': 'Empty'}} ] """ from jinja2 import Template from IPython.core.display import display, HTML STYLES=set_styles(style_file) # Load style file if none available if isinstance(style, str): # Specified by name style = STYLES[style] if network is None: nodes = def_nodes edges = def_edges else: nodes = network['elements']['nodes'] edges = network['elements']['edges'] path = os.path.abspath(os.path.dirname(__file__)) + '/' + HTML_TEMPLATE_FILE template = Template(open(path).read()) cyjs_widget = template.render( nodes=json.dumps(nodes), edges=json.dumps(edges), background=background, uuid="cy" + str(uuid.uuid4()), widget_width=str(width), widget_height=str(height), layout=layout_algorithm, style_json=json.dumps(style) ) display(HTML(cyjs_widget))
python
def render(network, style=DEF_STYLE, layout_algorithm=DEF_LAYOUT, background=DEF_BACKGROUND_COLOR, height=DEF_HEIGHT, width=DEF_WIDTH, style_file=STYLE_FILE, def_nodes=DEF_NODES, def_edges=DEF_EDGES): """Render network data with embedded Cytoscape.js widget. :param network: dict (required) The network data should be in Cytoscape.js JSON format. :param style: str or dict If str, pick one of the preset style. [default: 'default'] If dict, it should be Cytoscape.js style CSS object :param layout_algorithm: str Name of Cytoscape.js layout algorithm :param background: str Background in CSS format :param height: int Height of the widget. :param width: int Width of the widget. :param style_file: a styles file. [default: 'default_style.json'] :param def_nodes: default: [ {'data': {'id': 'Network Data'}}, {'data': {'id': 'Empty'}} ] :param def_edges: default: [ {'data': {'id': 'is', 'source': 'Network Data', 'target': 'Empty'}} ] """ from jinja2 import Template from IPython.core.display import display, HTML STYLES=set_styles(style_file) # Load style file if none available if isinstance(style, str): # Specified by name style = STYLES[style] if network is None: nodes = def_nodes edges = def_edges else: nodes = network['elements']['nodes'] edges = network['elements']['edges'] path = os.path.abspath(os.path.dirname(__file__)) + '/' + HTML_TEMPLATE_FILE template = Template(open(path).read()) cyjs_widget = template.render( nodes=json.dumps(nodes), edges=json.dumps(edges), background=background, uuid="cy" + str(uuid.uuid4()), widget_width=str(width), widget_height=str(height), layout=layout_algorithm, style_json=json.dumps(style) ) display(HTML(cyjs_widget))
[ "def", "render", "(", "network", ",", "style", "=", "DEF_STYLE", ",", "layout_algorithm", "=", "DEF_LAYOUT", ",", "background", "=", "DEF_BACKGROUND_COLOR", ",", "height", "=", "DEF_HEIGHT", ",", "width", "=", "DEF_WIDTH", ",", "style_file", "=", "STYLE_FILE", ",", "def_nodes", "=", "DEF_NODES", ",", "def_edges", "=", "DEF_EDGES", ")", ":", "from", "jinja2", "import", "Template", "from", "IPython", ".", "core", ".", "display", "import", "display", ",", "HTML", "STYLES", "=", "set_styles", "(", "style_file", ")", "# Load style file if none available", "if", "isinstance", "(", "style", ",", "str", ")", ":", "# Specified by name", "style", "=", "STYLES", "[", "style", "]", "if", "network", "is", "None", ":", "nodes", "=", "def_nodes", "edges", "=", "def_edges", "else", ":", "nodes", "=", "network", "[", "'elements'", "]", "[", "'nodes'", "]", "edges", "=", "network", "[", "'elements'", "]", "[", "'edges'", "]", "path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "+", "'/'", "+", "HTML_TEMPLATE_FILE", "template", "=", "Template", "(", "open", "(", "path", ")", ".", "read", "(", ")", ")", "cyjs_widget", "=", "template", ".", "render", "(", "nodes", "=", "json", ".", "dumps", "(", "nodes", ")", ",", "edges", "=", "json", ".", "dumps", "(", "edges", ")", ",", "background", "=", "background", ",", "uuid", "=", "\"cy\"", "+", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", ",", "widget_width", "=", "str", "(", "width", ")", ",", "widget_height", "=", "str", "(", "height", ")", ",", "layout", "=", "layout_algorithm", ",", "style_json", "=", "json", ".", "dumps", "(", "style", ")", ")", "display", "(", "HTML", "(", "cyjs_widget", ")", ")" ]
Render network data with embedded Cytoscape.js widget. :param network: dict (required) The network data should be in Cytoscape.js JSON format. :param style: str or dict If str, pick one of the preset style. [default: 'default'] If dict, it should be Cytoscape.js style CSS object :param layout_algorithm: str Name of Cytoscape.js layout algorithm :param background: str Background in CSS format :param height: int Height of the widget. :param width: int Width of the widget. :param style_file: a styles file. [default: 'default_style.json'] :param def_nodes: default: [ {'data': {'id': 'Network Data'}}, {'data': {'id': 'Empty'}} ] :param def_edges: default: [ {'data': {'id': 'is', 'source': 'Network Data', 'target': 'Empty'}} ]
[ "Render", "network", "data", "with", "embedded", "Cytoscape", ".", "js", "widget", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cytoscapejs/viewer.py#L57-L118
12,027
cytoscape/py2cytoscape
py2cytoscape/cyrest/edge.py
edge.create_attribute
def create_attribute(self,column=None,listType=None,namespace=None, network=None, atype=None, verbose=False): """ Creates a new edge column. :param column (string, optional): Unique name of column :param listType (string, optional): Can be one of integer, long, double, or string. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param atype (string, optional): Can be one of integer, long, double, string, or list. :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["column","listType","namespace","network","type"],[column,listType,namespace,network,atype]) response=api(url=self.__url+"/create attribute", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def create_attribute(self,column=None,listType=None,namespace=None, network=None, atype=None, verbose=False): """ Creates a new edge column. :param column (string, optional): Unique name of column :param listType (string, optional): Can be one of integer, long, double, or string. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param atype (string, optional): Can be one of integer, long, double, string, or list. :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["column","listType","namespace","network","type"],[column,listType,namespace,network,atype]) response=api(url=self.__url+"/create attribute", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "create_attribute", "(", "self", ",", "column", "=", "None", ",", "listType", "=", "None", ",", "namespace", "=", "None", ",", "network", "=", "None", ",", "atype", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"column\"", ",", "\"listType\"", ",", "\"namespace\"", ",", "\"network\"", ",", "\"type\"", "]", ",", "[", "column", ",", "listType", ",", "namespace", ",", "network", ",", "atype", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/create attribute\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Creates a new edge column. :param column (string, optional): Unique name of column :param listType (string, optional): Can be one of integer, long, double, or string. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param atype (string, optional): Can be one of integer, long, double, string, or list. :param verbose: print more
[ "Creates", "a", "new", "edge", "column", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/edge.py#L13-L35
12,028
cytoscape/py2cytoscape
py2cytoscape/cyrest/edge.py
edge.get
def get(self,edge=None,network=None,sourceNode=None, targetNode=None, atype=None, verbose=False): """ Returns the SUID of an edge that matches the passed parameters. If multiple edges are found, only one will be returned, and a warning will be reported in the Cytoscape Task History dialog. :param edge (string, optional): Selects an edge by name, or, if the parameter has the prefix suid:, selects an edge by SUID. If this parameter is set, all other edge matching parameters are ignored. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param sourceNode (string, optional): Selects a node by name, or, if the parameter has the prefix suid:, selects a node by SUID. Specifies that the edge matched must have this node as its source. This parameter must be used with the targetNode parameter to produce results. :param targetNode (string, optional): Selects a node by name, or, if the parameter has the prefix suid:, selects a node by SUID. Specifies that the edge matched must have this node as its target. This parameter must be used with the sourceNode parameter to produce results. :param atype (string, optional): Specifies that the edge matched must be of the specified type. This parameter must be used with the sourceNode and targetNode parameters to produce results. :param verbose: print more :returns: {"columnName": columnName } """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["edge","network","sourceNode","targetNode","type"],[edge,network,sourceNode,targetNode,atype]) response=api(url=self.__url+"/get", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def get(self,edge=None,network=None,sourceNode=None, targetNode=None, atype=None, verbose=False): """ Returns the SUID of an edge that matches the passed parameters. If multiple edges are found, only one will be returned, and a warning will be reported in the Cytoscape Task History dialog. :param edge (string, optional): Selects an edge by name, or, if the parameter has the prefix suid:, selects an edge by SUID. If this parameter is set, all other edge matching parameters are ignored. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param sourceNode (string, optional): Selects a node by name, or, if the parameter has the prefix suid:, selects a node by SUID. Specifies that the edge matched must have this node as its source. This parameter must be used with the targetNode parameter to produce results. :param targetNode (string, optional): Selects a node by name, or, if the parameter has the prefix suid:, selects a node by SUID. Specifies that the edge matched must have this node as its target. This parameter must be used with the sourceNode parameter to produce results. :param atype (string, optional): Specifies that the edge matched must be of the specified type. This parameter must be used with the sourceNode and targetNode parameters to produce results. :param verbose: print more :returns: {"columnName": columnName } """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["edge","network","sourceNode","targetNode","type"],[edge,network,sourceNode,targetNode,atype]) response=api(url=self.__url+"/get", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "get", "(", "self", ",", "edge", "=", "None", ",", "network", "=", "None", ",", "sourceNode", "=", "None", ",", "targetNode", "=", "None", ",", "atype", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"edge\"", ",", "\"network\"", ",", "\"sourceNode\"", ",", "\"targetNode\"", ",", "\"type\"", "]", ",", "[", "edge", ",", "network", ",", "sourceNode", ",", "targetNode", ",", "atype", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/get\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns the SUID of an edge that matches the passed parameters. If multiple edges are found, only one will be returned, and a warning will be reported in the Cytoscape Task History dialog. :param edge (string, optional): Selects an edge by name, or, if the parameter has the prefix suid:, selects an edge by SUID. If this parameter is set, all other edge matching parameters are ignored. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param sourceNode (string, optional): Selects a node by name, or, if the parameter has the prefix suid:, selects a node by SUID. Specifies that the edge matched must have this node as its source. This parameter must be used with the targetNode parameter to produce results. :param targetNode (string, optional): Selects a node by name, or, if the parameter has the prefix suid:, selects a node by SUID. Specifies that the edge matched must have this node as its target. This parameter must be used with the sourceNode parameter to produce results. :param atype (string, optional): Specifies that the edge matched must be of the specified type. This parameter must be used with the sourceNode and targetNode parameters to produce results. :param verbose: print more :returns: {"columnName": columnName }
[ "Returns", "the", "SUID", "of", "an", "edge", "that", "matches", "the", "passed", "parameters", ".", "If", "multiple", "edges", "are", "found", "only", "one", "will", "be", "returned", "and", "a", "warning", "will", "be", "reported", "in", "the", "Cytoscape", "Task", "History", "dialog", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/edge.py#L37-L68
12,029
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.add_edge
def add_edge(self, isDirected=None,name=None,network=None,sourceName=None,targetName=None, verbose=False): """ Add a new edge between two existing nodes in a network. The names of the nodes must be specified and much match the value in the 'name' column for each node. :param isDirected (string, optional): Whether the edge should be directed or not. Even though all edges in Cytoscape have a source and target, by default they are treated as undirected. Setting this to 'true' will flag some algorithms to treat them as directed, although many current implementations will ignore this flag. :param name (string, optional): Set the 'name' and 'shared name' columns for this edge to the provided value. , :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param sourceName (string): Enter the name of an existing node in the network to be the source of the edge. Note that this is the name as defined in the 'name' column of the network. :param targetName (string): Enter the name of an existing node in the network to be the target of the edge. Note that this is the name as defined in the 'name' column of the network. :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["isDirected","name","network","sourceName","targetName"],\ [isDirected,name,network,sourceName,targetName]) response=api(url=self.__url+"/add edge", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def add_edge(self, isDirected=None,name=None,network=None,sourceName=None,targetName=None, verbose=False): """ Add a new edge between two existing nodes in a network. The names of the nodes must be specified and much match the value in the 'name' column for each node. :param isDirected (string, optional): Whether the edge should be directed or not. Even though all edges in Cytoscape have a source and target, by default they are treated as undirected. Setting this to 'true' will flag some algorithms to treat them as directed, although many current implementations will ignore this flag. :param name (string, optional): Set the 'name' and 'shared name' columns for this edge to the provided value. , :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param sourceName (string): Enter the name of an existing node in the network to be the source of the edge. Note that this is the name as defined in the 'name' column of the network. :param targetName (string): Enter the name of an existing node in the network to be the target of the edge. Note that this is the name as defined in the 'name' column of the network. :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["isDirected","name","network","sourceName","targetName"],\ [isDirected,name,network,sourceName,targetName]) response=api(url=self.__url+"/add edge", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "add_edge", "(", "self", ",", "isDirected", "=", "None", ",", "name", "=", "None", ",", "network", "=", "None", ",", "sourceName", "=", "None", ",", "targetName", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"isDirected\"", ",", "\"name\"", ",", "\"network\"", ",", "\"sourceName\"", ",", "\"targetName\"", "]", ",", "[", "isDirected", ",", "name", ",", "network", ",", "sourceName", ",", "targetName", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/add edge\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Add a new edge between two existing nodes in a network. The names of the nodes must be specified and much match the value in the 'name' column for each node. :param isDirected (string, optional): Whether the edge should be directed or not. Even though all edges in Cytoscape have a source and target, by default they are treated as undirected. Setting this to 'true' will flag some algorithms to treat them as directed, although many current implementations will ignore this flag. :param name (string, optional): Set the 'name' and 'shared name' columns for this edge to the provided value. , :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param sourceName (string): Enter the name of an existing node in the network to be the source of the edge. Note that this is the name as defined in the 'name' column of the network. :param targetName (string): Enter the name of an existing node in the network to be the target of the edge. Note that this is the name as defined in the 'name' column of the network. :param verbose: print more
[ "Add", "a", "new", "edge", "between", "two", "existing", "nodes", "in", "a", "network", ".", "The", "names", "of", "the", "nodes", "must", "be", "specified", "and", "much", "match", "the", "value", "in", "the", "name", "column", "for", "each", "node", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L45-L73
12,030
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.create
def create(self, edgeList=None, excludeEdges=None, networkName=None, nodeList=None, source=None, verbose=False): """ Create a new network from a list of nodes and edges in an existing source network. The SUID of the network and view are returned. :param edgeList (string, optional): Specifies a list of edges. The keywords all, selected, or unselected can be used to specify edges by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param excludeEdges (string, optional): Unless this is set to true, edges that connect nodes in the nodeList are implicitly included :param networkName (string, optional): :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param source (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: { netowrk, view } """ network=check_network(self,source, verbose=verbose) PARAMS=set_param(["edgeList","excludeEdges","networkName","nodeList","source"], \ [edgeList,excludeEdges,networkName,nodeList,network]) response=api(url=self.__url+"/create", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def create(self, edgeList=None, excludeEdges=None, networkName=None, nodeList=None, source=None, verbose=False): """ Create a new network from a list of nodes and edges in an existing source network. The SUID of the network and view are returned. :param edgeList (string, optional): Specifies a list of edges. The keywords all, selected, or unselected can be used to specify edges by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param excludeEdges (string, optional): Unless this is set to true, edges that connect nodes in the nodeList are implicitly included :param networkName (string, optional): :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param source (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: { netowrk, view } """ network=check_network(self,source, verbose=verbose) PARAMS=set_param(["edgeList","excludeEdges","networkName","nodeList","source"], \ [edgeList,excludeEdges,networkName,nodeList,network]) response=api(url=self.__url+"/create", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "create", "(", "self", ",", "edgeList", "=", "None", ",", "excludeEdges", "=", "None", ",", "networkName", "=", "None", ",", "nodeList", "=", "None", ",", "source", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "source", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"edgeList\"", ",", "\"excludeEdges\"", ",", "\"networkName\"", ",", "\"nodeList\"", ",", "\"source\"", "]", ",", "[", "edgeList", ",", "excludeEdges", ",", "networkName", ",", "nodeList", ",", "network", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/create\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Create a new network from a list of nodes and edges in an existing source network. The SUID of the network and view are returned. :param edgeList (string, optional): Specifies a list of edges. The keywords all, selected, or unselected can be used to specify edges by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param excludeEdges (string, optional): Unless this is set to true, edges that connect nodes in the nodeList are implicitly included :param networkName (string, optional): :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param source (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: { netowrk, view }
[ "Create", "a", "new", "network", "from", "a", "list", "of", "nodes", "and", "edges", "in", "an", "existing", "source", "network", ".", "The", "SUID", "of", "the", "network", "and", "view", "are", "returned", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L137-L170
12,031
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.create_empty
def create_empty(self, name=None, renderers=None, RootNetworkList=None, verbose=False): """ Create a new, empty network. The new network may be created as part of an existing network collection or a new network collection. :param name (string, optional): Enter the name of the new network. :param renderers (string, optional): Select the renderer to use for the new network view. By default, the standard Cytoscape 2D renderer (Ding) will be used = [''], :param RootNetworkList (string, optional): Choose the network collection the new network should be part of. If no network collection is selected, a new network collection is created. = [' -- Create new network collection --', 'cy:command_documentation_generation'] :param verbose: print more """ PARAMS=set_param(["name","renderers","RootNetworkList"],[name,renderers,RootNetworkList]) response=api(url=self.__url+"/create empty", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def create_empty(self, name=None, renderers=None, RootNetworkList=None, verbose=False): """ Create a new, empty network. The new network may be created as part of an existing network collection or a new network collection. :param name (string, optional): Enter the name of the new network. :param renderers (string, optional): Select the renderer to use for the new network view. By default, the standard Cytoscape 2D renderer (Ding) will be used = [''], :param RootNetworkList (string, optional): Choose the network collection the new network should be part of. If no network collection is selected, a new network collection is created. = [' -- Create new network collection --', 'cy:command_documentation_generation'] :param verbose: print more """ PARAMS=set_param(["name","renderers","RootNetworkList"],[name,renderers,RootNetworkList]) response=api(url=self.__url+"/create empty", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "create_empty", "(", "self", ",", "name", "=", "None", ",", "renderers", "=", "None", ",", "RootNetworkList", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"name\"", ",", "\"renderers\"", ",", "\"RootNetworkList\"", "]", ",", "[", "name", ",", "renderers", ",", "RootNetworkList", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/create empty\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Create a new, empty network. The new network may be created as part of an existing network collection or a new network collection. :param name (string, optional): Enter the name of the new network. :param renderers (string, optional): Select the renderer to use for the new network view. By default, the standard Cytoscape 2D renderer (Ding) will be used = [''], :param RootNetworkList (string, optional): Choose the network collection the new network should be part of. If no network collection is selected, a new network collection is created. = [' -- Create new network collection --', 'cy:command_documentation_generation'] :param verbose: print more
[ "Create", "a", "new", "empty", "network", ".", "The", "new", "network", "may", "be", "created", "as", "part", "of", "an", "existing", "network", "collection", "or", "a", "new", "network", "collection", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L201-L218
12,032
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.list
def list(self, verbose=False): """ List all of the networks in the current session. :param verbose: print more :returns: [ list of network suids ] """ response=api(url=self.__url+"/list", method="POST", verbose=verbose) return response
python
def list(self, verbose=False): """ List all of the networks in the current session. :param verbose: print more :returns: [ list of network suids ] """ response=api(url=self.__url+"/list", method="POST", verbose=verbose) return response
[ "def", "list", "(", "self", ",", "verbose", "=", "False", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/list\"", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
List all of the networks in the current session. :param verbose: print more :returns: [ list of network suids ]
[ "List", "all", "of", "the", "networks", "in", "the", "current", "session", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L532-L542
12,033
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.list_attributes
def list_attributes(self, namespace=None, network=None, verbose=False): """ Returns a list of column names assocated with a network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: [ list of column names assocated with a network ] """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["namespace","network"],[namespace,network]) response=api(url=self.__url+"/list attributes", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def list_attributes(self, namespace=None, network=None, verbose=False): """ Returns a list of column names assocated with a network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: [ list of column names assocated with a network ] """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["namespace","network"],[namespace,network]) response=api(url=self.__url+"/list attributes", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "list_attributes", "(", "self", ",", "namespace", "=", "None", ",", "network", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"namespace\"", ",", "\"network\"", "]", ",", "[", "namespace", ",", "network", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/list attributes\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns a list of column names assocated with a network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: [ list of column names assocated with a network ]
[ "Returns", "a", "list", "of", "column", "names", "assocated", "with", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L544-L562
12,034
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.rename
def rename(self, name=None, sourceNetwork=None, verbose=False): """ Rename an existing network. The SUID of the network is returned :param name (string): Enter a new title for the network :param sourceNetwork (string): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: SUID of the network is returned """ sourceNetwork=check_network(self,sourceNetwork,verbose=verbose) PARAMS=set_param(["name","sourceNetwork"],[name,sourceNetwork]) response=api(url=self.__url+"/rename", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def rename(self, name=None, sourceNetwork=None, verbose=False): """ Rename an existing network. The SUID of the network is returned :param name (string): Enter a new title for the network :param sourceNetwork (string): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: SUID of the network is returned """ sourceNetwork=check_network(self,sourceNetwork,verbose=verbose) PARAMS=set_param(["name","sourceNetwork"],[name,sourceNetwork]) response=api(url=self.__url+"/rename", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "rename", "(", "self", ",", "name", "=", "None", ",", "sourceNetwork", "=", "None", ",", "verbose", "=", "False", ")", ":", "sourceNetwork", "=", "check_network", "(", "self", ",", "sourceNetwork", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"name\"", ",", "\"sourceNetwork\"", "]", ",", "[", "name", ",", "sourceNetwork", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/rename\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Rename an existing network. The SUID of the network is returned :param name (string): Enter a new title for the network :param sourceNetwork (string): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param verbose: print more :returns: SUID of the network is returned
[ "Rename", "an", "existing", "network", ".", "The", "SUID", "of", "the", "network", "is", "returned" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L619-L634
12,035
cytoscape/py2cytoscape
py2cytoscape/cyrest/session.py
session.new
def new(self, verbose=False): """ Destroys the current session and creates a new, empty one. :param wid: Window ID :param verbose: print more """ response=api(url=self.__url+"/new", verbose=verbose) return response
python
def new(self, verbose=False): """ Destroys the current session and creates a new, empty one. :param wid: Window ID :param verbose: print more """ response=api(url=self.__url+"/new", verbose=verbose) return response
[ "def", "new", "(", "self", ",", "verbose", "=", "False", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/new\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Destroys the current session and creates a new, empty one. :param wid: Window ID :param verbose: print more
[ "Destroys", "the", "current", "session", "and", "creates", "a", "new", "empty", "one", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/session.py#L14-L23
12,036
cytoscape/py2cytoscape
py2cytoscape/cyrest/session.py
session.open
def open(self, session_file=None,session_url=None, verbose=False): """ Opens a session from a local file or URL. :param session_file: The path to the session file (.cys) to be loaded. :param session_url: A URL that provides a session file. :param verbose: print more """ PARAMS=set_param(["file", "url"],[session_file, session_url]) response=api(url=self.__url+"/open", PARAMS=PARAMS, verbose=verbose) return response
python
def open(self, session_file=None,session_url=None, verbose=False): """ Opens a session from a local file or URL. :param session_file: The path to the session file (.cys) to be loaded. :param session_url: A URL that provides a session file. :param verbose: print more """ PARAMS=set_param(["file", "url"],[session_file, session_url]) response=api(url=self.__url+"/open", PARAMS=PARAMS, verbose=verbose) return response
[ "def", "open", "(", "self", ",", "session_file", "=", "None", ",", "session_url", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"file\"", ",", "\"url\"", "]", ",", "[", "session_file", ",", "session_url", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/open\"", ",", "PARAMS", "=", "PARAMS", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Opens a session from a local file or URL. :param session_file: The path to the session file (.cys) to be loaded. :param session_url: A URL that provides a session file. :param verbose: print more
[ "Opens", "a", "session", "from", "a", "local", "file", "or", "URL", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/session.py#L26-L37
12,037
cytoscape/py2cytoscape
py2cytoscape/cyrest/session.py
session.save
def save(self, session_file, verbose=False): """ Saves the current session to an existing file, which will be replaced. If this is a new session that has not been saved yet, use 'save as' instead. :param session_file: The path to the file where the current session must be saved to. :param verbose: print more """ PARAMS={"file":session_file} response=api(url=self.__url+"/save", PARAMS=PARAMS, verbose=verbose) return response
python
def save(self, session_file, verbose=False): """ Saves the current session to an existing file, which will be replaced. If this is a new session that has not been saved yet, use 'save as' instead. :param session_file: The path to the file where the current session must be saved to. :param verbose: print more """ PARAMS={"file":session_file} response=api(url=self.__url+"/save", PARAMS=PARAMS, verbose=verbose) return response
[ "def", "save", "(", "self", ",", "session_file", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "\"file\"", ":", "session_file", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/save\"", ",", "PARAMS", "=", "PARAMS", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Saves the current session to an existing file, which will be replaced. If this is a new session that has not been saved yet, use 'save as' instead. :param session_file: The path to the file where the current session must be saved to. :param verbose: print more
[ "Saves", "the", "current", "session", "to", "an", "existing", "file", "which", "will", "be", "replaced", ".", "If", "this", "is", "a", "new", "session", "that", "has", "not", "been", "saved", "yet", "use", "save", "as", "instead", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/session.py#L40-L54
12,038
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.apply
def apply(self, styles=None, verbose=False): """ Applies the specified style to the selected views and returns the SUIDs of the affected views. :param styles (string): Name of Style to be applied to the selected views. = ['Directed', 'BioPAX_SIF', 'Bridging Reads Histogram:unique_0', 'PSIMI 25 Style', 'Coverage Histogram:best&unique', 'Minimal', 'Bridging Reads Histogram:best&unique_0', 'Coverage Histogram_0', 'Big Labels', 'No Histogram:best&unique_0', 'Bridging Reads Histogram:best', 'No Histogram_0', 'No Histogram:best&unique', 'Bridging Reads Histogram_0', 'Ripple', 'Coverage Histogram:unique_0', 'Nested Network Style', 'Coverage Histogram:best', 'Coverage Histogram:best&unique_0', 'default black', 'No Histogram:best_0', 'No Histogram:unique', 'No Histogram:unique_0', 'Solid', 'Bridging Reads Histogram:unique', 'No Histogram:best', 'Coverage Histogram', 'BioPAX', 'Bridging Reads Histogram', 'Coverage Histogram:best_0', 'Sample1', 'Universe', 'Bridging Reads Histogram:best_0', 'Coverage Histogram:unique', 'Bridging Reads Histogram:best&unique', 'No Histogram', 'default'] :param verbose: print more :returns: SUIDs of the affected views """ PARAMS=set_param(["styles"],[styles]) response=api(url=self.__url+"/apply", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def apply(self, styles=None, verbose=False): """ Applies the specified style to the selected views and returns the SUIDs of the affected views. :param styles (string): Name of Style to be applied to the selected views. = ['Directed', 'BioPAX_SIF', 'Bridging Reads Histogram:unique_0', 'PSIMI 25 Style', 'Coverage Histogram:best&unique', 'Minimal', 'Bridging Reads Histogram:best&unique_0', 'Coverage Histogram_0', 'Big Labels', 'No Histogram:best&unique_0', 'Bridging Reads Histogram:best', 'No Histogram_0', 'No Histogram:best&unique', 'Bridging Reads Histogram_0', 'Ripple', 'Coverage Histogram:unique_0', 'Nested Network Style', 'Coverage Histogram:best', 'Coverage Histogram:best&unique_0', 'default black', 'No Histogram:best_0', 'No Histogram:unique', 'No Histogram:unique_0', 'Solid', 'Bridging Reads Histogram:unique', 'No Histogram:best', 'Coverage Histogram', 'BioPAX', 'Bridging Reads Histogram', 'Coverage Histogram:best_0', 'Sample1', 'Universe', 'Bridging Reads Histogram:best_0', 'Coverage Histogram:unique', 'Bridging Reads Histogram:best&unique', 'No Histogram', 'default'] :param verbose: print more :returns: SUIDs of the affected views """ PARAMS=set_param(["styles"],[styles]) response=api(url=self.__url+"/apply", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "apply", "(", "self", ",", "styles", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"styles\"", "]", ",", "[", "styles", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/apply\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Applies the specified style to the selected views and returns the SUIDs of the affected views. :param styles (string): Name of Style to be applied to the selected views. = ['Directed', 'BioPAX_SIF', 'Bridging Reads Histogram:unique_0', 'PSIMI 25 Style', 'Coverage Histogram:best&unique', 'Minimal', 'Bridging Reads Histogram:best&unique_0', 'Coverage Histogram_0', 'Big Labels', 'No Histogram:best&unique_0', 'Bridging Reads Histogram:best', 'No Histogram_0', 'No Histogram:best&unique', 'Bridging Reads Histogram_0', 'Ripple', 'Coverage Histogram:unique_0', 'Nested Network Style', 'Coverage Histogram:best', 'Coverage Histogram:best&unique_0', 'default black', 'No Histogram:best_0', 'No Histogram:unique', 'No Histogram:unique_0', 'Solid', 'Bridging Reads Histogram:unique', 'No Histogram:best', 'Coverage Histogram', 'BioPAX', 'Bridging Reads Histogram', 'Coverage Histogram:best_0', 'Sample1', 'Universe', 'Bridging Reads Histogram:best_0', 'Coverage Histogram:unique', 'Bridging Reads Histogram:best&unique', 'No Histogram', 'default'] :param verbose: print more :returns: SUIDs of the affected views
[ "Applies", "the", "specified", "style", "to", "the", "selected", "views", "and", "returns", "the", "SUIDs", "of", "the", "affected", "views", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L13-L39
12,039
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.create_style
def create_style(self,title=None,defaults=None,mappings=None,verbose=VERBOSE): """ Creates a new visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :param host: cytoscape host address, default=cytoscape_host :param port: cytoscape port, default=1234 :returns: nothing """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if defaults: defaults_=[] for d in defaults: if d: defaults_.append(d) defaults=defaults_ if mappings: mappings_=[] for m in mappings: if m: mappings_.append(m) mappings=mappings_ try: update_style(title=title,defaults=defaults,mappings=mappings,host=host,port=port) print("Existing style was updated.") sys.stdout.flush() except: print("Creating new style.") sys.stdout.flush() URL="http://"+str(host)+":"+str(port)+"/v1/styles" PARAMS={"title":title,\ "defaults":defaults,\ "mappings":mappings} r = requests.post(url = URL, json = PARAMS) checkresponse(r)
python
def create_style(self,title=None,defaults=None,mappings=None,verbose=VERBOSE): """ Creates a new visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :param host: cytoscape host address, default=cytoscape_host :param port: cytoscape port, default=1234 :returns: nothing """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if defaults: defaults_=[] for d in defaults: if d: defaults_.append(d) defaults=defaults_ if mappings: mappings_=[] for m in mappings: if m: mappings_.append(m) mappings=mappings_ try: update_style(title=title,defaults=defaults,mappings=mappings,host=host,port=port) print("Existing style was updated.") sys.stdout.flush() except: print("Creating new style.") sys.stdout.flush() URL="http://"+str(host)+":"+str(port)+"/v1/styles" PARAMS={"title":title,\ "defaults":defaults,\ "mappings":mappings} r = requests.post(url = URL, json = PARAMS) checkresponse(r)
[ "def", "create_style", "(", "self", ",", "title", "=", "None", ",", "defaults", "=", "None", ",", "mappings", "=", "None", ",", "verbose", "=", "VERBOSE", ")", ":", "u", "=", "self", ".", "__url", "host", "=", "u", ".", "split", "(", "\"//\"", ")", "[", "1", "]", ".", "split", "(", "\":\"", ")", "[", "0", "]", "port", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "0", "]", "version", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "1", "]", "if", "defaults", ":", "defaults_", "=", "[", "]", "for", "d", "in", "defaults", ":", "if", "d", ":", "defaults_", ".", "append", "(", "d", ")", "defaults", "=", "defaults_", "if", "mappings", ":", "mappings_", "=", "[", "]", "for", "m", "in", "mappings", ":", "if", "m", ":", "mappings_", ".", "append", "(", "m", ")", "mappings", "=", "mappings_", "try", ":", "update_style", "(", "title", "=", "title", ",", "defaults", "=", "defaults", ",", "mappings", "=", "mappings", ",", "host", "=", "host", ",", "port", "=", "port", ")", "print", "(", "\"Existing style was updated.\"", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "except", ":", "print", "(", "\"Creating new style.\"", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "URL", "=", "\"http://\"", "+", "str", "(", "host", ")", "+", "\":\"", "+", "str", "(", "port", ")", "+", "\"/v1/styles\"", "PARAMS", "=", "{", "\"title\"", ":", "title", ",", "\"defaults\"", ":", "defaults", ",", "\"mappings\"", ":", "mappings", "}", "r", "=", "requests", ".", "post", "(", "url", "=", "URL", ",", "json", "=", "PARAMS", ")", "checkresponse", "(", "r", ")" ]
Creates a new visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :param host: cytoscape host address, default=cytoscape_host :param port: cytoscape port, default=1234 :returns: nothing
[ "Creates", "a", "new", "visual", "style" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L86-L129
12,040
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.update_style
def update_style(self, title=None,defaults=None,mappings=None, verbose=False): """ Updates a visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :returns: nothing """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if defaults: defaults_=[] for d in defaults: if d: defaults_.append(d) defaults=defaults_ if mappings: mappings_=[] for m in mappings: if m: mappings_.append(m) mappings=mappings_ URL="http://"+str(host)+":"+str(port)+"/v1/styles/"+str(title) if verbose: print(URL) sys.stdout.flush() response = requests.get(URL).json() olddefaults=response["defaults"] oldmappings=response["mappings"] if mappings: mappings_visual_properties=[ m["visualProperty"] for m in mappings ] newmappings=[ m for m in oldmappings if m["visualProperty"] not in mappings_visual_properties ] for m in mappings: newmappings.append(m) else: newmappings=oldmappings if defaults: defaults_visual_properties=[ m["visualProperty"] for m in defaults ] newdefaults=[ m for m in olddefaults if m["visualProperty"] not in defaults_visual_properties ] for m in defaults: newdefaults.append(m) else: newdefaults=olddefaults r=requests.delete(URL) checkresponse(r) URL="http://"+str(host)+":"+str(port)+"/v1/styles" PARAMS={"title":title,\ "defaults":newdefaults,\ "mappings":newmappings} r = requests.post(url = URL, json = PARAMS) checkresponse(r)
python
def update_style(self, title=None,defaults=None,mappings=None, verbose=False): """ Updates a visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :returns: nothing """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if defaults: defaults_=[] for d in defaults: if d: defaults_.append(d) defaults=defaults_ if mappings: mappings_=[] for m in mappings: if m: mappings_.append(m) mappings=mappings_ URL="http://"+str(host)+":"+str(port)+"/v1/styles/"+str(title) if verbose: print(URL) sys.stdout.flush() response = requests.get(URL).json() olddefaults=response["defaults"] oldmappings=response["mappings"] if mappings: mappings_visual_properties=[ m["visualProperty"] for m in mappings ] newmappings=[ m for m in oldmappings if m["visualProperty"] not in mappings_visual_properties ] for m in mappings: newmappings.append(m) else: newmappings=oldmappings if defaults: defaults_visual_properties=[ m["visualProperty"] for m in defaults ] newdefaults=[ m for m in olddefaults if m["visualProperty"] not in defaults_visual_properties ] for m in defaults: newdefaults.append(m) else: newdefaults=olddefaults r=requests.delete(URL) checkresponse(r) URL="http://"+str(host)+":"+str(port)+"/v1/styles" PARAMS={"title":title,\ "defaults":newdefaults,\ "mappings":newmappings} r = requests.post(url = URL, json = PARAMS) checkresponse(r)
[ "def", "update_style", "(", "self", ",", "title", "=", "None", ",", "defaults", "=", "None", ",", "mappings", "=", "None", ",", "verbose", "=", "False", ")", ":", "u", "=", "self", ".", "__url", "host", "=", "u", ".", "split", "(", "\"//\"", ")", "[", "1", "]", ".", "split", "(", "\":\"", ")", "[", "0", "]", "port", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "0", "]", "version", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "1", "]", "if", "defaults", ":", "defaults_", "=", "[", "]", "for", "d", "in", "defaults", ":", "if", "d", ":", "defaults_", ".", "append", "(", "d", ")", "defaults", "=", "defaults_", "if", "mappings", ":", "mappings_", "=", "[", "]", "for", "m", "in", "mappings", ":", "if", "m", ":", "mappings_", ".", "append", "(", "m", ")", "mappings", "=", "mappings_", "URL", "=", "\"http://\"", "+", "str", "(", "host", ")", "+", "\":\"", "+", "str", "(", "port", ")", "+", "\"/v1/styles/\"", "+", "str", "(", "title", ")", "if", "verbose", ":", "print", "(", "URL", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "response", "=", "requests", ".", "get", "(", "URL", ")", ".", "json", "(", ")", "olddefaults", "=", "response", "[", "\"defaults\"", "]", "oldmappings", "=", "response", "[", "\"mappings\"", "]", "if", "mappings", ":", "mappings_visual_properties", "=", "[", "m", "[", "\"visualProperty\"", "]", "for", "m", "in", "mappings", "]", "newmappings", "=", "[", "m", "for", "m", "in", "oldmappings", "if", "m", "[", "\"visualProperty\"", "]", "not", "in", "mappings_visual_properties", "]", "for", "m", "in", "mappings", ":", "newmappings", ".", "append", "(", "m", ")", "else", ":", "newmappings", "=", "oldmappings", "if", "defaults", ":", "defaults_visual_properties", "=", "[", "m", "[", "\"visualProperty\"", "]", "for", "m", "in", "defaults", "]", "newdefaults", "=", "[", "m", "for", "m", "in", "olddefaults", "if", "m", "[", "\"visualProperty\"", "]", "not", "in", "defaults_visual_properties", "]", "for", "m", "in", "defaults", ":", "newdefaults", ".", "append", "(", "m", ")", "else", ":", "newdefaults", "=", "olddefaults", "r", "=", "requests", ".", "delete", "(", "URL", ")", "checkresponse", "(", "r", ")", "URL", "=", "\"http://\"", "+", "str", "(", "host", ")", "+", "\":\"", "+", "str", "(", "port", ")", "+", "\"/v1/styles\"", "PARAMS", "=", "{", "\"title\"", ":", "title", ",", "\"defaults\"", ":", "newdefaults", ",", "\"mappings\"", ":", "newmappings", "}", "r", "=", "requests", ".", "post", "(", "url", "=", "URL", ",", "json", "=", "PARAMS", ")", "checkresponse", "(", "r", ")" ]
Updates a visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :returns: nothing
[ "Updates", "a", "visual", "style" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L131-L194
12,041
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.simple_defaults
def simple_defaults(self, defaults_dic): """ Simplifies defaults. :param defaults_dic: a dictionary of the form { visualProperty_A:value_A, visualProperty_B:value_B, ..} :returns: a list of dictionaries with each item corresponding to a given key in defaults_dic """ defaults=[] for d in defaults_dic.keys(): dic={} dic["visualProperty"]=d dic["value"]=defaults_dic[d] defaults.append(dic) return defaults
python
def simple_defaults(self, defaults_dic): """ Simplifies defaults. :param defaults_dic: a dictionary of the form { visualProperty_A:value_A, visualProperty_B:value_B, ..} :returns: a list of dictionaries with each item corresponding to a given key in defaults_dic """ defaults=[] for d in defaults_dic.keys(): dic={} dic["visualProperty"]=d dic["value"]=defaults_dic[d] defaults.append(dic) return defaults
[ "def", "simple_defaults", "(", "self", ",", "defaults_dic", ")", ":", "defaults", "=", "[", "]", "for", "d", "in", "defaults_dic", ".", "keys", "(", ")", ":", "dic", "=", "{", "}", "dic", "[", "\"visualProperty\"", "]", "=", "d", "dic", "[", "\"value\"", "]", "=", "defaults_dic", "[", "d", "]", "defaults", ".", "append", "(", "dic", ")", "return", "defaults" ]
Simplifies defaults. :param defaults_dic: a dictionary of the form { visualProperty_A:value_A, visualProperty_B:value_B, ..} :returns: a list of dictionaries with each item corresponding to a given key in defaults_dic
[ "Simplifies", "defaults", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L278-L293
12,042
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.attribute_circle
def attribute_circle(self, EdgeAttribute=None, network=None, \ NodeAttribute=None, nodeList=None, singlePartition=None,\ spacing=None, verbose=False): """ Execute the Attribute Circle Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param singlePartition (string, optional): Don't partition graph before layout, only boolean values allowed: true or false :param spacing (string, optional): Circle size, in numeric value :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["EdgeAttribute","network","NodeAttribute","nodeList","singlePartition","spacing"],\ [EdgeAttribute,network,NodeAttribute,nodeList,singlePartition,spacing]) response=api(url=self.__url+"/attribute-circle", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def attribute_circle(self, EdgeAttribute=None, network=None, \ NodeAttribute=None, nodeList=None, singlePartition=None,\ spacing=None, verbose=False): """ Execute the Attribute Circle Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param singlePartition (string, optional): Don't partition graph before layout, only boolean values allowed: true or false :param spacing (string, optional): Circle size, in numeric value :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["EdgeAttribute","network","NodeAttribute","nodeList","singlePartition","spacing"],\ [EdgeAttribute,network,NodeAttribute,nodeList,singlePartition,spacing]) response=api(url=self.__url+"/attribute-circle", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "attribute_circle", "(", "self", ",", "EdgeAttribute", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "singlePartition", "=", "None", ",", "spacing", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"EdgeAttribute\"", ",", "\"network\"", ",", "\"NodeAttribute\"", ",", "\"nodeList\"", ",", "\"singlePartition\"", ",", "\"spacing\"", "]", ",", "[", "EdgeAttribute", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "singlePartition", ",", "spacing", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/attribute-circle\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Attribute Circle Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param singlePartition (string, optional): Don't partition graph before layout, only boolean values allowed: true or false :param spacing (string, optional): Circle size, in numeric value :param verbose: print more
[ "Execute", "the", "Attribute", "Circle", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L29-L61
12,043
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.attributes_layout
def attributes_layout(self, EdgeAttribute=None, maxwidth=None, minrad=None, \ network=None, NodeAttribute=None,nodeList=None, radmult=None, \ spacingx=None, spacingy=None, verbose=False): """ Execute the Group Attributes Layout on a network :param EdgeAttribute (string, optional): The name of the edge column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param maxwidth (string, optional): Maximum width of a row, in numeric value :param minrad (string, optional): Minimum width of a partition, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param radmult (string, optional): Minimum width of a partition, in numeric value :param spacingx (string, optional): Horizontal spacing between two partitions in a row, in numeric value :param spacingy (string, optional): Vertical spacing between the largest partitions of two rows, in numeric value :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["EdgeAttribute","network","NodeAttribute","nodeList","singlePartition","spacing"],\ [EdgeAttribute, maxwidth, \ minrad, network, NodeAttribute,nodeList, radmult, \ spacingx, spacingy]) response=api(url=self.__url+"/attributes-layout", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def attributes_layout(self, EdgeAttribute=None, maxwidth=None, minrad=None, \ network=None, NodeAttribute=None,nodeList=None, radmult=None, \ spacingx=None, spacingy=None, verbose=False): """ Execute the Group Attributes Layout on a network :param EdgeAttribute (string, optional): The name of the edge column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param maxwidth (string, optional): Maximum width of a row, in numeric value :param minrad (string, optional): Minimum width of a partition, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param radmult (string, optional): Minimum width of a partition, in numeric value :param spacingx (string, optional): Horizontal spacing between two partitions in a row, in numeric value :param spacingy (string, optional): Vertical spacing between the largest partitions of two rows, in numeric value :param verbose: print more """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(["EdgeAttribute","network","NodeAttribute","nodeList","singlePartition","spacing"],\ [EdgeAttribute, maxwidth, \ minrad, network, NodeAttribute,nodeList, radmult, \ spacingx, spacingy]) response=api(url=self.__url+"/attributes-layout", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "attributes_layout", "(", "self", ",", "EdgeAttribute", "=", "None", ",", "maxwidth", "=", "None", ",", "minrad", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "radmult", "=", "None", ",", "spacingx", "=", "None", ",", "spacingy", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"EdgeAttribute\"", ",", "\"network\"", ",", "\"NodeAttribute\"", ",", "\"nodeList\"", ",", "\"singlePartition\"", ",", "\"spacing\"", "]", ",", "[", "EdgeAttribute", ",", "maxwidth", ",", "minrad", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "radmult", ",", "spacingx", ",", "spacingy", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/attributes-layout\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Group Attributes Layout on a network :param EdgeAttribute (string, optional): The name of the edge column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param maxwidth (string, optional): Maximum width of a row, in numeric value :param minrad (string, optional): Minimum width of a partition, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column containing numeric values that will be used as weights in the layout algorithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param radmult (string, optional): Minimum width of a partition, in numeric value :param spacingx (string, optional): Horizontal spacing between two partitions in a row, in numeric value :param spacingy (string, optional): Vertical spacing between the largest partitions of two rows, in numeric value :param verbose: print more
[ "Execute", "the", "Group", "Attributes", "Layout", "on", "a", "network" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L64-L104
12,044
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.circular
def circular(self,EdgeAttribute=None,leftEdge=None,network=None,\ NodeAttribute=None,nodeHorizontalSpacing=None,nodeList=None,\ nodeVerticalSpacing=None,rightMargin=None,singlePartition=None,topEdge=None,\ verbose=None): """ Execute the Circular Layout on a network :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param leftEdge (string, optional): Left edge margin, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value :param rightMargin (string, optional): Right edge margin, in numeric value :param singlePartition (string, optional): Don't partition graph before lay out; only boolean values are allowed: true or false :param topEdge (string, optional): Top edge margin, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','leftEdge','network','NodeAttribute',\ 'nodeHorizontalSpacing','nodeList','nodeVerticalSpacing','rightMargin',\ 'singlePartition','topEdge'],[EdgeAttribute,leftEdge,network,NodeAttribute,\ nodeHorizontalSpacing,nodeList,nodeVerticalSpacing,rightMargin,\ singlePartition,topEdge]) response=api(url=self.__url+"/circular", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def circular(self,EdgeAttribute=None,leftEdge=None,network=None,\ NodeAttribute=None,nodeHorizontalSpacing=None,nodeList=None,\ nodeVerticalSpacing=None,rightMargin=None,singlePartition=None,topEdge=None,\ verbose=None): """ Execute the Circular Layout on a network :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param leftEdge (string, optional): Left edge margin, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value :param rightMargin (string, optional): Right edge margin, in numeric value :param singlePartition (string, optional): Don't partition graph before lay out; only boolean values are allowed: true or false :param topEdge (string, optional): Top edge margin, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','leftEdge','network','NodeAttribute',\ 'nodeHorizontalSpacing','nodeList','nodeVerticalSpacing','rightMargin',\ 'singlePartition','topEdge'],[EdgeAttribute,leftEdge,network,NodeAttribute,\ nodeHorizontalSpacing,nodeList,nodeVerticalSpacing,rightMargin,\ singlePartition,topEdge]) response=api(url=self.__url+"/circular", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "circular", "(", "self", ",", "EdgeAttribute", "=", "None", ",", "leftEdge", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeHorizontalSpacing", "=", "None", ",", "nodeList", "=", "None", ",", "nodeVerticalSpacing", "=", "None", ",", "rightMargin", "=", "None", ",", "singlePartition", "=", "None", ",", "topEdge", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'EdgeAttribute'", ",", "'leftEdge'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeHorizontalSpacing'", ",", "'nodeList'", ",", "'nodeVerticalSpacing'", ",", "'rightMargin'", ",", "'singlePartition'", ",", "'topEdge'", "]", ",", "[", "EdgeAttribute", ",", "leftEdge", ",", "network", ",", "NodeAttribute", ",", "nodeHorizontalSpacing", ",", "nodeList", ",", "nodeVerticalSpacing", ",", "rightMargin", ",", "singlePartition", ",", "topEdge", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/circular\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Circular Layout on a network :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param leftEdge (string, optional): Left edge margin, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value :param rightMargin (string, optional): Right edge margin, in numeric value :param singlePartition (string, optional): Don't partition graph before lay out; only boolean values are allowed: true or false :param topEdge (string, optional): Top edge margin, in numeric value
[ "Execute", "the", "Circular", "Layout", "on", "a", "network" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L106-L146
12,045
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.copycat
def copycat(self,gridUnmapped=None,selectUnmapped=None,sourceColumn=None,\ sourceNetwork=None,targetColumn=None,targetNetwork=None,verbose=None): """ Sets the coordinates for each node in the target network to the coordinates of a matching node in the source network. Optional parameters such as gridUnmapped and selectUnmapped determine the behavior of target network nodes that could not be matched. :param gridUnmapped (string, optional): If this is set to true, any nodes i n the target network that could not be matched to a node in the sour ce network will be laid out in a grid :param selectUnmapped (string, optional): If this is set to true, any nodes in the target network that could not be matched to a node in the so urce network will be selected in the target network :param sourceColumn (string): The name of column in the node table used to match nodes :param sourceNetwork (string): The name of network to get node coordinates from :param targetColumn (string): The name of column in the node table used to match nodes :param targetNetwork (string): The name of the network to apply coordinates to. """ PARAMS=set_param(['gridUnmapped','selectUnmapped','sourceColumn',\ 'sourceNetwork','targetColumn','targetNetwork'],[gridUnmapped,\ selectUnmapped,sourceColumn,sourceNetwork,targetColumn,targetNetwork]) response=api(url=self.__url+"/copycat", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def copycat(self,gridUnmapped=None,selectUnmapped=None,sourceColumn=None,\ sourceNetwork=None,targetColumn=None,targetNetwork=None,verbose=None): """ Sets the coordinates for each node in the target network to the coordinates of a matching node in the source network. Optional parameters such as gridUnmapped and selectUnmapped determine the behavior of target network nodes that could not be matched. :param gridUnmapped (string, optional): If this is set to true, any nodes i n the target network that could not be matched to a node in the sour ce network will be laid out in a grid :param selectUnmapped (string, optional): If this is set to true, any nodes in the target network that could not be matched to a node in the so urce network will be selected in the target network :param sourceColumn (string): The name of column in the node table used to match nodes :param sourceNetwork (string): The name of network to get node coordinates from :param targetColumn (string): The name of column in the node table used to match nodes :param targetNetwork (string): The name of the network to apply coordinates to. """ PARAMS=set_param(['gridUnmapped','selectUnmapped','sourceColumn',\ 'sourceNetwork','targetColumn','targetNetwork'],[gridUnmapped,\ selectUnmapped,sourceColumn,sourceNetwork,targetColumn,targetNetwork]) response=api(url=self.__url+"/copycat", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "copycat", "(", "self", ",", "gridUnmapped", "=", "None", ",", "selectUnmapped", "=", "None", ",", "sourceColumn", "=", "None", ",", "sourceNetwork", "=", "None", ",", "targetColumn", "=", "None", ",", "targetNetwork", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'gridUnmapped'", ",", "'selectUnmapped'", ",", "'sourceColumn'", ",", "'sourceNetwork'", ",", "'targetColumn'", ",", "'targetNetwork'", "]", ",", "[", "gridUnmapped", ",", "selectUnmapped", ",", "sourceColumn", ",", "sourceNetwork", ",", "targetColumn", ",", "targetNetwork", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/copycat\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Sets the coordinates for each node in the target network to the coordinates of a matching node in the source network. Optional parameters such as gridUnmapped and selectUnmapped determine the behavior of target network nodes that could not be matched. :param gridUnmapped (string, optional): If this is set to true, any nodes i n the target network that could not be matched to a node in the sour ce network will be laid out in a grid :param selectUnmapped (string, optional): If this is set to true, any nodes in the target network that could not be matched to a node in the so urce network will be selected in the target network :param sourceColumn (string): The name of column in the node table used to match nodes :param sourceNetwork (string): The name of network to get node coordinates from :param targetColumn (string): The name of column in the node table used to match nodes :param targetNetwork (string): The name of the network to apply coordinates to.
[ "Sets", "the", "coordinates", "for", "each", "node", "in", "the", "target", "network", "to", "the", "coordinates", "of", "a", "matching", "node", "in", "the", "source", "network", ".", "Optional", "parameters", "such", "as", "gridUnmapped", "and", "selectUnmapped", "determine", "the", "behavior", "of", "target", "network", "nodes", "that", "could", "not", "be", "matched", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L148-L175
12,046
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.degree_circle
def degree_circle(self,EdgeAttribute=None,network=None,NodeAttribute=None,\ nodeList=None,singlePartition=None,verbose=None): """ Execute the Degree Sorted Circle Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','network','NodeAttribute','nodeList',\ 'singlePartition'],[EdgeAttribute,network,NodeAttribute,nodeList,\ singlePartition]) response=api(url=self.__url+"/degree-circle", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def degree_circle(self,EdgeAttribute=None,network=None,NodeAttribute=None,\ nodeList=None,singlePartition=None,verbose=None): """ Execute the Degree Sorted Circle Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','network','NodeAttribute','nodeList',\ 'singlePartition'],[EdgeAttribute,network,NodeAttribute,nodeList,\ singlePartition]) response=api(url=self.__url+"/degree-circle", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "degree_circle", "(", "self", ",", "EdgeAttribute", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "singlePartition", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'EdgeAttribute'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeList'", ",", "'singlePartition'", "]", ",", "[", "EdgeAttribute", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "singlePartition", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/degree-circle\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Degree Sorted Circle Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false
[ "Execute", "the", "Degree", "Sorted", "Circle", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L233-L262
12,047
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.force_directed
def force_directed(self,defaultEdgeWeight=None,defaultNodeMass=None,\ defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\ isDeterministic=None,maxWeightCutoff=None,minWeightCutoff=None,network=None,\ NodeAttribute=None,nodeList=None,numIterations=None,singlePartition=None,\ Type=None,verbose=None): """ Execute the Prefuse Force Directed Layout on a network :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param defaultNodeMass (string, optional): Default Node Mass, in numeric va lue :param defaultSpringCoefficient (string, optional): Default Spring Coeffici ent, in numeric value :param defaultSpringLength (string, optional): Default Spring Length, in nu meric value :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param isDeterministic (string, optional): Force deterministic layouts (slo wer); boolean values only, true or false; defaults to false :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param numIterations (string, optional): Number of Iterations, in numeric v alue :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value'] """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['defaultEdgeWeight','defaultNodeMass','defaultSpringCoefficient',\ 'defaultSpringLength','EdgeAttribute','isDeterministic','maxWeightCutoff',\ 'minWeightCutoff','network','NodeAttribute','nodeList','numIterations',\ 'singlePartition','Type'],[defaultEdgeWeight,defaultNodeMass,\ defaultSpringCoefficient,defaultSpringLength,EdgeAttribute,isDeterministic,\ maxWeightCutoff,minWeightCutoff,network,NodeAttribute,nodeList,numIterations,\ singlePartition,Type]) response=api(url=self.__url+"/force-directed", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def force_directed(self,defaultEdgeWeight=None,defaultNodeMass=None,\ defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\ isDeterministic=None,maxWeightCutoff=None,minWeightCutoff=None,network=None,\ NodeAttribute=None,nodeList=None,numIterations=None,singlePartition=None,\ Type=None,verbose=None): """ Execute the Prefuse Force Directed Layout on a network :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param defaultNodeMass (string, optional): Default Node Mass, in numeric va lue :param defaultSpringCoefficient (string, optional): Default Spring Coeffici ent, in numeric value :param defaultSpringLength (string, optional): Default Spring Length, in nu meric value :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param isDeterministic (string, optional): Force deterministic layouts (slo wer); boolean values only, true or false; defaults to false :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param numIterations (string, optional): Number of Iterations, in numeric v alue :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value'] """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['defaultEdgeWeight','defaultNodeMass','defaultSpringCoefficient',\ 'defaultSpringLength','EdgeAttribute','isDeterministic','maxWeightCutoff',\ 'minWeightCutoff','network','NodeAttribute','nodeList','numIterations',\ 'singlePartition','Type'],[defaultEdgeWeight,defaultNodeMass,\ defaultSpringCoefficient,defaultSpringLength,EdgeAttribute,isDeterministic,\ maxWeightCutoff,minWeightCutoff,network,NodeAttribute,nodeList,numIterations,\ singlePartition,Type]) response=api(url=self.__url+"/force-directed", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "force_directed", "(", "self", ",", "defaultEdgeWeight", "=", "None", ",", "defaultNodeMass", "=", "None", ",", "defaultSpringCoefficient", "=", "None", ",", "defaultSpringLength", "=", "None", ",", "EdgeAttribute", "=", "None", ",", "isDeterministic", "=", "None", ",", "maxWeightCutoff", "=", "None", ",", "minWeightCutoff", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "numIterations", "=", "None", ",", "singlePartition", "=", "None", ",", "Type", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'defaultEdgeWeight'", ",", "'defaultNodeMass'", ",", "'defaultSpringCoefficient'", ",", "'defaultSpringLength'", ",", "'EdgeAttribute'", ",", "'isDeterministic'", ",", "'maxWeightCutoff'", ",", "'minWeightCutoff'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeList'", ",", "'numIterations'", ",", "'singlePartition'", ",", "'Type'", "]", ",", "[", "defaultEdgeWeight", ",", "defaultNodeMass", ",", "defaultSpringCoefficient", ",", "defaultSpringLength", ",", "EdgeAttribute", ",", "isDeterministic", ",", "maxWeightCutoff", ",", "minWeightCutoff", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "numIterations", ",", "singlePartition", ",", "Type", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/force-directed\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Prefuse Force Directed Layout on a network :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param defaultNodeMass (string, optional): Default Node Mass, in numeric va lue :param defaultSpringCoefficient (string, optional): Default Spring Coeffici ent, in numeric value :param defaultSpringLength (string, optional): Default Spring Length, in nu meric value :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param isDeterministic (string, optional): Force deterministic layouts (slo wer); boolean values only, true or false; defaults to false :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param numIterations (string, optional): Number of Iterations, in numeric v alue :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value']
[ "Execute", "the", "Prefuse", "Force", "Directed", "Layout", "on", "a", "network" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L265-L321
12,048
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.genemania_force_directed
def genemania_force_directed(self,curveSteepness=None,defaultEdgeWeight=None,\ defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\ ignoreHiddenElements=None,isDeterministic=None,maxNodeMass=None,\ maxWeightCutoff=None,midpointEdges=None,minNodeMass=None,minWeightCutoff=None,\ network=None,NodeAttribute=None,nodeList=None,numIterations=None,\ singlePartition=None,Type=None,verbose=None): """ Execute the GeneMANIA Force Directed Layout on a network. :param curveSteepness (string, optional): :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param defaultSpringCoefficient (string, optional): :param defaultSpringLength (string, optional): :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param ignoreHiddenElements (string, optional): :param isDeterministic (string, optional): :param maxNodeMass (string, optional): :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param midpointEdges (string, optional): :param minNodeMass (string, optional): :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param numIterations (string, optional): :param singlePartition (string, optional): :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value'] """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['curveSteepness','defaultEdgeWeight',\ 'defaultSpringCoefficient','defaultSpringLength','EdgeAttribute',\ 'ignoreHiddenElements','isDeterministic','maxNodeMass','maxWeightCutoff',\ 'midpointEdges','minNodeMass','minWeightCutoff','network','NodeAttribute',\ 'nodeList','numIterations','singlePartition','Type'],[curveSteepness,\ defaultEdgeWeight,defaultSpringCoefficient,defaultSpringLength,EdgeAttribute,\ ignoreHiddenElements,isDeterministic,maxNodeMass,maxWeightCutoff,\ midpointEdges,minNodeMass,minWeightCutoff,network,NodeAttribute,nodeList,\ numIterations,singlePartition,Type]) response=api(url=self.__url+"/genemania-force-directed", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def genemania_force_directed(self,curveSteepness=None,defaultEdgeWeight=None,\ defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\ ignoreHiddenElements=None,isDeterministic=None,maxNodeMass=None,\ maxWeightCutoff=None,midpointEdges=None,minNodeMass=None,minWeightCutoff=None,\ network=None,NodeAttribute=None,nodeList=None,numIterations=None,\ singlePartition=None,Type=None,verbose=None): """ Execute the GeneMANIA Force Directed Layout on a network. :param curveSteepness (string, optional): :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param defaultSpringCoefficient (string, optional): :param defaultSpringLength (string, optional): :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param ignoreHiddenElements (string, optional): :param isDeterministic (string, optional): :param maxNodeMass (string, optional): :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param midpointEdges (string, optional): :param minNodeMass (string, optional): :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param numIterations (string, optional): :param singlePartition (string, optional): :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value'] """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['curveSteepness','defaultEdgeWeight',\ 'defaultSpringCoefficient','defaultSpringLength','EdgeAttribute',\ 'ignoreHiddenElements','isDeterministic','maxNodeMass','maxWeightCutoff',\ 'midpointEdges','minNodeMass','minWeightCutoff','network','NodeAttribute',\ 'nodeList','numIterations','singlePartition','Type'],[curveSteepness,\ defaultEdgeWeight,defaultSpringCoefficient,defaultSpringLength,EdgeAttribute,\ ignoreHiddenElements,isDeterministic,maxNodeMass,maxWeightCutoff,\ midpointEdges,minNodeMass,minWeightCutoff,network,NodeAttribute,nodeList,\ numIterations,singlePartition,Type]) response=api(url=self.__url+"/genemania-force-directed", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "genemania_force_directed", "(", "self", ",", "curveSteepness", "=", "None", ",", "defaultEdgeWeight", "=", "None", ",", "defaultSpringCoefficient", "=", "None", ",", "defaultSpringLength", "=", "None", ",", "EdgeAttribute", "=", "None", ",", "ignoreHiddenElements", "=", "None", ",", "isDeterministic", "=", "None", ",", "maxNodeMass", "=", "None", ",", "maxWeightCutoff", "=", "None", ",", "midpointEdges", "=", "None", ",", "minNodeMass", "=", "None", ",", "minWeightCutoff", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "numIterations", "=", "None", ",", "singlePartition", "=", "None", ",", "Type", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'curveSteepness'", ",", "'defaultEdgeWeight'", ",", "'defaultSpringCoefficient'", ",", "'defaultSpringLength'", ",", "'EdgeAttribute'", ",", "'ignoreHiddenElements'", ",", "'isDeterministic'", ",", "'maxNodeMass'", ",", "'maxWeightCutoff'", ",", "'midpointEdges'", ",", "'minNodeMass'", ",", "'minWeightCutoff'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeList'", ",", "'numIterations'", ",", "'singlePartition'", ",", "'Type'", "]", ",", "[", "curveSteepness", ",", "defaultEdgeWeight", ",", "defaultSpringCoefficient", ",", "defaultSpringLength", ",", "EdgeAttribute", ",", "ignoreHiddenElements", ",", "isDeterministic", ",", "maxNodeMass", ",", "maxWeightCutoff", ",", "midpointEdges", ",", "minNodeMass", ",", "minWeightCutoff", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "numIterations", ",", "singlePartition", ",", "Type", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/genemania-force-directed\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the GeneMANIA Force Directed Layout on a network. :param curveSteepness (string, optional): :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param defaultSpringCoefficient (string, optional): :param defaultSpringLength (string, optional): :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param ignoreHiddenElements (string, optional): :param isDeterministic (string, optional): :param maxNodeMass (string, optional): :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param midpointEdges (string, optional): :param minNodeMass (string, optional): :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param numIterations (string, optional): :param singlePartition (string, optional): :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value']
[ "Execute", "the", "GeneMANIA", "Force", "Directed", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L455-L512
12,049
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.get_preferred
def get_preferred(self,network=None,verbose=None): """ Returns the name of the current preferred layout or empty string if not set. Default is grid. :param network (string, optional): Gets the name of the current preferred l ayout """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['network'],[network]) response=api(url=self.__url+"/get preferred", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def get_preferred(self,network=None,verbose=None): """ Returns the name of the current preferred layout or empty string if not set. Default is grid. :param network (string, optional): Gets the name of the current preferred l ayout """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['network'],[network]) response=api(url=self.__url+"/get preferred", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "get_preferred", "(", "self", ",", "network", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'network'", "]", ",", "[", "network", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/get preferred\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns the name of the current preferred layout or empty string if not set. Default is grid. :param network (string, optional): Gets the name of the current preferred l ayout
[ "Returns", "the", "name", "of", "the", "current", "preferred", "layout", "or", "empty", "string", "if", "not", "set", ".", "Default", "is", "grid", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L515-L526
12,050
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.grid
def grid(self,EdgeAttribute=None,network=None,NodeAttribute=None,\ nodeHorizontalSpacing=None,nodeList=None,nodeVerticalSpacing=None,verbose=None): """ Execute the Grid Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','network','NodeAttribute',\ 'nodeHorizontalSpacing','nodeList','nodeVerticalSpacing'],\ [EdgeAttribute,network,NodeAttribute,nodeHorizontalSpacing,nodeList,\ nodeVerticalSpacing]) response=api(url=self.__url+"/grid", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def grid(self,EdgeAttribute=None,network=None,NodeAttribute=None,\ nodeHorizontalSpacing=None,nodeList=None,nodeVerticalSpacing=None,verbose=None): """ Execute the Grid Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','network','NodeAttribute',\ 'nodeHorizontalSpacing','nodeList','nodeVerticalSpacing'],\ [EdgeAttribute,network,NodeAttribute,nodeHorizontalSpacing,nodeList,\ nodeVerticalSpacing]) response=api(url=self.__url+"/grid", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "grid", "(", "self", ",", "EdgeAttribute", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeHorizontalSpacing", "=", "None", ",", "nodeList", "=", "None", ",", "nodeVerticalSpacing", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'EdgeAttribute'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeHorizontalSpacing'", ",", "'nodeList'", ",", "'nodeVerticalSpacing'", "]", ",", "[", "EdgeAttribute", ",", "network", ",", "NodeAttribute", ",", "nodeHorizontalSpacing", ",", "nodeList", ",", "nodeVerticalSpacing", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/grid\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Grid Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value
[ "Execute", "the", "Grid", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L528-L560
12,051
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.hierarchical
def hierarchical(self,bandGap=None,componentSpacing=None,EdgeAttribute=None,\ leftEdge=None,network=None,NodeAttribute=None,nodeHorizontalSpacing=None,\ nodeList=None,nodeVerticalSpacing=None,rightMargin=None,topEdge=None,\ verbose=None): """ Execute the Hierarchical Layout on a network. :param bandGap (string, optional): Band gap, in numeric value :param componentSpacing (string, optional): Component spacing, in numeric v alue :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param leftEdge (string, optional): Left edge margin, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value :param rightMargin (string, optional): Right edge margin, in numeric value :param topEdge (string, optional): Top edge margin, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['bandGap','componentSpacing','EdgeAttribute','leftEdge',\ 'network','NodeAttribute','nodeHorizontalSpacing','nodeList',\ 'nodeVerticalSpacing','rightMargin','topEdge'],[bandGap,componentSpacing,\ EdgeAttribute,leftEdge,network,NodeAttribute,nodeHorizontalSpacing,\ nodeList,nodeVerticalSpacing,rightMargin,topEdge]) response=api(url=self.__url+"/hierarchical", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def hierarchical(self,bandGap=None,componentSpacing=None,EdgeAttribute=None,\ leftEdge=None,network=None,NodeAttribute=None,nodeHorizontalSpacing=None,\ nodeList=None,nodeVerticalSpacing=None,rightMargin=None,topEdge=None,\ verbose=None): """ Execute the Hierarchical Layout on a network. :param bandGap (string, optional): Band gap, in numeric value :param componentSpacing (string, optional): Component spacing, in numeric v alue :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param leftEdge (string, optional): Left edge margin, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value :param rightMargin (string, optional): Right edge margin, in numeric value :param topEdge (string, optional): Top edge margin, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['bandGap','componentSpacing','EdgeAttribute','leftEdge',\ 'network','NodeAttribute','nodeHorizontalSpacing','nodeList',\ 'nodeVerticalSpacing','rightMargin','topEdge'],[bandGap,componentSpacing,\ EdgeAttribute,leftEdge,network,NodeAttribute,nodeHorizontalSpacing,\ nodeList,nodeVerticalSpacing,rightMargin,topEdge]) response=api(url=self.__url+"/hierarchical", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "hierarchical", "(", "self", ",", "bandGap", "=", "None", ",", "componentSpacing", "=", "None", ",", "EdgeAttribute", "=", "None", ",", "leftEdge", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeHorizontalSpacing", "=", "None", ",", "nodeList", "=", "None", ",", "nodeVerticalSpacing", "=", "None", ",", "rightMargin", "=", "None", ",", "topEdge", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'bandGap'", ",", "'componentSpacing'", ",", "'EdgeAttribute'", ",", "'leftEdge'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeHorizontalSpacing'", ",", "'nodeList'", ",", "'nodeVerticalSpacing'", ",", "'rightMargin'", ",", "'topEdge'", "]", ",", "[", "bandGap", ",", "componentSpacing", ",", "EdgeAttribute", ",", "leftEdge", ",", "network", ",", "NodeAttribute", ",", "nodeHorizontalSpacing", ",", "nodeList", ",", "nodeVerticalSpacing", ",", "rightMargin", ",", "topEdge", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/hierarchical\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Hierarchical Layout on a network. :param bandGap (string, optional): Band gap, in numeric value :param componentSpacing (string, optional): Component spacing, in numeric v alue :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param leftEdge (string, optional): Left edge margin, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeHorizontalSpacing (string, optional): Horizontal spacing between nodes, in numeric value :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param nodeVerticalSpacing (string, optional): Vertical spacing between nod es, in numeric value :param rightMargin (string, optional): Right edge margin, in numeric value :param topEdge (string, optional): Top edge margin, in numeric value
[ "Execute", "the", "Hierarchical", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L563-L604
12,052
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.isom
def isom(self,coolingFactor=None,EdgeAttribute=None,initialAdaptation=None,\ maxEpoch=None,minAdaptation=None,minRadius=None,network=None,NodeAttribute=None,\ nodeList=None,radius=None,radiusConstantTime=None,singlePartition=None,\ sizeFactor=None,verbose=None): """ Execute the Inverted Self-Organizing Map Layout on a network. :param coolingFactor (string, optional): Cooling factor, in numeric value :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param initialAdaptation (string, optional): Initial adaptation, in numeric value :param maxEpoch (string, optional): Number of iterations, in numeric value :param minAdaptation (string, optional): Minimum adaptation value, in numer ic value :param minRadius (string, optional): Minimum radius, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param radius (string, optional): Radius, in numeric value :param radiusConstantTime (string, optional): Radius constant, in numeric v alue :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param sizeFactor (string, optional): Size factor, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['coolingFactor','EdgeAttribute','initialAdaptation',\ 'maxEpoch','minAdaptation','minRadius','network','NodeAttribute','nodeList',\ 'radius','radiusConstantTime','singlePartition','sizeFactor'],[coolingFactor,\ EdgeAttribute,initialAdaptation,maxEpoch,minAdaptation,minRadius,network,\ NodeAttribute,nodeList,radius,radiusConstantTime,singlePartition,sizeFactor]) response=api(url=self.__url+"/isom", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def isom(self,coolingFactor=None,EdgeAttribute=None,initialAdaptation=None,\ maxEpoch=None,minAdaptation=None,minRadius=None,network=None,NodeAttribute=None,\ nodeList=None,radius=None,radiusConstantTime=None,singlePartition=None,\ sizeFactor=None,verbose=None): """ Execute the Inverted Self-Organizing Map Layout on a network. :param coolingFactor (string, optional): Cooling factor, in numeric value :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param initialAdaptation (string, optional): Initial adaptation, in numeric value :param maxEpoch (string, optional): Number of iterations, in numeric value :param minAdaptation (string, optional): Minimum adaptation value, in numer ic value :param minRadius (string, optional): Minimum radius, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param radius (string, optional): Radius, in numeric value :param radiusConstantTime (string, optional): Radius constant, in numeric v alue :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param sizeFactor (string, optional): Size factor, in numeric value """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['coolingFactor','EdgeAttribute','initialAdaptation',\ 'maxEpoch','minAdaptation','minRadius','network','NodeAttribute','nodeList',\ 'radius','radiusConstantTime','singlePartition','sizeFactor'],[coolingFactor,\ EdgeAttribute,initialAdaptation,maxEpoch,minAdaptation,minRadius,network,\ NodeAttribute,nodeList,radius,radiusConstantTime,singlePartition,sizeFactor]) response=api(url=self.__url+"/isom", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "isom", "(", "self", ",", "coolingFactor", "=", "None", ",", "EdgeAttribute", "=", "None", ",", "initialAdaptation", "=", "None", ",", "maxEpoch", "=", "None", ",", "minAdaptation", "=", "None", ",", "minRadius", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "radius", "=", "None", ",", "radiusConstantTime", "=", "None", ",", "singlePartition", "=", "None", ",", "sizeFactor", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'coolingFactor'", ",", "'EdgeAttribute'", ",", "'initialAdaptation'", ",", "'maxEpoch'", ",", "'minAdaptation'", ",", "'minRadius'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeList'", ",", "'radius'", ",", "'radiusConstantTime'", ",", "'singlePartition'", ",", "'sizeFactor'", "]", ",", "[", "coolingFactor", ",", "EdgeAttribute", ",", "initialAdaptation", ",", "maxEpoch", ",", "minAdaptation", ",", "minRadius", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "radius", ",", "radiusConstantTime", ",", "singlePartition", ",", "sizeFactor", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/isom\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Inverted Self-Organizing Map Layout on a network. :param coolingFactor (string, optional): Cooling factor, in numeric value :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param initialAdaptation (string, optional): Initial adaptation, in numeric value :param maxEpoch (string, optional): Number of iterations, in numeric value :param minAdaptation (string, optional): Minimum adaptation value, in numer ic value :param minRadius (string, optional): Minimum radius, in numeric value :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param radius (string, optional): Radius, in numeric value :param radiusConstantTime (string, optional): Radius constant, in numeric v alue :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param sizeFactor (string, optional): Size factor, in numeric value
[ "Execute", "the", "Inverted", "Self", "-", "Organizing", "Map", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L607-L651
12,053
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.kamada_kawai
def kamada_kawai(self,defaultEdgeWeight=None,EdgeAttribute=None,\ m_anticollisionSpringStrength=None,m_averageIterationsPerNode=None,\ m_disconnectedNodeDistanceSpringRestLength=None,\ m_disconnectedNodeDistanceSpringStrength=None,m_layoutPass=None,\ m_nodeDistanceRestLengthConstant=None,m_nodeDistanceStrengthConstant=None,\ maxWeightCutoff=None,minWeightCutoff=None,network=None,NodeAttribute=None,\ nodeList=None,randomize=None,singlePartition=None,Type=None,unweighted=None,\ verbose=None): """ Execute the Edge-weighted Spring Embedded Layout on a network. :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param m_anticollisionSpringStrength (string, optional): Strength to apply to avoid collisions, in numeric value :param m_averageIterationsPerNode (string, optional): Average number of ite ratations for each node, in numeric value :param m_disconnectedNodeDistanceSpringRestLength (string, optional): Rest length of a 'disconnected' spring, in numeric value :param m_disconnectedNodeDistanceSpringStrength (string, optional): Strengt h of a 'disconnected' spring, in numeric value :param m_layoutPass (string, optional): Number of layout passes, in numeric value :param m_nodeDistanceRestLengthConstant (string, optional): Spring rest len gth, in numeric value :param m_nodeDistanceStrengthConstant (string, optional): Spring strength, in numeric value :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param randomize (string, optional): Randomize graph before layout; boolean values only, true or false; defaults to true :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value'] :param unweighted (string, optional): Use unweighted edges; boolean values only, true or false; defaults to false """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['defaultEdgeWeight','EdgeAttribute',\ 'm_anticollisionSpringStrength','m_averageIterationsPerNode',\ 'm_disconnectedNodeDistanceSpringRestLength',\ 'm_disconnectedNodeDistanceSpringStrength','m_layoutPass',\ 'm_nodeDistanceRestLengthConstant','m_nodeDistanceStrengthConstant',\ 'maxWeightCutoff','minWeightCutoff','network','NodeAttribute','nodeList',\ 'randomize','singlePartition','Type','unweighted'],[defaultEdgeWeight,\ EdgeAttribute,m_anticollisionSpringStrength,m_averageIterationsPerNode,\ m_disconnectedNodeDistanceSpringRestLength,\ m_disconnectedNodeDistanceSpringStrength,m_layoutPass,\ m_nodeDistanceRestLengthConstant,m_nodeDistanceStrengthConstant,\ maxWeightCutoff,minWeightCutoff,network,NodeAttribute,nodeList,randomize,\ singlePartition,Type,unweighted]) response=api(url=self.__url+"/kamada-kawai", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def kamada_kawai(self,defaultEdgeWeight=None,EdgeAttribute=None,\ m_anticollisionSpringStrength=None,m_averageIterationsPerNode=None,\ m_disconnectedNodeDistanceSpringRestLength=None,\ m_disconnectedNodeDistanceSpringStrength=None,m_layoutPass=None,\ m_nodeDistanceRestLengthConstant=None,m_nodeDistanceStrengthConstant=None,\ maxWeightCutoff=None,minWeightCutoff=None,network=None,NodeAttribute=None,\ nodeList=None,randomize=None,singlePartition=None,Type=None,unweighted=None,\ verbose=None): """ Execute the Edge-weighted Spring Embedded Layout on a network. :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param m_anticollisionSpringStrength (string, optional): Strength to apply to avoid collisions, in numeric value :param m_averageIterationsPerNode (string, optional): Average number of ite ratations for each node, in numeric value :param m_disconnectedNodeDistanceSpringRestLength (string, optional): Rest length of a 'disconnected' spring, in numeric value :param m_disconnectedNodeDistanceSpringStrength (string, optional): Strengt h of a 'disconnected' spring, in numeric value :param m_layoutPass (string, optional): Number of layout passes, in numeric value :param m_nodeDistanceRestLengthConstant (string, optional): Spring rest len gth, in numeric value :param m_nodeDistanceStrengthConstant (string, optional): Spring strength, in numeric value :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param randomize (string, optional): Randomize graph before layout; boolean values only, true or false; defaults to true :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value'] :param unweighted (string, optional): Use unweighted edges; boolean values only, true or false; defaults to false """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['defaultEdgeWeight','EdgeAttribute',\ 'm_anticollisionSpringStrength','m_averageIterationsPerNode',\ 'm_disconnectedNodeDistanceSpringRestLength',\ 'm_disconnectedNodeDistanceSpringStrength','m_layoutPass',\ 'm_nodeDistanceRestLengthConstant','m_nodeDistanceStrengthConstant',\ 'maxWeightCutoff','minWeightCutoff','network','NodeAttribute','nodeList',\ 'randomize','singlePartition','Type','unweighted'],[defaultEdgeWeight,\ EdgeAttribute,m_anticollisionSpringStrength,m_averageIterationsPerNode,\ m_disconnectedNodeDistanceSpringRestLength,\ m_disconnectedNodeDistanceSpringStrength,m_layoutPass,\ m_nodeDistanceRestLengthConstant,m_nodeDistanceStrengthConstant,\ maxWeightCutoff,minWeightCutoff,network,NodeAttribute,nodeList,randomize,\ singlePartition,Type,unweighted]) response=api(url=self.__url+"/kamada-kawai", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "kamada_kawai", "(", "self", ",", "defaultEdgeWeight", "=", "None", ",", "EdgeAttribute", "=", "None", ",", "m_anticollisionSpringStrength", "=", "None", ",", "m_averageIterationsPerNode", "=", "None", ",", "m_disconnectedNodeDistanceSpringRestLength", "=", "None", ",", "m_disconnectedNodeDistanceSpringStrength", "=", "None", ",", "m_layoutPass", "=", "None", ",", "m_nodeDistanceRestLengthConstant", "=", "None", ",", "m_nodeDistanceStrengthConstant", "=", "None", ",", "maxWeightCutoff", "=", "None", ",", "minWeightCutoff", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "randomize", "=", "None", ",", "singlePartition", "=", "None", ",", "Type", "=", "None", ",", "unweighted", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'defaultEdgeWeight'", ",", "'EdgeAttribute'", ",", "'m_anticollisionSpringStrength'", ",", "'m_averageIterationsPerNode'", ",", "'m_disconnectedNodeDistanceSpringRestLength'", ",", "'m_disconnectedNodeDistanceSpringStrength'", ",", "'m_layoutPass'", ",", "'m_nodeDistanceRestLengthConstant'", ",", "'m_nodeDistanceStrengthConstant'", ",", "'maxWeightCutoff'", ",", "'minWeightCutoff'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeList'", ",", "'randomize'", ",", "'singlePartition'", ",", "'Type'", ",", "'unweighted'", "]", ",", "[", "defaultEdgeWeight", ",", "EdgeAttribute", ",", "m_anticollisionSpringStrength", ",", "m_averageIterationsPerNode", ",", "m_disconnectedNodeDistanceSpringRestLength", ",", "m_disconnectedNodeDistanceSpringStrength", ",", "m_layoutPass", ",", "m_nodeDistanceRestLengthConstant", ",", "m_nodeDistanceStrengthConstant", ",", "maxWeightCutoff", ",", "minWeightCutoff", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "randomize", ",", "singlePartition", ",", "Type", ",", "unweighted", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/kamada-kawai\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Edge-weighted Spring Embedded Layout on a network. :param defaultEdgeWeight (string, optional): The default edge weight to con sider, default is 0.5 :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param m_anticollisionSpringStrength (string, optional): Strength to apply to avoid collisions, in numeric value :param m_averageIterationsPerNode (string, optional): Average number of ite ratations for each node, in numeric value :param m_disconnectedNodeDistanceSpringRestLength (string, optional): Rest length of a 'disconnected' spring, in numeric value :param m_disconnectedNodeDistanceSpringStrength (string, optional): Strengt h of a 'disconnected' spring, in numeric value :param m_layoutPass (string, optional): Number of layout passes, in numeric value :param m_nodeDistanceRestLengthConstant (string, optional): Spring rest len gth, in numeric value :param m_nodeDistanceStrengthConstant (string, optional): Spring strength, in numeric value :param maxWeightCutoff (string, optional): The maximum edge weight to consi der, default to the Double.MAX value :param minWeightCutoff (string, optional): The minimum edge weight to consi der, numeric values, default is 0 :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param randomize (string, optional): Randomize graph before layout; boolean values only, true or false; defaults to true :param singlePartition (string, optional): Don't partition graph before lay out; boolean values only, true or false; defaults to false :param Type (string, optional): How to interpret weight values; must be one of Heuristic, -Log(value), 1 - normalized value and normalized valu e. Defaults to Heuristic = ['Heuristic', '-Log(value)', '1 - normali zed value', 'normalized value'] :param unweighted (string, optional): Use unweighted edges; boolean values only, true or false; defaults to false
[ "Execute", "the", "Edge", "-", "weighted", "Spring", "Embedded", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L653-L726
12,054
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.set_preferred
def set_preferred(self,preferredLayout=None,verbose=None): """ Sets the preferred layout. Takes a specific name as defined in the API Default is grid. :param preferredLayout (string, optional): Layout to use as preferred, for allowed names see Layout API """ PARAMS=set_param(['preferredLayout'],[preferredLayout]) response=api(url=self.__url+"/set preferred", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def set_preferred(self,preferredLayout=None,verbose=None): """ Sets the preferred layout. Takes a specific name as defined in the API Default is grid. :param preferredLayout (string, optional): Layout to use as preferred, for allowed names see Layout API """ PARAMS=set_param(['preferredLayout'],[preferredLayout]) response=api(url=self.__url+"/set preferred", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "set_preferred", "(", "self", ",", "preferredLayout", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'preferredLayout'", "]", ",", "[", "preferredLayout", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/set preferred\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Sets the preferred layout. Takes a specific name as defined in the API Default is grid. :param preferredLayout (string, optional): Layout to use as preferred, for allowed names see Layout API
[ "Sets", "the", "preferred", "layout", ".", "Takes", "a", "specific", "name", "as", "defined", "in", "the", "API", "Default", "is", "grid", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L729-L739
12,055
cytoscape/py2cytoscape
py2cytoscape/cyrest/layout.py
layout.stacked_node_layout
def stacked_node_layout(self,EdgeAttribute=None,network=None,NodeAttribute=None,\ nodeList=None,x_position=None,y_start_position=None,verbose=None): """ Execute the Stacked Node Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param x_position (string, optional): X start position, in numeric value :param y_start_position (string, optional): Y start position, in numeric va lue """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','network','NodeAttribute','nodeList',\ 'x_position','y_start_position'],[EdgeAttribute,network,NodeAttribute,\ nodeList,x_position,y_start_position]) response=api(url=self.__url+"/stacked-node-layout", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def stacked_node_layout(self,EdgeAttribute=None,network=None,NodeAttribute=None,\ nodeList=None,x_position=None,y_start_position=None,verbose=None): """ Execute the Stacked Node Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param x_position (string, optional): X start position, in numeric value :param y_start_position (string, optional): Y start position, in numeric va lue """ network=check_network(self,network,verbose=verbose) PARAMS=set_param(['EdgeAttribute','network','NodeAttribute','nodeList',\ 'x_position','y_start_position'],[EdgeAttribute,network,NodeAttribute,\ nodeList,x_position,y_start_position]) response=api(url=self.__url+"/stacked-node-layout", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "stacked_node_layout", "(", "self", ",", "EdgeAttribute", "=", "None", ",", "network", "=", "None", ",", "NodeAttribute", "=", "None", ",", "nodeList", "=", "None", ",", "x_position", "=", "None", ",", "y_start_position", "=", "None", ",", "verbose", "=", "None", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "'EdgeAttribute'", ",", "'network'", ",", "'NodeAttribute'", ",", "'nodeList'", ",", "'x_position'", ",", "'y_start_position'", "]", ",", "[", "EdgeAttribute", ",", "network", ",", "NodeAttribute", ",", "nodeList", ",", "x_position", ",", "y_start_position", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/stacked-node-layout\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Execute the Stacked Node Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value c an also be used to specify the current network. :param NodeAttribute (string, optional): The name of the node column contai ning numeric values that will be used as weights in the layout algor ithm. Only columns containing numeric values are shown :param nodeList (string, optional): Specifies a list of nodes. The keywords all, selected, or unselected can be used to specify nodes by their selection state. The pattern COLUMN:VALUE sets this parameter to any rows that contain the specified column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN :VALUE pairs of the format COLUMN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. :param x_position (string, optional): X start position, in numeric value :param y_start_position (string, optional): Y start position, in numeric va lue
[ "Execute", "the", "Stacked", "Node", "Layout", "on", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L742-L772
12,056
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.create_column
def create_column(self,columnName=None,listType=None,table=None,ntype=None,verbose=None): """ Appends an additional column of attribute values to the current table. :param columnName (string, optional): The new column name :param listType (string, optional): Can be one of integer, long, double, or string. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param ntype (string, optional): Can be one of integer, long, double, string , or list. """ PARAMS=set_param(['columnName','listType','table','type'],[columnName,\ listType,table,ntype]) response=api(url=self.__url+"/create column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def create_column(self,columnName=None,listType=None,table=None,ntype=None,verbose=None): """ Appends an additional column of attribute values to the current table. :param columnName (string, optional): The new column name :param listType (string, optional): Can be one of integer, long, double, or string. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param ntype (string, optional): Can be one of integer, long, double, string , or list. """ PARAMS=set_param(['columnName','listType','table','type'],[columnName,\ listType,table,ntype]) response=api(url=self.__url+"/create column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "create_column", "(", "self", ",", "columnName", "=", "None", ",", "listType", "=", "None", ",", "table", "=", "None", ",", "ntype", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'columnName'", ",", "'listType'", ",", "'table'", ",", "'type'", "]", ",", "[", "columnName", ",", "listType", ",", "table", ",", "ntype", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/create column\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Appends an additional column of attribute values to the current table. :param columnName (string, optional): The new column name :param listType (string, optional): Can be one of integer, long, double, or string. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param ntype (string, optional): Can be one of integer, long, double, string , or list.
[ "Appends", "an", "additional", "column", "of", "attribute", "values", "to", "the", "current", "table", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L30-L46
12,057
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.create_table
def create_table(self,keyColumn=None,keyColumnType=None,title=None,verbose=None): """ Adds a new table to the network. :param keyColumn (string, optional): Specifies the name of a column in the table :param keyColumnType (string, optional): The syntactical type of the value used in the key :param title (string, optional): The name of the table used in the current network :returns: table SUID """ PARAMS=set_param(['keyColumn','keyColumnType','title'],[keyColumn,\ keyColumnType,title]) response=api(url=self.__url+"/create table", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def create_table(self,keyColumn=None,keyColumnType=None,title=None,verbose=None): """ Adds a new table to the network. :param keyColumn (string, optional): Specifies the name of a column in the table :param keyColumnType (string, optional): The syntactical type of the value used in the key :param title (string, optional): The name of the table used in the current network :returns: table SUID """ PARAMS=set_param(['keyColumn','keyColumnType','title'],[keyColumn,\ keyColumnType,title]) response=api(url=self.__url+"/create table", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "create_table", "(", "self", ",", "keyColumn", "=", "None", ",", "keyColumnType", "=", "None", ",", "title", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'keyColumn'", ",", "'keyColumnType'", ",", "'title'", "]", ",", "[", "keyColumn", ",", "keyColumnType", ",", "title", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/create table\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Adds a new table to the network. :param keyColumn (string, optional): Specifies the name of a column in the table :param keyColumnType (string, optional): The syntactical type of the value used in the key :param title (string, optional): The name of the table used in the current network :returns: table SUID
[ "Adds", "a", "new", "table", "to", "the", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L49-L65
12,058
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.delete_column
def delete_column(self,column=None,table=None,verbose=None): """ Remove a column from a table, specified by its name. Returns the name of the column removed. :param column (string, optional): Specifies the name of a column in the tab le :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['column','table'],[column,table]) response=api(url=self.__url+"/delete column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def delete_column(self,column=None,table=None,verbose=None): """ Remove a column from a table, specified by its name. Returns the name of the column removed. :param column (string, optional): Specifies the name of a column in the tab le :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['column','table'],[column,table]) response=api(url=self.__url+"/delete column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "delete_column", "(", "self", ",", "column", "=", "None", ",", "table", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'column'", ",", "'table'", "]", ",", "[", "column", ",", "table", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/delete column\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Remove a column from a table, specified by its name. Returns the name of the column removed. :param column (string, optional): Specifies the name of a column in the tab le :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d.
[ "Remove", "a", "column", "from", "a", "table", "specified", "by", "its", "name", ".", "Returns", "the", "name", "of", "the", "column", "removed", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L67-L80
12,059
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.delete_row
def delete_row(self,keyValue=None,table=None,verbose=None): """ Deletes a row from a table.Requires the table name or SUID and the row key. :param keyValue (string): Specifies the primary key of a value in the row o f a table :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['keyValue','table'],[keyValue,table]) response=api(url=self.__url+"/delete row", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def delete_row(self,keyValue=None,table=None,verbose=None): """ Deletes a row from a table.Requires the table name or SUID and the row key. :param keyValue (string): Specifies the primary key of a value in the row o f a table :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['keyValue','table'],[keyValue,table]) response=api(url=self.__url+"/delete row", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "delete_row", "(", "self", ",", "keyValue", "=", "None", ",", "table", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'keyValue'", ",", "'table'", "]", ",", "[", "keyValue", ",", "table", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/delete row\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Deletes a row from a table.Requires the table name or SUID and the row key. :param keyValue (string): Specifies the primary key of a value in the row o f a table :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d.
[ "Deletes", "a", "row", "from", "a", "table", ".", "Requires", "the", "table", "name", "or", "SUID", "and", "the", "row", "key", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L83-L95
12,060
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.get_value
def get_value(self,column=None,keyValue=None,table=None,verbose=None): """ Returns the value from a cell as specified by row and column ids. :param column (string, optional): Specifies the name of a column in the tab le :param keyValue (string, optional): Specifies a row of a table using the pr imary key as the indentifier :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :returns: value from a cell as specified by row and column ids """ PARAMS=set_param(['column','keyValue','table'],[column,keyValue,table]) response=api(url=self.__url+"/get value", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def get_value(self,column=None,keyValue=None,table=None,verbose=None): """ Returns the value from a cell as specified by row and column ids. :param column (string, optional): Specifies the name of a column in the tab le :param keyValue (string, optional): Specifies a row of a table using the pr imary key as the indentifier :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :returns: value from a cell as specified by row and column ids """ PARAMS=set_param(['column','keyValue','table'],[column,keyValue,table]) response=api(url=self.__url+"/get value", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "get_value", "(", "self", ",", "column", "=", "None", ",", "keyValue", "=", "None", ",", "table", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'column'", ",", "'keyValue'", ",", "'table'", "]", ",", "[", "column", ",", "keyValue", ",", "table", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/get value\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns the value from a cell as specified by row and column ids. :param column (string, optional): Specifies the name of a column in the tab le :param keyValue (string, optional): Specifies a row of a table using the pr imary key as the indentifier :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :returns: value from a cell as specified by row and column ids
[ "Returns", "the", "value", "from", "a", "cell", "as", "specified", "by", "row", "and", "column", "ids", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L160-L176
12,061
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.import_url
def import_url(self,caseSensitiveNetworkCollectionKeys=None,\ caseSensitiveNetworkKeys=None,dataTypeList=None,\ DataTypeTargetForNetworkCollection=None,DataTypeTargetForNetworkList=None,\ delimiters=None,delimitersForDataList=None,firstRowAsColumnNames=None,\ KeyColumnForMapping=None,KeyColumnForMappingNetworkList=None,\ keyColumnIndex=None,newTableName=None,startLoadRow=None,\ TargetNetworkCollection=None,TargetNetworkList=None,url=None,\ WhereImportTable=None,verbose=None): """ Similar to Import Table this uses a long list of input parameters to specify the attributes of the table, the mapping keys, and the destination table for the input. :param caseSensitiveNetworkCollectionKeys (string, optional): Determines wh ether capitalization is considered in matching and sorting :param caseSensitiveNetworkKeys (string, optional): Determines whether capi talization is considered in matching and sorting :param dataTypeList (string, optional): List of column data types ordered b y column index (e.g. "string,int,long,double,boolean,intlist" or jus t "s,i,l,d,b,il") :param DataTypeTargetForNetworkCollection (string, optional): Select whethe r to import the data as Node Table Columns, Edge Table Columns, or N etwork Table Columns :param DataTypeTargetForNetworkList (string, optional): The data type of th e targets :param delimiters (string, optional): The list of delimiters that separate columns in the table. :param delimitersForDataList (string, optional): The delimiters between ele ments of list columns in the table. :param firstRowAsColumnNames (string, optional): If the first imported row contains column names, set this to true. :param KeyColumnForMapping (string, optional): The column in the network to use as the merge key :param KeyColumnForMappingNetworkList (string, optional): The column in the network to use as the merge key :param keyColumnIndex (string, optional): The column that contains the key values for this import. These values will be used to match with the key values in the network. :param newTableName (string, optional): The title of the new table :param startLoadRow (string, optional): The first row of the input table to load. This allows the skipping of headers that are not part of the import. :param TargetNetworkCollection (string, optional): The network collection t o use for the table import :param TargetNetworkList (string, optional): The list of networks into whic h the table is imported :param url (string): The URL of the file or resource that provides the tabl e or network to be imported. :param WhereImportTable (string, optional): Determines what network(s) the imported table will be associated with (if any). A table can be impo rted into a Network Collection, Selected networks or to an unassigne d table. """ PARAMS=set_param(['caseSensitiveNetworkCollectionKeys',\ 'caseSensitiveNetworkKeys','dataTypeList','DataTypeTargetForNetworkCollection',\ 'DataTypeTargetForNetworkList','delimiters','delimitersForDataList',\ 'firstRowAsColumnNames','KeyColumnForMapping','KeyColumnForMappingNetworkList',\ 'keyColumnIndex','newTableName','startLoadRow','TargetNetworkCollection',\ 'TargetNetworkList','url','WhereImportTable'],[caseSensitiveNetworkCollectionKeys,\ caseSensitiveNetworkKeys,dataTypeList,DataTypeTargetForNetworkCollection,\ DataTypeTargetForNetworkList,delimiters,delimitersForDataList,\ firstRowAsColumnNames,KeyColumnForMapping,KeyColumnForMappingNetworkList,\ keyColumnIndex,newTableName,startLoadRow,TargetNetworkCollection,\ TargetNetworkList,url,WhereImportTable]) response=api(url=self.__url+"/import url", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def import_url(self,caseSensitiveNetworkCollectionKeys=None,\ caseSensitiveNetworkKeys=None,dataTypeList=None,\ DataTypeTargetForNetworkCollection=None,DataTypeTargetForNetworkList=None,\ delimiters=None,delimitersForDataList=None,firstRowAsColumnNames=None,\ KeyColumnForMapping=None,KeyColumnForMappingNetworkList=None,\ keyColumnIndex=None,newTableName=None,startLoadRow=None,\ TargetNetworkCollection=None,TargetNetworkList=None,url=None,\ WhereImportTable=None,verbose=None): """ Similar to Import Table this uses a long list of input parameters to specify the attributes of the table, the mapping keys, and the destination table for the input. :param caseSensitiveNetworkCollectionKeys (string, optional): Determines wh ether capitalization is considered in matching and sorting :param caseSensitiveNetworkKeys (string, optional): Determines whether capi talization is considered in matching and sorting :param dataTypeList (string, optional): List of column data types ordered b y column index (e.g. "string,int,long,double,boolean,intlist" or jus t "s,i,l,d,b,il") :param DataTypeTargetForNetworkCollection (string, optional): Select whethe r to import the data as Node Table Columns, Edge Table Columns, or N etwork Table Columns :param DataTypeTargetForNetworkList (string, optional): The data type of th e targets :param delimiters (string, optional): The list of delimiters that separate columns in the table. :param delimitersForDataList (string, optional): The delimiters between ele ments of list columns in the table. :param firstRowAsColumnNames (string, optional): If the first imported row contains column names, set this to true. :param KeyColumnForMapping (string, optional): The column in the network to use as the merge key :param KeyColumnForMappingNetworkList (string, optional): The column in the network to use as the merge key :param keyColumnIndex (string, optional): The column that contains the key values for this import. These values will be used to match with the key values in the network. :param newTableName (string, optional): The title of the new table :param startLoadRow (string, optional): The first row of the input table to load. This allows the skipping of headers that are not part of the import. :param TargetNetworkCollection (string, optional): The network collection t o use for the table import :param TargetNetworkList (string, optional): The list of networks into whic h the table is imported :param url (string): The URL of the file or resource that provides the tabl e or network to be imported. :param WhereImportTable (string, optional): Determines what network(s) the imported table will be associated with (if any). A table can be impo rted into a Network Collection, Selected networks or to an unassigne d table. """ PARAMS=set_param(['caseSensitiveNetworkCollectionKeys',\ 'caseSensitiveNetworkKeys','dataTypeList','DataTypeTargetForNetworkCollection',\ 'DataTypeTargetForNetworkList','delimiters','delimitersForDataList',\ 'firstRowAsColumnNames','KeyColumnForMapping','KeyColumnForMappingNetworkList',\ 'keyColumnIndex','newTableName','startLoadRow','TargetNetworkCollection',\ 'TargetNetworkList','url','WhereImportTable'],[caseSensitiveNetworkCollectionKeys,\ caseSensitiveNetworkKeys,dataTypeList,DataTypeTargetForNetworkCollection,\ DataTypeTargetForNetworkList,delimiters,delimitersForDataList,\ firstRowAsColumnNames,KeyColumnForMapping,KeyColumnForMappingNetworkList,\ keyColumnIndex,newTableName,startLoadRow,TargetNetworkCollection,\ TargetNetworkList,url,WhereImportTable]) response=api(url=self.__url+"/import url", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "import_url", "(", "self", ",", "caseSensitiveNetworkCollectionKeys", "=", "None", ",", "caseSensitiveNetworkKeys", "=", "None", ",", "dataTypeList", "=", "None", ",", "DataTypeTargetForNetworkCollection", "=", "None", ",", "DataTypeTargetForNetworkList", "=", "None", ",", "delimiters", "=", "None", ",", "delimitersForDataList", "=", "None", ",", "firstRowAsColumnNames", "=", "None", ",", "KeyColumnForMapping", "=", "None", ",", "KeyColumnForMappingNetworkList", "=", "None", ",", "keyColumnIndex", "=", "None", ",", "newTableName", "=", "None", ",", "startLoadRow", "=", "None", ",", "TargetNetworkCollection", "=", "None", ",", "TargetNetworkList", "=", "None", ",", "url", "=", "None", ",", "WhereImportTable", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'caseSensitiveNetworkCollectionKeys'", ",", "'caseSensitiveNetworkKeys'", ",", "'dataTypeList'", ",", "'DataTypeTargetForNetworkCollection'", ",", "'DataTypeTargetForNetworkList'", ",", "'delimiters'", ",", "'delimitersForDataList'", ",", "'firstRowAsColumnNames'", ",", "'KeyColumnForMapping'", ",", "'KeyColumnForMappingNetworkList'", ",", "'keyColumnIndex'", ",", "'newTableName'", ",", "'startLoadRow'", ",", "'TargetNetworkCollection'", ",", "'TargetNetworkList'", ",", "'url'", ",", "'WhereImportTable'", "]", ",", "[", "caseSensitiveNetworkCollectionKeys", ",", "caseSensitiveNetworkKeys", ",", "dataTypeList", ",", "DataTypeTargetForNetworkCollection", ",", "DataTypeTargetForNetworkList", ",", "delimiters", ",", "delimitersForDataList", ",", "firstRowAsColumnNames", ",", "KeyColumnForMapping", ",", "KeyColumnForMappingNetworkList", ",", "keyColumnIndex", ",", "newTableName", ",", "startLoadRow", ",", "TargetNetworkCollection", ",", "TargetNetworkList", ",", "url", ",", "WhereImportTable", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/import url\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Similar to Import Table this uses a long list of input parameters to specify the attributes of the table, the mapping keys, and the destination table for the input. :param caseSensitiveNetworkCollectionKeys (string, optional): Determines wh ether capitalization is considered in matching and sorting :param caseSensitiveNetworkKeys (string, optional): Determines whether capi talization is considered in matching and sorting :param dataTypeList (string, optional): List of column data types ordered b y column index (e.g. "string,int,long,double,boolean,intlist" or jus t "s,i,l,d,b,il") :param DataTypeTargetForNetworkCollection (string, optional): Select whethe r to import the data as Node Table Columns, Edge Table Columns, or N etwork Table Columns :param DataTypeTargetForNetworkList (string, optional): The data type of th e targets :param delimiters (string, optional): The list of delimiters that separate columns in the table. :param delimitersForDataList (string, optional): The delimiters between ele ments of list columns in the table. :param firstRowAsColumnNames (string, optional): If the first imported row contains column names, set this to true. :param KeyColumnForMapping (string, optional): The column in the network to use as the merge key :param KeyColumnForMappingNetworkList (string, optional): The column in the network to use as the merge key :param keyColumnIndex (string, optional): The column that contains the key values for this import. These values will be used to match with the key values in the network. :param newTableName (string, optional): The title of the new table :param startLoadRow (string, optional): The first row of the input table to load. This allows the skipping of headers that are not part of the import. :param TargetNetworkCollection (string, optional): The network collection t o use for the table import :param TargetNetworkList (string, optional): The list of networks into whic h the table is imported :param url (string): The URL of the file or resource that provides the tabl e or network to be imported. :param WhereImportTable (string, optional): Determines what network(s) the imported table will be associated with (if any). A table can be impo rted into a Network Collection, Selected networks or to an unassigne d table.
[ "Similar", "to", "Import", "Table", "this", "uses", "a", "long", "list", "of", "input", "parameters", "to", "specify", "the", "attributes", "of", "the", "table", "the", "mapping", "keys", "and", "the", "destination", "table", "for", "the", "input", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L246-L311
12,062
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.list_tables
def list_tables(self,includePrivate=None,namespace=None,atype=None,verbose=None): """ Returns a list of the table SUIDs associated with the passed network parameter. :param includePrivate (string, optional): A boolean value determining wheth er to return private as well as public tables :param namespace (string, optional): An optional argument to contrain outpu t to a single namespace, or ALL :param atype (string, optional): One of ''network'', ''node'', ''edge'', ''u nattached'', ''all'', to constrain the type of table listed :returns: list of the table SUIDs associated with the passed network parameter. """ PARAMS=set_param(['includePrivate','namespace','type'],\ [includePrivate,namespace,atype]) response=api(url=self.__url+"/list", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def list_tables(self,includePrivate=None,namespace=None,atype=None,verbose=None): """ Returns a list of the table SUIDs associated with the passed network parameter. :param includePrivate (string, optional): A boolean value determining wheth er to return private as well as public tables :param namespace (string, optional): An optional argument to contrain outpu t to a single namespace, or ALL :param atype (string, optional): One of ''network'', ''node'', ''edge'', ''u nattached'', ''all'', to constrain the type of table listed :returns: list of the table SUIDs associated with the passed network parameter. """ PARAMS=set_param(['includePrivate','namespace','type'],\ [includePrivate,namespace,atype]) response=api(url=self.__url+"/list", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "list_tables", "(", "self", ",", "includePrivate", "=", "None", ",", "namespace", "=", "None", ",", "atype", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'includePrivate'", ",", "'namespace'", ",", "'type'", "]", ",", "[", "includePrivate", ",", "namespace", ",", "atype", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/list\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns a list of the table SUIDs associated with the passed network parameter. :param includePrivate (string, optional): A boolean value determining wheth er to return private as well as public tables :param namespace (string, optional): An optional argument to contrain outpu t to a single namespace, or ALL :param atype (string, optional): One of ''network'', ''node'', ''edge'', ''u nattached'', ''all'', to constrain the type of table listed :returns: list of the table SUIDs associated with the passed network parameter.
[ "Returns", "a", "list", "of", "the", "table", "SUIDs", "associated", "with", "the", "passed", "network", "parameter", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L314-L329
12,063
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.list_columns
def list_columns(self,table=None,verbose=None): """ Returns the list of columns in the table. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :returns: list of columns in the table. """ PARAMS=set_param(['table'],[table]) response=api(url=self.__url+"/list columns", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def list_columns(self,table=None,verbose=None): """ Returns the list of columns in the table. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :returns: list of columns in the table. """ PARAMS=set_param(['table'],[table]) response=api(url=self.__url+"/list columns", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "list_columns", "(", "self", ",", "table", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'table'", "]", ",", "[", "table", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/list columns\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns the list of columns in the table. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :returns: list of columns in the table.
[ "Returns", "the", "list", "of", "columns", "in", "the", "table", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L332-L343
12,064
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.list_rows
def list_rows(self,rowList=None,table=None,verbose=None): """ Returns the list of primary keys for each of the rows in the specified table. :param rowList (string, optional): Specifies a list of rows. The pattern CO LUMN:VALUE sets this parameter to any rows that contain the specifie d column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLU MN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. This parameter can also be set to all to include all rows. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['rowList','table'],[rowList,table]) response=api(url=self.__url+"/list rows", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def list_rows(self,rowList=None,table=None,verbose=None): """ Returns the list of primary keys for each of the rows in the specified table. :param rowList (string, optional): Specifies a list of rows. The pattern CO LUMN:VALUE sets this parameter to any rows that contain the specifie d column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLU MN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. This parameter can also be set to all to include all rows. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['rowList','table'],[rowList,table]) response=api(url=self.__url+"/list rows", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "list_rows", "(", "self", ",", "rowList", "=", "None", ",", "table", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'rowList'", ",", "'table'", "]", ",", "[", "rowList", ",", "table", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/list rows\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns the list of primary keys for each of the rows in the specified table. :param rowList (string, optional): Specifies a list of rows. The pattern CO LUMN:VALUE sets this parameter to any rows that contain the specifie d column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLU MN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. This parameter can also be set to all to include all rows. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d.
[ "Returns", "the", "list", "of", "primary", "keys", "for", "each", "of", "the", "rows", "in", "the", "specified", "table", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L346-L362
12,065
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.merge
def merge(self,DataTypeTargetForNetworkCollection=None,\ dataTypeTargetForNetworkList=None,mergeType=None,SourceMergeColumns=None,\ SourceMergeKey=None,SourceTable=None,TargetKeyNetworkCollection=None,\ TargetMergeKey=None,TargetNetworkCollection=None,TargetNetworkList=None,\ UnassignedTable=None,WhereMergeTable=None,verbose=None): """ Merge tables together joining around a designated key column. Depending on the arguments, might merge into multiple local tables. :param DataTypeTargetForNetworkCollection (string, optional): The collectio n of networks where the merged table will reside :param dataTypeTargetForNetworkList (string, optional): :param mergeType (string, optional): A choice between ''Copy Columns'' and ''Link To Columns'' that determines if replicates are created :param SourceMergeColumns (string, optional): A list of columns that will b e brought into the merged table :param SourceMergeKey (string, optional): The name of the columns that exis ts in both tables and is used to correlate rows :param SourceTable (string, optional): The name of the table used as the ba se data in the merge :param TargetKeyNetworkCollection (string, optional): The name of the prima ry column about which the merge is made :param TargetMergeKey (string, optional): :param TargetNetworkCollection (string, optional): The group of networks th at will be merged into the source table :param TargetNetworkList (string, optional): The list of networks where the merged table will be added :param UnassignedTable (string, optional): :param WhereMergeTable (string, optional): The destination path of the resu ltant merged table. The choices are ''Network Collection'', ''Select ed Networks'', or ''All Unassigned Tables''. """ PARAMS=set_param(['DataTypeTargetForNetworkCollection','dataTypeTargetForNetworkList','mergeType','SourceMergeColumns','SourceMergeKey','SourceTable','TargetKeyNetworkCollection','TargetMergeKey','TargetNetworkCollection','TargetNetworkList','UnassignedTable','WhereMergeTable'],\ [DataTypeTargetForNetworkCollection,dataTypeTargetForNetworkList,mergeType,SourceMergeColumns,SourceMergeKey,SourceTable,TargetKeyNetworkCollection,TargetMergeKey,TargetNetworkCollection,TargetNetworkList,UnassignedTable,WhereMergeTable]) response=api(url=self.__url+"/merge", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def merge(self,DataTypeTargetForNetworkCollection=None,\ dataTypeTargetForNetworkList=None,mergeType=None,SourceMergeColumns=None,\ SourceMergeKey=None,SourceTable=None,TargetKeyNetworkCollection=None,\ TargetMergeKey=None,TargetNetworkCollection=None,TargetNetworkList=None,\ UnassignedTable=None,WhereMergeTable=None,verbose=None): """ Merge tables together joining around a designated key column. Depending on the arguments, might merge into multiple local tables. :param DataTypeTargetForNetworkCollection (string, optional): The collectio n of networks where the merged table will reside :param dataTypeTargetForNetworkList (string, optional): :param mergeType (string, optional): A choice between ''Copy Columns'' and ''Link To Columns'' that determines if replicates are created :param SourceMergeColumns (string, optional): A list of columns that will b e brought into the merged table :param SourceMergeKey (string, optional): The name of the columns that exis ts in both tables and is used to correlate rows :param SourceTable (string, optional): The name of the table used as the ba se data in the merge :param TargetKeyNetworkCollection (string, optional): The name of the prima ry column about which the merge is made :param TargetMergeKey (string, optional): :param TargetNetworkCollection (string, optional): The group of networks th at will be merged into the source table :param TargetNetworkList (string, optional): The list of networks where the merged table will be added :param UnassignedTable (string, optional): :param WhereMergeTable (string, optional): The destination path of the resu ltant merged table. The choices are ''Network Collection'', ''Select ed Networks'', or ''All Unassigned Tables''. """ PARAMS=set_param(['DataTypeTargetForNetworkCollection','dataTypeTargetForNetworkList','mergeType','SourceMergeColumns','SourceMergeKey','SourceTable','TargetKeyNetworkCollection','TargetMergeKey','TargetNetworkCollection','TargetNetworkList','UnassignedTable','WhereMergeTable'],\ [DataTypeTargetForNetworkCollection,dataTypeTargetForNetworkList,mergeType,SourceMergeColumns,SourceMergeKey,SourceTable,TargetKeyNetworkCollection,TargetMergeKey,TargetNetworkCollection,TargetNetworkList,UnassignedTable,WhereMergeTable]) response=api(url=self.__url+"/merge", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "merge", "(", "self", ",", "DataTypeTargetForNetworkCollection", "=", "None", ",", "dataTypeTargetForNetworkList", "=", "None", ",", "mergeType", "=", "None", ",", "SourceMergeColumns", "=", "None", ",", "SourceMergeKey", "=", "None", ",", "SourceTable", "=", "None", ",", "TargetKeyNetworkCollection", "=", "None", ",", "TargetMergeKey", "=", "None", ",", "TargetNetworkCollection", "=", "None", ",", "TargetNetworkList", "=", "None", ",", "UnassignedTable", "=", "None", ",", "WhereMergeTable", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'DataTypeTargetForNetworkCollection'", ",", "'dataTypeTargetForNetworkList'", ",", "'mergeType'", ",", "'SourceMergeColumns'", ",", "'SourceMergeKey'", ",", "'SourceTable'", ",", "'TargetKeyNetworkCollection'", ",", "'TargetMergeKey'", ",", "'TargetNetworkCollection'", ",", "'TargetNetworkList'", ",", "'UnassignedTable'", ",", "'WhereMergeTable'", "]", ",", "[", "DataTypeTargetForNetworkCollection", ",", "dataTypeTargetForNetworkList", ",", "mergeType", ",", "SourceMergeColumns", ",", "SourceMergeKey", ",", "SourceTable", ",", "TargetKeyNetworkCollection", ",", "TargetMergeKey", ",", "TargetNetworkCollection", ",", "TargetNetworkList", ",", "UnassignedTable", ",", "WhereMergeTable", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/merge\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Merge tables together joining around a designated key column. Depending on the arguments, might merge into multiple local tables. :param DataTypeTargetForNetworkCollection (string, optional): The collectio n of networks where the merged table will reside :param dataTypeTargetForNetworkList (string, optional): :param mergeType (string, optional): A choice between ''Copy Columns'' and ''Link To Columns'' that determines if replicates are created :param SourceMergeColumns (string, optional): A list of columns that will b e brought into the merged table :param SourceMergeKey (string, optional): The name of the columns that exis ts in both tables and is used to correlate rows :param SourceTable (string, optional): The name of the table used as the ba se data in the merge :param TargetKeyNetworkCollection (string, optional): The name of the prima ry column about which the merge is made :param TargetMergeKey (string, optional): :param TargetNetworkCollection (string, optional): The group of networks th at will be merged into the source table :param TargetNetworkList (string, optional): The list of networks where the merged table will be added :param UnassignedTable (string, optional): :param WhereMergeTable (string, optional): The destination path of the resu ltant merged table. The choices are ''Network Collection'', ''Select ed Networks'', or ''All Unassigned Tables''.
[ "Merge", "tables", "together", "joining", "around", "a", "designated", "key", "column", ".", "Depending", "on", "the", "arguments", "might", "merge", "into", "multiple", "local", "tables", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L365-L400
12,066
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.rename_column
def rename_column(self,columnName=None,newColumnName=None,table=None,verbose=None): """ Changes the name of a specified column in the table. :param columnName (string): The name of the column that will be renamed. :param newColumnName (string): The new name of the column. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['columnName','newColumnName','table'],[columnName,newColumnName,table]) response=api(url=self.__url+"/rename column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def rename_column(self,columnName=None,newColumnName=None,table=None,verbose=None): """ Changes the name of a specified column in the table. :param columnName (string): The name of the column that will be renamed. :param newColumnName (string): The new name of the column. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. """ PARAMS=set_param(['columnName','newColumnName','table'],[columnName,newColumnName,table]) response=api(url=self.__url+"/rename column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "rename_column", "(", "self", ",", "columnName", "=", "None", ",", "newColumnName", "=", "None", ",", "table", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'columnName'", ",", "'newColumnName'", ",", "'table'", "]", ",", "[", "columnName", ",", "newColumnName", ",", "table", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/rename column\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Changes the name of a specified column in the table. :param columnName (string): The name of the column that will be renamed. :param newColumnName (string): The new name of the column. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d.
[ "Changes", "the", "name", "of", "a", "specified", "column", "in", "the", "table", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L404-L416
12,067
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.set_title
def set_title(self,table=None,title=None,verbose=None): """ Changes the visible identifier of a single table. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param title (string, optional): The name of the table used in the current network """ PARAMS=set_param(['table','title'],[table,title]) response=api(url=self.__url+"/set title", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def set_title(self,table=None,title=None,verbose=None): """ Changes the visible identifier of a single table. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param title (string, optional): The name of the table used in the current network """ PARAMS=set_param(['table','title'],[table,title]) response=api(url=self.__url+"/set title", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "set_title", "(", "self", ",", "table", "=", "None", ",", "title", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'table'", ",", "'title'", "]", ",", "[", "table", ",", "title", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/set title\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Changes the visible identifier of a single table. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param title (string, optional): The name of the table used in the current network
[ "Changes", "the", "visible", "identifier", "of", "a", "single", "table", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L420-L432
12,068
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.set_values
def set_values(self,columnName=None,rowList=None,table=None,value=None,verbose=None): """ Set all the values in the specified list of rows with a single value. :param columnName (string, optional): Specifies the name of a column in the table :param rowList (string, optional): Specifies a list of rows. The pattern CO LUMN:VALUE sets this parameter to any rows that contain the specifie d column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLU MN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. This parameter can also be set to all to include all rows. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param value (string, optional): The value to set the columns in the select ed rows to. This should be a string value, which will be converted t o the appropriate column type. """ PARAMS=set_param(['columnName','rowList','table','value'],[columnName,rowList,table,value]) response=api(url=self.__url+"/set values", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def set_values(self,columnName=None,rowList=None,table=None,value=None,verbose=None): """ Set all the values in the specified list of rows with a single value. :param columnName (string, optional): Specifies the name of a column in the table :param rowList (string, optional): Specifies a list of rows. The pattern CO LUMN:VALUE sets this parameter to any rows that contain the specifie d column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLU MN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. This parameter can also be set to all to include all rows. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param value (string, optional): The value to set the columns in the select ed rows to. This should be a string value, which will be converted t o the appropriate column type. """ PARAMS=set_param(['columnName','rowList','table','value'],[columnName,rowList,table,value]) response=api(url=self.__url+"/set values", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "set_values", "(", "self", ",", "columnName", "=", "None", ",", "rowList", "=", "None", ",", "table", "=", "None", ",", "value", "=", "None", ",", "verbose", "=", "None", ")", ":", "PARAMS", "=", "set_param", "(", "[", "'columnName'", ",", "'rowList'", ",", "'table'", ",", "'value'", "]", ",", "[", "columnName", ",", "rowList", ",", "table", ",", "value", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/set values\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Set all the values in the specified list of rows with a single value. :param columnName (string, optional): Specifies the name of a column in the table :param rowList (string, optional): Specifies a list of rows. The pattern CO LUMN:VALUE sets this parameter to any rows that contain the specifie d column value; if the COLUMN prefix is not used, the NAME column is matched by default. A list of COLUMN:VALUE pairs of the format COLU MN1:VALUE1,COLUMN2:VALUE2,... can be used to match multiple values. This parameter can also be set to all to include all rows. :param table (string, optional): Specifies a table by table name. If the pr efix SUID: is used, the table corresponding the SUID will be returne d. :param value (string, optional): The value to set the columns in the select ed rows to. This should be a string value, which will be converted t o the appropriate column type.
[ "Set", "all", "the", "values", "in", "the", "specified", "list", "of", "rows", "with", "a", "single", "value", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L436-L457
12,069
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.getTable
def getTable(self, columns=None, table=None, network = "current", namespace='default', verbose=VERBOSE): """ Gets tables from cytoscape. :param table: table to retrieve eg. node :param columns: columns to retrieve in list format :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :returns: a pandas dataframe """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if type(network) != int: network=check_network(self,network,verbose=verbose) PARAMS=set_param(["columnList","namespace","network"],["SUID",namespace,network]) network=api(namespace="network", command="get attribute",PARAMS=PARAMS, host=host,port=str(port),version=version) network=network[0]["SUID"] df=pd.DataFrame() def target(column): URL="http://"+str(host)+":"+str(port)+"/v1/networks/"+str(network)+"/tables/"+namespace+table+"/columns/"+column if verbose: print("'"+URL+"'") sys.stdout.flush() response = urllib2.urlopen(URL) response = response.read() colA=json.loads(response) col=pd.DataFrame() colHeader=colA["name"] colValues=colA["values"] col[colHeader]=colValues return col ncols=["name"] for c in columns: ncols.append(c.replace(" ","%20") ) for c in ncols: try: col=target(c) df=pd.concat([df,col],axis=1) except: print("Could not find "+c) sys.stdout.flush() df.index=df["name"].tolist() df=df.drop(["name"],axis=1) return df
python
def getTable(self, columns=None, table=None, network = "current", namespace='default', verbose=VERBOSE): """ Gets tables from cytoscape. :param table: table to retrieve eg. node :param columns: columns to retrieve in list format :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :returns: a pandas dataframe """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if type(network) != int: network=check_network(self,network,verbose=verbose) PARAMS=set_param(["columnList","namespace","network"],["SUID",namespace,network]) network=api(namespace="network", command="get attribute",PARAMS=PARAMS, host=host,port=str(port),version=version) network=network[0]["SUID"] df=pd.DataFrame() def target(column): URL="http://"+str(host)+":"+str(port)+"/v1/networks/"+str(network)+"/tables/"+namespace+table+"/columns/"+column if verbose: print("'"+URL+"'") sys.stdout.flush() response = urllib2.urlopen(URL) response = response.read() colA=json.loads(response) col=pd.DataFrame() colHeader=colA["name"] colValues=colA["values"] col[colHeader]=colValues return col ncols=["name"] for c in columns: ncols.append(c.replace(" ","%20") ) for c in ncols: try: col=target(c) df=pd.concat([df,col],axis=1) except: print("Could not find "+c) sys.stdout.flush() df.index=df["name"].tolist() df=df.drop(["name"],axis=1) return df
[ "def", "getTable", "(", "self", ",", "columns", "=", "None", ",", "table", "=", "None", ",", "network", "=", "\"current\"", ",", "namespace", "=", "'default'", ",", "verbose", "=", "VERBOSE", ")", ":", "u", "=", "self", ".", "__url", "host", "=", "u", ".", "split", "(", "\"//\"", ")", "[", "1", "]", ".", "split", "(", "\":\"", ")", "[", "0", "]", "port", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "0", "]", "version", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "1", "]", "if", "type", "(", "network", ")", "!=", "int", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"columnList\"", ",", "\"namespace\"", ",", "\"network\"", "]", ",", "[", "\"SUID\"", ",", "namespace", ",", "network", "]", ")", "network", "=", "api", "(", "namespace", "=", "\"network\"", ",", "command", "=", "\"get attribute\"", ",", "PARAMS", "=", "PARAMS", ",", "host", "=", "host", ",", "port", "=", "str", "(", "port", ")", ",", "version", "=", "version", ")", "network", "=", "network", "[", "0", "]", "[", "\"SUID\"", "]", "df", "=", "pd", ".", "DataFrame", "(", ")", "def", "target", "(", "column", ")", ":", "URL", "=", "\"http://\"", "+", "str", "(", "host", ")", "+", "\":\"", "+", "str", "(", "port", ")", "+", "\"/v1/networks/\"", "+", "str", "(", "network", ")", "+", "\"/tables/\"", "+", "namespace", "+", "table", "+", "\"/columns/\"", "+", "column", "if", "verbose", ":", "print", "(", "\"'\"", "+", "URL", "+", "\"'\"", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "response", "=", "urllib2", ".", "urlopen", "(", "URL", ")", "response", "=", "response", ".", "read", "(", ")", "colA", "=", "json", ".", "loads", "(", "response", ")", "col", "=", "pd", ".", "DataFrame", "(", ")", "colHeader", "=", "colA", "[", "\"name\"", "]", "colValues", "=", "colA", "[", "\"values\"", "]", "col", "[", "colHeader", "]", "=", "colValues", "return", "col", "ncols", "=", "[", "\"name\"", "]", "for", "c", "in", "columns", ":", "ncols", ".", "append", "(", "c", ".", "replace", "(", "\" \"", ",", "\"%20\"", ")", ")", "for", "c", "in", "ncols", ":", "try", ":", "col", "=", "target", "(", "c", ")", "df", "=", "pd", ".", "concat", "(", "[", "df", ",", "col", "]", ",", "axis", "=", "1", ")", "except", ":", "print", "(", "\"Could not find \"", "+", "c", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "df", ".", "index", "=", "df", "[", "\"name\"", "]", ".", "tolist", "(", ")", "df", "=", "df", ".", "drop", "(", "[", "\"name\"", "]", ",", "axis", "=", "1", ")", "return", "df" ]
Gets tables from cytoscape. :param table: table to retrieve eg. node :param columns: columns to retrieve in list format :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :returns: a pandas dataframe
[ "Gets", "tables", "from", "cytoscape", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L459-L515
12,070
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.loadTableData
def loadTableData(self, df, df_key='index',table="node", table_key_column = "name", \ network="current",namespace="default",verbose=False): """ Loads tables into cytoscape. :param df: a pandas dataframe to load :param df_key: key column in df, default="index" :param table: target table, default="node" :param table_key_column: table key column, default="name" :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param verbose: print more information :returns: output of put request """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if type(network) != int: network=check_network(self,network,verbose=verbose) PARAMS=set_param(["columnList","namespace","network"],["SUID",namespace,network]) networkID=api(namespace="network", command="get attribute",PARAMS=PARAMS, host=host,port=str(port),version=version) PARAMS=set_param(["columnList","namespace","network"],["name",namespace,network]) networkname=api(namespace="network", command="get attribute",PARAMS=PARAMS, host=host,port=str(port),version=version) network=networkID[0]["SUID"] networkname=networkname[0]["name"] tmp=df.copy() if df_key!="index": tmp.index=tmp[df_key].tolist() tmp=tmp.drop([df_key],axis=1) tablen=networkname+" default node" data=[] for c in tmp.columns.tolist(): tmpcol=tmp[[c]].dropna() for r in tmpcol.index.tolist(): cell={} cell[str(table_key_column)]=str(r) # {"name":"p53"} val=tmpcol.loc[r,c] if type(val) != str: val=float(val) cell[str(c)]=val data.append(cell) upload={"key":table_key_column,"dataKey":table_key_column,\ "data":data} URL="http://"+str(host)+":"+str(port)+"/v1/networks/"+str(network)+"/tables/"+namespace+table if verbose: print("'"+URL+"'", upload) sys.stdout.flush() r = requests.put(url = URL, json = upload) if verbose: print(r) checkresponse(r) res=r.content return res
python
def loadTableData(self, df, df_key='index',table="node", table_key_column = "name", \ network="current",namespace="default",verbose=False): """ Loads tables into cytoscape. :param df: a pandas dataframe to load :param df_key: key column in df, default="index" :param table: target table, default="node" :param table_key_column: table key column, default="name" :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param verbose: print more information :returns: output of put request """ u=self.__url host=u.split("//")[1].split(":")[0] port=u.split(":")[2].split("/")[0] version=u.split(":")[2].split("/")[1] if type(network) != int: network=check_network(self,network,verbose=verbose) PARAMS=set_param(["columnList","namespace","network"],["SUID",namespace,network]) networkID=api(namespace="network", command="get attribute",PARAMS=PARAMS, host=host,port=str(port),version=version) PARAMS=set_param(["columnList","namespace","network"],["name",namespace,network]) networkname=api(namespace="network", command="get attribute",PARAMS=PARAMS, host=host,port=str(port),version=version) network=networkID[0]["SUID"] networkname=networkname[0]["name"] tmp=df.copy() if df_key!="index": tmp.index=tmp[df_key].tolist() tmp=tmp.drop([df_key],axis=1) tablen=networkname+" default node" data=[] for c in tmp.columns.tolist(): tmpcol=tmp[[c]].dropna() for r in tmpcol.index.tolist(): cell={} cell[str(table_key_column)]=str(r) # {"name":"p53"} val=tmpcol.loc[r,c] if type(val) != str: val=float(val) cell[str(c)]=val data.append(cell) upload={"key":table_key_column,"dataKey":table_key_column,\ "data":data} URL="http://"+str(host)+":"+str(port)+"/v1/networks/"+str(network)+"/tables/"+namespace+table if verbose: print("'"+URL+"'", upload) sys.stdout.flush() r = requests.put(url = URL, json = upload) if verbose: print(r) checkresponse(r) res=r.content return res
[ "def", "loadTableData", "(", "self", ",", "df", ",", "df_key", "=", "'index'", ",", "table", "=", "\"node\"", ",", "table_key_column", "=", "\"name\"", ",", "network", "=", "\"current\"", ",", "namespace", "=", "\"default\"", ",", "verbose", "=", "False", ")", ":", "u", "=", "self", ".", "__url", "host", "=", "u", ".", "split", "(", "\"//\"", ")", "[", "1", "]", ".", "split", "(", "\":\"", ")", "[", "0", "]", "port", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "0", "]", "version", "=", "u", ".", "split", "(", "\":\"", ")", "[", "2", "]", ".", "split", "(", "\"/\"", ")", "[", "1", "]", "if", "type", "(", "network", ")", "!=", "int", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", "set_param", "(", "[", "\"columnList\"", ",", "\"namespace\"", ",", "\"network\"", "]", ",", "[", "\"SUID\"", ",", "namespace", ",", "network", "]", ")", "networkID", "=", "api", "(", "namespace", "=", "\"network\"", ",", "command", "=", "\"get attribute\"", ",", "PARAMS", "=", "PARAMS", ",", "host", "=", "host", ",", "port", "=", "str", "(", "port", ")", ",", "version", "=", "version", ")", "PARAMS", "=", "set_param", "(", "[", "\"columnList\"", ",", "\"namespace\"", ",", "\"network\"", "]", ",", "[", "\"name\"", ",", "namespace", ",", "network", "]", ")", "networkname", "=", "api", "(", "namespace", "=", "\"network\"", ",", "command", "=", "\"get attribute\"", ",", "PARAMS", "=", "PARAMS", ",", "host", "=", "host", ",", "port", "=", "str", "(", "port", ")", ",", "version", "=", "version", ")", "network", "=", "networkID", "[", "0", "]", "[", "\"SUID\"", "]", "networkname", "=", "networkname", "[", "0", "]", "[", "\"name\"", "]", "tmp", "=", "df", ".", "copy", "(", ")", "if", "df_key", "!=", "\"index\"", ":", "tmp", ".", "index", "=", "tmp", "[", "df_key", "]", ".", "tolist", "(", ")", "tmp", "=", "tmp", ".", "drop", "(", "[", "df_key", "]", ",", "axis", "=", "1", ")", "tablen", "=", "networkname", "+", "\" default node\"", "data", "=", "[", "]", "for", "c", "in", "tmp", ".", "columns", ".", "tolist", "(", ")", ":", "tmpcol", "=", "tmp", "[", "[", "c", "]", "]", ".", "dropna", "(", ")", "for", "r", "in", "tmpcol", ".", "index", ".", "tolist", "(", ")", ":", "cell", "=", "{", "}", "cell", "[", "str", "(", "table_key_column", ")", "]", "=", "str", "(", "r", ")", "# {\"name\":\"p53\"}", "val", "=", "tmpcol", ".", "loc", "[", "r", ",", "c", "]", "if", "type", "(", "val", ")", "!=", "str", ":", "val", "=", "float", "(", "val", ")", "cell", "[", "str", "(", "c", ")", "]", "=", "val", "data", ".", "append", "(", "cell", ")", "upload", "=", "{", "\"key\"", ":", "table_key_column", ",", "\"dataKey\"", ":", "table_key_column", ",", "\"data\"", ":", "data", "}", "URL", "=", "\"http://\"", "+", "str", "(", "host", ")", "+", "\":\"", "+", "str", "(", "port", ")", "+", "\"/v1/networks/\"", "+", "str", "(", "network", ")", "+", "\"/tables/\"", "+", "namespace", "+", "table", "if", "verbose", ":", "print", "(", "\"'\"", "+", "URL", "+", "\"'\"", ",", "upload", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "r", "=", "requests", ".", "put", "(", "url", "=", "URL", ",", "json", "=", "upload", ")", "if", "verbose", ":", "print", "(", "r", ")", "checkresponse", "(", "r", ")", "res", "=", "r", ".", "content", "return", "res" ]
Loads tables into cytoscape. :param df: a pandas dataframe to load :param df_key: key column in df, default="index" :param table: target table, default="node" :param table_key_column: table key column, default="name" :param network (string, optional): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to specify the current network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by Apps. :param verbose: print more information :returns: output of put request
[ "Loads", "tables", "into", "cytoscape", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L517-L588
12,071
cytoscape/py2cytoscape
py2cytoscape/cyrest/table.py
table.getTableCount
def getTableCount(verbose=None): """ Returns the number of global tables. :param verbose: print more :returns: 200: successful operation """ response=api(url=self.url+'tables/count', method="GET", verbose=verbose, parse_params=False) return response
python
def getTableCount(verbose=None): """ Returns the number of global tables. :param verbose: print more :returns: 200: successful operation """ response=api(url=self.url+'tables/count', method="GET", verbose=verbose, parse_params=False) return response
[ "def", "getTableCount", "(", "verbose", "=", "None", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "url", "+", "'tables/count'", ",", "method", "=", "\"GET\"", ",", "verbose", "=", "verbose", ",", "parse_params", "=", "False", ")", "return", "response" ]
Returns the number of global tables. :param verbose: print more :returns: 200: successful operation
[ "Returns", "the", "number", "of", "global", "tables", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L590-L600
12,072
cytoscape/py2cytoscape
py2cytoscape/data/base_view.py
BaseView.set_value
def set_value(self, visual_property, value): """Set a single Visual Property Value :param visual_property: Visual Property ID :param value: New value for the VP :return: None """ if visual_property is None or value is None: raise ValueError('Both VP and value are required.') new_value = [ { 'visualProperty': visual_property, "value": value } ] requests.put(self.url, data=json.dumps(new_value), headers=HEADERS)
python
def set_value(self, visual_property, value): """Set a single Visual Property Value :param visual_property: Visual Property ID :param value: New value for the VP :return: None """ if visual_property is None or value is None: raise ValueError('Both VP and value are required.') new_value = [ { 'visualProperty': visual_property, "value": value } ] requests.put(self.url, data=json.dumps(new_value), headers=HEADERS)
[ "def", "set_value", "(", "self", ",", "visual_property", ",", "value", ")", ":", "if", "visual_property", "is", "None", "or", "value", "is", "None", ":", "raise", "ValueError", "(", "'Both VP and value are required.'", ")", "new_value", "=", "[", "{", "'visualProperty'", ":", "visual_property", ",", "\"value\"", ":", "value", "}", "]", "requests", ".", "put", "(", "self", ".", "url", ",", "data", "=", "json", ".", "dumps", "(", "new_value", ")", ",", "headers", "=", "HEADERS", ")" ]
Set a single Visual Property Value :param visual_property: Visual Property ID :param value: New value for the VP :return: None
[ "Set", "a", "single", "Visual", "Property", "Value" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L41-L57
12,073
cytoscape/py2cytoscape
py2cytoscape/data/base_view.py
BaseView.set_values
def set_values(self, values): """ Set multiple Visual properties at once. :param values: :return: """ if values is None: raise ValueError('Values are required.') new_values = [] for vp in values.keys(): new_val = { 'visualProperty': vp, 'value': values[vp] } new_values.append(new_val) requests.put(self.url, data=json.dumps(new_values), headers=HEADERS)
python
def set_values(self, values): """ Set multiple Visual properties at once. :param values: :return: """ if values is None: raise ValueError('Values are required.') new_values = [] for vp in values.keys(): new_val = { 'visualProperty': vp, 'value': values[vp] } new_values.append(new_val) requests.put(self.url, data=json.dumps(new_values), headers=HEADERS)
[ "def", "set_values", "(", "self", ",", "values", ")", ":", "if", "values", "is", "None", ":", "raise", "ValueError", "(", "'Values are required.'", ")", "new_values", "=", "[", "]", "for", "vp", "in", "values", ".", "keys", "(", ")", ":", "new_val", "=", "{", "'visualProperty'", ":", "vp", ",", "'value'", ":", "values", "[", "vp", "]", "}", "new_values", ".", "append", "(", "new_val", ")", "requests", ".", "put", "(", "self", ".", "url", ",", "data", "=", "json", ".", "dumps", "(", "new_values", ")", ",", "headers", "=", "HEADERS", ")" ]
Set multiple Visual properties at once. :param values: :return:
[ "Set", "multiple", "Visual", "properties", "at", "once", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L59-L77
12,074
cytoscape/py2cytoscape
py2cytoscape/data/base_view.py
BaseView.get_value
def get_value(self, visual_property): """Get a value for the Visual Property :param visual_property: :return: """ res = requests.get(self.url + '/' + visual_property) return res.json()['value']
python
def get_value(self, visual_property): """Get a value for the Visual Property :param visual_property: :return: """ res = requests.get(self.url + '/' + visual_property) return res.json()['value']
[ "def", "get_value", "(", "self", ",", "visual_property", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/'", "+", "visual_property", ")", "return", "res", ".", "json", "(", ")", "[", "'value'", "]" ]
Get a value for the Visual Property :param visual_property: :return:
[ "Get", "a", "value", "for", "the", "Visual", "Property" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L79-L86
12,075
cytoscape/py2cytoscape
py2cytoscape/data/base_view.py
BaseView.get_values
def get_values(self): """Get all visual property values for the object :return: dictionary of values (VP ID - value) """ results = requests.get(self.url).json() values = {} for entry in results: values[entry['visualProperty']] = entry['value'] return values
python
def get_values(self): """Get all visual property values for the object :return: dictionary of values (VP ID - value) """ results = requests.get(self.url).json() values = {} for entry in results: values[entry['visualProperty']] = entry['value'] return values
[ "def", "get_values", "(", "self", ")", ":", "results", "=", "requests", ".", "get", "(", "self", ".", "url", ")", ".", "json", "(", ")", "values", "=", "{", "}", "for", "entry", "in", "results", ":", "values", "[", "entry", "[", "'visualProperty'", "]", "]", "=", "entry", "[", "'value'", "]", "return", "values" ]
Get all visual property values for the object :return: dictionary of values (VP ID - value)
[ "Get", "all", "visual", "property", "values", "for", "the", "object" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L88-L98
12,076
cytoscape/py2cytoscape
py2cytoscape/data/network_view.py
CyNetworkView.update_network_view
def update_network_view(self, visual_property=None, value=None): """ Updates single value for Network-related VP. :param visual_property: :param value: :return: """ new_value = [ { "visualProperty": visual_property, "value": value } ] res = requests.put(self.__url + '/network', data=json.dumps(new_value), headers=HEADERS) check_response(res)
python
def update_network_view(self, visual_property=None, value=None): """ Updates single value for Network-related VP. :param visual_property: :param value: :return: """ new_value = [ { "visualProperty": visual_property, "value": value } ] res = requests.put(self.__url + '/network', data=json.dumps(new_value), headers=HEADERS) check_response(res)
[ "def", "update_network_view", "(", "self", ",", "visual_property", "=", "None", ",", "value", "=", "None", ")", ":", "new_value", "=", "[", "{", "\"visualProperty\"", ":", "visual_property", ",", "\"value\"", ":", "value", "}", "]", "res", "=", "requests", ".", "put", "(", "self", ".", "__url", "+", "'/network'", ",", "data", "=", "json", ".", "dumps", "(", "new_value", ")", ",", "headers", "=", "HEADERS", ")", "check_response", "(", "res", ")" ]
Updates single value for Network-related VP. :param visual_property: :param value: :return:
[ "Updates", "single", "value", "for", "Network", "-", "related", "VP", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/network_view.py#L153-L171
12,077
cytoscape/py2cytoscape
py2cytoscape/cyrest/view.py
view.export
def export(self, Height=None, options=None, outputFile=None, Resolution=None,\ Units=None, Width=None, Zoom=None, view="current", verbose=False): """ Exports the current view to a graphics file and returns the path to the saved file. PNG and JPEG formats have options for scaling, while other formats only have the option 'exportTextAsFont'. For the PDF format, exporting text as font does not work for two-byte characters such as Chinese or Japanese. To avoid corrupted texts in the exported PDF, please set false to 'exportTextAsFont' when exporting networks including those non-English characters. :param Height (string, optional): The height of the exported image. Valid only for bitmap formats, such as PNG and JPEG. :param options (string, optional): The format of the output file. = ['JPEG (*.jpeg, *.jpg)', 'PDF (*.pdf)', 'PNG (*.png)', 'PostScript (*.ps)', 'SVG (*.svg)'] :param OutputFile (string, optional): The path name of the file where the view must be saved to. By default, the view's title is used as the file name. :param Resolution (string, optional): The resolution of the exported image, in DPI. Valid only for bitmap formats, when the selected width and height 'units' is inches. The possible values are: 72 (default), 100, 150, 300, 600. = ['72', '100', '150', '300', '600'] :param Units (string, optional): The units for the 'width' and 'height' values. Valid only for bitmap formats, such as PNG and JPEG. The possible values are: pixels (default), inches. = ['pixels', 'inches'] :param Width (string, optional): The width of the exported image. Valid only for bitmap formats, such as PNG and JPEG. :param Zoom (string, optional): The zoom value to proportionally scale the image. The default value is 100.0. Valid only for bitmap formats, such as PNG and JPEG :param verbose: print more :returns: path to the saved file """ PARAMS=set_param(["Height","options","outputFile","Resolution",\ "Units","Width","Zoom","view"],\ [Height,options,outputFile,Resolution,Units,Width,Zoom,view ]) response=api(url=self.__url+"/export", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def export(self, Height=None, options=None, outputFile=None, Resolution=None,\ Units=None, Width=None, Zoom=None, view="current", verbose=False): """ Exports the current view to a graphics file and returns the path to the saved file. PNG and JPEG formats have options for scaling, while other formats only have the option 'exportTextAsFont'. For the PDF format, exporting text as font does not work for two-byte characters such as Chinese or Japanese. To avoid corrupted texts in the exported PDF, please set false to 'exportTextAsFont' when exporting networks including those non-English characters. :param Height (string, optional): The height of the exported image. Valid only for bitmap formats, such as PNG and JPEG. :param options (string, optional): The format of the output file. = ['JPEG (*.jpeg, *.jpg)', 'PDF (*.pdf)', 'PNG (*.png)', 'PostScript (*.ps)', 'SVG (*.svg)'] :param OutputFile (string, optional): The path name of the file where the view must be saved to. By default, the view's title is used as the file name. :param Resolution (string, optional): The resolution of the exported image, in DPI. Valid only for bitmap formats, when the selected width and height 'units' is inches. The possible values are: 72 (default), 100, 150, 300, 600. = ['72', '100', '150', '300', '600'] :param Units (string, optional): The units for the 'width' and 'height' values. Valid only for bitmap formats, such as PNG and JPEG. The possible values are: pixels (default), inches. = ['pixels', 'inches'] :param Width (string, optional): The width of the exported image. Valid only for bitmap formats, such as PNG and JPEG. :param Zoom (string, optional): The zoom value to proportionally scale the image. The default value is 100.0. Valid only for bitmap formats, such as PNG and JPEG :param verbose: print more :returns: path to the saved file """ PARAMS=set_param(["Height","options","outputFile","Resolution",\ "Units","Width","Zoom","view"],\ [Height,options,outputFile,Resolution,Units,Width,Zoom,view ]) response=api(url=self.__url+"/export", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "export", "(", "self", ",", "Height", "=", "None", ",", "options", "=", "None", ",", "outputFile", "=", "None", ",", "Resolution", "=", "None", ",", "Units", "=", "None", ",", "Width", "=", "None", ",", "Zoom", "=", "None", ",", "view", "=", "\"current\"", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"Height\"", ",", "\"options\"", ",", "\"outputFile\"", ",", "\"Resolution\"", ",", "\"Units\"", ",", "\"Width\"", ",", "\"Zoom\"", ",", "\"view\"", "]", ",", "[", "Height", ",", "options", ",", "outputFile", ",", "Resolution", ",", "Units", ",", "Width", ",", "Zoom", ",", "view", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/export\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Exports the current view to a graphics file and returns the path to the saved file. PNG and JPEG formats have options for scaling, while other formats only have the option 'exportTextAsFont'. For the PDF format, exporting text as font does not work for two-byte characters such as Chinese or Japanese. To avoid corrupted texts in the exported PDF, please set false to 'exportTextAsFont' when exporting networks including those non-English characters. :param Height (string, optional): The height of the exported image. Valid only for bitmap formats, such as PNG and JPEG. :param options (string, optional): The format of the output file. = ['JPEG (*.jpeg, *.jpg)', 'PDF (*.pdf)', 'PNG (*.png)', 'PostScript (*.ps)', 'SVG (*.svg)'] :param OutputFile (string, optional): The path name of the file where the view must be saved to. By default, the view's title is used as the file name. :param Resolution (string, optional): The resolution of the exported image, in DPI. Valid only for bitmap formats, when the selected width and height 'units' is inches. The possible values are: 72 (default), 100, 150, 300, 600. = ['72', '100', '150', '300', '600'] :param Units (string, optional): The units for the 'width' and 'height' values. Valid only for bitmap formats, such as PNG and JPEG. The possible values are: pixels (default), inches. = ['pixels', 'inches'] :param Width (string, optional): The width of the exported image. Valid only for bitmap formats, such as PNG and JPEG. :param Zoom (string, optional): The zoom value to proportionally scale the image. The default value is 100.0. Valid only for bitmap formats, such as PNG and JPEG :param verbose: print more :returns: path to the saved file
[ "Exports", "the", "current", "view", "to", "a", "graphics", "file", "and", "returns", "the", "path", "to", "the", "saved", "file", ".", "PNG", "and", "JPEG", "formats", "have", "options", "for", "scaling", "while", "other", "formats", "only", "have", "the", "option", "exportTextAsFont", ".", "For", "the", "PDF", "format", "exporting", "text", "as", "font", "does", "not", "work", "for", "two", "-", "byte", "characters", "such", "as", "Chinese", "or", "Japanese", ".", "To", "avoid", "corrupted", "texts", "in", "the", "exported", "PDF", "please", "set", "false", "to", "exportTextAsFont", "when", "exporting", "networks", "including", "those", "non", "-", "English", "characters", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/view.py#L46-L85
12,078
cytoscape/py2cytoscape
py2cytoscape/cyrest/view.py
view.fit_content
def fit_content(self, verbose=False): """ Zooms out the current view in order to display all of its elements. :param verbose: print more """ PARAMS={} response=api(url=self.__url+"/fit content", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def fit_content(self, verbose=False): """ Zooms out the current view in order to display all of its elements. :param verbose: print more """ PARAMS={} response=api(url=self.__url+"/fit content", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "fit_content", "(", "self", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/fit content\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Zooms out the current view in order to display all of its elements. :param verbose: print more
[ "Zooms", "out", "the", "current", "view", "in", "order", "to", "display", "all", "of", "its", "elements", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/view.py#L87-L96
12,079
cytoscape/py2cytoscape
py2cytoscape/cyrest/view.py
view.get_current
def get_current(self, layout=None, network=None, verbose=False): """ Returns the current view or null if there is none. :param verbose: print more :returns: current view or null if there is none """ PARAMS={} response=api(url=self.__url+"/get_current", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def get_current(self, layout=None, network=None, verbose=False): """ Returns the current view or null if there is none. :param verbose: print more :returns: current view or null if there is none """ PARAMS={} response=api(url=self.__url+"/get_current", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "get_current", "(", "self", ",", "layout", "=", "None", ",", "network", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/get_current\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Returns the current view or null if there is none. :param verbose: print more :returns: current view or null if there is none
[ "Returns", "the", "current", "view", "or", "null", "if", "there", "is", "none", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/view.py#L110-L120
12,080
cytoscape/py2cytoscape
py2cytoscape/data/style.py
Style.update_defaults
def update_defaults(self, prop_value_dict): """ Updates the value of one or more visual properties. :param prop_value_dict: Dictionary containing, for each visual property, the new value to use. """ body = [] for key in prop_value_dict: entry = { 'visualProperty': key, 'value': prop_value_dict[key] } body.append(entry) url = self.__url + 'defaults' requests.put(url, data=json.dumps(body), headers=HEADERS)
python
def update_defaults(self, prop_value_dict): """ Updates the value of one or more visual properties. :param prop_value_dict: Dictionary containing, for each visual property, the new value to use. """ body = [] for key in prop_value_dict: entry = { 'visualProperty': key, 'value': prop_value_dict[key] } body.append(entry) url = self.__url + 'defaults' requests.put(url, data=json.dumps(body), headers=HEADERS)
[ "def", "update_defaults", "(", "self", ",", "prop_value_dict", ")", ":", "body", "=", "[", "]", "for", "key", "in", "prop_value_dict", ":", "entry", "=", "{", "'visualProperty'", ":", "key", ",", "'value'", ":", "prop_value_dict", "[", "key", "]", "}", "body", ".", "append", "(", "entry", ")", "url", "=", "self", ".", "__url", "+", "'defaults'", "requests", ".", "put", "(", "url", ",", "data", "=", "json", ".", "dumps", "(", "body", ")", ",", "headers", "=", "HEADERS", ")" ]
Updates the value of one or more visual properties. :param prop_value_dict: Dictionary containing, for each visual property, the new value to use.
[ "Updates", "the", "value", "of", "one", "or", "more", "visual", "properties", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/style.py#L112-L129
12,081
cytoscape/py2cytoscape
py2cytoscape/cyrest/cyrest.py
cyclient.status
def status(self, verbose=False): """ Checks the status of your CyREST server. """ try: response=api(url=self.__url, method="GET", verbose=verbose) except Exception as e: print('Could not get status from CyREST:\n\n' + str(e)) else: print('CyREST online!')
python
def status(self, verbose=False): """ Checks the status of your CyREST server. """ try: response=api(url=self.__url, method="GET", verbose=verbose) except Exception as e: print('Could not get status from CyREST:\n\n' + str(e)) else: print('CyREST online!')
[ "def", "status", "(", "self", ",", "verbose", "=", "False", ")", ":", "try", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", ",", "method", "=", "\"GET\"", ",", "verbose", "=", "verbose", ")", "except", "Exception", "as", "e", ":", "print", "(", "'Could not get status from CyREST:\\n\\n'", "+", "str", "(", "e", ")", ")", "else", ":", "print", "(", "'CyREST online!'", ")" ]
Checks the status of your CyREST server.
[ "Checks", "the", "status", "of", "your", "CyREST", "server", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cyrest.py#L67-L76
12,082
cytoscape/py2cytoscape
py2cytoscape/cyrest/cyrest.py
cyclient.version
def version(self, verbose=False): """ Checks Cytoscape version """ response=api(url=self.__url+"version",method="H", verbose=verbose) response=json.loads(response) for k in response.keys(): print(k, response[k])
python
def version(self, verbose=False): """ Checks Cytoscape version """ response=api(url=self.__url+"version",method="H", verbose=verbose) response=json.loads(response) for k in response.keys(): print(k, response[k])
[ "def", "version", "(", "self", ",", "verbose", "=", "False", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"version\"", ",", "method", "=", "\"H\"", ",", "verbose", "=", "verbose", ")", "response", "=", "json", ".", "loads", "(", "response", ")", "for", "k", "in", "response", ".", "keys", "(", ")", ":", "print", "(", "k", ",", "response", "[", "k", "]", ")" ]
Checks Cytoscape version
[ "Checks", "Cytoscape", "version" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cyrest.py#L84-L91
12,083
cytoscape/py2cytoscape
py2cytoscape/cyrest/idmapper.py
idmapper.map_column
def map_column(self, only_use_one=None, source_column=None, species=None, target_selection= None, verbose=False): """ Uses the BridgeDB service to look up analogous identifiers from a wide selection of other databases :param only_use_one (string, optional): When multiple identifiers can be mapped from a single term, this forces a singular result :param source_column (string): Specifies the column nmae where the source identifiers are located = [''] :param source_selection (string): Specifies the database describing the existing identifiers = [''] :param species (string, optional): The combined common or latin name of the species to which the identifiers apply = ['Human (Homo sapiens)', 'Mouse (Mus musculus)', 'Rat (Rattus norvegicus)', 'Frog (Xenopus tropicalis)', 'Zebra fish (Danio rerio)', 'Fruit fly (Drosophila melanogaster)', 'Mosquito (Anopheles gambiae)', 'Arabidopsis thaliana (Arabidopsis thaliana)', 'Yeast (Saccharomyces cerevisiae)', 'E. coli (Escherichia coli)', 'Tuberculosis (Mycobacterium tuberculosis)', 'Worm (Caenorhabditis elegans)'] :param target_selection (string): Specifies the database identifiers to be looked up = [''] :param verbose: print more :returns: eg. { "new column": "SGD " } """ PARAMS=set_param(["only_use_one","source_column","species","target_selection"],[only_use_one,source_column,species,target_selection]) response=api(url=self.__url+"/map column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
python
def map_column(self, only_use_one=None, source_column=None, species=None, target_selection= None, verbose=False): """ Uses the BridgeDB service to look up analogous identifiers from a wide selection of other databases :param only_use_one (string, optional): When multiple identifiers can be mapped from a single term, this forces a singular result :param source_column (string): Specifies the column nmae where the source identifiers are located = [''] :param source_selection (string): Specifies the database describing the existing identifiers = [''] :param species (string, optional): The combined common or latin name of the species to which the identifiers apply = ['Human (Homo sapiens)', 'Mouse (Mus musculus)', 'Rat (Rattus norvegicus)', 'Frog (Xenopus tropicalis)', 'Zebra fish (Danio rerio)', 'Fruit fly (Drosophila melanogaster)', 'Mosquito (Anopheles gambiae)', 'Arabidopsis thaliana (Arabidopsis thaliana)', 'Yeast (Saccharomyces cerevisiae)', 'E. coli (Escherichia coli)', 'Tuberculosis (Mycobacterium tuberculosis)', 'Worm (Caenorhabditis elegans)'] :param target_selection (string): Specifies the database identifiers to be looked up = [''] :param verbose: print more :returns: eg. { "new column": "SGD " } """ PARAMS=set_param(["only_use_one","source_column","species","target_selection"],[only_use_one,source_column,species,target_selection]) response=api(url=self.__url+"/map column", PARAMS=PARAMS, method="POST", verbose=verbose) return response
[ "def", "map_column", "(", "self", ",", "only_use_one", "=", "None", ",", "source_column", "=", "None", ",", "species", "=", "None", ",", "target_selection", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"only_use_one\"", ",", "\"source_column\"", ",", "\"species\"", ",", "\"target_selection\"", "]", ",", "[", "only_use_one", ",", "source_column", ",", "species", ",", "target_selection", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/map column\"", ",", "PARAMS", "=", "PARAMS", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Uses the BridgeDB service to look up analogous identifiers from a wide selection of other databases :param only_use_one (string, optional): When multiple identifiers can be mapped from a single term, this forces a singular result :param source_column (string): Specifies the column nmae where the source identifiers are located = [''] :param source_selection (string): Specifies the database describing the existing identifiers = [''] :param species (string, optional): The combined common or latin name of the species to which the identifiers apply = ['Human (Homo sapiens)', 'Mouse (Mus musculus)', 'Rat (Rattus norvegicus)', 'Frog (Xenopus tropicalis)', 'Zebra fish (Danio rerio)', 'Fruit fly (Drosophila melanogaster)', 'Mosquito (Anopheles gambiae)', 'Arabidopsis thaliana (Arabidopsis thaliana)', 'Yeast (Saccharomyces cerevisiae)', 'E. coli (Escherichia coli)', 'Tuberculosis (Mycobacterium tuberculosis)', 'Worm (Caenorhabditis elegans)'] :param target_selection (string): Specifies the database identifiers to be looked up = [''] :param verbose: print more :returns: eg. { "new column": "SGD " }
[ "Uses", "the", "BridgeDB", "service", "to", "look", "up", "analogous", "identifiers", "from", "a", "wide", "selection", "of", "other", "databases" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/idmapper.py#L13-L38
12,084
cytoscape/py2cytoscape
py2cytoscape/cyrest/command.py
command.echo
def echo(self, variableName, verbose=False): """ The echo command will display the value of the variable specified by the variableName argument, or all variables if variableName is not provided. :param variableName: The name of the variable or '*' to display the value of all variables. :param verbose: print more """ PARAMS={"variableName":variableName} response=api(url=self.__url+"/echo", PARAMS=PARAMS, verbose=verbose) return response
python
def echo(self, variableName, verbose=False): """ The echo command will display the value of the variable specified by the variableName argument, or all variables if variableName is not provided. :param variableName: The name of the variable or '*' to display the value of all variables. :param verbose: print more """ PARAMS={"variableName":variableName} response=api(url=self.__url+"/echo", PARAMS=PARAMS, verbose=verbose) return response
[ "def", "echo", "(", "self", ",", "variableName", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "\"variableName\"", ":", "variableName", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/echo\"", ",", "PARAMS", "=", "PARAMS", ",", "verbose", "=", "verbose", ")", "return", "response" ]
The echo command will display the value of the variable specified by the variableName argument, or all variables if variableName is not provided. :param variableName: The name of the variable or '*' to display the value of all variables. :param verbose: print more
[ "The", "echo", "command", "will", "display", "the", "value", "of", "the", "variable", "specified", "by", "the", "variableName", "argument", "or", "all", "variables", "if", "variableName", "is", "not", "provided", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L13-L23
12,085
cytoscape/py2cytoscape
py2cytoscape/cyrest/command.py
command.open_dialog
def open_dialog(self, verbose=False): """ The command line dialog provides a field to enter commands and view results. It also provides the help command to display namespaces, commands, and arguments. :param verbose: print more """ response=api(url=self.__url+"/open dialog", verbose=verbose) return response
python
def open_dialog(self, verbose=False): """ The command line dialog provides a field to enter commands and view results. It also provides the help command to display namespaces, commands, and arguments. :param verbose: print more """ response=api(url=self.__url+"/open dialog", verbose=verbose) return response
[ "def", "open_dialog", "(", "self", ",", "verbose", "=", "False", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/open dialog\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
The command line dialog provides a field to enter commands and view results. It also provides the help command to display namespaces, commands, and arguments. :param verbose: print more
[ "The", "command", "line", "dialog", "provides", "a", "field", "to", "enter", "commands", "and", "view", "results", ".", "It", "also", "provides", "the", "help", "command", "to", "display", "namespaces", "commands", "and", "arguments", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L25-L34
12,086
cytoscape/py2cytoscape
py2cytoscape/cyrest/command.py
command.pause
def pause(self, message=None, verbose=False): """ The pause command displays a dialog with the text provided in the message argument and waits for the user to click OK :param message: a message to display. default=None :param verbose: print more """ PARAMS=set_param(["message"],[message]) response=api(url=self.__url+"/pause", PARAMS=PARAMS, verbose=verbose) return response
python
def pause(self, message=None, verbose=False): """ The pause command displays a dialog with the text provided in the message argument and waits for the user to click OK :param message: a message to display. default=None :param verbose: print more """ PARAMS=set_param(["message"],[message]) response=api(url=self.__url+"/pause", PARAMS=PARAMS, verbose=verbose) return response
[ "def", "pause", "(", "self", ",", "message", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"message\"", "]", ",", "[", "message", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/pause\"", ",", "PARAMS", "=", "PARAMS", ",", "verbose", "=", "verbose", ")", "return", "response" ]
The pause command displays a dialog with the text provided in the message argument and waits for the user to click OK :param message: a message to display. default=None :param verbose: print more
[ "The", "pause", "command", "displays", "a", "dialog", "with", "the", "text", "provided", "in", "the", "message", "argument", "and", "waits", "for", "the", "user", "to", "click", "OK" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L37-L48
12,087
cytoscape/py2cytoscape
py2cytoscape/cyrest/command.py
command.quit
def quit(self,verbose=False): """ This command causes Cytoscape to exit. It is typically used at the end of a script file. :param verbose: print more """ response=api(url=self.__url+"/quit", verbose=verbose) return response
python
def quit(self,verbose=False): """ This command causes Cytoscape to exit. It is typically used at the end of a script file. :param verbose: print more """ response=api(url=self.__url+"/quit", verbose=verbose) return response
[ "def", "quit", "(", "self", ",", "verbose", "=", "False", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/quit\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
This command causes Cytoscape to exit. It is typically used at the end of a script file. :param verbose: print more
[ "This", "command", "causes", "Cytoscape", "to", "exit", ".", "It", "is", "typically", "used", "at", "the", "end", "of", "a", "script", "file", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L51-L59
12,088
cytoscape/py2cytoscape
py2cytoscape/cyrest/command.py
command.run
def run(self,script_file,args=None,verbose=False): """ The run command will execute a command script from the file pointed to by the file argument, which should contain Cytoscape commands, one per line. Arguments to the script are provided by the args argument. :param script_file: file to run :param args: enter the script arguments as key:value pairs separated by commas. eg. "arg1:value1,arg2:value2" :param verbose: print more """ PARAMS=set_param(["file","args"],[script_file,args]) response=api(url=self.__url+"/run", PARAMS=PARAMS, verbose=verbose) return response
python
def run(self,script_file,args=None,verbose=False): """ The run command will execute a command script from the file pointed to by the file argument, which should contain Cytoscape commands, one per line. Arguments to the script are provided by the args argument. :param script_file: file to run :param args: enter the script arguments as key:value pairs separated by commas. eg. "arg1:value1,arg2:value2" :param verbose: print more """ PARAMS=set_param(["file","args"],[script_file,args]) response=api(url=self.__url+"/run", PARAMS=PARAMS, verbose=verbose) return response
[ "def", "run", "(", "self", ",", "script_file", ",", "args", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"file\"", ",", "\"args\"", "]", ",", "[", "script_file", ",", "args", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/run\"", ",", "PARAMS", "=", "PARAMS", ",", "verbose", "=", "verbose", ")", "return", "response" ]
The run command will execute a command script from the file pointed to by the file argument, which should contain Cytoscape commands, one per line. Arguments to the script are provided by the args argument. :param script_file: file to run :param args: enter the script arguments as key:value pairs separated by commas. eg. "arg1:value1,arg2:value2" :param verbose: print more
[ "The", "run", "command", "will", "execute", "a", "command", "script", "from", "the", "file", "pointed", "to", "by", "the", "file", "argument", "which", "should", "contain", "Cytoscape", "commands", "one", "per", "line", ".", "Arguments", "to", "the", "script", "are", "provided", "by", "the", "args", "argument", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L61-L75
12,089
cytoscape/py2cytoscape
py2cytoscape/cyrest/command.py
command.sleep
def sleep(self,duration,verbose=False): """ The sleep command will pause processing for a period of time as specified by duration seconds. It is typically used as part of a command script. :param duration: enter the time in seconds to sleep :param verbose: print more """ PARAMS={"duration":str(duration)} response=api(url=self.__url+"/sleep", PARAMS=PARAMS, verbose=verbose) return response
python
def sleep(self,duration,verbose=False): """ The sleep command will pause processing for a period of time as specified by duration seconds. It is typically used as part of a command script. :param duration: enter the time in seconds to sleep :param verbose: print more """ PARAMS={"duration":str(duration)} response=api(url=self.__url+"/sleep", PARAMS=PARAMS, verbose=verbose) return response
[ "def", "sleep", "(", "self", ",", "duration", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "\"duration\"", ":", "str", "(", "duration", ")", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/sleep\"", ",", "PARAMS", "=", "PARAMS", ",", "verbose", "=", "verbose", ")", "return", "response" ]
The sleep command will pause processing for a period of time as specified by duration seconds. It is typically used as part of a command script. :param duration: enter the time in seconds to sleep :param verbose: print more
[ "The", "sleep", "command", "will", "pause", "processing", "for", "a", "period", "of", "time", "as", "specified", "by", "duration", "seconds", ".", "It", "is", "typically", "used", "as", "part", "of", "a", "command", "script", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L77-L87
12,090
ofw/curlify
curlify.py
to_curl
def to_curl(request, compressed=False, verify=True): """ Returns string with curl command by provided request object Parameters ---------- compressed : bool If `True` then `--compressed` argument will be added to result """ parts = [ ('curl', None), ('-X', request.method), ] for k, v in sorted(request.headers.items()): parts += [('-H', '{0}: {1}'.format(k, v))] if request.body: body = request.body if isinstance(body, bytes): body = body.decode('utf-8') parts += [('-d', body)] if compressed: parts += [('--compressed', None)] if not verify: parts += [('--insecure', None)] parts += [(None, request.url)] flat_parts = [] for k, v in parts: if k: flat_parts.append(k) if v: flat_parts.append("'{0}'".format(v)) return ' '.join(flat_parts)
python
def to_curl(request, compressed=False, verify=True): """ Returns string with curl command by provided request object Parameters ---------- compressed : bool If `True` then `--compressed` argument will be added to result """ parts = [ ('curl', None), ('-X', request.method), ] for k, v in sorted(request.headers.items()): parts += [('-H', '{0}: {1}'.format(k, v))] if request.body: body = request.body if isinstance(body, bytes): body = body.decode('utf-8') parts += [('-d', body)] if compressed: parts += [('--compressed', None)] if not verify: parts += [('--insecure', None)] parts += [(None, request.url)] flat_parts = [] for k, v in parts: if k: flat_parts.append(k) if v: flat_parts.append("'{0}'".format(v)) return ' '.join(flat_parts)
[ "def", "to_curl", "(", "request", ",", "compressed", "=", "False", ",", "verify", "=", "True", ")", ":", "parts", "=", "[", "(", "'curl'", ",", "None", ")", ",", "(", "'-X'", ",", "request", ".", "method", ")", ",", "]", "for", "k", ",", "v", "in", "sorted", "(", "request", ".", "headers", ".", "items", "(", ")", ")", ":", "parts", "+=", "[", "(", "'-H'", ",", "'{0}: {1}'", ".", "format", "(", "k", ",", "v", ")", ")", "]", "if", "request", ".", "body", ":", "body", "=", "request", ".", "body", "if", "isinstance", "(", "body", ",", "bytes", ")", ":", "body", "=", "body", ".", "decode", "(", "'utf-8'", ")", "parts", "+=", "[", "(", "'-d'", ",", "body", ")", "]", "if", "compressed", ":", "parts", "+=", "[", "(", "'--compressed'", ",", "None", ")", "]", "if", "not", "verify", ":", "parts", "+=", "[", "(", "'--insecure'", ",", "None", ")", "]", "parts", "+=", "[", "(", "None", ",", "request", ".", "url", ")", "]", "flat_parts", "=", "[", "]", "for", "k", ",", "v", "in", "parts", ":", "if", "k", ":", "flat_parts", ".", "append", "(", "k", ")", "if", "v", ":", "flat_parts", ".", "append", "(", "\"'{0}'\"", ".", "format", "(", "v", ")", ")", "return", "' '", ".", "join", "(", "flat_parts", ")" ]
Returns string with curl command by provided request object Parameters ---------- compressed : bool If `True` then `--compressed` argument will be added to result
[ "Returns", "string", "with", "curl", "command", "by", "provided", "request", "object" ]
5a464218431f979ac78d089682d36860b57420ce
https://github.com/ofw/curlify/blob/5a464218431f979ac78d089682d36860b57420ce/curlify.py#L4-L42
12,091
rq/Flask-RQ2
src/flask_rq2/cli.py
shared_options
def shared_options(rq): "Default class options to pass to the CLI commands." return { 'url': rq.redis_url, 'config': None, 'worker_class': rq.worker_class, 'job_class': rq.job_class, 'queue_class': rq.queue_class, 'connection_class': rq.connection_class, }
python
def shared_options(rq): "Default class options to pass to the CLI commands." return { 'url': rq.redis_url, 'config': None, 'worker_class': rq.worker_class, 'job_class': rq.job_class, 'queue_class': rq.queue_class, 'connection_class': rq.connection_class, }
[ "def", "shared_options", "(", "rq", ")", ":", "return", "{", "'url'", ":", "rq", ".", "redis_url", ",", "'config'", ":", "None", ",", "'worker_class'", ":", "rq", ".", "worker_class", ",", "'job_class'", ":", "rq", ".", "job_class", ",", "'queue_class'", ":", "rq", ".", "queue_class", ",", "'connection_class'", ":", "rq", ".", "connection_class", ",", "}" ]
Default class options to pass to the CLI commands.
[ "Default", "class", "options", "to", "pass", "to", "the", "CLI", "commands", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L35-L44
12,092
rq/Flask-RQ2
src/flask_rq2/cli.py
empty
def empty(rq, ctx, all, queues): "Empty given queues." return ctx.invoke( rq_cli.empty, all=all, queues=queues or rq.queues, **shared_options(rq) )
python
def empty(rq, ctx, all, queues): "Empty given queues." return ctx.invoke( rq_cli.empty, all=all, queues=queues or rq.queues, **shared_options(rq) )
[ "def", "empty", "(", "rq", ",", "ctx", ",", "all", ",", "queues", ")", ":", "return", "ctx", ".", "invoke", "(", "rq_cli", ".", "empty", ",", "all", "=", "all", ",", "queues", "=", "queues", "or", "rq", ".", "queues", ",", "*", "*", "shared_options", "(", "rq", ")", ")" ]
Empty given queues.
[ "Empty", "given", "queues", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L66-L73
12,093
rq/Flask-RQ2
src/flask_rq2/cli.py
requeue
def requeue(rq, ctx, all, job_ids): "Requeue failed jobs." return ctx.invoke( rq_cli.requeue, all=all, job_ids=job_ids, **shared_options(rq) )
python
def requeue(rq, ctx, all, job_ids): "Requeue failed jobs." return ctx.invoke( rq_cli.requeue, all=all, job_ids=job_ids, **shared_options(rq) )
[ "def", "requeue", "(", "rq", ",", "ctx", ",", "all", ",", "job_ids", ")", ":", "return", "ctx", ".", "invoke", "(", "rq_cli", ".", "requeue", ",", "all", "=", "all", ",", "job_ids", "=", "job_ids", ",", "*", "*", "shared_options", "(", "rq", ")", ")" ]
Requeue failed jobs.
[ "Requeue", "failed", "jobs", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L79-L86
12,094
rq/Flask-RQ2
src/flask_rq2/cli.py
info
def info(rq, ctx, path, interval, raw, only_queues, only_workers, by_queue, queues): "RQ command-line monitor." return ctx.invoke( rq_cli.info, path=path, interval=interval, raw=raw, only_queues=only_queues, only_workers=only_workers, by_queue=by_queue, queues=queues or rq.queues, **shared_options(rq) )
python
def info(rq, ctx, path, interval, raw, only_queues, only_workers, by_queue, queues): "RQ command-line monitor." return ctx.invoke( rq_cli.info, path=path, interval=interval, raw=raw, only_queues=only_queues, only_workers=only_workers, by_queue=by_queue, queues=queues or rq.queues, **shared_options(rq) )
[ "def", "info", "(", "rq", ",", "ctx", ",", "path", ",", "interval", ",", "raw", ",", "only_queues", ",", "only_workers", ",", "by_queue", ",", "queues", ")", ":", "return", "ctx", ".", "invoke", "(", "rq_cli", ".", "info", ",", "path", "=", "path", ",", "interval", "=", "interval", ",", "raw", "=", "raw", ",", "only_queues", "=", "only_queues", ",", "only_workers", "=", "only_workers", ",", "by_queue", "=", "by_queue", ",", "queues", "=", "queues", "or", "rq", ".", "queues", ",", "*", "*", "shared_options", "(", "rq", ")", ")" ]
RQ command-line monitor.
[ "RQ", "command", "-", "line", "monitor", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L100-L113
12,095
rq/Flask-RQ2
src/flask_rq2/cli.py
worker
def worker(rq, ctx, burst, logging_level, name, path, results_ttl, worker_ttl, verbose, quiet, sentry_dsn, exception_handler, pid, queues): "Starts an RQ worker." ctx.invoke( rq_cli.worker, burst=burst, logging_level=logging_level, name=name, path=path, results_ttl=results_ttl, worker_ttl=worker_ttl, verbose=verbose, quiet=quiet, sentry_dsn=sentry_dsn, exception_handler=exception_handler or rq._exception_handlers, pid=pid, queues=queues or rq.queues, **shared_options(rq) )
python
def worker(rq, ctx, burst, logging_level, name, path, results_ttl, worker_ttl, verbose, quiet, sentry_dsn, exception_handler, pid, queues): "Starts an RQ worker." ctx.invoke( rq_cli.worker, burst=burst, logging_level=logging_level, name=name, path=path, results_ttl=results_ttl, worker_ttl=worker_ttl, verbose=verbose, quiet=quiet, sentry_dsn=sentry_dsn, exception_handler=exception_handler or rq._exception_handlers, pid=pid, queues=queues or rq.queues, **shared_options(rq) )
[ "def", "worker", "(", "rq", ",", "ctx", ",", "burst", ",", "logging_level", ",", "name", ",", "path", ",", "results_ttl", ",", "worker_ttl", ",", "verbose", ",", "quiet", ",", "sentry_dsn", ",", "exception_handler", ",", "pid", ",", "queues", ")", ":", "ctx", ".", "invoke", "(", "rq_cli", ".", "worker", ",", "burst", "=", "burst", ",", "logging_level", "=", "logging_level", ",", "name", "=", "name", ",", "path", "=", "path", ",", "results_ttl", "=", "results_ttl", ",", "worker_ttl", "=", "worker_ttl", ",", "verbose", "=", "verbose", ",", "quiet", "=", "quiet", ",", "sentry_dsn", "=", "sentry_dsn", ",", "exception_handler", "=", "exception_handler", "or", "rq", ".", "_exception_handlers", ",", "pid", "=", "pid", ",", "queues", "=", "queues", "or", "rq", ".", "queues", ",", "*", "*", "shared_options", "(", "rq", ")", ")" ]
Starts an RQ worker.
[ "Starts", "an", "RQ", "worker", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L136-L155
12,096
rq/Flask-RQ2
src/flask_rq2/cli.py
suspend
def suspend(rq, ctx, duration): "Suspends all workers." ctx.invoke( rq_cli.suspend, duration=duration, **shared_options(rq) )
python
def suspend(rq, ctx, duration): "Suspends all workers." ctx.invoke( rq_cli.suspend, duration=duration, **shared_options(rq) )
[ "def", "suspend", "(", "rq", ",", "ctx", ",", "duration", ")", ":", "ctx", ".", "invoke", "(", "rq_cli", ".", "suspend", ",", "duration", "=", "duration", ",", "*", "*", "shared_options", "(", "rq", ")", ")" ]
Suspends all workers.
[ "Suspends", "all", "workers", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L162-L168
12,097
rq/Flask-RQ2
src/flask_rq2/cli.py
scheduler
def scheduler(rq, ctx, verbose, burst, queue, interval, pid): "Periodically checks for scheduled jobs." scheduler = rq.get_scheduler(interval=interval, queue=queue) if pid: with open(os.path.expanduser(pid), 'w') as fp: fp.write(str(os.getpid())) if verbose: level = 'DEBUG' else: level = 'INFO' setup_loghandlers(level) scheduler.run(burst=burst)
python
def scheduler(rq, ctx, verbose, burst, queue, interval, pid): "Periodically checks for scheduled jobs." scheduler = rq.get_scheduler(interval=interval, queue=queue) if pid: with open(os.path.expanduser(pid), 'w') as fp: fp.write(str(os.getpid())) if verbose: level = 'DEBUG' else: level = 'INFO' setup_loghandlers(level) scheduler.run(burst=burst)
[ "def", "scheduler", "(", "rq", ",", "ctx", ",", "verbose", ",", "burst", ",", "queue", ",", "interval", ",", "pid", ")", ":", "scheduler", "=", "rq", ".", "get_scheduler", "(", "interval", "=", "interval", ",", "queue", "=", "queue", ")", "if", "pid", ":", "with", "open", "(", "os", ".", "path", ".", "expanduser", "(", "pid", ")", ",", "'w'", ")", "as", "fp", ":", "fp", ".", "write", "(", "str", "(", "os", ".", "getpid", "(", ")", ")", ")", "if", "verbose", ":", "level", "=", "'DEBUG'", "else", ":", "level", "=", "'INFO'", "setup_loghandlers", "(", "level", ")", "scheduler", ".", "run", "(", "burst", "=", "burst", ")" ]
Periodically checks for scheduled jobs.
[ "Periodically", "checks", "for", "scheduled", "jobs", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L193-L204
12,098
rq/Flask-RQ2
src/flask_rq2/app.py
RQ.init_cli
def init_cli(self, app): """ Initialize the Flask CLI support in case it was enabled for the app. Works with both Flask>=1.0's CLI support as well as the backport in the Flask-CLI package for Flask<1.0. """ # in case click isn't installed after all if click is None: raise RuntimeError('Cannot import click. Is it installed?') # only add commands if we have a click context available from .cli import add_commands add_commands(app.cli, self)
python
def init_cli(self, app): """ Initialize the Flask CLI support in case it was enabled for the app. Works with both Flask>=1.0's CLI support as well as the backport in the Flask-CLI package for Flask<1.0. """ # in case click isn't installed after all if click is None: raise RuntimeError('Cannot import click. Is it installed?') # only add commands if we have a click context available from .cli import add_commands add_commands(app.cli, self)
[ "def", "init_cli", "(", "self", ",", "app", ")", ":", "# in case click isn't installed after all", "if", "click", "is", "None", ":", "raise", "RuntimeError", "(", "'Cannot import click. Is it installed?'", ")", "# only add commands if we have a click context available", "from", ".", "cli", "import", "add_commands", "add_commands", "(", "app", ".", "cli", ",", "self", ")" ]
Initialize the Flask CLI support in case it was enabled for the app. Works with both Flask>=1.0's CLI support as well as the backport in the Flask-CLI package for Flask<1.0.
[ "Initialize", "the", "Flask", "CLI", "support", "in", "case", "it", "was", "enabled", "for", "the", "app", "." ]
58eedf6f0cd7bcde4ccd787074762ea08f531337
https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/app.py#L195-L208
12,099
ionelmc/python-remote-pdb
src/remote_pdb.py
set_trace
def set_trace(host=None, port=None, patch_stdstreams=False): """ Opens a remote PDB on first available port. """ if host is None: host = os.environ.get('REMOTE_PDB_HOST', '127.0.0.1') if port is None: port = int(os.environ.get('REMOTE_PDB_PORT', '0')) rdb = RemotePdb(host=host, port=port, patch_stdstreams=patch_stdstreams) rdb.set_trace(frame=sys._getframe().f_back)
python
def set_trace(host=None, port=None, patch_stdstreams=False): """ Opens a remote PDB on first available port. """ if host is None: host = os.environ.get('REMOTE_PDB_HOST', '127.0.0.1') if port is None: port = int(os.environ.get('REMOTE_PDB_PORT', '0')) rdb = RemotePdb(host=host, port=port, patch_stdstreams=patch_stdstreams) rdb.set_trace(frame=sys._getframe().f_back)
[ "def", "set_trace", "(", "host", "=", "None", ",", "port", "=", "None", ",", "patch_stdstreams", "=", "False", ")", ":", "if", "host", "is", "None", ":", "host", "=", "os", ".", "environ", ".", "get", "(", "'REMOTE_PDB_HOST'", ",", "'127.0.0.1'", ")", "if", "port", "is", "None", ":", "port", "=", "int", "(", "os", ".", "environ", ".", "get", "(", "'REMOTE_PDB_PORT'", ",", "'0'", ")", ")", "rdb", "=", "RemotePdb", "(", "host", "=", "host", ",", "port", "=", "port", ",", "patch_stdstreams", "=", "patch_stdstreams", ")", "rdb", ".", "set_trace", "(", "frame", "=", "sys", ".", "_getframe", "(", ")", ".", "f_back", ")" ]
Opens a remote PDB on first available port.
[ "Opens", "a", "remote", "PDB", "on", "first", "available", "port", "." ]
152b4af3b8da282bbba1fc6b62f85d5cdf70be6e
https://github.com/ionelmc/python-remote-pdb/blob/152b4af3b8da282bbba1fc6b62f85d5cdf70be6e/src/remote_pdb.py#L121-L130