code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class HtmlLexer(RegexLexer): <NEW_LINE> <INDENT> name = 'HTML' <NEW_LINE> aliases = ['html'] <NEW_LINE> filenames = ['*.html', '*.htm', '*.xhtml', '*.xslt'] <NEW_LINE> mimetypes = ['text/html', 'application/xhtml+xml'] <NEW_LINE> flags = re.IGNORECASE | re.DOTALL <NEW_LINE> tokens = { 'root': [ ('[^<&]+', Text), (r'&\S... | For HTML 4 and XHTML 1 markup. Nested JavaScript and CSS is highlighted
by the appropriate lexer. | 62598f57462c4b4f79dbaefe |
class PerlGdText(PerlPackage): <NEW_LINE> <INDENT> homepage = "http://search.cpan.org/~mverb/GDTextUtil-0.86/Text.pm" <NEW_LINE> url = "http://search.cpan.org/CPAN/authors/id/M/MV/MVERB/GDTextUtil-0.86.tar.gz" <NEW_LINE> version('0.86', '941ad06eadc86b47f3a32da405665c41') <NEW_LINE> depends_on('perl-gd', type=('bu... | Text utilities for use with GD | 62598f57507cdc57c63a429b |
class HiddenStateMLPPooling(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, hidden_dim=128, mlp_dim=128, mlp_dim_spatial=32, mlp_dim_vel=32, out_dim=None): <NEW_LINE> <INDENT> super(HiddenStateMLPPooling, self).__init__() <NEW_LINE> self.out_dim = out_dim or hidden_dim <NEW_LINE> self.spatial_embedding = torch... | Interaction vector is obtained by max-pooling the embeddings of relative coordinates
and hidden-state of all neighbours. Proposed in Social GAN
Attributes
----------
mlp_dim : Scalar
Embedding dimension of each neighbour
mlp_dim_spatial : Scalar
Embedding dimension of relative spatial coordinates
mlp_dim_vel: ... | 62598f575e10d32532ce3366 |
class Edge: <NEW_LINE> <INDENT> def __init__(self, alpha, beta, relation = None): <NEW_LINE> <INDENT> self._points = (alpha, beta) <NEW_LINE> if relation: <NEW_LINE> <INDENT> self._relation = relation(alpha,beta) <NEW_LINE> <DEDENT> <DEDENT> @property <NEW_LINE> def points(self): <NEW_LINE> <INDENT> return self._points | Connection between two nodes. Takes in parameters of two points to be connected. | 62598f5715fb5d323ce7e229 |
class RsyslogFieldParser(FieldParser): <NEW_LINE> <INDENT> log_rule_re = re.compile(r"([\w,\*]+)\.([\w,!=\*]+)") <NEW_LINE> destinations = collections.OrderedDict([ ("TCP", re.compile(r"(?:@@)([^;]*)")), ("UDP", re.compile(r"(?:@)([^;]*)")), ("PIPE", re.compile(r"(?:\|)([^;]*)")), ("NONE", re.compile(r"(?:~)([^;]*)")),... | Field parser for syslog configurations. | 62598f57ff9c53063f519b4d |
@add_status_code(504) <NEW_LINE> class TimeoutException(ServerException): <NEW_LINE> <INDENT> pass | 服务器连接超时异常. | 62598f57bf627c535bcb097d |
class GroupCollectionPermission(models.Model): <NEW_LINE> <INDENT> group = models.ForeignKey( Group, verbose_name=_('group'), related_name='collection_permissions', on_delete=models.CASCADE ) <NEW_LINE> collection = models.ForeignKey( Collection, verbose_name=_('collection'), related_name='group_permissions', on_delete... | A rule indicating that a group has permission for some action (e.g. "create document")
within a specified collection. | 62598f57d18da76e235b6bb6 |
class BasicSimplifier(object): <NEW_LINE> <INDENT> def __init__(self, target): <NEW_LINE> <INDENT> self.target = target <NEW_LINE> self.memoization_map = {} <NEW_LINE> <DEDENT> def simplify_node(self, node): <NEW_LINE> <INDENT> result = node <NEW_LINE> if node in self.memoization_map: <NEW_LINE> <INDENT> return self.me... | Basic expansion engine | 62598f57ff9c53063f519b4f |
class DataWrapper(object): <NEW_LINE> <INDENT> def __init__(self, default_value=None): <NEW_LINE> <INDENT> self.data = default_value <NEW_LINE> <DEDENT> def __getitem__(self, keyName): <NEW_LINE> <INDENT> if keyName == "data": <NEW_LINE> <INDENT> return self.data <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Exce... | A wrapper class to contain an immutable object. The purpose is to allow
a program to track a reference to an object (most importantly an immutable
object)
For now, we'll keep this extra-stupidly simple. We will allow self.data
to be literally anything. | 62598f57a8ecb03325870703 |
class RegistroD359(Registro): <NEW_LINE> <INDENT> campos = [ CampoFixo(1, 'REG', 'D359'), Campo(2, 'NUM_PROC', obrigatorio=True), Campo(3, 'IND_PROC', obrigatorio=True), ] | Processo Referenciado | 62598f57711fe17d825dfbf9 |
class ContactsModel(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._tablename_ = 'hvp_contacts' <NEW_LINE> <DEDENT> def get_wtform_choices(self): <NEW_LINE> <INDENT> sql = "SELECT id,name FROM "+self._tablename_+" ORDER by name;" <NEW_LINE> data = engine.execute(sql) <NEW_LINE> choices = list... | adresses | 62598f57462c4b4f79dbaf04 |
class __FreezeClass__ (type): <NEW_LINE> <INDENT> def __setattr__(self, name, _ignored): <NEW_LINE> <INDENT> err = "You tried to set the instance variable "" + name + ""\n" <NEW_LINE> err += " on the CLASS "" + self.__name__ + """ <NEW_LINE> err += ", which is not an OBJECT.\n" <NEW_LINE> err += " Did you forget th... | Prevents class variable assignment. | 62598f574d74a7450cd58959 |
class ApiGetClientApprovalHandlerRegressionTest( api_regression_test_lib.ApiRegressionTest, acl_test_lib.AclTestMixin): <NEW_LINE> <INDENT> api_method = "GetClientApproval" <NEW_LINE> handler = user_plugin.ApiGetClientApprovalHandler <NEW_LINE> def Run(self): <NEW_LINE> <INDENT> with test_lib.FakeTime(42): <NEW_LINE> <... | Regression test for ApiGetClientApprovalHandler. | 62598f579b70327d1c57e2ad |
class FunctionSettings: <NEW_LINE> <INDENT> @abstractclassmethod <NEW_LINE> def initialize(cls): <NEW_LINE> <INDENT> pass | Inherited class shoud be named function name. | 62598f57462c4b4f79dbaf06 |
class Test_scalar_cell_method(tests.IrisTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.cube = stock.simple_2d() <NEW_LINE> self.cm = CellMethod('mean', 'foo', '1 hour') <NEW_LINE> self.cube.cell_methods = (self.cm, ) <NEW_LINE> <DEDENT> def test_cell_method_found(self): <NEW_LINE> <INDENT> actual ... | Tests for iris.fileformats.rules.scalar_cell_method() function | 62598f574d74a7450cd5895b |
class TestTags: <NEW_LINE> <INDENT> def test_description(self): <NEW_LINE> <INDENT> s = idlsave.read(path.join(DATA_PATH, 'scalar_byte_descr.sav'), verbose=False) <NEW_LINE> assert_identical(s.i8u, np.uint8(234)) | Test that sav files with description tag read at all | 62598f57d164cc6175820488 |
class UserManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, email, password, **extra_fields): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError(_('The Email must be set')) <NEW_LINE> <DEDENT> user = self.model( email=self.normalize_email(email), **extra_fields ) <NEW_LINE> user.se... | Custom user model manager where email
is a unique authentication identifier. | 62598f5876d4e153a661c119 |
class ServerlessProjectsLocationsServicesGetRequest(_messages.Message): <NEW_LINE> <INDENT> name = _messages.StringField(1, required=True) | A ServerlessProjectsLocationsServicesGetRequest object.
Fields:
name: The name of the service being retrieved. If needed, replace
{namespace_id} with the project ID. | 62598f58925a0f43d25e753d |
class AdaIn(nn.Module): <NEW_LINE> <INDENT> def __init__(self, n_channel): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.norm = nn.InstanceNorm2d(n_channel) <NEW_LINE> <DEDENT> def forward(self, image, style): <NEW_LINE> <INDENT> factor, bias = style.chunk(2, 1) <NEW_LINE> result = self.norm(image) <NEW_LINE> ... | adaptive instance normalization | 62598f58be8e80087fbbe563 |
class HSV(gtk.ColorSelection): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> gtk.ColorSelection.__init__(self) <NEW_LINE> self.get_children()[0].remove(self.get_children()[0].get_children()[1]) <NEW_LINE> self.get_children()[0].get_children()[0].remove(self.get_children()[0].get_children()[0].get_children... | HSV. | 62598f586fece00bbaccae9c |
class QLearningAgent(ReinforcementAgent): <NEW_LINE> <INDENT> def __init__(self, **args): <NEW_LINE> <INDENT> ReinforcementAgent.__init__(self, **args) <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> self.qValues = util.Counter() <NEW_LINE> <DEDENT> def getActionOrVal(self, state, actions, act): <NEW_LINE> <INDENT> maxQ... | Q-Learning Agent
Functions you should fill in:
- computeValueFromQValues
- computeActionFromQValues
- getQValue
- getAction
- update
Instance variables you have access to
- self.epsilon (exploration prob)
- self.alpha (learning rate)
- self.discount (discount rate)
Functions you should use
- self.g... | 62598f58796e427e5384dca0 |
class ArrayFile: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._lines = [] <NEW_LINE> <DEDENT> def __call__(self, string: ByteString): <NEW_LINE> <INDENT> self._lines.append(string) <NEW_LINE> <DEDENT> def read(self): <NEW_LINE> <INDENT> return self._lines <NEW_LINE> <DEDENT> def copy(self): <NEW_LIN... | Array that behaves like a file.
Is used by FailSim to keep track of commands sent to Mad-X.
Examples:
A simple example showing writing to and reading from an ArrayFile object.
>>> af = ArrayFile() # Create ArrayFile object
>>> af("Hello") # Write to ArrayFile
>>> af(" world!")
>>> x = af.read() #... | 62598f584d74a7450cd5895e |
class PsqlError(Exception): <NEW_LINE> <INDENT> pass | psql reported an error or exited prematurely | 62598f58507cdc57c63a42ab |
class FakeWindow: <NEW_LINE> <INDENT> def __init__(self, identity: str = None): <NEW_LINE> <INDENT> self.identity = identity <NEW_LINE> self.name = "" <NEW_LINE> self.session = "" <NEW_LINE> self.number = None <NEW_LINE> self.directory = "" <NEW_LINE> self.layout = "" <NEW_LINE> <DEDENT> def set_session_name(self, sess... | Represents a window in a tmux session, for test injection | 62598f58be8e80087fbbe567 |
class Loc(object): <NEW_LINE> <INDENT> blank = 0 <NEW_LINE> comment = 0 <NEW_LINE> files = 0 <NEW_LINE> source = 0 <NEW_LINE> ext = '.py' <NEW_LINE> _time0 = 0 <NEW_LINE> _recurse = False <NEW_LINE> _verbose = False <NEW_LINE> def __init__(self, recurse=False, verbose=False): <NEW_LINE> <INDENT> if recurse: <N... | Lines-Of-Code accumulator.
| 62598f58507cdc57c63a42ad |
class EdgescanParser(object): <NEW_LINE> <INDENT> def get_scan_types(self): <NEW_LINE> <INDENT> return [SCANTYPE_EDGESCAN] <NEW_LINE> <DEDENT> def get_label_for_scan_types(self, scan_type): <NEW_LINE> <INDENT> return scan_type <NEW_LINE> <DEDENT> def get_description_for_scan_types(self, scan_type): <NEW_LINE> <INDENT> ... | Import from Edgescan API or JSON file | 62598f58925a0f43d25e7543 |
class HttpOptions(object): <NEW_LINE> <INDENT> def __init__(self, *options, **kwargs): <NEW_LINE> <INDENT> self._options = dict() <NEW_LINE> self.update(*options, **kwargs) <NEW_LINE> <DEDENT> def get_value(self, key: [bytes, str], *, value_type=bytes): <NEW_LINE> <INDENT> _kvp = self._options[generic.to_bytes(key).low... | Http header options
:param self._options: options key-value-pairs | 62598f58507cdc57c63a42af |
class Space(db.Model): <NEW_LINE> <INDENT> name = db.StringProperty() <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return '[space: %s]' % (self.name) | Information about a space
This is stored on Google DataStore. We cand add many types of information here. | 62598f58d164cc6175820492 |
class TextAreaRevision(models.Model): <NEW_LINE> <INDENT> pad_guid = models.CharField(max_length=32) <NEW_LINE> content = models.TextField( blank=True ) <NEW_LINE> editor = models.ForeignKey(User) <NEW_LINE> edit_time = models.DateTimeField( auto_now_add=True ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> ordering = ("-e... | Snapshot of the current TextArea state
| 62598f584d74a7450cd58961 |
class TestScene(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.hass = get_test_home_assistant() <NEW_LINE> test_light = getattr(self.hass.components, "test.light") <NEW_LINE> test_light.init() <NEW_LINE> assert setup_component( self.hass, light.DOMAIN, {light.DOMAIN: {"platform": "tes... | Test the scene component. | 62598f585166f23b2e2428f0 |
class Menu(object): <NEW_LINE> <INDENT> def run(self, options, id): <NEW_LINE> <INDENT> self.name = id <NEW_LINE> self.title = ( options[0].upper() ) <NEW_LINE> self.options = options[1:] <NEW_LINE> self.amount = len(self.options) <NEW_LINE> self.display() <NEW_LINE> <DEDENT> def number_input(self, min, max): <NEW_LINE... | Menu Object | 62598f58925a0f43d25e7547 |
class Task: <NEW_LINE> <INDENT> def __init__(self, time): <NEW_LINE> <INDENT> self.timeStamp = time <NEW_LINE> self.pages = random.randrange(1, 21) <NEW_LINE> <DEDENT> def getPages(self): <NEW_LINE> <INDENT> return self.pages <NEW_LINE> <DEDENT> def getStamp(self): <NEW_LINE> <INDENT> return self.timeStamp <NEW_LINE> <... | A task will note down the current time to check how muc time it was waiting after it was added to the queue, pages we are generating by random ( page limit is 20 pages) | 62598f58be8e80087fbbe56d |
class SecurityViolationConfigJailEscape(SecurityViolation): <NEW_LINE> <INDENT> def __init__( self, file: str, logger: typing.Optional['libioc.Logger.Logger']=None ) -> None: <NEW_LINE> <INDENT> msg = f"The file {file} references a file outsite of the jail resource" <NEW_LINE> SecurityViolation.__init__(self, reason=ms... | Raised when a file symlinks to a location outside of the jail. | 62598f58d18da76e235b6bc0 |
class IncorrectBounds(Error): <NEW_LINE> <INDENT> pass | Raised when inputted bounds for random sample generation are off | 62598f58507cdc57c63a42b5 |
class Colors(dict): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Colors, self).__init__() <NEW_LINE> for filename in os.listdir(PATH): <NEW_LINE> <INDENT> if filename.endswith(".json"): <NEW_LINE> <INDENT> fname, ext = os.path.splitext(filename) <NEW_LINE> with open(os.fsencode(os.path.join(PATH, f... | docstring for Colors. | 62598f588c3a8732951f5a76 |
class HorizontalRadioRenderer(forms.RadioSelect.renderer): <NEW_LINE> <INDENT> def render(self): <NEW_LINE> <INDENT> return mark_safe('\n'.join(['{0}\n'.format(w) for w in self])) | Custom class for horizontal radio buttons. Set this as the renderer
forms.RadioSelect to have the horizontal buttons. | 62598f58462c4b4f79dbaf1a |
class CourseListView(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> all_courses = Course.objects.all().order_by("-add_time") <NEW_LINE> hot_courses = Course.objects.all().order_by("-click_num")[:3] <NEW_LINE> search_keywords = request.GET.get('keywords', "") <NEW_LINE> if search_keywords: <NEW_L... | 课程列表 | 62598f58796e427e5384dcae |
class PrivateUserApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.user = create_user( email='test@gmail.com', password='testpass', name='name' ) <NEW_LINE> self.client = APIClient() <NEW_LINE> self.client.force_authenticate(user=self.user) <NEW_LINE> <DEDENT> def test_retreive_profile_s... | Test API requests that requires authentication | 62598f58462c4b4f79dbaf1e |
class Company_DB(models.Model): <NEW_LINE> <INDENT> date_time_created = models.DateTimeField(auto_now_add = True, verbose_name= u'Дата внесения компании в БД') <NEW_LINE> name = models.CharField(max_length = 100, verbose_name= u'Название организации') <NEW_LINE> address = models.CharField(max_length = 100, verbose_name... | Компания для обзвона | 62598f58be8e80087fbbe574 |
class IBaseReview(IBaseDoc): <NEW_LINE> <INDENT> psj_license = schema.Choice( title=_(u'Lizenz'), description=_(u'Wählen Sie eine Lizenz aus'), source=licenses_source, required=False, ) | A PSJ review base.
| 62598f589b70327d1c57e2c7 |
class Walker(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def set_params(self, params): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def central_velocity(self, req_velocity, angle): <NEW_LINE> <INDENT> raise NotImplementedErr... | Walker model class
Not implemented yet. This is a simle class that stores the parameters for
a kinematic model of a Walker. Also computes the velocities that are
required to work with the simulator core | 62598f58167d2b6e312b649c |
class ShiftTemplateListCreate(generics.ListCreateAPIView): <NEW_LINE> <INDENT> queryset = ShiftTemplate.objects.all() <NEW_LINE> serializer_class = ShiftTemplateSerializer | For shift_category 1=Grave, 3=Swing. | 62598f58a8ecb03325870720 |
class MQPeakDetection(object): <NEW_LINE> <INDENT> def __init__(self, max_peaks, sampling_rate, window_size): <NEW_LINE> <INDENT> self._max_peaks = max_peaks <NEW_LINE> self._sampling_rate = sampling_rate <NEW_LINE> self._window_size = window_size <NEW_LINE> self._fundamental = float(self._sampling_rate / self._window_... | Peak detection, based on the McAulay and Quatieri (MQ) algorithm.
A peak is defined as the point in the spectrum where the slope changes from
positive to negative. Hamming window is used, window size must be
(at least) 2.5 times the average pitch. During voiced sections of speech,
the window size is updated every 0.25 ... | 62598f584d74a7450cd58967 |
class TaurusImageButton(_AbstractTaurusValueButton): <NEW_LINE> <INDENT> _widgetClassName = 'TaurusImageDialog' <NEW_LINE> _icon = 'mimetypes:image-x-generic.svg' | A button that launches an ImageDialog | 62598f589b70327d1c57e2c9 |
class LivestreamInterrupted(Exception): <NEW_LINE> <INDENT> def __init__(self, title, cause): <NEW_LINE> <INDENT> super(LivestreamInterrupted, self).__init__(title, cause) <NEW_LINE> self.livestream_title = title | Error caused when livestream is interrupted unexpectedly | 62598f58711fe17d825dfc17 |
class Cpprestsdk(CMakePackage): <NEW_LINE> <INDENT> homepage = "https://github.com/Microsoft/cpprestsdk" <NEW_LINE> url = "https://github.com/Microsoft/cpprestsdk/archive/v2.9.1.tar.gz" <NEW_LINE> version('2.9.1', 'c3dd67d8cde8a65c2e994e2ede4439a2') <NEW_LINE> depends_on('boost') <NEW_LINE> root_cmakelists_dir = '... | The C++ REST SDK is a Microsoft project for cloud-based client-server
communication in native code using a modern asynchronous C++ API design.
This project aims to help C++ developers connect to and interact with
services. | 62598f58bf627c535bcb099d |
class ValueCoderImpl(LengthPrefixBaseCoderImpl): <NEW_LINE> <INDENT> def __init__(self, field_coder: 'FieldCoderImpl'): <NEW_LINE> <INDENT> super(ValueCoderImpl, self).__init__(field_coder) <NEW_LINE> <DEDENT> def encode_to_stream(self, value, out_stream: OutputStream): <NEW_LINE> <INDENT> self._field_coder.encode_to_s... | Encodes a single data to output stream. | 62598f58be8e80087fbbe578 |
class HiddenProducts(grok.GlobalUtility): <NEW_LINE> <INDENT> implements(INonInstallable) <NEW_LINE> grok.name('wcc.assemblyhomepage.upgrades') <NEW_LINE> def getNonInstallableProducts(self): <NEW_LINE> <INDENT> return [ 'wcc.assemblyhomepage.upgrades', ] | This hides the upgrade profiles from the quick installer tool. | 62598f588c3a8732951f5a7b |
class Obstacle(Entity): <NEW_LINE> <INDENT> pass | Something that can prevent an agent to move to some location in an
environment. | 62598f58be8e80087fbbe57a |
class SimplePlugin(PluginBase): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _format_hostname(hostname: str) -> str: <NEW_LINE> <INDENT> return hostname.replace('-', '') <NEW_LINE> <DEDENT> def _specify_regex_group_name(self, dataRegexMatches: dict, preRegexMatches: dict) -> dict: <NEW_LINE> <INDENT> newDataRegexMa... | Simplifies the implementation of PluginBase. | 62598f58d18da76e235b6bc7 |
class SingleGroupApproximation(Approximation): <NEW_LINE> <INDENT> _group_class = None <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> local_rv = kwargs.get("local_rv") <NEW_LINE> groups = [self._group_class(None, *args, **kwargs)] <NEW_LINE> if local_rv is not None: <NEW_LINE> <INDENT> groups.exten... | Base class for Single Group Approximation | 62598f58167d2b6e312b64a2 |
class Presence(object): <NEW_LINE> <INDENT> def __init__(self, nick=None, identifier=None, status=None, chatroom=None, message=None): <NEW_LINE> <INDENT> if nick is None and identifier is None: <NEW_LINE> <INDENT> raise ValueError('Presence: nick and identifiers are both None') <NEW_LINE> <DEDENT> if nick is None and c... | This class represents a presence change for a user or a user in a chatroom.
Instances of this class are passed to :meth:`~errbot.botplugin.BotPlugin.callback_presence`
when the presence of people changes. | 62598f58507cdc57c63a42c1 |
@python_2_unicode_compatible <NEW_LINE> class ClassifierBasedTagger(SequentialBackoffTagger, FeaturesetTaggerI): <NEW_LINE> <INDENT> def __init__(self, feature_detector=None, train=None, classifier_builder=NaiveBayesClassifier.train, classifier=None, backoff=None, cutoff_prob=None, verbose=False): <NEW_LINE> <INDENT> s... | A sequential tagger that uses a classifier to choose the tag for
each token in a sentence. The featureset input for the classifier
is generated by a feature detector function::
feature_detector(tokens, index, history) -> featureset
Where tokens is the list of unlabeled tokens in the sentence;
index is the index ... | 62598f5821a7993f00c6549b |
class OSProcess(schema.OSProcess): <NEW_LINE> <INDENT> rrdPath = get_rrd_path <NEW_LINE> def getRRDTemplateName(self): <NEW_LINE> <INDENT> default = super(OSProcess, self).getRRDTemplateName() <NEW_LINE> if self.supports_WorkingSetPrivate is False: <NEW_LINE> <INDENT> return '-'.join((default, '2003')) <NEW_LINE> <DEDE... | Model class for OSProcess.
Extended here to support alternate monitoring template binding.
Depending on the version of Windows there are different per-process
counters available. | 62598f589b70327d1c57e2cf |
class TestActionAppliedToExistingRoute(TestCase): <NEW_LINE> <INDENT> def test_exception_raised_when_action_applied_to_existing_route(self): <NEW_LINE> <INDENT> class TestViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> @action() <NEW_LINE> def retrieve(self, request, *args, **kwargs): <NEW_LINE> <INDENT> return Res... | Ensure `@action` decorator raises an except when applied
to an existing route | 62598f5856b00c62f0fb1ddb |
class HelloView(tk.Frame): <NEW_LINE> <INDENT> def __init__(self, parent, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(parent, *args, **kwargs) <NEW_LINE> self.name = tk.StringVar() <NEW_LINE> self.hello_string = tk.StringVar() <NEW_LINE> self.hello_string.set("Hello World!!!") <NEW_LINE> name_label = ttk.Lab... | A friendly little module | 62598f585166f23b2e242902 |
class Classes(db.Model): <NEW_LINE> <INDENT> __tablename__ = "classes" <NEW_LINE> id = db.Column(db.Integer, primary_key=True, autoincrement=True) <NEW_LINE> public_id = db.Column(db.String(100), unique=True) <NEW_LINE> youtube_id = db.Column(db.String(20), nullable=False) <NEW_LINE> name = db.Column(db.String(20), nul... | Classes Model for storing classes and their related details | 62598f5821a7993f00c6549d |
class EraseEdgeChange(SimpleChange): <NEW_LINE> <INDENT> def __init__(self, dup_size=None): <NEW_LINE> <INDENT> super(SimpleChange, self).__init__() <NEW_LINE> self.dup_size = dup_size <NEW_LINE> <DEDENT> def set_options(self, label, opt_str): <NEW_LINE> <INDENT> if len(opt_str): <NEW_LINE> <INDENT> self.dup_size = int... | A simple change that overwrites the outer border with the pixles that are just inside it. | 62598f58462c4b4f79dbaf28 |
class BSBI(IndexBuilder): <NEW_LINE> <INDENT> def __init__(self, collection, index_type): <NEW_LINE> <INDENT> IndexBuilder.__init__(self, collection) <NEW_LINE> self.index_type = 'Index_%s' % index_type <NEW_LINE> <DEDENT> def prepare_folder(self): <NEW_LINE> <INDENT> os.makedirs(os.path.join(RES_DIR, self.index_type),... | IndexBuilder that implements the Block Sort-Based Indexing algorithm to construct the indexes | 62598f58711fe17d825dfc1d |
class StockForm(FlaskForm): <NEW_LINE> <INDENT> symbol = SelectField("Choose Stock Symbol",[DataRequired()], choices=[ ("IBM", "IBM"), ("GOOGL", "GOOGL"), ], ) <NEW_LINE> chart_type = SelectField("Select Chart Type",[DataRequired()], choices=[ ("1", "1. Bar"), ("2", "2. Line"), ], ) <NEW_LINE> time_series = SelectField... | Generate Your Graph. | 62598f58bf627c535bcb09a3 |
class V0CommandStatusUpdateDetails(object): <NEW_LINE> <INDENT> swagger_types = { 'reason': 'str' } <NEW_LINE> attribute_map = { 'reason': 'reason' } <NEW_LINE> def __init__(self, reason=None): <NEW_LINE> <INDENT> self._reason = None <NEW_LINE> self.discriminator = None <NEW_LINE> if reason is not None: <NEW_LINE> <IND... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f58d18da76e235b6bca |
class Cache(Configurable): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def configurable_base(cls): <NEW_LINE> <INDENT> return Cache <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def configurable_default(cls): <NEW_LINE> <INDENT> return MemCache <NEW_LINE> <DEDENT> def initialize(self): <NEW_LINE> <INDENT> pass <NEW_LINE>... | 缓存部分数据的缓存. 例如用来维护登录的 Session, 避免一次登录请求
可以实现使用内存的缓存(MemCache), 基于Redis的缓存(TODO) | 62598f585e10d32532ce337c |
class PhysicsObject(object): <NEW_LINE> <INDENT> def __init__(self, physObj): <NEW_LINE> <INDENT> self.physObj = physObj <NEW_LINE> <DEDENT> def scaleEnergy( self, scale ): <NEW_LINE> <INDENT> p4 = self.physObj.p4() <NEW_LINE> p4 *= scale <NEW_LINE> self.physObj.setP4( p4 ) <NEW_LINE> <DEDENT> def __getattr__(self,name... | Extends the cmg::PhysicsObject functionalities. | 62598f595e10d32532ce337d |
class Nonce(object): <NEW_LINE> <INDENT> def __init__(self, redirect_uri, next_path): <NEW_LINE> <INDENT> import uuid <NEW_LINE> self.state = uuid.uuid4() <NEW_LINE> self.redirect_uri = redirect_uri <NEW_LINE> self.next_path = next_path | The openid-login is stored in cache as a temporary object, recording the
user's redirect_uri and next_pat | 62598f59462c4b4f79dbaf2e |
class SessionBinder: <NEW_LINE> <INDENT> def __init__(self, session): <NEW_LINE> <INDENT> self.session = session <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> global_session_push(self.session) <NEW_LINE> return self.session <NEW_LINE> <DEDENT> def __exit__(self, type, value, traceback): <NEW_LINE> <INDEN... | This class is returned when session.bind_only() is used | 62598f59be8e80087fbbe584 |
class FileCtx(_FileCtx): <NEW_LINE> <INDENT> def __init__(self, repo, changectx, path): <NEW_LINE> <INDENT> self._repo = repo <NEW_LINE> self._changectx = changectx <NEW_LINE> self._path = path <NEW_LINE> self._ctx = self._changectx[self._path] <NEW_LINE> <DEDENT> @locked_cached_property <NEW_LINE> def _first_changeset... | Base class that represents a file context. | 62598f594d74a7450cd5896e |
class dog(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.allowed_keys = { 'mode': '^\d{1,10}$', 'nid': '^\d{1,14}$', 'nt': '^\d{1,10}$', 'qnt': '^\d{1,20}$', 'qid': '^\d{1,14}$', 'nm': "^[\w\d_]+$", 'genre-type': '^(\d+|null)$', 'genre-id': '^(\d+|null)$', 'search-type': "^(artists|tracks|albu... | Checking script parameter against regular expression
| 62598f599b70327d1c57e2d7 |
class MachineStatusException(ExceptionBase): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> ExceptionBase.__init__(self) <NEW_LINE> self.msg = msg <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "Error in status data: %s" % self.msg | Status data from a remote machine is corrupt | 62598f598c3a8732951f5a82 |
class ColorEnvelope(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.hue_envelope = Envelope(loop=-1) <NEW_LINE> self.saturation_envelope = Envelope(loop=-1) <NEW_LINE> self.intensity_envelope = Envelope(loop=-1) <NEW_LINE> <DEDENT> def _add_shift(self, start, end, duration, shape, en... | Manages a set of envelopes in parallel related to color change | 62598f59a8ecb03325870730 |
class ArcGISSegmentationLabelList(ImageList): <NEW_LINE> <INDENT> _processor = SegmentationProcessor <NEW_LINE> def __init__(self, items, classes=None, class_mapping=None, color_mapping=None, **kwargs): <NEW_LINE> <INDENT> super().__init__(items, **kwargs) <NEW_LINE> self.class_mapping = class_mapping <NEW_LINE> self.c... | `ItemList` for segmentation masks. | 62598f5991af0d3eaad39338 |
class NmapElasticsearchPlugin(NmapBackendPlugin): <NEW_LINE> <INDENT> def __init__(self, index=None): <NEW_LINE> <INDENT> if index is None: <NEW_LINE> <INDENT> self.index = "nmap.{0}".format(datetime.now().strftime("%Y-%m-%d")) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.index = index <NEW_LINE> <DEDENT> self._e... | This class enables the user to store and manipulate nmap reports in a elastic search db. | 62598f59507cdc57c63a42cd |
class Parser(object): <NEW_LINE> <INDENT> class UsageError(Exception): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class _XMLTags: <NEW_LINE> <INDENT> DELIVERABLE = "Deliverable" <NEW_LINE> NAME = "Name" <NEW_LINE> PATH = "Path" <NEW_LINE> PLATFORM = "Platform" <NEW_LINE> PROJECT = "Project" <NEW_LINE> RELEASE = "Rele... | This class manages parsing the deliverables XML. The XML is assumed to
be valid (match its DTD or XSD). A non-validating XML parser is used. | 62598f59d164cc61758204b1 |
class FirmButFairStrategy(AbstractStrategy): <NEW_LINE> <INDENT> name = "Firm but fair" <NEW_LINE> def __init__(self) -> None: <NEW_LINE> <INDENT> self.last_move_outcome = Result.R <NEW_LINE> super().__init__() <NEW_LINE> <DEDENT> def get_next_move(self): <NEW_LINE> <INDENT> if self.last_move_outcome == Result.S: <NEW_... | Cooperates on the first move, and cooperates except after receiving a sucker payoff. | 62598f595e10d32532ce3380 |
class Interval: <NEW_LINE> <INDENT> def __init__(self, chrom=None, start=None, end=None): <NEW_LINE> <INDENT> assert(start <= end) <NEW_LINE> self.chrom = chrom <NEW_LINE> self.start = start <NEW_LINE> self.end = end <NEW_LINE> <DEDENT> def as_tuple(self): <NEW_LINE> <INDENT> return self.chrom, self.start, self.end <NE... | chrom is a string, start is 0-based, end is 1-based
| 62598f59711fe17d825dfc29 |
class DeleteUEcVHostRequestSchema(schema.RequestSchema): <NEW_LINE> <INDENT> fields = { "NodeId": fields.List(fields.Str()), "ProjectId": fields.Str(required=False, dump_to="ProjectId"), } | DeleteUEcVHost - 删除vhost虚拟机 v2.0 | 62598f59a8ecb03325870736 |
class TestDraftProspectPrimaryPosition(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 testDraftProspectPrimaryPosition(self): <NEW_LINE> <INDENT> pass | DraftProspectPrimaryPosition unit test stubs | 62598f59be8e80087fbbe58c |
class TestUserServiceAPI(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestUserServiceAPI, self).setUp() <NEW_LINE> self.course_id = CourseLocator("org", "course", "run") <NEW_LINE> self.user = UserFactory.create() <NEW_LINE> def mock_get_real_user(_anon_id): <NEW_LINE> <INDENT> return self.... | Test the user service interface | 62598f59796e427e5384dcc8 |
class dummy(function): <NEW_LINE> <INDENT> def _fnct_search(self, tobj, cr, uid, obj=None, name=None, domain=None, context=None): <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> def _fnct_write(self, obj, cr, uid, ids, field_name, values, args, context=None): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> def _... | Dummy fields
| 62598f59ff9c53063f519b83 |
class ControlPersistUnsupportedException(Exception): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> message = 'ControlPersist unsupported by local SSH installation' <NEW_LINE> super(ControlPersistUnsupportedException, self).__init__(message) | Raised when SSH ControlPersist is unsupported locally | 62598f5956b00c62f0fb1deb |
class Warframe: <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> self.bot = bot <NEW_LINE> <DEDENT> @commands.command(name="news", aliases=["wfnews"]) <NEW_LINE> async def news(self): <NEW_LINE> <INDENT> await self.bot.say(get_condensed_news_string()) <NEW_LINE> <DEDENT> @commands.command(name="invasion... | A bunch of Warframe-related cogs! | 62598f596fece00bbaccaec7 |
class IntegrationTestHandlers(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def py_integration_ok(body): <NEW_LINE> <INDENT> msg = 'py_integration_ok, {}'.format(body) <NEW_LINE> _logger.info(msg) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def py_integration_raise(body): <NEW_LINE> <INDENT> msg = 'py_integrat... | Basic message handlers that log or raise known exceptions to allow
interactive testing of the RabbitMQ config. | 62598f599b70327d1c57e2de |
class TileLayer(Layer): <NEW_LINE> <INDENT> __dump__ = True <NEW_LINE> def __init__(self, elem, base_path, loader = None): <NEW_LINE> <INDENT> super().__init__(elem, base_path) <NEW_LINE> self.width = attr(elem, int, 'width') <NEW_LINE> self.height = attr(elem, int, 'height') <NEW_LINE> self.tile_offset_x = 0 <NEW_L... | A Tiled tile layer. | 62598f5976d4e153a661c145 |
class NameSwitcher(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._name_map() <NEW_LINE> <DEDENT> def __call__(self, input): <NEW_LINE> <INDENT> return self._switch_names(input) <NEW_LINE> <DEDENT> def _name_map(self): <NEW_LINE> <INDENT> d1 = vars(cavecalc.gui.mapping) <NEW_LINE> for k in co... | Handles switching parameter names between code and readable versions.
Names and their readable equivalents are given in cavecalc.gui.mapping.
Useage:
ns = NameSwitcher()
name2 = ns(name1)
name3 = ns(name2) # name3 = name1 | 62598f59796e427e5384dcca |
class Respondents(Table): <NEW_LINE> <INDENT> def ReadRecords(self, data_dir='./data_dir', n=None): <NEW_LINE> <INDENT> filename = self.GetFilename() <NEW_LINE> self.ReadFile(data_dir, filename, self.GetFields(), Respondent, n) <NEW_LINE> self.Recode() <NEW_LINE> <DEDENT> def GetFilename(self): <NEW_LINE> <INDENT> retu... | Represents the respondent table. | 62598f595e10d32532ce3383 |
class MixinTestCase(object): <NEW_LINE> <INDENT> layer = PloneSite <NEW_LINE> def afterSetUp(self): <NEW_LINE> <INDENT> self.loginAsPortalOwner() <NEW_LINE> self.workflow = self.portal.portal_workflow <NEW_LINE> self.orig_mobile_ifaces = None <NEW_LINE> alsoProvides(self.portal.REQUEST, IGoogleSitemapsLayer) <NEW_LINE>... | Define layer and common afterSetup method with package installation.
Package installation on plone site setup impossible because of
five's registerPackage directive not recognized on module initializing. | 62598f59711fe17d825dfc2f |
class Ethertype(enum.Enum): <NEW_LINE> <INDENT> IPv4 = 4 <NEW_LINE> IPv6 = 6 | A rule's ethertype
deprecated - use snaps.config.security_group.Ethertype | 62598f59d18da76e235b6bd2 |
class WriteToBigQuery(beam.PTransform): <NEW_LINE> <INDENT> def __init__(self, table_name, dataset, schema, project): <NEW_LINE> <INDENT> beam.PTransform.__init__(self) <NEW_LINE> self.table_name = table_name <NEW_LINE> self.dataset = dataset <NEW_LINE> self.schema = schema <NEW_LINE> self.project = project <NEW_LINE> ... | Generate, format, and write BigQuery table row information. | 62598f59167d2b6e312b64b7 |
class CollatzTrackingChecker: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.seq = [] <NEW_LINE> self.high_water = [] <NEW_LINE> <DEDENT> def __call__(self, k): <NEW_LINE> <INDENT> self.seq.append(k) <NEW_LINE> if not self.high_water or k > self.high_water[-1]: <NEW_LINE> <INDENT> self.high_water.appe... | For testing, this looks for collatz hitting 1 for a given start value.
This is essentially a stateful version of collatz_checker. | 62598f59507cdc57c63a42d7 |
class Experiments(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'ramp_up_rules': {'key': 'rampUpRules', 'type': '[RampUpRule]'}, } <NEW_LINE> def __init__( self, *, ramp_up_rules: Optional[List["RampUpRule"]] = None, **kwargs ): <NEW_LINE> <INDENT> super(Experiments, self).__init__(**kwargs) <NEW_... | Routing rules in production experiments.
:ivar ramp_up_rules: List of ramp-up rules.
:vartype ramp_up_rules: list[~azure.mgmt.web.v2016_08_01.models.RampUpRule] | 62598f59925a0f43d25e756d |
class IJSPaths(Interface): <NEW_LINE> <INDENT> pass | Paths to JAvaScript resources needed for the ZMI. | 62598f5921a7993f00c654b1 |
class ArticleComment(BaseComment): <NEW_LINE> <INDENT> article = models.ForeignKey(Article, null=True, blank=True,on_delete=models.CASCADE, related_name='comments', verbose_name='评论') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> ordering = ['-time'] | 文章评论模型 | 62598f5976d4e153a661c149 |
class DataGridRowEventArgs(EventArgs): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def __new__(self,row): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> Row=property(lambda self: object(),lambda self,v: None,lambda self: None) | Provides data for the System.Windows.Controls.DataGrid.LoadingRow and System.Windows.Controls.DataGrid.UnloadingRow events.
DataGridRowEventArgs(row: DataGridRow) | 62598f59bf627c535bcb09b7 |
class CasXC(xc.BaseXC): <NEW_LINE> <INDENT> pass | This is the base class of all CAS-related exceptions | 62598f59796e427e5384dcce |
class CourseTabPluginManagerTestCase(TestCase): <NEW_LINE> <INDENT> @patch('openedx.core.lib.course_tabs.CourseTabPluginManager.get_available_plugins') <NEW_LINE> def test_get_tab_types(self, get_available_plugins): <NEW_LINE> <INDENT> def create_mock_plugin(tab_type, priority): <NEW_LINE> <INDENT> mock_plugin = Mock()... | Test cases for CourseTabPluginManager class | 62598f59a8ecb0332587073c |
class SimpleFileTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> filename = f'simplefile{os.getpid()}.txt' <NEW_LINE> self.existing_filename = Path(os.curdir) / filename <NEW_LINE> self.delete_file = False <NEW_LINE> if not self.existing_filename.exists(): <NEW_LINE> <INDENT> with self.... | Test cases for SimpleFile class. | 62598f596fece00bbaccaecd |
class TelegramBotHandler(logging.StreamHandler): <NEW_LINE> <INDENT> def __init__(self, botid, bot_users=[]): <NEW_LINE> <INDENT> logging.StreamHandler.__init__(self) <NEW_LINE> self.stream = None <NEW_LINE> self.botid = botid <NEW_LINE> self.bot_users = bot_users <NEW_LINE> self.formatter = logging.Formatter(fmt=loggi... | A handler class which writes formatted logging records to telegram bot.
Usage:
logging.root.addHandler(TelegramBotHandler('XXXXXXXXX:XXXXXXX-XXXXXXXXXX-XXXXXXXXX-XXXXXX', [XXXXXXXXX]))
...
logging.warning('Hello world!', extra={'bot': True}) | 62598f59462c4b4f79dbaf3e |
class Endpoint: <NEW_LINE> <INDENT> def __init__(self, connection): <NEW_LINE> <INDENT> self._connection = connection <NEW_LINE> self._base_endpoint = 'https://www.pivotaltracker.com/services/v5/projects/{}' .format(connection._project_id) <NEW_LINE> self._endpoint = self._base_endpoint <N... | Class which contains functions to compose pivotal url endpoints
Example:
>>> connection = PivotalConnection()
>>> endpoint = Endpoint(connection)
>>> print(endpoint.resource('something'))
http://example.com/something
>>> print(endpoint.with_state('foo'))
http://example.com/something?with_stat... | 62598f599b70327d1c57e2e5 |
class Identity(nn.Module): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Identity, self).__init__() <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> return x | Identity block. | 62598f5921a7993f00c654b5 |
class CardHistory(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.card_id = card_id <NEW_LINE> self.status = status <NEW_LINE> self.last_updated = last_updated | The job of this object is to record a Card's history | 62598f5976d4e153a661c14d |
class Lugar(models.Model): <NEW_LINE> <INDENT> nombre = models.CharField(max_length=200) <NEW_LINE> pais = models.ForeignKey(Pais) <NEW_LINE> latitud = models.DecimalField('Latitud', max_digits=8, decimal_places=5, blank=True, null = True) <NEW_LINE> longitud = models.DecimalField('Longitud', max_digits=8, decimal_plac... | Lugar de origen de los productos que vayan
agregando | 62598f59ff9c53063f519b8d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.