id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
56,200
xav-b/pyconsul
pyconsul/iron.py
Metrics.available
def available(self): ''' Check if a related database exists ''' return self.db_name in map( lambda x: x['name'], self._db.get_database_list() )
python
def available(self): ''' Check if a related database exists ''' return self.db_name in map( lambda x: x['name'], self._db.get_database_list() )
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "db_name", "in", "map", "(", "lambda", "x", ":", "x", "[", "'name'", "]", ",", "self", ".", "_db", ".", "get_database_list", "(", ")", ")" ]
Check if a related database exists
[ "Check", "if", "a", "related", "database", "exists" ]
06ce3b921d01010c19643424486bea4b22196076
https://github.com/xav-b/pyconsul/blob/06ce3b921d01010c19643424486bea4b22196076/pyconsul/iron.py#L36-L40
56,201
murphy214/berrl
build/lib/berrl/pipegeohash.py
make_geohash_tables
def make_geohash_tables(table,listofprecisions,**kwargs): ''' sort_by - field to sort by for each group return_squares - boolean arg if true returns a list of squares instead of writing out to table ''' return_squares = False sort_by = 'COUNT' # logic for accepting kwarg inputs for key,value in kwargs.iteritems...
python
def make_geohash_tables(table,listofprecisions,**kwargs): ''' sort_by - field to sort by for each group return_squares - boolean arg if true returns a list of squares instead of writing out to table ''' return_squares = False sort_by = 'COUNT' # logic for accepting kwarg inputs for key,value in kwargs.iteritems...
[ "def", "make_geohash_tables", "(", "table", ",", "listofprecisions", ",", "*", "*", "kwargs", ")", ":", "return_squares", "=", "False", "sort_by", "=", "'COUNT'", "# logic for accepting kwarg inputs", "for", "key", ",", "value", "in", "kwargs", ".", "iteritems", ...
sort_by - field to sort by for each group return_squares - boolean arg if true returns a list of squares instead of writing out to table
[ "sort_by", "-", "field", "to", "sort", "by", "for", "each", "group", "return_squares", "-", "boolean", "arg", "if", "true", "returns", "a", "list", "of", "squares", "instead", "of", "writing", "out", "to", "table" ]
ce4d060cc7db74c32facc538fa1d7030f1a27467
https://github.com/murphy214/berrl/blob/ce4d060cc7db74c32facc538fa1d7030f1a27467/build/lib/berrl/pipegeohash.py#L265-L331
56,202
svetlyak40wt/python-processor
setup.py
expand_includes
def expand_includes(text, path='.'): """Recursively expands includes in given text.""" def read_and_expand(match): filename = match.group('filename') filename = join(path, filename) text = read(filename) return expand_includes( text, path=join(path, dirname(filename))...
python
def expand_includes(text, path='.'): """Recursively expands includes in given text.""" def read_and_expand(match): filename = match.group('filename') filename = join(path, filename) text = read(filename) return expand_includes( text, path=join(path, dirname(filename))...
[ "def", "expand_includes", "(", "text", ",", "path", "=", "'.'", ")", ":", "def", "read_and_expand", "(", "match", ")", ":", "filename", "=", "match", ".", "group", "(", "'filename'", ")", "filename", "=", "join", "(", "path", ",", "filename", ")", "tex...
Recursively expands includes in given text.
[ "Recursively", "expands", "includes", "in", "given", "text", "." ]
9126a021d603030899897803ab9973250e5b16f6
https://github.com/svetlyak40wt/python-processor/blob/9126a021d603030899897803ab9973250e5b16f6/setup.py#L25-L37
56,203
KeplerGO/K2fov
K2fov/K2onSilicon.py
angSepVincenty
def angSepVincenty(ra1, dec1, ra2, dec2): """ Vincenty formula for distances on a sphere """ ra1_rad = np.radians(ra1) dec1_rad = np.radians(dec1) ra2_rad = np.radians(ra2) dec2_rad = np.radians(dec2) sin_dec1, cos_dec1 = np.sin(dec1_rad), np.cos(dec1_rad) sin_dec2, cos_dec2 = np.si...
python
def angSepVincenty(ra1, dec1, ra2, dec2): """ Vincenty formula for distances on a sphere """ ra1_rad = np.radians(ra1) dec1_rad = np.radians(dec1) ra2_rad = np.radians(ra2) dec2_rad = np.radians(dec2) sin_dec1, cos_dec1 = np.sin(dec1_rad), np.cos(dec1_rad) sin_dec2, cos_dec2 = np.si...
[ "def", "angSepVincenty", "(", "ra1", ",", "dec1", ",", "ra2", ",", "dec2", ")", ":", "ra1_rad", "=", "np", ".", "radians", "(", "ra1", ")", "dec1_rad", "=", "np", ".", "radians", "(", "dec1", ")", "ra2_rad", "=", "np", ".", "radians", "(", "ra2", ...
Vincenty formula for distances on a sphere
[ "Vincenty", "formula", "for", "distances", "on", "a", "sphere" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/K2onSilicon.py#L41-L60
56,204
KeplerGO/K2fov
K2fov/K2onSilicon.py
parse_file
def parse_file(infile, exit_on_error=True): """Parse a comma-separated file with columns "ra,dec,magnitude". """ try: a, b, mag = np.atleast_2d( np.genfromtxt( infile, usecols=[0, 1, 2], ...
python
def parse_file(infile, exit_on_error=True): """Parse a comma-separated file with columns "ra,dec,magnitude". """ try: a, b, mag = np.atleast_2d( np.genfromtxt( infile, usecols=[0, 1, 2], ...
[ "def", "parse_file", "(", "infile", ",", "exit_on_error", "=", "True", ")", ":", "try", ":", "a", ",", "b", ",", "mag", "=", "np", ".", "atleast_2d", "(", "np", ".", "genfromtxt", "(", "infile", ",", "usecols", "=", "[", "0", ",", "1", ",", "2", ...
Parse a comma-separated file with columns "ra,dec,magnitude".
[ "Parse", "a", "comma", "-", "separated", "file", "with", "columns", "ra", "dec", "magnitude", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/K2onSilicon.py#L63-L83
56,205
KeplerGO/K2fov
K2fov/K2onSilicon.py
onSiliconCheck
def onSiliconCheck(ra_deg, dec_deg, FovObj, padding_pix=DEFAULT_PADDING): """Check a single position.""" dist = angSepVincenty(FovObj.ra0_deg, FovObj.dec0_deg, ra_deg, dec_deg) if dist >= 90.: return False # padding_pix=3 means that objects less than 3 pixels off the edge of # a channel are ...
python
def onSiliconCheck(ra_deg, dec_deg, FovObj, padding_pix=DEFAULT_PADDING): """Check a single position.""" dist = angSepVincenty(FovObj.ra0_deg, FovObj.dec0_deg, ra_deg, dec_deg) if dist >= 90.: return False # padding_pix=3 means that objects less than 3 pixels off the edge of # a channel are ...
[ "def", "onSiliconCheck", "(", "ra_deg", ",", "dec_deg", ",", "FovObj", ",", "padding_pix", "=", "DEFAULT_PADDING", ")", ":", "dist", "=", "angSepVincenty", "(", "FovObj", ".", "ra0_deg", ",", "FovObj", ".", "dec0_deg", ",", "ra_deg", ",", "dec_deg", ")", "...
Check a single position.
[ "Check", "a", "single", "position", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/K2onSilicon.py#L86-L93
56,206
KeplerGO/K2fov
K2fov/K2onSilicon.py
onSiliconCheckList
def onSiliconCheckList(ra_deg, dec_deg, FovObj, padding_pix=DEFAULT_PADDING): """Check a list of positions.""" dist = angSepVincenty(FovObj.ra0_deg, FovObj.dec0_deg, ra_deg, dec_deg) mask = (dist < 90.) out = np.zeros(len(dist), dtype=bool) out[mask] = FovObj.isOnSiliconList(ra_deg[mask], dec_deg[ma...
python
def onSiliconCheckList(ra_deg, dec_deg, FovObj, padding_pix=DEFAULT_PADDING): """Check a list of positions.""" dist = angSepVincenty(FovObj.ra0_deg, FovObj.dec0_deg, ra_deg, dec_deg) mask = (dist < 90.) out = np.zeros(len(dist), dtype=bool) out[mask] = FovObj.isOnSiliconList(ra_deg[mask], dec_deg[ma...
[ "def", "onSiliconCheckList", "(", "ra_deg", ",", "dec_deg", ",", "FovObj", ",", "padding_pix", "=", "DEFAULT_PADDING", ")", ":", "dist", "=", "angSepVincenty", "(", "FovObj", ".", "ra0_deg", ",", "FovObj", ".", "dec0_deg", ",", "ra_deg", ",", "dec_deg", ")",...
Check a list of positions.
[ "Check", "a", "list", "of", "positions", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/K2onSilicon.py#L96-L102
56,207
KeplerGO/K2fov
K2fov/K2onSilicon.py
K2onSilicon
def K2onSilicon(infile, fieldnum, do_nearSiliconCheck=False): """Checks whether targets are on silicon during a given campaign. This function will write a csv table called targets_siliconFlag.csv, which details the silicon status for each target listed in `infile` (0 = not on silicon, 2 = on silion). ...
python
def K2onSilicon(infile, fieldnum, do_nearSiliconCheck=False): """Checks whether targets are on silicon during a given campaign. This function will write a csv table called targets_siliconFlag.csv, which details the silicon status for each target listed in `infile` (0 = not on silicon, 2 = on silion). ...
[ "def", "K2onSilicon", "(", "infile", ",", "fieldnum", ",", "do_nearSiliconCheck", "=", "False", ")", ":", "ra_sources_deg", ",", "dec_sources_deg", ",", "mag", "=", "parse_file", "(", "infile", ")", "n_sources", "=", "np", ".", "shape", "(", "ra_sources_deg", ...
Checks whether targets are on silicon during a given campaign. This function will write a csv table called targets_siliconFlag.csv, which details the silicon status for each target listed in `infile` (0 = not on silicon, 2 = on silion). Parameters ---------- infile : str Path to a csv ...
[ "Checks", "whether", "targets", "are", "on", "silicon", "during", "a", "given", "campaign", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/K2onSilicon.py#L122-L215
56,208
KeplerGO/K2fov
K2fov/K2onSilicon.py
K2onSilicon_main
def K2onSilicon_main(args=None): """Function called when `K2onSilicon` is executed on the command line.""" import argparse parser = argparse.ArgumentParser( description="Run K2onSilicon to find which targets in a " "list call on active silicon for a given K2 campaign.") parse...
python
def K2onSilicon_main(args=None): """Function called when `K2onSilicon` is executed on the command line.""" import argparse parser = argparse.ArgumentParser( description="Run K2onSilicon to find which targets in a " "list call on active silicon for a given K2 campaign.") parse...
[ "def", "K2onSilicon_main", "(", "args", "=", "None", ")", ":", "import", "argparse", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Run K2onSilicon to find which targets in a \"", "\"list call on active silicon for a given K2 campaign.\"", ")", ...
Function called when `K2onSilicon` is executed on the command line.
[ "Function", "called", "when", "K2onSilicon", "is", "executed", "on", "the", "command", "line", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/K2onSilicon.py#L218-L229
56,209
mardix/ses-mailer
ses_mailer.py
Template._get_template
def _get_template(self, template_name): """ Retrieve the cached version of the template """ if template_name not in self.chached_templates: self.chached_templates[template_name] = self.env.get_template(template_name) return self.chached_templates[template_name]
python
def _get_template(self, template_name): """ Retrieve the cached version of the template """ if template_name not in self.chached_templates: self.chached_templates[template_name] = self.env.get_template(template_name) return self.chached_templates[template_name]
[ "def", "_get_template", "(", "self", ",", "template_name", ")", ":", "if", "template_name", "not", "in", "self", ".", "chached_templates", ":", "self", ".", "chached_templates", "[", "template_name", "]", "=", "self", ".", "env", ".", "get_template", "(", "t...
Retrieve the cached version of the template
[ "Retrieve", "the", "cached", "version", "of", "the", "template" ]
14be4fbdf7182bce8a22235df56c524235b84c89
https://github.com/mardix/ses-mailer/blob/14be4fbdf7182bce8a22235df56c524235b84c89/ses_mailer.py#L57-L63
56,210
mardix/ses-mailer
ses_mailer.py
Template._render_context
def _render_context(self, template, block, **context): """ Render a block to a string with its context """ return u''.join(block(template.new_context(context)))
python
def _render_context(self, template, block, **context): """ Render a block to a string with its context """ return u''.join(block(template.new_context(context)))
[ "def", "_render_context", "(", "self", ",", "template", ",", "block", ",", "*", "*", "context", ")", ":", "return", "u''", ".", "join", "(", "block", "(", "template", ".", "new_context", "(", "context", ")", ")", ")" ]
Render a block to a string with its context
[ "Render", "a", "block", "to", "a", "string", "with", "its", "context" ]
14be4fbdf7182bce8a22235df56c524235b84c89
https://github.com/mardix/ses-mailer/blob/14be4fbdf7182bce8a22235df56c524235b84c89/ses_mailer.py#L94-L98
56,211
mardix/ses-mailer
ses_mailer.py
Mail.init_app
def init_app(self, app): """ For Flask using the app config """ self.__init__(aws_access_key_id=app.config.get("SES_AWS_ACCESS_KEY"), aws_secret_access_key=app.config.get("SES_AWS_SECRET_KEY"), region=app.config.get("SES_REGION", "us-east-1"), ...
python
def init_app(self, app): """ For Flask using the app config """ self.__init__(aws_access_key_id=app.config.get("SES_AWS_ACCESS_KEY"), aws_secret_access_key=app.config.get("SES_AWS_SECRET_KEY"), region=app.config.get("SES_REGION", "us-east-1"), ...
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "self", ".", "__init__", "(", "aws_access_key_id", "=", "app", ".", "config", ".", "get", "(", "\"SES_AWS_ACCESS_KEY\"", ")", ",", "aws_secret_access_key", "=", "app", ".", "config", ".", "get", "(", ...
For Flask using the app config
[ "For", "Flask", "using", "the", "app", "config" ]
14be4fbdf7182bce8a22235df56c524235b84c89
https://github.com/mardix/ses-mailer/blob/14be4fbdf7182bce8a22235df56c524235b84c89/ses_mailer.py#L143-L154
56,212
mardix/ses-mailer
ses_mailer.py
Mail.send_template
def send_template(self, template, to, reply_to=None, **context): """ Send email from template """ mail_data = self.parse_template(template, **context) subject = mail_data["subject"] body = mail_data["body"] del(mail_data["subject"]) del(mail_data["body"]) ...
python
def send_template(self, template, to, reply_to=None, **context): """ Send email from template """ mail_data = self.parse_template(template, **context) subject = mail_data["subject"] body = mail_data["body"] del(mail_data["subject"]) del(mail_data["body"]) ...
[ "def", "send_template", "(", "self", ",", "template", ",", "to", ",", "reply_to", "=", "None", ",", "*", "*", "context", ")", ":", "mail_data", "=", "self", ".", "parse_template", "(", "template", ",", "*", "*", "context", ")", "subject", "=", "mail_da...
Send email from template
[ "Send", "email", "from", "template" ]
14be4fbdf7182bce8a22235df56c524235b84c89
https://github.com/mardix/ses-mailer/blob/14be4fbdf7182bce8a22235df56c524235b84c89/ses_mailer.py#L219-L233
56,213
mardix/ses-mailer
ses_mailer.py
Mail.parse_template
def parse_template(self, template, **context): """ To parse a template and return all the blocks """ required_blocks = ["subject", "body"] optional_blocks = ["text_body", "html_body", "return_path", "format"] if self.template_context: context = dict(self.temp...
python
def parse_template(self, template, **context): """ To parse a template and return all the blocks """ required_blocks = ["subject", "body"] optional_blocks = ["text_body", "html_body", "return_path", "format"] if self.template_context: context = dict(self.temp...
[ "def", "parse_template", "(", "self", ",", "template", ",", "*", "*", "context", ")", ":", "required_blocks", "=", "[", "\"subject\"", ",", "\"body\"", "]", "optional_blocks", "=", "[", "\"text_body\"", ",", "\"html_body\"", ",", "\"return_path\"", ",", "\"for...
To parse a template and return all the blocks
[ "To", "parse", "a", "template", "and", "return", "all", "the", "blocks" ]
14be4fbdf7182bce8a22235df56c524235b84c89
https://github.com/mardix/ses-mailer/blob/14be4fbdf7182bce8a22235df56c524235b84c89/ses_mailer.py#L235-L259
56,214
p3trus/slave
slave/driver.py
_typelist
def _typelist(x): """Helper function converting all items of x to instances.""" if isinstance(x, collections.Sequence): return list(map(_to_instance, x)) elif isinstance(x, collections.Iterable): return x return None if x is None else [_to_instance(x)]
python
def _typelist(x): """Helper function converting all items of x to instances.""" if isinstance(x, collections.Sequence): return list(map(_to_instance, x)) elif isinstance(x, collections.Iterable): return x return None if x is None else [_to_instance(x)]
[ "def", "_typelist", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "collections", ".", "Sequence", ")", ":", "return", "list", "(", "map", "(", "_to_instance", ",", "x", ")", ")", "elif", "isinstance", "(", "x", ",", "collections", ".", "Iter...
Helper function converting all items of x to instances.
[ "Helper", "function", "converting", "all", "items", "of", "x", "to", "instances", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/driver.py#L48-L54
56,215
p3trus/slave
slave/driver.py
Command.write
def write(self, transport, protocol, *data): """Generates and sends a command message unit. :param transport: An object implementing the `.Transport` interface. It is used by the protocol to send the message. :param protocol: An object implementing the `.Protocol` interface. ...
python
def write(self, transport, protocol, *data): """Generates and sends a command message unit. :param transport: An object implementing the `.Transport` interface. It is used by the protocol to send the message. :param protocol: An object implementing the `.Protocol` interface. ...
[ "def", "write", "(", "self", ",", "transport", ",", "protocol", ",", "*", "data", ")", ":", "if", "not", "self", ".", "_write", ":", "raise", "AttributeError", "(", "'Command is not writeable'", ")", "if", "self", ".", "protocol", ":", "protocol", "=", "...
Generates and sends a command message unit. :param transport: An object implementing the `.Transport` interface. It is used by the protocol to send the message. :param protocol: An object implementing the `.Protocol` interface. :param data: The program data. :raises Attribu...
[ "Generates", "and", "sends", "a", "command", "message", "unit", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/driver.py#L131-L154
56,216
p3trus/slave
slave/driver.py
Command.query
def query(self, transport, protocol, *data): """Generates and sends a query message unit. :param transport: An object implementing the `.Transport` interface. It is used by the protocol to send the message and receive the response. :param protocol: An object implementing...
python
def query(self, transport, protocol, *data): """Generates and sends a query message unit. :param transport: An object implementing the `.Transport` interface. It is used by the protocol to send the message and receive the response. :param protocol: An object implementing...
[ "def", "query", "(", "self", ",", "transport", ",", "protocol", ",", "*", "data", ")", ":", "if", "not", "self", ".", "_query", ":", "raise", "AttributeError", "(", "'Command is not queryable'", ")", "if", "self", ".", "protocol", ":", "protocol", "=", "...
Generates and sends a query message unit. :param transport: An object implementing the `.Transport` interface. It is used by the protocol to send the message and receive the response. :param protocol: An object implementing the `.Protocol` interface. :param data: The pro...
[ "Generates", "and", "sends", "a", "query", "message", "unit", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/driver.py#L156-L184
56,217
p3trus/slave
slave/driver.py
Driver._write
def _write(self, cmd, *datas): """Helper function to simplify writing.""" cmd = Command(write=cmd) cmd.write(self._transport, self._protocol, *datas)
python
def _write(self, cmd, *datas): """Helper function to simplify writing.""" cmd = Command(write=cmd) cmd.write(self._transport, self._protocol, *datas)
[ "def", "_write", "(", "self", ",", "cmd", ",", "*", "datas", ")", ":", "cmd", "=", "Command", "(", "write", "=", "cmd", ")", "cmd", ".", "write", "(", "self", ".", "_transport", ",", "self", ".", "_protocol", ",", "*", "datas", ")" ]
Helper function to simplify writing.
[ "Helper", "function", "to", "simplify", "writing", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/driver.py#L237-L240
56,218
p3trus/slave
slave/driver.py
Driver._query
def _query(self, cmd, *datas): """Helper function to allow method queries.""" cmd = Command(query=cmd) return cmd.query(self._transport, self._protocol, *datas)
python
def _query(self, cmd, *datas): """Helper function to allow method queries.""" cmd = Command(query=cmd) return cmd.query(self._transport, self._protocol, *datas)
[ "def", "_query", "(", "self", ",", "cmd", ",", "*", "datas", ")", ":", "cmd", "=", "Command", "(", "query", "=", "cmd", ")", "return", "cmd", ".", "query", "(", "self", ".", "_transport", ",", "self", ".", "_protocol", ",", "*", "datas", ")" ]
Helper function to allow method queries.
[ "Helper", "function", "to", "allow", "method", "queries", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/driver.py#L242-L245
56,219
llazzaro/analyzerdam
analyzerdam/yahooFinance.py
YahooFinance.getAll
def getAll(self, symbol): """ Get all available quote data for the given ticker symbol. Returns a dictionary. """ values = self.__request(symbol, 'l1c1va2xj1b4j4dyekjm3m4rr5p5p6s7').split(',') data = {} data['price'] = values[0] data['change'] = va...
python
def getAll(self, symbol): """ Get all available quote data for the given ticker symbol. Returns a dictionary. """ values = self.__request(symbol, 'l1c1va2xj1b4j4dyekjm3m4rr5p5p6s7').split(',') data = {} data['price'] = values[0] data['change'] = va...
[ "def", "getAll", "(", "self", ",", "symbol", ")", ":", "values", "=", "self", ".", "__request", "(", "symbol", ",", "'l1c1va2xj1b4j4dyekjm3m4rr5p5p6s7'", ")", ".", "split", "(", "','", ")", "data", "=", "{", "}", "data", "[", "'price'", "]", "=", "valu...
Get all available quote data for the given ticker symbol. Returns a dictionary.
[ "Get", "all", "available", "quote", "data", "for", "the", "given", "ticker", "symbol", ".", "Returns", "a", "dictionary", "." ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/yahooFinance.py#L30-L57
56,220
llazzaro/analyzerdam
analyzerdam/yahooFinance.py
YahooFinance.getQuotes
def getQuotes(self, symbol, start, end): """ Get historical prices for the given ticker symbol. Date format is 'YYYY-MM-DD' Returns a nested list. """ try: start = str(start).replace('-', '') end = str(end).replace('-', '') ...
python
def getQuotes(self, symbol, start, end): """ Get historical prices for the given ticker symbol. Date format is 'YYYY-MM-DD' Returns a nested list. """ try: start = str(start).replace('-', '') end = str(end).replace('-', '') ...
[ "def", "getQuotes", "(", "self", ",", "symbol", ",", "start", ",", "end", ")", ":", "try", ":", "start", "=", "str", "(", "start", ")", ".", "replace", "(", "'-'", ",", "''", ")", "end", "=", "str", "(", "end", ")", ".", "replace", "(", "'-'", ...
Get historical prices for the given ticker symbol. Date format is 'YYYY-MM-DD' Returns a nested list.
[ "Get", "historical", "prices", "for", "the", "given", "ticker", "symbol", ".", "Date", "format", "is", "YYYY", "-", "MM", "-", "DD", "Returns", "a", "nested", "list", "." ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/yahooFinance.py#L59-L93
56,221
twisted/mantissa
xmantissa/product.py
Product.installProductOn
def installProductOn(self, userstore): """ Creates an Installation in this user store for our collection of powerups, and then install those powerups on the user's store. """ def install(): i = Installation(store=userstore) i.types = self.types ...
python
def installProductOn(self, userstore): """ Creates an Installation in this user store for our collection of powerups, and then install those powerups on the user's store. """ def install(): i = Installation(store=userstore) i.types = self.types ...
[ "def", "installProductOn", "(", "self", ",", "userstore", ")", ":", "def", "install", "(", ")", ":", "i", "=", "Installation", "(", "store", "=", "userstore", ")", "i", ".", "types", "=", "self", ".", "types", "i", ".", "install", "(", ")", "userstor...
Creates an Installation in this user store for our collection of powerups, and then install those powerups on the user's store.
[ "Creates", "an", "Installation", "in", "this", "user", "store", "for", "our", "collection", "of", "powerups", "and", "then", "install", "those", "powerups", "on", "the", "user", "s", "store", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/product.py#L29-L40
56,222
twisted/mantissa
xmantissa/product.py
Product.installOrResume
def installOrResume(self, userstore): """ Install this product on a user store. If this product has been installed on the user store already and the installation is suspended, it will be resumed. If it exists and is not suspended, an error will be raised. """ for ...
python
def installOrResume(self, userstore): """ Install this product on a user store. If this product has been installed on the user store already and the installation is suspended, it will be resumed. If it exists and is not suspended, an error will be raised. """ for ...
[ "def", "installOrResume", "(", "self", ",", "userstore", ")", ":", "for", "i", "in", "userstore", ".", "query", "(", "Installation", ",", "Installation", ".", "types", "==", "self", ".", "types", ")", ":", "if", "i", ".", "suspended", ":", "unsuspendTabP...
Install this product on a user store. If this product has been installed on the user store already and the installation is suspended, it will be resumed. If it exists and is not suspended, an error will be raised.
[ "Install", "this", "product", "on", "a", "user", "store", ".", "If", "this", "product", "has", "been", "installed", "on", "the", "user", "store", "already", "and", "the", "installation", "is", "suspended", "it", "will", "be", "resumed", ".", "If", "it", ...
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/product.py#L58-L73
56,223
twisted/mantissa
xmantissa/product.py
Installation.items
def items(self): """ Loads the items this Installation refers to. """ for id in self._items: yield self.store.getItemByID(int(id))
python
def items(self): """ Loads the items this Installation refers to. """ for id in self._items: yield self.store.getItemByID(int(id))
[ "def", "items", "(", "self", ")", ":", "for", "id", "in", "self", ".", "_items", ":", "yield", "self", ".", "store", ".", "getItemByID", "(", "int", "(", "id", ")", ")" ]
Loads the items this Installation refers to.
[ "Loads", "the", "items", "this", "Installation", "refers", "to", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/product.py#L85-L90
56,224
twisted/mantissa
xmantissa/product.py
Installation.install
def install(self): """ Called when installed on the user store. Installs my powerups. """ items = [] for typeName in self.types: it = self.store.findOrCreate(namedAny(typeName)) installOn(it, self.store) items.append(str(it.storeID).decode('asc...
python
def install(self): """ Called when installed on the user store. Installs my powerups. """ items = [] for typeName in self.types: it = self.store.findOrCreate(namedAny(typeName)) installOn(it, self.store) items.append(str(it.storeID).decode('asc...
[ "def", "install", "(", "self", ")", ":", "items", "=", "[", "]", "for", "typeName", "in", "self", ".", "types", ":", "it", "=", "self", ".", "store", ".", "findOrCreate", "(", "namedAny", "(", "typeName", ")", ")", "installOn", "(", "it", ",", "sel...
Called when installed on the user store. Installs my powerups.
[ "Called", "when", "installed", "on", "the", "user", "store", ".", "Installs", "my", "powerups", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/product.py#L97-L106
56,225
twisted/mantissa
xmantissa/product.py
Installation.uninstall
def uninstall(self): """ Called when uninstalled from the user store. Uninstalls all my powerups. """ for item in self.items: uninstallFrom(item, self.store) self._items = []
python
def uninstall(self): """ Called when uninstalled from the user store. Uninstalls all my powerups. """ for item in self.items: uninstallFrom(item, self.store) self._items = []
[ "def", "uninstall", "(", "self", ")", ":", "for", "item", "in", "self", ".", "items", ":", "uninstallFrom", "(", "item", ",", "self", ".", "store", ")", "self", ".", "_items", "=", "[", "]" ]
Called when uninstalled from the user store. Uninstalls all my powerups.
[ "Called", "when", "uninstalled", "from", "the", "user", "store", ".", "Uninstalls", "all", "my", "powerups", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/product.py#L108-L115
56,226
twisted/mantissa
xmantissa/product.py
ProductFragment.coerceProduct
def coerceProduct(self, **kw): """ Create a product and return a status string which should be part of a template. @param **kw: Fully qualified Python names for powerup types to associate with the created product. """ self.original.createProduct(filter(None, kw.v...
python
def coerceProduct(self, **kw): """ Create a product and return a status string which should be part of a template. @param **kw: Fully qualified Python names for powerup types to associate with the created product. """ self.original.createProduct(filter(None, kw.v...
[ "def", "coerceProduct", "(", "self", ",", "*", "*", "kw", ")", ":", "self", ".", "original", ".", "createProduct", "(", "filter", "(", "None", ",", "kw", ".", "values", "(", ")", ")", ")", "return", "u'Created.'" ]
Create a product and return a status string which should be part of a template. @param **kw: Fully qualified Python names for powerup types to associate with the created product.
[ "Create", "a", "product", "and", "return", "a", "status", "string", "which", "should", "be", "part", "of", "a", "template", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/product.py#L168-L177
56,227
jwodder/doapi
doapi/action.py
Action.fetch
def fetch(self): """ Fetch & return a new `Action` object representing the action's current state :rtype: Action :raises DOAPIError: if the API endpoint replies with an error """ api = self.doapi_manager return api._action(api.request(self.url)["action"])
python
def fetch(self): """ Fetch & return a new `Action` object representing the action's current state :rtype: Action :raises DOAPIError: if the API endpoint replies with an error """ api = self.doapi_manager return api._action(api.request(self.url)["action"])
[ "def", "fetch", "(", "self", ")", ":", "api", "=", "self", ".", "doapi_manager", "return", "api", ".", "_action", "(", "api", ".", "request", "(", "self", ".", "url", ")", "[", "\"action\"", "]", ")" ]
Fetch & return a new `Action` object representing the action's current state :rtype: Action :raises DOAPIError: if the API endpoint replies with an error
[ "Fetch", "&", "return", "a", "new", "Action", "object", "representing", "the", "action", "s", "current", "state" ]
b1306de86a01d8ae7b9c1fe2699765bb82e4f310
https://github.com/jwodder/doapi/blob/b1306de86a01d8ae7b9c1fe2699765bb82e4f310/doapi/action.py#L94-L103
56,228
jwodder/doapi
doapi/action.py
Action.wait
def wait(self, wait_interval=None, wait_time=None): """ Poll the server periodically until the action has either completed or errored out and return its final state. If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing the action's most recently fetched state) is raise...
python
def wait(self, wait_interval=None, wait_time=None): """ Poll the server periodically until the action has either completed or errored out and return its final state. If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing the action's most recently fetched state) is raise...
[ "def", "wait", "(", "self", ",", "wait_interval", "=", "None", ",", "wait_time", "=", "None", ")", ":", "return", "next", "(", "self", ".", "doapi_manager", ".", "wait_actions", "(", "[", "self", "]", ",", "wait_interval", ",", "wait_time", ")", ")" ]
Poll the server periodically until the action has either completed or errored out and return its final state. If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing the action's most recently fetched state) is raised. If a `KeyboardInterrupt` is caught, the action's most recent...
[ "Poll", "the", "server", "periodically", "until", "the", "action", "has", "either", "completed", "or", "errored", "out", "and", "return", "its", "final", "state", "." ]
b1306de86a01d8ae7b9c1fe2699765bb82e4f310
https://github.com/jwodder/doapi/blob/b1306de86a01d8ae7b9c1fe2699765bb82e4f310/doapi/action.py#L131-L158
56,229
twisted/mantissa
xmantissa/cachejs.py
CachedJSModule.wasModified
def wasModified(self): """ Check to see if this module has been modified on disk since the last time it was cached. @return: True if it has been modified, False if not. """ self.filePath.restat() mtime = self.filePath.getmtime() if mtime >= self.lastModif...
python
def wasModified(self): """ Check to see if this module has been modified on disk since the last time it was cached. @return: True if it has been modified, False if not. """ self.filePath.restat() mtime = self.filePath.getmtime() if mtime >= self.lastModif...
[ "def", "wasModified", "(", "self", ")", ":", "self", ".", "filePath", ".", "restat", "(", ")", "mtime", "=", "self", ".", "filePath", ".", "getmtime", "(", ")", "if", "mtime", ">=", "self", ".", "lastModified", ":", "return", "True", "else", ":", "re...
Check to see if this module has been modified on disk since the last time it was cached. @return: True if it has been modified, False if not.
[ "Check", "to", "see", "if", "this", "module", "has", "been", "modified", "on", "disk", "since", "the", "last", "time", "it", "was", "cached", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/cachejs.py#L45-L57
56,230
twisted/mantissa
xmantissa/cachejs.py
CachedJSModule.maybeUpdate
def maybeUpdate(self): """ Check this cache entry and update it if any filesystem information has changed. """ if self.wasModified(): self.lastModified = self.filePath.getmtime() self.fileContents = self.filePath.getContent() self.hashValue = h...
python
def maybeUpdate(self): """ Check this cache entry and update it if any filesystem information has changed. """ if self.wasModified(): self.lastModified = self.filePath.getmtime() self.fileContents = self.filePath.getContent() self.hashValue = h...
[ "def", "maybeUpdate", "(", "self", ")", ":", "if", "self", ".", "wasModified", "(", ")", ":", "self", ".", "lastModified", "=", "self", ".", "filePath", ".", "getmtime", "(", ")", "self", ".", "fileContents", "=", "self", ".", "filePath", ".", "getCont...
Check this cache entry and update it if any filesystem information has changed.
[ "Check", "this", "cache", "entry", "and", "update", "it", "if", "any", "filesystem", "information", "has", "changed", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/cachejs.py#L60-L68
56,231
twisted/mantissa
xmantissa/cachejs.py
HashedJSModuleProvider.getModule
def getModule(self, moduleName): """ Retrieve a JavaScript module cache from the file path cache. @returns: Module cache for the named module. @rtype: L{CachedJSModule} """ if moduleName not in self.moduleCache: modulePath = FilePath( athena.j...
python
def getModule(self, moduleName): """ Retrieve a JavaScript module cache from the file path cache. @returns: Module cache for the named module. @rtype: L{CachedJSModule} """ if moduleName not in self.moduleCache: modulePath = FilePath( athena.j...
[ "def", "getModule", "(", "self", ",", "moduleName", ")", ":", "if", "moduleName", "not", "in", "self", ".", "moduleCache", ":", "modulePath", "=", "FilePath", "(", "athena", ".", "jsDeps", ".", "getModuleForName", "(", "moduleName", ")", ".", "_cache", "."...
Retrieve a JavaScript module cache from the file path cache. @returns: Module cache for the named module. @rtype: L{CachedJSModule}
[ "Retrieve", "a", "JavaScript", "module", "cache", "from", "the", "file", "path", "cache", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/cachejs.py#L93-L107
56,232
rmed/pyemtmad
pyemtmad/util.py
check_result
def check_result(data, key=''): """Check the result of an API response. Ideally, this should be done by checking that the value of the ``resultCode`` attribute is 0, but there are endpoints that simply do not follow this rule. Args: data (dict): Response obtained from the API endpoint. ...
python
def check_result(data, key=''): """Check the result of an API response. Ideally, this should be done by checking that the value of the ``resultCode`` attribute is 0, but there are endpoints that simply do not follow this rule. Args: data (dict): Response obtained from the API endpoint. ...
[ "def", "check_result", "(", "data", ",", "key", "=", "''", ")", ":", "if", "not", "isinstance", "(", "data", ",", "dict", ")", ":", "return", "False", "if", "key", ":", "if", "key", "in", "data", ":", "return", "True", "return", "False", "if", "'re...
Check the result of an API response. Ideally, this should be done by checking that the value of the ``resultCode`` attribute is 0, but there are endpoints that simply do not follow this rule. Args: data (dict): Response obtained from the API endpoint. key (string): Key to check for existen...
[ "Check", "the", "result", "of", "an", "API", "response", "." ]
c21c42d0c7b50035dfed29540d7e64ab67833728
https://github.com/rmed/pyemtmad/blob/c21c42d0c7b50035dfed29540d7e64ab67833728/pyemtmad/util.py#L39-L69
56,233
rmed/pyemtmad
pyemtmad/util.py
datetime_string
def datetime_string(day, month, year, hour, minute): """Build a date string using the provided day, month, year numbers. Automatically adds a leading zero to ``day`` and ``month`` if they only have one digit. Args: day (int): Day number. month(int): Month number. year(int): Yea...
python
def datetime_string(day, month, year, hour, minute): """Build a date string using the provided day, month, year numbers. Automatically adds a leading zero to ``day`` and ``month`` if they only have one digit. Args: day (int): Day number. month(int): Month number. year(int): Yea...
[ "def", "datetime_string", "(", "day", ",", "month", ",", "year", ",", "hour", ",", "minute", ")", ":", "# Overflow", "if", "hour", "<", "0", "or", "hour", ">", "23", ":", "hour", "=", "0", "if", "minute", "<", "0", "or", "minute", ">", "60", ":",...
Build a date string using the provided day, month, year numbers. Automatically adds a leading zero to ``day`` and ``month`` if they only have one digit. Args: day (int): Day number. month(int): Month number. year(int): Year number. hour (int): Hour of the day in 24h format....
[ "Build", "a", "date", "string", "using", "the", "provided", "day", "month", "year", "numbers", "." ]
c21c42d0c7b50035dfed29540d7e64ab67833728
https://github.com/rmed/pyemtmad/blob/c21c42d0c7b50035dfed29540d7e64ab67833728/pyemtmad/util.py#L87-L107
56,234
rmed/pyemtmad
pyemtmad/util.py
response_list
def response_list(data, key): """Obtain the relevant response data in a list. If the response does not already contain the result in a list, a new one will be created to ease iteration in the parser methods. Args: data (dict): API response. key (str): Attribute of the response that con...
python
def response_list(data, key): """Obtain the relevant response data in a list. If the response does not already contain the result in a list, a new one will be created to ease iteration in the parser methods. Args: data (dict): API response. key (str): Attribute of the response that con...
[ "def", "response_list", "(", "data", ",", "key", ")", ":", "if", "key", "not", "in", "data", ":", "return", "None", "if", "isinstance", "(", "data", "[", "key", "]", ",", "list", ")", ":", "return", "data", "[", "key", "]", "else", ":", "return", ...
Obtain the relevant response data in a list. If the response does not already contain the result in a list, a new one will be created to ease iteration in the parser methods. Args: data (dict): API response. key (str): Attribute of the response that contains the result values. Returns...
[ "Obtain", "the", "relevant", "response", "data", "in", "a", "list", "." ]
c21c42d0c7b50035dfed29540d7e64ab67833728
https://github.com/rmed/pyemtmad/blob/c21c42d0c7b50035dfed29540d7e64ab67833728/pyemtmad/util.py#L154-L174
56,235
pudo/jsongraph
jsongraph/graph.py
Graph.base_uri
def base_uri(self): """ Resolution base for JSON schema. Also used as the default graph ID for RDF. """ if self._base_uri is None: if self._resolver is not None: self._base_uri = self.resolver.resolution_scope else: self._base_uri = 'http:/...
python
def base_uri(self): """ Resolution base for JSON schema. Also used as the default graph ID for RDF. """ if self._base_uri is None: if self._resolver is not None: self._base_uri = self.resolver.resolution_scope else: self._base_uri = 'http:/...
[ "def", "base_uri", "(", "self", ")", ":", "if", "self", ".", "_base_uri", "is", "None", ":", "if", "self", ".", "_resolver", "is", "not", "None", ":", "self", ".", "_base_uri", "=", "self", ".", "resolver", ".", "resolution_scope", "else", ":", "self",...
Resolution base for JSON schema. Also used as the default graph ID for RDF.
[ "Resolution", "base", "for", "JSON", "schema", ".", "Also", "used", "as", "the", "default", "graph", "ID", "for", "RDF", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L39-L47
56,236
pudo/jsongraph
jsongraph/graph.py
Graph.resolver
def resolver(self): """ Resolver for JSON Schema references. This can be based around a file or HTTP-based resolution base URI. """ if self._resolver is None: self._resolver = RefResolver(self.base_uri, {}) # if self.base_uri not in self._resolver.store: # self._re...
python
def resolver(self): """ Resolver for JSON Schema references. This can be based around a file or HTTP-based resolution base URI. """ if self._resolver is None: self._resolver = RefResolver(self.base_uri, {}) # if self.base_uri not in self._resolver.store: # self._re...
[ "def", "resolver", "(", "self", ")", ":", "if", "self", ".", "_resolver", "is", "None", ":", "self", ".", "_resolver", "=", "RefResolver", "(", "self", ".", "base_uri", ",", "{", "}", ")", "# if self.base_uri not in self._resolver.store:", "# self._resolver.s...
Resolver for JSON Schema references. This can be based around a file or HTTP-based resolution base URI.
[ "Resolver", "for", "JSON", "Schema", "references", ".", "This", "can", "be", "based", "around", "a", "file", "or", "HTTP", "-", "based", "resolution", "base", "URI", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L50-L57
56,237
pudo/jsongraph
jsongraph/graph.py
Graph.store
def store(self): """ Backend storage for RDF data. Either an in-memory store, or an external triple store controlled via SPARQL. """ if self._store is None: config = self.config.get('store', {}) if 'query' in config and 'update' in config: self._store = sp...
python
def store(self): """ Backend storage for RDF data. Either an in-memory store, or an external triple store controlled via SPARQL. """ if self._store is None: config = self.config.get('store', {}) if 'query' in config and 'update' in config: self._store = sp...
[ "def", "store", "(", "self", ")", ":", "if", "self", ".", "_store", "is", "None", ":", "config", "=", "self", ".", "config", ".", "get", "(", "'store'", ",", "{", "}", ")", "if", "'query'", "in", "config", "and", "'update'", "in", "config", ":", ...
Backend storage for RDF data. Either an in-memory store, or an external triple store controlled via SPARQL.
[ "Backend", "storage", "for", "RDF", "data", ".", "Either", "an", "in", "-", "memory", "store", "or", "an", "external", "triple", "store", "controlled", "via", "SPARQL", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L60-L71
56,238
pudo/jsongraph
jsongraph/graph.py
Graph.graph
def graph(self): """ A conjunctive graph of all statements in the current instance. """ if not hasattr(self, '_graph') or self._graph is None: self._graph = ConjunctiveGraph(store=self.store, identifier=self.base_uri) return self._graph
python
def graph(self): """ A conjunctive graph of all statements in the current instance. """ if not hasattr(self, '_graph') or self._graph is None: self._graph = ConjunctiveGraph(store=self.store, identifier=self.base_uri) return self._graph
[ "def", "graph", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_graph'", ")", "or", "self", ".", "_graph", "is", "None", ":", "self", ".", "_graph", "=", "ConjunctiveGraph", "(", "store", "=", "self", ".", "store", ",", "identifie...
A conjunctive graph of all statements in the current instance.
[ "A", "conjunctive", "graph", "of", "all", "statements", "in", "the", "current", "instance", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L74-L79
56,239
pudo/jsongraph
jsongraph/graph.py
Graph.buffered
def buffered(self): """ Whether write operations should be buffered, i.e. run against a local graph before being stored to the main data store. """ if 'buffered' not in self.config: return not isinstance(self.store, (Memory, IOMemory)) return self.config.get('buffered')
python
def buffered(self): """ Whether write operations should be buffered, i.e. run against a local graph before being stored to the main data store. """ if 'buffered' not in self.config: return not isinstance(self.store, (Memory, IOMemory)) return self.config.get('buffered')
[ "def", "buffered", "(", "self", ")", ":", "if", "'buffered'", "not", "in", "self", ".", "config", ":", "return", "not", "isinstance", "(", "self", ".", "store", ",", "(", "Memory", ",", "IOMemory", ")", ")", "return", "self", ".", "config", ".", "get...
Whether write operations should be buffered, i.e. run against a local graph before being stored to the main data store.
[ "Whether", "write", "operations", "should", "be", "buffered", "i", ".", "e", ".", "run", "against", "a", "local", "graph", "before", "being", "stored", "to", "the", "main", "data", "store", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L82-L87
56,240
pudo/jsongraph
jsongraph/graph.py
Graph.register
def register(self, alias, uri): """ Register a new schema URI under a given name. """ # TODO: do we want to constrain the valid alias names. if isinstance(uri, dict): id = uri.get('id', alias) self.resolver.store[id] = uri uri = id self.aliases[alias] ...
python
def register(self, alias, uri): """ Register a new schema URI under a given name. """ # TODO: do we want to constrain the valid alias names. if isinstance(uri, dict): id = uri.get('id', alias) self.resolver.store[id] = uri uri = id self.aliases[alias] ...
[ "def", "register", "(", "self", ",", "alias", ",", "uri", ")", ":", "# TODO: do we want to constrain the valid alias names.", "if", "isinstance", "(", "uri", ",", "dict", ")", ":", "id", "=", "uri", ".", "get", "(", "'id'", ",", "alias", ")", "self", ".", ...
Register a new schema URI under a given name.
[ "Register", "a", "new", "schema", "URI", "under", "a", "given", "name", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L95-L102
56,241
pudo/jsongraph
jsongraph/graph.py
Graph.get_uri
def get_uri(self, alias): """ Get the URI for a given alias. A registered URI will return itself, otherwise ``None`` is returned. """ if alias in self.aliases.keys(): return self.aliases[alias] if alias in self.aliases.values(): return alias raise GraphExc...
python
def get_uri(self, alias): """ Get the URI for a given alias. A registered URI will return itself, otherwise ``None`` is returned. """ if alias in self.aliases.keys(): return self.aliases[alias] if alias in self.aliases.values(): return alias raise GraphExc...
[ "def", "get_uri", "(", "self", ",", "alias", ")", ":", "if", "alias", "in", "self", ".", "aliases", ".", "keys", "(", ")", ":", "return", "self", ".", "aliases", "[", "alias", "]", "if", "alias", "in", "self", ".", "aliases", ".", "values", "(", ...
Get the URI for a given alias. A registered URI will return itself, otherwise ``None`` is returned.
[ "Get", "the", "URI", "for", "a", "given", "alias", ".", "A", "registered", "URI", "will", "return", "itself", "otherwise", "None", "is", "returned", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L104-L111
56,242
pudo/jsongraph
jsongraph/util.py
is_url
def is_url(text): """ Check if the given text looks like a URL. """ if text is None: return False text = text.lower() return text.startswith('http://') or text.startswith('https://') or \ text.startswith('urn:') or text.startswith('file://')
python
def is_url(text): """ Check if the given text looks like a URL. """ if text is None: return False text = text.lower() return text.startswith('http://') or text.startswith('https://') or \ text.startswith('urn:') or text.startswith('file://')
[ "def", "is_url", "(", "text", ")", ":", "if", "text", "is", "None", ":", "return", "False", "text", "=", "text", ".", "lower", "(", ")", "return", "text", ".", "startswith", "(", "'http://'", ")", "or", "text", ".", "startswith", "(", "'https://'", "...
Check if the given text looks like a URL.
[ "Check", "if", "the", "given", "text", "looks", "like", "a", "URL", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/util.py#L5-L11
56,243
pudo/jsongraph
jsongraph/util.py
safe_uriref
def safe_uriref(text): """ Escape a URL properly. """ url_ = url.parse(text).sanitize().deuserinfo().canonical() return URIRef(url_.punycode().unicode())
python
def safe_uriref(text): """ Escape a URL properly. """ url_ = url.parse(text).sanitize().deuserinfo().canonical() return URIRef(url_.punycode().unicode())
[ "def", "safe_uriref", "(", "text", ")", ":", "url_", "=", "url", ".", "parse", "(", "text", ")", ".", "sanitize", "(", ")", ".", "deuserinfo", "(", ")", ".", "canonical", "(", ")", "return", "URIRef", "(", "url_", ".", "punycode", "(", ")", ".", ...
Escape a URL properly.
[ "Escape", "a", "URL", "properly", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/util.py#L14-L17
56,244
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.computePointing
def computePointing(self, ra_deg, dec_deg, roll_deg, cartesian=False): """Compute a pointing model without changing the internal object pointing""" # Roll FOV Rrotate = r.rotateInXMat(roll_deg) # Roll # Slew from ra/dec of zero Ra = r.rightAscensionRotationMatrix(ra_deg) ...
python
def computePointing(self, ra_deg, dec_deg, roll_deg, cartesian=False): """Compute a pointing model without changing the internal object pointing""" # Roll FOV Rrotate = r.rotateInXMat(roll_deg) # Roll # Slew from ra/dec of zero Ra = r.rightAscensionRotationMatrix(ra_deg) ...
[ "def", "computePointing", "(", "self", ",", "ra_deg", ",", "dec_deg", ",", "roll_deg", ",", "cartesian", "=", "False", ")", ":", "# Roll FOV", "Rrotate", "=", "r", ".", "rotateInXMat", "(", "roll_deg", ")", "# Roll", "# Slew from ra/dec of zero", "Ra", "=", ...
Compute a pointing model without changing the internal object pointing
[ "Compute", "a", "pointing", "model", "without", "changing", "the", "internal", "object", "pointing" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L153-L171
56,245
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.getRaDecs
def getRaDecs(self, mods): """Internal function converting cartesian coords to ra dec""" raDecOut = np.empty( (len(mods), 5)) raDecOut[:,0:3] = mods[:,0:3] for i, row in enumerate(mods): raDecOut[i, 3:5] = r.raDecFromVec(row[3:6]) return raDecOut
python
def getRaDecs(self, mods): """Internal function converting cartesian coords to ra dec""" raDecOut = np.empty( (len(mods), 5)) raDecOut[:,0:3] = mods[:,0:3] for i, row in enumerate(mods): raDecOut[i, 3:5] = r.raDecFromVec(row[3:6]) return raDecOut
[ "def", "getRaDecs", "(", "self", ",", "mods", ")", ":", "raDecOut", "=", "np", ".", "empty", "(", "(", "len", "(", "mods", ")", ",", "5", ")", ")", "raDecOut", "[", ":", ",", "0", ":", "3", "]", "=", "mods", "[", ":", ",", "0", ":", "3", ...
Internal function converting cartesian coords to ra dec
[ "Internal", "function", "converting", "cartesian", "coords", "to", "ra", "dec" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L173-L181
56,246
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.isOnSilicon
def isOnSilicon(self, ra_deg, dec_deg, padding_pix=DEFAULT_PADDING): """Returns True if the given location is observable with a science CCD. Parameters ---------- ra_deg : float Right Ascension (J2000) in decimal degrees. dec_deg : float Declination (J20...
python
def isOnSilicon(self, ra_deg, dec_deg, padding_pix=DEFAULT_PADDING): """Returns True if the given location is observable with a science CCD. Parameters ---------- ra_deg : float Right Ascension (J2000) in decimal degrees. dec_deg : float Declination (J20...
[ "def", "isOnSilicon", "(", "self", ",", "ra_deg", ",", "dec_deg", ",", "padding_pix", "=", "DEFAULT_PADDING", ")", ":", "ch", ",", "col", ",", "row", "=", "self", ".", "getChannelColRow", "(", "ra_deg", ",", "dec_deg", ")", "# Modules 3 and 7 are no longer ope...
Returns True if the given location is observable with a science CCD. Parameters ---------- ra_deg : float Right Ascension (J2000) in decimal degrees. dec_deg : float Declination (J2000) in decimal degrees. padding : float Objects <= this ma...
[ "Returns", "True", "if", "the", "given", "location", "is", "observable", "with", "a", "science", "CCD", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L302-L327
56,247
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.getAllChannelsAsPolygons
def getAllChannelsAsPolygons(self, maptype=None): """Return slew the telescope and return the corners of the modules as Polygon objects. If a projection is supplied, the ras and decs are mapped onto x, y using that projection """ polyList = [] for ch in self.orig...
python
def getAllChannelsAsPolygons(self, maptype=None): """Return slew the telescope and return the corners of the modules as Polygon objects. If a projection is supplied, the ras and decs are mapped onto x, y using that projection """ polyList = [] for ch in self.orig...
[ "def", "getAllChannelsAsPolygons", "(", "self", ",", "maptype", "=", "None", ")", ":", "polyList", "=", "[", "]", "for", "ch", "in", "self", ".", "origin", "[", ":", ",", "2", "]", ":", "poly", "=", "self", ".", "getChannelAsPolygon", "(", "ch", ",",...
Return slew the telescope and return the corners of the modules as Polygon objects. If a projection is supplied, the ras and decs are mapped onto x, y using that projection
[ "Return", "slew", "the", "telescope", "and", "return", "the", "corners", "of", "the", "modules", "as", "Polygon", "objects", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L537-L548
56,248
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.plotPointing
def plotPointing(self, maptype=None, colour='b', mod3='r', showOuts=True, **kwargs): """Plot the FOV """ if maptype is None: maptype=self.defaultMap radec = self.currentRaDec for ch in radec[:,2][::4]: idx = np.where(radec[:,2].astype(np.int) == ch)[0] ...
python
def plotPointing(self, maptype=None, colour='b', mod3='r', showOuts=True, **kwargs): """Plot the FOV """ if maptype is None: maptype=self.defaultMap radec = self.currentRaDec for ch in radec[:,2][::4]: idx = np.where(radec[:,2].astype(np.int) == ch)[0] ...
[ "def", "plotPointing", "(", "self", ",", "maptype", "=", "None", ",", "colour", "=", "'b'", ",", "mod3", "=", "'r'", ",", "showOuts", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "maptype", "is", "None", ":", "maptype", "=", "self", ".", ...
Plot the FOV
[ "Plot", "the", "FOV" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L568-L587
56,249
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.plotOutline
def plotOutline(self, maptype=None, colour='#AAAAAA', **kwargs): """Plot an outline of the FOV. """ if maptype is None: maptype=self.defaultMap xarr = [] yarr = [] radec = self.currentRaDec for ch in [20,4,11,28,32, 71,68, 84, 75, 60, 56, 15 ]: ...
python
def plotOutline(self, maptype=None, colour='#AAAAAA', **kwargs): """Plot an outline of the FOV. """ if maptype is None: maptype=self.defaultMap xarr = [] yarr = [] radec = self.currentRaDec for ch in [20,4,11,28,32, 71,68, 84, 75, 60, 56, 15 ]: ...
[ "def", "plotOutline", "(", "self", ",", "maptype", "=", "None", ",", "colour", "=", "'#AAAAAA'", ",", "*", "*", "kwargs", ")", ":", "if", "maptype", "is", "None", ":", "maptype", "=", "self", ".", "defaultMap", "xarr", "=", "[", "]", "yarr", "=", "...
Plot an outline of the FOV.
[ "Plot", "an", "outline", "of", "the", "FOV", "." ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L590-L615
56,250
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.plotSpacecraftYAxis
def plotSpacecraftYAxis(self, maptype=None): """Plot a line pointing in the direction of the spacecraft y-axis (i.e normal to the solar panel """ if maptype is None: maptype=self.defaultMap #Plot direction of spacecraft +y axis. The subtraction of #90 degrees...
python
def plotSpacecraftYAxis(self, maptype=None): """Plot a line pointing in the direction of the spacecraft y-axis (i.e normal to the solar panel """ if maptype is None: maptype=self.defaultMap #Plot direction of spacecraft +y axis. The subtraction of #90 degrees...
[ "def", "plotSpacecraftYAxis", "(", "self", ",", "maptype", "=", "None", ")", ":", "if", "maptype", "is", "None", ":", "maptype", "=", "self", ".", "defaultMap", "#Plot direction of spacecraft +y axis. The subtraction of", "#90 degrees accounts for the different defintions o...
Plot a line pointing in the direction of the spacecraft y-axis (i.e normal to the solar panel
[ "Plot", "a", "line", "pointing", "in", "the", "direction", "of", "the", "spacecraft", "y", "-", "axis", "(", "i", ".", "e", "normal", "to", "the", "solar", "panel" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L618-L634
56,251
KeplerGO/K2fov
K2fov/fov.py
KeplerFov.plotChIds
def plotChIds(self, maptype=None, modout=False): """Print the channel numbers on the plotting display Note: --------- This method will behave poorly if you are plotting in mixed projections. Because the channel vertex polygons are already projected using self.defaultMap,...
python
def plotChIds(self, maptype=None, modout=False): """Print the channel numbers on the plotting display Note: --------- This method will behave poorly if you are plotting in mixed projections. Because the channel vertex polygons are already projected using self.defaultMap,...
[ "def", "plotChIds", "(", "self", ",", "maptype", "=", "None", ",", "modout", "=", "False", ")", ":", "if", "maptype", "is", "None", ":", "maptype", "=", "self", ".", "defaultMap", "polyList", "=", "self", ".", "getAllChannelsAsPolygons", "(", "maptype", ...
Print the channel numbers on the plotting display Note: --------- This method will behave poorly if you are plotting in mixed projections. Because the channel vertex polygons are already projected using self.defaultMap, applying this function when plotting in a different...
[ "Print", "the", "channel", "numbers", "on", "the", "plotting", "display" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L637-L653
56,252
KeplerGO/K2fov
K2fov/fov.py
Polygon.isPointInside
def isPointInside(self, xp, yp): """Is the given point inside the polygon? Input: ------------ xp, yp (floats) Coordinates of point in same units that array vertices are specified when object created. Returns: ----------- **True** / **Fals...
python
def isPointInside(self, xp, yp): """Is the given point inside the polygon? Input: ------------ xp, yp (floats) Coordinates of point in same units that array vertices are specified when object created. Returns: ----------- **True** / **Fals...
[ "def", "isPointInside", "(", "self", ",", "xp", ",", "yp", ")", ":", "point", "=", "np", ".", "array", "(", "[", "xp", ",", "yp", "]", ")", ".", "transpose", "(", ")", "polygon", "=", "self", ".", "polygon", "numVert", ",", "numDim", "=", "polygo...
Is the given point inside the polygon? Input: ------------ xp, yp (floats) Coordinates of point in same units that array vertices are specified when object created. Returns: ----------- **True** / **False**
[ "Is", "the", "given", "point", "inside", "the", "polygon?" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L728-L754
56,253
KeplerGO/K2fov
K2fov/fov.py
Polygon.draw
def draw(self, **kwargs): """Draw the polygon Optional Inputs: ------------ All optional inputs are passed to ``matplotlib.patches.Polygon`` Notes: --------- Does not accept maptype as an argument. """ ax = mp.gca() shape = matplotlib.pa...
python
def draw(self, **kwargs): """Draw the polygon Optional Inputs: ------------ All optional inputs are passed to ``matplotlib.patches.Polygon`` Notes: --------- Does not accept maptype as an argument. """ ax = mp.gca() shape = matplotlib.pa...
[ "def", "draw", "(", "self", ",", "*", "*", "kwargs", ")", ":", "ax", "=", "mp", ".", "gca", "(", ")", "shape", "=", "matplotlib", ".", "patches", ".", "Polygon", "(", "self", ".", "polygon", ",", "*", "*", "kwargs", ")", "ax", ".", "add_artist", ...
Draw the polygon Optional Inputs: ------------ All optional inputs are passed to ``matplotlib.patches.Polygon`` Notes: --------- Does not accept maptype as an argument.
[ "Draw", "the", "polygon" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/fov.py#L756-L770
56,254
p3trus/slave
slave/protocol.py
IEC60488.parse_response
def parse_response(self, response, header=None): """Parses the response message. The following graph shows the structure of response messages. :: +----------+ +--+ data sep +<-+ ...
python
def parse_response(self, response, header=None): """Parses the response message. The following graph shows the structure of response messages. :: +----------+ +--+ data sep +<-+ ...
[ "def", "parse_response", "(", "self", ",", "response", ",", "header", "=", "None", ")", ":", "response", "=", "response", ".", "decode", "(", "self", ".", "encoding", ")", "if", "header", ":", "header", "=", "\"\"", ".", "join", "(", "(", "self", "."...
Parses the response message. The following graph shows the structure of response messages. :: +----------+ +--+ data sep +<-+ | +---------...
[ "Parses", "the", "response", "message", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/protocol.py#L117-L147
56,255
p3trus/slave
slave/protocol.py
IEC60488.trigger
def trigger(self, transport): """Triggers the transport.""" logger.debug('IEC60488 trigger') with transport: try: transport.trigger() except AttributeError: trigger_msg = self.create_message('*TRG') transport.write(trigger_m...
python
def trigger(self, transport): """Triggers the transport.""" logger.debug('IEC60488 trigger') with transport: try: transport.trigger() except AttributeError: trigger_msg = self.create_message('*TRG') transport.write(trigger_m...
[ "def", "trigger", "(", "self", ",", "transport", ")", ":", "logger", ".", "debug", "(", "'IEC60488 trigger'", ")", "with", "transport", ":", "try", ":", "transport", ".", "trigger", "(", ")", "except", "AttributeError", ":", "trigger_msg", "=", "self", "."...
Triggers the transport.
[ "Triggers", "the", "transport", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/protocol.py#L167-L175
56,256
p3trus/slave
slave/protocol.py
IEC60488.clear
def clear(self, transport): """Issues a device clear command.""" logger.debug('IEC60488 clear') with transport: try: transport.clear() except AttributeError: clear_msg = self.create_message('*CLS') transport.write(clear_msg)
python
def clear(self, transport): """Issues a device clear command.""" logger.debug('IEC60488 clear') with transport: try: transport.clear() except AttributeError: clear_msg = self.create_message('*CLS') transport.write(clear_msg)
[ "def", "clear", "(", "self", ",", "transport", ")", ":", "logger", ".", "debug", "(", "'IEC60488 clear'", ")", "with", "transport", ":", "try", ":", "transport", ".", "clear", "(", ")", "except", "AttributeError", ":", "clear_msg", "=", "self", ".", "cre...
Issues a device clear command.
[ "Issues", "a", "device", "clear", "command", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/protocol.py#L177-L185
56,257
p3trus/slave
slave/protocol.py
SignalRecovery.query_bytes
def query_bytes(self, transport, num_bytes, header, *data): """Queries for binary data :param transport: A transport object. :param num_bytes: The exact number of data bytes expected. :param header: The message header. :param data: Optional data. :returns: The raw unpar...
python
def query_bytes(self, transport, num_bytes, header, *data): """Queries for binary data :param transport: A transport object. :param num_bytes: The exact number of data bytes expected. :param header: The message header. :param data: Optional data. :returns: The raw unpar...
[ "def", "query_bytes", "(", "self", ",", "transport", ",", "num_bytes", ",", "header", ",", "*", "data", ")", ":", "message", "=", "self", ".", "create_message", "(", "header", ",", "*", "data", ")", "logger", ".", "debug", "(", "'SignalRecovery query bytes...
Queries for binary data :param transport: A transport object. :param num_bytes: The exact number of data bytes expected. :param header: The message header. :param data: Optional data. :returns: The raw unparsed data bytearray.
[ "Queries", "for", "binary", "data" ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/protocol.py#L263-L287
56,258
KeplerGO/K2fov
K2fov/rotate.py
rotateAroundVector
def rotateAroundVector(v1, w, theta_deg): """Rotate vector v1 by an angle theta around w Taken from https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation (see Section "Rotating a vector") Notes: Rotating the x axis 90 degrees about the y axis gives -z Rotating the x axis 90 degrees a...
python
def rotateAroundVector(v1, w, theta_deg): """Rotate vector v1 by an angle theta around w Taken from https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation (see Section "Rotating a vector") Notes: Rotating the x axis 90 degrees about the y axis gives -z Rotating the x axis 90 degrees a...
[ "def", "rotateAroundVector", "(", "v1", ",", "w", ",", "theta_deg", ")", ":", "ct", "=", "np", ".", "cos", "(", "np", ".", "radians", "(", "theta_deg", ")", ")", "st", "=", "np", ".", "sin", "(", "np", ".", "radians", "(", "theta_deg", ")", ")", ...
Rotate vector v1 by an angle theta around w Taken from https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation (see Section "Rotating a vector") Notes: Rotating the x axis 90 degrees about the y axis gives -z Rotating the x axis 90 degrees about the z axis gives +y
[ "Rotate", "vector", "v1", "by", "an", "angle", "theta", "around", "w" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/rotate.py#L69-L87
56,259
KeplerGO/K2fov
K2fov/rotate.py
rotateInDeclination
def rotateInDeclination(v1, theta_deg): """Rotation is chosen so a rotation of 90 degrees from zenith ends up at ra=0, dec=0""" axis = np.array([0,-1,0]) return rotateAroundVector(v1, axis, theta_deg)
python
def rotateInDeclination(v1, theta_deg): """Rotation is chosen so a rotation of 90 degrees from zenith ends up at ra=0, dec=0""" axis = np.array([0,-1,0]) return rotateAroundVector(v1, axis, theta_deg)
[ "def", "rotateInDeclination", "(", "v1", ",", "theta_deg", ")", ":", "axis", "=", "np", ".", "array", "(", "[", "0", ",", "-", "1", ",", "0", "]", ")", "return", "rotateAroundVector", "(", "v1", ",", "axis", ",", "theta_deg", ")" ]
Rotation is chosen so a rotation of 90 degrees from zenith ends up at ra=0, dec=0
[ "Rotation", "is", "chosen", "so", "a", "rotation", "of", "90", "degrees", "from", "zenith", "ends", "up", "at", "ra", "=", "0", "dec", "=", "0" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/rotate.py#L90-L94
56,260
p3trus/slave
slave/cryomagnetics/mps4g.py
MPS4G.sweep
def sweep(self, mode, speed=None): """Starts the output current sweep. :param mode: The sweep mode. Valid entries are `'UP'`, `'DOWN'`, `'PAUSE'`or `'ZERO'`. If in shim mode, `'LIMIT'` is valid as well. :param speed: The sweeping speed. Valid entries are `'FAST'`, `'SLOW'` ...
python
def sweep(self, mode, speed=None): """Starts the output current sweep. :param mode: The sweep mode. Valid entries are `'UP'`, `'DOWN'`, `'PAUSE'`or `'ZERO'`. If in shim mode, `'LIMIT'` is valid as well. :param speed: The sweeping speed. Valid entries are `'FAST'`, `'SLOW'` ...
[ "def", "sweep", "(", "self", ",", "mode", ",", "speed", "=", "None", ")", ":", "sweep_modes", "=", "[", "'UP'", ",", "'DOWN'", ",", "'PAUSE'", ",", "'ZERO'", ",", "'LIMIT'", "]", "sweep_speed", "=", "[", "'SLOW'", ",", "'FAST'", ",", "None", "]", "...
Starts the output current sweep. :param mode: The sweep mode. Valid entries are `'UP'`, `'DOWN'`, `'PAUSE'`or `'ZERO'`. If in shim mode, `'LIMIT'` is valid as well. :param speed: The sweeping speed. Valid entries are `'FAST'`, `'SLOW'` or `None`.
[ "Starts", "the", "output", "current", "sweep", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/cryomagnetics/mps4g.py#L224-L242
56,261
vladcalin/gemstone
gemstone/event/transport/base.py
BaseEventTransport.run_on_main_thread
def run_on_main_thread(self, func, args=None, kwargs=None): """ Runs the ``func`` callable on the main thread, by using the provided microservice instance's IOLoop. :param func: callable to run on the main thread :param args: tuple or list with the positional arguments. ...
python
def run_on_main_thread(self, func, args=None, kwargs=None): """ Runs the ``func`` callable on the main thread, by using the provided microservice instance's IOLoop. :param func: callable to run on the main thread :param args: tuple or list with the positional arguments. ...
[ "def", "run_on_main_thread", "(", "self", ",", "func", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "not", "args", ":", "args", "=", "(", ")", "if", "not", "kwargs", ":", "kwargs", "=", "{", "}", "self", ".", "microservice"...
Runs the ``func`` callable on the main thread, by using the provided microservice instance's IOLoop. :param func: callable to run on the main thread :param args: tuple or list with the positional arguments. :param kwargs: dict with the keyword arguments. :return:
[ "Runs", "the", "func", "callable", "on", "the", "main", "thread", "by", "using", "the", "provided", "microservice", "instance", "s", "IOLoop", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/event/transport/base.py#L69-L83
56,262
KeplerGO/K2fov
K2fov/rotate2.py
rotateAboutVectorMatrix
def rotateAboutVectorMatrix(vec, theta_deg): """Construct the matrix that rotates vector a about vector vec by an angle of theta_deg degrees Taken from http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle Input: theta_deg (float) Angle through which vectors should...
python
def rotateAboutVectorMatrix(vec, theta_deg): """Construct the matrix that rotates vector a about vector vec by an angle of theta_deg degrees Taken from http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle Input: theta_deg (float) Angle through which vectors should...
[ "def", "rotateAboutVectorMatrix", "(", "vec", ",", "theta_deg", ")", ":", "ct", "=", "np", ".", "cos", "(", "np", ".", "radians", "(", "theta_deg", ")", ")", "st", "=", "np", ".", "sin", "(", "np", ".", "radians", "(", "theta_deg", ")", ")", "# Ens...
Construct the matrix that rotates vector a about vector vec by an angle of theta_deg degrees Taken from http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle Input: theta_deg (float) Angle through which vectors should be rotated in degrees Returns:...
[ "Construct", "the", "matrix", "that", "rotates", "vector", "a", "about", "vector", "vec", "by", "an", "angle", "of", "theta_deg", "degrees" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/rotate2.py#L128-L171
56,263
KeplerGO/K2fov
K2fov/rotate2.py
rotateInZMat
def rotateInZMat(theta_deg): """Rotate a vector theta degrees around the z-axis Equivalent to yaw left Rotates the vector in the sense that the x-axis is rotated towards the y-axis. If looking along the z-axis (which is not the way you usually look at it), the vector rotates clockwise. If...
python
def rotateInZMat(theta_deg): """Rotate a vector theta degrees around the z-axis Equivalent to yaw left Rotates the vector in the sense that the x-axis is rotated towards the y-axis. If looking along the z-axis (which is not the way you usually look at it), the vector rotates clockwise. If...
[ "def", "rotateInZMat", "(", "theta_deg", ")", ":", "ct", "=", "np", ".", "cos", "(", "np", ".", "radians", "(", "theta_deg", ")", ")", "st", "=", "np", ".", "sin", "(", "np", ".", "radians", "(", "theta_deg", ")", ")", "rMat", "=", "np", ".", "...
Rotate a vector theta degrees around the z-axis Equivalent to yaw left Rotates the vector in the sense that the x-axis is rotated towards the y-axis. If looking along the z-axis (which is not the way you usually look at it), the vector rotates clockwise. If sitting on the vector [1,0,0], the ...
[ "Rotate", "a", "vector", "theta", "degrees", "around", "the", "z", "-", "axis" ]
fb122b35687340e0357cba9e0dd47b3be0760693
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/rotate2.py#L174-L205
56,264
llazzaro/analyzerdam
analyzerdam/sqlDAM.py
SqlDAM.getReadSession
def getReadSession(self): ''' return scopted session ''' if self.ReadSession is None: self.ReadSession=scoped_session(sessionmaker(bind=self.engine)) return self.ReadSession
python
def getReadSession(self): ''' return scopted session ''' if self.ReadSession is None: self.ReadSession=scoped_session(sessionmaker(bind=self.engine)) return self.ReadSession
[ "def", "getReadSession", "(", "self", ")", ":", "if", "self", ".", "ReadSession", "is", "None", ":", "self", ".", "ReadSession", "=", "scoped_session", "(", "sessionmaker", "(", "bind", "=", "self", ".", "engine", ")", ")", "return", "self", ".", "ReadSe...
return scopted session
[ "return", "scopted", "session" ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/sqlDAM.py#L56-L61
56,265
llazzaro/analyzerdam
analyzerdam/sqlDAM.py
SqlDAM.readTupleQuotes
def readTupleQuotes(self, symbol, start, end): ''' read quotes as tuple ''' if end is None: end=sys.maxint session=self.getReadSession()() try: rows=session.query(Quote).filter(and_(Quote.symbol == symbol, ...
python
def readTupleQuotes(self, symbol, start, end): ''' read quotes as tuple ''' if end is None: end=sys.maxint session=self.getReadSession()() try: rows=session.query(Quote).filter(and_(Quote.symbol == symbol, ...
[ "def", "readTupleQuotes", "(", "self", ",", "symbol", ",", "start", ",", "end", ")", ":", "if", "end", "is", "None", ":", "end", "=", "sys", ".", "maxint", "session", "=", "self", ".", "getReadSession", "(", ")", "(", ")", "try", ":", "rows", "=", ...
read quotes as tuple
[ "read", "quotes", "as", "tuple" ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/sqlDAM.py#L86-L99
56,266
llazzaro/analyzerdam
analyzerdam/sqlDAM.py
SqlDAM.readBatchTupleQuotes
def readBatchTupleQuotes(self, symbols, start, end): ''' read batch quotes as tuple to save memory ''' if end is None: end=sys.maxint ret={} session=self.getReadSession()() try: symbolChunks=splitListEqually(symbols, 100) ...
python
def readBatchTupleQuotes(self, symbols, start, end): ''' read batch quotes as tuple to save memory ''' if end is None: end=sys.maxint ret={} session=self.getReadSession()() try: symbolChunks=splitListEqually(symbols, 100) ...
[ "def", "readBatchTupleQuotes", "(", "self", ",", "symbols", ",", "start", ",", "end", ")", ":", "if", "end", "is", "None", ":", "end", "=", "sys", ".", "maxint", "ret", "=", "{", "}", "session", "=", "self", ".", "getReadSession", "(", ")", "(", ")...
read batch quotes as tuple to save memory
[ "read", "batch", "quotes", "as", "tuple", "to", "save", "memory" ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/sqlDAM.py#L101-L126
56,267
llazzaro/analyzerdam
analyzerdam/sqlDAM.py
SqlDAM.read_tuple_ticks
def read_tuple_ticks(self, symbol, start, end): ''' read ticks as tuple ''' if end is None: end=sys.maxint session=self.getReadSession()() try: rows=session.query(Tick).filter(and_(Tick.symbol == symbol, ...
python
def read_tuple_ticks(self, symbol, start, end): ''' read ticks as tuple ''' if end is None: end=sys.maxint session=self.getReadSession()() try: rows=session.query(Tick).filter(and_(Tick.symbol == symbol, ...
[ "def", "read_tuple_ticks", "(", "self", ",", "symbol", ",", "start", ",", "end", ")", ":", "if", "end", "is", "None", ":", "end", "=", "sys", ".", "maxint", "session", "=", "self", ".", "getReadSession", "(", ")", "(", ")", "try", ":", "rows", "=",...
read ticks as tuple
[ "read", "ticks", "as", "tuple" ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/sqlDAM.py#L128-L141
56,268
llazzaro/analyzerdam
analyzerdam/sqlDAM.py
SqlDAM._fundamentalToSqls
def _fundamentalToSqls(self, symbol, keyTimeValueDict): ''' convert fundament dict to sqls ''' sqls=[] for key, timeValues in keyTimeValueDict.iteritems(): for timeStamp, value in timeValues.iteritems(): sqls.append(FmSql(symbol, key, timeStamp, value)) ...
python
def _fundamentalToSqls(self, symbol, keyTimeValueDict): ''' convert fundament dict to sqls ''' sqls=[] for key, timeValues in keyTimeValueDict.iteritems(): for timeStamp, value in timeValues.iteritems(): sqls.append(FmSql(symbol, key, timeStamp, value)) ...
[ "def", "_fundamentalToSqls", "(", "self", ",", "symbol", ",", "keyTimeValueDict", ")", ":", "sqls", "=", "[", "]", "for", "key", ",", "timeValues", "in", "keyTimeValueDict", ".", "iteritems", "(", ")", ":", "for", "timeStamp", ",", "value", "in", "timeValu...
convert fundament dict to sqls
[ "convert", "fundament", "dict", "to", "sqls" ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/sqlDAM.py#L208-L215
56,269
p3trus/slave
slave/lakeshore/ls340.py
Curve.delete
def delete(self): """Deletes the current curve. :raises RuntimeError: Raises when` when one tries to delete a read-only curve. """ if self._writeable: self._write(('CRVDEL', Integer), self.idx) else: raise RuntimeError('Can not delete read-on...
python
def delete(self): """Deletes the current curve. :raises RuntimeError: Raises when` when one tries to delete a read-only curve. """ if self._writeable: self._write(('CRVDEL', Integer), self.idx) else: raise RuntimeError('Can not delete read-on...
[ "def", "delete", "(", "self", ")", ":", "if", "self", ".", "_writeable", ":", "self", ".", "_write", "(", "(", "'CRVDEL'", ",", "Integer", ")", ",", "self", ".", "idx", ")", "else", ":", "raise", "RuntimeError", "(", "'Can not delete read-only curves.'", ...
Deletes the current curve. :raises RuntimeError: Raises when` when one tries to delete a read-only curve.
[ "Deletes", "the", "current", "curve", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/lakeshore/ls340.py#L163-L173
56,270
p3trus/slave
slave/lakeshore/ls340.py
Program.line
def line(self, idx): """Return the i'th program line. :param i: The i'th program line. """ # TODO: We should parse the response properly. return self._query(('PGM?', [Integer, Integer], String), self.idx, idx)
python
def line(self, idx): """Return the i'th program line. :param i: The i'th program line. """ # TODO: We should parse the response properly. return self._query(('PGM?', [Integer, Integer], String), self.idx, idx)
[ "def", "line", "(", "self", ",", "idx", ")", ":", "# TODO: We should parse the response properly.", "return", "self", ".", "_query", "(", "(", "'PGM?'", ",", "[", "Integer", ",", "Integer", "]", ",", "String", ")", ",", "self", ".", "idx", ",", "idx", ")...
Return the i'th program line. :param i: The i'th program line.
[ "Return", "the", "i", "th", "program", "line", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/lakeshore/ls340.py#L419-L426
56,271
p3trus/slave
slave/lakeshore/ls340.py
Program.append_line
def append_line(self, new_line): """Appends the new_line to the LS340 program.""" # TODO: The user still has to write the raw line, this is error prone. self._write(('PGM', [Integer, String]), self.idx, new_line)
python
def append_line(self, new_line): """Appends the new_line to the LS340 program.""" # TODO: The user still has to write the raw line, this is error prone. self._write(('PGM', [Integer, String]), self.idx, new_line)
[ "def", "append_line", "(", "self", ",", "new_line", ")", ":", "# TODO: The user still has to write the raw line, this is error prone.", "self", ".", "_write", "(", "(", "'PGM'", ",", "[", "Integer", ",", "String", "]", ")", ",", "self", ".", "idx", ",", "new_lin...
Appends the new_line to the LS340 program.
[ "Appends", "the", "new_line", "to", "the", "LS340", "program", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/lakeshore/ls340.py#L428-L431
56,272
p3trus/slave
slave/lakeshore/ls340.py
LS340.softcal
def softcal(self, std, dest, serial, T1, U1, T2, U2, T3=None, U3=None): """Generates a softcal curve. :param std: The standard curve index used to calculate the softcal curve. Valid entries are 1-20 :param dest: The user curve index where the softcal curve is stored. Val...
python
def softcal(self, std, dest, serial, T1, U1, T2, U2, T3=None, U3=None): """Generates a softcal curve. :param std: The standard curve index used to calculate the softcal curve. Valid entries are 1-20 :param dest: The user curve index where the softcal curve is stored. Val...
[ "def", "softcal", "(", "self", ",", "std", ",", "dest", ",", "serial", ",", "T1", ",", "U1", ",", "T2", ",", "U2", ",", "T3", "=", "None", ",", "U3", "=", "None", ")", ":", "args", "=", "[", "std", ",", "dest", ",", "serial", ",", "T1", ","...
Generates a softcal curve. :param std: The standard curve index used to calculate the softcal curve. Valid entries are 1-20 :param dest: The user curve index where the softcal curve is stored. Valid entries are 21-60. :param serial: The serial number of the new curve. A ...
[ "Generates", "a", "softcal", "curve", "." ]
bdc74e73bd0f47b74a090c43aa2283c469cde3be
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/lakeshore/ls340.py#L899-L921
56,273
twisted/mantissa
xmantissa/people.py
VIPPersonContactType.getParameters
def getParameters(self, contactItem): """ Return a list containing a single parameter suitable for changing the VIP status of a person. @type contactItem: L{_PersonVIPStatus} @rtype: C{list} of L{liveform.Parameter} """ isVIP = False # default if contact...
python
def getParameters(self, contactItem): """ Return a list containing a single parameter suitable for changing the VIP status of a person. @type contactItem: L{_PersonVIPStatus} @rtype: C{list} of L{liveform.Parameter} """ isVIP = False # default if contact...
[ "def", "getParameters", "(", "self", ",", "contactItem", ")", ":", "isVIP", "=", "False", "# default", "if", "contactItem", "is", "not", "None", ":", "isVIP", "=", "contactItem", ".", "person", ".", "vip", "return", "[", "liveform", ".", "Parameter", "(", ...
Return a list containing a single parameter suitable for changing the VIP status of a person. @type contactItem: L{_PersonVIPStatus} @rtype: C{list} of L{liveform.Parameter}
[ "Return", "a", "list", "containing", "a", "single", "parameter", "suitable", "for", "changing", "the", "VIP", "status", "of", "a", "person", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L284-L297
56,274
twisted/mantissa
xmantissa/people.py
Person.getEmailAddresses
def getEmailAddresses(self): """ Return an iterator of all email addresses associated with this person. @return: an iterator of unicode strings in RFC2822 address format. """ return self.store.query( EmailAddress, EmailAddress.person == self).getColumn('a...
python
def getEmailAddresses(self): """ Return an iterator of all email addresses associated with this person. @return: an iterator of unicode strings in RFC2822 address format. """ return self.store.query( EmailAddress, EmailAddress.person == self).getColumn('a...
[ "def", "getEmailAddresses", "(", "self", ")", ":", "return", "self", ".", "store", ".", "query", "(", "EmailAddress", ",", "EmailAddress", ".", "person", "==", "self", ")", ".", "getColumn", "(", "'address'", ")" ]
Return an iterator of all email addresses associated with this person. @return: an iterator of unicode strings in RFC2822 address format.
[ "Return", "an", "iterator", "of", "all", "email", "addresses", "associated", "with", "this", "person", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L514-L522
56,275
twisted/mantissa
xmantissa/people.py
Organizer.groupReadOnlyViews
def groupReadOnlyViews(self, person): """ Collect all contact items from the available contact types for the given person, organize them by contact group, and turn them into read-only views. @type person: L{Person} @param person: The person whose contact items we're inte...
python
def groupReadOnlyViews(self, person): """ Collect all contact items from the available contact types for the given person, organize them by contact group, and turn them into read-only views. @type person: L{Person} @param person: The person whose contact items we're inte...
[ "def", "groupReadOnlyViews", "(", "self", ",", "person", ")", ":", "# this is a slightly awkward, specific API, but at the time of", "# writing, read-only views are the thing that the only caller cares", "# about. we need the contact type to get a read-only view for a", "# contact item. ther...
Collect all contact items from the available contact types for the given person, organize them by contact group, and turn them into read-only views. @type person: L{Person} @param person: The person whose contact items we're interested in. @return: A mapping of of L{ContactGrou...
[ "Collect", "all", "contact", "items", "from", "the", "available", "contact", "types", "for", "the", "given", "person", "organize", "them", "by", "contact", "group", "and", "turn", "them", "into", "read", "-", "only", "views", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L885-L917
56,276
twisted/mantissa
xmantissa/people.py
PersonPluginView.getPluginWidget
def getPluginWidget(self, pluginName): """ Return the named plugin's view. @type pluginName: C{unicode} @param pluginName: The name of the plugin. @rtype: L{LiveElement} """ # this will always pick the first plugin with pluginName if there is # more than...
python
def getPluginWidget(self, pluginName): """ Return the named plugin's view. @type pluginName: C{unicode} @param pluginName: The name of the plugin. @rtype: L{LiveElement} """ # this will always pick the first plugin with pluginName if there is # more than...
[ "def", "getPluginWidget", "(", "self", ",", "pluginName", ")", ":", "# this will always pick the first plugin with pluginName if there is", "# more than one. don't do that.", "for", "plugin", "in", "self", ".", "plugins", ":", "if", "_organizerPluginName", "(", "plugin", "...
Return the named plugin's view. @type pluginName: C{unicode} @param pluginName: The name of the plugin. @rtype: L{LiveElement}
[ "Return", "the", "named", "plugin", "s", "view", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L1539-L1555
56,277
twisted/mantissa
xmantissa/people.py
Mugshot.makeThumbnail
def makeThumbnail(cls, inputFile, person, format, smaller): """ Make a thumbnail of a mugshot image and store it on disk. @param inputFile: The image to thumbnail. @type inputFile: C{file} @param person: The person this mugshot thumbnail is associated with. @type person...
python
def makeThumbnail(cls, inputFile, person, format, smaller): """ Make a thumbnail of a mugshot image and store it on disk. @param inputFile: The image to thumbnail. @type inputFile: C{file} @param person: The person this mugshot thumbnail is associated with. @type person...
[ "def", "makeThumbnail", "(", "cls", ",", "inputFile", ",", "person", ",", "format", ",", "smaller", ")", ":", "dirsegs", "=", "[", "'mugshots'", ",", "str", "(", "person", ".", "storeID", ")", "]", "if", "smaller", ":", "dirsegs", ".", "insert", "(", ...
Make a thumbnail of a mugshot image and store it on disk. @param inputFile: The image to thumbnail. @type inputFile: C{file} @param person: The person this mugshot thumbnail is associated with. @type person: L{Person} @param format: The format of the data in C{inputFile}. ...
[ "Make", "a", "thumbnail", "of", "a", "mugshot", "image", "and", "store", "it", "on", "disk", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L2597-L2627
56,278
rande/python-simple-ioc
ioc/extra/jinja2/di.py
Extension.post_build
def post_build(self, container_builder, container): """ Register filter and global in jinja environment instance IoC tags are: - jinja2.filter to register filter, the tag must contain a name and a method options - jinja2.global to add new global, here globals...
python
def post_build(self, container_builder, container): """ Register filter and global in jinja environment instance IoC tags are: - jinja2.filter to register filter, the tag must contain a name and a method options - jinja2.global to add new global, here globals...
[ "def", "post_build", "(", "self", ",", "container_builder", ",", "container", ")", ":", "jinja", "=", "container", ".", "get", "(", "'ioc.extra.jinja2'", ")", "for", "id", "in", "container_builder", ".", "get_ids_by_tag", "(", "'jinja2.filter'", ")", ":", "def...
Register filter and global in jinja environment instance IoC tags are: - jinja2.filter to register filter, the tag must contain a name and a method options - jinja2.global to add new global, here globals are functions. The tag must contain a name and a method op...
[ "Register", "filter", "and", "global", "in", "jinja", "environment", "instance" ]
36ddf667c1213a07a53cd4cdd708d02494e5190b
https://github.com/rande/python-simple-ioc/blob/36ddf667c1213a07a53cd4cdd708d02494e5190b/ioc/extra/jinja2/di.py#L40-L73
56,279
truemped/tornadotools
tornadotools/caching.py
cache_key
def cache_key(*args, **kwargs): """ Base method for computing the cache key with respect to the given arguments. """ key = "" for arg in args: if callable(arg): key += ":%s" % repr(arg) else: key += ":%s" % str(arg) return key
python
def cache_key(*args, **kwargs): """ Base method for computing the cache key with respect to the given arguments. """ key = "" for arg in args: if callable(arg): key += ":%s" % repr(arg) else: key += ":%s" % str(arg) return key
[ "def", "cache_key", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "key", "=", "\"\"", "for", "arg", "in", "args", ":", "if", "callable", "(", "arg", ")", ":", "key", "+=", "\":%s\"", "%", "repr", "(", "arg", ")", "else", ":", "key", "+="...
Base method for computing the cache key with respect to the given arguments.
[ "Base", "method", "for", "computing", "the", "cache", "key", "with", "respect", "to", "the", "given", "arguments", "." ]
d22632b83810afc353fa886fbc9e265bee78653f
https://github.com/truemped/tornadotools/blob/d22632b83810afc353fa886fbc9e265bee78653f/tornadotools/caching.py#L75-L87
56,280
xav-b/pyconsul
pyconsul/utils.py
decode_values
def decode_values(fct): ''' Decode base64 encoded responses from Consul storage ''' def inner(*args, **kwargs): ''' decorator ''' data = fct(*args, **kwargs) if 'error' not in data: for result in data: result['Value'] = base64.b64decode(result['Value']) ...
python
def decode_values(fct): ''' Decode base64 encoded responses from Consul storage ''' def inner(*args, **kwargs): ''' decorator ''' data = fct(*args, **kwargs) if 'error' not in data: for result in data: result['Value'] = base64.b64decode(result['Value']) ...
[ "def", "decode_values", "(", "fct", ")", ":", "def", "inner", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "''' decorator '''", "data", "=", "fct", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "'error'", "not", "in", "data", ":", ...
Decode base64 encoded responses from Consul storage
[ "Decode", "base64", "encoded", "responses", "from", "Consul", "storage" ]
06ce3b921d01010c19643424486bea4b22196076
https://github.com/xav-b/pyconsul/blob/06ce3b921d01010c19643424486bea4b22196076/pyconsul/utils.py#L13-L22
56,281
xav-b/pyconsul
pyconsul/utils.py
safe_request
def safe_request(fct): ''' Return json messages instead of raising errors ''' def inner(*args, **kwargs): ''' decorator ''' try: _data = fct(*args, **kwargs) except requests.exceptions.ConnectionError as error: return {'error': str(error), 'status': 404} ...
python
def safe_request(fct): ''' Return json messages instead of raising errors ''' def inner(*args, **kwargs): ''' decorator ''' try: _data = fct(*args, **kwargs) except requests.exceptions.ConnectionError as error: return {'error': str(error), 'status': 404} ...
[ "def", "safe_request", "(", "fct", ")", ":", "def", "inner", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "''' decorator '''", "try", ":", "_data", "=", "fct", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "requests", ".", "exce...
Return json messages instead of raising errors
[ "Return", "json", "messages", "instead", "of", "raising", "errors" ]
06ce3b921d01010c19643424486bea4b22196076
https://github.com/xav-b/pyconsul/blob/06ce3b921d01010c19643424486bea4b22196076/pyconsul/utils.py#L25-L43
56,282
twisted/mantissa
xmantissa/smtp.py
parseAddress
def parseAddress(address): """ Parse the given RFC 2821 email address into a structured object. @type address: C{str} @param address: The address to parse. @rtype: L{Address} @raise xmantissa.error.ArgumentError: The given string was not a valid RFC 2821 address. """ parts = [] ...
python
def parseAddress(address): """ Parse the given RFC 2821 email address into a structured object. @type address: C{str} @param address: The address to parse. @rtype: L{Address} @raise xmantissa.error.ArgumentError: The given string was not a valid RFC 2821 address. """ parts = [] ...
[ "def", "parseAddress", "(", "address", ")", ":", "parts", "=", "[", "]", "parser", "=", "_AddressParser", "(", ")", "end", "=", "parser", "(", "parts", ",", "address", ")", "if", "end", "!=", "len", "(", "address", ")", ":", "raise", "InvalidTrailingBy...
Parse the given RFC 2821 email address into a structured object. @type address: C{str} @param address: The address to parse. @rtype: L{Address} @raise xmantissa.error.ArgumentError: The given string was not a valid RFC 2821 address.
[ "Parse", "the", "given", "RFC", "2821", "email", "address", "into", "a", "structured", "object", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/smtp.py#L190-L207
56,283
vladcalin/gemstone
gemstone/core/microservice.py
MicroService.start
def start(self): """ The main method that starts the service. This is blocking. """ self._initial_setup() self.on_service_start() self.app = self.make_tornado_app() enable_pretty_logging() self.app.listen(self.port, address=self.host) self._star...
python
def start(self): """ The main method that starts the service. This is blocking. """ self._initial_setup() self.on_service_start() self.app = self.make_tornado_app() enable_pretty_logging() self.app.listen(self.port, address=self.host) self._star...
[ "def", "start", "(", "self", ")", ":", "self", ".", "_initial_setup", "(", ")", "self", ".", "on_service_start", "(", ")", "self", ".", "app", "=", "self", ".", "make_tornado_app", "(", ")", "enable_pretty_logging", "(", ")", "self", ".", "app", ".", "...
The main method that starts the service. This is blocking.
[ "The", "main", "method", "that", "starts", "the", "service", ".", "This", "is", "blocking", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/microservice.py#L141-L163
56,284
vladcalin/gemstone
gemstone/core/microservice.py
MicroService.get_plugin
def get_plugin(self, name): """ Returns a plugin by name and raises ``gemstone.errors.PluginDoesNotExistError`` error if no plugin with such name exists. :param name: a string specifying a plugin name. :return: the corresponding plugin instance. """ for plugin in...
python
def get_plugin(self, name): """ Returns a plugin by name and raises ``gemstone.errors.PluginDoesNotExistError`` error if no plugin with such name exists. :param name: a string specifying a plugin name. :return: the corresponding plugin instance. """ for plugin in...
[ "def", "get_plugin", "(", "self", ",", "name", ")", ":", "for", "plugin", "in", "self", ".", "plugins", ":", "if", "plugin", ".", "name", "==", "name", ":", "return", "plugin", "raise", "PluginDoesNotExistError", "(", "\"Plugin '{}' not found\"", ".", "forma...
Returns a plugin by name and raises ``gemstone.errors.PluginDoesNotExistError`` error if no plugin with such name exists. :param name: a string specifying a plugin name. :return: the corresponding plugin instance.
[ "Returns", "a", "plugin", "by", "name", "and", "raises", "gemstone", ".", "errors", ".", "PluginDoesNotExistError", "error", "if", "no", "plugin", "with", "such", "name", "exists", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/microservice.py#L165-L177
56,285
vladcalin/gemstone
gemstone/core/microservice.py
MicroService.start_thread
def start_thread(self, target, args, kwargs): """ Shortcut method for starting a thread. :param target: The function to be executed. :param args: A tuple or list representing the positional arguments for the thread. :param kwargs: A dictionary representing the keyword arguments....
python
def start_thread(self, target, args, kwargs): """ Shortcut method for starting a thread. :param target: The function to be executed. :param args: A tuple or list representing the positional arguments for the thread. :param kwargs: A dictionary representing the keyword arguments....
[ "def", "start_thread", "(", "self", ",", "target", ",", "args", ",", "kwargs", ")", ":", "thread_obj", "=", "threading", ".", "Thread", "(", "target", "=", "target", ",", "args", "=", "args", ",", "kwargs", "=", "kwargs", ",", "daemon", "=", "True", ...
Shortcut method for starting a thread. :param target: The function to be executed. :param args: A tuple or list representing the positional arguments for the thread. :param kwargs: A dictionary representing the keyword arguments. .. versionadded:: 0.5.0
[ "Shortcut", "method", "for", "starting", "a", "thread", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/microservice.py#L267-L278
56,286
vladcalin/gemstone
gemstone/core/microservice.py
MicroService.emit_event
def emit_event(self, event_name, event_body): """ Publishes an event of type ``event_name`` to all subscribers, having the body ``event_body``. The event is pushed through all available event transports. The event body must be a Python object that can be represented as a JSON. ...
python
def emit_event(self, event_name, event_body): """ Publishes an event of type ``event_name`` to all subscribers, having the body ``event_body``. The event is pushed through all available event transports. The event body must be a Python object that can be represented as a JSON. ...
[ "def", "emit_event", "(", "self", ",", "event_name", ",", "event_body", ")", ":", "for", "transport", "in", "self", ".", "event_transports", ":", "transport", ".", "emit_event", "(", "event_name", ",", "event_body", ")" ]
Publishes an event of type ``event_name`` to all subscribers, having the body ``event_body``. The event is pushed through all available event transports. The event body must be a Python object that can be represented as a JSON. :param event_name: a ``str`` representing the event type :...
[ "Publishes", "an", "event", "of", "type", "event_name", "to", "all", "subscribers", "having", "the", "body", "event_body", ".", "The", "event", "is", "pushed", "through", "all", "available", "event", "transports", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/microservice.py#L280-L297
56,287
vladcalin/gemstone
gemstone/core/microservice.py
MicroService._add_static_handlers
def _add_static_handlers(self, handlers): """ Creates and adds the handles needed for serving static files. :param handlers: """ for url, path in self.static_dirs: handlers.append((url.rstrip("/") + "/(.*)", StaticFileHandler, {"path": path}))
python
def _add_static_handlers(self, handlers): """ Creates and adds the handles needed for serving static files. :param handlers: """ for url, path in self.static_dirs: handlers.append((url.rstrip("/") + "/(.*)", StaticFileHandler, {"path": path}))
[ "def", "_add_static_handlers", "(", "self", ",", "handlers", ")", ":", "for", "url", ",", "path", "in", "self", ".", "static_dirs", ":", "handlers", ".", "append", "(", "(", "url", ".", "rstrip", "(", "\"/\"", ")", "+", "\"/(.*)\"", ",", "StaticFileHandl...
Creates and adds the handles needed for serving static files. :param handlers:
[ "Creates", "and", "adds", "the", "handles", "needed", "for", "serving", "static", "files", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/microservice.py#L395-L402
56,288
vladcalin/gemstone
gemstone/core/microservice.py
MicroService._gather_event_handlers
def _gather_event_handlers(self): """ Searches for the event handlers in the current microservice class. :return: """ self._extract_event_handlers_from_container(self) for module in self.modules: self._extract_event_handlers_from_container(module)
python
def _gather_event_handlers(self): """ Searches for the event handlers in the current microservice class. :return: """ self._extract_event_handlers_from_container(self) for module in self.modules: self._extract_event_handlers_from_container(module)
[ "def", "_gather_event_handlers", "(", "self", ")", ":", "self", ".", "_extract_event_handlers_from_container", "(", "self", ")", "for", "module", "in", "self", ".", "modules", ":", "self", ".", "_extract_event_handlers_from_container", "(", "module", ")" ]
Searches for the event handlers in the current microservice class. :return:
[ "Searches", "for", "the", "event", "handlers", "in", "the", "current", "microservice", "class", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/microservice.py#L424-L432
56,289
openvax/datacache
datacache/database_helpers.py
connect_if_correct_version
def connect_if_correct_version(db_path, version): """Return a sqlite3 database connection if the version in the database's metadata matches the version argument. Also implicitly checks for whether the data in this database has been completely filled, since we set the version last. TODO: Make an ex...
python
def connect_if_correct_version(db_path, version): """Return a sqlite3 database connection if the version in the database's metadata matches the version argument. Also implicitly checks for whether the data in this database has been completely filled, since we set the version last. TODO: Make an ex...
[ "def", "connect_if_correct_version", "(", "db_path", ",", "version", ")", ":", "db", "=", "Database", "(", "db_path", ")", "if", "db", ".", "has_version", "(", ")", "and", "db", ".", "version", "(", ")", "==", "version", ":", "return", "db", ".", "conn...
Return a sqlite3 database connection if the version in the database's metadata matches the version argument. Also implicitly checks for whether the data in this database has been completely filled, since we set the version last. TODO: Make an explicit 'complete' flag to the metadata.
[ "Return", "a", "sqlite3", "database", "connection", "if", "the", "version", "in", "the", "database", "s", "metadata", "matches", "the", "version", "argument", "." ]
73bcac02d37cf153710a07fbdc636aa55cb214ca
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/database_helpers.py#L37-L49
56,290
openvax/datacache
datacache/database_helpers.py
_create_cached_db
def _create_cached_db( db_path, tables, version=1): """ Either create or retrieve sqlite database. Parameters -------- db_path : str Path to sqlite3 database file tables : dict Dictionary mapping table names to datacache.DatabaseTable objects versio...
python
def _create_cached_db( db_path, tables, version=1): """ Either create or retrieve sqlite database. Parameters -------- db_path : str Path to sqlite3 database file tables : dict Dictionary mapping table names to datacache.DatabaseTable objects versio...
[ "def", "_create_cached_db", "(", "db_path", ",", "tables", ",", "version", "=", "1", ")", ":", "require_string", "(", "db_path", ",", "\"db_path\"", ")", "require_iterable_of", "(", "tables", ",", "DatabaseTable", ")", "require_integer", "(", "version", ",", "...
Either create or retrieve sqlite database. Parameters -------- db_path : str Path to sqlite3 database file tables : dict Dictionary mapping table names to datacache.DatabaseTable objects version : int, optional Version acceptable as cached data. Returns sqlite3 connec...
[ "Either", "create", "or", "retrieve", "sqlite", "database", "." ]
73bcac02d37cf153710a07fbdc636aa55cb214ca
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/database_helpers.py#L51-L112
56,291
openvax/datacache
datacache/database_helpers.py
db_from_dataframe
def db_from_dataframe( db_filename, table_name, df, primary_key=None, subdir=None, overwrite=False, indices=(), version=1): """ Given a dataframe `df`, turn it into a sqlite3 database. Store values in a table called `table_name`. Returns f...
python
def db_from_dataframe( db_filename, table_name, df, primary_key=None, subdir=None, overwrite=False, indices=(), version=1): """ Given a dataframe `df`, turn it into a sqlite3 database. Store values in a table called `table_name`. Returns f...
[ "def", "db_from_dataframe", "(", "db_filename", ",", "table_name", ",", "df", ",", "primary_key", "=", "None", ",", "subdir", "=", "None", ",", "overwrite", "=", "False", ",", "indices", "=", "(", ")", ",", "version", "=", "1", ")", ":", "return", "db_...
Given a dataframe `df`, turn it into a sqlite3 database. Store values in a table called `table_name`. Returns full path to the sqlite database file.
[ "Given", "a", "dataframe", "df", "turn", "it", "into", "a", "sqlite3", "database", ".", "Store", "values", "in", "a", "table", "called", "table_name", "." ]
73bcac02d37cf153710a07fbdc636aa55cb214ca
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/database_helpers.py#L229-L251
56,292
openvax/datacache
datacache/database_helpers.py
_db_filename_from_dataframe
def _db_filename_from_dataframe(base_filename, df): """ Generate database filename for a sqlite3 database we're going to fill with the contents of a DataFrame, using the DataFrame's column names and types. """ db_filename = base_filename + ("_nrows%d" % len(df)) for column_name in df.columns...
python
def _db_filename_from_dataframe(base_filename, df): """ Generate database filename for a sqlite3 database we're going to fill with the contents of a DataFrame, using the DataFrame's column names and types. """ db_filename = base_filename + ("_nrows%d" % len(df)) for column_name in df.columns...
[ "def", "_db_filename_from_dataframe", "(", "base_filename", ",", "df", ")", ":", "db_filename", "=", "base_filename", "+", "(", "\"_nrows%d\"", "%", "len", "(", "df", ")", ")", "for", "column_name", "in", "df", ".", "columns", ":", "column_db_type", "=", "db...
Generate database filename for a sqlite3 database we're going to fill with the contents of a DataFrame, using the DataFrame's column names and types.
[ "Generate", "database", "filename", "for", "a", "sqlite3", "database", "we", "re", "going", "to", "fill", "with", "the", "contents", "of", "a", "DataFrame", "using", "the", "DataFrame", "s", "column", "names", "and", "types", "." ]
73bcac02d37cf153710a07fbdc636aa55cb214ca
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/database_helpers.py#L254-L265
56,293
openvax/datacache
datacache/database_helpers.py
fetch_csv_db
def fetch_csv_db( table_name, download_url, csv_filename=None, db_filename=None, subdir=None, version=1, **pandas_kwargs): """ Download a remote CSV file and create a local sqlite3 database from its contents """ df = fetch_csv_dataframe( ...
python
def fetch_csv_db( table_name, download_url, csv_filename=None, db_filename=None, subdir=None, version=1, **pandas_kwargs): """ Download a remote CSV file and create a local sqlite3 database from its contents """ df = fetch_csv_dataframe( ...
[ "def", "fetch_csv_db", "(", "table_name", ",", "download_url", ",", "csv_filename", "=", "None", ",", "db_filename", "=", "None", ",", "subdir", "=", "None", ",", "version", "=", "1", ",", "*", "*", "pandas_kwargs", ")", ":", "df", "=", "fetch_csv_datafram...
Download a remote CSV file and create a local sqlite3 database from its contents
[ "Download", "a", "remote", "CSV", "file", "and", "create", "a", "local", "sqlite3", "database", "from", "its", "contents" ]
73bcac02d37cf153710a07fbdc636aa55cb214ca
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/database_helpers.py#L267-L292
56,294
llazzaro/analyzerdam
analyzerdam/google_finance.py
GoogleFinance.get_all
def get_all(self, security): """ Get all available quote data for the given ticker security. Returns a dictionary. """ url = 'http://www.google.com/finance?q=%s' % security page = self._request(url) soup = BeautifulSoup(page) snapData = soup.find...
python
def get_all(self, security): """ Get all available quote data for the given ticker security. Returns a dictionary. """ url = 'http://www.google.com/finance?q=%s' % security page = self._request(url) soup = BeautifulSoup(page) snapData = soup.find...
[ "def", "get_all", "(", "self", ",", "security", ")", ":", "url", "=", "'http://www.google.com/finance?q=%s'", "%", "security", "page", "=", "self", ".", "_request", "(", "url", ")", "soup", "=", "BeautifulSoup", "(", "page", ")", "snapData", "=", "soup", "...
Get all available quote data for the given ticker security. Returns a dictionary.
[ "Get", "all", "available", "quote", "data", "for", "the", "given", "ticker", "security", ".", "Returns", "a", "dictionary", "." ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/google_finance.py#L41-L58
56,295
llazzaro/analyzerdam
analyzerdam/google_finance.py
GoogleFinance.quotes
def quotes(self, security, start, end): """ Get historical prices for the given ticker security. Date format is 'YYYYMMDD' Returns a nested list. """ try: url = 'http://www.google.com/finance/historical?q=%s&startdate=%s&enddate=%s&output=csv' % (secu...
python
def quotes(self, security, start, end): """ Get historical prices for the given ticker security. Date format is 'YYYYMMDD' Returns a nested list. """ try: url = 'http://www.google.com/finance/historical?q=%s&startdate=%s&enddate=%s&output=csv' % (secu...
[ "def", "quotes", "(", "self", ",", "security", ",", "start", ",", "end", ")", ":", "try", ":", "url", "=", "'http://www.google.com/finance/historical?q=%s&startdate=%s&enddate=%s&output=csv'", "%", "(", "security", ".", "symbol", ",", "start", ",", "end", ")", "...
Get historical prices for the given ticker security. Date format is 'YYYYMMDD' Returns a nested list.
[ "Get", "historical", "prices", "for", "the", "given", "ticker", "security", ".", "Date", "format", "is", "YYYYMMDD", "Returns", "a", "nested", "list", "." ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/google_finance.py#L60-L95
56,296
llazzaro/analyzerdam
analyzerdam/google_finance.py
GoogleFinance._parseTarget
def _parseTarget(self, target, keyTimeValue): ''' parse table for get financial ''' table = target.table timestamps = self._getTimeStamps(table) for tr in table.tbody.findChildren('tr'): for i, td in enumerate(tr.findChildren('td')): if 0 == i: ...
python
def _parseTarget(self, target, keyTimeValue): ''' parse table for get financial ''' table = target.table timestamps = self._getTimeStamps(table) for tr in table.tbody.findChildren('tr'): for i, td in enumerate(tr.findChildren('td')): if 0 == i: ...
[ "def", "_parseTarget", "(", "self", ",", "target", ",", "keyTimeValue", ")", ":", "table", "=", "target", ".", "table", "timestamps", "=", "self", ".", "_getTimeStamps", "(", "table", ")", "for", "tr", "in", "table", ".", "tbody", ".", "findChildren", "(...
parse table for get financial
[ "parse", "table", "for", "get", "financial" ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/google_finance.py#L139-L151
56,297
llazzaro/analyzerdam
analyzerdam/google_finance.py
GoogleFinance._getTimeStamps
def _getTimeStamps(self, table): ''' get time stamps ''' timeStamps = [] for th in table.thead.tr.contents: if '\n' != th: timeStamps.append(th.getText()) return timeStamps[1:]
python
def _getTimeStamps(self, table): ''' get time stamps ''' timeStamps = [] for th in table.thead.tr.contents: if '\n' != th: timeStamps.append(th.getText()) return timeStamps[1:]
[ "def", "_getTimeStamps", "(", "self", ",", "table", ")", ":", "timeStamps", "=", "[", "]", "for", "th", "in", "table", ".", "thead", ".", "tr", ".", "contents", ":", "if", "'\\n'", "!=", "th", ":", "timeStamps", ".", "append", "(", "th", ".", "getT...
get time stamps
[ "get", "time", "stamps" ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/google_finance.py#L153-L160
56,298
llazzaro/analyzerdam
analyzerdam/google_finance.py
GoogleFinance.ticks
def ticks(self, security, start, end): """ Get tick prices for the given ticker security. @security: stock security @interval: interval in mins(google finance only support query till 1 min) @start: start date(YYYYMMDD) @end: end date(YYYYMMDD) start and e...
python
def ticks(self, security, start, end): """ Get tick prices for the given ticker security. @security: stock security @interval: interval in mins(google finance only support query till 1 min) @start: start date(YYYYMMDD) @end: end date(YYYYMMDD) start and e...
[ "def", "ticks", "(", "self", ",", "security", ",", "start", ",", "end", ")", ":", "period", "=", "1", "# url = 'http://www.google.com/finance/getprices?q=%s&i=%s&p=%sd&f=d,o,h,l,c,v&ts=%s' % (security, interval, period, start)\r", "url", "=", "'http://www.google.com/finance/getpr...
Get tick prices for the given ticker security. @security: stock security @interval: interval in mins(google finance only support query till 1 min) @start: start date(YYYYMMDD) @end: end date(YYYYMMDD) start and end is disabled since only 15 days data will show @...
[ "Get", "tick", "prices", "for", "the", "given", "ticker", "security", "." ]
c5bc7483dae23bd2e14bbf36147b7a43a0067bc0
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/google_finance.py#L168-L202
56,299
pudo/jsongraph
jsongraph/common.py
GraphOperations.get_binding
def get_binding(self, schema, data): """ For a given schema, get a binding mediator providing links to the RDF terms matching that schema. """ schema = self.parent.get_schema(schema) return Binding(schema, self.parent.resolver, data=data)
python
def get_binding(self, schema, data): """ For a given schema, get a binding mediator providing links to the RDF terms matching that schema. """ schema = self.parent.get_schema(schema) return Binding(schema, self.parent.resolver, data=data)
[ "def", "get_binding", "(", "self", ",", "schema", ",", "data", ")", ":", "schema", "=", "self", ".", "parent", ".", "get_schema", "(", "schema", ")", "return", "Binding", "(", "schema", ",", "self", ".", "parent", ".", "resolver", ",", "data", "=", "...
For a given schema, get a binding mediator providing links to the RDF terms matching that schema.
[ "For", "a", "given", "schema", "get", "a", "binding", "mediator", "providing", "links", "to", "the", "RDF", "terms", "matching", "that", "schema", "." ]
35e4f397dbe69cd5553cf9cb9ab98859c3620f03
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/common.py#L11-L15