code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ExtensionLoader(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._available_extensions = {} <NEW_LINE> <DEDENT> def load(self): <NEW_LINE> <INDENT> for entry_point in iter_entry_points('handroll.extensions'): <NEW_LINE> <INDENT> cls = entry_point.load() <NEW_LINE> self._available_extensio... | A loader for extensions from handroll's extension entry point. | 62598fb17047854f4633f442 |
class IprouteNetConfig(os_net_config.NetConfig): <NEW_LINE> <INDENT> pass | Configure network interfaces using iproute2. | 62598fb1498bea3a75a57b87 |
class DjangoMaintenance(object): <NEW_LINE> <INDENT> def process_request(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> json_data = open(JSON_FILE, 'r') <NEW_LINE> data = json.load(json_data) <NEW_LINE> json_data.close() <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> data = None <NEW_LINE> <DEDEN... | Django Maintennece middleware. | 62598fb199cbb53fe6830f41 |
class ParamPushConfiguration(object): <NEW_LINE> <INDENT> swagger_types = { 'piid': 'str' } <NEW_LINE> attribute_map = { 'piid': 'piid' } <NEW_LINE> def __init__(self, piid=None): <NEW_LINE> <INDENT> self._piid = None <NEW_LINE> if piid is not None: <NEW_LINE> <INDENT> self.piid = piid <NEW_LINE> <DEDENT> <DEDENT> @pro... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fb1283ffb24f3cf38f5 |
class DjangoModuleManager(object): <NEW_LINE> <INDENT> def __init__(self, projectname, *modulename): <NEW_LINE> <INDENT> self.__path = os.path.join(projectname, *modulename) <NEW_LINE> self.__file = {} <NEW_LINE> self.__data = {} <NEW_LINE> if not os.path.exists(self.__path): <NEW_LINE> <INDENT> os.makedirs(self.__path... | Utility class to modify and write files in a Python module. | 62598fb1fff4ab517ebcd84e |
@public <NEW_LINE> @implementer(IChain, IChainIterator) <NEW_LINE> class TerminalChainBase: <NEW_LINE> <INDENT> def _process(self, mlist, msg, msgdata): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def get_links(self, mlist, msg, msgdata): <NEW_LINE> <INDENT> return iter(self) <NEW_LINE> <DEDENT> d... | A base chain that always matches and executes a method.
The method is called '_process()' and must be provided by the subclass. | 62598fb1be383301e0253862 |
class BatchView(generics.ListCreateAPIView): <NEW_LINE> <INDENT> permission_classes = [permissions.IsAuthenticated] <NEW_LINE> serializer_class = BatchSerializer <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> product = Product.objects.get(owner=self.request.user, pk=self.kwargs['pk']) <NEW_LINE> return Batch.ob... | This class manages the view to create and list the products.
Attributes:
permission_classes (list(Permissions)): The options to access at this resource.
serializer_class (Serializer): The serializer to bind the request and the response object.
Returns:
200: The list of products.
201: The produ... | 62598fb1aad79263cf42e83b |
class User(db.Model): <NEW_LINE> <INDENT> __tablename__ = "info_user" <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(32), unique=True, nullable=False) <NEW_LINE> followers = db.relationship('User', secondary=tb_user_follows, primaryjoin=id == tb_user_follows.c.followed_id,... | 用户表 | 62598fb13539df3088ecc31a |
class MinusNumericExpression(NumericExpression): <NEW_LINE> <INDENT> def __init__(self, numericExpression): <NEW_LINE> <INDENT> NumericExpression.__init__(self) <NEW_LINE> self.numericExpression = numericExpression <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "MinusNE:" + "-(" + str(self.numericExp... | Class representing a minus numeric expression node in the AST of a MLP | 62598fb1a8370b77170f0444 |
class ProfileLinksForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> models = dillo.models.profiles.ProfileLinks <NEW_LINE> exclude = ('social',) | Links Form, used to generate an inline forms set. | 62598fb1090684286d593711 |
class HTMLSoupLinkScraper(BaseScraper): <NEW_LINE> <INDENT> content_types = [ "text/html", "application/xhtml+xml" ] <NEW_LINE> def derived_get_requests(self): <NEW_LINE> <INDENT> attributes = { "src": True, "href": True, "link": True, "script": True, "url": True } <NEW_LINE> host = self.queue_item.response.url <NEW_LI... | The HTMLSoupLinkScraper finds URLs from href attributes in HTML using BeautifulSoup.
Attributes:
content_types list(str): The supported content types. | 62598fb156ac1b37e6302253 |
class UploadCommand(Command): <NEW_LINE> <INDENT> description = 'Build and publish the package.' <NEW_LINE> user_options = [] <NEW_LINE> @staticmethod <NEW_LINE> def status(s): <NEW_LINE> <INDENT> print('\033[1m{0}\033[0m'.format(s)) <NEW_LINE> <DEDENT> def initialize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> ... | Support setup.py upload. | 62598fb14e4d56256637248f |
class SampleScript(PrometheusExporterScript): <NEW_LINE> <INDENT> name = "prometheus-aioexporter-sample" <NEW_LINE> default_port = 9091 <NEW_LINE> def configure(self, args: Namespace): <NEW_LINE> <INDENT> self.create_metrics( [ MetricConfig("a_gauge", "a gauge", "gauge", {"labels": ["foo", "bar"]}), MetricConfig("a_cou... | A sample exporter. | 62598fb1009cb60464d0158a |
class Stateful(object): <NEW_LINE> <INDENT> def save(self, filepath, overwrite=False): <NEW_LINE> <INDENT> with gzip.open(create_filepath(filepath, overwrite), 'wb') as openf: <NEW_LINE> <INDENT> openf.write(pickle.dumps(self)) <NEW_LINE> <DEDENT> <DEDENT> @staticmethod <NEW_LINE> def load(filepath): <NEW_LINE> <INDENT... | Generic class for a stateful object who needs save and load methods. | 62598fb1aad79263cf42e83c |
class Parser( baseparser.BaseParser ): <NEW_LINE> <INDENT> def __init__( self, declaration, root='root', prebuilts=(), definitionSources=common.SOURCES, ): <NEW_LINE> <INDENT> self._rootProduction = root <NEW_LINE> self._declaration = declaration <NEW_LINE> self._generator = simpleparsegrammar.Parser( declaration, preb... | EBNF-generated Parsers with results-handling
The Parser is a two-stage object:
Passed an EBNF definition during initialisation,
it compiles the definition into a tagging table
(which in turn requires creating a tagging table
for parsing the EBNF).
You then call the parser's parse method to
per... | 62598fb15fc7496912d482b2 |
class GenerateRandomNoize: <NEW_LINE> <INDENT> def __init__(self, mean, var, n): <NEW_LINE> <INDENT> self.mean = mean <NEW_LINE> self.sd = np.sqrt(var) <NEW_LINE> self.var = var <NEW_LINE> self.n = n <NEW_LINE> <DEDENT> def generate(self): <NEW_LINE> <INDENT> self.value = np.random.normal(loc=self.mean, scale=np.sqrt(s... | 1次元ガウス分布に従ってデータ点を生成するオブジェクト
sd : 標準偏差 | 62598fb167a9b606de546037 |
class RomanNumeral(object): <NEW_LINE> <INDENT> values = [(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"), (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I")] <NEW_LINE> rev_dict = [(v, k) for (k, v) in values] <NEW_LINE> def __init__(self, text): <NEW_LINE> <INDENT> se... | Store roman numerals. As per
https://projecteuler.net/about=roman_numerals | 62598fb14f6381625f1994f4 |
class SequenceProxy(Proxy[Sequence[T_co]], SequenceRole[T_co]): <NEW_LINE> <INDENT> pass | Proxy to :class:`typing.Sequence` object. | 62598fb185dfad0860cbfaa8 |
class DatabaseException(AioRestException): <NEW_LINE> <INDENT> pass | All database related exceptions | 62598fb1f7d966606f74804f |
@dataclass(frozen=True) <NEW_LINE> class Aggregate(BaseModel): <NEW_LINE> <INDENT> __blurb__: ClassVar[str] = 'Aggregate' <NEW_LINE> name: str <NEW_LINE> description: str <NEW_LINE> variable: str <NEW_LINE> aggregate_type: str <NEW_LINE> interval_length: pd.Timedelta <NEW_LINE> interval_label: str <NEW_LINE> timezone: ... | Class for keeping track of Aggregate metadata. Aggregates always
have interval_value_type of 'interval_mean'.
Parameters
----------
name : str
Name of the Aggregate, e.g. Utility X Solar PV
description : str
A description of what the aggregate is.
variable : str
Variable name, e.g. power, GHI. Each allowed... | 62598fb18e7ae83300ee910d |
class ScipyGaussianCopula(object): <NEW_LINE> <INDENT> implements(ICopula) <NEW_LINE> def __init__(self, portfolio): <NEW_LINE> <INDENT> from scipy import sparse <NEW_LINE> self.issuers = [i for i in portfolio.issuers()] <NEW_LINE> self.assets = [a for a in portfolio.assets] <NEW_LINE> self.asset_issuer_map = makeAsset... | Gaussian copula simulation of correlated defaults using scipy sparse matrix lib | 62598fb14428ac0f6e658590 |
class BlinkController(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> rospy.init_node('blink_controller', anonymous=False) <NEW_LINE> rospy.loginfo( '[Blink Controller]: Waiting for gazebo color plugin service') <NEW_LINE> self.serviceName = str(sys.argv[1]) + '/hat_color' <NEW_LINE> rospy.loginfo(... | docstring for Blink | 62598fb1a05bb46b3848a8d6 |
class PromoteUDBInstanceToHARequestSchema(schema.RequestSchema): <NEW_LINE> <INDENT> fields = { "DBId": fields.Str(required=True, dump_to="DBId"), "ProjectId": fields.Str(required=False, dump_to="ProjectId"), "Region": fields.Str(required=True, dump_to="Region"), } | PromoteUDBInstanceToHA - 普通db升级为高可用(只针对mysql5.5及以上版本)
| 62598fb138b623060ffa9106 |
class GRNN(object): <NEW_LINE> <INDENT> def __init__(self, training_data=[], standard_deviation=1.41, feature_mask =None, global_method=True, k=1): <NEW_LINE> <INDENT> self.training_data = training_data <NEW_LINE> if feature_mask == None: <NEW_LINE> <INDENT> self.feature_mask = [1 for _ in range(len(training_data[0][0]... | GRNN classifier | 62598fb15fcc89381b266181 |
class TicketChannel(): <NEW_LINE> <INDENT> def __init__(self, minRepeat=1800): <NEW_LINE> <INDENT> self.providers = [] <NEW_LINE> self.minRepeat = minRepeat <NEW_LINE> self.lastSent = {} <NEW_LINE> <DEDENT> def addProvider(self, regex, provider): <NEW_LINE> <INDENT> self.providers.append( { 're': regex, 'provider': pro... | Dispatcher and rate limiter for per-channel ticketing info | 62598fb1fff4ab517ebcd850 |
class RepoPkgsUpgradeToSubCommandTest(support.ResultTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(RepoPkgsUpgradeToSubCommandTest, self).setUp() <NEW_LINE> base = support.BaseCliStub('updates', 'third_party') <NEW_LINE> base.init_sack() <NEW_LINE> self.cli = base.mock_cli() <NEW_LINE> <DEDEN... | Tests of ``dnf.cli.commands.RepoPkgsCommand.UpgradeToSubCommand`` class. | 62598fb13539df3088ecc31c |
class ServerAuthenticationMiddleware(object): <NEW_LINE> <INDENT> def process_request(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> uTime = request.GET['uTime'] <NEW_LINE> sid, token = request.GET['sToken'].split('.') <NEW_LINE> <DEDENT> else: <NEW_LINE> <I... | Authenticates a server from querystring parameters 'uTime' and 'sToken'
If authentication is successful, a `request.server` will be set to the
`Server` model object that authenticated | 62598fb1090684286d593712 |
class FrequencyAverageForecaster(BaseForecaster): <NEW_LINE> <INDENT> def __init__(self, transform_timestamp): <NEW_LINE> <INDENT> self.transform_timestamp = transform_timestamp <NEW_LINE> self.averages_ = None <NEW_LINE> <DEDENT> def fit(self, series): <NEW_LINE> <INDENT> self.averages_ = series.groupby(self.transform... | Args:
transform_timestamp (func): A function which converts a pandas.tslib.Timestamp to a value
with which the data will be grouped by. | 62598fb121bff66bcd722cd1 |
class ReauthAccessTokenRefreshError(ReauthError): <NEW_LINE> <INDENT> def __init__(self, message=None, status=None): <NEW_LINE> <INDENT> super(ReauthAccessTokenRefreshError, self).__init__( 'Failed to get an access token for reauthentication. {0}'.format( message)) <NEW_LINE> self.status = status | An exception for when we can't get an access token for reauth. | 62598fb132920d7e50bc60be |
class Feature3(Feature): <NEW_LINE> <INDENT> def __init__(self, **kargs): Feature.__init__(self, 0, 'fa-coffee', **kargs) <NEW_LINE> def get(self, request): <NEW_LINE> <INDENT> return Text('Single Feature 3 Action') | Single Feature 3 | 62598fb14f88993c371f0540 |
class Solution: <NEW_LINE> <INDENT> def permuteUnique(self, nums): <NEW_LINE> <INDENT> nums.sort() <NEW_LINE> rlt = self._permuteUnique(nums) <NEW_LINE> return rlt <NEW_LINE> <DEDENT> def _permuteUnique(self, nums): <NEW_LINE> <INDENT> rlt = [] <NEW_LINE> if len(nums) in [0, 1]: <NEW_LINE> <INDENT> rlt.append(nums) <NE... | @param nums: A list of integers.
@return: A list of unique permutations. | 62598fb14e4d562566372491 |
class StdOutHandler(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.oldStdout = None <NEW_LINE> <DEDENT> def hideStdOut(self): <NEW_LINE> <INDENT> self.oldStdout = sys.stdout <NEW_LINE> sys.stdout = open(os.devnull, 'w') <NEW_LINE> <DEDENT> def restoreStdOut(self): <NEW_LINE> <INDENT> if self.oldStd... | Class for managing stdout | 62598fb1a219f33f346c687f |
class Rectangle: <NEW_LINE> <INDENT> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> if type(width) != int: <NEW_LINE> <INDENT> raise TypeError('width must be an integer') <NEW_LINE> <DEDENT> if width < 0: <NEW_LINE> <INDENT> raise ValueError('width must be >= 0') <NEW_LINE> <DEDENT> if type(height) != int: ... | Real Rectangle. | 62598fb15fdd1c0f98e5dff7 |
class canva_Mat(FigureCanvas): <NEW_LINE> <INDENT> N=25 <NEW_LINE> def __init__(self, parent=None): <NEW_LINE> <INDENT> self.start_time = time.time() <NEW_LINE> self.fig = Figure() <NEW_LINE> self.axes_y = self.fig.add_subplot(4,1,1) <NEW_LINE> self.axes_p = self.fig.add_subplot(4,1,3) <NEW_LINE> self.axes_r = self.fig... | This class pronting 3 graphic for acran | 62598fb123849d37ff85111e |
class Base64Decoder(object): <NEW_LINE> <INDENT> def __init__(self, underlying): <NEW_LINE> <INDENT> self.cache = bytearray() <NEW_LINE> self.underlying = underlying <NEW_LINE> <DEDENT> def write(self, data): <NEW_LINE> <INDENT> if len(self.cache) > 0: <NEW_LINE> <INDENT> data = self.cache + data <NEW_LINE> <DEDENT> de... | This object provides an interface to decode a stream of Base64 data. It
is instantiated with an "underlying object", and whenever a write()
operation is performed, it will decode the incoming data as Base64, and
call write() on the underlying object. This is primarily used for decoding
form data encoded as Base64, bu... | 62598fb1aad79263cf42e83e |
class Compilation(data.Compilation): <NEW_LINE> <INDENT> def save(self): <NEW_LINE> <INDENT> data_storage = {} <NEW_LINE> for name, node in [(na, no) for na, no in self._subnodes.items() if not no.empty]: <NEW_LINE> <INDENT> data_storage[name] = node.save() <NEW_LINE> <DEDENT> return data_storage | Compilation-type data node for the npz backend. | 62598fb167a9b606de546038 |
@TYPES.register("Outlet") <NEW_LINE> class Outlet(HomeAccessory): <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> super().__init__(*args, category=CATEGORY_OUTLET) <NEW_LINE> self._flag_state = False <NEW_LINE> serv_outlet = self.add_preload_service(SERV_OUTLET) <NEW_LINE> self.char_on = serv_outlet.... | Generate an Outlet accessory. | 62598fb101c39578d7f12de5 |
class DataLoader(object): <NEW_LINE> <INDENT> def __init__(self, reader, batch_size=1, collate_fn=default_collate, transform=None): <NEW_LINE> <INDENT> self.reader = reader <NEW_LINE> self.batch_size = batch_size <NEW_LINE> self.collate_fn = collate_fn <NEW_LINE> self.transform = transform <NEW_LINE> <DEDENT> def __ite... | A data loader adaptor for ``torch.utils.data.DataLoader``.
This class iterates and returns items from the Reader in batches.
This loader can be used as a context manager, but it will terminate at the end of an epoch.
The context will invoke next_epoch() upon entry.
If not used as context manager, invoke the next_epo... | 62598fb199cbb53fe6830f44 |
class StackTraceMapper(tf_stack.StackTraceMapper): <NEW_LINE> <INDENT> def __init__(self, converted_fn): <NEW_LINE> <INDENT> self._source_map = converted_fn.ag_source_map <NEW_LINE> <DEDENT> def get_effective_source_map(self): <NEW_LINE> <INDENT> effective_source_map = self._effective_source_map <NEW_LINE> if effective... | Remaps generated code to code it originated from. | 62598fb199fddb7c1ca62e1f |
class C3BinaryDataProcessor(DatasetGetter): <NEW_LINE> <INDENT> def __init__(self, tokenizer, max_length): <NEW_LINE> <INDENT> self.tokenizer = tokenizer <NEW_LINE> self.max_length = max_length <NEW_LINE> <DEDENT> def get_dataset(self, fn, with_label=True): <NEW_LINE> <INDENT> features = [] <NEW_LINE> df = pd.read_csv(... | return C3 dataset as a binary classification problem
via an implemented method `get_dataset`. | 62598fb155399d3f05626585 |
class BasicModel(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def create_model(self, kfold_X_train, y_train, kfold_X_test, y_test, test): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def batch_iter(self, data, batch_size, num_epochs=1, shuffle=True): <NEW_LINE> <INDENT> ... | Docstring for BasicModel. | 62598fb14527f215b58e9f40 |
class GA_Printer(StrPrinter): <NEW_LINE> <INDENT> function_names = ('acos', 'acosh', 'acot', 'acoth', 'arg', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceiling', 'conjugate', 'cos', 'cosh', 'cot', 'coth', 'exp', 'floor', 'im', 'log', 're', 'root', 'sin', 'sinh', 'sqrt', 'sign', 'tan', 'tanh') <NEW_LINE> def _print_Fun... | An enhanced string printer that is galgebra-aware. | 62598fb1e1aae11d1e7ce859 |
class DaemonOpenError(DaemonError): <NEW_LINE> <INDENT> def __init__(self, e): <NEW_LINE> <INDENT> if hasattr(e, 'filename'): <NEW_LINE> <INDENT> _msg = 'open({})'.format(e.filename) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> _msg = 'dup2()' <NEW_LINE> <DEDENT> self.msg = 'Failed {}: [errno={}] {}'.format(_msg, e.er... | Failed open()/dup2() while becoming a daemon | 62598fb1b7558d5895463696 |
class LikelihoodRatioTestResult(object): <NEW_LINE> <INDENT> def __init__(self, statistic, df, distribution, n): <NEW_LINE> <INDENT> self.statistic = statistic <NEW_LINE> self.df = df <NEW_LINE> self.distribution = distribution <NEW_LINE> self.n = n <NEW_LINE> <DEDENT> @property <NEW_LINE> def pvalue(self): <NEW_LINE> ... | The result of a likelihood ratio test.
:ivar statistic: test statistic
:ivar df: degrees of freedom
:ivar distribution: distribution of test statistic
:ivar n: sample size
:type statistic: float
:type df: int
:type distribution: scipy probability distribution
:type n: int | 62598fb1796e427e5384e800 |
class SerialExpectForSocket(SerialExpect): <NEW_LINE> <INDENT> def __init__(self, host='localhost', port=20000, logger=None): <NEW_LINE> <INDENT> url = 'socket://{host}:{port}'.format(host=host, port=port) <NEW_LINE> self.fd = self.try_connect(url, timeout=0.1) <NEW_LINE> self.logger = logger <NEW_LINE> <DEDENT> @stati... | Simple Expect implementation for tcp connection adapter | 62598fb11f5feb6acb162c8a |
class Vote(UpdateCountsMixin, BaseDate): <NEW_LINE> <INDENT> VOTING_CHOICES = ( (1, 'Like'), (-1, 'Dislike'), ) <NEW_LINE> node = models.ForeignKey('nodes.Node') <NEW_LINE> user = models.ForeignKey(settings.AUTH_USER_MODEL) <NEW_LINE> vote = models.IntegerField(choices=VOTING_CHOICES) <NEW_LINE> class Meta: <NEW_LINE> ... | Vote model
Like or dislike feature | 62598fb14c3428357761a324 |
class ACLsMerge(object): <NEW_LINE> <INDENT> def __init__(self, acls): <NEW_LINE> <INDENT> self.acls = acls <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> acls = config.get_cfg_storage(ID_ACL) <NEW_LINE> for aname in self.acls: <NEW_LINE> <INDENT> acl = acls.get(aname) <NEW_LINE> if acl is not None: <NEW_L... | Special class that merges different ACLs maps | 62598fb116aa5153ce40056f |
class BaseListViewPage(BaseDesktopPage): <NEW_LINE> <INDENT> def get_list_items(self): <NEW_LINE> <INDENT> list_items = self.driver.find_elements(*LIST_VIEW_ROW) <NEW_LINE> return [el for el in list_items if el.text.strip() != ''] <NEW_LINE> <DEDENT> def get_list_item_by_name(self, search_string): <NEW_LINE> <INDENT> l... | Common functionality for list view pages | 62598fb166673b3332c30438 |
class ReadableUrlProcessor: <NEW_LINE> <INDENT> patterns = [ (r'/\w+/OL\d+M', '/type/edition', 'title', 'untitled'), (r'/\w+/ia:[a-zA-Z0-9_\.-]+', '/type/edition', 'title', 'untitled'), (r'/\w+/OL\d+A', '/type/author', 'name', 'noname'), (r'/\w+/OL\d+W', '/type/work', 'title', 'untitled'), (r'/[/\w]+/OL\d+L', '/type/li... | Open Library code works with urls like /books/OL1M and
/books/OL1M/edit. This processor seemlessly changes the urls to
/books/OL1M/title and /books/OL1M/title/edit.
The changequery function is also customized to support this. | 62598fb1498bea3a75a57b8b |
class ApparentMagnitude(object): <NEW_LINE> <INDENT> def __init__(self, sed_name, max_mag=1000.): <NEW_LINE> <INDENT> self.bps = dict() <NEW_LINE> throughput_dir = lsstUtils.getPackageDir('throughputs') <NEW_LINE> for band in 'ugrizy': <NEW_LINE> <INDENT> self.bps[band] = photUtils.Bandpass() <NEW_LINE> self.bps[band].... | Class to compute apparent magnitudes for a given rest frame SED.
The SED normalization, internal extinction, redshift, and Galactic
extinction are applied given the parameters in an instance catalog
object line to produce the apparent magnitude in the desired band.
Attributes
----------
bps : dict
Dictionary of LS... | 62598fb15166f23b2e243446 |
class NelJet(object): <NEW_LINE> <INDENT> def __init__(self, n0, r0, beta): <NEW_LINE> <INDENT> self._n0 = n0 <NEW_LINE> self._r0 = r0 <NEW_LINE> self._beta = beta <NEW_LINE> return <NEW_LINE> <DEDENT> @property <NEW_LINE> def n0(self): <NEW_LINE> <INDENT> return self._n0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def r0... | Class to set characteristics of electron density of AGN Jet | 62598fb1fff4ab517ebcd851 |
class Study(models.Model): <NEW_LINE> <INDENT> userId = models.ForeignKey(User) <NEW_LINE> syllabus = models.TextField() | 在校学习模型,包括课表 | 62598fb130dc7b766599f8b9 |
class Details(db.Document, MtimeMixin): <NEW_LINE> <INDENT> movieinfo = db.EmbeddedDocumentField(MovieInfo) <NEW_LINE> release = db.ListField(db.EmbeddedDocumentField(Release)) <NEW_LINE> detail = db.EmbeddedDocumentField(MovieDetail) | 详细信息 | 62598fb11b99ca400228f566 |
class phantom(): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def shepp3d(sz = [256, 256, 256]): <NEW_LINE> <INDENT> dim = numpy.array(numpy.flipud(sz)) <NEW_LINE> space = odl.uniform_discr(min_pt = -dim / 2, max_pt = dim / 2, shape=dim, dtype='float32') <NEW_LINE> x = odl.phantom.transmission.shepp_logan(space) <NEW_L... | Use tomopy phantom module for now | 62598fb27b25080760ed751d |
class HistoricalPricesParser(object): <NEW_LINE> <INDENT> SITE_URL = "http://info.finance.yahoo.co.jp/history/?code=%(ccode)s&sy=%(syear)s&sm=%(smon)s&sd=%(sday)s&ey=%(eyear)s&em=%(emon)s&ed=%(eday)s&tm=%(range_type)s&p=%(page)s" <NEW_LINE> DATA_FIELD_NUM = 7 <NEW_LINE> INDEX_DATA_FIELD_NUM = 5 <NEW_LINE> COLUMN_NUM = ... | 過去の株価情報ページパーサ | 62598fb2f548e778e596b610 |
class BoardElement( object ): <NEW_LINE> <INDENT> def getPos(self): <NEW_LINE> <INDENT> return self.pos <NEW_LINE> <DEDENT> def setPos(self,x,y): <NEW_LINE> <INDENT> self.pos=(int(x),int(y)) <NEW_LINE> <DEDENT> pass | Representacao interna de um tabuleiro de Ricochet Robots. | 62598fb2d268445f26639bb9 |
class RbcpBusError(RbcpError): <NEW_LINE> <INDENT> def __init__(self, message=None): <NEW_LINE> <INDENT> if message is None: <NEW_LINE> <INDENT> message = "SiTCP RBCP Bus Error. Check Device Address and Length for read/write" <NEW_LINE> <DEDENT> super(RbcpBusError, self).__init__(message) | SiTCP RBCP Bus Error.
This exception is raised when the RBCP Reply message with Bus Error Flag was set.
Check Rbcp.read/write address and length value is valid. | 62598fb20c0af96317c563e8 |
class ParserPlugin(Plugin): <NEW_LINE> <INDENT> requires = ('xdress.base',) <NEW_LINE> defaultrc = utils.RunControl( includes=['.'], defines=["XDRESS"], undefines=[], variables=(), functions=(), classes=(), parsers={'c': ['pycparser', 'gccxml', 'clang'], 'c++':['gccxml', 'clang', 'pycparser']}, clear_parser_cache_perio... | This is a base plugin for tools that wish to wrap parsing.
It should not be used directly. | 62598fb27b180e01f3e49086 |
class NameNotFoundError(ExistenceError): <NEW_LINE> <INDENT> pass | No declaration, assignment, or definition of the given name was found. | 62598fb24e4d562566372493 |
class Alerts(Datapoint): <NEW_LINE> <INDENT> def __init__(self, forecast): <NEW_LINE> <INDENT> if not isinstance(forecast, f.Forecast): <NEW_LINE> <INDENT> raise TypeError("Not a Forecast object.") <NEW_LINE> <DEDENT> elif "alerts" not in forecast: <NEW_LINE> <INDENT> raise NoDataError("Alerts Array does not exist.") <... | Represents the Alerts object from the Forecast response.
Refer to https://darksky.net/dev/docs/response under Alerts for
documentation. | 62598fb2e5267d203ee6b975 |
class GetVariable(_Action): <NEW_LINE> <INDENT> check_hangup = False <NEW_LINE> def __init__(self, variable): <NEW_LINE> <INDENT> _Action.__init__(self, 'GET VARIABLE', quote(variable)) <NEW_LINE> <DEDENT> def process_response(self, response): <NEW_LINE> <INDENT> result = response.items.get(_RESULT_KEY) <NEW_LINE> if r... | Returns a `variable` associated with this channel.
The value of the requested variable is returned as a string. If the variable is
undefined, `None` is returned.
`AGIAppError` is raised on failure. | 62598fb226068e7796d4c9c2 |
class BaseTest(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> app = create_app(config.DevelopmentConfig) <NEW_LINE> self.app = app.test_client() <NEW_LINE> self.app_context = app.app_context <NEW_LINE> self.party_test_data = dict( id=1, name="kanu", hqAddress="Nakuru", logoUrl="gig.com/kanu.png" ) ... | Base Test Class to every test class | 62598fb223849d37ff851120 |
class OwnTracksEntity(TrackerEntity, RestoreEntity): <NEW_LINE> <INDENT> def __init__(self, dev_id, data=None): <NEW_LINE> <INDENT> self._dev_id = dev_id <NEW_LINE> self._data = data or {} <NEW_LINE> self.entity_id = f"{DOMAIN}.{dev_id}" <NEW_LINE> <DEDENT> @property <NEW_LINE> def unique_id(self): <NEW_LINE> <INDENT> ... | Represent a tracked device. | 62598fb271ff763f4b5e77df |
class Links(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=50, verbose_name='标题') <NEW_LINE> description = models.CharField(max_length=200, verbose_name='友情链接描述') <NEW_LINE> callback_url = models.URLField(verbose_name='url地址') <NEW_LINE> date_publish = models.DateTimeField(auto_now_add=True, ver... | 友情链接 | 62598fb201c39578d7f12de6 |
class TestLibx264Recipe(BaseTestForMakeRecipe, unittest.TestCase): <NEW_LINE> <INDENT> recipe_name = "libx264" <NEW_LINE> sh_command_calls = ["./configure"] | An unittest for recipe :mod:`~pythonforandroid.recipes.libx264` | 62598fb299cbb53fe6830f45 |
class ExpenseConfig(colander.MappingSchema): <NEW_LINE> <INDENT> id = colander.SchemaNode(colander.Integer(), widget=widget.HiddenWidget(), default=None, missing=None) <NEW_LINE> label = colander.SchemaNode(colander.String(), title=u"Libellé", validator=colander.Length(max=50)) <NEW_LINE> code = colander.SchemaNode(col... | Schema for the configuration of different expense types | 62598fb267a9b606de54603b |
class TypedMeta(type): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def create_property(name, ptype): <NEW_LINE> <INDENT> pname = '_' + name <NEW_LINE> def getter(self): <NEW_LINE> <INDENT> if not hasattr(self, pname) and hasattr(self, f'{self._getter_prefix}{pname}'): <NEW_LINE> <INDENT> self[f'{self._getter_prefix}{p... | This metaclass creates statically typed class attributes using the property
framework.
.. code-block:: Python
class TestMeta(TypedMeta):
attr1 = (int, float)
attr2 = DataFrame
class TestClass(metaclass=TestMeta):
def __init__(self, attr1, attr2):
self.attr1 = attr1
... | 62598fb24527f215b58e9f41 |
class _OneHotColumn(_FeatureColumn, collections.namedtuple("_OneHotColumn", ["sparse_id_column"])): <NEW_LINE> <INDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return "{}_one_hot".format(self.sparse_id_column.name) <NEW_LINE> <DEDENT> @property <NEW_LINE> def length(self): <NEW_LINE> <INDENT> return se... | Represents a one-hot column for use in deep networks.
Args:
sparse_id_column: A _SparseColumn which is created by `sparse_column_with_*`
function. | 62598fb23d592f4c4edbaf2e |
@base.vectorize <NEW_LINE> class setbit(base.Instruction): <NEW_LINE> <INDENT> __slots__ = ["code"] <NEW_LINE> code = base.opcodes['SETBIT'] <NEW_LINE> arg_format = ['srw', 'sb', 'int'] | SETBIT i k n
Assigns zero to sri, and then sets the n-th bit to be sb_k
The assignment of zero, rather than take an existing register
is to ensure we maintain SSA.
This instruction is vectorizable | 62598fb27c178a314d78d50a |
class EarlyStop(object): <NEW_LINE> <INDENT> step_fitness_dict = {'CartPole-v0': [], 'CarRacing-v0': [], 'Breakout-ram-v0': [], 'BipedalWalker-v2': [(190, 15), (300, 30), (400, 40), (600, 50), (700, 65), (800, 80)], 'RoboschoolPong-v1': [], 'Acrobot-v1': []} <NEW_LINE> @classmethod <NEW_LINE> def check(cls, step, fitne... | Contains a method and dictionary that enable
the controller.fitness evaluation to be prematurely terminated if a
candidate controllers performance is poor. This reduces computational cost.
If a given controller falls short of reaching a the specified cumulative
reward within the corresponding number of timesteps, the ... | 62598fb285dfad0860cbfaaa |
class MeanLayer(nn.Module): <NEW_LINE> <INDENT> def __init__(self, dim): <NEW_LINE> <INDENT> super(MeanLayer, self).__init__() <NEW_LINE> self.dim = dim <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> return x.mean(dim = self.dim, keepdim=True) | The mean layer: calculates the mean of the data along given 'dim' | 62598fb256b00c62f0fb2924 |
class Timeout(BaseException): <NEW_LINE> <INDENT> def __init__(self, seconds=None, exception=None): <NEW_LINE> <INDENT> self.seconds = seconds <NEW_LINE> self.exception = exception <NEW_LINE> self.timer = None <NEW_LINE> self.start() <NEW_LINE> <DEDENT> def start(self): <NEW_LINE> <INDENT> assert not self.pending, ... | Raises *exception* in the current greenthread after *timeout* seconds.
When *exception* is omitted or ``None``, the :class:`Timeout` instance
itself is raised. If *seconds* is None, the timer is not scheduled, and is
only useful if you're planning to raise it directly.
Timeout objects are context managers, and so can... | 62598fb255399d3f05626588 |
class HTTP429(HTTPError): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return repr('429 Too Many Requests') | Http429 Error Exception
The user has sent too many requests in a given amount of time.
Intended for use with rate limiting schemes. | 62598fb2be8e80087fbbf0d3 |
class WebServiceError(AcoustidError): <NEW_LINE> <INDENT> pass | The Web service request failed. | 62598fb2d58c6744b42dc30f |
class HTTP(BaseHTTPRequestHandler): <NEW_LINE> <INDENT> def _set_headers(self): <NEW_LINE> <INDENT> self.send_response(200) <NEW_LINE> self.send_header("Content-type", "text/html") <NEW_LINE> self.end_headers() <NEW_LINE> <DEDENT> def do_GET(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> html_file = open("./index.... | HTTP class
Serve HTTP | 62598fb2283ffb24f3cf38fb |
@python_2_unicode_compatible <NEW_LINE> class EncodeProfile(models.Model): <NEW_LINE> <INDENT> command = models.CharField(_('command'), max_length=1024) <NEW_LINE> container = models.CharField(_('container'), max_length=32) <NEW_LINE> name = models.CharField(_('name'), max_length=255) <NEW_LINE> def __str__(self): <NEW... | Encoding profiles associated with ``MediaBase`` subclasses. Each
media instance can have multiple encoding profiles associated
with it. When a media instance is encoded, it will be encoded
using all associated encoding profiles. | 62598fb2a79ad1619776a0d6 |
class AddRecord(environment.CLIRunnable): <NEW_LINE> <INDENT> action = 'add' <NEW_LINE> def execute(self, args): <NEW_LINE> <INDENT> manager = SoftLayer.DNSManager(self.client) <NEW_LINE> zone_id = helpers.resolve_id(manager.resolve_ids, args['<zone>'], name='zone') <NEW_LINE> manager.create_record( zone_id, args['<rec... | usage: sl dns add <zone> <record> <type> <data> [--ttl=TTL] [options]
Add resource record
Arguments:
<zone> Zone name (softlayer.com)
<record> Resource record (www)
<type> Record type. [Options: A, AAAA,
CNAME, MX, NS, PTR, SPF, SRV, TXT]
<data> Record data. NOTE: only minor validation... | 62598fb23539df3088ecc320 |
class AnalyzeQueryResponse(object): <NEW_LINE> <INDENT> openapi_types = { 'errors': 'list[AnalyzeQueryResponseErrors]' } <NEW_LINE> attribute_map = { 'errors': 'errors' } <NEW_LINE> def __init__(self, errors=None): <NEW_LINE> <INDENT> self._errors = None <NEW_LINE> self.discriminator = None <NEW_LINE> if errors is not ... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually. | 62598fb2167d2b6e312b6fe1 |
class AgentGlobals(object): <NEW_LINE> <INDENT> _container_id = "00000000-0000-0000-0000-000000000000" <NEW_LINE> @staticmethod <NEW_LINE> def get_container_id(): <NEW_LINE> <INDENT> return AgentGlobals._container_id <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def update_container_id(container_id): <NEW_LINE> <INDENT>... | This class is used for setting AgentGlobals which can be used all throughout the Agent. | 62598fb27d847024c075c430 |
class Builder(Command): <NEW_LINE> <INDENT> def __init__(self, build_engine, params): <NEW_LINE> <INDENT> self.params = params <NEW_LINE> self.build_engine = build_engine <NEW_LINE> self.target = self.params.target <NEW_LINE> self.generator = None <NEW_LINE> super(Builder, self).__init__(self.build_engine, Command.TYPE... | Class representing generic builder - if it's instantiated it returns proper builder | 62598fb2379a373c97d99083 |
class Dialogu_3(QDialog, Dialogu_3.Ui_Dialog): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> super(Dialogu_3, self).__init__(parent) <NEW_LINE> self.setupUi(self) <NEW_LINE> self.buttonBox_Ok_pilot.clicked.connect(self.setdata_pilot) <NEW_LINE> self.model = Model() <NEW_LINE> <DEDENT> def set... | Opens Dialogu box to insert new pilot in database | 62598fb2a8370b77170f044b |
class Slider(object): <NEW_LINE> <INDENT> def __init__(self, items=None): <NEW_LINE> <INDENT> self.items = items <NEW_LINE> self.menu = component.Component(Menu(self.items), model='slider') <NEW_LINE> self.menu.on_answer(self.select_slide) <NEW_LINE> self.content = component.Component(None) <NEW_LINE> self.select_slide... | A simple Bar chart rendered with html5
| 62598fb2e5267d203ee6b977 |
class DietPlanNutritionInfo (NutritionInfo): <NEW_LINE> <INDENT> diet_plan = models.OneToOneField(DietPlan, related_name='nutrition_info') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name = 'Target nutrition' <NEW_LINE> verbose_name_plural = 'Target nutrition' | Nutritional information for a DietPlan.
| 62598fb232920d7e50bc60c3 |
class CustomPlugin(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def start(cls,urldata): <NEW_LINE> <INDENT> pass | a customed fetch plugin | 62598fb25fc7496912d482b5 |
class TodoTxt: <NEW_LINE> <INDENT> def __init__(self, filename, encoding='utf-8', parser=None): <NEW_LINE> <INDENT> self.filename = pathlib.Path(filename) <NEW_LINE> self.encoding = encoding <NEW_LINE> self.linesep = os.linesep <NEW_LINE> self.tasks = [] <NEW_LINE> self.parser = parser or TodoTxtParser(self.encoding) <... | Convenience wrapper for a single todo.txt file
The most common use is::
todotxt = TodoTxt("todo.txt")
todotxt.parse()
Use the ``tasks`` property to access the parsed entries. | 62598fb201c39578d7f12de8 |
class ClickableCellRendererPixbuf(Gtk.CellRendererPixbuf): <NEW_LINE> <INDENT> __gsignals__ = { 'clicked': ( GObject.SignalFlags.RUN_LAST, GObject.TYPE_BOOLEAN, (GObject.TYPE_PYOBJECT,), GObject.signal_accumulator_true_handled, ) } <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> Gtk.CellRendererPixbuf.__init__(self)... | Custom :class:`Gtk.CellRendererPixbuf` emitting
an *clicked* signal upon activation of the pixbuf | 62598fb2d486a94d0ba2c03f |
class Time: <NEW_LINE> <INDENT> def flies(self): <NEW_LINE> <INDENT> return River.flow(day, night) | 逝者如斯夫,不舍昼夜。 -- 《论语》 | 62598fb292d797404e388b9b |
class StratifiedMean(_ProtoInit): <NEW_LINE> <INDENT> def __call__(self, shape, dtype="float32"): <NEW_LINE> <INDENT> self.instantiate(dtype=dtype) <NEW_LINE> for label, num in zip(self.unique_labels, self.prototype_distribution): <NEW_LINE> <INDENT> x_label = self.x_train[self.y_train == label] <NEW_LINE> x_label_mean... | Initializer that samples the mean data for each class. | 62598fb24f6381625f1994f7 |
class ConfigManagerEntryIndexView(HomeAssistantView): <NEW_LINE> <INDENT> url = '/api/config/config_entries/entry' <NEW_LINE> name = 'api:config:config_entries:entry' <NEW_LINE> @asyncio.coroutine <NEW_LINE> def get(self, request): <NEW_LINE> <INDENT> hass = request.app['hass'] <NEW_LINE> return self.json([{ 'entry_id'... | View to get available config entries. | 62598fb2a17c0f6771d5c2a4 |
class JobEndNode(graph.State): <NEW_LINE> <INDENT> def __init__(self, name, next_name, reentrance=False): <NEW_LINE> <INDENT> super(JobEndNode, self).__init__(name, reentrance) <NEW_LINE> self._next_name = next_name <NEW_LINE> <DEDENT> def process(self, session, current_node, nodes_process): <NEW_LINE> <INDENT> return ... | 任务结束节点 | 62598fb255399d3f05626589 |
class ElementGetter(object): <NEW_LINE> <INDENT> def __init__(self, locator_type, query_string, base_element=None, timeout=0, value=lambda el: el, only_if=lambda el: el is not None, facet=False): <NEW_LINE> <INDENT> self.query_string = query_string <NEW_LINE> self.locator_type = locator_type <NEW_LINE> self.timeout = t... | internal class to encapsulate the logic used by
:class:`holmium.core.Element`
& :class:`holmium.core.Elements` | 62598fb255399d3f0562658a |
class Crash(namedtuple("C", "foo bar")): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return "{0.foo}: {0.bar}".format(self) | Looking for attributes in __str__ will crash,
because EmptyNodes can't be infered. | 62598fb238b623060ffa910c |
class SitemapError(Exception): <NEW_LINE> <INDENT> pass | Base error class for Sitemap errors. | 62598fb22ae34c7f260ab152 |
class SinglePointSet(QChemDictSet): <NEW_LINE> <INDENT> defaults = {"basis": "6-311++G*", "SCF_algorithm": "diis", "max_scf_cycles": 200} <NEW_LINE> def __init__(self, molecule, DFT_rung=4, PCM_solvent=None): <NEW_LINE> <INDENT> self.basis_set = defaults.get("basis") <NEW_LINE> self.SCF_algorithm = defaults.get("SCF_al... | QChemDictSet for a single point calculation | 62598fb2a79ad1619776a0d8 |
class TestOdootilCommon(TestBaseCommon): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> super().setUpClass() <NEW_LINE> cls.Odootil = cls.env['odootil'] <NEW_LINE> cls.company = cls.env.ref('base.main_company') <NEW_LINE> cls.ResPartner = cls.env['res.partner'] <NEW_LINE> cls.partn... | Common class for all odootil test cases. | 62598fb2f548e778e596b614 |
class StructureKeeperLair(OwnedStructure): <NEW_LINE> <INDENT> def __init__(self, pos: RoomPosition, room: Room, structureType: str, _id: str, hits: int, hitsMax: int, my: bool, owner: _Owner, ticksToSpawn: int) -> None: <NEW_LINE> <INDENT> super().__init__(pos, room, structureType, _id, hits, hitsMax, my, owner) <NEW_... | :type ticksToSpawn: int | 62598fb24e4d562566372496 |
class TestViewFeatureViewSet(TestBaseViewFeatureViewSet, NamespaceMixin): <NEW_LINE> <INDENT> pass | Test ViewFeaturesViewSet read operations. | 62598fb2fff4ab517ebcd856 |
class ChoiceException(StandardOption, Exception): <NEW_LINE> <INDENT> def result(self, value): <NEW_LINE> <INDENT> return self | A choice for input_choice which result in this exception. | 62598fb27047854f4633f44b |
class HeatmiserV3Thermostat(ClimateDevice): <NEW_LINE> <INDENT> def __init__(self, heatmiser, device, name, serport): <NEW_LINE> <INDENT> self.heatmiser = heatmiser <NEW_LINE> self.device = device <NEW_LINE> self.serport = serport <NEW_LINE> self._current_temperature = None <NEW_LINE> self._name = name <NEW_LINE> self.... | Representation of a HeatmiserV3 thermostat. | 62598fb2aad79263cf42e843 |
class NetworkInterfaceListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'next_link': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkInterface]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_L... | Response for the ListNetworkInterface API service call.
Variables are only populated by the server, and will be ignored when sending a request.
:param value: A list of network interfaces in a resource group.
:type value: list[~azure.mgmt.network.v2019_06_01.models.NetworkInterface]
:ivar next_link: The URL to get the... | 62598fb2090684286d593715 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.