code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class GridStateActionSpace2D(StateActionSpace): <NEW_LINE> <INDENT> def __init__(self, dimensions = (3,1), allow_diag_actions = True): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> half_dimensions = (np.array(dimensions)/2).astype(int) <NEW_LINE> self.min_indices = -half_dimensions <NEW_LINE> self.max_indices = sel... | Grid-based state-action space
Grid based state-action space. Each state and action is a tuple of two
integers. Constructed with the dimensions of the thing. | 62598fb599fddb7c1ca62e5e |
class TestScoringService(object): <NEW_LINE> <INDENT> def test_do_inferenceで推論値yが入力サンプル数分反映されていればTrue(self, do): <NEW_LINE> <INDENT> request_path = sd.joinpath('data', 'request_sample.json') <NEW_LINE> with open(request_path, 'r') as f: <NEW_LINE> <INDENT> request_data = json.load(f) <NEW_LINE> <DEDENT> from scoring_se... | 推論パイプラインの結合テスト
| 62598fb5167d2b6e312b705a |
class Model(AbstractModel, StaticChildrenMixin, StaticActionsMixin): <NEW_LINE> <INDENT> __slots__ = () | Static model with a known set of sub-models and actions. | 62598fb5379a373c97d990fd |
class HTTPException(BaseException): <NEW_LINE> <INDENT> pass | This class signals an error during the processing of a HTTP request | 62598fb54f6381625f199534 |
class SublayerConnection(nn.Module): <NEW_LINE> <INDENT> def __init__(self, size: int, dropout: float) -> None: <NEW_LINE> <INDENT> super(SublayerConnection, self).__init__() <NEW_LINE> self.norm = LayerNorm(size) <NEW_LINE> self.dropout = nn.Dropout(dropout) <NEW_LINE> <DEDENT> def forward(self, x: Tensor, sublayer: n... | A residual connection followed by a layer norm.
Notes:
for code simplicity the norm is first as opposed to last.
Attributes:
norm (LayerNorm): A normalization layer defined with `size`.
dropout (nn.Dropout): A dropout module used after the sublayer and before the residual connection. | 62598fb592d797404e388bd7 |
@add_start_docstrings( XLM_ROBERTA_START_DOCSTRING, ) <NEW_LINE> class XLMRobertaForMaskedLM(RobertaForMaskedLM): <NEW_LINE> <INDENT> config_class = XLMRobertaConfig | This class overrides [`RobertaForMaskedLM`]. Please check the superclass for the appropriate documentation
alongside usage examples. | 62598fb5e5267d203ee6b9e6 |
class CommentDetailsForm(CommentSecurityForm): <NEW_LINE> <INDENT> comment = forms.CharField(widget=forms.Textarea, max_length=COMMENT_MAX_LENGTH) <NEW_LINE> def get_comment_object(self): <NEW_LINE> <INDENT> if not self.is_valid(): <NEW_LINE> <INDENT> raise ValueError("get_comment_object may only be called on val... | Handles the specific details of the comment (name, comment, etc.). | 62598fb5ec188e330fdf8978 |
class PBSProResourceDefinition: <NEW_LINE> <INDENT> def __init__( self, name: str, resource_type: ResourceType, flag: ResourceFlag ) -> None: <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.type = resource_type <NEW_LINE> self.flag = "".join(sorted(flag)) <NEW_LINE> self.__flag_simplified = self.flag.replace("m", ... | Resource slot_type
type = string
flag = h | 62598fb5dc8b845886d5369f |
class RuleStorage: <NEW_LINE> <INDENT> def __init__(self, module_name, f_name, annotator_info): <NEW_LINE> <INDENT> self.module_name = module_name <NEW_LINE> self.f_name = f_name <NEW_LINE> self.annotator_info = annotator_info <NEW_LINE> self.target_name = f"{module_name}:{f_name}" <NEW_LINE> self.rule_name = f"{module... | Object to store parameters for a snake rule. | 62598fb54c3428357761a3a2 |
class AppConfig() : <NEW_LINE> <INDENT> def __init__(self, appName) : <NEW_LINE> <INDENT> self._systemSettings = None <NEW_LINE> self._userPrefs = None <NEW_LINE> self.project = appName <NEW_LINE> self.variable = appName.upper() + "_CONF" <NEW_LINE> self._fileName = appName + ".yaml" <NEW_LINE> self.systemDir =... | AppConfig is an application configuration file management
appName is the application name
configuration file name is appName + ".yaml"
which is searched in these places and order:
1. from environment variable $'AppNme'
2. current directory
3. /etc/'AppName'/
Application user preferences are loaded and saved into
~/.con... | 62598fb55fcc89381b2661c0 |
class Paralleliser(object): <NEW_LINE> <INDENT> def __init__(self, inputs, paralleliserInfo): <NEW_LINE> <INDENT> self.doneCheckers = []; <NEW_LINE> self.paralleliserState = ParalleliserState.NOT_STARTED; <NEW_LINE> self.inputs = inputs; <NEW_LINE> self.paralleliserInfo = paralleliserInfo; <NEW_LINE> <DEDENT> def execu... | takes an instance of paralleliserInfo (which contains info on how to kick off the jobs) and
a series of inputs, and executes the jobs in parallel. | 62598fb521bff66bcd722d50 |
class CurveDirection(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "curve.switch_direction_obm" <NEW_LINE> bl_label = "Curve Direction" <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> bpy.ops.object.editmode_toggle() <NEW_LINE> bpy.ops.curve.switch_direction() <NEW_LINE> bpy.ops.object.editmode_toggle... | switch curve direction | 62598fb5a8370b77170f04c5 |
class Minc1Image(SpatialImage): <NEW_LINE> <INDENT> header_class = Minc1Header <NEW_LINE> _meta_sniff_len = 4 <NEW_LINE> valid_exts = ('.mnc',) <NEW_LINE> files_types = (('image', '.mnc'),) <NEW_LINE> _compressed_suffixes = ('.gz', '.bz2') <NEW_LINE> makeable = True <NEW_LINE> rw = False <NEW_LINE> ImageArrayProxy = Mi... | Class for MINC1 format images
The MINC1 image class uses the default header type, rather than a specific
MINC header type - and reads the relevant information from the MINC file on
load. | 62598fb501c39578d7f12e62 |
class RandomAgent(AbstractAgent): <NEW_LINE> <INDENT> def __init__(self, player): <NEW_LINE> <INDENT> self._player = player <NEW_LINE> <DEDENT> @property <NEW_LINE> def player(self) -> Player: <NEW_LINE> <INDENT> return self._player <NEW_LINE> <DEDENT> def choose_move(self, game: GameModel, opponent_move: Optional[Move... | An agent which picks a random move | 62598fb563d6d428bbee2896 |
@add_metaclass(type) <NEW_LINE> class HostData(object): <NEW_LINE> <INDENT> def __init__(self, uuid, name, status, result): <NEW_LINE> <INDENT> self.uuid = uuid <NEW_LINE> self.name = name <NEW_LINE> self.status = status <NEW_LINE> self.result = result <NEW_LINE> self.finish = time.time() | Data about an individual host. | 62598fb530bbd722464699ed |
class PolarPoint: <NEW_LINE> <INDENT> COORDINATE_ORDER = ('NEZ', 'ENZ') <NEW_LINE> def __init__(self, dist, angle, z_angle, th, angle_type, base_point, pid, text, coordorder): <NEW_LINE> <INDENT> self.dist = float(dist) <NEW_LINE> angle = float(angle) <NEW_LINE> z_angle = float(z_angle) <NEW_LINE> self.th = float(th) <... | A point geometry defined by polar coordinates. | 62598fb571ff763f4b5e785d |
class PercentFraction(types.TypeDecorator): <NEW_LINE> <INDENT> impl = types.Numeric(11, 10) <NEW_LINE> def load_dialect_impl(self, dialect): <NEW_LINE> <INDENT> if _is_mysql(dialect): <NEW_LINE> <INDENT> return mysql.DECIMAL(precision=11, scale=10, unsigned=True) <NEW_LINE> <DEDENT> return self.impl <NEW_LINE> <DEDENT... | Highly accurate percent fraction. | 62598fb57b25080760ed759b |
class MyException(Exception): <NEW_LINE> <INDENT> pass | Base class for custom exceptions. | 62598fb5a79ad1619776a154 |
class HGHBogusNumbersError(ValueError): <NEW_LINE> <INDENT> pass | Error which is raised when the HGH parameters contain f-type
or higher projectors. The HGH article only defines atomic Hamiltonian
matrices up to l=2, so these are meaningless. | 62598fb530dc7b766599f936 |
class TestUpperBound(GPflowTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.X = np.random.rand(100, 1) <NEW_LINE> self.Y = np.sin(1.5 * 2 * np.pi * self.X) + np.random.randn(*self.X.shape) * 0.1 <NEW_LINE> <DEDENT> def test_few_inducing_points(self): <NEW_LINE> <INDENT> with self.test_context() ... | Test for upper bound for regression marginal likelihood | 62598fb5460517430c4320d1 |
class TestInlineResponse20081Devices(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 testInlineResponse20081Devices(self): <NEW_LINE> <INDENT> pass | InlineResponse20081Devices unit test stubs | 62598fb567a9b606de5460b8 |
class raw_bdf: <NEW_LINE> <INDENT> def __init__(self, participant_id): <NEW_LINE> <INDENT> self.participant_id = participant_id <NEW_LINE> self.bdf_fname = data_dir + '/RAWEEG/%d_EmoWorM.bdf' % participant_id <NEW_LINE> <DEDENT> def plot_event_channel(self, show=False, save=True, plot_breaks=False, figsize=(20, 10)): <... | Class to handle the raw eeg data
Parameters
----------
participant_id : int
The id number for this participant | 62598fb57cff6e4e811b5b08 |
class AsyncRemotePillar(object): <NEW_LINE> <INDENT> def __init__(self, opts, grains, minion_id, saltenv, ext=None, functions=None, pillar=None, pillarenv=None): <NEW_LINE> <INDENT> self.opts = opts <NEW_LINE> self.opts['environment'] = saltenv <NEW_LINE> self.ext = ext <NEW_LINE> self.grains = grains <NEW_LINE> self.m... | Get the pillar from the master | 62598fb5009cb60464d0160b |
class WithingsAttribute: <NEW_LINE> <INDENT> def __init__( self, measurement: str, measure_type, friendly_name: str, unit_of_measurement: str, icon: str, ) -> None: <NEW_LINE> <INDENT> self.measurement = measurement <NEW_LINE> self.measure_type = measure_type <NEW_LINE> self.friendly_name = friendly_name <NEW_LINE> sel... | Base class for modeling withing data. | 62598fb5283ffb24f3cf3976 |
class CountSet(BaseCount.CountSet): <NEW_LINE> <INDENT> def day_totals(self): <NEW_LINE> <INDENT> return list(self.counts.values_list("day").annotate(total=Sum("count")).order_by("day")) <NEW_LINE> <DEDENT> def month_totals(self): <NEW_LINE> <INDENT> counts = self.counts.extra(select={"month": 'EXTRACT(month FROM "day"... | A queryset of counts which can be aggregated in different ways | 62598fb5d486a94d0ba2c0bb |
class BedFile: <NEW_LINE> <INDENT> def __init__(self, filename, referenceGenome, flankLength): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.peakBoundaries = {} <NEW_LINE> self.raw = BedTool(self.filename) <NEW_LINE> self.merged = self.raw.sort().merge() <NEW_LINE> self.slopped = None <NEW_LINE> self.chr... | API for processing BedFiles | 62598fb5fff4ab517ebcd8d0 |
class DetailView(generic.DetailView): <NEW_LINE> <INDENT> model=Question <NEW_LINE> template_name='polls/detail.html' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return Question.objects.filter(pub_date__lte=timezone.now()) | 显示明细 model也是django内置的属性-模型 | 62598fb599fddb7c1ca62e5f |
class Fringe: <NEW_LINE> <INDENT> def __init__(self, s): <NEW_LINE> <INDENT> self.structure = s() <NEW_LINE> assert ('push' in dir(s) and 'pop' in dir(s) and 'isEmpty' in dir(s)) <NEW_LINE> <DEDENT> def push(self, item, base, cost): <NEW_LINE> <INDENT> self.structure.push(item) if cost == 0 else self.structure.push( it... | Allows for a very (very) pretty abstraction, wherein the implementation
of graph search doesn't change, the user just decides which fringe type to
use. Stack will run DFS, Queue will run BFS, priority queues will run either UCS
or A*, depending on the cost function. | 62598fb5167d2b6e312b705c |
class MovieListViewTest(TransactionTestCase): <NEW_LINE> <INDENT> reset_sequences = True <NEW_LINE> @freeze_time("2012-01-14") <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> self.user = User.objects.create_user('hiren', 'a@b.com', 'bunny') <NEW_LINE> self.client.force_authenticate(... | Test movie list view | 62598fb555399d3f056265fe |
class BeamType(Container): <NEW_LINE> <INDENT> allowed_enclosed_commands = ['Correlation'] <NEW_LINE> command_params = { 'partnum': { 'desc': 'Particle number', 'doc': '', 'type': 'Integer', 'req': True, 'default': None}, 'bmtype': { 'desc': 'beam type {magnitude = mass code; sign = charge}: 1: e, 2: μ, 3: π, 4: K, 5: ... | A BeamType is a:
(1) PARTNUM (I) particle number
(2) BMTYPE (I) beam type {magnitude = mass code; sign = charge}
1: e
2: μ
3: π
4: K
5: p
6: d
7: He3
8: Li7
(3) FRACBT (R) fraction of beam of this type {0-1} The sum of all fracbt(i) should =1.0
(4) Distribution
(5) NBCORR # of beam corre... | 62598fb55fc7496912d482f0 |
class Annotator(db.Model): <NEW_LINE> <INDENT> __tablename__ = "annotator" <NEW_LINE> id = db.Column(db.Integer, autoincrement=True, primary_key=True) <NEW_LINE> name = db.Column(db.Text) <NEW_LINE> task_id = db.Column(db.Integer, db.ForeignKey('annotation_task.id'), nullable=False) <NEW_LINE> token = db.Column(db.Text... | Annotator Class | 62598fb57047854f4633f4c5 |
class EchoReader(): <NEW_LINE> <INDENT> def __init__(self, infile='', associatedchannel=''): <NEW_LINE> <INDENT> self.infile = infile <NEW_LINE> self.associatedchannel = associatedchannel <NEW_LINE> self.uniques = {';': 'UNIQ_' + self.get_unique_string() + '_QINU', ':': 'UNIQ_' + self.get_unique_string() + '_QINU', ','... | Essentially an initalization class | 62598fb5851cf427c66b83a0 |
class Log(models.Model): <NEW_LINE> <INDENT> team = models.ForeignKey(Team) <NEW_LINE> lat = models.FloatField() <NEW_LINE> lon = models.FloatField() <NEW_LINE> def get_owner_object(self): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> def __unicode__(self): <NEW_LINE> <INDENT> return self.name | Model for a GPS log entry | 62598fb521bff66bcd722d52 |
class MetadataBlock: <NEW_LINE> <INDENT> def __init__(self, metadata, action_pairs, start_time, runtime): <NEW_LINE> <INDENT> self.metadata = metadata <NEW_LINE> self.action_pairs = action_pairs <NEW_LINE> self.start_time = start_time <NEW_LINE> self.runtime = runtime <NEW_LINE> <DEDENT> def desc(self, sep='\n'): <NEW_... | List of Metadata corresponding to a AnimationBlock
Args:
metadata (Metadata[]): List of Metadata corresponding to the animations of the block
action_pairs (AlgoSceneActionPairs[])
start_time (float)
run_time (float): Total runtime of all the animations in the block | 62598fb5cc40096d6161a24e |
class AnswerBase(object): <NEW_LINE> <INDENT> def __init__(self, vctx, location, name, answers_desc): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.answers_desc = answers_desc <NEW_LINE> self.required = getattr(answers_desc, "required", False) <NEW_LINE> <DEDENT> def get_correct_answer_text(self, page_context): ... | Abstract interface for answer class of different type.
.. attribute:: type
.. attribute:: form_field_class | 62598fb516aa5153ce4005ee |
class GsInlineDiffStageOrResetBase(TextCommand, GitCommand): <NEW_LINE> <INDENT> def run(self, edit, **kwargs): <NEW_LINE> <INDENT> sublime.set_timeout_async(lambda: self.run_async(**kwargs), 0) <NEW_LINE> <DEDENT> def run_async(self, reset=False): <NEW_LINE> <INDENT> in_cached_mode = self.view.settings().get("git_savv... | Base class for any stage or reset operation in the inline-diff view.
Determine the line number of the current cursor location, and use that
to determine what diff to apply to the file (implemented in subclass). | 62598fb563d6d428bbee2898 |
class ApiGetFlowResultsExportCommandHandlerRegressionTest( api_regression_test_lib.ApiRegressionTest): <NEW_LINE> <INDENT> api_method = "GetFlowResultsExportCommand" <NEW_LINE> handler = flow_plugin.ApiGetFlowResultsExportCommandHandler <NEW_LINE> def Run(self): <NEW_LINE> <INDENT> client_id = self.SetupClient(0) <NEW_... | Regression test for ApiGetFlowResultsExportCommandHandler. | 62598fb55fdd1c0f98e5e079 |
class LineCollection(Collection): <NEW_LINE> <INDENT> _edge_default = True <NEW_LINE> def __init__(self, segments, linewidths=None, colors=None, antialiaseds=None, linestyles='solid', offsets=None, transOffset=None, norm=None, cmap=None, pickradius=5, zorder=2, facecolors='none', **kwargs ): <NEW_LINE> <INDENT> if colo... | All parameters must be sequences or scalars; if scalars, they will
be converted to sequences. The property of the ith line
segment is::
prop[i % len(props)]
i.e., the properties cycle if the ``len`` of props is less than the
number of segments. | 62598fb5a8370b77170f04c7 |
class UserPrivacySettingRuleRestrictChatMembers(Object): <NEW_LINE> <INDENT> ID = "userPrivacySettingRuleRestrictChatMembers" <NEW_LINE> def __init__(self, chat_ids, **kwargs): <NEW_LINE> <INDENT> self.chat_ids = chat_ids <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def read(q: dict, *args) -> "UserPrivacySettingRuleRe... | A rule to restrict all members of specified basic groups and supergroups from doing something
Attributes:
ID (:obj:`str`): ``UserPrivacySettingRuleRestrictChatMembers``
Args:
chat_ids (List of :obj:`int`):
The chat identifiers, total number of chats in all rules must not exceed 20
Returns:
UserP... | 62598fb58a349b6b43686326 |
class Bootstrap(object): <NEW_LINE> <INDENT> def __init__(self, conf): <NEW_LINE> <INDENT> self.conf = conf <NEW_LINE> self.conf.register_opts(_GENERAL_OPTIONS) <NEW_LINE> self.conf.register_opts(_DRIVER_OPTIONS, group=_DRIVER_GROUP) <NEW_LINE> self.driver_conf = self.conf[_DRIVER_GROUP] <NEW_LINE> log.setup('marconi')... | Defines the Marconi bootstrapper.
The bootstrap loads up drivers per a given configuration, and
manages their lifetimes. | 62598fb57b25080760ed759d |
class SignUpCfsServiceRequest(AbstractModel): <NEW_LINE> <INDENT> pass | SignUpCfsService request structure.
| 62598fb54f88993c371f0581 |
class ExponentStyle(Style): <NEW_LINE> <INDENT> default_style = '' <NEW_LINE> background_color = BACKGROUND <NEW_LINE> highlight_color = SELECTION <NEW_LINE> styles = { Comment: COMMENT, Text: FOREGROUND, Keyword: BLUE, Keyword.Type: YELLOW, Operator.Word: ... | Exponent color scheme, based on the Tomorrow theme. | 62598fb5d268445f26639bf9 |
class getFilePath_result(object): <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRING, 'success', 'UTF8', None, ), (1, TType.STRUCT, 'rnfEx', (ResourceNotFoundException, ResourceNotFoundException.thrift_spec), None, ), (2, TType.STRUCT, 'svEx', (ServerLogicException, ServerLogicException.thrift_spec), None, ), ) <NEW_... | Attributes:
- success
- rnfEx
- svEx | 62598fb599fddb7c1ca62e60 |
class Game(GameBase): <NEW_LINE> <INDENT> home_team = models.ForeignKey(School, related_name="boys_basketball_home_team", null=True) <NEW_LINE> away_team = models.ForeignKey(School, related_name="boys_basketball_away_team", null=True) <NEW_LINE> season ... | A representation of a Boys Basketball game. | 62598fb53346ee7daa3376bd |
class MultipleFormView(TemplateView): <NEW_LINE> <INDENT> form_classes = {} <NEW_LINE> form_instances = {} <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(MultipleFormView, self).get_context_data(**kwargs) <NEW_LINE> forms_initialized = {"forms": {}} <NEW_LINE> for name, obj in self... | View mixin that handles multiple forms / formsets.
After the successful data is inserted ``self.process_forms`` is called. | 62598fb5ff9c53063f51a739 |
class MetricPlugin: <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> NAME = '' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.name = self.NAME <NEW_LINE> self._value = 0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def value(self): <NEW_LINE> <INDENT> self._value = self._collect_metric() <NEW_LINE> return se... | This class provides a basic structure for all metric plugins | 62598fb59f288636728188af |
class TEST25(PMEM2_INTEGRATION): <NEW_LINE> <INDENT> test_case = "test_deep_flush_e_range_before" | test deep flush with range out of map | 62598fb5a219f33f346c68f0 |
class Zone: <NEW_LINE> <INDENT> zone_id = None <NEW_LINE> sync_token = None <NEW_LINE> atomic = False <NEW_LINE> def __init__(self, json=None): <NEW_LINE> <INDENT> if json is not None: <NEW_LINE> <INDENT> self.zone_id = ZoneID(parse(json, 'zoneID')) <NEW_LINE> self.sync_token = parse(json, 'syncToken') <NEW_LINE> self.... | A zone dictionary describes a successful zone fetch. | 62598fb5a17c0f6771d5c321 |
class TaskRerun(BaseClass): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(TaskRerun, self).__init__() <NEW_LINE> <DEDENT> def do(self): <NEW_LINE> <INDENT> hour = int(time.strftime("%H", time.localtime())) <NEW_LINE> if hour <= 6 or hour >= 22: <NEW_LINE> <INDENT> self.log.error("The current time pr... | rerun | 62598fb5d7e4931a7ef3c181 |
class BatchedCalls(object): <NEW_LINE> <INDENT> def __init__(self, iterator_slice, backend_and_jobs, reducer_callback=None, pickle_cache=None): <NEW_LINE> <INDENT> self.items = list(iterator_slice) <NEW_LINE> self._size = len(self.items) <NEW_LINE> self._reducer_callback = reducer_callback <NEW_LINE> if isinstance(back... | Wrap a sequence of (func, args, kwargs) tuples as a single callable | 62598fb53539df3088ecc398 |
class FlipTest(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api_base_domain = 'api.fake-host.com' <NEW_LINE> self.rotation = ['red', 'black', 'turquoise'] <NEW_LINE> self.current_stage = 'black' <NEW_LINE> self.next_stage = 'turquoise' <NEW_LINE> <DEDENT> @pytest.mark.skip(reason="moto does ... | TestCase class for testing flip.py | 62598fb5b7558d5895463719 |
class ItemData(RESTPayload, ImageData): <NEW_LINE> <INDENT> item_id: int <NEW_LINE> item_type_id: Optional[int] = None <NEW_LINE> item_category_id: Optional[int] = None <NEW_LINE> activatable_ability_id: Optional[int] = None <NEW_LINE> passive_ability_id: Optional[int] = None <NEW_LINE> is_vehicle_weapon: bool <NEW_LIN... | Data class for :class:`auraxium.ps2.Item`.
This class mirrors the payload data returned by the API, you may
use its attributes as keys in filters or queries. | 62598fb563b5f9789fe85258 |
class MockDropTable: <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.query = 'DROP TABLE IF EXISTS {};'.format(name) <NEW_LINE> <DEDENT> def __call__(self): <NEW_LINE> <INDENT> return self.query | Mocking a drop table MySQL query. | 62598fb6a79ad1619776a158 |
class PayByTxnError(Exception): <NEW_LINE> <INDENT> pass | Custom error class: thrown when the 'PAY BY" transaction cannot be found. | 62598fb65166f23b2e2434c7 |
class Input(Placeholder): <NEW_LINE> <INDENT> def __init__(self, function_handle, index=0, order=0, exponent=1): <NEW_LINE> <INDENT> if not isinstance(function_handle, collections.Callable): <NEW_LINE> <INDENT> raise TypeError("callable object has to be provided.") <NEW_LINE> <DEDENT> if not isinstance(index, int) or i... | Class that works as a placeholder for an input of the system.
Args:
function_handle (callable): Handle that will be called by the simulation
unit.
index (int): If the system's input is vectorial, specify the element to
be used.
order (int): temporal derivative order of this term
(Se... | 62598fb65fdd1c0f98e5e07b |
class DatabaseAppsRouter(object): <NEW_LINE> <INDENT> def db_for_read(self, model, **hints): <NEW_LINE> <INDENT> if model._meta.app_label in DATABASE_MAPPING: <NEW_LINE> <INDENT> return DATABASE_MAPPING[model._meta.app_label] <NEW_LINE> <DEDENT> return None <NEW_LINE> <DEDENT> def db_for_write(self, model, **hints): <N... | A router to control all database operations on models for different
databases.
In case an app is not set in settings.APP2DATABASE_MAPPING, the router
will fallback to the `default` database.
Settings example:
APP2DATABASE_MAPPING = {'app1': 'db1', 'app2': 'db2'} | 62598fb6e1aae11d1e7ce89a |
class Question: <NEW_LINE> <INDENT> def __init__(self, answer: str, question: str, options: list, init_text: str): <NEW_LINE> <INDENT> self.answer = answer <NEW_LINE> self.question = question <NEW_LINE> self.options = options <NEW_LINE> self.init_text = init_text <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDE... | This class represents the Question object.
Args:
answer: str, answer for the question
question: str, question (init_text with replaced similar words
options: list, list of 4 possible options for a given question
init_text: str, original text | 62598fb6097d151d1a2c111c |
class Solution: <NEW_LINE> <INDENT> def countCornerRectangles(self, grid): <NEW_LINE> <INDENT> if not grid: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> m,n = len(grid),len(grid[0]) <NEW_LINE> res = 0 <NEW_LINE> for i in range(m-1): <NEW_LINE> <INDENT> for j in range(n-1): <NEW_LINE> <INDENT> if grid[i][j] == 0: <N... | @param grid: the grid
@return: the number of corner rectangles | 62598fb601c39578d7f12e66 |
class Status: <NEW_LINE> <INDENT> SUCCESS = 'SUCCESS' <NEW_LINE> FAILED = 'FAILED' | CloudFormation custom resource status constants
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref-responses.html | 62598fb6442bda511e95c546 |
class Node: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.left = self.right = self.parent = None <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f'{self.data}' | Node class with a pointer to its parent | 62598fb64f6381625f199537 |
class Generator(object): <NEW_LINE> <INDENT> def __init__(self, base_path): <NEW_LINE> <INDENT> self.base_path = base_path <NEW_LINE> if not os.path.exists(os.path.join(self.base_path, "slide01.svg")): <NEW_LINE> <INDENT> raise ValueError("Directory does not appear to contain slides") <NEW_LINE> <DEDENT> self.type_path... | Generates PDF and PNG output from a set of slide SVGs. | 62598fb67047854f4633f4c8 |
class exists_args(object): <NEW_LINE> <INDENT> def __init__(self, id=None,): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: <NEW_LINE> <INDENT> ... | Attributes:
- id | 62598fb6796e427e5384e881 |
class VirtualMotorCenterAndGap(Device): <NEW_LINE> <INDENT> xc = Cpt(VirtualCenter, '-Ax:X}') <NEW_LINE> yc = Cpt(VirtualCenter, '-Ax:Y}') <NEW_LINE> xg = Cpt(VirtualGap, '-Ax:X}') <NEW_LINE> yg = Cpt(VirtualGap, '-Ax:Y}') | Center and gap with virtual motors | 62598fb692d797404e388bda |
class Section(MutableMapping): <NEW_LINE> <INDENT> def __init__(self, namespace, *args, **kwargs): <NEW_LINE> <INDENT> super(Section, self).__init__(*args, **kwargs) <NEW_LINE> self.namespace = namespace <NEW_LINE> self.__storage__ = dict() <NEW_LINE> <DEDENT> def __setitem__(self, name, value): <NEW_LINE> <INDENT> sel... | Representation of INI section. | 62598fb6bd1bec0571e15139 |
class StandardTableaux(SemistandardTableaux): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def __classcall_private__(cls, *args, **kwargs): <NEW_LINE> <INDENT> from sage.combinat.partition import _Partitions, Partition <NEW_LINE> from sage.combinat.skew_partition import SkewPartitions <NEW_LINE> if args: <NEW_LINE> <IN... | A factory for the various classes of standard tableaux.
INPUT:
- Either a non-negative integer (possibly specified with the keyword ``n``)
or a partition.
OUTPUT:
- With no argument, the class of all standard tableaux
- With a non-negative integer argument, ``n``, the class of all standard
tableaux of size ``n... | 62598fb6aad79263cf42e8c2 |
class WidthOneDense(keras.layers.Layer): <NEW_LINE> <INDENT> def __init__(self, input_dim, units, activation=None, trainable=True): <NEW_LINE> <INDENT> super(WidthOneDense, self).__init__() <NEW_LINE> dim = int(np.sqrt(input_dim)) <NEW_LINE> mask = tf.cast(tf.linalg.band_part(tf.ones([dim, dim]),0,-1), dtype=tf.bool) <... | Usage: layer = WidthOneDense(n**2, 1)
where n is the number of sections for different ks
n = 5 for k = 1
n = 15 for k = 2
n = 35 for k = 3
This layer is used directly after Bihomogeneous_k layers to sum over all
the terms in the previous layer. The weights are initialized so that the h
matr... | 62598fb65fc7496912d482f2 |
class Ensemble(object): <NEW_LINE> <INDENT> def __init__(self, name, verbose=False): <NEW_LINE> <INDENT> self.Name = name <NEW_LINE> self.Type = 'custom' <NEW_LINE> self.Run = self.init_run(verbose) <NEW_LINE> self.TCString = self.Run.TCString <NEW_LINE> self.Data = self.load_data() <NEW_LINE> self.Runs = self.init_run... | General enseble class for runs. | 62598fb64a966d76dd5eefc5 |
class FeedTagsTestCase(TestCase): <NEW_LINE> <INDENT> @patch.object(TagsFeeder, "feed") <NEW_LINE> @patch("dakara_feeder.__main__.load_feeder_securely") <NEW_LINE> @patch("dakara_feeder.__main__.load_config_securely") <NEW_LINE> def test_feed( self, mocked_load_config, mocked_load_feeder, mocked_feed, ): <NEW_LINE> <IN... | Test the feed tags subcommand. | 62598fb6a79ad1619776a15a |
class EntityAvailabilityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> AVAILABLE = "Available" <NEW_LINE> LIMITED = "Limited" <NEW_LINE> RENAMING = "Renaming" <NEW_LINE> RESTORING = "Restoring" <NEW_LINE> UNKNOWN = "Unknown" | Entity availability status.
| 62598fb6460517430c4320d4 |
class LoggingMixin(): <NEW_LINE> <INDENT> def __init__(self, message, project_name): <NEW_LINE> <INDENT> self.message = message <NEW_LINE> self.goggingfile_location = BASE_DIR + "logs/" + project_name + ".log" <NEW_LINE> self.logger = logging.getLogger('django-helper') <NEW_LINE> self.logger.setLevel(logging.DEBUG) <NE... | Provides full logging of requests and responses | 62598fb6a05bb46b3848a959 |
class MainMenuController(ConsoleController): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> entries = [TextMenuEntry("Start", self.startGame), TextMenuEntry("Options", self.runOptions), TextMenuEntry("Exit", self.stopRunning)] <NEW_LINE> self.menu = Menu(entries) <NEW_LINE> screen = MainMenuScreen(self.men... | Controller for the main menu | 62598fb6bf627c535bcb158f |
class DatasetProcessor(object): <NEW_LINE> <INDENT> def __init__(self, input_directory, output_file=None, max_size=None, parallel=True): <NEW_LINE> <INDENT> self.file_queue = self.paths_to_process(input_directory, max_size) <NEW_LINE> self.output = self.output_filename(input_directory, output_file) <NEW_LINE> self.para... | A tool to for creation of data matrix from the annotated PCAP files. | 62598fb6be8e80087fbbf156 |
class Port(NetworkNotificationBase, plugin_base.NonMetricNotificationBase): <NEW_LINE> <INDENT> resource_name = 'port' | Listen for Neutron notifications.
Handle port.{create.end|update.*|exists} notifications from neutron. | 62598fb6a8370b77170f04cc |
class MI_Platform(object): <NEW_LINE> <INDENT> def __init__(self, plt=None): <NEW_LINE> <INDENT> self.instruments = [] <NEW_LINE> if plt is None: <NEW_LINE> <INDENT> self.identifier = None <NEW_LINE> self.description = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> val = plt.find(util.nspath_eval('gmi:identifier', ... | Process gmi:MI_Platform | 62598fb64a966d76dd5eefc6 |
class Radio(BasePageWidget): <NEW_LINE> <INDENT> def __init__(self, owner, locatordict): <NEW_LINE> <INDENT> self._values = locatordict <NEW_LINE> super(Radio,self).__init__(owner, None) <NEW_LINE> <DEDENT> def _updateLocators(self): <NEW_LINE> <INDENT> self._locvalues = {} <NEW_LINE> for (textkey,locatorid) in self._v... | this object has no locatorid or locator,
all the information is in locatordict | 62598fb6cc0a2c111447b0fe |
class Reg8Bit(VarReg): <NEW_LINE> <INDENT> def __init__(self, reg): <NEW_LINE> <INDENT> super(Reg8Bit, self).__init__(reg, 1) | An 8-bit register | 62598fb6fff4ab517ebcd8d5 |
class TaskflowAPIAuthentication(BaseAuthentication): <NEW_LINE> <INDENT> def authenticate(self, request): <NEW_LINE> <INDENT> taskflow_secret = None <NEW_LINE> if request.method == 'POST' and 'sodar_secret' in request.POST: <NEW_LINE> <INDENT> taskflow_secret = request.POST['sodar_secret'] <NEW_LINE> <DEDENT> elif requ... | Taskflow API authentication handling | 62598fb623849d37ff8511a1 |
class MucRoomUser: <NEW_LINE> <INDENT> def __init__(self,presence_or_user_or_jid): <NEW_LINE> <INDENT> if isinstance(presence_or_user_or_jid,MucRoomUser): <NEW_LINE> <INDENT> self.presence=presence_or_user_or_jid.presence <NEW_LINE> self.role=presence_or_user_or_jid.role <NEW_LINE> self.affiliation=presence_or_user_or_... | Describes a user of a MUC room.
The attributes of this object should not be changed directly.
:Ivariables:
- `presence`: last presence stanza received for the user.
- `role`: user's role.
- `affiliation`: user's affiliation.
- `room_jid`: user's room jid.
- `real_jid`: user's real jid or None if n... | 62598fb6f548e778e596b693 |
class Admin(object): <NEW_LINE> <INDENT> def __init__(self, app=None, name=None, url=None, subdomain=None, index_view=None, translations_path=None, endpoint=None, static_url_path=None, base_template=None, template_mode=None): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> self.translations_path = translations_path <NEW_... | Collection of the admin views. Also manages menu structure. | 62598fb6097d151d1a2c111e |
class ListUsersViewSet(viewsets.GenericViewSet, mixins.ListModelMixin): <NEW_LINE> <INDENT> queryset = User.objects.all() <NEW_LINE> serializer_class = UserSerializer <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return self.queryset | List users | 62598fb67d43ff248742747a |
class HelperTests(TestCase): <NEW_LINE> <INDENT> def _load_fixture(self, fixture_name): <NEW_LINE> <INDENT> self._ids = {} <NEW_LINE> for col in ['Project', 'VCSSystem', 'File', 'Commit', 'FileAction', 'CodeEntityState', 'Hunk']: <NEW_LINE> <INDENT> module = importlib.import_module('visualSHARK.models') <NEW_LINE> obj ... | This tests the helpers. | 62598fb699cbb53fe6830fc5 |
class ScansTSV: <NEW_LINE> <INDENT> def __init__(self, scans_tsv_file, acquisition_file, verbose): <NEW_LINE> <INDENT> self.verbose = verbose <NEW_LINE> self.scans_tsv_file = scans_tsv_file <NEW_LINE> self.acquisition_file = acquisition_file <NEW_LINE> self.tsv_entries = utilities.read_tsv_file(self.scans_tsv_file) <... | This class reads the BIDS sub-XXX_scans.tsv file that includes acquisition level information
such as scan date or age at scan...
:Example:
from lib.scanstsv import ScansTSV
scan_info = ScansTSV(scans_tsv_file, acquisition_file)
acquisition_time = scan_info.get_acquisition_time()
age_at_scan = sc... | 62598fb67b180e01f3e490c8 |
class Seasson(models.Model): <NEW_LINE> <INDENT> name = models.CharField(u'Name', max_length=50) <NEW_LINE> from_date = models.DateField(u'From date') <NEW_LINE> to_date = models.DateField(u'To date', null=True) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.name | A seasson for the plate. | 62598fb667a9b606de5460bf |
class Fim(AFNICommand): <NEW_LINE> <INDENT> _cmd = '3dfim+' <NEW_LINE> input_spec = FimInputSpec <NEW_LINE> output_spec = AFNICommandOutputSpec | Program to calculate the cross-correlation of an ideal reference
waveform with the measured FMRI time series for each voxel.
For complete details, see the `3dfim+ Documentation.
<https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dfim+.html>`_
Examples
========
>>> from nipype.interfaces import afni
>>> fim = afni... | 62598fb67047854f4633f4ca |
class UserCreationForm(forms.ModelForm): <NEW_LINE> <INDENT> password1 = forms.CharField(label='Password', widget=forms.PasswordInput) <NEW_LINE> password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = ClanUser <NEW_LINE> fields = ('disco... | A form for creating new users. Includes all the required
fields, plus a repeated password. | 62598fb6a219f33f346c68f4 |
class CompositeOutputDevice(SourceMixin, CompositeDevice): <NEW_LINE> <INDENT> def on(self): <NEW_LINE> <INDENT> for device in self: <NEW_LINE> <INDENT> if isinstance(device, (OutputDevice, CompositeOutputDevice)): <NEW_LINE> <INDENT> device.on() <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def off(self): <NEW_LINE> <INDENT> ... | Extends :class:`CompositeDevice` with :meth:`on`, :meth:`off`, and
:meth:`toggle` methods for controlling subordinate output devices. Also
extends :attr:`value` to be writeable.
:param list _order:
If specified, this is the order of named items specified by keyword
arguments (to ensure that the :attr:`value` ... | 62598fb6ff9c53063f51a73d |
class ChargePreviewMetricsCmrr(object): <NEW_LINE> <INDENT> swagger_types = { 'discount': 'float', 'discount_delta': 'float', 'regular': 'float', 'regular_delta': 'float' } <NEW_LINE> attribute_map = { 'discount': 'discount', 'discount_delta': 'discountDelta', 'regular': 'regular', 'regular_delta': 'regularDelta' } <NE... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fb68e7ae83300ee918f |
class Xlsatoms(AutotoolsPackage): <NEW_LINE> <INDENT> homepage = "http://cgit.freedesktop.org/xorg/app/xlsatoms" <NEW_LINE> url = "https://www.x.org/archive/individual/app/xlsatoms-1.1.2.tar.gz" <NEW_LINE> version('1.1.2', '1f32e2b8c2135b5867291517848cb396') <NEW_LINE> depends_on('libxcb', when='@1.1:') <NEW_LINE>... | xlsatoms lists the interned atoms defined on an X11 server. | 62598fb6dc8b845886d536a7 |
class Undeletable(models.Model): <NEW_LINE> <INDENT> date_deleted = models.DateTimeField(blank=True) <NEW_LINE> objects = gw_managers.UndeletableManager() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> base_manager_name = 'objects' <NEW_LINE> <DEDENT> def delete(self, *args, **kwargs): <NEW_LINE>... | Replaces deletion of this model with updating of date_deleted.
NOTE: The instances can be normally deleted via Managers. | 62598fb65fc7496912d482f3 |
class FakeDoer(Doer): <NEW_LINE> <INDENT> def run(self, file_name): <NEW_LINE> <INDENT> return 'Hello' | A fake doer to test with as we can't directly instantiate the
:class:`.Doer` class. | 62598fb691f36d47f2230f20 |
class MQTTPublisher(): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def publish_temperature(serial): <NEW_LINE> <INDENT> if is_blank(serial): <NEW_LINE> <INDENT> raise IllegalArgumentException("serial is required") <NEW_LINE> <DEDENT> mqtt_id = ini_config.get("MQTT", "MQTT_CLIENT_ID") <NEW_LINE> user = ini_config.get("... | MQTT message publisher.
| 62598fb64c3428357761a3aa |
class BadParentTracker(AxonException): <NEW_LINE> <INDENT> pass | Parent tracker is bad (not actually a tracker?)
Possible causes:
- creating a coordinatingassistanttracker specifying a parent that is not
also a coordinatingassistanttracker? | 62598fb6377c676e912f6de6 |
class DatatypeException(Exception): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> message = "Error in common.datatypes: " + message <NEW_LINE> super().__init__(message) | Exception for errors relating to the datatypes in common.datatypes | 62598fb6d7e4931a7ef3c184 |
class ZhihuspiderItem(Item): <NEW_LINE> <INDENT> huati = Field() <NEW_LINE> question = Field() <NEW_LINE> author = Field() <NEW_LINE> content = Field() <NEW_LINE> voteup_count = Field() <NEW_LINE> answer_id = Field() <NEW_LINE> comment = Field() | son_href = Field()
son_name = Field()
son_content = Field()
topic_name = Field()
title = Field()
name = Field()
question_id = Field()
topic = Field() | 62598fb67d847024c075c4ab |
class OperationDefinition(Model): <NEW_LINE> <INDENT> _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, } <NEW_LINE> def __init__(self, *, name: str=None, display=None, **kwargs) -> None: <NEW_LINE> <INDENT> super(OperationDefinition, self)._... | The definition of a container registry operation.
:param name: Operation name: {provider}/{resource}/{operation}.
:type name: str
:param display: The display information for the container registry
operation.
:type display:
~azure.mgmt.containerregistry.v2017_03_01.models.OperationDisplayDefinition | 62598fb65fcc89381b2661c4 |
class Square: <NEW_LINE> <INDENT> def __init__(self, size=0): <NEW_LINE> <INDENT> if isinstance(size, int) is False: <NEW_LINE> <INDENT> raise TypeError("size must be an integer") <NEW_LINE> <DEDENT> if size < 0: <NEW_LINE> <INDENT> raise ValueError("size must be >= 0") <NEW_LINE> <DEDENT> self.__size = size | . | 62598fb61f5feb6acb162d0f |
class AutosysAny(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> for key, val in kwargs.items(): <NEW_LINE> <INDENT> exec("self." + key + '=val') | Creates an Autosys Job object with any and only the parameters specified by the user.
Args:
Any number of parameters that togeather constitute an AutosysJob object
Returns:
Instance of AutosysAny object | 62598fb61b99ca400228f5a8 |
class TestWithCallOnMatches(GetRunbooksToExecTest): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> self.target['runbooks']['book1']['actions'].update({ 'flop': {'call_on': ['OK', 'WARNING', 'CRITICAL'], 'trigger': 1, 'frequency': 0} }) <NEW_LINE> self.target['runbooks']['book1']['status']['OK'] = 1 <NEW_LIN... | Test when there are matching actions | 62598fb6a79ad1619776a15c |
class percent_not_minority_households_within_walking_distance(Variable): <NEW_LINE> <INDENT> _return_type="float32" <NEW_LINE> number_of_not_minority_households_within_walking_distance = "number_of_not_minority_households_within_walking_distance" <NEW_LINE> number_of_households_within_walking_distance ="number_of_house... | Percent of households within the walking radius that are designated as not minority.
[100 * (sum (over c in cell.entity_within_walking_radius) of (count of households hh placed in c such that is not minority)) /
(sum (over c in cell.entity_within_walking_radius) of (count of households hh placed in c))] | 62598fb616aa5153ce4005f4 |
class Cdecimal(AutotoolsPackage): <NEW_LINE> <INDENT> homepage = "https://www.bytereef.org/mpdecimal/" <NEW_LINE> url = "https://www.bytereef.org/software/mpdecimal/releases/cdecimal-2.3.tar.gz" <NEW_LINE> version('2.3', sha256='d737cbe43ed1f6ad9874fb86c3db1e9bbe20c0c750868fde5be3f379ade83d8b') <NEW_LINE> patch('d... | cdecimal is a fast drop-in replacement for the decimal module in
Python's standard library. | 62598fb6be383301e02538eb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.