code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class AcademicLevel(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.mRedis = RedisHelper() <NEW_LINE> self.authors = self.mRedis.getAllAuthors() <NEW_LINE> self.authorsPN =dict() <NEW_LINE> for author in self.authors: <NEW_LINE> <INDENT> self.authorsPN[author] = sum([len(self.mRedis.getAuCoauTimes(... | docstring for AcademicLevel | 62598fa163d6d428bbee25fb |
class Logger(object): <NEW_LINE> <INDENT> __metaclass__ = MetaLogger | Whoever subclasses Logger has the benefit of a local logger that
outputs with class_name in the message context. Also if you
setLevel of the master logger (defined by LOGGER_ID) to
logging.DEBUG you even get logs on function calls. | 62598fa17d847024c075c210 |
class TestAccuracy(tf.test.TestCase): <NEW_LINE> <INDENT> def test_default(self): <NEW_LINE> <INDENT> targets = tf.constant([[2, 1, 0, 0]], dtype=tf.int32) <NEW_LINE> weights = tf.placeholder(dtype=tf.float32, shape=targets.shape) <NEW_LINE> predictions = tf.constant( [[[0.1, 0.8, 0.1], [0.1, 0.8, 0.1], [0.8, 0.1, 0.1]... | Test class for the liteflow.metrics.accuracy function. | 62598fa1d7e4931a7ef3bee3 |
class NSNitroNserrRwUndefactInval(NSNitroRewriteErrors): <NEW_LINE> <INDENT> pass | Nitro error code 2818
Invalid action for undefined event | 62598fa1e5267d203ee6b757 |
class Connection(rpc_common.Connection): <NEW_LINE> <INDENT> def __init__(self, conf): <NEW_LINE> <INDENT> self.topics = [] <NEW_LINE> self.reactor = ZmqReactor(conf) <NEW_LINE> <DEDENT> def create_consumer(self, topic, proxy, fanout=False): <NEW_LINE> <INDENT> _get_matchmaker().register(topic, CONF.rpc_zmq_host) <NEW_... | Manages connections and threads. | 62598fa19c8ee82313040093 |
class TestIETotalsByCandidate(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> return IETotalsByC... | IETotalsByCandidate unit test stubs | 62598fa199cbb53fe6830d1d |
class TimingTables: <NEW_LINE> <INDENT> def __init__(self, size=1000, masked=False): <NEW_LINE> <INDENT> self.masked = masked <NEW_LINE> self.table = Table(masked=self.masked) <NEW_LINE> np.random.seed(12345) <NEW_LINE> self.table['i'] = np.arange(size) <NEW_LINE> self.table['a'] = np.random.random(size) <NEW_LINE> sel... | Object which contains two tables and various other attributes that
are useful for timing and other API tests. | 62598fa18c0ade5d55dc35b4 |
class Item(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length = 100) <NEW_LINE> notes = models.TextField(max_length = 500, blank=True) <NEW_LINE> created = models.DateField(auto_now_add=True) <NEW_LINE> priority = models.IntegerField(choices=( (0, 'Urgent'), (1, 'High'), (2, 'Normal'), (3, 'Low'), ),... | A single todo item. | 62598fa145492302aabfc31b |
class Trainer(object): <NEW_LINE> <INDENT> SUPPORTED_LANGUAGES = ["de", "en"] <NEW_LINE> def __init__(self, config, component_builder=None, skip_validation=False): <NEW_LINE> <INDENT> self.config = config <NEW_LINE> self.skip_validation = skip_validation <NEW_LINE> self.training_data = None <NEW_LINE> self.pipeline = [... | Given a pipeline specification and configuration this trainer will load the data and train all components. | 62598fa157b8e32f52508041 |
class BaseSkeleton(ConfigurableWithABC, Verbose): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def train(self, input_data, target_data): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def predict(self, input_data): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def fit(self, X, y, *args, **kwar... | Base class for all algorithms and networks.
| 62598fa1596a897236127ac6 |
class Remote(HMEvent, HelperEventRemote, HelperActionPress, HelperRssiPeer): <NEW_LINE> <INDENT> @property <NEW_LINE> def ELEMENT(self): <NEW_LINE> <INDENT> if "RC-2" in self.TYPE or "PB-2" in self.TYPE or "WRC2" in self.TYPE or "BRC2" in self.TYPE or "WRCC2" in self.TYPE: <NEW_LINE> <INDENT> return [1, 2] <NEW_LINE> <... | Remote handle buttons. | 62598fa155399d3f0562636d |
class StaticFilesStorage(FileSystemStorage): <NEW_LINE> <INDENT> def __init__(self, location=None, base_url=None, *args, **kwargs): <NEW_LINE> <INDENT> if location is None: <NEW_LINE> <INDENT> location = settings.STATIC_ROOT <NEW_LINE> <DEDENT> if base_url is None: <NEW_LINE> <INDENT> base_url = settings.STATIC_URL <NE... | Standard file system storage for static files.
The defaults for ``location`` and ``base_url`` are
``STATIC_ROOT`` and ``STATIC_URL``. | 62598fa1a79ad16197769eb0 |
class GetTariffResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | A ResultSet with methods tailored to the values returned by the GetTariff Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 62598fa1c432627299fa2e25 |
class PseudoCmbModule(object): <NEW_LINE> <INDENT> def __init__(self, icov=WMAP7_ICOV, mu=WMAP7_MEANS, min_sz=0, max_sz=2): <NEW_LINE> <INDENT> self.icov = icov <NEW_LINE> self.mu = mu <NEW_LINE> self.a = min_sz <NEW_LINE> self.b = max_sz <NEW_LINE> <DEDENT> def computeLikelihood(self, ctx): <NEW_LINE> <INDENT> x = ctx... | Chain for computing the likelihood of a multivariante gaussian distribution | 62598fa17047854f4633f222 |
class Schedule(db.Model): <NEW_LINE> <INDENT> __tablename__ = "schedule" <NEW_LINE> id = db.Column(db.Integer, primary_key=True, autoincrement=True) <NEW_LINE> title = db.Column(db.String(255), nullable=False) <NEW_LINE> public_id = db.Column(db.String(100), unique=True) <NEW_LINE> created_on = db.Column(db.DateTime, n... | User Model for storing user related details | 62598fa12c8b7c6e89bd3611 |
class DetectSilence(Filter): <NEW_LINE> <INDENT> __documentation_section__ = 'Envelope Utility UGens' <NEW_LINE> __slots__ = () <NEW_LINE> _ordered_input_names = ( 'source', 'threshold', 'time', 'done_action', ) <NEW_LINE> _valid_calculation_rates = None <NEW_LINE> def __init__( self, calculation_rate=None, done_action... | Evaluates `done_action` when input falls below `threshold`.
::
>>> source = ugentools.WhiteNoise.ar()
>>> source *= ugentools.Line.kr(start=1, stop=0)
>>> detect_silence = ugentools.DetectSilence.kr(
... done_action=DoneAction.FREE_SYNTH,
... source=source,
... threshold=0.0001,
... | 62598fa1462c4b4f79dbb857 |
class Test_SessionCredentials(TestCase): <NEW_LINE> <INDENT> def test_checkUsername(self): <NEW_LINE> <INDENT> username = 'tester' <NEW_LINE> session = SessionCredentials(username) <NEW_LINE> self.assertEquals(username, session.checkUsername()) | Tests for L{querryl.cred.credentials.SessionCredentials}. | 62598fa15f7d997b871f9305 |
class TestAnonymousSurvey(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> question = "What language did you first learn to speak?" <NEW_LINE> self.my_survey = AnonymousSurvey(question) <NEW_LINE> self.responses = ["English", "Scottish", "Welsh"] <NEW_LINE> <DEDENT> def test_store_single_res... | Tests for the AnonymousSurvey class | 62598fa1090684286d593600 |
class PersonCase(CompanyCase): <NEW_LINE> <INDENT> context = {"default_is_company": False, "default_type": "contact"} | Test ``res.partner`` when it is a person. | 62598fa1ac7a0e7691f72357 |
class URLField(StringField): <NEW_LINE> <INDENT> def gen_value(self): <NEW_LINE> <INDENT> return gen_url(subdomain=gen_alpha()) | Field that represents an URL | 62598fa130dc7b766599f699 |
class Markdown(Plugin): <NEW_LINE> <INDENT> def __init__(self, **options): <NEW_LINE> <INDENT> import markdown <NEW_LINE> self.md = markdown.Markdown(**options) <NEW_LINE> <DEDENT> def run(self, files, stack): <NEW_LINE> <INDENT> for filename, post in files.items(): <NEW_LINE> <INDENT> post.content = self.md.reset().co... | Convert markdown content to HTML. Options set in __init__ will be passed to parser. | 62598fa1d7e4931a7ef3bee5 |
class ProdConfig(Config): <NEW_LINE> <INDENT> ENV = 'prod' <NEW_LINE> DEBUG = False <NEW_LINE> SQLALCHEMY_DATABASE_URI = os.environ.get('ONEINOTE_SQLALCHEMY_URI') or 'postgresql://localhost/example' | Production configuration | 62598fa16aa9bd52df0d4d17 |
class TaxonUicnPlace(ModelSQL, ModelView): <NEW_LINE> <INDENT> __name__ = 'uicn.taxon_uicn_presence' <NEW_LINE> tiers = fields.Many2One('party.party', u'Tiers') <NEW_LINE> site = fields.Many2One('place.place', u'Site') <NEW_LINE> taxon = fields.Many2One('taxinomie.taxinomie', u'Taxon') <NEW_LINE> binomial = fields.Char... | Présence de Taxons | 62598fa1796e427e5384e5df |
class TestConsoleGetAuditLogHandler(object): <NEW_LINE> <INDENT> def setup_method(self): <NEW_LINE> <INDENT> self.hmc, self.hmc_resources = standard_test_hmc() <NEW_LINE> self.uris = ( (r'/api/console', ConsoleHandler), (r'/api/console/operations/get-audit-log', ConsoleGetAuditLogHandler), ) <NEW_LINE> self.urihandler ... | All tests for class ConsoleGetAuditLogHandler. | 62598fa1b7558d589546347a |
class Graph: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.edgeList = {} <NEW_LINE> self.vertList = {} <NEW_LINE> self.numVertices = 0 <NEW_LINE> <DEDENT> def addVertex(self, key): <NEW_LINE> <INDENT> self.numVertices += 1 <NEW_LINE> newVertex = Vertex(key) <NEW_LINE> self.vertList[key] = newVertex <... | A graph implemented as an adjacency list of vertices.
:slot: vertList (dict): A dictionary that maps a vertex key to a Vertex
object
:slot: numVertices (int): The total number of vertices in the graph | 62598fa199cbb53fe6830d1f |
class RegistroY681(Registro): <NEW_LINE> <INDENT> campos = [ CampoFixo(1, 'REG', 'Y681'), Campo(2, 'CODIGO'), CampoAlfanumerico(3, 'DESCRICAO'), CampoNumerico(4, 'VALOR', precisao=2), ] | Informações de Optantes pelo Refis (Lucro Real,
Presumido e Arbitrado) | 62598fa1442bda511e95c2a7 |
class Tpms: <NEW_LINE> <INDENT> def __init__(self, serial_number): <NEW_LINE> <INDENT> self.serial_number = serial_number <NEW_LINE> self.sensor_transmit_range = 300 <NEW_LINE> self.sensor_pressure_range = (8,300) <NEW_LINE> self.battery_life = 6 <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.g... | Tire Pressure Monitoring System.
| 62598fa1a8370b77170f0231 |
class _data_api(Keyword): <NEW_LINE> <INDENT> name = "data_api" <NEW_LINE> ptype = str <NEW_LINE> atype = "string" | REST API version (`mandatory`). Units: ``.
Returns:
str: AFLOWLIB version of the entry, API.}
| 62598fa116aa5153ce40034c |
class Fill(Payload): <NEW_LINE> <INDENT> def __init__(self, count, byte=b'A'): <NEW_LINE> <INDENT> self.count = count <NEW_LINE> self.byte = byte <NEW_LINE> <DEDENT> def compose(self): <NEW_LINE> <INDENT> return self.count * self.byte <NEW_LINE> <DEDENT> def __add__(self, other): <NEW_LINE> <INDENT> return Payload(self... | Memory filling payload component. | 62598fa157b8e32f52508042 |
class TestFunc(unittest.TestCase): <NEW_LINE> <INDENT> def test(self): <NEW_LINE> <INDENT> target = Solution() <NEW_LINE> self.assertEqual(8, target.maxAreaOfIsland([[1, 1, 1],[0, 1, 1],[0, 1, 0],[0, 1, 1]])) <NEW_LINE> self.assertEqual(7, target.maxAreaOfIsland([[0, 1, 1],[0, 1, 1],[0, 1, 0],[0, 1, 1]])) | Test fuction | 62598fa13539df3088ecc101 |
class Solution: <NEW_LINE> <INDENT> def replaceBlank(self, string, length): <NEW_LINE> <INDENT> return len(string.replace(' ', '%20')) | @param: string: An array of Char
@param: length: The true length of the string
@return: The true length of new string | 62598fa1d7e4931a7ef3bee6 |
class DeployRecord(models.Model): <NEW_LINE> <INDENT> project = models.ForeignKey(Project, null=True, on_delete=models.SET_NULL) <NEW_LINE> deploy_model = models.CharField(max_length=6, choices=DEPLOY_MODEL_CHOICES, default='branch') <NEW_LINE> deploy_ver = models.CharField('分支名或版本名', max_length=50, null=True, blank=Tr... | status: 0:构建中,未发布,1:预发,2:beta,3:正式 | 62598fa1cc0a2c111447ae5a |
class InvalidMoveError(RuntimeError): <NEW_LINE> <INDENT> def __init__(self, board: str, player: str, move: int) -> None: <NEW_LINE> <INDENT> self.code = utils.UserError.INVALID_MOVE.value[0] <NEW_LINE> self.message = utils.UserError.INVALID_MOVE.value[1].format(move=move, player=constants.PLAYERS[player].value, board=... | Exception representing an invalid move given the current game state | 62598fa10c0af96317c561ce |
class PerformanceScenario: <NEW_LINE> <INDENT> def __init__(self, kernel, time_step, integrator, reaction_scheduler): <NEW_LINE> <INDENT> self.sim = api.Simulation() <NEW_LINE> self.sim.set_kernel(kernel) <NEW_LINE> if integrator is not None: <NEW_LINE> <INDENT> self.integrator = integrator <NEW_LINE> <DEDENT> else: <N... | PerformanceScenario is a thin wrapper for Simulation. Derived classes take
a dictionary of factors (that scale typical variables like number of particles),
and configure a certain scenario. The scenario is then run, and performance
times are set or appended to containers (which usually are dictionaries of lists/arrays)... | 62598fa1e1aae11d1e7ce74a |
class GoogleComputeDiskTest(unittest.TestCase): <NEW_LINE> <INDENT> @typing.no_type_check <NEW_LINE> @mock.patch('libcloudforensics.providers.gcp.internal.common.GoogleCloudComputeClient.BlockOperation') <NEW_LINE> @mock.patch('libcloudforensics.providers.gcp.internal.common.GoogleCloudComputeClient.GceApi') <NEW_LINE>... | Test Google Cloud Compute Disk class. | 62598fa156b00c62f0fb26fd |
class SubtractOperation(Operation): <NEW_LINE> <INDENT> def operate(self): <NEW_LINE> <INDENT> return reduce(lambda x, y: x - y, self.terms) | Inherits `Operation` - subtracts self.terms. | 62598fa1e76e3b2f99fd8884 |
class GameOptionButton(Button): <NEW_LINE> <INDENT> def __init__(self, pos: Tuple[int, int], text: str) -> None: <NEW_LINE> <INDENT> Button.__init__(self, pos, text, width=int(.45 * LOCALBOARDSIZE), height=int(.75 * SQUARESIZE)) <NEW_LINE> self.selected: bool = False <NEW_LINE> self.selected_surface: pygame.Surface = p... | Each option in the GameOptions menu. Extends Button class | 62598fa1462c4b4f79dbb859 |
class KBEntity(Entity): <NEW_LINE> <INDENT> def __init__(self, name, identifier, score, aliases): <NEW_LINE> <INDENT> Entity.__init__(self, name) <NEW_LINE> self.id = identifier <NEW_LINE> self.score = score <NEW_LINE> self.aliases = aliases <NEW_LINE> <DEDENT> def sparql_name(self): <NEW_LINE> <INDENT> return self.id ... | A KB entity. | 62598fa191af0d3eaad39c59 |
class Ct(_msys.Ct): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> def __init__(self, ptr, id): <NEW_LINE> <INDENT> super().__init__(ptr, id) <NEW_LINE> <DEDENT> @property <NEW_LINE> def system(self): <NEW_LINE> <INDENT> return System(self._ptr) <NEW_LINE> <DEDENT> def addChain(self): <NEW_LINE> <INDENT> return Chain(se... | Represents a list of Chains in a System
The Ct class exists mainly to provide a separate namespace for chains.
If you merge two systems each of which has a chain A, you probably
want the chains to remain separate. Cts accomplish this.
The Ct class also provides a key-value namespace for assigning
arbitrary propertie... | 62598fa1e64d504609df92df |
@optplan.register_node_type() <NEW_LINE> class Overlap(optplan.Function): <NEW_LINE> <INDENT> type = schema_utils.polymorphic_model_type("function.overlap") <NEW_LINE> simulation = optplan.ReferenceType(optplan.Function) <NEW_LINE> overlap = optplan.ReferenceType(optplan.EmOverlap) | Defines an overlap integral.
Attributes:
type: Must be "function.overlap".
simulation: Simulation from which electric fields are obtained.
overlap: Overlap type to use. | 62598fa124f1403a926857d9 |
class QtLogStreamHandler(nxt_log.LogRecordStreamHandler): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def get_handler(cls, signal): <NEW_LINE> <INDENT> cls.new_log = signal <NEW_LINE> return cls <NEW_LINE> <DEDENT> def handle_log_record(self, record): <NEW_LINE> <INDENT> self.new_log.emit(record) | Handles logs by emitting the log record to a QtCore.Signal | 62598fa1656771135c4894d1 |
class HistogramPlot(Plot): <NEW_LINE> <INDENT> _DefaultAxesClass = HistogramAxes <NEW_LINE> def __init__(self, *data, **kwargs): <NEW_LINE> <INDENT> histargs = dict() <NEW_LINE> for key in ['bins', 'range', 'normed', 'weights', 'cumulative', 'bottom', 'histtype', 'align', 'orientation', 'rwidth', 'log', 'color', 'label... | A plot showing a histogram of data
| 62598fa11b99ca400228f455 |
class VaultListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[Vault]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(VaultListResult, self).__init__(**kwargs) <NEW_LINE> self.value ... | List of vaults.
:param value: The list of vaults.
:type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault]
:param next_link: The URL to get the next set of vaults.
:type next_link: str | 62598fa1498bea3a75a5796f |
class Converter(object): <NEW_LINE> <INDENT> regex = '[.a-zA-Z0-9:@&+$,_%%-]+' <NEW_LINE> class NotSet(object): pass <NEW_LINE> default = NotSet <NEW_LINE> def __init__(self, default=NotSet): <NEW_LINE> <INDENT> if not default is self.NotSet: <NEW_LINE> <INDENT> self.default = default <NEW_LINE> <DEDENT> <DEDENT> def t... | A base class for urlconverters | 62598fa1a219f33f346c6668 |
class IpcCommExit(IpcComm.IpcComm): <NEW_LINE> <INDENT> def __init__(self, transmit_handler): <NEW_LINE> <INDENT> super().__init__(transmit_handler) <NEW_LINE> <DEDENT> def __ReplyToRequest__(self, reqparam, execret, state): <NEW_LINE> <INDENT> retval = 0 <NEW_LINE> jsonresparam = json.dumps({ "ret" : retval, "message"... | 終了コマンドを表します。 | 62598fa1435de62698e9bc41 |
class DefaultConfig(object): <NEW_LINE> <INDENT> APP_NAME = 'rest-api' <NEW_LINE> DEBUG = False <NEW_LINE> LOG_LEVEL = 'WARNING' <NEW_LINE> LOG_DIR = 'logs/' <NEW_LINE> SQLALCHEMY_DATABASE_URI = "sqlite:///database/api.db" <NEW_LINE> SECRET_KEY = "Ch4ng3M3!" | Default Config (Is used when RESTAPICONFIG environment variable is not set) | 62598fa1e5267d203ee6b75b |
class sensors(): <NEW_LINE> <INDENT> cha=array(m) <NEW_LINE> chl=zeros((size(cha),3)) <NEW_LINE> chu=zeros((size(cha),3)) <NEW_LINE> for i in range(len(cha)): <NEW_LINE> <INDENT> chl[i,:]=( cha[i].loops[0].Position.x, cha[i].loops[0].Position.y, cha[i].loops[0].Position.z); <NEW_LINE> chu[i,:]=( cha[i].loops[1].Positio... | chu=pos.headshape.chu | 62598fa14a966d76dd5eed30 |
class PuppetClass( Entity, EntityCreateMixin, EntityDeleteMixin, EntityReadMixin, EntitySearchMixin): <NEW_LINE> <INDENT> def __init__(self, server_config=None, **kwargs): <NEW_LINE> <INDENT> self._fields = { 'name': entity_fields.StringField( required=True, str_type='alpha', length=(6, 12), ), } <NEW_LINE> self._meta ... | A representation of a Puppet Class entity. | 62598fa18da39b475be0302d |
class PyNetcdf4(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://github.com/Unidata/netcdf4-python" <NEW_LINE> url = "https://pypi.io/packages/source/n/netCDF4/netCDF4-1.2.7.tar.gz" <NEW_LINE> version('1.4.2', sha256='b934af350459cf9041bcdf5472e2aa56ed7321c018d918e9f325ec9a1f9d1a30') <NEW_LINE> version('1... | Python interface to the netCDF Library. | 62598fa1fbf16365ca793f09 |
class Cmd: <NEW_LINE> <INDENT> raw_cmd = None <NEW_LINE> cmd = None <NEW_LINE> cmd_args = None <NEW_LINE> COMMAND_LOCATION = 0 <NEW_LINE> CMD_NAME = None <NEW_LINE> sub_cmd_obj = None <NEW_LINE> def __init__(self, raw_str): <NEW_LINE> <INDENT> self.raw_cmd = raw_str <NEW_LINE> self.parse_cmd() <NEW_LINE> <DEDENT> def e... | Cmd structure is command name and then arguments, seprated by spaces.
sub class must set CMD_NAME attribute
must be aware of the game instance | 62598fa1d58c6744b42dc1fa |
class PrintPrimary(Primary): <NEW_LINE> <INDENT> def __call__(self, context): <NEW_LINE> <INDENT> path = context['path'] <NEW_LINE> suffix = context['args'] <NEW_LINE> context['buffer'].append(path) <NEW_LINE> if suffix: <NEW_LINE> <INDENT> context['buffer'].append(suffix) <NEW_LINE> return context <NEW_LINE> <DEDENT> ... | Prints out the filename
similar to `find . -print` | 62598fa1cc0a2c111447ae5c |
class _Formatter(object): <NEW_LINE> <INDENT> def __init__(self, original): <NEW_LINE> <INDENT> self._original = original <NEW_LINE> <DEDENT> def formatTime(self, record, datefmt=None): <NEW_LINE> <INDENT> return self._original.formatTime(record, datefmt) <NEW_LINE> <DEDENT> def format(self, record): <NEW_LINE> <INDENT... | Formats exceptions nicely.
Is is very important that this class does not throw exceptions. | 62598fa167a9b606de545e19 |
class ClassList(models.Model): <NEW_LINE> <INDENT> branch = models.ForeignKey("Branch", verbose_name="分校") <NEW_LINE> course = models.ForeignKey('Course') <NEW_LINE> class_type_choices = ( (0, '面授(脱产)'), (1, '面授(周末)'), (2, '网络班'), ) <NEW_LINE> class_type = models.SmallIntegerField(choices=class_type_choices, verbose_na... | 班级表 | 62598fa1d486a94d0ba2be26 |
class RefundQuery_pub(Wxpay_client_pub): <NEW_LINE> <INDENT> def __init__(self, timeout=WxPayConf_pub.CURL_TIMEOUT): <NEW_LINE> <INDENT> self.url = "https://api.mch.weixin.qq.com/pay/refundquery" <NEW_LINE> self.curl_timeout = timeout <NEW_LINE> super(RefundQuery_pub, self).__init__() <NEW_LINE> <DEDENT> def createXml(... | 退款查询接口 | 62598fa163d6d428bbee2600 |
class DeDuplicationRequestMiddleware(object): <NEW_LINE> <INDENT> def process_request(self, request, spider): <NEW_LINE> <INDENT> if not request.url: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> channel_id = request.meta.get('channel_id', 0) <NEW_LINE> if is_dup_detail(request.url, spider.name, channel_id): <NEW... | 去重 - 请求
(数据结构:集合) | 62598fa1498bea3a75a57970 |
class ClusterPubSub(PubSub): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ClusterPubSub, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> async def execute_command(self, *args, **kwargs): <NEW_LINE> <INDENT> await self.connection_pool.initialize() <NEW_LINE> if self.connection i... | Wrapper for PubSub class. | 62598fa1e64d504609df92e0 |
class CSC(_Compressed2d): <NEW_LINE> <INDENT> def __init__(self, arg, shape=None, prune=False, fill_value=0): <NEW_LINE> <INDENT> super().__init__(arg, shape=shape, compressed_axes=(1,), fill_value=fill_value) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_scipy_sparse(cls, x): <NEW_LINE> <INDENT> x = x.asformat(... | The CSC or CCS scheme stores a n-dimensional array using n+1 one-dimensional arrays.
The 3 arrays are same as GCCS. The remaining n-2 arrays are for storing the indices of
the non-zero values of the sparse matrix. CSC is simply the transpose of CSR.
Sparse supports 2-D CSC. | 62598fa1f548e778e596b3fd |
class ActionDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, data_filepath, crop=None): <NEW_LINE> <INDENT> self.crop = crop <NEW_LINE> print("[I] Loading data from %s" % data_filepath) <NEW_LINE> with open(data_filepath, 'r') as f: <NEW_LINE> <INDENT> self.action_seqs = [np.fromstring(l, dtype=np.uint8, sep=',... | Dataset class that reads the Actions dataset | 62598fa185dfad0860cbf99c |
class cd: <NEW_LINE> <INDENT> def __init__(self, newPath): <NEW_LINE> <INDENT> self.newPath = newPath <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.savedPath = os.getcwd() <NEW_LINE> os.chdir(self.newPath) <NEW_LINE> <DEDENT> def __exit__(self, etype, value, traceback): <NEW_LINE> <INDENT> os.chdir(... | Context manager for changing the current working directory, and
return to original location when finished. | 62598fa1498bea3a75a57971 |
class GolemResourceType(models.Model): <NEW_LINE> <INDENT> _name = 'golem.resource.type' <NEW_LINE> _description = 'GOLEM Resource Type' <NEW_LINE> _order = 'name asc' <NEW_LINE> _sql_constraints = [('golem_resource_type_name_uniq', 'UNIQUE (name)', 'Resource type must be unique.')] <NEW_LINE> name = fields.Char(string... | GOLEM Resource Type | 62598fa1be8e80087fbbeeaf |
class Process(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'process' <NEW_LINE> pid = db.Column(db.String(), nullable=False, primary_key=True) <NEW_LINE> user_id = db.Column( db.Integer, db.ForeignKey('user.id'), nullable=False ) <NEW_LINE> command = db.Column(db.String(), nullable=False) <NEW_LINE> desc = db.Column(... | Define the Process table. | 62598fa132920d7e50bc5ea6 |
class EventFIBCFlowMod(EventFIBCBase): <NEW_LINE> <INDENT> pass | FIBC FlowMod event | 62598fa17d43ff248742732a |
class Path: <NEW_LINE> <INDENT> def __init__(self, testbed, host, tb, is_dir=None): <NEW_LINE> <INDENT> self.testbed = testbed <NEW_LINE> self.host = host <NEW_LINE> self.tb = tb <NEW_LINE> self.is_dir = is_dir <NEW_LINE> <DEDENT> def copydown(self, check_existing=False): <NEW_LINE> <INDENT> if check_existing and self.... | Represent a file/dir with a host and a testbed path | 62598fa13617ad0b5ee05fa1 |
class SpatiaLiteFunctionParam(SpatiaLiteFunction): <NEW_LINE> <INDENT> sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)' | For SpatiaLite functions that take another parameter. | 62598fa1435de62698e9bc44 |
class Photo(models.Model): <NEW_LINE> <INDENT> LICENSES = ( ('http://creativecommons.org/licenses/by/2.0/', 'CC Attribution'), ('http://creativecommons.org/licenses/by-nd/2.0/', 'CC Attribution-NoDerivs'), ('http://creativecommons.org/licenses/by-nc-nd/2.0/', 'CC Attribution-NonCommercial-NoDerivs'), ('h... | Photo model | 62598fa163b5f9789fe84fc5 |
@final <NEW_LINE> class SetPlayerAttributeAction(EventAction[SetPlayerAttributeActionParameters]): <NEW_LINE> <INDENT> name = "set_player_attribute" <NEW_LINE> param_class = SetPlayerAttributeActionParameters <NEW_LINE> def start(self) -> None: <NEW_LINE> <INDENT> attribute = self.parameters[0] <NEW_LINE> value = self.... | Set the given attribute of the player character to the given value.
Script usage:
.. code-block::
set_player_attribute <name>,<value>
Script parameters:
name: Name of the attribute.
value: Value of the attribute. | 62598fa1d6c5a102081e1f97 |
class ProductAlternativeUnits(object): <NEW_LINE> <INDENT> swagger_types = { 'name': 'str', 'multiplier': 'float', 'sales_unit': 'bool', 'purchase_unit': 'bool' } <NEW_LINE> attribute_map = { 'name': 'Name', 'multiplier': 'Multiplier', 'sales_unit': 'SalesUnit', 'purchase_unit': 'PurchaseUnit' } <NEW_LINE> def __init__... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fa16fb2d068a7693d5d |
class TagFilter(object): <NEW_LINE> <INDENT> swagger_types = { 'type': 'str', 'tags': 'list[str]' } <NEW_LINE> attribute_map = { 'type': 'type', 'tags': 'tags' } <NEW_LINE> def __init__(self, type=None, tags=None): <NEW_LINE> <INDENT> self._type = None <NEW_LINE> self._tags = None <NEW_LINE> self.discriminator = None <... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fa1cc0a2c111447ae5e |
@hashableAttrs(repr=False) <NEW_LINE> class Track: <NEW_LINE> <INDENT> song: Song = attr.ib(hash=False, eq=False, repr=False) <NEW_LINE> number: int = attr.ib(default=1, hash=False, eq=False) <NEW_LINE> fretCount: int = 24 <NEW_LINE> offset: int = 0 <NEW_LINE> isPercussionTrack: bool = False <NEW_LINE> is12StringedGuit... | A track contains multiple measures. | 62598fa1c432627299fa2e2b |
class ServerProxy(xmlrpc.ServerProxy): <NEW_LINE> <INDENT> def __init__( self, uri, encoding=None, verbose=False, allow_none=False, use_datetime=False, use_builtin_types=False, auth=None, headers=None, timeout=5.0, session=None, ): <NEW_LINE> <INDENT> if not headers: <NEW_LINE> <INDENT> headers = { "User-Agent": "pytho... | ``xmlrpc.ServerProxy`` subclass for asyncio support | 62598fa17047854f4633f228 |
class UpdateNetworkSwitchSettingsMtuModel(object): <NEW_LINE> <INDENT> _names = { "default_mtu_size":'defaultMtuSize', "overrides":'overrides' } <NEW_LINE> def __init__(self, default_mtu_size=None, overrides=None): <NEW_LINE> <INDENT> self.default_mtu_size = default_mtu_size <NEW_LINE> self.overrides = overrides <NEW_L... | Implementation of the 'updateNetworkSwitchSettingsMtu' model.
TODO: type model description here.
Attributes:
default_mtu_size (int): MTU size for the entire network. Default value
is 9578.
overrides (list of OverrideModel): Override MTU size for individual
switches or switch profiles. An empty... | 62598fa1a79ad16197769eb6 |
class AppMarkupDetails(Base): <NEW_LINE> <INDENT> name = "app_markup_details" <NEW_LINE> def __call__(self, date_from: str, date_to: str, app_id: Optional[int] = None, client_loginid: Optional[str] = None, description: Optional[int] = None, limit: Optional[Union[int, float, Decimal]] = None, offset: Optional[Union[int,... | Class for Binary app_markup_details websocket channel. | 62598fa199cbb53fe6830d24 |
class Fuzzdata(BaseFuzzdata): <NEW_LINE> <INDENT> def get_fuzz_data(self): <NEW_LINE> <INDENT> yield [(BaseFuzzdata.get_random_ascii_string(), BaseFuzzdata.get_random_ascii_string())] | Just generates random key/value string pairs ad nauseam | 62598fa12ae34c7f260aaf31 |
@CommandProvider <NEW_LINE> class Repackage(MachCommandBase): <NEW_LINE> <INDENT> @Command('repackage', category='misc', description='Repackage artifacts into different formats.') <NEW_LINE> def repackage(self): <NEW_LINE> <INDENT> print("Usage: ./mach repackage [dmg|installer|mar] [args...]") <NEW_LINE> <DEDENT> @SubC... | Repackages artifacts into different formats.
This is generally used after packages are signed by the signing
scriptworkers in order to bundle things up into shippable formats, such as a
.dmg on OSX or an installer exe on Windows. | 62598fa1e64d504609df92e1 |
class RegulatedTemperature(GetSpotValue, CTypeValue): <NEW_LINE> <INDENT> _nParam = SpotCamConstant.REGULATEDTEMPERATURE <NEW_LINE> _ctype = ctypes.c_short | The temperature to which the image sensor is regulated, in tenths of a
degree C. | 62598fa1dd821e528d6d8d86 |
class GANEstimator(estimator.Estimator): <NEW_LINE> <INDENT> def __init__(self, model_dir=None, generator_fn=None, discriminator_fn=None, generator_loss_fn=None, discriminator_loss_fn=None, generator_optimizer=None, discriminator_optimizer=None, get_hooks_fn=None, add_summaries=None, use_loss_summaries=True, config=Non... | An estimator for Generative Adversarial Networks (GANs).
This Estimator is backed by TFGAN. The network functions follow the TFGAN API
except for one exception: if either `generator_fn` or `discriminator_fn` have
an argument called `mode`, then the tf.Estimator mode is passed in for that
argument. This helps with oper... | 62598fa130dc7b766599f69e |
class ObjectDescriptor(object): <NEW_LINE> <INDENT> def __init__(self, id=Ice._struct_marker, type='', proxyOptions=''): <NEW_LINE> <INDENT> if id is Ice._struct_marker: <NEW_LINE> <INDENT> self.id = _M_Ice.Identity() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.id = id <NEW_LINE> <DEDENT> self.type = type <NEW_L... | An Ice object descriptor. | 62598fa1f548e778e596b3ff |
class TestDatasets(Dataset): <NEW_LINE> <INDENT> def __init__(self, csv_file, hp): <NEW_LINE> <INDENT> self.landmarks_frame = pd.read_csv(csv_file, sep='\|', header=None) <NEW_LINE> self.hp = hp <NEW_LINE> if self.hp.spm_model is not None: <NEW_LINE> <INDENT> self.sp = spm.SentencePieceProcessor() <NEW_LINE> self.sp.Lo... | Test dataset. | 62598fa17047854f4633f229 |
class MedidaAreasPorRegiones(object): <NEW_LINE> <INDENT> def __init__(self, segman, img_trans): <NEW_LINE> <INDENT> self.regiones = [0 for i in range(9)] <NEW_LINE> self.centros = [] <NEW_LINE> ancho, alto = img_trans.size <NEW_LINE> for segmento in segman.get_segmentos(): <NEW_LINE> <INDENT> for pixel in segmento.get... | Calculamos la suma de las areas de los segmentos que caen en las 9 regiones definidas.
Para ver donde cae un segmento, usamos su centro de masa. (esto ya no (pixel por pixel)) | 62598fa163d6d428bbee2603 |
class Dirichlet(Continuous): <NEW_LINE> <INDENT> def __init__(self, a, transform=transforms.stick_breaking, *args, **kwargs): <NEW_LINE> <INDENT> self.k = shape = a.shape[0] <NEW_LINE> if "shape" not in kwargs.keys(): <NEW_LINE> <INDENT> kwargs.update({"shape": shape}) <NEW_LINE> <DEDENT> super(Dirichlet, self).__init_... | Dirichlet
This is a multivariate continuous distribution.
.. math::
f(\mathbf{x}) = rac{\Gamma(\sum_{i=1}^k heta_i)}{\prod \Gamma( heta_i)}\prod_{i=1}^{k-1} x_i^{ heta_i - 1}
\cdot\left(1-\sum_{i=1}^{k-1}x_i
ight)^ heta_k
:Parameters:
a : float tensor
a > 0
concentration paramet... | 62598fa11b99ca400228f457 |
class CounterMeta(type): <NEW_LINE> <INDENT> counter = 0 <NEW_LINE> def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> instance = type.__call__(self, *args, **kwargs) <NEW_LINE> instance.counter = CounterMeta.counter <NEW_LINE> CounterMeta.counter += 1 <NEW_LINE> return instance | A simple meta class which adds a ``_counter`` attribute to the instances of
the classes it is used on. This counter is simply incremented for each new
instance. | 62598fa1498bea3a75a57973 |
class FilesModTimePollerThread(QObject): <NEW_LINE> <INDENT> timesAvailable = Signal(list) <NEW_LINE> def __init__(self, parent=None): <NEW_LINE> <INDENT> super(FilesModTimePollerThread, self).__init__(parent) <NEW_LINE> self._thread = None <NEW_LINE> self._mutex = Lock() <NEW_LINE> self._threadPool = ThreadPool(4) <NE... | Thread responsible for non-blocking polling of last modification times of a list of files.
Uses a Python ThreadPool internally to split tasks on multiple threads. | 62598fa1442bda511e95c2ac |
class LibcxxwrapJulia(CMakePackage): <NEW_LINE> <INDENT> homepage = "https://github.com/JuliaInterop/libcxxwrap-julia" <NEW_LINE> url = "https://github.com/JuliaInterop/libcxxwrap-julia/archive/refs/tags/v0.8.3.tar.gz" <NEW_LINE> git = "https://github.com/JuliaInterop/libcxxwrap-julia.git" <NEW_LINE> maintain... | This is the C++ library component of the CxxWrap.jl package, distributed as a
regular CMake library for use in other C++ projects. | 62598fa14527f215b58e9d35 |
class basicstore(object): <NEW_LINE> <INDENT> def __init__(self, path, vfstype): <NEW_LINE> <INDENT> vfs = vfstype(path) <NEW_LINE> setvfsmode(vfs) <NEW_LINE> self.path = vfs.base <NEW_LINE> self.createmode = vfs.createmode <NEW_LINE> self.rawvfs = vfs <NEW_LINE> self.vfs = vfsmod.filtervfs(vfs, encodedir) <NEW_LINE> s... | base class for local repository stores | 62598fa121bff66bcd722ab6 |
class fetchRequest_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRING, 'functionName', None, None, ), ) <NEW_LINE> def __init__(self, functionName=None,): <NEW_LINE> <INDENT> self.functionName = functionName <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtoc... | Attributes:
- functionName | 62598fa13617ad0b5ee05fa4 |
class GPXTrackpoint(Element): <NEW_LINE> <INDENT> name = 'trkpt' <NEW_LINE> @property <NEW_LINE> def lat(self): <NEW_LINE> <INDENT> return float(self.elem.get('lat')) <NEW_LINE> <DEDENT> @property <NEW_LINE> def lon(self): <NEW_LINE> <INDENT> return float(self.elem.get('lon')) <NEW_LINE> <DEDENT> @property <NEW_LINE> d... | Wrapper for GPX trkpt elements.
Attributes:
- *lat, lon, elev*: floats
- *datetime*: datetime object
| 62598fa157b8e32f52508045 |
class Polyhedron(Element): <NEW_LINE> <INDENT> def __init__(self,LP= [[0,0,0], [1,0,0], [0,1,0], [0,0,1]] ,LV= [[0,1,2], [1,2,3], [0,1,3], [0,2,3]], Pr=0): <NEW_LINE> <INDENT> Element.__init__(self,'Polyhedron',Priority=str(Pr)) <NEW_LINE> for P in LP: <NEW_LINE> <INDENT> self.append(Vertex(x=P[0],y=P[1],z=P[2])) <NEW_... | AddPolyhedron.m | 62598fa16aa9bd52df0d4d1d |
class Tweet(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User) <NEW_LINE> message = models.CharField(max_length=140) <NEW_LINE> date_posted = models.DateTimeField(default=datetime.datetime.now) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return "Tweet from: %s, Txt: %s" % (self.user.username, s... | Model que representa los tweets. | 62598fa1f7d966606f747e35 |
class PersonalProfileQuerySet(models.QuerySet): <NEW_LINE> <INDENT> def regular_user(self): <NEW_LINE> <INDENT> return self.filter(is_trainer=False) <NEW_LINE> <DEDENT> def trainer(self): <NEW_LINE> <INDENT> return self.filter(is_trainer=True) | Details about Personal Profile | 62598fa17b25080760ed72fb |
class ServerFlag(_constantflags): <NEW_LINE> <INDENT> _prefix = 'SERVER_' <NEW_LINE> STATUS_IN_TRANS = 1 << 0 <NEW_LINE> STATUS_AUTOCOMMIT = 1 << 1 <NEW_LINE> MORE_RESULTS_EXISTS = 1 << 3 <NEW_LINE> QUERY_NO_GOOD_INDEX_USED = 1 << 4 <NEW_LINE> QUERY_NO_INDEX_USED = 1 << 5 <NEW_L... | Server flags as found in the MySQL sources mysql-src/include/mysql_com.h | 62598fa1d486a94d0ba2be29 |
class TwoLayerNet(object): <NEW_LINE> <INDENT> def __init__(self, input_dim=3*32*32, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0): <NEW_LINE> <INDENT> self.params = {} <NEW_LINE> self.reg = reg <NEW_LINE> self.params['W1'] = weight_scale * np.random.randn(input_dim, hidden_dim) <NEW_LINE> self.params['b1... | A two-layer fully-connected neural network with ReLU nonlinearity and
softmax loss that uses a modular layer design. We assume an input dimension
of D, a hidden dimension of H, and perform classification over C classes.
The architecure should be affine - relu - affine - softmax.
Note that this class does not implemen... | 62598fa15fdd1c0f98e5ddeb |
class GetAdStatsNode(template.Node): <NEW_LINE> <INDENT> def __init__(self, ad, varname, start=None, end=None): <NEW_LINE> <INDENT> self.ad = template.Variable(ad) <NEW_LINE> self.start = start <NEW_LINE> self.end = end <NEW_LINE> self.varname = varname.strip() <NEW_LINE> <DEDENT> def render(self, context): <NEW_LINE> ... | Retrieves the stats of an ad object.
Usage::
{% get_ad_stats for ad as stats %}
{% get_ad_stats for ad as stats from 2010-08-01 to 2011-08-01 %}
{% get_ad_stats for ad as stats from 2010-08-01 %}
{% get_ad_stats for ad as stats to 2011-08-01 %} | 62598fa18a43f66fc4bf1fcf |
class BCRNN(RNN): <NEW_LINE> <INDENT> def __init__(self, num_modules, **kwargs): <NEW_LINE> <INDENT> super(BCRNN, self).__init__(**kwargs) <NEW_LINE> self.num_modules = num_modules <NEW_LINE> <DEDENT> def bind(self, *args, **kwargs): <NEW_LINE> <INDENT> super(BCRNN, self).bind(*args, **kwargs) <NEW_LINE> if self.output... | Blocked cascading recurrent network layer.
Notes
-----
In a vanilla RNN the output from the layer at the previous time step is
incorporated into the input of the layer at the current time step:
.. math::
h_t = \sigma(x_t W_{xh} + h_{t-1} W_{hh} + b)
where :math:`\sigma(\cdot)` is the :ref:`activation function <a... | 62598fa1fff4ab517ebcd641 |
class ListUserViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> serializer_class = ListUserSerializer <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = User.objects.all() <NEW_LINE> return queryset | VIewset usuairo | 62598fa107f4c71912baf297 |
@toolbar_pool.register <NEW_LINE> class StaffMemberToolbar(CMSToolbar): <NEW_LINE> <INDENT> def populate(self): <NEW_LINE> <INDENT> if hasattr(self.request.user,'staffmember') and hasattr(self.request.user.staffmember,'instructor') and self.request.user.has_perm('core.view_own_instructor_stats'): <NEW_LINE> <INDENT> me... | Adds items to the toolbar to add class Series and Events. | 62598fa17d847024c075c219 |
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. | 62598fa144b2445a339b6897 |
class KNearestNeighbor(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def train(self, X, y): <NEW_LINE> <INDENT> self.X_train = X <NEW_LINE> self.y_train = y <NEW_LINE> <DEDENT> def predict(self, X, k=1, num_loops=0): <NEW_LINE> <INDENT> if num_loops == 0: <NEW_LINE> <INDE... | a kNN classifier with L2 distance | 62598fa1498bea3a75a57975 |
class WeightlogTestCase(WorkoutManagerTestCase): <NEW_LINE> <INDENT> def test_get_workout_session(self): <NEW_LINE> <INDENT> user1 = User.objects.get(pk=1) <NEW_LINE> user2 = User.objects.get(pk=2) <NEW_LINE> workout1 = Workout.objects.get(pk=2) <NEW_LINE> workout2 = Workout.objects.get(pk=2) <NEW_LINE> WorkoutLog.obje... | Tests other model methods | 62598fa101c39578d7f12bd2 |
class BodyguardAnt(Ant): <NEW_LINE> <INDENT> name = 'Bodyguard' <NEW_LINE> implemented = True <NEW_LINE> food_cost = 4 <NEW_LINE> container = True <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> Ant.__init__(self, 2) <NEW_LINE> self.ant = None <NEW_LINE> <DEDENT> def contain_ant(self, ant): <NEW_LINE> <INDENT> if se... | BodyguardAnt provides protection to other Ants. | 62598fa1d7e4931a7ef3beed |
class L2Regularizer(Regularizer): <NEW_LINE> <INDENT> def __init__(self, reg): <NEW_LINE> <INDENT> super().__init__(reg) <NEW_LINE> <DEDENT> def loss(self, w): <NEW_LINE> <INDENT> return self._lambda * np.square(np.linalg.norm(w[:-1], 2)) <NEW_LINE> <DEDENT> def gradient(self, w): <NEW_LINE> <INDENT> gradient = np.zero... | docstring for L2Regularizer | 62598fa1442bda511e95c2ae |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.