code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class SearchListProxy(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.search_list_handle = SearchListHandle() <NEW_LINE> <DEDENT> def go_to_goods_detail(self, kw): <NEW_LINE> <INDENT> self.search_list_handle.click_goods(kw) | 搜索列表-业务层 | 62599023d99f1b3c44d0659d |
class MemcacheStore(Store): <NEW_LINE> <INDENT> def __init__(self, connection_string: str) -> None: <NEW_LINE> <INDENT> self.log: logging.Logger = logging.getLogger(self.__class__.__name__) <NEW_LINE> self.client: pylibmc.Client = pylibmc.Client( [connection_string], binary=True, ) <NEW_LINE> <DEDENT> def get_multi(sel... | A memcache-backed implementation of a counter store.
Each operation in memcache is atomic, this ensures that the view of the
state that any client sees is the current view. Counters in previous
buckets will not change.
If two clients try to acquire a permit for the same key, they will each get
a different value, and ... | 6259902421bff66bcd723b5d |
class ContactInfo(models.Model): <NEW_LINE> <INDENT> address = models.CharField(max_length=200, blank=True, null=True) <NEW_LINE> address_line2 = models.CharField(max_length=200, blank=True, null=True) <NEW_LINE> city = models.CharField(max_length=80, blank=True, null=True) <NEW_LINE> state = models.CharField(max_lengt... | This is contact information that may go with an individual or entity.
Notice that 'email' is missing as this is part of auth.User or any model describing an entity.
This model basically requires incoming relationships to have any kind of normal life.
For example, people.userprofile has a 1to1 to this. | 6259902491af0d3eaad3ad21 |
class Acl(object): <NEW_LINE> <INDENT> allow_default = True <NEW_LINE> _permissions = None <NEW_LINE> def __init__(self, user): <NEW_LINE> <INDENT> self.user = user <NEW_LINE> <DEDENT> @property <NEW_LINE> def permissions(self): <NEW_LINE> <INDENT> if not self._permissions: <NEW_LINE> <INDENT> self._generate_user_permi... | Access Control List functionality for managing users' roles and
permissions.
By default, the user model contains an `acl` attribute, which allows
access to the Acl object.
Attributes:
allow_default (boolean): Whether or not to allow/deny access if the
permission has not been set on th... | 62599024be8e80087fbbff72 |
class GatewayEvent(six.with_metaclass(GatewayEventMeta, Model)): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def from_dispatch(client, data): <NEW_LINE> <INDENT> cls = EVENTS_MAP.get(data['t']) <NEW_LINE> if not cls: <NEW_LINE> <INDENT> raise Exception('Could not find cls for {} ({})'.format(data['t'], data)) <NEW_LIN... | The GatewayEvent class wraps various functionality for events passed to us
over the gateway websocket, and serves as a simple proxy to inner values for
some wrapped event-types (e.g. MessageCreate only contains a message, so we
proxy all attributes to the inner message object). | 6259902463f4b57ef00864f0 |
class CappedBuffer(CharacterBuffer): <NEW_LINE> <INDENT> def __init__(self, buffer, width, ignoreWhitespace=False): <NEW_LINE> <INDENT> self.buffer = buffer <NEW_LINE> self.bytesRead = 0 <NEW_LINE> self.width = width <NEW_LINE> self.ignoreWhitespace = ignoreWhitespace <NEW_LINE> <DEDENT> def getch(self): <NEW_LINE> <IN... | Implementation of a buffer that caps the number of bytes we can
getch(). The cap may or may not include whitespace characters. | 62599024bf627c535bcb23b2 |
class Price(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.OriginalPrice = None <NEW_LINE> self.DiscountPrice = None <NEW_LINE> self.UnitPrice = None <NEW_LINE> self.ChargeUnit = None <NEW_LINE> self.UnitPriceDiscount = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE... | 描述预付费或后付费云盘的价格。
| 62599024d99f1b3c44d065a1 |
class MovingThing(object): <NEW_LINE> <INDENT> def __init__(self, image, drawer, x=-1, y=-1, capacity=8): <NEW_LINE> <INDENT> self.drawer = drawer <NEW_LINE> self.image = image <NEW_LINE> self.images = { "default" : image} <NEW_LINE> dark = pygame.Surface(self.image.get_size()).convert_alpha() <NEW_LINE> dark.fill((0, ... | An icon that moves around. | 6259902463f4b57ef00864f1 |
class MapGetByIndexRangeToEnd(_BaseExpr): <NEW_LINE> <INDENT> _op = aerospike.OP_MAP_GET_BY_INDEX_RANGE_TO_END <NEW_LINE> def __init__(self, ctx: 'TypeCTX', return_type: int, index: 'TypeIndex', bin: 'TypeBinName'): <NEW_LINE> <INDENT> self._children = ( index, bin if isinstance(bin, _BaseExpr) else MapBin(bin) ) <NEW_... | Create an expression that selects map items starting at specified index to the end of map
and returns selected data specified by return_type. | 625990248c3a8732951f7455 |
class WSGIRequestHandlerLogging(WSGIRequestHandler): <NEW_LINE> <INDENT> def log_message(self, format, *args): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> logger.debug("restapi - %s %s %s" % args) <NEW_LINE> <DEDENT> except BaseException: <NEW_LINE> <INDENT> print(args) | wsgi request handler logging | 625990241d351010ab8f4a14 |
class Bind(xso.XSO): <NEW_LINE> <INDENT> TAG = (namespaces.rfc6120_bind, "bind") <NEW_LINE> jid = xso.ChildText( (namespaces.rfc6120_bind, "jid"), type_=xso.JID(), default=None ) <NEW_LINE> resource = xso.ChildText( (namespaces.rfc6120_bind, "resource"), default=None ) <NEW_LINE> def __init__(self, jid=None, resource=N... | The :class:`.IQ` payload for binding to a resource.
.. attribute:: jid
The server-supplied :class:`aioxmpp.JID`. This must not be set by
client code.
.. attribute:: resource
The client-supplied, optional resource. If a client wishes to bind to a
specific resource, it must tell the server that using this... | 6259902456b00c62f0fb37bd |
class DCTLayer(nn.Module): <NEW_LINE> <INDENT> def __init__(self, input_shape=IMAGE_SIZE): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.input_shape = input_shape <NEW_LINE> I = np.eye(self.input_shape) <NEW_LINE> I = dct(I, type=2, norm="ortho", axis=-1) <NEW_LINE> self.register_buffer("dct", torch.as_tensor(... | DCT-2 preprocessing layer.
Only supports square input. | 6259902426238365f5fada50 |
class WinUnicodeOutputBase(object): <NEW_LINE> <INDENT> def __init__(self, fileno, name, encoding): <NEW_LINE> <INDENT> self._fileno = fileno <NEW_LINE> self.encoding = encoding <NEW_LINE> self.name = name <NEW_LINE> self.closed = False <NEW_LINE> self.softspace = False <NEW_LINE> self.mode = 'w' <NEW_LINE> <DEDENT> @s... | Base class to adapt sys.stdout or sys.stderr to behave correctly on
Windows.
Setting encoding to utf-8 is recommended. | 62599024d164cc6175821e76 |
class MachinePanel(wx.Panel): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> super(MachinePanel, self).__init__(parent) <NEW_LINE> self.frame = parent.GetTopLevelParent() <NEW_LINE> self.machine_nb = wx.Notebook(self) <NEW_LINE> <DEDENT> def load_collection(self): <NEW_LINE> <INDENT> periods = self... | Panel with sheets of washers and dryers. | 62599024a8ecb0332587211e |
class Corpus(object): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self.dictionary = Dictionary() <NEW_LINE> self.train = self.tokenize(path) <NEW_LINE> <DEDENT> def tokenize(self, path): <NEW_LINE> <INDENT> assert os.path.exists(path) <NEW_LINE> with open(path, 'r', encoding='utf-8') as f: <NEW_LI... | 文本预处理,获取词汇表,并将字符串文本转换为数字序列。 | 62599024c432627299fa3ef2 |
class CounterThread(qtc.QThread): <NEW_LINE> <INDENT> countChanged = qtc.pyqtSignal(int, str) <NEW_LINE> pomoComplete = qtc.pyqtSignal() <NEW_LINE> running = True <NEW_LINE> def run(self): <NEW_LINE> <INDENT> on_focus, on_break = True, False <NEW_LINE> session_time = 0 <NEW_LINE> while CounterThread.running: <NEW_LINE>... | Runs a counter thread | 625990246fece00bbaccc8b9 |
class SingleInstance(object): <NEW_LINE> <INDENT> def __init__(self, proc): <NEW_LINE> <INDENT> proc = proc.split('/')[-1] <NEW_LINE> self.pidPath = '/tmp/' + proc + '.pid' <NEW_LINE> if os.path.exists(self.pidPath): <NEW_LINE> <INDENT> self.lasterror = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.lasterror ... | Se encarga de que este corriendo un solo encoder por grupo para cada tipo de archivo.
Crea un archivo .pid cuando la aplicacion esta corriendo, que se borra cuando se termina la ejecucion de la misma. | 625990249b70327d1c57fc82 |
class Uchip3131(Chip): <NEW_LINE> <INDENT> pinpos = ('l', 'l', 'l', 'b', 'r', 'r', 'r', 't') <NEW_LINE> @property <NEW_LINE> def coords(self): <NEW_LINE> <INDENT> return ((-0.5, 0.25), (-0.5, 0), (-0.5, -0.25), (0.0, -0.375), (0.5, -0.25), (0.5, 0), (0.5, 0.25), (0.0, 0.375)) <NEW_LINE> <DEDENT> @property <NEW_LINE> de... | Chip of size 3 1 3 1 | 62599024c432627299fa3ef4 |
class PrepareFieldmap(FSLCommand): <NEW_LINE> <INDENT> _cmd = 'fsl_prepare_fieldmap' <NEW_LINE> input_spec = PrepareFieldmapInputSpec <NEW_LINE> output_spec = PrepareFieldmapOutputSpec <NEW_LINE> def _parse_inputs(self, skip=None): <NEW_LINE> <INDENT> if skip is None: <NEW_LINE> <INDENT> skip = [] <NEW_LINE> <DEDENT> i... | Interface for the fsl_prepare_fieldmap script (FSL 5.0)
Prepares a fieldmap suitable for FEAT from SIEMENS data - saves output in
rad/s format (e.g. ```fsl_prepare_fieldmap SIEMENS
images_3_gre_field_mapping images_4_gre_field_mapping fmap_rads 2.65```).
Examples
--------
>>> from nipype.interfaces.fsl import Prepa... | 6259902491af0d3eaad3ad29 |
class MultikeyDict(dict): <NEW_LINE> <INDENT> def __init__(self, *arg, **kw): <NEW_LINE> <INDENT> dict.__init__(self, *arg, **kw) <NEW_LINE> self.value_set = set() <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> item = dict.__getitem__(self, key) <NEW_LINE> return item.value <NEW_LINE> <DEDENT> def ... | dict with multiple keys, i.e.
foo = MultikeyDict()
foo[(1, 'bar')] = 'hello'
foo[1] == foo['bar'] == 'hello'
To delete: "del foo[1]" or "del foo['bar']" or "del foo['hello']"
This is an alternative to maintaining 2 seperate dicts for e.g. player
IDs and their names, so you can do both dict[player_id] and... | 625990246e29344779b01553 |
class easygttsException(LibraryException): <NEW_LINE> <INDENT> pass | Base Error for easygTTS code. (premium=False) | 62599024d99f1b3c44d065a7 |
@six.add_metaclass(ABCMeta) <NEW_LINE> class SessionInit(object): <NEW_LINE> <INDENT> def init(self, sess): <NEW_LINE> <INDENT> self._init(sess) <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def _init(self, sess): <NEW_LINE> <INDENT> pass | Base class for utilities to initialize a session | 6259902421bff66bcd723b65 |
class Mirror(OptElement): <NEW_LINE> <INDENT> def __init__(self, r=[0,0,0], roll_ang=0.0, pitch_ang=0.0, yaw_ang=0.0, size=[1.0,1.0,0.1], id=None): <NEW_LINE> <INDENT> OptElement.__init__(self, r, roll_ang, pitch_ang, yaw_ang, size, id) | plane mirror | 62599024796e427e5384f681 |
class PerfCounter(object): <NEW_LINE> <INDENT> def __init__(self, name, description): <NEW_LINE> <INDENT> if name in Registry._counters: <NEW_LINE> <INDENT> raise Exception('Counter %s already exists.' % name) <NEW_LINE> <DEDENT> self._name = name <NEW_LINE> self._description = description <NEW_LINE> self._value = 0 <N... | Generic in-process numeric counter; not aggregated across instances. | 62599024a4f1c619b294f4f8 |
class AutomaticDimension(object): <NEW_LINE> <INDENT> AD_NAME = '' <NEW_LINE> AD_DESCRIPTION = '' <NEW_LINE> VALID_FOR_TYPE = () <NEW_LINE> def __init__(self, list_of_values): <NEW_LINE> <INDENT> self.att_type = type(list_of_values[0]) <NEW_LINE> self.set_of_values = set([str(val) for val in list_of_values]) <NEW_LINE>... | Class to create automatic dimensions for the hierarchies
| 62599024507cdc57c63a5caa |
class HitVecDict(dict): <NEW_LINE> <INDENT> def __missing__(self, k): <NEW_LINE> <INDENT> self[k] = biopsy.HitVec() <NEW_LINE> return self[k] | A dict where missing values are initialised to biopsy.HitVec(). | 625990249b70327d1c57fc86 |
class Update: <NEW_LINE> <INDENT> def __init__(self, in_headers, args): <NEW_LINE> <INDENT> self.aggregate_headers = [] <NEW_LINE> self.input_headers = in_headers <NEW_LINE> self.output_headers = in_headers <NEW_LINE> self.column_name = args.pop(0) <NEW_LINE> self.pythonExpr = args.pop(0) <NEW_LINE> if not(self.column_... | Updates the values of a column. Consume two arguments from args: a column name
and a python expression. Evaluate the expression using eval (as for Filter),
and assign the result to the designated column. Raise an exception if the
column is not in in_headers.
Does no aggregation.
Tip: use "x in l" to check if x is ... | 6259902430c21e258be9971a |
class BuiltinModule(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.is_main_module = False <NEW_LINE> self.to_be_mangled = False <NEW_LINE> self.exported_functions = dict() <NEW_LINE> self.dependent_modules = dict() <NEW_LINE> <DEDENT> def call_function(self, ... | Represent a builtin module.
it offer the same interface as ImportedModule class, but do not try to
validate function imported from here. | 6259902426238365f5fada56 |
class GetTableData(object): <NEW_LINE> <INDENT> def GET(self): <NEW_LINE> <INDENT> print("-----------------------------------") <NEW_LINE> print("GetTableData Started!") <NEW_LINE> result = json.loads(web.data().decode('utf-8')) <NEW_LINE> table = str(result["table"]) <NEW_LINE> if "database" in result: <NEW_LINE> <IND... | Gets data from a table / collection. Returns data if found. Otherwise, returns an error.
WARNING: Data can be non consistent if your saving method is wrong!
@author: Shreyas Gokhale
@contact: s.gokhale@campus.tu-berlin.de | 62599024c432627299fa3ef8 |
class LatLngList(ArrayList): <NEW_LINE> <INDENT> def refresh_points(self, points): <NEW_LINE> <INDENT> coordinates = [LatLng(*p) for p in points] <NEW_LINE> self.clear() <NEW_LINE> self.addAll([bridge.encode(c) for c in coordinates]) <NEW_LINE> <DEDENT> def handle_change(self, change): <NEW_LINE> <INDENT> op = change['... | A ArrayList<LatLng> that handles changes from an atom ContainerList | 6259902456b00c62f0fb37c5 |
class ForeignElement(_Element, _Tagged, _Parental, _Configurable, Signature2): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> attributes = self.render_attributes() <NEW_LINE> return "<{0}{1}/>".format(self.tagname, attributes) <NEW_LINE> children = self.render_children() <NEW_LINE> return "<{0}{1}>{2}</{0}... | This abstract element class implements foreign elements like RECT and
CIRCLE elements (those that can optionally self-close when they have no
children). | 62599024bf627c535bcb23bc |
class WebSocketServerProtocol(WebSocketAdapterProtocol, protocol.WebSocketServerProtocol): <NEW_LINE> <INDENT> def _onConnect(self, request): <NEW_LINE> <INDENT> res = maybeDeferred(self.onConnect, request) <NEW_LINE> res.addCallback(self.succeedHandshake) <NEW_LINE> def forwardError(failure): <NEW_LINE> <INDENT> if fa... | Base class for Twisted-based WebSocket server protocols. | 625990249b70327d1c57fc88 |
class TestUserFields: <NEW_LINE> <INDENT> def test_model_has_id_field(self, user_model_class): <NEW_LINE> <INDENT> assert hasattr(user_model_class, "id") <NEW_LINE> <DEDENT> def test_model_has_email_field(self, user_model_class): <NEW_LINE> <INDENT> assert hasattr(user_model_class, "email") <NEW_LINE> <DEDENT> def test... | This Testsuit summerizes the basic field tests:
1. Do all fields exist
2. Do all fields have the correct format/class instance | 625990245e10d32532ce4088 |
class FormattingString(str): <NEW_LINE> <INDENT> def __new__(cls, formatting, normal): <NEW_LINE> <INDENT> new = str.__new__(cls, formatting) <NEW_LINE> new._normal = normal <NEW_LINE> return new <NEW_LINE> <DEDENT> def __call__(self, text): <NEW_LINE> <INDENT> return self + text + self._normal | A Unicode string which can be called upon a piece of text to wrap it in
formatting | 62599024a4f1c619b294f4fc |
class World(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def stacked_proxy_safe_get(stacked_proxy, key, default=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return getattr(stacked_proxy, key) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> return default <NEW_LINE> <DEDENT> <DEDENT> def curren... | A World is the proxy to the app/request state for Features.
Proxying through World allows for easy testing and caching if needed. | 6259902491af0d3eaad3ad2e |
class Square: <NEW_LINE> <INDENT> def __init__(self, size=0, position=(0, 0)): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.position = position <NEW_LINE> <DEDENT> def area(self): <NEW_LINE> <INDENT> return (self.__size * self.__size) <NEW_LINE> <DEDENT> @property <NEW_LINE> def size(self): <NEW_LINE> <INDENT> ... | Private instance attribute: size
Instantiation with area and position method | 6259902421a7993f00c66e85 |
class MeridionalDiffusion(MeridionalAdvectionDiffusion): <NEW_LINE> <INDENT> def __init__(self, K=0., use_banded_solver=False, prescribed_flux=0., **kwargs): <NEW_LINE> <INDENT> super(MeridionalDiffusion, self).__init__( U=0., K=K, prescribed_flux=prescribed_flux, use_banded_solver=use_banded_solver, **kwargs) | A parent class for meridional diffusion-only processes,
with advection set to zero.
Otherwise identical to the parent class. | 6259902463f4b57ef00864f7 |
class MakeFakeFileSet(TaskAction): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> TaskAction.__init__(self, *args, **kwargs) <NEW_LINE> with self.config.TaskWorker.envForCMSWEB: <NEW_LINE> <INDENT> configDict = {"cacheduration": 1, "pycurl": True} <NEW_LINE> self.resourceCatalog = CRIC(log... | This is needed to make WMCore.JobSplitting lib working...
do not like very much. Given that all is fake here I am
quite sure we only need total number of events said that I
set all the other parmas to dummy values. We may want to set
them in the future | 6259902426238365f5fada5c |
class MapTerrainType( _DataTableRow_NamedBits ): <NEW_LINE> <INDENT> __tablename__ = "map_terrain_types" | A map terrain type. | 62599024d18da76e235b78d3 |
class KernelFinder(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channel, out_channel, kernel_size=(3, 2, 2)): <NEW_LINE> <INDENT> super(KernelFinder, self).__init__() <NEW_LINE> self.kernel_size = (out_channel, *kernel_size) <NEW_LINE> self.features = nn.Sequential( nn.Conv2d(in_channel, 8, kernel_size=7... | Given a batch of images returns the convolution
kernel that should applied to each one of them | 62599024d164cc6175821e81 |
class _Start(cli.Command): <NEW_LINE> <INDENT> def setup(self): <NEW_LINE> <INDENT> cpu_count = multiprocessing.cpu_count() * 2 + 1 <NEW_LINE> parser = self._parser.add_parser( "start", help="Start the demo_proxy web worker.") <NEW_LINE> parser.add_argument( "--workers", type=int, default=int(os.environ.get("PROXY_WORK... | Start the demo_proxy web worker. | 625990248c3a8732951f7463 |
class GlossaryTermsLoader(TranslatableModelLoader): <NEW_LINE> <INDENT> FILE_EXTENSION = ".md" <NEW_LINE> @transaction.atomic <NEW_LINE> def load(self): <NEW_LINE> <INDENT> glossary_slugs = set() <NEW_LINE> for filename in listdir(self.get_localised_dir(get_default_language())): <NEW_LINE> <INDENT> if filename.endswith... | Custom loader for loading glossary terms. | 625990241d351010ab8f4a22 |
class RecentDaysTimeframe(Timeframe): <NEW_LINE> <INDENT> def __init__(self, days=14): <NEW_LINE> <INDENT> self._name = "Recent days ({0})".format(days) <NEW_LINE> self._end = datetime.datetime.utcnow() <NEW_LINE> self._start = self._end - datetime.timedelta(days=days) <NEW_LINE> self._days = days | Recent days timeframe (in UTC).
| 62599024a4f1c619b294f500 |
class Music(object): <NEW_LINE> <INDENT> __db = None <NEW_LINE> __url = None <NEW_LINE> def __init__(self, configFile = '163Spider.conf'): <NEW_LINE> <INDENT> self.__headers = { 'Host':'music.163.com', 'Referer':'http://music.163.com/', 'User-Agent':'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536... | docstring for Music | 62599024ac7a0e7691f733f6 |
class CoordSysMaker(object): <NEW_LINE> <INDENT> coord_sys_klass = CoordinateSystem <NEW_LINE> def __init__(self, coord_names, name='', coord_dtype=np.float): <NEW_LINE> <INDENT> self.coord_names = tuple(coord_names) <NEW_LINE> self.name = name <NEW_LINE> self.coord_dtype = coord_dtype <NEW_LINE> <DEDENT> def __call__(... | Class to create similar coordinate maps of different dimensions
| 62599024bf627c535bcb23c2 |
class Seq2SeqEncoder(d2l.Encoder): <NEW_LINE> <INDENT> def __init__(self, vocab_size, embed_size, num_hiddens, num_layers, dropout=0, **kwargs): <NEW_LINE> <INDENT> super().__init__(*kwargs) <NEW_LINE> self.embedding = tf.keras.layers.Embedding(vocab_size, embed_size) <NEW_LINE> self.rnn = src.Model.SequenceModel.RNN.R... | The RNN encoder for sequence to sequence learning.
Defined in :numref:`sec_seq2seq` | 6259902456b00c62f0fb37cc |
class SimpleProducer(Producer): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.partition_cycles = {} <NEW_LINE> self.random_start = kwargs.pop('random_start', True) <NEW_LINE> super(SimpleProducer, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def _next_partition(self, topic): <... | A simple, round-robin producer.
See Producer class for Base Arguments
Additional Arguments:
random_start (bool, optional): randomize the initial partition which
the first message block will be published to, otherwise
if false, the first message block will always publish
to partition 0 befo... | 62599024287bf620b6272afa |
class _SHH(ExecutionModifier): <NEW_LINE> <INDENT> __slots__ = ('retcode', 'timeout') <NEW_LINE> def __init__(self, retcode=0, timeout=None): <NEW_LINE> <INDENT> self.retcode = retcode <NEW_LINE> self.timeout = timeout <NEW_LINE> <DEDENT> def __rand__(self, cmd): <NEW_LINE> <INDENT> return cmd.run(retcode=self.retcode,... | plumbum execution modifier to ensure output is not echoed to terminal
essentially a no-op, this may be used to override argcmdr settings
and cli flags controlling this feature, on a line-by-line basis, to
hide unnecessary or problematic (e.g. highly verbose) command output. | 625990248c3a8732951f7464 |
class Configuracao(Enum): <NEW_LINE> <INDENT> CalcularDezenasSemPontuacao = 1 <NEW_LINE> EmailManual = 2 <NEW_LINE> ValorMinimoParaEnviarEmail = 3 <NEW_LINE> EmailAutomatico = 4 <NEW_LINE> VerificaJogoOnline = 5 | how to use
# from enums import Enums
# print(Enums(1)) //Enum.megasena
# print(Enums['megasena']) //Enum.megasena
# print(Enums.megasena) //Enum.megasena
# print(Enums.megasena.value) //1 | 62599024d99f1b3c44d065b1 |
class UnThread(CompositionCommand): <NEW_LINE> <INDENT> SYNOPSIS = (None, 'unthread', 'message/unthread', None) <NEW_LINE> HTTP_CALLABLE = ('GET', 'POST') <NEW_LINE> HTTP_QUERY_VARS = { 'mid': 'message-id'} <NEW_LINE> HTTP_POST_VARS = { 'subject': 'Update the metadata subject as well'} <NEW_LINE> def command(self): <NE... | Remove a message from a thread. | 625990243eb6a72ae038b573 |
class SpacyTokenizer(object): <NEW_LINE> <INDENT> def __init__(self, lang='en'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import spacy <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> raise ImportError("spacy not found. Install it using pip install spacy") <NEW_LINE> <DEDENT> self.lang = lang <NEW_LINE> ... | Spacy tokenizer
| 6259902421a7993f00c66e8b |
class MyNode(SCons.Node.Node): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> SCons.Node.Node.__init__(self) <NEW_LINE> self.name = name <NEW_LINE> self.Tag('found_includes', []) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> def get_found_includes(sel... | The base Node class contains a number of do-nothing methods that
we expect to be overridden by real, functional Node subclasses. So
simulate a real, functional Node subclass. | 6259902463f4b57ef00864fa |
class CarImage(object): <NEW_LINE> <INDENT> def __init__(self, filename='./topview_car_wagon.png'): <NEW_LINE> <INDENT> super(CarImage, self).__init__() <NEW_LINE> self.fig = plt.figure() <NEW_LINE> plt.rcParams['keymap.fullscreen'] = '' <NEW_LINE> plt.rcParams['keymap.home'] = '' <NEW_LINE> plt.rcParams['keymap.back']... | docstring for CarImage. | 62599024c432627299fa3f02 |
class PageListByUserView(LoginRequiredMixin, ListView): <NEW_LINE> <INDENT> queryset = Page.objects.all() <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = super(PageListByUserView, self).get_queryset() <NEW_LINE> queryset = queryset.filter(category__is_private=False, category__user__username=self.kwarg... | Lista páginas por usuario.
:URl: http://ip_servidor/user/<username>/page/listar | 62599024ac7a0e7691f733fa |
class RedisQueue(BaseQueue): <NEW_LINE> <INDENT> def setup_queue(self): <NEW_LINE> <INDENT> conn_instance = RedisConnPool.from_config(self.connection_params) <NEW_LINE> self.queue = conn_instance.get_conn() <NEW_LINE> <DEDENT> def put(self, data, queue_name=None): <NEW_LINE> <INDENT> if self.get_len(queue_name=queue_na... | this is a fifo Queue by redis | 6259902456b00c62f0fb37d0 |
class PRC(object): <NEW_LINE> <INDENT> logging_name = "isce.orbit.PRC.PRC" <NEW_LINE> @logged <NEW_LINE> def __init__(self, file=None): <NEW_LINE> <INDENT> self.filename = file <NEW_LINE> self.firstEpoch = 0 <NEW_LINE> self.lastEpoch = 0 <NEW_LINE> self.tdtOffset = 0 <NEW_LINE> self.orbit = Orbit() <NEW_LINE> self.orbi... | A class to parse orbit data from D-PAF | 62599024be8e80087fbbff88 |
class GlyphTextureAtlas(image.Texture): <NEW_LINE> <INDENT> region_class = Glyph <NEW_LINE> x = 0 <NEW_LINE> y = 0 <NEW_LINE> line_height = 0 <NEW_LINE> def apply_blend_state(self): <NEW_LINE> <INDENT> glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) <NEW_LINE> glEnable(GL_BLEND) <NEW_LINE> <DEDENT> def fit(self, imag... | A texture within which glyphs can be drawn.
| 6259902430c21e258be99726 |
class BaseLabel(Enum): <NEW_LINE> <INDENT> pass | Utility class to inherit from and use as type hint/validation.
Implementations: Labels, FormattedLabels | 625990245166f23b2e2442e5 |
class TopResult: <NEW_LINE> <INDENT> def __init__(self, soup): <NEW_LINE> <INDENT> self.link = "???" <NEW_LINE> linksoup = soup.find("a", {"class": "tab_item_overlay"}) <NEW_LINE> if linksoup is not None: <NEW_LINE> <INDENT> self.link = linksoup.get("href") <NEW_LINE> if self.link is None: <NEW_LINE> <INDENT> self.link... | Class containing information about the games on the front of the store (new releases, specials etc.) | 62599024d99f1b3c44d065b3 |
class Timer: <NEW_LINE> <INDENT> def __init__(self, timeout=0.0): <NEW_LINE> <INDENT> self._timeout = None <NEW_LINE> self._start_time = None <NEW_LINE> if timeout: <NEW_LINE> <INDENT> self.rewind_to(timeout) <NEW_LINE> <DEDENT> <DEDENT> @property <NEW_LINE> def expired(self): <NEW_LINE> <INDENT> return (monotonic() - ... | A reusable class to track timeouts, like an egg timer | 625990241d351010ab8f4a28 |
class UnknownRepositoryOrigin(PublisherError): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return _("Unknown repository origin '%s'") % self.data | Used to indicate that a repository URI could not be found in the
list of repository origins. | 6259902421bff66bcd723b74 |
class LandSetCreateView(View): <NEW_LINE> <INDENT> def post(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> json_dict = json.loads(request.body.decode()) <NEW_LINE> LandDistrict.objects.create(**json_dict) <NEW_LINE> return JsonResponse({"statue": 200, 'data': '添加成功'}, safe=False) <NEW_LINE> <DEDENT> excep... | 地区设置/上传 | 62599024a8ecb03325872130 |
class Client: <NEW_LINE> <INDENT> def execute(self): <NEW_LINE> <INDENT> benz_builder = BenzBuilder() <NEW_LINE> queue = [] <NEW_LINE> queue.append('start') <NEW_LINE> queue.append('stop') <NEW_LINE> queue.append('alarm') <NEW_LINE> benz_builder.set_queue(queue) <NEW_LINE> benz = benz_builder.get_carmodel() <NEW_LINE> ... | 没有导演类的客户端 | 62599024796e427e5384f68f |
class OSBlockINv2(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, reduction=4, T=4, **kwargs): <NEW_LINE> <INDENT> super(OSBlockINv2, self).__init__() <NEW_LINE> assert T >= 1 <NEW_LINE> assert out_channels >= reduction and out_channels % reduction == 0 <NEW_LINE> mid_channels = out_channe... | Omni-scale feature learning block with instance normalization. | 625990248c3a8732951f746a |
class RouteLoader(object): <NEW_LINE> <INDENT> def __init__(self, path_prefix, path=None, app_name=None): <NEW_LINE> <INDENT> if not path: <NEW_LINE> <INDENT> raise exception.UrlError('path arg not found!') <NEW_LINE> <DEDENT> if not app_name: <NEW_LINE> <INDENT> raise exception.UrlError('app_name arg not found!') <NEW... | 路由加载器,将路由加载进tornado的路由系统中,
path_prefix:为模块前缀,这样路由可以省去写前缀
path:由于设计为子应用形式,路由最终路径为 /path/你的路由,比如blog应用下的/index,会被解析为/blog/index,
如果不希望在路由前加/path,则为单个路由设置path='/',path为必填参数
app_name:设置为子应用的模块名,大小写必须相同,根据此设置来找模版位置,必填 | 62599024d99f1b3c44d065b5 |
class EventListener: <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def notify(self, event): <NEW_LINE> <INDENT> return | Class implementing a listener that can be notified of events. | 62599024c432627299fa3f06 |
class Fraction(SignedWord): <NEW_LINE> <INDENT> def __init__(self, at, divisor=1.0, step=0, optional=False): <NEW_LINE> <INDENT> SignedWord.__init__(self, at, step, optional=optional) <NEW_LINE> self.divisor = divisor <NEW_LINE> <DEDENT> def fetch(self, data, pos): <NEW_LINE> <INDENT> val = SignedWord.fetch(self, data,... | A fraction with the given divisor. | 6259902421bff66bcd723b76 |
class MultipleArduinosFoundError(Exception): <NEW_LINE> <INDENT> pass | Raised if multiple connected boards are found with the same serial number | 62599024a4f1c619b294f508 |
class SmoothnessKeyMobileSites(test.Test): <NEW_LINE> <INDENT> test = smoothness.Smoothness <NEW_LINE> page_set = 'page_sets/key_mobile_sites.json' | Measures rendering statistics while scrolling down the key mobile sites.
http://www.chromium.org/developers/design-documents/rendering-benchmarks | 62599024287bf620b6272b02 |
class Assays(APIView): <NEW_LINE> <INDENT> def get_object(self, uuid): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return Assay.objects.get(uuid=uuid) <NEW_LINE> <DEDENT> except (Assay.DoesNotExist, Assay.MultipleObjectsReturned): <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <DEDENT> <DEDENT> def get_query_set(self, s... | Return assay object
---
#YAML
GET:
serializer: AssaySerializer
omit_serializer: false
parameters:
- name: uuid
description: Assay uuid
paramType: query
type: string
required: false
- name: study
description: Study uuid
paramType... | 625990249b70327d1c57fc96 |
class Result(Data): <NEW_LINE> <INDENT> def __defaults__(self): <NEW_LINE> <INDENT> self.tag = 'Results' <NEW_LINE> pass <NEW_LINE> <DEDENT> def add_segment(self,new_seg): <NEW_LINE> <INDENT> tag = new_seg['tag'] <NEW_LINE> new_seg = Segment(new_seg) <NEW_LINE> self.segments[tag] = new_seg <NEW_LINE> return | SUAVE.Results()
Results Data | 6259902421a7993f00c66e91 |
class CarProcessor(DataProcessor): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.labels = set() <NEW_LINE> <DEDENT> def get_train_examples(self, data_dir): <NEW_LINE> <INDENT> logger.info("LOOKING AT {}".format(os.path.join(data_dir, "train.tsv"))) <NEW_LINE> return self._create_examples( self._read_... | Processor for Car. | 6259902456b00c62f0fb37d6 |
class Logger(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> logging.basicConfig(level=logging.INFO) <NEW_LINE> self.logger = logging.getLogger(Strings.APP_NAME) <NEW_LINE> self.logger.setLevel(logging.INFO) <NEW_LINE> <DEDENT> def info(self, message): <NEW_LINE> <INDENT> self.logger.info(message) ... | Wrapper class for logging | 6259902491af0d3eaad3ad3d |
class ReconnectableMySQLDatabase(RetryOperationalError, MySQLDatabase): <NEW_LINE> <INDENT> pass | In case of broken pipe or any connection outage, reconnect to DB | 62599024925a0f43d25e8f5d |
@pytest.mark.draft <NEW_LINE> @pytest.mark.components <NEW_LINE> @pytest.allure.story('Distributions') <NEW_LINE> @pytest.allure.feature('POST') <NEW_LINE> class Test_PFE_Components(object): <NEW_LINE> <INDENT> @pytest.allure.link('https://jira.qumu.com/browse/TC-46856') <NEW_LINE> @pytest.mark.Distributions <NEW_LINE>... | PFE Distributions test cases. | 625990249b70327d1c57fc98 |
class KarmaItemEncoder(json.JSONEncoder): <NEW_LINE> <INDENT> def default(self, o: Any) -> Any: <NEW_LINE> <INDENT> if isinstance(o, KarmaItem): <NEW_LINE> <INDENT> return {"name": o.name, "pluses": o.pluses, "minuses": o.minuses} <NEW_LINE> <DEDENT> return super().default(o) | This class defines how to JSON Serialize our KarmaItem class. We do this via
implementing the default() function which defines what to do with objects that the
JSON library is attempting to serialize. If the object happens to be an instance of
KarmaItem, we return the appropriate representation of the object, otherwise... | 625990246e29344779b01567 |
class SimulationState: <NEW_LINE> <INDENT> def __init__(self, cfg: RrtConfig, obstacles: list[Obstacle] = None) -> None: <NEW_LINE> <INDENT> self._cfg: RrtConfig = cfg <NEW_LINE> self.ax: plt.Axes = init_plot(cfg) <NEW_LINE> self.rr_tree: Node = cfg.start_node <NEW_LINE> self.obstacles: list[Obstacle] = obstacles if ob... | Container class holding the state of the path finding algorithm. | 625990243eb6a72ae038b57b |
class BackgroundInitialSyncTestCase(jsfile.DynamicJSTestCase): <NEW_LINE> <INDENT> JS_FILENAME = os.path.join("jstests", "hooks", "run_initial_sync_node_validation.js") <NEW_LINE> def __init__( self, logger, test_name, description, base_test_name, hook, shell_options=None): <NEW_LINE> <INDENT> jsfile.DynamicJSTestCase.... | BackgroundInitialSyncTestCase class. | 6259902430c21e258be9972c |
class MaskGenerator(torch.nn.Module): <NEW_LINE> <INDENT> def __init__( self, input_dim: int, num_sources: int, kernel_size: int, num_feats: int, num_hidden: int, num_layers: int, num_stacks: int, ): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.input_dim = input_dim <NEW_LINE> self.num_sources = num_sources <... | TCN (Temporal Convolution Network) Separation Module
Generates masks for separation.
Args:
input_dim (int): Input feature dimension, <N>.
num_sources (int): The number of sources to separate.
kernel_size (int): The convolution kernel size of conv blocks, <P>.
num_featrs (int): Input/output feature dim... | 6259902421bff66bcd723b7a |
class OpenFlowHandlers (object): <NEW_LINE> <INDENT> def __init__ (self): <NEW_LINE> <INDENT> self.handlers = [] <NEW_LINE> self._build_table() <NEW_LINE> <DEDENT> def handle_default (self, con, msg): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def add_handler (self, msg_type, handler): <NEW_LINE> <INDENT> if msg_type... | A superclass for a thing which handles incoming OpenFlow messages
The only public part of the interface is that it should have a "handlers"
attribute which is a list where the index is an OFPT and the value is a
function to call for that type with the parameters (connection, msg). Oh,
and the add_handler() method to ... | 62599024be8e80087fbbff90 |
class TextDocumentSaveReason: <NEW_LINE> <INDENT> MANUAL = 1 <NEW_LINE> AFTER_DELAY = 2 <NEW_LINE> FOCUS_OUT = 3 | LSP text document saving action causes. | 62599024d99f1b3c44d065bb |
class SpannerProjectsInstancesOperationsCancelRequest(_messages.Message): <NEW_LINE> <INDENT> name = _messages.StringField(1, required=True) | A SpannerProjectsInstancesOperationsCancelRequest object.
Fields:
name: The name of the operation resource to be cancelled. | 625990243eb6a72ae038b57d |
class TestGoldStarWithoutNumbers(SimpleTestCase): <NEW_LINE> <INDENT> def test_a(self): <NEW_LINE> <INDENT> response = self.client.get( path=reverse('gold_star'), data={'score': 'a'}) <NEW_LINE> self.assertTemplateUsed(response, 'app/gold_star.html') <NEW_LINE> <DEDENT> def test_empty(self): <NEW_LINE> <INDENT> respons... | without numbers, it should render gold_star.html without answer in the context | 62599024c432627299fa3f0c |
class AccountBook: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> year_data_path = os.path.join('Accountbook_project/Accountbook/dataset') <NEW_LINE> year_list = reversed(os.listdir(year_data_path)) <NEW_LINE> self.ledger = list() <NEW_LINE> for year in year_list: <NEW_LINE> <INDENT> year = int(year) <NEW_... | Account book for execution.
It loads all year, month and day account books
and will be used with functions(apps) in main.py | 625990248c3a8732951f7471 |
class AuditlogHistoryField(generic.GenericRelation): <NEW_LINE> <INDENT> def __init__(self, pk_indexable=True, **kwargs): <NEW_LINE> <INDENT> kwargs['to'] = LogEntry <NEW_LINE> if pk_indexable: <NEW_LINE> <INDENT> kwargs['object_id_field'] = 'object_id' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> kwargs['object_id_fi... | A subclass of django.contrib.contenttypes.generic.GenericRelation that sets some default variables. This makes it
easier to implement the audit log in models, and makes future changes easier.
By default this field will assume that your primary keys are numeric, simply because this is the most common case.
However, if ... | 625990245e10d32532ce4091 |
class InvenioBibSortWasherNotImplementedError(Exception): <NEW_LINE> <INDENT> pass | Exception raised when a washer method
defined in the bibsort config file is not implemented | 62599024a8ecb03325872138 |
class FrameLookup(object): <NEW_LINE> <INDENT> def __init__(self, names_and_lengths): <NEW_LINE> <INDENT> self.files, self.lengths = zip(*names_and_lengths) <NEW_LINE> self.terminals = numpy.cumsum([s[1] for s in names_and_lengths]) <NEW_LINE> <DEDENT> def __getitem__(self, i): <NEW_LINE> <INDENT> idx = (i < self.termi... | Class encapsulating the logic of turning a frame index into a
collection of files into the frame index of a specific video file.
Item-indexing on this object will yield a (filename, nframes, frame_no)
tuple, where nframes is the number of frames in the given file (mainly
for checking that we're far enough from the end... | 6259902556b00c62f0fb37da |
class hsl(_trivalue_array): <NEW_LINE> <INDENT> h = property(**_trivalue_array._0()) <NEW_LINE> s = property(**_trivalue_array._1()) <NEW_LINE> l = property(**_trivalue_array._2()) <NEW_LINE> def __init__(self, *pargs): <NEW_LINE> <INDENT> super(hsl, self).__init__(*pargs) <NEW_LINE> <DEDENT> def rgb(self): <NEW_LINE> ... | Hue Saturation Light class for color manipulation | 625990258c3a8732951f7472 |
class TestsEoxFSLoader(TestCase): <NEW_LINE> <INDENT> @patch('eox_theming.configuration.ThemingConfiguration.theming_helpers') <NEW_LINE> @patch('eox_theming.configuration.ThemingConfiguration.get_parent_or_default_theme') <NEW_LINE> def test_returned_default_theme_template_sources(self, parent_mock, helper_mock): <NEW... | Tests for the eox_theming filesystem loader | 62599025d99f1b3c44d065bd |
class Paginator: <NEW_LINE> <INDENT> def __init__(self, prefix='```', suffix='```', max_size=2000): <NEW_LINE> <INDENT> self.prefix = prefix <NEW_LINE> self.suffix = suffix <NEW_LINE> self.max_size = max_size - len(suffix) <NEW_LINE> self._current_page = [prefix] <NEW_LINE> self._count = len(prefix) + 1 <NEW_LINE> self... | A class that aids in paginating code blocks for Discord messages.
Attributes
-----------
prefix: str
The prefix inserted to every page. e.g. three backticks.
suffix: str
The suffix appended at the end of every page. e.g. three backticks.
max_size: int
The maximum amount of codepoints allowed in a page. | 62599025d164cc6175821e92 |
class Model(Wireframe): <NEW_LINE> <INDENT> def __init__(self, position, scale=1.0, **kwargs): <NEW_LINE> <INDENT> super(Model, self).__init__(**kwargs) <NEW_LINE> self.position = position <NEW_LINE> self.scale = scale | Represents a wireframe model in the game world.
Parameters
----------
position : numpy array (of size 3)
scale : float, optional
Attributes
----------
position : numpy array
scale : float | 62599025a8ecb0332587213a |
class Car(): <NEW_LINE> <INDENT> def __init__(self, make, model, year): <NEW_LINE> <INDENT> self.make = make <NEW_LINE> self.model = model <NEW_LINE> self.year = year <NEW_LINE> self.odometer_reading = 0 <NEW_LINE> <DEDENT> def get_descriptive_name(self): <NEW_LINE> <INDENT> long_name = str(self.year) + " " + self.make... | 一次模拟汽车的简单尝试 | 625990251d351010ab8f4a32 |
class Meta: <NEW_LINE> <INDENT> model = RegistrationRequest <NEW_LINE> exclude = ('uuid', 'created') | Meta class connecting to RegistrationRequest object model. | 625990255166f23b2e2442f1 |
class Lines(Shape): <NEW_LINE> <INDENT> def __init__(self, surface, rgb, pos_list): <NEW_LINE> <INDENT> Shape.__init__(self, pos_list, surface, rgb) <NEW_LINE> self.color = rgb <NEW_LINE> self.point_list = pos_list <NEW_LINE> <DEDENT> def draw(self): <NEW_LINE> <INDENT> pygame.draw.lines(self.surface, self.color, False... | Connected lines shape | 62599025d99f1b3c44d065bf |
class RubberBandPickUp(Collectible): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Collectible.__init__(self) <NEW_LINE> self.image = pygame.image.load("rubber_band.png") <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.name = "Rubber Band" <NEW_LINE> self.stock = RUBBER_BAND_STOCK | A class to represent rubber bands that Snake can use as a weapon. | 6259902563f4b57ef0086501 |
class RoiPoolingConv(Layer): <NEW_LINE> <INDENT> def __init__(self, pool_size, num_rois, **kwargs): <NEW_LINE> <INDENT> self.dim_ordering = K.common.image_dim_ordering() <NEW_LINE> self.pool_size = pool_size <NEW_LINE> self.num_rois = num_rois <NEW_LINE> super(RoiPoolingConv, self).__init__(**kwargs) <NEW_LINE> <DEDENT... | ROI pooling layer for 2D inputs.
See Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition,
K. He, X. Zhang, S. Ren, J. Sun
# Arguments
pool_size: int
Size of pooling region to use. pool_size = 7 will result in a 7x7 region.
num_rois: number of regions of interest to be used
# In... | 6259902530c21e258be99734 |
class AlphaBetaAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def alBeAgent(self, state, depth, index, alpha, beta): <NEW_LINE> <INDENT> if index == 0: <NEW_LINE> <INDENT> return (self.maxAgent(state, depth, index, alpha, beta)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return (self.minAgent(state, depth, index,... | Your minimax agent with alpha-beta pruning (question 3) | 625990251f5feb6acb163b10 |
class CustomJSONEncoder(JSONEncoder): <NEW_LINE> <INDENT> def default(self, obj): <NEW_LINE> <INDENT> if isinstance(obj, Question): <NEW_LINE> <INDENT> return { 'question': obj.question, 'answer': obj.answer, 'distractors': obj.distractors, } <NEW_LINE> <DEDENT> return super().default(obj) | Class to turn Question object to JSON | 62599025d18da76e235b78dd |
class RegistrationSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> password = serializers.CharField( max_length=128, min_length=8, write_only=True ) <NEW_LINE> token = serializers.CharField(max_length=255, read_only=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ['email', ... | Serializers, registration requests and creates a new user | 625990251d351010ab8f4a35 |
class WorkSubmissionDownloadTest(test_utils.GCIDjangoTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(WorkSubmissionDownloadTest, self).setUp() <NEW_LINE> self.init() <NEW_LINE> self.timeline_helper.tasksPubliclyVisible() <NEW_LINE> self.task = _createTestTask(self.program, self.org) <NEW_LINE>... | Tests the WorkSubmissionDownload class. | 62599025c432627299fa3f12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.