code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Vulnerability(Base): <NEW_LINE> <INDENT> __tablename__ = 'vulnerability' <NEW_LINE> id = Column(String, primary_key=True, default=make_uuid) <NEW_LINE> cpe = Column(String, nullable=False) <NEW_LINE> cve = Column(String, nullable=False) <NEW_LINE> scan_vulns = relationship('VulnerabilitiesInScans') <NEW_LINE> def... | SQLAlchemy ScanVulnerability model | 62598efd7047854f4633dd40 |
class BufferedGzipFile(GzipFile): <NEW_LINE> <INDENT> MB = 2 ** 20 <NEW_LINE> SIZE = 2 * MB <NEW_LINE> @py3_data <NEW_LINE> def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None, **kwargs): <NEW_LINE> <INDENT> GzipFile.__init__(self, filename, mode, compresslevel, fileobj) <NEW_LINE> self._size = k... | A ``GzipFile`` subclass that buffers calls to ``read()`` and ``write()``.
This allows faster reads and writes of data to and from gzip-compressed
files at the cost of using more memory.
The default buffer size is 2MB.
``BufferedGzipFile`` is useful for loading large gzipped pickle objects
as well as writing large enc... | 62598efdbf627c535bcafded |
class TrafficInfractionMessage(erdos.Message): <NEW_LINE> <INDENT> def __init__(self, infraction_type: TrafficInfractionType, location: Location, timestamp: Timestamp): <NEW_LINE> <INDENT> super(TrafficInfractionMessage, self).__init__(timestamp, None) <NEW_LINE> if not isinstance(infraction_type, TrafficInfractionType... | Message class to be used to send traffic infraction events.
Args:
infraction_type (:py:class:`.TrafficInfractionType`): The type of the
infraction that occurred.
location (:py:class:`pylot.utils.Location`): The location where the
infraction occurred.
timestamp (:py:class:`erdos.timestamp.Ti... | 62598efd3346ee7daa336b23 |
class ImportFromHEDialogTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.dialog = ImportFromHEDialog(None) <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.dialog = None <NEW_LINE> <DEDENT> def test_dialog_ok(self): <NEW_LINE> <INDENT> button = self.dialog.button_bo... | Test dialog works. | 62598efd9c8ee8231303f619 |
class IRedturtlePatternsLayer(IDefaultBrowserLayer): <NEW_LINE> <INDENT> pass | Marker interface that defines a browser layer. | 62598efd796e427e5384d114 |
class FortranFile: <NEW_LINE> <INDENT> def __init__( self, filename=None, macros=None, readfile=True, cpp_includes=None, use_preprocessor=True, ): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.uses = None <NEW_LINE> self.modules = None <NEW_LINE> self.depends_on = None <NEW_LINE> if readfile: <NEW_LINE> ... | The modules and dependencies of a Fortran source file
Args:
filename (str): Source file
macros (iterable): Dict of preprocessor macros to be expanded
readfile (bool): Read and process the file [True]
cpp_includes (list of str): List of directories to add to preprocessor search path
use_preprocessor... | 62598efd60cbc95b06362caa |
@reversion.register() <NEW_LINE> class GroupState(SafeDeleteModel, RevisionModelMixin): <NEW_LINE> <INDENT> group = OneToOneField(Group, null=False, on_delete=models.CASCADE) <NEW_LINE> data = JSONField(null=False, default=group_state_data_default) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> app_label = "rescape_region" | Group state reference a single Group.
The json structure of data should be identical to that of UserState, but maybe in the future will
have additional attributes that deal with groups | 62598efdd486a94d0ba2a943 |
class GetTeamByShortname(Choreography): <NEW_LINE> <INDENT> def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/Kiva/Teams/GetTeamByShortname') <NEW_LINE> <DEDENT> def new_input_set(self): <NEW_LINE> <INDENT> return GetTeamByShortnameInputSet() <NEW_LINE> <DEDEN... | Create a new instance of the GetTeamByShortname Choreography. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied. | 62598efda219f33f346c51a8 |
class MicroprobeDMAFormatError(MicroprobeError): <NEW_LINE> <INDENT> pass | MicroprobeDMAFormatError Exception | 62598efd44b2445a339b5e2c |
class JsSpider(): <NEW_LINE> <INDENT> def __init__(self, url): <NEW_LINE> <INDENT> self._driver = webdriver.Chrome() <NEW_LINE> self._driver.get(url) <NEW_LINE> self._url = url <NEW_LINE> self._soup = None <NEW_LINE> <DEDENT> def scroll_bottom(self): <NEW_LINE> <INDENT> self._driver.execute_script("window.scrollTo(0, d... | A spider that can scape the js rendered page, it might takes longer
compare with the static Spider :O | 62598efd2ae34c7f260a9a5d |
class ExpectLog(logging.Filter): <NEW_LINE> <INDENT> def __init__(self, logger, regex, required=True): <NEW_LINE> <INDENT> if isinstance(logger, basestring_type): <NEW_LINE> <INDENT> logger = logging.getLogger(logger) <NEW_LINE> <DEDENT> self.logger = logger <NEW_LINE> self.regex = re.compile(regex) <NEW_LINE> self.req... | Context manager to capture and suppress expected log output.
Useful to make tests of error conditions less noisy, while still
leaving unexpected log entries visible. *Not thread safe.*
The attribute ``logged_stack`` is set to true if any exception
stack trace was logged.
Usage::
with ExpectLog('tornado.applica... | 62598efd4428ac0f6e656ec7 |
class MigrationScript(MigrateOperation): <NEW_LINE> <INDENT> def __init__( self, rev_id, upgrade_ops, downgrade_ops, message=None, imports=None, head=None, splice=None, branch_label=None, version_path=None, depends_on=None): <NEW_LINE> <INDENT> self.rev_id = rev_id <NEW_LINE> self.message = message <NEW_LINE> self.impo... | represents a migration script.
E.g. when autogenerate encounters this object, this corresponds to the
production of an actual script file.
A normal :class:`.MigrationScript` object would contain a single
:class:`.UpgradeOps` and a single :class:`.DowngradeOps` directive.
.. seealso::
:ref:`customizing_revision` | 62598efd377c676e912f6221 |
class ExpansionToken(Token): <NEW_LINE> <INDENT> def __init__(self, prefix, first): <NEW_LINE> <INDENT> self.prefix = prefix <NEW_LINE> self.first = first <NEW_LINE> <DEDENT> def scan(self, scanner): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def run(self, interpreter, locals): <NEW_LINE> <INDENT> pass | A token that involves an expansion. | 62598efd3d592f4c4edb9869 |
class CreateList(generics.CreateAPIView): <NEW_LINE> <INDENT> serializer_class = ListSerializer | Acceptes: POST
201: created | 62598efd71ff763f4b5e60dc |
class CachedStoreFactory(BaseStore): <NEW_LINE> <INDENT> def __init__(self, local_store, remote_store, cache=None): <NEW_LINE> <INDENT> self.local_store = local_store <NEW_LINE> self.remote_store = remote_store <NEW_LINE> self.cache = cache <NEW_LINE> <DEDENT> def add_to_cache(self, key): <NEW_LINE> <INDENT> if self.ca... | A Factory to compose custom cached Stores
| 62598efd76e4537e8c3edf36 |
class TestGETTaxationItemType(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testGETTaxationItemType(self): <NEW_LINE> <INDENT> pass | GETTaxationItemType unit test stubs | 62598efdaad79263cf42d18a |
class V1FCVolumeSource(object): <NEW_LINE> <INDENT> def __init__(self, target_ww_ns=None, lun=None, fs_type=None, read_only=None): <NEW_LINE> <INDENT> self.swagger_types = { 'target_ww_ns': 'list[str]', 'lun': 'int', 'fs_type': 'str', 'read_only': 'bool' } <NEW_LINE> self.attribute_map = { 'target_ww_ns': 'targetWWNs',... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598efd099cdd3c63674894 |
class YozakuraTimeoutError(YozakuraException, TimeoutError): <NEW_LINE> <INDENT> pass | Raised when a Timeout occurs. | 62598efd3346ee7daa336b24 |
class CioEncoder(LanguageEncoder): <NEW_LINE> <INDENT> def __init__(self, w=128, h=128, cacheDir="./cache", verbosity=0): <NEW_LINE> <INDENT> if 'CORTICAL_API_KEY' not in os.environ: <NEW_LINE> <INDENT> print ("Missing CORTICAL_API_KEY environment variable. If you have a " "key, set it with $ export CORTICAL_API_KEY=ap... | A language encoder using the Cortical.io API.
The encoder queries the Cortical.io REST API via the cortipy module, which
returns data in the form of "fingerprints". These representations are
converted to binary SDR arrays with this Cio encoder. | 62598efd26068e7796d4b2d5 |
class SessionRunningException(Exception): <NEW_LINE> <INDENT> pass | Exception
| 62598efd9c8ee8231303f61a |
class LibrosaAudioProcessor: <NEW_LINE> <INDENT> def __init__(self, type, sampling_rate, max_wave_value, sfft={'filter_length': 1024, 'hop_length': 256, 'win_length': 1024}, mel=None): <NEW_LINE> <INDENT> self.type = type <NEW_LINE> self.sampling_rate = sampling_rate <NEW_LINE> self.max_wave_value = max_wave_value <NEW... | Simple data processors | 62598efd9f28863672817170 |
class ExtraOrderItemPriceField(models.Model): <NEW_LINE> <INDENT> order_item = models.ForeignKey(OrderItem, verbose_name=_('Order item')) <NEW_LINE> label = models.CharField(max_length=255, verbose_name=_('Label')) <NEW_LINE> value = CurrencyField(verbose_name=_('Amount')) <NEW_LINE> data = JSONField(null=True, blank=T... | This will make Cart-provided extra price fields persistent since we want
to "snapshot" their statuses at the time when the order was made | 62598efd379a373c97d97975 |
class Solution: <NEW_LINE> <INDENT> def subsets(self, nums): <NEW_LINE> <INDENT> nums = sorted(nums) <NEW_LINE> combinations = [] <NEW_LINE> self.dfs(nums,0,[],combinations) <NEW_LINE> return combinations <NEW_LINE> <DEDENT> def dfs(self, nums, index, combination, combinations): <NEW_LINE> <INDENT> combinations.append(... | @param nums: A set of numbers
@return: A list of lists | 62598efd7d847024c075ad45 |
class Transaction: <NEW_LINE> <INDENT> def __init__(self, sender, recipient, amount): <NEW_LINE> <INDENT> self.sender = sender <NEW_LINE> self.recipient = recipient <NEW_LINE> self.amount = amount <NEW_LINE> self.is_intershard = self._is_intershard() <NEW_LINE> self.jsontype = "transaction" <NEW_LINE> <DEDENT> def _is_... | :sender: <str> sender's account address
:recipient: <str> recipient's account address
:amount: <float> amount of money to send | 62598efda219f33f346c51aa |
class Plot(_View): <NEW_LINE> <INDENT> pass | Plot is a View parameter that allows displaying bokeh plots as output. | 62598efd50812a4eaa6200a8 |
class SphinxItemDefinition: <NEW_LINE> <INDENT> def __init__(self, items: Dict = None): <NEW_LINE> <INDENT> if not items: <NEW_LINE> <INDENT> items = {} <NEW_LINE> <DEDENT> self.items = items <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.as_string() <NEW_LINE> <DEDENT> def as_string(self): <NEW... | A sphinx list like this:
item1
description of item1
item2
description of item2 | 62598efd97e22403b3839863 |
class RefuseDemandeAPIView(APIView): <NEW_LINE> <INDENT> permission_classes = [perm.IsGroupCreatorPatch] <NEW_LINE> def patch(self, *_args, **kwargs): <NEW_LINE> <INDENT> existe = DemandeInscription.objects.filter(id=kwargs.get('demande_id')).filter( groupe__id=kwargs.get('groupe_id')).count() <NEW_LINE> if existe != 0... | Vue permettant à un createur de groupe de refuser une demande d'inscription | 62598efdbe383301e025215d |
class BaseFormatterLocator: <NEW_LINE> <INDENT> def __init__(self, values=None, number=None, spacing=None, format=None): <NEW_LINE> <INDENT> if (values, number, spacing).count(None) < 2: <NEW_LINE> <INDENT> raise ValueError("At most one of values/number/spacing can be specifed") <NEW_LINE> <DEDENT> if values is not Non... | A joint formatter/locator | 62598efdad47b63b2c5a6194 |
class TLSInsufficientSecurity(TLSProtocolException): <NEW_LINE> <INDENT> pass | Parameters selected by user are too weak | 62598efd4c34283577618c64 |
class First: <NEW_LINE> <INDENT> operator = [('+', operator.add), ('-', operator.sub), ('*', operator.mul), ('/', operator.truediv)] <NEW_LINE> for i in range(200): <NEW_LINE> <INDENT> a = random.randint(1, 100) <NEW_LINE> b = random.randint(1, 100) <NEW_LINE> op, fn = random.choice(operator) <NEW_LINE> print("{}{}{}={... | def __init__(self, operator):
self.operator = operator | 62598efd7cff6e4e811b4361 |
class SearchProblem: <NEW_LINE> <INDENT> def getStartState(self): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def isGoalState(self, state): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def getSuccessors(self, state): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def... | This class outlines the structure of a search problem, but doesn't
implement any of the methods (in object-oriented terminology: an
abstract class).
You do not need to change anything in this class, ever. | 62598efd283ffb24f3cf2227 |
class test_ClusterRepository(baseClusterTestClass): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> import os.path <NEW_LINE> super(test_ClusterRepository, self).setUp() <NEW_LINE> self.clusterRepository = comoonics.cluster.getClusterRepository(os.path.join(self._testpath, "cluster2.conf")) <NEW_LINE> <DEDENT>... | Methods from RedhatClusterRepository | 62598efdf9cc0f698b1c478d |
@ddt.ddt <NEW_LINE> class TestAPIUtils(VideoPipelineIntegrationMixin, TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.pipeline_integration = self.create_video_pipeline_integration() <NEW_LINE> self.user = UserFactory(username=self.pipeline_integration.service_username) <NEW_LINE> self.oauth_cli... | Tests for API Utils. | 62598efd71ff763f4b5e60de |
class NALU(nn.Module): <NEW_LINE> <INDENT> def __init__(self, num_layers, in_dim, hidden_dim, out_dim): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.num_layers = num_layers <NEW_LINE> self.in_dim = in_dim <NEW_LINE> self.hidden_dim = hidden_dim <NEW_LINE> self.out_dim = out_dim <NEW_LINE> layers = [] <NEW_LIN... | A stack of NAC layers.
Attributes:
num_layers: the number of NAC layers.
in_dim: the size of the input sample.
hidden_dim: the size of the hidden layers.
out_dim: the size of the output. | 62598efdaad79263cf42d18c |
class getManifestForFrame(ChromeCommand): <NEW_LINE> <INDENT> def __init__(self, frameId: "Page.FrameId"): <NEW_LINE> <INDENT> self.frameId = frameId | Returns manifest URL for document in the given frame. | 62598efd099cdd3c63674895 |
class Column(object): <NEW_LINE> <INDENT> def __init__(self, name, getter=None, title=None, options=None): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> raise ValueError('name is required') <NEW_LINE> <DEDENT> if getter: <NEW_LINE> <INDENT> if callable(getter): <NEW_LINE> <INDENT> self.getter = getter <NEW_LINE>... | Simple struct that describes a single DataGrid column.
Column has:
- a name, which allows to uniquely identify a column in a DataGrid
- a getter, which is used to extract the field's value
- a title, which is displayed in the table's header
- options, which is a way to carry arbitrary user-defined data | 62598efdf548e778e5969f03 |
class IconNotFoundException(Exception): <NEW_LINE> <INDENT> pass | Icon not found Exception. | 62598efd9c8ee8231303f61b |
class CondorJob (cpi.job.Job): <NEW_LINE> <INDENT> def __init__(self, api, adaptor): <NEW_LINE> <INDENT> _cpi_base = super(CondorJob, self) <NEW_LINE> _cpi_base.__init__(api, adaptor) <NEW_LINE> <DEDENT> @SYNC_CALL <NEW_LINE> def init_instance(self, job_info): <NEW_LINE> <INDENT> self.jd = job_info["job_description"] <... | implements cpi.job.Job
| 62598efd796e427e5384d118 |
class Getter(typing.Generic[TextMapPropagatorT]): <NEW_LINE> <INDENT> def get(self, carrier: TextMapPropagatorT, key: str) -> typing.List[str]: <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def keys(self, carrier: TextMapPropagatorT) -> typing.List[str]: <NEW_LINE> <INDENT> raise NotImplementedErr... | This class implements a Getter that enables extracting propagated
fields from a carrier | 62598efd379a373c97d97977 |
class LeaderboardView(ListAPIView): <NEW_LINE> <INDENT> serializer_class = LeaderboardSerializer <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return Level.objects.filter(is_locked=False) | Retrieve Leaderboard as a list. | 62598efd3317a56b869bda23 |
class RichString(object): <NEW_LINE> <INDENT> def __init__(self, *segments): <NEW_LINE> <INDENT> self.segments = segments <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> if not self.segments: <NEW_LINE> <INDENT> return "empty_string" <NEW_LINE> <DEDENT> return ' + '.join(repr(s) for s in self.segments) <NEW... | A sequence of segments where each segment can have its own style. | 62598efda8370b77170eed62 |
class CuLocation(models.Model): <NEW_LINE> <INDENT> cu = models.ForeignKey(CalibrationUnit, on_delete=models.CASCADE) <NEW_LINE> date_received = models.DateTimeField('date received', default=timezone.now) <NEW_LINE> geo_loc = models.CharField('Location', max_length=200, default="") | This model stores information about Calibration Unit location history | 62598efd60cbc95b06362cae |
class PkgPackages(FactBase): <NEW_LINE> <INDENT> command = 'pkg info || pkg_info || true' <NEW_LINE> regex = r'^([a-zA-Z0-9_\-\+]+)\-([0-9a-z\.]+)' <NEW_LINE> default = dict <NEW_LINE> def process(self, output): <NEW_LINE> <INDENT> return parse_packages(self.regex, output) | Returns a dict of installed pkg packages:
.. code:: python
{
'package_name': ['version'],
} | 62598efdfff4ab517ebcc150 |
class NinjaAnt(Ant): <NEW_LINE> <INDENT> name = 'Ninja' <NEW_LINE> blocks_path = False <NEW_LINE> implemented = True <NEW_LINE> food_cost = 6 <NEW_LINE> damage = 1 <NEW_LINE> def action(self, colony): <NEW_LINE> <INDENT> copy_bees = copy.copy(self.place.bees) <NEW_LINE> for bee in copy_bees: <NEW_LINE> <INDENT> bee.red... | NinjaAnt is an Ant which does not block the path and does 1 damage to
all Bees in the exact same Place. | 62598efd4527f215b58e887a |
class DodgeDelegate(ChargeDelegate): <NEW_LINE> <INDENT> def __init__(self, dodgeType, message): <NEW_LINE> <INDENT> self.turns = 2 <NEW_LINE> self.turnToAttack = 1 <NEW_LINE> self.message = message <NEW_LINE> self.turnOn = 0 <NEW_LINE> self.dodgeType = dodgeType <NEW_LINE> <DEDENT> def applyEffect(self, user, target, ... | Represents an attack that dodges one turn and then attacks the next | 62598efd2ae34c7f260a9a61 |
class OracleObjectFactory(RhelObjectFactory): <NEW_LINE> <INDENT> pass | Oracle object factory class. | 62598efd442bda511e95addf |
class AbstractMonitor(metaclass=ABCMeta): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def __taskset_event__(self, taskset, event): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def __taskset_start__(self, taskset): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def ... | Abstract monitor class. | 62598efd377c676e912f6223 |
class TestFileTypeR(TempDirMixin, ParserTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestFileTypeR, self).setUp() <NEW_LINE> for file_name in [u'foo', u'bar']: <NEW_LINE> <INDENT> file = open(os.path.join(self.temp_dir, file_name), 'w') <NEW_LINE> file.write(file_name) <NEW_LINE> file.close... | Test the FileType option/argument type for reading files | 62598efd9f28863672817173 |
class UserSegment: <NEW_LINE> <INDENT> bearing = 0 <NEW_LINE> threshold_score_to_report = DEFAULT_MINIMUM_SCORE <NEW_LINE> def __init__(self, segment: Dict): <NEW_LINE> <INDENT> self.strava_id = segment["strava_id"] <NEW_LINE> self.name_str = segment["name"] <NEW_LINE> self.start_latlng = segment["start_latlng"] <NEW_L... | Segment with additional derived/user data. | 62598efd5fdd1c0f98e5c924 |
@admin.register(Card) <NEW_LINE> class CardAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> search_fields = ["name"] <NEW_LINE> inlines = [CardFaceInline, CardPrintingInline] | Admin for Card | 62598efd76e4537e8c3edf3a |
class SimpleEditor(Editor): <NEW_LINE> <INDENT> ok_color = DropColor <NEW_LINE> def init(self, parent): <NEW_LINE> <INDENT> if self.factory.readonly: <NEW_LINE> <INDENT> self.control = QtGui.QLineEdit(self.str_value) <NEW_LINE> self.control.setReadOnly(True) <NEW_LINE> self.set_tooltip() <NEW_LINE> <DEDENT> else: <NEW_... | Simple style of drop editor, which displays a read-only text field that
contains the string representation of the object trait's value. | 62598efd4f88993c371ef9a8 |
class FeedGenerator(): <NEW_LINE> <INDENT> def __init__(self, title, link, description): <NEW_LINE> <INDENT> self.feed = Atom1Feed( title = title, link = link, description = description, language=u"en", ) <NEW_LINE> <DEDENT> def add(self, **event): <NEW_LINE> <INDENT> self.feed.add_item(**event) <NEW_LINE> <DEDENT> def... | A class that wraps the feedgenerator (creates an Atom feed). | 62598efd099cdd3c63674896 |
class Pipeline(GraphModule): <NEW_LINE> <INDENT> def __init__(self, mode, name='Pipeline', subgraphs_by_features=None, shuffle=True, num_epochs=None): <NEW_LINE> <INDENT> super(Pipeline, self).__init__( mode=mode, name=name, module_type=GraphModule.ModuleType.PIPELINE) <NEW_LINE> self.subgraphs_by_features = subgraphs_... | Abstract InputPipeline class. All input pipelines must inherit from this.
An InputPipeline defines how data is read, parsed, and separated into
features and labels.
Args:
mode: `str`, Specifies if this training, evaluation or prediction. See `Modes`.
name: `str`, name to give for this pipeline.
subgraphs_b... | 62598efd4a966d76dd5ed853 |
class ResNet(nn.Module): <NEW_LINE> <INDENT> def __init__(self, ): <NEW_LINE> <INDENT> super(ResNet, self).__init__() <NEW_LINE> model = models.resnet34(pretrained=True) <NEW_LINE> del model.fc <NEW_LINE> del model.layer4 <NEW_LINE> self.model = model <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> x = se... | EffNet --> ResNet | 62598efd9f28863672817174 |
class StopResourceRelationships(object): <NEW_LINE> <INDENT> swagger_types = { 'parent_station': 'StopResourceRelationshipsParentStation' } <NEW_LINE> attribute_map = { 'parent_station': 'parent_station' } <NEW_LINE> def __init__(self, parent_station=None): <NEW_LINE> <INDENT> self._parent_station = None <NEW_LINE> sel... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598efdec188e330fdf722c |
class FreqDist(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._counts = Counter() <NEW_LINE> self._total = 0 <NEW_LINE> super(FreqDist, self).__init__() <NEW_LINE> <DEDENT> def inc(self, item, amount=1): <NEW_LINE> <INDENT> self._total += amount <NEW_LINE> self._counts[item] += amount <NEW_LI... | A frequency distribution.
While this could more simply inherit from defaultdict/Counter, the
underlying implementation is intentionally abstracted to allow for
more complex behavior in the future.
>>> f = FreqDist()
>>> f.freq('a')
Traceback (most recent call last):
ValueError: No events counted yet
>>> f.total_count... | 62598efd5fdd1c0f98e5c925 |
class ZoneoutWrapper(tf.contrib.rnn.RNNCell): <NEW_LINE> <INDENT> def __init__(self, cell, zoneout_prob, is_training=True, seed=None): <NEW_LINE> <INDENT> if not isinstance(cell, tf.contrib.rnn.RNNCell): <NEW_LINE> <INDENT> raise TypeError("The parameter cell is not an RNNCell.") <NEW_LINE> <DEDENT> if (isinstance(zone... | Operator adding zoneout to all states (states+cells) of the given cell. | 62598efd2c8b7c6e89bd2142 |
class LevelIndex(ListIndex): <NEW_LINE> <INDENT> def key_from_record(self, rec): <NEW_LINE> <INDENT> with warnings.catch_warnings(): <NEW_LINE> <INDENT> warnings.simplefilter("ignore", DeprecationWarning) <NEW_LINE> return rec["level"] <NEW_LINE> <DEDENT> <DEDENT> def details_from_record(self, rec): <NEW_LINE> <INDENT>... | Index for levels, as they come out of the database
The constructor syntax is: ``LevelIndex(shared=True, frozen=False, start=None)``.
The index saves all levels as dballe.Level tuples, in the same order
as they come out of the database. | 62598efddc8b845886d51f47 |
class Client(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.response_head = '' <NEW_LINE> <DEDENT> def start_response(self, resp_first_line, resp_head): <NEW_LINE> <INDENT> self.response_head += resp_first_line <NEW_LINE> for key, val in resp_head: <NEW_LINE> <INDENT> self.response_head += '\... | 对每个客户端套接字分别进行处理 | 62598efdbe383301e0252161 |
class PlayerTestCase(LoggedInUserTestCase): <NEW_LINE> <INDENT> @setup <NEW_LINE> def _queue_tracks(self): <NEW_LINE> <INDENT> r = random.Random() <NEW_LINE> sample_tracks_copy = sample_tracks <NEW_LINE> r.shuffle(sample_tracks_copy) <NEW_LINE> for track in sample_tracks_copy[:5]: <NEW_LINE> <INDENT> response = self.ap... | A test case for the player (player.py) functions, mostly the endpoints just to make sure they work. | 62598efd4428ac0f6e656ecd |
class Production(object): <NEW_LINE> <INDENT> DEBUG = False <NEW_LINE> TESTING = False <NEW_LINE> SQLALCHEMY_DATABASE_URI = f"mysql://{os.environ.get('MYSQL_USER')}:{os.environ.get('MYSQL_PASSWORD')}@svc-mysql/libarary" <NEW_LINE> JWT_SECRET_KEY = os.getenv("JWT_SECRET_KEY") <NEW_LINE> OIDC_CLIENT_SECRETS = "manifests/... | Production environment configuration | 62598efd3d592f4c4edb986f |
class Event_Periodical(Event_Generic): <NEW_LINE> <INDENT> def __init__(self, t, repeat, callback = None, description = None, parameters = [], priority = Event_Generic.PRIO_NORMAL, mute = False, threaded_callback = False): <NEW_LINE> <INDENT> Event_Generic.__init__(self, t, callback = callback, description = descriptio... | This class is used to implement events that happen each period of time | 62598efda8370b77170eed65 |
class ChatSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> participants = serializers.StringRelatedField(many=True) <NEW_LINE> messages = serializers.PrimaryKeyRelatedField( queryset=Message.objects.all(), many=True ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Chat <NEW_LINE> fields = "__all__" | Chat serializer | 62598efd23849d37ff84fa40 |
class SearchEvents(Choreography): <NEW_LINE> <INDENT> def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/Google/Calendar/SearchEvents') <NEW_LINE> <DEDENT> def new_input_set(self): <NEW_LINE> <INDENT> return SearchEventsInputSet() <NEW_LINE> <DEDENT> def _make_... | Create a new instance of the SearchEvents Choreography. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied. | 62598efd67a9b606de544951 |
class GradSliceChecker(object): <NEW_LINE> <INDENT> def __init__(self, test, sess, var, varnp): <NEW_LINE> <INDENT> self.test = test <NEW_LINE> self.sess = sess <NEW_LINE> self.val = var * var <NEW_LINE> self.var = var <NEW_LINE> self.varnp = varnp <NEW_LINE> <DEDENT> def __getitem__(self, spec): <NEW_LINE> <INDENT> sl... | Tests that we can compute a gradient for var^2. | 62598efd3346ee7daa336b27 |
class Error(Exception): <NEW_LINE> <INDENT> pass | Base error class
Args:
Exception (Exception): base Exception class | 62598efd1f5feb6acb1615d6 |
class FileSystemTree(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.root = Node("/") <NEW_LINE> self.now = self.root <NEW_LINE> <DEDENT> def mkdir(self, name): <NEW_LINE> <INDENT> if name[-1] != "/": <NEW_LINE> <INDENT> name += "/" <NEW_LINE> <DEDENT> node = Node(name) <NEW_LINE> self.now.chi... | 模拟文件系统 | 62598efda05bb46b384891f7 |
class Mysovskih(object): <NEW_LINE> <INDENT> def __init__(self, symbolic=False): <NEW_LINE> <INDENT> frac = sympy.Rational if symbolic else lambda x, y: x / y <NEW_LINE> sqrt = numpy.vectorize(sympy.sqrt) if symbolic else numpy.sqrt <NEW_LINE> pi = sympy.pi if symbolic else numpy.pi <NEW_LINE> pm_ = numpy.array([+1, -1... | I.P. Mysovskih,
On the construction of cubature formulas for the simplest regions,
Z. Vychisl. Mat. i. Mat. Fiz. 4, 3-14, 1964. | 62598efd5fdd1c0f98e5c927 |
class TestResponse(unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> cls.response = interface.Response() <NEW_LINE> <DEDENT> def test___init__(self): <NEW_LINE> <INDENT> actual = self.response.outputSpeech <NEW_LINE> self.assertIsInstance(actual, interface.OutputSp... | Test Response class. | 62598efd656771135c48800b |
class SolutionEditorField(EditorField): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(SolutionEditorField, self).__init__(*args, **kwargs) <NEW_LINE> self.length_error_template_singular = 'solution must be > %d character' <NEW_LINE> self.length_error_template_plural = 'solution must... | Editor field for problems | 62598efdff9c53063f518fe3 |
class CommentView(grok.View): <NEW_LINE> <INDENT> grok.context(IComment) <NEW_LINE> grok.require('zope2.View') <NEW_LINE> grok.name('comment-view') <NEW_LINE> def get_article_url(self): <NEW_LINE> <INDENT> unwanted = ['type', 'comment', 'id'] <NEW_LINE> getArgs = '' <NEW_LINE> for name in self.request.form: <NEW_LINE> ... | View for displaying a comment, loaded with AJAX from the @@articles
view. | 62598efd4428ac0f6e656ecf |
class DiGraph(object): <NEW_LINE> <INDENT> def __init__(self, n_nodes, n_edges, p_indptr, p_indices, s_indptr, s_indices): <NEW_LINE> <INDENT> self.n_nodes = n_nodes <NEW_LINE> self.n_edges = n_edges <NEW_LINE> self.p_indptr = p_indptr <NEW_LINE> self.p_indices = p_indices <NEW_LINE> self.s_indptr = s_indptr <NEW... | Simple directed graph.
n_nodes - # nodes
n_edges - # edges
p_indptr - index pointers for predecessors
p_indices - indices of predecessors
s_indptr - index pointers for successors
s_indices - indices for successors | 62598efd66673b3332c2ed33 |
class OperatorFlightDataGenerator(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.fake = Faker() <NEW_LINE> <DEDENT> def generate_serial_number(self): <NEW_LINE> <INDENT> return str(uuid.uuid4()) <NEW_LINE> <DEDENT> def generate_registration_number(self, prefix='CHE'): <NEW_LINE> <INDENT> registrati... | A class to generate fake data detailing operator name, operation name and operator location, it can be customized for locales and locations | 62598efd3d592f4c4edb9871 |
class RelationViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Relation.objects.all() <NEW_LINE> serializer_class = RelationSerializer <NEW_LINE> @list_route(methods=['get'], renderer_classes=[renderers.StaticHTMLRenderer], url_path='refresh-relations') <NEW_LINE> def refresh_relations(self, request, *arg... | API endpoint that allows Relations to be viewed or edited. | 62598efd9f28863672817177 |
class StreamBusMonitor(BusMonitor): <NEW_LINE> <INDENT> _signals = ["valid", "data"] <NEW_LINE> @cocotb.coroutine <NEW_LINE> def _monitor_recv(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> yield RisingEdge(self.clock) <NEW_LINE> yield ReadOnly() <NEW_LINE> if self.bus.valid.value: <NEW_LINE> <INDENT> self.... | streaming bus monitor | 62598efd7b180e01f3e48508 |
class ConfigurationLocation(ModelSQL, ValueMixin): <NEW_LINE> <INDENT> __name__ = 'stock.configuration.location' <NEW_LINE> shipment_internal_transit = shipment_internal_transit <NEW_LINE> @classmethod <NEW_LINE> def __register__(cls, module_name): <NEW_LINE> <INDENT> TableHandler = backend.get('TableHandler') <NEW_LIN... | Stock Configuration Location | 62598efd5fdd1c0f98e5c928 |
class WindowModelStub(AutoPropGObjectMixin, gobject.GObject): <NEW_LINE> <INDENT> _property_names = [] <NEW_LINE> _dynamic_property_names = [] <NEW_LINE> _internal_property_names = [] <NEW_LINE> _MODELTYPE = "Stub" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(WindowModelStub, self).__init__() <NEW_L... | Stub for all window models | 62598efd4f88993c371ef9aa |
class command_received(Event): <NEW_LINE> <INDENT> pass | Event fired whenever a command is parsed from new messages. | 62598efd099cdd3c63674898 |
class ConfigItem(object): <NEW_LINE> <INDENT> def __init__(self, name, namespace="config", default=None, required=False): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.namespace = namespace <NEW_LINE> self.default = default <NEW_LINE> self.required = required <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <I... | The configuration item which may be bound with a instance.
:param name: the property name.
:param namespace: optional. the name of the attribute which contains all
configuration nested in the instance.
:param default: optional. the value which be provided while the
configuration item ... | 62598efdf548e778e5969f09 |
class Scoreboard() : <NEW_LINE> <INDENT> def __init__(self, ai_settings, screen, stats) : <NEW_LINE> <INDENT> self.screen = screen <NEW_LINE> self.screen_rect = screen.get_rect() <NEW_LINE> self.ai_settings = ai_settings <NEW_LINE> self.stats = stats <NEW_LINE> self.text_color = (30, 30, 30) <NEW_LINE> self.font = pyga... | A class to report scoring information | 62598efdbe7bc26dc9251325 |
class NotFoundError(Exception): <NEW_LINE> <INDENT> pass | Exception raised when a referenced object does not exist.
category: Exception Classes | 62598efd9c8ee8231303f61e |
class SonarKeyboardAgent(SonarAgent): <NEW_LINE> <INDENT> WEST_KEY = 'a' <NEW_LINE> EAST_KEY = 'd' <NEW_LINE> NORTH_KEY = 'w' <NEW_LINE> SOUTH_KEY = 's' <NEW_LINE> def __init__( self, index = 0 ): <NEW_LINE> <INDENT> self.lastMove = Directions.STOP <NEW_LINE> self.index = index <NEW_LINE> self.keys = [] <NEW_LINE> <D... | An agent controlled by the keyboard. | 62598efd3346ee7daa336b28 |
class ComplexOutput(inout.ComplexOutput): <NEW_LINE> <INDENT> def __init__(self, identifier, formats, output_format=None, encoding="UTF-8", schema=None): <NEW_LINE> <INDENT> inout.ComplexOutput.__init__(self) <NEW_LINE> self.identifier = identifier <NEW_LINE> self.formats = formats <NEW_LINE> self._schema = None <NEW_L... | :param identifier: The name of this output.
:param formats: Possible output formats for this output.
Should be list of :class:`~Format` object.
:param output_format: Required format for this output.
Should be :class:`~Format` object.
:param encoding: The encoding of this input or requested for this outp... | 62598efd5fcc89381b2655eb |
class HttpErrorsMixin(object): <NEW_LINE> <INDENT> def test_it_should_return_user_error_codes(self): <NEW_LINE> <INDENT> expected_status = 404 <NEW_LINE> self.server.data['response_status'] = expected_status <NEW_LINE> r = self.request(method='GET', url=self.default_url) <NEW_LINE> assert_that(r.status_code, is_(expect... | Tests HTTP server errors | 62598efd5fc7496912d47734 |
class UserFilter(unittest.TestCase): <NEW_LINE> <INDENT> def test_emailfilter(self): <NEW_LINE> <INDENT> self.assertNotSubstring('me@the.net', wb.userfilter('me@the.net')) <NEW_LINE> self.assertNotSubstring('me@the.net', wb.userfilter('Me <me@the.net>')) <NEW_LINE> <DEDENT> def test_emailfilter_split(self): <NEW_LINE> ... | test commit user names filtering, should be safe from complete
email addresses and split user/email into separate HTML instances | 62598efd60cbc95b06362cb4 |
class testMeetingCategory(MeetingSeraingTestCase, mcmc): <NEW_LINE> <INDENT> pass | Tests the MeetingCategory class methods. | 62598efda219f33f346c51b2 |
class Bgp_Not_Selected_BestpathIdentity(object): <NEW_LINE> <INDENT> _prefix = 'oc-bgprib-types' <NEW_LINE> _revision = '2016-04-11' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def _meta_info(): <NEW_LINE> <INDENT> from ydk.models.openconfig._meta import _opencon... | Base identity for indicating reason a route was was not
selected by BGP route selection algorithm | 62598efdfff4ab517ebcc156 |
class RegistrationSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ('username', 'password', 'email') | Serializer of Registering User. It should only contains some information. | 62598efd44b2445a339b5e31 |
class ActivitySerializer(BaseSerializer): <NEW_LINE> <INDENT> def dumps(self, activity): <NEW_LINE> <INDENT> self.check_type(activity) <NEW_LINE> activity_time = '%.6f' % datetime_to_epoch(activity.time) <NEW_LINE> parts = [activity.actor_id, activity.verb.id, activity.object_id, activity.target_id or 0] <NEW_LINE> ext... | Serializer optimized for taking as little memory as possible to store an
Activity
Serialization consists of 5 parts
- actor_id
- verb_id
- object_id
- target_id
- extra_context (pickle)
None values are stored as 0 | 62598efdcc0a2c1114479987 |
class FPGA_PID: <NEW_LINE> <INDENT> def __init__(self, in_channel, out_channel, set_point, k_proportional, k_integral, k_derivative): <NEW_LINE> <INDENT> self.channels = (in_channel, out_channel) <NEW_LINE> self.set_point(set_point) <NEW_LINE> self.proportional(k_proportional) <NEW_LINE> self.integral(k_integral) <NEW_... | Interface with the buffers that control the Red Pitaya's FPGA PID
implementation. | 62598efd3d592f4c4edb9873 |
class Block: <NEW_LINE> <INDENT> def __init__(self, id, data=0): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> def __eq__(self, rhs): <NEW_LINE> <INDENT> return (self.id, self.data) == (rhs.id, rhs.data) <NEW_LINE> <DEDENT> def withData(self, data): <NEW_LINE> <INDENT> return Block(se... | Minecraft PI block description. Can be sent to Minecraft.setBlock/s | 62598efde5267d203ee6a287 |
class UserMembershipSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> profile_configuration = deepcopy(settings.ACCOUNT_VISIBILITY_CONFIGURATION) <NEW_LINE> profile_configuration['shareable_fields'].append('url') <NEW_LINE> profile_configuration['public_fields'].append('url') <NEW_LINE> user = ExpandableFiel... | Serializes CourseTeamMemberships with only user and date_joined
Used for listing team members. | 62598efd76e4537e8c3edf40 |
class BluetoothOutputData(OutputData): <NEW_LINE> <INDENT> bluetooth_mac_address = None <NEW_LINE> server_address = None <NEW_LINE> def send(self): <NEW_LINE> <INDENT> logger.info("Sending via Bluetooth") <NEW_LINE> return bluetooth.send_vcal(self.server_address, self.bluetooth_mac_address, self.data) | Define necessary OutputData for sending via bluetooth. | 62598efdaad79263cf42d195 |
class Usb(Escpos): <NEW_LINE> <INDENT> def __init__(self, idVendor, idProduct, interface=0, in_ep=0x82, out_ep=0x01): <NEW_LINE> <INDENT> self.idVendor = idVendor <NEW_LINE> self.idProduct = idProduct <NEW_LINE> self.interface = interface <NEW_LINE> self.in_ep = in_ep <NEW_LINE> self.out_ep = out_ep <NEW_LINE> ... | Define USB printer | 62598efd92d797404e38803d |
class HorizontalLine(_Line): <NEW_LINE> <INDENT> def __init__(self, posSize): <NEW_LINE> <INDENT> super(HorizontalLine, self).__init__(posSize) | A horizontal line.
.. image:: /_images/HorizontalLine.png
::
from vanilla import Window, HorizontalLine
class HorizontalLineDemo:
def __init__(self):
self.w = Window((100, 20))
self.w.line = HorizontalLine((10, 10, -10, 1))
self.w.open()
HorizontalLineDemo()... | 62598efd0fa83653e46f3867 |
class CallUnits(unittest.TestCase): <NEW_LINE> <INDENT> def testCase000(self): <NEW_LINE> <INDENT> global jval <NEW_LINE> global sval <NEW_LINE> global configdata <NEW_LINE> global appname <NEW_LINE> global schemafile <NEW_LINE> datafile = os.path.abspath(os.path.dirname(__file__))+os.sep+str('datafile.json') <NEW_LINE... | Base branch_add.
| 62598efd63b5f9789fe83ae5 |
class IssueSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Issue <NEW_LINE> fields = ('id', 'title', 'description', 'status', 'type', 'updated') | Serializing the issues for the API | 62598efdad47b63b2c5a619e |
class DataTypeOption(enum.Enum): <NEW_LINE> <INDENT> INTEGER = int <NEW_LINE> STRING = str | Describes the option MyConfig.data_type. | 62598efd4428ac0f6e656ed3 |
class MPIExecEngineSetLauncher(MPIEngineSetLauncher, DeprecatedMPILauncher): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(MPIExecEngineSetLauncher, self).__init__(*args, **kwargs) <NEW_LINE> self.warn() | Deprecated, use MPIEngineSetLauncher | 62598efd4c34283577618c6e |
class Fish(Agent): <NEW_LINE> <INDENT> def __init__(self, unique_id, model, pos, speed, velocity, vision, separation, tag="fish", cohere=0.025, separate=0.25, match=0.04): <NEW_LINE> <INDENT> super().__init__(unique_id, model) <NEW_LINE> self.pos = np.array(pos) <NEW_LINE> self.speed = speed <NEW_LINE> self.velocity = ... | A Boid-style agent. Boids have a vision that defines the radius in which
they look for their neighbors to flock with. Their heading (a unit vector)
and their interactions with their neighbors - cohering and avoiding -
define their movement. Separation is their desired minimum distance from
any other Boid. | 62598efde5267d203ee6a289 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.