function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def test_should_encode_single_quote_when_single_quoted(self):
encoded = cypher_repr(u"'", quote=u"'")
assert encoded == u"'\\''" | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_should_encode_single_quote_when_double_quoted(self):
encoded = cypher_repr(u"'", quote=u"\"")
assert encoded == u'"\'"' | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_should_encode_4_byte_extended_character(self):
encoded = cypher_repr(u"\uABCD")
assert encoded == u"'\\uabcd'" | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_should_encode_complex_sequence(self):
encoded = cypher_repr(u"' '' '''")
assert encoded == u"\"' '' '''\"" | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_should_encode_list(self):
encoded = cypher_repr([1, 2.0, u"three"])
assert encoded == u"[1, 2.0, 'three']" | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_should_encode_map(self):
encoded = cypher_repr(OrderedDict([("one", 1), ("two", 2.0), ("number three", u"three")]))
assert encoded == u"{one: 1, two: 2.0, `number three`: 'three'}" | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_should_encode_empty_node(self):
a = Node()
encoded = cypher_repr(a, node_template="{labels} {properties}")
assert encoded == u"({})" | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_should_encode_node_with_label(self):
a = Node("Person")
encoded = cypher_repr(a, node_template="{labels} {properties}")
assert encoded == u"(:Person {})" | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_can_encode_relationship(self):
a = Node(name="Alice")
b = Node(name="Bob")
ab = KNOWS(a, b)
encoded = cypher_repr(ab, related_node_template="{property.name}")
self.assertEqual("(Alice)-[:KNOWS {}]->(Bob)", encoded) | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_can_encode_relationship_with_alternative_names(self):
a = Node("Person", nom=u"Aimée")
b = Node("Person", nom=u"Baptiste")
ab = KNOWS_FR(a, b)
encoded = cypher_repr(ab, related_node_template=u"{property.nom}")
self.assertEqual(u"(Aimée)-[:CONNAÎT {}]->(Baptiste)", encode... | technige/cypy | [
5,
2,
5,
1,
1445556635
] |
def test_filter(tmp_path, simulator):
unit_test = tmp_path.joinpath('some_unit_test.sv')
unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def test_filter_wildcards(tmp_path, simulator):
failing_unit_test = tmp_path.joinpath('some_failing_unit_test.sv')
failing_unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def test_filter_without_dot(tmp_path, simulator):
dummy_unit_test = tmp_path.joinpath('dummy_unit_test.sv')
dummy_unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def test_filter_with_extra_dot(tmp_path, simulator):
dummy_unit_test = tmp_path.joinpath('dummy_unit_test.sv')
dummy_unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def test_filter_with_partial_widlcard(tmp_path, simulator):
dummy_unit_test = tmp_path.joinpath('dummy_unit_test.sv')
dummy_unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def test_multiple_filter_expressions(tmp_path, simulator):
unit_test = tmp_path.joinpath('some_unit_test.sv')
unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def test_negative_filter(tmp_path, simulator):
unit_test = tmp_path.joinpath('some_unit_test.sv')
unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def test_positive_and_negative_filter(tmp_path, simulator):
unit_test = tmp_path.joinpath('some_unit_test.sv')
unit_test.write_text(''' | svunit/svunit | [
132,
50,
132,
79,
1447196118
] |
def logger_name_from_path(path):
"""Validate a logger URI path and get the logger name.
:type path: str
:param path: URI path for a logger API request.
:rtype: str
:returns: Logger name parsed from ``path``.
:raises: :class:`ValueError` if the ``path`` is ill-formed or if
the proj... | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def _extract_payload(cls, resource):
"""Helper for :meth:`from_api_repr`"""
return None | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def from_api_repr(cls, resource, client, loggers=None):
"""Factory: construct an entry given its API representation
:type resource: dict
:param resource: text entry resource representation returned from
the API
:type client: :class:`google.cloud.logging.client... | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def _extract_payload(cls, resource):
"""Helper for :meth:`from_api_repr`"""
return resource['textPayload'] | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def _extract_payload(cls, resource):
"""Helper for :meth:`from_api_repr`"""
return resource['jsonPayload'] | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def _extract_payload(cls, resource):
"""Helper for :meth:`from_api_repr`"""
return resource['protoPayload'] | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def payload_pb(self):
if isinstance(self.payload, Any):
return self.payload | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def payload_json(self):
if not isinstance(self.payload, Any):
return self.payload | jonparrott/google-cloud-python | [
2,
1,
2,
1,
1443151125
] |
def main(): | neurodata/ndstore | [
39,
12,
39,
99,
1302639682
] |
def _NCNameChar(x):
return x.isalpha() or x.isdigit() or x == "." or x == '-' or x == "_" | pycontribs/wstools | [
7,
8,
7,
6,
1339586123
] |
def _toUnicodeHex(x):
hexval = hex(ord(x[0]))[2:]
hexlen = len(hexval)
# Make hexval have either 4 or 8 digits by prepending 0's
if (hexlen == 1):
hexval = "000" + hexval
elif (hexlen == 2):
hexval = "00" + hexval
elif (hexlen == 3):
hexval = "0" + hexval
elif (hexlen... | pycontribs/wstools | [
7,
8,
7,
6,
1339586123
] |
def toXMLname(string):
"""Convert string to a XML name."""
if string.find(':') != -1:
(prefix, localname) = string.split(':', 1)
else:
prefix = None
localname = string
T = text_type(localname)
N = len(localname)
X = []
for i in range(N):
if i < N - 1 and T[i... | pycontribs/wstools | [
7,
8,
7,
6,
1339586123
] |
def fun(matchobj):
return _fromUnicodeHex(matchobj.group(0)) | pycontribs/wstools | [
7,
8,
7,
6,
1339586123
] |
def get_clusters_info(uid):
c_db = get_routeCluster_db()
s_db = get_section_db()
clusterJson = c_db.find_one({"clusters":{"$exists":True}, "user": uid})
if clusterJson is None:
return []
c_info = []
clusterSectionLists= list(clusterJson["clusters"].values())
... | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def __init__(self, value):
self.value = value | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def getCanonicalTrips(uid, get_representative=False): # number returned isnt used
"""
uid is a UUID object, not a string
"""
# canonical_trip_list = []
# x = 0
# if route clusters return nothing, then get common routes for user
#clusters = get_routeCluster_db().find_one({'$and':[{'user':... | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def getAllTrips(uid):
#trips = list(get_trip_db().find({"user_id":uid, "type":"move"}))
query = {'user_id':uid, 'type':'move'}
return get_trip_db().find(query) | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def getNoAlternatives(uid):
# If pipelineFlags exists then we have started alternatives, and so have
# already scheduled the query. No need to reschedule unless the query fails.
# TODO: If the query fails, then remove the pipelineFlags so that we will
# reschedule.
query = {'user_id':uid, 'type':'mo... | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def getTrainingTrips(uid):
return getTrainingTrips_Date(uid, 30)
query = {'user_id':uid, 'type':'move'}
return get_trip_db().find(query) | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def getAlternativeTrips(trip_id):
#TODO: clean up datetime, and queries here
#d = datetime.datetime.now() - datetime.timedelta(days=6)
#query = {'trip_id':trip_id, 'trip_start_datetime':{"$gt":d}}
query = {'trip_id':trip_id}
alternatives = get_alternatives_db().find(query)
if alternatives.estima... | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def getTripsThroughMode(uid):
raise NotImplementedError() | e-mission/e-mission-server | [
20,
103,
20,
11,
1415342342
] |
def saltfpringfilter(axc,ayc,arad,rxc,ryc,filterfreq,filterwidth,itmax,conv, fitwidth,image,logfile,useconfig,configfile,verbose):
""" Determines the center coordinates of a ring, bins the ring radially and computes its power spectrum, and allows the user to select a smoothing filter for the ring. """ | saltastro/pysalt | [
15,
18,
15,
33,
1366643211
] |
def update_relations(self, **kwarg):
pass | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def contributed_values(self):
return self._contributed_values(self.contributed_values_obj) | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def _contributed_values(contributed_values_obj):
if not contributed_values_obj:
return {}
if not isinstance(contributed_values_obj, list):
contributed_values_obj = [contributed_values_obj]
ret = {}
try:
for obj in contributed_values_obj:
... | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def contributed_values(self, dict_values):
return dict_values | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def records(self):
"""calculated property when accessed, not saved in the DB
A view of the many to many relation"""
return self._records(self.records_obj) | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def _records(records_obj):
if not records_obj:
return []
if not isinstance(records_obj, list):
records_obj = [records_obj]
ret = []
try:
for rec in records_obj:
ret.append(rec.to_dict(exclude=["dataset_id"]))
except Exception... | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def records(self, dict_values):
return dict_values | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def contributed_values(self):
return self._contributed_values(self.contributed_values_obj) | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def _contributed_values(contributed_values_obj):
return DatasetORM._contributed_values(contributed_values_obj) | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def contributed_values(self, dict_values):
return dict_values | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def records(self):
"""calculated property when accessed, not saved in the DB
A view of the many to many relation"""
return self._records(self.records_obj) | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def _records(records_obj):
if not records_obj:
return []
if not isinstance(records_obj, list):
records_obj = [records_obj]
ret = []
try:
for rec in records_obj:
ret.append(rec.to_dict(exclude=["reaction_dataset_id"]))
except ... | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def records(self, dict_values):
return dict_values | psi4/mongo_qcdb | [
120,
42,
120,
82,
1484857698
] |
def sm_section(name: str) -> str:
""":return: section title used in .gitmodules configuration file"""
return f'submodule "{name}"' | gitpython-developers/GitPython | [
3885,
833,
3885,
140,
1291138443
] |
def mkhead(repo: 'Repo', path: PathLike) -> 'Head':
""":return: New branch/head instance"""
return git.Head(repo, git.Head.to_full_path(path)) | gitpython-developers/GitPython | [
3885,
833,
3885,
140,
1291138443
] |
def __init__(self, *args: Any, **kwargs: Any) -> None:
self._smref: Union['ReferenceType[Submodule]', None] = None
self._index = None
self._auto_write = True
super(SubmoduleConfigParser, self).__init__(*args, **kwargs) | gitpython-developers/GitPython | [
3885,
833,
3885,
140,
1291138443
] |
def set_submodule(self, submodule: 'Submodule') -> None:
"""Set this instance's submodule. It must be called before
the first write operation begins"""
self._smref = weakref.ref(submodule) | gitpython-developers/GitPython | [
3885,
833,
3885,
140,
1291138443
] |
def write(self) -> None: # type: ignore[override]
rval: None = super(SubmoduleConfigParser, self).write()
self.flush_to_index()
return rval | gitpython-developers/GitPython | [
3885,
833,
3885,
140,
1291138443
] |
def show_title(self, obj):
if not obj.target:
return '-- %s --' % ugettext('empty position')
else:
return u'%s [%s]' % (obj.target.title, ugettext(obj.target_ct.name),) | WhiskeyMedia/ella | [
1,
1,
1,
1,
1345455562
] |
def is_filled(self, obj):
if obj.target:
return True
else:
return False | WhiskeyMedia/ella | [
1,
1,
1,
1,
1345455562
] |
def is_active(self, obj):
if obj.disabled:
return False
now = timezone.now()
active_from = not obj.active_from or obj.active_from <= now
active_till = not obj.active_till or obj.active_till > now
return active_from and active_till | WhiskeyMedia/ella | [
1,
1,
1,
1,
1345455562
] |
def save(names, filename):
"""Saves the named snippets to a file."""
root = ET.Element('snippets')
root.text = '\n\n'
root.tail = '\n'
d = ET.ElementTree(root)
comment = ET.Comment(_comment.format(appinfo=appinfo))
comment.tail = '\n\n'
root.append(comment)
for name in names:
... | wbsoft/frescobaldi | [
612,
145,
612,
441,
1296225531
] |
def changed(item):
if item in (new, updated):
for i in range(item.childCount()):
c = item.child(i)
c.setCheckState(0, item.checkState(0)) | wbsoft/frescobaldi | [
612,
145,
612,
441,
1296225531
] |
def __init__(self, sun_vectors, sun_up_hours):
"""Radiance-based analemma.
Args:
sun_vectors: A list of sun vectors as (x, y, z).
sun_up_hours: List of hours of the year that corresponds to sun_vectors.
"""
RadianceSky.__init__(self)
vectors = sun_vectors... | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def from_json(cls, inp):
"""Create an analemma from a dictionary."""
return cls(inp['sun_vectors'], inp['sun_up_hours']) | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def from_location(cls, location, hoys=None, north=0, is_leap_year=False):
"""Generate a radiance-based analemma for a location.
Args:
location: A ladybug location.
hoys: A list of hours of the year (default: range(8760)).
north: North angle from Y direction (default:... | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def from_location_sun_up_hours(cls, location, sun_up_hours, north=0,
is_leap_year=False):
"""Generate a radiance-based analemma for a location.
Args:
location: A ladybug location.
sun_up_hours: A list of hours of the year to be included in anal... | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def from_wea(cls, wea, hoys=None, north=0, is_leap_year=False):
"""Generate a radiance-based analemma from a ladybug wea.
NOTE: Only the location from wea will be used for creating analemma. For
climate-based sun materix see SunMatrix class.
Args:
wea: A ladybug Wea.
... | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def from_wea_sun_up_hours(cls, wea, sun_up_hours, north=0, is_leap_year=False):
"""Generate a radiance-based analemma from a ladybug wea.
NOTE: Only the location from wea will be used for creating analemma. For
climate-based sun materix see SunMatrix class.
Args:
wea: A... | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def from_epw_file(cls, epw_file, hoys=None, north=0, is_leap_year=False):
"""Create sun matrix from an epw file.
NOTE: Only the location from epw file will be used for creating analemma. For
climate-based sun materix see SunMatrix class.
Args:
epw_file: Full path to an ... | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def from_epw_file_sun_up_hours(cls, epw_file, sun_up_hours, north=0,
is_leap_year=False):
"""Create sun matrix from an epw file.
NOTE: Only the location from epw file will be used for creating analemma. For
climate-based sun materix see SunMatrix class.
... | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def isAnalemma(self):
"""Return True."""
return True | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def is_climate_based(self):
"""Return True if generated based on values from weather file."""
return False | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def analemma_file(self):
"""Analemma file name.
Use this file to create the octree.
"""
return 'analemma.rad' | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def sunlist_file(self):
"""Sun list file name.
Use this file as the list of modifiers in rcontrib.
"""
return 'analemma.mod' | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def sun_vectors(self):
"""Return list of sun vectors."""
return self._sun_vectors | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def sun_up_hours(self):
"""Return list of hours for sun vectors."""
return self._sun_up_hours | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def duplicate(self):
"""Duplicate this class."""
return Analemma(self.sun_vectors, self.sun_up_hours) | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def to_json(self):
"""Convert analemma to a dictionary."""
return {'sun_vectors': self.sun_vectors, 'sun_up_hours': self.sun_up_hours} | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def __repr__(self):
"""Analemma representation."""
return 'Analemma: #%d' % len(self.sun_vectors) | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def analemma_file(self):
"""Analemma file name.
Use this file to create the octree.
"""
return 'analemma_reversed.rad' | ladybug-analysis-tools/honeybee | [
90,
26,
90,
38,
1451000618
] |
def _get_contracts_list(self, employee):
'''Return list of contracts in chronological order'''
contracts = []
for c in employee.contract_ids:
l = len(contracts)
if l == 0:
contracts.append(c)
else:
dCStart = datetime.strptime(c... | bwrsandman/openerp-hr | [
1,
3,
1,
4,
1402666223
] |
def get_months_service_to_date(self, cr, uid, ids, dToday=None, context=None):
'''Returns a dictionary of floats. The key is the employee id, and the value is
number of months of employment.'''
res = dict.fromkeys(ids, 0)
if dToday == None:
dToday = date.today()
for... | bwrsandman/openerp-hr | [
1,
3,
1,
4,
1402666223
] |
def _search_amount(self, cr, uid, obj, name, args, context):
ids = set()
for cond in args:
amount = cond[2]
if isinstance(cond[2], (list, tuple)):
if cond[1] in ['in', 'not in']:
amount = tuple(cond[2])
else:
... | bwrsandman/openerp-hr | [
1,
3,
1,
4,
1402666223
] |
def edit(self, spec, prefix):
if '%gcc' in spec:
if '+openmp' in spec:
make_include = join_path('arch', 'makefile.include.linux_gnu_omp')
else:
make_include = join_path('arch', 'makefile.include.linux_gnu')
elif '%nvhpc' in spec:
make_... | LLNL/spack | [
3244,
1839,
3244,
2847,
1389172932
] |
def build(self, spec, prefix):
if '+cuda' in self.spec:
make('gpu', 'gpu_ncl')
else:
make('std', 'gam', 'ncl') | LLNL/spack | [
3244,
1839,
3244,
2847,
1389172932
] |
def _parse_class_args(self):
"""Parse the contrailplugin.ini file.
Opencontrail supports extension such as ipam, policy, these extensions
can be configured in the plugin configuration file as shown below.
Plugin then loads the specified extensions.
contrail_extensions=ipam:<clas... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _get_base_binding_dict(self):
binding = {
portbindings.VIF_TYPE: portbindings.VIF_TYPE_VROUTER,
portbindings.VIF_DETAILS: {
# TODO(praneetb): Replace with new VIF security details
portbindings.CAP_PORT_FILTER:
'security-group' in self.s... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _request_api_server(self, url, data=None, headers=None):
# Attempt to post to Api-Server
response = requests.post(url, data=data, headers=headers)
if (response.status_code == requests.codes.unauthorized):
# Get token from keystone and save it for next request
response... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _relay_request(self, url_path, data=None):
"""Send received request to api server."""
url = "http://%s:%s%s" % (cfg.CONF.APISERVER.api_server_ip,
cfg.CONF.APISERVER.api_server_port,
url_path)
return self._request_api_serve... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _encode_context(self, context, operation, apitype):
cdict = {'user_id': getattr(context, 'user_id', ''),
'is_admin': getattr(context, 'is_admin', False),
'operation': operation,
'type': apitype,
'tenant_id': getattr(context, 'tenant_id', No... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _prune(self, resource_dict, fields):
if fields:
return dict(((key, item) for key, item in resource_dict.items()
if key in fields))
return resource_dict | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _raise_contrail_error(self, status_code, info, obj_name):
if status_code == requests.codes.bad_request:
raise ContrailBadRequestError(
msg=info['message'], resource=obj_name)
error_class = CONTRAIL_EXCEPTION_MAP[status_code]
raise error_class(msg=info['message']) | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _get_resource(self, res_type, context, id, fields):
"""Get a resource from API server.
This method gets a resource from the contrail api server
"""
res_dict = self._encode_resource(resource_id=id, fields=fields)
status_code, res_info = self._request_backend(context, res_dic... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _delete_resource(self, res_type, context, id):
"""Delete a resource in API server
This method deletes a resource in the contrail api server
"""
res_dict = self._encode_resource(resource_id=id)
LOG.debug("delete_%(res_type)s(): %(id)s",
{'res_type': res_typ... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def _count_resource(self, res_type, context, filters):
res_dict = self._encode_resource(filters=filters)
status_code, res_count = self._request_backend(context, res_dict,
res_type, 'READCOUNT')
LOG.debug("get_%(res_type)s_count(): %(res_coun... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def create_network(self, context, network):
"""Creates a new Virtual Network."""
return self._create_resource('network', context, network) | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def update_network(self, context, network_id, network):
"""Updates the attributes of a particular Virtual Network."""
return self._update_resource('network', context, network_id,
network) | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def get_networks(self, context, filters=None, fields=None):
"""Get the list of Virtual Networks."""
return self._list_resource('network', context, filters,
fields) | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
def create_subnet(self, context, subnet):
"""Creates a new subnet, and assigns it a symbolic name."""
if subnet['subnet']['gateway_ip'] is None:
subnet['subnet']['gateway_ip'] = '0.0.0.0'
if subnet['subnet']['host_routes'] != attr.ATTR_NOT_SPECIFIED:
if (len(subnet['sub... | cloudwatt/contrail-neutron-plugin | [
1,
2,
1,
1,
1401891835
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.