Пример #1
0
  public void __setattr__(java.lang.String name, org.python.Object value) {
    // The base object can't have attribute set on it unless the attribute already exists.
    // System.out.println("SETATTRIBUTE NATIVE MODULE " + this + " " + name + " = " + value);
    org.python.types.Type cls = org.python.types.Type.pythonType(this.klass);
    // System.out.println("instance attrs = " + this.attrs);
    // System.out.println("class attrs = " + cls.attrs);

    cls.attrs.put(name, value);
  }
Пример #2
0
  public org.python.Object __getattribute__(java.lang.String name) {
    // System.out.println("GETATTRIBUTE NATIVE MODULE " + this + " " + name);
    org.python.types.Type cls = org.python.types.Type.pythonType(this.klass);
    // System.out.println("instance attrs = " + this.attrs);
    // System.out.println("class attrs = " + cls.attrs);
    org.python.Object value;

    value = cls.attrs.get(name);
    if (value == null) {
      try {
        java.lang.Class java_class = java.lang.Class.forName(java_namespace + "." + name);
        value = new org.python.java.Type(java_class);
        cls.attrs.put(name, value);
      } catch (java.lang.ClassNotFoundException e) {
        throw new org.python.exceptions.NameError(name);
      }
    }
    return value;
  }
Пример #3
0
  static {
    org.python.types.Type cls = org.python.types.Type.pythonType(python.time.class);
    org.Python.initializeModule(python.time.class, cls.attrs);

    vm_start_time = python.platform.impl.clock();
  }