code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class FrameStackWrapperTfAgents(wrappers.PyEnvironmentBaseWrapper): <NEW_LINE> <INDENT> def __init__(self, env, k): <NEW_LINE> <INDENT> super(FrameStackWrapperTfAgents, self).__init__(env) <NEW_LINE> obs_spec: array_spec.ArraySpec = self._env.observation_spec() <NEW_LINE> if not isinstance(obs_spec, array_spec.ArraySpe... | Env wrapper to stack k last frames.
Maintains a circular buffer of the last k frame observations and returns
TimeStep including a concatenated state vector (with the last frames action,
reward, etc). Used to train models with multi-state context.
Note, the first frame's state is replicated k times to produce a state ... | 6259906d283ffb24f3cf50fa |
class _AsyncExecution: <NEW_LINE> <INDENT> def __init__(self, max_workers: Optional[int] = None): <NEW_LINE> <INDENT> self._max_workers = ( max_workers or multiprocessing.cpu_count() ) <NEW_LINE> self._pool = ThreadPoolExecutor(max_workers=self._max_workers) <NEW_LINE> <DEDENT> def set_max_workers(self, count: int): <N... | Tiny wrapper around ThreadPoolExecutor. This class is not meant to be
instantiated externally, but internally we just use it as a wrapper around
ThreadPoolExecutor so we can control the pool size and make the
`as_future` function public. | 6259906de1aae11d1e7cf434 |
class Money: <NEW_LINE> <INDENT> def __init__(self, amount, currency): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> if self.currency.symbol is not None: <NEW_LINE> <INDENT> return f"{self.currency.symbol}{self.amount:.{self.currency.digits}f}" <NEW_LINE> <DEDENT> else: <NEW_LINE> ... | Represents an amount of money. Requires an amount and a currency. | 6259906d4f6381625f19a0d1 |
class DefaultProject(registry_forms.FormDefaults): <NEW_LINE> <INDENT> def set_defaults(self, state, create): <NEW_LINE> <INDENT> if not create: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> default_project = models.project_default(state.get_request()) <NEW_LINE> project_config = state.lookup_item(models.ProjectConfig... | Default project configuration. | 6259906d76e4537e8c3f0dd6 |
class CustomSignupForm(SignupForm): <NEW_LINE> <INDENT> first_name = forms.CharField(max_length=50, label="First name") <NEW_LINE> last_name = forms.CharField(max_length=50, label="Last name") <NEW_LINE> def signup(self, request, user): <NEW_LINE> <INDENT> user.first_name = self.cleaned_data["first_name"] <NEW_LINE> us... | Custom registration form that includes first and last names. | 6259906ddd821e528d6da5aa |
class TSV(DelimitedFormat): <NEW_LINE> <INDENT> delimiter = "\t" <NEW_LINE> @staticmethod <NEW_LINE> def detect(stream): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> csv.Sniffer().sniff(stream, delimiters="\t") <NEW_LINE> return True <NEW_LINE> <DEDENT> except (csv.Error, TypeError): <NEW_LINE> <INDENT> return False | TSV format. Assumes each row is of the form ``text label``.
| 6259906d23849d37ff852908 |
class CaseInsensitiveMultiDict(MultiDict[str, 'VT']): <NEW_LINE> <INDENT> def wrap_key(self, key: str) -> str: <NEW_LINE> <INDENT> return key.casefold() | A case-insensitive multi-dict. | 6259906d2ae34c7f260ac93b |
class CombinedLengthAndGirthCriterion(Criterion): <NEW_LINE> <INDENT> value = models.FloatField(_(u"CLAG"), default=0.0) <NEW_LINE> def get_operators(self): <NEW_LINE> <INDENT> return self.NUMBER_OPERATORS <NEW_LINE> <DEDENT> def is_valid(self): <NEW_LINE> <INDENT> if self.product: <NEW_LINE> <INDENT> clag = (2 * self.... | Criterion to check against combined length and girth. | 6259906d2c8b7c6e89bd5039 |
class EnvRegistry(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.env_specs = {} <NEW_LINE> <DEDENT> def make(self, id): <NEW_LINE> <INDENT> logger.info('Making new env: %s', id) <NEW_LINE> spec = self.spec(id) <NEW_LINE> return spec.make() <NEW_LINE> <DEDENT> def all(self): <NEW_LINE> <INDENT... | Register an env by ID. IDs remain stable over time and are
guaranteed to resolve to the same environment dynamics (or be
desupported). The goal is that results on a particular environment
should always be comparable, and not depend on the version of the
code that was running. | 6259906d8e71fb1e983bd31a |
class LitModel(pl.LightningModule): <NEW_LINE> <INDENT> def __init__(self, model, padding_index, learning_rate, batch_size): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.save_hyperparameters() <NEW_LINE> self.model = model <NEW_LINE> self.loss = nn.CrossEntropyLoss(ignore_index=padding_index) <NEW_LINE> <DEDE... | Simple PyTorch-Lightning model to train our Transformer. | 6259906df7d966606f7494e5 |
class TableFactory: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_table(table): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if table == "BigTable": <NEW_LINE> <INDENT> return BigTable() <NEW_LINE> <DEDENT> if table == "MediumTable": <NEW_LINE> <INDENT> return MediumTable() <NEW_LINE> <DEDENT> if table == "Small... | Tha Factory Class | 6259906df548e778e596cddf |
class userOp(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def UserLogin(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): <NEW_LINE> <INDENT> return grpc.experimental.unary_unary(request, target, '/... | Missing associated documentation comment in .proto file. | 6259906df548e778e596cde0 |
class Types(Enum): <NEW_LINE> <INDENT> TIME = "time" <NEW_LINE> DURATION = "duration" <NEW_LINE> SIZE = "size" <NEW_LINE> @classmethod <NEW_LINE> def is_valid(cls, value): <NEW_LINE> <INDENT> if isinstance(value, AoiEstimator.Types): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return an... | Simple enum representing available estimate types. | 6259906d56b00c62f0fb4122 |
class Solution: <NEW_LINE> <INDENT> def singleNumber(self, A): <NEW_LINE> <INDENT> s = set() <NEW_LINE> for i in A: <NEW_LINE> <INDENT> if i in s: <NEW_LINE> <INDENT> s.remove(i) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> s.add(i) <NEW_LINE> <DEDENT> <DEDENT> return s.pop() | @param A: An integer array
@return: An integer | 6259906d9c8ee82313040db1 |
class Register(MutableOperand): <NEW_LINE> <INDENT> def __init__(self, regnum): <NEW_LINE> <INDENT> self.rnum = regnum <NEW_LINE> <DEDENT> def get(self, thread): <NEW_LINE> <INDENT> return thread.r[self.rnum] <NEW_LINE> <DEDENT> def set(self, thread, value): <NEW_LINE> <INDENT> thread.r[self.rnum] = value <NEW_LINE> <D... | This class encapsulates a generic register (r0 to r15).
.. attribute:: rnum
The register number. | 6259906da8370b77170f1c1a |
class SDEntry_Service(_SDEntry): <NEW_LINE> <INDENT> _defaults = {"type": _SDEntry.TYPE_SRV_FINDSERVICE} <NEW_LINE> name = "Service Entry" <NEW_LINE> fields_desc = [ _SDEntry, IntField("minor_ver", 0)] | Service Entry. | 6259906d3317a56b869bf16d |
class __FRedans : <NEW_LINE> <INDENT> def __init__(self) : <NEW_LINE> <INDENT> self.MIB = set() <NEW_LINE> self.SKB = set() <NEW_LINE> <DEDENT> def update(self, ans) : <NEW_LINE> <INDENT> self.MIB.update(ans.MIB) <NEW_LINE> self.SKB.update(ans.SKB) <NEW_LINE> <DEDENT> def add(self, MIBerc, SKBerc) : <NEW_LINE> <INDENT>... | for the return value of FRed(...) | 6259906d56ac1b37e630390c |
class TestCase(TestCase): <NEW_LINE> <INDENT> fixtures = ['tests.json'] <NEW_LINE> counter = 1 <NEW_LINE> def get_new_page_data(self, draft=False): <NEW_LINE> <INDENT> page_data = {'title':'test page %d' % self.counter, 'slug':'test-page-%d' % self.counter, 'language':'en-us', 'sites':[2], 'status': Page.DRAFT if draft... | Django page CMS test suite class | 6259906d2ae34c7f260ac93c |
class TestTransformations(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.X_, self.y_, headers = parse_csv(etalonroot + "/input.csv") <NEW_LINE> self.data = CData((self.X_, self.y_), cross_val=0) <NEW_LINE> <DEDENT> def test_standardization_on_etalon(self): <NEW_LINE> <INDENT> self.dat... | Dear Transformation Wrapper Classes,
I would like you to: | 6259906de1aae11d1e7cf435 |
class PlanePan(ClickOrDrag): <NEW_LINE> <INDENT> def __init__(self, viewport, plane, button=LEFT_BTN): <NEW_LINE> <INDENT> self._plane = plane <NEW_LINE> self._viewport = viewport <NEW_LINE> self._beginPlanePoint = None <NEW_LINE> self._beginPos = None <NEW_LINE> self._dragNdcZ = 0. <NEW_LINE> super(PlanePan, self).__i... | Pan a plane along its normal on drag. | 6259906d63b5f9789fe869b7 |
class UserProfileSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model=models.UserProfile <NEW_LINE> fields=('id','email','name','password') <NEW_LINE> extra_kwargs={'password':{'write_only':True}} <NEW_LINE> def create(self,validated_data): <NEW_LINE> <INDENT> user=models.U... | A serializer for our user profile objects | 6259906d63d6d428bbee3eb4 |
class OrderDetails(BaseModel): <NEW_LINE> <INDENT> order = models.ForeignKey(Order) <NEW_LINE> item = models.ForeignKey(Item) <NEW_LINE> item_quantity = models.IntegerField(_(u'物品数量'), default=1) <NEW_LINE> comment = models.TextField(default="") | 用户订单详细 | 6259906d3346ee7daa338288 |
class Dive(object): <NEW_LINE> <INDENT> def __init__(self, url): <NEW_LINE> <INDENT> self.url = url <NEW_LINE> self.password = None <NEW_LINE> self.username = None <NEW_LINE> return <NEW_LINE> <DEDENT> def call(self, timeout=1800): <NEW_LINE> <INDENT> if self.password is None or self.username is None: <NEW_LINE> <INDEN... | Client for DSMZ BacDive web services | 6259906d435de62698e9d65a |
class ExistDB(BaseExistDB): <NEW_LINE> <INDENT> def __init__(self, resultType=None, timeout=None): <NEW_LINE> <INDENT> if timeout is None: <NEW_LINE> <INDENT> timeout = getattr(settings, 'EXISTDB_TIMEOUT', None) <NEW_LINE> <DEDENT> BaseExistDB.__init__(self, resultType=resultType, server_url=self._get_exist_url(), time... | Connect to an eXist database configured by ``settings.py``.
:param resultType: The class to use for returning :meth:`query` results;
defaults to :class:`eulcore.existdb.QueryResult`.
:param timeout: Connection timeout setting, if any. If none is
specified, this class will look for a ``EXISTDB_... | 6259906d4f88993c371f114a |
class CaptureInfo(AlpacaBase): <NEW_LINE> <INDENT> first_key = "first" <NEW_LINE> last_key = "last" <NEW_LINE> def __init__(self, path, command=GetDefaults.info_command, *args, **kwargs): <NEW_LINE> <INDENT> super(CaptureInfo, self).__init__(*args, **kwargs) <NEW_LINE> self.path = path <NEW_LINE> self.command = command... | Holds the basic info for a PCAP file
Args:
path (str): path to file
command (str): command to get the info | 6259906d4e4d562566373c5b |
class SphericalStokesSolutionDelta(SphericalStokesSolution): <NEW_LINE> <INDENT> def __init__(self, ABCD, l, m, Rp=2.22, Rm=1.22, nu=1.0, g=1.0): <NEW_LINE> <INDENT> super(SphericalStokesSolutionDelta, self).__init__(l, m, Rp=Rp, Rm=Rm, nu=nu, g=g) <NEW_LINE> self.ABCD = ABCD <NEW_LINE> A, B, C, D = self.ABCD <NEW_LINE... | Base class for solutions in spherical shell domains with delta(r-r') forcing
This implements the analytical solution in one half (above or below r')
of the domain which is based on a poloidal function
.. math ::
\mathcal{P}(r,\theta,\varphi) = \mathcal{P}_l(r)Y_{lm}(\theta, \varphi)
and velocity
.. math ::
... | 6259906d23849d37ff85290a |
class IPage(Interface): <NEW_LINE> <INDENT> pass | The page type
| 6259906d32920d7e50bc789b |
class FileOpenFrame(ttk.Frame): <NEW_LINE> <INDENT> def __init__(self, master,file_entry_width=100): <NEW_LINE> <INDENT> super().__init__(master) <NEW_LINE> self.filePath = StringVar() <NEW_LINE> self.createWidget(file_entry_width) <NEW_LINE> self.pack() <NEW_LINE> <DEDENT> def createWidget(self,entry_width): <NEW_LINE... | ファイルの読み込み用フレーム | 6259906d92d797404e389785 |
class dev_report(Event): <NEW_LINE> <INDENT> pass | Trigger the reporting of the status for each known device. | 6259906dd486a94d0ba2d813 |
class RtspBaseClass: <NEW_LINE> <INDENT> def createEmptyPipeline(self): <NEW_LINE> <INDENT> self.pipeline = gst.Pipeline('mypipeline') <NEW_LINE> <DEDENT> def createRtspsrcElement(self): <NEW_LINE> <INDENT> self.source = gst.element_factory_make('rtspsrc', 'source') <NEW_LINE> self.source.set_property('latency', 0) <NE... | RtspBaseClass is a base class that provides the building blocks for other
classes that create rtsp pipelines. Commonly used gstreamer pipeline
elements and callback methods are defined within. | 6259906d55399d3f05627d77 |
class CustomerTaxForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = CustomerTax <NEW_LINE> exclude = () | Form to add and edit a customer tax. | 6259906dd268445f2663a787 |
class DeletePatternRepeat(QUndoCommand): <NEW_LINE> <INDENT> def __init__(self, canvas, patternRepeat, parent = None): <NEW_LINE> <INDENT> super(DeletePatternRepeat, self).__init__(parent) <NEW_LINE> self.canvas = canvas <NEW_LINE> self.patternRepeat = patternRepeat <NEW_LINE> <DEDENT> def redo(self): <NEW_LINE> <INDEN... | This class encapsulates the deletion of a pattern repeat
item on the canvas. | 6259906d99cbb53fe683273c |
class Webcam_detection_thread_worker(threading.Thread): <NEW_LINE> <INDENT> def __init__(self,on_finish) : <NEW_LINE> <INDENT> super(Webcam_detection_thread_worker, self).__init__() <NEW_LINE> self._on_finish = on_finish <NEW_LINE> <DEDENT> def run (self) : <NEW_LINE> <INDENT> WebCamObj = M_WEBCAM.luciole_webcam_detect... | Thread in charge of calling the webcam detection | 6259906d8e7ae83300eea8e4 |
class Pvnrt(QtGui.QMainWindow): <NEW_LINE> <INDENT> def __init__(self, parent = None): <NEW_LINE> <INDENT> QtGui.QWidget.__init__(self, parent) <NEW_LINE> self.ui = bouncingballs.BouncingBalls() | pv = nrt class
| 6259906d56ac1b37e630390d |
class Scenario_repository_upstream_authorization_check(APITestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> cls.upstream_username = 'rTtest123' <NEW_LINE> <DEDENT> @pre_upgrade <NEW_LINE> def test_pre_repository_scenario_upstream_authorization(self): <NEW_LINE> <INDENT> org... | This test scenario is to verify the upstream username in post-upgrade for a custom
repository which does have a upstream username but not password set on it in pre-upgrade.
Test Steps:
1. Before Satellite upgrade, Create a custom repository and sync it.
2. Set the upstream username on same repository using fo... | 6259906d1b99ca4002290160 |
class ToolCursorPosition(ToolBase): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self._idDrag = None <NEW_LINE> ToolBase.__init__(self, *args, **kwargs) <NEW_LINE> <DEDENT> def set_figure(self, figure): <NEW_LINE> <INDENT> if self._idDrag: <NEW_LINE> <INDENT> self.canvas.mpl_disconnect(s... | Send message with the current pointer position
This tool runs in the background reporting the position of the cursor | 6259906d76e4537e8c3f0dd9 |
class TestSetUpIof(): <NEW_LINE> <INDENT> def __init__(self, test_info=None, log_base_path=None): <NEW_LINE> <INDENT> self.test_info = test_info <NEW_LINE> self.log_dir_base = log_base_path <NEW_LINE> self.logger = logging.getLogger("TestRunnerLogger") <NEW_LINE> <DEDENT> def useLogDir(self, log_path): <NEW_LINE> <INDE... | Set up and start ctrl fs | 6259906d32920d7e50bc789c |
class TestBodhi4ComposeSyncWait(Base): <NEW_LINE> <INDENT> expected_title = "bodhi.compose.sync.wait" <NEW_LINE> expected_subti = "bodhi composer is waiting for dist-6E-epel-testing " + "to hit the master mirror" <NEW_LINE> expected_icon = "https://apps.fedoraproject.org/img/icons/bodhi.png" <NEW_LINE> expected_... | `Bodhi <https://bodhi.fedoraproject.org>`_ publishes messages
on this topic when it begins waiting for a completed repo to sync. | 6259906daad79263cf43000b |
class Accuracy(EvalMetric): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Accuracy, self).__init__('accuracy') <NEW_LINE> <DEDENT> def update(self, labels, preds): <NEW_LINE> <INDENT> check_label_shapes(labels, preds) <NEW_LINE> for label, pred_label in zip(labels, preds): <NEW_LINE> <INDENT> if pre... | Computes accuracy classification score.
Examples
--------
>>> predicts = [mx.nd.array([[0.3, 0.7], [0, 1.], [0.4, 0.6]])]
>>> labels = [mx.nd.array([0, 1, 1])]
>>> acc = mx.metric.Accuracy()
>>> acc.update(preds = predicts, labels = labels)
>>> print acc.get()
('accuracy', 0.6666666666666666) | 6259906d3539df3088ecdaf2 |
class whitespace(Facet): <NEW_LINE> <INDENT> ENUM = DataDict( preserve='preserve', replace='replace', colapse='colapse', ) <NEW_LINE> name = 'whiteSpace' <NEW_LINE> def __init__(self, restriction): <NEW_LINE> <INDENT> assert restriction in self.ENUM <NEW_LINE> self.restriction = restriction <NEW_LINE> <DEDENT> def __ca... | The whitespace facet constrains the value of types derived from string
whitespace.restriction must be one of: preserve, replace, collapse
preserve
No normalization is done, the value is not changed
replace
All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage
return) are replaced with #x20 (spac... | 6259906d4f6381625f19a0d3 |
class DistributionMeta(ABCMeta): <NEW_LINE> <INDENT> def __new__(cls, name, bases, clsdict): <NEW_LINE> <INDENT> if "random" in clsdict: <NEW_LINE> <INDENT> def _random(*args, **kwargs): <NEW_LINE> <INDENT> warnings.warn( "The old `Distribution.random` interface is deprecated.", FutureWarning, stacklevel=2, ) <NEW_LINE... | DistributionMeta class
Notes
-----
DistributionMeta currently performs many functions, and will likely be refactored soon.
See issue below for more details
https://github.com/pymc-devs/pymc/issues/5308 | 6259906da17c0f6771d5d7d4 |
class TokenDescriptionSection(object): <NEW_LINE> <INDENT> def __init__(self, mf, api=None, persona_id=None): <NEW_LINE> <INDENT> self.app_manifest = mf <NEW_LINE> self.entries = [] <NEW_LINE> self._api = api <NEW_LINE> self._persona_id = persona_id <NEW_LINE> self._all_permissions = None <NEW_LINE> self._permissions =... | Description of permissions associated with a particular application
| 6259906d8a43f66fc4bf39ea |
class JujuServiceDeploymentResource(CommonResource): <NEW_LINE> <INDENT> pipeline = ForeignKey( PipelineResource, 'pipeline', null=False, full_list=True) <NEW_LINE> jujuservice = ForeignKey( JujuServiceResource, 'jujuservice', full_list=True) <NEW_LINE> charm = ForeignKey(CharmResource, 'charm') <NEW_LINE> productunder... | API Resource for 'JujuServiceDeployment' model. | 6259906d460517430c432c81 |
class List(Trackable): <NEW_LINE> <INDENT> name = models.CharField(max_length=70) <NEW_LINE> slug = models.SlugField() <NEW_LINE> project = models.ForeignKey(Project, on_delete=models.CASCADE) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return f"<TodoList: {self.name}>" | Todo list for investigation. | 6259906daad79263cf43000c |
class Technicien(db.Model): <NEW_LINE> <INDENT> __tablename__ = "technicien" <NEW_LINE> __table_args__ = {'extend_existing': True} <NEW_LINE> code = db.Column(db.Integer, primary_key=True, autoincrement=True) <NEW_LINE> nom = db.Column(db.String(50)) <NEW_LINE> prenom = db.Column(db.String(50)) <NEW_LINE> intervention ... | Technicien Model for storing technicien related details | 6259906d63d6d428bbee3eb5 |
class RagelDLexer(DelegatingLexer): <NEW_LINE> <INDENT> name = 'Ragel in D Host' <NEW_LINE> aliases = ['ragel-d'] <NEW_LINE> filenames = ['*.rl'] <NEW_LINE> def __init__(self, **options): <NEW_LINE> <INDENT> super(RagelDLexer, self).__init__(DLexer, RagelEmbeddedLexer, **options) <NEW_LINE> <DEDENT> def analyse_text(te... | A lexer for `Ragel`_ in a D host file.
*New in Pygments 1.1* | 6259906d7b180e01f3e49c8f |
class Level(IntEnum): <NEW_LINE> <INDENT> DEBUG = 0 <NEW_LINE> INFO = 1 <NEW_LINE> WARN = 2 <NEW_LINE> ERROR = 3 | An enumerator representing the logging level.
Not valid if you override with your own loggers. | 6259906d4f88993c371f114b |
class _StreamRequestHandler(socketserver.StreamRequestHandler, object): <NEW_LINE> <INDENT> pass | Converted to newstyle class. | 6259906d99cbb53fe683273e |
class Cutout(object): <NEW_LINE> <INDENT> def __init__(self, n_holes, length): <NEW_LINE> <INDENT> self.n_holes = n_holes <NEW_LINE> self.length = length <NEW_LINE> <DEDENT> def __call__(self, img): <NEW_LINE> <INDENT> h = img.size(1) <NEW_LINE> w = img.size(2) <NEW_LINE> mask = np.ones((h, w), np.float32) <NEW_LINE> f... | Taken primarily from: https://github.com/uoguelph-mlrg/Cutout
Randomly mask out one or more patches from an image. | 6259906db7558d5895464b5d |
class CourseOutlineView(APIView): <NEW_LINE> <INDENT> def get(self,request,*args,**kwargs): <NEW_LINE> <INDENT> res = {'code': 1000, 'data': None} <NEW_LINE> try: <NEW_LINE> <INDENT> course_obj = models.Course.objects.filter(pk=1) <NEW_LINE> ser_obj = serializer.CourseOutlineSerializer(course_obj,many=True) <NEW_LINE> ... | 专题课id=1所有课程大纲 | 6259906d9c8ee82313040db3 |
class I_ior_w_l5_wp(Instruction_w_l5_wp_B): <NEW_LINE> <INDENT> name = 'ior' <NEW_LINE> mask = 0xF80060 <NEW_LINE> code = 0x700060 | IOR{.B} Wb, #lit5, [Wd] | 6259906d44b2445a339b758a |
class ExpectedErrorMiddleware: <NEW_LINE> <INDENT> def __init__(self, get_response): <NEW_LINE> <INDENT> self.get_response = get_response <NEW_LINE> <DEDENT> def __call__(self, request): <NEW_LINE> <INDENT> response = self.get_response(request) <NEW_LINE> return response <NEW_LINE> <DEDENT> def process_exception(self, ... | Middleware to add logging and monitoring for expected errors. | 6259906d8e7ae83300eea8e7 |
class SimpleOvalSquareFuncLayer_v2: <NEW_LINE> <INDENT> def __init__(self, x1, x2): <NEW_LINE> <INDENT> self.x1 = x1 <NEW_LINE> self.x2 = x2 <NEW_LINE> self.addX1_minus_three_layer = AddLayer() <NEW_LINE> self.X1_minus_three_square_layer = MulLayer() <NEW_LINE> self.mulX2_by_two_layer = MulLayer() <NEW_LINE> self.addTw... | This is simple layer that uses loss function of (x-3)^2+(2y-1)^2 | 6259906d97e22403b383c75b |
class Member(models.Model): <NEW_LINE> <INDENT> ROLE_CHOICES = ( ('admin', 'admin'), ('regular', 'regular') ) <NEW_LINE> firstname = models.CharField(max_length=100) <NEW_LINE> lastname = models.CharField(max_length=100) <NEW_LINE> phone = models.CharField(max_length=13) <NEW_LINE> email = models.EmailField() <NEW_LINE... | Stores details of a team member | 6259906d8da39b475be04a44 |
class FidelityPromo(Promotion): <NEW_LINE> <INDENT> def discount(self, order): <NEW_LINE> <INDENT> if order.customer.fidelity >= 1000: <NEW_LINE> <INDENT> return order.total() * 0.05 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0 | 5% discount for customers with 1000 or more fidelity points | 6259906dcb5e8a47e493cdae |
class TraceServiceServicer(object): <NEW_LINE> <INDENT> def BatchWriteSpans(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') <NEW_LINE> <DEDENT> def Creat... | This file describes an API for collecting and viewing traces and spans
within a trace. A Trace is a collection of spans corresponding to a single
operation or set of operations for an application. A span is an individual
timed event which forms a node of the trace tree. A single trace may
contain span(s) from multiple... | 6259906d5166f23b2e244c2a |
class Clip: <NEW_LINE> <INDENT> def __init__(self, filepath, activation_string, name=None, thumbnail_path=None, params={}, tags=[]): <NEW_LINE> <INDENT> self.f_name = filepath <NEW_LINE> self.t_names = thumbnail_path <NEW_LINE> self.command = activation_string <NEW_LINE> self.params = params <NEW_LINE> self.tags = [] <... | used to store "video clips"
with associated information
most importantly, filepath and how to activate them
but also params and tags
example params (inspired by previous sol version)
cue_points - point in time to jump to
loop_points - collection of pairs of points between which can loop
... | 6259906d16aa5153ce401d31 |
class DriverManager(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.driver = None <NEW_LINE> <DEDENT> def get_driver(self): <NEW_LINE> <INDENT> return self.driver <NEW_LINE> <DEDENT> def initialize_driver(self): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def start(self... | Base class for all driver managers. | 6259906da8370b77170f1c1f |
@dataclass(init=True, repr=True, eq=False, order=False, unsafe_hash=False, frozen=True) <NEW_LINE> class CurvePool: <NEW_LINE> <INDENT> lp: ChecksumEthAddress <NEW_LINE> assets: List[ChecksumEthAddress] <NEW_LINE> pool_address: ChecksumEthAddress | Represent a curve pool contract with the position token and the assets in the pool | 6259906dadb09d7d5dc0bdc2 |
class PyParso(PythonPackage): <NEW_LINE> <INDENT> pypi = "parso/parso-0.6.1.tar.gz" <NEW_LINE> version('0.8.1', sha256='8519430ad07087d4c997fda3a7918f7cfa27cb58972a8c89c2a0295a1c940e9e') <NEW_LINE> version('0.7.1', sha256='caba44724b994a8a5e086460bb212abc5a8bc46951bf4a9a1210745953622eb9') <NEW_LINE> version('0.6.1', sh... | Parso is a Python parser that supports error recovery and round-trip parsing
for different Python versions (in multiple Python versions).
Parso is also able to list multiple syntax errors
in your python file. | 6259906de76e3b2f99fda259 |
class InvalidEventError(Exception): <NEW_LINE> <INDENT> pass | Raised when a non-event is passed to the notifyListeners method of a
Notifier | 6259906d63b5f9789fe869bb |
class Tests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.root = os.path.dirname(__import__(settings.ROOT_URLCONF).__file__) <NEW_LINE> sys.path.append(self.root) <NEW_LINE> self.unique_id = str(uuid4()).replace("-", "") <NEW_LINE> self.test_apps = ["app%s%s" % (i, self.unique_id) for i in ra... | Test that ``overextends`` triggers across multiple project and
app templates with the same relative path. To achieve this, we
need the same template name to exist in multiple apps, as well as
at the project level, so we create some fake apps and a project
template. These all used a unique ID to ensure they don't
collid... | 6259906d3d592f4c4edbc739 |
class Solution: <NEW_LINE> <INDENT> def maxNode(self, root): <NEW_LINE> <INDENT> if root is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> left_max = self.maxNode(root.left) <NEW_LINE> right_max = self.maxNode(root.right) <NEW_LINE> if left_max is None and right_max is None: <NEW_LINE> <INDENT> return root <... | @param: root: the root of tree
@return: the max node | 6259906daad79263cf43000e |
class ListeningThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, network, listen2): <NEW_LINE> <INDENT> threading.Thread.__init__(self, name="moteinopy.ListeningThread") <NEW_LINE> self.Network = network <NEW_LINE> self.Listen2 = listen2 <NEW_LINE> self.Stop = False <NEW_LINE> <DEDENT> def stop(self, sig... | A thread that listens to the Serial port. When something (that ends with a newline) is recieved
the thread will start up a Send2Parent thread and go back to listening to the Serial port | 6259906d38b623060ffaa47f |
class QtAbstractMeta(ABCMeta, type(QObject)): <NEW_LINE> <INDENT> pass | Metaclass that allows implementing ABC and QObject simultaneously | 6259906d1f5feb6acb164449 |
class TestWriteSheetView(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.fh = StringIO() <NEW_LINE> self.worksheet = Worksheet() <NEW_LINE> self.worksheet._set_filehandle(self.fh) <NEW_LINE> <DEDENT> def test_write_sheet_view_tab_not_selected(self): <NEW_LINE> <INDENT> self.worksheet._... | Test the Worksheet _write_sheet_view() method. | 6259906d4c3428357761bb0b |
class SeekingToRange(RangeXYHold): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def transitions(): <NEW_LINE> <INDENT> return RangeXYHold.transitions(SeekingToRange, { RangeXYHold.IN_RANGE : SeekingToAligned }, lostState = FindAttemptRange) | Heads toward the target until it reaches the desired range | 6259906d4e4d562566373c5f |
class Building(object): <NEW_LINE> <INDENT> def __init__(self, name, level, cost, increment): <NEW_LINE> <INDENT> if name in BUILDING_NAMES: <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if type(name) != str: <NEW_LINE> <INDENT> raise TypeError("Building name should be a string") <N... | Building class | 6259906d7d847024c075dc35 |
class BaseField(object): <NEW_LINE> <INDENT> perm_getter = FieldPerm() <NEW_LINE> conv = convs.Char <NEW_LINE> widget = widgets.TextInput() <NEW_LINE> label = None <NEW_LINE> media = FormMedia() <NEW_LINE> def __init__(self, name, conv=None, parent=None, **kwargs): <NEW_LINE> <INDENT> kwargs.update(dict( parent=parent,... | Simple container class which ancestors represents various parts of Form.
Encapsulates converter, various fields attributes, methods for data
access control | 6259906d99cbb53fe6832740 |
class BlockStatement: <NEW_LINE> <INDENT> def __init__(self, parallel=False, statements=None): <NEW_LINE> <INDENT> self._parallel = bool(parallel) <NEW_LINE> if statements is None: <NEW_LINE> <INDENT> self._statements = [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._statements = statements <NEW_LINE> <DEDENT> <... | Represents a Jaqal block statement; either sequential or parallel. Can contain other
blocks, loop statements, and gate statements.
:param bool parallel: Set to False (default) for a sequential block or True for a parallel block.
:param statements: The contents of the block; defaults to an empty block.
:type statements... | 6259906db7558d5895464b5e |
class Convert_To_Mirror_Class(): <NEW_LINE> <INDENT> def GetResources(self): <NEW_LINE> <INDENT> iconpath = FreeCAD.getUserAppDataDir().encode("utf-8") + 'Mod/ehtecoptics/resources/mirror.svg.png' <NEW_LINE> return {'Pixmap': iconpath, 'Accel': "Shift+A", 'MenuText': "Convert To Absorber", 'ToolTip': "Converts a solid ... | My new command | 6259906d4a966d76dd5f0742 |
class Submission(StatusModel, TimeStampedModel): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> app_label = "djspikeval" <NEW_LINE> <DEDENT> STATUS = Choices("private", "public") <NEW_LINE> description = models.TextField( blank=True, null=True) <NEW_LINE> user = models.ForeignKey( settings.AUTH_USER_MODEL, blank=T... | container for a set of evaluations submitted by a user for one dataset | 6259906dac7a0e7691f73d41 |
class ImageTask(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.State = None <NEW_LINE> self.Message = None <NEW_LINE> self.ImageName = None <NEW_LINE> self.CreateTime = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.State = params.get("State") <NEW_LI... | 镜像任务
| 6259906dd268445f2663a789 |
class Meta: <NEW_LINE> <INDENT> db_table = 'form_gen_dates' | Override some params. | 6259906d3539df3088ecdaf5 |
class QuitHandler(IRCHandler): <NEW_LINE> <INDENT> def receive_msg(self, msg): <NEW_LINE> <INDENT> if self.is_authenticated(msg): <NEW_LINE> <INDENT> if msg.find(self.bot.bang_name + ' quit') != -1: <NEW_LINE> <INDENT> self.reply_to(msg, "Screw you guys, I'm going home.") <NEW_LINE> self.bot.stop() | quit: Makes the bot quit the server on with '!<botname> quit' command | 6259906d44b2445a339b758b |
class DictIter(object): <NEW_LINE> <INDENT> __slots__ = 'data', 'keys', 'index' <NEW_LINE> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.keys = sorted(data.keys()) <NEW_LINE> self.index = -1 <NEW_LINE> <DEDENT> def __next__(self): <NEW_LINE> <INDENT> self.index += 1 <NEW_LINE> if self.i... | Iterator through the tree | 6259906da8370b77170f1c21 |
class HttpResponseMixin(object): <NEW_LINE> <INDENT> def render_to_http_response(self, json_data): <NEW_LINE> <INDENT> return HttpResponse(json_data,content_type='application/json') | doc string for HttpResponseMixin. | 6259906d2ae34c7f260ac942 |
class Meta: <NEW_LINE> <INDENT> model = Organisation <NEW_LINE> include_fk = True <NEW_LINE> exclude = ('passcode',) | . | 6259906d1b99ca4002290162 |
class CacheConfSchema(schema.ResponseSchema): <NEW_LINE> <INDENT> fields = { "CacheBehavior": fields.Bool(required=True, load_from="CacheBehavior"), "CacheTTL": fields.Int(required=True, load_from="CacheTTL"), "CacheUnit": fields.Str(required=True, load_from="CacheUnit"), "Description": fields.Str(required=False, load_... | CacheConf - 缓存配置 | 6259906dfff4ab517ebcf074 |
@vaping.plugin.register("fping") <NEW_LINE> class FPing(FPingBase): <NEW_LINE> <INDENT> def init(self): <NEW_LINE> <INDENT> self.hosts = [] <NEW_LINE> for name, group_config in list(self.groups.items()): <NEW_LINE> <INDENT> self.hosts.extend(group_config.get("hosts", [])) <NEW_LINE> <DEDENT> <DEDENT> def probe(self): <... | Run fping on configured hosts
# Config
- command (`str=fping`): command to run
- interval (`str=1m`): time between pings
- count (`int=5`): number of pings to send
- period (`int=20`): time in milliseconds that fping waits
between successive packets to an individual target | 6259906d67a9b606de5476cf |
class OutputProxy(StringIO): <NEW_LINE> <INDENT> def write(self, str_): <NEW_LINE> <INDENT> sys.stdout.write(str_) <NEW_LINE> <DEDENT> def flush(self): <NEW_LINE> <INDENT> sys.stdout.flush() | A simple interface to replace sys.stdout so
doctest can capture it. | 6259906d4e4d562566373c60 |
@dataclass <NEW_LINE> class BankConflict(): <NEW_LINE> <INDENT> is_conflict: bool <NEW_LINE> t: int <NEW_LINE> s: int <NEW_LINE> new_bank: int | Whether there is a conflict.
If there is a conflict, the coordinates of one of the conflicting values and it's new bank> | 6259906d097d151d1a2c28ca |
class TopicType(models.Model): <NEW_LINE> <INDENT> forum = models.ForeignKey(Forum) <NEW_LINE> name = models.CharField("类型名", max_length=32) <NEW_LINE> slug = models.CharField(u"别名", max_length=32, unique=True, null=True, validators=[ validators.RegexValidator(re.compile('^([a-zA-Z0-9_-]*[a-zA-Z][a-zA-Z0-9_-]*)$'), u'字... | 主题类型 | 6259906d63b5f9789fe869bd |
class BalloonConfig(Config): <NEW_LINE> <INDENT> NAME = "TreeRingCracksComb2_OnlyRing" <NEW_LINE> IMAGES_PER_GPU = 4 <NEW_LINE> NUM_CLASSES = 1 + 1 <NEW_LINE> STEPS_PER_EPOCH = 650 <NEW_LINE> VALIDATION_STEPS = 1 <NEW_LINE> BACKBONE = "resnet101" <NEW_LINE> USE_MINI_MASK = True <NEW_LINE> MINI_MASK_SHAPE = (56, 56) <NE... | Configuration for training on the toy dataset.
Derives from the base Config class and overrides some values. | 6259906daad79263cf430010 |
class ScanError(ScheduleError): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> ScheduleError.__init__(self, *args, **kwargs) | Error in receivers specifications | 6259906d7047854f46340c11 |
class ValidateCloudConfigFileTest(CiTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(ValidateCloudConfigFileTest, self).setUp() <NEW_LINE> self.config_file = self.tmp_path('cloudcfg.yaml') <NEW_LINE> <DEDENT> def test_validateconfig_file_error_on_absent_file(self): <NEW_LINE> <INDENT> with self... | Tests for validate_cloudconfig_file. | 6259906d3346ee7daa33828b |
class NodeTest(unittest.TestCase): <NEW_LINE> <INDENT> def testCreationOcc(self): <NEW_LINE> <INDENT> node = Node("Salut") <NEW_LINE> self.assertEqual(1,node.getOcc()) | Test the Node class | 6259906d76e4537e8c3f0dde |
class Collections(enum.Enum): <NEW_LINE> <INDENT> PROJECTS = ( 'projects', 'projects/{projectsId}', {}, [u'projectsId'], True ) <NEW_LINE> PROJECTS_JOBS = ( 'projects.jobs', '{+name}', { '': 'projects/{projectsId}/jobs/{jobsId}', }, [u'name'], True ) <NEW_LINE> PROJECTS_LOCATIONS = ( 'projects.locations', '{+name}', { ... | Collections for all supported apis. | 6259906d8e71fb1e983bd323 |
class EB_EPD(Binary): <NEW_LINE> <INDENT> def install_step(self): <NEW_LINE> <INDENT> os.chdir(self.builddir) <NEW_LINE> if self.cfg['install_cmd'] is None: <NEW_LINE> <INDENT> self.cfg['install_cmd'] = "./epd_free-%s-x86_64.sh -b -p %s" % (self.version, self.installdir) <NEW_LINE> <DEDENT> super(EB_EPD, self).install_... | Easyblock implementing the build step for EPD,
this is just running the installer script, with an argument to the installdir | 6259906d99cbb53fe6832742 |
@command(server_cmds) <NEW_LINE> class server_attach(_CycladesInit, OptionalOutput): <NEW_LINE> <INDENT> arguments = dict( volume_id=ValueArgument('The volume to be attached', '--volume-id') ) <NEW_LINE> required = ('volume_id', ) <NEW_LINE> @errors.Generic.all <NEW_LINE> @errors.Cyclades.connection <NEW_LINE> @errors.... | Attach a volume on a VM | 6259906d2c8b7c6e89bd5041 |
class GameStats(): <NEW_LINE> <INDENT> def __init__(self, ai_settings): <NEW_LINE> <INDENT> self.ai_settings = ai_settings <NEW_LINE> self.reset_stats() <NEW_LINE> self.game_active = False <NEW_LINE> self.high_score = 0 <NEW_LINE> self.max_level = 1 <NEW_LINE> self.load_progress() <NEW_LINE> <DEDENT> def reset_stats(se... | Track all game statistics | 6259906d3539df3088ecdaf7 |
class Notification(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey("Profile", verbose_name="User to be notified") <NEW_LINE> text = models.CharField(max_length=500, verbose_name="Notification message") <NEW_LINE> url = models.URLField(null=True, verbose_name="Notification URL") <NEW_LINE> time = ... | Represents a notification message for a user | 6259906d32920d7e50bc78a1 |
class CreateLocation(messages.Message): <NEW_LINE> <INDENT> loc = messages.StringField(1, required=True) <NEW_LINE> observador = messages.StringField(2, required=True) | Message containing the information of a Location
loc: coordinates
observador: email | 6259906d66673b3332c31c58 |
class mytimr: <NEW_LINE> <INDENT> def start(self): <NEW_LINE> <INDENT> self.timeNow = time.time() <NEW_LINE> <DEDENT> def timeRep(self): <NEW_LINE> <INDENT> print("({0:.4f} sec.)".format(time.time() - self.timeNow)) | Rudimentary, measures real, not process time. | 6259906dbf627c535bcb2d25 |
class OfflineReq: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.I32, 'onsale_group_id', None, None, ), ) <NEW_LINE> def __init__(self, onsale_group_id=None,): <NEW_LINE> <INDENT> self.onsale_group_id = onsale_group_id <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProt... | Attributes:
- onsale_group_id | 6259906da8370b77170f1c23 |
@SkypeUtils.initAttrs <NEW_LINE> @SkypeUtils.convertIds("user") <NEW_LINE> class SkypeEndpointEvent(SkypeEvent): <NEW_LINE> <INDENT> attrs = SkypeEvent.attrs + ("userId", "name", "capabilities") <NEW_LINE> @classmethod <NEW_LINE> def rawToFields(cls, raw={}): <NEW_LINE> <INDENT> fields = super(SkypeEndpointEvent, cls).... | An event for changes to individual contact endpoints.
Attributes:
user (:class:`.SkypeUser`):
User whose endpoint emitted an event.
name (str):
Name of the device connected with this endpoint.
capabilities (str list):
Features available on the device. | 6259906d379a373c97d9a87b |
class Application(): <NEW_LINE> <INDENT> def __init__(self, browser, base_url): <NEW_LINE> <INDENT> if browser == "firefox": <NEW_LINE> <INDENT> self.wd = webdriver.Firefox() <NEW_LINE> <DEDENT> elif browser == "chrome": <NEW_LINE> <INDENT> self.wd = webdriver.Chrome() <NEW_LINE> <DEDENT> elif browser == "ie": <NEW_LIN... | Class for represent Application. | 6259906d97e22403b383c75f |
class DimmableLedController(CustomDevice): <NEW_LINE> <INDENT> signature = { MODELS_INFO: [("_TZ3210_9q49basr", "TS0501B")], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT, INPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, Scenes.cluster_id, OnOff.clus... | Tuya dimmable led controller single channel. | 6259906d283ffb24f3cf5104 |
class Node: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.r = None <NEW_LINE> <DEDENT> def make_il(self, il_code, symbol_table, c): <NEW_LINE> <INDENT> raise NotImplementedError | Base class for representing a single node in the AST.
All AST nodes inherit from this class. | 6259906d7b25080760ed8910 |
class LearningAgent(Agent): <NEW_LINE> <INDENT> def __init__(self, env, learning=False, epsilon=1.0, alpha=0.5): <NEW_LINE> <INDENT> super(LearningAgent, self).__init__(env) <NEW_LINE> self.planner = RoutePlanner(self.env, self) <NEW_LINE> self.valid_actions = self.env.valid_actions <NEW_LINE> self.learning = learning ... | An agent that learns to drive in the Smartcab world.
This is the object you will be modifying. | 6259906e99fddb7c1ca639ff |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.