code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@unittest.skip("Unimplemented Function") <NEW_LINE> class MinimumSpanningTree(unittest.TestCase): <NEW_LINE> <INDENT> def run_and_check(self, vertexes, adjacent, cost): <NEW_LINE> <INDENT> result = minimum_spanning_tree(vertexes, adjacent, cost) <NEW_LINE> <DEDENT> def value(self, vertexes, result): <NEW_LINE> <INDENT>...
Test Strategy: numpy has Kruskals algorithm, which I can use as a reference. I'm going to need new data sets to test this with... - Undirected - Randomly Generated Notes on MSTs: - If all edge weights are unique then the MST is also unique. - The value of the minimum spanning tree is the minimum even if the trees are...
6259906a45492302aabfdcb9
class KwicParser: <NEW_LINE> <INDENT> def __init__(self, callback): <NEW_LINE> <INDENT> self.callback = callback <NEW_LINE> self.generator = None <NEW_LINE> self.reset() <NEW_LINE> <DEDENT> def reset(self): <NEW_LINE> <INDENT> self.next_mark = 0 <NEW_LINE> self.group = None <NEW_LINE> <DEDENT> def get_generator(self, f...
A generator that iterates through the KWIC XML file. It yields items (token and lemma element) for each <string> element. A callback system allows you transform the item into other objects before they are yielded. It also exposes a cursor (self.next_mark) to help with QuerySet slices. This class was created to tie a...
6259906a26068e7796d4e11b
class KeyPathGenerator(object): <NEW_LINE> <INDENT> def __init__(self, source_path, candidate_paths): <NEW_LINE> <INDENT> self.source_path = source_path <NEW_LINE> self.candidate_paths = candidate_paths <NEW_LINE> self.matched_candidate_paths = [] <NEW_LINE> self.node_key_counter = 0 <NEW_LINE> self.tnode = 0.8 <NEW_LI...
Candidate Target Path Key Generator
6259906a44b2445a339b7550
class Graph(object): <NEW_LINE> <INDENT> def __init__(self, config): <NEW_LINE> <INDENT> self.config = config <NEW_LINE> self.layers = [] <NEW_LINE> self.names = [] <NEW_LINE> for layer_type, layer_params in config: <NEW_LINE> <INDENT> self.__check_layer(layer_type) <NEW_LINE> layer = self.__create_layer(layer_type, la...
The graph or network structure of a neural network. Arguments: config (list): a list of tuples with each tuple contains the name and parameters of a layer. Attributes: config (list): a list of tuples with each tuple contains the name and parameters of a layer. layers (list): a list of laye...
6259906abe8e80087fbc086d
class CommentSubstitution(BaseSubstitution): <NEW_LINE> <INDENT> def __init__(self, context, **kwargs): <NEW_LINE> <INDENT> super(CommentSubstitution, self).__init__(context, **kwargs) <NEW_LINE> <DEDENT> @property <NEW_LINE> def event(self): <NEW_LINE> <INDENT> return self.context.REQUEST.get('event') <NEW_LINE> <DEDE...
Comment string substitution
6259906a5fdd1c0f98e5f767
class GSystem(object): <NEW_LINE> <INDENT> def __init__(self, especes, reactions): <NEW_LINE> <INDENT> super(GSystem, self).__init__() <NEW_LINE> self.especes = especes <NEW_LINE> self.reactions = reactions
docstring for GSystem
6259906a8da39b475be049cd
class ActiveManager(models.Manager): <NEW_LINE> <INDENT> def active(self): <NEW_LINE> <INDENT> return super(ActiveManager, self).get_queryset().filter(active=True)
An extended manager to return active objects.
6259906a66673b3332c31bdf
class IJSONRPCRequest(IJSONRPCApplicationRequest, IHTTPCredentials, IHTTPRequest, ISkinnable): <NEW_LINE> <INDENT> jsonID = zope.interface.Attribute("""JSON-RPC ID for the request""")
JSON-RPC request.
6259906a63b5f9789fe86944
class MainPageLocators(): <NEW_LINE> <INDENT> SEARCH_username = (By.ID, "your_name") <NEW_LINE> SEARCH_password = (By.ID, "pass") <NEW_LINE> SEARCH_Loginbutton = (By.XPATH, "//button[@type='submit']") <NEW_LINE> SEARCH_Logo = (By.XPATH, "//a[@class='nav-item nav-link nav_text']") <NEW_LINE> SEARCH_ErrorMessage = (By.X...
A class for main page locators. All main page locators should come here
6259906a460517430c432c46
class __unmatched_case__(Syntax): <NEW_LINE> <INDENT> def __or__(self, line): <NEW_LINE> <INDENT> if line.is_match: <NEW_LINE> <INDENT> MatchStack.get_frame().matched = True <NEW_LINE> return __matched_case__(line.return_value) <NEW_LINE> <DEDENT> return self <NEW_LINE> <DEDENT> def __invert__(self): <NEW_LINE> <INDENT...
This class represents a caseof expression in mid-evaluation, when zero or more lines have been tested, but before a match has been found.
6259906a3317a56b869bf134
class NamingNodeManager(NodeManager): <NEW_LINE> <INDENT> def get_key(self, node): <NEW_LINE> <INDENT> return self._get_hash_value(node.obj) <NEW_LINE> <DEDENT> def _get_hash_value(self, obj): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> hash_value = hash(obj) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> hash_value ...
The node manager for a naming tree.
6259906a38b623060ffaa443
class CustomUserCreationForm(forms.ModelForm): <NEW_LINE> <INDENT> error_messages = { 'duplicate_username': _("A user with that username already exists."), 'password_mismatch': _("The two password fields didn't match."), } <NEW_LINE> username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', ...
A form that creates a user, with no privileges, from the given username and password.
6259906acc0a2c111447c6c1
class HueLightLevel(GenericHueGaugeSensorEntity): <NEW_LINE> <INDENT> device_class = DEVICE_CLASS_ILLUMINANCE <NEW_LINE> unit_of_measurement = LIGHT_LUX <NEW_LINE> @property <NEW_LINE> def state(self): <NEW_LINE> <INDENT> if self.sensor.lightlevel is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return roun...
The light level sensor entity for a Hue motion sensor device.
6259906a32920d7e50bc7828
class PrefetchAccessFilterValue(object): <NEW_LINE> <INDENT> swagger_types = { 'model': 'str', 'field': 'str', 'value': 'str', 'can': 'dict(str, bool)' } <NEW_LINE> attribute_map = { 'model': 'model', 'field': 'field', 'value': 'value', 'can': 'can' } <NEW_LINE> def __init__(self, model=None, field=None, value=None, ca...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259906a9c8ee82313040d79
class ExternalServiceId(GuidEnum): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def __new__(self,guid): <NEW_LINE> <INDENT> pass
Unique identifier of an external service. ExternalServiceId(guid: Guid)
6259906a8a43f66fc4bf3975
class ImageWriter: <NEW_LINE> <INDENT> def __init__(self, *, location_root='/media/sda1/camera', capture_period=0.5, image_format='jpg'): <NEW_LINE> <INDENT> self.location_root = os.path.abspath(location_root) <NEW_LINE> self.capture_period = capture_period <NEW_LINE> self.image_format = image_format <NEW_LINE> self.ac...
Creates a thread that periodically writes images to a specified directory. Useful for looking at images after a match has completed. The default location is ``/media/sda1/camera``. The folder ``/media/sda1`` is the default location that USB drives inserted into the RoboRIO are mounted at. The USB drive must have a di...
6259906a7d43ff2487428002
class _erfs(Function): <NEW_LINE> <INDENT> def _eval_aseries(self, n, args0, x, logx): <NEW_LINE> <INDENT> point = args0[0] <NEW_LINE> if point is S.Infinity: <NEW_LINE> <INDENT> z = self.args[0] <NEW_LINE> l = [ 1/sqrt(S.Pi) * C.factorial(2*k)*(-S( 4))**(-k)/C.factorial(k) * (1/z)**(2*k + 1) for k in xrange(0, n) ] <N...
Helper function to make the `\mathrm{erf}(z)` function tractable for the Gruntz algorithm.
6259906a56b00c62f0fb40b2
class AreaInput(graphene.InputObjectType): <NEW_LINE> <INDENT> area_id = graphene.Int(required=False) <NEW_LINE> name = graphene.String(required=False) <NEW_LINE> description = graphene.String(required=False) <NEW_LINE> created = graphene.String(required=False) <NEW_LINE> updated = graphene.String(required=False)
Area Input
6259906ad486a94d0ba2d7a1
class TestDeployVMVolumeCreationFailure(cloudstackTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.testdata = self.testClient.getParsedTestDataConfig() <NEW_LINE> self.apiclient = self.testClient.getApiClient() <NEW_LINE> self.domain = get_domain(self.apiclient) <NEW_LINE> self.zone = get_zone(...
Test VM deploy into user account with volume creation failure
6259906a435de62698e9d5ee
class AdminOnlySessionMiddleware(SessionMiddleware): <NEW_LINE> <INDENT> def process_request(self, request): <NEW_LINE> <INDENT> if request.path.startswith(reverse('admin:index')): <NEW_LINE> <INDENT> super(AdminOnlySessionMiddleware, self).process_request(request) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return <...
Only do the session stuff for admin urls. The frontend relies on auth tokens.
6259906a7b25080760ed88d3
class StorageRecord(dict): <NEW_LINE> <INDENT> eid_type = None <NEW_LINE> def __init__(self, storage, eid, element): <NEW_LINE> <INDENT> super().__init__(element) <NEW_LINE> self.storage = storage <NEW_LINE> self.eid = eid <NEW_LINE> <DEDENT> def __hash__(self): <NEW_LINE> <INDENT> return hash(self.eid)
A record in the storage container's database. Attributes: eid_type: Element identifier type. storage: Storage container whose database contains this record. eid: Element identifier value.
6259906a1b99ca4002290127
class Route(Document): <NEW_LINE> <INDENT> iata = StringField(required=True) <NEW_LINE> origin = ReferenceField(Airport) <NEW_LINE> destination = ReferenceField(Airport) <NEW_LINE> aircraft = StringField()
Route document structure
6259906abe8e80087fbc086f
class PercentScore(Score): <NEW_LINE> <INDENT> _description = ('100.0 is considered perfect agreement between the ' 'observation and the prediction. 0.0 is the worst possible ' 'agreement') <NEW_LINE> def _check_score(self, score): <NEW_LINE> <INDENT> if not (0.0 <= score <= 100.0): <NEW_LINE> <INDENT> raise errors.Inv...
A percent score. A float in the range [0,0,100.0] where higher is better.
6259906a44b2445a339b7551
class Merge(ElemWise): <NEW_LINE> <INDENT> __slots__ = '_child', 'children' <NEW_LINE> @property <NEW_LINE> def schema(self): <NEW_LINE> <INDENT> return schema_concat(self.children) <NEW_LINE> <DEDENT> @property <NEW_LINE> def fields(self): <NEW_LINE> <INDENT> return list(concat(child.fields for child in self.children)...
Merge many fields together Examples -------- >>> accounts = Symbol('accounts', 'var * {name: string, x: int, y: real}') >>> merge(accounts.name, z=accounts.x + accounts.y).fields ['name', 'z']
6259906af548e778e596cd6f
class CreatureGenerator(object): <NEW_LINE> <INDENT> logged = Logged() <NEW_LINE> @logged <NEW_LINE> def __init__(self, configuration, model, action_factory, rng): <NEW_LINE> <INDENT> super(CreatureGenerator, self).__init__() <NEW_LINE> self.configuration = configuration <NEW_LINE> self.model = model <NEW_LINE> self.ac...
Class used to generate creatures
6259906a66673b3332c31be1
class TLSCheckError(Exception): <NEW_LINE> <INDENT> pass
Custom TLS error to catch changed thimbprints numbers.
6259906acb5e8a47e493cd75
class BaseModel: <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> if len(kwargs) > 0: <NEW_LINE> <INDENT> for key in kwargs.keys(): <NEW_LINE> <INDENT> if key == '__class__': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> elif key == 'created_at' or key == 'updated_at': <NEW_LINE> <INDENT>...
Class to manage the database
6259906ad6c5a102081e390c
class AsyncMirrorSyncCompletionDetailTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_async_mirror_sync_completion_detail(self): <NEW_LINE> <INDENT> async_mirror_sync_completion_detail_obj = AsyncMirrorSyncCompletionDetail() <NEW_LINE> self.assertNotEqual(async_mirror_sync_completion_detail_obj, None)
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259906a21bff66bcd72444a
class ConstantOp(Op): <NEW_LINE> <INDENT> def __init__(self, value, name="Constant"): <NEW_LINE> <INDENT> super(ConstantOp, self).__init__(name) <NEW_LINE> self._value = value <NEW_LINE> self._graph = graph.get_default_graph() <NEW_LINE> self._graph.add_to_graph(self) <NEW_LINE> <DEDENT> def get_value(self): <NEW_LINE>...
The constant operation which contains one initialized value.
6259906a460517430c432c47
class MSEMasterFile: <NEW_LINE> <INDENT> def __init__(self, encoding): <NEW_LINE> <INDENT> self.encoding = encoding <NEW_LINE> self.reconds_count = 0 <NEW_LINE> self.file_handle = None <NEW_LINE> <DEDENT> def load(self): <NEW_LINE> <INDENT> if os.path.isfile('EMASTER'): <NEW_LINE> <INDENT> self.file_handle = open('EMAS...
Metastock extended index file
6259906a009cb60464d02d1d
class PinSage(nn.Module): <NEW_LINE> <INDENT> def __init__(self, num_nodes, feature_sizes, T, restart_prob, max_nodes, use_feature=False, G=None): <NEW_LINE> <INDENT> super(PinSage, self).__init__() <NEW_LINE> self.T = T <NEW_LINE> self.restart_prob = restart_prob <NEW_LINE> self.max_nodes = max_nodes <NEW_LINE> self.i...
Completes a multi-layer PinSage convolution G: DGLGraph feature_sizes: the dimensionality of input/hidden/output features T: number of neighbors we pick for each node restart_prob: restart probability max_nodes: max number of nodes visited for each seed
6259906a796e427e5384ff5b
class GeminateConsonants(SuggestionStrategy): <NEW_LINE> <INDENT> def suggest(self, word): <NEW_LINE> <INDENT> start = 1 <NEW_LINE> for i in range(start, len(word)-1): <NEW_LINE> <INDENT> candidate = list(word) <NEW_LINE> prev = candidate[i-1] <NEW_LINE> char = candidate[i] <NEW_LINE> next = candidate[i+1] <NEW_LINE> i...
Consonant to geminated consonant, if the consonant does not has adjacent virama പച്ചതത്ത -> പച്ചത്തത്ത
6259906a56ac1b37e63038d4
class TestSelectFindStart(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> rng = np.random.default_rng(6183) <NEW_LINE> cols = ['Shift', 'test', 'N_0', r'\sum H_0j N_j', 'alt', 'Proj. Energy'] <NEW_LINE> means = [-0.1, 10.0, 11.0, -9.0, 20.0, -0.2] <NEW_LINE> sine_periods = list(range(1, len...
Test `select_find_start()`.
6259906a4e4d562566373beb
class HelpDemo(object): <NEW_LINE> <INDENT> pass
This is a demo for using help() on a class
6259906a8a43f66fc4bf3977
class VizForm(forms.ModelForm): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(VizForm, self).__init__(*args, **kwargs) <NEW_LINE> self.fields['title'].required = False <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> model = SCOTUSMap <NEW_LINE> fields = [ 'cluster_start', 'clust...
NB: The VizEditForm subclasses this!
6259906a3eb6a72ae038be45
class Artifact: <NEW_LINE> <INDENT> def __init__(self, name: str): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.basedir = ARTIFACT_STORE_DIR / name <NEW_LINE> <DEDENT> def _retrieve(self, cmd: CmdType): <NEW_LINE> <INDENT> self.basedir.mkdir(exist_ok=True) <NEW_LINE> print_status(f'Retrieving artifact "{self.na...
Base class for external ressources
6259906a7d847024c075dbbf
class InputTermNotAtomic(ZiplineError): <NEW_LINE> <INDENT> msg = ( "Can't compute {parent} with non-atomic input {child}." )
Raised when a non-atomic term is specified as an input to an FFC term with a lookback window.
6259906aa17c0f6771d5d79a
class BaseFilter(object): <NEW_LINE> <INDENT> search_fields = {} <NEW_LINE> @classmethod <NEW_LINE> def build_q(cls, params, request=None): <NEW_LINE> <INDENT> return build_q(cls.get_search_fields(), params, request) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def get_search_fields(cls): <NEW_LINE> <INDENT> sfdict = {...
Base class providing an interface for mapping a form to a query
6259906aadb09d7d5dc0bd4f
class RoleManager(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._roles = [] <NEW_LINE> <DEDENT> def add_role(self, role): <NEW_LINE> <INDENT> self._assert_name_not_exists(role.name) <NEW_LINE> self._roles.append(role) <NEW_LINE> <DEDENT> def create_role(self, name, parent_names=None, default...
Container for roles. Each role must have unique name.
6259906abaa26c4b54d50a8c
class QLearningAgent(ReinforcementAgent): <NEW_LINE> <INDENT> def __init__(self, **args): <NEW_LINE> <INDENT> ReinforcementAgent.__init__(self, **args) <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> self.qValues = util.Counter() <NEW_LINE> <DEDENT> def getQValue(self, state, action): <NEW_LINE> <INDENT> return self.qVa...
Q-Learning Agent Functions you should fill in: - computeValueFromQValues - computeActionFromQValues - getQValue - getAction - update Instance variables you have access to - self.epsilon (exploration prob) - self.alpha (learning rate) - self.discount (discount rate) Functions you should use - self.g...
6259906a99cbb53fe68326cb
class coreWrapper: <NEW_LINE> <INDENT> def __init__(self, confUser): <NEW_LINE> <INDENT> self.interval = confUser['interval'] <NEW_LINE> self.overlap = confUser['overlap'] <NEW_LINE> self.datadir = os.path.join(confUser['DATADIR'], 'result') <NEW_LINE> pass <NEW_LINE> <DEDENT> def assetStartWrapping(self, FilterKnowled...
6259906a7c178a314d78e7de
class MultipleRegistrationException(Exception): <NEW_LINE> <INDENT> def __init__(self, event_id, emitter): <NEW_LINE> <INDENT> self.event_id = event_id <NEW_LINE> self.emitter = emitter <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "MultipleRegistrationException: %s on %s" % (self.event_id, self.emi...
Exception thrown if the event was already registered
6259906ab7558d5895464b23
class DumbAlgo(BaseAlgorithm): <NEW_LINE> <INDENT> def __init__(self, space, value=5, scoring=0, judgement=None, suspend=False, done=False, **nested_algo): <NEW_LINE> <INDENT> self._times_called_suspend = 0 <NEW_LINE> self._times_called_is_done = 0 <NEW_LINE> self._num = None <NEW_LINE> self._points = None <NEW_LINE> s...
Stab class for `BaseAlgorithm`.
6259906a3d592f4c4edbc6c5
class pp_children_as_list (object): <NEW_LINE> <INDENT> def __init__(self, val): <NEW_LINE> <INDENT> self.val = val <NEW_LINE> <DEDENT> def to_string(self): <NEW_LINE> <INDENT> return 'children_as_list_val' <NEW_LINE> <DEDENT> def children (self): <NEW_LINE> <INDENT> return [('one', 1)]
Throw error from display_hint
6259906a66673b3332c31be3
class LogoutView(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> logout(request) <NEW_LINE> return redirect(reverse('goods:index'))
登出
6259906acb5e8a47e493cd76
class Range(Number): <NEW_LINE> <INDENT> paramType = 'range'
Define numeric parameter with valid values in a given range. >>> @argument('value', types.Range, min=10, max=100, step=10) ... def func(value): ... pass
6259906a7d847024c075dbc0
class Suite(Pmf): <NEW_LINE> <INDENT> def Update(self, data): <NEW_LINE> <INDENT> for hypo in self.Values(): <NEW_LINE> <INDENT> like = self.Likelihood(data, hypo) <NEW_LINE> self.Mult(hypo, like) <NEW_LINE> <DEDENT> return self.Normalize() <NEW_LINE> <DEDENT> def LogUpdate(self, data): <NEW_LINE> <INDENT> for hypo in ...
Represents a suite of hypotheses and their probabilities.
6259906a21bff66bcd72444c
class LibError(PackageError): <NEW_LINE> <INDENT> pass
Raise when a library or executable is pulling in the wrong version of a library.
6259906a796e427e5384ff5d
class Movie(): <NEW_LINE> <INDENT> def __init__(self, full_path): <NEW_LINE> <INDENT> file_info = guessit(os.path.basename(full_path)) <NEW_LINE> if 'title' not in file_info: <NEW_LINE> <INDENT> raise ValueError('File name doesn\'t contain enough information \'{0}\''.format( os.path.basename(full_path))) <NEW_LINE> <DE...
Allow the manipulation of data representing a movie.
6259906a442bda511e95d94b
class Object(object): <NEW_LINE> <INDENT> BACKGROUND = 0 <NEW_LINE> PERSON = 1 <NEW_LINE> CAT = 2 <NEW_LINE> DOG = 3 <NEW_LINE> _LABELS = { BACKGROUND: 'BACKGROUND', PERSON: 'PERSON', CAT: 'CAT', DOG: 'DOG', } <NEW_LINE> def __init__(self, bounding_box, kind, score): <NEW_LINE> <INDENT> self.bounding_box = bounding_box...
Object detection result.
6259906af7d966606f7494ae
class ContentEntryParentTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.content = atom.data.Content() <NEW_LINE> <DEDENT> def testConvertToAndFromElementTree(self): <NEW_LINE> <INDENT> self.content.text = 'my content' <NEW_LINE> self.content.type = 'text' <NEW_LINE> self.content.s...
The test accesses hidden methods in atom.FeedEntryParent
6259906acc0a2c111447c6c3
class AWSConnection(object): <NEW_LINE> <INDENT> def __init__(self, ansible_obj, resources, boto3=True): <NEW_LINE> <INDENT> ansible_obj.deprecate("The 'ansible.module_utils.aws.batch.AWSConnection' class is deprecated please use 'AnsibleAWSModule.client()'", version='2.14') <NEW_LINE> self.region, self.endpoint, aws_c...
Create the connection object and client objects as required.
6259906a32920d7e50bc782c
class HistoricCSVDataHandler(DataHandler): <NEW_LINE> <INDENT> def __init__(self, events, csv_dir, symbol_list): <NEW_LINE> <INDENT> self.events = events <NEW_LINE> self.csv_dir = csv_dir <NEW_LINE> self.symbol_list = symbol_list <NEW_LINE> self.symbol_data = {} <NEW_LINE> self.latest_symbol_data = {} <NEW_LINE> self.c...
HistoricCSVDataHandler is designed o read CSV files for each requested symbol from disk and provide an interface to obtain the "latest" bar in a manner identical to a live trading interface.
6259906a5fcc89381b266d4a
class NonNegativeLinearRegression(LinearModel, RegressorMixin): <NEW_LINE> <INDENT> def __init__(self, fit_intercept=True, normalize=False, copy_X=True): <NEW_LINE> <INDENT> self.fit_intercept = fit_intercept <NEW_LINE> self.normalize = normalize <NEW_LINE> self.copy_X = copy_X <NEW_LINE> <DEDENT> def fit(self, X, y, s...
Non-negative least squares linear regression. Parameters ---------- fit_intercept : boolean, optional whether to calculate the intercept for this model. If set to false, no intercept will be used in calculations (e.g. data is expected to be already centered). normalize : boolean, optional, default False ...
6259906a8a43f66fc4bf3979
class Solution: <NEW_LINE> <INDENT> def arrayPairSum(self, nums): <NEW_LINE> <INDENT> nums.sort() <NEW_LINE> n = len(nums) <NEW_LINE> result = 0 <NEW_LINE> for i in range(int(n / 2)): <NEW_LINE> <INDENT> result += nums[i * 2] <NEW_LINE> <DEDENT> return result
@param nums: an array @return: the sum of min(ai, bi) for all i from 1 to n
6259906a8e71fb1e983bd2ad
class ServiceManagerTestCase(utils.BaseTestCase): <NEW_LINE> <INDENT> def test_override_manager_method(self): <NEW_LINE> <INDENT> serv = ExtendedService() <NEW_LINE> serv.start() <NEW_LINE> self.assertEqual(serv.test_method(), 'service')
Test cases for Services.
6259906ae1aae11d1e7cf400
class DoPublicCommentCount(comments.DoCommentCount): <NEW_LINE> <INDENT> def __call__(self, parser, token): <NEW_LINE> <INDENT> bits = token.contents.split() <NEW_LINE> if len(bits) != 6: <NEW_LINE> <INDENT> raise template.TemplateSyntaxError("'%s' tag takes five arguments" % bits[0]) <NEW_LINE> <DEDENT> if bits[1] != ...
Retrieves the number of comments attached to a particular object and stores them in a context variable. The difference between this tag and Django's built-in comment count tags is that this tag will only count comments with ``is_public=True``. If your application uses any sort of comment moderation which sets ``is_pub...
6259906a435de62698e9d5f2
class HasStrophe(HasLinkTo): <NEW_LINE> <INDENT> def __init__(self, argument): <NEW_LINE> <INDENT> super().__init__(argument) <NEW_LINE> self._namespace = "http://www.knora.org/ontology/text-structure" <NEW_LINE> self._name = "hasStrophe"
Relating a verse poem to a strophe it contains.
6259906a45492302aabfdcbf
class Rectangle(BaseGeometry): <NEW_LINE> <INDENT> def __init__(self, width, height): <NEW_LINE> <INDENT> self.integer_validator("height", height) <NEW_LINE> self.integer_validator("width", width) <NEW_LINE> self.__height = height <NEW_LINE> self.__width = width <NEW_LINE> <DEDENT> def area(self): <NEW_LINE> <INDENT> r...
Dfine a rect from BaseGeometry
6259906a97e22403b383c6f4
class Patch200(PullsComment): <NEW_LINE> <INDENT> pass
OK
6259906a66673b3332c31be5
class RatingTypeMap(DefaultDict[K, V]): <NEW_LINE> <INDENT> def __init__(self, default_factory, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(default_factory, *args, **kwargs) <NEW_LINE> for rating in (RatingType.GLOBAL, RatingType.LADDER_1V1): <NEW_LINE> <INDENT> self.__getitem__(rating)
A thin wrapper around `defaultdict` which stores RatingType keys as strings.
6259906ad6c5a102081e3910
class AnalysisMixin: <NEW_LINE> <INDENT> @property <NEW_LINE> def listing_url(self): <NEW_LINE> <INDENT> app = self.model._meta.app_label <NEW_LINE> cls = self.model.__name__.lower() <NEW_LINE> return reverse(f'admin:{app}_{cls}_changelist')
Helper for going back to analysis.
6259906af548e778e596cd74
class ScreenDistanceSpec(NumberSpec): <NEW_LINE> <INDENT> def prepare_value(self, cls, name, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if value is not None and value < 0: <NEW_LINE> <INDENT> raise ValueError("Distances must be positive or None!") <NEW_LINE> <DEDENT> <DEDENT> except TypeError: <NEW_LINE> <IND...
A |DataSpec| property that accepts numeric fixed values for screen distances, and also provides an associated units property that reports ``"screen"`` as the units. .. note:: Units are always ``"screen"``.
6259906a56ac1b37e63038d6
class ChristmasExtractor(Extractor): <NEW_LINE> <INDENT> def __init__(self, ref=None): <NEW_LINE> <INDENT> super(ChristmasExtractor, self).__init__(ref) <NEW_LINE> self.pattern = re.compile(r"\b(christmas(\seve)*)\b", re.IGNORECASE) <NEW_LINE> <DEDENT> def extract(self, text): <NEW_LINE> <INDENT> matches = self.pattern...
Extract Christmas or Christmas Eve from text.
6259906a0a50d4780f7069b4
class GalleryCreate(CreateView): <NEW_LINE> <INDENT> template_name = 'yawg/gadmin/gallery_edit.html' <NEW_LINE> model = Gallery <NEW_LINE> fields = ['gallery_name', 'gallery_alias']
Create new Gallery (model)
6259906acc0a2c111447c6c4
class SMUnfoldCommandClass(): <NEW_LINE> <INDENT> def GetResources(self): <NEW_LINE> <INDENT> __dir__ = os.path.dirname(__file__) <NEW_LINE> iconPath = os.path.join( __dir__, 'Resources', 'icons' ) <NEW_LINE> return {'Pixmap' : os.path.join( iconPath , 'SMUnfold.svg'), 'MenuText': QtCore.QT_TRANSLATE_NOOP('SheetMetal'...
Unfold object
6259906a8a43f66fc4bf397b
class TokenBucketQueue(object): <NEW_LINE> <INDENT> RateLimitExceeded = RateLimitExceeded <NEW_LINE> def __init__(self, fill_rate, queue=None, capacity=1): <NEW_LINE> <INDENT> self._bucket = TokenBucket(fill_rate, capacity) <NEW_LINE> self.queue = queue <NEW_LINE> if not self.queue: <NEW_LINE> <INDENT> self.queue = Que...
Queue with rate limited get operations. This uses the token bucket algorithm to rate limit the queue on get operations. :param fill_rate: The rate in tokens/second that the bucket will be refilled. :keyword capacity: Maximum number of tokens in the bucket. Default is 1.
6259906a9c8ee82313040d7c
@dataclass <NEW_LINE> class SearchResultId(BaseModel): <NEW_LINE> <INDENT> kind: Optional[str] = field(default=None) <NEW_LINE> videoId: Optional[str] = field(default=None, repr=False) <NEW_LINE> channelId: Optional[str] = field(default=None, repr=False) <NEW_LINE> playlistId: Optional[str] = field(default=None, repr=F...
A class representing the search result id info. Refer: https://developers.google.com/youtube/v3/docs/search#id
6259906a01c39578d7f14329
@implementer(interfaces.IPushProducer) <NEW_LINE> class _NoPushProducer(object): <NEW_LINE> <INDENT> def pauseProducing(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def resumeProducing(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def registerProducer(self, producer, streaming): <NEW_LINE> <INDENT> pass <N...
A no-op version of L{interfaces.IPushProducer}, used to abstract over the possibility that a L{HTTPChannel} transport does not provide L{IPushProducer}.
6259906aadb09d7d5dc0bd53
class UnexpectedParameters(TraversalError): <NEW_LINE> <INDENT> pass
Unexpected namespace parameters were provided.
6259906a435de62698e9d5f4
class ListFlavor(lister.Lister): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + ".ListFlavor") <NEW_LINE> def take_action(self, parsed_args): <NEW_LINE> <INDENT> self.log.debug("take_action(%s)" % parsed_args) <NEW_LINE> compute_client = self.app.client_manager.compute <NEW_LINE> columns = ( "ID", "Name", "RAM"...
List flavor command
6259906a7c178a314d78e7e0
class EmploymentVerificationGetRequest(ModelNormal): <NEW_LINE> <INDENT> allowed_values = { } <NEW_LINE> validations = { } <NEW_LINE> additional_properties_type = None <NEW_LINE> _nullable = False <NEW_LINE> @cached_property <NEW_LINE> def openapi_types(): <NEW_LINE> <INDENT> return { 'access_token': (str,), 'client_id...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the a...
6259906a3d592f4c4edbc6c9
class Stack: <NEW_LINE> <INDENT> def __init__(self, e): <NEW_LINE> <INDENT> print("Initialized Stack") <NEW_LINE> self.elements = [] <NEW_LINE> self.elements = e <NEW_LINE> <DEDENT> def push(self, element): <NEW_LINE> <INDENT> self.elements.append(element) <NEW_LINE> <DEDENT> def pop(self): <NEW_LINE> <INDENT> return s...
a simple implementation of the stack data structure
6259906a44b2445a339b7554
class ReportTo: <NEW_LINE> <INDENT> def __init__( self, max_age: int, include_subdomains: bool = False, group: Optional[str] = None, *endpoints: List[Dict[str, Union[str, int]]], ) -> None: <NEW_LINE> <INDENT> self.header = "Report-To" <NEW_LINE> report_to_endpoints = json.dumps(endpoints) <NEW_LINE> report_to_object: ...
Configure reporting endpoints Resources: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-to https://developers.google.com/web/updates/2018/09/reportingapi :param max_age: endpoint TIL in seconds :type max_age: int :param include_subdomains: enable for subdomains, defaults to F...
6259906a66673b3332c31be7
class DistAbstraction(object): <NEW_LINE> <INDENT> def __init__(self, req): <NEW_LINE> <INDENT> self.req = req <NEW_LINE> <DEDENT> def dist(self, finder): <NEW_LINE> <INDENT> raise NotImplementedError(self.dist) <NEW_LINE> <DEDENT> def prep_for_dist(self, finder): <NEW_LINE> <INDENT> raise NotImplementedError(self.dist...
Abstracts out the wheel vs non-wheel Resolver.resolve() logic. The requirements for anything installable are as follows: - we must be able to determine the requirement name (or we can't correctly handle the non-upgrade case). - we must be able to generate a list of run-time dependencies without installing any ...
6259906aa8370b77170f1baf
class SetterCommand(Command): <NEW_LINE> <INDENT> def __init__(self,c): <NEW_LINE> <INDENT> Command.__init__(self,c) <NEW_LINE> self.value=c.getAttribute("value") <NEW_LINE> <DEDENT> def execute(self,para,log): <NEW_LINE> <INDENT> f=replaceValues(self.filename,para) <NEW_LINE> v=replaceValues(self.value,para) <NEW_LINE...
Common class for commands that operate on dictionaries
6259906ae76e3b2f99fda1eb
@collection( name='summary-statistics', properties={ 'title': 'Summary Statistics', 'description': 'Listing of summary statistics', }) <NEW_LINE> class SummaryStatistic(Item): <NEW_LINE> <INDENT> item_type = 'summary_statistic' <NEW_LINE> schema = load_schema('encoded:schemas/summary_statistic.json') <NEW_LINE> embedde...
Summary statistics class.
6259906af548e778e596cd76
class SimpleDatasetPredictor(DatasetPredictorBase): <NEW_LINE> <INDENT> def __init__(self, config, dataset): <NEW_LINE> <INDENT> super(SimpleDatasetPredictor, self).__init__(config, dataset) <NEW_LINE> self.predictor = OfflinePredictor(config) <NEW_LINE> <DEDENT> @HIDE_DOC <NEW_LINE> def get_result(self): <NEW_LINE> <I...
Simply create one predictor and run it on the DataFlow.
6259906a4e4d562566373bf0
class SourceControlConfigurationClient(object): <NEW_LINE> <INDENT> def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: <NEW_LINE> <INDENT> if not base_url: <NEW_LINE> <INDENT> base_url = 'https://management.azure.com' <NEW_LINE> <DEDENT...
KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_03_01.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations :vartype operations: ...
6259906a2c8b7c6e89bd4fcf
class BaseModel(models.Model): <NEW_LINE> <INDENT> created = models.DateTimeField( 'created at', auto_now_add=True, help_text='Date time on which the object was created.', ) <NEW_LINE> modified = models.DateTimeField( 'modified at', auto_now=True, help_text='Date time on which the object was last modified.', ) <NEW_LIN...
BaseModel acts as an abstract base class from which every other model in the project will inherit. This class provides every table with the following attributes: + created (DateTime): Store the datetime the object was created. + modified (DateTime): Store the last datetime the object was modified.
6259906a2ae34c7f260ac8d2
class TimeLabel(Gtk.Label): <NEW_LINE> <INDENT> def __init__(self, time_=0): <NEW_LINE> <INDENT> Gtk.Label.__init__(self) <NEW_LINE> self.__widths = {} <NEW_LINE> self._disabled = False <NEW_LINE> self.set_time(time_) <NEW_LINE> <DEDENT> def do_get_preferred_width(self): <NEW_LINE> <INDENT> widths = Gtk.Label.do_get_pr...
A label for displaying the running time It tries to minimize size changes due to unequal character widths with the same number of characters. e.g. a time display -> 04:20
6259906afff4ab517ebcf005
class SampleFrac(PartitionMethod): <NEW_LINE> <INDENT> def __init__(self, frac): <NEW_LINE> <INDENT> self.fraction = frac <NEW_LINE> <DEDENT> def __call__(self, udf): <NEW_LINE> <INDENT> return udf.sample(frac=self.fraction)
Randomly select a fraction of test rows per user/item. :param frac: the fraction of items to select for testing. :paramtype frac: double
6259906a91f36d47f2231a84
class Solution: <NEW_LINE> <INDENT> def FindElements(self, Matrix): <NEW_LINE> <INDENT> m = len(Matrix) <NEW_LINE> s = set(Matrix[0]) <NEW_LINE> new_s = set() <NEW_LINE> for i in range(1, m): <NEW_LINE> <INDENT> new_s.clear() <NEW_LINE> for j in Matrix[i]: <NEW_LINE> <INDENT> if j in s: <NEW_LINE> <INDENT> new_s.add(j)...
@param Matrix: the input @return: the element which appears every row
6259906a55399d3f05627d0c
class SelflinkBot(MultipleSitesBot, BaseUnlinkBot): <NEW_LINE> <INDENT> summary_key = 'selflink-remove' <NEW_LINE> def __init__(self, generator, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.generator = generator <NEW_LINE> <DEDENT> def _create_callback(self): <NEW_LINE> <INDENT> callback = ...
Self-link removal bot.
6259906a99fddb7c1ca639c5
class Tests(IMP.test.TestCase): <NEW_LINE> <INDENT> def test_wlc(self): <NEW_LINE> <INDENT> wlc = IMP.misc.WormLikeChain(200, 3.4) <NEW_LINE> self.check_unary_function_min(wlc, 0, 250, .5, 0) <NEW_LINE> self.check_unary_function_deriv(wlc, 0, 250, .5) <NEW_LINE> self.assertGreater(wlc.evaluate_with_derivative(180)[1], ...
Tests for WLC unary function
6259906a67a9b606de547697
class TemplateResult(DictMixin, object): <NEW_LINE> <INDENT> def __init__(self, *a, **kw): <NEW_LINE> <INDENT> self.__dict__["_d"] = dict(*a, **kw) <NEW_LINE> self._d.setdefault("__body__", u'') <NEW_LINE> self.__dict__['_parts'] = [] <NEW_LINE> self.__dict__["extend"] = self._parts.extend <NEW_LINE> self._d.setdefault...
Dictionary like object for storing template output. The result of a template execution is usally a string, but sometimes it contains attributes set using $var. This class provides a simple dictionary like interface for storing the output of the template and the attributes. The output is stored with a special key __bod...
6259906a2ae34c7f260ac8d3
class SingleFileProgram(CLProgram): <NEW_LINE> <INDENT> def __init__(self, mode, filedesc, ext="", *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self.add_argument("file", metavar="file" + ext, nargs="?", type=FileType(mode), default="-", help=filedesc) <NEW_LINE> <DEDENT> def proces...
Program working with one file or standard streams.
6259906a23849d37ff8528a0
class Transaction: <NEW_LINE> <INDENT> def __init__(self, response): <NEW_LINE> <INDENT> self._response = response <NEW_LINE> <DEDENT> @property <NEW_LINE> def amount(self): <NEW_LINE> <INDENT> return self._response['amount'] <NEW_LINE> <DEDENT> @property <NEW_LINE> def id(self): <NEW_LINE> <INDENT> if 'transactionId' ...
Transfer transaction
6259906aadb09d7d5dc0bd55
class TestConfirmQuit: <NEW_LINE> <INDENT> TESTS = { '': None, 'always': ['always'], 'never': ['never'], 'multiple-tabs,downloads': ['multiple-tabs', 'downloads'], 'downloads,multiple-tabs': ['downloads', 'multiple-tabs'], 'downloads,,multiple-tabs': ['downloads', None, 'multiple-tabs'], } <NEW_LINE> @pytest.fixture <N...
Test ConfirmQuit.
6259906abaa26c4b54d50a92
class DoAPI: <NEW_LINE> <INDENT> def __init__(self, token): <NEW_LINE> <INDENT> self.token = token <NEW_LINE> self.manager = digitalocean.Manager(token=token) <NEW_LINE> self.ssh_keys = self.manager.get_all_sshkeys() <NEW_LINE> self.droplets: List[Droplet] = [] <NEW_LINE> self.ip_addresses: List[str] = [] <NEW_LINE> se...
Class for working with DigitalOcean's API
6259906ad486a94d0ba2d7aa
class ImageDataDisk(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'lun': {'required': True}, } <NEW_LINE> _attribute_map = { 'lun': {'key': 'lun', 'type': 'int'}, 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, 'blob_uri': {'key':...
Describes a data disk. All required parameters must be populated in order to send to Azure. :ivar lun: Required. Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. :vartype lun: int :ivar snaps...
6259906a45492302aabfdcc3
class NotesListHandler(ListHandler): <NEW_LINE> <INDENT> def post(self, cont_name, list_name, **kwargs): <NEW_LINE> <INDENT> _id = kwargs.pop('cid') <NEW_LINE> container, permchecker, storage, mongo_validator, input_validator, keycheck = self._initialize_request(cont_name, list_name, _id) <NEW_LINE> payload = self.requ...
NotesListHandler overrides post, put methods of ListHandler to add custom fields to the payload. e.g. _id, user, created, etc.
6259906abe8e80087fbc0877
class Webhook(pulumi.CustomResource): <NEW_LINE> <INDENT> def __init__(__self__, __name__, __opts__=None, branch_filter=None, project_name=None): <NEW_LINE> <INDENT> if not __name__: <NEW_LINE> <INDENT> raise TypeError('Missing resource name argument (for URN creation)') <NEW_LINE> <DEDENT> if not isinstance(__name__, ...
Manages a CodeBuild webhook, which is an endpoint accepted by the CodeBuild service to trigger builds from source code repositories. Depending on the source type of the CodeBuild project, the CodeBuild service may also automatically create and delete the actual repository webhook as well.
6259906acb5e8a47e493cd79
class Resource(GameObject): <NEW_LINE> <INDENT> def __init__(self, world): <NEW_LINE> <INDENT> super(Resource, self).__init__(world) <NEW_LINE> self.radius = 25 <NEW_LINE> self.color = 'cyan'
a tasty clump of resources to be consumed
6259906a5166f23b2e244bbd
class PercentageDiscountBenefit(Benefit): <NEW_LINE> <INDENT> u <NEW_LINE> class Meta: <NEW_LINE> <INDENT> proxy = True <NEW_LINE> <DEDENT> def apply(self, basket, condition=None): <NEW_LINE> <INDENT> discount = Decimal('0.00') <NEW_LINE> affected_items = 0 <NEW_LINE> max_affected_items = self._effective_max_affected_i...
An offer benefit that gives a percentage discount
6259906a76e4537e8c3f0d6e
class Row: <NEW_LINE> <INDENT> def __init__(self, sheet_reader_instance, data_range, values): <NEW_LINE> <INDENT> self.sheet_reader_instance = sheet_reader_instance <NEW_LINE> self.workbook_id = sheet_reader_instance.workbook_id <NEW_LINE> self.sheet_name = sheet_reader_instance.sheet_name <NEW_LINE> self.write_map = s...
A dict like object that represent one row in a Google sheet. Read a value: row[column_name] Write a value: row[column_name] = new_value
6259906af548e778e596cd78
class BaseRemovedInRBToolsVersionWarning(DeprecationWarning): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def warn(cls, message, stacklevel=2): <NEW_LINE> <INDENT> warnings.warn(message, cls, stacklevel=stacklevel + 1)
Base class for a RBTools deprecation warning. All version-specific deprecation warnings inherit from this, allowing callers to check for Review Board deprecations without being tied to a specific version.
6259906a76e4537e8c3f0d6f
class Post(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'posts' <NEW_LINE> __searchable__ = ['body', ] <NEW_LINE> __analyzer__ = ChineseAnalyzer() <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> body = db.Column(db.Text) <NEW_LINE> body_html = db.Column(db.Text) <NEW_LINE> timestamp = db.Column(db....
用户发表的博客文章; 博客文章的html代码缓存在body_html字段中,避免重复转换
6259906af7d966606f7494b1
class Rule: <NEW_LINE> <INDENT> def action(self, block, handler): <NEW_LINE> <INDENT> handler.start(self.type) <NEW_LINE> handler.feed(block) <NEW_LINE> handler.end(self.type) <NEW_LINE> return True
すべてのルールの基底クラス 全てのサブクラスがtypeという属性を持ち、文字列でタイプ名を格納している前提
6259906a4a966d76dd5f06e1
class TransformerLayer(nn.Module): <NEW_LINE> <INDENT> def __init__(self, size, num_heads, dropout=0.3): <NEW_LINE> <INDENT> super(TransformerLayer, self).__init__() <NEW_LINE> self.output_linear = nn.Linear(size, size) <NEW_LINE> self.norm = nn.LayerNorm(size) <NEW_LINE> self.dropout = nn.Dropout(dropout) <NEW_LINE> s...
attention -> add & norm -> PositionwiseFeedForward Note for code simplicity the norm is first as opposed to last.
6259906aa219f33f346c7ff4