code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Sword(Weapon): <NEW_LINE> <INDENT> def attack(self): <NEW_LINE> <INDENT> return ( random.choice([10, 15]), random.choice(["Bam!", "Whack!", "Pow!"]) )
A primitive close-range weapon. It deals either 5 or 10 damage with a 50/50 chance.
62598f91adb09d7d5dc0a1e4
class Uncollectable(object): <NEW_LINE> <INDENT> def __init__(self, partner=None): <NEW_LINE> <INDENT> if partner is None: <NEW_LINE> <INDENT> self.partner = Uncollectable(partner=self) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.partner = partner <NEW_LINE> <DEDENT> <DEDENT> def __del__(self): <NEW_LINE> <INDEN...
Create a reference cycle with multiple __del__ methods. An object in a reference cycle will never have zero references, and so must be garbage collected. If one or more objects in the cycle have __del__ methods, the gc refuses to guess an order, and leaves the cycle uncollected.
62598f91a79ad16197769cbd
class MaximaAbstractElementFunction(MaximaAbstractElement): <NEW_LINE> <INDENT> def __init__(self, parent, name, defn, args, latex): <NEW_LINE> <INDENT> MaximaAbstractElement.__init__(self, parent, name, is_name=True) <NEW_LINE> self.__defn = defn <NEW_LINE> self.__args = args <NEW_LINE> self.__latex = latex <NEW_LINE>...
Create a Maxima function with the parent ``parent``, name ``name``, definition ``defn``, arguments ``args`` and latex representation ``latex``. INPUT: - ``parent`` - an instance of a concrete Maxima interface - ``name`` - string - ``defn`` - string - ``args`` - string; comma separated names of arguments - ``latex...
62598f9163b5f9789fe84dd2
class SetField(StructureField): <NEW_LINE> <INDENT> def structure_class(self): <NEW_LINE> <INDENT> return Zset if self.ordered else Set
A field maintaining an unordered collection of values. It is initiated without any argument other than an optional model class. When accessed from the model instance, it returns an instance of :class:`Set` structure. For example:: class User(odm.StdModel): username = odm.AtomField(unique = True) p...
62598f910a50d4780f705032
class AppDiscovery(db.Model): <NEW_LINE> <INDENT> sid = db.Column(db.Integer(), nullable=False, primary_key=True) <NEW_LINE> identifier = db.Column(db.String(40), nullable=False, primary_key=False) <NEW_LINE> name = db.Column(db.String(80), nullable=False, primary_key=False) <NEW_LINE> category_id = db.Column(db.Intege...
the app discovery class represents a single Discoverable App
62598f91bde94217f3707497
class DataError(DatabaseError): <NEW_LINE> <INDENT> pass
Wraps a DB-API DataError.
62598f91ac7a0e7691f7216a
class BriefVideoProtocol(ModelProtocol, Protocol): <NEW_LINE> <INDENT> title: str <NEW_LINE> artists_name: str <NEW_LINE> duration_ms: str = ''
MvModel is also a kind of VideoModel. There is no MvModel anymore.
62598f92a17c0f6771d5be9a
class WebSocketClient(WebSocketHandler): <NEW_LINE> <INDENT> def open(self): <NEW_LINE> <INDENT> print('Frontend connected') <NEW_LINE> <DEDENT> def on_message(self, msg): <NEW_LINE> <INDENT> obj = json.loads(msg, 'utf-8') <NEW_LINE> JudgeDispatcher.emit_chal(obj, lambda res: self.write_message(json.dumps(res))) <NEW_L...
Websocket request handler.
62598f924e4d56256637207f
class QuickPanel(bpy.types.Panel): <NEW_LINE> <INDENT> bl_label = "Quick" <NEW_LINE> bl_idname = "QuickPanel" <NEW_LINE> bl_space_type = 'VIEW_3D' <NEW_LINE> bl_region_type = 'TOOLS' <NEW_LINE> bl_category = "TK17 Body" <NEW_LINE> def draw(self,context): <NEW_LINE> <INDENT> layout = self.layout <NEW_LINE> <DEDENT> def ...
Creates a Panel in the Tool Shelf
62598f9273bcbd0ca4bc9eb5
class DecisionTreeRegressor(DecisionTree): <NEW_LINE> <INDENT> def build_tree(self, features, targets, depth): <NEW_LINE> <INDENT> if len(features) == 0: <NEW_LINE> <INDENT> return DecisionNode() <NEW_LINE> <DEDENT> if depth == 0: <NEW_LINE> <INDENT> return DecisionNode(result=self.mean_output(targets)) <NEW_LINE> <DED...
:param max_depth: Maximum number of splits during training :param min_leaf_examples: Minimum number of examples in a leaf node. :param max_split_features: Maximum number of features considered at each split (default='auto') : - If int, the given nu...
62598f9216aa5153ce40015e
class GetUnreadMessagesFromUserInputSet(InputSet): <NEW_LINE> <INDENT> def set_AccessToken(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'AccessToken', value) <NEW_LINE> <DEDENT> def set_Name(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'Name', value) <NEW_LINE> <DEDENT> def set_ResponseMod...
An InputSet with methods appropriate for specifying the inputs to the GetUnreadMessagesFromUser Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
62598f9221a7993f00c65bdb
class CleanCommand(Command): <NEW_LINE> <INDENT> user_options = [] <NEW_LINE> def initialize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def finalize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> for folder in ['build', 'dist']: <NEW_LINE> <INDENT> if os....
Delete all distribution files
62598f9294891a1f408b951f
class RemovePackageThread(threading.Thread, PackageDisabler): <NEW_LINE> <INDENT> def __init__(self, manager, package): <NEW_LINE> <INDENT> self.manager = manager <NEW_LINE> self.package = package <NEW_LINE> threading.Thread.__init__(self) <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> time.sleep(0.7) <NEW_LINE...
A thread to run the remove package operation in so that the Sublime Text UI does not become frozen
62598f92f7d966606f747c41
class EntangleGate(BasicGate): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return "Entangle"
Entangle gate class. (Hadamard on first qubit, followed by CNOTs applied to all other qubits).
62598f9285dfad0860cbf8a2
class Libxpm(AutotoolsPackage, XorgPackage): <NEW_LINE> <INDENT> homepage = "http://cgit.freedesktop.org/xorg/lib/libXpm" <NEW_LINE> xorg_mirror_path = "lib/libXpm-3.5.12.tar.gz" <NEW_LINE> version('3.5.12', sha256='2523acc780eac01db5163267b36f5b94374bfb0de26fc0b5a7bee76649fd8501') <NEW_LINE> version('3.5.11', sha256='...
libXpm - X Pixmap (XPM) image file format library.
62598f92a219f33f346c647a
class OrderedBidict(OrderedBidictBase[KT, VT], MutableBidict[KT, VT]): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> if _t.TYPE_CHECKING: <NEW_LINE> <INDENT> @property <NEW_LINE> def inverse(self) -> 'OrderedBidict[VT, KT]': ... <NEW_LINE> <DEDENT> def clear(self) -> None: <NEW_LINE> <INDENT> self._fwdm.clear() <NEW_LI...
Mutable bidict type that maintains items in insertion order.
62598f92e76e3b2f99fd8696
class RandomVerticalFlip(object): <NEW_LINE> <INDENT> def __call__(self, img): <NEW_LINE> <INDENT> if random.random() < 0.5: <NEW_LINE> <INDENT> return img.transpose(Image.FLIP_TOP_BOTTOM) <NEW_LINE> <DEDENT> return img
Vertically flip the given PIL.Image randomly with a probability of 0.5.
62598f920c0af96317c55fe4
class ComponentsFetcher(KDayFetcher): <NEW_LINE> <INDENT> index_dname = { 'HS300': 'SH000300', 'CS500': 'SH000905', 'CS800': 'SH000906', 'SH50': 'SH000016', 'CYB': 'SZ399006', 'ZXB': 'SZ399005', 'JCA': 'SZ399317', } <NEW_LINE> dnames = DB.index_components.distinct('dname') <NEW_LINE> def __init__(self, as_bool=True, **...
Class to fetch index components data. :param boolean as_bool: Whether the returned result be a weight matrix or just a boolean matrix. Default: True
62598f929b70327d1c57ea01
class RecordListList(list): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> out = [] <NEW_LINE> for i in self: <NEW_LINE> <INDENT> out.append(repr(i)) <NEW_LINE> <DEDENT> return "\n".join(out)
Container for multiple RecordList instances that presents a more consistent representation.
62598f9215baa72349461bde
class ImageProcessor(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def process(self, field, url): <NEW_LINE> <INDENT> if not url: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> return self.__fetch(field, url) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def __fetch(self, field, url): <NEW_LINE> <INDENT> res = req...
This class is just an abstraction of the steps involved in grabbing a product image. Usage is easy as 1, 2, 3 (\o/ yay) >>> model = SomeModelThatHasAnImage() >>> assert hasattr(model, 'image') >>> >>> processor = ImageProcessor(model) >>> processor.process()
62598f9230dc7b766599f4bc
class Plot(ABC): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def __init__(self) -> None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def create_plots(self) -> None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def _set_figure(self) -> None: <NEW_LINE> <INDENT> p...
A template class for plots.
62598f9291af0d3eaad39a66
class RecoveryPoint(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'object_type': {'required': True}, } <NEW_LINE> _attribute_map = { 'object_type': {'key': 'objectType', 'type': 'str'}, } <NEW_LINE> _subtype_map = { 'object_type': {'AzureFileShareRecoveryPoint': 'AzureFileShareRecoveryPoint', 'AzureW...
Base class for backup copies. Workload-specific backup copies are derived from this class. You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureFileShareRecoveryPoint, AzureWorkloadRecoveryPoint, GenericRecoveryPoint, IaasVMRecoveryPoint. All required parameters must be po...
62598f9260cbc95b06363fa6
class VolumeDevice(_kuber_definitions.Definition): <NEW_LINE> <INDENT> def __init__( self, device_path: str = None, name: str = None, ): <NEW_LINE> <INDENT> super(VolumeDevice, self).__init__(api_version="core/v1", kind="VolumeDevice") <NEW_LINE> self._properties = { "devicePath": device_path if device_path is not None...
volumeDevice describes a mapping of a raw block device within a container.
62598f92d58c6744b42dc0fe
class Glob: <NEW_LINE> <INDENT> infoApi = { 'https': 'https://fr.openfoodfacts.org/cgi/search.pl?search_simple=1&action=process', 'action': 'process', 'sort_by': 'unique_scans_n', 'page_size': '200', 'json': '1', 'tagtype_0': 'categories', 'tag_contains_0': 'contains', } <NEW_LINE> categories = ( 'Sodas', 'Jus de fruit...
List of variables used by different Python script
62598f9207d97122c421690f
class AutoScrollFrame(tk.Frame): <NEW_LINE> <INDENT> def __init__(self, master, *args, **kwargs): <NEW_LINE> <INDENT> self.maxheight = kwargs.pop('maxheight', None) <NEW_LINE> tk.Frame.__init__(self, master, *args, **kwargs) <NEW_LINE> self._scroll = AutoScrollbar(self, orient=tk.VERTICAL) <NEW_LINE> self._scroll.grid(...
Frame with a auto-hiding scrollbar
62598f92a4f1c619b294e24c
class Building(Terrain): <NEW_LINE> <INDENT> def __init__(self, name, width, height, scale): <NEW_LINE> <INDENT> Terrain.__init__(self, name, width, height, scale) <NEW_LINE> self.culture = None <NEW_LINE> self.NPC = {} <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.name + " (Building)"
Class for all houses, shops and other constructions.
62598f920383005118f6d35c
class Planet: <NEW_LINE> <INDENT> def __init__(self, mass, xloc, yloc, period, sun=False): <NEW_LINE> <INDENT> self.mass = mass <NEW_LINE> self.xloc = xloc <NEW_LINE> self.yloc = yloc <NEW_LINE> if sun == True: <NEW_LINE> <INDENT> self.xvel = 0.0 <NEW_LINE> self.yvel = 0.0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ...
A generalized planet object that has a circular orbit, location, orbital period, and mass.
62598f9223849d37ff850d25
class RandomWalk(): <NEW_LINE> <INDENT> def __init__(self, num_points=5000): <NEW_LINE> <INDENT> self.num_points = num_points <NEW_LINE> self.x_values = [0] <NEW_LINE> self.y_values = [0] <NEW_LINE> <DEDENT> def get_step(self): <NEW_LINE> <INDENT> direction = choice([-1, 1]) <NEW_LINE> distance = choice([1, 2, 3, 4]) <...
A class to generate random walks.
62598f923539df3088ecbf20
class Response(object): <NEW_LINE> <INDENT> def __init__(self, process=None): <NEW_LINE> <INDENT> super(Response, self).__init__() <NEW_LINE> self._process = process <NEW_LINE> self.command = None <NEW_LINE> self.std_err = None <NEW_LINE> self.std_out = None <NEW_LINE> self.status_code = None <NEW_LINE> self.history = ...
A command's response
62598f92eab8aa0e5d30b9e1
class TestUpdateRequestGeneralAccountRequestModel(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 testUpdateRequestGeneralAccountRequestModel(self): <NEW_LINE> <INDENT> pass
UpdateRequestGeneralAccountRequestModel unit test stubs
62598f9207f4c71912baf0ab
@ttsengine('generic') <NEW_LINE> class TTSEngine: <NEW_LINE> <INDENT> def __init__(self, controller=None): <NEW_LINE> <INDENT> self.controller=controller <NEW_LINE> self.gui=self.controller.gui <NEW_LINE> self.language=None <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def can_run(): <NEW_LINE> <INDENT> return True <NEW...
Generic TTSEngine.
62598f92baa26c4b54d4ef19
class EmployeeCreate(CreateView): <NEW_LINE> <INDENT> model = Employee <NEW_LINE> success_url = reverse_lazy('human_res:employee-list') <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(EmployeeCreate, self).get_context_data(**kwargs) <NEW_LINE> context['action'] = reverse('human_res:...
add a new employee object then redirect to the list page
62598f9224f1403a926856e1
class Resolver: <NEW_LINE> <INDENT> def validator_for(self, command): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return getattr( self._getmodule(command), command.__class__.__name__ + 'Validator') <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> <DEDENT> def handler_for(s...
Retrieves validator class and handler class of command using naming conventions.
62598f92a79ad16197769cc0
class GQASceneGraph(_GQASceneGraphBase, total=False): <NEW_LINE> <INDENT> location: str <NEW_LINE> weather: str
Class wrapper for GQA scene graph information.
62598f9238b623060ffa8ceb
class _ComputePerplexityHook(tf.train.SessionRunHook): <NEW_LINE> <INDENT> def __init__(self, losses_tensor, weights_tensor, log_dir=None, summary_writer=None, min_global_step=None): <NEW_LINE> <INDENT> self._losses_tensor = losses_tensor <NEW_LINE> self._weights_tensor = weights_tensor <NEW_LINE> self._log_dir = log_d...
Hook to compute per-word perplexity during evaluation.
62598f92656771135c4892e1
class TM_Model(Model): <NEW_LINE> <INDENT> created_time = DateTimeField(auto_now_add=True) <NEW_LINE> updated_time = DateTimeField() <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return 'time model' <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> def set_updated_time(self...
only model templates have no relation with existing apps can be defined in me.models
62598f92be383301e0253465
class TestSearchdecoratorsApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = graylog.apis.searchdecorators_api.SearchdecoratorsApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_create(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <D...
SearchdecoratorsApi unit test stubs
62598f92cc0a2c111447ac74
class CasparCG(object): <NEW_LINE> <INDENT> def __init__(self, host:str="localhost", port:int=5250, timeout:float=2): <NEW_LINE> <INDENT> assert isinstance(port, int) and port <= 65535, "Invalid port number" <NEW_LINE> self.host = host <NEW_LINE> self.port = port <NEW_LINE> self.timeout = timeout <NEW_LINE> self.connec...
CasparCG client object
62598f924e4d562566372082
class RetryTask(tasks.Task): <NEW_LINE> <INDENT> required_attrs = tasks.Task.required_attrs + ['tries', 'interval', 'backoff', 'retry_failed'] <NEW_LINE> backoff = timedelta(0) <NEW_LINE> def __init__(self, tries=None, next_delay=None, **kwargs): <NEW_LINE> <INDENT> if tries is not None: <NEW_LINE> <INDENT> self.tries ...
Retry a task up to `tries` times until it succeeds. If it fails `tries` times, run the task returned by `retry_failed`. Wait `interval` time between tries, with `backoff` additional delay each time.
62598f92d7e4931a7ef3bd03
class CustomIndexDashboard(Dashboard): <NEW_LINE> <INDENT> columns = 2 <NEW_LINE> def init_with_context(self, context): <NEW_LINE> <INDENT> site_name = get_admin_site_name(context) <NEW_LINE> self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, c...
Custom index dashboard for the_voice.
62598f927cff6e4e811b567c
class ZoomMeetingsView(APIView): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.proxy = ZoomProxy() <NEW_LINE> <DEDENT> def get(self, request, pk, format=None): <NEW_LINE> <INDENT> return self.proxy.get_meeting(meeting_id=pk) <NEW_LINE> <DEDENT> def delete(self, request, pk, format=None): <NEW_LINE> <...
Interact with the Zoom Meeting API.
62598f92435de62698e9ba54
class XmippNormalizeStrainViewer(ProtocolViewer): <NEW_LINE> <INDENT> _label = 'viewer normalize strain' <NEW_LINE> _targets = [XmippProtNormalizeStrain] <NEW_LINE> _environments = [DESKTOP_TKINTER] <NEW_LINE> def __init__(self, **args): <NEW_LINE> <INDENT> ProtocolViewer.__init__(self, **args) <NEW_LINE> <DEDENT> def ...
Visualize the output of protocol volume strain
62598f92cb5e8a47e493bfa3
class RfxtrxCommandEntity(RfxtrxEntity): <NEW_LINE> <INDENT> def __init__(self, device, device_id, signal_repetitions=1, event=None): <NEW_LINE> <INDENT> super().__init__(device, device_id, event=event) <NEW_LINE> self.signal_repetitions = signal_repetitions <NEW_LINE> self._state = None <NEW_LINE> <DEDENT> async def _...
Represents a Rfxtrx device. Contains the common logic for Rfxtrx lights and switches.
62598f9207f4c71912baf0ac
class WaitCursor(object, IDisposable): <NEW_LINE> <INDENT> def Clear(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def Dispose(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def Set(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __enter__(self, *args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> de...
WaitCursor()
62598f924e4d562566372083
class ProgressBar(object): <NEW_LINE> <INDENT> def __init__(self, file_size, size=30, symbol='=', prog='%', space=''): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.symbol = symbol <NEW_LINE> self.mod = 0 <NEW_LINE> self.file_size = file_size <NEW_LINE> self.state = '/' <NEW_LINE> self.prog = prog <NEW_LINE> sel...
Displays progress bar while translation is occurring. Provides line number over number of lines inside file for parsing. Args: file_size (int): file size read from entire file.
62598f926fb2d068a7693c63
class JSUint8ArraysCommand(JSTypedArrayObjectsCommand): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(JSUint8ArraysCommand, self).__init__( "js_uint8_arrays", tracer.uint8_array_objects, 8 ) <NEW_LINE> print(parser)
js_uint8_arrays - Displays all javascript uint8 arrays
62598f9260cbc95b06363fa8
class BasketDetailView(APIView): <NEW_LINE> <INDENT> permission_classes = (IsAuthenticated, ) <NEW_LINE> def delete(self, request, pk): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> basket_to_delete = Basket_Item.objects.get(pk=pk) <NEW_LINE> if basket_to_delete.owner.id != request.user.id: <NEW_LINE> <INDENT> raise Per...
Controller for delete requests to /basket_item/id(pk) endpoint
62598f923617ad0b5ee05dad
class TASAutocompleteA(TASAutocomplete): <NEW_LINE> <INDENT> component = "a" <NEW_LINE> endpoint_doc = "usaspending_api/api_contracts/contracts/v2/autocomplete/accounts/a.md"
Returns the list of potential Availability Type Codes narrowed by other components supplied in the Treasury Account filter.
62598f92d58c6744b42dc0ff
class UtilTests(unittest.TestCase): <NEW_LINE> <INDENT> def test_logErrorReturnsError(self): <NEW_LINE> <INDENT> error = failure.Failure(RuntimeError()) <NEW_LINE> result = defer.logError(error) <NEW_LINE> self.flushLoggedErrors(RuntimeError) <NEW_LINE> self.assertIs(error, result) <NEW_LINE> <DEDENT> def test_logError...
Tests for utility functions.
62598f92d4950a0f3b110c69
@dataclass <NEW_LINE> class InsertStatementsVisitorContext: <NEW_LINE> <INDENT> ctx_stmt: List[StatementContext] <NEW_LINE> ctx_block: List[BlockContext]
Context for the InsertStatementsVisitor about which statements have been requested to insert before/after the current one.
62598f92f7d966606f747c45
class SerializerActionMixin: <NEW_LINE> <INDENT> def get_serializer_class(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.serializer_action_classes[self.action] <NEW_LINE> <DEDENT> except (KeyError, AttributeError): <NEW_LINE> <INDENT> return super().get_serializer_class()
Mixin to use separate serializers for certain actions (e.g. list vs. retrieve).
62598f928c0ade5d55dc34be
class Text: <NEW_LINE> <INDENT> def __init__(self, *, gui=None, parent=None, name=None, txt='', font=None, text_scale=1.0, pos=None): <NEW_LINE> <INDENT> pass
This type of text can be changed. Uses TextNode internally. Each instance is a new geom so use wisely!
62598f9223849d37ff850d27
class SocialProfile(dict): <NEW_LINE> <INDENT> @property <NEW_LINE> def type(self): <NEW_LINE> <INDENT> return self.get('type', None) <NEW_LINE> <DEDENT> @property <NEW_LINE> def id(self): <NEW_LINE> <INDENT> return self.get('id', None) <NEW_LINE> <DEDENT> @property <NEW_LINE> def url(self): <NEW_LINE> <INDENT> return ...
Object representing http://docs.intercom.io/#SocialProfiles) This object is read-only, and to hint at this __setitem__ is disabled. >>> from intercom.user import SocialProfile >>> profile = SocialProfile(type=u'twitter') >>> profile.type u'twitter' >>> profile['type'] = 'facebook' Traceback (most recent call last): ...
62598f920383005118f6d35e
class _BindParamClause(ColumnElement): <NEW_LINE> <INDENT> __visit_name__ = 'bindparam' <NEW_LINE> quote = None <NEW_LINE> def __init__(self, key, value, type_=None, unique=False, isoutparam=False, required=False, _compared_to_operator=None, _compared_to_type=None): <NEW_LINE> <INDENT> if unique: <NEW_LINE> <INDENT> se...
Represent a bind parameter. Public constructor is the :func:`bindparam()` function.
62598f92851cf427c66b7f27
class MCP9808(object): <NEW_LINE> <INDENT> __ADDR = 0x1f <NEW_LINE> __REG_CONFIG = 0x01 <NEW_LINE> __REG_ALERT_UPPER = 0x02 <NEW_LINE> __REG_ALERT_LOWER = 0x03 <NEW_LINE> __REG_CRITICAL_TEMP = 0x04 <NEW_LINE> __REG_TEMP = 0x05 <NEW_LINE> __REG_MFR_ID = 0x06 <NEW_LIN...
Microchip Technology MCP9808 temperature sensor
62598f92a8ecb03325870e6a
class CompetencyViewTests(TestCase): <NEW_LINE> <INDENT> def test_index_view(self): <NEW_LINE> <INDENT> response = self.client.get(reverse('competencies:index')) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> <DEDENT> def test_schools_view(self): <NEW_LINE> <INDENT> response = self.client.get(reverse...
Needed tests: - queryset tests for all pages - no-data tests
62598f92eab8aa0e5d30b9e3
class AddPullRequestCommentForm(wtf.Form): <NEW_LINE> <INDENT> commit = wtforms.HiddenField('commit identifier') <NEW_LINE> filename = wtforms.HiddenField('file changed') <NEW_LINE> row = wtforms.HiddenField('row') <NEW_LINE> requestid = wtforms.HiddenField('requestid') <NEW_LINE> comment = wtforms.TextAreaField( 'Comm...
Form to add a comment to a pull-request.
62598f92baa26c4b54d4ef1b
class Organisms(BaseController): <NEW_LINE> <INDENT> @cherrypy.expose <NEW_LINE> @ropy.service_format() <NEW_LINE> def changes(self, since): <NEW_LINE> <INDENT> logger.debug(since) <NEW_LINE> organism_list = self.queries.getAllOrganismsAndTaxonIDs() <NEW_LINE> organismIDs = [] <NEW_LINE> organismHash = {} <NEW_LINE> fo...
Organism related queries.
62598f92b57a9660fecd16dd
class SmartlinkEquipments: <NEW_LINE> <INDENT> OFSD24 = 'OFSD24' <NEW_LINE> iOFSD24 = 'iOFSD24' <NEW_LINE> ReflexiC60 = 'ReflexiC60' <NEW_LINE> RCAiC60 = 'RCAiC60' <NEW_LINE> iACT24 = 'iACT24' <NEW_LINE> iATL24 = 'iATL24' <NEW_LINE> PM3210 = 'PM3210' <NEW_LINE> PM3255 = 'PM3255' <NEW_LINE> iEM3110 = 'iEM3110' <NEW_LINE...
Smartlink way equipments
62598f920c0af96317c55fe8
class AdminUpdateForm(forms.ModelForm): <NEW_LINE> <INDENT> password = ReadOnlyPasswordHashField( label='Password', help_text=_( "Raw passwords are not stored, so there is no way to see this " "user's password, but you can change the password using " "<a href=\"../password/\">this form</a>." ), ) <NEW_LINE> class Meta:...
A form for updating users. Includes all the fields on the user, but replaces the password field with admin's password hash display field.
62598f92be383301e0253467
class IndependentSampler(BaseSampler): <NEW_LINE> <INDENT> key = "independent" <NEW_LINE> def _run(self, pianorolls, masks): <NEW_LINE> <INDENT> predictions = self.predictor(pianorolls, masks) <NEW_LINE> samples = self.sample_predictions(predictions) <NEW_LINE> assert (samples * masks).sum() == masks.max(axis=2).sum() ...
Samples all variables independently based on a single model evaluation.
62598f927d847024c075c036
class SearchTable(ScrapeDataTable): <NEW_LINE> <INDENT> search_changed = Signal(str) <NEW_LINE> search_cancelled = Signal() <NEW_LINE> replace_committed = Signal(str, str) <NEW_LINE> def _insertColumns(self, row, values): <NEW_LINE> <INDENT> from visualscrape.ui.viewer.support import SearchReplaceLabel <NEW_LINE> for (...
Extends ScrapeDataTable with some dirty search functionality Works as a signal bridge for internal display labels
62598f9230dc7b766599f4be
class SystemStat(BaseStat): <NEW_LINE> <INDENT> oio_sys_cpu_idle = None <NEW_LINE> def configure(self): <NEW_LINE> <INDENT> if not self.__class__.oio_sys_cpu_idle: <NEW_LINE> <INDENT> self._load_lib() <NEW_LINE> <DEDENT> <DEDENT> def _load_lib(self, path="liboiocore.so.0"): <NEW_LINE> <INDENT> cls = self.__class__ <NEW...
Fetch stats from the system (e.g. CPU usage)
62598f92435de62698e9ba56
class BaseTestClass(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = app.test_client() <NEW_LINE> self.user_details = { 'username' : 'ramonomondi', 'email' : 'ramonomondi@gmail.com', 'password' : '123456789', 'confirm_password': '123456789' } <NEW_LINE> self.user_login_details ...
Configuring the base test class for all the test cases
62598f9223e79379d538c169
class Robot(object): <NEW_LINE> <INDENT> robot_list = [] <NEW_LINE> @staticmethod <NEW_LINE> def contenders(): <NEW_LINE> <INDENT> if len(Robot.robot_list) == 0: <NEW_LINE> <INDENT> print("There are", len(Robot.robot_list), 'robots.\n') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("There are", len(Robot.robot_li...
Robot with a name, weapon, strength, and rating
62598f92b830903b9686e2a6
class MetricsServiceV2Stub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.ListLogMetrics = channel.unary_unary( '/google.logging.v2.MetricsServiceV2/ListLogMetrics', request_serializer=ListLogMetricsRequest.SerializeToString, response_deserializer=ListLogMetricsResponse.FromString, )...
Service for configuring logs-based metrics.
62598f9201c39578d7f129ed
class IssuerCredentials(Model): <NEW_LINE> <INDENT> _attribute_map = { 'account_id': {'key': 'account_id', 'type': 'str'}, 'password': {'key': 'pwd', 'type': 'str'}, } <NEW_LINE> def __init__(self, account_id=None, password=None): <NEW_LINE> <INDENT> self.account_id = account_id <NEW_LINE> self.password = password
The credentials to be used for the certificate issuer. :param account_id: The user name/account name/account id. :type account_id: str :param password: The password/secret/account key. :type password: str
62598f92dd821e528d6d8b98
class RealVectorStore(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.dict = {} <NEW_LINE> self.vectors = [] <NEW_LINE> self.real_vectors = [] <NEW_LINE> self.terms = [] <NEW_LINE> <DEDENT> def init_from_lists(self,terms,vectors): <NEW_LINE> <INDENT> self.terms = terms <NEW_LINE> self.vectors ...
Storage, retrieval and nearest neighbor search of real vectors
62598f923539df3088ecbf24
class Func(DatabaseColumn): <NEW_LINE> <INDENT> def __init__(self, func_name, entity_column, **kwargs): <NEW_LINE> <INDENT> self.func = func_name <NEW_LINE> if isinstance(self.func, basestring): <NEW_LINE> <INDENT> self.func = getattr(func, func_name) <NEW_LINE> <DEDENT> super(Func, self).__init__(entity_column, **kwar...
Wrap the specified column in an arbitrary function.
62598f92dd821e528d6d8b99
class CountableList(object): <NEW_LINE> <INDENT> def __init__(self, element_sedes, max_length=None): <NEW_LINE> <INDENT> self.element_sedes = element_sedes <NEW_LINE> self.max_length = max_length <NEW_LINE> <DEDENT> @to_list <NEW_LINE> def serialize(self, obj): <NEW_LINE> <INDENT> if not is_sequence(obj): <NEW_LINE> <I...
A sedes for lists of arbitrary length. :param element_sedes: when (de-)serializing a list, this sedes will be applied to all of its elements :param max_length: maximum number of allowed elements, or `None` for no limit
62598f9285dfad0860cbf8a5
class FileTypeError(BaseError): <NEW_LINE> <INDENT> message = "%(cause)s"
Error for handling unknown file types.
62598f92a79ad16197769cc4
class HorovodAllgather(torch.autograd.Function): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def forward(ctx, tensor, name): <NEW_LINE> <INDENT> ctx.dim = tensor.shape[0] <NEW_LINE> handle = allgather_async(tensor, name) <NEW_LINE> return synchronize(handle) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def backward(ct...
An autograd function that performs allgather on a tensor.
62598f92b57a9660fecd16df
class im(Function): <NEW_LINE> <INDENT> nargs = 1 <NEW_LINE> is_real = True <NEW_LINE> @classmethod <NEW_LINE> def eval(cls, arg): <NEW_LINE> <INDENT> if arg is S.NaN: <NEW_LINE> <INDENT> return S.NaN <NEW_LINE> <DEDENT> elif arg.is_real: <NEW_LINE> <INDENT> return S.Zero <NEW_LINE> <DEDENT> elif arg.is_Function and ar...
Returns imaginary part of expression. This function performs only elementary analysis and so it will fail to decompose properly more complicated expressions. If completely simplified result is needed then use Basic.as_real_imag() or perform complex expansion on instance of this function. >>> from sympy import re, im, ...
62598f924e4d562566372086
class Six_hole_whistle_designer(Design_whistle): <NEW_LINE> <INDENT> transpose = 12 <NEW_LINE> divisions = [ [(5,0)], [(1,0),(5,0)], [(1,0),(5,0),(5,0.5)], [(-1,0.75),(1,0.0),(2,1.0),(5,0.0),(5,0.3),(5,0.6)], ] <NEW_LINE> min_hole_diameters = design.bore_scaler([ 3.0 ]*6) <NEW_LINE> max_hole_diameters = design.bore_sca...
Abstract base class for folk and dorian whistles.
62598f924e696a045264dc3b
class BaseEcosystem(object): <NEW_LINE> <INDENT> name = None <NEW_LINE> default_backend = None
The base class that all the different ecosystems should extend.
62598f9223e79379d538c16a
class neuronOwnActivator (neuron): <NEW_LINE> <INDENT> activation="sigmoid" <NEW_LINE> def getactiv(self): <NEW_LINE> <INDENT> return self.activation <NEW_LINE> <DEDENT> def getalpha(self): <NEW_LINE> <INDENT> return self.alphas[self.getactiv()]
Has personal activation function, instead of using layer parametr
62598f9215baa72349461be4
class AddTeamMembers(CreateResource): <NEW_LINE> <INDENT> login_required = True <NEW_LINE> model = TeamUser <NEW_LINE> def on_post(self,req, resp, pk): <NEW_LINE> <INDENT> db = self.get_db(req) <NEW_LINE> posted_data = req.media <NEW_LINE> print (posted_data) <NEW_LINE> user_ids = posted_data.pop("user_ids",[]) <NEW_LI...
To add Members to specific team
62598f92bde94217f370749b
class TestUpdate(unittest.TestCase, ExtraAssertions): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.tdict = TwoWayOrderedDict([('a', 1), ('b', 2)]) <NEW_LINE> <DEDENT> def test_update_ordered(self): <NEW_LINE> <INDENT> self.tdict.update([('a', 10), ('c', 3), ('d', 4), ('e', 5)]) <NEW_LINE> self.assertVi...
Test case for the TwoWayOrderedDict update method.
62598f920c0af96317c55feb
class Action(QAction): <NEW_LINE> <INDENT> def __init__(self, category, name, label = None, help_ = "", icon = QIcon(), defaultShortcut = QKeySequence(), settingsLabel = None, menuRole = QAction.TextHeuristicRole): <NEW_LINE> <INDENT> if label is None: <NEW_LINE> <INDENT> label = name <NEW_LINE> <DEDENT> if settingsLab...
The only thing different in this from QAction is the ability to change the shortcut of it using CEED's settings API/interface. While it isn't needed/required to use this everywhere where QAction is used, it is recommended.
62598f92435de62698e9ba58
class Page(object): <NEW_LINE> <INDENT> __metaclass__ = PageMetaclass <NEW_LINE> page_name = None <NEW_LINE> provides_full_url = False <NEW_LINE> def get_url(self, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError( "The page must implement the get_url method.") <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> ...
This class defines the Page model, which has two responsibilities: registering elements selectors and setting the url for the page.
62598f9232920d7e50bc5cc5
class Book(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=200) <NEW_LINE> author = models.CharField(max_length=200) <NEW_LINE> category = models.ForeignKey(Category, on_delete=models.CASCADE) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.title
docstring for Book
62598f9273bcbd0ca4bc9ebd
class API(wsgi.Router): <NEW_LINE> <INDENT> def __init__(self, conf, **local_conf): <NEW_LINE> <INDENT> self.conf = conf <NEW_LINE> mapper = routes.Mapper() <NEW_LINE> schema_api = glance.schema.API(self.conf) <NEW_LINE> glance.schema.load_custom_schema_properties(conf, schema_api) <NEW_LINE> root_resource = root.creat...
WSGI router for Glance v2 API requests.
62598f9207f4c71912baf0b0
class GraphPercent(GraphLine.GraphLine): <NEW_LINE> <INDENT> def __init__(self, interval, channel, timedelta): <NEW_LINE> <INDENT> super().__init__(interval, channel, timedelta) <NEW_LINE> self.coordinates = dict() <NEW_LINE> <DEDENT> def __calculate_weekly_activities_percentage(self): <NEW_LINE> <INDENT> message_count...
- This class inherits from GraphLine to use the get_time_range() function and reuse all variables - The only difference in this is that the coordinates are stored in a dictionary. The reason for this is comes down to how percentages are calculated (Name : Percentage) instead of having a list of coordinates
62598f923c8af77a43b67d6d
class RevokeMessage(MessageBase): <NEW_LINE> <INDENT> msg_type = 10002
WeChat revoke message.
62598f9276d4e153a661c882
class DataSourceCloudSigma(sources.DataSource): <NEW_LINE> <INDENT> dsname = 'CloudSigma' <NEW_LINE> def __init__(self, sys_cfg, distro, paths): <NEW_LINE> <INDENT> self.cepko = Cepko() <NEW_LINE> self.ssh_public_key = '' <NEW_LINE> sources.DataSource.__init__(self, sys_cfg, distro, paths) <NEW_LINE> <DEDENT> def is_ru...
Uses cepko in order to gather the server context from the VM. For more information about CloudSigma's Server Context: http://cloudsigma-docs.readthedocs.org/en/latest/server_context.html
62598f9223e79379d538c16b
class ConsolePrinter: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def print_pool(self, node): <NEW_LINE> <INDENT> desc = pooling_type[node.pool_type] + ', k=' + str(node.kernel_size) + 'x' + str( node.kernel_size) + '/s=' + str(node.stride) + ' pad=' + str(node.pad) <NEW_LINE> i...
A simple console printer
62598f9216aa5153ce400167
class DefaultConfig(object): <NEW_LINE> <INDENT> VERSION = 'v0.9.8' <NEW_LINE> DESCRIPTION = 'Handy REST API client on your terminal' <NEW_LINE> ALL_METHODS = ('GET', 'POST', 'PUT', 'PATCH', 'DELETE') <NEW_LINE> DEFAULT_ALLOWED_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] <NEW_LINE> SEARCH_PATHS = ['.', '~/.recl...
Default configuration
62598f92e5267d203ee6b582
class _Prop_startup(aetools.NProperty): <NEW_LINE> <INDENT> which = 'istd' <NEW_LINE> want = 'bool'
startup - Is this disk the boot disk?
62598f9223849d37ff850d2b
class PersonModelTest(TestCase): <NEW_LINE> <INDENT> def setUp(self) -> None: <NEW_LINE> <INDENT> self.test_data: List[dict] = [ { "name": "sanjeev", "dob": datetime.date(2001, 9, 16), "email": "sanjeev@mail.com", "hobby": "singing", }, { "name": "rohan", "dob": datetime.date(1992, 10, 3), "email": "rohan@mail.com", "h...
Tests for api.models.Person.
62598f926aa9bd52df0d4b34
class TimePointGroup: <NEW_LINE> <INDENT> def __init__(self, time_info=None, duration=None, every=None, time_range=None): <NEW_LINE> <INDENT> self.duration = duration <NEW_LINE> self.time_point_group = [] <NEW_LINE> if time_info: <NEW_LINE> <INDENT> time_info_split = time_info.replace(' ','').split(',') <NEW_LINE> for ...
Wrapper của TimePoint - Giúp chuyển đổi từ dạng string kết hợp sang các đối tượng TimePoint riêng biệt VD: >>> "6:20, 17:20" sẽ chuyển thành 2 đối tượng TimePoint có cùng duration
62598f92d99f1b3c44d05315
class MapDependentModularConnectorFunction(ModularConnectorFunction): <NEW_LINE> <INDENT> required_parameters = ParameterSet({ 'map_location': str, 'sigma': float, 'periodic' : bool, }) <NEW_LINE> def __init__(self, source,target, parameters): <NEW_LINE> <INDENT> import pickle <NEW_LINE> ModularConnectorFunction.__init...
Corresponds to: distance*linear_scaler + constant_scaler
62598f92a8ecb03325870e6e
class ThreadWithReturnValue(Thread): <NEW_LINE> <INDENT> def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, Verbose=None): <NEW_LINE> <INDENT> Thread.__init__(self, group, target, name, args, kwargs) <NEW_LINE> self._return = None <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> if self._t...
Thread that returns a value. From : 'https://stackoverflow.com/questions/6893968/'. To get the value, once the thread is finished, call join().
62598f92498bea3a75a57790
class ProjThresh(FSLCommand): <NEW_LINE> <INDENT> _cmd = 'proj_thresh' <NEW_LINE> input_spec = ProjThreshInputSpec <NEW_LINE> output_spec = ProjThreshOuputSpec <NEW_LINE> def _list_outputs(self): <NEW_LINE> <INDENT> outputs = self.output_spec().get() <NEW_LINE> outputs['out_files'] = [] <NEW_LINE> for name in self.inpu...
Use FSL proj_thresh for thresholding some outputs of probtrack For complete details, see the FDT Documentation <http://www.fmrib.ox.ac.uk/fsl/fdt/fdt_thresh.html> Example ------- >>> from nipype.interfaces import fsl >>> ldir = ['seeds_to_M1.nii', 'seeds_to_M2.nii'] >>> pThresh = fsl.ProjThresh(in_files=ldir, thresho...
62598f92a79ad16197769cc6
class DeepCandidateFinder(): <NEW_LINE> <INDENT> def __init__(self, Embedding): <NEW_LINE> <INDENT> self.Embedding = Embedding <NEW_LINE> <DEDENT> def get_candidates(self, s, seed, n, min_similarity = 0.5): <NEW_LINE> <INDENT> seed_list = wiki_search(s, seed, 1) <NEW_LINE> if len(seed_list) == 0: <NEW_LINE> <INDENT> pr...
Candidate finder based on querying nearest neighbors from a semantic embedding of wikidata items
62598f92be8e80087fbbecc4
class fail_to_fill_col_err(AgeAppendingError): <NEW_LINE> <INDENT> pass
To Be called if trying to fill a column and fails.
62598f92596a8972361278e3
class GeoPoint(object): <NEW_LINE> <INDENT> def __init__(self, latitude, longitude): <NEW_LINE> <INDENT> self.latitude = latitude <NEW_LINE> self.longitude = longitude <NEW_LINE> <DEDENT> def to_protobuf(self): <NEW_LINE> <INDENT> return latlng_pb2.LatLng(latitude=self.latitude, longitude=self.longitude) <NEW_LINE> <DE...
Simple container for a geo point value. :type latitude: float :param latitude: Latitude of a point. :type longitude: float :param longitude: Longitude of a point.
62598f928e71fb1e983bb71b
class FizzBuzzClassTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_fizz_1(self): <NEW_LINE> <INDENT> self.assertEqual(fizz_buzz(3), 'Fizz', msg='should return `Fizz` for number divisible by 3') <NEW_LINE> <DEDENT> def test_fizz_2(self): <NEW_LINE> <INDENT> self.assertEqual(fizz_buzz(33), 'Fizz', msg='should retur...
docstring for FizzBuzz
62598f920c0af96317c55fec
class PostController(Controller): <NEW_LINE> <INDENT> def __init__(self, ghost): <NEW_LINE> <INDENT> super(PostController, self).__init__(ghost, 'posts', model_type=Post) <NEW_LINE> <DEDENT> def create(self, **kwargs): <NEW_LINE> <INDENT> return super(PostController, self).create(**self._with_markdown(kwargs)) <NEW_LIN...
Controller extension for managing posts.
62598f92d486a94d0ba2bc3a
class BloomSkySensor(Entity): <NEW_LINE> <INDENT> def __init__(self, bs, device, sensor_name): <NEW_LINE> <INDENT> self._bloomsky = bs <NEW_LINE> self._device_id = device['DeviceID'] <NEW_LINE> self._sensor_name = sensor_name <NEW_LINE> self._name = '{} {}'.format(device['DeviceName'], sensor_name) <NEW_LINE> self._sta...
Representation of a single sensor in a BloomSky device.
62598f92c432627299fa2c39
class CreditCard_c30: <NEW_LINE> <INDENT> def __init__(self, customer, bank, acnt, limit): <NEW_LINE> <INDENT> self.__customer = customer <NEW_LINE> self.__bank = bank <NEW_LINE> self.__account = acnt <NEW_LINE> self.__limit = limit <NEW_LINE> self.__balance = 0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def customer(sel...
CreditCard with protected setters and private class members
62598f9229b78933be269f10