text stringlengths 0 828 |
|---|
(data) = cls._update_tax_rate_by_id_with_http_info(tax_rate_id, tax_rate, **kwargs) |
return data" |
4625,"def build_append_file_task(urllocation, filelocation): |
""""""Build a task to watch a specific remote url and |
append that data to the file. This method should be used |
when you would like to keep all of the information stored |
on the local machine, but also append the new information |
found at the url. |
For instance, if the local file is: |
``` |
foo |
``` |
And the remote file is: |
``` |
bar |
``` |
The resulting file will contain: |
``` |
foo |
bar |
``` |
"""""" |
config = file_utils.get_celcius_config() |
basename = filelocation.split('/')[-1] |
tmp_filelocation = filelocation.replace(basename, 'tmp_'+basename) |
new_filelocation = filelocation.replace(basename, 'new_'+basename) |
if config['retrieve_command'] == 'curl': |
download_cmd = curl.build_download_file_command(urllocation, tmp_filelocation) |
elif config['retrieve_command'] == 'wget': |
download_cmd = wget.build_download_file_command(urllocation, tmp_filelocation) |
else: |
print(""Invalid retrieve command!"") |
sys.exit(1) |
diff_cmd = diff.build_append_file_command(filelocation, tmp_filelocation) |
compare_cmd = concat.build_and_concat_commands([download_cmd, diff_cmd]) |
redirect_cmd = redirect.redirect_output(compare_cmd, new_filelocation) |
full_cmd = concat.concat_commands([touch.touch(filelocation).build_command(), redirect_cmd, rm.build_force_rm_command(tmp_filelocation).build_command(), rm.build_force_rm_command(filelocation).build_command(), mv.mv(new_filelocation, filelocation).build_command()]) |
return full_cmd" |
4626,"def get_authentic_node_name(self, node_name: str) -> Optional[str]: |
"""""" |
Returns the exact, authentic node name for the given node name if a node corresponding to |
the given name exists in the graph (maybe not locally yet) or `None` otherwise. |
By default, this method checks whether a node with the given name exists locally in the |
graph and return `node_name` if it does or `None` otherwise. |
In `Graph` extensions that are used by applications where the user can enter potentially |
incorrect node names, this method should be overridden to improve usability. |
Arguments: |
node_name (str): The node name to return the authentic node name for. |
Returns: |
The authentic name of the node corresponding to the given node name or |
`None` if no such node exists. |
"""""" |
# Is there a node with the given name? |
vertex: IGraphVertex = None |
try: |
vertex: IGraphVertex = self._wrapped_graph.vs.find(node_name) |
except ValueError: |
pass |
# Is node_name a node index? |
if vertex is None: |
try: |
vertex: IGraphVertex = self._wrapped_graph.vs[int(node_name)] |
except ValueError: |
return None |
except IndexError: |
return None |
try: |
return vertex[""name""] |
except KeyError: |
return str(vertex.index)" |
4627,"def _create_memory_database_interface(self) -> GraphDatabaseInterface: |
"""""" |
Creates and returns the in-memory database interface the graph will use. |
"""""" |
Base = declarative_base() |
engine = sqlalchemy.create_engine(""sqlite://"", poolclass=StaticPool) |
Session = sessionmaker(bind=engine) |
dbi: GraphDatabaseInterface = create_graph_database_interface( |
sqlalchemy, Session(), Base, sqlalchemy.orm.relationship |
) |
Base.metadata.drop_all(engine) |
Base.metadata.create_all(engine) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.