code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class MMCWrapper: <NEW_LINE> <INDENT> def __init__(self, mmc): <NEW_LINE> <INDENT> self.__mmc = mmc <NEW_LINE> self.__wrapper_cache = {} <NEW_LINE> <DEDENT> def __getattr__(self, name): <NEW_LINE> <INDENT> attr = getattr(self.__mmc, name) <NEW_LINE> if not callable(attr): <NEW_LINE> <INDENT> return attr <NEW_LINE> <DED... | Wraps MMCorePy to raise more helpfule exceptions
| 62598f8907d97122c42167e8 |
class NaChannel(ChannelBase): <NEW_LINE> <INDENT> def __init__(self, name, parent, xpower, ypower=0.0, Ek=50e-3): <NEW_LINE> <INDENT> if config.context.exists(parent.path + '/' + name): <NEW_LINE> <INDENT> ChannelBase.__init__(self, name, parent, xpower=xpower, ypower=ypower) <NEW_LINE> return <NEW_LINE> <DEDENT> Chann... | Dummy base class for all Na+ channels | 62598f8966656f66f7d59f39 |
class GroupDefinition(namedtuple("GroupDefinition", ["id", "created_at", "name", "description", "params"])): <NEW_LINE> <INDENT> def __new__(cls, **kwargs): <NEW_LINE> <INDENT> return super(cls, GroupDefinition).__new__( cls, kwargs.get("id"), kwargs.get("created_at", datetime.utcnow().replace(tzinfo=utc)), kwargs.get(... | A class to represent a definition for a Group in an Experiment. | 62598f89656771135c4891bd |
class CourseDetailView(CourseMixin, DetailView): <NEW_LINE> <INDENT> context_object_name = 'course' <NEW_LINE> template_name = 'course/detail.html' <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> self.organisation_slug = self.kwargs.get('organisation_slug', None) <NEW_LINE> try: <NEW_LINE> <INDE... | Detail view for Course. | 62598f89004d5f362081ed9a |
class RecipientCollection(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=200) | Database representation of a list of recipients
This will probably not be used in the future and should be considered
deprecated! | 62598f8910dbd63aa1c706f8 |
class TestKernelDocument(unittest.TestCase): <NEW_LINE> <INDENT> def test_get_scielo_pid_v2(self): <NEW_LINE> <INDENT> result = kernel_document.get_scielo_pid_v2( issn_id="3456-0987", year_and_order="20095", order_in_issue="54321") <NEW_LINE> self.assertEqual("S3456-09872009000554321", result) <NEW_LINE> <DEDENT> @unit... | docstring for TestKernelDocument | 62598f89d7e4931a7ef3bbde |
class TimeSeries(av): <NEW_LINE> <INDENT> @av._output_format <NEW_LINE> @av._call_api_on_func <NEW_LINE> def get_intraday(self, symbol, interval='15min', outputsize='compact'): <NEW_LINE> <INDENT> _FUNCTION_KEY = "TIME_SERIES_INTRADAY" <NEW_LINE> return _FUNCTION_KEY, "Time Series ({})".format(interval), 'Meta Data' <N... | This class implements all the api calls to times series
| 62598f8945492302aabfc018 |
class SyntaxError(Exception): <NEW_LINE> <INDENT> def __init__(self, lineNumber, text): <NEW_LINE> <INDENT> Exception.__init__(self) <NEW_LINE> self.lineNumber = lineNumber <NEW_LINE> self.text = text <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "%%ERROR - [at line: %d] %s" % (self.lineNumber, self... | Class for catching syntax errors
| 62598f89462c4b4f79dbb545 |
class TestMixin(object): <NEW_LINE> <INDENT> _test_setup_gen_xid = False <NEW_LINE> _test_teardown_no_delete = False <NEW_LINE> _test_purge_fields = [] <NEW_LINE> @classmethod <NEW_LINE> def _test_setup_model(cls, env): <NEW_LINE> <INDENT> cls._build_model(env.registry, env.cr) <NEW_LINE> env.registry.setup_models(env.... | Mixin to setup fake models for tests.
Usage - the model:
class FakeModel(models.Model, TestMixin):
_name = 'fake.model'
name = fields.Char()
Usage - the test klass:
@classmethod
def setUpClass(cls):
super().setUpClass()
FakeModel._test_setup_model(cls.env)
@classmet... | 62598f891f037a2d8b9e3c1a |
class BafTar(CompressedArchive): <NEW_LINE> <INDENT> edam_data = "data_2536" <NEW_LINE> edam_format = "format_3712" <NEW_LINE> file_ext = "brukerbaf.d.tar" <NEW_LINE> def get_signature_file(self): <NEW_LINE> <INDENT> return "analysis.baf" <NEW_LINE> <DEDENT> def sniff(self, filename): <NEW_LINE> <INDENT> if tarfile.is_... | Base class for common behavior of tar files of directory-based raw file formats
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname('brukerbaf.d.tar')
>>> BafTar().sniff(fname)
True
>>> fname = get_test_fname('test.fast5.tar')
>>> BafTar().sniff(fname)
False | 62598f89d10714528d69da13 |
class Student(): <NEW_LINE> <INDENT> def __init__(self, first_name, last_name, age): <NEW_LINE> <INDENT> self.first_name = first_name <NEW_LINE> self.last_name = last_name <NEW_LINE> self.age = age <NEW_LINE> <DEDENT> def to_json(self, attrs=None): <NEW_LINE> <INDENT> if attrs is None: <NEW_LINE> <INDENT> return self._... | class description | 62598f8921a7993f00c65ab7 |
class Meta: <NEW_LINE> <INDENT> ordering = ['last_name'] <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.username | Sorts the list with respect to their last names. | 62598f89435de62698e9b932 |
class EntityEditorWidget(global_search_widget.GlobalSearchWidget): <NEW_LINE> <INDENT> __metaclass__ = ShotgunFieldMeta <NEW_LINE> _EDITOR_TYPE = "entity" <NEW_LINE> def setup_widget(self): <NEW_LINE> <INDENT> sg_connection = self._bundle.sgtk.shotgun <NEW_LINE> self._project_search_supported = check_project_search_sup... | Allows editing of a ``entity`` field value as returned by the Shotgun API. | 62598f89596a8972361277b7 |
class TradfriCover(TradfriBaseEntity, CoverEntity): <NEW_LINE> <INDENT> def __init__( self, device_coordinator: TradfriDeviceDataUpdateCoordinator, api: Callable[[Command | list[Command]], Any], gateway_id: str, ) -> None: <NEW_LINE> <INDENT> super().__init__( device_coordinator=device_coordinator, api=api, gateway_id=... | The platform class required by Home Assistant. | 62598f890a50d4780f704f11 |
class ParameterMismatchError(ServerError): <NEW_LINE> <INDENT> code=ErrorCode.ParameterMismatch | This exception is raised by the JSON-RPC server if a method
discovers that the parameters (arguments) provided to it do not match
the requisite types for the method's parameters. TypeError exceptions
originating from the method call are automatically translated to this
exception. | 62598f89a4f1c619b294e12a |
class DeviceGateway(models.Model): <NEW_LINE> <INDENT> name = models.CharField("Name", max_length=255, default="localhost") <NEW_LINE> address = models.GenericIPAddressField("Address", default="127.0.0.1") <NEW_LINE> port = models.IntegerField("Port",default=8000) <NEW_LINE> protocol = mode... | Data acquisition board or interface board used to communicate with the measurement device
protocol - describes com protocol between gateway and client node | 62598f894e696a045264dba5 |
class Nullable (Type): <NEW_LINE> <INDENT> def __init__(self, dtype, **attributes): <NEW_LINE> <INDENT> super(Nullable, self).__init__(**attributes) <NEW_LINE> self._type = convert_type(dtype) <NEW_LINE> <DEDENT> def set(self, value, context = None): <NEW_LINE> <INDENT> return value if value is None else self._type.set... | accept None value plus the given type | 62598f8915baa72349461ac2 |
@base.ReleaseTracks(base.ReleaseTrack.GA) <NEW_LINE> class GetIamPolicy(base.ListCommand): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(parser): <NEW_LINE> <INDENT> flags.Instance().AddToParser(parser) <NEW_LINE> base.URI_FLAG.RemoveFromParser(parser) <NEW_LINE> <DEDENT> def Run(self, args): <NEW_LINE> <INDENT... | Get the IAM policy for a Cloud Spanner instance. | 62598f89bde94217f3707408 |
class MiddlePeopleRankRecordView(View): <NEW_LINE> <INDENT> pass | 顾问等级记录/查 | 62598f89fbf16365ca793bf0 |
class FreeFemRunner(ScriptRunner): <NEW_LINE> <INDENT> def __init__(self, program, path=".", args={}, interpreter="FreeFem++", interpreter_args={"-ne":"", "-nw":"", "-cd":"" }): <NEW_LINE> <INDENT> ScriptRunner.__init__(self, program, path, args, interpreter, interpreter... | Class for executing FreeFem++ scripts | 62598f89925a0f43d25e7b79 |
class Project(models.Model): <NEW_LINE> <INDENT> LANGUAGES = [ ["0", "en-us"], ["1", "fa"], ] <NEW_LINE> VCS = [ ("0", "Git"), ("1", "Mercurial"), ("2", "SVN"), ] <NEW_LINE> language = models.CharField( choices=LANGUAGES, default="0", max_length=1, verbose_name=_("Language"), help_text=_("Site language (en-us at this t... | Project main model | 62598f8945492302aabfc019 |
class ProgrammingLanguage(): <NEW_LINE> <INDENT> def __init__(self, name, typing, reflection, year): <NEW_LINE> <INDENT> self.typing = typing.lower() <NEW_LINE> self.reflection = reflection <NEW_LINE> self.year = year <NEW_LINE> self.name = name <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "{}, {} ... | Display the information about a programming language | 62598f890a50d4780f704f12 |
class Inventory: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.bag = { 'linemate': 0, 'deraumere': 0, 'sibur': 0, 'mendiane':0, 'phiras': 0, 'thystame': 0, 'food': 0, 'player': 0 } <NEW_LINE> self.empty = True <NEW_LINE> <DEDENT> def is_empty(self): <NEW_LINE> <INDENT> return self.empty <NEW_LINE> <D... | Inventory class
Returns:
Inventory | 62598f89ec188e330fdf83e3 |
class UserIsEnabledException(Exception): <NEW_LINE> <INDENT> def __init__(self, name: str) -> None: <NEW_LINE> <INDENT> super().__init__(f"User {name} is enabled") | Operation failed because user is not disabled. | 62598f89be383301e0253340 |
class NodeRedBinarySensor(NodeRedEntity): <NEW_LINE> <INDENT> on_states = ( "1", "true", "yes", "enable", STATE_ON, STATE_OPEN, STATE_HOME, STATE_UNLOCKED, ) <NEW_LINE> def __init__(self, hass, config): <NEW_LINE> <INDENT> super().__init__(hass, config) <NEW_LINE> self._component = CONF_BINARY_SENSOR <NEW_LINE> self._s... | Node-RED binary-sensor class. | 62598f89b57a9660fecd15c1 |
class SockWrapper(): <NEW_LINE> <INDENT> ENGLISH_TEXT = 1 <NEW_LINE> MAORI_TEXT = 2 <NEW_LINE> GERMAN_TEXT = 3 <NEW_LINE> def __init__(self, socket_number, language): <NEW_LINE> <INDENT> self.data = None <NEW_LINE> self.req_addr = None <NEW_LINE> self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) <NEW_LINE>... | wrapper for socket object | 62598f898e71fb1e983bb5f5 |
class FormProducts: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.frame=Toplevel() <NEW_LINE> _init_toolbar(self) <NEW_LINE> self._init_gridbox() <NEW_LINE> self.frm_addproduct=None <NEW_LINE> self.frm_editproduct=None <NEW_LINE> self.addproductflag=False <NEW_LINE> <DEDENT> def _init_gridbox(self): ... | The Products window with toolbar and a datagrid of products | 62598f8945492302aabfc01a |
class XMLRPCTestResource(XMLRPC): <NEW_LINE> <INDENT> FAILURE = 666 <NEW_LINE> NOT_FOUND = 23 <NEW_LINE> SESSION_EXPIRED = 42 <NEW_LINE> addSlash = True <NEW_LINE> def xmlrpc_add(self, request, a, b): <NEW_LINE> <INDENT> return a + b <NEW_LINE> <DEDENT> xmlrpc_add.signature = [['int', 'int', 'int'], ['double', 'double'... | This is the XML-RPC "server" against which the tests will be run. | 62598f89e76e3b2f99fd8573 |
class DBRecord(object): <NEW_LINE> <INDENT> def __init__(self, record, strict=False): <NEW_LINE> <INDENT> self.strict = strict <NEW_LINE> self.record = record.copy() <NEW_LINE> try: <NEW_LINE> <INDENT> self._extract_info() <NEW_LINE> self._strip_logging_junk() <NEW_LINE> self._fix_types() <NEW_LINE> <DEDENT> except Val... | Convert logged record (dict) to object that we can store in a DB.
| 62598f89097d151d1a2c0b6b |
class ProtocolVersion(object): <NEW_LINE> <INDENT> V1 = 1 <NEW_LINE> V2 = 2 <NEW_LINE> V3 = 3 <NEW_LINE> V4 = 4 <NEW_LINE> V5 = 5 <NEW_LINE> SUPPORTED_VERSIONS = (V5, V4, V3, V2, V1) <NEW_LINE> BETA_VERSIONS = (V5,) <NEW_LINE> MIN_SUPPORTED = min(SUPPORTED_VERSIONS) <NEW_LINE> MAX_SUPPORTED = max(SUPPORTED_VERSIONS) <N... | Defines native protocol versions supported by this driver. | 62598f890c0af96317c55ed1 |
class ClusterHostDuplicateError(ClusterHostAddError): <NEW_LINE> <INDENT> pass | Trying add host to the cluster with the same IP and port | 62598f89a17c0f6771d5bd88 |
class FBIconPosition (Enumeration): <NEW_LINE> <INDENT> kFBIconLeft=property(doc="Icon on left of text. ") <NEW_LINE> kFBIconTop=property(doc="Icon on top of text. ") <NEW_LINE> pass | Different icon positions possible.
| 62598f89b5575c28eb712a6b |
class Communicator: <NEW_LINE> <INDENT> WAIT_PERIOD = 100 <NEW_LINE> BUFFER_SIZE = 1024 <NEW_LINE> CONNECT_TIMEOUT = 0.01 <NEW_LINE> def __init__(self, root, port, ip=None): <NEW_LINE> <INDENT> self.__root = root <NEW_LINE> self.__port = port <NEW_LINE> self.__ip = ip <NEW_LINE> self.__socket = None <NEW_LINE> self.__b... | Implements a non-blocking socket interface, where a message can be sent
(immediately, after an initial connection has been created) and a message
can be anticipated (after an initial connection has been created) and
acted upon. The initial connection needs to be explicitly created by
invoking connect(), which attempts ... | 62598f8926068e7796d4c4a3 |
class FiltersTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_single_keyword_filter(self): <NEW_LINE> <INDENT> f = Filters(keyword="airline", start_date="2020-03-01", end_date="2020-03-02") <NEW_LINE> self.assertEqual(f.query_string, '"airline" &startdatetime=20200301000000&enddatetime=20200302000000&maxrecord... | Test that the correct query strings are generated from
various filters. | 62598f89bde94217f3707409 |
class GaussianFit(unittest.TestCase): <NEW_LINE> <INDENT> def test_gaussian_fit(self): <NEW_LINE> <INDENT> params = np.array([0.5, 6, 2]) <NEW_LINE> x = np.arange(10) <NEW_LINE> y = peakutils.gaussian(x, *params) <NEW_LINE> self.assertAlmostEqual(peakutils.gaussian_fit(x, y), params[1]) <NEW_LINE> res = peakutils.gauss... | Tests the Gaussian fit implementation | 62598f89e76e3b2f99fd8574 |
class ShaderGeometry( shaders.ShaderGeometry ): <NEW_LINE> <INDENT> def Render (self, mode = None): <NEW_LINE> <INDENT> if not self.attributes or not self.appearance: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> _,_,_,token = self.appearance.render( mode ) <NEW_LINE> if token is not None: <NEW_LINE> <INDENT> try... | Renderable geometry type using shaders | 62598f8923e79379d538c042 |
class OpenUserPost(InstagramPostsSerializer): <NEW_LINE> <INDENT> def __init__(self, node): <NEW_LINE> <INDENT> processed_node = super().process_common_edge_node(node) <NEW_LINE> processed_node["accessibility_caption"] = node[ "accessibility_caption" ] <NEW_LINE> super().__init__(processed_node) | Serializador para posts abiertos. | 62598f89596a8972361277ba |
class Queen: <NEW_LINE> <INDENT> def __init__(self, color): <NEW_LINE> <INDENT> if color == "white" or color == "black": <NEW_LINE> <INDENT> self.color = color <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> die("Choose a valid color for the queen!") <NEW_LINE> <DEDENT> self.moves = 0 <NEW_LINE> self.moveset = (1, 1), (2... | The class for a Queen | 62598f8966656f66f7d59f3d |
class Collectable(): <NEW_LINE> <INDENT> collection = None | Objects can inherit this mixin class and will then get a ``.collection`` attribute
that points back to the collection they were added to | 62598f89dc8b845886d530fe |
class UnsignedInteger(Integer): <NEW_LINE> <INDENT> __type_name__ = 'nonNegativeInteger' <NEW_LINE> @staticmethod <NEW_LINE> def validate_native(cls, value): <NEW_LINE> <INDENT> return ( Integer.validate_native(cls, value) and value >= 0 ) | The arbitrary-size unsigned integer, also known as nonNegativeInteger. | 62598f8916aa5153ce400049 |
class Options: <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> self._args: argparse.Namespace = None <NEW_LINE> self.parse(sys.argv) <NEW_LINE> <DEDENT> def get_depth(self) -> int: <NEW_LINE> <INDENT> return self._args.depth[0] <NEW_LINE> <DEDENT> def get_directories(self) -> List[str]: <NEW_LINE> <... | Options class | 62598f8923849d37ff850c05 |
class CommunicationError(Error): <NEW_LINE> <INDENT> pass | Errors for communication with the access token server. | 62598f89d7e4931a7ef3bbe2 |
class OneLaneBridgeSema(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.bridge_signal = Semaphore(0) <NEW_LINE> self.direction = None <NEW_LINE> self.num_crossing = [0, 0] <NEW_LINE> self.end_mutex = [Semaphore(1), Semaphore(1)] <NEW_LINE> V(self.bridge_signal) <NEW_LINE> <DEDENT> def cr... | A one-lane bridge allows multiple cars to pass in either direction, but at any
point in time, all cars on the bridge must be going in the same direction.
Cars wishing to cross should call the cross function, once they have crossed
they should call finished() | 62598f89711fe17d825e0232 |
class EDTestSuitePluginControlMedianFilterImagev1_0(EDTestSuite): <NEW_LINE> <INDENT> def process(self): <NEW_LINE> <INDENT> self.addTestCaseFromName("EDTestCasePluginUnitControlMedianFilterImagev1_0") <NEW_LINE> self.addTestCaseFromName("EDTestCasePluginExecuteControlMedianFilterImagev1_0") <NEW_LINE> self.addTestCase... | This is the test suite for EDNA plugin MedianFilterImagev1_0
It will run subsequently all unit tests and execution tests. | 62598f897cff6e4e811b5559 |
class MongoConnect: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.client = MongoClient('172.17.0.2', 27017) <NEW_LINE> self.db = self.client.boticario_api <NEW_LINE> self.user_coll = self.db.users <NEW_LINE> self.order_coll = self.db.orders <NEW_LINE> <DEDENT> def collection_fetcher(self, collection)... | Class with all the methods to work with MongoDB | 62598f89596a8972361277bb |
class ProjectUserListResponse(DjangoProtoRPCMessage): <NEW_LINE> <INDENT> items = messages.MessageField( ProjectCollaboratorsResponseMessage, 1, repeated=True) <NEW_LINE> is_list = messages.BooleanField(2) | ProtoRPC message definition to represent a list of stored users. | 62598f89b57a9660fecd15c4 |
class BFGFSTapas(GenericTapasComic): <NEW_LINE> <INDENT> name = "bfgfs-tapa" <NEW_LINE> long_name = "BFGFS (from Tapas.io)" <NEW_LINE> url = "https://tapas.io/series/BFGFS" | Class to retrieve BFGFS comics. | 62598f894e696a045264dba7 |
class TruncatedNormal(Initializer): <NEW_LINE> <INDENT> def __init__(self, mean=0., stddev=0.05, seed=None): <NEW_LINE> <INDENT> self.mean = mean <NEW_LINE> self.stddev = stddev <NEW_LINE> self.seed = seed <NEW_LINE> <DEDENT> def __call__(self, shape, dtype=None): <NEW_LINE> <INDENT> x = K.truncated_normal(shape, self.... | Initializer that generates a truncated normal distribution.
These values are similar to values from a `RandomNormal`
except that values more than two standard deviations from the mean
are discarded and redrawn. This is the recommended initializer for
neural network weights and filters.
# Arguments
mean: a python ... | 62598f89498bea3a75a5766b |
class FaceService(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def GetFrameStream(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): <NEW_LINE> <INDENT> return grpc.experimental.unary_stream(request,... | Missing associated documentation comment in .proto file. | 62598f898da39b475be02d2f |
@dataclass <NEW_LINE> class ClassNode(Node): <NEW_LINE> <INDENT> _inherited_slots: ClassVar[List[str]] = [] <NEW_LINE> class_class_uri: ClassVar[URIRef] = OWL.Class <NEW_LINE> class_class_curie: ClassVar[str] = "owl:Class" <NEW_LINE> class_name: ClassVar[str] = "class node" <NEW_LINE> class_model_uri: ClassVar[URIRef] ... | A node that is a class. | 62598f89a8ecb03325870d48 |
class HeartbeatReceiver(object): <NEW_LINE> <INDENT> def __init__(self, port, default_timeout=timedelta(seconds=30)): <NEW_LINE> <INDENT> self.registered_senders = {} <NEW_LINE> self.timeout = default_timeout <NEW_LINE> self.port = port <NEW_LINE> self.context = zmq.Context() <NEW_LINE> self.command_listener = self.con... | Listens over a zmq socket for commands from a registered sender | 62598f89c432627299fa2b18 |
class APIRateLimit(TumblpyError): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self.msg = msg <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.msg) | Raised when you've hit an API limit. Try to avoid these, read the API
docs if you're running into issues here, Tumblthon does not concern itself with
this matter beyond telling you that you've done goofed. | 62598f8926068e7796d4c4a5 |
@pytest.mark.usefixtures("before_2") <NEW_LINE> class TestTryMark(object): <NEW_LINE> <INDENT> def test_third_3(self): <NEW_LINE> <INDENT> print("test_3()") <NEW_LINE> <DEDENT> def test_fourth_4(self): <NEW_LINE> <INDENT> print('test_4()') <NEW_LINE> <DEDENT> def test_fifth_5(self): <NEW_LINE> <INDENT> print('test_5()'... | This is one way to group tests with will use same resources
All tests within these class will use 'before_2' fixture
No need to add it before each test | 62598f8915fb5d323ce7e873 |
class SentenceTokenizerMixin(_AnnotatorBase): <NEW_LINE> <INDENT> def requires(self): <NEW_LINE> <INDENT> return ["doc text"] <NEW_LINE> <DEDENT> def ndarray_requires(self): <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> def returns(self): <NEW_LINE> <INDENT> return ["sent id", "sent text"] <NEW_LINE> <DEDENT> def n... | Analyze method takes a string (an article text usually) and splits it
into substrings corresponding to the sentences in the origial article. | 62598f8923e79379d538c044 |
class DataSet(ABC): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def word_set(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def tokenizer_name(self): <NEW_LINE> <INDENT> pass | DataSet class, which represents all data Algorithm should know beforehand about it. | 62598f89435de62698e9b937 |
class Stmt (Ast): <NEW_LINE> <INDENT> pass | A single statement | 62598f89d6c5a102081e1c89 |
class BenchmarkError(Exception): <NEW_LINE> <INDENT> pass | Module-level exception.
| 62598f89d10714528d69da18 |
class PipeMessenger(object): <NEW_LINE> <INDENT> def __init__(self, pipe, status_callback=None, update_callback=None): <NEW_LINE> <INDENT> self.pipe = pipe <NEW_LINE> self.status_callback = status_callback <NEW_LINE> self.update_callback = update_callback <NEW_LINE> self.log = logging.getLogger(self.__class__.__name__)... | Wrapper for pipe communication | 62598f893eb6a72ae038a17b |
class Stats: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.register_calls = 0 <NEW_LINE> self.metrics_calls = 0 <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return json.dumps({ 'metrics': self.metrics_calls, 'registers': self.register_calls, }) | Stats class shared between client and server. | 62598f89f7d966606f747b31 |
class UtilsView(BrowserView): <NEW_LINE> <INDENT> importantFields = [] <NEW_LINE> def isProfileCompleted(self): <NEW_LINE> <INDENT> context = self.context <NEW_LINE> completedFields = 0 <NEW_LINE> for field in self.importantFields: <NEW_LINE> <INDENT> if getattr(context, field, None) is not None: <NEW_LINE> <INDENT> co... | Utils view | 62598f8929b78933be269e7f |
class TestWebScraper(unittest.TestCase): <NEW_LINE> <INDENT> def test_get_video_attributes(self): <NEW_LINE> <INDENT> vrtnu_urls = [ 'https://www.vrt.be/vrtnu/a-z/girls-talk/2/girls-talk-s2-mannen-kunnen-beter-drinken/', 'https://www.vrt.be/vrtnu/a-z/de-ideale-wereld/2019-nj/de-ideale-wereld-d20191219/', 'https://www.v... | TestCase class | 62598f898e71fb1e983bb5f9 |
class DashAssetFinder(BaseFinder): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> root_urls = settings.ROOT_URLCONF <NEW_LINE> importlib.import_module(root_urls) <NEW_LINE> self.apps = all_apps() <NEW_LINE> self.locations = [] <NEW_LINE> self.storages = OrderedDict() <NEW_LINE> self.ignore_patterns = ["*.p... | Find static files in asset directories | 62598f89b830903b9686e216 |
class IdError(PiGlowError): <NEW_LINE> <INDENT> def __init__(self, id_type, wrong_id): <NEW_LINE> <INDENT> PiGlowError.__init__(self, (id_type, wrong_id)) <NEW_LINE> self.wrong_id = wrong_id <NEW_LINE> self.id_type = id_type <NEW_LINE> self.message = "Unknown " + str(self.id_type) + " ID (" + str(self.wrong_... | ID error. | 62598f89097d151d1a2c0b6f |
class Agenda(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.queue_of_tasks = [] <NEW_LINE> self.urgent_slot_tasks = [] <NEW_LINE> <DEDENT> def find_task_by_interaction(self, interaction_obj): <NEW_LINE> <INDENT> for each_task in self.queue_of_tasks: <NEW_LINE> <INDENT> if isinstance(each_task, Inte... | Class for storing the plan of future processing tasks | 62598f89711fe17d825e0234 |
class ParameterError(Exception): <NEW_LINE> <INDENT> pass | Generic exception class for all exceptions pertaining to Parameters. | 62598f89cad5886f8bdc4e2f |
class RunMode(NamedTuple): <NEW_LINE> <INDENT> mode: str <NEW_LINE> @property <NEW_LINE> def break_on_detection(self) -> bool: <NEW_LINE> <INDENT> return self.mode in ["d", "sd"] <NEW_LINE> <DEDENT> @property <NEW_LINE> def break_on_survival(self) -> bool: <NEW_LINE> <INDENT> return self.mode in ["s", "sd"] <NEW_LINE> ... | Running mode choices. This translate the ``-m`` argument into valid ``Config`` options. | 62598f89e64d504609df9156 |
class EveryEpoch(JavaValue): <NEW_LINE> <INDENT> def __init__(self, bigdl_type="float"): <NEW_LINE> <INDENT> JavaValue.__init__(self, None, bigdl_type) | A trigger specifies a timespot or several timespots during training,
and a corresponding action will be taken when the timespot(s) is reached.
EveryEpoch is a trigger that triggers an action when each epoch finishs.
Could be used as trigger in setvalidation and setcheckpoint in Optimizer,
and also in TrainSummary.set_s... | 62598f89596a8972361277bd |
@inherit_doc <NEW_LINE> class Model(Transformer, metaclass=ABCMeta): <NEW_LINE> <INDENT> pass | Abstract class for models that are fitted by estimators.
.. versionadded:: 1.4.0 | 62598f8994891a1f408b9493 |
class ProgramFactory(PageExtensionDjangoModelFactory): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = models.Program <NEW_LINE> exclude = [ "page_in_navigation", "page_languages", "page_parent", "page_template", "page_title", ] <NEW_LINE> <DEDENT> page_template = models.Program.PAGE["template"] <NEW_LINE> ... | A factory to automatically generate random yet meaningful program extensions
in our tests. | 62598f89d53ae8145f917fd9 |
class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_color = (230, 230, 230) <NEW_LINE> self.ship_speed_factor = 1.5 <NEW_LINE> self.ship_limit = 3 <NEW_LINE> self.bullet_speed_factor = 3 <NEW_LINE> self.bullet_widt... | A class to store all settings for Alien invasion. | 62598f89d99f1b3c44d051f2 |
class TestParse(unittest.TestCase): <NEW_LINE> <INDENT> def test_parse_out(self): <NEW_LINE> <INDENT> prefix, body = croxy.parse_out("PRIVMSG #test :bob: How's it going?") <NEW_LINE> self.assertEqual(prefix, "PRIVMSG #test ") <NEW_LINE> self.assertEqual(body, "bob: How's it going?") <NEW_LINE> <DEDENT> def test_parse_i... | Test parsing lines. | 62598f89b5575c28eb712a6d |
class Model(GObject.GObject): <NEW_LINE> <INDENT> __gsignals__ = { 'add_link': (GObject.SignalFlags.RUN_FIRST, None, ([int])), } <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> GObject.GObject.__init__(self) <NEW_LINE> self.data = {} <NEW_LINE> self.data['shared_links'] = [] <NEW_LINE> self.data['deleted'] = [] <NEW... | The model of web-activity which uses json to serialize its data
to a file and deserealize from it. | 62598f8915baa72349461ac8 |
@keras_export('keras.metrics.CosineSimilarity') <NEW_LINE> class CosineSimilarity(MeanMetricWrapper): <NEW_LINE> <INDENT> def __init__(self, name='cosine_similarity', dtype=None, axis=-1): <NEW_LINE> <INDENT> super(CosineSimilarity, self).__init__( cosine_similarity, name, dtype=dtype, axis=axis) | Computes the cosine similarity between the labels and predictions.
cosine similarity = (a . b) / ||a|| ||b||
[Cosine Similarity](https://en.wikipedia.org/wiki/Cosine_similarity)
This metric keeps the average cosine similarity between `predictions` and
`labels` over a stream of data.
Usage:
>>> # l2_norm(y_true) = [... | 62598f8926068e7796d4c4a7 |
class PowerGridUseRegister(ResourceUseRegister): <NEW_LINE> <INDENT> def __init__(self, fit): <NEW_LINE> <INDENT> ResourceUseRegister.__init__(self, fit, Attribute.power) <NEW_LINE> <DEDENT> def get_resource_use(self): <NEW_LINE> <INDENT> return round(ResourceUseRegister.get_resource_use(self), 2) | Calculates powergrid use of passed fit. | 62598f890383005118f6d244 |
class InvestUniverse(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.data = InvestUniverse._load_data() <NEW_LINE> self.companies = self.data.ticker.unique().tolist() <NEW_LINE> self.trading_days = pd.Series(self.data.Date.unique()).sort_values() <NEW_LINE> <DEDENT> def get_companies(self) -> List[s... | represents the investment universe. loads all the data of all titles.
offers several convenient methods to access the data. | 62598f89e76e3b2f99fd8578 |
class APIStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.List = channel.unary_unary( '/buckets.pb.API/List', request_serializer=buckets__pb2.ListRequest.SerializeToString, response_deserializer=buckets__pb2.ListReply.FromString, ) <NEW_LINE> self.Init = channel.unary_unary( '/buc... | Missing associated documentation comment in .proto file. | 62598f8921bff66bcd7227b7 |
class DownloadStatus: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.downloaded = 0 <NEW_LINE> self.total_size = None <NEW_LINE> self.resumed_from = 0 <NEW_LINE> self.time_started = None <NEW_LINE> self.time_finished = None <NEW_LINE> <DEDENT> def started(self, resumed_from=0, total_size=None): <NEW_L... | Holds details about the downland status. | 62598f8966656f66f7d59f41 |
class SelectFreeDeviceTests(TestCase): <NEW_LINE> <INDENT> def test_provides_device_name(self): <NEW_LINE> <INDENT> self.assertTrue(_select_free_device(['sda']).startswith(u'/dev/')) <NEW_LINE> <DEDENT> def test_all_devices_used(self): <NEW_LINE> <INDENT> existing = ['sd' + ch for ch in ascii_lowercase] <NEW_LINE> self... | Tests for selecting new device. | 62598f89507cdc57c63a48d8 |
class RlocIDL(object): <NEW_LINE> <INDENT> thrift_spec = (None, (1, TType.I32, 'addressAF', None, None), (2, TType.STRING, 'address', None, None)) <NEW_LINE> def __init__(self, addressAF = None, address = None): <NEW_LINE> <INDENT> self.addressAF = addressAF <NEW_LINE> self.address = address <NEW_LINE> <DEDENT> def rea... | RLOC Address
Attributes:
- addressAF
- address | 62598f8973bcbd0ca4bc9d9e |
class TestExternal(unittest.TestCase): <NEW_LINE> <INDENT> def test_load_external_by_filename(self): <NEW_LINE> <INDENT> with path('mailman.config', 'postfix.cfg') as filename: <NEW_LINE> <INDENT> contents = load_external(str(filename)) <NEW_LINE> <DEDENT> self.assertEqual(contents[:9], '[postfix]') <NEW_LINE> <DEDENT>... | Test external configuration file loading APIs. | 62598f89925a0f43d25e7b7f |
class SockAddrInet(object): <NEW_LINE> <INDENT> pass | <class maturity="stable">
<summary>
Class encapsulating an IPv4 address:port pair.
</summary>
<description>
<para>
This class encapsulates an IPv4 address:port pair, similarly to
the <parameter>sockaddr_in</parameter> struct in C. The class is implemented and exported by
the Zorp core. T... | 62598f8945492302aabfc01f |
class Rescale(object): <NEW_LINE> <INDENT> def __init__(self, output_size, yolo=False): <NEW_LINE> <INDENT> assert isinstance(output_size, (int, tuple)) <NEW_LINE> self.output_size = output_size <NEW_LINE> self.yolo = yolo <NEW_LINE> <DEDENT> def __call__(self, image, targets): <NEW_LINE> <INDENT> h, w = image.shape[:2... | Rescale the image in a sample to a given size.
Args:
output_size (tuple or int): Desired output size. If tuple, output is
matched to output_size. If int, smaller of image edges is matched
to output_size keeping aspect ratio the same. | 62598f89a79ad16197769bae |
class ArticleTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.new_article = Article(1234,'bbc news','A thrilling new world','new world','John','url','urlToImage','publishedAt') <NEW_LINE> <DEDENT> def test_instance(self): <NEW_LINE> <INDENT> self.assertTrue(isinstance(self.new_arti... | Test Class to test the behaviour of the Article class | 62598f8915baa72349461ac9 |
class UserProfile(AbstractBaseUser, PermissionsMixin): <NEW_LINE> <INDENT> email = models.EmailField(max_length=255, unique=True) <NEW_LINE> name = models.CharField(max_length=255) <NEW_LINE> is_active = models.BooleanField(default=True) <NEW_LINE> is_staff = models.BooleanField(default=False) <NEW_LINE> objects = User... | Datbase model for users in the system | 62598f89f7d966606f747b33 |
class Schema(object): <NEW_LINE> <INDENT> def __init__(self, fieldSchemas=None, properties=None,): <NEW_LINE> <INDENT> self.fieldSchemas = fieldSchemas <NEW_LINE> self.properties = properties <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTr... | Attributes:
- fieldSchemas
- properties | 62598f8929b78933be269e80 |
class PigDice(object): <NEW_LINE> <INDENT> def __init__(self, num_dice=1, dice_sides=6, skunk_value=0): <NEW_LINE> <INDENT> self.NumDice = num_dice <NEW_LINE> self.DiceSides = dice_sides <NEW_LINE> self.DiceList = [] <NEW_LINE> self.SkunkValue = skunk_value <NEW_LINE> for i in range(self.NumDice): <NEW_LINE> <INDENT> s... | @Class: PigDice
@Description:
Represents the game of pig (dice game)
@Methods:
Roll - Rolls the "die" or "dice" and returns a list of rolled values | 62598f897b25080760ed6ff4 |
class FilenameConfirm(QDialog): <NEW_LINE> <INDENT> def __init__(self, hlsp_name): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.default_val = ".".join([hlsp_name, "hlsp"]) <NEW_LINE> self.file = None <NEW_LINE> prompt = QLabel("Select a file name to use:") <NEW_LINE> self.default_button = QRadioButton("Defaul... | Pop up a confirmation dialog window before clearing all changes to the
form. | 62598f89a05bb46b3848a3c5 |
class TestAuthVariableOverride: <NEW_LINE> <INDENT> def init_ref(self, path, app): <NEW_LINE> <INDENT> admin_ref = db.reference(path, app) <NEW_LINE> admin_ref.set('test') <NEW_LINE> assert admin_ref.get() == 'test' <NEW_LINE> <DEDENT> def test_no_access(self, app, override_app): <NEW_LINE> <INDENT> path = '_adminsdk/p... | Test cases for database auth variable overrides. | 62598f89c432627299fa2b1c |
class NASAResponseError(Exception): <NEW_LINE> <INDENT> pass | Raised when NASA returns anything but a 200 | 62598f89d4950a0f3b110bdb |
class Age_Invalid(Exception): <NEW_LINE> <INDENT> def return_message(self): <NEW_LINE> <INDENT> return "Invalid Age: Enter only digits" | Exception occurs when entered age is invalid | 62598f8976d4e153a661c761 |
class Gender(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.setup_name_files() <NEW_LINE> <DEDENT> def load_name_file(self, filename): <NEW_LINE> <INDENT> with codecs.open(filename, encoding='utf-8') as f: <NEW_LINE> <INDENT> names = [name.strip() for name in f.readlines()] <NEW_LINE> <DEDENT... | Gender algorithms. | 62598f8926068e7796d4c4a9 |
class StaticFileHandler(webapp2.RequestHandler): <NEW_LINE> <INDENT> def get(self, path): <NEW_LINE> <INDENT> abs_path = os.path.dirname(__file__) + "/../static/" + path <NEW_LINE> if os.path.isdir(abs_path): <NEW_LINE> <INDENT> self.response.set_status(403) <NEW_LINE> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT... | As webapp2 doesn't have any built-in capabilities to handle static files,
we implement our own here.
StaticFileHandler reads the local filesystem to read files specified in the
URL and serve them accordingly.
TODO(cgb): Make sure that callers can't read files outside of magik's
directory. | 62598f8923e79379d538c048 |
class StaClrWordpress(StaClrLog): <NEW_LINE> <INDENT> def serialization(self): <NEW_LINE> <INDENT> lines = self.status_log <NEW_LINE> data = self.data <NEW_LINE> if_n = True <NEW_LINE> for i in lines: <NEW_LINE> <INDENT> if i.startswith("wordpress"): <NEW_LINE> <INDENT> if "latest" in i: <NEW_LINE> <INDENT> start = lin... | clearlinux test_status_wordpress long analysis | 62598f89fbf16365ca793bf8 |
class BaseTodoCommand(Command): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.type = 'todo' <NEW_LINE> super(BaseTodoCommand, self).__init__(**kwargs) <NEW_LINE> <DEDENT> def get_data_path(self, key, week=None): <NEW_LINE> <INDENT> data_dir = '%s/%s' % (self.storage_path, key) <NEW_LINE> if... | A base class for Todo commands
| 62598f8973bcbd0ca4bc9d9f |
class TestBlockSerializer(TestBlockSerializerBase): <NEW_LINE> <INDENT> def create_serializer(self, context=None): <NEW_LINE> <INDENT> if context is None: <NEW_LINE> <INDENT> context = self.serializer_context <NEW_LINE> <DEDENT> return BlockSerializer( context['block_structure'], many=True, context=context, ) <NEW_LINE... | Tests the BlockSerializer class, which returns a list of blocks. | 62598f8907d97122c42167f2 |
class TradeLoopBack(object): <NEW_LINE> <INDENT> def __init__(self, trade_days, trade_strategy): <NEW_LINE> <INDENT> self.trade_days = trade_days <NEW_LINE> self.trade_strategy = trade_strategy <NEW_LINE> self.profit_array = [] <NEW_LINE> <DEDENT> def execute_trade(self): <NEW_LINE> <INDENT> for ind, day in enumerate(s... | 交易回测系统 | 62598f8966656f66f7d59f43 |
class ImportExportDocumentArray(ImportExportDocument): <NEW_LINE> <INDENT> OVERHEAD = 0 <NEW_LINE> def _random_array(self, value: str, num: int): <NEW_LINE> <INDENT> if value == '': <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> if len(value) < num: <NEW_LINE> <INDENT> return [value] * 5 <NEW_LINE> <DEDENT> scope = ... | Extend ImportExportDocument by adding array docs.
The documents contain 25 top-level fields with variable-size arrays. | 62598f8916aa5153ce40004f |
class char_desc: <NEW_LINE> <INDENT> def __init__(self, handle, uuid): <NEW_LINE> <INDENT> self.handle = handle <NEW_LINE> self.uuid = uuid <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return '\t\t0x{0:04x}\t{1}\t{2}\n'.format(self.handle, self.uuid, uuid_to_desc(self.uuid)) | charachteristic description class. | 62598f89507cdc57c63a48da |
class ExcelData: <NEW_LINE> <INDENT> test_case_id = None <NEW_LINE> test_case_name = None <NEW_LINE> run_test_case = 'yes' <NEW_LINE> request_url = None <NEW_LINE> request_method = 'get' <NEW_LINE> request_header = None <NEW_LINE> request_param = None <NEW_LINE> request_body = None <NEW_LINE> dependent_case_id = None <... | excel字段定义 | 62598f89009cb60464d01078 |
class Collection(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User, null=True, blank=True) <NEW_LINE> name = models.CharField(max_length=128) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return "%s (%d)" % (self.name, self.user_id or 0) | A collection. Mostly the theme | 62598f895f7d997b871f917f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.