code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Imagewang(tfds.core.GeneratorBasedBuilder): <NEW_LINE> <INDENT> BUILDER_CONFIGS = _make_builder_configs() <NEW_LINE> def _info(self): <NEW_LINE> <INDENT> names_file = tfds.core.get_tfds_path(_LABELS_FNAME) <NEW_LINE> return tfds.core.DatasetInfo( builder=self, description=_DESCRIPTION, features=tfds.features.Feat... | Imagewang contains Imagenette and Imagewoof combined. | 62598fb07c178a314d78d4e0 |
class TecnicoListCreate(generics.ListCreateAPIView): <NEW_LINE> <INDENT> queryset = Tecnico.objects.all() <NEW_LINE> serializer_class = TecnicoSerializer | Lista todos os técnicos ou cria um novo técnico | 62598fb0f548e778e596b5e7 |
class PhEDExInjectorPassableError(WMException): <NEW_LINE> <INDENT> pass | _PassableError_
Raised in cases where the error is sufficiently severe to terminate
the loop, but not severe enough to force us to crash the code.
Built to use with PhEDEx injection failures - if PhEDEx fails we should
terminate the loop, but continue to retry without terminating the entire
component. | 62598fb02c8b7c6e89bd3809 |
class LargestLastIndependentSet3: <NEW_LINE> <INDENT> def __init__(self, graph): <NEW_LINE> <INDENT> if graph.is_directed(): <NEW_LINE> <INDENT> raise ValueError("the graph is directed") <NEW_LINE> <DEDENT> self.graph = graph <NEW_LINE> for edge in self.graph.iteredges(): <NEW_LINE> <INDENT> if edge.source == edge.targ... | Find a maximal independent set. | 62598fb0adb09d7d5dc0a5ce |
class DummyRandomizer(object): <NEW_LINE> <INDENT> def _do_nothing(value, *args, **kwargs): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> relative = _do_nothing <NEW_LINE> absolute = _do_nothing <NEW_LINE> def factor(self, *args, **kwargs): <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> def term(self, *args, *... | docstring for DummyRandomizer | 62598fb001c39578d7f12dc3 |
class ConnectionLostEventTestCase(StatusEventTestCase): <NEW_LINE> <INDENT> CLASS = aggregator.ConnectionLostStatus <NEW_LINE> def test_many_message_built_correctly(self): <NEW_LINE> <INDENT> if self.status: <NEW_LINE> <INDENT> count = 99 <NEW_LINE> test_events = [FakeStatus(88)] * count + [self.CLASS()] <NEW_LINE> exp... | Test the event when the connection is lost. | 62598fb0a05bb46b3848a8af |
class PreEvent(AutoUnload): <NEW_LINE> <INDENT> def __init__(self, *event_names): <NEW_LINE> <INDENT> self._event_names = event_names <NEW_LINE> self._callback = None <NEW_LINE> <DEDENT> def __call__(self, callback): <NEW_LINE> <INDENT> self._callback = callback <NEW_LINE> for event_name in self._event_names: <NEW_LINE... | Pre-Event decorator class. | 62598fb0be383301e025383e |
class Cliente(models.Model): <NEW_LINE> <INDENT> domicilio = models.CharField(max_length=128) <NEW_LINE> email = models.CharField(max_length=50) <NEW_LINE> fechaalta = models.DateField(default=timezone.now) <NEW_LINE> nombre = models.CharField(max_length=128) <NEW_LINE> poblacion = models.CharField(max_length=128) <NEW... | Esta clase incluye los datos de un cliente | 62598fb0cc40096d6161a1fb |
class Divination(SubClass): <NEW_LINE> <INDENT> name = "School of Divination" <NEW_LINE> features_by_level = defaultdict(list) <NEW_LINE> features_by_level[2] = [features.DivinationSavant, features.Portent] <NEW_LINE> features_by_level[6] = [features.ExpertDivination] <NEW_LINE> features_by_level[10] = [features.TheThi... | The counsel of a diviner is sought by royalty and commoners alike, for all
seek a clearer understanding of the past, present, and future. As a
diviner, you strive to part the veils of space, time, and consciousness so
that you can see clearly. You work to master spells of discernment, remote
viewing, supernatural knowl... | 62598fb04e4d56256637246b |
class MultiLayerStatefulLSTMEncoder(ChainList): <NEW_LINE> <INDENT> def __init__(self, embed_size, hidden_size, num_layers): <NEW_LINE> <INDENT> super(MultiLayerStatefulLSTMEncoder, self).__init__() <NEW_LINE> self.add_link(links.LSTM(embed_size,hidden_size)) <NEW_LINE> for i in range(1, num_layers): <NEW_LINE> <INDENT... | This is an implementation of a Multilayered Stateful LSTM.
The underlying idea is to simply stack multiple LSTMs where the LSTM at the bottom takes the regular input,
and the LSTMs after that simply take the outputs (represented by h) of the previous LSMTs as inputs.
This is simply an analogous version of the Multilaye... | 62598fb05fcc89381b26616e |
class TestBlackwhite(unittest.TestCase): <NEW_LINE> <INDENT> def test_saved_output(self): <NEW_LINE> <INDENT> execute_and_test_output_images(self, CliRunner(), 3, 3, "save_", ["save"]) | Tests for `save` subcommand. | 62598fb0aad79263cf42e818 |
class Site(ptforum.Site): <NEW_LINE> <INDENT> def get_forum_page(self, forum): <NEW_LINE> <INDENT> xml = self.get_page('/forum/%s' % forum.forumId) <NEW_LINE> return xml <NEW_LINE> <DEDENT> def forum_page_posts(self, forum, page_xml): <NEW_LINE> <INDENT> xfeed = xml.etree.ElementTree.XML(page_xml) <NEW_LINE> if xfeed.t... | Atom feed | 62598fb0f7d966606f74802a |
class CompiledConstant(): <NEW_LINE> <INDENT> def __init__(self, constVal): <NEW_LINE> <INDENT> self.constantValue = constVal <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "CompiledConstant '{}'".format(self.constantValue) <NEW_LINE> <DEDENT> def execute(self, engine, caller): <NEW_LINE> <INDENT> en... | Compiled Constants is a primitive that will push a constant on the stack | 62598fb0fff4ab517ebcd82a |
class CourseStop(Base): <NEW_LINE> <INDENT> _din_file = "route.din" <NEW_LINE> version_id: Column[int] = Column("VERSION", Integer(), ForeignKey(Version.id), primary_key=True) <NEW_LINE> line: Column[int] = Column("LINE_NR", Integer(), primary_key=True) <NEW_LINE> course_id: Column[str] = Column("STR_LINE_VAR", String(... | Course stop
A single stop on a `Course`.
Primary key: `version_id` & `line` & `course_id` & `line_dir` & `consec_stop_nr` | 62598fb07047854f4633f41f |
class PairCompose(object): <NEW_LINE> <INDENT> def __init__(self, transforms): <NEW_LINE> <INDENT> self.transforms = transforms <NEW_LINE> <DEDENT> def __call__(self, *args): <NEW_LINE> <INDENT> for t in self.transforms: <NEW_LINE> <INDENT> args = t(*args) <NEW_LINE> <DEDENT> return args | Composes several transforms together.
Args:
transforms (list of ``Transform`` objects): list of transforms to compose.
Example:
>>> transforms.Compose([
>>> transforms.CenterCrop(10),
>>> transforms.ToTensor(),
>>> ]) | 62598fb023849d37ff8510f8 |
class WithTradingSessions(WithTradingCalendars, WithDefaultDateBounds): <NEW_LINE> <INDENT> DATA_MIN_DAY = alias('START_DATE') <NEW_LINE> DATA_MAX_DAY = alias('END_DATE') <NEW_LINE> trading_days = alias('nyse_sessions') <NEW_LINE> @classmethod <NEW_LINE> def init_class_fixtures(cls): <NEW_LINE> <INDENT> super(WithTradi... | ZiplineTestCase mixin providing cls.trading_days, cls.all_trading_sessions
as a class-level fixture.
After init_class_fixtures has been called, `cls.all_trading_sessions`
is populated with a dictionary of calendar name to the DatetimeIndex
containing the calendar trading days ranging from:
(DATA_MAX_DAY - (cls.TRADIN... | 62598fb026068e7796d4c99a |
class ListComputeHomes(command.Lister): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + '.ListComputeHomes') <NEW_LINE> def take_action(self, parsed_args): <NEW_LINE> <INDENT> self.log.debug('take_action(%s)', parsed_args) <NEW_LINE> client = self.app.client_manager.allocation <NEW_LINE> zones = client.zones.com... | List zones available to a allocation home | 62598fb02c8b7c6e89bd380a |
class TestCustomComplianceControlsApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = esp_sdk.apis.custom_compliance_controls_api.CustomComplianceControlsApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_add_custom_signature(self)... | CustomComplianceControlsApi unit test stubs | 62598fb063b5f9789fe851ad |
class BytesUntil(Parser): <NEW_LINE> <INDENT> def __init__(self, terminal): <NEW_LINE> <INDENT> self.buffer = UnsizedParserBuffer(terminal) <NEW_LINE> <DEDENT> def parser(self, data): <NEW_LINE> <INDENT> result = '' <NEW_LINE> if (self.buffer.add_data(data)): <NEW_LINE> <INDENT> result = self.buffer.result <NEW_LINE> s... | paresr multi bytes until terminal and The terminus is NOT included in
the returned value | 62598fb056ac1b37e630222f |
class TokenDetailView(LoginRequiredMixin, DetailView): <NEW_LINE> <INDENT> model = Token <NEW_LINE> page_title = "Token Detail" <NEW_LINE> template_name = 'common/token_detail.html' <NEW_LINE> def get_context_data(self, *args, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(*args, **kwargs) <NEW_LINE>... | Displays detailed information about a particular token. | 62598fb0097d151d1a2c1070 |
class ProjectTest(RepoTestCase): <NEW_LINE> <INDENT> def test_create(self): <NEW_LINE> <INDENT> project = self.create_project() <NEW_LINE> self.assertTrue(os.path.exists(project.full_path)) <NEW_LINE> self.assertTrue(project.slug in project.full_path) <NEW_LINE> <DEDENT> def test_rename(self): <NEW_LINE> <INDENT> compo... | Project object testing. | 62598fb08da39b475be0322b |
class AssertionSession(Session): <NEW_LINE> <INDENT> JWT_BEARER_GRANT_TYPE = JWTBearerGrant.GRANT_TYPE <NEW_LINE> ASSERTION_METHODS = { JWT_BEARER_GRANT_TYPE: JWTBearerGrant.sign, } <NEW_LINE> def __init__(self, token_url, issuer, subject, audience, grant_type, claims=None, token_placement='header', scope=None, **kwarg... | Constructs a new Assertion Framework for OAuth 2.0 Authorization Grants
per RFC7521_.
.. _RFC7521: https://tools.ietf.org/html/rfc7521 | 62598fb03d592f4c4edbaf06 |
class BooleanMetric(Metric): <NEW_LINE> <INDENT> def _populate_value(self, metric, value, start_time): <NEW_LINE> <INDENT> metric.boolean_value = value <NEW_LINE> <DEDENT> def _populate_value_new(self, data, value): <NEW_LINE> <INDENT> data.bool_value = value <NEW_LINE> <DEDENT> def _populate_value_type(self, data_set)... | A metric whose value type is a boolean. | 62598fb097e22403b383af53 |
class LazyPlugInFlowable(Flowable): <NEW_LINE> <INDENT> def __init__(self, dirname, modulename, functionname, content): <NEW_LINE> <INDENT> self.dirname = dirname <NEW_LINE> self.modulename = modulename <NEW_LINE> self.functionname = functionname <NEW_LINE> self.content = content <NEW_LINE> self.flowable = None <NEW_LI... | defer conversion of content until wrap time (to allow, eg, page numbering) | 62598fb01f5feb6acb162c64 |
class RayTests(unittest.TestCase): <NEW_LINE> <INDENT> def test_ray_basic(self): <NEW_LINE> <INDENT> ox_axis = Ray(Vec3(), Vec3.versor(0)) <NEW_LINE> self.assertEqual(ox_axis.point_at(4), Vec3(4, 0, 0)) <NEW_LINE> direction = Vec3(1, -1, 0).normalised() <NEW_LINE> ray1 = Ray(Vec3(0, 2, 0), direction) <NEW_LINE> ray2 = ... | Tests for Ray class. | 62598fb0bd1bec0571e150e5 |
class OFPPortMod(MsgBase): <NEW_LINE> <INDENT> _TYPE = { 'ascii': [ 'hw_addr', ] } <NEW_LINE> version = ofproto.OFP_VERSION <NEW_LINE> msg_type = ofproto.OFPT_PORT_MOD <NEW_LINE> def __init__(self, port_no=0, hw_addr='00:00:00:00:00:00', config=0, mask=0, advertise=0): <NEW_LINE> <INDENT> super(OFPPortMod, self).__init... | Port modification message
The controller sneds this message to modify the behavior of the port.
================ ======================================================
Attribute Description
================ ======================================================
port_no Port number to modify
hw_addr ... | 62598fb0b7558d5895463670 |
class MainProduct(BTreeContainer): <NEW_LINE> <INDENT> implements(IMainProduct, IMainProductContained) <NEW_LINE> name = u"" <NEW_LINE> description = u"" | Implementation of a IMainProduct using B-Tree Container
Make sure that the ``MainProduct`` implements the ``IMainProduct``
interface:
>>> from zope.interface.verify import verifyClass
>>> verifyClass(IMainProduct, MainProduct)
True
Make sure that the ``MainProduct`` implements the ``IMainProductContained``
interface... | 62598fb057b8e32f5250813e |
class DbServiceConnect: <NEW_LINE> <INDENT> def __init__(self, postgres_config): <NEW_LINE> <INDENT> self.conn = psycopg2.connect(**postgres_config) | Class to separate connect to Postgre DB.
To initialize requires path to config in dictionary with keys 'user','password','host','dbname' ,'port'. | 62598fb071ff763f4b5e77b7 |
class Battery(): <NEW_LINE> <INDENT> def __init__(self, size=70): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.charge_level = 0 <NEW_LINE> <DEDENT> def get_range(self): <NEW_LINE> <INDENT> if self.size == 70: <NEW_LINE> <INDENT> return 240 <NEW_LINE> <DEDENT> elif self.size == 85: <NEW_LINE> <INDENT> return 270 | A battery for an electric car. | 62598fb07d847024c075c408 |
class IncompatibleScopeError(Exception): <NEW_LINE> <INDENT> def __init__(self, scope, other_scope): <NEW_LINE> <INDENT> msg = f"Scope {scope} is not compatible with {other_scope}" <NEW_LINE> super().__init__(msg) | Raised when trying to align two factors' index with unequal scope. | 62598fb02c8b7c6e89bd380b |
class CachedObject(object): <NEW_LINE> <INDENT> name: str = "unnamed" <NEW_LINE> hashlist = () <NEW_LINE> cached_properties = [] <NEW_LINE> def __hash__(self): <NEW_LINE> <INDENT> return hash_attributes(self, self.hashlist) <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <INDENT> for prop in self.cached_properties: <... | An object to provide cached properties and functions.
Provide a list of attributes to hash down for tracking changes | 62598fb076e4537e8c3ef5ed |
class SomeGraph: <NEW_LINE> <INDENT> def __init__( self, some_datetime: datetime.datetime, formatless_datetime: datetime.datetime) -> None: <NEW_LINE> <INDENT> self.some_datetime = some_datetime <NEW_LINE> self.formatless_datetime = formatless_datetime | defines some object graph. | 62598fb06e29344779b006a2 |
class AjaxStringLookupWidget(forms.Widget): <NEW_LINE> <INDENT> class Media: <NEW_LINE> <INDENT> css = { 'all' : ("css/autocomplete.css",) } <NEW_LINE> js = ("js/jquery.autocomplete.min.js", "js/setup_ajax.js", "js/ajax_string_lookup.js",) <NEW_LINE> <DEDENT> def render(self, name, value, *args, **kwargs): <NEW_LINE> <... | Widget for a string lookup with suggestions | 62598fb0cc0a2c111447b058 |
class MessageForm(forms.ModelForm): <NEW_LINE> <INDENT> user_to = AutoCompleteField("usernames", required=False, help_text=None, label="To") <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Message <NEW_LINE> fields = ["title", "message"] <NEW_LINE> <DEDENT> def clean_user_to(self): <NEW_LINE> <INDENT> try: <NEW_LINE... | The form a user fills in when creating a new message | 62598fb030dc7b766599f893 |
class Camera(object): <NEW_LINE> <INDENT> def __init__(self, width, height): <NEW_LINE> <INDENT> self.state = pygame.Rect(0, 0, width, height) <NEW_LINE> <DEDENT> def apply(self, target): <NEW_LINE> <INDENT> return target.rect.move(self.state.topleft) <NEW_LINE> <DEDENT> def update(self, target): <NEW_LINE> <INDENT> se... | classe qui gere l'affichage du niveau du jeu sur l'ecran qui est plus petit
| 62598fb0f548e778e596b5ea |
class HigherOrderFunctionTests(unittest.TestCase): <NEW_LINE> <INDENT> PATH = './sample/asm/functions/higher_order' <NEW_LINE> def testApply(self): <NEW_LINE> <INDENT> runTest(self, 'apply.asm', '25') <NEW_LINE> <DEDENT> def testApplyByMove(self): <NEW_LINE> <INDENT> runTest(self, 'apply_by_move.asm', '25') <NEW_LINE> ... | Tests for higher-order function support.
| 62598fb066673b3332c30412 |
class VraFactory(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def factory(object_type, customization_func=None, **kwargs): <NEW_LINE> <INDENT> config = VraConfig().config_file <NEW_LINE> if object_type == 'payload': <NEW_LINE> <INDENT> if all(k in kwargs for k in ("payload_version", "payload_type")): <NEW_LINE... | Factory to create specific object class
| 62598fb05fcc89381b26616f |
class Tinder: <NEW_LINE> <INDENT> def __init__(self, facebook_id: AnyStr, facebook_token: AnyStr) -> None: <NEW_LINE> <INDENT> self.facebook_id = facebook_id <NEW_LINE> self.facebook_token = facebook_token <NEW_LINE> self.tinder = Api(facebook_id, facebook_token) <NEW_LINE> <DEDENT> def __repr__(self) -> AnyStr: <NEW_L... | Tinder API response handler.
| 62598fb016aa5153ce400549 |
class Port(object): <NEW_LINE> <INDENT> def __init__(self, device, name): <NEW_LINE> <INDENT> self.device = device <NEW_LINE> self.name = name.replace(" ","_") <NEW_LINE> self.speed = None <NEW_LINE> self.type = None <NEW_LINE> self.l2adjacency = None <NEW_LINE> self.l3adjacency = None <NEW_LINE> self.address = None <N... | switch or router port | 62598fb07b25080760ed74f6 |
class AnnotationJSONPresenter(AnnotationBasePresenter): <NEW_LINE> <INDENT> def __init__(self, annotation_resource, formatters=None): <NEW_LINE> <INDENT> super(AnnotationJSONPresenter, self).__init__(annotation_resource) <NEW_LINE> self._formatters = [] <NEW_LINE> if formatters is not None: <NEW_LINE> <INDENT> for form... | Present an annotation in the JSON format returned by API requests. | 62598fb07d43ff2487427425 |
class TonalCertainty(featuresModule.FeatureExtractor): <NEW_LINE> <INDENT> id = 'K1' <NEW_LINE> def __init__(self, dataOrStream=None, *arguments, **keywords): <NEW_LINE> <INDENT> featuresModule.FeatureExtractor.__init__(self, dataOrStream=dataOrStream, *arguments, **keywords) <NEW_LINE> self.name = 'Tonal Certainty' <... | >>> s = corpus.parse('bwv66.6')
>>> fe = features.native.TonalCertainty(s)
>>> f = fe.extract()
>>> f.vector
[1.26...]
>>> pitches = [56, 55, 56, 57, 58, 57, 58, 59, 60, 59, 60, 61, 62, 61, 62, 63, 64, 63, 64, 65, 66, 65, 66, 67]
>>> s = stream.Stream()
>>> for pitch in pitches:
... s.append(note.Note(pitch))
>>> f... | 62598fb066656f66f7d5a436 |
class ScriptMinimalDummy(Script): <NEW_LINE> <INDENT> _DEFAULT_SETTINGS = [ Parameter('execution_time', 0.1, float, 'execution time of script (s)') ] <NEW_LINE> _INSTRUMENTS = {} <NEW_LINE> _SCRIPTS = {} <NEW_LINE> def __init__(self, name=None, settings=None, log_function = None, data_path = None): <NEW_LINE> <INDENT> ... | Minimal Example Script that has only a single parameter (execution time)
| 62598fb0dd821e528d6d8f7b |
class CGetRSPMessage(DIMSEResponseMessage, StatusMixin): <NEW_LINE> <INDENT> command_field = 0x8010 <NEW_LINE> command_fields = ['CommandGroupLength', 'AffectedSOPClassUID', 'MessageIDBeingRespondedTo', 'Status', 'NumberOfRemainingSuboperations', 'NumberOfCompletedSuboperations', 'NumberOfFailedSuboperations', 'NumberO... | C-GET-RSP Message.
Complete definition can be found in DICOM PS3.7, 9.3.3.2 C-GET-RSP | 62598fb0fff4ab517ebcd82c |
class EquivalentModel(Model): <NEW_LINE> <INDENT> number_of_no_data_constraints = None <NEW_LINE> def setup(self, model, dependent_uncertainties, setting): <NEW_LINE> <INDENT> data_constraints, no_data_constraints = [], [] <NEW_LINE> for i, p in enumerate(model.unsubbed): <NEW_LINE> <INDENT> equivalent_p = EquivalentPo... | A class that generates models that are equivalent to the original models and ready to be
robustified. | 62598fb026068e7796d4c99c |
class is_standard_module_tc(ModutilsTestCase): <NEW_LINE> <INDENT> def test_knownValues_is_standard_module_builtins(self): <NEW_LINE> <INDENT> if sys.version_info < (3, 0): <NEW_LINE> <INDENT> self.assertEqual(modutils.is_standard_module('__builtin__'), True) <NEW_LINE> self.assertEqual(modutils.is_standard_module('bui... | return true if the module may be considered as a module from the standard
library | 62598fb05166f23b2e243420 |
class UpdateListings(OpsActor): <NEW_LINE> <INDENT> public = True <NEW_LINE> class Schema(mm.Schema): <NEW_LINE> <INDENT> query = mmf.Dict(missing=dict, title='Listing query') <NEW_LINE> <DEDENT> def perform(self, query=None): <NEW_LINE> <INDENT> vendors = filter_with_json(Vendor.query, {'listings': query}) <NEW_LINE> ... | Update all listings in the given query, if their vendor extension provides an UpdateListings action. | 62598fb0be7bc26dc9251e80 |
class AlreadyUnlocked(UnlockError): <NEW_LINE> <INDENT> pass | Raised when an attempt is made to unlock an unlocked file. | 62598fb08da39b475be0322d |
class pageo(pageol): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() | Store and unpack O page data.
- Output power
@memo とりあえずscalingsはpending
@todo OK
@memo format
[0]: 'O'
[1]: internal time
[2-5]: time
[6-8]: ch0
[9-11]: ch1
[12-14]: ch2
[15-17]: ch3
[18-20]: ch0
[21-23]: ch1
[24-26]: ch2
[27-29]: ch3
[30-31]: LQI | 62598fb04428ac0f6e65856d |
class AsynchronousWrapper(Wrapper): <NEW_LINE> <INDENT> def __init__(self, env: Env) -> None: <NEW_LINE> <INDENT> super().__init__(env) <NEW_LINE> self._executor = concurrent.futures.ThreadPoolExecutor(max_workers=1) <NEW_LINE> self._futures = [] <NEW_LINE> <DEDENT> def _wait(self): <NEW_LINE> <INDENT> if len(self._fut... | For environments with a synchronous act() function, run act() asynchronously on a
separate thread.
:param env: environment to wrap | 62598fb0498bea3a75a57b67 |
class Handler(webapp2.RequestHandler): <NEW_LINE> <INDENT> def renderError(self, error_code): <NEW_LINE> <INDENT> self.error(error_code) <NEW_LINE> self.response.write("Oops! Something went wrong.") <NEW_LINE> <DEDENT> def login_user(self, user): <NEW_LINE> <INDENT> user_id = user.key().id() <NEW_LINE> self.set_secure_... | A base RequestHandler class for our app.
The other handlers inherit form this one. | 62598fb0e1aae11d1e7ce847 |
class ResourceError(testpool.core.exceptions.TestpoolError): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> super(testpool.core.exceptions.TestpoolError, self).__init__(message) | Thrown when a resource is not available. | 62598fb0e5267d203ee6b950 |
class ListOfExpressions(Subparser): <NEW_LINE> <INDENT> def parse(self, parser, tokens): <NEW_LINE> <INDENT> items = [] <NEW_LINE> while not tokens.is_end(): <NEW_LINE> <INDENT> exp = Expression().parse(parser, tokens) <NEW_LINE> if exp != None: <NEW_LINE> <INDENT> items.append(exp) <NEW_LINE> <DEDENT> else: <NEW_LINE>... | list_of_expr: (expr COMMA)* | 62598fb0009cb60464d01568 |
class InvalidRubricSelection(Exception): <NEW_LINE> <INDENT> pass | The specified criterion/option do not exist in the rubric. | 62598fb0b7558d5895463672 |
class Transformation(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def transform(cls, transformation, vector): <NEW_LINE> <INDENT> assert isinstance(transformation, np.ndarray) <NEW_LINE> assert isinstance(vector, PVector) <NEW_LINE> assert all([len(vector) == dimension for dimension in transformation.shape]) <N... | Classes for transforming PVectors | 62598fb0796e427e5384e7dc |
class Redis(StrictRedis): <NEW_LINE> <INDENT> RESPONSE_CALLBACKS = dict_merge( StrictRedis.RESPONSE_CALLBACKS, { 'TTL': lambda r: r >= 0 and r or None, 'PTTL': lambda r: r >= 0 and r or None, } ) <NEW_LINE> def pipeline(self, transaction=True, shard_hint=None): <NEW_LINE> <INDENT> return Pipeline( self.db, self.respons... | Provides backwards compatibility with older versions of redis-py that
changed arguments to some commands to be more Pythonic, sane, or by
accident. | 62598fb0be8e80087fbbf0ac |
class CoattentionNet(nn.Module): <NEW_LINE> <INDENT> def __init__(self, vocab_size, embedding_dim, max_len,answer_vocab=1000): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.word_embeddings = nn.Embedding(vocab_size, embedding_dim, padding_idx=0) <NEW_LINE> self.unigram = nn.Conv1d(embedding_dim,embedding_dim,1... | Predicts an answer to a question about an image using the Hierarchical Question-Image Co-Attention
for Visual Question Answering (Lu et al, 2017) paper. | 62598fb0adb09d7d5dc0a5d2 |
class Groups(generics.ListAPIView): <NEW_LINE> <INDENT> queryset = Group.objects.all() <NEW_LINE> pagination_class = PageNumberPagination <NEW_LINE> serializer_class = GroupSerializer | API фотоальбомов. | 62598fb0fff4ab517ebcd82d |
class isDirectory_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRING, 'path', None, None, ), ) <NEW_LINE> def __init__(self, path=None,): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and... | Attributes:
- path | 62598fb0aad79263cf42e81b |
class IMessageSendingTest(Interface): <NEW_LINE> <INDENT> email = schema.Email( title=_(u'Email', default='Email'), description=_( u'email_sendingtest_description', default=u'Email to send the test message', ), required=True, ) | define field for sending test of message | 62598fb0a219f33f346c685d |
class PS3JoystickOld(Joystick): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(PS3JoystickOld, self).__init__(*args, **kwargs) <NEW_LINE> self.axis_names = { 0x00: 'left_stick_horz', 0x01: 'left_stick_vert', 0x02: 'right_stick_horz', 0x05: 'right_stick_vert', 0x1a: 'tilt_x', 0x1b: 't... | An interface to a physical PS3 joystick available at /dev/input/js0
Contains mapping that worked for Raspian Jessie drivers | 62598fb044b2445a339b6995 |
class AnimalDetail(generics.RetrieveUpdateDestroyAPIView): <NEW_LINE> <INDENT> queryset = Animal.objects.all() <NEW_LINE> serializer_class = AnimalSerializer <NEW_LINE> name = 'animal-details' | Class that inherits from:
RetrieveUpdateDestroyAPIView: GET / PUT / DELETE
on a single object (detail) | 62598fb0091ae35668704c68 |
class Board: <NEW_LINE> <INDENT> def __init__(self, secret): <NEW_LINE> <INDENT> self.board = ['_'] * len(secret) <NEW_LINE> self.guessed = [] <NEW_LINE> self._secret = secret <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return '< ' + " ".join(self.word()) + " : " + ",".join(self.guesses()) + ' >' <NEW_L... | Board for hangman with attributes board and guessed.
Attributes:
board - list of correct characters or "_" in the secret word
guessed - list of characters guessed so far
>>> from secret import SecretWord
>>> b = Board(SecretWord("bookkeeper"))
>>> len(b)
10
>>> b.guess('o')
2
>>> b
< _ o o _ _ _ _ _ _ _ : o >
>>... | 62598fb05fcc89381b266170 |
class DuplicateRegistrationError(Exception): <NEW_LINE> <INDENT> pass | A Node already has a registration.
| 62598fb07d847024c075c40b |
class Equal(_EqualityOperator, SympyComparison): <NEW_LINE> <INDENT> operator = '==' <NEW_LINE> grouping = 'None' <NEW_LINE> sympy_name = 'Eq' <NEW_LINE> @staticmethod <NEW_LINE> def _op(x): <NEW_LINE> <INDENT> return x | <dl>
<dt>'Equal[$x$, $y$]'
<dt>'$x$ == $y$'
<dd>yields 'True' if $x$ and $y$ are known to be equal, or
'False' if $x$ and $y$ are known to be unequal.
<dt>'$lhs$ == $rhs$'
<dd>represents the equation $lhs$ = $rhs$.
</dl>
>> a==a
= True
>> a==b
= a == b
>> 1==1.
= True
Lists are compared based on their ... | 62598fb032920d7e50bc609c |
class ContactUsView(FormView): <NEW_LINE> <INDENT> template_name = 'app/2_contact_us.html' <NEW_LINE> form_class = ContactUsForm <NEW_LINE> success_url = "/" <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.contact_us_limit = False <NEW_LINE> <DEDENT> def get_conte... | View that is responsible for feedback page | 62598fb0851cf427c66b8304 |
class WAR_Game(object): <NEW_LINE> <INDENT> def __init__(self, names): <NEW_LINE> <INDENT> self.players = [] <NEW_LINE> for name in names: <NEW_LINE> <INDENT> player = WAR_Player(name) <NEW_LINE> self.players.append(player) <NEW_LINE> <DEDENT> self.dealer = WAR_Dealer("Дилер") <NEW_LINE> self.deck = WAR_Deck() <NEW_LIN... | Игра в "Очко". | 62598fb03d592f4c4edbaf09 |
@pytest.mark.skipif(openmm_missing, reason='OpenMM and openmmtools are not installed') <NEW_LINE> class TestArgonTemperingSampler(object): <NEW_LINE> <INDENT> def test_initialization(self): <NEW_LINE> <INDENT> nparticles = 1000 <NEW_LINE> temperature_ladder = np.linspace(300.0, 500.0, 20) <NEW_LINE> biases = np.arange(... | A set of tests for the simulated tempering example of an argon gas. | 62598fb02c8b7c6e89bd380e |
class ShelterInspectionRepresent(S3Represent): <NEW_LINE> <INDENT> def __init__(self, show_link=False): <NEW_LINE> <INDENT> super(ShelterInspectionRepresent, self).__init__(lookup = "cr_shelter_inspection", show_link = show_link, ) <NEW_LINE> <DEDENT> def link(self, k, v, row=None): <NEW_LINE> <INDENT> if row: <NEW_LIN... | Representations of Shelter Inspections | 62598fb04527f215b58e9f1e |
class _Texture: <NEW_LINE> <INDENT> __tex = None <NEW_LINE> def __init__(self, win, target): <NEW_LINE> <INDENT> self.__win = win <NEW_LINE> self.__target = target <NEW_LINE> self.__tex = gl.createTexture() <NEW_LINE> self.update = True <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <INDENT> if self.__tex: <NEW_LINE... | Internal OpenGL texture handle | 62598fb092d797404e388b88 |
class ConfigParser(dict): <NEW_LINE> <INDENT> VARIABLE = re.compile(r'(?P<replace>\$(\{)?(?P<name>[a-zA-Z0-9_-]+)(?(2)\}|))') <NEW_LINE> UNICODE_CHAR = re.compile(r'(?P<replace>\\x(?P<char>[0-9a-f]{2}))', re.I) <NEW_LINE> def __init__(self, path): <NEW_LINE> <INDENT> with open(path, 'r') as f: <NEW_LINE> <INDENT> lexer... | Parse bash scripts to extract variables | 62598fb067a9b606de546016 |
class SkuRestriction(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'type': {'readonly': True}, 'values': {'readonly': True}, 'reason_code': {'readonly': True}, 'restriction_info': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'values': {'key': 'values', '... | The restrictions because of which SKU cannot be used.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar type: The type of the restriction.
:vartype type: str
:ivar values: The locations where sku is restricted.
:vartype values: list[str]
:ivar reason_code: The SKU restricti... | 62598fb04f88993c371f052f |
class HashKey(BaseSchemaField): <NEW_LINE> <INDENT> attr_type = 'HASH' | An field representing a hash key.
Example::
>>> from txboto.dynamodb2.types import NUMBER
>>> HashKey('username')
>>> HashKey('date_joined', data_type=NUMBER) | 62598fb0dd821e528d6d8f7e |
class Pupil(Person): <NEW_LINE> <INDENT> classes: List[Class] | Pupils attend classes to learn things. | 62598fb04428ac0f6e65856f |
class TestRunRequest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.httpClient = makeHttpClient() <NEW_LINE> <DEDENT> def testRunSearchRequest(self): <NEW_LINE> <INDENT> mockPost = mock.Mock() <NEW_LINE> with mock.patch('requests.request', mockPost): <NEW_LINE> <INDENT> mockPost.side_... | Test the logic of the run*Request methods | 62598fb0bf627c535bcb14e8 |
class RandomEvaluator(Evaluator): <NEW_LINE> <INDENT> ap = ArgumentParser() <NEW_LINE> ap.add_argument('--seed', dest='rand_seed', type=int, default=None) <NEW_LINE> arg_parsers = (ap,) <NEW_LINE> def __init__(self, argparser, args): <NEW_LINE> <INDENT> super(RandomEvaluator, self).__init__(argparser, args) <NEW_LINE> ... | Shuffle the input randomly | 62598fb099fddb7c1ca62e0e |
class Unique: <NEW_LINE> <INDENT> def __call__(self, value): <NEW_LINE> <INDENT> for i in range(len(value) - 1): <NEW_LINE> <INDENT> for j in range(i+1, len(value)): <NEW_LINE> <INDENT> if value[i] == value[j]: <NEW_LINE> <INDENT> raise vol.Invalid('duplicate value: {}'.format(value[i])) <NEW_LINE> <DEDENT> <DEDENT> <D... | Validates that elements of all different, works with unhashable types | 62598fb08a43f66fc4bf21c4 |
class EntityNotFoundException(VcdException): <NEW_LINE> <INDENT> pass | Raised when an entity is not found in vcd. | 62598fb0d7e4931a7ef3c0de |
class UsageWarning(UserWarning): <NEW_LINE> <INDENT> pass | Something unsafe was requested and carried out.
| 62598fb0d268445f26639ba8 |
class ItemCallback(ABC): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def call(self, zin: ZipFile, zout: ZipFile, item: ZipInfo) -> bool: <NEW_LINE> <INDENT> pass | Called on each item of the source. Use a ItemCallback to ignore a script. | 62598fb0fff4ab517ebcd82f |
class BARewardMolecule(molecules_mdp.Molecule): <NEW_LINE> <INDENT> def __init__(self, discount_factor, **kwargs): <NEW_LINE> <INDENT> super(BARewardMolecule, self).__init__(**kwargs) <NEW_LINE> self.discount_factor = discount_factor <NEW_LINE> <DEDENT> def _reward(self): <NEW_LINE> <INDENT> molecule = Chem.MolFromSmil... | The molecule whose reward is the Bingding affinity. | 62598fb0a8370b77170f0426 |
class FREQuency(SCPINode, SCPIQuery, SCPISet): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "FREQuency" <NEW_LINE> args = ["1"] <NEW_LINE> class STEP(SCPINode): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "STEP" <NEW_LINE> args = [] <NEW_LINE> class INCRement(SCPINode, SCPIQuery, SCPISet): <NEW_LINE> <... | SOURce:PULSe:INTernal:FREQuency
Arguments: 1 | 62598fb07047854f4633f424 |
class ELBResponse(AWSGenericResponse): <NEW_LINE> <INDENT> namespace = NS <NEW_LINE> exceptions = {} <NEW_LINE> xpath = 'Error' | Amazon ELB response class. | 62598fb05fc7496912d482a5 |
class LinkedList(object): <NEW_LINE> <INDENT> def __init__(self, data=None): <NEW_LINE> <INDENT> self._length = 0 <NEW_LINE> self.head = None <NEW_LINE> try: <NEW_LINE> <INDENT> for val in data: <NEW_LINE> <INDENT> self.push(val) <NEW_LINE> <DEDENT> <DEDENT> except TypeError: <NEW_LINE> <INDENT> if data: <NEW_LINE> <IN... | Method for linked list.
push(val) - will insert the value at the head of the list.
pop() - remove the first value off the head and return it.
size() - will return the length of the list.
search(val) - will return the node containing val in the list, if
present, else None
remove(node) - will remove the given node from ... | 62598fb0aad79263cf42e81d |
class UserMessage(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=20, verbose_name=u'用户名') <NEW_LINE> email = models.EmailField(verbose_name=u'邮箱') <NEW_LINE> address = models.CharField(max_length=100, verbose_name=u'联系地址') <NEW_LINE> message = models.CharField(max_length=500, verbose_name=u'用户留言信... | 用户留言信息 | 62598fb0a05bb46b3848a8b5 |
class _CardAccessor(object): <NEW_LINE> <INDENT> def __init__(self, header): <NEW_LINE> <INDENT> self._header = header <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return '\n'.join(repr(c) for c in self._header._cards) <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return len(self._header._ca... | This is a generic class for wrapping a Header in such a way that you can
use the header's slice/filtering capabilities to return a subset of cards
and do something with them.
This is sort of the opposite notion of the old CardList class--whereas
Header used to use CardList to get lists of cards, this uses Header to ge... | 62598fb0442bda511e95c4a2 |
class ComputeNetworksRemovePeeringRequest(_messages.Message): <NEW_LINE> <INDENT> network = _messages.StringField(1, required=True) <NEW_LINE> networksRemovePeeringRequest = _messages.MessageField('NetworksRemovePeeringRequest', 2) <NEW_LINE> project = _messages.StringField(3, required=True) <NEW_LINE> requestId = _mes... | A ComputeNetworksRemovePeeringRequest object.
Fields:
network: Name of the network resource to remove peering from.
networksRemovePeeringRequest: A NetworksRemovePeeringRequest resource to
be passed as the request body.
project: Project ID for this request.
requestId: An optional request ID to identify req... | 62598fb0cc40096d6161a1fe |
class RelationalExpressionValue(BinaryExpressionValue): <NEW_LINE> <INDENT> VALID_OPS = {'>', '<', '>=', '<=', '==', '!='} <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(RelationalExpressionValue, self).__init__() <NEW_LINE> <DEDENT> def _validateOperator(self, value): <NEW_LINE> <INDENT> return value in self... | Relational expression - comparison | 62598fb0091ae35668704c6a |
class MessageSync: <NEW_LINE> <INDENT> def __init__( self, messages: typing.Iterable[Message], timestamps: bool = True, gap: float = 0.0001, skip: float = 60.0, ) -> None: <NEW_LINE> <INDENT> self.raw_messages = messages <NEW_LINE> self.timestamps = timestamps <NEW_LINE> self.gap = gap <NEW_LINE> self.skip = skip <NEW_... | Used to iterate over some given messages in the recorded time. | 62598fb0f9cc0f698b1c52ef |
class RefB(SKABaseDevice): <NEW_LINE> <INDENT> __metaclass__ = DeviceMeta <NEW_LINE> attr1 = attribute( dtype='str', doc="Attribute 1 for DevB", ) <NEW_LINE> attr2 = attribute( dtype='str', doc="Attribute 2 for DevB", ) <NEW_LINE> importantState = attribute( dtype='DevEnum', access=AttrWriteType.READ_WRITE, enum_labels... | Ref (Reference Element) device of type B. | 62598fb060cbc95b0636439a |
class ArticleListView(CustomListRendererMixin, generics.ListAPIView): <NEW_LINE> <INDENT> queryset = Article.objects.all() <NEW_LINE> serializer_class = ArticleSerializer | List of articles | 62598fb032920d7e50bc609f |
class Predlogenie(models.Model): <NEW_LINE> <INDENT> TYPE_OF = ( ('P', 'Потребительский'), ('I', 'Ипотека'), ('A', 'Автокредит'), ) <NEW_LINE> create_dt = models.DateTimeField(auto_now_add=True) <NEW_LINE> update_dt = models.DateTimeField(auto_now=True) <NEW_LINE> start_rotate = models.DateTimeField() <NEW_LINE> end_ro... | Предложение. | 62598fb0cc0a2c111447b05d |
class Solution: <NEW_LINE> <INDENT> def countBits(self, num): <NEW_LINE> <INDENT> answer = [0] <NEW_LINE> for i in range(1, num + 1): <NEW_LINE> <INDENT> if i % 2 == 0: <NEW_LINE> <INDENT> number = answer[i//2] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> number = answer[i - 1] + 1 <NEW_LINE> <DEDENT> answer.append(nu... | @param num: a non negative integer number
@return: an array represent the number of 1's in their binary | 62598fb0d486a94d0ba2c01b |
class WorkerProcessTest(EventLoopTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> EventLoopTest.setUp(self) <NEW_LINE> workerprocess._subprocess_manager.handler_class = ( UnittestWorkerProcessHandler) <NEW_LINE> self.result = self.error = None <NEW_LINE> <DEDENT> def callback(self, result): <NEW_LINE> <I... | Test our worker process. | 62598fb097e22403b383af59 |
class ULAcoin(Bitcoin): <NEW_LINE> <INDENT> name = 'ulacoin' <NEW_LINE> symbols = ('ULA', ) <NEW_LINE> seeds = ('ulacoin.com', 'node.walletbuilders.com', ) <NEW_LINE> port = 21659 <NEW_LINE> message_start = b'\x8b\xa3\x36\x9a' <NEW_LINE> base58_prefixes = { 'PUBKEY_ADDR': 68, 'SCRIPT_ADDR': 5, 'SECRET_KEY': 196 } | Class with all the necessary ULAcoin (ULA) network information based on
https://github.com/UlaTechGroup/UlatechGroup/blob/master/src/net.cpp
(date of access: 02/17/2018) | 62598fb01f5feb6acb162c6a |
@_display_as_base <NEW_LINE> class _ArrayMemoryError(MemoryError): <NEW_LINE> <INDENT> def __init__(self, shape, dtype): <NEW_LINE> <INDENT> self.shape = shape <NEW_LINE> self.dtype = dtype <NEW_LINE> <DEDENT> @property <NEW_LINE> def _total_size(self): <NEW_LINE> <INDENT> num_bytes = self.dtype.itemsize <NEW_LINE> for... | Thrown when an array cannot be allocated | 62598fb12ae34c7f260ab12d |
class HMISUser (object): <NEW_LINE> <INDENT> def __init__(self, user): <NEW_LINE> <INDENT> self.user = user <NEW_LINE> self.groups = None <NEW_LINE> <DEDENT> def group_names(self): <NEW_LINE> <INDENT> return (g.name for g in self.user.groups.all()) <NEW_LINE> <DEDENT> def is_intake_staff(self): <NEW_LINE> <INDENT> retu... | A user object that adds a few convenience methods to the Django User. | 62598fb14f6381625f1994e5 |
class CheckReplDBHashInBackground(jsfile.JSHook): <NEW_LINE> <INDENT> def __init__(self, hook_logger, fixture, shell_options=None): <NEW_LINE> <INDENT> description = "Check dbhashes of all replica set members while a test is running" <NEW_LINE> js_filename = os.path.join("jstests", "hooks", "run_check_repl_dbhash_backg... | A hook for comparing the dbhashes of all replica set members while a test is running. | 62598fb1f548e778e596b5ef |
class MultiHeadAttention(Module): <NEW_LINE> <INDENT> def __init__(self, num_heads: int, d_q_in: int, d_k_in: int, d_v_in: int, d_atn: int, d_v: int, d_out: int, dropout_rate: float = 0.1) -> None: <NEW_LINE> <INDENT> super(MultiHeadAttention, self).__init__() <NEW_LINE> self.num_heads = num_heads <NEW_LINE> self.q_tra... | Neural module wrapping multihead scaled dot-product attention. | 62598fb18a43f66fc4bf21c7 |
class Dialect(object): <NEW_LINE> <INDENT> __slots__ = ["_delimiter", "_doublequote", "_escapechar", "_lineterminator", "_quotechar", "_quoting", "_skipinitialspace", "_strict"] <NEW_LINE> def __new__(cls, dialect, **kwargs): <NEW_LINE> <INDENT> for name in kwargs: <NEW_LINE> <INDENT> if '_' + name not in Dialect.__slo... | CSV dialect
The Dialect type records CSV parsing and generation options. | 62598fb1fff4ab517ebcd831 |
class VCDValueHistoryEntry(VCDObject): <NEW_LINE> <INDENT> def __init__(self, scope: VCDScope, signal: str, time: int): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._scope = scope <NEW_LINE> self._signal = signal <NEW_LINE> self._time = int(time) <NEW_LINE> <DEDENT> @property <NEW_LINE> def scope(self) -> VCD... | Value history entry. | 62598fb12ae34c7f260ab12e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.