python_code stringlengths 0 4.04M | repo_name stringlengths 8 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
from .input_output_evaluator import InputOutputEvaluator
from ...code_runner import RUN_ROOT_DIR
from ... | CodeGen-main | codegen_sources/code_runners/test_runners/input_output_runners/go_input_output_evaluator.py |
CodeGen-main | codegen_sources/code_runners/test_runners/input_output_runners/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import typing as tp
from pathlib import Path
from ...code_runner import CodeRunner, RUN_ROOT_DIR
from ...runner_errors import M... | CodeGen-main | codegen_sources/code_runners/test_runners/input_output_runners/input_output_evaluator.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
from pathlib import Path
from ...code_runner import RUN_ROOT_DIR
from ....model.src.utils import get_java_bin_path
fr... | CodeGen-main | codegen_sources/code_runners/test_runners/input_output_runners/java_input_output_evaluator.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
from .input_output_evaluator import InputOutputEvaluator
from ...code_runner import RUN_ROOT_DIR
from ... | CodeGen-main | codegen_sources/code_runners/test_runners/input_output_runners/cpp_input_output_evaluator.py |
CodeGen-main | codegen_sources/code_runners/test_runners/evosuite_test_runners/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
from pathlib import Path
from codegen_sources.preprocessing.lang_processors import LangProcessor
from ...code_runner... | CodeGen-main | codegen_sources/code_runners/test_runners/evosuite_test_runners/python_evosuite_test_runner.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
from codegen_sources.preprocessing.lang_processors import LangProcessor
from ...code_runner import RUN... | CodeGen-main | codegen_sources/code_runners/test_runners/evosuite_test_runners/cpp_evosuite_test_runner.py |
CodeGen-main | codegen_sources/code_runners/test_runners/tests/__init__.py | |
from pathlib import Path
import os
from codegen_sources.code_runners.test_runners import PythonEvosuiteTestRunner
from codegen_sources.preprocessing.lang_processors import LangProcessor
python_processor = LangProcessor.processors["python"]()
TEST_SIGMOID = """import numpy as np
import math
from math import *
impor... | CodeGen-main | codegen_sources/code_runners/test_runners/tests/test_python_test_runner.py |
from pathlib import Path
import os
from codegen_sources.code_runners.test_runners import CppEvosuiteTestRunner
from codegen_sources.preprocessing.lang_processors import LangProcessor
cpp_processor = LangProcessor.processors["cpp"]()
TEST_SIGMOID = """#include <iostream>
#include <cstdlib>
#include <string>
#includ... | CodeGen-main | codegen_sources/code_runners/test_runners/tests/test_cpp_test_runner.py |
CodeGen-main | codegen_sources/code_runners/test_runners/tests/test_input_output_runners/__init__.py | |
from pathlib import Path
import os
from codegen_sources.preprocessing.lang_processors import LangProcessor
from codegen_sources.code_runners.test_runners import JavaInputOutputEvaluator
java_processor = LangProcessor.processors["java"]()
ADDITION_PROGRAM = " ".join(
java_processor.tokenize_code(
r"""
i... | CodeGen-main | codegen_sources/code_runners/test_runners/tests/test_input_output_runners/test_java_io_evaluators.py |
from pathlib import Path
import os
from codegen_sources.preprocessing.lang_processors import LangProcessor
from codegen_sources.code_runners.test_runners import CppInputOutputEvaluator
cpp_processor = LangProcessor.processors["cpp"]()
ADDITION_PROGRAM = " ".join(
cpp_processor.tokenize_code(
"""#includ... | CodeGen-main | codegen_sources/code_runners/test_runners/tests/test_input_output_runners/test_cpp_io_evaluators.py |
from pathlib import Path
import os
from codegen_sources.preprocessing.lang_processors import LangProcessor
from codegen_sources.code_runners.test_runners import RustInputOutputEvaluator
rust_processor = LangProcessor.processors["rust"]()
ADDITION_PROGRAM = " ".join(
rust_processor.tokenize_code(
"""
fn... | CodeGen-main | codegen_sources/code_runners/test_runners/tests/test_input_output_runners/test_rust_io_evaluators.py |
from pathlib import Path
import os
from codegen_sources.preprocessing.lang_processors import LangProcessor
from codegen_sources.code_runners.test_runners import GoInputOutputEvaluator
go_processor = LangProcessor.processors["go"]()
ADDITION_PROGRAM = " ".join(
go_processor.tokenize_code(
"""
func main(... | CodeGen-main | codegen_sources/code_runners/test_runners/tests/test_input_output_runners/test_go_io_evaluators.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import re
import itertools
from pathlib import Path
import torch
import fastBPE
from transformers import RobertaTokenizer
import... | CodeGen-main | codegen_sources/dataloaders/transforms.py |
CodeGen-main | codegen_sources/dataloaders/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import time
import json
import gzip
import dataclasses
import contextlib
import typing as tp
from pathlib import Path
import sub... | CodeGen-main | codegen_sources/dataloaders/utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import errno
import math
import os
import re
import signal
import subprocess
import time
from functools import partial, wraps
fr... | CodeGen-main | codegen_sources/IR_tools/utils_ir.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
# Translate sentences from the input stream.
# The model will be faster is sentences are sorted by length.
# Input sentences mus... | CodeGen-main | codegen_sources/model/translate.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
"""
Example: python data/vocab.txt data/train.txt
vocab.txt: 1stline=word, 2ndline=count
"""
import os
import sys
from codeg... | CodeGen-main | codegen_sources/model/preprocess.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import argparse
from pathlib import Path
import sys
import fastBPE
import torch
from codegen_sources.model.src.logger import crea... | CodeGen-main | codegen_sources/model/deobfuscate.py |
CodeGen-main | codegen_sources/model/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import argparse
import json
import random
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parents[2]))... | CodeGen-main | codegen_sources/model/train.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
from pythainlp.tokenize import word_tokenize
for line in sys.stdin.readlines():
line = line.rstrip("\n")
p... | CodeGen-main | codegen_sources/model/tools/segment_th.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
import unicodedata
import six
def convert_to_unicode(text):
"""
Converts `text` to Unicode (if it's not a... | CodeGen-main | codegen_sources/model/tools/lowercase_and_remove_accent.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import typing as tp
from pathlib import Path
import numpy
import pytest
import requests
import torch
from ..src.data.dictionar... | CodeGen-main | codegen_sources/model/model_tests/test_forward_pass.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
import typing as tp
from codegen_sources.model.src.evaluation.comp_acc_computation import (
submit... | CodeGen-main | codegen_sources/model/model_tests/test_comp_acc_computation.py |
CodeGen-main | codegen_sources/model/model_tests/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from codegen_sources.model.src.evaluation.subtoken_score import (
subtoken_counts,
subtoken_score_on_lines,
subtoken_... | CodeGen-main | codegen_sources/model/model_tests/test_subtoken_score.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import subprocess
import uuid
from pathlib import Path
import pytest
import requests
import torch
import codegen_so... | CodeGen-main | codegen_sources/model/model_tests/test_translation.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import signal
import socket
import subprocess
import sys
from logging import getLogger
import torch
logger = getLog... | CodeGen-main | codegen_sources/model/src/slurm.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
REF = "REF"
OUT = "OUT"
HYPO = "HYPO"
IR = "IR"
SOURCE = "SOURCE"
SUPPORTED_LANGUAGES_FOR_TESTS = {"java", "python", "cpp", "ru... | CodeGen-main | codegen_sources/model/src/constants.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import pickle
import random
import typing as tp
from logging import getLogger
from pathlib import Path
import torch
logger = g... | CodeGen-main | codegen_sources/model/src/cache.py |
CodeGen-main | codegen_sources/model/src/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
import time
from datetime import timedelta
class LogFormatter:
def __init__(self) -> None:
self.st... | CodeGen-main | codegen_sources/model/src/logger.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import argparse
import getpass
import math
import os
import pickle
import random
import re
import subprocess
import sys
import ... | CodeGen-main | codegen_sources/model/src/utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import re
import subprocess
import sys
import textwrap
from pathlib import Path
import torch
from .constants import... | CodeGen-main | codegen_sources/model/src/vizualization_utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import math
import os
import random
import time
import typing as tp
from collections import OrderedDict
from concurrent.futures.... | CodeGen-main | codegen_sources/model/src/trainer.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import inspect
import math
import re
import torch
from torch import optim
class Adam(optim.Optimizer):
"""
Same as h... | CodeGen-main | codegen_sources/model/src/optim.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import io
from logging import getLogger
import numpy as np
import torch
logger = getLogger()
def load_fasttext_model(path):... | CodeGen-main | codegen_sources/model/src/model/pretrain.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from torch import nn
try:
from apex.parallel import DistributedDataParallel
class CustomApexDDP(DistributedDataParalle... | CodeGen-main | codegen_sources/model/src/model/CustomDDP.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import math
import typing as tp
from einops import rearrange, repeat
import torch
from torch import nn
from torch import Tensor... | CodeGen-main | codegen_sources/model/src/model/cape_embeddings.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import math
import os
import typing as tp
import dataclasses
import logging
import torch
from ..data.dictionary import UNK_WOR... | CodeGen-main | codegen_sources/model/src/model/__init__.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import typing as tp
import itertools
import math
import dataclasses
from logging import getLogger
import numpy as np
import to... | CodeGen-main | codegen_sources/model/src/model/transformer.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from logging import getLogger
import torch
from ..data.dictionary import (
BOS_WORD,
EOS_WORD,
MASK_WORD,
PAD... | CodeGen-main | codegen_sources/model/src/model/embedder.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import typing as tp
from stringcase import snakecase
from ..utils import read_file_lines
def compute_subtokens(tok... | CodeGen-main | codegen_sources/model/src/evaluation/subtoken_score.py |
CodeGen-main | codegen_sources/model/src/evaluation/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from .subtoken_score import (
subtoken_counts,
subtoken_score_on_lines,
subtoken_score_on_lines_subtoken_level,
)
d... | CodeGen-main | codegen_sources/model/src/evaluation/test_subtoken_score.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import subprocess
import json
import typing as tp
from concurrent.futures import ProcessPoolExecutor
import sys
import os
from l... | CodeGen-main | codegen_sources/model/src/evaluation/comp_acc_computation.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import json
import os
import subprocess
import time
import typing as tp
from collections import OrderedDict, defaultdict
from c... | CodeGen-main | codegen_sources/model/src/evaluation/evaluator.py |
CodeGen-main | codegen_sources/model/src/data/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
import json
from pathlib import Path
import math
import typing as tp
from logging import getLogger
import numpy as ... | CodeGen-main | codegen_sources/model/src/data/dataset.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
from logging import getLogger
import numpy as np
import torch
from .dataset import StreamDataset, Dataset, Parallel... | CodeGen-main | codegen_sources/model/src/data/loader.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import typing as tp
from pathlib import Path
from logging import getLogger
import numpy as np
import torch
logger =... | CodeGen-main | codegen_sources/model/src/data/dictionary.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
import multiprocessing
import os
from pathlib import Path
import argparse
import submitit
from codegen_source... | CodeGen-main | codegen_sources/preprocessing/preprocess.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import errno
import math
import os
import signal
import time
from functools import partial, wraps
class TimeoutError(BaseExce... | CodeGen-main | codegen_sources/preprocessing/timeout.py |
CodeGen-main | codegen_sources/preprocessing/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import argparse
import json
import random
import subprocess
from pathlib import Path
from logging import getLogger
from codegen... | CodeGen-main | codegen_sources/preprocessing/utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
import typing as tp
TMP_EXT = ".tmp"
class BPEMode:
"""
the base BPE mode logic for running ... | CodeGen-main | codegen_sources/preprocessing/bpe_modes/bpe_mode.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
import os
import re
from pathlib import Path
from codegen_sources.preprocessing.bpe_modes.bpe_mode import BPEMo... | CodeGen-main | codegen_sources/preprocessing/bpe_modes/roberta_bpe_mode.py |
from .bpe_mode import BPEMode as BPEMode
from .fast_bpe_mode import FastBPEMode as FastBPEMode
from .roberta_bpe_mode import RobertaBPEMode as RobertaBPEMode
| CodeGen-main | codegen_sources/preprocessing/bpe_modes/__init__.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import re
import subprocess
from logging import getLogger
from pathlib import Path
import fastBPE
import typing as tp
from cod... | CodeGen-main | codegen_sources/preprocessing/bpe_modes/fast_bpe_mode.py |
CodeGen-main | codegen_sources/preprocessing/tests/__init__.py | |
CodeGen-main | codegen_sources/preprocessing/tests/pipeline/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import logging
import shutil
import unittest
from pathlib import Path
import pytest
from codegen_sources.preproces... | CodeGen-main | codegen_sources/preprocessing/tests/pipeline/test_pipeline.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
from codegen_sources.preprocessing.lang_processors.cpp_processor import CppProcessor
from codegen_sou... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_tokenize_cpp.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from codegen_sources.preprocessing.utils import split_arguments
def test_parentheses_split_args():
input_str = "((1,2,3),... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
import pytest
from codegen_sources.preprocessing.lang_processors.javascript_processor import (
Ja... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_tokenize_javascript.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
from codegen_sources.preprocessing.lang_processors import JavaProcessor
from codegen_sources.preproce... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_tokenize_java.py |
CodeGen-main | codegen_sources/preprocessing/tests/tokenization/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import difflib
import typing as tp
def tokenizer_test(test_examples, processor, keep_comments):
for i, (x, y) in enumerat... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/tokenization_tests_utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import ast
import difflib
import typing as tp
from pathlib import Path
import pytest
from codegen_sources.preprocessing.lang_pr... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_tokenize_python.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from codegen_sources.preprocessing.lang_processors import GoProcessor
from codegen_sources.preprocessing.tests.tokenization.tok... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_tokenize_go.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from codegen_sources.preprocessing.lang_processors import RustProcessor
from codegen_sources.preprocessing.tests.tokenization.t... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_tokenize_rust.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import pytest
from codegen_sources.preprocessing.lang_processors.java_processor import JavaProcessor
from pathlib import Path
... | CodeGen-main | codegen_sources/preprocessing/tests/tokenization/test_tokenize_strings.py |
CodeGen-main | codegen_sources/preprocessing/tests/obfuscation/__init__.py | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import difflib
import typing as tp
def diff_tester(
expected: tp.Union[str, tp.Iterable[tp.Any]],
res: tp.Union[str, ... | CodeGen-main | codegen_sources/preprocessing/tests/obfuscation/utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
from codegen_sources.preprocessing.lang_processors.java_processor import JavaProcessor
from codegen_s... | CodeGen-main | codegen_sources/preprocessing/tests/obfuscation/test_java_obfuscation.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import pytest
import codegen_sources.preprocessing.lang_processors as lp
from codegen_sources.preprocessing.obfuscation import ... | CodeGen-main | codegen_sources/preprocessing/tests/obfuscation/test_python_obfuscator.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
from logging import getLogger
from pathlib import Path
import submitit
import typing as tp
from codegen_sources.pre... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/monolingual_mode.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
from logging import getLogger
from pathlib import Path
import submitit
import typing as tp
from codegen_sources.pre... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/monolingual_functions_mode.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
import typing as tp
from logging import getLogger
from codegen_sources.IR_tools.utils_ir import code_to_ir, ir_had_... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/ir_full_files_mode.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from itertools import chain
from logging import getLogger
import submitit
import typing as tp
from codegen_sources.preprocessi... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/obfuscation_mode.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
import typing as tp
from logging import getLogger
from codegen_sources.IR_tools.utils_ir import code_to_ir, ir_had_... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/ir_functions_mode.py |
# datasests must be registered here for automatic inclusion
from .dataset_mode import DatasetMode
from .monolingual_functions_mode import MonolingualFunctionsMode
from .ir_functions_mode import IRFunctionsMode
from .ir_full_files_mode import IRFullFilesMode
from .monolingual_mode import MonolingualMode
from .obfuscatio... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/__init__.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import concurrent
import sys
import json
import time
from typing import Optional
import zlib
import fileinput
import subprocess... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/dataset_mode.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from .. import dataset_modes
def test_modes_dict() -> None:
must_be_avail = {
"obfuscation",
"monolingual... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/test_dataset_modes.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from itertools import chain
from logging import getLogger
import submitit
import typing as tp
from codegen_sources.preprocessi... | CodeGen-main | codegen_sources/preprocessing/dataset_modes/obfuscation_functions_mode.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import javalang
from codegen_sources.preprocessing.obfuscation.obfuscated_names_generator import (
ObfuscatedNamesGenerator... | CodeGen-main | codegen_sources/preprocessing/obfuscation/javalang_obfuscator.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import typing as tp
from enum import Enum
class ObfuscatedNameType(Enum):
VARIABLE = "VAR"
FUNCTION = "FUNC"
CLAS... | CodeGen-main | codegen_sources/preprocessing/obfuscation/obfuscated_names_generator.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import typing as tp
import re
SEPARATOR = " | "
OBFUSCATED_PREFIXES = ["VAR_", "FUNC_", "CLASS_"]
REPLACE_DICT = {
protect... | CodeGen-main | codegen_sources/preprocessing/obfuscation/utils_deobfuscation.py |
"""
This file is adapted from https://github.com/Cobertos/bobskater
Obfuscate a python file so it still works
Has issues:
Doesn't support any sort of annotations (skips them, should be okay for now?)
Hacky patch of comprehensions (see top, reverses for one specific thing so the _fields prints out the right way due to)... | CodeGen-main | codegen_sources/preprocessing/obfuscation/bobskater_obfuscator.py |
# This file is adapted from https://github.com/Cobertos/bobskater
"""
Utility classes for tracking identifiers in Python scopes
"""
import ast
import builtins # Do not use __builtins__, it's different in different implementations (like IPython vs CPython)
# TODO: After coming back to this a second time, the names ... | CodeGen-main | codegen_sources/preprocessing/obfuscation/bobskater_frameUtils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import re
import subprocess
import uuid
from pathlib import Path
from .tree_sitter_processor import (
TreeSitterLangProcess... | CodeGen-main | codegen_sources/preprocessing/lang_processors/cpp_processor.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import typing as tp
import pytest
from . import python_tree_sitter_processor as ptsp
STAR_IMPORT = "from typing import *"
DIC... | CodeGen-main | codegen_sources/preprocessing/lang_processors/test_python_utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import re
import typing as tp
from sacrebleu import tokenize_v14_international
# IMPORTED
class ind_iter:
def __init__(se... | CodeGen-main | codegen_sources/preprocessing/lang_processors/tokenization_utils.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import re
import logging
import itertools
import typing as tp
from pathlib import Path
import tree_sitter as ts
from .lang_proc... | CodeGen-main | codegen_sources/preprocessing/lang_processors/tree_sitter_processor.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from pathlib import Path
from .java_processor import JAVA_CHAR2TOKEN, JAVA_TOKEN2CHAR
from .tree_sitter_processor import TreeSit... | CodeGen-main | codegen_sources/preprocessing/lang_processors/javascript_processor.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.