code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class LearnerInterrupt(Exception): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(LearnerInterrupt,self).__init__() | Exception that is raised when the learner is ended with the end flag or event. | 62598f9507f4c71912baf11a |
class LinkCollector: <NEW_LINE> <INDENT> def __init__( self, session, search_scope, ): <NEW_LINE> <INDENT> self.search_scope = search_scope <NEW_LINE> self.session = session <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def create(cls, session, options, suppress_no_index=False): <NEW_LINE> <INDENT> index_urls = [options.... | Responsible for collecting Link objects from all configured locations,
making network requests as needed.
The class's main method is its collect_sources() method. | 62598f9563d6d428bbee248d |
class TestPDU_Equality(unittest.TestCase): <NEW_LINE> <INDENT> def test_equality(self): <NEW_LINE> <INDENT> self.assertTrue(PDU() == PDU()) <NEW_LINE> self.assertFalse(PDU() == 'TEST') <NEW_LINE> pdu = PDU() <NEW_LINE> pdu.formats = ['a'] <NEW_LINE> self.assertFalse(pdu == PDU()) <NEW_LINE> <DEDENT> def test_inequality... | Test the PDU equality/inequality operators. | 62598f95d53ae8145f91815c |
class Pagamento(Entrega): <NEW_LINE> <INDENT> def __init__(self, pagamento): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.pagamento = pagamento | Formas de pgamento | 62598f9573bcbd0ca4bc9f28 |
class NoFieldsSpecified(exceptions.Error): <NEW_LINE> <INDENT> pass | Error for calling update command with no args that represent fields. | 62598f9526068e7796d4c631 |
class Square(Rectangle): <NEW_LINE> <INDENT> def __init__(self, size, x=0, y=0, id=None): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> super().__init__(size, size, x, y, id) <NEW_LINE> <DEDENT> @property <NEW_LINE> def size(self): <NEW_LINE> <INDENT> return self.width <NEW_LINE> <DEDENT> @size.setter <NEW_LINE> def ... | Create the square class heritance of rectangle | 62598f95d6c5a102081e1e13 |
class StoreListing(BaseListing): <NEW_LINE> <INDENT> store = models.ForeignKey('store.Store', related_name='listings') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name_plural = 'store listings' <NEW_LINE> ordering = ['-created_at',] | A unique listing belonging to a store.
Inherites base model fields: product, currency, retail_price, sale_price, wholesale_price
Inherits mixin fields: created_at, modified_at, published_at, unpublished_at, valid_at, expired_at, slug | 62598f957d847024c075c0a3 |
class TestItemsApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = meli.api.items_api.ItemsApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_items_id_get(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_items_id_put(se... | ItemsApi unit test stubs | 62598f95baa26c4b54d4ef7f |
class IRCUser(namedtuple('_IRCUser', 'raw nick user host')): <NEW_LINE> <INDENT> REGEX = re.compile(r'(?P<raw>(?P<nick>[^!]+)(!~*(?P<user>[^@]+))?(@(?P<host>.+))?)') <NEW_LINE> @classmethod <NEW_LINE> def parse(cls, raw): <NEW_LINE> <INDENT> return cls(**cls.REGEX.match(raw).groupdict()) | Provide access to the parts of an IRC user string.
The following parts of the user string are available, set to *None* if that
part of the string is absent:
:param raw: Raw user string
:param nick: Nick of the user
:param user: Username of the user (excluding leading ``~``)
:param host: Hostname of the user
>>> u = ... | 62598f95498bea3a75a577f1 |
class newktgg(): <NEW_LINE> <INDENT> need_check_ziduan = ['main', 'city', 'bbd_dotime', 'title' ] <NEW_LINE> def check_main(self, indexstr, ustr): <NEW_LINE> <INDENT> ret = None <NEW_LINE> if ustr and len(ustr): <NEW_LINE> <INDENT> if all(not public.is_chinese(c) for c in ustr): <NEW_LINE> <INDENT> ret = u'不包含中文' <NEW_... | 开庭公告 | 62598f950c0af96317c56053 |
class itkInPlaceImageFilterIUS3IRGBUS3(itkImageToImageFilterBPython.itkImageToImageFilterIUS3IRGBUS3): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined"... | Proxy of C++ itkInPlaceImageFilterIUS3IRGBUS3 class | 62598f95379a373c97d98ce3 |
class GetMyExcel: <NEW_LINE> <INDENT> def __init__(self, excel): <NEW_LINE> <INDENT> self.wb = load_workbook(excel) <NEW_LINE> self.sheetnames = self.wb.sheetnames <NEW_LINE> <DEDENT> def get_sheet_data(self): <NEW_LINE> <INDENT> lines = [] <NEW_LINE> for sheetname in self.sheetnames: <NEW_LINE> <INDENT> sheet = self.w... | 读取excel数据 | 62598f95507cdc57c63a4a64 |
class ShortThrower(ThrowerAnt): <NEW_LINE> <INDENT> name = 'Short' <NEW_LINE> food_cost = 2 <NEW_LINE> armor = 1 <NEW_LINE> max_range = 3 <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> def nearest_bee(self, beehive): <NEW_LINE> <INDENT> spot = self.place <NEW_LINE> moving = 0 <NEW_LINE> for i in range(self.min_range): ... | A ThrowerAnt that only throws leaves at Bees at most 3 places away. | 62598f9516aa5153ce4001cd |
class Module(models.Model): <NEW_LINE> <INDENT> module_id = models.CharField(max_length=13, unique=True, verbose_name=_("module id")) <NEW_LINE> name_de = models.CharField(max_length=128, verbose_name=_("german name")) <NEW_LINE> name_en = models.CharField(max_length=128, verbose_name=_("english name"), blank = True) <... | A module (e.g. readings, exercise groups, ...) that porvides literature
recommendations which can be looked up through the system. A module has
a dedicated module_id from the university campus management system,
as well as a name and information on when it was last offered.
The name TUCaN refers to the TU Darmstadt Ca... | 62598f95a219f33f346c64eb |
class Person(BaseNode): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return self.name | An object representing a senator or representative. | 62598f95b5575c28eb712b34 |
class VersionInvalid(voluptuous.Invalid): <NEW_LINE> <INDENT> pass | Incorrect version number | 62598f954428ac0f6e6581fb |
class FeatureFlipper(AbstractFeatureFlipper): <NEW_LINE> <INDENT> USER_FEATURE_FIELD = 'user' <NEW_LINE> user = models.ForeignKey( flipper_settings.AUTH_USER_MODEL, on_delete=models.CASCADE) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> swappable = 'FEATURE_FLIPPER_MODEL' | A feature flipper hooked up to the Django User referenced by the user's
settings. This provides a simple flipper class that most developers can use
out of the box | 62598f95baa26c4b54d4ef80 |
class LabelSmoothing(nn.Module): <NEW_LINE> <INDENT> def __init__(self, size, padding_idx, smoothing=0.0): <NEW_LINE> <INDENT> super(LabelSmoothing, self).__init__() <NEW_LINE> self.criterion = nn.KLDivLoss(size_average=False) <NEW_LINE> self.padding_idx = padding_idx <NEW_LINE> self.confidence = 1.0 - smoothing <NEW_L... | Implement label smoothing.定义的一个损失函数 | 62598f958da39b475be02eb3 |
class GetConfig(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.pwd = os.path.split(os.path.realpath(__file__))[0] <NEW_LINE> self.config_path = os.path.join(os.path.split(self.pwd)[0], 'config.ini') <NEW_LINE> self.config_file = ConfigParser() <NEW_LINE> self.config_file.read(self.config_path... | to get config from config.ini | 62598f9576e4537e8c3ef284 |
class Hash: <NEW_LINE> <INDENT> def __init__(self, password: str, uuid: int | str, salt: bytes = None, key: bytes = None, hash_password: str = None) -> None: <NEW_LINE> <INDENT> if salt is None: <NEW_LINE> <INDENT> self.salt = urandom(16) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.salt = salt <NEW_LINE> <DEDENT... | Generates password hashes, hashes for sessions, authenticator token,
checks password hashes.
Args:
password (str, required): password
uuid (int or str, required): unique user identity number
salt (bytes | None, required): additional unique identifier which added
to the pa... | 62598f9523e79379d538c1d2 |
class DengLuPage(SuperPage): <NEW_LINE> <INDENT> def __init__(self, testcase, driver, logger): <NEW_LINE> <INDENT> super(DengLuPage, self).__init__(testcase, driver, logger) <NEW_LINE> <DEDENT> def validSelf(self): <NEW_LINE> <INDENT> logger.info("Check 登录页面 begin") <NEW_LINE> API().assertElementByResourceId(self.testc... | 作者 乔佳溪
登录 | 62598f9501c39578d7f12a5a |
class CircularArray(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.array = [] <NEW_LINE> <DEDENT> def add_item(self, item): <NEW_LINE> <INDENT> self.array.append(item) <NEW_LINE> <DEDENT> def get_by_index(self, index): <NEW_LINE> <INDENT> if index < len(self.array): <NEW_LINE> <INDENT> return... | An array that may be rotated, and items retrieved by index | 62598f95925a0f43d25e7d0d |
class footprintMicroswitchSmt6x4(footprintSmdDualRow): <NEW_LINE> <INDENT> def __init__(self, density, name="", alternativeLibName="niceSwitches"): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> name="MicroswitchSmd6x4_%s" % ( density) <NEW_LINE> <DEDENT> padSizes={"L":[1.2,1.3], "N":[1.4,1.5], "M":[1.6,1.7]} <NE... | SMT microswitch 6x4mm | 62598f9563d6d428bbee248f |
class CreateRoomView(LoginRequiredMixin, KwargsEventView, generic.CreateView): <NEW_LINE> <INDENT> model = Room <NEW_LINE> form_class = RoomForm <NEW_LINE> template_name = 'talks/crud_room.html' <NEW_LINE> def get_success_url(self): <NEW_LINE> <INDENT> url = r( 'talks:rooms', kwargs={ 'event': self.kwargs['event'] } ) ... | View de criação de uma sala | 62598f95d53ae8145f91815e |
class MaskedSoftmaxCELoss(tf.keras.losses.Loss): <NEW_LINE> <INDENT> def __init__(self, valid_len): <NEW_LINE> <INDENT> super().__init__(reduction='none') <NEW_LINE> self.valid_len = valid_len <NEW_LINE> <DEDENT> def call(self, label, pred): <NEW_LINE> <INDENT> weights = tf.ones_like(label, dtype=tf.float32) <NEW_LINE>... | The softmax cross-entropy loss with masks.
Defined in :numref:`sec_seq2seq_decoder` | 62598f958a43f66fc4bf1e4d |
class APIError(BetfairError): <NEW_LINE> <INDENT> def __init__(self, response, method=None, params=None, exception=None): <NEW_LINE> <INDENT> if response: <NEW_LINE> <INDENT> error_data = response.get('error') <NEW_LINE> message = '%s \nParams: %s \nException: %s \nError: %s \nFull Response: %s' % ( method, params, exc... | Exception raised if error is found. | 62598f95ac7a0e7691f721de |
class WorldEngineDialog(QtGui.QDialog, Ui_WorldEngineDialog): <NEW_LINE> <INDENT> def __init__(self, iface): <NEW_LINE> <INDENT> self.iface = iface <NEW_LINE> QtGui.QDialog.__init__(self) <NEW_LINE> self.setupUi(self) <NEW_LINE> self.setWindowTitle('WorldEngine') <NEW_LINE> self.distanceSpinBox.setValue(1) <NEW_LINE> s... | Setting up User Interface
| 62598f95e76e3b2f99fd8708 |
class EmptyDashboard(Dashboard): <NEW_LINE> <INDENT> pass | Funcao em branco. | 62598f9526068e7796d4c633 |
@dataclass(frozen=True) <NEW_LINE> class Block(StateChange): <NEW_LINE> <INDENT> block_number: BlockNumber <NEW_LINE> gas_limit: BlockGasLimit <NEW_LINE> block_hash: BlockHash <NEW_LINE> def __post_init__(self) -> None: <NEW_LINE> <INDENT> typecheck(self.block_number, T_BlockNumber) | Transition used when a new block is mined.
Args:
block_number: The current block_number. | 62598f95a8ecb03325870eda |
class Parser: <NEW_LINE> <INDENT> def __init__(self, tokens): <NEW_LINE> <INDENT> self.tokens = tokens <NEW_LINE> <DEDENT> def parser(self): <NEW_LINE> <INDENT> print("test") | intialize parser | 62598f95851cf427c66b7f98 |
class RSTIncludeSpy(Include): <NEW_LINE> <INDENT> include_contents = [] <NEW_LINE> @classmethod <NEW_LINE> def get_include_contents(cls): <NEW_LINE> <INDENT> val = ''.join(cls.include_contents) <NEW_LINE> cls.include_contents = [] <NEW_LINE> return val <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> read_text_fi... | Tracing reStructuredText include directive
Determine the exact content included by a docutils publishing run.
Include directive that tracks the contents included into a published
reStructuredText document. As include directives are processed, the
spy saves the output of each ``run`` call before handing them back
to t... | 62598f957d847024c075c0a5 |
@six.add_metaclass(abc.ABCMeta) <NEW_LINE> class OpportunisticFixture(DbFixture): <NEW_LINE> <INDENT> DRIVER = abc.abstractproperty(lambda: None) <NEW_LINE> DBNAME = PASSWORD = USERNAME = 'openstack_citest' <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self._provisioning_engine = provision.get_engine( utils.get_conne... | Base fixture to use default CI databases.
The databases exist in OpenStack CI infrastructure. But for the
correct functioning in local environment the databases must be
created manually. | 62598f950fa83653e46f4bbb |
class PostDeleteHandler(Handler): <NEW_LINE> <INDENT> @user_logged_in <NEW_LINE> @post_exists <NEW_LINE> @user_owns_post <NEW_LINE> def post(self, post_id, post=None, user=None): <NEW_LINE> <INDENT> likes = post.likes <NEW_LINE> comments = post.comments <NEW_LINE> for comment in comments: <NEW_LINE> <INDENT> comment.de... | Handles delete requests | 62598f953cc13d1c6d46543f |
class ThrowerAnt(Ant): <NEW_LINE> <INDENT> name = 'Thrower' <NEW_LINE> implemented = True <NEW_LINE> damage = 1 <NEW_LINE> food_cost = 4 <NEW_LINE> min_range = 0 <NEW_LINE> max_range = 10 <NEW_LINE> def nearest_bee(self, hive): <NEW_LINE> <INDENT> def helper(place, hive, count): <NEW_LINE> <INDENT> if place is hive: <N... | ThrowerAnt throws a leaf each turn at the nearest Bee in its range. | 62598f950c0af96317c56055 |
@base.ReleaseTracks(base.ReleaseTrack.ALPHA) <NEW_LINE> class RemoveHostRuleAlpha(RemoveHostRule): <NEW_LINE> <INDENT> URL_MAP_ARG = None <NEW_LINE> @classmethod <NEW_LINE> def Args(cls, parser): <NEW_LINE> <INDENT> cls.URL_MAP_ARG = flags.UrlMapArgument(include_alpha=True) <NEW_LINE> cls.URL_MAP_ARG.AddArgument(parser... | Remove a host rule from a URL map.
*{command}* is used to remove a host rule from a URL map. When
a host rule is removed, its path matcher is only removed if
it is not referenced by any other host rules and
`--delete-orphaned-path-matcher` is provided.
## EXAMPLES
To remove a host rule that contains the host `example... | 62598f95dd821e528d6d8c07 |
class Chart(object): <NEW_LINE> <INDENT> def __init__(self, chartSpace, chart_part): <NEW_LINE> <INDENT> super(Chart, self).__init__() <NEW_LINE> self._chartSpace = chartSpace <NEW_LINE> self._chart_part = chart_part <NEW_LINE> <DEDENT> @property <NEW_LINE> def category_axis(self): <NEW_LINE> <INDENT> catAx = self._cha... | A chart object. | 62598f95b830903b9686e2dd |
class OnapSecurityNodePortsCerts(K8sTesting): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(OnapSecurityNodePortsCerts, self).__init__(**kwargs) <NEW_LINE> os.chdir('/usr/lib/python3.8/site-packages/check_certificates') <NEW_LINE> self.cmd = ['python3', 'check_certificates_validity.py', '-... | Check the cerfificates for the nodeports. | 62598f9545492302aabfc1ab |
class AllSettings(GeneratedSettings): <NEW_LINE> <INDENT> pass | Define the settings (config) of the website.
The selected value is determined as follows (in descending order of priority):
1. The command line arguments, e.g., '--db-host' is mapped to 'db_host'
2. Environment variables, e.g., '$DB_HOST' is mapped to 'db_host'
3. Variables loaded from a dotenv (.env) file, e.g., 'DB_... | 62598f95a4f1c619b294e2be |
class SgrCoordinates(coord.SphericalCoordinatesBase): <NEW_LINE> <INDENT> __doc__ = __doc__.format(params=coord.SphericalCoordinatesBase. _init_docstring_param_templ. format(lonnm='Lambda', latnm='Beta')) <NEW_LINE> def __init__(self, *ar... | A spherical coordinate system defined by the orbit of the Sagittarius
dwarf galaxy, as described in
http://adsabs.harvard.edu/abs/2003ApJ...599.1082M
and further explained in
http://www.astro.virginia.edu/~srm4n/Sgr/. | 62598f95596a897236127951 |
class OperationalException(TradingbotException): <NEW_LINE> <INDENT> pass | Requires manual intervention and will stop the bot.
Most of the time, this is caused by an invalid Configuration. | 62598f95287bf620b6271892 |
class Event(list): <NEW_LINE> <INDENT> def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> for listener in self: <NEW_LINE> <INDENT> listener(*args, **kwargs) | Event.
An event is a callable object that delegate all the calls to a set
of callable objects previously registered as listeners. The event
implement the :class:`list` interface and you can use it to register and
un-register event listeners. | 62598f95b7558d5895463301 |
class AnagraficaGasRefrigeranteDetail(AnagraficaDetail): <NEW_LINE> <INDENT> def __init__(self, anagrafica): <NEW_LINE> <INDENT> AnagraficaDetail.__init__(self, anagrafica) <NEW_LINE> <DEDENT> def setDao(self, dao): <NEW_LINE> <INDENT> self.dao = dao <NEW_LINE> if dao is None: <NEW_LINE> <INDENT> self.dao = GasRefriger... | Dettaglio dell'anagrafica delle gas refrigerante
| 62598f950a50d4780f7050aa |
class Serializer(PythonSerializer): <NEW_LINE> <INDENT> internal_use_only = False <NEW_LINE> def handle_field(self, obj, field): <NEW_LINE> <INDENT> if isinstance(field, schema.TimeField) and getattr(obj, field.name) is not None: <NEW_LINE> <INDENT> self._current[field.name] = str(getattr(obj, field.name)) <NEW_LINE> <... | Convert a queryset to YAML. | 62598f9538b623060ffa8d5f |
class Interface(object): <NEW_LINE> <INDENT> def __init__( self, i_address="02D5F1DD31E0", i_description="Dell GigabitEthernet", i_id="{C5F468C0-DD5F-4C2B-939F-A411DCB5DE16}", i_name="Ethernet", i_receive_only=False, i_status=1, i_type=6, ): <NEW_LINE> <INDENT> self.PhysicalAddress = PhysicalAddress(i_address) <NEW_LIN... | Mocked interface object | 62598f9501c39578d7f12a5c |
class UPSError(Exception): <NEW_LINE> <INDENT> pass | UPS error. | 62598f9563d6d428bbee2491 |
class ContextStack(object): <NEW_LINE> <INDENT> def __init__(self, *items): <NEW_LINE> <INDENT> self._stack = list(items) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "%s%s" % (self.__class__.__name__, tuple(self._stack)) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def create(*context, **kwargs):... | Provides dictionary-like access to a stack of zero or more items.
Instances of this class are meant to act as the rendering context
when rendering Mustache templates in accordance with mustache(5)
and the Mustache spec.
Instances encapsulate a private stack of hashes, objects, and built-in
type instances. Querying t... | 62598f9573bcbd0ca4bc9f2c |
class KeyEvent(object): <NEW_LINE> <INDENT> def __init__(self, c, char, event, shortcut, w, x=None, y=None, x_root=None, y_root=None, ): <NEW_LINE> <INDENT> trace = False <NEW_LINE> assert not g.isStroke(shortcut), g.callers() <NEW_LINE> stroke = g.KeyStroke(shortcut) if shortcut else None <NEW_LINE> if trace: g.trace(... | A gui-independent wrapper for gui events. | 62598f9507d97122c4216985 |
class evaluate_2parts_size_ratio_discrete: <NEW_LINE> <INDENT> def __init__(self,p_slope_d, p_Transed_l, eg_p_l, p_l): <NEW_LINE> <INDENT> self.p_slope_d = p_slope_d <NEW_LINE> self.p_Transed_l = p_Transed_l <NEW_LINE> self.eg_p_l = eg_p_l <NEW_LINE> self.p_l = p_l <NEW_LINE> <DEDENT> def calculate_dim(self): <NEW_LINE... | 判断字的两个组成部分的大小比例(上收下放),可以是由离散的点组成的两部分 | 62598f9591af0d3eaad39adb |
class MongoCache_qcwy(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.client = MongoClient('localhost', 27017) <NEW_LINE> self.db = self.client.cache <NEW_LINE> qcwy = self.db.qcwy <NEW_LINE> self.db.qcwy.create_index('url') <NEW_LINE> <DEDENT> def __setitem__(self, key, value): <NEW_LINE> <IN... | 前程无忧url | 62598f958e71fb1e983bb788 |
class Solution: <NEW_LINE> <INDENT> def mergeSortedArray(self, A, m, B, n): <NEW_LINE> <INDENT> C = A[:] <NEW_LINE> i = 0 <NEW_LINE> j = 0 <NEW_LINE> k = 0 <NEW_LINE> while i < m and j < n: <NEW_LINE> <INDENT> if C[i] < B[j]: <NEW_LINE> <INDENT> A[k] = C[i] <NEW_LINE> i += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT... | @param: A: sorted integer array A which has m elements, but size of A is m+n
@param: m: An integer
@param: B: sorted integer array B which has n elements
@param: n: An integer
@return: nothing | 62598f95236d856c2adc92a1 |
class ModelChoiceFieldMixin: <NEW_LINE> <INDENT> def get_field_info(self, field): <NEW_LINE> <INDENT> field_info = super().get_field_info(field) <NEW_LINE> if (not field_info.get('read_only') and isinstance(field, ModelChoiceField) and hasattr(field, 'choices')): <NEW_LINE> <INDENT> field_info['choices'] = [ { 'value':... | Mixin for displaying field choices based on model data. | 62598f95379a373c97d98ce6 |
class DynamicObstaclesEnv(MiniGridEnv): <NEW_LINE> <INDENT> def __init__( self, size=8, agent_start_pos=(1, 1), agent_start_dir=0, n_obstacles=4 ): <NEW_LINE> <INDENT> self.agent_start_pos = agent_start_pos <NEW_LINE> self.agent_start_dir = agent_start_dir <NEW_LINE> if n_obstacles <= size/2 + 1: <NEW_LINE> <INDENT> se... | Single-room square grid environment with moving obstacles | 62598f950fa83653e46f4bbd |
class NormalPolicyFixedStd(tf.keras.Model): <NEW_LINE> <INDENT> def __init__(self, action_space_size, std, layer_arguments=None): <NEW_LINE> <INDENT> super(NormalPolicyFixedStd, self).__init__() <NEW_LINE> if layer_arguments is None: <NEW_LINE> <INDENT> layer_arguments = {} <NEW_LINE> <DEDENT> self.linear_layer = tf.ke... | Normal policy with a fixed standard deviation. | 62598f95fbf16365ca793d89 |
class UserMNG_Sitemap(Sitemap): <NEW_LINE> <INDENT> changeFreq = "monthly" <NEW_LINE> priority = 0.6 <NEW_LINE> lastmod = datetime.now() <NEW_LINE> protocol = "https" <NEW_LINE> def items(self): <NEW_LINE> <INDENT> return ["register", "login", "reset_password", "userMng_index"] <NEW_LINE> <DEDENT> def location(self, it... | create a sitemap for some additional User Management pages | 62598f95435de62698e9bac7 |
class SingleBucketList(Resource): <NEW_LINE> <INDENT> @auth.login_required <NEW_LINE> def get(self, id): <NEW_LINE> <INDENT> bucketlist = Bucketlist.query.filter_by(id=id).first() <NEW_LINE> if bucketlist: <NEW_LINE> <INDENT> if bucketlist.created_by == g.user.id: <NEW_LINE> <INDENT> return {"id": bucketlist.id, "name"... | Fetching a single bucketlist by ID | 62598f95dd821e528d6d8c09 |
class robCRS97(robCRS, object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.description = 'CRS 1997 with gripper' <NEW_LINE> self.hhirc = [-182500, 252, -63625, 99200, 14300, -98150] <NEW_LINE> self.bound = [[-370000, -100000, -190000, -5000, -44000, -199500], [10000, 100000, 65000, 202000, 72000, ... | Robot specification: CRS97 | 62598f95a05bb46b3848a553 |
class MreAppa(MelRecord): <NEW_LINE> <INDENT> rec_sig = b'APPA' <NEW_LINE> melSet = MelSet( MelEdid(), MelVmad(), MelBounds(), MelFull(), MelModel(), MelIcons(), MelDestructible(), MelPickupSound(), MelDropSound(), MelUInt32(b'QUAL', 'quality'), MelDescription(), MelValueWeight(), ) <NEW_LINE> __slots__ = melSet.getSlo... | Alchemical Apparatus. | 62598f9599cbb53fe6830ba4 |
class RequestError(OSError): <NEW_LINE> <INDENT> def __init__(self, response, content): <NEW_LINE> <INDENT> self.response = response <NEW_LINE> self.content = content <NEW_LINE> try: <NEW_LINE> <INDENT> message = json.loads(content)['error'] <NEW_LINE> <DEDENT> except StandardError: <NEW_LINE> <INDENT> message = conten... | Exception class for errors while making a request. | 62598f95379a373c97d98ce7 |
class TestKeepImageSettings(EsptoolTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestKeepImageSettings, self).setUp() <NEW_LINE> self.BL_IMAGE = { "esp8266": "images/esp8266_sdk/boot_v1.4(b1).bin", "esp32": "images/bootloader_esp32.bin", "esp32s2": "images/bootloader_esp32s2.bin", }[chip] <N... | Tests for the -fm keep, -ff keep options for write_flash | 62598f950c0af96317c56058 |
class InterfaceHistory(Document): <NEW_LINE> <INDENT> meta = {'collection': 'interface_history'} <NEW_LINE> interfaceId = ReferenceField(Interface, required=True, unique=True) <NEW_LINE> records = SortedListField(EmbeddedDocumentField(History), default=[], ordering="createTime", reverse=True) <NEW_LINE> createTime = Da... | 接口信息 | 62598f95a17c0f6771d5bf10 |
class ThreadModelWorker(QtCore.QObject): <NEW_LINE> <INDENT> def __init__(self, model): <NEW_LINE> <INDENT> super(ThreadModelWorker, self).__init__() <NEW_LINE> self.signals = WorkerSignals() <NEW_LINE> self.model = model <NEW_LINE> <DEDENT> @Slot() <NEW_LINE> def run(self): <NEW_LINE> <INDENT> self.signals.started.emi... | The worker objects wraps the code that is to be run on the QThread, allowing us to "move" the instance of this class
into the thread (this prevents us needing to inherit from QThread, with is not a QObject, which causes many issues
for parenting widgets and managing the threading). | 62598f9507d97122c4216986 |
class Hill_Climbing: <NEW_LINE> <INDENT> def __init__ (self, weights,controller): <NEW_LINE> <INDENT> self.__weights = deepcopy(weights) <NEW_LINE> self.__result = controller.run_episode(weights) <NEW_LINE> self.__new_weight_got = True <NEW_LINE> <DEDENT> def climb (self, controller): <NEW_LINE> <INDENT> while (self.__... | Classe Hill_Climbing - Executa o Hill_Climbing alterando os thetas com -1 e com +1
Chamar com:
hill = Hill_Climbing(weights,self)
weights = hill.climb(self) | 62598f95287bf620b6271894 |
class QueueMessage: <NEW_LINE> <INDENT> def __init__(self, command, argsList=list()): <NEW_LINE> <INDENT> self.command = command <NEW_LINE> self.args = argsList <NEW_LINE> <DEDENT> def getArgs(self): <NEW_LINE> <INDENT> return self.args <NEW_LINE> <DEDENT> def getCommand(self): <NEW_LINE> <INDENT> return self.command <... | Data structure to hold the Messages accepted by the QueueProcessor | 62598f9530dc7b766599f527 |
class Entity (object): <NEW_LINE> <INDENT> name = "Unnamed" <NEW_LINE> NO_LOG = False <NEW_LINE> LOG_LEVEL = "debug" <NEW_LINE> def __lt__(self, other): <NEW_LINE> <INDENT> return self.name < other.name <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def create (cls, name, *args, **kw): <NEW_LINE> <INDENT> return core.Crea... | Base class for all entities (switches, hosts, etc.). | 62598f95dd821e528d6d8c0a |
class FileTransferServer(StreamServer): <NEW_LINE> <INDENT> def __init__(self, host, port): <NEW_LINE> <INDENT> super(FileTransferServer, self).__init__(host, port) <NEW_LINE> self.recv_collection = set() <NEW_LINE> <DEDENT> def handle_connection(self, client_sock): <NEW_LINE> <INDENT> client_info = str(client_sock.get... | A simple server to transfer file from one client to another.
The file data is packed in a message.
Message format: | Messagelen | opcode | filedata
|---4bytes---|-1bytes-|---------
Message types:
opcode=0:send file data
opcode=1:recv file data
If a client wants to receive file data , it will ... | 62598f958da39b475be02eb8 |
class DltRansacModel: <NEW_LINE> <INDENT> def __init__(self,X3d,x2d,debug=False): <NEW_LINE> <INDENT> self.X3dht = np.hstack((X3d, np.ones( (len(X3d),1)))).T <NEW_LINE> self.x2dt = x2d.T <NEW_LINE> self.fullB,self.fullc = build_Bc(X3d,x2d) <NEW_LINE> self.debug = debug <NEW_LINE> <DEDENT> def fit(self, data): <NEW_LINE... | linear system solved using linear least squares
This class serves as an example that fulfills the model interface
needed by the ransac() function. | 62598f9507f4c71912baf120 |
class LayerNormalization(_BaseNormalization): <NEW_LINE> <INDENT> def __init__(self, axes=None, bias_axes=[-1], epsilon=1e-3, **kwargs): <NEW_LINE> <INDENT> super(LayerNormalization, self).__init__(**kwargs) <NEW_LINE> self.axes = axes <NEW_LINE> self.bias_axes = bias_axes <NEW_LINE> self.epsilon = epsilon <NEW_LINE> <... | LayerNormalization is a determenistic normalization layer to replace
BN's stochasticity.
# Arguments
axes: list of axes that won't be aggregated over | 62598f9585dfad0860cbf8de |
class FrozenDict(collections.Mapping): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self._d = dict(*args, **kwargs) <NEW_LINE> self._hash = None <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return iter(self._d) <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> ret... | Don't forget the docstrings!! | 62598f9563d6d428bbee2493 |
class Stripe: <NEW_LINE> <INDENT> URL_CHARGE = 'https://%s:@api.stripe.com/v1/charges' <NEW_LINE> URL_CHECK = 'https://%s:@api.stripe.com/v1/charges/%s' <NEW_LINE> URL_REFUND = 'https://%s:@api.stripe.com/v1/charges/%s/refund' <NEW_LINE> def __init__(self, key): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> <DEDENT> de... | Use in WEB2PY (guaranteed PCI compliant)
def pay():
from gluon.contrib.stripe import StripeForm
form = StripeForm(
pk=STRIPE_PUBLISHABLE_KEY,
sk=STRIPE_SECRET_KEY,
amount=150, # $1.5 (amount is in cents)
description="Nothing").process()
if form.accepted:
payment_... | 62598f95d58c6744b42dc13a |
class Density(ScalarField): <NEW_LINE> <INDENT> def __init__(self, nspinor, nsppol, nspden, rhor, structure, iorder="c"): <NEW_LINE> <INDENT> super(Density, self).__init__(nspinor, nsppol, nspden, rhor, structure, iorder=iorder) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_file(cls, filepath): <NEW_LINE> <INDEN... | Electron density | 62598f9526068e7796d4c637 |
class LXDServerInfo(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def build_from_response(cls, metadata): <NEW_LINE> <INDENT> server_info = LXDServerInfo() <NEW_LINE> server_info.api_extensions = metadata.get("api_extensions", None) <NEW_LINE> server_info.api_status = metadata.get("api_status", None) <NEW_LINE> ... | Wraps the response form /1.0 | 62598f958e71fb1e983bb78a |
class DeviceScope(object): <NEW_LINE> <INDENT> def __init__(self, device, id=0, use_cudnn=True): <NEW_LINE> <INDENT> self.device = device.lower() <NEW_LINE> self.engine = 'CUDNN' if use_cudnn else 'DRAGON' <NEW_LINE> assert self.device in ['cpu', 'gpu', 'cuda'] <NEW_LINE> if self.device == 'cuda': self.device = 'gpu' <... | DeviceScope is a auxiliary to assign the specific device.
Examples
--------
>>> with DeviceScope(device='cpu'): a = ops.RandomUniform([2, 3])
>>> import dragon
>>> with dragon.device_scope(device='gpu', id=0, use_cudnn=True): a = ops.RandomUniform([2, 3]) | 62598f95236d856c2adc92a2 |
class INVSTMTMSGSETV1(Aggregate): <NEW_LINE> <INDENT> msgsetcore = SubAggregate(MSGSETCORE, required=True) <NEW_LINE> trandnld = Bool(required=True) <NEW_LINE> oodnld = Bool(required=True) <NEW_LINE> posdnld = Bool(required=True) <NEW_LINE> baldnld = Bool(required=True) <NEW_LINE> canemail = Bool(required=True) <NEW_LI... | OFX section 13.7.1.1 | 62598f95379a373c97d98ce8 |
class RunsInOgitRepo(GitException): <NEW_LINE> <INDENT> pass | When the user forgot to change folder, he will run
the script in the git folder of ogit... Which is usually
not what he wants to do. | 62598f95fbf16365ca793d8b |
class _FTSearchThread(QThread): <NEW_LINE> <INDENT> searchFinished = pyqtSignal() <NEW_LINE> searchError = pyqtSignal() <NEW_LINE> def __init__(self, searcher, parent): <NEW_LINE> <INDENT> QThread.__init__(self, parent) <NEW_LINE> self._searcher = searcher <NEW_LINE> self._quit = False <NEW_LINE> self._mutex = QMutex()... | This thread performs full text search in the background | 62598f95b7558d5895463304 |
class BJ_Player(BJ_Hand): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> super(BJ_Player, self).__init__(name) <NEW_LINE> self.money = 10 <NEW_LINE> self.bet = 0 <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> rep = self.name + ":\t" + super(BJ_Hand, self).__str__() <NEW_LINE> if self.tota... | Gracz w blackjacku. | 62598f95009cb60464d011fb |
class FollowUser(APIView): <NEW_LINE> <INDENT> def put(self, request, format=None): <NEW_LINE> <INDENT> username = request.data['user_to_follow'] <NEW_LINE> try: <NEW_LINE> <INDENT> user_to_follow = UserProfile.objects.get(username = username) <NEW_LINE> <DEDENT> except UserProfile.DoesNotExist: <NEW_LINE> <INDENT> use... | Provides a PUT method to allow a logged in user to 'follow' other users. This
will cause the followed users' chirps to appear at the user's 'home' screen.
PUT accepts one JSON name-value pair: "user_to_follow", which contains the
username of the user to follow. | 62598f959b70327d1c57ea78 |
class InternalDatabaseVersion(models.Model): <NEW_LINE> <INDENT> version = models.IntegerField() <NEW_LINE> updated = models.DateTimeField(auto_now_add=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return "version %d updated the %s" % (self.version, self.updated.isoformat()) <NEW_LINE> <DEDENT> class Meta: <N... | Object that tell us to witch version is the database. | 62598f950c0af96317c56059 |
class Parser(BaseParser): <NEW_LINE> <INDENT> def extract(self, filename, **kwargs): <NEW_LINE> <INDENT> book = epub.read_epub(filename) <NEW_LINE> result = '' <NEW_LINE> for id, _ in book.spine: <NEW_LINE> <INDENT> item = book.get_item_with_id(id) <NEW_LINE> soup = BeautifulSoup(item.content, 'lxml') <NEW_LINE> for ch... | Extract text from epub using python epub library
| 62598f9582261d6c5272fd42 |
class CredentialsPrompt(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_email(): <NEW_LINE> <INDENT> print('Sign in with your Google account:') <NEW_LINE> return input('Email: ') <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def get_password(): <NEW_LINE> <INDENT> return getpass.getpass() <NEW_LINE> <DEDEN... | Callbacks for prompting user for their Google account credentials.
This implementation prompts the user in a terminal using standard in/out. | 62598f95a79ad16197769d38 |
class InterfaceCurvatureFromNumberDensity(Equation): <NEW_LINE> <INDENT> def __init__(self, dest, sources, with_morris_correction=True): <NEW_LINE> <INDENT> self.with_morris_correction = with_morris_correction <NEW_LINE> super(InterfaceCurvatureFromNumberDensity, self).__init__(dest, sources) <NEW_LINE> <DEDENT> def in... | Interface curvature using number density. Eq. (15) in [SY11]:
.. math::
\kappa_a = \sum_b \frac{2.0}{\psi_a + \psi_b}
\left(\boldsymbol{n_a} - \boldsymbol{n_b}\right) \cdot
\nabla_a W_{ab} | 62598f952c8b7c6e89bd34a5 |
class _DistributedFairseqModel(ddp_class): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self._heartbeat_timeout = heartbeat_timeout <NEW_LINE> if self._heartbeat_timeout > 0: <NEW_LINE> <INDENT> self._heartbeat = threading.Event() <NEW_LINE> s... | Extend DistributedDataParallel to check for missing attributes in the
wrapped module and to add a timeout to kill the job if no progress is
made (--heartbeat-timeout). | 62598f950a50d4780f7050ad |
class OpenstackConfigTestCase(TestCase, LoaderModuleMockMixin): <NEW_LINE> <INDENT> def setup_loader_modules(self): <NEW_LINE> <INDENT> return {openstack_config: {"__opts__": {"test": False}}} <NEW_LINE> <DEDENT> def test_present(self): <NEW_LINE> <INDENT> name = "salt" <NEW_LINE> filename = "/tmp/salt" <NEW_LINE> sect... | Test cases for salt.states.openstack_config | 62598f95d99f1b3c44d05386 |
class MicrophoneSensor(Sensor): <NEW_LINE> <INDENT> def __init__(self, sensor_id, sensor_name, data_type, binary_type): <NEW_LINE> <INDENT> super(self.__class__, self).__init__(sensor_id, sensor_name, data_type, binary_type) <NEW_LINE> self.is_paused = False <NEW_LINE> self.pyaudio = None <NEW_LINE> self.stream = None ... | Collects audio data from the local device | 62598f95cc0a2c111447acec |
class DecodingError(ErrorHandlerException): <NEW_LINE> <INDENT> def __init__(self, _type, text): <NEW_LINE> <INDENT> self.message = "Can't decode '{text}' to type '{type}'.".format( text=text, type=_type ) | Raised when a value representation can't be decoded. | 62598f9521a7993f00c65c56 |
class Parser(object): <NEW_LINE> <INDENT> def __init__(self, config, stream_handle, state, sieve_fn, state_callback, publish_callback, exception_callback = None): <NEW_LINE> <INDENT> self._chunker = StringChunker(sieve_fn) <NEW_LINE> self._stream_handle = stream_handle <NEW_LINE> self._state = state <NEW_LINE> self._st... | abstract class to show API needed for plugin poller objects | 62598f9538b623060ffa8d63 |
class User: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> user_obj = data.get("user") or data or {} <NEW_LINE> user_attr = data.get("userAttributes", {}) <NEW_LINE> self.email = user_obj.get("email") <NEW_LINE> self.first_name = user_obj.get("firstName") <NEW_LINE> self.last_name = user_obj.get("las... | The User object represents data we get back when loading a list of
users or as a card's author, verifier, etc.
These objects have properties like:
- `email`
- `first_name`
- `last_name`
- `groups` - when you load a list of users (i.e. from calling `g.get_members()`) the User
objects that come back have a list of gr... | 62598f95dd821e528d6d8c0c |
class ClassResource(flask_restful.Resource): <NEW_LINE> <INDENT> def delete(self, database_name, class_name): <NEW_LINE> <INDENT> db_connector.class_drop(database_name, class_name) <NEW_LINE> return flask.Response("OK") | API /databases/<database_name>/classes/<class_name> endpoint. | 62598f956aa9bd52df0d4ba4 |
class Bold(Element): <NEW_LINE> <INDENT> def __init__(self, text=None, cl=None, ident=None, style=None, attrs=None): <NEW_LINE> <INDENT> super().__init__(cl=cl, ident=ident, style=style, attrs=attrs) <NEW_LINE> if text: <NEW_LINE> <INDENT> self._children.append(text) <NEW_LINE> <DEDENT> <DEDENT> def __repr__(self): <NE... | Implements the <strong> tag | 62598f958da39b475be02eba |
class EmailConfirmationToken(models.Model): <NEW_LINE> <INDENT> person = models.OneToOneField(Person, models.CASCADE) <NEW_LINE> created_at = models.DateTimeField(auto_now_add=True) <NEW_LINE> token = models.CharField(db_index=True, unique=True, max_length=8) <NEW_LINE> def save(self, force_insert=False, force_update=F... | The token for email confirmation. | 62598f95e5267d203ee6b5f1 |
class MsgpackExt(TypeDecorator): <NEW_LINE> <INDENT> impl = BYTEA <NEW_LINE> def process_bind_param(self, value, dialect): <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return msgpackext_dumps(value) <NEW_LINE> <DEDENT> <DEDENT> def process_result_v... | Converts JSON-like data to msgpack with full NumPy Array support. | 62598f9567a9b606de545cac |
class PostDetailView(View): <NEW_LINE> <INDENT> def get(self, request, pk): <NEW_LINE> <INDENT> post = get_object_or_404(Post, pk=pk) <NEW_LINE> post.visit_count += 1 <NEW_LINE> post.save(update_fields=['visit_count']) <NEW_LINE> if post.author == request.user: <NEW_LINE> <INDENT> if post.status == 'draft': <NEW_LINE> ... | 文章详情页View
每次访问都需要增加以下阅读量,visit_count
更新阅读量的时候,要传递update_fields=['visit_count']
默认Model.save方法的参数update_fields=None,不传值,同时会修改掉updated字段的数据 | 62598f95fbf16365ca793d8d |
class MediaDeleteView(LoginRequiredView, DeleteView): <NEW_LINE> <INDENT> model = Media <NEW_LINE> success_url = reverse_lazy('list_media') <NEW_LINE> def get_object(self, queryset=None): <NEW_LINE> <INDENT> obj = super(MediaDeleteView, self).get_object() <NEW_LINE> if not obj.created_by == self.request.user: <NEW_LINE... | Handle delete of Media objects | 62598f958e7ae83300ee8d75 |
class ParseJournal(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._dsdict = {} <NEW_LINE> self._activity_name = [] <NEW_LINE> self._activity_count = [] <NEW_LINE> homepath = os.environ['HOME'] <NEW_LINE> for path in glob.glob(os.path.join(homepath, '.sugar', '*')): <NEW_LINE> <INDENT> if isdsdir(pa... | Simple parser of datastore | 62598f95462c4b4f79dbb6e0 |
class RsgAsActivityRelatedInstance(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.InstanceId = None <NEW_LINE> self.InstanceStatus = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.InstanceId = params.get("InstanceId") <NEW_LINE> self.InstanceStatus = ... | 伸缩组活动关联的节点
| 62598f959b70327d1c57ea7a |
class FormatTypes(object, metaclass=EnumMetaClass): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> __enum_names__ = [ 'SFT_FLATBUF_FLEX_ROW' , 'SFT_FLATBUF_UNION_ROW', 'SFT_FLATBUF_UNION_COL', 'SFT_FLATBUF_CSV_ROW' , 'SFT_ARROW' , 'SFT_PARQUET' , 'SFT_PG_TUPLE' , 'SFT_CSV' ... | A class that represents Skyhook's SFT enum. | 62598f95435de62698e9bacb |
class UniformAlongShoreWindStress(BaseWindStress): <NEW_LINE> <INDENT> def __init__(self, tau0=0, rho=0, alpha=0): <NEW_LINE> <INDENT> assert(False), "This is a deprecated wind stress definition. Please use the WindStress class!" <NEW_LINE> self.tau0 = np.float32(tau0) <NEW_LINE> self.rho = np.float32(r... | Uniform along shore wind stress.
tau0: Amplitude of wind stress (Pa)
rho: Density of sea water (1025.0 kg / m^3)
alpha: Offshore e-folding length (1/(10*dx) = 5e-6 m^-1) | 62598f95bde94217f37074d5 |
class Header: <NEW_LINE> <INDENT> def __rich__(self) -> Panel: <NEW_LINE> <INDENT> grid = Table.grid(expand=True) <NEW_LINE> grid.add_column(justify="center", ratio=1) <NEW_LINE> grid.add_column(justify="right") <NEW_LINE> grid.add_row( "[b]Cart Manager[/b]", datetime.now().ctime().replace(":", "[blink]:[/]"), ) <NEW_L... | Display header with clock. | 62598f95a17c0f6771d5bf13 |
class AppFilter(logging.Filter): <NEW_LINE> <INDENT> def filter(self, record): <NEW_LINE> <INDENT> record.app_version = "kalliope-%s" % version_str <NEW_LINE> return True | Class used to add a custom entry into the logger | 62598f95379a373c97d98ceb |
class ClfCollate: <NEW_LINE> <INDENT> def __init__(self, sort=False, batch_first=True): <NEW_LINE> <INDENT> self.sort = sort <NEW_LINE> self.batch_first = batch_first <NEW_LINE> <DEDENT> def pad_collate(self, batch): <NEW_LINE> <INDENT> batch = sorted(batch, key=lambda x: x[2], reverse=True) <NEW_LINE> inputs = pad_seq... | a variant of callate_fn that pads according to the longest sequence in
a batch of sequences | 62598f95004d5f362081ee68 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.