Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | CARL-main/carl/envs/box2d/utils.py | from typing import List
import Box2D
def safe_destroy(world: Box2D.b2World, bodies: List[Box2D.b2Body]) -> None:
for body in bodies:
try:
world.DestroyBody(body)
except AssertionError as error:
if str(error) != "m_bodyCount > 0":
raise error
| 305 | 22.538462 | 75 | py |
null | CARL-main/carl/envs/box2d/parking_garage/__init__.py | __author__ = "André Biedenkapp"
| 32 | 15.5 | 31 | py |
null | CARL-main/carl/envs/box2d/parking_garage/bus.py | from typing import List
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.b2 import p... | 21,459 | 34.296053 | 113 | py |
null | CARL-main/carl/envs/box2d/parking_garage/race_car.py | from typing import List
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.b2 import p... | 22,179 | 34.374801 | 118 | py |
null | CARL-main/carl/envs/box2d/parking_garage/street_car.py | from __future__ import annotations
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.... | 21,788 | 34.314425 | 113 | py |
null | CARL-main/carl/envs/box2d/parking_garage/trike.py | from typing import List
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.b2 import p... | 13,543 | 34.270833 | 117 | py |
null | CARL-main/carl/envs/box2d/parking_garage/utils.py | class Particle:
pass
| 25 | 7.666667 | 15 | py |
null | CARL-main/carl/envs/brax/__init__.py | # flake8: noqa: F401
# Contexts and bounds by name
from carl.envs.brax.carl_ant import CONTEXT_BOUNDS as CARLAnt_bounds
from carl.envs.brax.carl_ant import DEFAULT_CONTEXT as CARLAnt_defaults
from carl.envs.brax.carl_ant import CARLAnt
from carl.envs.brax.carl_fetch import CONTEXT_BOUNDS as CARLFetch_bounds
from carl.e... | 1,269 | 59.47619 | 87 | py |
null | CARL-main/carl/envs/brax/carl_ant.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.ant import _SYSTEM_CONFIG, Ant
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format impo... | 4,160 | 35.5 | 91 | py |
null | CARL-main/carl/envs/brax/carl_fetch.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.fetch import _SYSTEM_CONFIG, Fetch
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format ... | 4,790 | 36.429688 | 91 | py |
null | CARL-main/carl/envs/brax/carl_grasp.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.grasp import _SYSTEM_CONFIG, Grasp
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format ... | 4,911 | 35.932331 | 91 | py |
null | CARL-main/carl/envs/brax/carl_halfcheetah.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.half_cheetah import _SYSTEM_CONFIG, Halfcheetah
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf... | 3,994 | 35.318182 | 91 | py |
null | CARL-main/carl/envs/brax/carl_humanoid.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax import jumpy as jp
from brax.envs.humanoid import _SYSTEM_CONFIG, Humanoid
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from brax.physics import bodies
from google.protobu... | 4,162 | 35.517544 | 91 | py |
null | CARL-main/carl/envs/brax/carl_ur5e.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.ur5e import _SYSTEM_CONFIG, Ur5e
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format im... | 4,690 | 35.648438 | 91 | py |
null | CARL-main/carl/envs/classic_control/__init__.py | # flake8: noqa: F401
# Contexts and bounds by name
from carl.envs.classic_control.carl_acrobot import (
CONTEXT_BOUNDS as CARLAcrobotEnv_bounds,
)
from carl.envs.classic_control.carl_acrobot import (
DEFAULT_CONTEXT as CARLAcrobotEnv_defaults,
)
from carl.envs.classic_control.carl_acrobot import CARLAcrobotEnv
... | 1,525 | 37.15 | 73 | py |
null | CARL-main/carl/envs/classic_control/carl_acrobot.py | from typing import Dict, List, Optional, Union
import numpy as np
from gym.envs.classic_control import AcrobotEnv
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT =... | 6,517 | 38.743902 | 118 | py |
null | CARL-main/carl/envs/classic_control/carl_cartpole.py | from typing import Dict, List, Optional, Union
import numpy as np
from gym.envs.classic_control import CartPoleEnv
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT ... | 4,993 | 38.634921 | 119 | py |
null | CARL-main/carl/envs/classic_control/carl_mountaincar.py | from typing import Dict, List, Optional, Tuple, Union
import gym.envs.classic_control as gccenvs
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT... | 6,035 | 36.962264 | 109 | py |
null | CARL-main/carl/envs/classic_control/carl_mountaincarcontinuous.py | from typing import Dict, List, Optional, Union
import gym.envs.classic_control as gccenvs
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
... | 5,417 | 37.7 | 109 | py |
null | CARL-main/carl/envs/classic_control/carl_pendulum.py | from typing import Dict, List, Optional, Union
import gym.envs.classic_control as gccenvs
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
... | 4,415 | 35.196721 | 109 | py |
null | CARL-main/carl/envs/dmc/__init__.py | # flake8: noqa: F401
# Contexts and bounds by name
from carl.envs.dmc.carl_dm_finger import CONTEXT_BOUNDS as CARLDmcFingerEnv_bounds
from carl.envs.dmc.carl_dm_finger import CONTEXT_MASK as CARLDmcFingerEnv_mask
from carl.envs.dmc.carl_dm_finger import DEFAULT_CONTEXT as CARLDmcFingerEnv_defaults
from carl.envs.dmc.ca... | 1,209 | 59.5 | 88 | py |
null | CARL-main/carl/envs/dmc/carl_dm_finger.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.fish import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Con... | 3,654 | 34.144231 | 94 | py |
null | CARL-main/carl/envs/dmc/carl_dm_fish.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.fish import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Con... | 3,373 | 34.145833 | 94 | py |
null | CARL-main/carl/envs/dmc/carl_dm_quadruped.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.quadruped import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types impor... | 3,342 | 34.56383 | 96 | py |
null | CARL-main/carl/envs/dmc/carl_dm_walker.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.walker import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import C... | 3,336 | 34.5 | 96 | py |
null | CARL-main/carl/envs/dmc/carl_dmcontrol.py | from typing import Dict, List, Optional, Union
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.envs.dmc.loader import load_dmc_env
from carl.envs.dmc.wrappers import MujocoToGymWrapper
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Cont... | 3,171 | 32.744681 | 84 | py |
null | CARL-main/carl/envs/dmc/loader.py | from typing import Any, Dict, List, Optional
import inspect
import dm_env # type: ignore
from dm_control import suite # type: ignore
from carl.envs.dmc.dmc_tasks import ( # type: ignore [import] # noqa: F401
finger,
fish,
quadruped,
walker,
)
from carl.utils.types import Context
_DOMAINS = {
... | 1,770 | 28.032787 | 85 | py |
null | CARL-main/carl/envs/dmc/wrappers.py | from typing import Any, Optional, Tuple, TypeVar, Union
import dm_env # type: ignore
import gym
import numpy as np
from dm_env import StepType
from gym import spaces
ObsType = TypeVar("ObsType")
ActType = TypeVar("ActType")
def get_shape(shape: tuple) -> tuple:
"""
Get shape of array or scalar.
If sca... | 5,348 | 35.141892 | 120 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/finger.py | # flake8: noqa: E501
# Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 9,772 | 36.588462 | 178 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/fish.py | # Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 7,848 | 36.555024 | 87 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/quadruped.py | # Copyright 2019 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 21,376 | 37.241503 | 87 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/utils.py | from __future__ import annotations
from typing import List
from lxml import etree # type: ignore
from carl.utils.types import Context
def adapt_context(
xml_string: bytes, context: Context, context_mask: List = []
) -> bytes:
"""Adapts and returns the xml_string of the model with the given context."""
... | 7,735 | 37.29703 | 88 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/walker.py | # Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 7,522 | 34.995215 | 87 | py |
null | CARL-main/carl/envs/mario/__init__.py | # flake8: noqa: F401
import warnings
try:
from carl.envs.mario.carl_mario import CARLMarioEnv
except Exception as e:
warnings.warn(f"Could not load CARLMarioEnv which is probably not installed ({e}).")
from carl.envs.mario.carl_mario_definitions import CONTEXT_BOUNDS as CARLMarioEnv_bounds
from carl.envs.mari... | 402 | 30 | 88 | py |
null | CARL-main/carl/envs/mario/carl_mario.py | from typing import Dict, List, Optional, Union
import gym
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.envs.mario.carl_mario_definitions import (
DEFAULT_CONTEXT,
INITIAL_HEIGHT,
INITIAL_WIDTH,
)
from carl.envs.mario.mario_env import MarioEnv
from ca... | 2,895 | 36.128205 | 86 | py |
null | CARL-main/carl/envs/mario/carl_mario_definitions.py | import numpy as np
from torch import Tensor
try:
from carl.envs.mario.toad_gan import generate_initial_noise
except FileNotFoundError:
def generate_initial_noise(width: int, height: int, level_index: int) -> Tensor:
return Tensor()
INITIAL_WIDTH = 100
INITIAL_LEVEL_INDEX = 0
INITIAL_HEIGHT = 16
DEFA... | 797 | 27.5 | 88 | py |
null | CARL-main/carl/envs/mario/generate_sample.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from typing import Any, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn.functional import interpolate
# Generates a noise tensor. Uses torch.randn.
def generate_spatial_noise(
size: Union[Any, List[int], Tuple... | 3,858 | 30.373984 | 86 | py |
null | CARL-main/carl/envs/mario/level_image_gen.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from typing import Any, List, Tuple
import os
from PIL import Image, ImageEnhance, ImageOps
class LevelImageGen:
"""Generates PIL Image files from Super Mario Bros. ascii levels.
Initialize once and then use LevelImageGen.render() to generate images."""
... | 15,849 | 36.828162 | 116 | py |
null | CARL-main/carl/envs/mario/mario_env.py | from typing import Any, ByteString, Deque, Dict, List, Literal, Optional, Union, cast
import os
import random
import socket
from collections import deque
import cv2
import gym
import numpy as np
from gym import spaces
from gym.core import ObsType
from gym.utils import seeding
from PIL import Image
from py4j.java_gate... | 7,520 | 31.986842 | 88 | py |
null | CARL-main/carl/envs/mario/mario_game.py | from abc import ABC, abstractmethod
class MarioGame(ABC):
@abstractmethod
def getPort(self) -> int:
pass
@abstractmethod
def initGame(self) -> None:
pass
@abstractmethod
def stepGame(
self, left: bool, right: bool, down: bool, speed: bool, jump: bool
) -> None:
... | 841 | 18.136364 | 74 | py |
null | CARL-main/carl/envs/mario/reachabillity.py | from typing import List, Tuple
import numpy as np
horizontal = 10 # when sprinting Mario can jump over a 10 tiles gap horizontally
vertical = 4 # Mario can jump over a 4 tile wall
diagonal = (
6 # Mario can jump over 6 tiles to clear a 4 block height difference when sprinting
)
empty = "-"
ignored = ["M", "F"... | 11,693 | 36.722581 | 118 | py |
null | CARL-main/carl/envs/mario/toad_gan.py | from typing import Optional
import functools
import os
import sys
from dataclasses import dataclass
import torch
from torch import Tensor
from carl.envs.mario.generate_sample import generate_sample, generate_spatial_noise
from carl.envs.mario.reachabillity import reachability_map
@dataclass
class TOADGAN:
def ... | 3,584 | 26.576923 | 88 | py |
null | CARL-main/carl/envs/mario/utils.py | from typing import Tuple
import atexit
import os
import socket
import sys
from contextlib import closing
from py4j.java_gateway import JavaGateway
from xvfbwrapper import Xvfb
MARIO_AI_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), "Mario-AI-Framework")
)
_gateway = None
_port = None
def find_... | 1,467 | 23.466667 | 73 | py |
null | CARL-main/carl/envs/mario/models/__init__.py | 0 | 0 | 0 | py | |
null | CARL-main/carl/envs/mario/models/conv_block.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from typing import Tuple, Union
import torch.nn as nn
class ConvBlock(nn.Sequential):
"""Conv block containing Conv2d, BatchNorm2d and LeakyReLU Layers."""
def __init__(
self,
in_channel: int,
out_channel: int,
ker_size: Union[... | 858 | 25.84375 | 73 | py |
null | CARL-main/carl/envs/mario/models/discriminator.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from argparse import Namespace
import torch
import torch.nn as nn
from torch import Tensor
from .conv_block import ConvBlock
class Level_WDiscriminator(nn.Module):
"""Patch based Discriminator. Uses Namespace opt."""
def __init__(self, opt: Namespace):
... | 1,049 | 29 | 88 | py |
null | CARL-main/carl/envs/mario/models/generator.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from argparse import Namespace
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from .conv_block import ConvBlock
class Level_GeneratorConcatSkip2CleanAdd(nn.Module):
"""Patch based Generator. Uses namespace opt."""
... | 1,464 | 31.555556 | 86 | py |
null | CARL-main/carl/envs/mario/sprites/README.md | ## Notice
This folder contains the sprite images from https://github.com/amidos2006/Mario-AI-Framework/tree/master/img.
They are necessary for the Mario-AI-Framework and our level preview renderer. | 198 | 48.75 | 109 | md |
null | CARL-main/carl/envs/rna/__init__.py | # flake8: noqa: F401
# isort: skip_file
try:
from carl.envs.rna.carl_rna import CARLRnaDesignEnv
from carl.envs.rna.carl_rna_definitions import (
DEFAULT_CONTEXT as CARLRnaDesignEnv_defaults,
CONTEXT_BOUNDS as CARLRnaDesignEnv_bounds,
)
except Exception as e:
print(e)
| 301 | 26.454545 | 55 | py |
null | CARL-main/carl/envs/rna/carl_rna.py | # pylint: disable=missing-module-docstring # isort: skip_file
from typing import Optional, Dict, Union, List, Tuple, Any
import numpy as np
import gym
from carl.envs.carl_env import CARLEnv
from carl.envs.rna.parse_dot_brackets import parse_dot_brackets
from carl.envs.rna.rna_environment import (
RnaDesignEnviron... | 4,929 | 40.083333 | 119 | py |
null | CARL-main/carl/envs/rna/carl_rna_definitions.py | import numpy as np
from gym import spaces
DEFAULT_CONTEXT = {
"mutation_threshold": 5,
"reward_exponent": 1,
"state_radius": 5,
"dataset": "eterna",
"target_structure_ids": None,
}
CONTEXT_BOUNDS = {
"mutation_threshold": (0.1, np.inf, float),
"reward_exponent": (0.1, np.inf, float),
"s... | 664 | 26.708333 | 84 | py |
null | CARL-main/carl/envs/rna/parse_dot_brackets.py | # flake8: noqa: F401
# isort: skip_file
from pathlib import Path
from typing import List, Optional, Union, Generator
def parse_dot_brackets(
dataset: str,
data_dir: str,
target_structure_ids: Optional[List[int]] = None,
target_structure_path: Optional[Union[str, Path]] = None,
) -> List[str]:
"""... | 1,278 | 29.452381 | 101 | py |
null | CARL-main/carl/envs/rna/readme.md | # **CARL RNA Environment**
This is the CARL RNA environment that has been adapted from the [Learning to Design RNA](https://openreview.net/pdf?id=ByfyHh05tQ) by Runge et. al. The code has been adapted from [https://github.com/automl/learna](https://github.com/automl/learna) with a carl wrapper written around the envi... | 851 | 64.538462 | 349 | md |
null | CARL-main/carl/envs/rna/rna_environment.py | # isort: skip_file
"""
Code adapted from https://github.com/automl/learna
"""
import time
from itertools import product
from dataclasses import dataclass
from distance import hamming
import numpy as np
from RNA import fold
import gym
from typing import Any, List
@dataclass
class RnaDesignEnvironmentConfig:
"... | 12,643 | 29.46747 | 95 | py |
null | CARL-main/carl/envs/rna/data/download_and_build_eterna.py | # flake8: noqa: F401
# # isort: skip_file
from urllib.request import Request
from tqdm import tqdm
import requests # type: ignore[import]
def _download_dataset_from_http(url: str, download_path: str) -> None:
"""Donwload the dataset from a given url
Parameters
----------
url : string
URL for... | 1,914 | 28.015152 | 81 | py |
null | CARL-main/carl/envs/rna/data/download_and_build_rfam_learn.sh | #!/usr/bin/env bash
# So far RNA has been tested only on linux systems
mkdir -p data/rfam_learn/{raw,test,train,validation}
cd data/
wget https://www.dropbox.com/s/cfhnkzdx4ciy7zf/rfam_learn.tar.gz?dl=1 -O rfam_learn.tar.gz
tar xf rfam_learn.tar.gz
rm -f rfam_learn.tar.gz | 274 | 29.555556 | 90 | sh |
null | CARL-main/carl/envs/rna/data/download_and_build_rfam_taneda.sh | # So far RNA has been tested only on linux systems
cd data/
mkdir rfam_taneda
cd rfam_taneda
wget rna.eit.hirosaki-u.ac.jp/modena/v0028/linux/modena.dataset.tar.gz
tar -xf modena.dataset.tar.gz
rm -f modena.dataset.tar.gz
rm -rf ct_version
i=1
while [[ i -le 30 ]]; do
if [ $i == 23 ]; then
:
elif [[ $i ... | 510 | 16.62069 | 70 | sh |
null | CARL-main/carl/envs/rna/data/parse_dot_brackets.py | # flake8: noqa: F401
# isort: skip_file
from email.generator import Generator
from pathlib import Path
from typing import List
def parse_dot_brackets(
dataset: str,
data_dir: str,
target_structure_ids: List[int] = None,
target_structure_path: Path = None,
) -> List[str]:
"""Generate the targets ... | 1,399 | 27 | 81 | py |
null | CARL-main/carl/envs/rna/data/secondaries_to_single_files.sh | # So far RNA has been tested only on linux systems
DATAPATH=$1
SECONDARY_FILE=$2
NUM_SECONDARIES=$(cat $SECONDARY_FILE | wc -l )
i=1;
while [[ i -le $NUM_SECONDARIES ]];
do awk "NR==$i{print;exit}" $SECONDARY_FILE > $DATAPATH/$i.rna;
let i=$i+1;
done
Footer
| 262 | 19.230769 | 64 | sh |
null | CARL-main/carl/utils/__init__.py | 0 | 0 | 0 | py | |
null | CARL-main/carl/utils/trial_logger.py | from typing import Union
import argparse
from pathlib import Path
import configargparse
import pandas as pd
from carl.utils.types import Context
class TrialLogger(object):
"""
Holds all train arguments and sets up logging directory and stables baselines
logging, writes trial setup and writes context fe... | 4,697 | 32.557143 | 94 | py |
null | CARL-main/carl/utils/types.py | from typing import Any, Dict, List, TypeVar, Union
import numpy as np
Context = Dict[str, Any]
Contexts = Dict[Any, Context]
Vector = Union[List[Any], np.ndarray]
ObsType = TypeVar("ObsType")
| 194 | 20.666667 | 50 | py |
null | CARL-main/carl/utils/doc_building/__init__.py | 0 | 0 | 0 | py | |
null | CARL-main/carl/utils/doc_building/build.py | from typing import Dict, Tuple
from pathlib import Path
import numpy as np
import pandas as pd
from gym import spaces
import carl.envs
# JUST FOR DOCS / is dynamic in code!!
MARIO_OBSERVATION_SPACE = spaces.Box(
low=0,
high=255,
shape=[4, 64, 64],
dtype=np.uint8,
) # is dynamic in code
MARIO_ACTION... | 4,177 | 31.387597 | 88 | py |
null | CARL-main/carl/utils/doc_building/plot_context_space.py | """
Boxplot
- number of context features
- percentage of continuous CFs
- number of CFs changing the dynamics
- number of CFs changing the reward
"""
from __future__ import annotations
if __name__ == "__main__":
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas ... | 2,611 | 27.703297 | 88 | py |
null | CARL-main/carl/utils/doc_building/plot_radar.py | from __future__ import annotations
if __name__ == "__main__":
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from carl.utils.doc_building.plotting import radar_factory
env_context_feature_names = {
"CARLMounta... | 12,721 | 26.477322 | 104 | py |
null | CARL-main/carl/utils/doc_building/plotting.py | from typing import Any, Dict, List, Tuple
import numpy as np
from matplotlib.lines import Line2D
from matplotlib.patches import Circle, RegularPolygon
from matplotlib.path import Path
from matplotlib.projections import register_projection
from matplotlib.projections.polar import PolarAxes
from matplotlib.spines import... | 3,591 | 36.416667 | 86 | py |
null | CARL-main/carl/utils/doc_building/print_tables.py | if __name__ == "__main__":
from typing import List
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.offsetbox import AnchoredText
import carl.envs
def plot_context_feature_freq(
context_f... | 11,646 | 31.263158 | 116 | py |
null | CARL-main/carl/utils/doc_building/render_brax_env.py | if __name__ == "__main__":
from typing import List
import brax
import jax
from brax import envs
from brax.io import html
from IPython.display import HTML
env_name = "fetch" # @param ['ant', 'humanoid', 'fetch', 'grasp', 'halfcheetah', 'ur5e', 'reacher']
env_fn = envs.create_fn(env_nam... | 714 | 33.047619 | 104 | py |
null | CARL-main/docs/conf.py | import os, sys
sys.path.insert(0, os.path.abspath(".."))
import automl_sphinx_theme # Must come after the path injection above
from carl import copyright, author, version, name
options = {"copyright": copyright,
"author": author,
"version": version,
"versions": {
... | 1,301 | 36.2 | 89 | py |
null | CARL-main/docs/themes/smac/docs-navbar.html | <div class="container-xl">
<div id="navbar-start">
{% for navbar_item in theme_navbar_start %}
{% include navbar_item %}
{% endfor %}
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapsible" aria-controls="navbar-collapsible" aria-expanded="false" ... | 995 | 30.125 | 203 | html |
null | CARL-main/docs/themes/smac/docs-sidebar.html | 0 | 0 | 0 | html | |
null | CARL-main/docs/themes/smac/footer.html | <footer class="footer mt-5 mt-md-0">
<div class="container">
{% for footer_item in theme_footer_items %}
<div class="footer-item">
{% include footer_item %}
</div>
{% endfor %}
</div>
</footer> | 219 | 23.444444 | 47 | html |
null | CARL-main/docs/themes/smac/gc.html | <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ _('Site') }} <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc">{{ toctree(maxdepth=10) }}</ul>
</li> | 200 | 49.25 | 102 | html |
null | CARL-main/docs/themes/smac/icon-links.html | {%- macro icon_link_nav_item(url, icon, name) -%}
{%- if url | length > 2 %}
<li class="nav-item">
<a class="nav-link" href="{{ url }}" rel="noopener" target="_blank" title="{{ _(name) }}">
<span><i class="{{ icon }}"></i></span>
<label class="sr-only">{{ _(name) }}</label>
... | 1,062 | 45.217391 | 100 | html |
null | CARL-main/docs/themes/smac/layout.html | {%- extends "basic/layout.html" %}
{%- import "static/webpack-macros.html" as _webpack with context %}
{%- block css %}
{{ _webpack.head_pre_bootstrap() }}
{{ _webpack.head_pre_icons() }}
{% block fonts %}
{{ _webpack.head_pre_fonts() }}
{% endblock %}
{{- css() }}
{{ _webpack.head_js_pre... | 3,409 | 31.169811 | 114 | html |
null | CARL-main/docs/themes/smac/search-field.html | <form class="bd-search align-items-center" action="{{ pathto('search') }}" method="get"
style="width: 100%;">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="{{ _(theme_search_bar_text) }}" aria-label="{{ theme_search_bar_text }}" autocomplete="of... | 334 | 46.857143 | 177 | html |
null | CARL-main/docs/themes/smac/smac_theme.py | """
Bootstrap-based sphinx theme from the PyData community
"""
# flake8: noqa: E402
# mypy: ignore-errors
import os
from sphinx.errors import ExtensionError
from sphinx.util import logging
from sphinx.environment.adapters.toctree import TocTree
from sphinx import addnodes
import jinja2
from bs4 import BeautifulSoup ... | 22,899 | 35.349206 | 89 | py |
null | CARL-main/docs/themes/smac/title.html | <h4 class="mt-0 mb-0">{{ project }}</h4>
<div class="mb-3">v{{ version }}</div> | 79 | 39 | 40 | html |
null | CARL-main/docs/themes/smac/static/webpack-macros.html | <!-- these macros are generated by "yarn build:production". do not edit by hand. -->
{% macro head_pre_icons() %}
<link rel="stylesheet"
href="{{ pathto('_static/vendor/fontawesome/5.13.0/css/all.min.css', 1) }}">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="{{ pathto('_static/vendor/fo... | 1,094 | 42.8 | 106 | html |
null | CARL-main/docs/themes/smac/static/css/custom.css | .bd-search {
margin: 0;
padding-left: 0;
padding-right: 0;
}
.bd-search .icon {
left: 10px;
}
#navbar-collapsible {
padding: 0;
}
#navbar-icon-links {
margin: 0 15px 0 0;
}
.navbar-nav {
flex-direction: row;
}
.navbar-light .navbar-nav li a.nav-link {
padding: 0 5px 0 0;
}
@media (... | 2,464 | 20.25 | 220 | css |
null | CARL-main/docs/themes/smac/static/css/index.ac9c05f7c49ca1e1f876c6e36360ea26.css | /*!
* Bootstrap v4.6.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yell... | 159,086 | 26,513.5 | 158,876 | css |
null | CARL-main/docs/themes/smac/static/css/theme.css | /* Provided by the Sphinx base theme template at build time */
@import "../basic.css";
:root {
/*****************************************************************************
* Theme config
**/
--pst-header-height: 60px;
/*****************************************************************************
* Font ... | 4,802 | 38.694215 | 95 | css |
null | CARL-main/docs/themes/smac/static/vendor/fontawesome/5.13.0/css/all.min.css | /*!
* Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:norm... | 58,578 | 11,714.8 | 58,392 | css |
null | CARL-main/docs/themes/smac/templates/copyright.html | <p class="copyright">
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}© <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}<br>
{%- else %}
{% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}<br>
{%- endif %}
</p> | 310 | 43.428571 | 139 | html |
null | CARL-main/docs/themes/smac/templates/edit-this-page.html | {% if sourcename is defined and theme_use_edit_page_button==true and page_source_suffix %}
{% set src = sourcename.split('.') %}
<div class="tocsection editthispage">
<a href="{{ get_edit_url() }}">
<i class="fas fa-pencil-alt"></i> {{ _("Edit this page") }}
</a>
</div>
{% endif %}
| 299 | 32.333333 | 90 | html |
null | CARL-main/docs/themes/smac/templates/last-updated.html | <p class="last-updated">
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}<br>
</p> | 122 | 40 | 92 | html |
null | CARL-main/docs/themes/smac/templates/navbar-icon-links.html | {%- block icon_links -%}
{%- include "icon-links.html" with context -%}
{%- endblock %} | 87 | 28.333333 | 46 | html |
null | CARL-main/docs/themes/smac/templates/navbar-logo.html | {% if logo %}
{% if not theme_logo_link %}
<a class="navbar-brand" href="{{ pathto(master_doc) }}">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
</a>
{% elif theme_logo_link[:4] == 'http' %}
<a class="navbar-brand" href="{{ theme_logo_link }}">
<img src="{{ pathto('_static/' + logo, 1) }}"... | 639 | 32.684211 | 72 | html |
null | CARL-main/docs/themes/smac/templates/navbar-nav.html | <ul id="navbar-main-elements" class="navbar-nav">
{{ generate_nav_html("navbar", maxdepth=1, collapse=True, includehidden=True, titles_only=True) }}
{% for external_link in theme_external_links %}
<li class="nav-item">
<a class="nav-link nav-external" href="{{ external_link.url }}">{{ _(external_lin... | 407 | 50 | 143 | html |
null | CARL-main/docs/themes/smac/templates/page-toc.html | {% set page_toc = generate_toc_html() %}
{%- if page_toc | length >= 1 %}
<div class="tocsection onthispage pt-5 pb-3">
<i class="fas fa-list"></i> {{ _("On this page") }}
</div>
{%- endif %}
<nav id="bd-toc-nav">
{{ page_toc }}
</nav> | 245 | 21.363636 | 55 | html |
null | CARL-main/docs/themes/smac/templates/prev-next.html | <!-- Previous / next buttons -->
<div class='prev-next-area'>
{%- if prev %}
<a class='left-prev' id="prev-link" href="{{ prev.link|e }}" title="{{ _('previous') }} {{ _('page') }}">
<i class="fas fa-angle-left"></i>
<div class="prev-next-info">
<p class="prev-next-subtitle">{{ _("p... | 821 | 38.142857 | 109 | html |
null | CARL-main/docs/themes/smac/templates/sidebar-ethical-ads.html | {% if READTHEDOCS %}
<div
id="ethical-ad-placement"
class="flat"
data-ea-publisher="readthedocs"
data-ea-type="readthedocs-sidebar"
data-ea-manual="true"
></div>
{% endif %}
| 184 | 17.5 | 36 | html |
null | CARL-main/docs/themes/smac/templates/sidebar-nav-bs.html | <nav class="bd-links" id="bd-docs-nav" aria-label="{{ _('Main navigation') }}">
<div class="bd-toc-item active">
{{ generate_nav_html("sidebar",
maxdepth=theme_navigation_depth|int,
collapse=theme_collapse_navigation|tobool,
includehidden=... | 388 | 37.9 | 79 | html |
null | CARL-main/docs/themes/smac/templates/sphinx-version.html | <p class="sphinx-version">
{% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx-doc.org/">Sphinx</a>
{{ sphinx_version }}. Template is modified version of <a
href="https://pydata-sphinx-theme.readthedocs.io">PyData Sphinx Theme</a>. {% endtrans %}<br>
</p> | 283 | 55.8 | 100 | html |
null | CARL-main/examples/demo_carracing.py | """
Code adapted from gym.envs.box2d.car_racing.py
"""
from typing import Any
import numpy as np
import gym
import time
import pygame
from carl.envs.box2d.carl_vehicle_racing import CARLVehicleRacingEnv, VEHICLE_NAMES
if __name__ == "__main__":
from pyglet.window import key
a = np.array([0.0, 0.0, 0.0])
... | 2,242 | 30.152778 | 84 | py |
null | CARL-main/examples/demo_heuristic_lunarlander.py | from typing import Union, Optional
from gym.envs.box2d.lunar_lander import heuristic
import gym.envs.box2d.lunar_lander as lunar_lander
from carl.envs import CARLLunarLanderEnv
def demo_heuristic_lander(
env: Union[
CARLLunarLanderEnv, lunar_lander.LunarLander, lunar_lander.LunarLanderContinuous
],
... | 1,428 | 24.981818 | 88 | py |
null | CARL-main/examples/try_dm_control.py | # flake8: noqa: F401
# type: ignore
import matplotlib.pyplot as plt
from carl.envs import CARLDmcFishEnv
from carl.envs import CARLDmcFishEnv_defaults as fish_default
from carl.envs import CARLDmcFishEnv_mask as fish_mask
from carl.envs import CARLDmcQuadrupedEnv
from carl.envs import CARLDmcQuadrupedEnv_defaults as q... | 2,117 | 36.821429 | 126 | py |
null | CARL-main/test/test_CARLEnv.py | from typing import Any, Dict
import unittest
import numpy as np
from carl.envs.classic_control.carl_pendulum import CARLPendulumEnv
from carl.utils.types import Context
class TestStateConstruction(unittest.TestCase):
def test_hiddenstate(self):
"""
Test if we set hide_context = True that we get... | 15,722 | 35.822014 | 116 | py |
null | CARL-main/test/test_all_envs.py | import unittest
import numpy as np
import carl.envs
class TestInitEnvs(unittest.TestCase):
def test_init_all_envs(self):
global_vars = vars(carl.envs)
mustinclude = "CARL"
forbidden = ["defaults", "bounds", "mask"]
for varname, var in global_vars.items():
if mustinclu... | 680 | 29.954545 | 88 | py |