code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Session(Base): <NEW_LINE> <INDENT> __tablename__ = 'sessions' <NEW_LINE> id = Column(UUID, primary_key=True, nullable=False, default=uuid.uuid4) <NEW_LINE> authenticated = Column(Boolean, default=False, nullable=False) <NEW_LINE> groups = Column(JSONEncodedValue) <NEW_LINE> last_request_at = Column(DateTime, null...
Define the mapper for carrying session data
62599049d53ae8145f91981d
class GetAudioView(MethodView): <NEW_LINE> <INDENT> def get(self, audioFileType, id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if audioFileType == "song": <NEW_LINE> <INDENT> if id is None: <NEW_LINE> <INDENT> songs = Song.objects.all() <NEW_LINE> return make_response(json.loads(json_util.dumps(songs.to_json())), 2...
Returns an audio(podcast, song or audiobook) based on audioFileType and id
625990498da39b475be045ae
class TestBasic2(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.a = 1 <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> del self.a <NEW_LINE> <DEDENT> def test_basic1(self): <NEW_LINE> <INDENT> self.assertNotEqual(self.a, 2) <NEW_LINE> <DEDENT> def test_basic2(self): <NEW_LINE> <INDE...
Show setup and teardown
625990498e05c05ec3f6f839
class PoolSenseEntity(CoordinatorEntity): <NEW_LINE> <INDENT> _attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION} <NEW_LINE> def __init__(self, coordinator, email, description: EntityDescription): <NEW_LINE> <INDENT> super().__init__(coordinator) <NEW_LINE> self.entity_description = description <NEW_LINE> se...
Implements a common class elements representing the PoolSense component.
6259904916aa5153ce4018ab
class PayoffSimple: <NEW_LINE> <INDENT> def __init__(self, strike, expiry, type, size): <NEW_LINE> <INDENT> if not isinstance(expiry, date): raise TypeError ("bad option expiration: must be represented as a 'datetime.date'") <NEW_LINE> if type.upper() not in ["C", "P"]: raise ValueError("bad option type: must be 'C' ...
The payoff of a Put or Call option.
62599049379a373c97d9a3e8
class AddPrintableRingOperator46(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "addongen.add_printable_ring_operator46" <NEW_LINE> bl_label = "Add 18.89mm (9)" <NEW_LINE> bl_options = {'REGISTER'} <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> basicRingFor3DPrint('ring', 64, 18.89) <NEW_LINE> return ...
Add 18.89mm (US 9 | British R 3/4 | French - | German 19 | Japanese 18 | Swiss -)
62599049d4950a0f3b111821
class UpdatedLabelsIn(): <NEW_LINE> <INDENT> def __init__(self, types: List['TypeLabel'], categories: List['Category']) -> None: <NEW_LINE> <INDENT> self.types = types <NEW_LINE> self.categories = categories <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_dict(cls, _dict: Dict) -> 'UpdatedLabelsIn': <NEW_LINE> <IN...
The updated labeling from the input document, accounting for the submitted feedback. :attr List[TypeLabel] types: Description of the action specified by the element and whom it affects. :attr List[Category] categories: List of functional categories into which the element falls; in other words, the subject ...
625990496e29344779b01a00
class Improved_Hold(Advantage): <NEW_LINE> <INDENT> advantage_cost_type = Cost_Type.NO_RANK <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super().__init__("Improved Hold") <NEW_LINE> self.init_no()
Your grab attacks are particularly difficult to escape. Opponents you grab suffer a –5 circumstance penalty on checks to escape.
625990496fece00bbacccd76
class OfflineComputedGrade(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User, db_index=True) <NEW_LINE> course_id = CourseKeyField(max_length=255, db_index=True) <NEW_LINE> created = models.DateTimeField(auto_now_add=True, null=True, db_index=True) <NEW_LINE> updated = models.DateTimeField(auto_now=True,...
Table of grades computed offline for a given user and course.
62599049a79ad1619776b43f
@dataclass(frozen=True) <NEW_LINE> class ZtNetworkPermissions: <NEW_LINE> <INDENT> read: bool <NEW_LINE> authorize: bool <NEW_LINE> modify: bool <NEW_LINE> delete: bool
Zerotier network permissions.
6259904923849d37ff85247c
class SubIntake(Subsystem): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__("Intake") <NEW_LINE> self._victor = VictorSPX(robotmap.talon_intake) <NEW_LINE> self.set_state(StateIntake.HALT) <NEW_LINE> <DEDENT> def set_victor(self, spd_target: float, mode: ControlMode = ControlMode.PercentOut...
Subsystem used to intake and eject cargo
6259904973bcbd0ca4bcb64d
@slots_extender(('msg_id',)) <NEW_LINE> class AbstractMessage(six.with_metaclass(ABCMeta, BasicStruct)): <NEW_LINE> <INDENT> pass
Basic message class. Holds the common data for resource management messages. Attributes: msg_id (number): sending side unique message identifier.
625990498e71fb1e983bce84
class ListParameterWidget(GenericParameterWidget): <NEW_LINE> <INDENT> def __init__(self, parameter, parent=None): <NEW_LINE> <INDENT> super(ListParameterWidget, self).__init__(parameter, parent) <NEW_LINE> self._input = QListWidget() <NEW_LINE> self._input.setSelectionMode(QAbstractItemView.MultiSelection) <NEW_LINE> ...
Widget class for List parameter.
62599049379a373c97d9a3ea
class AQTSamplerLocalSimulator(AQTSampler): <NEW_LINE> <INDENT> def __init__(self, remote_host: str = '', access_token: str = '', simulate_ideal: bool = False): <NEW_LINE> <INDENT> self.remote_host = remote_host <NEW_LINE> self.access_token = access_token <NEW_LINE> self.simulate_ideal = simulate_ideal <NEW_LINE> <DEDE...
Sampler using the AQT simulator on the local machine. Can be used as a replacement for the AQTSampler When the attribute simulate_ideal is set to True, an ideal circuit is sampled If not, the error model defined in aqt_simulator_test.py is used Example for running the ideal sampler: sampler = AQTSamplerLocalSimulator...
6259904930dc7b76659a0bf2
class HelpTemplate(HasStrictTraits): <NEW_LINE> <INDENT> item_html = Str(ItemHTML) <NEW_LINE> group_html = Str(GroupHTML) <NEW_LINE> item_help = Str(ItemHelp) <NEW_LINE> group_help = Str(GroupHelp) <NEW_LINE> no_group_help = Str('')
Contains HTML templates for displaying help.
6259904915baa72349463351
class ActionLogEventAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ["function_name", "user", "second_arg", "third_arg", "was_successful", "message", "vessel_count", "date_started", "completion_time"] <NEW_LINE> list_filter = ["function_name", "user", "third_arg", "was_successful", "vessel_count", "date_sta...
Customized admin view of the ActionLogEvent model.
625990498a43f66fc4bf3555
class PostView(object): <NEW_LINE> <INDENT> def __init__(self, arg): <NEW_LINE> <INDENT> super(PostView, self).__init__() <NEW_LINE> self.arg = arg
docstring for PostView
625990493eb6a72ae038ba1b
class FlaskDocument(db.Document): <NEW_LINE> <INDENT> meta = { 'abstract': True, } <NEW_LINE> @classmethod <NEW_LINE> def all_subclasses(cls): <NEW_LINE> <INDENT> return cls.__subclasses__() + [g for s in cls.__subclasses__() for g in s.all_subclasses()]
Abstract base class. You should inherit all your models from this to save time down the road. Chances are you will want all your models to share a set of functions or to override others (like changing save behavior)
62599049ec188e330fdf9c5d
class Temperatura(object): <NEW_LINE> <INDENT> C = 1 <NEW_LINE> F = 2 <NEW_LINE> K = 3 <NEW_LINE> def converter(self, valor, tipo, destino): <NEW_LINE> <INDENT> if tipo == self.C: <NEW_LINE> <INDENT> valor = self.celsius_para(valor, destino) <NEW_LINE> <DEDENT> elif tipo == self.F: <NEW_LINE> <INDENT> valor = self.fahr...
Métrica de temperatura (C, F, K) para conversão.
62599049d7e4931a7ef3d437
class ChooseMTModelDialog(QDialog, Ui_Dialog): <NEW_LINE> <INDENT> def __init__(self, parent=None, datamodel=None): <NEW_LINE> <INDENT> QDialog.__init__(self, parent) <NEW_LINE> self.setupUi(self) <NEW_LINE> self.model = QSqlQueryModel() <NEW_LINE> self.selTableView.setModel(self.model) <NEW_LINE> self.database = datam...
Class documentation goes here.
6259904973bcbd0ca4bcb64e
class XMLBuilder(Builder): <NEW_LINE> <INDENT> name = 'xml' <NEW_LINE> format = 'xml' <NEW_LINE> epilog = __('The XML files are in %(outdir)s.') <NEW_LINE> out_suffix = '.xml' <NEW_LINE> allow_parallel = True <NEW_LINE> _writer_class = XMLWriter <NEW_LINE> default_translator_class = XMLTranslator <NEW_LINE> def init(se...
Builds Docutils-native XML.
625990496fece00bbacccd78
class FailoverSegmentRecoveryMethod(Enum): <NEW_LINE> <INDENT> AUTO = "auto" <NEW_LINE> RESERVED_HOST = "reserved_host" <NEW_LINE> AUTO_PRIORITY = "auto_priority" <NEW_LINE> RH_PRIORITY = "rh_priority" <NEW_LINE> ALL = (AUTO, RESERVED_HOST, AUTO_PRIORITY, RH_PRIORITY) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> ...
Represents possible recovery_methods for failover segment.
62599049d10714528d69f06e
class HostEvents(object): <NEW_LINE> <INDENT> def __init__(self, kernel_name='', kernel_id='', dispatch_id='', dispatch_start=None, dispatch_end=None, create_buf_start=None, create_buf_end=None, write_start=None, write_end=None, ndrange_start=None, ndrange_end=None, read_start=None, read_end=None): <NEW_LINE> <INDENT> ...
Class for storing timing information of various events associated with a kernel. :ivar dispatch_start: Start Timestamp for dispatch function :ivar dispatch_end: End Timestamp for dispatch function :ivar create_buf_start: Start Timestamp for Creation of Buffers :ivar create_buf_end: End Timestamp for Creation of Bugge...
625990490fa83653e46f629e
class accountCurveGroupForType(accountCurveSingleElement): <NEW_LINE> <INDENT> def __init__(self, acc_curve_for_type_list, asset_columns, capital=None, weighted_flag=False, curve_type="net"): <NEW_LINE> <INDENT> (acc_total, capital) = total_from_list( acc_curve_for_type_list, asset_columns, capital) <NEW_LINE> super()....
an accountCurveGroup for one cost type (gross, net, costs)
62599049b57a9660fecd2e3d
class Table(object): <NEW_LINE> <INDENT> def __init__(self, rowNames, columnNames, matrix=None): <NEW_LINE> <INDENT> self.rowNames = list(rowNames) <NEW_LINE> self.columnNames = list(columnNames) <NEW_LINE> self.rowIndices = dict([(n, i) for i, n in enumerate(self.rowNames)]) <NEW_LINE> self.columnIndices = dict([(n, i...
Provides a two-dimensional matrix with named rows and columns.
6259904907f4c71912bb07f4
class ExportTask(Task): <NEW_LINE> <INDENT> def __init__(self, instance, dn=None): <NEW_LINE> <INDENT> self.cn = 'export_' + Task._get_task_date() <NEW_LINE> dn = "cn=%s,%s" % (self.cn, DN_EXPORT_TASK) <NEW_LINE> self._properties = None <NEW_LINE> super(ExportTask, self).__init__(instance, dn) <NEW_LINE> <DEDENT> def e...
Create the export to ldif task :param instance: The instance :type instance: lib389.DirSrv
62599049d99f1b3c44d06a5c
class CreateClusterEndpointRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ClusterId = None <NEW_LINE> self.SubnetId = None <NEW_LINE> self.IsExtranet = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.ClusterId = params.get("ClusterId") <NEW_LIN...
CreateClusterEndpoint request structure.
625990498da39b475be045b2
class NodeForm(BetterForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> fieldsets = (('libvirt', {'fields': ('address',), 'legend': _('Libvirt configuration')}), ('resources', {'fields': ('hdd_total', 'cpu_total', 'memory_total'), 'legend': _('Node capacity')}),) <NEW_LINE> def __init__(self): <NEW_LINE> <INDEN...
Class for <b>creating a node</b> form.
62599049e76e3b2f99fd9dcc
class override_settings(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.options = kwargs <NEW_LINE> self.wrapped = settings._wrapped <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.enable() <NEW_LINE> <DEDENT> def __exit__(self, exc_type, exc_value, traceback): <NEW...
Acts as either a decorator, or a context manager. If it's a decorator it takes a function and returns a wrapped function. If it's a contextmanager it's used with the ``with`` statement. In either event entering/exiting are called before and after, respectively, the function/block is executed.
6259904921a7993f00c6732b
class NIH_Segmented(unittest.TestCase): <NEW_LINE> <INDENT> def test_segment(self): <NEW_LINE> <INDENT> self.assertEqual("532690-57e12f-e2b74b-a07c89-2560a2", parse._nih_segmented("53269057e12fe2b74ba07c892560a2")) <NEW_LINE> self.assertEqual("5326-9057-e12f-e2b7-4ba0-7c89-2560-a2", parse._nih_segmented("53269057e12fe2...
Test _nih_segmented()
625990494e696a045264e801
class VmSettings(validation.ValidatedDict): <NEW_LINE> <INDENT> KEY_VALIDATOR = validation.Regex('[a-zA-Z_][a-zA-Z0-9_]*') <NEW_LINE> VALUE_VALIDATOR = str <NEW_LINE> @classmethod <NEW_LINE> def Merge(cls, vm_settings_one, vm_settings_two): <NEW_LINE> <INDENT> result_vm_settings = (vm_settings_two or {}).copy() <NEW_LI...
Class for VM settings. The settings are not further validated here. The settings are validated on the server side.
6259904923e79379d538d8c0
class Batch: <NEW_LINE> <INDENT> def __init__(self, src, pos, trg=None, pad=0): <NEW_LINE> <INDENT> self.src = src <NEW_LINE> self.src_mask = (src != pad).unsqueeze(-2) <NEW_LINE> self.trg = trg <NEW_LINE> self.pos = pos <NEW_LINE> self.ntokens = torch.tensor(self.src != pad, dtype=torch.float).data.sum()
Object for holding a batch of data with mask during training.
6259904996565a6dacd2d96a
class OpenFileAction(Action): <NEW_LINE> <INDENT> tooltip = "Open a file for editing" <NEW_LINE> description = "Open a file for editing" <NEW_LINE> def perform(self, event=None): <NEW_LINE> <INDENT> logger.info('OpenFileAction.perform()') <NEW_LINE> pref_script_path = preference_manager.cviewerui.scriptpath <NEW_LINE> ...
Open an existing file in the text editor.
625990498a349b6b4368760f
class IActivationModel(Interface): <NEW_LINE> <INDENT> pass
Register utility registration which marks active Activation SQLAlchemy model class.
62599049b5575c28eb7136aa
class BigInputsSortCase(BaseSortCase): <NEW_LINE> <INDENT> def setup(self, n_elems, max_elem): <NEW_LINE> <INDENT> self.n_elems = n_elems <NEW_LINE> self.max_elem = max_elem <NEW_LINE> self.test_input = [] <NEW_LINE> for _ in range(n_elems): <NEW_LINE> <INDENT> self.test_input.append(random.randint(1, max_elem))
Sort case where VERY LARGE inputs are sorted. The length of the input and maximum value of the input is configurable with the method 'setup'. The elements consist of random values up to the maximum input.
6259904924f1403a926862ae
class Clase(ClaseMadre): <NEW_LINE> <INDENT> def __init__(self, valor): <NEW_LINE> <INDENT> self.atributo = valor
Esto es un ejemplo de clase que hereda de ClaseMadre
62599049498bea3a75a58ee2
class SpriteSheet(object): <NEW_LINE> <INDENT> def __init__(self, file_name): <NEW_LINE> <INDENT> self.sprite_sheet = pygame.image.load(file_name).convert() <NEW_LINE> <DEDENT> def get_image(self, x, y, width, height): <NEW_LINE> <INDENT> image = pygame.Surface([width, height]).convert() <NEW_LINE> image.blit(self.spri...
Class used to grab images out of a sprite sheet.
62599049462c4b4f79dbcdc2
class EngagementInstance(InstanceResource): <NEW_LINE> <INDENT> class Status(object): <NEW_LINE> <INDENT> ACTIVE = "active" <NEW_LINE> ENDED = "ended" <NEW_LINE> <DEDENT> def __init__(self, version, payload, flow_sid, sid=None): <NEW_LINE> <INDENT> super(EngagementInstance, self).__init__(version) <NEW_LINE> self._prop...
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
62599049d99f1b3c44d06a5e
class IntegrationController(object): <NEW_LINE> <INDENT> def __init__(self, working_dir, view=None, img_data=None, mask_data=None, calibration_data=None, spectrum_data=None, phase_data=None): <NEW_LINE> <INDENT> self.working_dir = working_dir <NEW_LINE> if view == None: <NEW_LINE> <INDENT> self.view = IntegrationView()...
This controller hosts all the Subcontroller of the integration tab.
625990498da39b475be045b4
class CurveFitting(Command): <NEW_LINE> <INDENT> name = 'curve' <NEW_LINE> options = [CommonOption()] <NEW_LINE> short_description = 'ST-FMR fitting for a single sample' <NEW_LINE> long_description = 'Analyze experimental data using ST-FMR method for a single sample' <NEW_LINE> file_list = [] <NEW_LINE> range_type = []...
Sub command of root
625990498e05c05ec3f6f83c
class ErrorDuringMerge(GitException): <NEW_LINE> <INDENT> pass
When an error occurs during the merge (merge conflict...)
6259904923849d37ff852480
class RNNCell(RNNCellBase): <NEW_LINE> <INDENT> __constants__ = ['input_size', 'hidden_size', 'bias', 'nonlinearity'] <NEW_LINE> nonlinearity: str <NEW_LINE> def __init__(self, input_size: int, hidden_size: int, bias: bool = True, nonlinearity: str = "tanh", device=None, dtype=None) -> None: <NEW_LINE> <INDENT> factory...
An Elman RNN cell with tanh or ReLU non-linearity. .. math:: h' = \tanh(W_{ih} x + b_{ih} + W_{hh} h + b_{hh}) If :attr:`nonlinearity` is `'relu'`, then ReLU is used in place of tanh. Args: input_size: The number of expected features in the input `x` hidden_size: The number of features in the hidden s...
625990498e71fb1e983bce88
class Scene(QtGui.QGraphicsScene): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> left = -300 <NEW_LINE> top = -300 <NEW_LINE> width = 600 <NEW_LINE> height = 600 <NEW_LINE> QtGui.QGraphicsScene.__init__(self) <NEW_LINE> self.setSceneRect(left, top, width, height)
Hold information for the scene that is being drawn in the tugalinhas screen
6259904963d6d428bbee3b8d
class InterpolateColorTests(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.white = Color('white') <NEW_LINE> self.black = Color('black') <NEW_LINE> <DEDENT> def test_invalid_start(self): <NEW_LINE> <INDENT> with self.assertRaises(qtutils.QtValueError): <NEW_LINE> <INDENT> utils.interp...
Tests for interpolate_color. Attributes: white: The Color white as a valid Color for tests. white: The Color black as a valid Color for tests.
625990494e696a045264e802
class ChatLogger(BasePlugin): <NEW_LINE> <INDENT> name = 'chat_logger' <NEW_LINE> def on_chat_sent(self, data): <NEW_LINE> <INDENT> parsed = chat_sent().parse(data.data) <NEW_LINE> self.logger.info( 'Chat message sent: <%s> %s', self.protocol.player.name, parsed.message.decode('utf-8') )
Plugin which parses player chatter into the log file.
6259904945492302aabfd896
class ExtendedManagerMixin(BaseUtilityMixin): <NEW_LINE> <INDENT> def __getattr__(self, attr, *args): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return getattr(self.__class__, attr, *args) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return getattr(self.get_queryset(), attr, *args)
add this mixin to add support for chainable custom methods to your manager
6259904991af0d3eaad3b1e9
class FileChooserDialog(gtk.FileChooserDialog): <NEW_LINE> <INDENT> def __init__(self, title_text, buttons, default_response, action=gtk.FILE_CHOOSER_ACTION_OPEN, select_multiple=False, current_folder=None, on_response_ok=None, on_response_cancel = None): <NEW_LINE> <INDENT> gtk.FileChooserDialog.__init__(self, title=t...
Non-blocking FileChooser Dialog around gtk.FileChooserDialog
62599049e64d504609df9db2
class SelfOrAdminPermissionMixin(UserPassesTestMixin): <NEW_LINE> <INDENT> def test_func(self) -> bool: <NEW_LINE> <INDENT> user = self.get_object() <NEW_LINE> return user == self.request.user or self.request.user.is_superuser
Mixin to require that a user is the linked object or an admin. To be used e.g. for edit permission on user profiles
6259904973bcbd0ca4bcb652
class NamesTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_first_last_name(self): <NEW_LINE> <INDENT> formatted_name = get_formatted_name('janis', 'joplin') <NEW_LINE> self.assertEqual(formatted_name, 'Janis Joplin') <NEW_LINE> <DEDENT> def test_first_last_middle_name(self): <NEW_LINE> <INDENT> formatted_name...
test name_function.py
6259904950485f2cf55dc34e
class BaseServiceProperty(core_models.UuidMixin, core_models.NameMixin, models.Model): <NEW_LINE> <INDENT> class Meta(object): <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> @lru_cache(maxsize=1) <NEW_LINE> def get_url_name(cls): <NEW_LINE> <INDENT> return '{}-{}'.format(cls._meta.app_l...
Base service properties like image, flavor, region, which are usually used for Resource provisioning.
625990493cc13d1c6d466afd
@tf_export("distribute.experimental.CollectiveHints") <NEW_LINE> class Hints(object): <NEW_LINE> <INDENT> def __init__(self, bytes_per_pack=0): <NEW_LINE> <INDENT> if bytes_per_pack < 0: <NEW_LINE> <INDENT> raise ValueError("bytes_per_pack must be non-negative") <NEW_LINE> <DEDENT> self.bytes_per_pack = bytes_per_pack
Hints for collective operations like AllReduce. This can be passed to methods like `tf.distribute.get_replica_context().all_reduce()` to optimize collective operation performance. Note that these are only hints, which may or may not change the actual behavior. Some options only apply to certain strategy and are ignore...
625990490fa83653e46f62a2
class Particle(object): <NEW_LINE> <INDENT> def __init__(self, name, point, mass): <NEW_LINE> <INDENT> if not isinstance(name, str): <NEW_LINE> <INDENT> raise TypeError('Supply a valid name.') <NEW_LINE> <DEDENT> self._name = name <NEW_LINE> self.mass = mass <NEW_LINE> self.point = point <NEW_LINE> self.potential_energ...
A particle. Particles have a non-zero mass and lack spatial extension; they take up no space. Values need to be supplied on initialization, but can be changed later. Parameters ========== name : str Name of particle point : Point A physics/mechanics Point which represents the position, velocity, and acce...
6259904907d97122c4218068
class EncoderDir(nn.Module): <NEW_LINE> <INDENT> def __init__(self, cfg, target_function): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.inference_network = NeuralNetwork(input_size=cfg.data_size, output_size=cfg.latent_size , hidden_size=cfg.latent_size ) <NEW_LINE> self.latent_size = cfg.latent_size <NEW_LIN...
Approximate posterior parameterized by an inference network.
62599049cad5886f8bdc5a61
class SubtractNode(BinOpNode): <NEW_LINE> <INDENT> nodeName = 'Subtract' <NEW_LINE> def __init__(self, name): <NEW_LINE> <INDENT> BinOpNode.__init__(self, name, '__sub__')
Returns A - B. Does not check input types.
62599049d99f1b3c44d06a60
class Cached(object): <NEW_LINE> <INDENT> cache_keys = [] <NEW_LINE> def save(self, *args, **kwargs): <NEW_LINE> <INDENT> for ckey in self.cache_keys: <NEW_LINE> <INDENT> cache.remove(ckey) <NEW_LINE> <DEDENT> super(Cached, self).save(*args, **kwargs) <NEW_LINE> <DEDENT> def get_cache_values(self): <NEW_LINE> <INDENT> ...
Mixin class to invalidate cache keys on model.save(). Usage:: class MyModel(Cached, models.Model): # models.Model must be last @property def cache_keys(self): return [...] ... (that's it. All cache keys will be removed whenever `MyModel.save()` is called).
62599049711fe17d825e1680
class text_to_say(smach.StateMachine): <NEW_LINE> <INDENT> def __init__(self, text=None, text_cb=None, wait_before_speaking=0, lang='en_US', wait=True): <NEW_LINE> <INDENT> self.say_pub= rospy.Publisher('/sound/goal', SoundActionGoal, latch=True) <NEW_LINE> smach.StateMachine.__init__(self, outcomes=['succeeded', 'pree...
To use say you need to indicate the text to be said. By default it waits 0 seconds before speaking and uses en_US language and don't use the nsecs wait option. smach.StateMachine.add( 'SaySM', text_to_say("I'm working"), transitions={'succeeded': 'succeeded', 'aborted': 'aborted'})
6259904945492302aabfd898
class Ping(object): <NEW_LINE> <INDENT> def __init__(self, address): <NEW_LINE> <INDENT> self.address = address <NEW_LINE> <DEDENT> def do(self): <NEW_LINE> <INDENT> ping_cmd = 'ping -c 4 {0}'.format(self.address) <NEW_LINE> out = runsub.cmd(ping_cmd) <NEW_LINE> return out[1]
Get information about the ping (icmp)
62599049dc8b845886d54981
class TimerMsg(RunnerMsg): <NEW_LINE> <INDENT> pass
A message telling your code that a timer triggers. Subclass this and use it as `CallAdmin.timer`'s ``cls`` parameter for easier disambiguation.
6259904945492302aabfd899
@unique <NEW_LINE> class ExchangeName(IntEnum): <NEW_LINE> <INDENT> Default = 0 <NEW_LINE> HuoBi = 1 <NEW_LINE> BitMex = 2 <NEW_LINE> DataIntegration = 3 <NEW_LINE> LocalFile = 4
交易所名称
6259904976d4e153a661dc59
class AddFolderRequestBody(object): <NEW_LINE> <INDENT> swagger_types = { 'path': 'str', 'name': 'str', 'parent_resource': 'str' } <NEW_LINE> attribute_map = { 'path': 'path', 'name': 'name', 'parent_resource': 'parentResource' } <NEW_LINE> def __init__(self, path=None, name=None, parent_resource=None): <NEW_LINE> <IND...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259904923e79379d538d8c4
class AxisType (pyxb.binding.basis.complexTypeDefinition): <NEW_LINE> <INDENT> _TypeDefinition = None <NEW_LINE> _ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_EMPTY <NEW_LINE> _Abstract = False <NEW_LINE> _ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'AxisType') <NEW_LINE> _XSDLocation = pyxb....
Complex type AxisType with content type EMPTY
625990498a349b6b43687613
class ElectricCar(Car): <NEW_LINE> <INDENT> def __init__(self, make, model, year): <NEW_LINE> <INDENT> super().__init__(make, model, year) <NEW_LINE> self.battery = Battery()
Represent aspects of a car, specific to electric vehicles.
625990493617ad0b5ee07503
class CourseDiscussionDivisionEnabledTestCase(ModuleStoreTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self.course = CourseFactory.create() <NEW_LINE> CourseModeFactory.create(course_id=self.course.id, mode_slug=CourseMode.AUDIT) <NEW_LINE> self.test_cohort = CohortFacto...
Test the course_discussion_division_enabled and available_division_schemes methods.
62599049b5575c28eb7136ac
class PermissionRegistrationConflict(PermissionException): <NEW_LINE> <INDENT> def __init__(self, perm_name, new_view, old_view): <NEW_LINE> <INDENT> message = "Permission %s is already registered " % perm_name <NEW_LINE> message += "with view name %s. Cannot register " % old_view <NEW_LINE> message += "again with view...
Raised when a permission is registered with two different views.
6259904924f1403a926862b0
class Genres(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> data = {genre.id: genre.name for genre in Genre.objects.all()} <NEW_LINE> return JsonResponse(data)
View class that return Json encoded list of music genres available
62599049baa26c4b54d50670
class ArcadeOutputService: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def clear_screen(self): <NEW_LINE> <INDENT> arcade.start_render() <NEW_LINE> <DEDENT> def draw_actor(self, actor): <NEW_LINE> <INDENT> actor.draw() <NEW_LINE> <DEDENT> def draw_actors(self, actors): <NEW_LINE...
Outputs the game state. The responsibility of the class of objects is to draw the game state on the terminal. Stereotype: Service Provider Attributes: _screen (Screen): An Asciimatics screen.
62599049507cdc57c63a6165
class TargetAT(object): <NEW_LINE> <INDENT> def __init__(self, enemy, player_list): <NEW_LINE> <INDENT> self.enemy = enemy <NEW_LINE> self.player_list = player_list <NEW_LINE> <DEDENT> def find_AT_target(self): <NEW_LINE> <INDENT> if self.enemy.AT is None: <NEW_LINE> <INDENT> self.__create_AT() <NEW_LINE> <DEDENT> targ...
Special targeting that only Elites use. Creates an Aggression Token and "gives" it to the Player which fulfills its targeting restriction. If an Elite already has an Aggression Token in effect, it uses it instead of creating a new one.
6259904950485f2cf55dc350
class MixtureMember(object): <NEW_LINE> <INDENT> def __init__(self, distribution, name=''): <NEW_LINE> <INDENT> self.distribution = distribution <NEW_LINE> self.name = name <NEW_LINE> self.parameters = {} <NEW_LINE> <DEDENT> def pdf(self, X): <NEW_LINE> <INDENT> return self.distribution.pdf(X, **self.parameters) <NEW_L...
Base class for mixture member.
625990493cc13d1c6d466aff
class LoggerPlus(logging.Logger): <NEW_LINE> <INDENT> def __init__(self, name, level=logging.NOTSET): <NEW_LINE> <INDENT> logging.Logger.__init__(self, name, level) <NEW_LINE> <DEDENT> def pipelinetrace(self, pipeline_part, msg, *args, **kwargs): <NEW_LINE> <INDENT> if pipeline_part in alpha2aleph.cfgini.CFGINI["pipeli...
LoggerPlus class
62599049cad5886f8bdc5a62
class Car(): <NEW_LINE> <INDENT> def __init__(self, make, model, year): <NEW_LINE> <INDENT> self.make = make <NEW_LINE> self.model = model <NEW_LINE> self.year = year <NEW_LINE> self.odometer_reading = 0 <NEW_LINE> <DEDENT> def get_descriptive_name(self): <NEW_LINE> <INDENT> long_name = str(self.year) + ' ' + self.make...
给定实参
6259904907f4c71912bb07fa
class AllergicAdopter(Adopter): <NEW_LINE> <INDENT> def __init__(self, name, desired_species, allergic_species): <NEW_LINE> <INDENT> Adopter.__init__(self, name, desired_species) <NEW_LINE> self.allergic_species = allergic_species <NEW_LINE> <DEDENT> def get_score(self, adoption_center): <NEW_LINE> <INDENT> list = set(...
An AllergicAdopter is extremely allergic to a one or more species and cannot even be around it a little bit! If the adoption center contains one or more of these animals, they will not go there. Score should be 0 if the center contains any of the animals, or 1x number of desired animals if not
6259904915baa72349463359
class AST1(AST2, AST0): <NEW_LINE> <INDENT> def __new__(cls, *args, **kw): <NEW_LINE> <INDENT> new_args = [AST_adapt(arg) for arg in args] <NEW_LINE> new_kw = {k: AST_adapt(v) for k, v in kw.items()} <NEW_LINE> self = super().__new__(cls, *new_args, **new_kw) <NEW_LINE> raspon = obuhvati(itertools.chain(args, kw.values...
Tip apstraktnog sintaksnog stabla.
6259904929b78933be26aaa6
class TraitsController(rest.RestController): <NEW_LINE> <INDENT> @requires_admin <NEW_LINE> @wsme_pecan.wsexpose([Trait], wtypes.text, wtypes.text) <NEW_LINE> def get_one(self, event_type, trait_name): <NEW_LINE> <INDENT> LOG.debug(_("Getting traits for %s") % event_type) <NEW_LINE> return [Trait(name=t.name, type=t.ge...
Works on Event Traits.
6259904994891a1f408ba0d9
class SoftDeletionUserQuerySet(QuerySet): <NEW_LINE> <INDENT> def delete(self, **kwargs): <NEW_LINE> <INDENT> return super(SoftDeletionUserQuerySet, self).update(deleted_at=timezone.now(), is_active=False, deleted_by = kwargs.pop('user',None)) <NEW_LINE> <DEDENT> def hard_delete(self): <NEW_LINE> <INDENT> return super...
QuerySet que va de la mano con "SoftDeletionUserManager" Toma el mismo comportamiento definido en el Modelo, implementando el marcado en lugar de la eliminación real, para un conjunto de instancias (en lugar de una, como sucede en el Modelo)
6259904923e79379d538d8c6
class FilesystemWatchMixin (object): <NEW_LINE> <INDENT> def monitor_directories(self, *directories, **kwargs): <NEW_LINE> <INDENT> tokens = [] <NEW_LINE> force = kwargs.get('force', False) <NEW_LINE> for directory in directories: <NEW_LINE> <INDENT> gfile = Gio.File.new_for_path(directory) <NEW_LINE> if not force and ...
A mixin for Sources watching directories
6259904930c21e258be99bce
class TimedOutError(MessageQueueError): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(TimedOutError, self).__init__( "Timed out waiting for the message queue.")
Raised when a message queue operation times out.
6259904924f1403a926862b1
class SmoothenValue: <NEW_LINE> <INDENT> def __init__(self, beta: float = 0.98): <NEW_LINE> <INDENT> self.beta, self.n, self.mov_avg = beta, 0, 0 <NEW_LINE> <DEDENT> def __call__(self, val: float): <NEW_LINE> <INDENT> self.n += 1 <NEW_LINE> self.mov_avg = self.beta * self.mov_avg + (1 - self.beta) * val <NEW_LINE> smoo...
Create a smooth moving average for a value (loss, etc).
62599049ec188e330fdf9c65
class BiCounter(Mapping): <NEW_LINE> <INDENT> def __init__(self, iterable=None): <NEW_LINE> <INDENT> self.item_to_freq = defaultdict(lambda: 0) <NEW_LINE> self.freq_to_items = defaultdict(set) <NEW_LINE> self.largest_count = 0 <NEW_LINE> if iterable is not None: <NEW_LINE> <INDENT> for item in iterable: <NEW_LINE> <IND...
Bi-directional counter. Maps items to a count, and maps the counts to a set of items. Examples -------- >>> bc = BiCounter() >>> bc.increment("a") >>> bc.increment("b") >>> bc.increment("c") >>> bc.increment("a") >>> bc.increment("b") >>> bc.get_most_common() {"a", "b"} >>> bc.decrement("b") >>> bc.get_most_common()...
62599049498bea3a75a58ee7
class ConfigServerSettingsValidateResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'is_valid': {'key': 'isValid', 'type': 'bool'}, 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, } <NEW_LINE> def __init__( self, *, is_valid: Optional[bool] = None, details: Optional[...
Validation result for config server settings. :ivar is_valid: Indicate if the config server settings are valid. :vartype is_valid: bool :ivar details: The detail validation results. :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord]
62599049462c4b4f79dbcdc8
@utils.use_signature(core.TopLevelConcatSpec) <NEW_LINE> class ConcatChart(TopLevelMixin, core.TopLevelConcatSpec): <NEW_LINE> <INDENT> def __init__(self, data=Undefined, concat=(), columns=Undefined, **kwargs): <NEW_LINE> <INDENT> for spec in concat: <NEW_LINE> <INDENT> _check_if_valid_subspec(spec, "ConcatChart") <NE...
A chart with horizontally-concatenated facets
62599049a8ecb033258725da
class V1DaemonSetCondition(object): <NEW_LINE> <INDENT> swagger_types = { 'last_transition_time': 'datetime', 'message': 'str', 'reason': 'str', 'status': 'str', 'type': 'str' } <NEW_LINE> attribute_map = { 'last_transition_time': 'lastTransitionTime', 'message': 'message', 'reason': 'reason', 'status': 'status', 'type...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259904907d97122c421806b
class Exception(Exception): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return self.__class__.__name__ <NEW_LINE> <DEDENT> def ice_name(self): <NEW_LINE> <INDENT> return self.ice_id()[2:] <NEW_LINE> <DEDENT> def ice_id(self): <NEW_LINE> <INDENT> return self._ice_id
The base class for all Ice exceptions.
6259904907d97122c421806c
class TestBillingUpdate(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testBillingUpdate(self): <NEW_LINE> <INDENT> pass
BillingUpdate unit test stubs
6259904a07f4c71912bb07fc
class Batch: <NEW_LINE> <INDENT> def __init__(self, transport_loop): <NEW_LINE> <INDENT> self.messaging_stack = MessagingStack(transport_loop) <NEW_LINE> self.protocol_printer = Printer(prefix=(batch.RESPONSE_PREFIX)) <NEW_LINE> self.command_printer = MessagePrinter(prefix=' Sending: ') <NEW_LINE> self.protocol = Prot...
Actor-based batch execution.
6259904ad4950a0f3b111827
class FeatureNames(object): <NEW_LINE> <INDENT> STORY = 'story' <NEW_LINE> QUESTION = 'question' <NEW_LINE> ANSWER = 'answer' <NEW_LINE> @classmethod <NEW_LINE> def features(cls): <NEW_LINE> <INDENT> for attr, value in cls.__dict__.items(): <NEW_LINE> <INDENT> if not attr.startswith('__') and not callable(getattr(cls, ...
Feature names, i.e keys for storing babi_qa data in TFExamples.
6259904a8a43f66fc4bf355f
class PolkitTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def __init__(self, methodName='runTest'): <NEW_LINE> <INDENT> unittest.TestCase.__init__(self, methodName) <NEW_LINE> self.polkit_pid = None <NEW_LINE> <DEDENT> def start_polkitd(self, allowed_actions, on_bus=None): <NEW_LINE> <INDENT> assert self.polkit_pid ...
Convenient test cases involving polkit. Call start_polkitd() with the list of allowed actions in your test cases. The daemon will be automatically terminated when the test case exits.
6259904adc8b845886d54985
class Flow(JsonObject): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.table_id = kwargs.get('table_id', None) <NEW_LINE> self.priority = kwargs.get('priority', None) <NEW_LINE> self.match = kwargs.get('match', None) <NEW_LINE> self.duration_sec = kwargs.get('duration_sec', None) <NEW_LINE> ...
Flow (JsonObject) Una representación pitón del objeto de flujo
6259904a45492302aabfd89d
class MessageDispatcher(object): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.recipients = {} <NEW_LINE> <DEDENT> def add(self, transport, address=None): <NEW_LINE> <INDENT> if not address: <NEW_LINE> <INDENT> address = str(uuid.uuid1()) <NEW_LINE> <DEDENT> if address in self.recipi...
MessageDispatcher is a PubSub state machine that routes data packets through an attribute called "recipients". The recipients attribute is a dict structure where the keys are unique addresses and the values are instances of RecipientManager. "address"es (i.e. RecipientManagers) are created and/or subscribed to. Subscri...
6259904ad6c5a102081e34e6
class SwapGate(TwoQubitGate): <NEW_LINE> <INDENT> gate_name = 'SWAP' <NEW_LINE> gate_name_latex = 'SWAP' <NEW_LINE> def get_target_matrix(self, format='sympy'): <NEW_LINE> <INDENT> return matrix_cache.get_matrix('SWAP', format) <NEW_LINE> <DEDENT> def decompose(self, **options): <NEW_LINE> <INDENT> i, j = self.targets[...
Two qubit SWAP gate. This gate swap the values of the two qubits. Parameters ---------- label : tuple A tuple of the form (target1, target2). Examples ========
6259904a94891a1f408ba0da
class GcodeSet(YamlMixin, RstMixin): <NEW_LINE> <INDENT> def __init__(self, yaml_path): <NEW_LINE> <INDENT> data = self._load_yaml(yaml_path) <NEW_LINE> self._gcodes = {} <NEW_LINE> for gcode_txt, d in data.items(): <NEW_LINE> <INDENT> gcode = Gcode(gcode_txt, d['meaning']) <NEW_LINE> self._gcodes[gcode_txt] = gcode <N...
Class for the table of G-codes.
6259904a71ff763f4b5e8b6f
class BinaryPackage: <NEW_LINE> <INDENT> def __init__(self, package_type, package_path): <NEW_LINE> <INDENT> self.type = package_type <NEW_LINE> self.path = package_path <NEW_LINE> self.metadata = None <NEW_LINE> self.name = None <NEW_LINE> <DEDENT> def load(self): <NEW_LINE> <INDENT> if self.metadata is not No...
A binary package is the endpoint of a binary package file provided by most of the Linux distribution. It stores metadata read from the binary package itself.
6259904a24f1403a926862b2
class CustomerInformation( BaseSettingsForm ): <NEW_LINE> <INDENT> form_fields = form.Fields(interfaces.IGetPaidManagementCustomerInformation)
get paid management interface
6259904a07d97122c421806e
class BlockV2(HybridBlock): <NEW_LINE> <INDENT> def __init__(self, channels_num, **kwargs): <NEW_LINE> <INDENT> super(BlockV2, self).__init__(**kwargs) <NEW_LINE> self.body1 = nn.HybridSequential(prefix='') <NEW_LINE> self.body1.add(nn.Conv3D(channels=channels_num, kernel_size=(3, 3, 3), strides=(2, 2, 2), padding=(1, ...
Component of 3D branch.
6259904a6e29344779b01a0c
class BaseDeathPenalty(object): <NEW_LINE> <INDENT> def __init__(self, timeout, exception=JobTimeoutException): <NEW_LINE> <INDENT> self._timeout = timeout <NEW_LINE> self._exception = exception <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.setup_death_penalty() <NEW_LINE> <DEDENT> def __exit__(self...
Base class to setup job timeouts.
6259904a7cff6e4e811b6e05
class paymentMethodIdProp(SchemaProperty): <NEW_LINE> <INDENT> _prop_schema = 'paymentMethodId' <NEW_LINE> _expected_schema = None <NEW_LINE> _enum = False <NEW_LINE> _format_as = "TextField"
SchemaField for paymentMethodId Usage: Include in SchemaObject SchemaFields as your_django_field = paymentMethodIdProp() schema.org description:An identifier for the method of payment used (e.g. the last 4 digits of the credit card). prop_schema returns just the property without url# format_as is used by app templat...
6259904a82261d6c527308ab
class Critter(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> print("Появилась на свет новая зверюшка!") <NEW_LINE> <DEDENT> def talk(self): <NEW_LINE> <INDENT> print("Привет. Я зверюшка - экземпляр класса Critter.")
Виртуальный питомец
6259904a711fe17d825e1683
class TestMemberCreateRequestBody(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testMemberCreateRequestBody(self): <NEW_LINE> <INDENT> pass
MemberCreateRequestBody unit test stubs
6259904a73bcbd0ca4bcb659
class MonitoringStation: <NEW_LINE> <INDENT> def __init__(self, station_id, measure_id, label, coord, typical_range, river, town): <NEW_LINE> <INDENT> self.station_id = station_id <NEW_LINE> self.measure_id = measure_id <NEW_LINE> self.name = label <NEW_LINE> if isinstance(label, list): <NEW_LINE> <INDENT> self.name = ...
This class represents a river level monitoring station
6259904a30dc7b76659a0bfe
class VMwareHTTPWriteVmdk(VMwareHTTPFile): <NEW_LINE> <INDENT> def __init__(self, session, host, rp_ref, vm_folder_ref, vm_create_spec, vmdk_size): <NEW_LINE> <INDENT> self._session = session <NEW_LINE> self._vmdk_size = vmdk_size <NEW_LINE> self._progress = 0 <NEW_LINE> lease = session.invoke_api(session.vim, 'ImportV...
Write VMDK over HTTP using VMware HttpNfcLease.
6259904a8e05c05ec3f6f840
class ListRule(ListItemRule): <NEW_LINE> <INDENT> type = 'list' <NEW_LINE> inside = False <NEW_LINE> def condition(self,block): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> def action(self, block, handler): <NEW_LINE> <INDENT> if not self.inside and ListItemRule.condition(self,block): <NEW_LINE> <INDENT> handler...
A list begins between a block that is not a list item and a subsequent list item. It ends after the last consecutive list item.
6259904ab57a9660fecd2e48