repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
muckamuck/stackility
stackility/command.py
upsert
def upsert(version, stack, ini, dryrun, yaml, no_poll, work_directory): """ The main reason we have arrived here. This is the entry-point for the utility to create/update a CloudFormation stack. """ ini_data = read_config_info(ini) if 'environment' not in ini_data: print('[environment] s...
python
def upsert(version, stack, ini, dryrun, yaml, no_poll, work_directory): """ The main reason we have arrived here. This is the entry-point for the utility to create/update a CloudFormation stack. """ ini_data = read_config_info(ini) if 'environment' not in ini_data: print('[environment] s...
[ "def", "upsert", "(", "version", ",", "stack", ",", "ini", ",", "dryrun", ",", "yaml", ",", "no_poll", ",", "work_directory", ")", ":", "ini_data", "=", "read_config_info", "(", "ini", ")", "if", "'environment'", "not", "in", "ini_data", ":", "print", "(...
The main reason we have arrived here. This is the entry-point for the utility to create/update a CloudFormation stack.
[ "The", "main", "reason", "we", "have", "arrived", "here", ".", "This", "is", "the", "entry", "-", "point", "for", "the", "utility", "to", "create", "/", "update", "a", "CloudFormation", "stack", "." ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L41-L74
train
This function is used to create or update a CloudFormation stack.
muckamuck/stackility
stackility/command.py
delete
def delete(stack, region, profile): """ Delete the given CloudFormation stack. """ ini_data = {} environment = {} environment['stack_name'] = stack if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment[...
python
def delete(stack, region, profile): """ Delete the given CloudFormation stack. """ ini_data = {} environment = {} environment['stack_name'] = stack if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment[...
[ "def", "delete", "(", "stack", ",", "region", ",", "profile", ")", ":", "ini_data", "=", "{", "}", "environment", "=", "{", "}", "environment", "[", "'stack_name'", "]", "=", "stack", "if", "region", ":", "environment", "[", "'region'", "]", "=", "regi...
Delete the given CloudFormation stack.
[ "Delete", "the", "given", "CloudFormation", "stack", "." ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L81-L102
train
Delete the given CloudFormation stack.
muckamuck/stackility
stackility/command.py
list
def list(region, profile): """ List all the CloudFormation stacks in the given region. """ ini_data = {} environment = {} if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment['profile'] = profile ini_...
python
def list(region, profile): """ List all the CloudFormation stacks in the given region. """ ini_data = {} environment = {} if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment['profile'] = profile ini_...
[ "def", "list", "(", "region", ",", "profile", ")", ":", "ini_data", "=", "{", "}", "environment", "=", "{", "}", "if", "region", ":", "environment", "[", "'region'", "]", "=", "region", "else", ":", "environment", "[", "'region'", "]", "=", "find_mysel...
List all the CloudFormation stacks in the given region.
[ "List", "all", "the", "CloudFormation", "stacks", "in", "the", "given", "region", "." ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L108-L127
train
List all CloudFormation stacks in the given region.
muckamuck/stackility
stackility/command.py
drift
def drift(stack, region, profile): """ Produce a CloudFormation drift report for the given stack. """ logging.debug('finding drift - stack: {}'.format(stack)) logging.debug('region: {}'.format(region)) logging.debug('profile: {}'.format(profile)) tool = DriftTool( Stack=stack, ...
python
def drift(stack, region, profile): """ Produce a CloudFormation drift report for the given stack. """ logging.debug('finding drift - stack: {}'.format(stack)) logging.debug('region: {}'.format(region)) logging.debug('profile: {}'.format(profile)) tool = DriftTool( Stack=stack, ...
[ "def", "drift", "(", "stack", ",", "region", ",", "profile", ")", ":", "logging", ".", "debug", "(", "'finding drift - stack: {}'", ".", "format", "(", "stack", ")", ")", "logging", ".", "debug", "(", "'region: {}'", ".", "format", "(", "region", ")", ")...
Produce a CloudFormation drift report for the given stack.
[ "Produce", "a", "CloudFormation", "drift", "report", "for", "the", "given", "stack", "." ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L134-L151
train
Produce a CloudFormation drift report for the given stack.
muckamuck/stackility
stackility/command.py
start_upsert
def start_upsert(ini_data): """ Helper function to facilitate upsert. Args: ini_date - the dictionary of info to run upsert Exit: 0 - good 1 - bad """ stack_driver = CloudStackUtility(ini_data) poll_stack = not ini_data.get('no_poll', False) if stack_driver.upsert(...
python
def start_upsert(ini_data): """ Helper function to facilitate upsert. Args: ini_date - the dictionary of info to run upsert Exit: 0 - good 1 - bad """ stack_driver = CloudStackUtility(ini_data) poll_stack = not ini_data.get('no_poll', False) if stack_driver.upsert(...
[ "def", "start_upsert", "(", "ini_data", ")", ":", "stack_driver", "=", "CloudStackUtility", "(", "ini_data", ")", "poll_stack", "=", "not", "ini_data", ".", "get", "(", "'no_poll'", ",", "False", ")", "if", "stack_driver", ".", "upsert", "(", ")", ":", "lo...
Helper function to facilitate upsert. Args: ini_date - the dictionary of info to run upsert Exit: 0 - good 1 - bad
[ "Helper", "function", "to", "facilitate", "upsert", "." ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L154-L212
train
This function starts the upsert operation.
muckamuck/stackility
stackility/command.py
read_config_info
def read_config_info(ini_file): """ Read the INI file Args: ini_file - path to the file Returns: A dictionary of stuff from the INI file Exits: 1 - if problems are encountered """ try: config = RawConfigParser() config.optionxform = lambda option: o...
python
def read_config_info(ini_file): """ Read the INI file Args: ini_file - path to the file Returns: A dictionary of stuff from the INI file Exits: 1 - if problems are encountered """ try: config = RawConfigParser() config.optionxform = lambda option: o...
[ "def", "read_config_info", "(", "ini_file", ")", ":", "try", ":", "config", "=", "RawConfigParser", "(", ")", "config", ".", "optionxform", "=", "lambda", "option", ":", "option", "config", ".", "read", "(", "ini_file", ")", "the_stuff", "=", "{", "}", "...
Read the INI file Args: ini_file - path to the file Returns: A dictionary of stuff from the INI file Exits: 1 - if problems are encountered
[ "Read", "the", "INI", "file" ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L257-L284
train
Read the INI file and return a dictionary of stuff from the INI file
muckamuck/stackility
stackility/stack_tool.py
StackTool.print_stack_info
def print_stack_info(self): ''' List resources from the given stack Args: None Returns: A dictionary filled resources or None if things went sideways ''' try: rest_api_id = None deployment_found = False respon...
python
def print_stack_info(self): ''' List resources from the given stack Args: None Returns: A dictionary filled resources or None if things went sideways ''' try: rest_api_id = None deployment_found = False respon...
[ "def", "print_stack_info", "(", "self", ")", ":", "try", ":", "rest_api_id", "=", "None", "deployment_found", "=", "False", "response", "=", "self", ".", "_cf_client", ".", "describe_stack_resources", "(", "StackName", "=", "self", ".", "_stack_name", ")", "pr...
List resources from the given stack Args: None Returns: A dictionary filled resources or None if things went sideways
[ "List", "resources", "from", "the", "given", "stack" ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/stack_tool.py#L39-L92
train
Prints the stack info.
muckamuck/stackility
stackility/stack_tool.py
StackTool.print_stack_events
def print_stack_events(self): ''' List events from the given stack Args: None Returns: None ''' first_token = '7be7981bd6287dd8112305e8f3822a6f' keep_going = True next_token = first_token current_request_token = None ...
python
def print_stack_events(self): ''' List events from the given stack Args: None Returns: None ''' first_token = '7be7981bd6287dd8112305e8f3822a6f' keep_going = True next_token = first_token current_request_token = None ...
[ "def", "print_stack_events", "(", "self", ")", ":", "first_token", "=", "'7be7981bd6287dd8112305e8f3822a6f'", "keep_going", "=", "True", "next_token", "=", "first_token", "current_request_token", "=", "None", "rows", "=", "[", "]", "try", ":", "while", "keep_going",...
List events from the given stack Args: None Returns: None
[ "List", "events", "from", "the", "given", "stack" ]
b1696f02661134d31b99b4dea7c0d21d09482d33
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/stack_tool.py#L94-L147
train
Prints the list of events from the given stack.
theno/fabsetup
fabsetup/fabfile/setup/service/trac.py
trac
def trac(): '''Set up or update a trac project. This trac installation uses python2, git, sqlite (trac-default), gunicorn, and nginx. The connection is https-only and secured by a letsencrypt certificate. This certificate must be created separately with task setup.server_letsencrypt. This ta...
python
def trac(): '''Set up or update a trac project. This trac installation uses python2, git, sqlite (trac-default), gunicorn, and nginx. The connection is https-only and secured by a letsencrypt certificate. This certificate must be created separately with task setup.server_letsencrypt. This ta...
[ "def", "trac", "(", ")", ":", "hostname", "=", "re", ".", "sub", "(", "r'^[^@]+@'", ",", "''", ",", "env", ".", "host", ")", "# without username if any", "sitename", "=", "query_input", "(", "question", "=", "'\\nEnter site-name of Your trac web service'", ",", ...
Set up or update a trac project. This trac installation uses python2, git, sqlite (trac-default), gunicorn, and nginx. The connection is https-only and secured by a letsencrypt certificate. This certificate must be created separately with task setup.server_letsencrypt. This task installes or upd...
[ "Set", "up", "or", "update", "a", "trac", "project", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/service/trac.py#L28-L120
train
Set up or update a trac project.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.query
async def query(self, path, method='get', **params): """ Do a query to the System API :param path: url to the API :param method: the kind of query to do :param params: a dict with all the necessary things to query the API :return json data """ if ...
python
async def query(self, path, method='get', **params): """ Do a query to the System API :param path: url to the API :param method: the kind of query to do :param params: a dict with all the necessary things to query the API :return json data """ if ...
[ "async", "def", "query", "(", "self", ",", "path", ",", "method", "=", "'get'", ",", "*", "*", "params", ")", ":", "if", "method", "in", "(", "'get'", ",", "'post'", ",", "'patch'", ",", "'delete'", ",", "'put'", ")", ":", "full_path", "=", "self",...
Do a query to the System API :param path: url to the API :param method: the kind of query to do :param params: a dict with all the necessary things to query the API :return json data
[ "Do", "a", "query", "to", "the", "System", "API" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L60-L91
train
Query the System API for the current version of the current version of the user.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.handle_json_response
async def handle_json_response(responses): """ get the json data response :param responses: the json response :return the json data without 'root' node """ json_data = {} if responses.status != 200: err_msg = HttpProcessingError(code=responses.status, ...
python
async def handle_json_response(responses): """ get the json data response :param responses: the json response :return the json data without 'root' node """ json_data = {} if responses.status != 200: err_msg = HttpProcessingError(code=responses.status, ...
[ "async", "def", "handle_json_response", "(", "responses", ")", ":", "json_data", "=", "{", "}", "if", "responses", ".", "status", "!=", "200", ":", "err_msg", "=", "HttpProcessingError", "(", "code", "=", "responses", ".", "status", ",", "message", "=", "a...
get the json data response :param responses: the json response :return the json data without 'root' node
[ "get", "the", "json", "data", "response", ":", "param", "responses", ":", "the", "json", "response", ":", "return", "the", "json", "data", "without", "root", "node" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L94-L115
train
handle the json response from the Wallabag server
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.__get_attr
def __get_attr(what, type_attr, value_attr, **kwargs): """ get the value of a parm :param what: string parm :param type_attr: type of parm :param value_attr: :param kwargs: :return: value of the parm """ if what in kwargs: value = int(k...
python
def __get_attr(what, type_attr, value_attr, **kwargs): """ get the value of a parm :param what: string parm :param type_attr: type of parm :param value_attr: :param kwargs: :return: value of the parm """ if what in kwargs: value = int(k...
[ "def", "__get_attr", "(", "what", ",", "type_attr", ",", "value_attr", ",", "*", "*", "kwargs", ")", ":", "if", "what", "in", "kwargs", ":", "value", "=", "int", "(", "kwargs", "[", "what", "]", ")", "if", "type_attr", "==", "'int'", "else", "kwargs"...
get the value of a parm :param what: string parm :param type_attr: type of parm :param value_attr: :param kwargs: :return: value of the parm
[ "get", "the", "value", "of", "a", "parm", ":", "param", "what", ":", "string", "parm", ":", "param", "type_attr", ":", "type", "of", "parm", ":", "param", "value_attr", ":", ":", "param", "kwargs", ":", ":", "return", ":", "value", "of", "the", "parm...
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L118-L130
train
get the value of a parm
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.get_entries
async def get_entries(self, **kwargs): """ GET /api/entries.{_format} Retrieve all entries. It could be filtered by many options. :param kwargs: can contain one of the following filters archive: '0' or '1', default '0' filter by archived status. starred: '0' or...
python
async def get_entries(self, **kwargs): """ GET /api/entries.{_format} Retrieve all entries. It could be filtered by many options. :param kwargs: can contain one of the following filters archive: '0' or '1', default '0' filter by archived status. starred: '0' or...
[ "async", "def", "get_entries", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# default values", "params", "=", "dict", "(", "{", "'access_token'", ":", "self", ".", "token", ",", "'sort'", ":", "'created'", ",", "'order'", ":", "'desc'", ",", "'page'"...
GET /api/entries.{_format} Retrieve all entries. It could be filtered by many options. :param kwargs: can contain one of the following filters archive: '0' or '1', default '0' filter by archived status. starred: '0' or '1', default '0' filter by starred status. sor...
[ "GET", "/", "api", "/", "entries", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L133-L177
train
Retrieve all entries in the specified format.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.post_entries
async def post_entries(self, url, title='', tags='', starred=0, archive=0, content='', language='', published_at='', authors='', public=1, original_url=''): """ POST /api/entries.{_format} Create an entry :param url: the url of the note to store :para...
python
async def post_entries(self, url, title='', tags='', starred=0, archive=0, content='', language='', published_at='', authors='', public=1, original_url=''): """ POST /api/entries.{_format} Create an entry :param url: the url of the note to store :para...
[ "async", "def", "post_entries", "(", "self", ",", "url", ",", "title", "=", "''", ",", "tags", "=", "''", ",", "starred", "=", "0", ",", "archive", "=", "0", ",", "content", "=", "''", ",", "language", "=", "''", ",", "published_at", "=", "''", "...
POST /api/entries.{_format} Create an entry :param url: the url of the note to store :param title: Optional, we'll get the title from the page. :param tags: tag1,tag2,tag3 a comma-separated list of tags. :param starred entry already starred :param archive entry already ...
[ "POST", "/", "api", "/", "entries", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L179-L206
train
POST an entry to the note
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.get_entry
async def get_entry(self, entry): """ GET /api/entries/{entry}.{_format} Retrieve a single entry :param entry: \w+ an integer The Entry ID :return data related to the ext """ params = {'access_token': self.token} url = '/api/entries/{entry}.{ext}'.format...
python
async def get_entry(self, entry): """ GET /api/entries/{entry}.{_format} Retrieve a single entry :param entry: \w+ an integer The Entry ID :return data related to the ext """ params = {'access_token': self.token} url = '/api/entries/{entry}.{ext}'.format...
[ "async", "def", "get_entry", "(", "self", ",", "entry", ")", ":", "params", "=", "{", "'access_token'", ":", "self", ".", "token", "}", "url", "=", "'/api/entries/{entry}.{ext}'", ".", "format", "(", "entry", "=", "entry", ",", "ext", "=", "self", ".", ...
GET /api/entries/{entry}.{_format} Retrieve a single entry :param entry: \w+ an integer The Entry ID :return data related to the ext
[ "GET", "/", "api", "/", "entries", "/", "{", "entry", "}", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L208-L220
train
Get a single entry
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.patch_entries
async def patch_entries(self, entry, **kwargs): """ PATCH /api/entries/{entry}.{_format} Change several properties of an entry :param entry: the entry to 'patch' / update :param kwargs: can contain one of the following title: string tags: a list of tags ...
python
async def patch_entries(self, entry, **kwargs): """ PATCH /api/entries/{entry}.{_format} Change several properties of an entry :param entry: the entry to 'patch' / update :param kwargs: can contain one of the following title: string tags: a list of tags ...
[ "async", "def", "patch_entries", "(", "self", ",", "entry", ",", "*", "*", "kwargs", ")", ":", "# default values", "params", "=", "{", "'access_token'", ":", "self", ".", "token", ",", "'title'", ":", "''", ",", "'tags'", ":", "[", "]", "}", "if", "'...
PATCH /api/entries/{entry}.{_format} Change several properties of an entry :param entry: the entry to 'patch' / update :param kwargs: can contain one of the following title: string tags: a list of tags tag1,tag2,tag3 archive: '0' or '1', default '0' archive...
[ "PATCH", "/", "api", "/", "entries", "/", "{", "entry", "}", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L236-L276
train
This method is used to update the properties of an entry.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.delete_entries
async def delete_entries(self, entry): """ DELETE /api/entries/{entry}.{_format} Delete permanently an entry :param entry: \w+ an integer The Entry ID :return result """ params = {'Authorization': 'Bearer {}'.format(self.token)} path = '/api/entries/{en...
python
async def delete_entries(self, entry): """ DELETE /api/entries/{entry}.{_format} Delete permanently an entry :param entry: \w+ an integer The Entry ID :return result """ params = {'Authorization': 'Bearer {}'.format(self.token)} path = '/api/entries/{en...
[ "async", "def", "delete_entries", "(", "self", ",", "entry", ")", ":", "params", "=", "{", "'Authorization'", ":", "'Bearer {}'", ".", "format", "(", "self", ".", "token", ")", "}", "path", "=", "'/api/entries/{entry}.{ext}'", ".", "format", "(", "entry", ...
DELETE /api/entries/{entry}.{_format} Delete permanently an entry :param entry: \w+ an integer The Entry ID :return result
[ "DELETE", "/", "api", "/", "entries", "/", "{", "entry", "}", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L308-L321
train
Delete permanently an entry.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.entries_exists
async def entries_exists(self, url, urls=''): """ GET /api/entries/exists.{_format} Check if an entry exist by url. :param url string true An url Url to check if it exists :param urls string false An array of urls (?urls[]=http...&urls[]=http...) Urls (as an array...
python
async def entries_exists(self, url, urls=''): """ GET /api/entries/exists.{_format} Check if an entry exist by url. :param url string true An url Url to check if it exists :param urls string false An array of urls (?urls[]=http...&urls[]=http...) Urls (as an array...
[ "async", "def", "entries_exists", "(", "self", ",", "url", ",", "urls", "=", "''", ")", ":", "params", "=", "{", "'access_token'", ":", "self", ".", "token", ",", "'url'", ":", "url", ",", "'urls'", ":", "urls", "}", "path", "=", "'/api/entries/exists....
GET /api/entries/exists.{_format} Check if an entry exist by url. :param url string true An url Url to check if it exists :param urls string false An array of urls (?urls[]=http...&urls[]=http...) Urls (as an array) to check if it exists :return result
[ "GET", "/", "api", "/", "entries", "/", "exists", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L323-L341
train
Check if an entry exists by url.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.post_entry_tags
async def post_entry_tags(self, entry, tags): """ POST /api/entries/{entry}/tags.{_format} Add one or more tags to an entry :param entry: \w+ an integer The Entry ID :param tags: list of tags (urlencoded) :return result """ params = {'access_token': self...
python
async def post_entry_tags(self, entry, tags): """ POST /api/entries/{entry}/tags.{_format} Add one or more tags to an entry :param entry: \w+ an integer The Entry ID :param tags: list of tags (urlencoded) :return result """ params = {'access_token': self...
[ "async", "def", "post_entry_tags", "(", "self", ",", "entry", ",", "tags", ")", ":", "params", "=", "{", "'access_token'", ":", "self", ".", "token", ",", "'tags'", ":", "[", "]", "}", "if", "len", "(", "tags", ")", ">", "0", "and", "isinstance", "...
POST /api/entries/{entry}/tags.{_format} Add one or more tags to an entry :param entry: \w+ an integer The Entry ID :param tags: list of tags (urlencoded) :return result
[ "POST", "/", "api", "/", "entries", "/", "{", "entry", "}", "/", "tags", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L359-L374
train
POST entry tags
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.delete_entry_tag
async def delete_entry_tag(self, entry, tag): """ DELETE /api/entries/{entry}/tags/{tag}.{_format} Permanently remove one tag for an entry :param entry: \w+ an integer The Entry ID :param tag: string The Tag :return data related to the ext """ params = {...
python
async def delete_entry_tag(self, entry, tag): """ DELETE /api/entries/{entry}/tags/{tag}.{_format} Permanently remove one tag for an entry :param entry: \w+ an integer The Entry ID :param tag: string The Tag :return data related to the ext """ params = {...
[ "async", "def", "delete_entry_tag", "(", "self", ",", "entry", ",", "tag", ")", ":", "params", "=", "{", "'access_token'", ":", "self", ".", "token", "}", "url", "=", "'/api/entries/{entry}/tags/{tag}.{ext}'", ".", "format", "(", "entry", "=", "entry", ",", ...
DELETE /api/entries/{entry}/tags/{tag}.{_format} Permanently remove one tag for an entry :param entry: \w+ an integer The Entry ID :param tag: string The Tag :return data related to the ext
[ "DELETE", "/", "api", "/", "entries", "/", "{", "entry", "}", "/", "tags", "/", "{", "tag", "}", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L376-L389
train
Permanently remove one tag for an entry
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.get_tags
async def get_tags(self): """ GET /api/tags.{_format} Retrieve all tags :return data related to the ext """ params = {'access_token': self.token} path = '/api/tags.{ext}'.format(ext=self.format) return await self.query(path, "get", **params)
python
async def get_tags(self): """ GET /api/tags.{_format} Retrieve all tags :return data related to the ext """ params = {'access_token': self.token} path = '/api/tags.{ext}'.format(ext=self.format) return await self.query(path, "get", **params)
[ "async", "def", "get_tags", "(", "self", ")", ":", "params", "=", "{", "'access_token'", ":", "self", ".", "token", "}", "path", "=", "'/api/tags.{ext}'", ".", "format", "(", "ext", "=", "self", ".", "format", ")", "return", "await", "self", ".", "quer...
GET /api/tags.{_format} Retrieve all tags :return data related to the ext
[ "GET", "/", "api", "/", "tags", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L391-L401
train
Retrieve all tags related to the ext
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.delete_tag
async def delete_tag(self, tag): """ DELETE /api/tags/{tag}.{_format} Permanently remove one tag from every entry :param tag: string The Tag :return data related to the ext """ path = '/api/tags/{tag}.{ext}'.format(tag=tag, ext=self.format) params = {'ac...
python
async def delete_tag(self, tag): """ DELETE /api/tags/{tag}.{_format} Permanently remove one tag from every entry :param tag: string The Tag :return data related to the ext """ path = '/api/tags/{tag}.{ext}'.format(tag=tag, ext=self.format) params = {'ac...
[ "async", "def", "delete_tag", "(", "self", ",", "tag", ")", ":", "path", "=", "'/api/tags/{tag}.{ext}'", ".", "format", "(", "tag", "=", "tag", ",", "ext", "=", "self", ".", "format", ")", "params", "=", "{", "'access_token'", ":", "self", ".", "token"...
DELETE /api/tags/{tag}.{_format} Permanently remove one tag from every entry :param tag: string The Tag :return data related to the ext
[ "DELETE", "/", "api", "/", "tags", "/", "{", "tag", "}", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L403-L414
train
Permanently remove one tag from every entry
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.put_annotations
async def put_annotations(self, annotation): """ PUT /api/annotations/{annotation}.{_format} Updates an annotation. :param annotation \w+ string The annotation ID Will returns annotation for this entry :return data related to the ext """ params = {'a...
python
async def put_annotations(self, annotation): """ PUT /api/annotations/{annotation}.{_format} Updates an annotation. :param annotation \w+ string The annotation ID Will returns annotation for this entry :return data related to the ext """ params = {'a...
[ "async", "def", "put_annotations", "(", "self", ",", "annotation", ")", ":", "params", "=", "{", "'access_token'", ":", "self", ".", "token", "}", "url", "=", "'/api/annotations/{annotation}.{ext}'", ".", "format", "(", "annotation", "=", "annotation", ",", "e...
PUT /api/annotations/{annotation}.{_format} Updates an annotation. :param annotation \w+ string The annotation ID Will returns annotation for this entry :return data related to the ext
[ "PUT", "/", "api", "/", "annotations", "/", "{", "annotation", "}", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L462-L476
train
Update an annotation.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.post_annotations
async def post_annotations(self, entry, **kwargs): """ POST /api/annotations/{entry}.{_format} Creates a new annotation. :param entry \w+ integer The entry ID :return """ params = dict({'access_token': self.token, 'ranges': [], ...
python
async def post_annotations(self, entry, **kwargs): """ POST /api/annotations/{entry}.{_format} Creates a new annotation. :param entry \w+ integer The entry ID :return """ params = dict({'access_token': self.token, 'ranges': [], ...
[ "async", "def", "post_annotations", "(", "self", ",", "entry", ",", "*", "*", "kwargs", ")", ":", "params", "=", "dict", "(", "{", "'access_token'", ":", "self", ".", "token", ",", "'ranges'", ":", "[", "]", ",", "'quote'", ":", "''", ",", "'text'", ...
POST /api/annotations/{entry}.{_format} Creates a new annotation. :param entry \w+ integer The entry ID :return
[ "POST", "/", "api", "/", "annotations", "/", "{", "entry", "}", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L494-L517
train
POST an annotation for a specific entry.
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.version
async def version(self): """ GET /api/version.{_format} Retrieve version number :return data related to the ext """ params = {'access_token': self.token} url = '/api/version.{ext}'.format(ext=self.format) return await self.query(url, "get", **params)
python
async def version(self): """ GET /api/version.{_format} Retrieve version number :return data related to the ext """ params = {'access_token': self.token} url = '/api/version.{ext}'.format(ext=self.format) return await self.query(url, "get", **params)
[ "async", "def", "version", "(", "self", ")", ":", "params", "=", "{", "'access_token'", ":", "self", ".", "token", "}", "url", "=", "'/api/version.{ext}'", ".", "format", "(", "ext", "=", "self", ".", "format", ")", "return", "await", "self", ".", "que...
GET /api/version.{_format} Retrieve version number :return data related to the ext
[ "GET", "/", "api", "/", "version", ".", "{", "_format", "}" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L521-L531
train
Retrieve version number of the current locale
push-things/wallabag_api
wallabag_api/wallabag.py
Wallabag.get_token
async def get_token(cls, host, **params): """ POST /oauth/v2/token Get a new token :param host: host of the service :param params: will contain : params = {"grant_type": "password", "client_id": "a string", "client_secret": "a string...
python
async def get_token(cls, host, **params): """ POST /oauth/v2/token Get a new token :param host: host of the service :param params: will contain : params = {"grant_type": "password", "client_id": "a string", "client_secret": "a string...
[ "async", "def", "get_token", "(", "cls", ",", "host", ",", "*", "*", "params", ")", ":", "params", "[", "'grant_type'", "]", "=", "\"password\"", "path", "=", "\"/oauth/v2/token\"", "async", "with", "aiohttp", ".", "ClientSession", "(", ")", "as", "sess", ...
POST /oauth/v2/token Get a new token :param host: host of the service :param params: will contain : params = {"grant_type": "password", "client_id": "a string", "client_secret": "a string", "username": "a login", ...
[ "POST", "/", "oauth", "/", "v2", "/", "token" ]
8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e
https://github.com/push-things/wallabag_api/blob/8d1e10a6ebc03d1ac9af2b38b57eb69f29b4216e/wallabag_api/wallabag.py#L534-L556
train
POST / oauth / v2 / token
theno/fabsetup
fabsetup/fabfile/setup/revealjs.py
revealjs
def revealjs(basedir=None, title=None, subtitle=None, description=None, github_user=None, github_repo=None): '''Set up or update a reveals.js presentation with slides written in markdown. Several reveal.js plugins will be set up, too. More info: Demo: https://theno.github.io/revealjs_te...
python
def revealjs(basedir=None, title=None, subtitle=None, description=None, github_user=None, github_repo=None): '''Set up or update a reveals.js presentation with slides written in markdown. Several reveal.js plugins will be set up, too. More info: Demo: https://theno.github.io/revealjs_te...
[ "def", "revealjs", "(", "basedir", "=", "None", ",", "title", "=", "None", ",", "subtitle", "=", "None", ",", "description", "=", "None", ",", "github_user", "=", "None", ",", "github_repo", "=", "None", ")", ":", "basedir", "=", "basedir", "or", "quer...
Set up or update a reveals.js presentation with slides written in markdown. Several reveal.js plugins will be set up, too. More info: Demo: https://theno.github.io/revealjs_template http://lab.hakim.se/reveal-js/ https://github.com/hakimel/reveal.js plugins: https://github.com/...
[ "Set", "up", "or", "update", "a", "reveals", ".", "js", "presentation", "with", "slides", "written", "in", "markdown", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/revealjs.py#L50-L90
train
Create or update a reveals. js presentation with slides written in markdown.
theno/fabsetup
fabsetup/fabfile/setup/revealjs.py
tweak_css
def tweak_css(repo_dir): '''Comment out some css settings.''' print_msg("* don't capitalize titles (no uppercase headings)") files = [ 'beige.css', 'black.css', 'blood.css', 'league.css', 'moon.css', 'night.css', 'serif.css', 'simple.css', 'sky.css', 'solarized.css', 'white.css', ...
python
def tweak_css(repo_dir): '''Comment out some css settings.''' print_msg("* don't capitalize titles (no uppercase headings)") files = [ 'beige.css', 'black.css', 'blood.css', 'league.css', 'moon.css', 'night.css', 'serif.css', 'simple.css', 'sky.css', 'solarized.css', 'white.css', ...
[ "def", "tweak_css", "(", "repo_dir", ")", ":", "print_msg", "(", "\"* don't capitalize titles (no uppercase headings)\"", ")", "files", "=", "[", "'beige.css'", ",", "'black.css'", ",", "'blood.css'", ",", "'league.css'", ",", "'moon.css'", ",", "'night.css'", ",", ...
Comment out some css settings.
[ "Comment", "out", "some", "css", "settings", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/revealjs.py#L184-L218
train
Comment out some css settings.
theno/fabsetup
fabsetup/fabfile/setup/revealjs.py
_create_github_remote_repo
def _create_github_remote_repo(basedir): '''More info: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ https://developer.github.com/v3/repos/#create https://stackoverflow.com/a/10325316 ''' github_user = _lazy('github_user') github_repo = _...
python
def _create_github_remote_repo(basedir): '''More info: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ https://developer.github.com/v3/repos/#create https://stackoverflow.com/a/10325316 ''' github_user = _lazy('github_user') github_repo = _...
[ "def", "_create_github_remote_repo", "(", "basedir", ")", ":", "github_user", "=", "_lazy", "(", "'github_user'", ")", "github_repo", "=", "_lazy", "(", "'github_repo'", ",", "default", "=", "os", ".", "path", ".", "basename", "(", "basedir", ")", ")", "_ins...
More info: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ https://developer.github.com/v3/repos/#create https://stackoverflow.com/a/10325316
[ "More", "info", ":", "https", ":", "//", "help", ".", "github", ".", "com", "/", "articles", "/", "adding", "-", "an", "-", "existing", "-", "project", "-", "to", "-", "github", "-", "using", "-", "the", "-", "command", "-", "line", "/", "https", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/revealjs.py#L318-L339
train
Create a github remote repository.
theno/fabsetup
fabsetup/fabfile/setup/revealjs.py
decktape
def decktape(): '''Install DeckTape. DeckTape is a "high-quality PDF exporter for HTML5 presentation frameworks". It can be used to create PDFs from reveal.js presentations. More info: https://github.com/astefanutti/decktape https://github.com/hakimel/reveal.js/issues/1252#issuecomment-19...
python
def decktape(): '''Install DeckTape. DeckTape is a "high-quality PDF exporter for HTML5 presentation frameworks". It can be used to create PDFs from reveal.js presentations. More info: https://github.com/astefanutti/decktape https://github.com/hakimel/reveal.js/issues/1252#issuecomment-19...
[ "def", "decktape", "(", ")", ":", "run", "(", "'mkdir -p ~/bin/decktape'", ")", "if", "not", "exists", "(", "'~/bin/decktape/decktape-1.0.0'", ")", ":", "print_msg", "(", "'\\n## download decktape 1.0.0\\n'", ")", "run", "(", "'cd ~/bin/decktape && '", "'curl -L https:/...
Install DeckTape. DeckTape is a "high-quality PDF exporter for HTML5 presentation frameworks". It can be used to create PDFs from reveal.js presentations. More info: https://github.com/astefanutti/decktape https://github.com/hakimel/reveal.js/issues/1252#issuecomment-198270915
[ "Install", "DeckTape", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/revealjs.py#L366-L395
train
Install DeckTape.
theno/fabsetup
fabsetup/fabfile/setup/revealjs.py
revealjs_template
def revealjs_template(): '''Create or update the template presentation demo using task `revealjs`. ''' from config import basedir, github_user, github_repo run(flo('rm -f {basedir}/index.html')) run(flo('rm -f {basedir}/slides.md')) run(flo('rm -f {basedir}/README.md')) run(flo('rm -rf {bas...
python
def revealjs_template(): '''Create or update the template presentation demo using task `revealjs`. ''' from config import basedir, github_user, github_repo run(flo('rm -f {basedir}/index.html')) run(flo('rm -f {basedir}/slides.md')) run(flo('rm -f {basedir}/README.md')) run(flo('rm -rf {bas...
[ "def", "revealjs_template", "(", ")", ":", "from", "config", "import", "basedir", ",", "github_user", ",", "github_repo", "run", "(", "flo", "(", "'rm -f {basedir}/index.html'", ")", ")", "run", "(", "flo", "(", "'rm -f {basedir}/slides.md'", ")", ")", "run", ...
Create or update the template presentation demo using task `revealjs`.
[ "Create", "or", "update", "the", "template", "presentation", "demo", "using", "task", "revealjs", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/revealjs.py#L401-L434
train
Create or update the template presentation demo using task revealjs.
awickert/gFlex
gflex/f1d.py
F1D.spatialDomainNoGrid
def spatialDomainNoGrid(self): """ Superposition of analytical solutions without a gridded domain """ self.w = np.zeros(self.xw.shape) if self.Debug: print("w = ") print(self.w.shape) for i in range(len(self.q)): # More efficient if we have created some 0-load ...
python
def spatialDomainNoGrid(self): """ Superposition of analytical solutions without a gridded domain """ self.w = np.zeros(self.xw.shape) if self.Debug: print("w = ") print(self.w.shape) for i in range(len(self.q)): # More efficient if we have created some 0-load ...
[ "def", "spatialDomainNoGrid", "(", "self", ")", ":", "self", ".", "w", "=", "np", ".", "zeros", "(", "self", ".", "xw", ".", "shape", ")", "if", "self", ".", "Debug", ":", "print", "(", "\"w = \"", ")", "print", "(", "self", ".", "w", ".", "shape...
Superposition of analytical solutions without a gridded domain
[ "Superposition", "of", "analytical", "solutions", "without", "a", "gridded", "domain" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L143-L159
train
Returns a new array with the first two elements of the spatial domain that is not gridded.
awickert/gFlex
gflex/f1d.py
F1D.elasprepFD
def elasprepFD(self): """ dx4, D = elasprepFD(dx,Te,E=1E11,nu=0.25) Defines the variables (except for the subset flexural rigidity) that are needed to run "coeff_matrix_1d" """ self.dx4 = self.dx**4 self.D = self.E*self.Te**3/(12*(1-self.nu**2))
python
def elasprepFD(self): """ dx4, D = elasprepFD(dx,Te,E=1E11,nu=0.25) Defines the variables (except for the subset flexural rigidity) that are needed to run "coeff_matrix_1d" """ self.dx4 = self.dx**4 self.D = self.E*self.Te**3/(12*(1-self.nu**2))
[ "def", "elasprepFD", "(", "self", ")", ":", "self", ".", "dx4", "=", "self", ".", "dx", "**", "4", "self", ".", "D", "=", "self", ".", "E", "*", "self", ".", "Te", "**", "3", "/", "(", "12", "*", "(", "1", "-", "self", ".", "nu", "**", "2...
dx4, D = elasprepFD(dx,Te,E=1E11,nu=0.25) Defines the variables (except for the subset flexural rigidity) that are needed to run "coeff_matrix_1d"
[ "dx4", "D", "=", "elasprepFD", "(", "dx", "Te", "E", "=", "1E11", "nu", "=", "0", ".", "25", ")", "Defines", "the", "variables", "(", "except", "for", "the", "subset", "flexural", "rigidity", ")", "that", "are", "needed", "to", "run", "coeff_matrix_1d"...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L164-L172
train
This method is used to prepare the FD for the new FD.
awickert/gFlex
gflex/f1d.py
F1D.BC_Rigidity
def BC_Rigidity(self): """ Utility function to help implement boundary conditions by specifying them for and applying them to the elastic thickness grid """ ######################################### # FLEXURAL RIGIDITY BOUNDARY CONDITIONS # #########################################...
python
def BC_Rigidity(self): """ Utility function to help implement boundary conditions by specifying them for and applying them to the elastic thickness grid """ ######################################### # FLEXURAL RIGIDITY BOUNDARY CONDITIONS # #########################################...
[ "def", "BC_Rigidity", "(", "self", ")", ":", "#########################################\r", "# FLEXURAL RIGIDITY BOUNDARY CONDITIONS #\r", "#########################################\r", "# West\r", "if", "self", ".", "BC_W", "==", "'Periodic'", ":", "self", ".", "BC_Rigidity_W"...
Utility function to help implement boundary conditions by specifying them for and applying them to the elastic thickness grid
[ "Utility", "function", "to", "help", "implement", "boundary", "conditions", "by", "specifying", "them", "for", "and", "applying", "them", "to", "the", "elastic", "thickness", "grid" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L206-L262
train
Utility function to help implement boundary conditions by specifying them for and applying them to the elastic thickness grid
awickert/gFlex
gflex/f1d.py
F1D.build_diagonals
def build_diagonals(self): """ Builds the diagonals for the coefficient array """ ########################################################## # INCORPORATE BOUNDARY CONDITIONS INTO COEFFICIENT ARRAY # ########################################################## # Roll to keep the pro...
python
def build_diagonals(self): """ Builds the diagonals for the coefficient array """ ########################################################## # INCORPORATE BOUNDARY CONDITIONS INTO COEFFICIENT ARRAY # ########################################################## # Roll to keep the pro...
[ "def", "build_diagonals", "(", "self", ")", ":", "##########################################################\r", "# INCORPORATE BOUNDARY CONDITIONS INTO COEFFICIENT ARRAY #\r", "##########################################################\r", "# Roll to keep the proper coefficients at the proper pla...
Builds the diagonals for the coefficient array
[ "Builds", "the", "diagonals", "for", "the", "coefficient", "array" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L344-L377
train
Builds the diagonals for the coefficient array.
awickert/gFlex
gflex/f1d.py
F1D.BC_Periodic
def BC_Periodic(self): """ Periodic boundary conditions: wraparound to the other side. """ if self.BC_E == 'Periodic' and self.BC_W == 'Periodic': # If both boundaries are periodic, we are good to go (and self-consistent) pass # It is just a shift in the coeff. matrix creation. el...
python
def BC_Periodic(self): """ Periodic boundary conditions: wraparound to the other side. """ if self.BC_E == 'Periodic' and self.BC_W == 'Periodic': # If both boundaries are periodic, we are good to go (and self-consistent) pass # It is just a shift in the coeff. matrix creation. el...
[ "def", "BC_Periodic", "(", "self", ")", ":", "if", "self", ".", "BC_E", "==", "'Periodic'", "and", "self", ".", "BC_W", "==", "'Periodic'", ":", "# If both boundaries are periodic, we are good to go (and self-consistent)\r", "pass", "# It is just a shift in the coeff. matri...
Periodic boundary conditions: wraparound to the other side.
[ "Periodic", "boundary", "conditions", ":", "wraparound", "to", "the", "other", "side", "." ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L379-L398
train
This method is used to make the boundary condition a periodic boundary condition.
awickert/gFlex
gflex/f1d.py
F1D.BC_0Displacement0Slope
def BC_0Displacement0Slope(self): """ 0Displacement0Slope boundary condition for 0 deflection. This requires that nothing be done to the edges of the solution array, because the lack of the off-grid terms implies that they go to 0 Here we just turn the cells outside the array into nan, to ensu...
python
def BC_0Displacement0Slope(self): """ 0Displacement0Slope boundary condition for 0 deflection. This requires that nothing be done to the edges of the solution array, because the lack of the off-grid terms implies that they go to 0 Here we just turn the cells outside the array into nan, to ensu...
[ "def", "BC_0Displacement0Slope", "(", "self", ")", ":", "if", "self", ".", "BC_W", "==", "'0Displacement0Slope'", ":", "i", "=", "0", "self", ".", "l2", "[", "i", "]", "=", "np", ".", "nan", "self", ".", "l1", "[", "i", "]", "=", "np", ".", "nan"...
0Displacement0Slope boundary condition for 0 deflection. This requires that nothing be done to the edges of the solution array, because the lack of the off-grid terms implies that they go to 0 Here we just turn the cells outside the array into nan, to ensure that we are not accidentally including ...
[ "0Displacement0Slope", "boundary", "condition", "for", "0", "deflection", ".", "This", "requires", "that", "nothing", "be", "done", "to", "the", "edges", "of", "the", "solution", "array", "because", "the", "lack", "of", "the", "off", "-", "grid", "terms", "i...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L400-L434
train
Returns a new array with boundary conditions for 0 deflection.
awickert/gFlex
gflex/f1d.py
F1D.BC_Mirror
def BC_Mirror(self): """ Mirrors qs across the boundary on either the west (left) or east (right) side, depending on the selections. This can, for example, produce a scenario in which you are observing a mountain range up to the range crest (or, more correctly, the halfway point a...
python
def BC_Mirror(self): """ Mirrors qs across the boundary on either the west (left) or east (right) side, depending on the selections. This can, for example, produce a scenario in which you are observing a mountain range up to the range crest (or, more correctly, the halfway point a...
[ "def", "BC_Mirror", "(", "self", ")", ":", "if", "self", ".", "BC_W", "==", "'Mirror'", ":", "i", "=", "0", "#self.l2[i] += np.nan\r", "#self.l1[i] += np.nan\r", "self", ".", "c0", "[", "i", "]", "+=", "0", "self", ".", "r1", "[", "i", "]", "+=", "se...
Mirrors qs across the boundary on either the west (left) or east (right) side, depending on the selections. This can, for example, produce a scenario in which you are observing a mountain range up to the range crest (or, more correctly, the halfway point across the mountain range).
[ "Mirrors", "qs", "across", "the", "boundary", "on", "either", "the", "west", "(", "left", ")", "or", "east", "(", "right", ")", "side", "depending", "on", "the", "selections", ".", "This", "can", "for", "example", "produce", "a", "scenario", "in", "which...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L525-L558
train
A method to modify the internal representation of the Mirror class.
awickert/gFlex
gflex/f1d.py
F1D.calc_max_flexural_wavelength
def calc_max_flexural_wavelength(self): """ Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good character...
python
def calc_max_flexural_wavelength(self): """ Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good character...
[ "def", "calc_max_flexural_wavelength", "(", "self", ")", ":", "if", "np", ".", "isscalar", "(", "self", ".", "D", ")", ":", "Dmax", "=", "self", ".", "D", "else", ":", "Dmax", "=", "self", ".", "D", ".", "max", "(", ")", "# This is an approximation if ...
Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good characteristic distance for any truncation limit
[ "Returns", "the", "approximate", "maximum", "flexural", "wavelength", "This", "is", "important", "when", "padding", "of", "the", "grid", "is", "required", ":", "in", "Flexure", "(", "this", "code", ")", "grids", "are", "padded", "out", "to", "one", "maximum"...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L562-L578
train
Calculates the approximate maximum flexural wavelength of a single node
awickert/gFlex
gflex/f1d.py
F1D.fd_solve
def fd_solve(self): """ w = fd_solve() where coeff is the sparse coefficient matrix output from function coeff_matrix and qs is the array of loads (stresses) Sparse solver for one-dimensional flexure of an elastic plate """ if self.Debug: print("qs", self.qs.shape) ...
python
def fd_solve(self): """ w = fd_solve() where coeff is the sparse coefficient matrix output from function coeff_matrix and qs is the array of loads (stresses) Sparse solver for one-dimensional flexure of an elastic plate """ if self.Debug: print("qs", self.qs.shape) ...
[ "def", "fd_solve", "(", "self", ")", ":", "if", "self", ".", "Debug", ":", "print", "(", "\"qs\"", ",", "self", ".", "qs", ".", "shape", ")", "print", "(", "\"Te\"", ",", "self", ".", "Te", ".", "shape", ")", "self", ".", "calc_max_flexural_wavelengt...
w = fd_solve() where coeff is the sparse coefficient matrix output from function coeff_matrix and qs is the array of loads (stresses) Sparse solver for one-dimensional flexure of an elastic plate
[ "w", "=", "fd_solve", "()", "where", "coeff", "is", "the", "sparse", "coefficient", "matrix", "output", "from", "function", "coeff_matrix", "and", "qs", "is", "the", "array", "of", "loads", "(", "stresses", ")", "Sparse", "solver", "for", "one", "-", "dime...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L580-L621
train
Solve the sparse coefficient matrix and return the array of loads.
futurice/django-history
djangohistory/signals.py
m2m_changed_handler
def m2m_changed_handler(sender, *args, **kwargs): """ A model's save() never gets called on ManyToManyField changes, m2m_changed-signal is sent. sender = dynamically generated model in m2m-table instance = parent related_instance = instance being m2m'ed """ action = kwargs['action'] inst...
python
def m2m_changed_handler(sender, *args, **kwargs): """ A model's save() never gets called on ManyToManyField changes, m2m_changed-signal is sent. sender = dynamically generated model in m2m-table instance = parent related_instance = instance being m2m'ed """ action = kwargs['action'] inst...
[ "def", "m2m_changed_handler", "(", "sender", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "action", "=", "kwargs", "[", "'action'", "]", "instance", "=", "kwargs", "[", "'instance'", "]", "logger", ".", "debug", "(", "\"m2m_changed: %s (%s) {%s}\"", ...
A model's save() never gets called on ManyToManyField changes, m2m_changed-signal is sent. sender = dynamically generated model in m2m-table instance = parent related_instance = instance being m2m'ed
[ "A", "model", "s", "save", "()", "never", "gets", "called", "on", "ManyToManyField", "changes", "m2m_changed", "-", "signal", "is", "sent", ".", "sender", "=", "dynamically", "generated", "model", "in", "m2m", "-", "table", "instance", "=", "parent", "relate...
8b618c331d50aa821182fed16090792993a1096b
https://github.com/futurice/django-history/blob/8b618c331d50aa821182fed16090792993a1096b/djangohistory/signals.py#L47-L102
train
This method is called when a ManyToManyField changes is received.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_gt_from_lt
def _gt_from_lt(self, other): """Return a > b. Computed by @total_ordering from (not a < b) and (a != b).""" op_result = self.__lt__(other) if op_result is NotImplemented: return NotImplemented return not op_result and self != other
python
def _gt_from_lt(self, other): """Return a > b. Computed by @total_ordering from (not a < b) and (a != b).""" op_result = self.__lt__(other) if op_result is NotImplemented: return NotImplemented return not op_result and self != other
[ "def", "_gt_from_lt", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__lt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result", "and", "self", "!=", "other" ]
Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
[ "Return", "a", ">", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L16-L21
train
Return a > b. Computed by total_ordering from
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_le_from_lt
def _le_from_lt(self, other): """Return a <= b. Computed by @total_ordering from (a < b) or (a == b).""" op_result = self.__lt__(other) return op_result or self == other
python
def _le_from_lt(self, other): """Return a <= b. Computed by @total_ordering from (a < b) or (a == b).""" op_result = self.__lt__(other) return op_result or self == other
[ "def", "_le_from_lt", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__lt__", "(", "other", ")", "return", "op_result", "or", "self", "==", "other" ]
Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
[ "Return", "a", "<", "=", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L24-L27
train
Return True if self < other. Computed by total_ordering from ( a < b.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_ge_from_lt
def _ge_from_lt(self, other): """Return a >= b. Computed by @total_ordering from (not a < b).""" op_result = self.__lt__(other) if op_result is NotImplemented: return NotImplemented return not op_result
python
def _ge_from_lt(self, other): """Return a >= b. Computed by @total_ordering from (not a < b).""" op_result = self.__lt__(other) if op_result is NotImplemented: return NotImplemented return not op_result
[ "def", "_ge_from_lt", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__lt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result" ]
Return a >= b. Computed by @total_ordering from (not a < b).
[ "Return", "a", ">", "=", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L30-L35
train
Return a > = b. Computed by total_ordering from ( not a < b.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_ge_from_le
def _ge_from_le(self, other): """Return a >= b. Computed by @total_ordering from (not a <= b) or (a == b).""" op_result = self.__le__(other) if op_result is NotImplemented: return NotImplemented return not op_result or self == other
python
def _ge_from_le(self, other): """Return a >= b. Computed by @total_ordering from (not a <= b) or (a == b).""" op_result = self.__le__(other) if op_result is NotImplemented: return NotImplemented return not op_result or self == other
[ "def", "_ge_from_le", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__le__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result", "or", "self", "==", "other" ]
Return a >= b. Computed by @total_ordering from (not a <= b) or (a == b).
[ "Return", "a", ">", "=", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L38-L43
train
Return True if self < = other. Computed by total_ordering from
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_lt_from_le
def _lt_from_le(self, other): """Return a < b. Computed by @total_ordering from (a <= b) and (a != b).""" op_result = self.__le__(other) if op_result is NotImplemented: return NotImplemented return op_result and self != other
python
def _lt_from_le(self, other): """Return a < b. Computed by @total_ordering from (a <= b) and (a != b).""" op_result = self.__le__(other) if op_result is NotImplemented: return NotImplemented return op_result and self != other
[ "def", "_lt_from_le", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__le__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "op_result", "and", "self", "!=", "other" ]
Return a < b. Computed by @total_ordering from (a <= b) and (a != b).
[ "Return", "a", "<", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L46-L51
train
Return True if self < other.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_gt_from_le
def _gt_from_le(self, other): """Return a > b. Computed by @total_ordering from (not a <= b).""" op_result = self.__le__(other) if op_result is NotImplemented: return NotImplemented return not op_result
python
def _gt_from_le(self, other): """Return a > b. Computed by @total_ordering from (not a <= b).""" op_result = self.__le__(other) if op_result is NotImplemented: return NotImplemented return not op_result
[ "def", "_gt_from_le", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__le__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result" ]
Return a > b. Computed by @total_ordering from (not a <= b).
[ "Return", "a", ">", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L54-L59
train
Return a > b. Computed by total_ordering from ( not a < b.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_lt_from_gt
def _lt_from_gt(self, other): """Return a < b. Computed by @total_ordering from (not a > b) and (a != b).""" op_result = self.__gt__(other) if op_result is NotImplemented: return NotImplemented return not op_result and self != other
python
def _lt_from_gt(self, other): """Return a < b. Computed by @total_ordering from (not a > b) and (a != b).""" op_result = self.__gt__(other) if op_result is NotImplemented: return NotImplemented return not op_result and self != other
[ "def", "_lt_from_gt", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__gt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result", "and", "self", "!=", "other" ]
Return a < b. Computed by @total_ordering from (not a > b) and (a != b).
[ "Return", "a", "<", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L62-L67
train
Return a < b. Computed by total_ordering from
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_ge_from_gt
def _ge_from_gt(self, other): """Return a >= b. Computed by @total_ordering from (a > b) or (a == b).""" op_result = self.__gt__(other) return op_result or self == other
python
def _ge_from_gt(self, other): """Return a >= b. Computed by @total_ordering from (a > b) or (a == b).""" op_result = self.__gt__(other) return op_result or self == other
[ "def", "_ge_from_gt", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__gt__", "(", "other", ")", "return", "op_result", "or", "self", "==", "other" ]
Return a >= b. Computed by @total_ordering from (a > b) or (a == b).
[ "Return", "a", ">", "=", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L70-L73
train
Return True if self > = other. Computed by total_ordering from ( a > b ).
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_le_from_gt
def _le_from_gt(self, other): """Return a <= b. Computed by @total_ordering from (not a > b).""" op_result = self.__gt__(other) if op_result is NotImplemented: return NotImplemented return not op_result
python
def _le_from_gt(self, other): """Return a <= b. Computed by @total_ordering from (not a > b).""" op_result = self.__gt__(other) if op_result is NotImplemented: return NotImplemented return not op_result
[ "def", "_le_from_gt", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__gt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result" ]
Return a <= b. Computed by @total_ordering from (not a > b).
[ "Return", "a", "<", "=", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L76-L81
train
Return a < b. Computed by total_ordering from ( not a > b.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_le_from_ge
def _le_from_ge(self, other): """Return a <= b. Computed by @total_ordering from (not a >= b) or (a == b).""" op_result = self.__ge__(other) if op_result is NotImplemented: return NotImplemented return not op_result or self == other
python
def _le_from_ge(self, other): """Return a <= b. Computed by @total_ordering from (not a >= b) or (a == b).""" op_result = self.__ge__(other) if op_result is NotImplemented: return NotImplemented return not op_result or self == other
[ "def", "_le_from_ge", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__ge__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result", "or", "self", "==", "other" ]
Return a <= b. Computed by @total_ordering from (not a >= b) or (a == b).
[ "Return", "a", "<", "=", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L84-L89
train
Return True if self < = other.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_gt_from_ge
def _gt_from_ge(self, other): """Return a > b. Computed by @total_ordering from (a >= b) and (a != b).""" op_result = self.__ge__(other) if op_result is NotImplemented: return NotImplemented return op_result and self != other
python
def _gt_from_ge(self, other): """Return a > b. Computed by @total_ordering from (a >= b) and (a != b).""" op_result = self.__ge__(other) if op_result is NotImplemented: return NotImplemented return op_result and self != other
[ "def", "_gt_from_ge", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__ge__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "op_result", "and", "self", "!=", "other" ]
Return a > b. Computed by @total_ordering from (a >= b) and (a != b).
[ "Return", "a", ">", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L92-L97
train
Return True if self > = other.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
_lt_from_ge
def _lt_from_ge(self, other): """Return a < b. Computed by @total_ordering from (not a >= b).""" op_result = self.__ge__(other) if op_result is NotImplemented: return NotImplemented return not op_result
python
def _lt_from_ge(self, other): """Return a < b. Computed by @total_ordering from (not a >= b).""" op_result = self.__ge__(other) if op_result is NotImplemented: return NotImplemented return not op_result
[ "def", "_lt_from_ge", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__ge__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result" ]
Return a < b. Computed by @total_ordering from (not a >= b).
[ "Return", "a", "<", "b", ".", "Computed", "by" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L100-L105
train
Return a < b. Computed by total_ordering from ( not a < b.
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
total_ordering
def total_ordering(cls): """Class decorator that fills in missing ordering methods""" convert = { # :off '__lt__': [('__gt__', _gt_from_lt), ('__le__', _le_from_lt), ('__ge__', _ge_from_lt)], '__le__': [('__ge__', _ge_from_le), ('__lt__',...
python
def total_ordering(cls): """Class decorator that fills in missing ordering methods""" convert = { # :off '__lt__': [('__gt__', _gt_from_lt), ('__le__', _le_from_lt), ('__ge__', _ge_from_lt)], '__le__': [('__ge__', _ge_from_le), ('__lt__',...
[ "def", "total_ordering", "(", "cls", ")", ":", "convert", "=", "{", "# :off", "'__lt__'", ":", "[", "(", "'__gt__'", ",", "_gt_from_lt", ")", ",", "(", "'__le__'", ",", "_le_from_lt", ")", ",", "(", "'__ge__'", ",", "_ge_from_lt", ")", "]", ",", "'__le...
Class decorator that fills in missing ordering methods
[ "Class", "decorator", "that", "fills", "in", "missing", "ordering", "methods" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L109-L138
train
Class decorator that fills in missing ordering methods
sbmlteam/libCombine
examples/python/createArchiveExample.py
createArchiveExample
def createArchiveExample(fileName): """ Creates Combine Archive containing the given file. :param fileName: file to include in the archive :return: None """ print('*' * 80) print('Create archive') print('*' * 80) archive = CombineArchive() archive.addFile( fileName, # file...
python
def createArchiveExample(fileName): """ Creates Combine Archive containing the given file. :param fileName: file to include in the archive :return: None """ print('*' * 80) print('Create archive') print('*' * 80) archive = CombineArchive() archive.addFile( fileName, # file...
[ "def", "createArchiveExample", "(", "fileName", ")", ":", "print", "(", "'*'", "*", "80", ")", "print", "(", "'Create archive'", ")", "print", "(", "'*'", "*", "80", ")", "archive", "=", "CombineArchive", "(", ")", "archive", ".", "addFile", "(", "fileNa...
Creates Combine Archive containing the given file. :param fileName: file to include in the archive :return: None
[ "Creates", "Combine", "Archive", "containing", "the", "given", "file", "." ]
d7c11a90129dedbcc8bdba8d204be03f1dd0c3e4
https://github.com/sbmlteam/libCombine/blob/d7c11a90129dedbcc8bdba8d204be03f1dd0c3e4/examples/python/createArchiveExample.py#L11-L57
train
Creates Combine Archive containing the given file.
theno/fabsetup
fabfile-dev.py
clean
def clean(): '''Delete temporary files not under version control.''' basedir = dirname(__file__) print(cyan('delete temp files and dirs for packaging')) local(flo( 'rm -rf ' '{basedir}/.eggs/ ' '{basedir}/fabsetup.egg-info/ ' '{basedir}/dist ' '{basedir}/REA...
python
def clean(): '''Delete temporary files not under version control.''' basedir = dirname(__file__) print(cyan('delete temp files and dirs for packaging')) local(flo( 'rm -rf ' '{basedir}/.eggs/ ' '{basedir}/fabsetup.egg-info/ ' '{basedir}/dist ' '{basedir}/REA...
[ "def", "clean", "(", ")", ":", "basedir", "=", "dirname", "(", "__file__", ")", "print", "(", "cyan", "(", "'delete temp files and dirs for packaging'", ")", ")", "local", "(", "flo", "(", "'rm -rf '", "'{basedir}/.eggs/ '", "'{basedir}/fabsetup.egg-info/ '", "'{...
Delete temporary files not under version control.
[ "Delete", "temporary", "files", "not", "under", "version", "control", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabfile-dev.py#L43-L72
train
Delete temporary files not under version control.
theno/fabsetup
fabfile-dev.py
pypi
def pypi(): '''Build package and upload to pypi.''' if not query_yes_no('version updated in ' '`fabsetup/_version.py`?'): print('abort') else: print(cyan('\n## clean-up\n')) execute(clean) basedir = dirname(__file__) # latest_pythons = _deter...
python
def pypi(): '''Build package and upload to pypi.''' if not query_yes_no('version updated in ' '`fabsetup/_version.py`?'): print('abort') else: print(cyan('\n## clean-up\n')) execute(clean) basedir = dirname(__file__) # latest_pythons = _deter...
[ "def", "pypi", "(", ")", ":", "if", "not", "query_yes_no", "(", "'version updated in '", "'`fabsetup/_version.py`?'", ")", ":", "print", "(", "'abort'", ")", "else", ":", "print", "(", "cyan", "(", "'\\n## clean-up\\n'", ")", ")", "execute", "(", "clean", ")...
Build package and upload to pypi.
[ "Build", "package", "and", "upload", "to", "pypi", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabfile-dev.py#L76-L97
train
Build and upload to pypi.
yahoo/serviceping
serviceping/serviceping.py
calc_deviation
def calc_deviation(values, average): """ Calculate the standard deviation of a list of values @param values: list(float) @param average: @return: """ size = len(values) if size < 2: return 0 calc_sum = 0.0 for number in range(0, size): calc_sum += math.sqrt((valu...
python
def calc_deviation(values, average): """ Calculate the standard deviation of a list of values @param values: list(float) @param average: @return: """ size = len(values) if size < 2: return 0 calc_sum = 0.0 for number in range(0, size): calc_sum += math.sqrt((valu...
[ "def", "calc_deviation", "(", "values", ",", "average", ")", ":", "size", "=", "len", "(", "values", ")", "if", "size", "<", "2", ":", "return", "0", "calc_sum", "=", "0.0", "for", "number", "in", "range", "(", "0", ",", "size", ")", ":", "calc_sum...
Calculate the standard deviation of a list of values @param values: list(float) @param average: @return:
[ "Calculate", "the", "standard", "deviation", "of", "a", "list", "of", "values" ]
1f9df5ee5b3cba466426b1164262278472ba4977
https://github.com/yahoo/serviceping/blob/1f9df5ee5b3cba466426b1164262278472ba4977/serviceping/serviceping.py#L106-L120
train
Calculate the standard deviation of a list of values
yahoo/serviceping
serviceping/serviceping.py
StatsList.append
def append(self, value): """ Append a value to the stats list Parameters ---------- value : float The value to add """ self.count += 1 if self.count == 1: self.old_m = self.new_m = value self.old_s = 0 else: ...
python
def append(self, value): """ Append a value to the stats list Parameters ---------- value : float The value to add """ self.count += 1 if self.count == 1: self.old_m = self.new_m = value self.old_s = 0 else: ...
[ "def", "append", "(", "self", ",", "value", ")", ":", "self", ".", "count", "+=", "1", "if", "self", ".", "count", "==", "1", ":", "self", ".", "old_m", "=", "self", ".", "new_m", "=", "value", "self", ".", "old_s", "=", "0", "else", ":", "self...
Append a value to the stats list Parameters ---------- value : float The value to add
[ "Append", "a", "value", "to", "the", "stats", "list" ]
1f9df5ee5b3cba466426b1164262278472ba4977
https://github.com/yahoo/serviceping/blob/1f9df5ee5b3cba466426b1164262278472ba4977/serviceping/serviceping.py#L35-L54
train
Append a value to the stats list.
bionikspoon/pureyaml
docs/github_docs.py
pipeline
def pipeline(steps, initial=None): """ Chain results from a list of functions. Inverted reduce. :param (function) steps: List of function callbacks :param initial: Starting value for pipeline. """ def apply(result, step): return step(result) return reduce(apply, steps, initial)
python
def pipeline(steps, initial=None): """ Chain results from a list of functions. Inverted reduce. :param (function) steps: List of function callbacks :param initial: Starting value for pipeline. """ def apply(result, step): return step(result) return reduce(apply, steps, initial)
[ "def", "pipeline", "(", "steps", ",", "initial", "=", "None", ")", ":", "def", "apply", "(", "result", ",", "step", ")", ":", "return", "step", "(", "result", ")", "return", "reduce", "(", "apply", ",", "steps", ",", "initial", ")" ]
Chain results from a list of functions. Inverted reduce. :param (function) steps: List of function callbacks :param initial: Starting value for pipeline.
[ "Chain", "results", "from", "a", "list", "of", "functions", ".", "Inverted", "reduce", "." ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/docs/github_docs.py#L186-L197
train
Inverted reduce.
jaraco/jaraco.windows
jaraco/windows/environ.py
enver
def enver(*args): """ %prog [<name>=[value]] To show all environment variables, call with no parameters: %prog To Add/Modify/Delete environment variable: %prog <name>=[value] If <name> is PATH or PATHEXT, %prog will by default append the value using a semicolon as a separator. Use -r to disable this behavio...
python
def enver(*args): """ %prog [<name>=[value]] To show all environment variables, call with no parameters: %prog To Add/Modify/Delete environment variable: %prog <name>=[value] If <name> is PATH or PATHEXT, %prog will by default append the value using a semicolon as a separator. Use -r to disable this behavio...
[ "def", "enver", "(", "*", "args", ")", ":", "from", "optparse", "import", "OptionParser", "parser", "=", "OptionParser", "(", "usage", "=", "trim", "(", "enver", ".", "__doc__", ")", ")", "parser", ".", "add_option", "(", "'-U'", ",", "'--user-environment'...
%prog [<name>=[value]] To show all environment variables, call with no parameters: %prog To Add/Modify/Delete environment variable: %prog <name>=[value] If <name> is PATH or PATHEXT, %prog will by default append the value using a semicolon as a separator. Use -r to disable this behavior or -a to force it for...
[ "%prog", "[", "<name", ">", "=", "[", "value", "]]" ]
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/environ.py#L172-L253
train
Help for the enver command line interface.
jaraco/jaraco.windows
jaraco/windows/environ.py
RegisteredEnvironment.add
def add(class_, name, value, sep=';'): """ Add a value to a delimited variable, but only when the value isn't already present. """ values = class_.get_values_list(name, sep) if value in values: return new_value = sep.join(values + [value]) winreg.SetValueEx( class_.key, name, 0, winreg.REG_EXPAND_...
python
def add(class_, name, value, sep=';'): """ Add a value to a delimited variable, but only when the value isn't already present. """ values = class_.get_values_list(name, sep) if value in values: return new_value = sep.join(values + [value]) winreg.SetValueEx( class_.key, name, 0, winreg.REG_EXPAND_...
[ "def", "add", "(", "class_", ",", "name", ",", "value", ",", "sep", "=", "';'", ")", ":", "values", "=", "class_", ".", "get_values_list", "(", "name", ",", "sep", ")", "if", "value", "in", "values", ":", "return", "new_value", "=", "sep", ".", "jo...
Add a value to a delimited variable, but only when the value isn't already present.
[ "Add", "a", "value", "to", "a", "delimited", "variable", "but", "only", "when", "the", "value", "isn", "t", "already", "present", "." ]
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/environ.py#L84-L95
train
Add a value to a delimited variable but only when the value isn t already present.
jaraco/jaraco.windows
jaraco/windows/environ.py
RegisteredEnvironment.notify
def notify(class_): """ Notify other windows that the environment has changed (following http://support.microsoft.com/kb/104011). """ # TODO: Implement Microsoft UIPI (User Interface Privilege Isolation) to # elevate privilege to system level so the system gets this notification # for now, this must be r...
python
def notify(class_): """ Notify other windows that the environment has changed (following http://support.microsoft.com/kb/104011). """ # TODO: Implement Microsoft UIPI (User Interface Privilege Isolation) to # elevate privilege to system level so the system gets this notification # for now, this must be r...
[ "def", "notify", "(", "class_", ")", ":", "# TODO: Implement Microsoft UIPI (User Interface Privilege Isolation) to", "# elevate privilege to system level so the system gets this notification", "# for now, this must be run as admin to work as expected", "return_val", "=", "ctypes", ".", "...
Notify other windows that the environment has changed (following http://support.microsoft.com/kb/104011).
[ "Notify", "other", "windows", "that", "the", "environment", "has", "changed", "(", "following", "http", ":", "//", "support", ".", "microsoft", ".", "com", "/", "kb", "/", "104011", ")", "." ]
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/environ.py#L128-L146
train
Notify other windows that the environment has changed.
jaraco/jaraco.windows
jaraco/windows/timezone.py
Info.current
def current(class_): "Windows Platform SDK GetTimeZoneInformation" tzi = class_() kernel32 = ctypes.windll.kernel32 getter = kernel32.GetTimeZoneInformation getter = getattr(kernel32, 'GetDynamicTimeZoneInformation', getter) code = getter(ctypes.byref(tzi)) return code, tzi
python
def current(class_): "Windows Platform SDK GetTimeZoneInformation" tzi = class_() kernel32 = ctypes.windll.kernel32 getter = kernel32.GetTimeZoneInformation getter = getattr(kernel32, 'GetDynamicTimeZoneInformation', getter) code = getter(ctypes.byref(tzi)) return code, tzi
[ "def", "current", "(", "class_", ")", ":", "tzi", "=", "class_", "(", ")", "kernel32", "=", "ctypes", ".", "windll", ".", "kernel32", "getter", "=", "kernel32", ".", "GetTimeZoneInformation", "getter", "=", "getattr", "(", "kernel32", ",", "'GetDynamicTimeZo...
Windows Platform SDK GetTimeZoneInformation
[ "Windows", "Platform", "SDK", "GetTimeZoneInformation" ]
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/timezone.py#L168-L175
train
Windows Platform SDK GetTimeZoneInformation
jaraco/jaraco.windows
jaraco/windows/timezone.py
Info.dynamic_info
def dynamic_info(self): "Return a map that for a given year will return the correct Info" if self.key_name: dyn_key = self.get_key().subkey('Dynamic DST') del dyn_key['FirstEntry'] del dyn_key['LastEntry'] years = map(int, dyn_key.keys()) values = map(Info, dyn_key.values()) # create a range mappi...
python
def dynamic_info(self): "Return a map that for a given year will return the correct Info" if self.key_name: dyn_key = self.get_key().subkey('Dynamic DST') del dyn_key['FirstEntry'] del dyn_key['LastEntry'] years = map(int, dyn_key.keys()) values = map(Info, dyn_key.values()) # create a range mappi...
[ "def", "dynamic_info", "(", "self", ")", ":", "if", "self", ".", "key_name", ":", "dyn_key", "=", "self", ".", "get_key", "(", ")", ".", "subkey", "(", "'Dynamic DST'", ")", "del", "dyn_key", "[", "'FirstEntry'", "]", "del", "dyn_key", "[", "'LastEntry'"...
Return a map that for a given year will return the correct Info
[ "Return", "a", "map", "that", "for", "a", "given", "year", "will", "return", "the", "correct", "Info" ]
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/timezone.py#L198-L210
train
Return a map that for a given year will return the correct Info
jaraco/jaraco.windows
jaraco/windows/timezone.py
Info._locate_day
def _locate_day(year, cutoff): """ Takes a SYSTEMTIME object, such as retrieved from a TIME_ZONE_INFORMATION structure or call to GetTimeZoneInformation and interprets it based on the given year to identify the actual day. This method is necessary because the SYSTEMTIME structure refers to a day by its ...
python
def _locate_day(year, cutoff): """ Takes a SYSTEMTIME object, such as retrieved from a TIME_ZONE_INFORMATION structure or call to GetTimeZoneInformation and interprets it based on the given year to identify the actual day. This method is necessary because the SYSTEMTIME structure refers to a day by its ...
[ "def", "_locate_day", "(", "year", ",", "cutoff", ")", ":", "# MS stores Sunday as 0, Python datetime stores Monday as zero", "target_weekday", "=", "(", "cutoff", ".", "day_of_week", "+", "6", ")", "%", "7", "# For SYSTEMTIMEs relating to time zone inforamtion, cutoff.day", ...
Takes a SYSTEMTIME object, such as retrieved from a TIME_ZONE_INFORMATION structure or call to GetTimeZoneInformation and interprets it based on the given year to identify the actual day. This method is necessary because the SYSTEMTIME structure refers to a day by its day of the week and week of the month ...
[ "Takes", "a", "SYSTEMTIME", "object", "such", "as", "retrieved", "from", "a", "TIME_ZONE_INFORMATION", "structure", "or", "call", "to", "GetTimeZoneInformation", "and", "interprets", "it", "based", "on", "the", "given", "year", "to", "identify", "the", "actual", ...
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/timezone.py#L213-L254
train
Locate the actual day of the given date.
pmac/django-redirect-urls
redirect_urls/utils.py
no_redirect
def no_redirect(pattern, locale_prefix=True, re_flags=None): """ Return a url matcher that will stop the redirect middleware and force Django to continue with regular URL matching. For use when you have a URL pattern you want to serve, and a broad catch-all pattern you want to redirect. :param patte...
python
def no_redirect(pattern, locale_prefix=True, re_flags=None): """ Return a url matcher that will stop the redirect middleware and force Django to continue with regular URL matching. For use when you have a URL pattern you want to serve, and a broad catch-all pattern you want to redirect. :param patte...
[ "def", "no_redirect", "(", "pattern", ",", "locale_prefix", "=", "True", ",", "re_flags", "=", "None", ")", ":", "if", "locale_prefix", ":", "pattern", "=", "pattern", ".", "lstrip", "(", "'^/'", ")", "pattern", "=", "LOCALE_RE", "+", "pattern", "if", "r...
Return a url matcher that will stop the redirect middleware and force Django to continue with regular URL matching. For use when you have a URL pattern you want to serve, and a broad catch-all pattern you want to redirect. :param pattern: regex URL patter that will definitely not redirect. :param locale...
[ "Return", "a", "url", "matcher", "that", "will", "stop", "the", "redirect", "middleware", "and", "force", "Django", "to", "continue", "with", "regular", "URL", "matching", ".", "For", "use", "when", "you", "have", "a", "URL", "pattern", "you", "want", "to"...
21495194b0b2a2bdd1013e13ec0d54d34dd7f750
https://github.com/pmac/django-redirect-urls/blob/21495194b0b2a2bdd1013e13ec0d54d34dd7f750/redirect_urls/utils.py#L104-L125
train
Returns a url matcher that will not redirect to the given pattern.
pmac/django-redirect-urls
redirect_urls/utils.py
redirect
def redirect(pattern, to, permanent=True, locale_prefix=True, anchor=None, name=None, query=None, vary=None, cache_timeout=12, decorators=None, re_flags=None, to_args=None, to_kwargs=None, prepend_locale=True, merge_query=False): """ Return a url matcher suited for urlpatterns. pa...
python
def redirect(pattern, to, permanent=True, locale_prefix=True, anchor=None, name=None, query=None, vary=None, cache_timeout=12, decorators=None, re_flags=None, to_args=None, to_kwargs=None, prepend_locale=True, merge_query=False): """ Return a url matcher suited for urlpatterns. pa...
[ "def", "redirect", "(", "pattern", ",", "to", ",", "permanent", "=", "True", ",", "locale_prefix", "=", "True", ",", "anchor", "=", "None", ",", "name", "=", "None", ",", "query", "=", "None", ",", "vary", "=", "None", ",", "cache_timeout", "=", "12"...
Return a url matcher suited for urlpatterns. pattern: the regex against which to match the requested URL. to: either a url name that `reverse` will find, a url that will simply be returned, or a function that will be given the request and url captures, and return the destination. permanent:...
[ "Return", "a", "url", "matcher", "suited", "for", "urlpatterns", "." ]
21495194b0b2a2bdd1013e13ec0d54d34dd7f750
https://github.com/pmac/django-redirect-urls/blob/21495194b0b2a2bdd1013e13ec0d54d34dd7f750/redirect_urls/utils.py#L128-L257
train
Returns a url matcher suited for redirecting the requested URL to another URL.
jaraco/jaraco.windows
bugs/find_target_path.py
findpath
def findpath(target, start=os.path.curdir): r""" Find a path from start to target where target is relative to start. >>> orig_wd = os.getcwd() >>> os.chdir('c:\\windows') # so we know what the working directory is >>> findpath('d:\\') 'd:\\' >>> findpath('d:\\', 'c:\\windows') 'd:\\' >>> find...
python
def findpath(target, start=os.path.curdir): r""" Find a path from start to target where target is relative to start. >>> orig_wd = os.getcwd() >>> os.chdir('c:\\windows') # so we know what the working directory is >>> findpath('d:\\') 'd:\\' >>> findpath('d:\\', 'c:\\windows') 'd:\\' >>> find...
[ "def", "findpath", "(", "target", ",", "start", "=", "os", ".", "path", ".", "curdir", ")", ":", "return", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "start", ",", "target", ")", ")" ]
r""" Find a path from start to target where target is relative to start. >>> orig_wd = os.getcwd() >>> os.chdir('c:\\windows') # so we know what the working directory is >>> findpath('d:\\') 'd:\\' >>> findpath('d:\\', 'c:\\windows') 'd:\\' >>> findpath('\\bar', 'd:\\') 'd:\\bar' >>> find...
[ "r", "Find", "a", "path", "from", "start", "to", "target", "where", "target", "is", "relative", "to", "start", ".", ">>>", "orig_wd", "=", "os", ".", "getcwd", "()", ">>>", "os", ".", "chdir", "(", "c", ":", "\\\\", "windows", ")", "#", "so", "we",...
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/bugs/find_target_path.py#L3-L53
train
Find a path relative to target.
jaraco/jaraco.windows
jaraco/windows/inet.py
AllocatedTable.__get_table_size
def __get_table_size(self): """ Retrieve the size of the buffer needed by calling the method with a null pointer and length of zero. This should trigger an insufficient buffer error and return the size needed for the buffer. """ length = ctypes.wintypes.DWORD() res = self.method(None, length, False) i...
python
def __get_table_size(self): """ Retrieve the size of the buffer needed by calling the method with a null pointer and length of zero. This should trigger an insufficient buffer error and return the size needed for the buffer. """ length = ctypes.wintypes.DWORD() res = self.method(None, length, False) i...
[ "def", "__get_table_size", "(", "self", ")", ":", "length", "=", "ctypes", ".", "wintypes", ".", "DWORD", "(", ")", "res", "=", "self", ".", "method", "(", "None", ",", "length", ",", "False", ")", "if", "res", "!=", "errors", ".", "ERROR_INSUFFICIENT_...
Retrieve the size of the buffer needed by calling the method with a null pointer and length of zero. This should trigger an insufficient buffer error and return the size needed for the buffer.
[ "Retrieve", "the", "size", "of", "the", "buffer", "needed", "by", "calling", "the", "method", "with", "a", "null", "pointer", "and", "length", "of", "zero", ".", "This", "should", "trigger", "an", "insufficient", "buffer", "error", "and", "return", "the", ...
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/inet.py#L49-L60
train
Get the size of the table.
jaraco/jaraco.windows
jaraco/windows/inet.py
AllocatedTable.get_table
def get_table(self): """ Get the table """ buffer_length = self.__get_table_size() returned_buffer_length = ctypes.wintypes.DWORD(buffer_length) buffer = ctypes.create_string_buffer(buffer_length) pointer_type = ctypes.POINTER(self.structure) table_p = ctypes.cast(buffer, pointer_type) res = self.meth...
python
def get_table(self): """ Get the table """ buffer_length = self.__get_table_size() returned_buffer_length = ctypes.wintypes.DWORD(buffer_length) buffer = ctypes.create_string_buffer(buffer_length) pointer_type = ctypes.POINTER(self.structure) table_p = ctypes.cast(buffer, pointer_type) res = self.meth...
[ "def", "get_table", "(", "self", ")", ":", "buffer_length", "=", "self", ".", "__get_table_size", "(", ")", "returned_buffer_length", "=", "ctypes", ".", "wintypes", ".", "DWORD", "(", "buffer_length", ")", "buffer", "=", "ctypes", ".", "create_string_buffer", ...
Get the table
[ "Get", "the", "table" ]
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/inet.py#L62-L74
train
Get the table of the current structure.
jaraco/jaraco.windows
jaraco/windows/inet.py
AllocatedTable.entries
def entries(self): """ Using the table structure, return the array of entries based on the table size. """ table = self.get_table() entries_array = self.row_structure * table.num_entries pointer_type = ctypes.POINTER(entries_array) return ctypes.cast(table.entries, pointer_type).contents
python
def entries(self): """ Using the table structure, return the array of entries based on the table size. """ table = self.get_table() entries_array = self.row_structure * table.num_entries pointer_type = ctypes.POINTER(entries_array) return ctypes.cast(table.entries, pointer_type).contents
[ "def", "entries", "(", "self", ")", ":", "table", "=", "self", ".", "get_table", "(", ")", "entries_array", "=", "self", ".", "row_structure", "*", "table", ".", "num_entries", "pointer_type", "=", "ctypes", ".", "POINTER", "(", "entries_array", ")", "retu...
Using the table structure, return the array of entries based on the table size.
[ "Using", "the", "table", "structure", "return", "the", "array", "of", "entries", "based", "on", "the", "table", "size", "." ]
51811efed50b46ad08daa25408a1cc806bc8d519
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/inet.py#L77-L85
train
Returns the array of entries based on the table size.
theno/fabsetup
fabsetup/fabfile/setup/service/__init__.py
owncloud
def owncloud(): '''Set up owncloud. Package 'owncloud' pulls package 'mysql' which asks for a password. ''' hostname = re.sub(r'^[^@]+@', '', env.host) # without username if any sitename = query_input( question='\nEnter site-name of Your Owncloud web service', ...
python
def owncloud(): '''Set up owncloud. Package 'owncloud' pulls package 'mysql' which asks for a password. ''' hostname = re.sub(r'^[^@]+@', '', env.host) # without username if any sitename = query_input( question='\nEnter site-name of Your Owncloud web service', ...
[ "def", "owncloud", "(", ")", ":", "hostname", "=", "re", ".", "sub", "(", "r'^[^@]+@'", ",", "''", ",", "env", ".", "host", ")", "# without username if any", "sitename", "=", "query_input", "(", "question", "=", "'\\nEnter site-name of Your Owncloud web service'",...
Set up owncloud. Package 'owncloud' pulls package 'mysql' which asks for a password.
[ "Set", "up", "owncloud", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/service/__init__.py#L23-L98
train
Set up owncloud.
theno/fabsetup
fabsetup/fabfile/setup/service/__init__.py
fdroid
def fdroid(): '''Set up an F-Droid App Repo. More infos: * https://f-droid.org/wiki/page/Setup_an_FDroid_App_Repo * https://f-droid.org/wiki/page/Installing_the_Server_and_Repo_Tools ''' hostname = re.sub(r'^[^@]+@', '', env.host) # without username if any sitename = query_input( ...
python
def fdroid(): '''Set up an F-Droid App Repo. More infos: * https://f-droid.org/wiki/page/Setup_an_FDroid_App_Repo * https://f-droid.org/wiki/page/Installing_the_Server_and_Repo_Tools ''' hostname = re.sub(r'^[^@]+@', '', env.host) # without username if any sitename = query_input( ...
[ "def", "fdroid", "(", ")", ":", "hostname", "=", "re", ".", "sub", "(", "r'^[^@]+@'", ",", "''", ",", "env", ".", "host", ")", "# without username if any", "sitename", "=", "query_input", "(", "question", "=", "'\\nEnter site-name of Your F-Droid web service'", ...
Set up an F-Droid App Repo. More infos: * https://f-droid.org/wiki/page/Setup_an_FDroid_App_Repo * https://f-droid.org/wiki/page/Installing_the_Server_and_Repo_Tools
[ "Set", "up", "an", "F", "-", "Droid", "App", "Repo", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/service/__init__.py#L104-L187
train
Setup an F - Droid App Repo.
theno/fabsetup
fabsetup/fabfile/setup/service/__init__.py
vnc_raspi_osmc
def vnc_raspi_osmc(): '''Install and configure dispmanx_vnc server on osmc (raspberry pi). More Infos: * https://github.com/patrikolausson/dispmanx_vnc * https://discourse.osmc.tv/t/howto-install-a-vnc-server-on-the-raspberry-pi/1517 * tightvnc: * http://raspberry.tips/raspberrypi-einstei...
python
def vnc_raspi_osmc(): '''Install and configure dispmanx_vnc server on osmc (raspberry pi). More Infos: * https://github.com/patrikolausson/dispmanx_vnc * https://discourse.osmc.tv/t/howto-install-a-vnc-server-on-the-raspberry-pi/1517 * tightvnc: * http://raspberry.tips/raspberrypi-einstei...
[ "def", "vnc_raspi_osmc", "(", ")", ":", "print", "(", "blue", "(", "'Install dependencies'", ")", ")", "install_packages", "(", "[", "'git'", ",", "'build-essential'", ",", "'rbp-userland-dev-osmc'", ",", "'libvncserver-dev'", ",", "'libconfig++-dev'", ",", "]", "...
Install and configure dispmanx_vnc server on osmc (raspberry pi). More Infos: * https://github.com/patrikolausson/dispmanx_vnc * https://discourse.osmc.tv/t/howto-install-a-vnc-server-on-the-raspberry-pi/1517 * tightvnc: * http://raspberry.tips/raspberrypi-einsteiger/raspberry-pi-einsteiger-g...
[ "Install", "and", "configure", "dispmanx_vnc", "server", "on", "osmc", "(", "raspberry", "pi", ")", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/service/__init__.py#L191-L233
train
Install and configure the dispmanx_vnc server on the OSMC raspberry pi.
theno/fabsetup
fabsetup/fabfile/setup/service/__init__.py
lms
def lms(): '''Install and start a Logitech Media Server (lms). More infos: * http://wiki.slimdevices.com/index.php/Logitech_Media_Server * http://wiki.slimdevices.com/index.php/DebianPackage * http://www.mysqueezebox.com/download * XSqueeze on Kodi: * http://kodi.wiki/view/Add-on:XSq...
python
def lms(): '''Install and start a Logitech Media Server (lms). More infos: * http://wiki.slimdevices.com/index.php/Logitech_Media_Server * http://wiki.slimdevices.com/index.php/DebianPackage * http://www.mysqueezebox.com/download * XSqueeze on Kodi: * http://kodi.wiki/view/Add-on:XSq...
[ "def", "lms", "(", ")", ":", "# cf. http://wiki.slimdevices.com/index.php/DebianPackage#installing_7.9.0", "cmds", "=", "'''\\\nurl=\"http://www.mysqueezebox.com/update/?version=7.9.0&revision=1&geturl=1&os=deb\"\nlatest_lms=$(wget -q -O - \"$url\")\nmkdir -p ~/.logitech_media_server_sources\ncd ~/....
Install and start a Logitech Media Server (lms). More infos: * http://wiki.slimdevices.com/index.php/Logitech_Media_Server * http://wiki.slimdevices.com/index.php/DebianPackage * http://www.mysqueezebox.com/download * XSqueeze on Kodi: * http://kodi.wiki/view/Add-on:XSqueeze * htt...
[ "Install", "and", "start", "a", "Logitech", "Media", "Server", "(", "lms", ")", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/service/__init__.py#L237-L268
train
Install and start a Logitech Media Server.
theno/fabsetup
fabsetup/fabfile/setup/service/__init__.py
samba
def samba(): '''Install smb server samba and create a share (common read-write-access). More infos: * https://wiki.ubuntuusers.de/Samba%20Server/ ''' username = env.user install_packages(['samba']) run(flo('sudo smbpasswd -a {username}')) path = '$HOME/shared' sharename = 'shared'...
python
def samba(): '''Install smb server samba and create a share (common read-write-access). More infos: * https://wiki.ubuntuusers.de/Samba%20Server/ ''' username = env.user install_packages(['samba']) run(flo('sudo smbpasswd -a {username}')) path = '$HOME/shared' sharename = 'shared'...
[ "def", "samba", "(", ")", ":", "username", "=", "env", ".", "user", "install_packages", "(", "[", "'samba'", "]", ")", "run", "(", "flo", "(", "'sudo smbpasswd -a {username}'", ")", ")", "path", "=", "'$HOME/shared'", "sharename", "=", "'shared'", "comment",...
Install smb server samba and create a share (common read-write-access). More infos: * https://wiki.ubuntuusers.de/Samba%20Server/
[ "Install", "smb", "server", "samba", "and", "create", "a", "share", "(", "common", "read", "-", "write", "-", "access", ")", "." ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/service/__init__.py#L273-L291
train
Install smb server samba and create a shared file
bionikspoon/pureyaml
pureyaml/grammar/productions.py
YAMLProductions.p_scalar__doublequote
def p_scalar__doublequote(self, p): """ scalar : DOUBLEQUOTE_START SCALAR DOUBLEQUOTE_END """ scalar = re.sub('\n\s+', ' ', str(p[2])) p[0] = Str(scalar.replace('\\"', '"'))
python
def p_scalar__doublequote(self, p): """ scalar : DOUBLEQUOTE_START SCALAR DOUBLEQUOTE_END """ scalar = re.sub('\n\s+', ' ', str(p[2])) p[0] = Str(scalar.replace('\\"', '"'))
[ "def", "p_scalar__doublequote", "(", "self", ",", "p", ")", ":", "scalar", "=", "re", ".", "sub", "(", "'\\n\\s+'", ",", "' '", ",", "str", "(", "p", "[", "2", "]", ")", ")", "p", "[", "0", "]", "=", "Str", "(", "scalar", ".", "replace", "(", ...
scalar : DOUBLEQUOTE_START SCALAR DOUBLEQUOTE_END
[ "scalar", ":", "DOUBLEQUOTE_START", "SCALAR", "DOUBLEQUOTE_END" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/grammar/productions.py#L202-L208
train
doublequote scalar
bionikspoon/pureyaml
pureyaml/grammar/productions.py
YAMLProductions.p_scalar__literal
def p_scalar__literal(self, p): """ scalar : B_LITERAL_START scalar_group B_LITERAL_END """ scalar_group = ''.join(p[2]) p[0] = ScalarDispatch('%s\n' % dedent(scalar_group).replace('\n\n\n', '\n'), cast='str')
python
def p_scalar__literal(self, p): """ scalar : B_LITERAL_START scalar_group B_LITERAL_END """ scalar_group = ''.join(p[2]) p[0] = ScalarDispatch('%s\n' % dedent(scalar_group).replace('\n\n\n', '\n'), cast='str')
[ "def", "p_scalar__literal", "(", "self", ",", "p", ")", ":", "scalar_group", "=", "''", ".", "join", "(", "p", "[", "2", "]", ")", "p", "[", "0", "]", "=", "ScalarDispatch", "(", "'%s\\n'", "%", "dedent", "(", "scalar_group", ")", ".", "replace", "...
scalar : B_LITERAL_START scalar_group B_LITERAL_END
[ "scalar", ":", "B_LITERAL_START", "scalar_group", "B_LITERAL_END" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/grammar/productions.py#L240-L245
train
handle scalar literal
bionikspoon/pureyaml
pureyaml/grammar/productions.py
YAMLProductions.p_scalar__folded
def p_scalar__folded(self, p): """ scalar : B_FOLD_START scalar_group B_FOLD_END """ scalar_group = ''.join(p[2]) folded_scalar = fold(dedent(scalar_group)).rstrip() p[0] = ScalarDispatch('%s\n' % folded_scalar, cast='str')
python
def p_scalar__folded(self, p): """ scalar : B_FOLD_START scalar_group B_FOLD_END """ scalar_group = ''.join(p[2]) folded_scalar = fold(dedent(scalar_group)).rstrip() p[0] = ScalarDispatch('%s\n' % folded_scalar, cast='str')
[ "def", "p_scalar__folded", "(", "self", ",", "p", ")", ":", "scalar_group", "=", "''", ".", "join", "(", "p", "[", "2", "]", ")", "folded_scalar", "=", "fold", "(", "dedent", "(", "scalar_group", ")", ")", ".", "rstrip", "(", ")", "p", "[", "0", ...
scalar : B_FOLD_START scalar_group B_FOLD_END
[ "scalar", ":", "B_FOLD_START", "scalar_group", "B_FOLD_END" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/grammar/productions.py#L248-L254
train
Folded version of the scalar.
bionikspoon/pureyaml
pureyaml/grammar/productions.py
YAMLProductions.p_scalar__indented_flow
def p_scalar__indented_flow(self, p): """ scalar : INDENT scalar_group DEDENT """ scalar_group = '\n'.join(p[2]) folded_scalar = fold(dedent(scalar_group)) p[0] = ScalarDispatch(folded_scalar, cast='str')
python
def p_scalar__indented_flow(self, p): """ scalar : INDENT scalar_group DEDENT """ scalar_group = '\n'.join(p[2]) folded_scalar = fold(dedent(scalar_group)) p[0] = ScalarDispatch(folded_scalar, cast='str')
[ "def", "p_scalar__indented_flow", "(", "self", ",", "p", ")", ":", "scalar_group", "=", "'\\n'", ".", "join", "(", "p", "[", "2", "]", ")", "folded_scalar", "=", "fold", "(", "dedent", "(", "scalar_group", ")", ")", "p", "[", "0", "]", "=", "ScalarDi...
scalar : INDENT scalar_group DEDENT
[ "scalar", ":", "INDENT", "scalar_group", "DEDENT" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/grammar/productions.py#L257-L263
train
INDENT scalar_group DEDENTscalar_group
bionikspoon/pureyaml
pureyaml/grammar/productions.py
YAMLProductions.p_scalar__string_indented_multi_line
def p_scalar__string_indented_multi_line(self, p): """ scalar : scalar INDENT SCALAR DEDENT """ scalar = '\n'.join([p[1].value, p[3]]) p[0] = ScalarDispatch(fold(scalar), cast='str')
python
def p_scalar__string_indented_multi_line(self, p): """ scalar : scalar INDENT SCALAR DEDENT """ scalar = '\n'.join([p[1].value, p[3]]) p[0] = ScalarDispatch(fold(scalar), cast='str')
[ "def", "p_scalar__string_indented_multi_line", "(", "self", ",", "p", ")", ":", "scalar", "=", "'\\n'", ".", "join", "(", "[", "p", "[", "1", "]", ".", "value", ",", "p", "[", "3", "]", "]", ")", "p", "[", "0", "]", "=", "ScalarDispatch", "(", "f...
scalar : scalar INDENT SCALAR DEDENT
[ "scalar", ":", "scalar", "INDENT", "SCALAR", "DEDENT" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/grammar/productions.py#L266-L272
train
scalar INDENT SCALAR DEDENTS scalar
bionikspoon/pureyaml
pureyaml/grammar/productions.py
YAMLProductions.p_scalar_group
def p_scalar_group(self, p): """ scalar_group : SCALAR | scalar_group SCALAR """ if len(p) == 2: p[0] = (str(p[1]),) if len(p) == 3: p[0] = p[1] + (str(p[2]),) if len(p) == 4: p[0] = p[1] + (str(p[3]),)
python
def p_scalar_group(self, p): """ scalar_group : SCALAR | scalar_group SCALAR """ if len(p) == 2: p[0] = (str(p[1]),) if len(p) == 3: p[0] = p[1] + (str(p[2]),) if len(p) == 4: p[0] = p[1] + (str(p[3]),)
[ "def", "p_scalar_group", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "(", "str", "(", "p", "[", "1", "]", ")", ",", ")", "if", "len", "(", "p", ")", "==", "3", ":", "p", "[", "...
scalar_group : SCALAR | scalar_group SCALAR
[ "scalar_group", ":", "SCALAR", "|", "scalar_group", "SCALAR" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/grammar/productions.py#L275-L287
train
SCALAR is a list of strings.
bionikspoon/pureyaml
docs/source/conf.py
doctree_read_handler
def doctree_read_handler(app, doctree): """ Add 'orphan' to metadata for partials :type app: sphinx.application.Sphinx :type doctree: docutils.nodes.document """ # noinspection PyProtectedMember docname = sys._getframe(2).f_locals['docname'] if docname.startswith('_partial'): ap...
python
def doctree_read_handler(app, doctree): """ Add 'orphan' to metadata for partials :type app: sphinx.application.Sphinx :type doctree: docutils.nodes.document """ # noinspection PyProtectedMember docname = sys._getframe(2).f_locals['docname'] if docname.startswith('_partial'): ap...
[ "def", "doctree_read_handler", "(", "app", ",", "doctree", ")", ":", "# noinspection PyProtectedMember", "docname", "=", "sys", ".", "_getframe", "(", "2", ")", ".", "f_locals", "[", "'docname'", "]", "if", "docname", ".", "startswith", "(", "'_partial'", ")",...
Add 'orphan' to metadata for partials :type app: sphinx.application.Sphinx :type doctree: docutils.nodes.document
[ "Add", "orphan", "to", "metadata", "for", "partials" ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/docs/source/conf.py#L26-L36
train
Handle doctree read events.
bionikspoon/pureyaml
docs/source/conf.py
autodoc_skip_member_handler
def autodoc_skip_member_handler(app, what, name, obj, skip, options): """ Skip un parseable functions. :type app: sphinx.application.Sphinx :param str what: the type of the object which the docstring belongs to (one of "module", "class", "exception", "function", "method", "attribute") :para...
python
def autodoc_skip_member_handler(app, what, name, obj, skip, options): """ Skip un parseable functions. :type app: sphinx.application.Sphinx :param str what: the type of the object which the docstring belongs to (one of "module", "class", "exception", "function", "method", "attribute") :para...
[ "def", "autodoc_skip_member_handler", "(", "app", ",", "what", ",", "name", ",", "obj", ",", "skip", ",", "options", ")", ":", "if", "'YAMLTokens'", "in", "name", ":", "return", "True", "return", "False" ]
Skip un parseable functions. :type app: sphinx.application.Sphinx :param str what: the type of the object which the docstring belongs to (one of "module", "class", "exception", "function", "method", "attribute") :param str name: the fully qualified name of the object :param type obj: the object...
[ "Skip", "un", "parseable", "functions", "." ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/docs/source/conf.py#L39-L54
train
This function is used to skip the member of the object which is not in the object list.
awickert/gFlex
gflex/base.py
Utility.configGet
def configGet(self, vartype, category, name, optional=False, specialReturnMessage=None): """ Wraps a try / except and a check for self.filename around ConfigParser as it talks to the configuration file. Also, checks for existence of configuration file so this won't execute (and fail) when no config...
python
def configGet(self, vartype, category, name, optional=False, specialReturnMessage=None): """ Wraps a try / except and a check for self.filename around ConfigParser as it talks to the configuration file. Also, checks for existence of configuration file so this won't execute (and fail) when no config...
[ "def", "configGet", "(", "self", ",", "vartype", ",", "category", ",", "name", ",", "optional", "=", "False", ",", "specialReturnMessage", "=", "None", ")", ":", "try", ":", "if", "vartype", "==", "'float'", ":", "var", "=", "self", ".", "config", ".",...
Wraps a try / except and a check for self.filename around ConfigParser as it talks to the configuration file. Also, checks for existence of configuration file so this won't execute (and fail) when no configuration file is provided (e.g., running in coupled mode with CSDMS entirely with getters and set...
[ "Wraps", "a", "try", "/", "except", "and", "a", "check", "for", "self", ".", "filename", "around", "ConfigParser", "as", "it", "talks", "to", "the", "configuration", "file", ".", "Also", "checks", "for", "existence", "of", "configuration", "file", "so", "t...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L34-L88
train
Get a variable from the configuration file.
awickert/gFlex
gflex/base.py
Utility.greatCircleDistance
def greatCircleDistance(self, lat1, long1, lat2, long2, radius): """ Returns the great circle distance between two points. Useful when using the SAS_NG solution in lat/lon coordinates Modified from http://www.johndcook.com/blog/python_longitude_latitude/ It should be able to take numpy arrays. "...
python
def greatCircleDistance(self, lat1, long1, lat2, long2, radius): """ Returns the great circle distance between two points. Useful when using the SAS_NG solution in lat/lon coordinates Modified from http://www.johndcook.com/blog/python_longitude_latitude/ It should be able to take numpy arrays. "...
[ "def", "greatCircleDistance", "(", "self", ",", "lat1", ",", "long1", ",", "lat2", ",", "long2", ",", "radius", ")", ":", "# Convert latitude and longitude to", "# spherical coordinates in radians.", "degrees_to_radians", "=", "np", ".", "pi", "/", "180.0", "# theta...
Returns the great circle distance between two points. Useful when using the SAS_NG solution in lat/lon coordinates Modified from http://www.johndcook.com/blog/python_longitude_latitude/ It should be able to take numpy arrays.
[ "Returns", "the", "great", "circle", "distance", "between", "two", "points", ".", "Useful", "when", "using", "the", "SAS_NG", "solution", "in", "lat", "/", "lon", "coordinates", "Modified", "from", "http", ":", "//", "www", ".", "johndcook", ".", "com", "/...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L100-L135
train
Compute the great circle distance between two points.
awickert/gFlex
gflex/base.py
Utility.define_points_grid
def define_points_grid(self): """ This is experimental code that could be used in the spatialDomainNoGrid section to build a grid of points on which to generate the solution. However, the current development plan (as of 27 Jan 2015) is to have the end user supply the list of points where they want ...
python
def define_points_grid(self): """ This is experimental code that could be used in the spatialDomainNoGrid section to build a grid of points on which to generate the solution. However, the current development plan (as of 27 Jan 2015) is to have the end user supply the list of points where they want ...
[ "def", "define_points_grid", "(", "self", ")", ":", "# Grid making step", "# In this case, an output at different (x,y), e.g., on a grid, is desired", "# First, see if there is a need for a grid, and then make it", "# latlon arrays must have a pre-set grid", "if", "self", ".", "latlon", ...
This is experimental code that could be used in the spatialDomainNoGrid section to build a grid of points on which to generate the solution. However, the current development plan (as of 27 Jan 2015) is to have the end user supply the list of points where they want a solution (and/or for it to be provi...
[ "This", "is", "experimental", "code", "that", "could", "be", "used", "in", "the", "spatialDomainNoGrid", "section", "to", "build", "a", "grid", "of", "points", "on", "which", "to", "generate", "the", "solution", ".", "However", "the", "current", "development",...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L137-L184
train
This function is used to define the grid of points on which to generate a solution.
awickert/gFlex
gflex/base.py
Utility.loadFile
def loadFile(self, var, close_on_fail = True): """ A special function to replate a variable name that is a string file path with the loaded file. var is a string on input output is a numpy array or a None-type object (success vs. failure) """ out = None try: # First see if it is a ...
python
def loadFile(self, var, close_on_fail = True): """ A special function to replate a variable name that is a string file path with the loaded file. var is a string on input output is a numpy array or a None-type object (success vs. failure) """ out = None try: # First see if it is a ...
[ "def", "loadFile", "(", "self", ",", "var", ",", "close_on_fail", "=", "True", ")", ":", "out", "=", "None", "try", ":", "# First see if it is a full path or directly links from the current", "# working directory", "out", "=", "np", ".", "load", "(", "var", ")", ...
A special function to replate a variable name that is a string file path with the loaded file. var is a string on input output is a numpy array or a None-type object (success vs. failure)
[ "A", "special", "function", "to", "replate", "a", "variable", "name", "that", "is", "a", "string", "file", "path", "with", "the", "loaded", "file", ".", "var", "is", "a", "string", "on", "input", "output", "is", "a", "numpy", "array", "or", "a", "None"...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L187-L225
train
Load a file from the model python files.
awickert/gFlex
gflex/base.py
Plotting.surfplot
def surfplot(self, z, titletext): """ Plot if you want to - for troubleshooting - 1 figure """ if self.latlon: plt.imshow(z, extent=(0, self.dx*z.shape[0], self.dy*z.shape[1], 0)) #,interpolation='nearest' plt.xlabel('longitude [deg E]', fontsize=12, fontweight='bold') plt.ylabel('lati...
python
def surfplot(self, z, titletext): """ Plot if you want to - for troubleshooting - 1 figure """ if self.latlon: plt.imshow(z, extent=(0, self.dx*z.shape[0], self.dy*z.shape[1], 0)) #,interpolation='nearest' plt.xlabel('longitude [deg E]', fontsize=12, fontweight='bold') plt.ylabel('lati...
[ "def", "surfplot", "(", "self", ",", "z", ",", "titletext", ")", ":", "if", "self", ".", "latlon", ":", "plt", ".", "imshow", "(", "z", ",", "extent", "=", "(", "0", ",", "self", ".", "dx", "*", "z", ".", "shape", "[", "0", "]", ",", "self", ...
Plot if you want to - for troubleshooting - 1 figure
[ "Plot", "if", "you", "want", "to", "-", "for", "troubleshooting", "-", "1", "figure" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L376-L390
train
Plots the surface of the given z.
awickert/gFlex
gflex/base.py
Plotting.twoSurfplots
def twoSurfplots(self): """ Plot multiple subplot figure for 2D array """ # Could more elegantly just call surfplot twice # And also could include xyzinterp as an option inside surfplot. # Noted here in case anyone wants to take that on in the future... plt.subplot(211) plt.title('Load ...
python
def twoSurfplots(self): """ Plot multiple subplot figure for 2D array """ # Could more elegantly just call surfplot twice # And also could include xyzinterp as an option inside surfplot. # Noted here in case anyone wants to take that on in the future... plt.subplot(211) plt.title('Load ...
[ "def", "twoSurfplots", "(", "self", ")", ":", "# Could more elegantly just call surfplot twice", "# And also could include xyzinterp as an option inside surfplot.", "# Noted here in case anyone wants to take that on in the future...", "plt", ".", "subplot", "(", "211", ")", "plt", "....
Plot multiple subplot figure for 2D array
[ "Plot", "multiple", "subplot", "figure", "for", "2D", "array" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L392-L422
train
Plot multiple subplot figure for 2D array
awickert/gFlex
gflex/base.py
Plotting.xyzinterp
def xyzinterp(self, x, y, z, titletext): """ Interpolates and plots ungridded model outputs from SAS_NG solution """ # Help from http://wiki.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data if self.Verbose: print("Starting to interpolate grid for plotting -- can be a slow pr...
python
def xyzinterp(self, x, y, z, titletext): """ Interpolates and plots ungridded model outputs from SAS_NG solution """ # Help from http://wiki.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data if self.Verbose: print("Starting to interpolate grid for plotting -- can be a slow pr...
[ "def", "xyzinterp", "(", "self", ",", "x", ",", "y", ",", "z", ",", "titletext", ")", ":", "# Help from http://wiki.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data", "if", "self", ".", "Verbose", ":", "print", "(", "\"Starting to interpolate grid for plotti...
Interpolates and plots ungridded model outputs from SAS_NG solution
[ "Interpolates", "and", "plots", "ungridded", "model", "outputs", "from", "SAS_NG", "solution" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L424-L488
train
Interpolates and plots ungridded model outputs from SAS_NG solution
awickert/gFlex
gflex/base.py
Flexure.outputDeflections
def outputDeflections(self): """ Outputs a grid of deflections if an output directory is defined in the configuration file If the filename given in the configuration file ends in ".npy", then a binary numpy grid will be exported. Otherwise, an ASCII grid will be exported. """ ...
python
def outputDeflections(self): """ Outputs a grid of deflections if an output directory is defined in the configuration file If the filename given in the configuration file ends in ".npy", then a binary numpy grid will be exported. Otherwise, an ASCII grid will be exported. """ ...
[ "def", "outputDeflections", "(", "self", ")", ":", "try", ":", "# If wOutFile exists, has already been set by a setter", "self", ".", "wOutFile", "if", "self", ".", "Verbose", ":", "print", "(", "\"Output filename provided.\"", ")", "# Otherwise, it needs to be set by an co...
Outputs a grid of deflections if an output directory is defined in the configuration file If the filename given in the configuration file ends in ".npy", then a binary numpy grid will be exported. Otherwise, an ASCII grid will be exported.
[ "Outputs", "a", "grid", "of", "deflections", "if", "an", "output", "directory", "is", "defined", "in", "the", "configuration", "file", "If", "the", "filename", "given", "in", "the", "configuration", "file", "ends", "in", ".", "npy", "then", "a", "binary", ...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L762-L796
train
Outputs a grid of deflections to a file.
awickert/gFlex
gflex/base.py
Flexure.coeffArraySizeCheck
def coeffArraySizeCheck(self): """ Make sure that q0 and coefficient array are the right size compared to each other (for finite difference if loading a pre-build coefficient array). Otherwise, exit. """ if prod(self.coeff_matrix.shape) != long(prod(np.array(self.qs.shape,dtype=int64)+2)**2): ...
python
def coeffArraySizeCheck(self): """ Make sure that q0 and coefficient array are the right size compared to each other (for finite difference if loading a pre-build coefficient array). Otherwise, exit. """ if prod(self.coeff_matrix.shape) != long(prod(np.array(self.qs.shape,dtype=int64)+2)**2): ...
[ "def", "coeffArraySizeCheck", "(", "self", ")", ":", "if", "prod", "(", "self", ".", "coeff_matrix", ".", "shape", ")", "!=", "long", "(", "prod", "(", "np", ".", "array", "(", "self", ".", "qs", ".", "shape", ",", "dtype", "=", "int64", ")", "+", ...
Make sure that q0 and coefficient array are the right size compared to each other (for finite difference if loading a pre-build coefficient array). Otherwise, exit.
[ "Make", "sure", "that", "q0", "and", "coefficient", "array", "are", "the", "right", "size", "compared", "to", "each", "other", "(", "for", "finite", "difference", "if", "loading", "a", "pre", "-", "build", "coefficient", "array", ")", ".", "Otherwise", "ex...
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L896-L905
train
Check that the size of the coefficient array and q0 array are the right size compared to
awickert/gFlex
gflex/base.py
Flexure.TeArraySizeCheck
def TeArraySizeCheck(self): """ Checks that Te and q0 array sizes are compatible For finite difference solution. """ # Only if they are both defined and are arrays # Both being arrays is a possible bug in this check routine that I have # intentionally introduced if type(self.Te) == np.n...
python
def TeArraySizeCheck(self): """ Checks that Te and q0 array sizes are compatible For finite difference solution. """ # Only if they are both defined and are arrays # Both being arrays is a possible bug in this check routine that I have # intentionally introduced if type(self.Te) == np.n...
[ "def", "TeArraySizeCheck", "(", "self", ")", ":", "# Only if they are both defined and are arrays", "# Both being arrays is a possible bug in this check routine that I have ", "# intentionally introduced", "if", "type", "(", "self", ".", "Te", ")", "==", "np", ".", "ndarray", ...
Checks that Te and q0 array sizes are compatible For finite difference solution.
[ "Checks", "that", "Te", "and", "q0", "array", "sizes", "are", "compatible", "For", "finite", "difference", "solution", "." ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L907-L921
train
Checks that Te and q0 array sizes are compatible
awickert/gFlex
gflex/base.py
Flexure.FD
def FD(self): """ Set-up for the finite difference solution method """ if self.Verbose: print("Finite Difference Solution Technique") # Used to check for coeff_matrix here, but now doing so in self.bc_check() # called by f1d and f2d at the start # # Define a stress-based qs = q0 ...
python
def FD(self): """ Set-up for the finite difference solution method """ if self.Verbose: print("Finite Difference Solution Technique") # Used to check for coeff_matrix here, but now doing so in self.bc_check() # called by f1d and f2d at the start # # Define a stress-based qs = q0 ...
[ "def", "FD", "(", "self", ")", ":", "if", "self", ".", "Verbose", ":", "print", "(", "\"Finite Difference Solution Technique\"", ")", "# Used to check for coeff_matrix here, but now doing so in self.bc_check()", "# called by f1d and f2d at the start", "# ", "# Define a stress-bas...
Set-up for the finite difference solution method
[ "Set", "-", "up", "for", "the", "finite", "difference", "solution", "method" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L927-L1008
train
This method is called by the FD method in the class constructor.
awickert/gFlex
gflex/base.py
Flexure.SAS
def SAS(self): """ Set-up for the rectangularly-gridded superposition of analytical solutions method for solving flexure """ if self.x is None: self.x = np.arange(self.dx/2., self.dx * self.qs.shape[0], self.dx) if self.filename: # Define the (scalar) elastic thickness self.Te...
python
def SAS(self): """ Set-up for the rectangularly-gridded superposition of analytical solutions method for solving flexure """ if self.x is None: self.x = np.arange(self.dx/2., self.dx * self.qs.shape[0], self.dx) if self.filename: # Define the (scalar) elastic thickness self.Te...
[ "def", "SAS", "(", "self", ")", ":", "if", "self", ".", "x", "is", "None", ":", "self", ".", "x", "=", "np", ".", "arange", "(", "self", ".", "dx", "/", "2.", ",", "self", ".", "dx", "*", "self", ".", "qs", ".", "shape", "[", "0", "]", ",...
Set-up for the rectangularly-gridded superposition of analytical solutions method for solving flexure
[ "Set", "-", "up", "for", "the", "rectangularly", "-", "gridded", "superposition", "of", "analytical", "solutions", "method", "for", "solving", "flexure" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L1017-L1045
train
This method is used to set up the rectangularly - gridded superposition of analytical solutions method for solving flexure of analytical solutions for solving flexure of analytical solutions.
awickert/gFlex
gflex/base.py
Flexure.SAS_NG
def SAS_NG(self): """ Set-up for the ungridded superposition of analytical solutions method for solving flexure """ if self.filename: # Define the (scalar) elastic thickness self.Te = self.configGet("float", "input", "ElasticThickness") # See if it wants to be run in lat/lon ...
python
def SAS_NG(self): """ Set-up for the ungridded superposition of analytical solutions method for solving flexure """ if self.filename: # Define the (scalar) elastic thickness self.Te = self.configGet("float", "input", "ElasticThickness") # See if it wants to be run in lat/lon ...
[ "def", "SAS_NG", "(", "self", ")", ":", "if", "self", ".", "filename", ":", "# Define the (scalar) elastic thickness", "self", ".", "Te", "=", "self", ".", "configGet", "(", "\"float\"", ",", "\"input\"", ",", "\"ElasticThickness\"", ")", "# See if it wants to be ...
Set-up for the ungridded superposition of analytical solutions method for solving flexure
[ "Set", "-", "up", "for", "the", "ungridded", "superposition", "of", "analytical", "solutions", "method", "for", "solving", "flexure" ]
3ac32249375b0f8d342a142585d86ea4d905a5a0
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L1047-L1138
train
Set - up for the ungridded superposition of analytical solutions method for solving flexure of analytical solutions
bionikspoon/pureyaml
pureyaml/_compat/singledispatch.py
_c3_merge
def _c3_merge(sequences): # noqa """Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/. """ result = [] while True: sequences = [s for s in sequences if s] # purge empty sequences if not sequences: ...
python
def _c3_merge(sequences): # noqa """Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/. """ result = [] while True: sequences = [s for s in sequences if s] # purge empty sequences if not sequences: ...
[ "def", "_c3_merge", "(", "sequences", ")", ":", "# noqa", "result", "=", "[", "]", "while", "True", ":", "sequences", "=", "[", "s", "for", "s", "in", "sequences", "if", "s", "]", "# purge empty sequences", "if", "not", "sequences", ":", "return", "resul...
Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/.
[ "Merges", "MROs", "in", "*", "sequences", "*", "to", "a", "single", "MRO", "using", "the", "C3", "algorithm", "." ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/singledispatch.py#L21-L46
train
Merges MROs in sequences into a single MRO.
bionikspoon/pureyaml
pureyaml/_compat/singledispatch.py
_c3_mro
def _c3_mro(cls, abcs=None): """Computes the method resolution order using extended C3 linearization. If no *abcs* are given, the algorithm works exactly like the built-in C3 linearization used for method resolution. If given, *abcs* is a list of abstract base classes that should be inserted into ...
python
def _c3_mro(cls, abcs=None): """Computes the method resolution order using extended C3 linearization. If no *abcs* are given, the algorithm works exactly like the built-in C3 linearization used for method resolution. If given, *abcs* is a list of abstract base classes that should be inserted into ...
[ "def", "_c3_mro", "(", "cls", ",", "abcs", "=", "None", ")", ":", "for", "i", ",", "base", "in", "enumerate", "(", "reversed", "(", "cls", ".", "__bases__", ")", ")", ":", "if", "hasattr", "(", "base", ",", "'__abstractmethods__'", ")", ":", "boundar...
Computes the method resolution order using extended C3 linearization. If no *abcs* are given, the algorithm works exactly like the built-in C3 linearization used for method resolution. If given, *abcs* is a list of abstract base classes that should be inserted into the resulting MRO. Unrelated ABCs ar...
[ "Computes", "the", "method", "resolution", "order", "using", "extended", "C3", "linearization", "." ]
784830b907ca14525c4cecdb6ae35306f6f8a877
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/singledispatch.py#L49-L88
train
Computes the method resolution order using extended C3 linearization.