code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Parameter(function.Function): <NEW_LINE> <INDENT> parameter_names = 'W', <NEW_LINE> gradient_names = 'gW', <NEW_LINE> def __init__(self, array): <NEW_LINE> <INDENT> self.W = array <NEW_LINE> self.gW = numpy.empty_like(array) <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> return self.W, <NEW_LINE> <...
Function that outputs its weight array. This is a parameterized function that takes no input and returns a variable holding a shallow copy of the parameter array. Args: array: Initial parameter array.
62598eda097d151d1a2bf52f
class LawVotingViewSet(viewsets.ReadOnlyModelViewSet): <NEW_LINE> <INDENT> throttle_classes = (AnonRateThrottle, UserRateThrottle) <NEW_LINE> queryset = LawVoting.objects.all() <NEW_LINE> serializer_class = LawVotingSerializer
API endpoint law models
62598eda0a50d4780f7038b9
class MordenkainensSword(Spell): <NEW_LINE> <INDENT> name = "Mordenkainen's Sword" <NEW_LINE> level = 7 <NEW_LINE> casting_time = "1 action" <NEW_LINE> components = ('V', 'S', 'M') <NEW_LINE> materials = "a miniature platinum sword with a grip and pommel of copper and zinc, worth 250 gp" <NEW_LINE> duration = "Concentr...
You create a sword-shaped plane of force that hovers within range. It lasts for the duration. When the sword appears, you make a melee spell attack against a target of your choice within 5 feet of the sword. On a hit, the target takes 3d10 force damage. Until the spell ends, you can use a bonus action on each of your t...
62598eda090684286d592967
class QuantiativeQuestionInstructionsView(PromptView): <NEW_LINE> <INDENT> submit_view = 'feature-phone:prompt-quantitative-question' <NEW_LINE> accept_keypress = True <NEW_LINE> accept_speech = False <NEW_LINE> timeout = 0 <NEW_LINE> prompts = ['quantitative-question-instructions', 'quantitative-question-reminder'] <N...
Explain the quantitative question section, and initialize session data.
62598eda4e4d56256637092b
class StreamLogger: <NEW_LINE> <INDENT> def __init__(self, experiment: "Experiment", stream: TextIO): <NEW_LINE> <INDENT> self.experiment = experiment <NEW_LINE> self.stream = stream <NEW_LINE> <DEDENT> def write(self, line: str) -> int: <NEW_LINE> <INDENT> self.experiment.log_output([line]) <NEW_LINE> return self.stre...
Decorates IO[str] class in order to log output
62598eda99fddb7c1ca62090
class QLearningAgent11(QLearningAgent): <NEW_LINE> <INDENT> def __init__(self, env, i_id, d_normalizers, d_ofi_scale, f_min_time=3600., f_gamma=0.5, f_alpha=0.5, i_numOfTilings=16, s_decay_fun=None, f_ttoupdate=5., d_initial_pos={}, s_hedging_on='DI1F19', b_hedging=True, b_keep_pos=True): <NEW_LINE> <INDENT> super(QLea...
A representation of an agent that learns using Q-learning with linear parametrization and e-greedy exploration described at p.60 ~ p.61 form Busoniu at al., 2010. The approximator used is the implementation of tile coding, described at Sutton and Barto, 2016 (draft).
62598edabaa26c4b54d4d7ea
class Utils(commands.Cog): <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> self.bot = bot <NEW_LINE> self._session = aiohttp.ClientSession(loop=self.bot.loop) <NEW_LINE> <DEDENT> @commands.command() <NEW_LINE> async def ping(self, ctx,): <NEW_LINE> <INDENT> latency = self.bot.latency * 1000 <NEW_LINE> ...
Utility commands for Senbot
62598eda3617ad0b5ee0463f
class AbstractConfEditor(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def default_stanza(self): <NEW_LINE> <INDENT> raise NotImplementedError("property 'default_stanza' is not defined") <NEW_LINE> <DEDENT> def get_conf(self, orig_stanza=None): <NEW_LINE> <INDENT> return self.default_stanza if orig_stanza is None e...
The conf editor class provides methods for producing and updating configuration stanzas for use in configuration file.
62598eda5f7d997b871f865e
class itkIntensityWindowingImageFilterID3IUL3_Superclass(itkInPlaceImageFilterAPython.itkInPlaceImageFilterID3IUL3): <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++ itkIntensityWindowingImageFilterID3IUL3_Superclass class
62598edab7558d5895461b5f
class AryionGalleryExtractor(AryionExtractor): <NEW_LINE> <INDENT> subcategory = "gallery" <NEW_LINE> categorytransfer = True <NEW_LINE> pattern = BASE_PATTERN + r"/(?:gallery/|user/|latest.php\?name=)([^/?#]+)" <NEW_LINE> test = ( ("https://aryion.com/g4/gallery/jameshoward", { "options": (("recursive", False),), "pat...
Extractor for a user's gallery on eka's portal
62598eda3cc13d1c6d463c7b
class WaitingListener(ConnectionListener): <NEW_LINE> <INDENT> def __init__(self, receipt): <NEW_LINE> <INDENT> self.receipt_condition = threading.Condition() <NEW_LINE> self.disconnect_condition = threading.Condition() <NEW_LINE> self.receipt = receipt <NEW_LINE> self.received = False <NEW_LINE> self.disconnected = Fa...
A listener which waits for a specific receipt to arrive.
62598eda8e71fb1e983b9f85
class LMC(SCPINode, SCPIQuery): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "*LMC" <NEW_LINE> args = []
*LMC Arguments:
62598edaa05bb46b38488d8f
class UserSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = get_user_model() <NEW_LINE> fields = ['email', 'password', 'name'] <NEW_LINE> extra_kwargs = {'password': {'write_only': True, 'min_length': 5}} <NEW_LINE> <DEDENT> def create(self, validated_data): <NEW_LINE>...
Serializer for the user object
62598eda4e4d56256637092c
class ParametricSoftplus(nn.Module): <NEW_LINE> <INDENT> def __init__(self, units, threshold=20): <NEW_LINE> <INDENT> super(ParametricSoftplus, self).__init__() <NEW_LINE> self.units = units <NEW_LINE> self.beta = nn.Parameter(th.Tensor(self.units)) <NEW_LINE> self.threshold = threshold <NEW_LINE> self.softplus = nn.So...
Applies the element-wise function: .. math:: \text{Softplus}(x) = \frac{1}{\beta} * \log(1 + \exp(\beta * x)) SoftPlus is a smooth approximation to the ReLU function and can be used to constrain the output of a machine to always be positive.
62598eda7b25080760ed59ad
class Module(ModuleBase): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> return "Module(%s, %x)" % (self.type_key, self.handle.value) <NEW_LINE> <DEDENT> @property <NEW_LINE> def type_key(self): <NEW_LINE> <INDENT> return _GetTypeKey(self) <NEW_LINE> <DEDENT> def get_source(self, fmt=""): <NEW_LINE> <INDEN...
Module container of all TVM generated functions
62598edafbf16365ca7925b6
class MarkdownParser(Parser): <NEW_LINE> <INDENT> def parse_front_matter(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def parse(self, text): <NEW_LINE> <INDENT> md = _Markdown() <NEW_LINE> markedup_text = md.convert(text) <NEW_LINE> self._parse_tree = md.parse_tree <NEW_LINE> return markedup_text
A markdown parser implementing the Markdown-Python library.
62598eda379a373c97d97515
class Connection(object): <NEW_LINE> <INDENT> autorefill = False <NEW_LINE> compression = True <NEW_LINE> https = True <NEW_LINE> def __init__(self, host, role, authcode, useWebsocket=False): <NEW_LINE> <INDENT> self._authItems = (host, role, authcode) <NEW_LINE> if useWebsocket: <NEW_LINE> <INDENT> self.websocket = Rd...
Connection object. Generates cursors for database operations. Most specific ops handled by cursors themselves. Note that this is an rdbhost connection, not a postgresql connection.
62598eda92d797404e387e05
class SupportVectorMachine(LinearModel): <NEW_LINE> <INDENT> def backward(self, f, y): <NEW_LINE> <INDENT> reg_grad = self.w_decay_factor * self.w <NEW_LINE> y_grad = np.zeros(len(y)) <NEW_LINE> for i in range(len(y_grad)): <NEW_LINE> <INDENT> if (1-y[i]*f[i] > 0): <NEW_LINE> <INDENT> y_grad[i] = -y[i] <NEW_LINE> <DEDE...
Implements a linear regression mode model
62598eda91f36d47f223012e
class OrderItemsStatusViewSet(viewsets.GenericViewSet, mixins.RetrieveModelMixin): <NEW_LINE> <INDENT> serializer_class = OrderStatusSerializer <NEW_LINE> queryset = Order.objects.all()
A viewset for order status
62598eda596a89723612617b
class ModelNSD(DDNModelPlugin): <NEW_LINE> <INDENT> relname = 'nsdNodes' <NEW_LINE> modname = 'ZenPacks.DDN.Gridscaler.NsdNode' <NEW_LINE> def prepTask(self, device, log): <NEW_LINE> <INDENT> self.device = device <NEW_LINE> log.info("%s: preparing for NSD clients", device.id) <NEW_LINE> cmdinfo = [{ 'cmd': '/opt/ddn/di...
Models GridScaler NSD Clients
62598eda30bbd7224646814c
class PermissionError(TracBaseError, StandardError): <NEW_LINE> <INDENT> title = N_("Forbidden") <NEW_LINE> def __init__(self, action=None, resource=None, env=None, msg=None): <NEW_LINE> <INDENT> self.action = action <NEW_LINE> self.resource = resource <NEW_LINE> self.env = env <NEW_LINE> if self.action: <NEW_LINE> <IN...
Insufficient permissions to complete the operation
62598eda21a7993f00c6447f
class lexicalConceptualResourceInfoType_model(resourceComponentTypeType_model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> verbose_name = "Lexical conceptual resource" <NEW_LINE> <DEDENT> __schema_name__ = 'lexicalConceptualResourceInfoType' <NEW_LINE> __schema_fields__ = ( ( u'resourceType', u'resourceType', ...
Groups together information specific to lexical/conceptual resources
62598edacc0a2c1114479516
class GetCfxMIC(BaseObj): <NEW_LINE> <INDENT> _strfmt2 = "GetCfxMIC(flags:{0:#02x}, snd_seq:{1}, sgn_cksum:{2})" <NEW_LINE> _attrlist = ("flags", "snd_seq", "sgn_cksum") <NEW_LINE> def __init__(self, unpack): <NEW_LINE> <INDENT> ulist = unpack.unpack(14, "!B5sQ") <NEW_LINE> self.flags = ulist[0] <NEW_LINE> self.fi...
struct GSS_GetCfxMIC { unsigned char flags; /* Attributes field */ opaque filler[5]; /* Filler bytes: 0xffffffffff */ unsigned long long snd_seq; /* Sequence number field */ unsigned char sgn_cksum[]; /* Checksum of "to-be-signed data" */ };
62598eda24f1403a92684b2d
class TimeoutHTTPAdapter(HTTPAdapter): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.timeout = DEFAULT_TIMEOUT <NEW_LINE> if "timeout" in kwargs: <NEW_LINE> <INDENT> self.timeout = kwargs["timeout"] <NEW_LINE> del kwargs["timeout"] <NEW_LINE> <DEDENT> super().__init__(*args, **kwargs...
https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/
62598eda1f037a2d8b9e2619
class WriteInstruction(_messages.Message): <NEW_LINE> <INDENT> input = _messages.MessageField('InstructionInput', 1) <NEW_LINE> sink = _messages.MessageField('Sink', 2)
An instruction that writes records. Takes one input, produces no outputs. Fields: input: The input. sink: The sink to write to.
62598eda507cdc57c63a32c8
class Command(Enum): <NEW_LINE> <INDENT> BUILD = 'build' <NEW_LINE> RUN = 'run'
Represents valid commands
62598eda4e696a045264d075
class DescribeAddressTemplateGroupsRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Filters = None <NEW_LINE> self.Offset = None <NEW_LINE> self.Limit = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("Filters") is not None: <NEW_LINE> <...
DescribeAddressTemplateGroups请求参数结构体
62598eda0a50d4780f7038bb
class PluginMixin(_PluginMixin): <NEW_LINE> <INDENT> @_PluginMixin.plugin_mixin_assert <NEW_LINE> def register_plugins(self): <NEW_LINE> <INDENT> for name in self.config['plugins']: <NEW_LINE> <INDENT> modname = 'harpseal.plugins.{}'.format(name) <NEW_LINE> plugin = None <NEW_LINE> try: <NEW_LINE> <INDENT> plugin = imp...
Mixin class for Plugin management.
62598edaa79ad1619776852e
class EchoZeroCascadeTask(KnownCodeBaseTask): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(type(self), self).__init__( ',[.>[->+>.<<]>+[-<+>]<<,]', default_input_fn_factory(), **kwargs)
Print k-th char with k zeros inbetween (1-indexed).
62598eda30dc7b766599dd9c
class UserWidget(TextInput): <NEW_LINE> <INDENT> placeholder = 'Jane Doe (jane.doe@email.com)' <NEW_LINE> def __init__(self, attrs=None): <NEW_LINE> <INDENT> attrs = attrs or {} <NEW_LINE> attrs['class'] = 'user-widget' <NEW_LINE> attrs['placeholder'] = self.placeholder <NEW_LINE> self.users_by_id = None <NEW_LINE> sup...
Custom widget for editing a user inline, as 'FirstName LastName (email)'.
62598eda16aa5153ce3fea0e
class _Products(lhn.AccordionGroup): <NEW_LINE> <INDENT> _locator_button_create_new = locator.LhnMenu.BUTTON_CREATE_NEW_PRODUCTS <NEW_LINE> _locator_spinny = locator.LhnMenu.SPINNY_PRODUCTS <NEW_LINE> _create_new_modal_cls = modal.create_new_object.ProductsCreate <NEW_LINE> _locator_accordion_members = locator.LhnMenu....
Products dropdown in LHN.
62598eda097d151d1a2bf532
class Config(object): <NEW_LINE> <INDENT> screenwidth = 1024 <NEW_LINE> screenheight = 600 <NEW_LINE> thiefx, thiefy = 50,50 <NEW_LINE> thiefdx = random.randint(-150,150) <NEW_LINE> thiefdy = random.randint(-150,150) <NEW_LINE> thiefmaxspeed = 200 <NEW_LINE> erratic = 1 <NEW_LINE> policex, policey = 250, 240 <NEW_LINE>...
place to store some variables so that every function can access them also a good place to start modding the game
62598edabaa26c4b54d4d7ec
class flatPlate(): <NEW_LINE> <INDENT> def __init__(self, N, c): <NEW_LINE> <INDENT> self.N = N <NEW_LINE> self.c = c <NEW_LINE> self.x = np.linspace(0,1, N+1)*self.c <NEW_LINE> self.z = np.zeros((1,N+1))*self.c <NEW_LINE> self.qc_x = np.arange(1/N*1/4,1+1/N*1/4, 1/N) *self.c <NEW_LINE> self.cp_x = np.arange(1/N*3/4,1+...
Define a flat plate geometry in a moving reference frame
62598eda3617ad0b5ee04641
class TagAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ['name']
标签
62598eda004d5f362081e289
class Lint(Bear): <NEW_LINE> <INDENT> check_prerequisites = classmethod(is_binary_present) <NEW_LINE> executable = None <NEW_LINE> arguments = "" <NEW_LINE> output_regex = re.compile(r'(?P<line>\d+)\.(?P<column>\d+)\|' r'(?P<severity>\d+): (?P<message>.*)') <NEW_LINE> use_stderr = False <NEW_LINE> severity_map = None <...
:param executable: The executable to run the linter. :param arguments: The arguments to supply to the linter, such that the file name to be analyzed can be appended to the end. :param output_regex: The regex which will match the output of the linter to...
62598eda4527f215b58e8418
class _HiddenScrollbar(Scrollbar): <NEW_LINE> <INDENT> def set(self, lo, hi): <NEW_LINE> <INDENT> if float(lo) <= 0.0 and float(hi) >= 1.0: <NEW_LINE> <INDENT> self.grid_remove() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.grid() <NEW_LINE> <DEDENT> Scrollbar.set(self, lo, hi)
Scrollbar that hides if slider's both ends reached extreme position.
62598eda55399d3f05624a41
class StateValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> TEST_STATE_UNSPECIFIED = 0 <NEW_LINE> VALIDATING = 1 <NEW_LINE> PENDING = 2 <NEW_LINE> RUNNING = 3 <NEW_LINE> FINISHED = 4 <NEW_LINE> ERROR = 5 <NEW_LINE> UNSUPPORTED_ENVIRONMENT = 6 <NEW_LINE> INCOMPATIBLE_ENVIRONMENT = 7 <NEW_LINE> INCOMPATIBLE_ARCHITECT...
Indicates the current progress of the test execution (e.g., FINISHED). @OutputOnly Values: TEST_STATE_UNSPECIFIED: Do not use. For proto versioning only. VALIDATING: The execution or matrix is being validated. PENDING: The execution or matrix is waiting for resources to become available. RUNNING: The exec...
62598eda7d847024c075a8e6
class PassivePluginBase(PluginBase): <NEW_LINE> <INDENT> def __init__(self, name, blueprint): <NEW_LINE> <INDENT> super().__init__(name, blueprint) <NEW_LINE> self._prefix += 'passive/' <NEW_LINE> <DEDENT> @property <NEW_LINE> def blueprint(self): <NEW_LINE> <INDENT> return self._blueprint <NEW_LINE> <DEDENT> @blueprin...
Plugin base class that all passive plugins should extend. Attributes: name: A string that stores the plugin's identifying name. blueprint: A Blueprint that defines the plugin.
62598eda4e4d56256637092e
@directory.register <NEW_LINE> class TK762_Radio(Kenwood_M60_Radio): <NEW_LINE> <INDENT> MODEL = "TK-762" <NEW_LINE> TYPE = "M0762" <NEW_LINE> VARIANTS = { "M0762\x01\x00\x00": (2, 136, 156, "K2"), "M0762\x00\x00\x00": (2, 148, 174, "K") }
Kenwood TK-762 Radios
62598eda76e4537e8c3edad6
class MockedCloudTestCase(APITestCase): <NEW_LINE> <INDENT> def create_patch(self, name): <NEW_LINE> <INDENT> patcher = patch(name, autospec=True) <NEW_LINE> mock = patcher.start() <NEW_LINE> self.addCleanup(patcher.stop) <NEW_LINE> return mock <NEW_LINE> <DEDENT> def set_auth_result(self, auth_result): <NEW_LINE> <IND...
TestCase that mocks device cloud lib and authentication layer to prevent real network calls
62598edadd821e528d6d745c
class Solution2: <NEW_LINE> <INDENT> def search(self, nums: List[int], target: int) -> int: <NEW_LINE> <INDENT> idx = bisect_left(nums, target) <NEW_LINE> return idx if (idx < len(nums) and nums[idx] == target) else -1
Binary search using standard library module 'bisect' Runtime: 240 ms, faster than 39.88% of Python3 Memory Usage: 15.6 MB, less than 20.05% of Python3 Time complexity: O(log n)
62598edaa17c0f6771d5a771
class ResponseTableModel(qc.QAbstractTableModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ResponseTableModel, self).__init__() <NEW_LINE> self.images = [] <NEW_LINE> <DEDENT> def rowCount(self, index=qc.QModelIndex()): <NEW_LINE> <INDENT> return len(self.images) <NEW_LINE> <DEDENT> def columnC...
Table of channels with properties such as extracted, sorted etc
62598eda7b25080760ed59af
class MYJDFailedException(MYJDApiException): <NEW_LINE> <INDENT> pass
MyJDownloader failed API Exception.
62598edaf7d966606f746507
class Descriptor(object): <NEW_LINE> <INDENT> def __init__(self, ip, protocolo, puerto=None): <NEW_LINE> <INDENT> self.ip = ip <NEW_LINE> self.protocolo = protocolo <NEW_LINE> self.puerto = puerto <NEW_LINE> <DEDENT> def compatible(self, otro): <NEW_LINE> <INDENT> return (self.protocolo is None or otro.protocolo is Non...
Describe una parte de la ACE (IP, protocolo, puerto)
62598edad53ae8145f9169a0
class OptionsFlow(config_entries.OptionsFlow): <NEW_LINE> <INDENT> def __init__(self, config_entry): <NEW_LINE> <INDENT> self.config_entry = config_entry <NEW_LINE> <DEDENT> async def async_step_init(self, user_input=None): <NEW_LINE> <INDENT> return await self.async_step_user(user_input) <NEW_LINE> <DEDENT> async def ...
Krisinformation config flow options handler.
62598edad58c6744b42db541
class StartRandomDownloadAction(StartDownloadAction): <NEW_LINE> <INDENT> def __init__(self, magnets_file_path): <NEW_LINE> <INDENT> with open(magnets_file_path) as torrent_links_file: <NEW_LINE> <INDENT> content = torrent_links_file.read() <NEW_LINE> links = content.split('\n')[:-1] <NEW_LINE> <DEDENT> rand_link = cho...
Start a random download from a pre-defined list.
62598eda1b99ca400228e797
class StatesModel(_db.Model): <NEW_LINE> <INDENT> __tablename__ = 'switchStates' <NEW_LINE> id = _db.Column(_db.Integer, primary_key=True) <NEW_LINE> state = _db.Column(_db.Boolean, nullable=False) <NEW_LINE> date = _db.Column(_db.DateTime, nullable=False) <NEW_LINE> id_switch = _db.Column(_db.Integer, _db.ForeignKey('...
Model para gestionar los estados de los interruptores
62598edafbf16365ca7925b8
class Race(datasets.GeneratorBasedBuilder): <NEW_LINE> <INDENT> VERSION = datasets.Version("0.1.0") <NEW_LINE> BUILDER_CONFIGS = [ datasets.BuilderConfig(name="high", description="Exams designed for high school students", version=VERSION), datasets.BuilderConfig( name="middle", description="Exams designed for middle sc...
ReAding Comprehension Dataset From Examination dataset from CMU
62598edabe8e80087fbbd561
class TestVerifyBST(unittest.TestCase): <NEW_LINE> <INDENT> def test_singleelement(self): <NEW_LINE> <INDENT> root = Node(key=42) <NEW_LINE> self.assertTrue(verifyBST(root)) <NEW_LINE> <DEDENT> def test_allequal(self): <NEW_LINE> <INDENT> left = Node(key=42, left=Node(key=42)) <NEW_LINE> right = Node(key=42, left=Node(...
A test suite for verifyBST().
62598eda56ac1b37e6300704
class Command(BaseCommand): <NEW_LINE> <INDENT> help = 'Add UWUM app.' <NEW_LINE> def add_arguments(self, parser): <NEW_LINE> <INDENT> parser.add_argument( '--id', action='store', dest='id', default=None, help='Add UWUM app with this ID.' ), <NEW_LINE> <DEDENT> def handle(self, *args, **options): <NEW_LINE> <INDENT> pr...
Add UWUM app.
62598eda30bbd7224646814e
class GuardianNews(object): <NEW_LINE> <INDENT> base_url = 'http://content.guardianapis.com/search' <NEW_LINE> def __init__(self, key): <NEW_LINE> <INDENT> self._key = key <NEW_LINE> <DEDENT> def build_url(self, **params): <NEW_LINE> <INDENT> querystring = urllib.urlencode(params) <NEW_LINE> return '%s?%s' % (self.base...
Service for Guardian News API
62598edacc0a2c1114479518
class UnknownXBeePacket(XBeeAPIPacket): <NEW_LINE> <INDENT> __MIN_PACKET_LENGTH = 5 <NEW_LINE> def __init__(self, api_frame, rf_data): <NEW_LINE> <INDENT> super().__init__(api_frame_type=api_frame) <NEW_LINE> self.__rf_data = rf_data <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def create_packet(raw, operating_mode=Ope...
This class represents an unknown XBee packet. .. seealso:: | :class:`.XBeeAPIPacket`
62598eda24f1403a92684b2e
class Place(BaseModel): <NEW_LINE> <INDENT> city_id = "" <NEW_LINE> user_id = "" <NEW_LINE> name = "" <NEW_LINE> description = "" <NEW_LINE> number_rooms = 0 <NEW_LINE> number_bathrooms = 0 <NEW_LINE> max_guest = 0 <NEW_LINE> price_by_night = 0 <NEW_LINE> latitude = 0.0 <NEW_LINE> longitude = 0.0 <NEW_LINE> amenity_ids...
Attributes: city_id (str): the City.id user_id (str): the User.id name (str): name of the place description (str): description of the place number_rooms (int): default: 0 number_bathrooms (int): default: 0 max_guest (int): default: 0 price_by_night (int): default: 0 latitude (float): default: 0.0 longitude(float): defa...
62598edaadb09d7d5dc08adc
class ELispDomain(Domain): <NEW_LINE> <INDENT> name = 'el' <NEW_LINE> label = 'ELisp' <NEW_LINE> object_types = { 'function': ObjType(_('function'), 'function'), 'variable': ObjType(_('variable'), 'variable'), 'command': ObjType(_('function'), 'command'), 'option': ObjType(_('variable'), 'option'), } <NEW_LINE> directi...
Emacs Lisp language domain.
62598eda498bea3a75a5604b
@six.add_metaclass(abc.ABCMeta) <NEW_LINE> class VariableFactoryAbstract(object): <NEW_LINE> <INDENT> def __init__(self, apply_to, modifier = None): <NEW_LINE> <INDENT> self._apply_to_regex = apply_to or '.*' <NEW_LINE> self._modifier = modifier <NEW_LINE> self._layer_name_variable_index_map = collections.defaultdict(l...
Abstract class to support various variable factories.
62598eda097d151d1a2bf533
class languageindependent(martian.Directive): <NEW_LINE> <INDENT> scope = martian.CLASS <NEW_LINE> store = LanguageIndependentStorage() <NEW_LINE> def factory(self, *args): <NEW_LINE> <INDENT> return args
Directive used to mark one or more fields as 'languageindependent'
62598eda82261d6c5272f142
class XMLAttribute(Base): <NEW_LINE> <INDENT> def __init__(self, typ, use=None): <NEW_LINE> <INDENT> self._typ = typ <NEW_LINE> self._use = use <NEW_LINE> <DEDENT> def marshall(self, name, value, parent_elt): <NEW_LINE> <INDENT> if value is not None: <NEW_LINE> <INDENT> parent_elt.set(name, value) <NEW_LINE> <DEDENT> <...
items which are marshalled as attributes of the parent element.
62598eda0fa83653e46f3403
class EventOutput: <NEW_LINE> <INDENT> def __init__(self, data: Dict[str, Any]): <NEW_LINE> <INDENT> self.__dict__.update(data) <NEW_LINE> <DEDENT> def update(self, data: Dict[str, Any]): <NEW_LINE> <INDENT> self.__dict__.update(data) <NEW_LINE> <DEDENT> def append(self, data: Any): <NEW_LINE> <INDENT> if not isinstanc...
output of event type
62598eda004d5f362081e28a
class ReportingTasksEntity(object): <NEW_LINE> <INDENT> swagger_types = { 'reporting_tasks': 'list[ReportingTaskEntity]' } <NEW_LINE> attribute_map = { 'reporting_tasks': 'reportingTasks' } <NEW_LINE> def __init__(self, reporting_tasks=None): <NEW_LINE> <INDENT> self._reporting_tasks = None <NEW_LINE> if reporting_task...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598eda7cff6e4e811b3f05
class IoStream(Base): <NEW_LINE> <INDENT> def __init__(self, io_stream, output_format='json', **kw): <NEW_LINE> <INDENT> self._io_stream = io_stream <NEW_LINE> self._output_format = output_format <NEW_LINE> Base.__init__(self, **kw) <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDE...
Output records into IO stream
62598eda3539df3088eca7c9
@register_node <NEW_LINE> class EnvFunc(NodeBase): <NEW_LINE> <INDENT> def __call__(self, *args): <NEW_LINE> <INDENT> return _api_internal._EnvFuncCall(self, *args) <NEW_LINE> <DEDENT> @property <NEW_LINE> def func(self): <NEW_LINE> <INDENT> return _api_internal._EnvFuncGetPackedFunc(self)
Environment function. This is a global function object that can be serialized by its name.
62598eda009cb60464cffa6b
class DockableViewElement(HasPrivateTraits, IDockable): <NEW_LINE> <INDENT> ui = Instance(UI) <NEW_LINE> element = Instance(ViewSubElement) <NEW_LINE> should_close = Bool(False) <NEW_LINE> def dockable_should_close(self): <NEW_LINE> <INDENT> element = self.element <NEW_LINE> if element is None: <NEW_LINE> <INDENT> elem...
Allows Traits UIs and Traits UI elements to be docked in external Pyface DockWindow windows.
62598eda9c8ee8231303f3e3
class TranslationSerializerField(fields.WritableField): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(TranslationSerializerField, self).__init__(*args, **kwargs) <NEW_LINE> self.return_all_translations = True <NEW_LINE> <DEDENT> def initialize(self, parent, field_name): <NEW_LINE> <...
Django-rest-framework custom serializer field for our TranslatedFields. - When deserializing, in `from_native`, it accepts both a string or a dictionary. If a string is given, it'll be considered to be in the default language. - When serializing, its behavior depends on the parent's serializer context: If a re...
62598eda32920d7e50bc4545
class Context(dict): <NEW_LINE> <INDENT> def copy(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def clear(self): <NEW_LINE> <INDENT> pass
Execution context that retains the changes the tests make. Preferably use one per module to obtain nice "literate" modules that "follow along". In other words, directly the opposite of: https://docs.python.org/3/library/doctest.html#what-s-the-execution-context By popular demand: http://stackoverflow.com/questions/13...
62598edaac7a0e7691f70a29
class InvalidAgentNumberError(ValueError): <NEW_LINE> <INDENT> pass
Raised when there are no agents on the appliance.
62598eda66673b3332c2e8bd
class WindSchema(base_schema.ObjTypeSchema): <NEW_LINE> <INDENT> name = SchemaNode(String(), test_equal=False) <NEW_LINE> description = SchemaNode(String()) <NEW_LINE> filename = FilenameSchema(save=False, missing=drop, isdatafile=False, update=False, test_equal=False) <NEW_LINE> updated_at = SchemaNode(LocalDateTime()...
validate data after deserialize, before it is given back to pyGnome's from_dict to set _state of object
62598edad53ae8145f9169a2
class ConvBlock(nn.Module): <NEW_LINE> <INDENT> def __init__(self, layer_idx, in_channels, out_channels, kernel_size=3, stride=1, padding=1, dilation=1, add_bias=False, wscale_gain=np.sqrt(2.0), wscale_lr_multiplier=1.0, randomize_noise=False): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> if layer_idx % 2 == 0: <N...
Implements the convolutional block used in progressive GAN. Basically, this block is used as the second convolutional block for each resolution.
62598eda379a373c97d97518
class Event: <NEW_LINE> <INDENT> def __init__(self, time, event): <NEW_LINE> <INDENT> self.time = time <NEW_LINE> self.event = event <NEW_LINE> <DEDENT> def __lt__(self, other): <NEW_LINE> <INDENT> return self.time < other.time <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(self.time) + ' ' + sel...
Helper class for ordering events temporally
62598eda26068e7796d4ae85
class GroupDataMiddleware(BaseMiddleware): <NEW_LINE> <INDENT> def __init__(self, group_id: str = None, group_name: str = None): <NEW_LINE> <INDENT> LOGGER.debug("Initializing") <NEW_LINE> self.group_id = group_id <NEW_LINE> self.group_name = group_name <NEW_LINE> <DEDENT> def process_request(self, req: REQUEST_MODELS)...
This middleware fills the :code:`groupId` and :code:`groupName` fields when submitting a new analysis job. This means that only :code:`process_request` carries business logic, while :code:`process_response` returns the input response object right away without touching it.
62598eda92d797404e387e07
class ItemBuilder: <NEW_LINE> <INDENT> def build_items(self, **kwargs): <NEW_LINE> <INDENT> item_effects_map = kwargs["item_effects_map"] <NEW_LINE> item_models = kwargs["item_models"] <NEW_LINE> effect_collection = kwargs["effect_collection"] <NEW_LINE> items = [] <NEW_LINE> for item_model in item_models: <NEW_LINE> <...
Builds an Item given a list of item models and ItemCollection to look up items and such
62598edabaa26c4b54d4d7ef
class TextColor: <NEW_LINE> <INDENT> PURPLE = '\033[95m' <NEW_LINE> CYAN = '\033[96m' <NEW_LINE> DARKCYAN = '\033[36m' <NEW_LINE> BLUE = '\033[94m' <NEW_LINE> GREEN = '\033[92m' <NEW_LINE> YELLOW = '\033[93m' <NEW_LINE> RED = '\033[91m' <NEW_LINE> BOLD = '\033[1m' <NEW_LINE> UNDERLINE = '\033[4m' <NEW_LINE> END = '\033...
Defines color codes for text used to give different mode of errors.
62598eda63d6d428bbee0cea
class SHTSensorHumidity(SHTSensor): <NEW_LINE> <INDENT> @property <NEW_LINE> def unit_of_measurement(self): <NEW_LINE> <INDENT> return UNIT_PERCENTAGE <NEW_LINE> <DEDENT> def update(self): <NEW_LINE> <INDENT> super().update() <NEW_LINE> humidity = self._sensor.humidity <NEW_LINE> if humidity is not None: <NEW_LINE> <IN...
Representation of a humidity sensor.
62598eda21a7993f00c64483
class MockListener: <NEW_LINE> <INDENT> def __init__(self, ip = '127.0.0.1', port = 5000, use_ssl=False): <NEW_LINE> <INDENT> self.ip, self.port, self.use_ssl = ip, port, use_ssl <NEW_LINE> self.sel = selectors.DefaultSelector() <NEW_LINE> self.ss = socket.socket() <NEW_LINE> if self.use_ssl: <NEW_LINE> <INDENT> self.s...
Accept connections and create MockSock classes to handle them
62598eda63b5f9789fe83689
class router(nocobject): <NEW_LINE> <INDENT> def __init__(self, index, name, **kwargs): <NEW_LINE> <INDENT> self.index = index <NEW_LINE> self.name = name <NEW_LINE> self.ipcore_ref = None <NEW_LINE> self.graph_ref = None <NEW_LINE> self.address = index <NEW_LINE> for key in kwargs.keys(): <NEW_LINE> <INDENT> setattr(s...
Router base object This object represents a router object and its properties. This base class is meant to either be inherited or extended by adding other attributes. Relations with other objects: * It should be related to one NoC model object (self.graph_ref) * It should be one of the node attributes in the graph mod...
62598eda07f4c71912bad977
class VolumeRecording(Recording): <NEW_LINE> <INDENT> pass
Recording of one or more frames from a 3D imaging device (MRI, lightfield, tomography, etc).
62598eda435de62698e9a2ee
class InsightsSupport(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def collect_support_info(self): <NEW_LINE> <INDENT> cfg_block = [] <NEW_LINE> logger.info('Insights version: %s' % (constants.version)) <NEW_LINE> cfg_block += registration_check() <NEW_LINE> lastupload =...
Build the support logfile
62598eda2eb69b55b15a0614
class Weapon: <NEW_LINE> <INDENT> def __init__(self, damage): <NEW_LINE> <INDENT> self.damage = damage <NEW_LINE> <DEDENT> def hit(self, target): <NEW_LINE> <INDENT> target.reduce_health(self.damage)
Weapon with attack damage
62598eda507cdc57c63a32cb
class SimpleLatticeTestHarness(TestHarness): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SimpleLatticeTestHarness, self).__init__() <NEW_LINE> self.input_set = SimpleLatticeInput(num_dimensions=3) <NEW_LINE> self.num_polar = 4 <NEW_LINE> self.azim_spacing = 0.12 <NEW_LINE> self.z_spacing = 0.5 <NE...
An eigenvalue calculation in a 3D lattice with 7-group C5G7 data.
62598edaa17c0f6771d5a774
class BinarySearchTree: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.root = None <NEW_LINE> <DEDENT> def insert(self, value): <NEW_LINE> <INDENT> if self.root == None: <NEW_LINE> <INDENT> self.root = Node(value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> current_node = self.root <NEW_LINE> while ...
Creates a Binary Search Tree. Attributes: root (int): The root of the Tree.
62598eda8c0ade5d55dc290f
class UserLogin(Resource): <NEW_LINE> <INDENT> def post(self): <NEW_LINE> <INDENT> data = PARSER.parse_args() <NEW_LINE> user = UserModel(data.email, data.password) <NEW_LINE> res = user.check_password() <NEW_LINE> if not res['error']: <NEW_LINE> <INDENT> res['message']['access_token'] = create_access_token(identity=us...
This class handles user login
62598eda5f7d997b871f8661
class DataLoader(object): <NEW_LINE> <INDENT> ALL = ['default', 'component', 'role', 'environment', 'host'] <NEW_LINE> def __init__(self, data_dir, data_modules=ALL): <NEW_LINE> <INDENT> self.data_dir = data_dir <NEW_LINE> self.data_modules = set(data_modules) <NEW_LINE> <DEDENT> def __call__(self, componentdef): <NEW_...
Load and merge configuration data. Configuration data is loaded from python files by type, where type is defined to include defaults, per-role values, per-component values, per-environment values and per-host values. Configuration data also includes the current environment, component and host string values under a 'c...
62598edabaa26c4b54d4d7f0
class LogReader: <NEW_LINE> <INDENT> def __init__(self, output_dir_path): <NEW_LINE> <INDENT> self.output_dir_path = output_dir_path <NEW_LINE> self.property_uuid_name_map = PropertyUuidNameMapLog(output_dir_path + "/log_property_uuid_name_map.csv") <NEW_LINE> self.case_log = CaseLog(output_dir_path + "/log_cases.csv")...
Read all the log files and create the appropriate objects for them.
62598eda8e71fb1e983b9f8a
class ImageForm(forms.Form, DashboardPluginFormBase): <NEW_LINE> <INDENT> plugin_data_fields = [ ("title", ""), ("image", ""), ("fit_method", DEFAULT_FIT_METHOD), ("show_link", True) ] <NEW_LINE> title = forms.CharField(label=_("Title"), required=True) <NEW_LINE> image = forms.ImageField(label=_("Image"), required=True...
Image form for `ImagePlugin` plugin.
62598eda38b623060ffa75aa
class PictureSplashTemplatePlugin(PicturePlugin): <NEW_LINE> <INDENT> name = _('Template Splash Image') <NEW_LINE> fieldsets = [ (None, { 'fields': ( 'picture', 'external_picture', 'attributes', ) }), ] <NEW_LINE> def get_render_template(self, context, instance, placeholder): <NEW_LINE> <INDENT> return 'djangocms_pictu...
A subclass of the Django CMS PicturePlugin that can be used just to select a photo for inclusion as the splash page in a theme. Your theme will need to override 'djangocms_picture/splash_image/picture.html' to place the splash image appropriately in the template (e.g. using the <header> tag).
62598eda004d5f362081e28b
class Hero(pg.sprite.Sprite): <NEW_LINE> <INDENT> def __init__(self, game, x_pos, y_pos): <NEW_LINE> <INDENT> pg.sprite.Sprite.__init__(self) <NEW_LINE> pg.mixer.init() <NEW_LINE> self.game = game <NEW_LINE> self.x_pos = x_pos <NEW_LINE> self.y_pos = y_pos <NEW_LINE> self.image = pg.transform.scale(pg.image.load( './im...
Create hero
62598eda4428ac0f6e656a74
class ExplorerrApp(App): <NEW_LINE> <INDENT> def build(self): <NEW_LINE> <INDENT> return TwoHorizontalLayout()
Starting class
62598eda4527f215b58e841c
class AgentConfig(Graph, metaclass=Singleton): <NEW_LINE> <INDENT> PATH = '/etc/%s/agent.conf' % NAME <NEW_LINE> def __init__(self, path=None): <NEW_LINE> <INDENT> conf = Config(AGENT_DEFAULTS, path or AgentConfig.PATH) <NEW_LINE> conf.validate(AGENT_SCHEMA) <NEW_LINE> Graph.__init__(self, conf)
The gofer agent configuration. :cvar PATH: The absolute path to the config directory. :type PATH: str
62598eda07f4c71912bad978
class Square(Rectangle): <NEW_LINE> <INDENT> def __init__(self, size): <NEW_LINE> <INDENT> self.__size = size <NEW_LINE> self.integer_validator('size', size) <NEW_LINE> super().__init__(size, size) <NEW_LINE> <DEDENT> def area(self): <NEW_LINE> <INDENT> return super().area() <NEW_LINE> <DEDENT> def __str__(self): <NEW_...
class Square that inherits from Rectangle (9-rectangle.py). (task based on 10-square.py).
62598eda3539df3088eca7cb
class EventEditView(EventViewMixin, ContentEditFormBase): <NEW_LINE> <INDENT> form_fields = form.FormFields(IEventSchema) <NEW_LINE> form_fields['start_date'].custom_widget = DatetimeI18nWidget <NEW_LINE> form_fields['stop_date'].custom_widget = DatetimeI18nWidget
Edit view for IMutableEvent.
62598eda009cb60464cffa6d
class Solution: <NEW_LINE> <INDENT> def deleteDuplicates(self, head): <NEW_LINE> <INDENT> if not head or not head.next: <NEW_LINE> <INDENT> return head <NEW_LINE> <DEDENT> prev = head <NEW_LINE> curr = head.next <NEW_LINE> while curr: <NEW_LINE> <INDENT> if curr.val == prev.val: <NEW_LINE> <INDENT> prev.next = curr.nex...
Iterative Solution Intuition: Maintain two pointers: prev and curr. If prev.val == curr.val, we can leapfrog over curr, and set prev's next pointer to curr.next. If the two values are not equal, we move the prev pointer up one.
62598eda55399d3f05624a46
class CheckRecord(db.Model): <NEW_LINE> <INDENT> isbn = db.Column(db.Integer, primary_key=True) <NEW_LINE> last_check_time = db.Column(db.DateTime) <NEW_LINE> check_count = db.Column(db.Integer) <NEW_LINE> def __init__(self, isbn): <NEW_LINE> <INDENT> self.isbn = isbn <NEW_LINE> self.last_check_time = datetime.now() <N...
model of table check_record
62598eda3eb6a72ae0388b58
class TagsIntPrint0x0007IntegerOverflow(metaclass=CaseMeta): <NEW_LINE> <INDENT> url = "https://github.com/Exiv2/exiv2/issues/1912" <NEW_LINE> filename = path("$data_path/issue_1912_poc.jpg") <NEW_LINE> commands = ["$exiv2 -q -Pt $filename"] <NEW_LINE> stderr = [""] <NEW_LINE> retval = [0] <NEW_LINE> compare_stdout = c...
Regression test for the bug described in: https://github.com/Exiv2/exiv2/issues/1912
62598edaa219f33f346c4d51
@_register <NEW_LINE> class UnprocessableEntity(ClientError): <NEW_LINE> <INDENT> code = http.HTTPStatus.UNPROCESSABLE_ENTITY
422 unprocessable entity
62598eda9c8ee8231303f3e4
class XceptionConfiguration(TrainingConfiguration): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__(data_shape = (299, 299, 3), learning_rate=1.0, training_minibatch_size=4) <NEW_LINE> <DEDENT> def classifier(self) -> Model: <NEW_LINE> <INDENT> model = Xception(include_top=False, weights='i...
A rudimentary configuration for starting
62598eda4e4d562566370932
class FancyArrow(Polygon): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return "FancyArrow()" <NEW_LINE> <DEDENT> @docstring.dedent_interpd <NEW_LINE> def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False, head_width=None, head_length=None, shape='full', overhang=0, head_starts_at_zero=...
Like Arrow, but lets you set head width and head height independently.
62598eda2c8b7c6e89bd1ce3
class TokenGenerator(object): <NEW_LINE> <INDENT> signature = "vy1ZLamRVfu3EF5r683iySz61suBRjZ0" <NEW_LINE> def __init__(self, encryption_key, expiration_delay): <NEW_LINE> <INDENT> self.encryption_key = encryption_key <NEW_LINE> self.expiration_delay = expiration_delay <NEW_LINE> <DEDENT> @property <NEW_LINE> def log(...
Generate or check time-stamped tokens
62598eda7b25080760ed59b3
class RcLocal(BaseSystemFile): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def add_boot_item(self, cmd, name=None): <NEW_LINE> <INDENT> pass
rc.local的配置文件类
62598eda6aa9bd52df0d33c6
class SampleLayer(lasagne.layers.MergeLayer): <NEW_LINE> <INDENT> def __init__(self, mean, log_sigma): <NEW_LINE> <INDENT> super(SampleLayer, self).__init__([mean, log_sigma]) <NEW_LINE> <DEDENT> def get_output_shape_for(self, input_shape): <NEW_LINE> <INDENT> return input_shape[0] <NEW_LINE> <DEDENT> def get_output_fo...
Basically taking the approach from [parmesan](https://github.com/casperkaae/parmesan/blob/master/parmesan/layers/sample.py)
62598edaa8370b77170ee907
class DummyPage(Page): <NEW_LINE> <INDENT> def __init__(self, wiki, url, text): <NEW_LINE> <INDENT> data = self._loadData(wiki, url, text) <NEW_LINE> super(DummyPage, self).__init__(wiki, data) <NEW_LINE> <DEDENT> def _loadData(self, wiki, url, text): <NEW_LINE> <INDENT> data = PageData() <NEW_LINE> extension = wiki.fs...
A dummy page for previewing in-progress editing.
62598eda1b99ca400228e799
class Author(object): <NEW_LINE> <INDENT> def __init__(self, name=u'', type_=None, lang=None): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> if type_ and type_ not in (u'words',u'music',u'translation'): <NEW_LINE> <INDENT> raise ValueError(u'`type` must be one of "words", "music", or' + '"translation".') <NEW_LINE> <...
An author of words, music, or a translation. name: Author's name as a string. type: One of "words", "music", or "translation". This module will throw ValueError if one of these is found to be incorrect. lang: A language code, in the format of "xx", or "xx-YY".
62598edad6c5a102081e064a