code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Tag(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=20, blank=False, unique=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return str(self.id) +":"+self.name <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> verbose_name_plural = "Tags"
This is a tag for user submitted post entries.
6259906fd268445f2663a7a7
class ShadowBox(Camera): <NEW_LINE> <INDENT> def __init__(self, fratio=0.5, distorted=False): <NEW_LINE> <INDENT> self.stages = [] <NEW_LINE> D = 12. <NEW_LINE> res = 0.1 <NEW_LINE> transmitter = OpticalSurface(D, res) <NEW_LINE> f = fratio * D <NEW_LINE> if distorted: <NEW_LINE> <INDENT> transmitter.distort_randomly()...
## class `ShadowBox`: A particular kind of `Camera` that is a circular aperture in a screen! It is illuminated by a perfect plane wave (for now). # initialization input: * `fratio`: F ratio of the primary optics (default 4). * `distorted`: If `True`, apply random distortions.
6259906f32920d7e50bc78db
class SoftmaxWithXEntropy(OutputLayer): <NEW_LINE> <INDENT> def __init__(self, n_units, n_in, *args, **kwargs): <NEW_LINE> <INDENT> super(SoftmaxWithXEntropy, self).__init__(n_units, n_in, *args, **kwargs) <NEW_LINE> <DEDENT> def calculate_layer_gradients(self, *args, **kwargs): <NEW_LINE> <INDENT> y = kwargs.get('y', ...
Calculating exponentials and logarithmics are computationally expensive. As we can see from the previous 2 parts, the softmax layer is raising the logit scores to exponential in order to get probability vectors, and then the loss function is doing the log to calculate the entropy of the loss. If we combine these 2 sta...
6259906f091ae356687064ca
class GoalKeeper(Tactic): <NEW_LINE> <INDENT> def __init__(self, p_info_manager, p_player_id, p_is_yellow=False): <NEW_LINE> <INDENT> Tactic.__init__(self, p_info_manager) <NEW_LINE> assert isinstance(p_player_id, int) <NEW_LINE> assert PLAYER_PER_TEAM >= p_player_id >= 0 <NEW_LINE> assert isinstance(p_is_yellow, bool)...
Tactique du gardien de but standard. Le gardien doit se placer entre la balle et le but, tout en restant à l'intérieur de son demi-cercle. Si la balle entre dans son demi-cercle, le gardien tente d'aller en prendre possession. Il s'agit d'une version simple, mais fonctionelle du gardien. Peut être améliorer. méthodes: ...
6259906f63b5f9789fe869f8
class RandomCrop(object): <NEW_LINE> <INDENT> def __init__(self, size, padding=0): <NEW_LINE> <INDENT> if isinstance(size, numbers.Number): <NEW_LINE> <INDENT> self.size = (int(size), int(size)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.size = size <NEW_LINE> <DEDENT> self.padding = padding <NEW_LINE> <DEDENT>...
Crop the given PIL Image at a random location. Args: size (sequence or int): Desired output size of the crop. If size is an int instead of sequence like (h, w), a square crop (size, size) is made. padding (int or sequence, optional): Optional padding on each border of the image. Default ...
6259906fec188e330fdfa137
class TestDestinyDefinitionsDestinyActivityModifierReferenceDefinition(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 testDestinyDefinitionsDestinyActivityModifierReferenceDefinition(self): <NEW_L...
DestinyDefinitionsDestinyActivityModifierReferenceDefinition unit test stubs
6259906f32920d7e50bc78dc
class Mahasiswa(object): <NEW_LINE> <INDENT> def __init__(self, nama, nim, kota,us): <NEW_LINE> <INDENT> self.nama = nama <NEW_LINE> self.NIM = nim <NEW_LINE> self.kotaTinggal = kota <NEW_LINE> self.uangSaku = us <NEW_LINE> self.listKuliah = [] <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> s = self.nama + ...
Class mahasiswa dengan berbagai metode
6259906fadb09d7d5dc0be00
class TkMenu(tk.Menu, TkWidgetSimple): <NEW_LINE> <INDENT> def __init__(self, master, *args, **kw): <NEW_LINE> <INDENT> tk.Menu.__init__(self, master) <NEW_LINE> TkWidgetSimple.__init__(self, master, *args, **kw)
Extends tk.Menu and TkWidgetSimple. This Object is an Extension of the Tkinter Menu Widget which is needed to make it possible to build a GUI with XML Definitions.
6259906f01c39578d7f1437f
class UniqueSettingsTests(TestCase): <NEW_LINE> <INDENT> settings_module = settings <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self._installed_apps = self.settings_module.INSTALLED_APPS <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.settings_module.INSTALLED_APPS = self._installed_apps <NEW_LINE>...
Tests for the INSTALLED_APPS setting.
6259906f097d151d1a2c2906
class HealthStatus(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.HealthScore = None <NEW_LINE> self.HealthLevel = None <NEW_LINE> self.ScoreLost = None <NEW_LINE> self.ScoreDetails = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.HealthScore = params...
实例健康详情。
6259906f97e22403b383c798
class TestUntranslatedValidator(unittest.TestCase): <NEW_LINE> <INDENT> def test_pass(self): <NEW_LINE> <INDENT> entry = POEntry(msgid="Source", msgstr="Translation") <NEW_LINE> status = Status() <NEW_LINE> status.step(entry) <NEW_LINE> self.assertTrue(untranslated_validator(status)) <NEW_LINE> <DEDENT> def test_fail_m...
Test `untranslated_validator`.
6259906f4527f215b58eb5ea
class __action_space__: <NEW_LINE> <INDENT> def __init__(self, base): <NEW_LINE> <INDENT> self.__base__ = base <NEW_LINE> self.shape = len(self.__base__.__possible_choices__) <NEW_LINE> <DEDENT> def sample(self): <NEW_LINE> <INDENT> return random.choice(self.__base__.__current_direction__[:-1])
to see more information about __action_space__ class, see the env-class docstring about its action_space-class Note: This sub-class is snchronized with the parent-env-class
6259906f4e4d562566373c9c
class User(Base): <NEW_LINE> <INDENT> __tablename__ = 'user' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> name = Column(String(250), nullable=False) <NEW_LINE> email = Column(String(250), nullable=False) <NEW_LINE> picture = Column(String(250))
User class that creates the user, and stores their login data Attributes: name (str): user's name email (str): user's email picture (img): user's profile picture
6259906f56b00c62f0fb4163
class Rectangle: <NEW_LINE> <INDENT> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> self.height = height <NEW_LINE> self.width = width <NEW_LINE> <DEDENT> @property <NEW_LINE> def width(self): <NEW_LINE> <INDENT> return self.__width <NEW_LINE> <DEDENT> @property <NEW_LINE> def height(self): <NEW_LINE> <INDE...
Defines class Rectangle
6259906f71ff763f4b5e903d
class DummyMixedDictEnv(gym.Env): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.observation_space = spaces.Dict( { "obs1": spaces.Box(low=-20.0, high=20.0, shape=(4,), dtype=np.float32), "obs2": spaces.Discrete(1), "obs3": spaces.Box(low=-20.0, high=20.0, shape=(4,), dty...
Dummy mixed gym env for testing purposes
6259906fa8370b77170f1c5e
class CalcLifeCell(Elaboratable): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.input = Signal(9) <NEW_LINE> self.output = Signal() <NEW_LINE> <DEDENT> def elaborate(self, platform): <NEW_LINE> <INDENT> m = Module() <NEW_LINE> total = Signal(4) <NEW_LINE> i = [self.input[n] for n in range(9)] <NEW_LI...
An evaluator for a single cell
6259906f99fddb7c1ca63a1d
class Monster: <NEW_LINE> <INDENT> def __init__(self, x, y, hp): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.hp = hp <NEW_LINE> <DEDENT> def move(self, tuple): <NEW_LINE> <INDENT> self.x = tuple[0] <NEW_LINE> self.y = tuple[1] <NEW_LINE> <DEDENT> def attack(self, player): <NEW_LINE> <INDENT> pl...
Creates a Monster
6259906f8e7ae83300eea926
class TestRemoteValueSceneNumber: <NEW_LINE> <INDENT> def test_to_knx(self): <NEW_LINE> <INDENT> xknx = XKNX() <NEW_LINE> remote_value = RemoteValueSceneNumber(xknx) <NEW_LINE> assert remote_value.to_knx(11) == DPTArray((0x0A,)) <NEW_LINE> <DEDENT> def test_from_knx(self): <NEW_LINE> <INDENT> xknx = XKNX() <NEW_LINE> r...
Test class for RemoteValueSceneNumber objects.
6259906f435de62698e9d69c
class Conflict(HTTPException): <NEW_LINE> <INDENT> code = 409 <NEW_LINE> description = ( 'A conflict happened while processing the request. The resource ' 'might have been modified while the request was being processed.' )
*409* `Conflict` Raise to signal that a request cannot be completed because it conflicts with the current state on the server. .. versionadded:: 0.7
6259906fe5267d203ee6d008
class MemoryMessageStoreFactory(MessageStoreFactory): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.base_dict = {} <NEW_LINE> <DEDENT> def get_store(self, store_id): <NEW_LINE> <INDENT> return MemoryMessageStore(self.base_dict, store_id)
Return a Memory message store. All message are lost at pypeman stop.
6259906fa17c0f6771d5d7f5
class PrintIntTask(BaseTask): <NEW_LINE> <INDENT> def __init__(self, base, fixed_string): <NEW_LINE> <INDENT> super(type(self), self).__init__() <NEW_LINE> self.base = base <NEW_LINE> self.eos = 0 <NEW_LINE> self.fixed_string = [13,12,13,14] <NEW_LINE> self.input_type = IOType.integer <NEW_LINE> self.output_type = IOTy...
Print integer coding task. Code needs to output a fixed single value (given as a hyperparameter to the task constructor). Program input is ignored.
6259906fcc0a2c111447c71c
class SQALink(MooseMarkdownCommon, Pattern): <NEW_LINE> <INDENT> RE = r'(?<!`)\[(?P<text>.*?)\]\((?P<filename>.*?)(?:\s+(?P<settings>.*?))?\)' <NEW_LINE> @staticmethod <NEW_LINE> def defaultSettings(): <NEW_LINE> <INDENT> settings = MooseMarkdownCommon.defaultSettings() <NEW_LINE> settings['status'] = (False, "When Tru...
Creates markdown link syntax that accept key, value pairs.
6259906f167d2b6e312b81da
class TestA(object): <NEW_LINE> <INDENT> pass
Base test class.
6259906fd486a94d0ba2d855
class EventHubListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[EventHubResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(EventHubListResult, self).__init__(**kwargs) <NEW_...
The result of the List EventHubs operation. :param value: Result of the List EventHubs operation. :type value: list[~azure.mgmt.eventhub.v2015_08_01.models.EventHubResource] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of EventHubs. :type next_link: str
6259906f3539df3088ecdb33
class NullTerminatedInput(object): <NEW_LINE> <INDENT> sizehint = 8 * 1024 <NEW_LINE> ifile = None <NEW_LINE> buff = '' <NEW_LINE> def __init__(self, ifile: TextIO=sys.stdin): <NEW_LINE> <INDENT> self.ifile = ifile <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def readlines...
An iterator over null-terminated lines (terminated by '') in a file. File must be opened before construction and should be closed by the caller afterward.
6259906faad79263cf43004d
class SpecificHumidityStandardNameAdd(AttributeAdd): <NEW_LINE> <INDENT> def __init__(self, filename, directory): <NEW_LINE> <INDENT> super().__init__(filename, directory) <NEW_LINE> self.attribute_name = 'standard_name' <NEW_LINE> self.attribute_visibility = self.variable_name <NEW_LINE> self.attribute_type = 'c' <NEW...
Add a variable attribute `standard_name` with a value of `specific_humidity`. This is done in overwrite mode and so will work irrespective of whether there is an existing standard_name attribute.
6259906f55399d3f05627db7
class BootstrapEstimator(object): <NEW_LINE> <INDENT> def __init__(self, wrapped, n_bootstrap_samples=1000): <NEW_LINE> <INDENT> self._instances = [clone(wrapped, safe=False) for _ in range(n_bootstrap_samples)] <NEW_LINE> self._n_bootstrap_samples = n_bootstrap_samples <NEW_LINE> <DEDENT> def fit(self, *args, **named_...
Estimator that uses bootstrap sampling to wrap an existing estimator. This estimator provides a `fit` method with the same signature as the wrapped estimator. The bootstrap estimator will also wrap all other methods and attributes of the wrapped estimator, but return the average of the sampled calculations (this will...
6259906f796e427e5385000f
class PathObject(BaseObject): <NEW_LINE> <INDENT> def __init__(self, x, y, p, rgb, parent): <NEW_LINE> <INDENT> super(PathObject, self).__init__(parent) <NEW_LINE> qDebug("PathObject Constructor()") <NEW_LINE> self.init(x, y, p, rgb, Qt.SolidLine) <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <INDENT> qDebug("PathO...
Subclass of `BaseObject`_ TOWRITE
6259906fac7a0e7691f73d7f
class RSSError(Exception): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.value)
Base class for all rss.py errors
6259906f1f037a2d8b9e54b6
class UpdateSubmodules(Command): <NEW_LINE> <INDENT> description = "Update git submodules" <NEW_LINE> user_options = [] <NEW_LINE> def initialize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def finalize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> failur...
Update git submodules
6259906f4527f215b58eb5eb
class MockJSONEncoder(JSONEncoder): <NEW_LINE> <INDENT> def default(self, o): <NEW_LINE> <INDENT> return "9"
Mock JSON encoder.
6259906f4e4d562566373c9e
class RWLock(object): <NEW_LINE> <INDENT> def __init__(self, max_readers=1, io_loop=None): <NEW_LINE> <INDENT> self._max_readers = max_readers <NEW_LINE> self._block = BoundedSemaphore(value=max_readers, io_loop=io_loop) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "<%s _block=%s>" % ( self.__class...
A reader-writer lock for coroutines. It is created unlocked. When unlocked, :meth:`acquire_write` always changes the state to locked. When unlocked, :meth:`acquire_read` can changed the state to locked, if :meth:`acquire_read` was called max_readers times. When the state is locked, yielding :meth:`acquire_read`/meth:`...
6259906ff548e778e596ce24
class AppAlertDismissAjaxView(SODARBaseAjaxView): <NEW_LINE> <INDENT> permission_required = 'appalerts.view_alerts' <NEW_LINE> def post(self, request, **kwargs): <NEW_LINE> <INDENT> if not request.user or request.user.is_anonymous: <NEW_LINE> <INDENT> return Response({'detail': 'Anonymous access denied'}, status=401) <...
View to handle app alert dismissal in UI
6259906f56ac1b37e630392e
class AssetContentRecord(osid_records.OsidRecord): <NEW_LINE> <INDENT> pass
A record for an ``AssetContent``. The methods specified by the record type are available through the underlying object.
6259906f627d3e7fe0e0871f
class Euclidean(core.BaseWeight): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def names(cls): <NEW_LINE> <INDENT> return "euclidean", "euc", "ordinary" <NEW_LINE> <DEDENT> def __init__(self, to_num=None): <NEW_LINE> <INDENT> self.to_num = to_num_default if to_num is None else to_num <NEW_LINE> <DEDENT> def weight(self,...
Calculates "ordinary" distance/weight between two haplotypes given by the Pythagorean formula. Every attribute value is converted to a number by a ``to_num`` function. The default behavior of ``to_num`` is a sumatory of base64 ord value of every attribute value. Example: .. code-block:: python def to_num(attr):...
6259906f8da39b475be04a85
class ExportAssetsRequest(_messages.Message): <NEW_LINE> <INDENT> class ContentTypeValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> CONTENT_TYPE_UNSPECIFIED = 0 <NEW_LINE> RESOURCE = 1 <NEW_LINE> IAM_POLICY = 2 <NEW_LINE> <DEDENT> assetTypes = _messages.StringField(1, repeated=True) <NEW_LINE> contentType = _messag...
Export asset request. Enums: ContentTypeValueValuesEnum: Asset content type. If not specified, no content but the asset name will be returned. Fields: assetTypes: A list of asset types of which to take a snapshot for. For example: "compute.googleapis.com/Disk". If specified, only matching assets will ...
6259906fa05bb46b3848bd78
class Sentence(AbstractSentence): <NEW_LINE> <INDENT> homework_sheet = models.ForeignKey("HomeworkSheet", related_name="sentences"); <NEW_LINE> def get_mixed(self): <NEW_LINE> <INDENT> splited = self.sentence_text[:-1].split() <NEW_LINE> shuffle(splited) <NEW_LINE> return " ".join(splited) + self.sentence_text[-1]
Original sentence model. For sentences written by teacher.
6259906fa8370b77170f1c60
class get_twitter(): <NEW_LINE> <INDENT> def __init__(self,query,item,namesave): <NEW_LINE> <INDENT> self.df_traing = pd.DataFrame() <NEW_LINE> self.query = query <NEW_LINE> self.namesave = namesave <NEW_LINE> self.item = item <NEW_LINE> <DEDENT> def __help__(): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __versio...
use Twiiter API (by tweepy api)
6259906fdd821e528d6da5cd
class BouncingBall: <NEW_LINE> <INDENT> def __init__(self, canvas, center, radius, color, direction, speed): <NEW_LINE> <INDENT> x, y = center <NEW_LINE> x1 = x - radius <NEW_LINE> y1 = y - radius <NEW_LINE> x2 = x + radius <NEW_LINE> y2 = y + radius <NEW_LINE> self.handle = canvas.create_oval(x1, y1, x2, y2, fill=colo...
Objects of this class represent balls which bounce on a canvas.
6259906f99fddb7c1ca63a1e
class Register(Resource): <NEW_LINE> <INDENT> def post(self): <NEW_LINE> <INDENT> email = request.form['email'] <NEW_LINE> password = request.form['password'] <NEW_LINE> if not email or not password: <NEW_LINE> <INDENT> response = jsonify({'message': 'Provide both email and password'}) <NEW_LINE> response.status_code =...
Register user
6259906f5fc7496912d48eb4
class LoginHandler(BaseHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> if not self.current_user: <NEW_LINE> <INDENT> self.render("admin_login.html") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.redirect("/Index") <NEW_LINE> <DEDENT> <DEDENT> async def post(self): <NEW_LINE> <INDENT> data = tornad...
Login Page
6259906f3317a56b869bf190
class LookupError(Error): <NEW_LINE> <INDENT> pass
An error occurred during a lookup query.
6259906ff548e778e596ce25
class BeginTransactionRequest(_messages.Message): <NEW_LINE> <INDENT> options = _messages.MessageField('TransactionOptions', 1)
The request for Firestore.BeginTransaction. Fields: options: The options for the transaction. Defaults to a read-write transaction.
6259906f4f88993c371f116c
class _IsolatedEnvVenvPip(IsolatedEnv): <NEW_LINE> <INDENT> def __init__(self, path, python_executable, scripts_dir): <NEW_LINE> <INDENT> self._path = path <NEW_LINE> self._python_executable = python_executable <NEW_LINE> self._scripts_dir = scripts_dir <NEW_LINE> <DEDENT> @property <NEW_LINE> def path(self): <NEW_LINE...
Isolated build environment context manager Non-standard paths injected directly to sys.path will still be passed to the environment.
6259906f7d847024c075dc71
class AnanlysisEmployeeEveryday(LoginRequiredMixin,View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> getParams = request.GET <NEW_LINE> filter_date = getParams.get('filter_date', '') <NEW_LINE> employee_name= getParams.get('employee_name', '') <NEW_LINE> if not employee_name: <NEW_LINE> <INDENT> em...
查询特定职员每日工作情况
6259906fe76e3b2f99fda29b
class CreateRouteTableResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RouteTable = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("RouteTable") is not None: <NEW_LINE> <INDENT> self.RouteTable = RouteT...
CreateRouteTable返回参数结构体
6259906fd486a94d0ba2d857
@implementer(IToolConf) <NEW_LINE> class ToolConf(baseConf): <NEW_LINE> <INDENT> def __init__(self, copyFrom=None, **values): <NEW_LINE> <INDENT> self.id = "" <NEW_LINE> self.name = "" <NEW_LINE> self.context = "" <NEW_LINE> self.apply = None <NEW_LINE> self.data = [] <NEW_LINE> self.values = {} <NEW_LINE> self.views =...
Tool configuration Values :: *id : Unique tool id as ascii string. Used to register and lookup the tool. *context : Dotted python name or class reference used as factory. *apply : List of interfaces the tool is registered for. data : Tool data defined as nive.definitions.FieldConf list. ...
6259906f01c39578d7f14381
class CalibrationClient(Client): <NEW_LINE> <INDENT> def __init__(self, calibrationID=None, workerID=None, **kwargs): <NEW_LINE> <INDENT> super(CalibrationClient, self).__init__(**kwargs) <NEW_LINE> self.setServer('Calibration/Calibration') <NEW_LINE> self.calibrationID = calibrationID <NEW_LINE> self.workerID = worker...
Provide an interface for user and worker nodes to talk to Calibration service. Contains interfaces to fetch the necessary data from the service to worker node and to report the results back.
6259906f7047854f46340c51
class TestCalendarUpdate(Base): <NEW_LINE> <INDENT> expected_title = "fedocal.calendar.update" <NEW_LINE> expected_subti = 'ralph updated the "awesome" calendar' <NEW_LINE> expected_link = "https://apps.fedoraproject.org/calendar/awesome/" <NEW_LINE> expected_icon = ("https://apps.fedoraproject.org/calendar/" "static/c...
These messages are published when someone updates a whole calendar from `fedocal <https://apps.fedoraproject.org/calendar>`_.
6259906ffff4ab517ebcf0b4
class SafeChildWatcher(BaseChildWatcher): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._callbacks = {} <NEW_LINE> <DEDENT> def close(self): <NEW_LINE> <INDENT> self._callbacks.clear() <NEW_LINE> super().close() <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT...
'Safe' child watcher implementation. This implementation avoids disrupting other code spawning processes by polling explicitly each process in the SIGCHLD handler instead of calling os.waitpid(-1). This is a safe solution but it has a significant overhead when handling a big number of children (O(n) each time SIGCHLD...
6259906fbe8e80087fbc0928
class WeblateLoginView(LoginView): <NEW_LINE> <INDENT> form_class = LoginForm <NEW_LINE> template_name = "accounts/login.html" <NEW_LINE> redirect_authenticated_user = True <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(**kwargs) <NEW_LINE> auth_backends = list(l...
Login handler, just a wrapper around standard Django login.
6259906fa05bb46b3848bd79
class RaftStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.RequestVote = channel.unary_unary( '/Raft/RequestVote', request_serializer=raft__pb2.VoteRequest.SerializeToString, response_deserializer=raft__pb2.Ack.FromString, ) <NEW_LINE> self.AppendEntries = channel.unary_unary( '/R...
Raft gRPC implementation
6259906fa8370b77170f1c62
class ScaledMean(Mean, ScaledFunction): <NEW_LINE> <INDENT> @_dispatch <NEW_LINE> def __call__(self, x): <NEW_LINE> <INDENT> return B.multiply(self.scale, self[0](x))
Scaled mean.
6259906f5fdd1c0f98e5f820
class WindowManager(ScreenManager): <NEW_LINE> <INDENT> pass
Navigation Router
6259906f009cb60464d02dd1
class Vehiculo(models.Model): <NEW_LINE> <INDENT> TIPO_USUARIO = ( (u'1', u'Gerente'), (u'2', u'Tesorero'), (u'3', u'Cliente'), (u'4', u'Conductor'), ) <NEW_LINE> id = models.UUIDField(primary_key=True, default=uuid4, editable=False) <NEW_LINE> documento_identidad=models.IntegerField() <NEW_LINE> foto_vehiculo=models.I...
docs
6259906f0a50d4780f706a0e
class UUIDEncoder(json.JSONEncoder): <NEW_LINE> <INDENT> def default(self, obj): <NEW_LINE> <INDENT> if isinstance(obj, UUID4): <NEW_LINE> <INDENT> return str(obj) <NEW_LINE> <DEDENT> return json.JSONEncoder.default(self, obj)
UUID Encoder
6259906f4f6381625f19a0f5
class SubstringEmbeddableGenerator(AbstractEmbeddableGenerator): <NEW_LINE> <INDENT> def __init__(self, substringGenerator, name=None): <NEW_LINE> <INDENT> self.substringGenerator = substringGenerator <NEW_LINE> super(SubstringEmbeddableGenerator, self).__init__(name) <NEW_LINE> <DEDENT> def generateEmbeddable(self): <...
Generates a :class:`.StringEmbeddable` Calls ``substringGenerator``, wraps the result in a :class:`.StringEmbeddable` and returns it. Arguments: substringGenerator: instance of :class:`.AbstractSubstringGenerator`
6259906f92d797404e3897a8
class BaseConfig: <NEW_LINE> <INDENT> DEBUG = False <NEW_LINE> TESTING = False <NEW_LINE> SECRET_KEY = "PB3aGvTmCkzaLGRAxDc3aMayKTPTDd5usT8gw4pCmKOk5AlJjh12pTrnNgQyOHCH" <NEW_LINE> DEBUG_TB_ENABLED = False <NEW_LINE> DEBUG_TB_INTERCEPT_REDIRECTS = False
Base configuration
6259906f2ae34c7f260ac984
class Background(Effect): <NEW_LINE> <INDENT> def __init__(self, screen, bg=0, **kwargs): <NEW_LINE> <INDENT> super(Background, self).__init__(screen, **kwargs) <NEW_LINE> self._bg = bg <NEW_LINE> <DEDENT> def reset(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _update(self, frame_no): <NEW_LINE> <INDENT> for...
Effect to be used as a Desktop background. This sets the background to the specified colour.
6259906f460517430c432ca4
class NetworkServer(NetworkPlayer): <NEW_LINE> <INDENT> def __init__(self,name="玩家1",parent=None): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> self.name = name <NEW_LINE> self.ser_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) <NEW_LINE> try: <NEW_LINE> <INDENT> self.ser_socket.bind(("0.0.0.0", ...
运行服务端游戏界面
6259906f1f5feb6acb16448c
class CycleCallback(Callback): <NEW_LINE> <INDENT> def __init__(self, optimizer, max_lr, min_lr, cycles, cycle_len=1, cycle_mult=1, init_iter=0, init_lr=0, interpolate='linear'): <NEW_LINE> <INDENT> self.max_lr = max_lr <NEW_LINE> self.min_lr = min_lr <NEW_LINE> self.cycles = cycles <NEW_LINE> self.cycle_len = cycle_le...
A callback that manages setting the proper learning rate
6259906f38b623060ffaa4a1
class Unbaser(object): <NEW_LINE> <INDENT> ALPHABET = { 56: '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz', 59: '0123456789abcdefghijklmnopqrstuvwABCDEFGHIJKLMNOPQRSTUVWXYZ', 64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/', 95: (' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU...
Functor for a given base. Will efficiently convert strings to natural numbers.
6259906f167d2b6e312b81dc
class Device(models.Model): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return self.uuid <NEW_LINE> <DEDENT> uuid = models.CharField( db_index=True, max_length=64, unique=True, default=uuid.uuid4, editable=False, ) <NEW_LINE> user = models.OneToOneField( User, related_name="Hiccup_Device", on_delete=mode...
A device representing a phone that has been registered on Hiccup.
6259906f56b00c62f0fb4169
class UsualDiaryOneSubject: <NEW_LINE> <INDENT> def __init__(self, name: str, subject_type: str, time: str, homework: str, marks: str) -> None: <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.type = subject_type <NEW_LINE> self.time = time <NEW_LINE> self.homework = homework <NEW_LINE> self.marks = marks <NEW_LINE...
Class representing one subject in user diary Arguments --------- name: str Name of the subject type: str Type of the lesson (intramural, extramural) time: str Time of the lesson (8:00 - 8:45) homework: str Homework for this lesson marks: str Marks for that lesson Returns ------- None
6259906f1f037a2d8b9e54b8
class NuclearPleomorphism(OneFieldPerReport): <NEW_LINE> <INDENT> __version__ = 'NuclearPleomorphism1.0' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(NuclearPleomorphism, self).__init__() <NEW_LINE> self.field_name = 'NuclearPleomorphism' <NEW_LINE> self.regex = r'Nuclear Pleomorphism:[\s]+([123\-]+)[\s]+po...
find the invasive nuclear pleomorphism in the templated pathology report
6259906f71ff763f4b5e9043
class LinkedList: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__root = None <NEW_LINE> <DEDENT> def get_root(self): <NEW_LINE> <INDENT> return self.__root <NEW_LINE> <DEDENT> def add_to_list(self, node): <NEW_LINE> <INDENT> if self.__root: <NEW_LINE> <INDENT> node.set_next(self.__root) <NEW_LINE> <...
This class is the one you should be modifying! Don't change the name of the class or any of the methods. Implement those methods that current raise a NotImplementedError
6259906f44b2445a339b75ac
class MustDoHistory(models.Model): <NEW_LINE> <INDENT> date = models.DateField() <NEW_LINE> category_link = models.ForeignKey('MustDoCategories', related_name='history') <NEW_LINE> done = models.BooleanField(default=False)
the combination of start date and schedule will populate this field.
6259906ff548e778e596ce28
class QueryView(View): <NEW_LINE> <INDENT> def get(self, request, task_id): <NEW_LINE> <INDENT> result_object = AsyncResult(task_id) <NEW_LINE> response = { 'status': result_object.state } <NEW_LINE> if result_object.successful(): <NEW_LINE> <INDENT> response['output'] = result_object.result <NEW_LINE> <DEDENT> return ...
Given a task id, queries the status of the associated task.
6259906f627d3e7fe0e08723
class Actions(ActionsBase): <NEW_LINE> <INDENT> def configure(self,**args): <NEW_LINE> <INDENT> self.jp_instance.hrd.applyOnFile( path="/opt/elasticsearch/config/elasticsearch.yml", additionalArgs={}) <NEW_LINE> return True
process for install ------------------- step1: prepare actions step2: check_requirements action step3: download files & copy on right location (hrd info is used) step4: configure action step5: check_uptime_local to see if process stops (uses timeout $process.stop.timeout) step5b: if check uptime was true will do stop ...
6259906fbe8e80087fbc092a
class WalmartModel(models.Model): <NEW_LINE> <INDENT> upc = models.CharField(unique=True,max_length=50) <NEW_LINE> salePrice = models.DecimalField(decimal_places=2,max_digits=12) <NEW_LINE> name = models.CharField(max_length=10000) <NEW_LINE> brandName = models.CharField(max_length=10000) <NEW_LINE> modelNumber = model...
Collection walmart data
6259906fa219f33f346c80a5
class IndexPageTest(TestCase): <NEW_LINE> <INDENT> def test_index_page_renders_index_template(self): <NEW_LINE> <INDENT> response = self.client.get('/') <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertTemplateUsed(response, 'index.html')
测试index登录首页
6259906f3317a56b869bf192
class OptionDialog(dialogs.FancyPopup): <NEW_LINE> <INDENT> def __init__(self, parent, playback): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> layout = QtWidgets.QVBoxLayout(self) <NEW_LINE> hLayout = QtWidgets.QHBoxLayout() <NEW_LINE> layout.addLayout(hLayout) <NEW_LINE> hLayout.addWidget(QtWidgets.QLabel(s...
Dialog for the option button in the playlist's (dock widget) title bar.
6259906f7c178a314d78e839
class capture_output(object): <NEW_LINE> <INDENT> stdout = True <NEW_LINE> stderr = True <NEW_LINE> display = True <NEW_LINE> def __init__(self, stdout=True, stderr=True, display=True): <NEW_LINE> <INDENT> self.stdout = stdout <NEW_LINE> self.stderr = stderr <NEW_LINE> self.display = display <NEW_LINE> self.shell = Non...
context manager for capturing stdout/err
6259906f4428ac0f6e659dd0
class Rds(): <NEW_LINE> <INDENT> def __init__(self, host, port, db): <NEW_LINE> <INDENT> self.rds = Redis(host = host, port = port, db = db) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def getLocal(): <NEW_LINE> <INDENT> obj = Rds('127.0.0.1', 6379, 1) <NEW_LINE> return obj.rds <NEW_LINE> <DEDENT> @staticmethod <NEW_L...
Redis封装
6259906f2ae34c7f260ac986
class StatefulServiceReplicaHealthState(ReplicaHealthState): <NEW_LINE> <INDENT> _validation = { 'service_kind': {'required': True}, } <NEW_LINE> _attribute_map = { 'aggregated_health_state': {'key': 'AggregatedHealthState', 'type': 'str'}, 'partition_id': {'key': 'PartitionId', 'type': 'str'}, 'service_kind': {'key': ...
Represents the health state of the stateful service replica, which contains the replica id and the aggregated health state. :param aggregated_health_state: Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', 'Unknown' :type aggregated_health_state: str or :class:`enum <azure.servicefabric.models.enum>` :pa...
6259906f9c8ee82313040dd6
class SquareXianchangyaoCases(TestCase): <NEW_LINE> <INDENT> def tearDown(self): <NEW_LINE> <INDENT> self.reset.clearData() <NEW_LINE> self.driver.quit() <NEW_LINE> <DEDENT> def setUp(self): <NEW_LINE> <INDENT> self.logger = Logger() <NEW_LINE> self.driver = AppiumDriver(None, None, IDC.platformName, IDC.platformVersio...
作者 刘涛 广场现场摇
625990703539df3088ecdb39
class UserProfile(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, on_delete=models.CASCADE) <NEW_LINE> dob = models.DateField(blank=True, null=True) <NEW_LINE> nickname = models.CharField(max_length=30, blank=True, null=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name_plural = 'UserPro...
A Profile Model for creating and updating User profile
625990707047854f46340c55
class Command(CeleryCommand): <NEW_LINE> <INDENT> help = "celery control utility" <NEW_LINE> keep_base_opts = False <NEW_LINE> def run_from_argv(self, argv): <NEW_LINE> <INDENT> util = celeryctl(app=app) <NEW_LINE> util.execute_from_commandline(self.handle_default_options(argv)[1:])
Run the celery control utility.
625990701f037a2d8b9e54b9
class DirectedEdgeStar(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._outEdges = [] <NEW_LINE> self._sorted = False <NEW_LINE> <DEDENT> def sortEdges(self): <NEW_LINE> <INDENT> if not self._sorted: <NEW_LINE> <INDENT> self._outEdges = sorted(self._outEdges, key=lambda de: de.angle) <NEW_LINE> self...
* A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
62599070fff4ab517ebcf0b8
class ThreadWithExceptions(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ThreadWithExceptions, self).__init__(*args, **kwargs) <NEW_LINE> self.exception = None <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.RunWithExceptions()...
Extension of threading.Thread that propagates exceptions on join.
6259907097e22403b383c7a1
class PrivateIngredientsApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> self.user = get_user_model().objects.create_user( 'test2@testexample.com', 'testpass' ) <NEW_LINE> self.client.force_authenticate(self.user) <NEW_LINE> <DEDENT> def test_retrieve_ing...
Test the private ingredients API
62599070e1aae11d1e7cf45b
class CalculatorType(Enum): <NEW_LINE> <INDENT> MATLAB, OCTAVE, REMOTE = range(3)
Enum used to specify the type of NATLAB client to build
62599070dd821e528d6da5d0
class TempDirectoryPath(str): <NEW_LINE> <INDENT> def __enter__(self) -> "TempDirectoryPath": <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def __exit__( self, _exc: Optional[Type[BaseException]], _value: Optional[Exception], _tb: Optional[TracebackType], ) -> bool: <NEW_LINE> <INDENT> if os.path.exists(self): <N...
Represents a path to an temporary directory. When used as a context manager, it erases the contents of the directory on exit.
625990703317a56b869bf193
class Lexical(restService): <NEW_LINE> <INDENT> def __init__(self, basePath=None, verbose=False, cache=False, safe_cache=False, key=None, do_error=False): <NEW_LINE> <INDENT> if basePath is None: <NEW_LINE> <INDENT> basePath = BASEPATH <NEW_LINE> <DEDENT> self._basePath = basePath <NEW_LINE> self._verbose = verbose <NE...
Lexical services
625990704f88993c371f116f
class ReluLayer(Layer): <NEW_LINE> <INDENT> def fprop(self, inputs): <NEW_LINE> <INDENT> return np.maximum(0., inputs) <NEW_LINE> <DEDENT> def bprop(self, inputs, outputs, grads_wrt_outputs): <NEW_LINE> <INDENT> return (outputs > 0.) * grads_wrt_outputs <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return...
Layer implementing an element-wise rectified linear transformation.
62599070d268445f2663a7ac
class OpenLatchImpl(AbstractCommandImpl[OpenLatchParams, OpenLatchResult]): <NEW_LINE> <INDENT> def __init__( self, state_view: StateView, hardware_api: HardwareControlAPI, **unused_dependencies: object, ) -> None: <NEW_LINE> <INDENT> self._state_view = state_view <NEW_LINE> self._hardware_api = hardware_api <NEW_LINE>...
Execution implementation of a Heater-Shaker's open latch command.
625990702ae34c7f260ac988
class equilibrium(osv.osv): <NEW_LINE> <INDENT> _name = 'interview.equilibrium' <NEW_LINE> def _perform_equilibrium(self, cr, uid, ids, fields_name, arg, context=None): <NEW_LINE> <INDENT> res = {} <NEW_LINE> result = "" <NEW_LINE> for i in ids: <NEW_LINE> <INDENT> A = [int(x) for x in self.browse(cr, uid, ids)[0].list...
A equilibrium model
6259907038b623060ffaa4a3
class LogModel(QtWidgets.QFileSystemModel): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(LogModel, self).__init__() <NEW_LINE> <DEDENT> def columnCount(self, parent = QtCore.QModelIndex()): <NEW_LINE> <INDENT> return super(LogModel, self).columnCount()+1 <NEW_LINE> <DEDENT> def dat...
A Subclass of QFileSystemModel to add a column.
6259907076e4537e8c3f0e23
class AuthenticationForm(forms.Form): <NEW_LINE> <INDENT> email = forms.EmailField( label=_("Email address"), max_length=254, widget=forms.EmailInput(attrs={'autofocus': True}), ) <NEW_LINE> password = forms.CharField( label=_("Password"), strip=False, widget=forms.PasswordInput, ) <NEW_LINE> error_messages = { 'invali...
Base class for authenticating users. Extend this to get a form that accepts email/password logins.
62599070796e427e53850017
class DbTest(BaseTest): <NEW_LINE> <INDENT> def test_select_db(self): <NEW_LINE> <INDENT> bloom = pyreBloom.pyreBloom(self.KEY, self.CAPACITY, self.ERROR_RATE, db=1) <NEW_LINE> samples = sample_strings(20, 100) <NEW_LINE> self.bloom.extend(samples) <NEW_LINE> self.assertEqual(len(bloom.contains(samples)), 0)
Make sure we can select a database
62599070aad79263cf430055
class UnschedulableNodeError(RuntimeError): <NEW_LINE> <INDENT> log = True <NEW_LINE> fault_code = fault_code_counter.next()
Raise if an action isn't valid on a node marked "unscheduled"
6259907044b2445a339b75ae
class PlatformReport(models.Model): <NEW_LINE> <INDENT> date = models.DateField("Дата", default=datetime.now) <NEW_LINE> platform_id = models.IntegerField(verbose_name="Площадка") <NEW_LINE> video_id = models.CharField(verbose_name="Видео", max_length=32) <NEW_LINE> video_views = models.PositiveIntegerField("Количество...
Данные отчетов по площадка.
62599070e1aae11d1e7cf45c
class TFOptimizer(Optimizer, trackable.Trackable): <NEW_LINE> <INDENT> def __init__(self, optimizer, iterations=None): <NEW_LINE> <INDENT> self.optimizer = optimizer <NEW_LINE> self._track_trackable(optimizer, name='optimizer') <NEW_LINE> if iterations is None: <NEW_LINE> <INDENT> with K.name_scope(self.__class__.__nam...
Wrapper class for native TensorFlow optimizers.
625990703d592f4c4edbc780
class ProxyWorkerFinder(WorkerFinder): <NEW_LINE> <INDENT> def __init__(self, uuid, proxy, topics): <NEW_LINE> <INDENT> super(ProxyWorkerFinder, self).__init__() <NEW_LINE> self._proxy = proxy <NEW_LINE> self._topics = topics <NEW_LINE> self._workers = {} <NEW_LINE> self._uuid = uuid <NEW_LINE> self._proxy.dispatcher.t...
Requests and receives responses about workers topic+task details.
62599070a219f33f346c80a9
class CuttlefishCommonPkgInstaller(base_task_runner.BaseTaskRunner): <NEW_LINE> <INDENT> WELCOME_MESSAGE_TITLE = "Install cuttlefish-common packages on the host" <NEW_LINE> WELCOME_MESSAGE = ("This step will walk you through the cuttlefish-common " "packages installation for your host.") <NEW_LINE> def ShouldRun(self):...
Subtask base runner class for installing cuttlefish-common.
625990708e7ae83300eea930
class Apparmor(Plugin, UbuntuPlugin): <NEW_LINE> <INDENT> def setup(self): <NEW_LINE> <INDENT> self.add_copy_specs([ "/etc/apparmor" ])
Apparmor related information
6259907099cbb53fe6832789
class ReflexAgent(Agent): <NEW_LINE> <INDENT> def getAction(self, gameState): <NEW_LINE> <INDENT> legalMoves = gameState.getLegalActions() <NEW_LINE> scores = [self.evaluationFunction(gameState, action) for action in legalMoves] <NEW_LINE> bestScore = max(scores) <NEW_LINE> bestIndices = [index for index in range(len(s...
A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our method headers.
62599070435de62698e9d6a5
class WhooshBookmarks(object): <NEW_LINE> <INDENT> def __init__(self, db): <NEW_LINE> <INDENT> self.bookmarks_collection = db.bookmarks_col <NEW_LINE> self.webpages_collection = db.webpages_col <NEW_LINE> self.indexdir = "index" <NEW_LINE> self.indexname = "bookmarks" <NEW_LINE> self.schema = self.get_schema() <NEW_LIN...
Object utilising Whoosh (http://woosh.ca/) to create a search index of all crawled rss feeds, parse queries and search the index for related mentions.
6259907067a9b606de5476f3
class GridFSStorage(FileStorage): <NEW_LINE> <INDENT> def __init__(self, mongouri, collection='filedepot'): <NEW_LINE> <INDENT> self._cli = MongoClient(mongouri) <NEW_LINE> self._db = self._cli.get_default_database() <NEW_LINE> self._gridfs = gridfs.GridFS(self._db, collection=collection) <NEW_LINE> <DEDENT> def get(se...
:class:`depot.io.interfaces.FileStorage` implementation that stores files on MongoDB. All the files are stored using GridFS to the database pointed by the ``mongouri`` parameter into the collection named ``collection``.
625990704a966d76dd5f078a
class Rectangle: <NEW_LINE> <INDENT> number_of_instances = 0 <NEW_LINE> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> self.height = height <NEW_LINE> self.width = width <NEW_LINE> self.__class__.number_of_instances += 1 <NEW_LINE> <DEDENT> def __testInput(self, prop, value): <NEW_LINE> <INDENT> if type(val...
class Rectangle that defines a rectangle
625990708e7ae83300eea931