code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Frankeinstein(MetaBadge): <NEW_LINE> <INDENT> id="frankeinstein" <NEW_LINE> model = models.History <NEW_LINE> one_time_only = True <NEW_LINE> title = _("Frankeinstein") <NEW_LINE> description = _("Cloned a cancelled or deprecated object") <NEW_LINE> link_to_doc = "PLMObject/1_common.html#attributes" <NEW_LINE> le... | Badge won by user who clonee a cancelled or deprecated object | 62599041e64d504609df9d32 |
@ns.route('/') <NEW_LINE> class BookList(Resource): <NEW_LINE> <INDENT> @ns.doc('list_todos') <NEW_LINE> @ns.marshal_list_with(book) <NEW_LINE> def get(self): <NEW_LINE> <INDENT> return DAO.books <NEW_LINE> <DEDENT> @ns.doc('create_todo') <NEW_LINE> @ns.expect(book) <NEW_LINE> @ns.marshal_with(book, code=201) <NEW_LINE... | Shows a list of all todos, and lets you POST to add new tasks | 625990413eb6a72ae038b924 |
class GoogleFusionTableService: <NEW_LINE> <INDENT> def __init__(self, service): <NEW_LINE> <INDENT> self.service = service <NEW_LINE> <DEDENT> def save_location(self, location): <NEW_LINE> <INDENT> sql_query = "INSERT INTO {} (Address, Location) VALUES ('{}', '{},{}')" .format(settings.TABLE_ID, location['a... | Google fusion table service to save location records and purge whole table | 62599041a79ad1619776b342 |
class BridgesResource(CustomErrorHandlingResource, CSPResource): <NEW_LINE> <INDENT> isLeaf = True <NEW_LINE> def __init__(self, distributor, schedule, N=1, useForwardedHeader=False, includeFingerprints=True): <NEW_LINE> <INDENT> gettext.install("bridgedb", unicode=True) <NEW_LINE> CSPResource.__init__(self) <NEW_LINE>... | This resource displays bridge lines in response to a request. | 625990413eb6a72ae038b923 |
class GCDaySteps(GCDaySection): <NEW_LINE> <INDENT> def __init__(self, raw_html): <NEW_LINE> <INDENT> super().__init__(raw_html, tag="STEPS") <NEW_LINE> self.total = None <NEW_LINE> self.goal = None <NEW_LINE> self.avg = None <NEW_LINE> self.distance = None <NEW_LINE> <DEDENT> def parse(self): <NEW_LINE> <INDENT> try: ... | Standard activity in the Garmin Connect timeline of day.
Common features are total, goal, distance, avg daily | 6259904123e79379d538d7c1 |
class UbuntuNetworking(Networking, UbuntuPlugin): <NEW_LINE> <INDENT> trace_host = "archive.ubuntu.com" <NEW_LINE> def setup(self): <NEW_LINE> <INDENT> super(UbuntuNetworking, self).setup() <NEW_LINE> self.add_copy_specs([ "/etc/resolvconf", "/etc/ufw", "/var/log/ufw.Log", "/etc/resolv.conf"]) <NEW_LINE> self.add_cmd_o... | network related information for Ubuntu based distribution
| 62599041b830903b9686eddb |
class PositionWiseFFN(nn.Block): <NEW_LINE> <INDENT> def __init__(self, ffn_num_hiddens, ffn_num_outputs, **kwargs): <NEW_LINE> <INDENT> super(PositionWiseFFN, self).__init__(**kwargs) <NEW_LINE> self.dense1 = nn.Dense(ffn_num_hiddens, flatten=False, activation='relu') <NEW_LINE> self.dense2 = nn.Dense(ffn_num_outputs,... | Positionwise feed-forward network.
Defined in :numref:`sec_transformer` | 6259904107d97122c4217f62 |
class NodeController(object): <NEW_LINE> <INDENT> def __init__(self, nodeParams, logFile=[]): <NEW_LINE> <INDENT> self.logFile = logFile <NEW_LINE> self.logTime = 0 <NEW_LINE> self.nodeParams = nodeParams <NEW_LINE> <DEDENT> def controlNode(self): <NEW_LINE> <INDENT> self.processCommands() <NEW_LINE> self.monitorFormat... | Generic node controller to subtype for specific vehicle types.
Attributes:
logFile: File object for logging node data.
logTime: Time of last write to log file.
nodeConfig: NodeConfig instance that stores configuration data for this node. | 62599041097d151d1a2c232b |
class _ValueCtxManager(Awaitable[_T], AsyncContextManager[_T]): <NEW_LINE> <INDENT> def __init__(self, value_obj: "Value", coro: Awaitable[Any], *, acquire_lock: bool): <NEW_LINE> <INDENT> self.value_obj = value_obj <NEW_LINE> self.coro = coro <NEW_LINE> self.raw_value = None <NEW_LINE> self.__original_value = None <NE... | Context manager implementation of config values.
This class allows mutable config values to be both "get" and "set" from
within an async context manager.
The context manager can only be used to get and set a mutable data type,
i.e. `dict`s or `list`s. This is because this class's ``raw_value``
attribute must contain ... | 6259904130c21e258be99aca |
class DownloadDmsFileRequest(object): <NEW_LINE> <INDENT> swagger_types = { 'cloud_db_instance_no': 'str', 'file_name': 'str' } <NEW_LINE> attribute_map = { 'cloud_db_instance_no': 'cloudDBInstanceNo', 'file_name': 'fileName' } <NEW_LINE> def __init__(self, cloud_db_instance_no=None, file_name=None): <NEW_LINE> <INDENT... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62599041d6c5a102081e33e9 |
class BaseBlocking(object): <NEW_LINE> <INDENT> def __init__(self, ref_attr_index, target_attr_index): <NEW_LINE> <INDENT> self.ref_attr_index = ref_attr_index <NEW_LINE> self.target_attr_index = target_attr_index <NEW_LINE> self.refids = None <NEW_LINE> self.targetids = None <NEW_LINE> self.is_fitted = False <NEW_LINE... | An abstract general blocking object that exposes
the API that should be common to all blockings object | 62599041c432627299fa4263 |
class AzureActiveDirectoryValidation(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'jwt_claim_checks': {'key': 'jwtClaimChecks', 'type': 'JwtClaimChecks'}, 'allowed_audiences': {'key': 'allowedAudiences', 'type': '[str]'}, } <NEW_LINE> def __init__( self, *, jwt_claim_checks: Optional["JwtClaimChe... | The configuration settings of the Azure Active Directory token validation flow.
:ivar jwt_claim_checks: The configuration settings of the checks that should be made while
validating the JWT Claims.
:vartype jwt_claim_checks: ~azure.mgmt.web.v2020_12_01.models.JwtClaimChecks
:ivar allowed_audiences: The list of audien... | 625990414e696a045264e783 |
class HostList(GenericDropDownList): <NEW_LINE> <INDENT> _model = m_hosts.HostListModel <NEW_LINE> _label = 'Host select list' <NEW_LINE> def selected_host(self): <NEW_LINE> <INDENT> return self.value <NEW_LINE> <DEDENT> def choose_host(self, host_name): <NEW_LINE> <INDENT> self.value = host_name | DropDown list of hosts | 62599041287bf620b6272eaa |
class Dataset(_StructuralElement): <NEW_LINE> <INDENT> def __init__(self, name, comment='', attributes=dict(), data=np.empty(0), display_name='', scale_name='', quantity='', unit='', display_unit='', is_scale=False, scales=[] ): <NEW_LINE> <INDENT> _StructuralElement.__init__(self, name, comment, attributes) <NEW_LINE>... | SDF Dataset | 6259904182261d6c52730826 |
class ListaEncadeada: <NEW_LINE> <INDENT> class No: <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self._value = value <NEW_LINE> self.next = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def value(self): <NEW_LINE> <INDENT> return self._value <NEW_LINE> <DEDENT> <DEDENT> def __init__(self): <NEW_LI... | Implementa uma estrutura de dados do tipo Lista Encadeada. | 62599041507cdc57c63a6060 |
class UserInfo(models.Model): <NEW_LINE> <INDENT> uName = models.CharField("用户名", max_length=20) <NEW_LINE> uPwd = models.CharField("密码", max_length=100) <NEW_LINE> uEmail = models.EmailField("电子邮件") <NEW_LINE> uPhone = models.DecimalField("手机号", max_digits=11, decimal_places=0) <NEW_LINE> uAddr = models.CharField("收货地... | 用户信息表 | 62599041379a373c97d9a2ed |
class Setup(CLIRunnable): <NEW_LINE> <INDENT> action = 'setup' <NEW_LINE> def execute(self, args): <NEW_LINE> <INDENT> username, secret, endpoint_url, timeout = self.get_user_input() <NEW_LINE> api_key = get_api_key(self.client, username, secret, endpoint_url=endpoint_url) <NEW_LINE> path = '~/.softlayer' <NEW_LINE> if... | usage: sl config setup [options]
Setup configuration | 625990426e29344779b01917 |
class FilterDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, input_dataset, predicate): <NEW_LINE> <INDENT> super(FilterDataset, self).__init__() <NEW_LINE> self._input_dataset = input_dataset <NEW_LINE> @function.Defun(*nest.flatten( sparse.as_dense_types(input_dataset.output_types, input_dataset.output_classe... | A `Dataset` that filters its input according to a predicate function. | 6259904226068e7796d4dc0b |
class ImageOps: <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def resize_image(cls, image_body, size, fit_to_size=False): <NEW_LINE> <INDENT> image_file = BytesIO(image_body) <NEW_LINE> try: <NEW_LINE> <INDENT> image = Image.open(image_file) <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> return False <NEW_LINE> ... | Module that holds all image operations. Since there's no state,
everything is a classmethod. | 625990428a43f66fc4bf3456 |
class FiberPrinter: <NEW_LINE> <INDENT> def __init__(self, val): <NEW_LINE> <INDENT> self.val = val <NEW_LINE> state = self.val['state_'] <NEW_LINE> d = gdb.types.make_enum_dict(state.type) <NEW_LINE> d = dict((v, k) for k, v in d.items()) <NEW_LINE> self.state = d[int(state)] <NEW_LINE> <DEDENT> def state_to_string(se... | Print a folly::fibers::Fiber | 625990428da39b475be044b3 |
class test_sort_and_remove(unittest.TestCase): <NEW_LINE> <INDENT> def test_sort_(self): <NEW_LINE> <INDENT> input_ = [9, 4, -1, 429, -62, 3, 0, 9, -1000, 17] <NEW_LINE> output_ = [-1000, -62, -1, 0, 3, 4, 9, 9, 17, 429] <NEW_LINE> self.assertEqual(sort_(input_), output_) <NEW_LINE> <DEDENT> def test_remove_(self): <NE... | Performs unit tests on sort_, remove_, and sort_and_remove
| 6259904230dc7b76659a0af4 |
class PKCS1Primitives(ISO18033Primitives): <NEW_LINE> <INDENT> def OS2IP(self, X): <NEW_LINE> <INDENT> xLen = len(X) <NEW_LINE> x = 0 <NEW_LINE> for i in range(0, xLen): <NEW_LINE> <INDENT> char2int = ord(X[i]) <NEW_LINE> pow = xLen - i - 1 <NEW_LINE> x = x + 256 ** pow * char2int <NEW_LINE> if self.explain: <NEW_LINE>... | Defined in section 4 of RSA PKCS#1 | 62599042711fe17d825e15ff |
class NameHandler(BaseHandler): <NEW_LINE> <INDENT> @required_login <NEW_LINE> def post(self, *args, **kwargs): <NEW_LINE> <INDENT> user_id = self.session.data["user_id"] <NEW_LINE> name = self.json_args.get("name") <NEW_LINE> if name in (None, ""): <NEW_LINE> <INDENT> return self.write(dict(errcode=RET.PARAMERR,errmsg... | 修改用户名 | 62599042e64d504609df9d33 |
class Frenzied(SpecialRule): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Frenzied, self).__init__(name="Frenzied") | Rule book p.69
Frenzied troops have the Extra Attack and Immune to Psychology special rules | 62599042d164cc617582223c |
class Https(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Switch = None <NEW_LINE> self.Http2 = None <NEW_LINE> self.OcspStapling = None <NEW_LINE> self.VerifyClient = None <NEW_LINE> self.CertInfo = None <NEW_LINE> self.ClientCertInfo = None <NEW_LINE> self.Spdy = None <NEW_LINE> sel... | 域名https配置。
| 62599042d53ae8145f919722 |
class OsWalk(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(OsWalk, self).__init__() <NEW_LINE> <DEDENT> def walk(self, directory): <NEW_LINE> <INDENT> return os.walk(directory) | A OsWalk object so that unit tests mock will work on it. Other
routines may need to be added as they are needed | 6259904207d97122c4217f64 |
class QuestionView(ListCreateAPIView): <NEW_LINE> <INDENT> serializer_class = QuestionSerializer <NEW_LINE> queryset = Question.objects.all() | Question API endpoint | 6259904226238365f5fade1e |
class profile_loader(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.events = event_handler() <NEW_LINE> self.t = tab_completer.tabCompleter() <NEW_LINE> readline.set_completer_delims('\t') <NEW_LINE> readline.parse_and_bind("tab: complete") <NEW_LINE> readline.set_completer(self.t.pathComplet... | Load and run through test profile defined in a .csv. | 62599042097d151d1a2c232d |
class MotorPacketBits(ctypes.LittleEndianStructure): <NEW_LINE> <INDENT> _fields_ = [("motor_id", ctypes.c_uint8, 2), ("negative", ctypes.c_uint8, 1), ("speed", ctypes.c_uint8, 5)] | The bits for the packet sent to the motors.
Note that the mbed's processor is little endian, which is why a
``LittleEndianStructure`` is used.
See Also
--------
MotorPacket | 6259904210dbd63aa1c71e9d |
class FdbInterface(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> @catch_exceptions <NEW_LINE> def add(mac, dev, dst_ip=None, namespace=None, **kwargs): <NEW_LINE> <INDENT> priv_ip_lib.add_bridge_fdb(mac, dev, dst_ip=dst_ip, namespace=namespace, **kwargs) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> @catch_excep... | Provide basic functionality to edit the FDB table | 62599042d99f1b3c44d06962 |
class amg(pyamgcl_ext.amg): <NEW_LINE> <INDENT> def __init__(self, A, prm={}): <NEW_LINE> <INDENT> Acsr = A.tocsr() <NEW_LINE> self.shape = A.shape <NEW_LINE> pyamgcl_ext.amg.__init__(self, Acsr.indptr, Acsr.indices, Acsr.data, prm) | Algebraic multigrid hierarchy to be used as a preconditioner | 625990421d351010ab8f4de3 |
class MatchesDetail(View): <NEW_LINE> <INDENT> def get(self,request,match_id): <NEW_LINE> <INDENT> match = get_object_or_404(Matches, pk=match_id) <NEW_LINE> context = {'match': match} <NEW_LINE> return render(request, 'matches/detail.html', context) | View method for 'cricteam' app's matches' details page.
:param request:
:param match_id:
:return: HttpResponse | 6259904294891a1f408ba059 |
class UsageTrigger(InstanceResource): <NEW_LINE> <INDENT> def update(self, **kwargs): <NEW_LINE> <INDENT> return self.parent.update(self.name, **kwargs) <NEW_LINE> <DEDENT> def delete(self): <NEW_LINE> <INDENT> return self.parent.delete(self.name) | A usage trigger resource | 625990421d351010ab8f4de4 |
class SimulationResult: <NEW_LINE> <INDENT> def __init__(self, molecule_collection): <NEW_LINE> <INDENT> self.molecule_collection = molecule_collection <NEW_LINE> self.trace = [] <NEW_LINE> self.time = [] <NEW_LINE> <DEDENT> def add_timepoint(self, time): <NEW_LINE> <INDENT> self.trace.append(self.molecule_collection.c... | handles and stores a simulation result for one species | 62599042b5575c28eb71362c |
class DescribeFavorRepositoryPersonalRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RepoName = None <NEW_LINE> self.Limit = None <NEW_LINE> self.Offset = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.RepoName = params.get("RepoName") <NEW_LIN... | DescribeFavorRepositoryPersonal请求参数结构体
| 6259904282261d6c52730827 |
class mrp_replacement_resource(models.Model): <NEW_LINE> <INDENT> _name = 'mrp.replacement.resource' <NEW_LINE> _description = 'Replacement resource' <NEW_LINE> _rec_name = 'resource_id' <NEW_LINE> resource_id = fields.Many2one('mrp.resource', string='Resource', required=True, ondelete='cascade') <NEW_LINE> new_resourc... | Replacement resource | 62599042d7e4931a7ef3d33c |
class Pipeline(object): <NEW_LINE> <INDENT> def __init__(self, input_stage): <NEW_LINE> <INDENT> self._input_stage = input_stage <NEW_LINE> self._output_stages = input_stage.getLeaves() <NEW_LINE> self._input_stage.build() <NEW_LINE> <DEDENT> def put(self, task): <NEW_LINE> <INDENT> self._input_stage.put(task) <NEW_LIN... | A pipeline of stages. | 6259904245492302aabfd7a1 |
class Model(object): <NEW_LINE> <INDENT> def __init__(self, input_dim, *layers): <NEW_LINE> <INDENT> self.x = PlaceHolder(input_dim) <NEW_LINE> last_layer = self.x <NEW_LINE> for layer in layers: <NEW_LINE> <INDENT> if layer == "linear": <NEW_LINE> <INDENT> last_layer = Linear(32, last_layer) <NEW_LINE> <DEDENT> if lay... | used to create complete models. Persistently stores varaibles
values between updates. Exposes handles for training the model
and for checking accuracy | 625990420fa83653e46f61a0 |
class WarningsValueListEntry(_messages.Message): <NEW_LINE> <INDENT> class CodeValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> CLEANUP_FAILED = 0 <NEW_LINE> DEPRECATED_RESOURCE_USED = 1 <NEW_LINE> DISK_SIZE_LARGER_THAN_IMAGE_SIZE = 2 <NEW_LINE> INJECTED_KERNELS_DEPRECATED = 3 <NEW_LINE> NEXT_HOP_ADDRESS_NOT_ASSIGN... | A WarningsValueListEntry object.
Enums:
CodeValueValuesEnum: [Output Only] A warning code, if applicable. For
example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no
results in the response.
Messages:
DataValueListEntry: A DataValueListEntry object.
Fields:
code: [Output Only] A warning code... | 6259904207f4c71912bb06f8 |
class TemporaryRedirect(Response): <NEW_LINE> <INDENT> status_code = 307 | 307 Temporary Redirect
Should be used to tell clients to resubmit the request to another URI.
HTTP/1.1 introduced the 307 status code to reiterate the originally
intended semantics of the 302 ("Found") status code. A 307 response
indicates that the REST API is not going to process the client's request.
Instead, the cli... | 6259904230dc7b76659a0af6 |
class TestPath(object): <NEW_LINE> <INDENT> def test_regular_isdir_isfile_islink(self): <NEW_LINE> <INDENT> host = test_base.ftp_host_factory() <NEW_LINE> testdir = "/home/sschwarzer" <NEW_LINE> host.chdir(testdir) <NEW_LINE> assert not host.path.isdir("notthere") <NEW_LINE> assert not host.path.isfile("notthere") <NEW... | Test operations in `FTPHost.path`. | 62599042d53ae8145f919724 |
class EpistasisClassifierMixin: <NEW_LINE> <INDENT> def _fit_additive(self, X=None, y=None): <NEW_LINE> <INDENT> self.Additive = EpistasisLinearRegression( order=1, model_type=self.model_type) <NEW_LINE> self.Additive.add_gpm(self.gpm) <NEW_LINE> self.Additive.epistasis = EpistasisMap( sites=self.Additive.Xcolumns, ) <... | A Mixin class for epistasis classifiers
| 6259904207d97122c4217f66 |
class ExpectRemoteRef(object): <NEW_LINE> <INDENT> def __init__(self, rrclass): <NEW_LINE> <INDENT> self.rrclass = rrclass <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return isinstance(other, self.rrclass) | Define an expected RemoteReference in the args to an L{Expect} class | 6259904207f4c71912bb06f9 |
class LocationInfoAction(Action): <NEW_LINE> <INDENT> name = "info" <NEW_LINE> target_type = "location" <NEW_LINE> @classmethod <NEW_LINE> def setup_cl_args(cls, parser): <NEW_LINE> <INDENT> parser.add_argument( "code", nargs="?", default=current_location_code(), help="Print info for the supplied location code." ) <NEW... | Print information about a location. | 62599042d99f1b3c44d06964 |
class PhysicalProvider(TefloProvider): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(PhysicalProvider, self).__init__() <NEW_LINE> pass | Physical provider class. | 625990426fece00bbacccc79 |
class Item: <NEW_LINE> <INDENT> def __init__(self, x, y, height, width, board): <NEW_LINE> <INDENT> self.__x = x <NEW_LINE> self.__y = y <NEW_LINE> self.__height = height <NEW_LINE> self.__width = width <NEW_LINE> self.__matrix = [] <NEW_LINE> <DEDENT> def get_x(self): <NEW_LINE> <INDENT> return self.__x <NEW_LINE> <DE... | General item class to define various
obstacles and objects | 625990421d351010ab8f4de6 |
class WebMediaSlice: <NEW_LINE> <INDENT> def __init__(self, source): <NEW_LINE> <INDENT> self.source = source <NEW_LINE> _, self.name = split(source) <NEW_LINE> self.width = int(re.match(r'^.+-(\d+)\..+$', source).groups()[0]) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> media_type = 'image' <NEW_LINE> i... | A slice is a single processed file that makes up part of the output for
a given source media file.
For example, if canoe-trip.mp4 was the source file, you might see slices
like canoe-trip-640.mp4 and canoe-trip-1080.mp4. | 62599042507cdc57c63a6064 |
class PublicAPIStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.GetInfo = channel.unary_unary( '/v1alpha.PublicAPI/GetInfo', request_serializer=api__pb2.GetInfoRequest.SerializeToString, response_deserializer=api__pb2.GetInfoResponse.FromString, ) <NEW_LINE> self.ListPods = channe... | PublicAPI defines the read-only APIs that will be supported.
These will be handled over TCP sockets. | 62599042d10714528d69eff0 |
class TestDiceRoller(unittest.TestCase): <NEW_LINE> <INDENT> def test_multi_roll(self): <NEW_LINE> <INDENT> d = dice_roll.DiceRoller(dice_roll.Dice(6)) <NEW_LINE> t = d.roll(4) <NEW_LINE> self.assertTrue(len(t) == 4) | Test multiple roll functionality | 625990426e29344779b0191b |
class MySpider(scrapy.spiders.Spider): <NEW_LINE> <INDENT> name = 'myFirst' <NEW_LINE> page_index = 1 <NEW_LINE> def start_requests(self): <NEW_LINE> <INDENT> urls = [ 'http://lab.scrapyd.cn/' ] <NEW_LINE> for url in urls: <NEW_LINE> <INDENT> yield scrapy.Request(url=url, callback=self.parse) <NEW_LINE> <DEDENT> <DEDEN... | 定义一个蜘蛛类,类名随意,必须继承scrapy.Spider
var name:蜘蛛的名称,唯一
fun start_requests:蜘蛛运行的方法,请求对应的页面
fun parse:页面请求后的回调方法,后续的解析都会在这里 | 6259904245492302aabfd7a3 |
class MinimaxPlayer(IsolationPlayer): <NEW_LINE> <INDENT> def get_move(self, game, time_left): <NEW_LINE> <INDENT> self.time_left = time_left <NEW_LINE> best_move = (-1, -1) <NEW_LINE> try: <NEW_LINE> <INDENT> return self.minimax(game, self.search_depth) <NEW_LINE> <DEDENT> except SearchTimeout: <NEW_LINE> <INDENT> ret... | Game-playing agent that chooses a move using depth-limited minimax
search. You must finish and test this player to make sure it properly uses
minimax to return a good move before the search time limit expires. | 625990428e71fb1e983bcd96 |
class FlowListMixin(object): <NEW_LINE> <INDENT> ns_map = None <NEW_LINE> ns_map_absolute = False <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.ns_map = kwargs.get('ns_map', {}) <NEW_LINE> super(FlowListMixin, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> @property <NEW_LINE> def flows(... | Mixin for list view contains multiple flows. | 625990420fa83653e46f61a2 |
class FormDelivery(Form): <NEW_LINE> <INDENT> title = StringField(label='Заголовок', validators=[ validators.Required(message='Это поле необходимо заполнить'), validators.Length(max=255, message='Поле не должно превышать более %(max)s символов') ]) <NEW_LINE> description = TextAreaField(label='Описание', validators=[ v... | Доставка | 6259904273bcbd0ca4bcb553 |
class ExtraContextTemplateView(TemplateView): <NEW_LINE> <INDENT> extra_context = None <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(ExtraContextTemplateView, self).get_context_data(**kwargs) <NEW_LINE> if self.extra_context is not None: <NEW_LINE> <INDENT> context.update(self.ext... | Extends TemplateView to accept a dictionary of additional context.
Example usage in URL config:
url(r'^foo/$', ExtraContextTemplateView.as_view(
template_name='foo.html', extra_context={'foo': 'bar'})), | 62599042e76e3b2f99fd9cd3 |
class RestBadParameter(RestDispException404): <NEW_LINE> <INDENT> pass; | Bad parameter. | 625990428a43f66fc4bf345a |
class WampRawSocketServerFactory(WampRawSocketFactory): <NEW_LINE> <INDENT> protocol = WampRawSocketServerProtocol <NEW_LINE> def __init__(self, factory, serializers=None): <NEW_LINE> <INDENT> assert(callable(factory)) <NEW_LINE> self._factory = factory <NEW_LINE> if serializers is None: <NEW_LINE> <INDENT> serializers... | Base class for Twisted-based WAMP-over-RawSocket server factories. | 625990423eb6a72ae038b929 |
class TestJob1(interface.TurbiniaJob): <NEW_LINE> <INDENT> NAME = 'testjob1' <NEW_LINE> def create_tasks(self, evidence): <NEW_LINE> <INDENT> return None | Test job. | 62599042d164cc6175822240 |
class URLScene(NormalizedScene): <NEW_LINE> <INDENT> def __init__(self, metadata_url, band_urls=None): <NEW_LINE> <INDENT> self._metadata_url = metadata_url <NEW_LINE> if band_urls is None: <NEW_LINE> <INDENT> self._band_base_url = metadata_url.rsplit('/', maxsplit=1)[0] <NEW_LINE> <DEDENT> elif isinstance(band_urls, s... | Lazy NormalizedScene that is read via urlopen | 62599042596a897236128f13 |
class IPhoneWidget(ITextWidget): <NEW_LINE> <INDENT> pass | A Phone widget ( html5 type="tel") | 6259904291af0d3eaad3b0ed |
class CurrencyDoesntExistError(Exception): <NEW_LINE> <INDENT> pass | exchange rate for either of the currency codes doesn't exist on the date
I will show an appropriate message. | 625990428c3a8732951f7823 |
class TestConcave: <NEW_LINE> <INDENT> def test_no_surfaces(self): <NEW_LINE> <INDENT> S = [Point(0.9, 0.5, 0.5)] <NEW_LINE> R = [Point(0.1, 0.501, 0.501)] <NEW_LINE> walls = [] <NEW_LINE> model = Model(walls, S, R) <NEW_LINE> with pytest.raises(ValueError): <NEW_LINE> <INDENT> list(model.mirrors()) <NEW_LINE> <DEDENT>... | Tests for :class:`ism.Model`.
| 62599042c432627299fa4266 |
class KNNRegresser(KNN): <NEW_LINE> <INDENT> def _predict_one(self, array, smoothing, probability): <NEW_LINE> <INDENT> k_nearest_indices = self._k_nearest_indices(array) <NEW_LINE> k_nearest_labels = self._y[k_nearest_indices] <NEW_LINE> if self.weights == "uniform": <NEW_LINE> <INDENT> my_weights = np.repeat(1, repea... | This class is the child class of the KNN class that is performs
KNN regression. | 625990426fece00bbacccc7b |
class RecordBuilder(object): <NEW_LINE> <INDENT> def __init__(self, rel_path=None): <NEW_LINE> <INDENT> super(RecordBuilder, self).__init__() <NEW_LINE> self.rel_path = rel_path <NEW_LINE> self.lf = { "local_version": 0, "local_size": 0, "local_mtime": 0, "local_permission": 0, } <NEW_LINE> self.rf = { "remote_version"... | docstring for RecordBuilder | 62599042507cdc57c63a6066 |
class TenantAdd(Command): <NEW_LINE> <INDENT> log = logging.getLogger(__name__) <NEW_LINE> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(TenantAdd, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( 'tenant_name', metavar='<tenant-name>', help='Tenant name', ) <NEW_LINE> parser.add_argume... | Add a tenant. | 6259904223e79379d538d7c8 |
class EscenaJuego(Escena): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Escena.__init__(self) <NEW_LINE> self.fondo = cargar_imagen("fondo.jpg") <NEW_LINE> self.pelota = Pelota() <NEW_LINE> self.jugador = Jugador() <NEW_LINE> self.muro = Muro() <NEW_LINE> self.puntos = 0 <NEW_LINE> self.puntuacion = Text... | Clase que define la escena principal del videojuego. | 625990424e696a045264e786 |
class about(): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> response = current.response <NEW_LINE> request = current.request <NEW_LINE> T = current.T <NEW_LINE> view = path.join(request.folder, "private", "templates", "DRRPP", "views", "about.html") <NEW_LINE> try: <NEW_LINE> <INDENT> response.view = ope... | Custom About page | 62599042d7e4931a7ef3d340 |
class ReportIndex(TemplateView): <NEW_LINE> <INDENT> template_name = 'ereports/index.html' <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> reports = [] <NEW_LINE> for report in ReportConfiguration.objects.filter(published=True).order_by('group', 'name'): <NEW_LINE> <INDENT> reports.append(report) <... | Index of all available reports for an office
| 6259904224f1403a92686231 |
class ExpFitSGCombinedSNR(ExpFitCombinedSNR): <NEW_LINE> <INDENT> def __init__(self, files, ifos=None): <NEW_LINE> <INDENT> ExpFitCombinedSNR.__init__(self, files, ifos=ifos) <NEW_LINE> self.get_newsnr = ranking.get_newsnr_sgveto | ExpFitCombinedSNR but with sine-Gaussian veto added to the single
detector ranking | 62599042b57a9660fecd2d46 |
class CIFARBasicBlockV2(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channels, channels, stride, downsample=False, **kwargs): <NEW_LINE> <INDENT> super(CIFARBasicBlockV2, self).__init__(**kwargs) <NEW_LINE> self.bn1 = nn.BatchNorm2d(in_channels) <NEW_LINE> self.conv1 = _conv3x3(in_channels, channels, stride) <... | BasicBlock V2 from
`"Identity Mappings in Deep Residual Networks"
<https://arxiv.org/abs/1603.05027>`_ paper.
This is used for ResNet V2 for 18, 34 layers.
Parameters
----------
in_channels : int
Number of input channels.
channels : int
Number of output channels.
stride : int
Stride size.
downsample : bool... | 6259904229b78933be26aa28 |
class CudaErrorCheck(CustomCodeNode): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__(f'{self.err_check_function.function_name}(cudaPeekAtLastError());', [], []) <NEW_LINE> <DEDENT> err_check_function = CudaErrorCheckDefinition() <NEW_LINE> required_global_declarations = [err_check_function... | Checks whether the last call to the CUDA API was successful and panics in the negative case.
.. code:: c++
# define gpuErrchk(ans) { gpuAssert((ans), __PRETTY_FUNCTION__, __FILE__, __LINE__); }
inline static void gpuAssert(cudaError_t code, const char* function, const char *file, int line, bool abort=true)
... | 625990421f5feb6acb163ebe |
class ILiegeUrbanLayer(IDefaultBrowserLayer): <NEW_LINE> <INDENT> pass | Marker interface that defines a browser layer. | 62599042d53ae8145f919728 |
class PMarkov(PStochasticPattern): <NEW_LINE> <INDENT> def __init__(self, nodes=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> if isinstance(nodes, list): <NEW_LINE> <INDENT> learner = MarkovLearner() <NEW_LINE> for value in nodes: <NEW_LINE> <INDENT> learner.register(value) <NEW_LINE> <DEDENT> self.nodes = l... | PMarkov: First-order Markov chain generator.
| 62599042e64d504609df9d36 |
class Location: <NEW_LINE> <INDENT> def __init__(self, city: str = None, postoffice: int = None): <NEW_LINE> <INDENT> self.city = city <NEW_LINE> self.postoffice = postoffice | Location were to deliver a thing
>>> place = Location('Lwiw', 121)
>>> place.__class__.__name__
'Location' | 6259904207f4c71912bb06fd |
class ActorViewset(ModelViewSet): <NEW_LINE> <INDENT> queryset = Actor.objects.all() <NEW_LINE> serializer_class = ActorSerializer | A simple ViewSet for viewing and editing accounts. | 6259904215baa7234946325d |
class Paviani(Benchmark): <NEW_LINE> <INDENT> def __init__(self, dimensions=10): <NEW_LINE> <INDENT> Benchmark.__init__(self, dimensions) <NEW_LINE> self.bounds = zip([2.001] * self.dimensions, [9.999] * self.dimensions) <NEW_LINE> self.global_optimum = [9.350266 for _ in range(self.dimensions)] <NEW_LINE> self.fglob =... | Paviani test objective function.
This class defines the Paviani global optimization problem. This
is a multimodal minimization problem defined as follows:
.. math::
f_{\text{Paviani}}(\mathbf{x}) = \sum_{i=1}^{10} \left[\log^{2}\left(10 - x_i\right) + \log^{2}\left(x_i -2\right)\right] - \left(\prod_{i=1}^{10} x... | 6259904266673b3332c316c5 |
class Card(object): <NEW_LINE> <INDENT> values = {"T": 10, "J": 11, "Q": 12, "K": 13, "A": 14} <NEW_LINE> def __init__(self, value, suit): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.value = int(value) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> self.value = Card.values[value.upper()] <NEW_LINE> <D... | Standard playing card | 62599042507cdc57c63a6068 |
class Strategy(metaclass=abc.ABCMeta): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def run(self): <NEW_LINE> <INDENT> pass | Контекст использует данный интерфейс для вызова алгоритма, определённого
конкретной стратегией | 6259904207d97122c4217f6b |
class White(Token): <NEW_LINE> <INDENT> whiteStrs = { ' ' : '<SP>', '\t': '<TAB>', '\n': '<LF>', '\r': '<CR>', '\f': '<FF>', u'\u00A0': '<NBSP>', u'\u1680': '<OGHAM_SPACE_MARK>', u'\u180E': '<MONGOLIAN_VOWEL_SEPARATOR>', u'\u2000': '<EN_QUAD>', u'\u2001': '<EM_QUAD>', u'\u2002': '<EN_SPACE>', u'\u2003': '<EM_SPACE>', u... | Special matching class for matching whitespace. Normally,
whitespace is ignored by pyparsing grammars. This class is included
when some whitespace structures are significant. Define with
a string containing the whitespace characters to be matched; default
is ``" \t\r\n"``. Also takes optional ``min``,
``max``, and ... | 62599042b57a9660fecd2d47 |
class MSG_srec_end_ok(RXMessage): <NEW_LINE> <INDENT> _format = '>BBB' <NEW_LINE> _filter = [(True, 0), (True, 0), (True, 1)] <NEW_LINE> def __init__(self, raw): <NEW_LINE> <INDENT> super().__init__(expected_id=RSP_ID, raw=raw) | sent in response to an internal part of an S-record | 6259904282261d6c5273082a |
class JvoltDipole: <NEW_LINE> <INDENT> def __init__(self, VoltDpinfo): <NEW_LINE> <INDENT> self.dipole = VoltDpinfo.DIPOLE <NEW_LINE> try: <NEW_LINE> <INDENT> self.Rx1x = float(VoltDpinfo.Rx1x) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self.Rx1y = float(VoltDpinfo... | object containing voltage information | 6259904245492302aabfd7a7 |
class BatchTransform(Transform): <NEW_LINE> <INDENT> def __init__(self, job_queue, job_definition, parameters=None, container_overrides=None, **kwargs): <NEW_LINE> <INDENT> super(BatchTransform, self).__init__(**kwargs) <NEW_LINE> self.job_queue = job_queue <NEW_LINE> self.job_definition = job_definition <NEW_LINE> sel... | docstring for . | 625990420fa83653e46f61a6 |
class removeByInner_args(object): <NEW_LINE> <INDENT> def __init__(self, boxId=None, innerPath=None,): <NEW_LINE> <INDENT> self.boxId = boxId <NEW_LINE> self.innerPath = innerPath <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CRea... | Attributes:
- boxId
- innerPath | 62599042e76e3b2f99fd9cd7 |
class ProtocolError(object): <NEW_LINE> <INDENT> pass | Invalid protocol exception raised for AddOn Traffic. | 6259904223849d37ff852386 |
class TestUpdateUserHandler(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.__interactor = Mock(UpdateUserInteractor) <NEW_LINE> interactor_factory = Mock(InteractorFactory) <NEW_LINE> interactor_factory.create = Mock(return_value=self.__interactor) <NEW_LINE> self.__target = UpdateUse... | Unit tests for the UpdateUserHandler class | 62599042d164cc6175822244 |
class OggPacket(_vorbisenc.ogg_packet): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(OggPacket, self).__init__() | An ogg packet wrapper.
| 6259904291af0d3eaad3b0f1 |
class directoryServiceStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.GetFileServer = channel.unary_unary( '/directoryService/GetFileServer', request_serializer=service__pb2.SimpleRequest.SerializeToString, response_deserializer=service__pb2.SimpleReply.FromString, ) <NEW_LINE> s... | 目录服务器
| 625990428c3a8732951f7827 |
class Error(Exception): <NEW_LINE> <INDENT> pass | Base Class for all exceptions | 6259904215baa7234946325f |
@skipIfFailed(TestDesign, TestDesign.test_functions_defined.__name__, tag=A1.display_guess_matrix.__name__) <NEW_LINE> class TestDisplayGuessMatrix(TestFunctionality): <NEW_LINE> <INDENT> def test_display_01(self): <NEW_LINE> <INDENT> with RedirectStdIO(stdinout=True) as stdio: <NEW_LINE> <INDENT> self.a1.display_guess... | Tests display_guess_matrix | 625990423c8af77a43b688a3 |
class LoginPageLocators(object): <NEW_LINE> <INDENT> USERNAME = (By.ID, 'username') <NEW_LINE> PASSWORD = (By.ID, 'password') <NEW_LINE> SUBMIT = (By.NAME, 'op') | A class for login page locators. All login page locators should come here | 62599042e76e3b2f99fd9cd9 |
class CannotBindAction(APIException): <NEW_LINE> <INDENT> name = 'cannot-bind-action' | This exception is raised when an Action is attempted to be assigned to a
Target that does not exist. | 625990428a43f66fc4bf3460 |
class EventSendPort(EventPort, SendPort): <NEW_LINE> <INDENT> nineml_type = 'EventSendPort' | EventSendPort
An |EventSendPort| is a port that can transmit discrete events at
points in time. For example, an integrate-and-fire could 'send' events to
notify other components that it had fired. | 625990421f5feb6acb163ec2 |
class SingleColumnDataExampleWithoutSlices(Tracker): <NEW_LINE> <INDENT> tracks = ("track1", "track2", "track3") <NEW_LINE> def __call__(self, track, slice=None): <NEW_LINE> <INDENT> s = [random.randint(0, 20) for x in range(40)] <NEW_LINE> random.shuffle(s) <NEW_LINE> return odict((("data", s),)) | return a single column of data. | 625990428a349b6b43687517 |
class Driver(object): <NEW_LINE> <INDENT> instance = None <NEW_LINE> @classmethod <NEW_LINE> def get_instance(cls): <NEW_LINE> <INDENT> if cls.instance is None: <NEW_LINE> <INDENT> cls.instance = Driver() <NEW_LINE> <DEDENT> return cls.instance <NEW_LINE> <DEDENT> def __init__(self): <NEW_LINE> <INDENT> self.driver = w... | Singleton class for interacting with the selenium webdriver object | 6259904229b78933be26aa2a |
class Package(object): <NEW_LINE> <INDENT> def __init__(self, kind, name, version): <NEW_LINE> <INDENT> self.kind = kind <NEW_LINE> self.name = name <NEW_LINE> self.version = version <NEW_LINE> self.required_by = [] <NEW_LINE> self.morphology = None <NEW_LINE> self.dependencies = None <NEW_LINE> self.is_build_dep = Fal... | A package in the processing queue.
In order to provide helpful errors, this item keeps track of what
packages depend on it, and hence of why it was added to the queue. | 6259904207d97122c4217f6e |
class TestReupholster(TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> delete_all_locations() <NEW_LINE> cls.domain = create_domain('locations-test') <NEW_LINE> cls.domain.locations_enabled = True <NEW_LINE> bootstrap_location_types(cls.domain.name) <NEW_LINE> cls.state = ... | These tests were written to drive removal of sepecific queries. It
is safe to delete this when the reuholstering of Location is done
and somone has written test coverage for the methods used in here. | 62599042b830903b9686ede1 |
class ManagerNotificationWrapper(object): <NEW_LINE> <INDENT> def __init__(self, operation, resource_type, host=None): <NEW_LINE> <INDENT> self.operation = operation <NEW_LINE> self.resource_type = resource_type <NEW_LINE> RESOURCE_TYPES.add(resource_type) <NEW_LINE> self.host = host <NEW_LINE> <DEDENT> def __call__(se... | Send event notifications for ``Manager`` methods.
Sends a notification if the wrapped Manager method does not raise an
``Exception`` (such as ``keystone.exception.NotFound``).
:param resource_type: type of resource being affected
:param host: host of the resource (optional) | 62599042baa26c4b54d50578 |
class ParametricBuffer(BalancedExemplarsBuffer): <NEW_LINE> <INDENT> def __init__( self, max_size: int, groupby=None, selection_strategy: Optional["ExemplarsSelectionStrategy"] = None, ): <NEW_LINE> <INDENT> super().__init__(max_size) <NEW_LINE> assert groupby in {None, "task", "class", "experience"}, ( "Unknown groupi... | Stores samples for replay using a custom selection strategy and
grouping. | 6259904216aa5153ce4017bc |
class PostOwnStatus(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self, request, view, obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return obj.user_profile.id == request.user.id | Allow users to update their own status. | 62599042d99f1b3c44d0696c |
class NewTaskSchema(colander.Schema): <NEW_LINE> <INDENT> name = colander.SchemaNode( colander.String(), title=u"Nom du document", description=u"Ce nom n'apparaît pas dans le document final", validator=colander.Length(max=255), default=deferred_default_name, missing="", ) <NEW_LINE> customer_id = customer_choice_node_f... | schema used to initialize a new task | 6259904221a7993f00c67237 |
class Associator: <NEW_LINE> <INDENT> def __init__(self, profile_name, debug=False, vpc_id=None, vpc_region=None): <NEW_LINE> <INDENT> self.debug = debug <NEW_LINE> self.vpc_id = None <NEW_LINE> self.vpc_region = None <NEW_LINE> self.profile_name = profile_name <NEW_LINE> self.utility = Utils(debug=self.debug) <NEW_LIN... | Creates an Associator object | 6259904291af0d3eaad3b0f3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.