Пример #1
0
 public void __delete__(PyObject obj) {
   PyType self_type = getType();
   PyObject impl = self_type.lookup("__delete__");
   if (impl != null) {
     impl.__get__(this, self_type).__call__(obj);
     return;
   }
   super.__delete__(obj);
 }
Пример #2
0
 public void __delattr__(String name) {
   PyType self_type = getType();
   PyObject impl = self_type.lookup("__delattr__");
   if (impl != null) {
     impl.__get__(this, self_type).__call__(PyString.fromInterned(name));
     return;
   }
   super.__delattr__(name);
 }
Пример #3
0
 public void __delitem__(PyObject key) { // ???
   PyType self_type = getType();
   PyObject impl = self_type.lookup("__delitem__");
   if (impl != null) {
     impl.__get__(this, self_type).__call__(key);
     return;
   }
   super.__delitem__(key);
 }
Пример #4
0
  @SuppressWarnings("unchecked")
  public static Filter[] pathTo(CanonicalPath path) {
    if (!path.isDefined()) {
      return new Filter[0];
    }

    List<Filter> fs = new ArrayList<>();

    for (Path.Segment s : path.getPath()) {
      fs.add(Related.by(Relationships.WellKnown.contains));
      fs.add(With.type(Entity.entityTypeFromSegmentType(s.getElementType())));
      fs.add(With.id(s.getElementId()));
    }

    if (fs.size() < 2) {
      return new Filter[0];
    } else {
      // remove the first 'contains' defined in the loop above
      List<Filter> ret = fs.subList(1, fs.size());
      return ret.toArray(new Filter[ret.size()]);
    }
  }
Пример #5
0
 public void __delslice__(PyObject start, PyObject stop, PyObject step) {
   if (step != null) {
     __delitem__(new PySlice(start, stop, step));
     return;
   }
   PyType self_type = getType();
   PyObject impl = self_type.lookup("__delslice__");
   if (impl != null) {
     PyObject[] indices = PySlice.indices2(this, start, stop);
     impl.__get__(this, self_type).__call__(indices[0], indices[1]);
     return;
   }
   super.__delslice__(start, stop, step);
 }