code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class TestModel(DBTest): <NEW_LINE> <INDENT> model = model
The base class for testing models in you TG project.
62598fb2bd1bec0571e15100
class CosineProximity(LossFunction): <NEW_LINE> <INDENT> def __init__(self, bigdl_type="float"): <NEW_LINE> <INDENT> super(CosineProximity, self).__init__(None, bigdl_type)
The negative of the mean cosine proximity between predictions and targets. The cosine proximity is defined as below: x'(i) = x(i) / sqrt(max(sum(x(i)^2), 1e-12)) y'(i) = y(i) / sqrt(max(sum(x(i)^2), 1e-12)) cosine_proximity(x, y) = mean(-1 * x'(i) * y'(i)) >>> metrics = CosineProximity() creating: createZo...
62598fb28a43f66fc4bf21f5
class Fingerprint(object): <NEW_LINE> <INDENT> def __init__(self, fingerprint): <NEW_LINE> <INDENT> self.fp = fingerprint <NEW_LINE> <DEDENT> def __or__(self, other): <NEW_LINE> <INDENT> return ob.OBFingerprint.Tanimoto(self.fp, other.fp) <NEW_LINE> <DEDENT> @property <NEW_LINE> def bits(self): <NEW_LINE> <INDENT> retu...
A Molecular Fingerprint. Required parameters: fingerprint -- a vector calculated by OBFingerprint.FindFingerprint() Attributes: fp -- the underlying fingerprint object bits -- a list of bits set in the Fingerprint Methods: The "|" operator can be used to calculate the Tanimoto coeff. For example, give...
62598fb2d486a94d0ba2c04b
class CpuAcctStat: <NEW_LINE> <INDENT> cpuacctPath = '/sys/fs/cgroup/cpuacct/docker/' <NEW_LINE> def __init__(self, containerId, containerName): <NEW_LINE> <INDENT> self.containerId = containerId <NEW_LINE> self.containerName = containerName <NEW_LINE> self.time = datetime.datetime.now() <NEW_LINE> try: <NEW_LINE> <IND...
Class for cpu metric for a docker container
62598fb285dfad0860cbfab1
class Toolchain(Bundle): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def extra_options(extra_vars=None): <NEW_LINE> <INDENT> if extra_vars is None: <NEW_LINE> <INDENT> extra_vars = {} <NEW_LINE> <DEDENT> extra_vars.update({ 'set_env_external_modules': [False, "Include setenv statements for toolchain components that us...
Compiler toolchain easyblock: nothing to install, just generate module file.
62598fb24527f215b58e9f50
class VersionPlistCommandDependency (CommandDependency): <NEW_LINE> <INDENT> def __init__(self, key='CFBundleShortVersionString', **kwargs): <NEW_LINE> <INDENT> super(VersionPlistCommandDependency, self).__init__(**kwargs) <NEW_LINE> self.key = key <NEW_LINE> <DEDENT> def _get_command_version_stream(self, *args, **kwar...
A command that doesn't support --version or equivalent options On OS X, a command's executable may be hard to find, or not exist in the PATH. Work around that by looking up the version information in the package's version.plist file.
62598fb2796e427e5384e80f
class AvroUtils(object): <NEW_LINE> <INDENT> REQUEST_SCHEMA = {} <NEW_LINE> REQUEST_AVSC = 'hq_sample.avrc' <NEW_LINE> @classmethod <NEW_LINE> def init_schma(self, request_file=''): <NEW_LINE> <INDENT> request_file = request_file or self.REQUEST_AVSC <NEW_LINE> with open(request_file, 'r') as fileOpen: <NEW_LINE> <IND...
avro序列化接口
62598fb260cbc95b063643c7
class SelectCommand(CAPDU): <NEW_LINE> <INDENT> name = "Select" <NEW_LINE> def __init__(self, file_path=None, file_identifier=None, next_occurrence=False): <NEW_LINE> <INDENT> if file_path is not None: <NEW_LINE> <INDENT> if isinstance(file_path, str): <NEW_LINE> <INDENT> self.data = [ord(c) for c in file_path] <NEW_LI...
Select an application or file on the card. Defined in: EMV 4.3 Book 1 section 11.3
62598fb23317a56b869be589
class Sink(Model): <NEW_LINE> <INDENT> def __init__(self, sim): <NEW_LINE> <INDENT> super().__init__(sim) <NEW_LINE> self.departures = Intervals() <NEW_LINE> self.departures.record(self.sim.stime) <NEW_LINE> <DEDENT> def receive_packet(self): <NEW_LINE> <INDENT> self.departures.record(self.sim.stime)
Sink module represents the traffic sink and counts arrived packets. Methods: - receive_packet(): called when the server finishes serving packet.
62598fb263b5f9789fe851e5
class MultiHeadedSelfAttentionModule(nn.Module): <NEW_LINE> <INDENT> def __init__(self, d_model: int, num_heads: int, dropout_p: float = 0.1, device: torch.device = 'cuda'): <NEW_LINE> <INDENT> super(MultiHeadedSelfAttentionModule, self).__init__() <NEW_LINE> self.positional_encoding = PositionalEncoding(d_model) <NEW_...
Conformer employ multi-headed self-attention (MHSA) while integrating an important technique from Transformer-XL, the relative sinusoidal positional encoding scheme. The relative positional encoding allows the self-attention module to generalize better on different input length and the resulting encoder is more robust ...
62598fb255399d3f05626596
class ProctoredExamStudentAttemptFilter(BaseDataApiFilter): <NEW_LINE> <INDENT> site = django_filters.CharFilter(field_name="user__usersignupsource__site", lookup_expr='iexact') <NEW_LINE> course_id = django_filters.CharFilter(field_name="proctored_exam__course_id", lookup_expr='iexact') <NEW_LINE> exam_name = django_f...
TODO: add me
62598fb24428ac0f6e65859e
class Mushroom(Veggies): <NEW_LINE> <INDENT> pass
マッシュルーム
62598fb263d6d428bbee2828
class ListContactView(ListView): <NEW_LINE> <INDENT> model = Contact <NEW_LINE> form_class = SearchContactForm <NEW_LINE> template_name = 'caesar/contact_list.html' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = Contact.objects.all() <NEW_LINE> if self.request.GET.get('receiver'): <NEW_LINE> <INDENT>...
Displays the list of all contacts created for all visitors; which means that no login and no permissions are required.
62598fb2a8370b77170f0458
class VirtualboxProviderPlugin(ProviderPlugin): <NEW_LINE> <INDENT> NAME = 'virtualbox' <NEW_LINE> DESCRIPTION = 'a virtualbox provider' <NEW_LINE> APPLIANCE = VirtualboxAppliance <NEW_LINE> MACHINE = VirtualboxMachineNode <NEW_LINE> NETWORK = VirtualboxNetworkNode <NEW_LINE> INTERFACE = VirtualboxInterfaceNode <NEW_LI...
A provider
62598fb2be383301e0253876
class ZookeeperDiscoverySpi(DiscoverySpi): <NEW_LINE> <INDENT> def __init__(self, zoo_service, root_path): <NEW_LINE> <INDENT> self.connection_string = zoo_service.connection_string() <NEW_LINE> self.port = zoo_service.settings.client_port <NEW_LINE> self.root_path = root_path <NEW_LINE> self.session_timeout = zoo_serv...
ZookeeperDiscoverySpi.
62598fb2aad79263cf42e84f
class DeviotUpgradePioCommand(WindowCommand): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> self.window.run_command("deviot_update_pio")
Search for platformIO updates Extends: sublime_plugin.WindowCommand
62598fb24e4d5625663724a3
class Solution: <NEW_LINE> <INDENT> def strStr(self, source, target): <NEW_LINE> <INDENT> len_source = len(source) <NEW_LINE> len_target = len(target) <NEW_LINE> if len_source <= 0 and source == target: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> for start_ind in range(len_source): <NEW_LINE> <INDENT> sub = source...
@param source: @param target: @return: return the index
62598fb2be7bc26dc9251e9a
class UnsupportedFlavor(CreateError): <NEW_LINE> <INDENT> pass
Unsupported create action for given flavor name.
62598fb2a8370b77170f0459
class FlowControlVisitor(BaseVisitor): <NEW_LINE> <INDENT> def __init__(self, main_visitor_method): <NEW_LINE> <INDENT> super(FlowControlVisitor, self).__init__(main_visitor_method) <NEW_LINE> <DEDENT> def should_visit(self, nodety, node, state): <NEW_LINE> <INDENT> return nodety in (phpast.Block, phpast.If, phpast.Els...
Create new Scopes
62598fb2009cb60464d0159e
class SampleDict(UserDict): <NEW_LINE> <INDENT> def __init__(self, name=None): <NEW_LINE> <INDENT> UserDict.__init__(self) <NEW_LINE> self['name'] = name
Class with ancestor class
62598fb226068e7796d4c9d2
class OptionsPoints(_BaseElementOptions): <NEW_LINE> <INDENT> size = properties.Instance( 'Default point size on the element', OptionsSize, default=OptionsSize, ) <NEW_LINE> shape = properties.StringChoice( 'Points are displayed as squares or spheres', default='square', choices=['square', 'sphere'], )
PointSet visualization options
62598fb267a9b606de54604b
class TensorSpec(object): <NEW_LINE> <INDENT> __slots__ = ["_shape", "_shape_tuple", "_dtype", "_name"] <NEW_LINE> def __init__(self, shape, dtype, name=None): <NEW_LINE> <INDENT> self._shape = tensor_shape.TensorShape(shape) <NEW_LINE> try: <NEW_LINE> <INDENT> self._shape_tuple = tuple(self.shape.as_list()) <NEW_LINE>...
Describes a tf.Tensor. A TensorSpec allows an API to describe the Tensors that it accepts or returns, before that Tensor exists. This allows dynamic and flexible graph construction and configuration.
62598fb24a966d76dd5eef54
class TestReadFileassertNotEqual(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.results = (None) <NEW_LINE> self.test_data = (123) <NEW_LINE> <DEDENT> def test_function(self): <NEW_LINE> <INDENT> assertNotEqual(self.results, read_file(self.test_data))
Unittest
62598fb27c178a314d78d519
class MovieView(GenreYear, ListView): <NEW_LINE> <INDENT> model = Movie <NEW_LINE> queryset = Movie.objects.filter(draft=False) <NEW_LINE> template_name = "movies/movie_list.html" <NEW_LINE> paginate_by = 2
Список фильмов
62598fb232920d7e50bc60d1
class TestOptimization(unittest.TestCase): <NEW_LINE> <INDENT> def test_readme_basic_example(self): <NEW_LINE> <INDENT> def my_process(x, y): <NEW_LINE> <INDENT> val = np.sin(x)*x + np.sin(y)*y <NEW_LINE> return {'val': val} <NEW_LINE> <DEDENT> builder = BlueprintBuilder() <NEW_LINE> builder.add_float_gene(name='x', do...
E2E tests for the Lamarck Optimizer.
62598fb24f6381625f1994fe
class RedirectResponseSchema(colander.MappingSchema): <NEW_LINE> <INDENT> headers = RedirectHeadersSchema()
Redirect response schema.
62598fb285dfad0860cbfab2
class Controller(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._log = _logger(self.__class__) <NEW_LINE> <DEDENT> @property <NEW_LINE> def position(self): <NEW_LINE> <INDENT> return self._position_get() <NEW_LINE> <DEDENT> @position.setter <NEW_LINE> def position(self, pos): <NEW_LINE> <INDE...
A controller for sending virtual mouse events to the system.
62598fb25fc7496912d482bc
class View(object): <NEW_LINE> <INDENT> def __init__(self, *values, **kargs): <NEW_LINE> <INDENT> self.content = values <NEW_LINE> self.layout = kargs.get("layout", "|") <NEW_LINE> self.label=kargs.get("label", "")
Describes the layout of widget. <Long description of the class functionality.>
62598fb201c39578d7f12df6
class Unauthorized(ClientError): <NEW_LINE> <INDENT> def __init__(self, msg=None): <NEW_LINE> <INDENT> ClientError.__init__(self, 401, msg)
401 Unauthorized
62598fb24527f215b58e9f51
class PrimeFreq(): <NEW_LINE> <INDENT> def __init__(self, listlistinningnos): <NEW_LINE> <INDENT> self.listprime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] <NEW_LINE> self.dictPrimeFreq = collections.defaultdict(int) <NEW_LINE> self.listlistFreqPrime = [] <NEW_LINE> self.totalprime = 0 <NEW_LINE> self.listI...
소수(prime number)에 대해 그 빈도수를 구하고, 확률를 구한다.
62598fb23d592f4c4edbaf3e
class AuiToolBarEvent(CommandToolBarEvent): <NEW_LINE> <INDENT> def __init__(self, command_type=None, win_id=0): <NEW_LINE> <INDENT> CommandToolBarEvent.__init__(self, command_type, win_id) <NEW_LINE> if type(command_type) in six.integer_types: <NEW_LINE> <INDENT> self.notify = wx.NotifyEvent(command_type, win_id) <NEW...
A specialized command event class for events sent by :class:`AuiToolBar`.
62598fb256ac1b37e6302268
class TASRTestCase(unittest.TestCase): <NEW_LINE> <INDENT> test_dir = TEST_DIR <NEW_LINE> src_dir = SRC_DIR <NEW_LINE> fix_dir = FIX_DIR <NEW_LINE> @staticmethod <NEW_LINE> def get_fixture_file(rel_path, mode): <NEW_LINE> <INDENT> path = '%s/%s' % (TASRTestCase.fix_dir, rel_path) <NEW_LINE> return open(path, mode) <NEW...
These tests check that the TASR S+V REST API, expected by the Avro-1124 repo code. This does not check the TASR native API calls.
62598fb255399d3f05626597
class JobMember(models.Model): <NEW_LINE> <INDENT> objects = ProcessManager() <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> if self.committee_member_confirmed: <NEW_LINE> <INDENT> return '%s is a confirmed %s for rating decision %s' % ( self.member, self.role, self.rating_decision ) <NEW_LINE> <DEDENT> else: <NEW_L...
Describe the attributes of a committee member for a specific decision.
62598fb230bbd722464699b7
class TestOrganisationGroupsApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = ChronoSheetsClientLibApi.organisation_groups_api.OrganisationGroupsApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_organisation_groups_create_organi...
OrganisationGroupsApi unit test stubs
62598fb2baa26c4b54d4f333
class PartyMemberSupportedBillFeature(BooleanFeature): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Feature.__init__(self, "Party member supported the Bill") <NEW_LINE> <DEDENT> def Extract(self, party, bill): <NEW_LINE> <INDENT> return bool(set(bill.joining_members.all()).intersection( set(party.member_...
Feature is True if a party member was supporting the bill.
62598fb2236d856c2adc947d
class GameStartEvent(GameEvent): <NEW_LINE> <INDENT> name = 'GameStartEvent' <NEW_LINE> def __init__(self, frame, pid, data): <NEW_LINE> <INDENT> super(GameStartEvent, self).__init__(frame, pid)
Recorded when the game starts and the frames start to roll. This is a global non-player event.
62598fb22ae34c7f260ab160
class ConvertImageDtype(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, dtype: torch.dtype) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.dtype = dtype <NEW_LINE> <DEDENT> def forward(self, image): <NEW_LINE> <INDENT> return F.convert_image_dtype(image, self.dtype)
Convert a tensor image to the given ``dtype`` and scale the values accordingly This function does not support PIL Image and Numpy NDArray. Args: dtype (torch.dtype): Desired data type of the output .. note:: When converting from a smaller to a larger integer ``dtype`` the maximum values are **not** mapped ex...
62598fb24a966d76dd5eef55
class AwsResourceCollector(): <NEW_LINE> <INDENT> instance_table = None <NEW_LINE> region_list = [] <NEW_LINE> keyname_list = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if os.path.exists('./resource_keeper.yaml'): <NEW_LINE> <INDENT> config_file = './resource_keeper.yaml' <NEW_LINE...
Collect unused resources for AWS.
62598fb25fcc89381b26618b
class MAVLink_mission_write_partial_list_message(MAVLink_message): <NEW_LINE> <INDENT> def __init__(self, target_system, target_component, start_index, end_index): <NEW_LINE> <INDENT> MAVLink_message.__init__(self, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST, 'MISSION_WRITE_PARTIAL_LIST') <NEW_LINE> self._fieldnames = ['...
This message is sent to the MAV to write a partial list. If start index == end index, only one item will be transmitted / updated. If the start index is NOT 0 and above the current list size, this request should be REJECTED!
62598fb24e4d5625663724a4
class FunctionEnvelopeCollection(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'value': {'required': True}, 'next_link': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[FunctionEnvelope]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __ini...
Collection of Kudu function information elements. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. :vartype value: list[~azure.mgmt.web.v2020_06_01.models.Functi...
62598fb27d847024c075c440
class BufferedParallelTestResult(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.buffered_result = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def test(self): <NEW_LINE> <INDENT> return self.buffered_result.test <NEW_LINE> <DEDENT> def updateResult(self, result): <NEW_LINE> <INDENT> result.startTe...
A picklable struct used to communicate test results across processes Fulfills the interface for unittest.TestResult
62598fb267a9b606de54604c
class ClientCollector(StateMachine): <NEW_LINE> <INDENT> tasks: List[Task] <NEW_LINE> bundle: List[bytes] <NEW_LINE> queue: QueueClient <NEW_LINE> local: Queue[Optional[Task]] <NEW_LINE> bundlesize: int <NEW_LINE> bundlewait: int <NEW_LINE> previous_send: datetime <NEW_LINE> state = CollectorState.START <NEW_LINE> stat...
Collect finished tasks and bundle for outgoing queue.
62598fb299cbb53fe6830f52
class GitterAPI(object): <NEW_LINE> <INDENT> def __init__(self, token): <NEW_LINE> <INDENT> self.token = token <NEW_LINE> self.room_id_dict = self.get_room_id_dict() <NEW_LINE> <DEDENT> def get_rooms(self): <NEW_LINE> <INDENT> headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {0}'.format(self.token), }...
Gitter API wrapper URL: https://developer.gitter.im/docs/welcome
62598fb27c178a314d78d51b
class Extended(object): <NEW_LINE> <INDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return memoryview(self) == memoryview(other) <NEW_LINE> <DEDENT> def __ne__(self, other): <NEW_LINE> <INDENT> return memoryview(self) != memoryview(other)
Used to add extended capability to structures
62598fb2d486a94d0ba2c04f
class ShutterContact(IPShutterContact, HelperSabotage): <NEW_LINE> <INDENT> pass
Door / Window contact that emits its open/closed state.
62598fb257b8e32f5250815b
class ForRecursion(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def change_status(cls, artifact, status): <NEW_LINE> <INDENT> for a in artifact.children: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> a.visibility = status <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> print("failed aid: %d, status %s"...
for some strange reason, my guess is how we are executing the patches recursion doesn't work directly so decided to use a class to make it work
62598fb2b7558d58954636aa
class Meta: <NEW_LINE> <INDENT> model = ChartData <NEW_LINE> fields = ( 'ticker', 'date', 'open_value', 'close_value', 'high_value', 'low_value', 'volume', 'adj_close' )
Meta class.
62598fb2a17c0f6771d5c2b4
class USPSSelect(Select): <NEW_LINE> <INDENT> def __init__(self, attrs=None): <NEW_LINE> <INDENT> from my_django.contrib.localflavor.us.us_states import USPS_CHOICES <NEW_LINE> super(USPSSelect, self).__init__(attrs, choices=USPS_CHOICES)
A Select widget that uses a list of US Postal Service codes as its choices.
62598fb24c3428357761a338
class Group(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.have_comments = False <NEW_LINE> self.header = [] <NEW_LINE> self.m = numpy.identity(4) <NEW_LINE> self.n_parts = 0 <NEW_LINE> self.n_primitives = 0 <NEW_LINE> self.parts_list = [] <NEW_LINE> <DEDENT>...
A group of parts.
62598fb21f5feb6acb162c9e
class FileRequestDeadline(object): <NEW_LINE> <INDENT> __slots__ = [ '_deadline_value', '_deadline_present', '_allow_late_uploads_value', '_allow_late_uploads_present', ] <NEW_LINE> _has_required_fields = True <NEW_LINE> def __init__(self, deadline=None, allow_late_uploads=None): <NEW_LINE> <INDENT> self._deadline_valu...
:ivar deadline: The deadline for this file request. :ivar allow_late_uploads: If set, allow uploads after the deadline has passed. These uploads will be marked overdue.
62598fb255399d3f0562659a
class JustNodesStats(NodesStats): <NEW_LINE> <INDENT> def getData(self): <NEW_LINE> <INDENT> self.options[self.TRANSFORM_PARAM] = self.TRANSFORM_VALUE_NESTED <NEW_LINE> return NodesStats.getData(self) <NEW_LINE> <DEDENT> def printData(self, data): <NEW_LINE> <INDENT> if 'nodes' in data: <NEW_LINE> <INDENT> for node in ...
Get "just" nodes stats
62598fb2a79ad1619776a0e8
class BundleDataJSONEncoder(json.JSONEncoder): <NEW_LINE> <INDENT> def default(self, o): <NEW_LINE> <INDENT> if isinstance(o, FileInfo): <NEW_LINE> <INDENT> return [o.public, o.size, o.hash_digest.hex()] <NEW_LINE> <DEDENT> elif isinstance(o, UUID): <NEW_LINE> <INDENT> return str(o) <NEW_LINE> <DEDENT> elif isinstance(...
Default JSON serialization.
62598fb2a05bb46b3848a8eb
class confPostgis: <NEW_LINE> <INDENT> def __init__(self,extent): <NEW_LINE> <INDENT> self.host = 'localhost' <NEW_LINE> self.dbname = 'DBNAME' <NEW_LINE> self.user = 'USERNAME' <NEW_LINE> self.password = 'PASSWORD' <NEW_LINE> self.prefixTable = 'PREFIX' <NEW_LINE> self.geomColumn = 'way' <NEW_LINE> self.srid = '4326' ...
Class to create the connections to postgis database IMPORTANT: you must change the values for your connections
62598fb2498bea3a75a57b9f
class VideoSource(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=200) <NEW_LINE> home = models.URLField() <NEW_LINE> embed_template = models.URLField() <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.name
An encapsulation for "embed template".
62598fb23346ee7daa337687
class Encoder(nn.Module): <NEW_LINE> <INDENT> def __init__(self, input_dim, hidden_dim, dim_h1, categorical_dim): <NEW_LINE> <INDENT> super(Encoder, self).__init__() <NEW_LINE> self.input_dim = input_dim <NEW_LINE> self.hidden_dim = hidden_dim <NEW_LINE> self.dim_h1 = dim_h1 <NEW_LINE> self.categorical_dim = categorica...
encoder
62598fb2aad79263cf42e853
class CourseCommentsAdmin(object): <NEW_LINE> <INDENT> list_display = ['user', 'course', 'comments', 'add_time'] <NEW_LINE> search_fields = ['user', 'course', 'comments'] <NEW_LINE> list_filter = ['user', 'course', 'comments', 'add_time']
用户评论后台管理器
62598fb2cc0a2c111447b092
class Subscriber: <NEW_LINE> <INDENT> def __init__(self, _id, func, calls): <NEW_LINE> <INDENT> self.__id = _id <NEW_LINE> self.__func = func <NEW_LINE> self.__calls = calls <NEW_LINE> self.__total_calls = 0 <NEW_LINE> <DEDENT> def call(self, *args, **kwargs): <NEW_LINE> <INDENT> self.__func(*args, **kwargs) <NEW_LINE>...
Contains subscriber data
62598fb23539df3088ecc332
class TestGetQuestions(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.app = app.test_client() <NEW_LINE> <DEDENT> def test_if_all_successfuly_returned_all_questions(self): <NEW_LINE> <INDENT> response = self.app.post('/api/v1/questions', content_type='application/json', data={ 'id': 1...
This Test class is meant to test all the routes with a GET method
62598fb2be7bc26dc9251e9c
class RevocationEndpoint(BaseEndpoint): <NEW_LINE> <INDENT> valid_token_types = ('access_token', 'refresh_token') <NEW_LINE> def __init__(self, request_validator, supported_token_types=None, enable_jsonp=False): <NEW_LINE> <INDENT> BaseEndpoint.__init__(self) <NEW_LINE> self.request_validator = request_validator <NEW_L...
Token revocation endpoint. Endpoint used by authenticated clients to revoke access and refresh tokens. Commonly this will be part of the Authorization Endpoint.
62598fb2009cb60464d015a2
class OAIHarvester(object): <NEW_LINE> <INDENT> def __init__(self, mdRegistry): <NEW_LINE> <INDENT> self._mdRegistry = mdRegistry <NEW_LINE> <DEDENT> def _listRecords(self, baseUrl, metadataPrefix="oai_dc", **kwargs): <NEW_LINE> <INDENT> kwargs['metadataPrefix'] = metadataPrefix <NEW_LINE> client = Client(baseUrl, meta...
Abstract Base Class for an OAI-PMH Harvester. Should be sub-classed in order to do useful things with the harvested records (e.g. put them in a directory, VCS repository, local database etc.
62598fb267a9b606de54604e
class AmbienceDevice(): <NEW_LINE> <INDENT> group = None <NEW_LINE> kind = None <NEW_LINE> def get_label(self) -> str: <NEW_LINE> <INDENT> raise AmbienceDeviceException <NEW_LINE> <DEDENT> def set_label(self, label): <NEW_LINE> <INDENT> raise AmbienceDeviceException <NEW_LINE> <DEDENT> def get_online(self) -> bool: <NE...
Template class to be extended by other template classes that want to represent a unique kind of device. (i.e. light)
62598fb2167d2b6e312b6ff3
class Miss(Wake): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return '/'
A piece representing a square that had been unsuccessfully shot. (Wake) Overridden Methods: __str__
62598fb266656f66f7d5a470
class ISEOConfigSiteMapXMLSchema(Interface): <NEW_LINE> <INDENT> not_included_types = schema.Tuple( title=_("label_included_types", default=u"Types of content included in the XML Site Map"), description=_("help_included_types", default=u"The content types that should be included in the sitemap.xml.gz."), required=False...
Schema for Site Map XML Tools
62598fb226068e7796d4c9d6
class ReaderSHP(ReaderBaseClass): <NEW_LINE> <INDENT> def __init__(self, path, **kwargs): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self._shp_reader = fiona.open(path, 'r') <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> for row in self._shp_reader: <NEW_LINE> <INDENT> flat_dict = row['properties'] <N...
Reader class implementation for SHP files using Fiona. Returns a flattened Fiona record. See: http://toblerity.org/fiona/manual.html#records Fiona generated dictionary keys id and type are transformed into key names, fiona_id and fiona_type. Required Config Parameters: :param path: Attribute containing the actual fil...
62598fb2d486a94d0ba2c050
class PrintfFormatSourceValidator(BaseValidator): <NEW_LINE> <INDENT> printf_re = re.compile( '%((?:(?P<ord>\d+)\$|\((?P<key>\w+)\))?(?P<fullvar>[+#-]*(?:\d+)?' '(?:\.\d+)?(hh\|h\|l\|ll)?(?P<type>[\w%])))' ) <NEW_LINE> def validate(self, source_trans, target_trans): <NEW_LINE> <INDENT> source_trans = unescap...
Validator that checks printf-format specifiers in the source string are preserved in the translation.
62598fb2e5267d203ee6b985
class Actor: <NEW_LINE> <INDENT> def __init__(self, fp_radius=0.3): <NEW_LINE> <INDENT> self.x = 0.0 <NEW_LINE> self.y = 0.0 <NEW_LINE> self.th = 0.0 <NEW_LINE> self.path = None <NEW_LINE> self.flag_follow_traj = True <NEW_LINE> self.t_curr = 0.0 <NEW_LINE> self.counter = 0 <NEW_LINE> self.len_traj = 0 <NEW_LINE> self....
A base class, defines an actor that can follow a given path in 2D Assuming a holonomic actor, i.e. can move in all directions
62598fb25fdd1c0f98e5e00d
class Cola: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._frente = None <NEW_LINE> self._ultimo = None <NEW_LINE> <DEDENT> def encolar(self, dato): <NEW_LINE> <INDENT> nodo = _Nodo(dato) <NEW_LINE> if self.esta_vacia(): <NEW_LINE> <INDENT> self._frente = nodo <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN...
Representa a una cola, con operaciones de encolar y desencolar. El primero en ser encolado es también el primero en ser desencolado.
62598fb2460517430c43209e
class Routine: <NEW_LINE> <INDENT> DeployLoopRoutineID = 0xE200 <NEW_LINE> EraseMemory = 0xFF00 <NEW_LINE> CheckProgrammingDependencies = 0xFF01 <NEW_LINE> EraseMirrorMemoryDTCs = 0xFF02 <NEW_LINE> @classmethod <NEW_LINE> def name_from_id(cls, routine_id): <NEW_LINE> <INDENT> if not isinstance(routine_id, int) or routi...
Defines a list of constants that are routine identifiers defined by the UDS standard. This class provides no functionality apart from defining these constants
62598fb2baa26c4b54d4f336
class SupportFunctionsTests(unittest.TestCase): <NEW_LINE> <INDENT> def test_get_version(self): <NEW_LINE> <INDENT> version = pyluksde.get_version()
Tests the support functions.
62598fb2e5267d203ee6b986
class PingBench: <NEW_LINE> <INDENT> def __init__(self, ip, interval=1): <NEW_LINE> <INDENT> self.ip = ip <NEW_LINE> self.interval = interval <NEW_LINE> self.ping_cmd = 'ping -i ' + str(self.interval) + ' -w 5 ' + self.ip <NEW_LINE> self.process = pexpect.spawn(self.ping_cmd) <NEW_LINE> self.process.timeout = 50 <NEW_L...
Ping target IP Adapted from https://github.com/matthieu-lapeyre/network-benchmark /blob/master/network_test.py
62598fb244b2445a339b69b2
class LogMetricTrigger(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, 'threshold': {'key': 'threshold', 'type': 'float'}, 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, 'metric_column': {'key': 'metricColumn', '...
A log metrics trigger descriptor. :param threshold_operator: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", "LessThan", "Equal". Default value: "GreaterThanOrEqual". :type threshold_operator: str or ~$(python-...
62598fb28e7ae83300ee9125
class ErrataToolUnauthorizedException(Exception): <NEW_LINE> <INDENT> pass
You were not authorized to make a request to the Errata Tool API
62598fb216aa5153ce400585
class CacheNameInvalid(Error): <NEW_LINE> <INDENT> pass
Name is not a valid cache name.
62598fb2097d151d1a2c10af
class PagerDutyPrinter(Printer): <NEW_LINE> <INDENT> def format(self, result): <NEW_LINE> <INDENT> if not result.check.pagerduty_service: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> url = "%s://%s/explore/?q=%s" % (settings.PRODUCTSTATUS_PROTOCOL, settings.PRODUCTSTATUS_HOST, result.check.product.id) <NEW_LINE>...
Submit a check result to PagerDuty.
62598fb22ae34c7f260ab164
class GooglePlacesApiQueryLimitError(Exception): <NEW_LINE> <INDENT> def __init__(self, message, *args): <NEW_LINE> <INDENT> super(GooglePlacesApiQueryLimitError, self).__init__(message, *args)
Exception raised when the query limit in the Google Places API has been reached.
62598fb2fff4ab517ebcd867
class DummyTileContents(object): <NEW_LINE> <INDENT> def __init__(self, tile_type_id, tile_footprint, band_stack): <NEW_LINE> <INDENT> self.tile_type_id = tile_type_id <NEW_LINE> self.tile_footprint = tile_footprint <NEW_LINE> self.band_stack = band_stack <NEW_LINE> self.reprojected = False <NEW_LINE> self.removed = Fa...
Dummy tile contents class for testing.
62598fb27047854f4633f45c
class DiGraph(Graph): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def is_directed(cls): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def dag(cls): <NEW_LINE> <INDENT> graph = cls(6) <NEW_LINE> graph.add_edge(5, 0) <NEW_LINE> graph.add_edge(5, 2) <NEW_LINE> graph.add_edge(4, 0) <NEW_LINE> ...
directed graph
62598fb263d6d428bbee282e
class AnonymousOutbox(Outbox): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(AnonymousOutbox, self).__init__('', '', *args, **kwargs) <NEW_LINE> <DEDENT> def authenticate(self, smtp): <NEW_LINE> <INDENT> pass
Outbox subclass suitable for SMTP servers that do not (or will not) perform authentication.
62598fb2091ae35668704c9f
class BaseKwargsUpdatedField: <NEW_LINE> <INDENT> initial_options = None <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> kwargs.update(self.initial_options) <NEW_LINE> super().__init__(*args, **kwargs)
Abstract base class made to conform the DRY principle. The initial_options is overridden by the dict in the subclasses and then automatically passed to kwargs in the FormField.__init__() method.
62598fb2090684286d59371e
class ValidateNameTest(TestCase): <NEW_LINE> <INDENT> def test_invalid_char(self): <NEW_LINE> <INDENT> with self.assertRaises(BundleError): <NEW_LINE> <INDENT> users.User.validate_name(MagicMock(), "bundle wrap") <NEW_LINE> <DEDENT> <DEDENT> def test_ends_in_dash(self): <NEW_LINE> <INDENT> with self.assertRaises(Bundle...
Tests bundlewrap.items.users.User.validate_name.
62598fb2d7e4931a7ef3c116
class DependencyStrategy(Strategy): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__("dependency strategy") <NEW_LINE> <DEDENT> def constraints(self, solver, vars, model): <NEW_LINE> <INDENT> for _, task in model.tasks.items(): <NEW_LINE> <INDENT> if len(task.dependencies) == 0: <NEW_LINE> <...
dependency strategy class
62598fb23539df3088ecc334
class AskPrimeHandler(CommonHandler): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _number(expr, assumptions): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> i = int(expr.round()) <NEW_LINE> if not (expr - i).equals(0): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> <DEDENT> except TypeError: <NEW_LINE> <IND...
Handler for key 'prime' Test that an expression represents a prime number. When the expression is a number the result, when True, is subject to the limitations of isprime() which is used to return the result.
62598fb22c8b7c6e89bd3847
class CinderKeystoneContext(base_wsgi.Middleware): <NEW_LINE> <INDENT> @webob.dec.wsgify(RequestClass=base_wsgi.Request) <NEW_LINE> def __call__(self, req): <NEW_LINE> <INDENT> user_id = req.headers.get('X_USER') <NEW_LINE> user_id = req.headers.get('X_USER_ID', user_id) <NEW_LINE> if user_id is None: <NEW_LINE> <INDEN...
Make a request context from keystone headers
62598fb2d486a94d0ba2c052
@dataclass <NEW_LINE> class TFXLNetForMultipleChoiceOutput(ModelOutput): <NEW_LINE> <INDENT> loss: Optional[tf.Tensor] = None <NEW_LINE> logits: tf.Tensor = None <NEW_LINE> mems: Optional[List[tf.Tensor]] = None <NEW_LINE> hidden_states: Optional[Tuple[tf.Tensor]] = None <NEW_LINE> attentions: Optional[Tuple[tf.Tensor]...
Output type of :class:`~transformers.TFXLNetForMultipleChoice`. Args: loss (:obj:`tf.Tensor` of shape `(1,)`, `optional`, returned when :obj:`labels` is provided): Classification loss. logits (:obj:`tf.Tensor` of shape :obj:`(batch_size, num_choices)`): `num_choices` is the second dimension of ...
62598fb2460517430c43209f
class PartnerAddress(object): <NEW_LINE> <INDENT> def __init__(self, partner): <NEW_LINE> <INDENT> super(PartnerAddress, self).__init__() <NEW_LINE> self.id = partner.id <NEW_LINE> self.name = partner.name <NEW_LINE> self.street = partner.street <NEW_LINE> self.street2 = partner.street2 <NEW_LINE> self.city = partner.c...
Object representing a partner address for use in qweb
62598fb267a9b606de546051
class C01_Read(SetupMixin, unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> SetupMixin.setUp(self) <NEW_LINE> self.m_api = hue_device.Api(self.m_pyhouse_obj) <NEW_LINE> self.m_device = HueInformation() <NEW_LINE> <DEDENT> def test_01_Init(self): <NEW_LINE> <INDENT> pass
This section tests the reading and writing of XML used by node_local.
62598fb24a966d76dd5eef5a
class RyanteckRobot(Robot): <NEW_LINE> <INDENT> def __init__(self, pwm=True, pin_factory=None): <NEW_LINE> <INDENT> super(RyanteckRobot, self).__init__( left=(17, 18), right=(22, 23), pwm=pwm, pin_factory=pin_factory )
Extends :class:`Robot` for the `Ryanteck motor controller board`_. The Ryanteck MCB pins are fixed and therefore there's no need to specify them when constructing this class. The following example drives the robot forward:: from gpiozero import RyanteckRobot robot = RyanteckRobot() robot.forward() :para...
62598fb285dfad0860cbfab5
class S3: <NEW_LINE> <INDENT> def __init__(self, region, role, bucket): <NEW_LINE> <INDENT> self.region = region <NEW_LINE> self.client = role.client('s3', region_name=region) <NEW_LINE> self.resource = role.resource('s3', region_name=region) <NEW_LINE> self.bucket = bucket <NEW_LINE> <DEDENT> def put_object(self, key,...
Class used for modeling S3
62598fb292d797404e388ba5
class CSIMultipleChoiceField(forms.MultipleChoiceField): <NEW_LINE> <INDENT> def to_python(self, value): <NEW_LINE> <INDENT> return ','.join(value) <NEW_LINE> <DEDENT> def validate(self, value): <NEW_LINE> <INDENT> if value: <NEW_LINE> <INDENT> value = value.split(',') <NEW_LINE> <DEDENT> super(CSIMultipleChoiceField, ...
Modified MultipleChoiceField for CommaSeparatedIntegerField
62598fb255399d3f0562659d
class User(AbstractUser): <NEW_LINE> <INDENT> username = models.CharField(max_length=30, primary_key=True) <NEW_LINE> USERNAME_FIELD = 'username' <NEW_LINE> hangman_points = models.IntegerField(default=0)
A class that extends basic user fields. It makes the username field the id. It also stores the amount of points the user has won from playing hangman.
62598fb28e7ae83300ee9126
class Action(Editeur): <NEW_LINE> <INDENT> nom = "editeur:base:action" <NEW_LINE> def __init__(self, pere, objet=None, attribut=None, callback=None, methode=None, *arguments): <NEW_LINE> <INDENT> Editeur.__init__(self, pere, objet, attribut) <NEW_LINE> self.callback = callback <NEW_LINE> self.methode = methode <NEW_LIN...
Contexte-éditeur action. Ce contexte sert à faire une action particulière, appelle une méthode avec les paramètres indiqués.
62598fb21f5feb6acb162ca2
class BertEncoderExtended(nn.Module): <NEW_LINE> <INDENT> def __init__(self, config): <NEW_LINE> <INDENT> super(BertEncoderExtended, self).__init__() <NEW_LINE> self.output_attentions = config.output_attentions <NEW_LINE> self.output_hidden_states = config.output_hidden_states <NEW_LINE> self.layer = nn.ModuleList([mb....
Small modification from mb.BertEncoder to return three outputs in the last layer, instead of one. These three values represent "queries", "keys" and "values" to use for the pointing, mimicking the self-attention the model has inside.
62598fb291f36d47f2230ee9
class ProxyResponse(CasResponseBase): <NEW_LINE> <INDENT> def render_content(self, context): <NEW_LINE> <INDENT> ticket = context.get('ticket') <NEW_LINE> error = context.get('error') <NEW_LINE> service_response = etree.Element(self.ns('serviceResponse')) <NEW_LINE> if ticket: <NEW_LINE> <INDENT> proxy_success = etree....
(2.7.2) Render an XML format CAS service response for a proxy request success or failure. On request success: <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'> <cas:proxySuccess> <cas:proxyTicket>PT-1856392-b98xZrQN4p90ASrw96c8</cas:proxyTicket> </cas:proxySuccess> </cas:serviceResponse> O...
62598fb2f548e778e596b627
class World: <NEW_LINE> <INDENT> def __init__(self, size): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.things = {} <NEW_LINE> self.effects = {} <NEW_LINE> self.t = 0 <NEW_LINE> <DEDENT> def spawn(self, thing, position): <NEW_LINE> <INDENT> if not inside_map(position, self.size): <NEW_LINE> <INDENT> message = "...
World where to play the game.
62598fb216aa5153ce400587
class ExtensionManager(object): <NEW_LINE> <INDENT> def is_loaded(self, alias): <NEW_LINE> <INDENT> return alias in self.extensions <NEW_LINE> <DEDENT> def register(self, ext): <NEW_LINE> <INDENT> if not self._check_extension(ext): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> alias = ext.alias <NEW_LINE> LOG.audit(_(...
Load extensions from the configured extension path. See nova/tests/api/openstack/volume/extensions/foxinsocks.py or an example extension implementation.
62598fb24428ac0f6e6585a4
class AlphaBetaAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def getAction(self, gameState): <NEW_LINE> <INDENT> legalActions = gameState.getLegalActions(0) <NEW_LINE> numAgents = gameState.getNumAgents() <NEW_LINE> bestAction = None <NEW_LINE> maxi = -999999 <NEW_LINE> a = -999999 <NEW_LINE> b = 999999 <NEW_LINE> ...
Your minimax agent with alpha-beta pruning (question 3)
62598fb266673b3332c30450
class Bullet(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_settings, screen, ship): <NEW_LINE> <INDENT> super(Bullet, self).__init__() <NEW_LINE> self.screen = screen <NEW_LINE> self.rect = pygame.Rect(0, 0, ai_settings.bullet_width, ai_settings.bullet_height) <NEW_LINE> self.rect.centerx = ship.rect.centerx <NEW_...
A class to manage bullets fired from the ship
62598fb2aad79263cf42e857
class CaptionDriver(SerialDriver): <NEW_LINE> <INDENT> def _tool_name(self): <NEW_LINE> <INDENT> return "captioncompiler" <NEW_LINE> <DEDENT> def precompile(self, context: AssetBuildContext, asset: Asset) -> List[str]: <NEW_LINE> <INDENT> asset.outpath = asset.path.with_suffix(".dat") <NEW_LINE> return PrecompileResult...
Driver that handles compiling closed captions
62598fb2090684286d59371f
class QuerySetSequenceModel(object): <NEW_LINE> <INDENT> class DoesNotExist(ObjectDoesNotExist): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class MultipleObjectsReturned(MultipleObjectsReturned): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class _meta: <NEW_LINE> <INDENT> object_name = 'QuerySetSequenceModel'
A fake Model that is used to throw DoesNotExist exceptions for QuerySetSequence.
62598fb29c8ee823130401b4
class BackupRestoration(core_models.UuidMixin, TimeStampedModel): <NEW_LINE> <INDENT> backup = models.ForeignKey(Backup, related_name='restorations') <NEW_LINE> instance = models.OneToOneField(Instance, related_name='+') <NEW_LINE> flavor = models.ForeignKey(Flavor, related_name='+', null=True, blank=True, on_delete=mo...
This model corresponds to instance restoration from backup.
62598fb27b180e01f3e49092