repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
carlosp420/dataset-creator
dataset_creator/tnt.py
TntDatasetBlock.convert_to_string
def convert_to_string(self, block): """ Takes a list of SeqRecordExpanded objects corresponding to a gene_code and produces the gene_block as string. :param block: :return: str. """ if self.aminoacids: molecule_type = "protein" else: ...
python
def convert_to_string(self, block): """ Takes a list of SeqRecordExpanded objects corresponding to a gene_code and produces the gene_block as string. :param block: :return: str. """ if self.aminoacids: molecule_type = "protein" else: ...
[ "def", "convert_to_string", "(", "self", ",", "block", ")", ":", "if", "self", ".", "aminoacids", ":", "molecule_type", "=", "\"protein\"", "else", ":", "molecule_type", "=", "\"dna\"", "out", "=", "None", "for", "seq_record", "in", "block", ":", "if", "no...
Takes a list of SeqRecordExpanded objects corresponding to a gene_code and produces the gene_block as string. :param block: :return: str.
[ "Takes", "a", "list", "of", "SeqRecordExpanded", "objects", "corresponding", "to", "a", "gene_code", "and", "produces", "the", "gene_block", "as", "string", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/tnt.py#L25-L53
dreipol/meta-tagger
meta_tagger/templatetags/meta_tagger_tags.py
render_title_tag
def render_title_tag(context, is_og=False): """ Returns the title as string or a complete open graph meta tag. """ request = context['request'] content = '' # Try to get the title from the context object (e.g. DetailViews). if context.get('object'): try: content = contex...
python
def render_title_tag(context, is_og=False): """ Returns the title as string or a complete open graph meta tag. """ request = context['request'] content = '' # Try to get the title from the context object (e.g. DetailViews). if context.get('object'): try: content = contex...
[ "def", "render_title_tag", "(", "context", ",", "is_og", "=", "False", ")", ":", "request", "=", "context", "[", "'request'", "]", "content", "=", "''", "# Try to get the title from the context object (e.g. DetailViews).", "if", "context", ".", "get", "(", "'object'...
Returns the title as string or a complete open graph meta tag.
[ "Returns", "the", "title", "as", "string", "or", "a", "complete", "open", "graph", "meta", "tag", "." ]
train
https://github.com/dreipol/meta-tagger/blob/e00a8c774d7b45882f068ba6d2706bb559de2b80/meta_tagger/templatetags/meta_tagger_tags.py#L29-L57
dreipol/meta-tagger
meta_tagger/templatetags/meta_tagger_tags.py
render_description_meta_tag
def render_description_meta_tag(context, is_og=False): """ Returns the description as meta or open graph tag. """ request = context['request'] content = '' # Try to get the description from the context object (e.g. DetailViews). if context.get('object'): try: content = c...
python
def render_description_meta_tag(context, is_og=False): """ Returns the description as meta or open graph tag. """ request = context['request'] content = '' # Try to get the description from the context object (e.g. DetailViews). if context.get('object'): try: content = c...
[ "def", "render_description_meta_tag", "(", "context", ",", "is_og", "=", "False", ")", ":", "request", "=", "context", "[", "'request'", "]", "content", "=", "''", "# Try to get the description from the context object (e.g. DetailViews).", "if", "context", ".", "get", ...
Returns the description as meta or open graph tag.
[ "Returns", "the", "description", "as", "meta", "or", "open", "graph", "tag", "." ]
train
https://github.com/dreipol/meta-tagger/blob/e00a8c774d7b45882f068ba6d2706bb559de2b80/meta_tagger/templatetags/meta_tagger_tags.py#L61-L91
dreipol/meta-tagger
meta_tagger/templatetags/meta_tagger_tags.py
render_robots_meta_tag
def render_robots_meta_tag(context): """ Returns the robots meta tag. """ request = context['request'] robots_indexing = None robots_following = None # Prevent indexing any unwanted domains (e.g. staging). if context.request.get_host() in settings.META_TAGGER_ROBOTS_DOMAIN_WHITELIST: ...
python
def render_robots_meta_tag(context): """ Returns the robots meta tag. """ request = context['request'] robots_indexing = None robots_following = None # Prevent indexing any unwanted domains (e.g. staging). if context.request.get_host() in settings.META_TAGGER_ROBOTS_DOMAIN_WHITELIST: ...
[ "def", "render_robots_meta_tag", "(", "context", ")", ":", "request", "=", "context", "[", "'request'", "]", "robots_indexing", "=", "None", "robots_following", "=", "None", "# Prevent indexing any unwanted domains (e.g. staging).", "if", "context", ".", "request", ".",...
Returns the robots meta tag.
[ "Returns", "the", "robots", "meta", "tag", "." ]
train
https://github.com/dreipol/meta-tagger/blob/e00a8c774d7b45882f068ba6d2706bb559de2b80/meta_tagger/templatetags/meta_tagger_tags.py#L95-L133
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client._key_digest
def _key_digest(self, secret_key): ''' a helper method for creating a base 64 encoded secret key and digest :param secret_key: string with key to encrypt/decrypt data :return: string with base64 key, string with base64 digest ''' from hashlib import ...
python
def _key_digest(self, secret_key): ''' a helper method for creating a base 64 encoded secret key and digest :param secret_key: string with key to encrypt/decrypt data :return: string with base64 key, string with base64 digest ''' from hashlib import ...
[ "def", "_key_digest", "(", "self", ",", "secret_key", ")", ":", "from", "hashlib", "import", "md5", ",", "sha256", "from", "base64", "import", "b64encode", "key_bytes", "=", "sha256", "(", "secret_key", ".", "encode", "(", "'utf-8'", ")", ")", ".", "digest...
a helper method for creating a base 64 encoded secret key and digest :param secret_key: string with key to encrypt/decrypt data :return: string with base64 key, string with base64 digest
[ "a", "helper", "method", "for", "creating", "a", "base", "64", "encoded", "secret", "key", "and", "digest", ":", "param", "secret_key", ":", "string", "with", "key", "to", "encrypt", "/", "decrypt", "data", ":", "return", ":", "string", "with", "base64", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L70-L85
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.list_buckets
def list_buckets(self): ''' a method to retrieve a list of buckets on s3 :return: list of buckets ''' title = '%s.list_buckets' % self.__class__.__name__ bucket_list = [] # send request to s3 try: response = self.connection...
python
def list_buckets(self): ''' a method to retrieve a list of buckets on s3 :return: list of buckets ''' title = '%s.list_buckets' % self.__class__.__name__ bucket_list = [] # send request to s3 try: response = self.connection...
[ "def", "list_buckets", "(", "self", ")", ":", "title", "=", "'%s.list_buckets'", "%", "self", ".", "__class__", ".", "__name__", "bucket_list", "=", "[", "]", "# send request to s3", "try", ":", "response", "=", "self", ".", "connection", ".", "list_buckets", ...
a method to retrieve a list of buckets on s3 :return: list of buckets
[ "a", "method", "to", "retrieve", "a", "list", "of", "buckets", "on", "s3" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L87-L111
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.create_bucket
def create_bucket(self, bucket_name, access_control='private', version_control=False, log_destination=None, lifecycle_rules=None, tag_list=None, notification_settings=None, region_replication=None, access_policy=None): ''' a method for creating a bucket on AWS S3 :param bucket...
python
def create_bucket(self, bucket_name, access_control='private', version_control=False, log_destination=None, lifecycle_rules=None, tag_list=None, notification_settings=None, region_replication=None, access_policy=None): ''' a method for creating a bucket on AWS S3 :param bucket...
[ "def", "create_bucket", "(", "self", ",", "bucket_name", ",", "access_control", "=", "'private'", ",", "version_control", "=", "False", ",", "log_destination", "=", "None", ",", "lifecycle_rules", "=", "None", ",", "tag_list", "=", "None", ",", "notification_set...
a method for creating a bucket on AWS S3 :param bucket_name: string with name of bucket :param access_control: string with type of access control policy :param version_control: [optional] boolean to enable versioning of records :param log_destination: [optional] dictionary w...
[ "a", "method", "for", "creating", "a", "bucket", "on", "AWS", "S3", ":", "param", "bucket_name", ":", "string", "with", "name", "of", "bucket", ":", "param", "access_control", ":", "string", "with", "type", "of", "access", "control", "policy", ":", "param"...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L113-L340
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.read_bucket
def read_bucket(self, bucket_name): ''' a method to retrieve properties of a bucket in s3 :param bucket_name: string with name of bucket :return: dictionary with details of bucket ''' title = '%s.read_bucket' % self.__class__.__name__ # validate inputs...
python
def read_bucket(self, bucket_name): ''' a method to retrieve properties of a bucket in s3 :param bucket_name: string with name of bucket :return: dictionary with details of bucket ''' title = '%s.read_bucket' % self.__class__.__name__ # validate inputs...
[ "def", "read_bucket", "(", "self", ",", "bucket_name", ")", ":", "title", "=", "'%s.read_bucket'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'bucket_name'", ":", "bucket_name", "}", "for", "key", ",", "valu...
a method to retrieve properties of a bucket in s3 :param bucket_name: string with name of bucket :return: dictionary with details of bucket
[ "a", "method", "to", "retrieve", "properties", "of", "a", "bucket", "in", "s3" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L342-L514
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.update_bucket
def update_bucket(self, bucket_name, access_control='private', version_control=False, log_destination=None, lifecycle_rules=None, tag_list=None, notification_settings=None, region_replication=None, access_policy=None): ''' a method for updating the properties of a bucket in S3 :param bucke...
python
def update_bucket(self, bucket_name, access_control='private', version_control=False, log_destination=None, lifecycle_rules=None, tag_list=None, notification_settings=None, region_replication=None, access_policy=None): ''' a method for updating the properties of a bucket in S3 :param bucke...
[ "def", "update_bucket", "(", "self", ",", "bucket_name", ",", "access_control", "=", "'private'", ",", "version_control", "=", "False", ",", "log_destination", "=", "None", ",", "lifecycle_rules", "=", "None", ",", "tag_list", "=", "None", ",", "notification_set...
a method for updating the properties of a bucket in S3 :param bucket_name: string with name of bucket :param access_control: string with type of access control policy :param version_control: [optional] boolean to enable versioning of records :param log_destination: [optional] dictionary...
[ "a", "method", "for", "updating", "the", "properties", "of", "a", "bucket", "in", "S3" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L516-L788
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.delete_bucket
def delete_bucket(self, bucket_name): ''' a method to delete a bucket in s3 and all its contents :param bucket_name: string with name of bucket :return: string with status of method ''' title = '%s.delete_bucket' % self.__class__.__name__ # validate in...
python
def delete_bucket(self, bucket_name): ''' a method to delete a bucket in s3 and all its contents :param bucket_name: string with name of bucket :return: string with status of method ''' title = '%s.delete_bucket' % self.__class__.__name__ # validate in...
[ "def", "delete_bucket", "(", "self", ",", "bucket_name", ")", ":", "title", "=", "'%s.delete_bucket'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'bucket_name'", ":", "bucket_name", "}", "for", "key", ",", "...
a method to delete a bucket in s3 and all its contents :param bucket_name: string with name of bucket :return: string with status of method
[ "a", "method", "to", "delete", "a", "bucket", "in", "s3", "and", "all", "its", "contents" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L790-L867
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.list_records
def list_records(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key=''): ''' a method for retrieving a list of the versions of records in a bucket :param bucket_name: string with name of bucket :param prefix: [optional] string with value limiting results to ...
python
def list_records(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key=''): ''' a method for retrieving a list of the versions of records in a bucket :param bucket_name: string with name of bucket :param prefix: [optional] string with value limiting results to ...
[ "def", "list_records", "(", "self", ",", "bucket_name", ",", "prefix", "=", "''", ",", "delimiter", "=", "''", ",", "max_results", "=", "1000", ",", "starting_key", "=", "''", ")", ":", "title", "=", "'%s.list_records'", "%", "self", ".", "__class__", "....
a method for retrieving a list of the versions of records in a bucket :param bucket_name: string with name of bucket :param prefix: [optional] string with value limiting results to key prefix :param delimiter: string with value which results must not contain (after prefix) :param max_re...
[ "a", "method", "for", "retrieving", "a", "list", "of", "the", "versions", "of", "records", "in", "a", "bucket" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L869-L941
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.list_versions
def list_versions(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key='', starting_version=''): ''' a method for retrieving a list of the versions of records in a bucket :param bucket_name: string with name of bucket :param prefix: [optional] string with valu...
python
def list_versions(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key='', starting_version=''): ''' a method for retrieving a list of the versions of records in a bucket :param bucket_name: string with name of bucket :param prefix: [optional] string with valu...
[ "def", "list_versions", "(", "self", ",", "bucket_name", ",", "prefix", "=", "''", ",", "delimiter", "=", "''", ",", "max_results", "=", "1000", ",", "starting_key", "=", "''", ",", "starting_version", "=", "''", ")", ":", "title", "=", "'%s.list_versions'...
a method for retrieving a list of the versions of records in a bucket :param bucket_name: string with name of bucket :param prefix: [optional] string with value limiting results to key prefix :param delimiter: [optional] string with value limiting results to key delimiter :param max_res...
[ "a", "method", "for", "retrieving", "a", "list", "of", "the", "versions", "of", "records", "in", "a", "bucket" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L943-L1046
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.create_record
def create_record(self, bucket_name, record_key, record_data, record_metadata=None, record_mimetype='', record_encoding='', overwrite=True): ''' a method for adding a record to an S3 bucket :param bucket_name: string with name of bucket :param record_key: string with na...
python
def create_record(self, bucket_name, record_key, record_data, record_metadata=None, record_mimetype='', record_encoding='', overwrite=True): ''' a method for adding a record to an S3 bucket :param bucket_name: string with name of bucket :param record_key: string with na...
[ "def", "create_record", "(", "self", ",", "bucket_name", ",", "record_key", ",", "record_data", ",", "record_metadata", "=", "None", ",", "record_mimetype", "=", "''", ",", "record_encoding", "=", "''", ",", "overwrite", "=", "True", ")", ":", "title", "=", ...
a method for adding a record to an S3 bucket :param bucket_name: string with name of bucket :param record_key: string with name of key (path) for record :param record_data: byte data for record :param record_metadata: [optional] dictionary with metadata to attach to record ...
[ "a", "method", "for", "adding", "a", "record", "to", "an", "S3", "bucket", ":", "param", "bucket_name", ":", "string", "with", "name", "of", "bucket", ":", "param", "record_key", ":", "string", "with", "name", "of", "key", "(", "path", ")", "for", "rec...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1048-L1165
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.read_headers
def read_headers(self, bucket_name, record_key, record_version='', version_check=False): ''' a method for retrieving the headers of a record from s3 :param bucket_name: string with name of bucket :param record_key: string with key value of record :param record_version: [opt...
python
def read_headers(self, bucket_name, record_key, record_version='', version_check=False): ''' a method for retrieving the headers of a record from s3 :param bucket_name: string with name of bucket :param record_key: string with key value of record :param record_version: [opt...
[ "def", "read_headers", "(", "self", ",", "bucket_name", ",", "record_key", ",", "record_version", "=", "''", ",", "version_check", "=", "False", ")", ":", "title", "=", "'%s.read_headers'", "%", "self", ".", "__class__", ".", "__name__", "from", "datetime", ...
a method for retrieving the headers of a record from s3 :param bucket_name: string with name of bucket :param record_key: string with key value of record :param record_version: [optional] string with aws id of version of record :param version_check: [optional] boolean to enable current ...
[ "a", "method", "for", "retrieving", "the", "headers", "of", "a", "record", "from", "s3" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1167-L1252
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.read_record
def read_record(self, bucket_name, record_key, record_version='', version_check=False): ''' a method for retrieving data of record from AWS S3 :param bucket_name: string with name of bucket :param record_key: string with name of key (path) for record :param reco...
python
def read_record(self, bucket_name, record_key, record_version='', version_check=False): ''' a method for retrieving data of record from AWS S3 :param bucket_name: string with name of bucket :param record_key: string with name of key (path) for record :param reco...
[ "def", "read_record", "(", "self", ",", "bucket_name", ",", "record_key", ",", "record_version", "=", "''", ",", "version_check", "=", "False", ")", ":", "title", "=", "'%s.read_record'", "%", "self", ".", "__class__", ".", "__name__", "from", "datetime", "i...
a method for retrieving data of record from AWS S3 :param bucket_name: string with name of bucket :param record_key: string with name of key (path) for record :param record_version: [optional] string with aws id of version of record :param version_check: [optional] boolean t...
[ "a", "method", "for", "retrieving", "data", "of", "record", "from", "AWS", "S3", ":", "param", "bucket_name", ":", "string", "with", "name", "of", "bucket", ":", "param", "record_key", ":", "string", "with", "name", "of", "key", "(", "path", ")", "for", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1254-L1343
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.delete_record
def delete_record(self, bucket_name, record_key, record_version=''): ''' a method for deleting an object record in s3 :param bucket_name: string with name of bucket :param record_key: string with key value of record :param record_version: [optional] string with aws id of ve...
python
def delete_record(self, bucket_name, record_key, record_version=''): ''' a method for deleting an object record in s3 :param bucket_name: string with name of bucket :param record_key: string with key value of record :param record_version: [optional] string with aws id of ve...
[ "def", "delete_record", "(", "self", ",", "bucket_name", ",", "record_key", ",", "record_version", "=", "''", ")", ":", "title", "=", "'%s.delete_record'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'bucket_na...
a method for deleting an object record in s3 :param bucket_name: string with name of bucket :param record_key: string with key value of record :param record_version: [optional] string with aws id of version of record :return: dictionary with status of delete request
[ "a", "method", "for", "deleting", "an", "object", "record", "in", "s3" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1345-L1396
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.export_records
def export_records(self, bucket_name, export_path='', overwrite=True): ''' a method to export all the records from a bucket to local files :param bucket_name: string with name of bucket :param export_path: [optional] string with path to root directory for record dump :param...
python
def export_records(self, bucket_name, export_path='', overwrite=True): ''' a method to export all the records from a bucket to local files :param bucket_name: string with name of bucket :param export_path: [optional] string with path to root directory for record dump :param...
[ "def", "export_records", "(", "self", ",", "bucket_name", ",", "export_path", "=", "''", ",", "overwrite", "=", "True", ")", ":", "title", "=", "'%s.export_records'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{"...
a method to export all the records from a bucket to local files :param bucket_name: string with name of bucket :param export_path: [optional] string with path to root directory for record dump :param overwrite: [optional] boolean to overwrite existing files matching records :return: Tru...
[ "a", "method", "to", "export", "all", "the", "records", "from", "a", "bucket", "to", "local", "files" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1398-L1488
collectiveacuity/labPack
labpack/storage/aws/s3.py
_s3Client.import_records
def import_records(self, bucket_name, import_path='', overwrite=True): ''' a method to importing records from local files to a bucket :param bucket_name: string with name of bucket :param export_path: [optional] string with path to root directory of files :param overwrite: ...
python
def import_records(self, bucket_name, import_path='', overwrite=True): ''' a method to importing records from local files to a bucket :param bucket_name: string with name of bucket :param export_path: [optional] string with path to root directory of files :param overwrite: ...
[ "def", "import_records", "(", "self", ",", "bucket_name", ",", "import_path", "=", "''", ",", "overwrite", "=", "True", ")", ":", "title", "=", "'%s.import_records'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{"...
a method to importing records from local files to a bucket :param bucket_name: string with name of bucket :param export_path: [optional] string with path to root directory of files :param overwrite: [optional] boolean to overwrite existing files matching records :return: True
[ "a", "method", "to", "importing", "records", "from", "local", "files", "to", "a", "bucket" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1490-L1548
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client._import
def _import(self, record_key, record_data, overwrite=True, encryption='', last_modified=0.0, **kwargs): ''' a helper method for other storage clients to import into s3 :param record_key: string with key for record :param record_data: byte data for body of record...
python
def _import(self, record_key, record_data, overwrite=True, encryption='', last_modified=0.0, **kwargs): ''' a helper method for other storage clients to import into s3 :param record_key: string with key for record :param record_data: byte data for body of record...
[ "def", "_import", "(", "self", ",", "record_key", ",", "record_data", ",", "overwrite", "=", "True", ",", "encryption", "=", "''", ",", "last_modified", "=", "0.0", ",", "*", "*", "kwargs", ")", ":", "# define keyword arguments", "from", "time", "import", ...
a helper method for other storage clients to import into s3 :param record_key: string with key for record :param record_data: byte data for body of record :param overwrite: [optional] boolean to overwrite existing records :param encryption: [optional] string with encryption ...
[ "a", "helper", "method", "for", "other", "storage", "clients", "to", "import", "into", "s3", ":", "param", "record_key", ":", "string", "with", "key", "for", "record", ":", "param", "record_data", ":", "byte", "data", "for", "body", "of", "record", ":", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1639-L1695
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client.exists
def exists(self, record_key): ''' a method to determine if a record exists in collection :param record_key: string with key of record :return: boolean reporting status ''' title = '%s.exists' % self.__class__.__name__ # validate inputs ...
python
def exists(self, record_key): ''' a method to determine if a record exists in collection :param record_key: string with key of record :return: boolean reporting status ''' title = '%s.exists' % self.__class__.__name__ # validate inputs ...
[ "def", "exists", "(", "self", ",", "record_key", ")", ":", "title", "=", "'%s.exists'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'record_key'", ":", "record_key", "}", "for", "key", ",", "value", "in", ...
a method to determine if a record exists in collection :param record_key: string with key of record :return: boolean reporting status
[ "a", "method", "to", "determine", "if", "a", "record", "exists", "in", "collection" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1697-L1720
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client.save
def save(self, record_key, record_data, overwrite=True, secret_key=''): ''' a method to create a file in the collection folder on S3 :param record_key: string with name to assign to record (see NOTES below) :param record_data: byte data for record body :param overw...
python
def save(self, record_key, record_data, overwrite=True, secret_key=''): ''' a method to create a file in the collection folder on S3 :param record_key: string with name to assign to record (see NOTES below) :param record_data: byte data for record body :param overw...
[ "def", "save", "(", "self", ",", "record_key", ",", "record_data", ",", "overwrite", "=", "True", ",", "secret_key", "=", "''", ")", ":", "title", "=", "'%s.save'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "...
a method to create a file in the collection folder on S3 :param record_key: string with name to assign to record (see NOTES below) :param record_data: byte data for record body :param overwrite: [optional] boolean to overwrite records with same name :param secret_key: [optional] string ...
[ "a", "method", "to", "create", "a", "file", "in", "the", "collection", "folder", "on", "S3" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1722-L1796
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client.load
def load(self, record_key, secret_key=''): ''' a method to retrieve byte data of an S3 record :param record_key: string with name of record :param secret_key: [optional] string used to decrypt data :return: byte data for record body ''' titl...
python
def load(self, record_key, secret_key=''): ''' a method to retrieve byte data of an S3 record :param record_key: string with name of record :param secret_key: [optional] string used to decrypt data :return: byte data for record body ''' titl...
[ "def", "load", "(", "self", ",", "record_key", ",", "secret_key", "=", "''", ")", ":", "title", "=", "'%s.load'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'record_key'", ":", "record_key", ",", "'secret_...
a method to retrieve byte data of an S3 record :param record_key: string with name of record :param secret_key: [optional] string used to decrypt data :return: byte data for record body
[ "a", "method", "to", "retrieve", "byte", "data", "of", "an", "S3", "record" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1798-L1838
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client.list
def list(self, prefix='', delimiter='', filter_function=None, max_results=1, previous_key=''): ''' a method to list keys in the collection :param prefix: string with prefix value to filter results :param delimiter: string with value results must not contain (after prefix) ...
python
def list(self, prefix='', delimiter='', filter_function=None, max_results=1, previous_key=''): ''' a method to list keys in the collection :param prefix: string with prefix value to filter results :param delimiter: string with value results must not contain (after prefix) ...
[ "def", "list", "(", "self", ",", "prefix", "=", "''", ",", "delimiter", "=", "''", ",", "filter_function", "=", "None", ",", "max_results", "=", "1", ",", "previous_key", "=", "''", ")", ":", "title", "=", "'%s.list'", "%", "self", ".", "__class__", ...
a method to list keys in the collection :param prefix: string with prefix value to filter results :param delimiter: string with value results must not contain (after prefix) :param filter_function: (positional arguments) function used to filter results :param max_results: integer with m...
[ "a", "method", "to", "list", "keys", "in", "the", "collection" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1873-L1991
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client.delete
def delete(self, record_key): ''' a method to delete a record from S3 :param record_key: string with key of record :return: string reporting outcome ''' title = '%s.delete' % self.__class__.__name__ # validate inputs input_fields = { 'r...
python
def delete(self, record_key): ''' a method to delete a record from S3 :param record_key: string with key of record :return: string reporting outcome ''' title = '%s.delete' % self.__class__.__name__ # validate inputs input_fields = { 'r...
[ "def", "delete", "(", "self", ",", "record_key", ")", ":", "title", "=", "'%s.delete'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'record_key'", ":", "record_key", "}", "for", "key", ",", "value", "in", ...
a method to delete a record from S3 :param record_key: string with key of record :return: string reporting outcome
[ "a", "method", "to", "delete", "a", "record", "from", "S3" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L1993-L2021
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client.remove
def remove(self): ''' a method to remove collection and all records in the collection :return: string with confirmation of deletion ''' title = '%s.remove' % self.__class__.__name__ # request bucket delete self.s3.delete_bucket(self.bucket_na...
python
def remove(self): ''' a method to remove collection and all records in the collection :return: string with confirmation of deletion ''' title = '%s.remove' % self.__class__.__name__ # request bucket delete self.s3.delete_bucket(self.bucket_na...
[ "def", "remove", "(", "self", ")", ":", "title", "=", "'%s.remove'", "%", "self", ".", "__class__", ".", "__name__", "# request bucket delete ", "self", ".", "s3", ".", "delete_bucket", "(", "self", ".", "bucket_name", ")", "# return confirmation", "exit_msg", ...
a method to remove collection and all records in the collection :return: string with confirmation of deletion
[ "a", "method", "to", "remove", "collection", "and", "all", "records", "in", "the", "collection" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L2023-L2038
collectiveacuity/labPack
labpack/storage/aws/s3.py
s3Client.export
def export(self, storage_client, overwrite=True): ''' a method to export all the records in collection to another platform :param storage_client: class object with storage client methods :return: string with exit message ''' title = '%s.expo...
python
def export(self, storage_client, overwrite=True): ''' a method to export all the records in collection to another platform :param storage_client: class object with storage client methods :return: string with exit message ''' title = '%s.expo...
[ "def", "export", "(", "self", ",", "storage_client", ",", "overwrite", "=", "True", ")", ":", "title", "=", "'%s.export'", "%", "self", ".", "__class__", ".", "__name__", "# validate storage client", "method_list", "=", "[", "'save'", ",", "'load'", ",", "'l...
a method to export all the records in collection to another platform :param storage_client: class object with storage client methods :return: string with exit message
[ "a", "method", "to", "export", "all", "the", "records", "in", "collection", "to", "another", "platform", ":", "param", "storage_client", ":", "class", "object", "with", "storage", "client", "methods", ":", "return", ":", "string", "with", "exit", "message" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/aws/s3.py#L2040-L2109
nefarioustim/parker
parker/crawlpage.py
is_uri_to_be_filtered
def is_uri_to_be_filtered(uri, filter_list): """Test whether @uri should be filtered by @filter_list.""" match = False if filter_list: for uri_filter in filter_list: if re.search(uri_filter, uri, flags=re.IGNORECASE): match = True return match
python
def is_uri_to_be_filtered(uri, filter_list): """Test whether @uri should be filtered by @filter_list.""" match = False if filter_list: for uri_filter in filter_list: if re.search(uri_filter, uri, flags=re.IGNORECASE): match = True return match
[ "def", "is_uri_to_be_filtered", "(", "uri", ",", "filter_list", ")", ":", "match", "=", "False", "if", "filter_list", ":", "for", "uri_filter", "in", "filter_list", ":", "if", "re", ".", "search", "(", "uri_filter", ",", "uri", ",", "flags", "=", "re", "...
Test whether @uri should be filtered by @filter_list.
[ "Test", "whether" ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/crawlpage.py#L70-L77
nefarioustim/parker
parker/crawlpage.py
CrawlPage.get_uris
def get_uris(self, base_uri, filter_list=None): """Return a set of internal URIs.""" return { re.sub(r'^/', base_uri, link.attrib['href']) for link in self.parsedpage.get_nodes_by_selector('a') if 'href' in link.attrib and ( link.attrib['href'].startsw...
python
def get_uris(self, base_uri, filter_list=None): """Return a set of internal URIs.""" return { re.sub(r'^/', base_uri, link.attrib['href']) for link in self.parsedpage.get_nodes_by_selector('a') if 'href' in link.attrib and ( link.attrib['href'].startsw...
[ "def", "get_uris", "(", "self", ",", "base_uri", ",", "filter_list", "=", "None", ")", ":", "return", "{", "re", ".", "sub", "(", "r'^/'", ",", "base_uri", ",", "link", ".", "attrib", "[", "'href'", "]", ")", "for", "link", "in", "self", ".", "pars...
Return a set of internal URIs.
[ "Return", "a", "set", "of", "internal", "URIs", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/crawlpage.py#L53-L63
codeif/qcos
qcos/auth.py
filter_headers
def filter_headers(data): """只设置host content-type 还有x开头的头部. :param data(dict): 所有的头部信息. :return(dict): 计算进签名的头部. """ headers = {} for i in data: if i == 'Content-Type' or i == 'Host' or i[0] == 'x' or i[0] == 'X': headers[i] = data[i] return headers
python
def filter_headers(data): """只设置host content-type 还有x开头的头部. :param data(dict): 所有的头部信息. :return(dict): 计算进签名的头部. """ headers = {} for i in data: if i == 'Content-Type' or i == 'Host' or i[0] == 'x' or i[0] == 'X': headers[i] = data[i] return headers
[ "def", "filter_headers", "(", "data", ")", ":", "headers", "=", "{", "}", "for", "i", "in", "data", ":", "if", "i", "==", "'Content-Type'", "or", "i", "==", "'Host'", "or", "i", "[", "0", "]", "==", "'x'", "or", "i", "[", "0", "]", "==", "'X'",...
只设置host content-type 还有x开头的头部. :param data(dict): 所有的头部信息. :return(dict): 计算进签名的头部.
[ "只设置host", "content", "-", "type", "还有x开头的头部", "." ]
train
https://github.com/codeif/qcos/blob/284988094e54ed28161ae57b6d956b43ac1096d4/qcos/auth.py#L18-L28
neillc/angular-gettext-babel
angular_gettext_babel/extract.py
extract_angular
def extract_angular(fileobj, keywords, comment_tags, options): """Extract messages from angular template (HTML) files that use the angular-gettext translate directive as per https://angular-gettext.rocketeer.be/ . :param fileobj: the file-like object the messages should be extracted ...
python
def extract_angular(fileobj, keywords, comment_tags, options): """Extract messages from angular template (HTML) files that use the angular-gettext translate directive as per https://angular-gettext.rocketeer.be/ . :param fileobj: the file-like object the messages should be extracted ...
[ "def", "extract_angular", "(", "fileobj", ",", "keywords", ",", "comment_tags", ",", "options", ")", ":", "if", "keywords", ":", "logging", ".", "debug", "(", "'Parameter keywords ignored.'", ")", "if", "comment_tags", ":", "logging", ".", "debug", "(", "'Para...
Extract messages from angular template (HTML) files that use the angular-gettext translate directive as per https://angular-gettext.rocketeer.be/ . :param fileobj: the file-like object the messages should be extracted from :param keywords: This is a standard parameter so it is accep...
[ "Extract", "messages", "from", "angular", "template", "(", "HTML", ")", "files", "that", "use", "the", "angular", "-", "gettext", "translate", "directive", "as", "per", "https", ":", "//", "angular", "-", "gettext", ".", "rocketeer", ".", "be", "/", "." ]
train
https://github.com/neillc/angular-gettext-babel/blob/675278040b8256fd4bb93076abdd7bebbfbd2187/angular_gettext_babel/extract.py#L105-L145
dayski/requestlogs
requestlogs/tasks.py
find
def find(*args, **kwargs): """ kwargs supported: user: the username start_at: start datetime object end_at: end datetime object limit: # of objects to fetch """ # default end_at to now and start to 1 day from now end_at = kwargs.get('end_at', datetime.datetime.now()) ...
python
def find(*args, **kwargs): """ kwargs supported: user: the username start_at: start datetime object end_at: end datetime object limit: # of objects to fetch """ # default end_at to now and start to 1 day from now end_at = kwargs.get('end_at', datetime.datetime.now()) ...
[ "def", "find", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# default end_at to now and start to 1 day from now", "end_at", "=", "kwargs", ".", "get", "(", "'end_at'", ",", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "start_at", "=", "...
kwargs supported: user: the username start_at: start datetime object end_at: end datetime object limit: # of objects to fetch
[ "kwargs", "supported", ":", "user", ":", "the", "username", "start_at", ":", "start", "datetime", "object", "end_at", ":", "end", "datetime", "object", "limit", ":", "#", "of", "objects", "to", "fetch" ]
train
https://github.com/dayski/requestlogs/blob/c22bba4ddfe2a514c1cec08cf49b2e29373db537/requestlogs/tasks.py#L13-L33
lwcook/horsetail-matching
horsetailmatching/demoproblems.py
TP0
def TP0(dv, u): '''Demo problem 0 for horsetail matching, takes two input vectors of any size and returns a single output''' return np.linalg.norm(np.array(dv)) + np.linalg.norm(np.array(u))
python
def TP0(dv, u): '''Demo problem 0 for horsetail matching, takes two input vectors of any size and returns a single output''' return np.linalg.norm(np.array(dv)) + np.linalg.norm(np.array(u))
[ "def", "TP0", "(", "dv", ",", "u", ")", ":", "return", "np", ".", "linalg", ".", "norm", "(", "np", ".", "array", "(", "dv", ")", ")", "+", "np", ".", "linalg", ".", "norm", "(", "np", ".", "array", "(", "u", ")", ")" ]
Demo problem 0 for horsetail matching, takes two input vectors of any size and returns a single output
[ "Demo", "problem", "0", "for", "horsetail", "matching", "takes", "two", "input", "vectors", "of", "any", "size", "and", "returns", "a", "single", "output" ]
train
https://github.com/lwcook/horsetail-matching/blob/f3d5f8d01249debbca978f412ce4eae017458119/horsetailmatching/demoproblems.py#L3-L6
lwcook/horsetail-matching
horsetailmatching/demoproblems.py
TP1
def TP1(x, u, jac=False): '''Demo problem 1 for horsetail matching, takes two input vectors of size 2 and returns just the qoi if jac is False or the qoi and its gradient if jac is True''' factor = 0.1*(u[0]**2 + 2*u[0]*u[1] + u[1]**2) q = 0 + factor*(x[0]**2 + 2*x[1]*x[0] + x[1]**2) if not jac:...
python
def TP1(x, u, jac=False): '''Demo problem 1 for horsetail matching, takes two input vectors of size 2 and returns just the qoi if jac is False or the qoi and its gradient if jac is True''' factor = 0.1*(u[0]**2 + 2*u[0]*u[1] + u[1]**2) q = 0 + factor*(x[0]**2 + 2*x[1]*x[0] + x[1]**2) if not jac:...
[ "def", "TP1", "(", "x", ",", "u", ",", "jac", "=", "False", ")", ":", "factor", "=", "0.1", "*", "(", "u", "[", "0", "]", "**", "2", "+", "2", "*", "u", "[", "0", "]", "*", "u", "[", "1", "]", "+", "u", "[", "1", "]", "**", "2", ")"...
Demo problem 1 for horsetail matching, takes two input vectors of size 2 and returns just the qoi if jac is False or the qoi and its gradient if jac is True
[ "Demo", "problem", "1", "for", "horsetail", "matching", "takes", "two", "input", "vectors", "of", "size", "2", "and", "returns", "just", "the", "qoi", "if", "jac", "is", "False", "or", "the", "qoi", "and", "its", "gradient", "if", "jac", "is", "True" ]
train
https://github.com/lwcook/horsetail-matching/blob/f3d5f8d01249debbca978f412ce4eae017458119/horsetailmatching/demoproblems.py#L8-L18
lwcook/horsetail-matching
horsetailmatching/demoproblems.py
TP2
def TP2(dv, u, jac=False): '''Demo problem 2 for horsetail matching, takes two input vectors of size 2 and returns just the qoi if jac is False or the qoi and its gradient if jac is True''' y = dv[0]/2. z = dv[1]/2. + 12 q = 0.25*((y**2 + z**2)/10 + 5*u[0]*u[1] - z*u[1]**2) + 0.2*z*u[1]**3 + 7 ...
python
def TP2(dv, u, jac=False): '''Demo problem 2 for horsetail matching, takes two input vectors of size 2 and returns just the qoi if jac is False or the qoi and its gradient if jac is True''' y = dv[0]/2. z = dv[1]/2. + 12 q = 0.25*((y**2 + z**2)/10 + 5*u[0]*u[1] - z*u[1]**2) + 0.2*z*u[1]**3 + 7 ...
[ "def", "TP2", "(", "dv", ",", "u", ",", "jac", "=", "False", ")", ":", "y", "=", "dv", "[", "0", "]", "/", "2.", "z", "=", "dv", "[", "1", "]", "/", "2.", "+", "12", "q", "=", "0.25", "*", "(", "(", "y", "**", "2", "+", "z", "**", "...
Demo problem 2 for horsetail matching, takes two input vectors of size 2 and returns just the qoi if jac is False or the qoi and its gradient if jac is True
[ "Demo", "problem", "2", "for", "horsetail", "matching", "takes", "two", "input", "vectors", "of", "size", "2", "and", "returns", "just", "the", "qoi", "if", "jac", "is", "False", "or", "the", "qoi", "and", "its", "gradient", "if", "jac", "is", "True" ]
train
https://github.com/lwcook/horsetail-matching/blob/f3d5f8d01249debbca978f412ce4eae017458119/horsetailmatching/demoproblems.py#L20-L34
lwcook/horsetail-matching
horsetailmatching/demoproblems.py
TP3
def TP3(x, u, jac=False): '''Demo problem 1 for horsetail matching, takes two input values of size 1''' q = 2 + 0.5*x + 1.5*(1-x)*u if not jac: return q else: grad = 0.5 -1.5*u return q, grad
python
def TP3(x, u, jac=False): '''Demo problem 1 for horsetail matching, takes two input values of size 1''' q = 2 + 0.5*x + 1.5*(1-x)*u if not jac: return q else: grad = 0.5 -1.5*u return q, grad
[ "def", "TP3", "(", "x", ",", "u", ",", "jac", "=", "False", ")", ":", "q", "=", "2", "+", "0.5", "*", "x", "+", "1.5", "*", "(", "1", "-", "x", ")", "*", "u", "if", "not", "jac", ":", "return", "q", "else", ":", "grad", "=", "0.5", "-",...
Demo problem 1 for horsetail matching, takes two input values of size 1
[ "Demo", "problem", "1", "for", "horsetail", "matching", "takes", "two", "input", "values", "of", "size", "1" ]
train
https://github.com/lwcook/horsetail-matching/blob/f3d5f8d01249debbca978f412ce4eae017458119/horsetailmatching/demoproblems.py#L53-L62
CS207-Final-Project-Group-10/cs207-FinalProject
example_newtons_method.py
newtons_method_scalar
def newtons_method_scalar(f: fl.Fluxion, x: float, tol: float =1e-8) -> float: """Solve the equation f(x) = 0 for a function from R->R using Newton's method""" max_iters: int = 100 for i in range(max_iters): # Evaluate f(x) and f'(x) y, dy_dx = f(x) # Is y within the tolerance? ...
python
def newtons_method_scalar(f: fl.Fluxion, x: float, tol: float =1e-8) -> float: """Solve the equation f(x) = 0 for a function from R->R using Newton's method""" max_iters: int = 100 for i in range(max_iters): # Evaluate f(x) and f'(x) y, dy_dx = f(x) # Is y within the tolerance? ...
[ "def", "newtons_method_scalar", "(", "f", ":", "fl", ".", "Fluxion", ",", "x", ":", "float", ",", "tol", ":", "float", "=", "1e-8", ")", "->", "float", ":", "max_iters", ":", "int", "=", "100", "for", "i", "in", "range", "(", "max_iters", ")", ":",...
Solve the equation f(x) = 0 for a function from R->R using Newton's method
[ "Solve", "the", "equation", "f", "(", "x", ")", "=", "0", "for", "a", "function", "from", "R", "-", ">", "R", "using", "Newton", "s", "method" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/example_newtons_method.py#L7-L21
dasevilla/rovi-python
roviclient/base.py
RoviApi.make_request
def make_request(self, resource, params=None): """ Performs the API request. Most methods are a wrapper around this one. """ if params is None: params = {} url = self.request_url(resource) params['format'] = 'json' r = self.session.get(url=url, param...
python
def make_request(self, resource, params=None): """ Performs the API request. Most methods are a wrapper around this one. """ if params is None: params = {} url = self.request_url(resource) params['format'] = 'json' r = self.session.get(url=url, param...
[ "def", "make_request", "(", "self", ",", "resource", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "url", "=", "self", ".", "request_url", "(", "resource", ")", "params", "[", "'format'", "]", "=", ...
Performs the API request. Most methods are a wrapper around this one.
[ "Performs", "the", "API", "request", ".", "Most", "methods", "are", "a", "wrapper", "around", "this", "one", "." ]
train
https://github.com/dasevilla/rovi-python/blob/46039d6ebfcf2ff20b4edb4636cb972682cf6af4/roviclient/base.py#L52-L66
sassoo/goldman
goldman/stores/base.py
Cache.get
def get(self, key, bucket): """ Get a cached item by key If the cached item isn't found the return None. """ try: return self._cache[bucket][key] except (KeyError, TypeError): return None
python
def get(self, key, bucket): """ Get a cached item by key If the cached item isn't found the return None. """ try: return self._cache[bucket][key] except (KeyError, TypeError): return None
[ "def", "get", "(", "self", ",", "key", ",", "bucket", ")", ":", "try", ":", "return", "self", ".", "_cache", "[", "bucket", "]", "[", "key", "]", "except", "(", "KeyError", ",", "TypeError", ")", ":", "return", "None" ]
Get a cached item by key If the cached item isn't found the return None.
[ "Get", "a", "cached", "item", "by", "key" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/base.py#L24-L33
sassoo/goldman
goldman/stores/base.py
Cache.set
def set(self, key, val, bucket): """ Set a cached item by key WARN: Regardless if the item is already in the cache, it will be udpated with the new value. """ if bucket not in self._cache: self._cache[bucket] = {} self._cache[bucket][key] = val
python
def set(self, key, val, bucket): """ Set a cached item by key WARN: Regardless if the item is already in the cache, it will be udpated with the new value. """ if bucket not in self._cache: self._cache[bucket] = {} self._cache[bucket][key] = val
[ "def", "set", "(", "self", ",", "key", ",", "val", ",", "bucket", ")", ":", "if", "bucket", "not", "in", "self", ".", "_cache", ":", "self", ".", "_cache", "[", "bucket", "]", "=", "{", "}", "self", ".", "_cache", "[", "bucket", "]", "[", "key"...
Set a cached item by key WARN: Regardless if the item is already in the cache, it will be udpated with the new value.
[ "Set", "a", "cached", "item", "by", "key" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/base.py#L35-L45
stephanepechard/projy
projy/templates/ProjyTemplate.py
ProjyTemplate.create
def create(self, project_name, template_name, substitutions): """ Launch the project creation. """ self.project_name = project_name self.template_name = template_name # create substitutions dictionary from user arguments # TODO: check what is given for subs in substituti...
python
def create(self, project_name, template_name, substitutions): """ Launch the project creation. """ self.project_name = project_name self.template_name = template_name # create substitutions dictionary from user arguments # TODO: check what is given for subs in substituti...
[ "def", "create", "(", "self", ",", "project_name", ",", "template_name", ",", "substitutions", ")", ":", "self", ".", "project_name", "=", "project_name", "self", ".", "template_name", "=", "template_name", "# create substitutions dictionary from user arguments", "# TOD...
Launch the project creation.
[ "Launch", "the", "project", "creation", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/ProjyTemplate.py#L27-L45
stephanepechard/projy
projy/templates/ProjyTemplate.py
ProjyTemplate.make_directories
def make_directories(self): """ Create the directories of the template. """ # get the directories from the template directories = [] try: directories = self.directories() except AttributeError: self.term.print_info(u"No directory in the template.") ...
python
def make_directories(self): """ Create the directories of the template. """ # get the directories from the template directories = [] try: directories = self.directories() except AttributeError: self.term.print_info(u"No directory in the template.") ...
[ "def", "make_directories", "(", "self", ")", ":", "# get the directories from the template", "directories", "=", "[", "]", "try", ":", "directories", "=", "self", ".", "directories", "(", ")", "except", "AttributeError", ":", "self", ".", "term", ".", "print_inf...
Create the directories of the template.
[ "Create", "the", "directories", "of", "the", "template", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/ProjyTemplate.py#L48-L73
stephanepechard/projy
projy/templates/ProjyTemplate.py
ProjyTemplate.make_files
def make_files(self): """ Create the files of the template. """ # get the files from the template files = [] try: files = self.files() except AttributeError: self.term.print_info(u"No file in the template. Weird, but why not?") # get the substit...
python
def make_files(self): """ Create the files of the template. """ # get the files from the template files = [] try: files = self.files() except AttributeError: self.term.print_info(u"No file in the template. Weird, but why not?") # get the substit...
[ "def", "make_files", "(", "self", ")", ":", "# get the files from the template", "files", "=", "[", "]", "try", ":", "files", "=", "self", ".", "files", "(", ")", "except", "AttributeError", ":", "self", ".", "term", ".", "print_info", "(", "u\"No file in th...
Create the files of the template.
[ "Create", "the", "files", "of", "the", "template", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/ProjyTemplate.py#L76-L135
stephanepechard/projy
projy/templates/ProjyTemplate.py
ProjyTemplate.make_posthook
def make_posthook(self): """ Run the post hook into the project directory. """ print(id(self.posthook), self.posthook) print(id(super(self.__class__, self).posthook), super(self.__class__, self).posthook) import ipdb;ipdb.set_trace() if self.posthook: os.chdir(self.pr...
python
def make_posthook(self): """ Run the post hook into the project directory. """ print(id(self.posthook), self.posthook) print(id(super(self.__class__, self).posthook), super(self.__class__, self).posthook) import ipdb;ipdb.set_trace() if self.posthook: os.chdir(self.pr...
[ "def", "make_posthook", "(", "self", ")", ":", "print", "(", "id", "(", "self", ".", "posthook", ")", ",", "self", ".", "posthook", ")", "print", "(", "id", "(", "super", "(", "self", ".", "__class__", ",", "self", ")", ".", "posthook", ")", ",", ...
Run the post hook into the project directory.
[ "Run", "the", "post", "hook", "into", "the", "project", "directory", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/ProjyTemplate.py#L138-L145
stephanepechard/projy
projy/templates/ProjyTemplate.py
ProjyTemplate.replace_in_file
def replace_in_file(self, file_path, old_exp, new_exp): """ In the given file, replace all 'old_exp' by 'new_exp'. """ self.term.print_info(u"Making replacement into {}" .format(self.term.text_in_color(file_path, ...
python
def replace_in_file(self, file_path, old_exp, new_exp): """ In the given file, replace all 'old_exp' by 'new_exp'. """ self.term.print_info(u"Making replacement into {}" .format(self.term.text_in_color(file_path, ...
[ "def", "replace_in_file", "(", "self", ",", "file_path", ",", "old_exp", ",", "new_exp", ")", ":", "self", ".", "term", ".", "print_info", "(", "u\"Making replacement into {}\"", ".", "format", "(", "self", ".", "term", ".", "text_in_color", "(", "file_path", ...
In the given file, replace all 'old_exp' by 'new_exp'.
[ "In", "the", "given", "file", "replace", "all", "old_exp", "by", "new_exp", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/ProjyTemplate.py#L148-L166
sassoo/goldman
goldman/middleware/serializer/__init__.py
Middleware.process_resource
def process_resource(self, req, resp, resource): """ Process the request after routing. Serializer selection needs a resource to determine which serializers are allowed. """ if resource: allowed = resource.serializer_mimetypes preferred = req.client_pref...
python
def process_resource(self, req, resp, resource): """ Process the request after routing. Serializer selection needs a resource to determine which serializers are allowed. """ if resource: allowed = resource.serializer_mimetypes preferred = req.client_pref...
[ "def", "process_resource", "(", "self", ",", "req", ",", "resp", ",", "resource", ")", ":", "if", "resource", ":", "allowed", "=", "resource", ".", "serializer_mimetypes", "preferred", "=", "req", ".", "client_prefers", "(", "allowed", ")", "if", "not", "p...
Process the request after routing. Serializer selection needs a resource to determine which serializers are allowed.
[ "Process", "the", "request", "after", "routing", "." ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/middleware/serializer/__init__.py#L40-L55
dossier/dossier.models
dossier/models/openquery/fetcher.py
ChunkRoller.add
def add(self, si): '''puts `si` into the currently open chunk, which it creates if necessary. If this item causes the chunk to cross chunk_max, then the chunk closed after adding. ''' if self.o_chunk is None: if os.path.exists(self.t_path): os.remove...
python
def add(self, si): '''puts `si` into the currently open chunk, which it creates if necessary. If this item causes the chunk to cross chunk_max, then the chunk closed after adding. ''' if self.o_chunk is None: if os.path.exists(self.t_path): os.remove...
[ "def", "add", "(", "self", ",", "si", ")", ":", "if", "self", ".", "o_chunk", "is", "None", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "t_path", ")", ":", "os", ".", "remove", "(", "self", ".", "t_path", ")", "self", ".", ...
puts `si` into the currently open chunk, which it creates if necessary. If this item causes the chunk to cross chunk_max, then the chunk closed after adding.
[ "puts", "si", "into", "the", "currently", "open", "chunk", "which", "it", "creates", "if", "necessary", ".", "If", "this", "item", "causes", "the", "chunk", "to", "cross", "chunk_max", "then", "the", "chunk", "closed", "after", "adding", "." ]
train
https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/openquery/fetcher.py#L108-L121
ikalnytskyi/dooku
dooku/algorithm.py
find_if
def find_if(pred, iterable, default=None): """ Returns a reference to the first element in the ``iterable`` range for which ``pred`` returns ``True``. If no such element is found, the function returns ``default``. >>> find_if(lambda x: x == 3, [1, 2, 3, 4]) 3 :param pred: a predica...
python
def find_if(pred, iterable, default=None): """ Returns a reference to the first element in the ``iterable`` range for which ``pred`` returns ``True``. If no such element is found, the function returns ``default``. >>> find_if(lambda x: x == 3, [1, 2, 3, 4]) 3 :param pred: a predica...
[ "def", "find_if", "(", "pred", ",", "iterable", ",", "default", "=", "None", ")", ":", "return", "next", "(", "(", "i", "for", "i", "in", "iterable", "if", "pred", "(", "i", ")", ")", ",", "default", ")" ]
Returns a reference to the first element in the ``iterable`` range for which ``pred`` returns ``True``. If no such element is found, the function returns ``default``. >>> find_if(lambda x: x == 3, [1, 2, 3, 4]) 3 :param pred: a predicate function to check a value from the iterable range ...
[ "Returns", "a", "reference", "to", "the", "first", "element", "in", "the", "iterable", "range", "for", "which", "pred", "returns", "True", ".", "If", "no", "such", "element", "is", "found", "the", "function", "returns", "default", "." ]
train
https://github.com/ikalnytskyi/dooku/blob/77e6c82c9c41211c86ee36ae5e591d477945fedf/dooku/algorithm.py#L43-L57
twidi/py-dataql
dataql/parsers/generic.py
DataQLParser.visit_root
def visit_root(self, _, children): """The main node holding all the query. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``WS`` (whitespace): ``None``. - 1: for ``NAMED_RESOURCE``: an instance of a subclass of ``.resourc...
python
def visit_root(self, _, children): """The main node holding all the query. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``WS`` (whitespace): ``None``. - 1: for ``NAMED_RESOURCE``: an instance of a subclass of ``.resourc...
[ "def", "visit_root", "(", "self", ",", "_", ",", "children", ")", ":", "resource", "=", "children", "[", "1", "]", "resource", ".", "is_root", "=", "True", "return", "resource" ]
The main node holding all the query. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``WS`` (whitespace): ``None``. - 1: for ``NAMED_RESOURCE``: an instance of a subclass of ``.resources.Resource``. - 2: for ``WS`` (wh...
[ "The", "main", "node", "holding", "all", "the", "query", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/generic.py#L78-L127
twidi/py-dataql
dataql/parsers/generic.py
DataQLParser.visit_named_resource
def visit_named_resource(self, _, children): """A resource in the query with its optional name. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``OPTIONAL_RESOURCE_NAME``: str, the name of the resource, or ``None`` if not ...
python
def visit_named_resource(self, _, children): """A resource in the query with its optional name. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``OPTIONAL_RESOURCE_NAME``: str, the name of the resource, or ``None`` if not ...
[ "def", "visit_named_resource", "(", "self", ",", "_", ",", "children", ")", ":", "name", ",", "resource", "=", "children", "if", "name", ":", "resource", ".", "name", "=", "name", "return", "resource" ]
A resource in the query with its optional name. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``OPTIONAL_RESOURCE_NAME``: str, the name of the resource, or ``None`` if not set in the query. - 1: for ``RESOURCE``...
[ "A", "resource", "in", "the", "query", "with", "its", "optional", "name", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/generic.py#L167-L199
twidi/py-dataql
dataql/parsers/generic.py
DataQLParser.visit_field
def visit_field(self, _, children): """A simple field. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``FILTERS``: list of instances of ``.resources.Field``. Returns ------- .resources.Field An in...
python
def visit_field(self, _, children): """A simple field. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``FILTERS``: list of instances of ``.resources.Field``. Returns ------- .resources.Field An in...
[ "def", "visit_field", "(", "self", ",", "_", ",", "children", ")", ":", "filters", "=", "children", "[", "0", "]", "return", "self", ".", "Field", "(", "getattr", "(", "filters", "[", "0", "]", ",", "'name'", ",", "None", ")", ",", "filters", "=", ...
A simple field. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``FILTERS``: list of instances of ``.resources.Field``. Returns ------- .resources.Field An instance of ``.resources.Field`` with the correct...
[ "A", "simple", "field", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/generic.py#L373-L399
twidi/py-dataql
dataql/parsers/generic.py
DataQLParser.visit_named_object
def visit_named_object(self, _, children): """Manage an object, represented by a ``.resources.Object`` instance. This object is populated with data from the result of the ``FILTERS``. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - ...
python
def visit_named_object(self, _, children): """Manage an object, represented by a ``.resources.Object`` instance. This object is populated with data from the result of the ``FILTERS``. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - ...
[ "def", "visit_named_object", "(", "self", ",", "_", ",", "children", ")", ":", "filters", ",", "resource", "=", "children", "resource", ".", "name", "=", "filters", "[", "0", "]", ".", "name", "resource", ".", "filters", "=", "filters", "return", "resour...
Manage an object, represented by a ``.resources.Object`` instance. This object is populated with data from the result of the ``FILTERS``. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``FILTERS``: list of instances of ``.resources....
[ "Manage", "an", "object", "represented", "by", "a", ".", "resources", ".", "Object", "instance", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/generic.py#L402-L428
twidi/py-dataql
dataql/parsers/generic.py
DataQLParser.visit_named_list
def visit_named_list(self, _, children): """Manage a list, represented by a ``.resources.List`` instance. This list is populated with data from the result of the ``FILTERS``. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``...
python
def visit_named_list(self, _, children): """Manage a list, represented by a ``.resources.List`` instance. This list is populated with data from the result of the ``FILTERS``. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``...
[ "def", "visit_named_list", "(", "self", ",", "_", ",", "children", ")", ":", "filters", ",", "resource", "=", "children", "resource", ".", "name", "=", "filters", "[", "0", "]", ".", "name", "resource", ".", "filters", "=", "filters", "return", "resource...
Manage a list, represented by a ``.resources.List`` instance. This list is populated with data from the result of the ``FILTERS``. Arguments --------- _ (node) : parsimonious.nodes.Node. children : list - 0: for ``FILTERS``: list of instances of ``.resources.Field``...
[ "Manage", "a", "list", "represented", "by", "a", ".", "resources", ".", "List", "instance", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/generic.py#L456-L482
maxfischer2781/include
include/__init__.py
disable
def disable(identifier, children_only=False): """ Disable an include type :param identifier: module or name of the include type :param children_only: disable the include type only for child processes, not the current process The ``identifier`` can be specified in multiple ways to disable an includ...
python
def disable(identifier, children_only=False): """ Disable an include type :param identifier: module or name of the include type :param children_only: disable the include type only for child processes, not the current process The ``identifier`` can be specified in multiple ways to disable an includ...
[ "def", "disable", "(", "identifier", ",", "children_only", "=", "False", ")", ":", "DISABLED_TYPES", ".", "disable", "(", "identifier", "=", "identifier", ",", "children_only", "=", "children_only", ")" ]
Disable an include type :param identifier: module or name of the include type :param children_only: disable the include type only for child processes, not the current process The ``identifier`` can be specified in multiple ways to disable an include type. See :py:meth:`~.DisabledIncludeTypes.disable` ...
[ "Disable", "an", "include", "type" ]
train
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/__init__.py#L68-L78
maxfischer2781/include
include/__init__.py
enable
def enable(identifier, exclude_children=False): """ Enable a previously disabled include type :param identifier: module or name of the include type :param exclude_children: disable the include type only for child processes, not the current process The ``identifier`` can be specified in multiple wa...
python
def enable(identifier, exclude_children=False): """ Enable a previously disabled include type :param identifier: module or name of the include type :param exclude_children: disable the include type only for child processes, not the current process The ``identifier`` can be specified in multiple wa...
[ "def", "enable", "(", "identifier", ",", "exclude_children", "=", "False", ")", ":", "DISABLED_TYPES", ".", "enable", "(", "identifier", "=", "identifier", ",", "exclude_children", "=", "exclude_children", ")" ]
Enable a previously disabled include type :param identifier: module or name of the include type :param exclude_children: disable the include type only for child processes, not the current process The ``identifier`` can be specified in multiple ways to disable an include type. See :py:meth:`~.DisabledI...
[ "Enable", "a", "previously", "disabled", "include", "type" ]
train
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/__init__.py#L81-L91
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
load_constants
def load_constants(): """Load physical constants to simulate the earth-sun system""" # The universal gravitational constant # https://en.wikipedia.org/wiki/Gravitational_constant G: float = 6.67408E-11 # The names of the celestial bodies body_name = \ ['sun', 'moon', ...
python
def load_constants(): """Load physical constants to simulate the earth-sun system""" # The universal gravitational constant # https://en.wikipedia.org/wiki/Gravitational_constant G: float = 6.67408E-11 # The names of the celestial bodies body_name = \ ['sun', 'moon', ...
[ "def", "load_constants", "(", ")", ":", "# The universal gravitational constant", "# https://en.wikipedia.org/wiki/Gravitational_constant", "G", ":", "float", "=", "6.67408E-11", "# The names of the celestial bodies", "body_name", "=", "[", "'sun'", ",", "'moon'", ",", "'merc...
Load physical constants to simulate the earth-sun system
[ "Load", "physical", "constants", "to", "simulate", "the", "earth", "-", "sun", "system" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L71-L122
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
julian_day
def julian_day(t: date) -> int: """Convert a Python datetime to a Julian day""" # Compute the number of days from January 1, 2000 to date t dt = t - julian_base_date # Add the julian base number to the number of days from the julian base date to date t return julian_base_number + dt.days
python
def julian_day(t: date) -> int: """Convert a Python datetime to a Julian day""" # Compute the number of days from January 1, 2000 to date t dt = t - julian_base_date # Add the julian base number to the number of days from the julian base date to date t return julian_base_number + dt.days
[ "def", "julian_day", "(", "t", ":", "date", ")", "->", "int", ":", "# Compute the number of days from January 1, 2000 to date t", "dt", "=", "t", "-", "julian_base_date", "# Add the julian base number to the number of days from the julian base date to date t", "return", "julian_b...
Convert a Python datetime to a Julian day
[ "Convert", "a", "Python", "datetime", "to", "a", "Julian", "day" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L126-L131
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
calc_mse
def calc_mse(q1, q2): """Compare the results of two simulations""" # Difference in positions between two simulations dq = q2 - q1 # Mean squared error in AUs return np.sqrt(np.mean(dq*dq))/au2m
python
def calc_mse(q1, q2): """Compare the results of two simulations""" # Difference in positions between two simulations dq = q2 - q1 # Mean squared error in AUs return np.sqrt(np.mean(dq*dq))/au2m
[ "def", "calc_mse", "(", "q1", ",", "q2", ")", ":", "# Difference in positions between two simulations", "dq", "=", "q2", "-", "q1", "# Mean squared error in AUs", "return", "np", ".", "sqrt", "(", "np", ".", "mean", "(", "dq", "*", "dq", ")", ")", "/", "au...
Compare the results of two simulations
[ "Compare", "the", "results", "of", "two", "simulations" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L134-L139
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
simulate_leapfrog
def simulate_leapfrog(config_func: Callable, accel_func: Callable, t0: date, t1: date, steps_per_day: int): """ Simulate the earth-sun system from t0 to t1 using Leapfrog Integration. INPUTS: config_func: function taking a date or date range and returning position and velocity of ...
python
def simulate_leapfrog(config_func: Callable, accel_func: Callable, t0: date, t1: date, steps_per_day: int): """ Simulate the earth-sun system from t0 to t1 using Leapfrog Integration. INPUTS: config_func: function taking a date or date range and returning position and velocity of ...
[ "def", "simulate_leapfrog", "(", "config_func", ":", "Callable", ",", "accel_func", ":", "Callable", ",", "t0", ":", "date", ",", "t1", ":", "date", ",", "steps_per_day", ":", "int", ")", ":", "# Length of the simulation (number of steps)", "N", ":", "int", "=...
Simulate the earth-sun system from t0 to t1 using Leapfrog Integration. INPUTS: config_func: function taking a date or date range and returning position and velocity of bodies accel_func: function taking positions of the bodies and returning their accelerations t0: start date of the simulation; a pytho...
[ "Simulate", "the", "earth", "-", "sun", "system", "from", "t0", "to", "t1", "using", "Leapfrog", "Integration", ".", "INPUTS", ":", "config_func", ":", "function", "taking", "a", "date", "or", "date", "range", "and", "returning", "position", "and", "velocity...
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L143-L193
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
flux_r2
def flux_r2(q_vars: List[fl.Var], i: int, j: int): """Make Fluxion with the distance between body i and j""" # Indices with the base of (x, y, z) for each body k0 = 3*i k1 = 3*j # The squared distance bewteen body i and j as a Fluxion instance return fl.square(q_vars[k1+0] - q_vars[k0+0]) + \ ...
python
def flux_r2(q_vars: List[fl.Var], i: int, j: int): """Make Fluxion with the distance between body i and j""" # Indices with the base of (x, y, z) for each body k0 = 3*i k1 = 3*j # The squared distance bewteen body i and j as a Fluxion instance return fl.square(q_vars[k1+0] - q_vars[k0+0]) + \ ...
[ "def", "flux_r2", "(", "q_vars", ":", "List", "[", "fl", ".", "Var", "]", ",", "i", ":", "int", ",", "j", ":", "int", ")", ":", "# Indices with the base of (x, y, z) for each body", "k0", "=", "3", "*", "i", "k1", "=", "3", "*", "j", "# The squared dis...
Make Fluxion with the distance between body i and j
[ "Make", "Fluxion", "with", "the", "distance", "between", "body", "i", "and", "j" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L197-L205
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
flux_r
def flux_r(q_vars: List[fl.Var], i: int, j: int): """Make Fluxion with the distance between body i and j""" return fl.sqrt(flux_r2(q_vars, i, j))
python
def flux_r(q_vars: List[fl.Var], i: int, j: int): """Make Fluxion with the distance between body i and j""" return fl.sqrt(flux_r2(q_vars, i, j))
[ "def", "flux_r", "(", "q_vars", ":", "List", "[", "fl", ".", "Var", "]", ",", "i", ":", "int", ",", "j", ":", "int", ")", ":", "return", "fl", ".", "sqrt", "(", "flux_r2", "(", "q_vars", ",", "i", ",", "j", ")", ")" ]
Make Fluxion with the distance between body i and j
[ "Make", "Fluxion", "with", "the", "distance", "between", "body", "i", "and", "j" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L208-L210
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
flux_v2
def flux_v2(v_vars: List[fl.Var], i: int): """Make Fluxion with the speed squared of body i""" # Index with the base of (v_x, v_y, v_z) for body i k = 3*i # The speed squared of body i return fl.square(v_vars[k+0]) + fl.square(v_vars[k+1]) + fl.square(v_vars[k+2])
python
def flux_v2(v_vars: List[fl.Var], i: int): """Make Fluxion with the speed squared of body i""" # Index with the base of (v_x, v_y, v_z) for body i k = 3*i # The speed squared of body i return fl.square(v_vars[k+0]) + fl.square(v_vars[k+1]) + fl.square(v_vars[k+2])
[ "def", "flux_v2", "(", "v_vars", ":", "List", "[", "fl", ".", "Var", "]", ",", "i", ":", "int", ")", ":", "# Index with the base of (v_x, v_y, v_z) for body i", "k", "=", "3", "*", "i", "# The speed squared of body i", "return", "fl", ".", "square", "(", "v_...
Make Fluxion with the speed squared of body i
[ "Make", "Fluxion", "with", "the", "speed", "squared", "of", "body", "i" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L213-L218
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
U_ij
def U_ij(q_vars: List[fl.Var], mass: np.ndarray, i: int, j: int): """Make Fluxion with the gratiational potential energy beween body i and j""" # Check that the lengths are consistent assert len(q_vars) == 3 * len(mass) # Masses of the bodies i and j mi = mass[i] mj = mass[j] # Gra...
python
def U_ij(q_vars: List[fl.Var], mass: np.ndarray, i: int, j: int): """Make Fluxion with the gratiational potential energy beween body i and j""" # Check that the lengths are consistent assert len(q_vars) == 3 * len(mass) # Masses of the bodies i and j mi = mass[i] mj = mass[j] # Gra...
[ "def", "U_ij", "(", "q_vars", ":", "List", "[", "fl", ".", "Var", "]", ",", "mass", ":", "np", ".", "ndarray", ",", "i", ":", "int", ",", "j", ":", "int", ")", ":", "# Check that the lengths are consistent", "assert", "len", "(", "q_vars", ")", "==",...
Make Fluxion with the gratiational potential energy beween body i and j
[ "Make", "Fluxion", "with", "the", "gratiational", "potential", "energy", "beween", "body", "i", "and", "j" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L225-L236
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
T_i
def T_i(v_vars: List[fl.Var], mass: np.ndarray, i: int): """Make Fluxion with the kinetic energy of body i""" # Check that the lengths are consistent assert len(v_vars) == 3 * len(mass) # Mass of the body i m = mass[i] # kineteic energy = 1/2 * mass * speed^2 T = (0.5 * m) * flux_v2(v_...
python
def T_i(v_vars: List[fl.Var], mass: np.ndarray, i: int): """Make Fluxion with the kinetic energy of body i""" # Check that the lengths are consistent assert len(v_vars) == 3 * len(mass) # Mass of the body i m = mass[i] # kineteic energy = 1/2 * mass * speed^2 T = (0.5 * m) * flux_v2(v_...
[ "def", "T_i", "(", "v_vars", ":", "List", "[", "fl", ".", "Var", "]", ",", "mass", ":", "np", ".", "ndarray", ",", "i", ":", "int", ")", ":", "# Check that the lengths are consistent", "assert", "len", "(", "v_vars", ")", "==", "3", "*", "len", "(", ...
Make Fluxion with the kinetic energy of body i
[ "Make", "Fluxion", "with", "the", "kinetic", "energy", "of", "body", "i" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L239-L249
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
plot_energy
def plot_energy(time, H, T, U): """Plot kinetic and potential energy of system over time""" # Normalize energy to initial KE T0 = T[0] H = H / T0 T = T / T0 U = U / T0 # Plot fig, ax = plt.subplots(figsize=[16,8]) ax.set_title('System Energy vs. Time') ax.set_xlabel('Time in...
python
def plot_energy(time, H, T, U): """Plot kinetic and potential energy of system over time""" # Normalize energy to initial KE T0 = T[0] H = H / T0 T = T / T0 U = U / T0 # Plot fig, ax = plt.subplots(figsize=[16,8]) ax.set_title('System Energy vs. Time') ax.set_xlabel('Time in...
[ "def", "plot_energy", "(", "time", ",", "H", ",", "T", ",", "U", ")", ":", "# Normalize energy to initial KE", "T0", "=", "T", "[", "0", "]", "H", "=", "H", "/", "T0", "T", "=", "T", "/", "T0", "U", "=", "U", "/", "T0", "# Plot", "fig", ",", ...
Plot kinetic and potential energy of system over time
[ "Plot", "kinetic", "and", "potential", "energy", "of", "system", "over", "time" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L253-L271
carlosp420/dataset-creator
dataset_creator/dataset.py
Dataset.sort_seq_records
def sort_seq_records(self, seq_records): """Checks that SeqExpandedRecords are sorted by gene_code and then by voucher code. The dashes in taxon names need to be converted to underscores so the dataset will be accepted by Biopython to do format conversions. """ for seq_record i...
python
def sort_seq_records(self, seq_records): """Checks that SeqExpandedRecords are sorted by gene_code and then by voucher code. The dashes in taxon names need to be converted to underscores so the dataset will be accepted by Biopython to do format conversions. """ for seq_record i...
[ "def", "sort_seq_records", "(", "self", ",", "seq_records", ")", ":", "for", "seq_record", "in", "seq_records", ":", "seq_record", ".", "voucher_code", "=", "seq_record", ".", "voucher_code", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "unsorted_gene_codes"...
Checks that SeqExpandedRecords are sorted by gene_code and then by voucher code. The dashes in taxon names need to be converted to underscores so the dataset will be accepted by Biopython to do format conversions.
[ "Checks", "that", "SeqExpandedRecords", "are", "sorted", "by", "gene_code", "and", "then", "by", "voucher", "code", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/dataset.py#L81-L109
carlosp420/dataset-creator
dataset_creator/dataset.py
Dataset._validate_outgroup
def _validate_outgroup(self, outgroup): """All voucher codes in our datasets have dashes converted to underscores.""" if outgroup: outgroup = outgroup.replace("-", "_") good_outgroup = False for seq_record in self.seq_records: if seq_record.voucher_cod...
python
def _validate_outgroup(self, outgroup): """All voucher codes in our datasets have dashes converted to underscores.""" if outgroup: outgroup = outgroup.replace("-", "_") good_outgroup = False for seq_record in self.seq_records: if seq_record.voucher_cod...
[ "def", "_validate_outgroup", "(", "self", ",", "outgroup", ")", ":", "if", "outgroup", ":", "outgroup", "=", "outgroup", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "good_outgroup", "=", "False", "for", "seq_record", "in", "self", ".", "seq_records", ...
All voucher codes in our datasets have dashes converted to underscores.
[ "All", "voucher", "codes", "in", "our", "datasets", "have", "dashes", "converted", "to", "underscores", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/dataset.py#L131-L146
carlosp420/dataset-creator
dataset_creator/dataset.py
Dataset._prepare_data
def _prepare_data(self): """ Creates named tuple with info needed to create a dataset. :return: named tuple """ self._extract_genes() self._extract_total_number_of_chars() self._extract_number_of_taxa() self._extract_reading_frames() Data = named...
python
def _prepare_data(self): """ Creates named tuple with info needed to create a dataset. :return: named tuple """ self._extract_genes() self._extract_total_number_of_chars() self._extract_number_of_taxa() self._extract_reading_frames() Data = named...
[ "def", "_prepare_data", "(", "self", ")", ":", "self", ".", "_extract_genes", "(", ")", "self", ".", "_extract_total_number_of_chars", "(", ")", "self", ".", "_extract_number_of_taxa", "(", ")", "self", ".", "_extract_reading_frames", "(", ")", "Data", "=", "n...
Creates named tuple with info needed to create a dataset. :return: named tuple
[ "Creates", "named", "tuple", "with", "info", "needed", "to", "create", "a", "dataset", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/dataset.py#L148-L164
carlosp420/dataset-creator
dataset_creator/dataset.py
Dataset._extract_total_number_of_chars
def _extract_total_number_of_chars(self): """ sets `self.number_chars` to the number of characters as string. """ self._get_gene_codes_and_seq_lengths() sum = 0 for seq_length in self._gene_codes_and_lengths.values(): sum += sorted(seq_length, reverse=True)[0...
python
def _extract_total_number_of_chars(self): """ sets `self.number_chars` to the number of characters as string. """ self._get_gene_codes_and_seq_lengths() sum = 0 for seq_length in self._gene_codes_and_lengths.values(): sum += sorted(seq_length, reverse=True)[0...
[ "def", "_extract_total_number_of_chars", "(", "self", ")", ":", "self", ".", "_get_gene_codes_and_seq_lengths", "(", ")", "sum", "=", "0", "for", "seq_length", "in", "self", ".", "_gene_codes_and_lengths", ".", "values", "(", ")", ":", "sum", "+=", "sorted", "...
sets `self.number_chars` to the number of characters as string.
[ "sets", "self", ".", "number_chars", "to", "the", "number", "of", "characters", "as", "string", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/dataset.py#L174-L183
carlosp420/dataset-creator
dataset_creator/dataset.py
Dataset._extract_number_of_taxa
def _extract_number_of_taxa(self): """ sets `self.number_taxa` to the number of taxa as string """ n_taxa = dict() for i in self.seq_records: if i.gene_code not in n_taxa: n_taxa[i.gene_code] = 0 n_taxa[i.gene_code] += 1 number_taxa...
python
def _extract_number_of_taxa(self): """ sets `self.number_taxa` to the number of taxa as string """ n_taxa = dict() for i in self.seq_records: if i.gene_code not in n_taxa: n_taxa[i.gene_code] = 0 n_taxa[i.gene_code] += 1 number_taxa...
[ "def", "_extract_number_of_taxa", "(", "self", ")", ":", "n_taxa", "=", "dict", "(", ")", "for", "i", "in", "self", ".", "seq_records", ":", "if", "i", ".", "gene_code", "not", "in", "n_taxa", ":", "n_taxa", "[", "i", ".", "gene_code", "]", "=", "0",...
sets `self.number_taxa` to the number of taxa as string
[ "sets", "self", ".", "number_taxa", "to", "the", "number", "of", "taxa", "as", "string" ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/dataset.py#L201-L211
tlatsas/wigiki
wigiki/config.py
ConfigManager.cli
def cli(self): """Read program parameters from command line and configuration files We support both command line arguments and configuration files. The command line arguments have always precedence over any configuration file parameters. This allows us to have most of our option...
python
def cli(self): """Read program parameters from command line and configuration files We support both command line arguments and configuration files. The command line arguments have always precedence over any configuration file parameters. This allows us to have most of our option...
[ "def", "cli", "(", "self", ")", ":", "# first we parse only for a configuration file with an initial parser", "init_parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ",", "formatter_class", "=", "argparse", ".", "RawDescriptionHelpFormatte...
Read program parameters from command line and configuration files We support both command line arguments and configuration files. The command line arguments have always precedence over any configuration file parameters. This allows us to have most of our options in files but override th...
[ "Read", "program", "parameters", "from", "command", "line", "and", "configuration", "files" ]
train
https://github.com/tlatsas/wigiki/blob/baf9c5a6523a9b90db7572330d04e3e199391273/wigiki/config.py#L46-L104
tlatsas/wigiki
wigiki/config.py
ConfigManager.detect_config
def detect_config(self): """check in the current working directory for configuration files""" default_files = ("config.json", "config.yml") for file_ in default_files: if os.path.exists(file_): return file_
python
def detect_config(self): """check in the current working directory for configuration files""" default_files = ("config.json", "config.yml") for file_ in default_files: if os.path.exists(file_): return file_
[ "def", "detect_config", "(", "self", ")", ":", "default_files", "=", "(", "\"config.json\"", ",", "\"config.yml\"", ")", "for", "file_", "in", "default_files", ":", "if", "os", ".", "path", ".", "exists", "(", "file_", ")", ":", "return", "file_" ]
check in the current working directory for configuration files
[ "check", "in", "the", "current", "working", "directory", "for", "configuration", "files" ]
train
https://github.com/tlatsas/wigiki/blob/baf9c5a6523a9b90db7572330d04e3e199391273/wigiki/config.py#L106-L111
tlatsas/wigiki
wigiki/config.py
ConfigManager.merge_with_default_options
def merge_with_default_options(self, config_opts): """merge options from configuration file with the default options""" return dict(list(self.defaults.items()) + list(config_opts.items()))
python
def merge_with_default_options(self, config_opts): """merge options from configuration file with the default options""" return dict(list(self.defaults.items()) + list(config_opts.items()))
[ "def", "merge_with_default_options", "(", "self", ",", "config_opts", ")", ":", "return", "dict", "(", "list", "(", "self", ".", "defaults", ".", "items", "(", ")", ")", "+", "list", "(", "config_opts", ".", "items", "(", ")", ")", ")" ]
merge options from configuration file with the default options
[ "merge", "options", "from", "configuration", "file", "with", "the", "default", "options" ]
train
https://github.com/tlatsas/wigiki/blob/baf9c5a6523a9b90db7572330d04e3e199391273/wigiki/config.py#L113-L115
Kjwon15/autotweet
autotweet/twitter.py
authorize
def authorize(): """Authorize to twitter. Use PIN authentification. :returns: Token for authentificate with Twitter. :rtype: :class:`autotweet.twitter.OAuthToken` """ auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) url = auth.get_authorization_url() print('Open this url on y...
python
def authorize(): """Authorize to twitter. Use PIN authentification. :returns: Token for authentificate with Twitter. :rtype: :class:`autotweet.twitter.OAuthToken` """ auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) url = auth.get_authorization_url() print('Open this url on y...
[ "def", "authorize", "(", ")", ":", "auth", "=", "tweepy", ".", "OAuthHandler", "(", "CONSUMER_KEY", ",", "CONSUMER_SECRET", ")", "url", "=", "auth", ".", "get_authorization_url", "(", ")", "print", "(", "'Open this url on your webbrowser: {0}'", ".", "format", "...
Authorize to twitter. Use PIN authentification. :returns: Token for authentificate with Twitter. :rtype: :class:`autotweet.twitter.OAuthToken`
[ "Authorize", "to", "twitter", "." ]
train
https://github.com/Kjwon15/autotweet/blob/c35b68ee1814916fbe9e5a5bd6ea6e75b3cc596e/autotweet/twitter.py#L61-L78
Kjwon15/autotweet
autotweet/twitter.py
expand_url
def expand_url(status): """Expand url on statuses. :param status: A tweepy status to expand urls. :type status: :class:`tweepy.models.Status` :returns: A string with expanded urls. :rtype: :class:`str` """ try: txt = get_full_text(status) for url in status.entities['urls']:...
python
def expand_url(status): """Expand url on statuses. :param status: A tweepy status to expand urls. :type status: :class:`tweepy.models.Status` :returns: A string with expanded urls. :rtype: :class:`str` """ try: txt = get_full_text(status) for url in status.entities['urls']:...
[ "def", "expand_url", "(", "status", ")", ":", "try", ":", "txt", "=", "get_full_text", "(", "status", ")", "for", "url", "in", "status", ".", "entities", "[", "'urls'", "]", ":", "txt", "=", "txt", ".", "replace", "(", "url", "[", "'url'", "]", ","...
Expand url on statuses. :param status: A tweepy status to expand urls. :type status: :class:`tweepy.models.Status` :returns: A string with expanded urls. :rtype: :class:`str`
[ "Expand", "url", "on", "statuses", "." ]
train
https://github.com/Kjwon15/autotweet/blob/c35b68ee1814916fbe9e5a5bd6ea6e75b3cc596e/autotweet/twitter.py#L92-L115
Kjwon15/autotweet
autotweet/twitter.py
strip_tweet
def strip_tweet(text, remove_url=True): """Strip tweet message. This method removes mentions strings and urls(optional). :param text: tweet message :type text: :class:`str` :param remove_url: Remove urls. default :const:`True`. :type remove_url: :class:`boolean` :returns: Striped tweet m...
python
def strip_tweet(text, remove_url=True): """Strip tweet message. This method removes mentions strings and urls(optional). :param text: tweet message :type text: :class:`str` :param remove_url: Remove urls. default :const:`True`. :type remove_url: :class:`boolean` :returns: Striped tweet m...
[ "def", "strip_tweet", "(", "text", ",", "remove_url", "=", "True", ")", ":", "if", "remove_url", ":", "text", "=", "url_pattern", ".", "sub", "(", "''", ",", "text", ")", "else", ":", "text", "=", "expand_url", "(", "text", ")", "text", "=", "mention...
Strip tweet message. This method removes mentions strings and urls(optional). :param text: tweet message :type text: :class:`str` :param remove_url: Remove urls. default :const:`True`. :type remove_url: :class:`boolean` :returns: Striped tweet message :rtype: :class:`str`
[ "Strip", "tweet", "message", "." ]
train
https://github.com/Kjwon15/autotweet/blob/c35b68ee1814916fbe9e5a5bd6ea6e75b3cc596e/autotweet/twitter.py#L127-L149
fizyk/pyramid_yml
setup.py
read
def read(fname): """Quick way to read a file content.""" content = None with open(os.path.join(here, fname)) as f: content = f.read() return content
python
def read(fname): """Quick way to read a file content.""" content = None with open(os.path.join(here, fname)) as f: content = f.read() return content
[ "def", "read", "(", "fname", ")", ":", "content", "=", "None", "with", "open", "(", "os", ".", "path", ".", "join", "(", "here", ",", "fname", ")", ")", "as", "f", ":", "content", "=", "f", ".", "read", "(", ")", "return", "content" ]
Quick way to read a file content.
[ "Quick", "way", "to", "read", "a", "file", "content", "." ]
train
https://github.com/fizyk/pyramid_yml/blob/1b36c4e74194c04d7d69b4d7f86801757e78f0a6/setup.py#L8-L13
42matters/bottle-couchbase
bottle_couchbase.py
_Pool.get_client
def get_client(self, initial_timeout=0.1, next_timeout=30): """ Wait until a client instance is available :param float initial_timeout: how long to wait initially for an existing client to complete :param float next_timeout: if the pool could not obtain a client durin...
python
def get_client(self, initial_timeout=0.1, next_timeout=30): """ Wait until a client instance is available :param float initial_timeout: how long to wait initially for an existing client to complete :param float next_timeout: if the pool could not obtain a client durin...
[ "def", "get_client", "(", "self", ",", "initial_timeout", "=", "0.1", ",", "next_timeout", "=", "30", ")", ":", "try", ":", "return", "self", ".", "_test_client", "(", "self", ".", "_q", ".", "get", "(", "True", ",", "initial_timeout", ")", ")", "excep...
Wait until a client instance is available :param float initial_timeout: how long to wait initially for an existing client to complete :param float next_timeout: if the pool could not obtain a client during the initial timeout, and we have allocated the maximum available num...
[ "Wait", "until", "a", "client", "instance", "is", "available", ":", "param", "float", "initial_timeout", ":", "how", "long", "to", "wait", "initially", "for", "an", "existing", "client", "to", "complete", ":", "param", "float", "next_timeout", ":", "if", "th...
train
https://github.com/42matters/bottle-couchbase/blob/79e8c347e0ec4e1daab5da2a844fe8aa763019e2/bottle_couchbase.py#L69-L98
42matters/bottle-couchbase
bottle_couchbase.py
_Pool.release_client
def release_client(self, cb): """ Return a Connection object to the pool :param Connection cb: the client to release """ if cb: self._q.put(cb, True) self._clients_in_use -= 1
python
def release_client(self, cb): """ Return a Connection object to the pool :param Connection cb: the client to release """ if cb: self._q.put(cb, True) self._clients_in_use -= 1
[ "def", "release_client", "(", "self", ",", "cb", ")", ":", "if", "cb", ":", "self", ".", "_q", ".", "put", "(", "cb", ",", "True", ")", "self", ".", "_clients_in_use", "-=", "1" ]
Return a Connection object to the pool :param Connection cb: the client to release
[ "Return", "a", "Connection", "object", "to", "the", "pool", ":", "param", "Connection", "cb", ":", "the", "client", "to", "release" ]
train
https://github.com/42matters/bottle-couchbase/blob/79e8c347e0ec4e1daab5da2a844fe8aa763019e2/bottle_couchbase.py#L100-L107
sahilchinoy/django-irs-filings
irs/management/commands/downloadIRS.py
Command.download
def download(self): """ Download the archive from the IRS website. """ url = 'http://forms.irs.gov/app/pod/dataDownload/fullData' r = requests.get(url, stream=True) with open(self.zip_path, 'wb') as f: # This is a big file, so we download in chunks ...
python
def download(self): """ Download the archive from the IRS website. """ url = 'http://forms.irs.gov/app/pod/dataDownload/fullData' r = requests.get(url, stream=True) with open(self.zip_path, 'wb') as f: # This is a big file, so we download in chunks ...
[ "def", "download", "(", "self", ")", ":", "url", "=", "'http://forms.irs.gov/app/pod/dataDownload/fullData'", "r", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "with", "open", "(", "self", ".", "zip_path", ",", "'wb'", ")", "as...
Download the archive from the IRS website.
[ "Download", "the", "archive", "from", "the", "IRS", "website", "." ]
train
https://github.com/sahilchinoy/django-irs-filings/blob/efe80cc57ce1d9d8488f4e9496cf2347e29b6d8b/irs/management/commands/downloadIRS.py#L63-L74
sahilchinoy/django-irs-filings
irs/management/commands/downloadIRS.py
Command.unzip
def unzip(self): """ Unzip the archive. """ logger.info('Unzipping archive') with zipfile.ZipFile(self.zip_path, 'r') as zipped_archive: data_file = zipped_archive.namelist()[0] zipped_archive.extract(data_file, self.extract_path)
python
def unzip(self): """ Unzip the archive. """ logger.info('Unzipping archive') with zipfile.ZipFile(self.zip_path, 'r') as zipped_archive: data_file = zipped_archive.namelist()[0] zipped_archive.extract(data_file, self.extract_path)
[ "def", "unzip", "(", "self", ")", ":", "logger", ".", "info", "(", "'Unzipping archive'", ")", "with", "zipfile", ".", "ZipFile", "(", "self", ".", "zip_path", ",", "'r'", ")", "as", "zipped_archive", ":", "data_file", "=", "zipped_archive", ".", "namelist...
Unzip the archive.
[ "Unzip", "the", "archive", "." ]
train
https://github.com/sahilchinoy/django-irs-filings/blob/efe80cc57ce1d9d8488f4e9496cf2347e29b6d8b/irs/management/commands/downloadIRS.py#L76-L83
sahilchinoy/django-irs-filings
irs/management/commands/downloadIRS.py
Command.clean
def clean(self): """ Get the .txt file from within the many-layered directory structure, then delete the directories. """ logger.info('Cleaning up archive') shutil.move( os.path.join( self.data_dir, 'var/IRS/data/scripts/pofd/do...
python
def clean(self): """ Get the .txt file from within the many-layered directory structure, then delete the directories. """ logger.info('Cleaning up archive') shutil.move( os.path.join( self.data_dir, 'var/IRS/data/scripts/pofd/do...
[ "def", "clean", "(", "self", ")", ":", "logger", ".", "info", "(", "'Cleaning up archive'", ")", "shutil", ".", "move", "(", "os", ".", "path", ".", "join", "(", "self", ".", "data_dir", ",", "'var/IRS/data/scripts/pofd/download/FullDataFile.txt'", ")", ",", ...
Get the .txt file from within the many-layered directory structure, then delete the directories.
[ "Get", "the", ".", "txt", "file", "from", "within", "the", "many", "-", "layered", "directory", "structure", "then", "delete", "the", "directories", "." ]
train
https://github.com/sahilchinoy/django-irs-filings/blob/efe80cc57ce1d9d8488f4e9496cf2347e29b6d8b/irs/management/commands/downloadIRS.py#L85-L100
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
_get_xsitype
def _get_xsitype(pyclass): '''returns the xsi:type as a tuple, coupled with ZSI.schema ''' if hasattr(pyclass,'type') and type(pyclass.type) in _seqtypes: return pyclass.type elif hasattr(pyclass,'type') and hasattr(pyclass, 'schema'): return (pyclass.schema, pyclass.type) return (N...
python
def _get_xsitype(pyclass): '''returns the xsi:type as a tuple, coupled with ZSI.schema ''' if hasattr(pyclass,'type') and type(pyclass.type) in _seqtypes: return pyclass.type elif hasattr(pyclass,'type') and hasattr(pyclass, 'schema'): return (pyclass.schema, pyclass.type) return (N...
[ "def", "_get_xsitype", "(", "pyclass", ")", ":", "if", "hasattr", "(", "pyclass", ",", "'type'", ")", "and", "type", "(", "pyclass", ".", "type", ")", "in", "_seqtypes", ":", "return", "pyclass", ".", "type", "elif", "hasattr", "(", "pyclass", ",", "'t...
returns the xsi:type as a tuple, coupled with ZSI.schema
[ "returns", "the", "xsi", ":", "type", "as", "a", "tuple", "coupled", "with", "ZSI", ".", "schema" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L34-L42
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.serialize
def serialize(self, elt, sw, pyobj, name=None, orig=None, **kw): ''' Parameters: elt -- the current DOMWrapper element sw -- soapWriter object pyobj -- python object to serialize ''' raise EvaluateException("Unimplemented evaluation", sw.Backtrace(elt))
python
def serialize(self, elt, sw, pyobj, name=None, orig=None, **kw): ''' Parameters: elt -- the current DOMWrapper element sw -- soapWriter object pyobj -- python object to serialize ''' raise EvaluateException("Unimplemented evaluation", sw.Backtrace(elt))
[ "def", "serialize", "(", "self", ",", "elt", ",", "sw", ",", "pyobj", ",", "name", "=", "None", ",", "orig", "=", "None", ",", "*", "*", "kw", ")", ":", "raise", "EvaluateException", "(", "\"Unimplemented evaluation\"", ",", "sw", ".", "Backtrace", "("...
Parameters: elt -- the current DOMWrapper element sw -- soapWriter object pyobj -- python object to serialize
[ "Parameters", ":", "elt", "--", "the", "current", "DOMWrapper", "element", "sw", "--", "soapWriter", "object", "pyobj", "--", "python", "object", "to", "serialize" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L118-L126
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.SimpleHREF
def SimpleHREF(self, elt, ps, tag): '''Simple HREF for non-string and non-struct and non-array. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. tag -- ''' if len(_children(elt)): return elt href = _find_href(elt) ...
python
def SimpleHREF(self, elt, ps, tag): '''Simple HREF for non-string and non-struct and non-array. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. tag -- ''' if len(_children(elt)): return elt href = _find_href(elt) ...
[ "def", "SimpleHREF", "(", "self", ",", "elt", ",", "ps", ",", "tag", ")", ":", "if", "len", "(", "_children", "(", "elt", ")", ")", ":", "return", "elt", "href", "=", "_find_href", "(", "elt", ")", "if", "not", "href", ":", "if", "self", ".", "...
Simple HREF for non-string and non-struct and non-array. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. tag --
[ "Simple", "HREF", "for", "non", "-", "string", "and", "non", "-", "struct", "and", "non", "-", "array", ".", "Parameters", ":", "elt", "--", "the", "DOM", "element", "being", "parsed", "ps", "--", "the", "ParsedSoap", "object", ".", "tag", "--" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L144-L157
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.get_parse_and_errorlist
def get_parse_and_errorlist(self): """Get the parselist and human-readable version, errorlist is returned, because it is used in error messages. """ d = self.__class__.__dict__ parselist = d.get('parselist') errorlist = d.get('errorlist') if parselist and not erro...
python
def get_parse_and_errorlist(self): """Get the parselist and human-readable version, errorlist is returned, because it is used in error messages. """ d = self.__class__.__dict__ parselist = d.get('parselist') errorlist = d.get('errorlist') if parselist and not erro...
[ "def", "get_parse_and_errorlist", "(", "self", ")", ":", "d", "=", "self", ".", "__class__", ".", "__dict__", "parselist", "=", "d", ".", "get", "(", "'parselist'", ")", "errorlist", "=", "d", ".", "get", "(", "'errorlist'", ")", "if", "parselist", "and"...
Get the parselist and human-readable version, errorlist is returned, because it is used in error messages.
[ "Get", "the", "parselist", "and", "human", "-", "readable", "version", "errorlist", "is", "returned", "because", "it", "is", "used", "in", "error", "messages", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L159-L172
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.checkname
def checkname(self, elt, ps): '''See if the name and type of the "elt" element is what we're looking for. Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. ''' parselist,errorlist = self.get_parse_an...
python
def checkname(self, elt, ps): '''See if the name and type of the "elt" element is what we're looking for. Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. ''' parselist,errorlist = self.get_parse_an...
[ "def", "checkname", "(", "self", ",", "elt", ",", "ps", ")", ":", "parselist", ",", "errorlist", "=", "self", ".", "get_parse_and_errorlist", "(", ")", "ns", ",", "name", "=", "_get_element_nsuri_name", "(", "elt", ")", "if", "ns", "==", "SOAP", ".", "...
See if the name and type of the "elt" element is what we're looking for. Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object.
[ "See", "if", "the", "name", "and", "type", "of", "the", "elt", "element", "is", "what", "we", "re", "looking", "for", ".", "Return", "the", "element", "s", "type", ".", "Parameters", ":", "elt", "--", "the", "DOM", "element", "being", "parsed", "ps", ...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L174-L201
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.checktype
def checktype(self, elt, ps): '''See if the type of the "elt" element is what we're looking for. Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. ''' typeName = _find_type(elt) if typeName is N...
python
def checktype(self, elt, ps): '''See if the type of the "elt" element is what we're looking for. Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. ''' typeName = _find_type(elt) if typeName is N...
[ "def", "checktype", "(", "self", ",", "elt", ",", "ps", ")", ":", "typeName", "=", "_find_type", "(", "elt", ")", "if", "typeName", "is", "None", "or", "typeName", "==", "\"\"", ":", "return", "(", "None", ",", "None", ")", "# Parse the QNAME.", "prefi...
See if the type of the "elt" element is what we're looking for. Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object.
[ "See", "if", "the", "type", "of", "the", "elt", "element", "is", "what", "we", "re", "looking", "for", ".", "Return", "the", "element", "s", "type", ".", "Parameters", ":", "elt", "--", "the", "DOM", "element", "being", "parsed", "ps", "--", "the", "...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L203-L229
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.name_match
def name_match(self, elt): '''Simple boolean test to see if we match the element name. Parameters: elt -- the DOM element being parsed ''' return self.pname == elt.localName and \ self.nspname in [None, '', elt.namespaceURI]
python
def name_match(self, elt): '''Simple boolean test to see if we match the element name. Parameters: elt -- the DOM element being parsed ''' return self.pname == elt.localName and \ self.nspname in [None, '', elt.namespaceURI]
[ "def", "name_match", "(", "self", ",", "elt", ")", ":", "return", "self", ".", "pname", "==", "elt", ".", "localName", "and", "self", ".", "nspname", "in", "[", "None", ",", "''", ",", "elt", ".", "namespaceURI", "]" ]
Simple boolean test to see if we match the element name. Parameters: elt -- the DOM element being parsed
[ "Simple", "boolean", "test", "to", "see", "if", "we", "match", "the", "element", "name", ".", "Parameters", ":", "elt", "--", "the", "DOM", "element", "being", "parsed" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L231-L237
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.nilled
def nilled(self, elt, ps): '''Is the element NIL, and is that okay? Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. ''' if _find_nil(elt) not in [ "true", "1"]: return False if self.nillable is False: raise Evaluat...
python
def nilled(self, elt, ps): '''Is the element NIL, and is that okay? Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. ''' if _find_nil(elt) not in [ "true", "1"]: return False if self.nillable is False: raise Evaluat...
[ "def", "nilled", "(", "self", ",", "elt", ",", "ps", ")", ":", "if", "_find_nil", "(", "elt", ")", "not", "in", "[", "\"true\"", ",", "\"1\"", "]", ":", "return", "False", "if", "self", ".", "nillable", "is", "False", ":", "raise", "EvaluateException...
Is the element NIL, and is that okay? Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object.
[ "Is", "the", "element", "NIL", "and", "is", "that", "okay?", "Parameters", ":", "elt", "--", "the", "DOM", "element", "being", "parsed", "ps", "--", "the", "ParsedSoap", "object", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L239-L249
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.simple_value
def simple_value(self, elt, ps, mixed=False): '''Get the value of the simple content of this element. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. mixed -- ignore element content, optional text node ''' if not _valid_enc...
python
def simple_value(self, elt, ps, mixed=False): '''Get the value of the simple content of this element. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. mixed -- ignore element content, optional text node ''' if not _valid_enc...
[ "def", "simple_value", "(", "self", ",", "elt", ",", "ps", ",", "mixed", "=", "False", ")", ":", "if", "not", "_valid_encoding", "(", "elt", ")", ":", "raise", "EvaluateException", "(", "'Invalid encoding'", ",", "ps", ".", "Backtrace", "(", "elt", ")", ...
Get the value of the simple content of this element. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object. mixed -- ignore element content, optional text node
[ "Get", "the", "value", "of", "the", "simple", "content", "of", "this", "element", ".", "Parameters", ":", "elt", "--", "the", "DOM", "element", "being", "parsed", "ps", "--", "the", "ParsedSoap", "object", ".", "mixed", "--", "ignore", "element", "content"...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L251-L273
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.parse_attributes
def parse_attributes(self, elt, ps): '''find all attributes specified in the attribute_typecode_dict in current element tag, if an attribute is found set it in the self.attributes dictionary. Default to putting in String. Parameters: elt -- the DOM element being parsed ...
python
def parse_attributes(self, elt, ps): '''find all attributes specified in the attribute_typecode_dict in current element tag, if an attribute is found set it in the self.attributes dictionary. Default to putting in String. Parameters: elt -- the DOM element being parsed ...
[ "def", "parse_attributes", "(", "self", ",", "elt", ",", "ps", ")", ":", "if", "self", ".", "attribute_typecode_dict", "is", "None", ":", "return", "attributes", "=", "{", "}", "for", "attr", ",", "what", "in", "self", ".", "attribute_typecode_dict", ".", ...
find all attributes specified in the attribute_typecode_dict in current element tag, if an attribute is found set it in the self.attributes dictionary. Default to putting in String. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object.
[ "find", "all", "attributes", "specified", "in", "the", "attribute_typecode_dict", "in", "current", "element", "tag", "if", "an", "attribute", "is", "found", "set", "it", "in", "the", "self", ".", "attributes", "dictionary", ".", "Default", "to", "putting", "in...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L275-L299
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.set_attributes
def set_attributes(self, el, pyobj): '''Instance data attributes contains a dictionary of keys (namespaceURI,localName) and attribute values. These values can be self-describing (typecode), or use attribute_typecode_dict to determine serialization. Paramters: el -- M...
python
def set_attributes(self, el, pyobj): '''Instance data attributes contains a dictionary of keys (namespaceURI,localName) and attribute values. These values can be self-describing (typecode), or use attribute_typecode_dict to determine serialization. Paramters: el -- M...
[ "def", "set_attributes", "(", "self", ",", "el", ",", "pyobj", ")", ":", "if", "not", "hasattr", "(", "pyobj", ",", "self", ".", "attrs_aname", ")", ":", "return", "if", "not", "isinstance", "(", "getattr", "(", "pyobj", ",", "self", ".", "attrs_aname"...
Instance data attributes contains a dictionary of keys (namespaceURI,localName) and attribute values. These values can be self-describing (typecode), or use attribute_typecode_dict to determine serialization. Paramters: el -- MessageInterface representing the element ...
[ "Instance", "data", "attributes", "contains", "a", "dictionary", "of", "keys", "(", "namespaceURI", "localName", ")", "and", "attribute", "values", ".", "These", "values", "can", "be", "self", "-", "describing", "(", "typecode", ")", "or", "use", "attribute_ty...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L301-L348
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.set_attribute_xsi_type
def set_attribute_xsi_type(self, el, **kw): '''if typed, set the xsi:type attribute Paramters: el -- MessageInterface representing the element ''' if kw.get('typed', self.typed): namespaceURI,typeName = kw.get('type', _get_xsitype(self)) if namespaceU...
python
def set_attribute_xsi_type(self, el, **kw): '''if typed, set the xsi:type attribute Paramters: el -- MessageInterface representing the element ''' if kw.get('typed', self.typed): namespaceURI,typeName = kw.get('type', _get_xsitype(self)) if namespaceU...
[ "def", "set_attribute_xsi_type", "(", "self", ",", "el", ",", "*", "*", "kw", ")", ":", "if", "kw", ".", "get", "(", "'typed'", ",", "self", ".", "typed", ")", ":", "namespaceURI", ",", "typeName", "=", "kw", ".", "get", "(", "'type'", ",", "_get_x...
if typed, set the xsi:type attribute Paramters: el -- MessageInterface representing the element
[ "if", "typed", "set", "the", "xsi", ":", "type", "attribute", "Paramters", ":", "el", "--", "MessageInterface", "representing", "the", "element" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L350-L359
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.set_attribute_id
def set_attribute_id(self, el, objid): '''set id attribute Paramters: el -- MessageInterface representing the element objid -- ID type, unique id ''' if self.unique is False: el.setAttributeNS(None, 'id', "%s" %objid)
python
def set_attribute_id(self, el, objid): '''set id attribute Paramters: el -- MessageInterface representing the element objid -- ID type, unique id ''' if self.unique is False: el.setAttributeNS(None, 'id', "%s" %objid)
[ "def", "set_attribute_id", "(", "self", ",", "el", ",", "objid", ")", ":", "if", "self", ".", "unique", "is", "False", ":", "el", ".", "setAttributeNS", "(", "None", ",", "'id'", ",", "\"%s\"", "%", "objid", ")" ]
set id attribute Paramters: el -- MessageInterface representing the element objid -- ID type, unique id
[ "set", "id", "attribute", "Paramters", ":", "el", "--", "MessageInterface", "representing", "the", "element", "objid", "--", "ID", "type", "unique", "id" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L369-L376
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
TypeCode.get_name
def get_name(self, name, objid): ''' Paramters: name -- element tag objid -- ID type, unique id ''' if type(name) is tuple: return name ns = self.nspname n = name or self.pname or ('E' + objid) return ns,n
python
def get_name(self, name, objid): ''' Paramters: name -- element tag objid -- ID type, unique id ''' if type(name) is tuple: return name ns = self.nspname n = name or self.pname or ('E' + objid) return ns,n
[ "def", "get_name", "(", "self", ",", "name", ",", "objid", ")", ":", "if", "type", "(", "name", ")", "is", "tuple", ":", "return", "name", "ns", "=", "self", ".", "nspname", "n", "=", "name", "or", "self", ".", "pname", "or", "(", "'E'", "+", "...
Paramters: name -- element tag objid -- ID type, unique id
[ "Paramters", ":", "name", "--", "element", "tag", "objid", "--", "ID", "type", "unique", "id" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L378-L389
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
SimpleType.serialize_text_node
def serialize_text_node(self, elt, sw, pyobj): '''Serialize without an element node. ''' textNode = None if pyobj is not None: text = self.get_formatted_content(pyobj) if type(text) not in _stringtypes: raise TypeError, 'pyobj must be a formatted s...
python
def serialize_text_node(self, elt, sw, pyobj): '''Serialize without an element node. ''' textNode = None if pyobj is not None: text = self.get_formatted_content(pyobj) if type(text) not in _stringtypes: raise TypeError, 'pyobj must be a formatted s...
[ "def", "serialize_text_node", "(", "self", ",", "elt", ",", "sw", ",", "pyobj", ")", ":", "textNode", "=", "None", "if", "pyobj", "is", "not", "None", ":", "text", "=", "self", ".", "get_formatted_content", "(", "pyobj", ")", "if", "type", "(", "text",...
Serialize without an element node.
[ "Serialize", "without", "an", "element", "node", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L451-L462
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
SimpleType.serialize
def serialize(self, elt, sw, pyobj, name=None, orig=None, **kw): '''Handles the start and end tags, and attributes. callout to get_formatted_content to get the textNode value. Parameters: elt -- ElementProxy/DOM element sw -- SoapWriter instance pyobj -- pro...
python
def serialize(self, elt, sw, pyobj, name=None, orig=None, **kw): '''Handles the start and end tags, and attributes. callout to get_formatted_content to get the textNode value. Parameters: elt -- ElementProxy/DOM element sw -- SoapWriter instance pyobj -- pro...
[ "def", "serialize", "(", "self", ",", "elt", ",", "sw", ",", "pyobj", ",", "name", "=", "None", ",", "orig", "=", "None", ",", "*", "*", "kw", ")", ":", "objid", "=", "_get_idstr", "(", "pyobj", ")", "ns", ",", "n", "=", "self", ".", "get_name"...
Handles the start and end tags, and attributes. callout to get_formatted_content to get the textNode value. Parameters: elt -- ElementProxy/DOM element sw -- SoapWriter instance pyobj -- processed content KeyWord Parameters: name -- ...
[ "Handles", "the", "start", "and", "end", "tags", "and", "attributes", ".", "callout", "to", "get_formatted_content", "to", "get", "the", "textNode", "value", ".", "Parameters", ":", "elt", "--", "ElementProxy", "/", "DOM", "element", "sw", "--", "SoapWriter", ...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L464-L506
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
String.text_to_data
def text_to_data(self, text, elt, ps): '''convert text into typecode specific data. Encode all strings as UTF-8, which will be type 'str' not 'unicode' ''' if self.strip: text = text.strip() if self.pyclass is not None: return self.pyclass(text.encode(UNICODE_...
python
def text_to_data(self, text, elt, ps): '''convert text into typecode specific data. Encode all strings as UTF-8, which will be type 'str' not 'unicode' ''' if self.strip: text = text.strip() if self.pyclass is not None: return self.pyclass(text.encode(UNICODE_...
[ "def", "text_to_data", "(", "self", ",", "text", ",", "elt", ",", "ps", ")", ":", "if", "self", ".", "strip", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "self", ".", "pyclass", "is", "not", "None", ":", "return", "self", ".", "pyclas...
convert text into typecode specific data. Encode all strings as UTF-8, which will be type 'str' not 'unicode'
[ "convert", "text", "into", "typecode", "specific", "data", ".", "Encode", "all", "strings", "as", "UTF", "-", "8", "which", "will", "be", "type", "str", "not", "unicode" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L709-L717
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
URI.text_to_data
def text_to_data(self, text, elt, ps): '''text --> typecode specific data. ''' return String.text_to_data(self, urldecode(text), elt, ps)
python
def text_to_data(self, text, elt, ps): '''text --> typecode specific data. ''' return String.text_to_data(self, urldecode(text), elt, ps)
[ "def", "text_to_data", "(", "self", ",", "text", ",", "elt", ",", "ps", ")", ":", "return", "String", ".", "text_to_data", "(", "self", ",", "urldecode", "(", "text", ")", ",", "elt", ",", "ps", ")" ]
text --> typecode specific data.
[ "text", "--", ">", "typecode", "specific", "data", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L739-L742
rameshg87/pyremotevbox
pyremotevbox/ZSI/TC.py
URI.get_formatted_content
def get_formatted_content(self, pyobj): '''typecode data --> text ''' u = urlencode(pyobj, self.reserved) return String.get_formatted_content(self, u)
python
def get_formatted_content(self, pyobj): '''typecode data --> text ''' u = urlencode(pyobj, self.reserved) return String.get_formatted_content(self, u)
[ "def", "get_formatted_content", "(", "self", ",", "pyobj", ")", ":", "u", "=", "urlencode", "(", "pyobj", ",", "self", ".", "reserved", ")", "return", "String", ".", "get_formatted_content", "(", "self", ",", "u", ")" ]
typecode data --> text
[ "typecode", "data", "--", ">", "text" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L744-L749