text:
.class Landroid/net/INetworkManagementEventObserver$Stub$Proxy;
.super Ljava/lang/Object;
.source "INetworkManagementEventObserver.java"

# interfaces
.implements Landroid/net/INetworkManagementEventObserver;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/net/INetworkManagementEventObserver$Stub;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "Proxy"
.end annotation

# instance fields
.field private mRemote:Landroid/os/IBinder;

# direct methods
.method constructor <init>(Landroid/os/IBinder;)V
    .locals 0
    .param p1, "remote"    # Landroid/os/IBinder;

    .prologue
    .line 193
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 195
    iput-object p1, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    .line 193
    return-void
.end method

# virtual methods
.method public addressRemoved(Ljava/lang/String;Landroid/net/LinkAddress;)V
    .locals 5
    .param p1, "iface"    # Ljava/lang/String;
    .param p2, "address"    # Landroid/net/LinkAddress;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 326
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 327
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 329
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 330
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 331
    if-eqz p2, :cond_0

    .line 332
    const/4 v2, 0x1

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 333
    const/4 v2, 0x0

    invoke-virtual {p2, v0, v2}, Landroid/net/LinkAddress;->writeToParcel(Landroid/os/Parcel;I)V

    .line 338
    :goto_0
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x6

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 339
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 342
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 343
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 324
    return-void

    .line 336
    :cond_0
    const/4 v2, 0x0

    :try_start_1
    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 341
    :catchall_0
    move-exception v2

    .line 342
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 343
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 341
    throw v2
.end method

.method public addressUpdated(Ljava/lang/String;Landroid/net/LinkAddress;)V
    .locals 5
    .param p1, "iface"    # Ljava/lang/String;
    .param p2, "address"    # Landroid/net/LinkAddress;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 298
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 299
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 301
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 302
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 303
    if-eqz p2, :cond_0

    .line 304
    const/4 v2, 0x1

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 305
    const/4 v2, 0x0

    invoke-virtual {p2, v0, v2}, Landroid/net/LinkAddress;->writeToParcel(Landroid/os/Parcel;I)V

    .line 310
    :goto_0
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x5

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 311
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 314
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 315
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 296
    return-void

    .line 308
    :cond_0
    const/4 v2, 0x0

    :try_start_1
    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 313
    :catchall_0
    move-exception v2

    .line 314
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 315
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 313
    throw v2
.end method

.method public asBinder()Landroid/os/IBinder;
    .locals 1

    .prologue
    .line 199
    iget-object v0, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    return-object v0
.end method

.method public getInterfaceDescriptor()Ljava/lang/String;
    .locals 1

    .prologue
    .line 203
    const-string/jumbo v0, "android.net.INetworkManagementEventObserver"

    return-object v0
.end method

.method public interfaceAdded(Ljava/lang/String;)V
    .locals 5
    .param p1, "iface"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 257
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 258
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 260
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 261
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 262
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x3

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 263
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 266
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 267
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 255
    return-void

    .line 265
    :catchall_0
    move-exception v2

    .line 266
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 267
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 265
    throw v2
.end method

.method public interfaceClassDataActivityChanged(Ljava/lang/String;ZJ)V
    .locals 5
    .param p1, "label"    # Ljava/lang/String;
    .param p2, "active"    # Z
    .param p3, "tsNanos"    # J
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    const/4 v2, 0x0

    .line 378
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 379
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 381
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v3, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v3}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 382
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 383
    if-eqz p2, :cond_0

    const/4 v2, 0x1

    :cond_0
    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 384
    invoke-virtual {v0, p3, p4}, Landroid/os/Parcel;->writeLong(J)V

    .line 385
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/16 v3, 0x8

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 386
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 389
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 390
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 376
    return-void

    .line 388
    :catchall_0
    move-exception v2

    .line 389
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 390
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 388
    throw v2
.end method

.method public interfaceDnsServerInfo(Ljava/lang/String;J[Ljava/lang/String;)V
    .locals 6
    .param p1, "iface"    # Ljava/lang/String;
    .param p2, "lifetime"    # J
    .param p4, "servers"    # [Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 402
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 403
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 405
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 406
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 407
    invoke-virtual {v0, p2, p3}, Landroid/os/Parcel;->writeLong(J)V

    .line 408
    invoke-virtual {v0, p4}, Landroid/os/Parcel;->writeStringArray([Ljava/lang/String;)V

    .line 409
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/16 v3, 0x9

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 410
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 413
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 414
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 400
    return-void

    .line 412
    :catchall_0
    move-exception v2

    .line 413
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 414
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 412
    throw v2
.end method

.method public interfaceLinkStateChanged(Ljava/lang/String;Z)V
    .locals 5
    .param p1, "iface"    # Ljava/lang/String;
    .param p2, "up"    # Z
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    const/4 v2, 0x0

    .line 236
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 237
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 239
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v3, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v3}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 240
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 241
    if-eqz p2, :cond_0

    const/4 v2, 0x1

    :cond_0
    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 242
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x2

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 243
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 246
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 247
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 234
    return-void

    .line 245
    :catchall_0
    move-exception v2

    .line 246
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 247
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 245
    throw v2
.end method

.method public interfaceRemoved(Ljava/lang/String;)V
    .locals 5
    .param p1, "iface"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 277
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 278
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 280
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 281
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 282
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x4

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 283
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 286
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 287
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 275
    return-void

    .line 285
    :catchall_0
    move-exception v2

    .line 286
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 287
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 285
    throw v2
.end method

.method public interfaceStatusChanged(Ljava/lang/String;Z)V
    .locals 5
    .param p1, "iface"    # Ljava/lang/String;
    .param p2, "up"    # Z
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    const/4 v2, 0x1

    const/4 v3, 0x0

    .line 213
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 214
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 216
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v4, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v4}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 217
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 218
    if-eqz p2, :cond_0

    :goto_0
    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 219
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x1

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 220
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 223
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 224
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 211
    return-void

    :cond_0
    move v2, v3

    .line 218
    goto :goto_0

    .line 222
    :catchall_0
    move-exception v2

    .line 223
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 224
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 222
    throw v2
.end method

.method public limitReached(Ljava/lang/String;Ljava/lang/String;)V
    .locals 5
    .param p1, "limitName"    # Ljava/lang/String;
    .param p2, "iface"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 355
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 356
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 358
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 359
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 360
    invoke-virtual {v0, p2}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 361
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x7

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 362
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 365
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 366
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 353
    return-void

    .line 364
    :catchall_0
    move-exception v2

    .line 365
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 366
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 364
    throw v2
.end method

.method public routeRemoved(Landroid/net/RouteInfo;)V
    .locals 5
    .param p1, "route"    # Landroid/net/RouteInfo;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 446
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 447
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 449
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 450
    if-eqz p1, :cond_0

    .line 451
    const/4 v2, 0x1

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 452
    const/4 v2, 0x0

    invoke-virtual {p1, v0, v2}, Landroid/net/RouteInfo;->writeToParcel(Landroid/os/Parcel;I)V

    .line 457
    :goto_0
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/16 v3, 0xb

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 458
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 461
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 462
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 444
    return-void

    .line 455
    :cond_0
    const/4 v2, 0x0

    :try_start_1
    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 460
    :catchall_0
    move-exception v2

    .line 461
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 462
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 460
    throw v2
.end method

.method public routeUpdated(Landroid/net/RouteInfo;)V
    .locals 5
    .param p1, "route"    # Landroid/net/RouteInfo;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 422
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 423
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 425
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string/jumbo v2, "android.net.INetworkManagementEventObserver"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 426
    if-eqz p1, :cond_0

    .line 427
    const/4 v2, 0x1

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 428
    const/4 v2, 0x0

    invoke-virtual {p1, v0, v2}, Landroid/net/RouteInfo;->writeToParcel(Landroid/os/Parcel;I)V

    .line 433
    :goto_0
    iget-object v2, p0, Landroid/net/INetworkManagementEventObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/16 v3, 0xa

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 434
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 437
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 438
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 420
    return-void

    .line 431
    :cond_0
    const/4 v2, 0x0

    :try_start_1
    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInt(I)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 436
    :catchall_0
    move-exception v2

    .line 437
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 438
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 436
    throw v2
.end method


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Blumea 44:189. 1999

#### Original name
Sapium indicum Willd.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text: Projetos com boas praticas de programação


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>JPEGCam Test Page: Image Resize</title>
	<meta name="generator" content="TextMate http://macromates.com/">
	<meta name="author" content="Joseph Huckaby">

JPEGCam Test Page with Image Resize

Demonstrates resizing the image from 320x240 down to 160x120 before upload.

<form>
		<input type=button value="Configure..." onClick="webcam.configure()">

		<input type=button value="Take Snapshot" onClick="take_snapshot()">
	</form>


text:
import os
import csv
import sys

import dogexam.utils as utils
import dogexam.db as db

script_path = os.path.dirname(os.path.realpath(__file__))
db_path = os.path.join(script_path, 'data', 'exambot.db')
DB = db.ExamBotDB(db_path)

if len(sys.argv) != 2:
    print("Usage: python -m dogexam.import_exams EXAM_LIST.csv")
    sys.exit()

exam_list_file = sys.argv[1]

if not utils.check_file_exists(exam_list_file):
    print("Error: " + exam_list_file + " does not exist.")
    sys.exit()

# Process the modules in the data file.
dataset = []
with open(exam_list_file, 'r') as csvfile:
    content = csv.reader(csvfile, delimiter=',')
    for line in content:
        dataset.append((line[0].strip(), line[1].strip(),
         line[2].strip().replace('"', '')))

# Confirm with the user.
print("The following exams will be imported:")
for row in dataset:
    print(row)
if input("Confirm? [y/n]: ").lower() != "y":
    print("Cancelled.")
    sys.exit()

# Insert the exams.
if DB.system_import_modules(dataset):
    print("Exams have been imported.")
else:
    print("There are issues in the exam list CSV, please see the error messages\
     for more details.")


text:
<?php
/**
 * bloodstone community V1.0.0
 * attachmentAPI Class !
 * an API to handle threads attachments system
 * @link https://www.facebook.com/Mazn.touati
 * @author Mazen Touati
 * @version 1.0.0
 */

class attachmentAPI extends databaseAPI{
    /**
     * @var  string
     */
    private $_table = 'attachment';

    private static $_instance = null;

    public static function getInstance(){
        if (!isset(self::$_instance)){
            self::$_instance = new attachmentAPI(Controller::$db);
        }
        return self::$_instance;
    }
    /**
     * define the database variable when call this class
     * @param $db
     */
    function __construct($db){
        $this->setDataBase($db);
    }

    /**
     * @param string $rows
     * @param null $where
     * @return mixed
     */
    public function getAttachments($rows = '*', $where = null)
    {
        return parent::selectData($rows, $where, $this->_table);
    }

    /**
     * @param $id
     * @return mixed
     */
    public function getAttachmentById($id)
    {
        return parent::selectData("*", [ ['id', '=', $id] ], $this->_table);
    }

    /**
     * @param $thread
     * @param string $rows
     * @return bool|mixed
     */
    public function getThreadAttachments($thread, $rows = "*")
    {
        if (threadsAPI::getInstance()->isExist($thread))
            return parent::selectData($rows, [ ['thread_id', '=', $thread] ], $this->_table);
        else
            return false;
    }

    /**
     * @param array $data
     * @return bool
     */
    public function addAttachment($data = array())
    {
        if (threadsAPI::getInstance()->isExist($data['thread_id']))
            return (parent::insertData($this->_table, array_keys($data), array_values($data))) ? true : false;
        else
            return false;
    }

    public function deleteAttachment($id)
    {
        return parent::deleteData($this->_table, ['field' => 'id', 'value' => $id]);
    }

    /**
     * @param $thread
     * @return string
     */
    public function getFilesReadyForDownload($thread)
    {
        Controller::$language->load('attachment');
        $attachs = $this->getThreadAttachments($thread);
        $links = "";
        foreach($attachs as $attach)
        {
            $path = $attach->path;
            if (file_exists(ROOT.'public/attachment/'.$path))
            {
                if (isset($path[35]))
                    $path = mb_substr($path, 0, 30, 'UTF-8').'[...]';
                $links .= "
id}'>{$path} - {$attach->size}
";
            }else{
                $links .= "
". Language::invokeOutput('file-not-found') ." - 0b
";
            }
        }
        return $links;
    }

    /**
     * @param $id
     * @return bool
     */
    public function deleteThreadAttachments($id)
    {
        $getAttach = $this->getThreadAttachments($id);
        if (empty($getAttach))
            return true;
        foreach($getAttach as $attch)
        {
            $this->deleteAttachment($attch->id);
            if (is_readable(ROOT.'public/attachment/'.$attch->path))
                unlink(ROOT.'public/attachment/'.$attch->path);
        }
    }

    public static function fetchAttachments($jsonFile)
    {
        $getFiles = json_decode(base64_decode($jsonFile));
        if (empty($getFiles))
            return false;

        $links = '';
        foreach ($getFiles as $file)
            $links .= "
{$file->newName} - {$file->size}
";

        return $links;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using Gallio.Model;

namespace Gallio.Runner.Events
{
    /// <summary>
    /// The Gallio.Runner.Events namespace contains event types that are used by the test runner.
    /// </summary>
    [CompilerGenerated]
    class NamespaceDoc
    {
    }
}


text:
using namespace IECore;
using namespace Gaffer;
using namespace GafferOSL;

//////////////////////////////////////////////////////////////////////////
// ClosurePlug
//////////////////////////////////////////////////////////////////////////

GAFFER_PLUG_DEFINE_TYPE( ClosurePlug );

ClosurePlug::ClosurePlug( const std::string &name, Direction direction, unsigned flags )
	:	Plug( name, direction, flags )
{
}

ClosurePlug::~ClosurePlug()
{
}

bool ClosurePlug::acceptsChild( const GraphComponent *potentialChild ) const
{
	return false;
}

Gaffer::PlugPtr ClosurePlug::createCounterpart( const std::string &name, Direction direction ) const
{
	return new ClosurePlug( name, direction, getFlags() );
}

bool ClosurePlug::acceptsInput( const Gaffer::Plug *input ) const
{
	if( !Plug::acceptsInput( input ) )
	{
		return false;
	}

	if( !input )
	{
		return true;
	}

	// We only want to accept connections from other
	// ClosurePlugs.
	if( runTimeCast<const ClosurePlug>( input ) )
	{
		return true;
	}

	// But we must also provide backwards compatibility
	// to a time when closure plugs didn't exist, and
	// regular Plugs were used instead. These may have
	// been promoted onto Boxes and passed through Dots,
	// so we must accept such connections to keep old
	// files loading. We only need to consider this when
	// a script is currently being loaded.
	const ScriptNode *script = ancestor<ScriptNode>();
	if( !script || !script->isExecuting() )
	{
		return false;
	}

	const Node *node = input->node();
	return
		runTimeCast<const SubGraph>( node ) ||
		runTimeCast<const Switch>( node ) ||
		runTimeCast<const Dot>( node )
	;
}


text:
using System;
using System.Threading.Tasks;
using Xamarin.Forms.Platform.UWP;

[assembly: ExportRendererAttribute(typeof(Urho.Forms.UrhoSurface), typeof(Urho.Forms.UwpSurfaceRenderer))]

namespace Urho.Forms
{

	public class UwpSurfaceRenderer : ViewRenderer<Urho.Forms.UrhoSurface, Urho.UWP.UrhoSurface>
	{
		Urho.UWP.UrhoSurface urhoSurface = null;

		protected override void OnElementChanged(ElementChangedEventArgs<UrhoSurface> e)
		{
			urhoSurface = new Urho.UWP.UrhoSurface();
			e.NewElement.UrhoApplicationLauncher = UrhoLauncher;
			SetNativeControl(urhoSurface);
			base.OnElementChanged(e);
		}

		Task<Application> UrhoLauncher(Type type, ApplicationOptions opts)
		{
			var app = urhoSurface.Run(type, opts);
			return Task.FromResult(app);
		}
	}
}


text:
package com.baidubce.services.tablestorage.model.transform;

/**
 * Used to parse T from R.
 */
public interface Unmarshaller<T, R> {
    public T unmarshall(R in) throws Exception;

}


text: EventBus is a distributed messaging platform


text:
<?php

namespace Oro\Bundle\ImportExportBundle\Serializer\Encoder;

use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\EncoderInterface;

/**
 * This encoder is used by import/export processor, no encoding/decoding is required, all work is done by normalizers
 */
class DummyEncoder implements EncoderInterface, DecoderInterface
{
    /**
     * {@inheritdoc}
     */
    public function encode($data, $format, array $context = array())
    {
        return $data;
    }

    /**
     * {@inheritdoc}
     */
    public function decode($data, $format, array $context = array())
    {
        return $data;
    }

    /**
     * {@inheritdoc}
     */
    public function supportsEncoding($format)
    {
        return empty($format);
    }

    /**
     * {@inheritdoc}
     */
    public function supportsDecoding($format)
    {
        return empty($format);
    }
}


text:
cask 'bean' do
  version :latest
  sha256 :no_check

  url 'http://www.bean-osx.com/releases/Bean-Install.zip'
  name 'Bean'
  homepage 'http://www.bean-osx.com'
  license :gratis

  app 'Bean-Install/Bean.app'
end


text:
using namespace rapidjson;

namespace chrono {
namespace vehicle {

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
WheeledVehicle::WheeledVehicle(const std::string& filename,
                               ChContactMethod contact_method,
                               bool create_powertrain,
                               bool create_tires)
    : ChWheeledVehicle("", contact_method) {
    Create(filename, create_powertrain, create_tires);
}

WheeledVehicle::WheeledVehicle(ChSystem* system, const std::string& filename, bool create_powertrain, bool create_tires)
    : ChWheeledVehicle("", system) {
    Create(filename, create_powertrain, create_tires);
}

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void WheeledVehicle::Create(const std::string& filename, bool create_powertrain, bool create_tires) {
    // Open and parse the input file
    Document d;
    ReadFileJSON(filename, d);
    if (d.IsNull())
        return;

    // Read top-level data
    assert(d.HasMember("Type"));
    assert(d.HasMember("Template"));
    assert(d.HasMember("Name"));

    std::string name = d["Name"].GetString();
    std::string type = d["Type"].GetString();
    std::string subtype = d["Template"].GetString();
    assert(type.compare("Vehicle") == 0);
    assert(subtype.compare("WheeledVehicle") == 0);

    SetName(name);

    // ----------------------------
    // Validations of the JSON file
    // ----------------------------

    assert(d.HasMember("Chassis"));
    assert(d.HasMember("Axles"));
    assert(d["Axles"].IsArray());

    // Extract number of rear chassis subsystems
    if (d.HasMember("Rear Chassis")) {
        assert(d["Rear Chassis"].IsArray());
        m_num_rear_chassis = d["Rear Chassis"].Size();
    } else {
        m_num_rear_chassis = 0;
    }

    // Extract number of subchassis subsystems
    if (d.HasMember("Subchassis")) {
        assert(d["Subchassis"].IsArray());
        m_num_subch = d["Subchassis"].Size();
    } else {
        m_num_subch = 0;
    }

    // Extract the number of axles.
    m_num_axles = d["Axles"].Size();

    // Extract the number of steering subsystems
    if (d.HasMember("Steering Subsystems")) {
        assert(d["Steering Subsystems"].IsArray());
        m_num_strs = d["Steering Subsystems"].Size();
    } else {
        m_num_strs = 0;
    }

    // Resize arrays
    if (m_num_rear_chassis > 0) {
        m_chassis_rear.resize(m_num_rear_chassis);
        m_chassis_connectors.resize(m_num_rear_chassis);
        m_rearch_chassis_index.resize(m_num_rear_chassis);
    }

    if (m_num_subch > 0) {
        m_subchassis.resize(m_num_subch);
        m_subch_locations.resize(m_num_subch);
        m_subch_chassis_index.resize(m_num_subch);
    }

    m_axles.resize(m_num_axles);
    m_arb_locations.resize(m_num_axles);
    m_susp_locations.resize(m_num_axles);
    m_susp_steering_index.resize(m_num_axles, -1);    // default: non-steerbale
    m_susp_chassis_index.resize(m_num_axles, -1);     // default: attached to main chassis
    m_susp_subchassis_index.resize(m_num_axles, -1);  // default: no subchassis attachment

    if (m_num_strs > 0) {
        m_steerings.resize(m_num_strs);
        m_str_locations.resize(m_num_strs);
        m_str_rotations.resize(m_num_strs);
        m_str_chassis_index.resize(m_num_strs, -1);  // default: attach to main chassis
    }

    m_wheel_separations.resize(m_num_axles, 0.0);

    // -------------------------------------------
    // Create the chassis system
    // -------------------------------------------

    {
        std::string file_name = d["Chassis"]["Input File"].GetString();
        m_chassis = ReadChassisJSON(vehicle::GetDataFile(file_name));
        if (d["Chassis"].HasMember("Output")) {
            m_chassis->SetOutput(d["Chassis"]["Output"].GetBool());
        }
    }

    // ---------------------------------------------------------
    // Create rear chassis and corresponding connectors (if any)
    // ---------------------------------------------------------

    for (int i = 0; i < m_num_rear_chassis; i++) {
        std::string file_name = d["Rear Chassis"][i]["Input File"].GetString();
        m_chassis_rear[i] = ReadChassisRearJSON(vehicle::GetDataFile(file_name));
        if (d["Rear Chassis"][i].HasMember("Output")) {
            m_chassis->SetOutput(d["Rear Chassis"][i]["Output"].GetBool());
        }
        file_name = d["Rear Chassis"][i]["Connector Input File"].GetString();
        m_chassis_connectors[i] = ReadChassisConnectorJSON(vehicle::GetDataFile(file_name));
        m_rearch_chassis_index[i] = d["Rear Chassis"][i]["Chassis Index"].GetInt();
    }

    // -------------------------------------
    // Create subchassis subsystems (if any)
    // -------------------------------------

    for (int i = 0; i < m_num_subch; i++) {
        std::string file_name = d["Subchassis"][i]["Input File"].GetString();
        m_subchassis[i] = ReadSubchassisJSON(vehicle::GetDataFile(file_name));
        m_subch_locations[i] = ReadVectorJSON(d["Subchassis"][i]["Subchassis Location"]);
        m_subch_chassis_index[i] = d["Subchassis"][i]["Chassis Index"].GetInt();
    }

    // ------------------------------
    // Create the steering subsystems
    // ------------------------------

    for (int i = 0; i < m_num_strs; i++) {
        std::string file_name = d["Steering Subsystems"][i]["Input File"].GetString();
        m_steerings[i] = ReadSteeringJSON(vehicle::GetDataFile(file_name));
        if (d["Steering Subsystems"][i].HasMember("Output")) {
            m_steerings[i]->SetOutput(d["Steering Subsystems"][i]["Output"].GetBool());
        }
        m_str_locations[i] = ReadVectorJSON(d["Steering Subsystems"][i]["Location"]);
        m_str_rotations[i] = ReadQuaternionJSON(d["Steering Subsystems"][i]["Orientation"]);

        // Index of chassis subsystem (if applicable)
        if (d["Steering Subsystems"][i].HasMember("Chassis Index")) {
            m_str_chassis_index[i] = d["Steering Subsystems"][i]["Chassis Index"].GetInt();
        }
    }

    // ------------------------------------
    // Create the powertrain (if specified)
    // ------------------------------------

    if (create_powertrain && d.HasMember("Powertrain")) {
        std::string file_name = d["Powertrain"]["Input File"].GetString();
        m_powertrain = ReadPowertrainJSON(vehicle::GetDataFile(file_name));
    }

    // --------------------
    // Create the driveline
    // --------------------

    if (d.HasMember("Driveline")) {
        std::string file_name = d["Driveline"]["Input File"].GetString();
        m_driveline = ReadDrivelineWVJSON(vehicle::GetDataFile(file_name));
        if (d["Driveline"].HasMember("Output")) {
            m_driveline->SetOutput(d["Driveline"]["Output"].GetBool());
        }
        SizeType num_driven_axles = d["Driveline"]["Suspension Indexes"].Size();
        m_driven_axles.resize(num_driven_axles);
        for (SizeType i = 0; i < num_driven_axles; i++) {
            m_driven_axles[i] = d["Driveline"]["Suspension Indexes"][i].GetInt();
        }
    }

    // ---------------------------------------------------
    // Create the suspension, wheel, and brake subsystems.
    // Create tires (if specified)
    // ---------------------------------------------------

    for (int i = 0; i < m_num_axles; i++) {
        m_axles[i] = chrono_types::make_shared<ChAxle>();

        // Suspension
        std::string file_name = d["Axles"][i]["Suspension Input File"].GetString();
        m_axles[i]->m_suspension = ReadSuspensionJSON(vehicle::GetDataFile(file_name));
        m_susp_locations[i] = ReadVectorJSON(d["Axles"][i]["Suspension Location"]);

        // Index of steering subsystem (if applicable)
        if (d["Axles"][i].HasMember("Steering Index")) {
            m_susp_steering_index[i] = d["Axles"][i]["Steering Index"].GetInt();
        }

        // Index of chassis subsystem (if applicable)
        if (d["Axles"][i].HasMember("Chassis Index")) {
            m_susp_chassis_index[i] = d["Axles"][i]["Chassis Index"].GetInt();
        }

        // Index of subchassis subsystem (if applicable)
        if (d["Axles"][i].HasMember("Subchassis Index")) {
            m_susp_subchassis_index[i] = d["Axles"][i]["Subchassis Index"].GetInt();
        }

        // Antirollbar (if applicable)
        if (d["Axles"][i].HasMember("Antirollbar Input File")) {
            assert(m_axles[i]->m_suspension->IsIndependent());
            assert(d["Axles"][i].HasMember("Antirollbar Location"));
            file_name = d["Axles"][i]["Antirollbar Input File"].GetString();
            m_axles[i]->m_antirollbar = ReadAntirollbarJSON(vehicle::GetDataFile(file_name));
            m_arb_locations[i] = ReadVectorJSON(d["Axles"][i]["Antirollbar Location"]);
        }

        // Check if there are double wheels
        // Otherwise, assume only two
        if (d["Axles"][i].HasMember("Wheel Separation")) {
            m_wheel_separations[i] = d["Axles"][i]["Wheel Separation"].GetDouble();

            int num_wheels = 4;
            m_axles[i]->m_wheels.resize(num_wheels);
            file_name = d["Axles"][i]["Left Inside Wheel Input File"].GetString();
            m_axles[i]->m_wheels[0] = ReadWheelJSON(vehicle::GetDataFile(file_name));

            file_name = d["Axles"][i]["Right Inside Wheel Input File"].GetString();
            m_axles[i]->m_wheels[1] = ReadWheelJSON(vehicle::GetDataFile(file_name));

            file_name = d["Axles"][i]["Left Outside Wheel Input File"].GetString();
            m_axles[i]->m_wheels[2] = ReadWheelJSON(vehicle::GetDataFile(file_name));

            file_name = d["Axles"][i]["Right Outside Wheel Input File"].GetString();
            m_axles[i]->m_wheels[3] = ReadWheelJSON(vehicle::GetDataFile(file_name));
        } else {
            int num_wheels = 2;
            m_axles[i]->m_wheels.resize(num_wheels);
            file_name = d["Axles"][i]["Left Wheel Input File"].GetString();
            m_axles[i]->m_wheels[0] = ReadWheelJSON(vehicle::GetDataFile(file_name));

            file_name = d["Axles"][i]["Right Wheel Input File"].GetString();
            m_axles[i]->m_wheels[1] = ReadWheelJSON(vehicle::GetDataFile(file_name));
        }

        // Left and right brakes (if specified)
        if (d["Axles"][i].HasMember("Left Brake Input File")) {
            file_name = d["Axles"][i]["Left Brake Input File"].GetString();
            m_axles[i]->m_brake_left = ReadBrakeJSON(vehicle::GetDataFile(file_name));

            file_name = d["Axles"][i]["Right Brake Input File"].GetString();
            m_axles[i]->m_brake_right = ReadBrakeJSON(vehicle::GetDataFile(file_name));
        }

        // Create tires (if specified)
        if (create_tires && d["Axles"][i].HasMember("Tire Input File")) {
            file_name = d["Axles"][i]["Tire Input File"].GetString();
            for (auto& wheel : m_axles[i]->GetWheels()) {
                wheel->SetTire(ReadTireJSON(vehicle::GetDataFile(file_name)));
            }
        }

        if (d["Axles"][i].HasMember("Output")) {
            bool output = d["Axles"][i]["Output"].GetBool();
            m_axles[i]->SetOutput(output);
        }
    }

    // Get the wheelbase (if defined in JSON file).
    // Otherwise, approximate as distance between first and last suspensions.
    if (d.HasMember("Wheelbase")) {
        m_wheelbase = d["Wheelbase"].GetDouble();
    } else {
        m_wheelbase = m_susp_locations[0].x() - m_susp_locations[m_num_axles - 1].x();
    }
    assert(m_wheelbase >= 0);

    // Get the minimum turning radius (if defined in JSON file).
    // Otherwise, use default value.
    if (d.HasMember("Minimum Turning Radius")) {
        m_turn_radius = d["Minimum Turning Radius"].GetDouble();
    } else {
        m_turn_radius = ChWheeledVehicle::GetMinTurningRadius();
    }

    // Set maximum steering angle. Use value from JSON file is provided.
    // Otherwise, use default estimate.
    if (d.HasMember("Maximum Steering Angle")) {
        m_steer_angle = d["Maximum Steering Angle"].GetDouble() * CH_C_DEG_TO_RAD;
    } else {
        m_steer_angle = ChWheeledVehicle::GetMaxSteeringAngle();
    }

    GetLog() << "Loaded JSON: " << filename.c_str() << "\n";
}

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void WheeledVehicle::Initialize(const ChCoordsys<>& chassisPos, double chassisFwdVel) {
    // Initialize the chassis subsystem.
    m_chassis->Initialize(m_system, chassisPos, chassisFwdVel, WheeledCollisionFamily::CHASSIS);

    // Initialize any rear chassis subsystems and their connectors.
    for (int i = 0; i < m_num_rear_chassis; i++) {
        int front_index = m_rearch_chassis_index[i];
        std::shared_ptr<ChChassis> front = (front_index == -1) ? m_chassis : m_chassis_rear[front_index];
        m_chassis_rear[i]->Initialize(front, WheeledCollisionFamily::CHASSIS);
        m_chassis_connectors[i]->Initialize(front, m_chassis_rear[i]);
    }

    // Initialize any subchassis subsystems.
    for (int i = 0; i < m_num_subch; i++) {
        int chassis_index = m_subch_chassis_index[i];
        std::shared_ptr<ChChassis> chassis = (chassis_index == -1) ? m_chassis : m_chassis_rear[chassis_index];
        m_subchassis[i]->Initialize(chassis, m_subch_locations[i]);
    }

    // Initialize the steering subsystems.
    for (int i = 0; i < m_num_strs; i++) {
        int ch_index = m_str_chassis_index[i];
        std::shared_ptr<ChChassis> chassis = (ch_index == -1) ? m_chassis : m_chassis_rear[ch_index];
        m_steerings[i]->Initialize(chassis, m_str_locations[i], m_str_rotations[i]);
    }

    // Initialize the axles (suspension + brakes + wheels + antirollbar)
    for (int i = 0; i < m_num_axles; i++) {
        int ch_index = m_susp_chassis_index[i];
        int subch_index = m_susp_subchassis_index[i];
        int str_index = m_susp_steering_index[i];
        std::shared_ptr<ChChassis> chassis = (ch_index == -1) ? m_chassis : m_chassis_rear[ch_index];
        std::shared_ptr<ChSubchassis> subchassis = (subch_index == -1) ? nullptr : m_subchassis[subch_index];
        std::shared_ptr<ChSteering> steering = (str_index == -1) ? nullptr : m_steerings[str_index];
        m_axles[i]->Initialize(chassis, subchassis, steering, m_susp_locations[i], m_arb_locations[i],
                               m_wheel_separations[i]);
        // Initialize tires (if present)
        for (auto& wheel : m_axles[i]->GetWheels()) {
            if (wheel->GetTire()) {
                InitializeTire(wheel->GetTire(), wheel);
            }
        }
    }

    // Initialize the driveline
    if (m_driveline) {
        m_driveline->Initialize(m_chassis, m_axles, m_driven_axles);

        // Sanity check: make sure the driveline can accommodate the number of driven axles.
        assert(m_driveline->GetNumDrivenAxles() == m_driven_axles.size());
    }

    // Initialize the powertain (if present)
    if (m_powertrain) {
        InitializePowertrain(m_powertrain);
    }

    // Invoke base class method
    ChWheeledVehicle::Initialize(chassisPos, chassisFwdVel);
}

}  // end namespace vehicle
}  // end namespace chrono


text:
#include "3rdparty/INIReader.h"
#include "examples/cpp/multi_gpu_gpt/gpt_example_utils.h"
#include "src/fastertransformer/models/gptneox/GptNeoX.h"
#include "src/fastertransformer/utils/mpi_utils.h"
#include "src/fastertransformer/utils/nccl_utils.h"
#include "src/fastertransformer/utils/nvtx_utils.h"
#include "src/fastertransformer/utils/word_list.h"

#include <cuda_profiler_api.h>
#include <fstream>
#include <sstream>
#include <string>
#include <sys/time.h>
#include <vector>

#ifdef USE_NVTX
bool NVTX_ON = true;
#endif

using namespace fastertransformer;

template<typename T>
void gptneox_example(const INIReader reader);

int main(int argc, char* argv[])
{
    mpi::initialize(&argc, &argv);
    srand(0);

    std::string ini_name;
    if (argc == 2) {
        ini_name = std::string(argv[1]);
    }
    else {
        ini_name = "../examples/cpp/gptneox/gptneox_config.ini";
    }

    INIReader reader = INIReader(ini_name);
    if (reader.ParseError() < 0) {
        std::cout << "[ERROR] Can't load '" << ini_name << "'\n";
        return -1;
    }
    const std::string data_type = reader.Get("ft_instance_hyperparameter", "data_type");

    if (data_type == "fp32") {
        gptneox_example<float>(reader);
    }
    else if (data_type == "fp16") {
        gptneox_example<half>(reader);
    }
    else {
        FT_LOG_ERROR("is_fp16 should be 0 (use float) or 1 (use half).");
        return -1;
    }
    mpi::finalize();
    return 0;
}

template<typename T>
void gptneox_example(const INIReader reader)
{
    const std::string model_name = reader.Get("ft_instance_hyperparameter", "model_name");
    std::string       model_dir  = std::string(reader.Get("ft_instance_hyperparameter", "model_dir"));

    int tensor_para_size   = reader.GetInteger("ft_instance_hyperparameter", "tensor_para_size");
    int pipeline_para_size = reader.GetInteger("ft_instance_hyperparameter", "pipeline_para_size");

    const size_t head_num             = reader.GetInteger(model_name, "head_num");
    const size_t size_per_head        = reader.GetInteger(model_name, "size_per_head");
    const size_t vocab_size           = reader.GetInteger(model_name, "vocab_size");
    const size_t decoder_layers       = reader.GetInteger(model_name, "decoder_layers");
    const size_t rotary_embedding_dim = reader.GetInteger(model_name, "rotary_embedding");
    const int    start_id             = reader.GetInteger(model_name, "start_id");
    const int    end_id               = reader.GetInteger(model_name, "end_id");

    const size_t hidden_units = head_num * size_per_head;
    const size_t inter_size   = 4 * hidden_units;

    const size_t beam_width                 = reader.GetInteger("request", "beam_width");
    const uint   top_k                      = (uint)reader.GetInteger("request", "top_k");
    const float  top_p                      = reader.GetFloat("request", "top_p");
    const float  temperature                = reader.GetFloat("request", "temperature");
    const float  repetition_penalty         = reader.GetFloat("request", "repetition_penalty");
    const float  len_penalty                = reader.GetFloat("request", "len_penalty");
    const float  beam_search_diversity_rate = reader.GetFloat("request", "beam_search_diversity_rate");
    const size_t request_batch_size         = reader.GetInteger("request", "request_batch_size");
    // The length of tokens we hope this model to generate
    const int request_output_len = reader.GetInteger("request", "request_output_len");

    FT_CHECK(head_num % tensor_para_size == 0);
    FT_CHECK(decoder_layers % pipeline_para_size == 0);

    // Prepare the parallelism parameters
    int rank       = mpi::getCommWorldRank();
    int world_size = mpi::getCommWorldSize();
    if (rank == 0) {
        printf("Total ranks: %d.\n", world_size);
    }
    int device, device_count;
    check_cuda_error(cudaGetDeviceCount(&device_count));
    check_cuda_error(cudaSetDevice(rank % device_count));
    check_cuda_error(cudaGetDevice(&device));

    struct cudaDeviceProp prop;
    check_cuda_error(cudaGetDeviceProperties(&prop, device));
    printf("Device %s\n", prop.name);

    printf("P%d is running with GPU #%d.\n", rank, device);
    if (tensor_para_size * pipeline_para_size != world_size) {
        if (world_size % pipeline_para_size) {
            printf("[ERROR] tensor_para_size * pipeline_para_size should equal to world_size \n");
            exit(-1);
        }
        tensor_para_size = world_size / pipeline_para_size;
        printf("[INFO] Setting tensor_para_size to %d \n", tensor_para_size);
    }

    const int layers_per_group = decoder_layers / pipeline_para_size;
    if (layers_per_group * pipeline_para_size != (int)decoder_layers) {
        printf("[ERROR] layers_per_group (%d) * pipeline_para_size (%d) should equal to decoder_layers (%ld) \n",
               layers_per_group,
               pipeline_para_size,
               decoder_layers);
        exit(-1);
    }

    // assume gpu_num = k * n,
    // tensor parallelism group size is n
    // pipeline parallelism group size is k
    NcclParam tensor_para;
    NcclParam pipeline_para;
    ftNcclInitialize(tensor_para, pipeline_para, tensor_para_size, pipeline_para_size);

    // Handle bad_words dictionary
    std::vector<int> bad_words;
    read_word_list("../examples/cpp/gptneox/bad_words.csv", bad_words);

    int* d_bad_words = nullptr;
    deviceMalloc(&d_bad_words, bad_words.size(), false);
    cudaH2Dcpy(d_bad_words, bad_words.data(), bad_words.size());

    // Handle stop_words dictionary
    std::vector<int> stop_words;
    read_word_list("../examples/cpp/gptneox/stop_words.csv", stop_words);

    const size_t stop_words_len = stop_words.size() / 2;
    // Tile with same dict for each element
    std::vector<int> tiled_stop_words;
    for (int i = 0; i < request_batch_size; i++) {
        tiled_stop_words.insert(tiled_stop_words.end(), stop_words.begin(), stop_words.end());
    }

    int* d_stop_words = nullptr;
    deviceMalloc(&d_stop_words, tiled_stop_words.size(), false);
    cudaH2Dcpy(d_stop_words, tiled_stop_words.data(), tiled_stop_words.size());

    // Read ids of request from file.
    int              max_input_len = -1;
    std::vector<int> v_start_lengths;
    std::vector<int> v_start_ids;
    read_start_ids(request_batch_size,
                   &v_start_lengths,
                   &v_start_ids,
                   max_input_len,
                   end_id,
                   1,
                   "../examples/cpp/gptneox/start_ids.csv");

    int* d_input_ids;
    int* d_input_lengths;
    if (max_input_len == 0) {
        // unconditional case, no input ids, so do nothing.
        d_input_ids     = nullptr;
        d_input_lengths = nullptr;
    }
    else {
        // conditional case.
        deviceMalloc(&d_input_ids, request_batch_size * max_input_len, false);
        deviceMalloc(&d_input_lengths, request_batch_size, false);
        cudaH2Dcpy(d_input_ids, v_start_ids.data(), request_batch_size * max_input_len);
        cudaH2Dcpy(d_input_lengths, v_start_lengths.data(), request_batch_size);
    }
    std::vector<int> start_ids(request_batch_size, start_id);
    std::vector<int> end_ids(request_batch_size, end_id);

    // Prompt Learning Configurations
    // NOTE: if you don't need prefix prompts, remember to set max_prefix_len to 0 and others to nullptr
    int prompt_learning_start_id = reader.GetInteger(model_name, "prompt_learning_start_id", end_id + 1);
    fastertransformer::PromptLearningType prompt_learning_type =
        static_cast<fastertransformer::PromptLearningType>(reader.GetInteger(model_name, "prompt_learning_type", 0));

    // NOTE: specify task names, take name id, prompt length in order to load those prompt learning tables.
    // NOTE: Please make sure task ids are continuous and start from 0
    // for example:
    // std::map<std::string, std::pair<int, int>> prefix_prompt_table_pair{{"no_prompt", {0, 0}},
    //                                                                     {"prompt_1", {1, 1}},
    //                                                                     {"prompt_2", {2, 2}},
    //                                                                     {"prompt_3", {3, 3}},
    //                                                                     {"prompt_4", {4, 4}},
    //                                                                     {"prompt_5", {5, 5}}};

    std::map<std::string, std::pair<int, int>> prefix_prompt_table_pair;

    // NOTE: get prompt table pairs from configuration files
    const int num_tasks = reader.GetInteger(model_name, "num_tasks", 0);
    for (int task_name_id = 0; task_name_id < num_tasks; task_name_id++) {
        std::string config_task_name = model_name + "_task_" + std::to_string(task_name_id);
        std::string task_name        = reader.Get(config_task_name, "task_name");
        const int   prompt_length    = reader.GetInteger(config_task_name, "prompt_length", 0);
        prefix_prompt_table_pair.insert({task_name, {task_name_id, prompt_length}});
    }

    // NOTE: task_name_ids for each sequence in one batch
    // Each sequence can have different prompt learning task ids
    std::vector<int> prefix_prompt_task_ids(request_batch_size, 0);

    // Set different task ids
    for (int i = 0; i < request_batch_size; i++) {
        prefix_prompt_task_ids[i] = (num_tasks > 0) ? i % num_tasks : 0;
    }

    const int total_output_len = max_input_len + request_output_len;

    cudaStream_t     stream;
    cublasHandle_t   cublas_handle;
    cublasLtHandle_t cublaslt_handle;
    cudaStreamCreate(&stream);
    cublasCreate(&cublas_handle);
    cublasLtCreate(&cublaslt_handle);
    cublasSetStream(cublas_handle, stream);
    cublasAlgoMap* cublas_algo_map = new cublasAlgoMap("gemm_config.in");

    Allocator<AllocatorType::CUDA> allocator(getDevice());

    std::mutex*     cublas_wrapper_mutex = new std::mutex();
    cublasMMWrapper cublas_wrapper =
        cublasMMWrapper(cublas_handle, cublaslt_handle, stream, cublas_algo_map, cublas_wrapper_mutex, &allocator);
    if (std::is_same<T, half>::value) {
        cublas_wrapper.setGemmConfig(CUDA_R_16F, CUDA_R_16F, CUDA_R_16F, CUDA_R_32F);
    }
    else if (std::is_same<T, float>::value) {
        cublas_wrapper.setFP32GemmConfig();
    }

    // GPT NeoX Residual Type
    const bool                          use_gptj_residual = (bool)reader.GetInteger(model_name, "use_gptj_residual", 1);
    fastertransformer::GptNeoXWeight<T> gpt_weights(hidden_units,
                                                    inter_size,
                                                    vocab_size,
                                                    decoder_layers,
                                                    0,  // max_seq_len, deprecated
                                                    tensor_para.world_size_,
                                                    tensor_para.rank_,
                                                    pipeline_para.world_size_,
                                                    pipeline_para.rank_,
                                                    use_gptj_residual,
                                                    prompt_learning_type,
                                                    prefix_prompt_table_pair);

    model_dir = model_dir + "/" + std::to_string(tensor_para.world_size_) + "-gpu";
    gpt_weights.loadModel(model_dir);
    unsigned long long random_seed;
    if (rank == 0) {
        random_seed = (unsigned long long)(0);
    }
    if (world_size > 1) {
        mpi::bcast(&random_seed, 1, mpi::MPI_TYPE_UNSIGNED_LONG_LONG, 0, mpi::COMM_WORLD);
    }

    GptNeoX<T> gpt = GptNeoX<T>(head_num,
                                size_per_head,
                                inter_size,
                                decoder_layers,
                                vocab_size,
                                rotary_embedding_dim,
                                start_id,
                                end_id,
                                prompt_learning_start_id,
                                prompt_learning_type,
                                use_gptj_residual,
                                0.0f,
                                top_k,
                                top_p,
                                random_seed,
                                temperature,
                                len_penalty,
                                repetition_penalty,
                                tensor_para,
                                pipeline_para,
                                stream,
                                &cublas_wrapper,
                                &allocator,
                                false,
                                &prop);

    int* d_output_ids;
    int* d_sequence_lengths;
    deviceMalloc(&d_output_ids, request_batch_size * beam_width * total_output_len, false);
    deviceMalloc(&d_sequence_lengths, request_batch_size * beam_width, false);
    std::vector<uint32_t>                   output_seq_len(request_batch_size, total_output_len);
    std::unordered_map<std::string, Tensor> input_tensors = std::unordered_map<std::string, Tensor>{
        {"input_ids",
         Tensor{MEMORY_GPU, TYPE_INT32, std::vector<size_t>{request_batch_size, (size_t)max_input_len}, d_input_ids}},
        {"input_lengths", Tensor{MEMORY_GPU, TYPE_INT32, std::vector<size_t>{request_batch_size}, d_input_lengths}},
        // NOTE: if you need prefix prompts, remember to add prefix_prompt_task_ids here
        // {"prompt_learning_task_name_ids", Tensor{MEMORY_CPU, TYPE_INT32, std::vector<size_t>{request_batch_size},
        // prefix_prompt_task_ids.data()}},
        {"output_seq_len",
         Tensor{MEMORY_CPU, TYPE_UINT32, std::vector<size_t>{request_batch_size}, output_seq_len.data()}},
        {"bad_words_list", Tensor{MEMORY_GPU, TYPE_INT32, {2, bad_words.size() / 2}, d_bad_words}},
        {"stop_words_list", Tensor{MEMORY_GPU, TYPE_INT32, {request_batch_size, 2, stop_words_len}, d_stop_words}},
        {"temperature", Tensor{MEMORY_CPU, TYPE_FP32, std::vector<size_t>{1}, &temperature}},
        {"len_penalty", Tensor{MEMORY_CPU, TYPE_FP32, std::vector<size_t>{1}, &len_penalty}},
        {"repetition_penalty", Tensor{MEMORY_CPU, TYPE_FP32, std::vector<size_t>{1}, &repetition_penalty}},
        {"start_id", Tensor{MEMORY_CPU, TYPE_INT32, std::vector<size_t>{request_batch_size}, start_ids.data()}},
        {"end_id", Tensor{MEMORY_CPU, TYPE_INT32, std::vector<size_t>{request_batch_size}, end_ids.data()}}};

    if (num_tasks > 0) {
        // Prefix Prompt Task Name Ids here
        input_tensors.insert(
            {"prompt_learning_task_name_ids",
             Tensor{MEMORY_CPU, TYPE_INT32, std::vector<size_t>{request_batch_size}, prefix_prompt_task_ids.data()}});
    }

    if (top_k == 0 && top_p == 0.0f) {
        FT_CHECK(beam_width > 1);
        input_tensors.insert({"beam_search_diversity_rate",
                              Tensor{MEMORY_CPU, TYPE_FP32, std::vector<size_t>{1}, &beam_search_diversity_rate}});
    }
    else {
        input_tensors.insert({"random_seed", Tensor{MEMORY_CPU, TYPE_UINT64, std::vector<size_t>{1}, &random_seed}});
        if (top_p != 0.0f) {
            input_tensors.insert({"runtime_top_p", Tensor{MEMORY_CPU, TYPE_FP32, std::vector<size_t>{1}, &top_p}});
        }
        if (top_k != 0) {
            input_tensors.insert({"runtime_top_k", Tensor{MEMORY_CPU, TYPE_UINT32, std::vector<size_t>{1}, &top_k}});
        }
    }

    std::unordered_map<std::string, Tensor> output_tensors = std::unordered_map<std::string, Tensor>{
        {"output_ids",
         Tensor{MEMORY_GPU,
                TYPE_INT32,
                std::vector<size_t>{request_batch_size, beam_width, (size_t)total_output_len},
                d_output_ids}},
        {"sequence_length",
         Tensor{MEMORY_GPU, TYPE_INT32, std::vector<size_t>{request_batch_size, beam_width}, d_sequence_lengths}},
        {"output_log_probs",
         Tensor{MEMORY_GPU,
                TYPE_FP32,
                std::vector<size_t>{(size_t)request_output_len, request_batch_size, beam_width},
                nullptr}}};

    print_mem_usage();

    int ite = 1;
    cudaDeviceSynchronize();
    mpi::barrier();

    cudaProfilerStart();
    // warm up
    ite = 1;
    nvtx::setScope("warmup_time");
    PUSH_RANGE("warmup time")
    for (int i = 0; i < ite; ++i) {
        gpt.forward(&output_tensors, &input_tensors, &gpt_weights);
    }
    cudaDeviceSynchronize();
    mpi::barrier();

    POP_RANGE;
    nvtx::resetScope();

    if (rank == 0) {

        std::string fName   = "out";
        auto        outFile = std::ofstream(fName, std::ios::out);
        if (!outFile.is_open()) {
            printf("[WARNING] Cannot write results into output file %s \n", fName.c_str());
        }
        else {
            size_t outCount = total_output_len * request_batch_size * beam_width;
            int*   hBuf     = new int[outCount];
            cudaD2Hcpy(hBuf, d_output_ids, outCount);

            {
                std::cout << "Writing " << outCount << " elements\n";
                int zeroCount = 0;
                for (size_t i = 0; i < outCount; i++) {
                    if (hBuf[i] == int(0)) {
                        zeroCount++;
                    }
                    outFile << hBuf[i] << " ";
                    if ((i + 1) % (total_output_len) == 0) {
                        outFile << std::endl;
                    }

                    if (i < 10) {
                        printf("%5d ", hBuf[i]);
                    }
                    if ((i + 1) % (total_output_len) == 0 && i < 10) {
                        std::cout << std::endl;
                    }
                }
                std::cout << std::endl << "zeroCount = " << zeroCount << std::endl;
            }
            delete[] hBuf;
        }
    }

    // test time
    struct timeval start, end;
    mpi::barrier();
    cudaDeviceSynchronize();
    gettimeofday(&start, NULL);

    nvtx::setScope("total_time");
    PUSH_RANGE("total time")
    for (int i = 0; i < ite; ++i) {
        gpt.forward(&output_tensors, &input_tensors, &gpt_weights);
    }

    cudaDeviceSynchronize();
    mpi::barrier();

    POP_RANGE;
    nvtx::resetScope();
    gettimeofday(&end, NULL);

    cudaProfilerStop();

    printf("[INFO] request_batch_size %ld beam_width %ld head_num %ld size_per_head %ld total_output_len %d"
           " decoder_layers %ld vocab_size %ld FT-CPP-decoding-beamsearch-time %.2f ms\n",
           request_batch_size,
           beam_width,
           head_num,
           size_per_head,
           total_output_len,
           decoder_layers,
           vocab_size,
           ((end.tv_sec - start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) * 0.001) / ite);

    ftNcclParamDestroy(tensor_para);
    ftNcclParamDestroy(pipeline_para);

    delete cublas_algo_map;
    delete cublas_wrapper_mutex;

    cudaFree(d_bad_words);
    cudaFree(d_stop_words);
    if (d_input_ids != nullptr) {
        cudaFree(d_input_ids);
    }
    if (d_input_lengths != nullptr) {
        cudaFree(d_input_lengths);
    }
    if (d_output_ids != nullptr) {
        deviceFree(d_output_ids);
    }
    if (d_sequence_lengths != nullptr) {
        deviceFree(d_sequence_lengths);
    }

    return;
}


text:
package edu.nanoracket.npr.ui.fragment;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

import edu.nanoracket.npr.R;

public abstract class PreferenceCompatFragment extends Fragment {

    private static final int FIRST_REQUEST_CODE = 100;
    private static final int MSG_BIND_PREFERENCES = 1;
    private static final String PREFERENCES_TAG = "android:preferences";
    private boolean mHavePrefs;
    private boolean mInitDone;
    private ListView mList;
    private PreferenceManager mPreferenceManager;

    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {

                case MSG_BIND_PREFERENCES:
                    bindPreferences();
                    break;
            }
        }
    };

    final private Runnable mRequestFocus = new Runnable() {
        public void run() {
            mList.focusableViewAvailable(mList);
        }
    };

    private void bindPreferences() {
        PreferenceScreen localPreferenceScreen = getPreferenceScreen();
        if (localPreferenceScreen != null) {
            ListView localListView = getListView();
            localPreferenceScreen.bind(localListView);
        }
    }

    private void ensureList() {
        if (mList == null) {
            View view = getView();
            if (view == null) {
                throw new IllegalStateException("Content view not yet created");
            }

            View listView = view.findViewById(android.R.id.list);
            if (!(listView instanceof ListView)) {
                throw new RuntimeException("Content has view with id attribute 'android.R.id.list' that is not a ListView class");
            }

            mList = (ListView)listView;
            if (mList == null) {
                throw new RuntimeException("Your content must have a ListView whose id attribute is 'android.R.id.list'");
            }

            mHandler.post(mRequestFocus);
        }
    }

    private void postBindPreferences() {
        if (mHandler.hasMessages(MSG_BIND_PREFERENCES)) {
            mHandler.obtainMessage(MSG_BIND_PREFERENCES).sendToTarget();
        }
    }

    private void requirePreferenceManager() {
        if (this.mPreferenceManager == null) {
            throw new RuntimeException("This should be called after super.onCreate.");
        }
    }

    public void addPreferencesFromIntent(Intent intent) {
        requirePreferenceManager();
        PreferenceScreen screen = inflateFromIntent(intent, getPreferenceScreen());
        setPreferenceScreen(screen);
    }

    public void addPreferencesFromResource(int resId) {
        requirePreferenceManager();
        PreferenceScreen screen = inflateFromResource(getActivity(), resId, getPreferenceScreen());
        setPreferenceScreen(screen);
    }

    public Preference findPreference(CharSequence key) {
        if (mPreferenceManager == null) {
            return null;
        }
        return mPreferenceManager.findPreference(key);
    }

    public ListView getListView() {
        ensureList();
        return mList;
    }

    public PreferenceManager getPreferenceManager() {
        return mPreferenceManager;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        getListView().setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
        if (mHavePrefs) {
            bindPreferences();
        }
        mInitDone = true;
        if (savedInstanceState != null) {
            Bundle localBundle = savedInstanceState.getBundle(PREFERENCES_TAG);
            if (localBundle != null) {
                PreferenceScreen screen = getPreferenceScreen();
                if (screen != null) {
                    screen.restoreHierarchyState(localBundle);
                }
            }
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        dispatchActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        mPreferenceManager = createPreferenceManager();
    }

    @Override
    public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) {
        return paramLayoutInflater.inflate(R.layout.preference_list_content, paramViewGroup, false);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        dispatchActivityDestroy();
    }

    @Override
    public void onDestroyView() {
        mList = null;
        mHandler.removeCallbacks(mRequestFocus);
        mHandler.removeMessages(MSG_BIND_PREFERENCES);
        super.onDestroyView();
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        PreferenceScreen screen = getPreferenceScreen();
        if (screen != null) {
            Bundle localBundle = new Bundle();
            screen.saveHierarchyState(localBundle);
            bundle.putBundle(PREFERENCES_TAG, localBundle);
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        dispatchActivityStop();
    }

    /** Access methods with visibility private **/
    private PreferenceManager createPreferenceManager() {
        try {
            Constructor<PreferenceManager> c = PreferenceManager.class.getDeclaredConstructor(Activity.class, int.class);
            c.setAccessible(true);
            return c.newInstance(this.getActivity(), FIRST_REQUEST_CODE);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private PreferenceScreen getPreferenceScreen() {
        try {
            Method m = PreferenceManager.class.getDeclaredMethod("getPreferenceScreen");
            m.setAccessible(true);
            return (PreferenceScreen) m.invoke(mPreferenceManager);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void setPreferenceScreen(PreferenceScreen preferenceScreen) {
        try {
            Method m = PreferenceManager.class.getDeclaredMethod("setPreferences", PreferenceScreen.class);
            m.setAccessible(true);
            boolean result = (Boolean) m.invoke(mPreferenceManager, preferenceScreen);
            if (result && preferenceScreen != null) {
                mHavePrefs = true;
                if (mInitDone) {
                    postBindPreferences();
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void dispatchActivityResult(int requestCode, int resultCode, Intent data) {
        try {
            Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityResult", int.class, int.class, Intent.class);
            m.setAccessible(true);
            m.invoke(mPreferenceManager, requestCode, resultCode, data);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void dispatchActivityDestroy() {
        try {
            Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityDestroy");
            m.setAccessible(true);
            m.invoke(mPreferenceManager);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void dispatchActivityStop() {
        try {
            Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityStop");
            m.setAccessible(true);
            m.invoke(mPreferenceManager);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public PreferenceScreen inflateFromResource(Context context, int resId, PreferenceScreen rootPreferences) {
        PreferenceScreen preferenceScreen ;
        try {
            Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
            m.setAccessible(true);
            preferenceScreen = (PreferenceScreen) m.invoke(mPreferenceManager, context, resId, rootPreferences);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return preferenceScreen;
    }

    public PreferenceScreen inflateFromIntent(Intent queryIntent, PreferenceScreen rootPreferences) {
        PreferenceScreen preferenceScreen ;
        try {
            Method m = PreferenceManager.class.getDeclaredMethod("inflateFromIntent", Intent.class, PreferenceScreen.class);
            m.setAccessible(true);
            preferenceScreen = (PreferenceScreen) m.invoke(mPreferenceManager, queryIntent, rootPreferences);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return preferenceScreen;
    }
}


text:
angular.module('viaggia.controllers.mytrips', [])
  /*
  Controller that manages the view with my trips and let the user show them, delete them and modify them
  */
  .controller('MyTripsCtrl', function ($scope, Config, $timeout, ionicMaterialMotion, ionicMaterialInk, planService, $state, $filter) {

    //get the saved trips (currently from localStorage)
    planService.getTrips().then(function (data) {
      $scope.savedTripsDB = data;
      $scope.savedTripsKeys = [];
      if ($scope.savedTripsDB) {
        $scope.savedTripsKeys = Object.keys($scope.savedTripsDB);
      }
      $scope.savedTrips = [];
      for (var k = 0; k < $scope.savedTripsKeys.length; k++) {
        $scope.savedTrips.push($scope.savedTripsDB[$scope.savedTripsKeys[k]]);
      }
    });

    $scope.$on('ngLastRepeat.savedTrips', function (e) {
      $timeout(function () {
        ionicMaterialMotion.ripple();
        ionicMaterialInk.displayEffect()
      }, 0); // No timeout delay necessary.
    });

    //open the details page passing the id for parameter
    $scope.showPlan = function (journey) {
      $state.go('app.tripdetails', {
        tripId: journey.tripId
      });
    }

    //open the popup for confirm the delating. If user press yes, delete the trip at $index position
    $scope.deleteTrip = function ($index) {
      var journey = $scope.savedTrips[$index];
      $scope.showConfirm($filter('translate')("popup_delete_trip_message"), $filter('translate')("popup_delete_trip_title"), function () {
        Config.loading();
        planService.deleteTrip(journey.tripId).then(function (res) {
          $scope.savedTrips.splice($index, 1);
        }).finally(Config.loaded);
      });
    }

    //modify the saved trip setting the configuration in planService, parameters and moving to the new state
    $scope.modifyTrip = function ($index) {
      var journey = $scope.savedTrips[$index];
      $scope.showConfirm($filter('translate')("popup_modify_trip_message"), $filter('translate')("popup_modify_trip_title"), function () {
        Config.loading();
        planService.getTrip(journey.tripId).then(function (trip) {
          if (trip.data) {
            planService.setName("from", trip.data.originalFrom.name);
            planService.setName("to", trip.data.originalTo.name);
            planService.setPlanConfigure(planService.buildConfigureOptions(trip));
            planService.setEditInstance(trip);
            var params = {
              replan: true,
              tripId: journey.clientId
            }
            $state.go('app.plan', params);
          }
        }).finally(Config.loaded);
      });
    }
  })


text:
package net.dxs.mobilesafe.utils.process;

import java.util.ArrayList;
import java.util.List;

import eu.chainfire.libsuperuser.Shell;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * 进程管理器
 *
 * @author lijian-pc
 * @date 2016-5-16 下午4:27:00
 */
public class ProcessManager {

	private static final String TAG = "ProcessManager";

	private static final String APP_ID_PATTERN;

	static {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
			// Android 4.2 (JB-MR1) changed the UID name of apps for multiple
			// user account support.
			APP_ID_PATTERN = "u\\d+_a\\d+";
		} else {
			APP_ID_PATTERN = "app_\\d+";
		}
	}

	public static List<Process> getRunningProcesses() {
		List<Process> processes = new ArrayList<Process>();
		List<String> stdout = Shell.SH.run("toolbox ps -p -P -x -c");
		for (String line : stdout) {
			try {
				processes.add(new Process(line));
			} catch (Exception e) {
				android.util.Log.d(TAG, "Failed parsing line " + line);
			}
		}
		return processes;
	}

	public static List<Process> getRunningApps() {
		List<Process> processes = new ArrayList<Process>();
		List<String> stdout = Shell.SH.run("toolbox ps -p -P -x -c");
		int myPid = android.os.Process.myPid();
		for (String line : stdout) {
			try {
				Process process = new Process(line);
				if (process.user.matches(APP_ID_PATTERN)) {
					if (process.ppid == myPid || process.name.equals("toolbox")) {
						// skip the processes we created to get the running
						// apps.
						continue;
					}
					processes.add(process);
				}
			} catch (Exception e) {
				android.util.Log.d(TAG, "Failed parsing line " + line);
			}
		}
		return processes;
	}

	public static class Process implements Parcelable {

		/** User name */
		public final String user;

		/** User ID */
		public final int uid;

		/** Processes ID */
		public final int pid;

		/** Parent processes ID */
		public final int ppid;

		/** virtual memory size of the process in KiB (1024-byte units). */
		public final long vsize;

		/**
		 * resident set size, the non-swapped physical memory that a task has
		 * used (in kiloBytes).
		 */
		public final long rss;

		public final int cpu;

		/** The priority */
		public final int priority;

		/**
		 * The priority, niceness level
		 */
		public final int niceness;

		/** Real time priority */
		public final int realTimePriority;

		/** 0 (sched_other), 1 (sched_fifo), and 2 (sched_rr). */
		public final int schedulingPolicy;

		/** The scheduling policy. Either "bg", "fg", "un", "er", or "" */
		public final String policy;

		/** address of the kernel function where the process is sleeping */
		public final String wchan;

		public final String pc;

		/**
		 * Possible states:
		 *

		 * "D" uninterruptible sleep (usually IO)
		 *

		 * "R" running or runnable (on run queue)
		 *

		 * "S" interruptible sleep (waiting for an event to complete)
		 *

		 * "T" stopped, either by a job control signal or because it is being
		 * traced
		 *

		 * "W" paging (not valid since the 2.6.xx kernel)
		 *

		 * "X" dead (should never be seen)
		 *

		 * "Z" defunct ("zombie") process, terminated but not reaped by its
		 * parent
		 */
		public final String state;

		/** The process name */
		public final String name;

		/** user time in milliseconds */
		public final long userTime;

		/** system time in milliseconds */
		public final long systemTime;

		// Much dirty. Much ugly.
		private Process(String line) throws Exception {
			String[] fields = line.split("\\s+");
			user = fields[0];
			uid = android.os.Process.getUidForName(user);
			pid = Integer.parseInt(fields[1]);
			ppid = Integer.parseInt(fields[2]);
			vsize = Integer.parseInt(fields[3]) * 1024;
			rss = Integer.parseInt(fields[4]) * 1024;
			cpu = Integer.parseInt(fields[5]);
			priority = Integer.parseInt(fields[6]);
			niceness = Integer.parseInt(fields[7]);
			realTimePriority = Integer.parseInt(fields[8]);
			schedulingPolicy = Integer.parseInt(fields[9]);
			if (fields.length == 16) {
				policy = "";
				wchan = fields[10];
				pc = fields[11];
				state = fields[12];
				name = fields[13];
				userTime = Integer.parseInt(fields[14].split(":")[1].replace(
						",", "")) * 1000;
				systemTime = Integer.parseInt(fields[15].split(":")[1].replace(
						")", "")) * 1000;
			} else {
				policy = fields[10];
				wchan = fields[11];
				pc = fields[12];
				state = fields[13];
				name = fields[14];
				userTime = Integer.parseInt(fields[15].split(":")[1].replace(
						",", "")) * 1000;
				systemTime = Integer.parseInt(fields[16].split(":")[1].replace(
						")", "")) * 1000;
			}
		}

		private Process(Parcel in) {
			user = in.readString();
			uid = in.readInt();
			pid = in.readInt();
			ppid = in.readInt();
			vsize = in.readLong();
			rss = in.readLong();
			cpu = in.readInt();
			priority = in.readInt();
			niceness = in.readInt();
			realTimePriority = in.readInt();
			schedulingPolicy = in.readInt();
			policy = in.readString();
			wchan = in.readString();
			pc = in.readString();
			state = in.readString();
			name = in.readString();
			userTime = in.readLong();
			systemTime = in.readLong();
		}

		public String getPackageName() {
			if (!user.matches(APP_ID_PATTERN)) {
				// this process is not an application
				return null;
			} else if (name.contains(":")) {
				// background service running in another process than the main
				// app process
				return name.split(":")[0];
			}
			return name;
		}

		public PackageInfo getPackageInfo(Context context, int flags)
				throws PackageManager.NameNotFoundException {
			String packageName = getPackageName();
			if (packageName == null) {
				throw new PackageManager.NameNotFoundException(name
						+ " is not an application process");
			}
			return context.getPackageManager().getPackageInfo(packageName,
					flags);
		}

		public ApplicationInfo getApplicationInfo(Context context, int flags)
				throws PackageManager.NameNotFoundException {
			String packageName = getPackageName();
			if (packageName == null) {
				throw new PackageManager.NameNotFoundException(name
						+ " is not an application process");
			}
			return context.getPackageManager().getApplicationInfo(packageName,
					flags);
		}

		@Override
		public int describeContents() {
			return 0;
		}

		@Override
		public void writeToParcel(Parcel dest, int flags) {
			dest.writeString(user);
			dest.writeInt(uid);
			dest.writeInt(pid);
			dest.writeInt(ppid);
			dest.writeLong(vsize);
			dest.writeLong(rss);
			dest.writeInt(cpu);
			dest.writeInt(priority);
			dest.writeInt(niceness);
			dest.writeInt(realTimePriority);
			dest.writeInt(schedulingPolicy);
			dest.writeString(policy);
			dest.writeString(wchan);
			dest.writeString(pc);
			dest.writeString(state);
			dest.writeString(name);
			dest.writeLong(userTime);
			dest.writeLong(systemTime);
		}

		public static final Creator<Process> CREATOR = new Creator<Process>() {

			public Process createFromParcel(Parcel source) {
				return new Process(source);
			}

			public Process[] newArray(int size) {
				return new Process[size];
			}
		};
	}
}


text:
Node.js module that lets you define and use errors consistently across your APIs and apps. Simple. HTTP friendly.

## Example usage

``` js
var assert = require('assert');
var SimpleError = require('.');

var MyError = SimpleError.define('MyError');
var myError = new MyError('boom');

assert.ok(myerror instanceof MyError); // true
assert.ok(myerror instanceof Error); // true
assert.equal(myError.message, 'boom'); // true

var ApiError = SimpleError.define('ApiError', {
  code: 100,
  statusCode: 500,
  methods: {
    badCall: function () {
      return 'Bad call: ' + this.message;
    }
  }
});

var err = new ApiError('NO!');

assert.equal(err.type, 'ApiError'); // true
assert.equal(err.name, 'ApiError'); // true
assert.equal(err.code, 100);        // true
assert.equal(err.statusCode, 500);  // true

console.log(err.toJSON());
// {"success":false,"message":"NO!","statusCode":400,"code":101}

console.log(err.badCall()); // Bad call: NO!

assert.ok(err instanceof Error); // true
assert.ok(err instanceof ApiError); // true

var util = require('util');

// Warning! Does not work with node.js util.isError method
util.isError(err); // false

// Sub errors
var BadRequestError = ApiError.define('BadRequestError', {
  code: 102,
  statusCode: 400,
  message: 'Bad request',
  methods: {
    hello: function () {
      return 'well, hello!';
    }
  }
});

var bad = new BadRequestError();

assert.ok(bad instanceof Error);           // true
assert.ok(bad instanceof ApiError);        // true
assert.ok(bad instanceof BadRequestError); // true

bad.hello(); // well, hello!

// inherited from ApiError
bad.badCall(); // Bad call: Bad request

// Wrapping unknown exceptions
var e = new Error('oops');
var wrappedError = BadRequestError.wrap(e);

assert.ok(wrappedError instanceof ApiError);        // true
assert.ok(wrappedError instanceof BadRequestError); // true
assert.equal(wrappedError.inner, e);                // true

console.log(wrappedError.toJSON());
// {"success":false,"message":"oops","statusCode":400,"code":102}

// Custom error consctructor if needed
var BasicError = SimpleError.define('BasicError', {
   code: 1234,
   statusCode: 400,
   message: 'Error with custom constructor',
   ctor: function (errorCode, links) {
     this.errorCode = errorCode;
     this.links = links;
   }
});

var links = ['http://www.npmjs.org', 'http://www.google.com'];
var err = new BasicError(101, links);

```

## Error definition defaults and options

There are some "sensible" defaults when it comes to defining your errors.

### code (any value)
Meant to be used as an internal code for other apps or APIs. Default is `0`.

### statusCode (integer)
HTTP error status code. Default is `500`.

### message (string)
Message format string. Called by node's util.format for interpolation if needed. Default is `Unknown`.

### exclude (array[string])
Properties to exclude when calling `friendly` method. For example: `exclude: ['code', 'foo', 'bar', 'baz']`.
Properties that are always excluded are `['isError', 'type', 'name']`

### showStack (boolean)
When set to true stacktrace is included in `toJSON` call. Default is `false`

### ctor (function)
If supplied will be used in new error construction as a constructor. See tests.

### methods (dict of functions)
If supplied all the methods will be copied to prototype and thus available on all instances of that
error type. See tests.

## Instance methods

### friendly()
Returns a frendly error object with properties excluded defined in exclude
option

## Class methods

### .wrap(err)
Takes an error and returns an new instance of error with passed in error set as
`.inner` property and all other properties copied over to new instance.

## License

MIT


text:
from __future__ import with_statement

import os, sys
import signal
import time

import safeclose

def main():
  pid = os.fork()
  return child_main() if not pid else parent_main(pid)

def child_main():
  with safeclose.section():
    while not safeclose.exit():
      time.sleep(0.1)
  return 2

def parent_main(pid):
  time.sleep(1)
  os.kill(pid, signal.SIGTERM)

  pid, code = os.wait()
  assert code >> 8 == 2

  return 0

if __name__ == '__main__':
  if not os.fork():
    sys.exit(main())

  else:
    pid, status = os.wait()
    print "Testing safe close on SIGTERM ... ",
    assert status >> 8 == 0
    print '[ OK ]'

    print "Testing safe close on CTRL-C ..."
    flag = False
    try:
      def onexit(): print 'Got exit request.'

      with safeclose.section(onexit):
        print "Press CTRL-C to exit."
        while not safeclose.exit():
          time.sleep(0.3)

      flag = True
    except KeyboardInterrupt:
      assert False # this should not happen

    assert flag is True
    print "[ OK ]"

    print "Done."


text:
package com.facebook.buck.rules.macros;

import com.facebook.buck.model.MacroException;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.SourcePathResolver;

import java.nio.file.Path;

/**
 * Expands to the path of a build rules output.
 */
public class LocationMacroExpander extends BuildTargetMacroExpander {

  @Override
  public String expand(SourcePathResolver resolver, BuildRule rule)
      throws MacroException {
    Path output = rule.getPathToOutput();
    if (output == null) {
      throw new MacroException(
          String.format(
              "%s used in location macro does not produce output",
              rule.getBuildTarget()));
    }
    return rule.getProjectFilesystem().resolve(output).toString();
  }

}


text:
package it.polito.elite.enocean.enj.communication.timing.tasks;

import java.util.Set;

import it.polito.elite.enocean.enj.communication.EnJDeviceChangeType;
import it.polito.elite.enocean.enj.communication.EnJDeviceListener;
import it.polito.elite.enocean.enj.model.EnOceanDevice;

/**
 * @author bonino
 *
 */
public class EnJDeviceChangeDeliveryTask implements Runnable
{
	private EnOceanDevice changedDevice;
	private EnJDeviceChangeType typeOfChange;
	private Set<EnJDeviceListener> listeners;

	/**
	 * Builds a device update delivery task having as subject the given
	 * {@link EnOceanDevice} instance and as type of change the given
	 * {@link EnJDeviceChangeType} value.
	 *
	 * @param changedDevice
	 *            The changed device.
	 * @param typeOfChange
	 *            The type of change (CREATED, MODIFIED or DELETED)
	 * @param listeners
	 *            The {@link EnJDeviceListener}s to be notified.
	 */
	public EnJDeviceChangeDeliveryTask(EnOceanDevice changedDevice,
			EnJDeviceChangeType typeOfChange, Set<EnJDeviceListener> listeners)
	{
		this.changedDevice = changedDevice;
		this.typeOfChange = typeOfChange;
		this.listeners = listeners;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run()
	{
		// deliver to all listeners
		for (EnJDeviceListener listener : this.listeners)
		{
			// deliver the device update notification according to the change
			// type
			switch (this.typeOfChange)
			{
				case CREATED:
				{
					listener.addedEnOceanDevice(changedDevice);
					break;
				}
				case MODIFIED:
				{
					listener.modifiedEnOceanDevice(changedDevice);
					break;
				}
				case DELETED:
				{
					listener.removedEnOceanDevice(changedDevice);
					break;
				}
			}
		}

	}

}


text:
/* eslint no-undef: 0 */
'use strict';
const path = require('path');
const fs = jest.genMockFromModule('fs');
const root = process.cwd();
let mockFiles = Object.create(null);

/**
* The path of the files must be relative to root (process.cwd())
*/
function __setMockFiles(newMockFiles) {
  mockFiles = Object.create(null);
  newMockFiles.forEach(function(file) {
    file = path.normalize(file);
    const dir = path.dirname(file);
    if (!mockFiles[dir]) {
      mockFiles[dir] = [];
    }
    mockFiles[dir].push(path.basename(file));
  });
}

function stat(file, cb) {
  if (this.existsSync(file)) {
    cb(null, {
      isFile: function() { return true; }
    });
  } else {
    cb(new Error("Not a file "+file), null);
  }
}

fs.__setMockFiles = __setMockFiles;
fs.existsSync = function existsSync(file) {
  file = this._normalize(file);
  const dir = path.dirname(file);
  return Boolean(mockFiles[dir] && mockFiles[dir].includes(path.basename(file)));
};
fs._normalize = function normalize(file) {
  return path.relative(this.root || root, path.normalize(file));
}
fs.stat = stat;
fs.readFile = function(file, cb) { cb('body {}'); }

module.exports = fs;


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('core', '0003_auto_20141217_1953'),
    ]

    operations = [
        migrations.AlterField(
            model_name='pearl',
            name='text',
            field=models.TextField(blank=True, max_length=500),
            preserve_default=True,
        ),
    ]