code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Alias(models.Model): <NEW_LINE> <INDENT> compound = models.ForeignKey('Compound', related_name="aliases") <NEW_LINE> name = models.CharField(max_length=DEFAULT_MAX_LENGTH, unique=True) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return '%s (%s)' % (self.name, self.compound.name) | Some shortchuts to find Compounds.
Example: 'c5' -> Pentane | 62599069f7d966606f7494a6 |
class DeleteMountTargetResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.RequestId = params.get("RequestId") | DeleteMountTarget返回参数结构体
| 62599069167d2b6e312b8179 |
class SimpleEditor(Editor): <NEW_LINE> <INDENT> def init(self, parent): <NEW_LINE> <INDENT> tctl = masked.TimeCtrl(parent, -1, name="12 hour control") <NEW_LINE> self.control = tctl <NEW_LINE> self.control.Bind(masked.EVT_TIMEUPDATE, self.time_updated) <NEW_LINE> return <NEW_LINE> <DEDENT> def time_updated(self, event)... | Traits UI time editor. | 62599069097d151d1a2c2844 |
class IJVZooEvent(Interface): <NEW_LINE> <INDENT> pass | Base class for niteoweb.jvzoo events. | 62599069adb09d7d5dc0bd41 |
class ContextInheritanceTestCase(common_test.ContextTestCase): <NEW_LINE> <INDENT> def test_context_inherit(self): <NEW_LINE> <INDENT> data = {'css': {'background-color': 'blue'}} <NEW_LINE> common_test.create_plugin(hierarchy=('some', ), platforms='', data=data) <NEW_LINE> common_test.create_plugin(hierarchy=('some', ... | Test the ways the a Context is meant to inherit from Context objects.
Context objects from others through their hierarchy.
If a Context exists at a lower hierarchy | 625990693539df3088ecda76 |
class ListConverter(BaseConverter): <NEW_LINE> <INDENT> def to_python(self, value): <NEW_LINE> <INDENT> return value.split('+') <NEW_LINE> <DEDENT> def to_url(self, values): <NEW_LINE> <INDENT> return '+'.join( BaseConverter.to_url(self, item) for item in values ) | nome+nome2+nome3 | 625990691b99ca4002290121 |
class Bar(object): <NEW_LINE> <INDENT> def __init__(self, an_argument): <NEW_LINE> <INDENT> self.random_attrib = an_argument <NEW_LINE> self.name = None | Some Other Class | 6259906944b2445a339b754b |
class GPU(object): <NEW_LINE> <INDENT> def __init__(self, deviceID): <NEW_LINE> <INDENT> self.deviceID = deviceID <NEW_LINE> self.name = None <NEW_LINE> self.pcibusID = None <NEW_LINE> self.constmem = None <NEW_LINE> self.totalmem = None <NEW_LINE> <DEDENT> def get_gpu_info(self, drv): <NEW_LINE> <INDENT> self.name = d... | GPU information. | 62599069cb5e8a47e493cd6f |
class WellKnownApi(object): <NEW_LINE> <INDENT> def __init__(self, api_client=None): <NEW_LINE> <INDENT> if api_client is None: <NEW_LINE> <INDENT> api_client = ApiClient() <NEW_LINE> <DEDENT> self.api_client = api_client <NEW_LINE> <DEDENT> def get_service_account_issuer_open_id_configuration(self, **kwargs): <NEW_LIN... | NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually. | 6259906926068e7796d4e111 |
class BoolConst(Const): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> pass | A boolean const | 62599069be8e80087fbc0863 |
class H(OneLineTag): <NEW_LINE> <INDENT> def __init__(self, level, content, **kwargs): <NEW_LINE> <INDENT> super().__init__(content, **kwargs) <NEW_LINE> self.level = level <NEW_LINE> self.tag = f'h{level}' | Header element. Overrides onelinetag by taking one int arg for the header
level. | 62599069f548e778e596cd63 |
class CollectionItemsCreate(generics.ListCreateAPIView): <NEW_LINE> <INDENT> serializer_class = ItemSerialiser <NEW_LINE> permission_classes = [IsAuthenticated, IsOwnerCollectionOrHasPermission, ] <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return Item.objects.filter(collection=self.kwargs['collection']) <NE... | Create items in a collection; needs to be collection owner or have owner's permission
url: collection/<int:collection>/items/ | 625990693cc13d1c6d466f1d |
class SimpleCurveWriter(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.curves = [] <NEW_LINE> self.imt = None <NEW_LINE> <DEDENT> def __exit__(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def add_... | Simple imt-agnostic Curve Writer that stores curves in a list of
dictionaries. | 625990693539df3088ecda77 |
class UserProfile(AbstractBaseUser, PermissionsMixin): <NEW_LINE> <INDENT> email = models.EmailField(max_length=255, unique=True) <NEW_LINE> name = models.CharField(max_length=255) <NEW_LINE> is_active = models.BooleanField(default=True) <NEW_LINE> is_staff = models.BooleanField(default=False) <NEW_LINE> objects = User... | Represents a "user profile" inside our system. | 625990695166f23b2e244baa |
class Meta: <NEW_LINE> <INDENT> model = ProductSpecification | Contain definition of ProductSpecificationModelSerializer | 62599069a8370b77170f1b9d |
class BlastProtDb(_BlastDb, Data): <NEW_LINE> <INDENT> file_ext = "blastdbp" <NEW_LINE> allow_datatype_change = False <NEW_LINE> composite_type = "basic" <NEW_LINE> def __init__(self, **kwd): <NEW_LINE> <INDENT> Data.__init__(self, **kwd) <NEW_LINE> self.add_composite_file("blastdb.phr", is_binary=True) <NEW_LINE> self... | Class for protein BLAST database files. | 625990693317a56b869bf12f |
class _WFastaTabularWriter(_WFastaWriter): <NEW_LINE> <INDENT> def __init__(self, fp, min_frequency, repeat): <NEW_LINE> <INDENT> super(_WFastaTabularWriter, self).__init__(fp, min_frequency, repeat) <NEW_LINE> self.writer = csv.writer(self.fp, delimiter='\t', lineterminator='\n') <NEW_LINE> self.writer.writerow(('id',... | Writer for tab-delimited text, with a header | 6259906991f36d47f2231a7b |
class XlsxFilesProcessor: <NEW_LINE> <INDENT> def __init__(self,rString = r'(?P<string>QCM_MF_S1_(?P<number>1[012]|[1-9]))', workingDir='.'): <NEW_LINE> <INDENT> self.__regexMCQ = re.compile(rString) <NEW_LINE> os.chdir(workingDir) <NEW_LINE> print('Working directory:\n {0}'.format(os.getcwd())) <NEW_LINE> self.__xlsx... | Class for processing .xlsx files from Microsoft Forms.
Regex must have this two following groups:
- <string>
- <number> | 625990694a966d76dd5f06cd |
class SourceManager: <NEW_LINE> <INDENT> sources = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.sources = list() <NEW_LINE> <DEDENT> def identify_sources(self, spec): <NEW_LINE> <INDENT> if not spec: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> for source in spec.pkg_source: <NEW_LINE> <INDENT> ... | Responsible for identifying, fetching, and verifying sources as listed
within a YpkgSpec. | 6259906932920d7e50bc781f |
class SeenURLs: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._urls = set() <NEW_LINE> <DEDENT> def mark_seen(self, crawler_url): <NEW_LINE> <INDENT> self._urls.add(crawler_url.url) <NEW_LINE> <DEDENT> def seen(self, crawler_url): <NEW_LINE> <INDENT> return crawler_url.url in self._urls | Keeps track of URLs seen by the crawler. It keeps everything in
memory, which works fine for small sites. A different approach
would be required to be able to crawl bigger sites (e.g. using
persistent storage). | 6259906955399d3f05627cf9 |
class OverrideAuditEventListener(sublime_plugin.EventListener): <NEW_LINE> <INDENT> def on_post_save_async(self, view): <NEW_LINE> <INDENT> setup_override_minidiff(view) <NEW_LINE> <DEDENT> def on_load_async(self, view): <NEW_LINE> <INDENT> setup_override_minidiff(view) <NEW_LINE> <DEDENT> def on_close(self, view): <NE... | Check on file load and save to see if the new file is potentially an
override for a package, and set the variables that allow for our context
menus to let you edit/diff the override. | 625990698e71fb1e983bd29f |
class WebIDLFile(SandboxDerived): <NEW_LINE> <INDENT> __slots__ = ( 'basename', ) <NEW_LINE> def __init__(self, sandbox, path): <NEW_LINE> <INDENT> SandboxDerived.__init__(self, sandbox) <NEW_LINE> self.basename = path | Describes an individual .webidl source file. | 625990695fcc89381b266d43 |
class Player(Entity): <NEW_LINE> <INDENT> name = "Player" <NEW_LINE> def __init__(self, username="", **kwargs): <NEW_LINE> <INDENT> super(Player, self).__init__(**kwargs) <NEW_LINE> self.username = username <NEW_LINE> self.inventory = Inventory() <NEW_LINE> self.equipped = 0 <NEW_LINE> <DEDENT> def __repr__(self): <NEW... | A player entity. | 625990697d43ff2487427ffd |
class OverReferendumListView(ListView): <NEW_LINE> <INDENT> model = Referendum <NEW_LINE> template_name = 'referendum/referendum_list.html' <NEW_LINE> def get_context_data(self, *, object_list=None, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(object_list=object_list, **kwargs) <NEW_LINE> context['... | Over referendum list view | 62599069435de62698e9d5e3 |
class ActionPermission(BasePermission): <NEW_LINE> <INDENT> def perm_non_superuser(self, request, view): <NEW_LINE> <INDENT> queryset = view.get_queryset() <NEW_LINE> content_type = ContentType.objects.get_for_model(queryset.model) <NEW_LINE> codename = '%s_%s' % (view.action, content_type.model, ) <NEW_LINE> perm_exis... | Allows access only to has perm users. | 6259906901c39578d7f14321 |
@method_decorator(login_required, name='dispatch') <NEW_LINE> class EmployeeUpdateProfileSettings(SuccessMessageMixin, UpdateView): <NEW_LINE> <INDENT> template_name = 'schedulingcalendar/employeeProfile.html' <NEW_LINE> success_message = 'Schedule display settings successfully updated' <NEW_LINE> form_class = Employee... | Display employee settings and form to update these settings. | 6259906916aa5153ce401cb2 |
class HeroInfo(models.Model): <NEW_LINE> <INDENT> hname = models.CharField(max_length=20) <NEW_LINE> hgender = models.BooleanField(default=False) <NEW_LINE> hcomment = models.CharField(max_length=128) <NEW_LINE> hbook = models.ForeignKey('BookInfo', on_delete=models.CASCADE) | 英雄人物模型类 | 62599069d486a94d0ba2d797 |
class Cupping(CuppingServiceBaseMixin, Base): <NEW_LINE> <INDENT> __tablename__ = 'cuppings' <NEW_LINE> session_id = Column(Integer, ForeignKey('sessions.id'), nullable=False) <NEW_LINE> name = Column(String(length=127)) <NEW_LINE> session = relationship('Session', back_populates='cuppings') <NEW_LINE> scores = Column(... | An individual cupping for one object (roast). | 62599069435de62698e9d5e4 |
class FeatureBase(metaclass=ABCMeta): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._last_submission = None <NEW_LINE> self._submission = None <NEW_LINE> self._values = [] <NEW_LINE> <DEDENT> @property <NEW_LINE> @abstractmethod <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return None <NEW_LINE> <D... | Base class for features. | 625990697d847024c075dbb3 |
class StringDouble(_object): <NEW_LINE> <INDENT> __swig_setmethods__ = {} <NEW_LINE> __setattr__ = lambda self, name, value: _swig_setattr(self, StringDouble, name, value) <NEW_LINE> __swig_getmethods__ = {} <NEW_LINE> __getattr__ = lambda self, name: _swig_getattr(self, StringDouble, name) <NEW_LINE> __repr__ = _swig_... | Proxy of C++ std::pair<(std::string,double)> class. | 62599069627d3e7fe0e08661 |
class Tag(object): <NEW_LINE> <INDENT> def __init__(self, name, output): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.url = '/{0}/'.format( output.format(tag=name).lstrip('/').rstrip('/')) | Simple wrapper to provide useful methods for manipulating with tag. | 62599069dd821e528d6da56d |
class Client(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey('auth.User', related_name="client") <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.user.username | Model for Clients who buy yachts | 62599069fff4ab517ebceff4 |
class Command(BaseCommand): <NEW_LINE> <INDENT> help = "Sync prices (and plans) from stripe." <NEW_LINE> def handle(self, *args, **options): <NEW_LINE> <INDENT> for price_data in Price.api_list(): <NEW_LINE> <INDENT> price = Price.sync_from_stripe_data(price_data) <NEW_LINE> self.stdout.write(f"Synchronized price {pric... | Sync prices (and plans) from stripe. | 62599069a8370b77170f1b9e |
class Book: <NEW_LINE> <INDENT> def display_book(self): <NEW_LINE> <INDENT> print("%s by %s" %(self.title, self.author)) <NEW_LINE> <DEDENT> def display_book_status(self): <NEW_LINE> <INDENT> print("%s is checked out: %s" %(self.title, self.checked_out)) <NEW_LINE> <DEDENT> def return_book(self): <NEW_LINE> <INDENT> se... | 62599069baa26c4b54d50a80 | |
class Solution: <NEW_LINE> <INDENT> def mergeTwoLists(self, l1, l2): <NEW_LINE> <INDENT> if not l1: <NEW_LINE> <INDENT> return l2 <NEW_LINE> <DEDENT> if not l2: <NEW_LINE> <INDENT> return l1 <NEW_LINE> <DEDENT> if l1.val<l2.val: <NEW_LINE> <INDENT> head, l1_ind, l2_ind = l1, l1.next, l2 <NEW_LINE> <DEDENT> else: <NEW_L... | @param two ListNodes
@return a ListNode | 6259906a1f037a2d8b9e5457 |
class BasicUserCreationForm(forms.ModelForm): <NEW_LINE> <INDENT> username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), error_messages = {'invalid': _("This value may contain only letters, numbers and... | A form that creates a user, with no privileges, from the given username and password. | 6259906abe8e80087fbc0865 |
class Node: <NEW_LINE> <INDENT> def __init__(self,char=None,weight=0,left=None,right=None): <NEW_LINE> <INDENT> self.char = char <NEW_LINE> self.weight = weight <NEW_LINE> self.left = left <NEW_LINE> self.right = right | Class for holding all node objects: branches and leaves. For leaves,
the left and right attributes are set to the value None while the
char and weight attributes are set accordingly. Branches are given
a left and right attribute, which contain another node object
recursively until a leaf is reached. Branches' char a... | 6259906aaad79263cf42ff8f |
class Persister(Base.Persister): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _get_table_name(): <NEW_LINE> <INDENT> return 'People' | Persists Guardian objects | 6259906a7d847024c075dbb4 |
class UpdateJobRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.JobId = None <NEW_LINE> self.JobAction = None <NEW_LINE> self.Description = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.JobId = params.get("JobId") <NEW_LINE> self.JobAction = pa... | UpdateJob请求参数结构体
| 6259906ad6c5a102081e3902 |
class NULBC(DataItemBase): <NEW_LINE> <INDENT> __type__ = variables.Dynamic <NEW_LINE> __allowedtypes__ = [variables.U1, variables.String] | Column count in dies.
:Types:
- :class:`String <secsgem.secs.variables.String>`
- :class:`U1 <secsgem.secs.variables.U1>`
**Used In Function**
- :class:`SecsS12F01 <secsgem.secs.functions.SecsS12F01>`
- :class:`SecsS12F03 <secsgem.secs.functions.SecsS12F03>`
- :class:`SecsS12F04 <secsgem.secs.functi... | 6259906a56ac1b37e63038cf |
class ReleasesFeatured(DataAPIService): <NEW_LINE> <INDENT> service_name = "releases" <NEW_LINE> uri = "/releases/featured/(.*)" <NEW_LINE> def __init__(self, config): <NEW_LINE> <INDENT> super(ReleasesFeatured, self).__init__(config) <NEW_LINE> logger.debug('Releases featured service __init__') <NEW_LINE> <DEDENT> def... | Handle featured versions of a given product.
| 6259906af548e778e596cd66 |
class BasicEventFormatter(EventFormatter): <NEW_LINE> <INDENT> def __init__( self, data_type='basic', format_string=None, format_string_short=None): <NEW_LINE> <INDENT> super(BasicEventFormatter, self).__init__(data_type=data_type) <NEW_LINE> self._format_string_attribute_names = None <NEW_LINE> self._format_string = f... | Format event values using a message format string.
Attributes:
custom_helpers (list[str]): identifiers of custom event formatter helpers.
helpers (list[EventFormatterHelper]): event formatter helpers. | 6259906a76e4537e8c3f0d5d |
class Box(Mesh): <NEW_LINE> <INDENT> def __init__(self, size, material=None): <NEW_LINE> <INDENT> self._size = np.array(size) <NEW_LINE> mesh = trimesh.creation.box(size) <NEW_LINE> super(Box, self).__init__(mesh, material=material) <NEW_LINE> <DEDENT> def is_on_surface(self, point): <NEW_LINE> <INDENT> on_surf, _ = on... | Defines an axis-aligned box with centre (0, 0, 0) and side length.
Notes
-----
This is currently implemented using trimesh, it could be the case that this is
a little overkill of such a simple class. Consider re-writing, but add timing
tests to test efficiencies of the changes.
For TIR rays it would seem possible to ... | 6259906a4e4d562566373be1 |
class TestPickle: <NEW_LINE> <INDENT> def test_pickle_unit(self): <NEW_LINE> <INDENT> x = unit.kelvin <NEW_LINE> y = pickle.loads(pickle.dumps(x)) <NEW_LINE> assert x == y <NEW_LINE> <DEDENT> def test_pick_quantity(self): <NEW_LINE> <INDENT> x = 1.0 * unit.kelvin <NEW_LINE> y = pickle.loads(pickle.dumps(x)) <NEW_LINE> ... | Test pickle-based serialization of Quantity, Unit, and Measurement objects
See:
* https://github.com/hgrecco/pint/issues/1017
* https://github.com/openforcefield/openff-evaluator/pull/341 | 6259906a2ae34c7f260ac8c2 |
class ShowSchedule(View): <NEW_LINE> <INDENT> template_name = "schedule/show.html" <NEW_LINE> def get(self, request): <NEW_LINE> <INDENT> check_schedule_view(request) <NEW_LINE> schedule = Schedule.objects.filter(published=True, hidden=False).first() <NEW_LINE> if not schedule: <NEW_LINE> <INDENT> raise Http404() <NEW_... | Shows the schedule of the event. | 6259906a4f88993c371f110c |
class ImageSlidingWindowDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, full_example, image_patch_size=128, window_step_size=32): <NEW_LINE> <INDENT> self.full_example = CrowdExample(image=full_example.image) <NEW_LINE> self.window_step_size = window_step_size <NEW_LINE> self.image_patch_size = image_patch_siz... | Creates a database for a sliding window extraction of 1 full example (i.e. each of the patches of the full example). | 6259906a009cb60464d02d14 |
class Solution: <NEW_LINE> <INDENT> @timeit <NEW_LINE> def tictactoe(self, board: List[str]) -> str: <NEW_LINE> <INDENT> n = len(board) <NEW_LINE> def win(s): <NEW_LINE> <INDENT> rlist = board[:] <NEW_LINE> rlist.extend([''.join([board[i][j] for i in range(n)]) for j in range(n)]) <NEW_LINE> rlist.append(''.join([board... | [面试题 16.04. 井字游戏](https://leetcode-cn.com/problems/tic-tac-toe-lcci/) | 6259906afff4ab517ebceff5 |
class TestSyntaxErrorHandling(unittest.TestCase): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> with self.assertRaises(SyntaxError): <NEW_LINE> <INDENT> Renderer(env).load_callback('syntaxerror', None, None) | Propagates a SyntaxError | 6259906a92d797404e389749 |
class FirstLastAccum(object): <NEW_LINE> <INDENT> default_init = (None, None, None, None) <NEW_LINE> def __init__(self, stats_tuple=None): <NEW_LINE> <INDENT> self.first = None <NEW_LINE> self.firsttime = None <NEW_LINE> self.last = None <NEW_LINE> self.lasttime = None <NEW_LINE> <DEDENT> def setStats(self, stats_tuple... | Minimal accumulator, suitable for strings.
It can only return the first and last strings it has seen, along with their timestamps. | 6259906a4428ac0f6e659d0c |
class Node: <NEW_LINE> <INDENT> def __init__(self,data=None,next=None): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.next = next <NEW_LINE> <DEDENT> def get_data(self): <NEW_LINE> <INDENT> return self.data <NEW_LINE> <DEDENT> def get_next(self): <NEW_LINE> <INDENT> return self.next <NEW_LINE> <DEDENT> def set_n... | Implementing a Queue using a linked list | 6259906a435de62698e9d5e5 |
class Search(Kiwicom): <NEW_LINE> <INDENT> def search_places(self, headers=None, request_args=None, **params): <NEW_LINE> <INDENT> service_url = urljoin(self.API_HOST['search'], 'places') <NEW_LINE> return self.make_request(service_url, headers=headers, request_args=request_args, **params) <NEW_LINE> <DEDENT> def searc... | Search Class | 6259906ad486a94d0ba2d799 |
class ArrayOverallState(PLNOverallState): <NEW_LINE> <INDENT> def __init__( self, annotated_interactions, active_gene_threshold, transition_ratio, seed_links_indices=None, link_false_pos=None, link_false_neg=None, link_prior=None, parameters_state_class=PLNParametersState, links_state_class=ArrayLinksState ): <NEW_LINE... | Similar to `PLNOverallState`, but using `ArrayLinksState` as the
links state class, and `AnnotatedInteractionsArray` as the annotated
interactions class. | 6259906a097d151d1a2c2848 |
class SaltclassPillarTestCase(TestCase, LoaderModuleMockMixin): <NEW_LINE> <INDENT> def setup_loader_modules(self): <NEW_LINE> <INDENT> return {saltclass: {}} <NEW_LINE> <DEDENT> def _runner(self, expected_ret): <NEW_LINE> <INDENT> fake_args = { "path": os.path.abspath( os.path.join(RUNTIME_VARS.FILES, "saltclass", "ex... | Tests for salt.pillar.saltclass | 6259906a2ae34c7f260ac8c3 |
class Matcher: <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.not_ = InverseMatcher(value, self) <NEW_LINE> <DEDENT> def toBe(self, value): <NEW_LINE> <INDENT> if self.value != value: <NEW_LINE> <INDENT> msg = "expected " + str(self.value) + " to be " + str(value) ... | Matcher raises assertion errors when its expectations fail | 6259906ad486a94d0ba2d79a |
class ListenerTests(test_santiago.SantiagoTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.listener = santiago.SantiagoListener(santiago.Santiago()) <NEW_LINE> self.listener.santiago.incoming_request = self.acall <NEW_LINE> self.listener.santiago.get_client_locations = self.acall <NEW_LINE> self.lis... | Tests the ``SantiagoListener`` class.
Mostly making sure entire requests are successfully passed down to the
underlying Santiago. | 6259906a44b2445a339b754d |
class ManyToManyWidget(Widget): <NEW_LINE> <INDENT> def __init__(self, model, separator=None, field=None, *args, **kwargs): <NEW_LINE> <INDENT> if separator is None: <NEW_LINE> <INDENT> separator = ',' <NEW_LINE> <DEDENT> if field is None: <NEW_LINE> <INDENT> field = 'pk' <NEW_LINE> <DEDENT> self.model = model <NEW_LIN... | Widget that converts between representations of a ManyToMany relationships
as a list and an actual ManyToMany field.
:param model: The model the ManyToMany field refers to (required).
:param separator: Defaults to ``','``.
:param field: A field on the related model. Default is ``pk``. | 6259906a3cc13d1c6d466f21 |
class Program: <NEW_LINE> <INDENT> def create_user(self, user_name: str): <NEW_LINE> <INDENT> user: User = User(UserName(user_name)) <NEW_LINE> user_service: UserService = UserService() <NEW_LINE> if user_service.exists(user): <NEW_LINE> <INDENT> raise Exception(f"{user_name}はすでに存在しています") | ユーザ作成処理の実装 | 6259906a8da39b475be049c7 |
class WebUsbTransport(ProtocolBasedTransport): <NEW_LINE> <INDENT> PATH_PREFIX = "webusb" <NEW_LINE> ENABLED = usb1 is not None <NEW_LINE> context = None <NEW_LINE> def __init__( self, device: str, handle: WebUsbHandle = None, debug: bool = False ) -> None: <NEW_LINE> <INDENT> if handle is None: <NEW_LINE> <INDENT> han... | WebUsbTransport implements transport over WebUSB interface. | 6259906a76e4537e8c3f0d5e |
class Header3_Locators_Base_2(object): <NEW_LINE> <INDENT> locators = { 'base' : "css=#header", 'login' : "css=#login a", 'register' : "css=#register a", 'logout' : "css=#logout a", 'myaccount' : "css=#myaccount a", 'username' : "css=#usersname a", 'search' : "css=#searchfor... | locators for Header object | 6259906a442bda511e95d946 |
class Cluster(mb.SavannaBase): <NEW_LINE> <INDENT> __tablename__ = 'clusters' <NEW_LINE> __table_args__ = ( sa.UniqueConstraint('name', 'tenant_id'), ) <NEW_LINE> id = _id_column() <NEW_LINE> name = sa.Column(sa.String(80), nullable=False) <NEW_LINE> description = sa.Column(sa.Text) <NEW_LINE> tenant_id = sa.Column(sa.... | Contains all info about cluster. | 6259906a796e427e5384ff53 |
class BaseConfig: <NEW_LINE> <INDENT> DEBUG = False <NEW_LINE> SECRET_KEY = os.getenv('SECRET_KEY', 'my_strong_key') <NEW_LINE> BCRYPT_HASH_PREFIX = 14 <NEW_LINE> SQLALCHEMY_TRACK_MODIFICATIONS = False | Base application configuration | 6259906a3317a56b869bf131 |
class geni_union: <NEW_LINE> <INDENT> def __init__(self, union_dict, union_id): <NEW_LINE> <INDENT> self.union_id = union_id <NEW_LINE> self.union_url = union_dict["url"] <NEW_LINE> self.union_status = union_dict["status"] <NEW_LINE> self.parents = [] <NEW_LINE> self.children = [] <NEW_LINE> for tmp_profile in union_di... | This function deals with geni unions model, it is a data handler, no itended
to be used as a caller. | 6259906a8e7ae83300eea86a |
class Reshape(Transform): <NEW_LINE> <INDENT> def __init__(self, shape): <NEW_LINE> <INDENT> self.shape = shape <NEW_LINE> <DEDENT> def __call__(self, x): <NEW_LINE> <INDENT> if isinstance(x, np.ndarray): <NEW_LINE> <INDENT> return x.reshape(self.shape) <NEW_LINE> <DEDENT> elif torch.is_tensor(x): <NEW_LINE> <INDENT> r... | Reshapes PyTorch tensors and NumPy arrays as required
Parameters
----------
shape: tuple of integers
Shape to reshape all input to | 6259906a32920d7e50bc7822 |
class BoardLabels(object): <NEW_LINE> <INDENT> def __init__(self, board): <NEW_LINE> <INDENT> self.board = board <NEW_LINE> self.labels = [] <NEW_LINE> for data in board.labels: <NEW_LINE> <INDENT> t = component.Component(label.LabelTitle(data)) <NEW_LINE> l = component.Component(data, model='edit-color') <NEW_LINE> se... | Board configuration component for board labels | 6259906a55399d3f05627cfd |
class StorageLayout: <NEW_LINE> <INDENT> COMPRESSED_SUFFIX = ".lzma" <NEW_LINE> if os.path.isfile("/usr/bin/lzma"): <NEW_LINE> <INDENT> COMPRESS_PATH = "/usr/bin/lzma" <NEW_LINE> <DEDENT> elif os.path.isfile("/usr/local/bin/lzma"): <NEW_LINE> <INDENT> COMPRESS_PATH = "/usr/local/bin/lzma" <NEW_LINE> <DEDENT> COMPRESSIO... | A class for encapsulating the on-disk data layout for Telemetry | 6259906a5fcc89381b266d45 |
class EquipmentLocatorLedFsmTask(ManagedObject): <NEW_LINE> <INDENT> consts = EquipmentLocatorLedFsmTaskConsts() <NEW_LINE> naming_props = set([u'item']) <NEW_LINE> mo_meta = MoMeta("EquipmentLocatorLedFsmTask", "equipmentLocatorLedFsmTask", "task-[item]", VersionMeta.Version111j, "OutputOnly", 0xf, [], [""], [u'equipm... | This is EquipmentLocatorLedFsmTask class. | 6259906ae5267d203ee6cfac |
class CreatePostView(LoginRequiredMixin, CreateView): <NEW_LINE> <INDENT> template_name = 'posts/new.html' <NEW_LINE> form_class = PostForm <NEW_LINE> success_url = reverse_lazy('posts:feed') <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(**kwargs) <NEW_LINE> con... | Create a new post | 6259906a0c0af96317c5794d |
class Runner: <NEW_LINE> <INDENT> rmdir_count = 0 <NEW_LINE> rmdir_failed = 0 <NEW_LINE> unlink_count = 0 <NEW_LINE> unlink_failed = 0 | Module-level configuration and value store. | 6259906a435de62698e9d5e8 |
class Post(models.Model): <NEW_LINE> <INDENT> description = models.TextField() | Model for post resource; only needs 'description' field | 6259906a2c8b7c6e89bd4fc3 |
class faq_publisher(webdav_publisher.webdav_publisher): <NEW_LINE> <INDENT> meta_type = 'FAQ publisher' <NEW_LINE> publisher = 1 <NEW_LINE> manage_options = (OFS.Folder.Folder.manage_options[0],) + ( {'label': 'View', 'action': ''}, {'label': 'Security', 'action': 'manage_access'}, ) <NEW_LINE> security ... | FAQ publisher class.
An FAQ publisher publishes issues (questions, and optionally solutions) to a FAQ | 6259906afff4ab517ebceff8 |
class CHSAlumniSkateDateStaffListView(LoginRequiredMixin, ListView): <NEW_LINE> <INDENT> model = CHSAlumniDate <NEW_LINE> context_object_name = 'skate_dates' <NEW_LINE> template_name = 'chs_alumni_skate_sessions_list.html' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = super().get_queryset() <NEW_LIN... | Displays page with list of upcoming CHS ALumni Skate dates with buttons for viewing registered skaters. | 6259906a45492302aabfdcb5 |
class TutorFactory(factory.django.DjangoModelFactory): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = models.Tutor <NEW_LINE> <DEDENT> user = factory.SubFactory(UserFactory) <NEW_LINE> promotion = factory.Iterator([_this_year, _this_year + 1, _this_year + 2]) <NEW_LINE> address = factory.SubFactory(Address... | Tutor object factory. | 6259906ad6c5a102081e3906 |
class HtmlFormatter(logging.Formatter): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> logging.Formatter.__init__( self, "%(asctime)s %(levelname)s %(name)s %(message)s", "%Y-%m-%d %H:%M:%S", ) <NEW_LINE> <DEDENT> def formatException(self, exc_info): <NEW_LINE> <INDENT> exc = logging.Formatter.formatExcept... | Formatter for the logging class | 6259906a091ae35668706410 |
class BGrid_GFDL(object): <NEW_LINE> <INDENT> def __init__(self, lon_t, lat_t, lon_uv, lat_uv, mask_t, mask_uv, h, z_t, z_t_edges, z_uv, z_uv_edges, f, name, xrange, yrange): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.xrange = xrange <NEW_LINE> self.yrange = yrange ... | Arakawa B-Grid for GFDL CM2.1 | 6259906aa8370b77170f1ba3 |
class DatabaseLock(object): <NEW_LINE> <INDENT> def __init__(self, key, timeout=86400, grace=None): <NEW_LINE> <INDENT> self.key = "lock:%s" % key <NEW_LINE> self.timeout = timeout <NEW_LINE> self.grace = grace <NEW_LINE> self.instance_id = uuid.uuid1().hex <NEW_LINE> <DEDENT> def acquire(self, blocking=True): <NEW_LIN... | Try to do same as threading.Lock, but using django cache to store lock
instance to do a distributed lock | 6259906aa219f33f346c7fe5 |
class TestCrowdMap(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self._map = CrowdMap('sandyaiddev.crowdmap.com/api') <NEW_LINE> self.categories = {u'1': u'Category 1', u'3': u'Category 3', u'2': u'Category 2', u'4': u'Trusted Reports'} <NEW_LINE> <DEDENT> def test_categories(self): <NEW_... | Simple tests for the CrowdMap class.
You can run them with: python -m unittest crowdmap_bot | 6259906afff4ab517ebceff9 |
class Dimecoin(Bitcoin): <NEW_LINE> <INDENT> name = 'dimecoin' <NEW_LINE> symbols = ('DIME', ) <NEW_LINE> nodes = ('217.175.119.125', '184.164.129.202', '200.123.47.184', '13.81.2.56', '189.27.221.173', '45.116.233.61', '200.123.47.184') <NEW_LINE> port = 11931 <NEW_LINE> message_start = b'\xfe\xa5\x03\xdd' <NEW_LINE> ... | Class with all the necessary Dimecoin (DIME) network information based on
https://github.com/dime-coin/dimecoin/blob/master/src/net.cpp
(date of access: 02/16/2018) | 6259906a4527f215b58eb58f |
class RegIvaDialog(ga._AnagDialog): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> if not kwargs.has_key('title') and len(args) < 3: <NEW_LINE> <INDENT> kwargs['title'] = FRAME_TITLE <NEW_LINE> <DEDENT> ga._AnagDialog.__init__(self, *args, **kwargs) <NEW_LINE> self.LoadAnagPanel(RegIvaPane... | Dialog Gestione tabella Registri IVA. | 6259906a8a43f66fc4bf3971 |
class MessageFilter(object): <NEW_LINE> <INDENT> default_filter_type = 'json' <NEW_LINE> filter_class_by_type = { "json": BasicDjangoFilter, } <NEW_LINE> def __init__(self, type, data=None, query_params=None, *args, **kwargs): <NEW_LINE> <INDENT> self.type = type <NEW_LINE> filter_class = self.filter_class_by_type[type... | A generic message filter object that looks
up the proper filter implementation based on
the given filter type. | 6259906a8e71fb1e983bd2a5 |
class RawOutstreamFile: <NEW_LINE> <INDENT> def __init__(self, outfile=''): <NEW_LINE> <INDENT> self.buffer = StringIO() <NEW_LINE> self.outfile = outfile <NEW_LINE> <DEDENT> def writeSlice(self, str_slice): <NEW_LINE> <INDENT> self.buffer.write(str_slice) <NEW_LINE> <DEDENT> def writeBew(self, value, length=1): <NEW_L... | Writes a midi file to disk.
Parameters
----------
outfile : str, optional. Default: ''
the file name of the file to be written. May contain a path
to a folder / directory as well. | 6259906a097d151d1a2c284c |
class _DLPolyParser(object): <NEW_LINE> <INDENT> def tearDown(self): <NEW_LINE> <INDENT> del self.p <NEW_LINE> del self.f <NEW_LINE> <DEDENT> def test_usage(self): <NEW_LINE> <INDENT> with self.p(self.f) as parser: <NEW_LINE> <INDENT> struc = parser.parse() <NEW_LINE> <DEDENT> assert_equal('atoms' in struc, True) <NEW_... | Test of real data | 6259906a56b00c62f0fb40ae |
class ReadWriteMutex(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.async_ = 0 <NEW_LINE> self.current_sync_operation = None <NEW_LINE> self.condition = threading.Condition(threading.Lock()) <NEW_LINE> <DEDENT> def acquire_read_lock(self, wait=True): <NEW_LINE> <INDENT> self.condition.acquire... | A mutex which allows multiple readers, single writer.
:class:`.ReadWriteMutex` uses a Python ``threading.Condition``
to provide this functionality across threads within a process.
The Beaker package also contained a file-lock based version
of this concept, so that readers/writers could be synchronized
across processe... | 6259906a0c0af96317c5794e |
class SpeechRecognitionResult(RecognitionResult): <NEW_LINE> <INDENT> def __init__(self, impl_result): <NEW_LINE> <INDENT> super().__init__(impl_result) | Base class for speech recognition results. | 6259906a4f6381625f19a096 |
class KGDatasetWN18(KGDataset): <NEW_LINE> <INDENT> def __init__(self, path, name='wn18'): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> url = 'https://data.dgl.ai/dataset/{}.zip'.format(name) <NEW_LINE> if not os.path.exists(os.path.join(path, name)): <NEW_LINE> <INDENT> print('File not found. Downloading from', url... | Load a knowledge graph wn18
The wn18 dataset has five files:
* entities.dict stores the mapping between entity Id and entity name.
* relations.dict stores the mapping between relation Id and relation name.
* train.txt stores the triples in the training set.
* valid.txt stores the triples in the validation set.
* test.... | 6259906aa8370b77170f1ba4 |
class Object_dectector: <NEW_LINE> <INDENT> def __init__(self,cfg_path,threshold=0.5): <NEW_LINE> <INDENT> self.cfg = get_cfg() <NEW_LINE> self.cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = threshold <NEW_LINE> self.cfg.merge_from_file(model_zoo.get_config_file(cfg_path)) <NEW_LINE> self.cfg.MODEL.WEIGHTS = model_zoo.get_che... | Detect objects in an image using models supported by detectron2 | 6259906a45492302aabfdcb7 |
class PEP3101FormattingWrapperTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.observer = mock.Mock() <NEW_LINE> self.wrapper = PEP3101FormattingWrapper(self.observer) <NEW_LINE> <DEDENT> def test_why_is_None(self): <NEW_LINE> <INDENT> self.wrapper({'why': None, 'key': 'value'}) <NEW_LINE>... | Test the PEP3101 Formatting. | 6259906abe8e80087fbc086b |
class ConnectionContext(rpc_common.Connection): <NEW_LINE> <INDENT> def __init__(self, connection_pool, pooled=True): <NEW_LINE> <INDENT> self.connection = None <NEW_LINE> self.connection_pool = connection_pool <NEW_LINE> if pooled: <NEW_LINE> <INDENT> self.connection = connection_pool.get() <NEW_LINE> <DEDENT> else: <... | The class that is actually returned to the create_connection() caller.
This is essentially a wrapper around Connection that supports 'with'.
It can also return a new Connection, or one from a pool.
The function will also catch when an instance of this class is to be
deleted. With that we can return Connections to th... | 6259906a1f037a2d8b9e545a |
class DPeptideChemComp(PeptideChemComp): <NEW_LINE> <INDENT> type = 'D-peptide linking' | A single peptide component with (unusual) D- chirality.
See :class:`ChemComp` for a description of the parameters. | 6259906a091ae35668706412 |
class wgssplit(dsl.ContainerOp): <NEW_LINE> <INDENT> def __init__(self, validate=None): <NEW_LINE> <INDENT> super(wgssplit, self).__init__( name='wgs-split-first', image='10.18.101.90:80/library/wgs-split:latest', command=['./root/app/split.sh'], arguments=[ '--validate', validate, ], file_outputs={ 'split': '/output.t... | test images-wgs-nfs:v1 | 6259906a7cff6e4e811b7229 |
class UsersViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Users.objects.all().order_by('-date_joined') <NEW_LINE> serializer_class = UsersSerializer | API endpoint that allows users to be viewed or edited. | 6259906aaad79263cf42ff95 |
class CompressorFileAltStorage(CompressorFileStorage): <NEW_LINE> <INDENT> def __init__(self, location=None, base_url=None, *args, **kwargs): <NEW_LINE> <INDENT> if location is None: <NEW_LINE> <INDENT> location = settings.COMPRESS_SOURCE_ROOT <NEW_LINE> <DEDENT> base_url = None <NEW_LINE> super(CompressorFileAltStorag... | This alternative django-compressor storage class is utilised
specifically for CompressorAltFinder which allows an independent
find path.
The default for ``location`` is ``COMPRESS_SOURCE_ROOT``. | 6259906a442bda511e95d948 |
class Document(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Document, self).__init__() <NEW_LINE> self.reset() <NEW_LINE> <DEDENT> def add_style_as_used(self, name): <NEW_LINE> <INDENT> if name not in self.used_styles: <NEW_LINE> <INDENT> self.used_styles.append(name) <NEW_LINE> <DEDENT> <... | Represents OOXML document. | 6259906a8e7ae83300eea86e |
class ParameterStructure(dict): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def flatten_dict(dict_: dict): <NEW_LINE> <INDENT> new_dict = {} <NEW_LINE> for key, value in dict_.items(): <NEW_LINE> <INDENT> if isinstance(value, dict): <NEW_LINE> <INDENT> flattened = ParameterStructure.flatten_dict(value) <NEW_LINE> for ... | Basic functionality of a structure containing parameters. | 6259906a32920d7e50bc7826 |
class MinimaxAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def maxValue(self, gameState, depth, agent): <NEW_LINE> <INDENT> if gameState.isWin() or gameState.isLose() or depth == self.depth: <NEW_LINE> <INDENT> return self.evaluationFunction(gameState) <NEW_LINE> <DEDENT> v = float("-inf") <NEW_LINE> actions = game... | Your minimax agent (question 2) | 6259906a2c8b7c6e89bd4fc6 |
@resources.register('rds-snapshot') <NEW_LINE> class RDSSnapshot(QueryResourceManager): <NEW_LINE> <INDENT> class Meta(object): <NEW_LINE> <INDENT> service = 'rds' <NEW_LINE> type = 'rds-snapshot' <NEW_LINE> enum_spec = ('describe_db_snapshots', 'DBSnapshots', None) <NEW_LINE> name = id = 'DBSnapshotIdentifier' <NEW_LI... | Resource manager for RDS DB snapshots.
| 6259906a92d797404e38974c |
class DMS_Feed(_CHART): <NEW_LINE> <INDENT> service_url = 'https://chart.maryland.gov/rss/ProduceRss.aspx?Type=DMSXML' <NEW_LINE> @classmethod <NEW_LINE> def get_msg_boards(cls): <NEW_LINE> <INDENT> return cls.get_geojson(cls.service_url) | Access DMS XML from CHART. | 6259906a5fcc89381b266d47 |
class QueueScaleCountView(GenericAPIView): <NEW_LINE> <INDENT> parser_classes = (JSONParser,) <NEW_LINE> queryset = Queue.objects.all() <NEW_LINE> serializer_class = QueueStatusSerializerV6 <NEW_LINE> def post(self, request): <NEW_LINE> <INDENT> if request.version == 'v6' or request.version == 'v7': <NEW_LINE> <INDENT>... | This view is the endpoint for queuing new Scale Count jobs. | 6259906a7d43ff2487428001 |
class Droid(Character): <NEW_LINE> <INDENT> def __init__(self, name='C-3PO', species='Droid', eye_color= 'yellow', birth_year='112BBY', json_dict=None): <NEW_LINE> <INDENT> super().__init__(name, species, json_dict) <NEW_LINE> if json_dict is not None: <NEW_LINE> <INDENT> self.birth_year = json_dict['birth_year'] <NEW_... | docstring for Droid. | 6259906a2c8b7c6e89bd4fc7 |
class KNXClimate(ClimateDevice): <NEW_LINE> <INDENT> def __init__(self, device): <NEW_LINE> <INDENT> self.device = device <NEW_LINE> <DEDENT> @property <NEW_LINE> def supported_features(self): <NEW_LINE> <INDENT> support = SUPPORT_TARGET_TEMPERATURE <NEW_LINE> if self.device.supports_operation_mode: <NEW_LINE> <INDENT>... | Representation of a KNX climate device. | 6259906aa8370b77170f1ba6 |
class Permission(DeclarativeBase): <NEW_LINE> <INDENT> __tablename__ = 'tg_permission' <NEW_LINE> permission_id = Column(Integer, autoincrement=True, primary_key=True) <NEW_LINE> permission_name = Column(Unicode(63), unique=True, nullable=False) <NEW_LINE> description = Column(Unicode(255)) <NEW_LINE> groups = relation... | Permission definition for :mod:`repoze.what`.
Only the ``permission_name`` column is required by :mod:`repoze.what`. | 6259906abaa26c4b54d50a88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.