code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Meta: <NEW_LINE> <INDENT> model = ChangeSet <NEW_LINE> fields = ('author', 'object', 'resolved_by', 'status')
FilterForm
62598edf1b99ca400228e7e8
class StudentsForm(forms.ModelForm): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(StudentsForm, self).__init__(*args, **kwargs) <NEW_LINE> instance = getattr(self, 'instance', None) <NEW_LINE> if instance: <NEW_LINE> <INDENT> self.fields['user'].widget.attrs['readonly'] = True <NEW...
Form for managing the students enrolled in the course
62598edfe5267d203ee69eba
class ReutersParser(html_parser.HTMLParser): <NEW_LINE> <INDENT> def __init__(self, encoding='utf-8'): <NEW_LINE> <INDENT> html_parser.HTMLParser.__init__(self) <NEW_LINE> self._reset() <NEW_LINE> self.encoding = encoding <NEW_LINE> <DEDENT> def handle_starttag(self, tag, attrs): <NEW_LINE> <INDENT> method = 'start_' +...
Utility class to parse a SGML file and yield documents one at a time. Utility类来解析一个SGML文件并一次产生一个文档。
62598edf3d592f4c4edb94ab
class BlogFront(BlogHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> posts = Post.all().order('-created') <NEW_LINE> self.render('front.html', posts=posts)
Shows all posts sorted from latest modified first
62598edf8da39b475be01761
class AWSSnapshotS3CopyException(Exception): <NEW_LINE> <INDENT> def __init__(self, message: str) -> None: <NEW_LINE> <INDENT> super().__init__(message) <NEW_LINE> self.message = message
Class to represent an exception in this collector. Attributes: message (str): The error message.
62598edf45492302aabfaa6a
class ReviewDirExistsError(ReviewError): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> msg = 'The directory %s is in the way, please remove' % os.path.abspath(path) <NEW_LINE> ReviewError.__init__(self, msg, 2) <NEW_LINE> self.show_logs = False
The review dir is already in place.
62598edf498bea3a75a560ee
class Collection(Catalog, total=False): <NEW_LINE> <INDENT> keywords: List[str] <NEW_LINE> license: str <NEW_LINE> providers: List[Dict[str, Any]] <NEW_LINE> extent: Dict[str, Any] <NEW_LINE> summaries: Dict[str, Any] <NEW_LINE> assets: Dict[str, Any]
STAC Collection.
62598edf2c8b7c6e89bd1d77
class Mutation(OffspringCreator): <NEW_LINE> <INDENT> def __init__(self, num_muts=1, rng=np.random): <NEW_LINE> <INDENT> OffspringCreator.__init__(self, num_muts=num_muts, rng=rng) <NEW_LINE> self.descriptor = 'Mutation' <NEW_LINE> self.min_inputs = 1 <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def get_atomic_configura...
Base class for all particle mutation type operators. Do not call this class directly.
62598edf21bff66bcd72120a
class RunNamespacesDomainmappingsCreateRequest(_messages.Message): <NEW_LINE> <INDENT> domainMapping = _messages.MessageField('DomainMapping', 1) <NEW_LINE> parent = _messages.StringField(2, required=True)
A RunNamespacesDomainmappingsCreateRequest object. Fields: domainMapping: A DomainMapping resource to be passed as the request body. parent: The project ID or project number in which this domain mapping should be created.
62598edf38b623060ffa764c
class PHPFormatCheck(BaseFormatCheck): <NEW_LINE> <INDENT> check_id = 'php_format' <NEW_LINE> name = _('PHP format') <NEW_LINE> description = _('Format string does not match source') <NEW_LINE> flag = 'php-format' <NEW_LINE> regexp = PHP_PRINTF_MATCH
Check for PHP format string
62598edfcb5e8a47e493b455
class CtlProgram(BaseProgram): <NEW_LINE> <INDENT> def __init__(self, description, address, timeout=3000): <NEW_LINE> <INDENT> super(CtlProgram, self).__init__(description, address) <NEW_LINE> self.client = ClientWrapper(address, timeout) if address else None <NEW_LINE> self.parser.add_argument( 'command', help='comman...
The Ctl program Note: When a CtlProgram accepts a command it will make a request to the remote service with that command and any args extracted. When we add commands via `add_command` method, then those commands will be executed by our registered function; they will be not dispatched to the remot...
62598edf2ae34c7f260a96a0
class EnablingModesComponent(ModesComponent): <NEW_LINE> <INDENT> def __init__(self, component=None, enabled_color='DefaultButton.On', disabled_color='DefaultButton.Off', *a, **k): <NEW_LINE> <INDENT> super(EnablingModesComponent, self).__init__(*a, **k) <NEW_LINE> component.set_enabled(False) <NEW_LINE> self.add_mode(...
Adds the two modes 'enabled' and 'disabled'. The provided component will be enabled while the 'enabled' mode is active.
62598edf925a0f43d25e65e5
class RedBlackBST(object): <NEW_LINE> <INDENT> def __init__(self, root): <NEW_LINE> <INDENT> self.root = root <NEW_LINE> <DEDENT> def is_red(self, x): <NEW_LINE> <INDENT> return False if x is None else x.color == RED <NEW_LINE> <DEDENT> def rotate_left(self, h): <NEW_LINE> <INDENT> x = h.right <NEW_LINE> h.right = x.le...
二叉查找树
62598edf66656f66f7d58999
class EnemyDistanceFeature(Feature): <NEW_LINE> <INDENT> def __init__(self, enemy_id): <NEW_LINE> <INDENT> self.enemy_id = enemy_id <NEW_LINE> <DEDENT> def __call__(self, state, action): <NEW_LINE> <INDENT> my_position = state.get_position() <NEW_LINE> enemy_position = state.get_agent_position(self.enemy_id) <NEW_LINE>...
Calculate the distance to the enemy.
62598edf5fdd1c0f98e5c566
class ImageStat(DotDic): <NEW_LINE> <INDENT> def __init__(self, image): <NEW_LINE> <INDENT> if image.sort is None: <NEW_LINE> <INDENT> image.make_sort() <NEW_LINE> <DEDENT> sort = image.sort <NEW_LINE> self.mean = np.mean(image.im0) <NEW_LINE> self.rms = np.std(image.im0) <NEW_LINE> self.number_count = len(image.im0.fl...
Container mean, median, rms, min, max, number_count, sum
62598edf379a373c97d975b3
class WeekWithScheduleMixin(WeekCalendarMixin): <NEW_LINE> <INDENT> def get_week_schedules(self, days): <NEW_LINE> <INDENT> user = self.request.user <NEW_LINE> term_date = self.get_term_date() <NEW_LINE> day_schedules = {} <NEW_LINE> for day in days: <NEW_LINE> <INDENT> week = self.week_names[day.weekday()] <NEW_LINE> ...
スケジュール付きの、週間カレンダーを提供するMixin
62598edf7b25080760ed5a52
class CitationFilter(Filter): <NEW_LINE> <INDENT> FILTER_CLASS = CitationSidebarFilter
A gramplet providing a Citation Filter.
62598edf01c39578d7f11360
class Fipscheck(AutotoolsPackage): <NEW_LINE> <INDENT> homepage = "https://github.com/LairdCP/fipscheck" <NEW_LINE> url = "https://github.com/LairdCP/fipscheck/archive/LRD-REL-7.0.0.398.tar.gz" <NEW_LINE> version('7.0.0.398', sha256='1b78c71b8b39d948926910644ad544719ce6f69672d3205bc36a5924a07f6e9b') <NEW_LINE> ver...
The integrity check is only one of many requirements needed for validation of a software cryptographic module.
62598edf99fddb7c1ca620e2
class LoadLocalPacketWrapper: <NEW_LINE> <INDENT> def __init__(self, from_packet): <NEW_LINE> <INDENT> if not from_packet.is_load_local_packet(): <NEW_LINE> <INDENT> raise ValueError( f"Cannot create '{self.__class__}' object from invalid packet type" ) <NEW_LINE> <DEDENT> self.packet = from_packet <NEW_LINE> self.file...
Load Local Packet Wrapper. It uses an existing packet object, and wraps around it, exposing useful variables while still providing access to the original packet objects variables and methods.
62598edfa79ad161977685d5
class PoresSizeDistParser(): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def parse(cls, string): <NEW_LINE> <INDENT> def clean_values(float_list): <NEW_LINE> <INDENT> return [ 0 if math.isnan(f) or math.isinf(f) else f for f in float_list ] <NEW_LINE> <DEDENT> lines = string.splitlines() <NEW_LINE> lines = [l for l in ...
Parse pore size distribution output of network executable.
62598edf498bea3a75a560ef
class Source(object): <NEW_LINE> <INDENT> def read(self): <NEW_LINE> <INDENT> raise NotImplementedError
Sources can be anything, from RSS/Atom feeds to Twitter Searches, Google News, etc. Make sure that Sources yield results when reading.
62598edfe76e3b2f99fd6ff2
class ADSL(ExtensionOnlyType_): <NEW_LINE> <INDENT> c_tag = 'ADSL' <NEW_LINE> c_namespace = NAMESPACE <NEW_LINE> c_children = ExtensionOnlyType_.c_children.copy() <NEW_LINE> c_attributes = ExtensionOnlyType_.c_attributes.copy() <NEW_LINE> c_child_order = ExtensionOnlyType_.c_child_order[:] <NEW_LINE> c_cardinality = Ex...
The urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport:ADSL element
62598edf21a7993f00c64525
class CloudControllerHelpers(EucaMachineHelpers): <NEW_LINE> <INDENT> @property <NEW_LINE> def cloud_controller_service(self): <NEW_LINE> <INDENT> for service in self.services: <NEW_LINE> <INDENT> if service.type == 'eucalyptus': <NEW_LINE> <INDENT> return service <NEW_LINE> <DEDENT> <DEDENT> return None
Helper methods for the machine hosting the cluster controller service.
62598edf9b70327d1c57d373
class Double(Decimal): <NEW_LINE> <INDENT> __type_name__ = 'double' <NEW_LINE> Value = float <NEW_LINE> if platform.python_version_tuple()[:2] == ('2','6'): <NEW_LINE> <INDENT> class Attributes(Decimal.Attributes): <NEW_LINE> <INDENT> gt = float('-inf') <NEW_LINE> ge = float('-inf') <NEW_LINE> lt = float('inf') <NEW_LI...
This is serialized as the python ``float``. So this type comes with its gotchas. Unless you really know what you're doing, you should use a :class:`Decimal` with a pre-defined number of integer and decimal digits. .. NOTE:: This class is not compatible with :class:`spyne.model.Decimal`. You can get strange res...
62598edf0c0af96317c54956
class CategoryVocabulary(BasePortalTypeVocabulary): <NEW_LINE> <INDENT> portal_type = 'collective.directory.category'
Vocabulary factory listing all category
62598edf76e4537e8c3edb71
class CacheTreeChildrenTestCase(TreeTestCase): <NEW_LINE> <INDENT> fixtures = ['categories.json'] <NEW_LINE> def test_cache_tree_children_caches_parents(self): <NEW_LINE> <INDENT> with self.assertNumQueries(1): <NEW_LINE> <INDENT> roots = cache_tree_children(Category.objects.all()) <NEW_LINE> games = roots[0] <NEW_LINE...
Tests for the ``cache_tree_children`` template filter.
62598edf4e4d5625663709d2
class CustomUserDeleteView( LoginRequiredMixin, PermissionRequiredMixin, DeleteView ): <NEW_LINE> <INDENT> model = CustomUser <NEW_LINE> template_name = "customuser_delete.html" <NEW_LINE> success_url = reverse_lazy("customuser_list") <NEW_LINE> login_url = "login" <NEW_LINE> permission_required = "rosters.change_roste...
UserDeleteView.
62598edf8a43f66fc4bf072b
class Template(object): <NEW_LINE> <INDENT> def __init__(self, root, nsmap=None): <NEW_LINE> <INDENT> self.root = root.unwrap() if root is not None else None <NEW_LINE> self.nsmap = nsmap or {} <NEW_LINE> self.serialize_options = dict(encoding='UTF-8', xml_declaration=True) <NEW_LINE> <DEDENT> def _serialize(self, pare...
Represent a template.
62598edf56b00c62f0fb0e89
class _workspaceVariable(aplQuantity): <NEW_LINE> <INDENT> def __init__(self, quantity): <NEW_LINE> <INDENT> aplQuantity.__init__(self, []) <NEW_LINE> self.set(quantity) <NEW_LINE> <DEDENT> def get(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def set(self, quantity): <NEW_LINE> <INDENT> self._clone(quan...
a simple wrapper for an aplQuantity to ensure values are values, not promises
62598edfbd1bec0571e143a8
class LogViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = models.Log.objects.all() <NEW_LINE> serializer_class = serializers.LogSerializer <NEW_LINE> permission_classes = [permissions.IsAuthenticated]
ViewSet for the Log class
62598edf6aa9bd52df0d3467
class PostsTags(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def get_post_tags(post_id): <NEW_LINE> <INDENT> tags = [] <NEW_LINE> try: <NEW_LINE> <INDENT> results = mongo.db.posts_tags.find({ 'post_id': post_id }) <NEW_LINE> for result in results...
标签文章关系模型 :_id 自动 id :post_id 文章 id :tag_id 标签 id
62598edf23849d37ff84f673
class AudioReader(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> r = pyaudio.PyAudio() <NEW_LINE> self.stream = r.open(format=pyaudio.paInt16, channels=1, rate=44100, input=True, output=True, frames_per_buffer=AUDIO_CHUNK) <NEW_LINE> <DEDENT> def read(self): <NEW_LINE> <INDENT> return array.array('h', s...
Class for reading audio data. Reads data using PyAudio.
62598edf56ac1b37e63007a5
class CausalConv(nn.Conv): <NEW_LINE> <INDENT> is_causal: bool = False <NEW_LINE> def __call__(self, inputs): <NEW_LINE> <INDENT> kernel_size = tuple(self.kernel_size) <NEW_LINE> def maybe_broadcast(x): <NEW_LINE> <INDENT> if x is None: <NEW_LINE> <INDENT> x = 1 <NEW_LINE> <DEDENT> if isinstance(x, int): <NEW_LINE> <IN...
A (possibly) causal (1D) convolution.
62598edfd7e4931a7ef3a656
class _ResourceParser(object): <NEW_LINE> <INDENT> def __init__(self, registry, collection_info): <NEW_LINE> <INDENT> self.registry = registry <NEW_LINE> self.collection_info = collection_info <NEW_LINE> <DEDENT> def ParseRelativeName( self, relative_name, base_url=None, subcollection='', url_unescape=False): <NEW_LINE...
Class that turns command-line arguments into a cloud resource message.
62598edfb7558d5895461c05
class BaseCommand: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._name = "" <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self) -> str: <NEW_LINE> <INDENT> if "".__eq__(self._name): <NEW_LINE> <INDENT> return self.__module__.split(".")[-1].replace("_", "-") <NEW_LINE> <DEDENT> return self._name <...
BaseCommand
62598edf97e22403b38394a9
class fbeta_loss(object): <NEW_LINE> <INDENT> def __init__(self,beta,threshold=0.5,use_thresh=True,eps=1e-9): <NEW_LINE> <INDENT> self.beta, self.eps = beta, eps <NEW_LINE> self.threshold, self.use_thresh = threshold, use_thresh <NEW_LINE> <DEDENT> def __call__(self,y_pred,y_true): <NEW_LINE> <INDENT> beta2 = self.beta...
Class for the fbeta loss function for multi-label classification. See https://www.kaggle.com/c/planet-understanding-the-amazon-from-space/overview/evaluation , for loss definition. My code modified from https://www.kaggle.com/igormq/f-beta-score-for-pytorch Arguments: beta: The parameter beta in definition of ...
62598edf32920d7e50bc45e7
class Data(_Material): <NEW_LINE> <INDENT> def __init__(self, wls, ns): <NEW_LINE> <INDENT> assert len(wls) == len(ns), ('There should be the same amount of ' 'wavelengths as refractive index values.') <NEW_LINE> wls *= 1e3 <NEW_LINE> wl_min = wls[0] <NEW_LINE> wl_max = wls[-1] <NEW_LINE> n_func = spi.interp1d(wls, ns)...
An object that facilitates importing materials from lists. Args: wls (list): List of wavelengths. ns (list): List of refractive indices at the corresponding `wls`. Should be the same size as `wls`.
62598edf3c8af77a43b6720f
class Test_global_pam_api_service(object): <NEW_LINE> <INDENT> def test_list_no_parameters(self, client_generator): <NEW_LINE> <INDENT> with client_generator.get_client() as cl: <NEW_LINE> <INDENT> global_pams = cl.global_pam.list_matches() <NEW_LINE> assert len(global_pams) >= 0
This class tests the global_pam service.
62598edfcb5e8a47e493b456
class ModelTypeRelationsPresenters(object): <NEW_LINE> <INDENT> swagger_types = { 'href': 'str', 'model': 'str', 'operation': 'str', 'params': 'ModelTypeRelationsCampaignsParams' } <NEW_LINE> attribute_map = { 'href': 'href', 'model': 'model', 'operation': 'operation', 'params': 'params' } <NEW_LINE> def __init__(self,...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598edf1f5feb6acb16120b
class StrongConnectedComponents(ConnectedComponents): <NEW_LINE> <INDENT> def __init__(self, graph): <NEW_LINE> <INDENT> self.graph = graph <NEW_LINE> self.visited = [] <NEW_LINE> self.components = dict() <NEW_LINE> self.count = 0 <NEW_LINE> do = DepthFirstOrder(graph) <NEW_LINE> for v in do: <NEW_LINE> <INDENT> if v n...
Strong connected components for directed graph. Kosaraju Sharir method. It looks practically the same as the Connected Components, but iterates over the reversed postorder of vertices given by the topological sort
62598edf4428ac0f6e656b0c
class PartOfSpeechFeatures(object): <NEW_LINE> <INDENT> def __init__(self, filename, freq_metric): <NEW_LINE> <INDENT> self.pos = PartOfSpeechVector(filename, freq_metric) <NEW_LINE> self.pos.build_features() <NEW_LINE> <DEDENT> def pos_features(self, tuples): <NEW_LINE> <INDENT> features = {} <NEW_LINE> for tup in tup...
Constructs features from Part-of-Speech specific distributional vectors. This includes cosine similarity of the word-vectors of the two members of a tuple. The metric used to measure co-occurrence of peers of a word needs to be specified - RAW, LMI, PPMI (see utils.py) Attributes: pos (PartOfSpeechVector): Instanc...
62598edf2eb69b55b15a0666
class CursorType(enum.Enum): <NEW_LINE> <INDENT> CURSOR_TYPE_UNDERLINE = 0 <NEW_LINE> CURSOR_TYPE_VERTICAL = 1 <NEW_LINE> CURSOR_TYPE_BOX = 2
Describes the type of the cursor.
62598edf63b5f9789fe8372b
class TestPackingSlipTemplateLineExtraDataEnumApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = Infoplus.api.packing_slip_template_line_extra_data_enum_api.PackingSlipTemplateLineExtraDataEnumApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DED...
PackingSlipTemplateLineExtraDataEnumApi unit test stubs
62598edf9c8ee8231303f435
class Event(EventCommon, SenderGetter): <NEW_LINE> <INDENT> def __init__(self, query): <NEW_LINE> <INDENT> super().__init__(chat_peer=types.PeerUser(query.user_id)) <NEW_LINE> SenderGetter.__init__(self, query.user_id) <NEW_LINE> self.query = query <NEW_LINE> self.pattern_match = None <NEW_LINE> self._answered = False ...
Represents the event of a new callback query. Members: query (:tl:`UpdateBotInlineQuery`): The original :tl:`UpdateBotInlineQuery`. Make sure to access the `text` property of the query if you want the text rather than the actual query object. pattern_match (`obj`, optional): T...
62598edf91af0d3eaad383d3
class CustomEndLineCommand(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def run(self, edit): <NEW_LINE> <INDENT> print('Run CustomEndLineCommand') <NEW_LINE> new_regions = [] <NEW_LINE> for region in self.view.sel(): <NEW_LINE> <INDENT> end_reg = region.end() <NEW_LINE> last_line = self.view.lines(region)[-1] <NEW_...
Replacement for the usual ctrl-e command. Goes to the end of the line if cursor is in the middle of the line, otherwise will place the cursor in a useful place within the line. The command name for key-bindings etc will be custom_end_line
62598edfd6c5a102081e06eb
class MovieFileRepository(MovieRepository): <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> MovieRepository.__init__(self) <NEW_LINE> self.__filename = filename <NEW_LINE> self.__loadFromFile() <NEW_LINE> <DEDENT> def __loadFromFile(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> f = open(self...
Class that is used for retrive/store movies from/into files
62598edf30bbd722464681f3
class message(yapc.event): <NEW_LINE> <INDENT> name = "Raw Message" <NEW_LINE> def __init__(self, sock, msg): <NEW_LINE> <INDENT> self.sock = sock <NEW_LINE> self.message = msg <NEW_LINE> <DEDENT> def reply(self, message): <NEW_LINE> <INDENT> self.sock.send(message)
Raw message event @author ykk @date July 2011
62598edf10dbd63aa1c6f12b
class Wing(Model): <NEW_LINE> <INDENT> @parse_variables(__doc__, globals()) <NEW_LINE> def setup(self): <NEW_LINE> <INDENT> return [c == (S/A)**0.5, W >= S*rho] <NEW_LINE> <DEDENT> dynamic = WingAero
Aircraft wing model Variables --------- W [lbf] weight S [ft^2] surface area rho 1 [lbf/ft^2] areal density A 27 [-] aspect ratio c [ft] mean chord Upper Unbounded --------------- W Lower Unbounded --------------- c, S
62598edf76e4537e8c3edb73
@register_dataset <NEW_LINE> @dataclass(frozen=True) <NEW_LINE> class TourismYearlyDatasetConfig(GluonTsDatasetConfig): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def name(cls) -> str: <NEW_LINE> <INDENT> return "tourism_yearly" <NEW_LINE> <DEDENT> @property <NEW_LINE> def max_training_time(self) -> int: <NEW_LINE> <I...
The dataset configuration for the `tourism_yearly` dataset.
62598edf99cbb53fe682f46d
class Mysql(object,metaclass=Mymeta): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.host='127.0.0.1' <NEW_LINE> self.port=3306 <NEW_LINE> <DEDENT> def conn(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def execute(self): <NEW_LINE> <INDENT> pass
mysql xxx
62598edf3617ad0b5ee046e9
class PGLogProbModel(PGModel): <NEW_LINE> <INDENT> def tf_loss_per_instance(self, states, internals, actions, terminal, reward, next_states, next_internals, update, reference=None): <NEW_LINE> <INDENT> embedding = self.network.apply(x=states, internals=internals, update=update) <NEW_LINE> log_probs = list() <NEW_LINE> ...
Policy gradient model based on computing log likelihoods, e.g. VPG.
62598edfbd1bec0571e143a9
class HttpTransactionModel(BaseWebServiceScanModel, WebRequestMixin, ResourceInfoMixin): <NEW_LINE> <INDENT> response_headers = KeywordKeyValueElasticsearchType( help_text="The HTTP response headers associated with this transaction.", ) <NEW_LINE> def __init__( self, response_headers=None, content_type=None, content_le...
Documentation for HttpTransactionModel.
62598edf4428ac0f6e656b0d
class FirmwareImageExtractor(FirmwareImageControllerBase): <NEW_LINE> <INDENT> def extract(self): <NEW_LINE> <INDENT> target_file = self.fw_file <NEW_LINE> common.add_exec_permission_to(target_file) <NEW_LINE> temp_dir = tempfile.mkdtemp() <NEW_LINE> extract_path = os.path.join(temp_dir, self.fw_filename) <NEW_LINE> tr...
Helper class to extract the raw file from compact firmware image file This class acts as a helper class in extracting the raw firmware file from the compact firmware file.
62598edf23849d37ff84f675
class ErrorHolder(TestHolder): <NEW_LINE> <INDENT> def __init__(self, description, error): <NEW_LINE> <INDENT> super().__init__(description) <NEW_LINE> self.error = util.excInfoOrFailureToExcInfo(error) <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LINE> <INDENT> return "<ErrorHolder description={!r} error={!r}>"...
Used to insert arbitrary errors into a test suite run. Provides enough methods to look like a C{TestCase}, however, when it is run, it simply adds an error to the C{TestResult}. The most common use-case is for when a module fails to import.
62598edfe5267d203ee69ebe
class SparseSmallVisionModel(SmallVisionModel): <NEW_LINE> <INDENT> def __init__( self, negative_samples=16, k_predictions=5, resnet_50=False, block_dims=None, num_channels=None, grayscale=True, patch_size=16, overlap=2, sparse_weights_class=SparseWeights2d, sparsity=None, percent_on=None, ): <NEW_LINE> <INDENT> super(...
A version of the above SmallVisionModel that uses sparse weights and activations. Like the other models in this file, this has been deprecated in favor of the more general GreedyInfoMaxModel. :param negative_samples: number of negative samples to contrast per positive sample :param k_predictions: number of prediction ...
62598edfdd821e528d6d7502
class MediaRangeTest(TestCase): <NEW_LINE> <INDENT> def test_any_media(self): <NEW_LINE> <INDENT> media_range = MediaRange("*/*") <NEW_LINE> self.assertEqual(media_range.content_type, "*/*") <NEW_LINE> self.assertTrue(media_range.any_media) <NEW_LINE> self.assertTrue(media_range.any_subtype) <NEW_LINE> <DEDENT> def tes...
Test media range parsing.
62598edf8da39b475be01765
class Category(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.establishments = [] <NEW_LINE> self.amount = 0 <NEW_LINE> self.name = name <NEW_LINE> <DEDENT> def get_amount(self,): <NEW_LINE> <INDENT> return self.amount <NEW_LINE> <DEDENT> def get_establishments(self): <NEW_LINE> <INDENT...
Categories in Buisinesses csv
62598edf462c4b4f79db9fb5
class JsonProperty(db.Property): <NEW_LINE> <INDENT> data_type = db.TextProperty <NEW_LINE> def get_value_for_datastore(self, model_instance): <NEW_LINE> <INDENT> value = super(JsonProperty, self).get_value_for_datastore(model_instance) <NEW_LINE> return self._deflate(value) <NEW_LINE> <DEDENT> def validate(self, value...
JSON data stored in database. From - http://snipplr.com/view.php?codeview&id=10529
62598edffff4ab517ebcbd9f
class CanViewOrEditNotebook(permissions.BasePermission): <NEW_LINE> <INDENT> message = "You do not have permissions for this notebook." <NEW_LINE> def has_object_permission(self, request, view, notebook): <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if user == notebook.user: <NEW_LINE> <INDENT> return True <NEW_L...
Return True if the notebook belongs to the user or the user is doing a safe request to a public notebook.
62598edf1f037a2d8b9e26c1
class Solution: <NEW_LINE> <INDENT> def merge(self, intervals: List[List[int]]) -> List[List[int]]: <NEW_LINE> <INDENT> ret = [] <NEW_LINE> for i in sorted(intervals, key=lambda x: x[0]): <NEW_LINE> <INDENT> if ret and ret[-1][1] >= i[0]: <NEW_LINE> <INDENT> ret[-1][1] = max(ret[-1][1], i[1]) <NEW_LINE> <DEDENT> else: ...
新版没有Interval class的设定了,解法还是一样的
62598edfb5575c28eb711fae
class TestVehicleApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = swagger_client.api.vehicle_api.VehicleApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_api_web_vehicle_controller_index(self): <NEW_LINE> <INDENT> pass <NEW_LIN...
VehicleApi unit test stubs
62598edf3cc13d1c6d463d26
class CAssignment(CStatement): <NEW_LINE> <INDENT> def __init__(self, lhs, rhs): <NEW_LINE> <INDENT> super(CAssignment, self).__init__() <NEW_LINE> self.lhs = lhs <NEW_LINE> self.rhs = rhs <NEW_LINE> <DEDENT> def c_repr(self, indent=0, posmap=None): <NEW_LINE> <INDENT> indent_str = self.indent_str(indent=indent) <NEW_L...
a = b
62598edf796e427e5384cd54
class RandomMode(Mode): <NEW_LINE> <INDENT> def execute(self): <NEW_LINE> <INDENT> randthing = self._kwargs.type <NEW_LINE> try: <NEW_LINE> <INDENT> limit = self._kwargs.limit <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> limit = 1 <NEW_LINE> <DEDENT> return self._execute(randthing, limit) <NEW_LINE> <DEDENT> @static...
Handles mode 'random'. Returns you with a random instance of whatever was requested.
62598edf7d847024c075a98a
class CarbonMonoxideDevice: <NEW_LINE> <INDENT> def __init__(self, co_sensor, display_unit): <NEW_LINE> <INDENT> self.carbon_monoxide_sensor = co_sensor <NEW_LINE> self.display_unit = display_unit <NEW_LINE> <DEDENT> def display(self): <NEW_LINE> <INDENT> msg = 'Carbon Monoxide Level is : ' + str(self.carbon_monoxide_...
State the Carbon Monoxide level.
62598edf21bff66bcd72120e
class SetPresetPlaybackWithExtraData(TestMixins.SetWithDataMixin, OptionalParameterTestFixture): <NEW_LINE> <INDENT> PID = 'PRESET_PLAYBACK' <NEW_LINE> DATA = 'foobar'
Send a SET PRESET_PLAYBACK command with extra data.
62598edf57b8e32f525073e4
class LinkToPrimaryHandler(AdminPageHandler): <NEW_LINE> <INDENT> def decode_link_ticket(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return replication.decode_link_ticket( self.request.get('t').encode('ascii')) <NEW_LINE> <DEDENT> except (KeyError, ValueError): <NEW_LINE> <INDENT> self.abort(400) <NEW_LINE> ret...
A page with confirmation of Primary <-> Replica linking request. URL to that page is generated by a Primary service.
62598edf090684286d5929bd
class ContentReferencedBy(silvaviews.Viewlet): <NEW_LINE> <INDENT> grok.template('contentreferencedby') <NEW_LINE> grok.context(ISilvaObject) <NEW_LINE> grok.view(Properties) <NEW_LINE> grok.viewletmanager(silvaforms.SMIFormPortlets) <NEW_LINE> def update(self): <NEW_LINE> <INDENT> references = {} <NEW_LINE> service = ...
Report reference usage of this publishable
62598edfcb5e8a47e493b457
class PricePolicy(models.Model): <NEW_LINE> <INDENT> content_type = models.ForeignKey(ContentType, verbose_name='关联普通课或者学位课表',on_delete=models.CASCADE) <NEW_LINE> object_id = models.PositiveIntegerField(verbose_name='关联普通课或者学位课中的课程ID') <NEW_LINE> content_object = GenericForeignKey('content_type', 'object_id') <NEW_LINE...
价格与有课程效期表
62598edf97e22403b38394ac
class CronohubTargetPlugin(metaclass=ABCMeta): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def validate(self): <NEW_LINE> <INDENT> ... <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def help(self): <NEW_LINE> <INDENT> ... <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def archive(self, files): <NEW_LINE> <INDENT> .....
This is the basic definition of a CronoHub plugin.
62598edf4e4d5625663709d5
class met_shifted_TauEnDown: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def make_obj(tree): <NEW_LINE> <INDENT> _pt = getattr(tree, "met_shifted_TauEnDown_pt", None) <NEW_LINE> _phi = getattr(tree, "met_shifted_TauEnDown_phi", None) <NEW_LINE> _sumEt = getattr(tree, "met_shifted_TauEnDown_sumEt", None) <NEW_LINE> ret...
62598edf2eb69b55b15a0667
class TestAddSubmissionMixin(DatabaseMixin, FileSystemMixin): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestAddSubmissionMixin, self).setUp() <NEW_LINE> self.write_file(_FILENAME_1, _CONTENT_1) <NEW_LINE> self.write_file(_FILENAME_2, _CONTENT_2) <NEW_LINE> self.write_file(_FILENAME_3, _CONTENT_3) <...
Mixin for testing AddSubmission with different tasks.
62598edf2ae34c7f260a96a4
class ReadDestroyViewSet(mixins.RetrieveModelMixin, mixins.ListModelMixin, mixins.DestroyModelMixin, viewsets.GenericViewSet): <NEW_LINE> <INDENT> pass
A viewset that provides default `list()`, 'destroy()' and `retrieve()` actions. use for actived job management
62598edf8e71fb1e983ba02d
class ApplicationGatewayIPConfiguration(SubResource): <NEW_LINE> <INDENT> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, 'provisi...
IP configuration of an application gateway. Currently 1 public and 1 private IP configuration is allowed. :param id: Resource ID. :type id: str :param name: Name of the IP configuration that is unique within an Application Gateway. :type name: str :param etag: A unique read-only string that changes whenever the resour...
62598edf379a373c97d975b6
class TextBlock(object): <NEW_LINE> <INDENT> preformatted = False <NEW_LINE> _amp_regex = re.compile(r'&(?P<suffix>([^;&\s]{0,32}(?=(&|\s|\Z))))') <NEW_LINE> def __init__(self, lines): <NEW_LINE> <INDENT> self._contents = lines <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return ''.join(self.generate()).r...
A holder for intermingled character data and markup. The TextBlock does not guarantee that its contents are well-formed. It generally should not be used directly. Instead use one of its subclasses. A very basic example: >>> test = TextBlock(('Hello World!', 'This is a test.')) >>> print test Hello World! This is a te...
62598edf097d151d1a2bf5db
class TurnOffCommand(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.power_off = True
A command to have the ACC turn off.
62598edfac7a0e7691f70ad0
class OPS_Sky_Boss_Good_Carton(BaseCarton): <NEW_LINE> <INDENT> name = 'ops_sky_boss_good' <NEW_LINE> cadence = None <NEW_LINE> category = 'sky_boss' <NEW_LINE> program = 'ops_sky' <NEW_LINE> mapper = None <NEW_LINE> instrument = 'BOSS' <NEW_LINE> inertial = True <NEW_LINE> priority = 5001 <NEW_LINE> load_magnitudes = ...
Reasonable quality skies for the BOSS spectrograph. Use these skies when there are not enough OPS_Sky_Boss_Best_Carton skies available Definition: Select sky positions from catalogdb.skies_v2 that don't have a nearby Gaia, Tycho2, or 2MASS source. Results in a catalogue that covers the vast majority of ...
62598edf6e29344779afebea
class PCMD(ATCommand): <NEW_LINE> <INDENT> flag = parameters.Int32( 'flag enabling the use of progressive commands and/or the Combined' 'Yaw mode (bitfield)') <NEW_LINE> roll = parameters.Float('drone left-right tilt, [-1...1]', default=0) <NEW_LINE> pitch = parameters.Float('drone front-back tilt, [-1...1]', default=0...
Send progressive commands - makes the drone move (translate/rotate).
62598edfa17c0f6771d5a811
class ViewBuilder(object): <NEW_LINE> <INDENT> def build(self, rate_limits, absolute_limits): <NEW_LINE> <INDENT> rate_limits = self._build_rate_limits(rate_limits) <NEW_LINE> absolute_limits = self._build_absolute_limits(absolute_limits) <NEW_LINE> output = { "limits": { "rate": rate_limits, "absolute": absolute_limit...
OpenStack API base limits view builder.
62598edf9c8ee8231303f436
class _ManagedRelationalDbDecoder(option_decoders.TypeVerifier): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(_ManagedRelationalDbDecoder, self).__init__( valid_types=(dict,), **kwargs) <NEW_LINE> <DEDENT> def Decode(self, value, component_full_name, flag_values): <NEW_LINE> <INDENT> mana...
Validate the managed_relational_db dictionary of a benchmark config object.
62598edf32920d7e50bc45ea
class TagsDTO(Model): <NEW_LINE> <INDENT> tags = ListType(StringType)
DTO used to define available tags
62598edf91af0d3eaad383d5
@ddt.ddt <NEW_LINE> class BulkEmailTest(BaseInstructorDashboardTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(BulkEmailTest, self).setUp() <NEW_LINE> self.course_fixture = CourseFixture(**self.course_info).install() <NEW_LINE> self.log_in_as_instructor() <NEW_LINE> instructor_dashboard_page = sel...
End-to-end tests for bulk emailing from instructor dash.
62598edfd6c5a102081e06ed
class CocoCaptionsTrain(data.Dataset): <NEW_LINE> <INDENT> def __init__(self, vocab, root, annFile, transform=None): <NEW_LINE> <INDENT> from pycocotools.coco import COCO <NEW_LINE> self.root = os.path.expanduser(root) <NEW_LINE> self.coco = COCO(annFile) <NEW_LINE> self.vocab = vocab <NEW_LINE> self.ids = list(self.co...
`MS Coco Captions <http://mscoco.org/dataset/#captions-challenge2015>`_ Dataset.
62598edf6fb2d068a7693100
class Scope(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'scope' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(20), unique=True) <NEW_LINE> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return ...
权限范围
62598edfe64d504609df869e
class _HTTPClient: <NEW_LINE> <INDENT> def __init__(self, service_instance, cert_file=None, account_name=None, account_key=None, service_namespace=None, issuer=None, x_ms_version=None, protocol='https'): <NEW_LINE> <INDENT> self.service_instance = service_instance <NEW_LINE> self.status = None <NEW_LINE> self.respheade...
Takes the request and sends it to cloud service and returns the response.
62598edf76e4537e8c3edb75
class Meta: <NEW_LINE> <INDENT> abstract = False
This is not an abstract class
62598edf56b00c62f0fb0e8d
class ArgumentType: <NEW_LINE> <INDENT> VALUE, POINTER, REFERENCE = range(3)
Type of argument.
62598edfd7e4931a7ef3a659
class ConversionAdjustmentUploadServiceStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.UploadConversionAdjustments = channel.unary_unary( '/google.ads.googleads.v2.services.ConversionAdjustmentUploadService/UploadConversionAdjustments', request_serializer=google_dot_ads_dot_googl...
Service to upload conversion adjustments.
62598edfa05bb46b38488e3b
class NetworkException(KiteException): <NEW_LINE> <INDENT> def __init__(self, message, code=503): <NEW_LINE> <INDENT> super(NetworkException, self).__init__(message, code)
Represents a network issue between Kite and the backend Order Management System (OMS). Default code is 503.
62598edf460517430c430a46
class ShardQuerySet(QuerySet): <NEW_LINE> <INDENT> def __init__(self, model=None, *args, **kwargs): <NEW_LINE> <INDENT> super(ShardQuerySet, self).__init__(model=model, *args, **kwargs) <NEW_LINE> self._exact_lookups = {} <NEW_LINE> <DEDENT> def _clone(self, **kwargs): <NEW_LINE> <INDENT> clone = super(ShardQuerySet, s...
Stores the lookups to pass to the router as a hint
62598edfa8ecb0332586f7a5
class NotebookCellDirective(Directive): <NEW_LINE> <INDENT> required_arguments = 0 <NEW_LINE> optional_arguments = 1 <NEW_LINE> has_content = True <NEW_LINE> option_spec = {'skip_exceptions': directives.flag} <NEW_LINE> def run(self): <NEW_LINE> <INDENT> if not self.state.document.settings.raw_enabled: <NEW_LINE> <INDE...
Insert an evaluated notebook cell into a document This uses runipy and nbconvert to transform an inline python script into html suitable for embedding in a Sphinx document.
62598edf442bda511e95aa24
class PackageBone(ConfigurationsMixin, SettingsMixin): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.templates_manager = TemplatesManager() <NEW_LINE> <DEDENT> def build(self): <NEW_LINE> <INDENT> self.create_package_directory() <NEW_LINE> self.create_init_file() <NEW_LINE> self.create_setup_file() <...
Handle package bone points.
62598edf8da39b475be01767
class Solution: <NEW_LINE> <INDENT> def myPow(self, x, n): <NEW_LINE> <INDENT> if n < 0: <NEW_LINE> <INDENT> x = 1/x <NEW_LINE> n = -n <NEW_LINE> <DEDENT> ret = 1 <NEW_LINE> tmp = x <NEW_LINE> while n > 0: <NEW_LINE> <INDENT> if n%2 == 1: <NEW_LINE> <INDENT> ret *= tmp <NEW_LINE> <DEDENT> tmp *= tmp <NEW_LINE> n = n/2 ...
@param x {float}: the base number @param n {int}: the power number @return {float}: the result
62598edf4a966d76dd5ed4a1
class TestHrExpenseReplenishmentTaxCopy(TransactionCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestHrExpenseReplenishmentTaxCopy, self).setUp() <NEW_LINE> self.expense = self.env['hr.expense.expense'] <NEW_LINE> <DEDENT> def test_10_copy_method(self): <NEW_LINE> <INDENT> expense = self.env.ref...
Test for hr_expense_replenishment_tax copy method.
62598edf851cf427c66b688f
class CidadesPA(CidadesPorEstado): <NEW_LINE> <INDENT> implements(IVocabularyFactory) <NEW_LINE> uf = u'PA' <NEW_LINE> def __call__(self, context=None): <NEW_LINE> <INDENT> return super(CidadesPA,self).__call__(context)
Vocabulary for cities from Pará >>> from zope.component import queryUtility >>> name = 'brasil.cidades.PA' >>> util = queryUtility(IVocabularyFactory, name) >>> cidades = util() >>> cidades <zope.schema.vocabulary.SimpleVocabulary object at ...>
62598edf5f7d997b871f86b4
class sample(object): <NEW_LINE> <INDENT> def __init__(self, x, lnl, weight=1, extra=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.x = x <NEW_LINE> self.lnl = lnl <NEW_LINE> self.extra = extra <NEW_LINE> self.weight = weight
A SlikSampler's sample method should yield objects of this type.
62598edfb7558d5895461c09
class SublayerConnection(Chain): <NEW_LINE> <INDENT> def __init__(self, layer, size, dropout_ratio=0.1): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.dropout_ratio = dropout_ratio <NEW_LINE> with self.init_scope(): <NEW_LINE> <INDENT> self.layer = layer <NEW_LINE> self.norm = L.LayerNormalization(size) <NEW_L...
Implementation of the residual connections with LayerNorm for each transformer layer
62598edf435de62698e9a394
class IdFilterBase(luigi.Task): <NEW_LINE> <INDENT> task_name = 'id_filter' <NEW_LINE> src_file = os.path.abspath(__file__) <NEW_LINE> allow_retry = False <NEW_LINE> node_label_path = luigi.Parameter() <NEW_LINE> node_label_key = luigi.Parameter() <NEW_LINE> output_path = luigi.Parameter() <NEW_LINE> filter_labels = lu...
IdFilter base class
62598edf3539df3088eca870
class Item(Base): <NEW_LINE> <INDENT> __tablename__ = 'item' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> name = Column(String(250), nullable=False) <NEW_LINE> description = Column(String(500), nullable=False) <NEW_LINE> creation_time = Column(DateTime, default=datetime.datetime.utcnow) <NEW_LINE> categ...
Any one item belongs only to one category. However, one category may have multiple items (Category: Item = One : Many) The Item table will be used to store items of a category. The backref 'items' is equivalent to having an 'items' column in category to refer the items in the category
62598edfcb5e8a47e493b458
class TableReader( Iterator ): <NEW_LINE> <INDENT> def __init__( self, input, return_header=True, return_comments=True, force_header=None, comment_lines_startswith = ["#"] ): <NEW_LINE> <INDENT> self.input = input <NEW_LINE> self.return_comments = return_comments <NEW_LINE> self.return_header = return_header <NEW_LINE>...
Reader for iterating tabular data
62598edf4e4d5625663709d7
class RFPDupeFilter(BaseDupeFilter): <NEW_LINE> <INDENT> logger = logger <NEW_LINE> def __init__(self, server, key, debug=False): <NEW_LINE> <INDENT> self.server = server <NEW_LINE> self.key = key <NEW_LINE> self.debug = debug <NEW_LINE> self.logdupes = True <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_settings...
Redis-based request duplicates filter. This class can also be used with default Scrapy's scheduler.
62598edf8e71fb1e983ba02f