repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
smt
smt-master/smt/surrogate_models/krg.py
""" Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu> This package is distributed under New BSD license. """ from smt.surrogate_models.krg_based import KrgBased from smt.utils.kriging import componentwise_distance class KRG(KrgBased): name = "Kriging" def _initialize(self): super()._initialize() ...
921
25.342857
86
py
smt
smt-master/smt/surrogate_models/kplsk.py
""" Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu> This package is distributed under New BSD license. """ from smt.surrogate_models import KPLS from smt.utils.kriging import componentwise_distance_PLS, componentwise_distance class KPLSK(KPLS): name = "KPLSK" def _initialize(self): super()._ini...
1,388
27.346939
86
py
smt
smt-master/smt/surrogate_models/rmtb.py
""" Author: Dr. John T. Hwang <hwangjt@umich.edu> This package is distributed under New BSD license. """ import numpy as np import scipy.sparse from numbers import Integral from smt.utils.linear_solvers import get_solver from smt.utils.line_search import get_line_search_class from smt.surrogate_models.rmts import RMT...
4,507
33.945736
86
py
smt
smt-master/smt/surrogate_models/surrogate_model.py
""" Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu> Dr. John T. Hwang <hwangjt@umich.edu> This package is distributed under New BSD license. Paul Saves : Mixed Integer """ from typing import Optional import numpy as np from collections import defaultdict from abc import ABCMeta, abstractmethod from smt.ut...
18,858
31.571675
131
py
smt
smt-master/smt/surrogate_models/kpls.py
""" Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu> This package is distributed under New BSD license. """ import numpy as np from sklearn.cross_decomposition import PLSRegression as pls from smt.surrogate_models.krg_based import KrgBased from smt.utils.kriging import componentwise_distance_PLS import warnings ...
4,500
31.854015
112
py
smt
smt-master/smt/surrogate_models/__init__.py
from .ls import LS from .qp import QP from .krg import KRG from .kpls import KPLS from .gekpls import GEKPLS from .kplsk import KPLSK from .genn import GENN from .mgp import MGP from .krg_based import MixIntKernelType from smt.utils.design_space import ( DesignSpace, FloatVariable, IntegerVariable, Ord...
535
18.851852
46
py
smt
smt-master/smt/surrogate_models/krg_based.py
""" Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu> Some functions are copied from gaussian_process submodule (Scikit-learn 0.14) This package is distributed under New BSD license. """ import numpy as np from enum import Enum from scipy import linalg, optimize from copy import deepcopy import warnings from smt....
72,518
36.987952
163
py
smt
smt-master/smt/surrogate_models/qp.py
""" Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu> Dr. Nathalie.bartoli <nathalie@onera.fr> This package is distributed under New BSD license. TO DO: - define outputs['sol'] = self.sol """ import numpy as np import scipy from smt.surrogate_models.surrogate_model import SurrogateModel from smt.uti...
4,775
28.300613
98
py
smt
smt-master/smt/surrogate_models/tests/test_krg_het_noise.py
""" Author: Andres Lopez-Lopera <<andres.lopez_lopera@onera.fr>> This package is distributed under New BSD license. """ import unittest import numpy as np from smt.surrogate_models import KRG from smt.utils.sm_test_case import SMTestCase from smt.utils import compute_rms_error class Test(SMTestCase): def test_...
1,072
27.236842
86
py
smt
smt-master/smt/surrogate_models/tests/test_kpls.py
""" Author: Remi Lafage <<remi.lafage@onera.fr>> This package is distributed under New BSD license. """ import unittest import numpy as np from smt.surrogate_models import KPLS from smt.problems import Sphere from smt.sampling_methods import FullFactorial, LHS class TestKPLS(unittest.TestCase): def test_predict...
2,294
30.875
88
py
smt
smt-master/smt/surrogate_models/tests/test_mgp.py
""" Author: Remi Lafage <<remi.lafage@onera.fr>> This package is distributed under New BSD license. """ import unittest import numpy as np from smt.surrogate_models import MGP from smt.problems import Sphere from smt.sampling_methods import FullFactorial, LHS class TestMGP(unittest.TestCase): def test_predict_o...
1,659
28.122807
78
py
smt
smt-master/smt/surrogate_models/tests/test_krg_based.py
""" Author: Remi Lafage <<remi.lafage@onera.fr>> This package is distributed under New BSD license. """ import unittest import numpy as np from smt.surrogate_models.krg_based import KrgBased class TestKrgBased(unittest.TestCase): def test_theta0_default_init(self): krg = KrgBased() krg.set_trai...
1,127
30.333333
84
py
smt
smt-master/smt/surrogate_models/tests/test_rmts.py
""" Author: Remi Lafage <<remi.lafage@onera.fr>> This package is distributed under New BSD license. """ import unittest import numpy as np import matplotlib.pyplot as plt from smt.utils.silence import Silence from smt.utils.sm_test_case import SMTestCase from smt.utils import compute_rms_error from smt.surrogate_mod...
2,291
26.614458
84
py
smt
smt-master/smt/surrogate_models/tests/test_krg_training.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 23 15:20:29 2020 @author: ninamoello """ from __future__ import print_function, division import numpy as np import unittest from smt.utils.sm_test_case import SMTestCase from smt.utils.kriging import ( pow_exp, abs_exp, squar_exp, a...
11,319
35.050955
88
py
smt
smt-master/smt/surrogate_models/tests/test_surrogate_model_examples.py
""" Author: John Hwang <<hwangjt@umich.edu>> This package is distributed under New BSD license. """ import unittest import matplotlib matplotlib.use("Agg") try: from smt.surrogate_models import IDW, RBF, RMTB, RMTC compiled_available = True except: compiled_available = False class Test(unittest.Test...
18,375
28.354633
104
py
smt
smt-master/smt/surrogate_models/tests/test_qp.py
""" Author: Remi Lafage <<remi.lafage@onera.fr>>, Frederic Zahle This package is distributed under New BSD license. """ import unittest import numpy as np from smt.surrogate_models import QP, KRG from smt.examples.rans_crm_wing.rans_crm_wing import ( get_rans_crm_wing, plot_rans_crm_wing, ) class TestQP(un...
818
25.419355
70
py
smt
smt-master/smt/surrogate_models/tests/__init__.py
0
0
0
py
smt
smt-master/smt/surrogate_models/tests/test_krg_predictions.py
""" Authors: Nathalie Bartoli, Paul Saves This package is distributed under New BSD license. """ import unittest import numpy as np from smt.surrogate_models import KRG from smt.sampling_methods import LHS from smt.utils.sm_test_case import SMTestCase class Test(SMTestCase): def setUp(self): def pb(x):...
6,514
34.026882
84
py
smt
smt-master/smt/surrogate_models/tests/test_krg_outputs.py
""" Author: Remi Lafage <<remi.lafage@onera.fr>> This package is distributed under New BSD license. """ import unittest import numpy as np from smt.surrogate_models import KRG from smt.problems import Sphere from smt.sampling_methods import FullFactorial, LHS class TestKRG(unittest.TestCase): def test_predict_o...
1,347
25.431373
70
py
smt
smt-master/smt/applications/mfk.py
# -*- coding: utf-8 -*- """ Created on Fri May 04 10:26:49 2018 @author: Mostafa Meliani <melimostafa@gmail.com> Multi-Fidelity co-Kriging: recursive formulation with autoregressive model of order 1 (AR1) Adapted on January 2021 by Andres Lopez-Lopera to the new SMT version """ from copy import deepcopy import numpy...
27,471
35.776439
141
py
smt
smt-master/smt/applications/application.py
""" Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>, R. Lafage This package is distributed under New BSD license. """ from smt.utils.options_dictionary import OptionsDictionary from smt.surrogate_models import LS, QP, KPLS, KRG, KPLSK, GEKPLS, MGP try: from smt.surrogate_models import IDW, RBF, RMTC, RMTB...
2,127
27
99
py
smt
smt-master/smt/applications/vfm.py
""" Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>, R. Lafage This package is distributed under New BSD license. Variable-fidelity modeling: two types of bridge functions are available; i.e., additive and multiplicative """ import numpy as np from smt.utils.options_dictionary import OptionsDictionary from t...
9,813
34.557971
97
py
smt
smt-master/smt/applications/moe.py
""" Author: Remi Lafage <remi.lafage@onera.fr> This package is distributed under New BSD license. Mixture of Experts """ # TODO : support for best number of clusters # TODO : implement verbosity 'print_global' # TODO : documentation import numpy as np import warnings OLD_SKLEARN = False try: # scikit-learn < 0.20....
25,371
31.695876
109
py
smt
smt-master/smt/applications/mfkplsk.py
# -*- coding: utf-8 -*- """ Created on Fri May 04 10:26:49 2018 @author: Mostafa Meliani <melimostafa@gmail.com> Multi-Fidelity co-Kriging: recursive formulation with autoregressive model of order 1 (AR1) Partial Least Square decomposition added on highest fidelity level KPLSK model combined PLS followed by a Krging m...
2,074
31.421875
103
py
smt
smt-master/smt/applications/__init__.py
from .vfm import VFM from .moe import MOE, MOESurrogateModel from .mfk import MFK, NestedLHS from .mfkpls import MFKPLS from .mfkplsk import MFKPLSK from .ego import EGO, Evaluator
181
25
39
py
smt
smt-master/smt/applications/mixed_integer.py
""" Author: Remi Lafage <remi.lafage@onera.fr> This package is distributed under New BSD license. """ import numpy as np from smt.surrogate_models.surrogate_model import SurrogateModel from smt.sampling_methods.sampling_method import SamplingMethod from smt.utils.checks import ensure_2d_array from smt.surrogate_model...
12,226
34.44058
163
py
smt
smt-master/smt/applications/mfkpls.py
# -*- coding: utf-8 -*- """ Created on Fri May 04 10:26:49 2018 @author: Mostafa Meliani <melimostafa@gmail.com> Multi-Fidelity co-Kriging: recursive formulation with autoregressive model of order 1 (AR1) Partial Least Square decomposition added on highest fidelity level Adapted on March 2020 by Nathalie Bartoli to th...
2,313
32.057143
120
py
smt
smt-master/smt/applications/ego.py
""" Authors: Nathalie Bartoli, Remy Priem, Remi Lafage, Emile Roux <emile.roux@univ-smb.fr> This package is distributed under New BSD license. """ import numpy as np from types import FunctionType from scipy.stats import norm from scipy.optimize import minimize from smt.surrogate_models import KPLS, KRG, KPLSK, M...
14,811
33.446512
102
py
smt
smt-master/smt/applications/tests/test_mfkpls.py
# -*- coding: utf-8 -*- """ Created on Mon May 07 14:20:11 2018 @author: m.meliani Adapted to new SMT version in march 2020 by Nathalie Bartoli """ import matplotlib matplotlib.use("Agg") import unittest import numpy as np import unittest import inspect from collections import OrderedDict from smt.problems impor...
6,025
27.027907
83
py
smt
smt-master/smt/applications/tests/test_mfkplsk.py
# -*- coding: utf-8 -*- """ Created on Mon May 07 14:20:11 2018 @author: m.meliani Adapted to new SMT version in march 2020 by Nathalie Bartoli """ import matplotlib matplotlib.use("Agg") import unittest import numpy as np import unittest import inspect from collections import OrderedDict from smt.problems impor...
6,062
26.811927
84
py
smt
smt-master/smt/applications/tests/test_ego.py
# coding: utf-8 """ Author: Remi Lafage <remi.lafage@onera.fr> and Nathalie Bartoli This package is distributed under New BSD license. """ import warnings warnings.filterwarnings("ignore") import os import unittest import numpy as np from sys import argv import matplotlib matplotlib.use("Agg") from smt.applications...
43,079
32.525292
98
py
smt
smt-master/smt/applications/tests/test_mfk_variance.py
# -*- coding: utf-8 -*- """ Created on Mon Apr 27 15:36:13 2020 @author: Vincent Drouet and Nathalie Bartoli in order to validate the variance formula for multifidelity on the branin 2D function Comparisons are based on the paper Le Gratiet et Cannamela 2015 : Le Gratiet, L., & Cannamela, C. (2015). Cokriging-...
16,153
33.080169
88
py
smt
smt-master/smt/applications/tests/test_vfm.py
""" Author: Mohamed Amine Bouhlel <mbouhlel@umich.edu> This package is distributed under New BSD license. """ import unittest import matplotlib matplotlib.use("Agg") import numpy as np from scipy import linalg from smt.utils.sm_test_case import SMTestCase from smt.utils import compute_rms_error from smt.utils.silen...
7,530
29.366935
88
py
smt
smt-master/smt/applications/tests/test_mfk_1fidelity.py
import matplotlib matplotlib.use("Agg") import unittest import numpy as np import unittest from smt.problems import TensorProduct from smt.sampling_methods import LHS from smt.utils.sm_test_case import SMTestCase from smt.utils.silence import Silence from smt.utils import compute_rms_error from smt.applications.mfk...
2,882
24.741071
70
py
smt
smt-master/smt/applications/tests/test_mfk.py
# -*- coding: utf-8 -*- """ Created on Mon May 07 14:20:11 2018 @author: m.meliani """ import matplotlib matplotlib.use("Agg") import unittest import numpy as np import unittest import inspect from collections import OrderedDict from smt.problems import Sphere, TensorProduct from smt.sampling_methods import LHS, ...
5,714
26.742718
74
py
smt
smt-master/smt/applications/tests/__init__.py
0
0
0
py
smt
smt-master/smt/applications/tests/test_mixed_integer.py
""" Created on Tue Oct 12 10:48:01 2021 @author: psaves """ import unittest import numpy as np import matplotlib import itertools matplotlib.use("Agg") from smt.applications.mixed_integer import ( MixedIntegerContext, MixedIntegerSamplingMethod, MixedIntegerKrigingModel, ) from smt.problems import Sphere...
55,817
31.584939
116
py
smt
smt-master/smt/applications/tests/test_moe.py
""" Author: Remi Lafage <remi.lafage@onera.fr> This package is distributed under New BSD license. """ import matplotlib matplotlib.use("Agg") import unittest import numpy as np from sys import argv from smt.applications import MOE, MOESurrogateModel from smt.utils.sm_test_case import SMTestCase from smt.problems i...
16,658
29.344262
99
py
smt
smt-master/doc/preprocess_test.py
""" Author: Dr. John T. Hwang <hwangjt@umich.edu> This package is distributed under New BSD license. """ import os, sys import inspect import importlib import contextlib try: from StringIO import StringIO except: from io import StringIO import matplotlib matplotlib.use("Agg") import matplotlib.pypl...
3,771
27.793893
81
py
smt
smt-master/doc/preprocess_options.py
""" Author: Dr. John T. Hwang <hwangjt@umich.edu> This package is distributed under New BSD license. """ def process_options(root, file_name, iline, line): file_path = root + "/" + file_name embed_num_indent = line.find(".. embed-options-table") if "embed-options-table-surrogate_models" in line: ...
3,088
31.861702
86
py
smt
smt-master/doc/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # SMT documentation build configuration file, created by # sphinx-quickstart on Sun Aug 6 19:36:14 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autoge...
5,197
28.873563
79
py
smt
smt-master/doc/preprocess.py
""" Author: Dr. John T. Hwang <hwangjt@umich.edu> This package is distributed under New BSD license. """ import os from preprocess_test import process_test from preprocess_options import process_options def get_file_paths(): file_paths_list = [] file_paths_list_rstx = [] file_paths_list_py = []...
1,505
27.415094
76
py
smt
smt-master/doc/embed_directives/directive_embed_options.py
from sphinx_auto_embed.directive import Directive class DirectiveEmbedOptions(Directive): """ Directive for embedding a table from an OptionsDictionary instance. The 3 arguments are the module name, class name, and attribute name. """ NAME = "embed-options-table" NUM_ARGS = 3 def run(se...
2,419
37.412698
88
py
pyzor
pyzor-master/setup.py
import sys import setuptools import distutils.core import pyzor long_description = """ Pyzor is spam-blocking networked system that uses spam signatures to identify them. """ classifiers = ["Operating System :: POSIX", "Operating System :: Microsoft :: Windows", "Environment :: Console...
1,532
28.480769
75
py
pyzor
pyzor-master/web/application.py
#! /usr/bin/env python import os import email import socket import logging import smtplib import datetime import email.utils import email.mime.base import email.mime.text import email.mime.multipart try: import configparser as ConfigParser except ImportError: import ConfigParser import flask from flask_wtf.f...
8,333
31.940711
80
py
pyzor
pyzor-master/pyzor/message.py
"""This modules contains the various messages used in the pyzor client server communication. """ import random import email.message import pyzor class Message(email.message.Message): def __init__(self): email.message.Message.__init__(self) self.setup() def setup(self): pass def...
4,023
23.993789
77
py
pyzor
pyzor-master/pyzor/digest.py
"""Handle digesting the messages.""" from __future__ import print_function import re import sys import codecs import hashlib try: import HTMLParser except ImportError: import html.parser as HTMLParser # Hard-coded for the moment. digest_spec = ([(20, 3), (60, 3)]) HASH = hashlib.sha1 HASH_SIZE = len(HASH(b...
6,107
30.979058
76
py
pyzor
pyzor-master/pyzor/server.py
"""Networked spam-signature detection server. The server receives the request in the form of a RFC5321 message, and responds with another RFC5321 message. Neither of these messages has a body - all of the data is encapsulated in the headers. The response headers will always include a "Code" header, which is a HTTP-s...
15,776
37.574572
79
py
pyzor
pyzor-master/pyzor/account.py
"""A collection of utilities that facilitate working with Pyzor accounts. Note that accounts are not necessary (on the client or server), as an "anonymous" account always exists.""" import time import hashlib import pyzor def sign_msg(hashed_key, timestamp, msg, hash_=hashlib.sha1): """Converts the key, timest...
2,546
30.8375
74
py
pyzor
pyzor-master/pyzor/config.py
"""Functions that handle parsing pyzor configuration files.""" import os import re import logging import collections try: import sentry_sdk _has_sentry = True except ImportError: _has_sentry = False import pyzor.account _COMMENT_P = re.compile(r"((?<=[^\\])#.*)") # Configuration files for the Pyzor Se...
9,034
34.155642
85
py
pyzor
pyzor-master/pyzor/client.py
"""Networked spam-signature detection client. >>> import pyzor >>> import pyzor.client >>> import pyzor.digest >>> import pyzor.config To load the accounts file: >>> accounts = pyzor.config.load_accounts(filename) To create a client (to then issue commands): >>> client = pyzor.client.Client(accounts) To create a ...
10,826
33.262658
78
py
pyzor
pyzor-master/pyzor/__init__.py
"""Networked spam-signature detection.""" __author__ = "Frank J. Tobin, ftobin@neverending.org" __credits__ = "Tony Meyer, Dreas von Donselaar, all the Pyzor contributors." __version__ = "1.1.1" import hashlib proto_name = 'pyzor' proto_version = 2.1 anonymous_user = 'anonymous' # We would like to use sha512, but t...
1,410
23.327586
76
py
pyzor
pyzor-master/pyzor/forwarder.py
"""Manage the forwarder process.""" import logging import threading try: import Queue except ImportError: import queue as Queue class Forwarder(object): """Forwards digest to remote pyzor servers""" def __init__(self, forwarding_client, remote_servers, max_queue_size=10000): ...
2,568
34.191781
79
py
pyzor
pyzor-master/pyzor/engines/redis_.py
"""Redis database engine.""" import time import logging import datetime import functools try: import redis _has_redis = True except ImportError: redis = None _has_redis = False from pyzor.engines.common import * VERSION = "1" NAMESPACE = "pyzord.digest_v%s" % VERSION def encode_date(date): """...
6,235
31.310881
80
py
pyzor
pyzor-master/pyzor/engines/gdbm_.py
"""Gdbm database engine.""" try: import gdbm as gdbm _has_gdbm = True except ImportError: try: import dbm.gnu as gdbm _has_gdbm = True except ImportError: _has_gdbm = False import time import logging import datetime import threading from pyzor.engines.common import Record, DBH...
6,609
30.327014
79
py
pyzor
pyzor-master/pyzor/engines/mysql.py
"""MySQLdb database engine.""" import time import logging import datetime import itertools import functools import threading try: import Queue except ImportError: import queue as Queue try: import MySQLdb import MySQLdb.cursors _has_mysql = True except ImportError: _has_mysql = False from py...
12,438
34.438746
78
py
pyzor
pyzor-master/pyzor/engines/redis_v0.py
"""Redis database engine. XXX Deprecated version. """ import logging import datetime import functools try: import redis _has_redis = True except ImportError: redis = None _has_redis = False from pyzor.engines.common import * NAMESPACE = "pyzord.digest" encode_date = lambda d: "" if d is None else...
4,666
29.703947
80
py
pyzor
pyzor-master/pyzor/engines/common.py
"""Common library shared by different engines.""" import sys import datetime from collections import namedtuple __all__ = ["DBHandle", "DatabaseError", "Record", "BaseEngine"] DBHandle = namedtuple("DBHandle", ["single_threaded", "multi_threaded", "multi_processing", "prefork"]) ...
3,190
28.009091
79
py
pyzor
pyzor-master/pyzor/engines/__init__.py
"""Database backends for pyzord. The database class must expose a dictionary-like interface, allowing access via __getitem__, __setitem__, and __delitem__. The key will be a forty character string, and the value should be an instance of the Record class. If the database backend cannot store the Record objects native...
891
30.857143
75
py
pyzor
pyzor-master/pyzor/hacks/py3.py
"""Hacks for python2-3 compatibility.""" import sys def reload(module): """Reload the modeule. This is handled differently according to the python version. This even varies across Python3 versions """ if sys.version_info[0] == 2: # Built-in method return reload(module) el...
506
22.045455
63
py
pyzor
pyzor-master/pyzor/hacks/__init__.py
"""Various hack to make pyzor compatible with different Python versions."""
76
37.5
75
py
pyzor
pyzor-master/pyzor/hacks/py26.py
"""Hacks for Python 2.6""" __all__ = ["hack_all", "hack_email", "hack_select"] def hack_all(email=True, select=True): """Apply all Python 2.6 patches.""" if email: hack_email() if select: hack_select() def hack_email(): """The python2.6 version of email.message_from_string, doesn't ...
1,258
26.977778
76
py
pyzor
pyzor-master/scripts/summarise.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """Summarise Pyzor database. Generate a summary of the current state of a Pyzor database. This currently only works with a MySQL (or compatible) database. This can currently only output to a Slack channel. There are extra requirements for this script: * click * requ...
6,995
29.819383
87
py
pyzor
pyzor-master/tests/__init__.py
"""Package reserved for tests and test utilities.""" import unittest def suite(): """Gather all the tests from this package in a test suite.""" import tests.unit as unit import tests.functional as functional test_suite = unittest.TestSuite() test_suite.addTest(unit.suite()) test_suite.addTe...
433
20.7
65
py
pyzor
pyzor-master/tests/unit/test_forwarder.py
"""Test the pyzor.forwarder module """ import time import unittest import threading try: from unittest.mock import call, Mock except ImportError: from mock import call, Mock import pyzor.forwarder class ForwarderTest(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) def te...
2,352
32.614286
106
py
pyzor
pyzor-master/tests/unit/test_account.py
"""Test the pyzor.account module""" import io import os import time import email import hashlib import unittest import pyzor import pyzor.config import pyzor.account class AccountTest(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) self.timestamp = 1381219396 self.msg ...
8,254
39.665025
104
py
pyzor
pyzor-master/tests/unit/test_config.py
import os import logging import unittest try: import configparser as ConfigParser except ImportError: import ConfigParser try: from unittest.mock import patch, Mock except ImportError: from mock import patch, Mock import pyzor.config from tests.util import mock_open class MockData(list): def c...
9,903
30.948387
74
py
pyzor
pyzor-master/tests/unit/test_server.py
"""Test the pyzor.server module """ import io import sys import time import logging import unittest try: import socketserver as SocketServer except ImportError: import SocketServer from datetime import datetime, timedelta try: from unittest.mock import patch except ImportError: from mock import patch ...
14,225
34.654135
81
py
pyzor
pyzor-master/tests/unit/test_client.py
import time import email import unittest try: from unittest.mock import Mock, patch, call except ImportError: from mock import Mock, patch, call import pyzor.client import pyzor.account class TestBase(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) self.thread = 3371...
12,149
30.889764
82
py
pyzor
pyzor-master/tests/unit/__init__.py
"""A suite of unit tests that verifies the correct behaviour of various functions/methods in the pyzord code. Note these tests the source of pyzor, not the version currently installed. """ import unittest def suite(): """Gather all the tests from this package in a test suite.""" import test_client impor...
897
26.212121
74
py
pyzor
pyzor-master/tests/unit/test_digest.py
"""The the pyzor.digest module """ import unittest import pyzor.digest from pyzor.digest import * try: from unittest.mock import patch, Mock, call except ImportError: from mock import patch, Mock, call HTML_TEXT = """<html><head><title>Email spam</title></head><body> <p><b>Email spam</b>, also known as <b>j...
11,210
35.399351
129
py
pyzor
pyzor-master/tests/unit/test_engines/test_redis.py
"""Test the pyzor.engines.gdbm_ module.""" import time import logging import unittest from datetime import datetime try: from unittest.mock import Mock, patch, call except ImportError: from mock import Mock, patch, call import pyzor.engines.redis_ import pyzor.engines.common class EncodingRedisTest(unittes...
8,064
34.528634
90
py
pyzor
pyzor-master/tests/unit/test_engines/test_mysql.py
"""Test the pyzor.engines.mysql module.""" import unittest import threading from datetime import datetime, timedelta import pyzor.engines import pyzor.engines.mysql import pyzor.engines.common class MockTimer(): def __init__(self, *args, **kwargs): pass def start(self): pass def setDaemo...
6,907
33.368159
83
py
pyzor
pyzor-master/tests/unit/test_engines/test_gdbm.py
"""Test the pyzor.engines.gdbm_ module.""" import sys import time import unittest import threading from datetime import datetime, timedelta import pyzor.engines.gdbm_ import pyzor.engines.common class MockTimer(): def __init__(self, *args, **kwargs): pass def start(self): pass def setDae...
5,304
29.843023
94
py
pyzor
pyzor-master/tests/unit/test_engines/test_redis_v0.py
"""Test the pyzor.engines.gdbm_ module.""" import unittest from datetime import datetime import pyzor.engines.redis_v0 import pyzor.engines.common class EncodingRedisTest(unittest.TestCase): """Test the RedisDBHandle class""" r_count = 24 wl_count = 42 entered = datetime(2014, 4, 23, 15, 41, 30) ...
7,898
36.084507
83
py
pyzor
pyzor-master/tests/unit/test_engines/__init__.py
"""A suite of unit tests that verifies the correct behaviour of various functions/methods in the pyzord code. Note these tests the source of pyzor, not the version currently installed. """ import unittest def suite(): """Gather all the tests from this package in a test suite.""" import test_gdbm import ...
682
23.392857
74
py
pyzor
pyzor-master/tests/util/__init__.py
"""This package contains various utilities use in the pyzor tests.""" import os import sys import time import redis import shutil import unittest import subprocess from datetime import datetime try: from unittest.mock import mock_open as _mock_open except ImportError: from mock import mock_open as _mock_open...
14,111
36.73262
132
py
pyzor
pyzor-master/tests/benchmark/__init__.py
0
0
0
py
pyzor
pyzor-master/tests/benchmark/measure_server_response.py
from __future__ import division import json import Queue import timeit import optparse import threading import collections DIGEST = "da39a3ee5e6b4b0d3255bfef95601890afd80709" SETUP = """ import pyzor import string import random import hashlib import pyzor.client digest = "".join(random.choice(string.letters) for _ ...
4,339
27.552632
79
py
pyzor
pyzor-master/tests/functional/test_forwarder.py
import os import time import shutil import unittest import subprocess import redis class ForwardSetup(object): """Setup forwarding client and 'remote' pyzord""" def write_homedir_file(self, name, content): if not name or not content: return with open(os.path.join(self.homedir, nam...
4,002
35.390909
191
py
pyzor
pyzor-master/tests/functional/test_account.py
import unittest from tests.util import * class AccountPyzorTest(PyzorTestBase): # test bob which has access to everything def test_ping(self): self.check_pyzor("ping", "bob", code=200, exit_code=0) def test_pong(self): self.check_pyzor("pong", "bob", input=msg, code=200, exit_code=0)...
4,999
34.971223
84
py
pyzor
pyzor-master/tests/functional/test_pyzor.py
import io import sys import redis import unittest from tests.util import * MBOX_FILE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_data", "test.mbx") class PyzorScriptTest(PyzorTestBase): password_file = None access = """ALL : anonymous : allow """ def test_report_threshold(self...
11,584
49.58952
112
py
pyzor
pyzor-master/tests/functional/test_server.py
import sys import time import errno import unittest try: import configparser as ConfigParser except ImportError: import ConfigParser import pyzor.client from tests.util import * try: import MySQLdb has_mysql = True except ImportError: has_mysql = False try: import redis has_redis = True ...
7,853
31.188525
70
py
pyzor
pyzor-master/tests/functional/__init__.py
"""A suite of functional tests that verifies the correct behaviour of the pyzor client and server as a whole. Functional test should not touch real data and are usually safe, but it's not recommended to run theses on production servers. Note these tests the installed version of pyzor, not the version from the sourc...
964
26.571429
77
py
pyzor
pyzor-master/tests/functional/test_digest.py
# -*- coding: utf-8 -*- import sys import hashlib import unittest from tests.util import * TEXT = """MIME-Version: 1.0 Sender: chirila@spamexperts.com Received: by 10.216.90.129 with HTTP; Fri, 23 Aug 2013 01:59:03 -0700 (PDT) Date: Fri, 23 Aug 2013 11:59:03 +0300 Delivered-To: chirila@spamexperts.com X-Google-Sender...
56,344
56.029352
206
py
pyzor
pyzor-master/tests/functional/test_engines/test_redis.py
import unittest try: import redis has_redis = True except ImportError: has_redis = False from tests.util import * @unittest.skipIf(not has_redis, "redis library not available") class RedisPyzorTest(PyzorTest, PyzorTestBase): """Test the redis engine""" dsn = "localhost,,,10" engine = "redis"...
1,306
24.627451
68
py
pyzor
pyzor-master/tests/functional/test_engines/test_mysql.py
import unittest try: import configparser as ConfigParser except ImportError: import ConfigParser from tests.util import * try: import MySQLdb has_mysql = True except ImportError: has_mysql = False schema = """ CREATE TABLE IF NOT EXISTS `%s` ( `digest` char(40) default NULL, `r_count`...
3,987
31.16129
79
py
pyzor
pyzor-master/tests/functional/test_engines/test_gdbm.py
import unittest from tests.util import * try: import gdbm has_gdbm = True except ImportError: has_gdbm = False @unittest.skipIf(not has_gdbm, "gdbm library not available") class GdbmPyzorTest(PyzorTest, PyzorTestBase): """Test the gdbm engine""" dsn = "pyzord.db" engine = "gdbm" class Thread...
1,009
25.578947
67
py
pyzor
pyzor-master/tests/functional/test_engines/__init__.py
"""A suite of functional tests that verifies the correct behaviour of the pyzor client and server as a whole. Functional test should not touch real data and are usually safe, but it's not recommended to run theses on production servers. Note these tests the installed version of pyzor, not the version from the source....
745
24.724138
77
py
pyzor
pyzor-master/docs/conf.py
# -*- coding: utf-8 -*- # # Pyzor documentation build configuration file, created by # sphinx-quickstart on Sat Jun 7 15:20:07 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All...
8,310
30.244361
79
py
MINDER
MINDER-main/setup.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 distutils.core import setup, Extension import os extra_compile_args = ["-std=c++11", "-DNDEBUG", "-O3"] extension =...
810
26.965517
77
py
MINDER
MINDER-main/scripts/build_fm_index.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 csv import logging import multiprocessing import re import ftfy import torch import tqdm import pic...
7,216
29.974249
136
py
MINDER
MINDER-main/scripts/training/make_supervised_msmarco_dataset2.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 argparse import ArgumentParser from collections import defaultdict import json import multiprocessing import random im...
10,873
33.302839
135
py
MINDER
MINDER-main/scripts/training/make_supervised_msmarco_dataset3.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 argparse import ArgumentParser from collections import defaultdict import json import multiprocessing import random im...
10,873
33.302839
135
py
MINDER
MINDER-main/scripts/training/make_generated_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 csv import random import tqdm import pickle from nltk.corpus import stopwords from random import sam...
7,389
32.139013
110
py
MINDER
MINDER-main/scripts/training/make_generated_dataset3.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 csv import random import tqdm import pickle from nltk.corpus import stopwords from random import sam...
8,962
31.711679
140
py
MINDER
MINDER-main/scripts/training/make_supervised_dpr_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 argparse import ArgumentParser from collections import defaultdict import json import multiprocessing import random im...
9,100
31.974638
135
py
MINDER
MINDER-main/scripts/training/make_unsupervised_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 csv import random import tqdm from nltk.corpus import stopwords banned = { "the", "The", "...
5,756
31.525424
88
py
MINDER
MINDER-main/scripts/training/make_generated_dataset2.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 csv import random import tqdm import pickle from nltk.corpus import stopwords from random import sam...
7,171
30.594714
140
py
MINDER
MINDER-main/scripts/training/make_generated_dataset_for_mamarco.py
# Copyright (c) Facebook, Inc. and its affiliates. # 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 csv import random import tqdm import pickle from nltk.corpus import stopwords from random import sam...
7,234
30.872247
136
py