code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class TestStudentFromIdentifier(TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> super(TestStudentFromIdentifier, cls).setUpClass() <NEW_LINE> cls.valid_student = UserFactory.create(username='baz@touchstone') <NEW_LINE> cls.student_conflicting_email = UserFactory.create(em... | Test get_student_from_identifier() | 62598fb4d268445f26639be2 |
class RobotServiceException(Exception): <NEW_LINE> <INDENT> pass | General exception used by the agent. | 62598fb4bf627c535bcb155f |
class Button(Control): <NEW_LINE> <INDENT> def __init__(self, message, position, size = (0,0), color = (0,0,0), triggerFunc = None, menuRef = None, bgColor = None, fontSize = None): <NEW_LINE> <INDENT> self.message = message <NEW_LINE> self.menuRef = menuRef <NEW_LINE> self.color = color <NEW_LINE> self.bgColor = bgCol... | button class derived from control | 62598fb416aa5153ce4005c1 |
class P4ConvP4(SplitGConv2D): <NEW_LINE> <INDENT> @property <NEW_LINE> def input_stabilizer_size(self): <NEW_LINE> <INDENT> return 4 <NEW_LINE> <DEDENT> @property <NEW_LINE> def output_stabilizer_size(self): <NEW_LINE> <INDENT> return 4 <NEW_LINE> <DEDENT> @property <NEW_LINE> def transformation_indices(self): <NEW_LIN... | P4 to P4 group convolution layer.
This layer creates a convolution kernel that is convolved
(actually cross-correlated) with the layer input to produce a tensor of
outputs. If `use_bias` is True, a bias vector is created and added to the outputs.
Finally, if `activation` is not `None`, it is applied to the outputs as ... | 62598fb43d592f4c4edbaf7e |
class ComponentTests(ossie.utils.testing.ScaComponentTestCase): <NEW_LINE> <INDENT> def testScaBasicBehavior(self): <NEW_LINE> <INDENT> execparams = self.getPropertySet(kinds=("execparam",), modes=("readwrite", "writeonly"), includeNil=False) <NEW_LINE> execparams = dict([(x.id, any.from_any(x.value)) for x in execpara... | Test for all component implementations in throttle_ii | 62598fb455399d3f056265d2 |
class AnswerComment(models.Model): <NEW_LINE> <INDENT> content = models.TextField(verbose_name=_('Content')) <NEW_LINE> commenter = models.ForeignKey(User, verbose_name=_('Commenter')) <NEW_LINE> create_time = models.DateTimeField(verbose_name=_('Create Time'), auto_now_add=True) <NEW_LINE> class Meta(object): <NEW_LIN... | Answer comment model
| 62598fb44f6381625f19951f |
class MaxCorrectionsError(CustodianError): <NEW_LINE> <INDENT> def __init__(self, message, raises, max_errors): <NEW_LINE> <INDENT> super().__init__(message, raises) <NEW_LINE> self.max_errors = max_errors | Error raised when the maximum allowed number of errors is reached | 62598fb4f548e778e596b662 |
class PipProvider(AbstractProvider): <NEW_LINE> <INDENT> def __init__( self, factory, constraints, ignore_dependencies, upgrade_strategy, user_requested, ): <NEW_LINE> <INDENT> self._factory = factory <NEW_LINE> self._constraints = constraints <NEW_LINE> self._ignore_dependencies = ignore_dependencies <NEW_LINE> self._... | Pip's provider implementation for resolvelib.
:params constraints: A mapping of constraints specified by the user. Keys
are canonicalized project names.
:params ignore_dependencies: Whether the user specified ``--no-deps``.
:params upgrade_strategy: The user-specified upgrade strategy.
:params user_requested: A se... | 62598fb45fc7496912d482db |
class LabelledPath(object): <NEW_LINE> <INDENT> labels = dict() <NEW_LINE> def __init__(self, label, path): <NEW_LINE> <INDENT> assert isinstance(label, str) and len(label) == 1 <NEW_LINE> assert label not in LabelledPath.labels <NEW_LINE> assert isinstance(path, Path) <NEW_LINE> self.label = label <NEW_LINE> self.path... | This class represents a path labelled with a unique single-letter label.
Parameters
----------
label : str
A single-letter label.
path : Path
The labelled-path.
Attributes
----------
labels : dict of (str, Path)
A mapping between labels, and paths.
label : str
A single-letter label.
path : Path
Th... | 62598fb4cc40096d6161a238 |
class ShortThrower(ThrowerAnt): <NEW_LINE> <INDENT> name = "ShortThrower" <NEW_LINE> implemented = True <NEW_LINE> food_cost = 2 <NEW_LINE> min_range = 0 <NEW_LINE> max_range = 3 | Thrower Ant with a range of 0 - 3 places | 62598fb4a219f33f346c68c4 |
class Optimization(metaclass=abc.ABCMeta): <NEW_LINE> <INDENT> supported_constraints = [] <NEW_LINE> def __init__(self, opt_method): <NEW_LINE> <INDENT> self._opt_method = opt_method <NEW_LINE> self._maxiter = DEFAULT_MAXITER <NEW_LINE> self._eps = DEFAULT_EPS <NEW_LINE> self._acc = DEFAULT_ACC <NEW_LINE> <DEDENT> @pro... | Base class for optimizers.
Parameters
----------
opt_method : callable
Implements optimization method
Notes
-----
The base Optimizer does not support any constraints by default; individual
optimizers should explicitly set this list to the specific constraints
it supports. | 62598fb4a8370b77170f049b |
class Reader(object): <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> return self.process() <NEW_LINE> <DEDENT> def process(self): <NEW_LINE> <INDENT> pass | Generic Reader class for processing input. Should be subclassed instead of used directly. | 62598fb4236d856c2adc949e |
class Saver(PostProcessorBaseClass): <NEW_LINE> <INDENT> def __init__(self, spec: LoaderSpec) -> None: <NEW_LINE> <INDENT> super().__init__(spec) <NEW_LINE> self._time_list = [] <NEW_LINE> self._first_compute = True <NEW_LINE> if df.MPI.rank(df.MPI.comm_world) == 0: <NEW_LINE> <INDENT> self._casedir.mkdir(parents=True,... | Class for saving stuff. | 62598fb460cbc95b06364403 |
class Review(object): <NEW_LINE> <INDENT> def __init__(self, reviewerID, productID, helpful, reviewText, overall,category): <NEW_LINE> <INDENT> self.reviewerID = reviewerID <NEW_LINE> self.productID = productID <NEW_LINE> self.helpful = helpful <NEW_LINE> self.reviewText = reviewText <NEW_LINE> self.overall = overall ... | reviewerID - ID of the reviewer, e.g. A2SUAM1J3GNN3B
asin - ID of the product, e.g. 0000013714
reviewerName - name of the reviewer
helpful - helpfulness rating of the review, e.g. 2/3
reviewText - text of the review
overall - rating of the product
summary - summary of the review
unixReviewTime - time of the review (uni... | 62598fb456ac1b37e63022a9 |
class PositionalTensorArgs: <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> self.args = args <NEW_LINE> self.tf_args = [(i,a) for i,a in enumerate(args) if is_tensor(a)] <NEW_LINE> <DEDENT> @property <NEW_LINE> def tensor_args(self): <NEW_LINE> <INDENT> return [a for i,a in self.tf_args] <NEW_LINE> <D... | Handle tensor arguments. | 62598fb423849d37ff851172 |
class Conmat(CommandLine): <NEW_LINE> <INDENT> _cmd = 'conmat' <NEW_LINE> input_spec = ConmatInputSpec <NEW_LINE> output_spec = ConmatOutputSpec <NEW_LINE> def _list_outputs(self): <NEW_LINE> <INDENT> outputs = self.output_spec().get() <NEW_LINE> output_root = self._gen_outputroot() <NEW_LINE> outputs['conmat_sc'] = os... | Creates a connectivity matrix using a 3D label image (the target image)
and a set of streamlines. The connectivity matrix records how many stream-
lines connect each pair of targets, and optionally the mean tractwise
statistic (eg tract-averaged FA, or length).
The output is a comma separated variable file or file... | 62598fb4baa26c4b54d4f376 |
class Sorting(Enum): <NEW_LINE> <INDENT> ASCENDING = True <NEW_LINE> DESCENDING = False | Util class, to choose what type of sorting should be used. | 62598fb4097d151d1a2c10ee |
class TransactionsList(APIView): <NEW_LINE> <INDENT> renderer_classes = [TemplateHTMLRenderer] <NEW_LINE> template_name = 'transaction.html' <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> serializer = TransactionSerializer(data=request.data) <NEW_LINE> if serializer.is_valid(): <NEW_LINE> <INDE... | Create a new transaction. | 62598fb456ac1b37e63022aa |
class KMeans(Clustering): <NEW_LINE> <INDENT> def __init__(self, n_clusters=2, n_runs=10): <NEW_LINE> <INDENT> self.n_clusters = n_clusters <NEW_LINE> self.n_runs = n_runs <NEW_LINE> self.distortion = 0 <NEW_LINE> self.centroids = [] <NEW_LINE> self.clusters = [] <NEW_LINE> self._X = None <NEW_LINE> <DEDENT> def _calc_... | K-Means Clustering algorithm
Parameters:
-----------
n_clusters : integer, optional
n_runs : integer, how many times to run the algorithm, optional | 62598fb460cbc95b06364404 |
class ISODatastore(Updateable): <NEW_LINE> <INDENT> def __init__(self, provider=None): <NEW_LINE> <INDENT> self.provider = provider <NEW_LINE> <DEDENT> def _form_mapping(self, create=None, **kwargs): <NEW_LINE> <INDENT> return {'provider': kwargs.get('provider')} <NEW_LINE> <DEDENT> def _submit(self, cancel, submit_but... | Model of a PXE Server object in CFME
Args:
provider: Provider name. | 62598fb4f548e778e596b663 |
class ReferenceCounter(BoundVariableTracker): <NEW_LINE> <INDENT> def __init__(self, name, value): <NEW_LINE> <INDENT> super().__init__(name, value) <NEW_LINE> self.count = 0 <NEW_LINE> <DEDENT> def update(self, reference=None): <NEW_LINE> <INDENT> del reference <NEW_LINE> self.count += 1 <NEW_LINE> <DEDENT> def __str_... | Data container to track number References to a variable in an AST.
Attributes:
name: The string name representing the variable whose binding is represented
by an instance of `ReferenceCounter`.
value: The value bound to `name`. Can be an instance of
`building_blocks.ComputationBuildingBlock` or None if th... | 62598fb4cc0a2c111447b0d2 |
@register_node <NEW_LINE> class Function(Node): <NEW_LINE> <INDENT> def __init__(self, graph, name, inputs=[], config={}): <NEW_LINE> <INDENT> super(Function, self).__init__(graph, name, inputs=inputs, config=config) <NEW_LINE> self.computes_gradient = False <NEW_LINE> <DEDENT> def setup_defaults(self): <NEW_LINE> <IND... | Define an arbitrary function inside the computational graph | 62598fb4d486a94d0ba2c091 |
class ExecutionRecursionDecorator(object): <NEW_LINE> <INDENT> def __init__(self, func): <NEW_LINE> <INDENT> self.func = func <NEW_LINE> self.reset() <NEW_LINE> <DEDENT> def __call__(self, execution, evaluate_generator=False): <NEW_LINE> <INDENT> debug.dbg('Execution recursions: %s' % execution, self.recursion_level, s... | Catches recursions of executions.
It is designed like a Singelton. Only one instance should exist. | 62598fb457b8e32f5250817c |
class TeamMembershipType(bb.Union): <NEW_LINE> <INDENT> _catch_all = None <NEW_LINE> full = None <NEW_LINE> limited = None <NEW_LINE> def is_full(self): <NEW_LINE> <INDENT> return self._tag == 'full' <NEW_LINE> <DEDENT> def is_limited(self): <NEW_LINE> <INDENT> return self._tag == 'limited' <NEW_LINE> <DEDENT> def _pro... | This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar team.TeamMembershipType.full: User uses a license and has full access
to team resources like the shared quota.
:ivar team.TeamMem... | 62598fb47b180e01f3e490b0 |
class ResmokeGenTaskService: <NEW_LINE> <INDENT> @inject.autoparams() <NEW_LINE> def __init__(self, gen_task_options: GenTaskOptions) -> None: <NEW_LINE> <INDENT> self.gen_task_options = gen_task_options <NEW_LINE> <DEDENT> def generate_tasks(self, generated_suite: GeneratedSuite, params: ResmokeGenTaskParams) -> Set[T... | A service to generated split resmoke suites. | 62598fb44a966d76dd5eef97 |
class Python27(Python, Dependency): <NEW_LINE> <INDENT> name = "python27" <NEW_LINE> recommended = False | Backwards compatibility. | 62598fb4adb09d7d5dc0a64c |
class Pitchfork(Publication): <NEW_LINE> <INDENT> title = 'Pitchfork: Best New Albums' <NEW_LINE> url = "http://pitchfork.com/reviews/best/albums/" <NEW_LINE> rank = 3 <NEW_LINE> medium = Album() <NEW_LINE> @Publication.catch_scraper_exceptions <NEW_LINE> def scrape(self): <NEW_LINE> <INDENT> reviews = self.html.find_a... | The Pitchfork Music publication class | 62598fb4fff4ab517ebcd8a6 |
class MateriaDaTurmaDetailView(LoginRequiredMixin, DetailView): <NEW_LINE> <INDENT> model = MateriaDaTurma <NEW_LINE> context_object_name = 'materia' | View de detalhes sobre a materia | 62598fb47047854f4633f49a |
class UtgReplayPolicy(InputPolicy): <NEW_LINE> <INDENT> def __init__(self, device, app, replay_output): <NEW_LINE> <INDENT> super(UtgReplayPolicy, self).__init__(device, app) <NEW_LINE> self.logger = logging.getLogger(self.__class__.__name__) <NEW_LINE> self.replay_output = replay_output <NEW_LINE> import os <NEW_LINE>... | Replay DroidBot output generated by UTG policy | 62598fb43d592f4c4edbaf80 |
class Character: <NEW_LINE> <INDENT> def __init__(self, char, position, clock) -> None: <NEW_LINE> <INDENT> self.char = char <NEW_LINE> self.position = position <NEW_LINE> self.clock = clock <NEW_LINE> <DEDENT> @property <NEW_LINE> def author(self) -> int: <NEW_LINE> <INDENT> return self.position.sites[-1] <NEW_LINE> <... | Represents a character in CRDT document. | 62598fb492d797404e388bc3 |
@public <NEW_LINE> @implementer(IRule) <NEW_LINE> class SuspiciousHeader: <NEW_LINE> <INDENT> name = 'suspicious-header' <NEW_LINE> description = _('Catch messages with suspicious headers.') <NEW_LINE> record = True <NEW_LINE> def check(self, mlist, msg, msgdata): <NEW_LINE> <INDENT> return (mlist.bounce_matching_heade... | The historical 'suspicious header' rule. | 62598fb44e4d5625663724e3 |
class Worker(BaseAnt): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> BaseAnt.__init__(self) <NEW_LINE> self.role = 'Worker' | A worker in the ant colony. | 62598fb455399d3f056265d4 |
class OpCodeMapper(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.code_to_name = {} <NEW_LINE> for idx, d in enumerate(data["operator_codes"]): <NEW_LINE> <INDENT> self.code_to_name[idx] = d["builtin_code"] <NEW_LINE> <DEDENT> <DEDENT> def __call__(self, x): <NEW_LINE> <INDENT> if x not... | Maps an opcode index to an op name. | 62598fb4be8e80087fbbf127 |
class SatTableWithoutHeaders(Table): <NEW_LINE> <INDENT> ROWS = './tbody/tr' <NEW_LINE> COLUMNS = './tbody/tr[1]/td' <NEW_LINE> ROW_AT_INDEX = './tbody/tr[{0}]' <NEW_LINE> HEADER_IN_ROWS = None <NEW_LINE> HEADERS = None <NEW_LINE> @property <NEW_LINE> def _is_header_in_body(self): <NEW_LINE> <INDENT> return False <NEW_... | Applicable for every table in application that has no headers. Due logic of the Table
widget we have to explicitly specify custom headers. As we have no idea about the content
and structure of the table in advance, we will dynamically name each column using simple -
'column1', 'column2', ... 'columnN'.
Example html re... | 62598fb466656f66f7d5a4b1 |
class itkIntensityWindowingImageFilterID3IUC3_Superclass(itkInPlaceImageFilterAPython.itkInPlaceImageFilterID3IUC3): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constr... | Proxy of C++ itkIntensityWindowingImageFilterID3IUC3_Superclass class | 62598fb4bd1bec0571e15122 |
class PythonLexer(Qsci.QsciLexerPython): <NEW_LINE> <INDENT> py_kwds = ( 'ArithmeticError AssertionError AttributeError BaseException ' 'BufferError BytesWarning DeprecationWarning EOFErr Ellipsis ' 'EnvironmentError Exception False FloatingPointError FutureWarning ' 'GeneratorExit IOError ImportError ImportWarning Ind... | A custom Python lexer which highlights extra identifiers.
| 62598fb4aad79263cf42e894 |
class GoawayFrame(SpdyFrame): <NEW_LINE> <INDENT> def __init__(self, last_stream_id, reason): <NEW_LINE> <INDENT> SpdyFrame.__init__(self, FrameTypes.GOAWAY, Flags.FLAG_NONE) <NEW_LINE> self.last_stream_id = last_stream_id <NEW_LINE> self.reason = reason <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return... | A SPDY GOAWAY frame. | 62598fb41f5feb6acb162cde |
class Solution: <NEW_LINE> <INDENT> @timeit <NEW_LINE> def isSubPath(self, head: ListNode, root: TreeNode) -> bool: <NEW_LINE> <INDENT> def dfs1(p, q): <NEW_LINE> <INDENT> if not p: return True <NEW_LINE> if not q: return False <NEW_LINE> if p.val != q.val: return False <NEW_LINE> return dfs1(p.next, q.left) or dfs1(p.... | [5346. 二叉树中的列表](https://leetcode-cn.com/problems/linked-list-in-binary-tree/) | 62598fb4851cf427c66b8377 |
class ListProfiles(APIView): <NEW_LINE> <INDENT> permission_classes = (permissions.IsAuthenticated,) <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> articles = Article.objects.distinct("author").all() <NEW_LINE> authors = Profile.objects.filter( user_id__in=[article.author.username for article i... | Class to list author profiles | 62598fb456b00c62f0fb2978 |
class tvdb_resourcenotfound(tvdb_exception): <NEW_LINE> <INDENT> pass | Resource cannot be found on thetvdb.com
| 62598fb430bbd722464699d9 |
class PsuWrapper: <NEW_LINE> <INDENT> def __init__(self, dmgr, devices, mappings): <NEW_LINE> <INDENT> self.core = dmgr.get("core") <NEW_LINE> self.devices = { dev: dmgr.get(dev) for dev in devices } <NEW_LINE> self.mappings = mappings <NEW_LINE> <DEDENT> def set_voltage_limit(self, logicalChannel, value): <NEW_LINE> <... | Wraps multiple power supplies to allow reference to channels by an
easily remappable logical name. The arguments are:
'devices', the list of power supplies,
'mappings', a dictionary mapping logical devices names to
(device,channel) tuples | 62598fb497e22403b383afcd |
class VideoSearchView(LoginRequiredMixin, FormView): <NEW_LINE> <INDENT> template_name = 'video_search_results.html' <NEW_LINE> form_class = YouTubeVideoSearchForm <NEW_LINE> def get(self, request, pk): <NEW_LINE> <INDENT> return HttpResponseNotAllowed('post') <NEW_LINE> <DEDENT> def get_context_data(self, form, **kwar... | Allows users to search youtube for videos to add to their project | 62598fb4baa26c4b54d4f378 |
class BadDomainError(OutputFilterError): <NEW_LINE> <INDENT> pass | An error to throw when a domain is invalid. | 62598fb4442bda511e95c519 |
class FolderMoveObjects(BaseSubstitution): <NEW_LINE> <INDENT> category = u'AsyncMove' <NEW_LINE> description = u'Move folder objects' <NEW_LINE> def safe_call(self): <NEW_LINE> <INDENT> return getattr(self.wrapper, 'folder_move_objects', '') | Move folder objects substitution
| 62598fb4097d151d1a2c10f0 |
class UserRoles(Enum): <NEW_LINE> <INDENT> admin = "admin" <NEW_LINE> writer = "writer" <NEW_LINE> reader = "reader" | Closed list of accepted Contact roles in Isogeo API.
:Example:
>>> # parse members and values
>>> print("{0:<30} {1:>20}".format("Enum", "Value"))
>>> for role in UserRoles:
>>> print("{0:<30} {1:>20}".format(role, role.value))
Enum Value
UserRoles.... | 62598fb44527f215b58e9f96 |
class MatchNdTargetAddrIDL(object): <NEW_LINE> <INDENT> thrift_spec = (None, (1, TType.I32, 'sense', None, None), (2, TType.LIST, 'targetAddr', (TType.BYTE, None), None)) <NEW_LINE> def __init__(self, sense = None, targetAddr = None): <NEW_LINE> <INDENT> self.sense = sense <NEW_LINE> self.targetAddr = targetAddr <NEW_L... | ND Target Address match
Attributes:
- sense
- targetAddr | 62598fb466673b3332c3048e |
class Attention(nn.Module): <NEW_LINE> <INDENT> def __init__(self, hidden_dim: int, method: str): <NEW_LINE> <INDENT> super(Attention, self).__init__() <NEW_LINE> assert method in {'dot', 'general', 'concat'}, 'method should either be dot, general or concat' <NEW_LINE> self.method = method <NEW_LINE> self.hi... | Based on Luong's attention https://arxiv.org/pdf/1508.04025.pdf
PyTorch implementation inspired by https://github.com/marumalo/pytorch-seq2seq/blob/master/model.py | 62598fb467a9b606de546090 |
class B2PmxeSolidifyDelete(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "b2pmxem.delete_solidify" <NEW_LINE> bl_label = "Delete Solidify Edge" <NEW_LINE> bl_options = {'REGISTER', 'UNDO'} <NEW_LINE> @classmethod <NEW_LINE> def poll(cls, context): <NEW_LINE> <INDENT> obj = context.active_object <NEW_LINE> return... | Delete Solidify Edge of selected objects | 62598fb460cbc95b06364406 |
class cmd_connect(Command): <NEW_LINE> <INDENT> connected = True <NEW_LINE> arguments = [ Argument('device', help = 'The device to connect to, can include an optional [username@].'), ] <NEW_LINE> options = [ Option('search-all', 'a', take_argument = False, help = 'Search all attributes and networks (default is to only ... | SSH/RDP connection to a device. | 62598fb4cc0a2c111447b0d4 |
class GCommitArrow(GConnectionLine): <NEW_LINE> <INDENT> def __init__(self, origin, origin_attach_mode, destination, destination_attach_mode): <NEW_LINE> <INDENT> super().__init__(origin, origin_attach_mode, destination, destination_attach_mode) <NEW_LINE> <DEDENT> def paint(self, QPainter, QStyleOptionGraphicsItem, QW... | A graphics item representing the connection between GCommitNodes
A GCommitArrow originates from child GCommitNodes and points to
their parent GCommitNode. GCommitArrows consist of a line and an
arrow head, and will expand and contract as their source and
destination nodes are moved around | 62598fb416aa5153ce4005c5 |
class GrowthAPILoader(DataFileLoader): <NEW_LINE> <INDENT> def __init__(self, api_file_dbf, year): <NEW_LINE> <INDENT> super(GrowthAPILoader, self).__init__(api_file_dbf) <NEW_LINE> self.year = year <NEW_LINE> <DEDENT> def load_file(self): <NEW_LINE> <INDENT> if self.file[-4:].lower() != '.dbf': <NEW_LINE> <INDENT> rai... | Parses/loads growth api DBF files | 62598fb43317a56b869be5ad |
class SlippyImageArtist(AxesImage): <NEW_LINE> <INDENT> def __init__(self, ax, raster_source, **kwargs): <NEW_LINE> <INDENT> self.raster_source = raster_source <NEW_LINE> super(SlippyImageArtist, self).__init__(ax, **kwargs) <NEW_LINE> self.set_clip_path(ax.outline_patch) <NEW_LINE> <DEDENT> @matplotlib.artist.allow_ra... | A subclass of :class:`~matplotlib.image.AxesImage` which provides an
interface for getting a raster from the given object with interactive
slippy map type functionality.
Kwargs are passed to the AxesImage constructor. | 62598fb4ff9c53063f51a70f |
class LargeFeeCharger(FeeCharger): <NEW_LINE> <INDENT> def getFee(self, start, end): <NEW_LINE> <INDENT> return (end - start) * 0.5 | Parking Lot large fee charger. | 62598fb4283ffb24f3cf394e |
class WindowError(RasterioError): <NEW_LINE> <INDENT> pass | Raised when errors occur during window operations | 62598fb47047854f4633f49c |
class ConditionProvider(cst.VisitorMetadataProvider): <NEW_LINE> <INDENT> cond_stack: tp.List[cst.BaseExpression] <NEW_LINE> def __init__(self, simplify: bool = False): <NEW_LINE> <INDENT> self.cond_stack = [] <NEW_LINE> <DEDENT> def on_leave(self, node: cst.CSTNode) -> None: <NEW_LINE> <INDENT> self.set_metadata(node,... | Marks each node with the conditions under which they will be executed | 62598fb4fff4ab517ebcd8a8 |
class Reaction(models.Model): <NEW_LINE> <INDENT> created_at = models.DateTimeField(auto_now_add=True) <NEW_LINE> like_or_dislike = models.CharField( choices=LikeOrDislike.choices, max_length=255, null=True, blank=True ) <NEW_LINE> comment = models.TextField(null=True, blank=True) <NEW_LINE> author = models.ForeignKey(... | A model to store user reactions associated with a Post instance. | 62598fb4bd1bec0571e15123 |
class ReactiveFluxSimulation(ShootFromSnapshotsSimulation): <NEW_LINE> <INDENT> def __init__(self, storage, engine=None, states=None, randomizer=None, initial_snapshots=None, rc=None): <NEW_LINE> <INDENT> self.states = states <NEW_LINE> state_A = states[0] <NEW_LINE> state_B = states[1] <NEW_LINE> self.rc = rc <NEW_LIN... | Reactive Flux simulations (effective positive flux).
Parameters
----------
storage : :class:`.Storage`
the file to store simulations in
engine : :class:`.DynamicsEngine`
the dynamics engine to use to run the simulation
states : list of :class:`.Volume`
the volumes representing the stable states, first stat... | 62598fb4aad79263cf42e896 |
class CounterCollection(object): <NEW_LINE> <INDENT> def __init__(self, sim): <NEW_LINE> <INDENT> self.sim = sim <NEW_LINE> self.cnt_wt = TimeIndependentCounter() <NEW_LINE> self.hist_wt = TimeIndependentHistogram(self.sim, "w") <NEW_LINE> self.cnt_ql = TimeDependentCounter(self.sim) <NEW_LINE> self.hist_ql = TimeDepen... | CounterCollection is a collection of all counters and histograms that are used in the simulations.
It contains several counters and histograms, that are used in the different tasks.
Reporting is done by calling the report function. This function can be adapted, depending on which counters should
report their results a... | 62598fb476e4537e8c3ef668 |
class context_schema(Embryo.Schema): <NEW_LINE> <INDENT> dao = fields.Nested( { 'name': fields.String(), 'type': fields.String(nullable=True), 'params': fields.Nested({}), 'fields': fields.List(fields.Dict()) } ) | # Context Schema
The respective Dao schema
## Fields
* `dao`:
* `name`: TODO
* `type`: TODO
* `fields`: TODO | 62598fb491f36d47f2230f09 |
class ChdirContext(object): <NEW_LINE> <INDENT> def __init__(self, dpath=None, stay=False, verbose=None): <NEW_LINE> <INDENT> if verbose is None: <NEW_LINE> <INDENT> verbose = 1 <NEW_LINE> <DEDENT> self.verbose = verbose <NEW_LINE> self.stay = stay <NEW_LINE> self.dpath = dpath <NEW_LINE> self.curdir = os.getcwd() <NEW... | References http://www.astropython.org/snippet/2009/10/chdir-context-manager | 62598fb48a349b6b436862fe |
class MixedCaseUnderscoreStyle(Style): <NEW_LINE> <INDENT> def pythonAttrToDBColumn(self, attr): <NEW_LINE> <INDENT> return mixedToUnder(attr) <NEW_LINE> <DEDENT> def dbColumnToPythonAttr(self, col): <NEW_LINE> <INDENT> return underToMixed(col) <NEW_LINE> <DEDENT> def pythonClassToDBTable(self, className): <NEW_LINE> <... | This is the default style. Python attributes use mixedCase,
while database columns use underscore_separated. | 62598fb497e22403b383afce |
class PluginRegistry(object): <NEW_LINE> <INDENT> def find_requirement_by_env_var(self, env_var, options): <NEW_LINE> <INDENT> from .requirement import EnvVarRequirement <NEW_LINE> return EnvVarRequirement(registry=self, env_var=env_var, options=options) <NEW_LINE> <DEDENT> def find_requirement_by_service_type(self, se... | Allows creating Requirement and Provider instances. | 62598fb463b5f9789fe8522e |
class Life(): <NEW_LINE> <INDENT> life = False <NEW_LINE> lifetime = 0 <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.life = False <NEW_LINE> self.lifetime = 0 <NEW_LINE> <DEDENT> def ILive(self): <NEW_LINE> <INDENT> return self.life <NEW_LINE> <DEDENT> def Kill(self): <NEW_LINE> <INDENT> self.lifetime = 0 <NE... | Attributes
----------
life : boolean
True is a live
life_time : int
updtime of life
Methods
-------
Ilive()
return life
Kill()
to kill life
Rise()
to rise life | 62598fb4a8370b77170f04a0 |
class Variable(object): <NEW_LINE> <INDENT> def __init__(self, var): <NEW_LINE> <INDENT> self.var = var <NEW_LINE> self.literal = None <NEW_LINE> self.lookups = None <NEW_LINE> self.translate = False <NEW_LINE> self.message_context = None <NEW_LINE> try: <NEW_LINE> <INDENT> self.literal = float(var) <NEW_LINE> if '.' n... | A template variable, resolvable against a given context. The variable may
be a hard-coded string (if it begins and ends with single or double quote
marks)::
>>> c = {'article': {'section':u'News'}}
>>> Variable('article.section').resolve(c)
u'News'
>>> Variable('article').resolve(c)
{'section': u'N... | 62598fb4097d151d1a2c10f1 |
class RoundRobinMap(Map): <NEW_LINE> <INDENT> def getPartition(self, seq, p, q): <NEW_LINE> <INDENT> return seq[p:len(seq):q] <NEW_LINE> <DEDENT> def joinPartitions(self, listOfPartitions): <NEW_LINE> <INDENT> testObject = listOfPartitions[0] <NEW_LINE> for m in arrayModules: <NEW_LINE> <INDENT> if isinstance(testObjec... | Partitions a sequence in a roun robin fashion.
This currently does not work! | 62598fb44428ac0f6e6585e3 |
class BlockDeviceMapping(dict): <NEW_LINE> <INDENT> def __init__(self, connection=None): <NEW_LINE> <INDENT> dict.__init__(self) <NEW_LINE> self.connection = connection <NEW_LINE> self.current_name = None <NEW_LINE> self.current_value = None <NEW_LINE> <DEDENT> def startElement(self, name, attrs, connection): <NEW_LINE... | Represents a collection of BlockDeviceTypes when creating ec2 instances.
Example:
dev_sda1 = BlockDeviceType()
dev_sda1.size = 100 # change root volume to 100GB instead of default
bdm = BlockDeviceMapping()
bdm['/dev/sda1'] = dev_sda1
reservation = image.run(..., block_device_map=bdm, ...) | 62598fb471ff763f4b5e7837 |
class UserExists(BackendError): <NEW_LINE> <INDENT> pass | Raised when a user already exists. | 62598fb467a9b606de546092 |
class Config(object): <NEW_LINE> <INDENT> DB_URI = 'postgresql+psycopg2://alex:@127.0.0.1/openbookmark' <NEW_LINE> DOMAIN = '' <NEW_LINE> DEBUG = True <NEW_LINE> TIMEOUT = 3600 <NEW_LINE> REDIS_HOST = '127.0.0.1' <NEW_LINE> REDIS_PORT = 6379 | 基本配置 | 62598fb4fff4ab517ebcd8a9 |
class TestOrderStyleForwardingAlgorithm(TradingAlgorithm): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.method_name = kwargs.pop('method_name') <NEW_LINE> super(TestOrderStyleForwardingAlgorithm, self) .__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def initialize(self): <... | Test Algorithm for verifying that ExecutionStyles are properly forwarded by
order API helper methods. Pass the name of the method to be tested as a
string parameter to this algorithm's constructor. | 62598fb4d268445f26639be5 |
class People: <NEW_LINE> <INDENT> def __init__(self, user_id): <NEW_LINE> <INDENT> self.name = None <NEW_LINE> self.email = None <NEW_LINE> self.user_id = user_id <NEW_LINE> <DEDENT> def set_name(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def set_email(self, email): <NEW_LINE> <INDENT> self.e... | Identity on a issue tracking system.
@param user_id: identifier of the user
@type user_id: C{str} | 62598fb4be383301e02538bf |
class Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_3(object): <NEW_LINE> <INDENT> Invalid = 0 <NEW_LINE> Tiny_Orchestra_Glock_Pluck_Mode_3_Off = 2569343836 <NEW_LINE> Tiny_Orchestra_Glock_Pluck_Mode_3_On = 1273367574 | Automatically-generated uint_32 enumeration. | 62598fb4cc0a2c111447b0d7 |
class BaseSetting(object): <NEW_LINE> <INDENT> enable_themes = True <NEW_LINE> use_bootswatch = True | 配置主题 | 62598fb4a79ad1619776a12f |
class TTAVerticalFlip(BaseWheatTTA): <NEW_LINE> <INDENT> def augment(self, image): <NEW_LINE> <INDENT> return image.flip(2) <NEW_LINE> <DEDENT> def batch_augment(self, images): <NEW_LINE> <INDENT> return images.flip(3) <NEW_LINE> <DEDENT> def deaugment_boxes(self, boxes): <NEW_LINE> <INDENT> boxes[:, [0,2]] = self.imag... | author: @shonenkov | 62598fb4f548e778e596b668 |
class ActMask(nn.Module): <NEW_LINE> <INDENT> def __init__(self, num_channels): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> assert isinstance(num_channels, int) <NEW_LINE> assert num_channels >= 1 <NEW_LINE> self.num_channels = num_channels <NEW_LINE> self.mask = nn.Parameter(torch.ones(num_channels), requires_gr... | Apply a 0-1 mask on the activation channels. | 62598fb42c8b7c6e89bd3888 |
class WorksheetPrintView(WorksheetDetailView): <NEW_LINE> <INDENT> template_name = 'worksheet/print.html' <NEW_LINE> def render_to_response(self, context, **response_kwargs): <NEW_LINE> <INDENT> numbering = self.request.GET.get('q', '') <NEW_LINE> response = super(WorksheetPrintView, self).render_to_response( context, ... | Based on the WorkSheet Detail View, this is one is used for
downloading PDF module and sample test file. | 62598fb491f36d47f2230f0a |
class Optional(Proxy[T]): <NEW_LINE> <INDENT> def __init__(self, obj): <NEW_LINE> <INDENT> super().__init__(obj) <NEW_LINE> <DEDENT> def __contains__(self, item) -> bool: <NEW_LINE> <INDENT> me = getattr(self, '_Proxy__obj') <NEW_LINE> if me is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return item in m... | A wrapper for your classes, that does nothing if the object passed in is None.
It will return an empty Optional in that case.
Usage example:
>>> may_be_none = None
>>> Optional(may_be_none).cancel().result()
So far operations supported:
* calling
* getattr
* getitem/setitem/delitem
* testing for truth
* comparison ... | 62598fb45fdd1c0f98e5e053 |
class LSTMCell(tf.contrib.rnn.RNNCell): <NEW_LINE> <INDENT> def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.9): <NEW_LINE> <INDENT> self.num_units = num_units <NEW_LINE> self.forget_bias = forget_bias <NEW_LINE> self.use_recurrent_dropout = use_recurrent_dropout <NEW_LINE... | Vanilla LSTM cell.
Uses ortho initializer, and also recurrent dropout without memory loss
(https://arxiv.org/abs/1603.05118) | 62598fb4091ae35668704ce4 |
class MethodAttributeMemoizer(object): <NEW_LINE> <INDENT> def __init__(self, attribute_name): <NEW_LINE> <INDENT> self.attribute_name = attribute_name <NEW_LINE> <DEDENT> def __call__(self, func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapped_f(*args, **kwargs): <NEW_LINE> <INDENT> obj = args[0] <N... | Define a decorator which caches results of an instance method.
Results are cached according to the value of a specific instance attribute. | 62598fb460cbc95b0636440a |
class Grammar(object): <NEW_LINE> <INDENT> def __init__(self, tags): <NEW_LINE> <INDENT> self.tags = tags <NEW_LINE> <DEDENT> def validate_server(self, server): <NEW_LINE> <INDENT> for tag in self.tags.keys(): <NEW_LINE> <INDENT> if tag in server.metadata: <NEW_LINE> <INDENT> self.validate(tag, self.metadata[tag]) <NEW... | Container object for valid instance annotations. | 62598fb47d43ff2487427465 |
class DnsChecker(): <NEW_LINE> <INDENT> def querry(self, resolvers, targets): <NEW_LINE> <INDENT> resolver = dns.resolver.Resolver() <NEW_LINE> test_resolvers = {} <NEW_LINE> dnsresults = dnsresult.DNSResult() <NEW_LINE> for name, value in sorted(resolvers["Servers"].items()): <NEW_LINE> <INDENT> if value["active"] is ... | Query each server defined in self.dns_resolvers for each domain in self.targets | 62598fb4cc0a2c111447b0d8 |
class EightHeatSensor(EightSleepHeatEntity): <NEW_LINE> <INDENT> def __init__(self, name, eight, sensor): <NEW_LINE> <INDENT> super().__init__(eight) <NEW_LINE> self._sensor = sensor <NEW_LINE> self._mapped_name = NAME_MAP.get(self._sensor, self._sensor) <NEW_LINE> self._name = f"{name} {self._mapped_name}" <NEW_LINE> ... | Representation of an eight sleep heat-based sensor. | 62598fb47b180e01f3e490b3 |
class UserDialogInfo: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRUCT, 'dialog', (DialogInfoDto, DialogInfoDto.thrift_spec), None, ), (2, TType.STRUCT, 'lastMessage', (InstantMessageDto, InstantMessageDto.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, dialog=None, lastMessage=None,): <NEW_LINE> <INDE... | Attributes:
- dialog
- lastMessage | 62598fb467a9b606de546095 |
class NonStringError(TypeError): <NEW_LINE> <INDENT> pass | An Error for arguments given that are not strings. | 62598fb45fdd1c0f98e5e054 |
class RegExpInstance(ObjectInstance): <NEW_LINE> <INDENT> es_class = 'RegExp' <NEW_LINE> def __init__(self, interpreter, source=None, is_global=False, is_ignore_case=False, is_multiline=False): <NEW_LINE> <INDENT> super(RegExpInstance, self).__init__(interpreter) <NEW_LINE> self.source = source <NEW_LINE> self.is_globa... | The specialized ``RegExp`` object class.
15.10.7 | 62598fb47047854f4633f4a1 |
class RegistrationForm(UserCreationForm): <NEW_LINE> <INDENT> error_messages = {'password_mismatch': _e[7], 'email_unique': _e[9], 'username_min_length': _e[2]} <NEW_LINE> Meta = UserCreationForm.Meta <NEW_LINE> Meta.error_messages = {'username': {'unique': _e[1], 'required': _e[0], 'max_length': _e[3]}} <NEW_LINE> pas... | User registration form. | 62598fb410dbd63aa1c70c7c |
class TestInitialisation(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.fh = StringIO() <NEW_LINE> self.workbook = Workbook() <NEW_LINE> self.workbook._set_filehandle(self.fh) <NEW_LINE> <DEDENT> def test_xml_declaration(self): <NEW_LINE> <INDENT> self.workbook._xml_declaration() <NEW... | Test initialisation of the Workbook class and call a method. | 62598fb456b00c62f0fb297e |
class MultiRegionAccessPoint(AWSObject): <NEW_LINE> <INDENT> resource_type = "AWS::S3::MultiRegionAccessPoint" <NEW_LINE> props: PropsDictType = { "Name": (str, False), "PublicAccessBlockConfiguration": (PublicAccessBlockConfiguration, False), "Regions": ([Region], True), } | `MultiRegionAccessPoint <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-multiregionaccesspoint.html>`__ | 62598fb430bbd722464699dc |
class DependencyType(object): <NEW_LINE> <INDENT> (NONE, IMAGE, CONTAINER) = flag_gen(3) | Differentiate between `Image` and `Container` graphs | 62598fb4627d3e7fe0e06f75 |
class LsbootLan(ManagedObject): <NEW_LINE> <INDENT> consts = LsbootLanConsts() <NEW_LINE> naming_props = set([]) <NEW_LINE> mo_meta = MoMeta("LsbootLan", "lsbootLan", "lan", VersionMeta.Version111a, "InputOutput", 0x3f, [], ["admin", "ls-compute", "ls-config", "ls-config-policy", "ls-server", "ls-server-policy", "ls-st... | This is LsbootLan class. | 62598fb4dc8b845886d5367d |
class ChildAbs(Abstract): <NEW_LINE> <INDENT> pass | Child of abstract class, should not be abstract by default | 62598fb45fc7496912d482df |
class UnknownVerificarloBackend(Exception): <NEW_LINE> <INDENT> pass | Raised when backend is unknown | 62598fb491f36d47f2230f0b |
class Union(_WithSubValidators): <NEW_LINE> <INDENT> def _exec(self, funcs, v, path=None): <NEW_LINE> <INDENT> error = None <NEW_LINE> for func in funcs: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if path is None: <NEW_LINE> <INDENT> return func(v) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return func(path, v) <N... | Use the first validated value among those selected by discriminant.
:param msg: Message to deliver to user if validation fails.
:param discriminant(value, validators): Returns the filtered list of validators based on the value.
:param kwargs: All other keyword arguments are passed to the sub-schema constructors.
:retu... | 62598fb44c3428357761a381 |
class PrmDetacher(Parametre): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Parametre.__init__(self, "détacher", "untide") <NEW_LINE> self.aide_courte = "détache les amarres" <NEW_LINE> self.aide_longue = "Cette commande permet de détacher les amarres retenant un " "navire. Vous ne d... | Commande 'amarre detacher'.
| 62598fb4f9cc0f698b1c532f |
class BaseCache(object): <NEW_LINE> <INDENT> def cached(self, extra=None, timeout=None): <NEW_LINE> <INDENT> def decorator(func): <NEW_LINE> <INDENT> def get_cache_key(*args, **kwargs): <NEW_LINE> <INDENT> md5 = cross.md5() <NEW_LINE> md5.update('%s.%s' % (func.__module__, func.__name__)) <NEW_LINE> if extra is not Non... | Simple cache with time-based invalidation | 62598fb45166f23b2e2434a2 |
class InitFenetre(Fenetre): <NEW_LINE> <INDENT> def createFenetre(self): <NEW_LINE> <INDENT> self.setWindowTitle('Chargement') <NEW_LINE> self.resize(395, 460) <NEW_LINE> self.okButton = QtGui.QPushButton("Ok", parent=self) <NEW_LINE> self.okButton.setGeometry(QtCore.QRect(10, 250, 361, 41)) <NEW_LINE> self.progressBar... | fenetre d'initialisation | 62598fb463b5f9789fe85232 |
class ClearEntryMixin(object): <NEW_LINE> <INDENT> __gsignals__ = {'clear': ( gobject.SIGNAL_RUN_LAST|gobject.SIGNAL_ACTION, gobject.TYPE_NONE, ())} <NEW_LINE> def enable_clear_button(self): <NEW_LINE> <INDENT> self.set_icon_from_stock( gtk.ENTRY_ICON_SECONDARY, gtk.STOCK_CLEAR) <NEW_LINE> self.connect("icon-release", ... | A clear icon mixin supporting newer gtk.Entry or sexy.IconEntry /
a separate clear button as a fallback. | 62598fb4498bea3a75a57be8 |
class EnvironmentSettingsBuilderCompletenessTests(PythonAPICompletenessTestCase, unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def python_class(cls): <NEW_LINE> <INDENT> return EnvironmentSettings.Builder <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def java_class(cls): <NEW_LINE> <INDENT> return "org.... | Tests whether the Python :class:`EnvironmentSettings.Builder` is consistent with
Java `org.apache.flink.table.api.EnvironmentSettings$Builder`. | 62598fb4091ae35668704ce6 |
class AddAccessConfigInputSet(InputSet): <NEW_LINE> <INDENT> def set_AccessConfiguration(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'AccessConfiguration', value) <NEW_LINE> <DEDENT> def set_AccessToken(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'AccessToken', value) <NEW_LINE> <DEDENT>... | An InputSet with methods appropriate for specifying the inputs to the AddAccessConfig
Choreo. The InputSet object is used to specify input parameters when executing this Choreo. | 62598fb456ac1b37e63022b2 |
class Writer: <NEW_LINE> <INDENT> def __init__(self, file_type, file_handler, **kwargs): <NEW_LINE> <INDENT> _mapped_writer_class = { "csv": CsvWriter, "flat": FlatWriter, }[file_type] <NEW_LINE> self.writer = _mapped_writer_class(file_handler, **kwargs) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> retur... | writer factory | 62598fb44f88993c371f056f |
class Verb_a(Verb): <NEW_LINE> <INDENT> def __init__(self, name, base=None): <NEW_LINE> <INDENT> Verb.__init__(self, name, base) <NEW_LINE> if base is None: <NEW_LINE> <INDENT> self.base = self.name[:-2] <NEW_LINE> <DEDENT> self.endings = { '1s': 'ám', '2s': 'áš', '3s': 'á', '1p': 'áme', '2p': 'áte', '3p': 'ají', } <NE... | -A verbs (dĕlat, , , mít) | 62598fb416aa5153ce4005cb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.