Search is not available for this dataset
text stringlengths 75 104k |
|---|
def indent(self):
"""
Performs an indentation
"""
if not self.tab_always_indent:
super(PyIndenterMode, self).indent()
else:
cursor = self.editor.textCursor()
assert isinstance(cursor, QtGui.QTextCursor)
if cursor.hasSelection():
... |
def unindent(self):
"""
Performs an un-indentation
"""
if self.tab_always_indent:
cursor = self.editor.textCursor()
if not cursor.hasSelection():
cursor.select(cursor.LineUnderCursor)
self.unindent_selection(cursor)
else:
... |
def _handle_indent_between_paren(self, column, line, parent_impl, tc):
"""
Handle indent between symbols such as parenthesis, braces,...
"""
pre, post = parent_impl
next_char = self._get_next_char(tc)
prev_char = self._get_prev_char(tc)
prev_open = prev_char in ['... |
def _at_block_start(tc, line):
"""
Improve QTextCursor.atBlockStart to ignore spaces
"""
if tc.atBlockStart():
return True
column = tc.columnNumber()
indentation = len(line) - len(line.lstrip())
return column <= indentation |
def detect_encoding(self, path):
"""
For the implementation of encoding definitions in Python, look at:
- http://www.python.org/dev/peps/pep-0263/
.. note:: code taken and adapted from
```jedi.common.source_to_unicode.detect_encoding```
"""
with open(path, 'r... |
def on_state_changed(self, state):
"""
Called when the mode is activated/deactivated
"""
if state:
self.action.triggered.connect(self.comment)
self.editor.add_action(self.action, sub_menu='Python')
if 'pyqt5' in os.environ['QT_API'].lower():
... |
def comment(self):
"""
Comments/Uncomments the selected lines or the current lines if there
is no selection.
"""
cursor = self.editor.textCursor()
# get the indent at which comment should be inserted and whether to
# comment or uncomment the selected text
... |
def setPlainText(self, txt, mimetype='text/x-python', encoding='utf-8'):
"""
Extends QCodeEdit.setPlainText to allow user to setPlainText without
mimetype (since the python syntax highlighter does not use it).
"""
try:
self.syntax_highlighter.docstrings[:] = []
... |
def update_terminal_colors(self):
"""
Update terminal color scheme based on the pygments color scheme colors
"""
self.color_scheme = self.create_color_scheme(
background=self.syntax_highlighter.color_scheme.background,
foreground=self.syntax_highlighter.color_sche... |
def mouseMoveEvent(self, e):
"""
Extends mouseMoveEvent to display a pointing hand cursor when the
mouse cursor is over a file location
"""
super(PyInteractiveConsole, self).mouseMoveEvent(e)
cursor = self.cursorForPosition(e.pos())
assert isinstance(cursor, QtGui... |
def mousePressEvent(self, e):
"""
Emits open_file_requested if the press event occured over
a file location string.
"""
super(PyInteractiveConsole, self).mousePressEvent(e)
cursor = self.cursorForPosition(e.pos())
p = cursor.positionInBlock()
usd = cursor... |
def detect_fold_level(self, prev_block, block):
"""
Perfoms fold level detection for current block (take previous block
into account).
:param prev_block: previous block, None if `block` is the first block.
:param block: block to analyse.
:return: block fold level
... |
def setup_actions(self):
""" Connects slots to signals """
self.actionOpen.triggered.connect(self.on_open)
self.actionNew.triggered.connect(self.on_new)
self.actionSave.triggered.connect(self.on_save)
self.actionSave_as.triggered.connect(self.on_save_as)
self.actionQuit.t... |
def setup_editor(self, editor):
"""
Setup the python editor, run the server and connect a few signals.
:param editor: editor to setup.
"""
editor.cursorPositionChanged.connect(self.on_cursor_pos_changed)
try:
m = editor.modes.get(modes.GoToAssignmentsMode)
... |
def open_file(self, path, line=None):
"""
Creates a new GenericCodeEdit, opens the requested file and adds it
to the tab widget.
:param path: Path of the file to open
:return The opened editor if open succeeded.
"""
editor = None
if path:
int... |
def _get_backend_parameters(self):
"""
Gets the pyqode backend parameters (interpreter and script).
"""
frozen = hasattr(sys, 'frozen')
interpreter = Settings().interpreter
if frozen:
interpreter = None
pyserver = server.__file__ if interpreter is not ... |
def on_new(self):
"""
Add a new empty code editor to the tab widget
"""
interpreter, pyserver, args = self._get_backend_parameters()
self.setup_editor(self.tabWidget.create_new_document(
extension='.py', interpreter=interpreter, server_script=pyserver,
arg... |
def on_open(self):
"""
Shows an open file dialog and open the file if the dialog was
accepted.
"""
filename, filter = QtWidgets.QFileDialog.getOpenFileName(self, 'Open')
if filename:
self.open_file(filename)
self.actionRun.setEnabled(True)
sel... |
def on_save_as(self):
"""
Save the current editor document as.
"""
path = self.tabWidget.current_widget().file.path
path = os.path.dirname(path) if path else ''
filename, filter = QtWidgets.QFileDialog.getSaveFileName(
self, 'Save', path)
if filename:
... |
def setup_mnu_style(self, editor):
""" setup the style menu for an editor tab """
menu = QtWidgets.QMenu('Styles', self.menuEdit)
group = QtWidgets.QActionGroup(self)
self.styles_group = group
current_style = editor.syntax_highlighter.color_scheme.name
group.triggered.con... |
def setup_mnu_panels(self, editor):
"""
Setup the panels menu for the current editor.
:param editor:
"""
for panel in editor.panels:
if panel.dynamic:
continue
a = QtWidgets.QAction(self.menuModes)
a.setText(panel.name)
... |
def on_current_tab_changed(self):
"""
Update action states when the current tab changed.
"""
self.menuEdit.clear()
self.menuModes.clear()
self.menuPanels.clear()
editor = self.tabWidget.current_widget()
self.menuEdit.setEnabled(editor is not None)
... |
def on_run(self):
"""
Run the current current script
"""
filename = self.tabWidget.current_widget().file.path
wd = os.path.dirname(filename)
args = Settings().get_run_config_for_file(filename)
self.interactiveConsole.start_process(
Settings().interpret... |
def on_goto_out_of_doc(self, assignment):
"""
Open the a new tab when goto goes out of the current document.
:param assignment: Destination
"""
editor = self.open_file(assignment.module_path)
if editor:
TextHelper(editor).goto_line(assignment.line, assignment... |
def calltips(request_data):
"""
Worker that returns a list of calltips.
A calltips is a tuple made of the following parts:
- module_name: name of the module of the function invoked
- call_name: name of the function that is being called
- params: the list of parameter names.
- index:... |
def goto_assignments(request_data):
"""
Go to assignements worker.
"""
code = request_data['code']
line = request_data['line'] + 1
column = request_data['column']
path = request_data['path']
# encoding = request_data['encoding']
encoding = 'utf-8'
script = jedi.Script(code, line,... |
def defined_names(request_data):
"""
Returns the list of defined names for the document.
"""
global _old_definitions
ret_val = []
path = request_data['path']
toplvl_definitions = jedi.names(
request_data['code'], path, 'utf-8')
for d in toplvl_definitions:
definition = _e... |
def quick_doc(request_data):
"""
Worker that returns the documentation of the symbol under cursor.
"""
code = request_data['code']
line = request_data['line'] + 1
column = request_data['column']
path = request_data['path']
# encoding = 'utf-8'
encoding = 'utf-8'
script = jedi.Scr... |
def run_pep8(request_data):
"""
Worker that run the pep8 tool on the current editor text.
:returns a list of tuples (msg, msg_type, line_number)
"""
import pycodestyle
from pyqode.python.backend.pep8utils import CustomChecker
WARNING = 1
code = request_data['code']
path = request_da... |
def run_pyflakes(request_data):
"""
Worker that run a frosted (the fork of pyflakes) code analysis on the
current editor text.
"""
global prev_results
from pyflakes import checker
import _ast
WARNING = 1
ERROR = 2
ret_val = []
code = request_data['code']
path = request_da... |
def icon_from_typename(name, icon_type):
"""
Returns the icon resource filename that corresponds to the given typename.
:param name: name of the completion. Use to make the distinction between
public and private completions (using the count of starting '_')
:pram typename: the typename reported... |
def complete(code, line, column, path, encoding, prefix):
"""
Completes python code using `jedi`_.
:returns: a list of completion.
"""
ret_val = []
try:
script = jedi.Script(code, line + 1, column, path, encoding)
completions = script.completions(... |
def make_python_patterns(additional_keywords=[], additional_builtins=[]):
"""Strongly inspired from idlelib.ColorDelegator.make_pat"""
kw = r"\b" + any("keyword", kwlist + additional_keywords) + r"\b"
kw_namespace = r"\b" + any("namespace", kw_namespace_list) + r"\b"
word_operators = r"\b" + any("operat... |
def _check_word_cursor(self, tc=None):
"""
Request a go to assignment.
:param tc: Text cursor which contains the text that we must look for
its assignment. Can be None to go to the text that is under
the text cursor.
:type tc: QtGui.QTextCursor
... |
def _unique(self, seq):
"""
Not performant but works.
"""
# order preserving
checked = []
for e in seq:
present = False
for c in checked:
if str(c) == str(e):
present = True
break
... |
def read_bgen(filepath, metafile_filepath=None, samples_filepath=None, verbose=True):
r""" Read a given BGEN file.
Parameters
----------
filepath : str
A bgen file path.
metafile_filepath : str, optional
If ``None``, it will try to read the ``filepath + ".metadata"`` file. If this i... |
def _validateDirectives(self, directiveList, checkFileName):
if len(directiveList) == 0:
raise ParsingException("'{file}' does not contain any CHECK directives".format(file=checkFileName))
from . import Directives
"""
We should enforce for every CHECK-NOT and CHECK-NOT-... |
def _substituteCheckPattern(self, inputString, lineNumber, lastLineNumber, checkFileName, isForRegex):
"""
Do various ${} substitutions
"""
assert isinstance(inputString, str)
assert isinstance(lineNumber, int)
assert isinstance(lastLineNumber, int)
assert isinsta... |
def create_metafile(bgen_filepath, metafile_filepath, verbose=True):
r"""Create variants metadata file.
Variants metadata file helps speed up subsequent reads of the associated
bgen file.
Parameters
----------
bgen_filepath : str
Bgen file path.
metafile_file : str
Metafile... |
def match(self, subsetLines, offsetOfSubset, fileName):
"""
Search through lines for match.
Raise an Exception if fail to match
If match is succesful return the position the match was found
"""
for (offset,l) in enumerate(subsetLines):
column = l.... |
def match(self, subsetLines, offsetOfSubset, fileName):
"""
Search through lines for match.
Raise an Exception if a match
"""
for (offset,l) in enumerate(subsetLines):
for t in self.regex:
m = t.Regex.search(l)
if m != None:
... |
def isA(instance, typeList):
"""
Return true if ``instance`` is an instance of any the Directive
types in ``typeList``
"""
return any(map(lambda iType: isinstance(instance,iType), typeList)) |
def _touch(fname, mode=0o666, dir_fd=None, **kwargs):
""" Touch a file.
Credits to <https://stackoverflow.com/a/1160227>.
"""
flags = os.O_CREAT | os.O_APPEND
with os.fdopen(os.open(fname, flags=flags, mode=mode, dir_fd=dir_fd)) as f:
os.utime(
f.fileno() if os.utime in os.suppo... |
def allele_frequency(expec):
r""" Compute allele frequency from its expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
Returns
-------
:class:`numpy.ndarray`
Allele frequencies encoded as a variants-by-alleles m... |
def compute_dosage(expec, alt=None):
r""" Compute dosage from allele expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
alt : array_like, optional
Alternative allele index. If ``None``, the allele having the minor
... |
def allele_expectation(bgen, variant_idx):
r""" Allele expectation.
Compute the expectation of each allele from the genotype probabilities.
Parameters
----------
bgen : bgen_file
Bgen file handler.
variant_idx : int
Variant index.
Returns
-------
:class:`numpy.ndar... |
def find_libname(self, name):
"""Try to infer the correct library name."""
names = ["{}.lib", "lib{}.lib", "{}lib.lib"]
names = [n.format(name) for n in names]
dirs = self.get_library_dirs()
for d in dirs:
for n in names:
if exists(join(d, n)):
... |
def split(self, X, y=None, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target va... |
def molconvert_chemaxon(data):
"""
molconvert wrapper
:param data: buffer or string or path to file
:return: array of molecules of reactions
"""
if isinstance(data, Path):
with data.open('rb') as f:
data = f.read()
elif isinstance(data, StringIO):
data = data.read... |
def fit(self, X, y=None):
"""Fit distance-based AD.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
Returns
-------
self : object
... |
def predict_proba(self, X):
"""Returns the value of the nearest neighbor from the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and i... |
def predict(self, X):
"""Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix ... |
def fit(self, X, y=None):
"""Learning is to find the inverse matrix for X and calculate the threshold.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
... |
def predict_proba(self, X):
"""Predict the distances for X to center of the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a spa... |
def predict(self, X):
"""Predict inside or outside AD for X.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
... |
def get_feature_names(self):
"""Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform.
"""
return ['temperature', 'pressure'] + [f'solvent.{x}' for x in range(1, self.max_solvents + 1)] + \
... |
def fit(self, X, y=None):
"""Find min and max values of every feature.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The training input samples.
y : Ignored
not used, present for API consistency by convention.
... |
def predict(self, X):
""" Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix ... |
def split(self, X, y=None, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target va... |
def fit(self, x, y=None):
"""Do nothing and return the estimator unchanged
This method is just there to implement the usual API and hence work in pipelines.
"""
if self._dtype is not None:
iter2array(x, dtype=self._dtype)
else:
iter2array(x)
retur... |
def finalize(self):
"""
finalize partial fitting procedure
"""
if self.__head_less:
warn(f'{self.__class__.__name__} configured to head less mode. finalize unusable')
elif not self.__head_generate:
warn(f'{self.__class__.__name__} already finalized or fitt... |
def _reset(self):
"""Reset internal data-dependent state.
__init__ parameters are not touched.
"""
if not self.__head_less:
if not self.__head_generate:
self.__head_generate = True
if self.__head_dict:
self.__head_dump = self.__head... |
def get_feature_names(self):
"""Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform.
"""
if self.__head_less:
raise AttributeError(f'{self.__class__.__name__} instance configured to head l... |
def fit(self, x, y=None):
"""Compute the header.
"""
x = iter2array(x, dtype=(MoleculeContainer, CGRContainer))
if self.__head_less:
warn(f'{self.__class__.__name__} configured to head less mode. fit unusable')
return self
self._reset()
self.__pr... |
def fit(self, X):
"""Fit structure-based AD. The training model memorizes the unique set of reaction signature.
Parameters
----------
X : after read rdf file
Returns
-------
self : object
"""
X = iter2array(X, dtype=ReactionContainer)
se... |
def predict(self, X):
"""Reaction is considered belonging to model’s AD
if its reaction signature coincides with ones used in training set.
Parameters
----------
X : after read rdf file
Returns
-------
self : array contains True (reaction in AD) and Fals... |
def __parser(expression):
""" adopted from Paul McGuire example. http://pyparsing.wikispaces.com/file/view/fourFn.py
"""
expr_stack = []
def push_first(strg, loc, toks):
expr_stack.append(toks[0])
def push_u_minus(strg, loc, toks):
if toks and toks[0] ==... |
def from_int(data):
"""
:params data: integer
:returns: proquint made from input data
:type data: int
:rtype: string
"""
if not isinstance(data, int) and not isinstance(data, long):
raise TypeError('Input must be integer')
res = []
while data > 0 or not res:
for j in... |
def to_int(data):
"""
:params data: proquint
:returns: proquint decoded into an integer
:type data: string
:rtype: int
"""
if not isinstance(data, basestring):
raise TypeError('Input must be string')
res = 0
for part in data.split('-'):
if len(part) != 5:
... |
def get_or_create_shared_key(cls, force_new=False):
"""
Create a shared public/private key pair for certificate pushing,
if the settings allow.
"""
if force_new:
with transaction.atomic():
SharedKey.objects.filter(current=True).update(current=False)
... |
def _self_referential_fk(klass_model):
"""
Return whether this model has a self ref FK, and the name for the field
"""
for f in klass_model._meta.concrete_fields:
if f.related_model:
if issubclass(klass_model, f.related_model):
return f.attname
return None |
def get_or_create_current_instance(cls):
"""Get the instance model corresponding to the current system, or create a new
one if the system is new or its properties have changed (e.g. OS from upgrade)."""
# on Android, platform.platform() barfs, so we handle that safely here
try:
... |
def _deserialize_store_model(self, fk_cache):
"""
When deserializing a store model, we look at the deleted flags to know if we should delete the app model.
Upon loading the app model in memory we validate the app models fields, if any errors occurs we follow
foreign key relationships to ... |
def serialize(self):
"""All concrete fields of the ``SyncableModel`` subclass, except for those specifically blacklisted, are returned in a dict."""
# NOTE: code adapted from https://github.com/django/django/blob/master/django/forms/models.py#L75
opts = self._meta
data = {}
for ... |
def deserialize(cls, dict_model):
"""Returns an unsaved class object based on the valid properties passed in."""
kwargs = {}
for f in cls._meta.concrete_fields:
if f.attname in dict_model:
kwargs[f.attname] = dict_model[f.attname]
return cls(**kwargs) |
def get_default(self):
"""
Returns the default value for this field.
"""
if self.has_default():
if callable(self.default):
default = self.default()
if isinstance(default, uuid.UUID):
return default.hex
return... |
def calculate_uuid(self):
"""Should return a 32-digit hex string for a UUID that is calculated as a function of a set of fields from the model."""
# raise an error if no inputs to the UUID calculation were specified
if self.uuid_input_fields is None:
raise NotImplementedError("""You... |
def add_to_deleted_models(sender, instance=None, *args, **kwargs):
"""
Whenever a model is deleted, we record its ID in a separate model for tracking purposes. During serialization, we will mark
the model as deleted in the store.
"""
if issubclass(sender, SyncableModel):
instance._update_del... |
def make_request(self, url, method='get', headers=None, data=None,
callback=None, errors=STRICT, verify=False, timeout=None, **params):
"""
Reusable method for performing requests.
:param url - URL to request
:param method - request method, default is 'get'
:... |
def _with_error_handling(resp, error, mode, response_format):
"""
Static method for error handling.
:param resp - API response
:param error - Error thrown
:param mode - Error mode
:param response_format - XML or json
"""
def safe_parse(r):
try... |
def poll(self, url, initial_delay=2, delay=1, tries=20, errors=STRICT, is_complete_callback=None, **params):
"""
Poll the URL
:param url - URL to poll, should be returned by 'create_session' call
:param initial_delay - specifies how many seconds to wait before the first poll
:par... |
def _default_poll_callback(self, poll_resp):
"""
Checks the condition in poll response to determine if it is complete
and no subsequent poll requests should be done.
"""
if poll_resp.parsed is None:
return False
success_list = ['UpdatesComplete', True, 'COMPLE... |
def _fsic_queuing_calc(fsic1, fsic2):
"""
We set the lower counter between two same instance ids.
If an instance_id exists in one fsic but not the other we want to give that counter a value of 0.
:param fsic1: dictionary containing (instance_id, counter) pairs
:param fsic2: dictionary containing (i... |
def _serialize_into_store(profile, filter=None):
"""
Takes data from app layer and serializes the models into the store.
"""
# ensure that we write and retrieve the counter in one go for consistency
current_id = InstanceIDModel.get_current_instance_and_increment_counter()
with transaction.atomi... |
def _deserialize_from_store(profile):
"""
Takes data from the store and integrates into the application.
"""
# we first serialize to avoid deserialization merge conflicts
_serialize_into_store(profile)
fk_cache = {}
with transaction.atomic():
syncable_dict = _profile_models[profile]... |
def _queue_into_buffer(transfersession):
"""
Takes a chunk of data from the store to be put into the buffer to be sent to another morango instance.
"""
last_saved_by_conditions = []
filter_prefixes = Filter(transfersession.filter)
server_fsic = json.loads(transfersession.server_fsic)
client_... |
def _dequeue_into_store(transfersession):
"""
Takes data from the buffers and merges into the store and record max counters.
"""
with connection.cursor() as cursor:
DBBackend._dequeuing_delete_rmcb_records(cursor, transfersession.id)
DBBackend._dequeuing_delete_buffered_records(cursor, t... |
def max_parameter_substitution():
"""
SQLite has a limit on the max number of variables allowed for parameter substitution. This limit is usually 999, but
can be compiled to a different number. This function calculates what the max is for the sqlite version running on the device.
We use the calculated v... |
def authenticate_credentials(self, userargs, password, request=None):
"""
Authenticate the userargs and password against Django auth backends.
The "userargs" string may be just the username, or a querystring-encoded set of params.
"""
credentials = {
'password': pass... |
def _multiple_self_ref_fk_check(class_model):
"""
We check whether a class has more than 1 FK reference to itself.
"""
self_fk = []
for f in class_model._meta.concrete_fields:
if f.related_model in self_fk:
return True
if f.related_model == class_model:
self_f... |
def add_syncable_models():
"""
Per profile, adds each model to a dictionary mapping the morango model name to its model class.
We sort by ForeignKey dependencies to safely sync data.
"""
import django.apps
from morango.models import SyncableModel
from morango.manager import SyncableModelMan... |
def _bulk_insert_into_app_models(self, cursor, app_model, fields, db_values, placeholder_list):
"""
Example query:
`REPLACE INTO model (F1,F2,F3) VALUES (%s, %s, %s), (%s, %s, %s), (%s, %s, %s)`
where values=[1,2,3,4,5,6,7,8,9]
"""
# calculate and create equal sized chunk... |
def _request(self, endpoint, method="GET", lookup=None, data={}, params={}, userargs=None, password=None):
"""
Generic request method designed to handle any morango endpoint.
:param endpoint: constant representing which morango endpoint we are querying
:param method: HTTP verb/method fo... |
def fuzzyfinder(input, collection, accessor=lambda x: x, sort_results=True):
"""
Args:
input (str): A partial string which is typically entered by a user.
collection (iterable): A collection of strings which will be filtered
based on the `input`.
accessor (... |
def create_access_token(self, valid_in_hours=1, data=None):
"""
Creates an access token.
TODO: check valid in hours
TODO: maybe specify how often a token can be used
"""
data = data or {}
token = AccessToken(
token=self.generate(),
expires... |
def save_service(self, service, overwrite=True):
"""
Stores an OWS service in mongodb.
"""
name = namesgenerator.get_sane_name(service.name)
if not name:
name = namesgenerator.get_random_name()
if self.collection.count_documents({'name': name}) > 0:
... |
def list_services(self):
"""
Lists all services in mongodb storage.
"""
my_services = []
for service in self.collection.find().sort('name', pymongo.ASCENDING):
my_services.append(Service(service))
return my_services |
def fetch_by_name(self, name):
"""
Gets service for given ``name`` from mongodb storage.
"""
service = self.collection.find_one({'name': name})
if not service:
raise ServiceNotFound
return Service(service) |
def fetch_by_url(self, url):
"""
Gets service for given ``url`` from mongodb storage.
"""
service = self.collection.find_one({'url': url})
if not service:
raise ServiceNotFound
return Service(service) |
def owsproxy(request):
"""
TODO: use ows exceptions
"""
try:
service_name = request.matchdict.get('service_name')
extra_path = request.matchdict.get('extra_path')
store = servicestore_factory(request.registry)
service = store.fetch_by_name(service_name)
except Excepti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.