code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
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.
6259905dbaa26c4b54d508f1
class TestValidateEOLDate(BasePyTestCase): <NEW_LINE> <INDENT> def test_none(self): <NEW_LINE> <INDENT> request = mock.Mock() <NEW_LINE> request.errors = Errors() <NEW_LINE> request.validated = {'eol': None} <NEW_LINE> validators.validate_eol_date(request) <NEW_LINE> assert not len(request.errors) <NEW_LINE> <DEDENT> d...
Test the validate_eol_date() function.
6259905d4428ac0f6e659b88
class NonSuicidePlayer(RandomCapturePlayer): <NEW_LINE> <INDENT> def getAction(self): <NEW_LINE> <INDENT> p = self.game.getAcceptable(self.color) <NEW_LINE> if len(p) > 0: <NEW_LINE> <INDENT> return [self.color, choice(p)] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return RandomCapturePlayer.getAction(self)
do random non-suicide moves in the capture game
6259905d56b00c62f0fb3f16
class Screen(object): <NEW_LINE> <INDENT> pygame.init() <NEW_LINE> _screen = pygame.display.set_mode((800, 600)) <NEW_LINE> _camera = Point(0, 0) <NEW_LINE> center = Point(800 / 2, 600 / 2) <NEW_LINE> def clear(self): <NEW_LINE> <INDENT> self._screen.fill(COLOR_BLACK) <NEW_LINE> <DEDENT> def blit(self, renderable, poin...
The global screen object.
6259905dd486a94d0ba2d613
class HeaderSection: <NEW_LINE> <INDENT> REQUIRED_HEADER_ENTITIES = ('FILE_DESCRIPTION', 'FILE_NAME', 'FILE_SCHEMA') <NEW_LINE> OPTIONAL_HEADER_ENTITIES = ('FILE_POPULATION', 'SECTION_LANGUAGE', 'SECTION_CONTENT') <NEW_LINE> KNOWN_HEADER_ENTITIES = set(REQUIRED_HEADER_ENTITIES) | set(OPTIONAL_HEADER_ENTITIES) <NEW_LINE...
The HEADER section has a fixed structure consisting of 3 to 6 groups in the given order. Except for the data fields time_stamp and FILE_SCHEMA all fields may contain empty strings.
6259905d2c8b7c6e89bd4e3a
class HelloCommand(Command): <NEW_LINE> <INDENT> pass
Complete me please. hello { --dangerous-option= : This $hould be `escaped`. } { --option-without-description }
6259905dbe8e80087fbc06d0
class JsonRenderView(object): <NEW_LINE> <INDENT> def render_to_json(self, model_data): <NEW_LINE> <INDENT> data = serializers.serialize('json', model_data) <NEW_LINE> return HttpResponse(data, mimetype="application/json")
Renders a django model directly to json
6259905d7d847024c075da1e
@implementer(IAccountUnlocked) <NEW_LINE> class AccountUnlocked(UserActivity): <NEW_LINE> <INDENT> activity = u'unlock_account' <NEW_LINE> def __init__(self, request, user, actor=None, **activity_detail): <NEW_LINE> <INDENT> super(AccountUnlocked, self).__init__(request, user, actor, **activity_detail)
An instance of this class is emitted as an :term:`event` whenever a user's account is unlocked. See :class:`UserActivity`.
6259905df548e778e596cbd5
class MonitoringLog(object): <NEW_LINE> <INDENT> def __init__(self, logs_to_stdout): <NEW_LINE> <INDENT> self.logs_to_stdout = logs_to_stdout <NEW_LINE> if not (os.path.isdir("vypr_monitoring_logs")): <NEW_LINE> <INDENT> os.mkdir("vypr_monitoring_logs") <NEW_LINE> <DEDENT> self.log_file_name = "vypr_monitoring_logs/%s"...
Class to handle monitoring logging.
6259905dadb09d7d5dc0bbb6
class GraphQLApplication(object): <NEW_LINE> <INDENT> def __init__( self, schema, execute_options={}, format_error=graphql_server.default_format_error, encode=graphql_server.json_encode ): <NEW_LINE> <INDENT> self.schema = schema <NEW_LINE> self.execute_options = execute_options <NEW_LINE> self.format_error = format_er...
WSGI GraphQL Application.
6259905d435de62698e9d451
class War: <NEW_LINE> <INDENT> def __init__(self, enemy_modifier, population, resentment): <NEW_LINE> <INDENT> self.casualties = 0 <NEW_LINE> self.annexed = 0 <NEW_LINE> self.won = False <NEW_LINE> self.mercenary_pay = 0 <NEW_LINE> self.looting_victims = 0 <NEW_LINE> self.captured_grain = 0 <NEW_LINE> self.ceasefire...
Calculate the outcome, casualties and resentment of war with a neighbouring duchy. - enemy_modifier: a random integer in the range [1, 9], is a proxy for enemy strength / size. - population: The number of peasants in your duchy. - resentment: an integer that gives the level of resentment against you by your peasants.
6259905d4e4d562566373a53
class CrawlResult(collections.Sequence): <NEW_LINE> <INDENT> url = None <NEW_LINE> feed = None <NEW_LINE> hints = None <NEW_LINE> icon_url = None <NEW_LINE> def __init__(self, url, feed, hints, icon_url=None): <NEW_LINE> <INDENT> self.url = url <NEW_LINE> self.feed = feed <NEW_LINE> self.hints = hints <NEW_LINE> self.i...
The result of each crawl of a feed. It mimics triple of (:attr:`url`, :attr:`feed`, :attr:`hints`) for backward compatibility to below 0.3.0, so you can still take these values using tuple unpacking, though it's not recommended way to get these values anymore. .. versionadded:: 0.3.0
6259905d1f5feb6acb164236
class ValidationError(object): <NEW_LINE> <INDENT> def __init__(self, code, info = ""): <NEW_LINE> <INDENT> self._code = code <NEW_LINE> self._info = info <NEW_LINE> <DEDENT> NO_ERROR = 0 <NEW_LINE> INVALID_SIGNATURE = 1 <NEW_LINE> NO_SIGNATURE = 2 <NEW_LINE> CANNOT_RETRIEVE_...
Create a new ValidationError for the given code. :param int code: The code which is one of the standard error codes such as ValidationError.INVALID_SIGNATURE, or a custom code if greater than or equal to ValidationError.USER_MIN . :param str info: {optinal) The error message. If omitted, use an empty string.
6259905d8e71fb1e983bd117
class ConcatPool2d(nn.Module): <NEW_LINE> <INDENT> def __init__(self, kernel_sz=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> kernel_sz = kernel_sz or 1 <NEW_LINE> self.ap,self.mp = nn.AvgPool2d(kernel_sz), nn.MaxPool2d(kernel_sz) <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> return torch.cat...
Layer that concats `AvgPool2d` and `MaxPool2d`.
6259905d32920d7e50bc7693
class Featured(Base): <NEW_LINE> <INDENT> __tablename__ = 'featured' <NEW_LINE> id = Column(Integer, primary_key = True) <NEW_LINE> title = Column(String(80), nullable = False) <NEW_LINE> artist = Column(String(80), nullable = False) <NEW_LINE> genre = Column(String(80)) <NEW_LINE> youtube = Column(String(250)) <NEW_LI...
This class is for songs in the special playlist, Featured. Attribute: id (int): Song id, primary key. title (str): Title of song. artist (str): Artist of song. genre (str): Musical genre of song. youtube (str): Youtube video id. rendition (str): If the song is a cover or a rendition of an older...
6259905d0c0af96317c57885
class AccountInfoExistsError(CAError): <NEW_LINE> <INDENT> pass
Raised when the account file already exists.
6259905d7d847024c075da1f
class LoginTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.browser = Browser() <NEW_LINE> self.browser.visit("http://diabcontrol1.herokuapp.com") <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.browser.quit() <NEW_LINE> <DEDENT> def _login(self, username, pass...
Proposed solution for task 3.2 Splinter Firefox
6259905d435de62698e9d452
class VerifyShortAddress(ShortAddrSpecialCommand): <NEW_LINE> <INDENT> _cmdval=0xb9 <NEW_LINE> _isquery=True <NEW_LINE> _response=YesNoResponse
The ballast shall give an answer "YES" if the received short address is equal to its own short address.
6259905d01c39578d7f1425d
class CloudbaseinitAddUserdata(CloudbaseinitRecipe): <NEW_LINE> <INDENT> def prepare_cbinit_config(self, service_type): <NEW_LINE> <INDENT> super(CloudbaseinitAddUserdata, self).prepare_cbinit_config( service_type) <NEW_LINE> if self._backend.remote_client.manager.os_type != util.WINDOWS_NANO: <NEW_LINE> <INDENT> LOG.i...
Recipe for testing that the userdata is being saved on the disk.
6259905d3cc13d1c6d466d8e
class ModelsEIP(object): <NEW_LINE> <INDENT> swagger_types = { 'public_ip': 'str' } <NEW_LINE> attribute_map = { 'public_ip': 'publicIP' } <NEW_LINE> def __init__(self, public_ip=None): <NEW_LINE> <INDENT> self._public_ip = None <NEW_LINE> self.discriminator = None <NEW_LINE> if public_ip is not None: <NEW_LINE> <INDEN...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259905d097d151d1a2c26bb
class _AnsiColorizer(object): <NEW_LINE> <INDENT> _colors = dict(black=30, red=31, green=32, yellow=33, blue=34, magenta=35, cyan=36, white=37) <NEW_LINE> def __init__(self, stream): <NEW_LINE> <INDENT> self.stream = stream <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def supported(cls, stream=sys.stdout): <NEW_LINE> <I...
A colorizer is an object that loosely wraps around a stream, allowing callers to write text to the stream in a particular color. Colorizer classes must implement C{supported()} and C{write(text, color)}.
6259905dbe8e80087fbc06d2
class PoLintTool(Tool): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def get_default_config(cls): <NEW_LINE> <INDENT> config = Tool.get_default_config() <NEW_LINE> config['filters'] = [ r'\.pot?$', ] <NEW_LINE> config['options'] = { 'variable-formats': list(get_available_formats()), } <NEW_LINE> return config <NEW_LINE>...
A part of the dennis package, this tool lints PO and POT files for problems.
6259905d16aa5153ce401b30
class PathCompositionInterface(object): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> def __init__(self, strict=False): <NEW_LINE> <INDENT> self._path = Path(force_absolute=self._force_absolute, strict=strict) <NEW_LINE> <DEDENT> @property <NEW_LINE> def path(self): <NEW_LINE> <INDENT> return self._path <N...
Abstract class interface for a parent class that contains a Path.
6259905d4f6381625f199fc9
class SlowMotion(PowerupEffect): <NEW_LINE> <INDENT> runtime = 140.0 <NEW_LINE> symbol = 4 <NEW_LINE> def start(self): <NEW_LINE> <INDENT> self.player = self.state.player <NEW_LINE> snd.play('gameover') <NEW_LINE> game.speedmult += 2 <NEW_LINE> self.ending = 0 <NEW_LINE> self.player.bullet = 1 <NEW_LINE> <DEDENT> def t...
Bullet Time
6259905d097d151d1a2c26bc
class Chat(QMainWindow, main_class): <NEW_LINE> <INDENT> def __init__(self, espera_mensaje_local, parent=None): <NEW_LINE> <INDENT> QMainWindow.__init__(self, parent) <NEW_LINE> self.setupUi(self) <NEW_LINE> <DEDENT> def getTexto(self): <NEW_LINE> <INDENT> msj = str(self.text_send.toPlainText()) <NEW_LINE> self.text_se...
************************************************** Clase que inicia la ventana del chat. **************************************************
6259905dd53ae8145f919aaf
class NewEdXPageExtractor(CurrentEdXPageExtractor): <NEW_LINE> <INDENT> def extract_sections_from_html(self, page, BASE_URL): <NEW_LINE> <INDENT> def _make_url(section_soup): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return section_soup.a['href'] <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return ...
A new page extractor for the latest changes in layout of edx
6259905da219f33f346c7e54
class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> ENABLED = "enabled" <NEW_LINE> DISABLED = "disabled"
The value that indicates whether the policy is enabled or not.
6259905d9c8ee82313040cb1
class GPKernelHandle: <NEW_LINE> <INDENT> ARD_KERNELS = ["RBF", "Matern"] <NEW_LINE> def __init__( self, kernels: List[str] = None, kernel_kwargs: List[dict] = None, ard: bool = True, ): <NEW_LINE> <INDENT> if kernels is None: <NEW_LINE> <INDENT> kernels = ["RBF", "WhiteKernel"] <NEW_LINE> <DEDENT> self.kernels: List[s...
Convenience class for Gaussian process kernel construction. Allows to create kernels depending on problem dimensions.
6259905d32920d7e50bc7694
class TestDocsBaseModel(unittest.TestCase): <NEW_LINE> <INDENT> def test_module(self): <NEW_LINE> <INDENT> self.assertTrue(len(file_storage.__doc__) > 0) <NEW_LINE> <DEDENT> def test_class(self): <NEW_LINE> <INDENT> self.assertTrue(len(FileStorage.__doc__) > 0) <NEW_LINE> <DEDENT> def test_method(self): <NEW_LINE> <IND...
test docstrings for base and test_base files
6259905d379a373c97d9a673
class Marc698Field(EmbeddedDocument): <NEW_LINE> <INDENT> a = StringField(max_length=2000)
698a = Disciplina de la revista
6259905d3eb6a72ae038bcae
class Settings: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_color = (230, 230, 230) <NEW_LINE> self.ship_speed = 1.5 <NEW_LINE> self.ship_limit = 3 <NEW_LINE> self.bullet_speed = 1.5 <NEW_LINE> self.bullet_width = 3 <NEW_LIN...
A class to store all settings for Alien Invasion.
6259905d1f5feb6acb164238
class Student: <NEW_LINE> <INDENT> def __init__(self, first_name, last_name, age): <NEW_LINE> <INDENT> self.first_name = first_name <NEW_LINE> self.last_name = last_name <NEW_LINE> self.age = age <NEW_LINE> <DEDENT> def to_json(self): <NEW_LINE> <INDENT> return self.__dict__
class that defines student
6259905d97e22403b383c55b
class SpointCalculator(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.func = None <NEW_LINE> self.binning = None <NEW_LINE> self.binning_mode = "integrate" <NEW_LINE> self.normalize = False <NEW_LINE> self.kwargs = {} <NEW_LINE> <DEDENT> def _prepare_spoint(self, spoint): <NEW_LINE> <INDENT> ...
A class that holds the function with which we calculate each point in sample space. Note that this has to be a separate class from Scanner to avoid problems related to multiprocessing's use of the pickle library, which are described here: https://stackoverflow.com/questions/1412787/
6259905d0c0af96317c57886
class State(Base): <NEW_LINE> <INDENT> __tablename__ = 'states' <NEW_LINE> id = Column(Integer, autoincrement=True, primary_key=True, nullable=False) <NEW_LINE> name = Column(String(128), nullable=False)
State class definition
6259905d24f1403a926863f5
class GoogleCloudVisionV1p3beta1Product(_messages.Message): <NEW_LINE> <INDENT> description = _messages.StringField(1) <NEW_LINE> displayName = _messages.StringField(2) <NEW_LINE> name = _messages.StringField(3) <NEW_LINE> productCategory = _messages.StringField(4) <NEW_LINE> productLabels = _messages.MessageField('Goo...
A Product contains ReferenceImages. Fields: description: User-provided metadata to be stored with this product. Must be at most 4096 characters long. displayName: The user-provided name for this Product. Must not be empty. Must be at most 4096 characters long. name: The resource name of the product. For...
6259905d1b99ca400229005e
class Meta(models.Model): <NEW_LINE> <INDENT> meta = models.ForeignKey(Config, on_delete=models.CASCADE) <NEW_LINE> meta_data = models.CharField(default='', max_length=64)
: The class: "Meta", is part of module: "models". Meta request data.
6259905d63d6d428bbee3daf
class DiscordEventarrator(Eventarrator): <NEW_LINE> <INDENT> def __init__(self, client: Client, channel: DiscordTextChannel, **options): <NEW_LINE> <INDENT> self.client = client <NEW_LINE> self.channel = channel <NEW_LINE> users = options.pop("users", None) <NEW_LINE> if users: <NEW_LINE> <INDENT> if isinstance(users, ...
The Discord Eventarrator that does the actual work. Args: client: Client to use channel: TextChannel to play the Eventory in users (Optional[Union[User, Sequence[User]]]): The user or a list of users who play(s) the Eventory message_check (Optional[Callable[[Message], Union[bool, Awaitable[bool]]]): A ...
6259905d0a50d4780f7068e6
class Aceptacion(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.aceptacion = data <NEW_LINE> <DEDENT> @property <NEW_LINE> def fecha_aceptacion(self): <NEW_LINE> <INDENT> fecha_aceptacion = '' <NEW_LINE> try: <NEW_LINE> <INDENT> fecha_aceptacion = self.aceptacion.FechaAceptacion.text <N...
Classe que implementa la aceptació
6259905dd486a94d0ba2d617
class ImageFile(Plugin): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Plugin.__init__(self) <NEW_LINE> self.help = "Realiza a aquisição de uma imagem a " + "partir de algum dispositivo, " + "seja este uma mídia ou um dispositivo de " + "aquisição de imagens (câmera, scann...
This class contains methods related the ImageFile class.
6259905d8e7ae83300eea6dd
class ShareDetailView(HTTPMethodView): <NEW_LINE> <INDENT> @share_bp.get('/<pk>', name='share_detail') <NEW_LINE> async def get(self, pk=None): <NEW_LINE> <INDENT> share = SharePoints.select().where(SharePoints.id == pk).first() <NEW_LINE> if share: <NEW_LINE> <INDENT> share.click_nums += 1 <NEW_LINE> share.save() <NEW...
分享链接
6259905d460517430c432b7a
class WatcherFunc(BaseWatcherDirective): <NEW_LINE> <INDENT> option_spec = {'format': rst.directives.unchanged} <NEW_LINE> has_content = True <NEW_LINE> def run(self): <NEW_LINE> <INDENT> if not self.content: <NEW_LINE> <INDENT> error = self.state_machine.reporter.error( 'The "%s" directive is empty; content required.'...
Directive to import a value returned by a func into the Watcher doc **How to use it** # inside your .py file class Bar(object): def foo(object): return foo_string # Inside your .rst file .. watcher-func:: import.path.to.your.Bar.foo node_classname node_classname is decumented here: http://docutils.sou...
6259905dadb09d7d5dc0bbba
class ImagePackageManifestEntry(Base): <NEW_LINE> <INDENT> __tablename__ = 'image_package_db_entries' <NEW_LINE> image_id = Column(String(image_id_length), primary_key=True) <NEW_LINE> image_user_id = Column(String(user_id_length), primary_key=True) <NEW_LINE> pkg_name = Column(String(pkg_name_length), primary_key=True...
An entry from the package manifest (e.g. rpm, deb, apk) for verifying package contents in a generic way.
6259905da219f33f346c7e56
class Listing(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> verbose_name = 'listing' <NEW_LINE> verbose_name_plural = 'listings' <NEW_LINE> <DEDENT> user = models.ForeignKey(User, help_text="User") <NEW_LINE> category = models.ForeignKey(Category, default=1, help_text="") <NEW_LINE> title = models....
Listing Represents a job offer
6259905d1f037a2d8b9e5393
class PaymentInitiationPaymentCreateResponse(ModelNormal): <NEW_LINE> <INDENT> allowed_values = { } <NEW_LINE> validations = { } <NEW_LINE> @cached_property <NEW_LINE> def additional_properties_type(): <NEW_LINE> <INDENT> lazy_import() <NEW_LINE> return (bool, date, datetime, dict, float, int, list, str, none_type,) <N...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the a...
6259905d32920d7e50bc7696
class CopyTemplate: <NEW_LINE> <INDENT> def __init__(self, form, user): <NEW_LINE> <INDENT> if not DB_FILE or ";" in DB_FILE: <NEW_LINE> <INDENT> print_error("PROBLEM WITH DATABASE", DB_FILE) <NEW_LINE> <DEDENT> args = get_args(form) <NEW_LINE> self.run(args.get('id')) <NEW_LINE> <DEDENT> def run(self, template_id): <N...
Manage form for creating defaulted entry from template
6259905d4e4d562566373a57
class FirethornCheckerResults(object): <NEW_LINE> <INDENT> def __init__(self, exceptions={}, message=""): <NEW_LINE> <INDENT> self.exceptions = exceptions <NEW_LINE> self.message = message <NEW_LINE> return
Firethorn Health Checker Results Class, stores information from a health check run
6259905d45492302aabfdb29
class CreateDistanceCallback(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> locations = create_data_array() <NEW_LINE> size = len(locations) <NEW_LINE> self.matrix = {} <NEW_LINE> for from_node in xrange(size): <NEW_LINE> <INDENT> self.matrix[from_node] = {} <NEW_LINE> for to_node in xrange(size):...
Create callback to calculate distances between points.
6259905d07f4c71912bb0a8c
class _AsyncSFTPServer(SFTPServer): <NEW_LINE> <INDENT> @asyncio.coroutine <NEW_LINE> def format_longname(self, name): <NEW_LINE> <INDENT> return super().format_longname(name) <NEW_LINE> <DEDENT> @asyncio.coroutine <NEW_LINE> def open(self, path, pflags, attrs): <NEW_LINE> <INDENT> return super().open(path, pflags, att...
Implement all SFTP callbacks as coroutines
6259905d99cbb53fe6832530
class KafkaConsumer: <NEW_LINE> <INDENT> def __init__( self, topic_name_pattern, message_handler, is_avro=True, offset_earliest=False, sleep_secs=1.0, consume_timeout=0.1, ): <NEW_LINE> <INDENT> self.topic_name_pattern = topic_name_pattern <NEW_LINE> self.message_handler = message_handler <NEW_LINE> self.sleep_secs = s...
Defines the base kafka consumer class
6259905d24f1403a926863f6
class Provider(metaclass=ABCMeta): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def make_request(self, method, params=None): <NEW_LINE> <INDENT> raise NotImplementedError("Providers must implement this method") <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def is_connected(self): <NEW_LINE> <INDENT> raise NotImpleme...
The provider defines how the IconService connects to Loopchain.
6259905da17c0f6771d5d6cb
class CommandPWD(Command): <NEW_LINE> <INDENT> def set_args(self, args): <NEW_LINE> <INDENT> self.__args = args <NEW_LINE> <DEDENT> def run(self, input, env): <NEW_LINE> <INDENT> self.__output = Stream() <NEW_LINE> return_value = 0 <NEW_LINE> if self.__args: <NEW_LINE> <INDENT> self.__output.write_line('Wrong number of...
The 'pwd' command prints name of current/working directory.
6259905d4428ac0f6e659b8e
class TimeDeltaFormat(TimeFormat): <NEW_LINE> <INDENT> def _check_scale(self, scale): <NEW_LINE> <INDENT> if scale is not None and scale not in TIME_DELTA_SCALES: <NEW_LINE> <INDENT> raise ScaleValueError("Scale value '{0}' not in " "allowed values {1}" .format(scale, TIME_DELTA_SCALES)) <NEW_LINE> <DEDENT> return scal...
Base class for time delta representations
6259905d63d6d428bbee3db0
class FairsConfig(AppConfig): <NEW_LINE> <INDENT> name = "myhandycrafts.fairs" <NEW_LINE> verbose_name = _("Fairs")
config for fairs
6259905d435de62698e9d456
class Queue(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.list = [] <NEW_LINE> <DEDENT> def insert(self, elem): <NEW_LINE> <INDENT> self.list.append(elem) <NEW_LINE> <DEDENT> def remove(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.list.pop(0) <NEW_LINE> <DEDENT> except: <N...
Implements a Queue
6259905d76e4537e8c3f0bdd
class StorageElementTestCase( unittest.TestCase ): <NEW_LINE> <INDENT> def setUp( self ): <NEW_LINE> <INDENT> self.numberOfFiles = 1 <NEW_LINE> self.storageElement = StorageElement( storageElementToTest ) <NEW_LINE> self.localSourceFile = fileToTest <NEW_LINE> self.localFileSize = getSize( self.localSourceFile ) <NEW_L...
Base class for the StorageElement test cases
6259905dd486a94d0ba2d619
class UserProfileManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, email, name, password=None): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError("User must have an email address") <NEW_LINE> <DEDENT> email = self.normalize_email(email) <NEW_LINE> user = self.model(email=email, na...
Manager for user profiles
6259905d01c39578d7f1425f
class Player: <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def get_player_ships(self, board, ships): <NEW_LINE> <INDENT> for ship in ships: <NEW_LINE> <INDENT> board.ship_on_board(ship) <NEW_LINE> board.print_board(board.board) <NEW_LINE> <DEDENT> <DEDENT> def f...
Sets player name, ships available to the player and their orientation
6259905d498bea3a75a59126
class UserCreateTest(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.username = "testuser" <NEW_LINE> self.password = "password" <NEW_LINE> self.email = "test@example.com" <NEW_LINE> self.first_name = "John" <NEW_LINE> self.last_name = "Sample" <NEW_LINE> self.affiliation = "University" <NEW_LI...
Test User instance creation
6259905d23e79379d538db4d
class Graph(Base): <NEW_LINE> <INDENT> __tablename__ = 'graph' <NEW_LINE> id = Column('graph_id', Integer, primary_key=True) <NEW_LINE> calculation_id = Column(Integer, ForeignKey('calculation.calculation_id'), nullable=False) <NEW_LINE> title = Column(String(255), nullable=False) <NEW_LINE> created = Column(DateTime, ...
График
6259905de64d504609df9ef7
class MXBase(dns.rdata.Rdata): <NEW_LINE> <INDENT> __slots__ = ['preference', 'exchange'] <NEW_LINE> def __init__(self, rdclass, rdtype, preference, exchange): <NEW_LINE> <INDENT> super(MXBase, self).__init__(rdclass, rdtype) <NEW_LINE> self.preference = preference <NEW_LINE> self.exchange = exchange <NEW_LINE> <DEDENT...
Base class for rdata that is like an MX record. @ivar preference: the preference value @type preference: int @ivar exchange: the exchange name @type exchange: dns.name.Name object
6259905d460517430c432b7b
class MoveForms(messages.Message): <NEW_LINE> <INDENT> items = messages.MessageField(MoveForm, 1, repeated=True)
MoveForms for showing all the moves in a game
6259905d009cb60464d02b87
class BracketPluginRunCommand(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def run(self, edit): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> Payload.args["edit"] = edit <NEW_LINE> Payload.plugin.run(**Payload.args) <NEW_LINE> Payload.status = True <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> print("Bra...
Sublime run command to run BH plugins.
6259905d56b00c62f0fb3f1d
class TinyMCEMemo3x3AndroidMainWidget(TinyMCEMemo2x2AndroidMainWidget): <NEW_LINE> <INDENT> plugin_uid = 'tinymce_memo_3x3' <NEW_LINE> cols = 3 <NEW_LINE> rows = 3
Memo3x3 plugin widget for Android layout (placeholder `main`).
6259905e1f5feb6acb16423c
class Map(device.Map): <NEW_LINE> <INDENT> def _to_device(self): <NEW_LINE> <INDENT> if not hasattr(self, '_device_values'): <NEW_LINE> <INDENT> self._device_values = array.to_device(_queue, self._values) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> warnings.warn("Copying Map data for %s again, do you really want to d...
OP2 OpenCL map, a relation between two Sets.
6259905e3539df3088ecd8ee
class StackedLSTM(nn.Module): <NEW_LINE> <INDENT> def __init__(self, num_layers, input_size, rnn_size, dropout): <NEW_LINE> <INDENT> super(StackedLSTM, self).__init__() <NEW_LINE> self.dropout = nn.Dropout(dropout) <NEW_LINE> self.num_layers = num_layers <NEW_LINE> self.layers = nn.ModuleList() <NEW_LINE> for _ in rang...
Our own implementation of stacked LSTM. Needed for the decoder, because we do input feeding.
6259905e07f4c71912bb0a8f
class IITech3Exception(Exception): <NEW_LINE> <INDENT> pass
The base class for exception thrown by this program.
6259905e6e29344779b01ca1
class UserVideo(db.Model): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_key_name(video_or_youtube_id, user_data): <NEW_LINE> <INDENT> id = video_or_youtube_id <NEW_LINE> if type(id) not in [str, unicode]: <NEW_LINE> <INDENT> id = video_or_youtube_id.youtube_id <NEW_LINE> <DEDENT> return user_data.key_email + ":...
A single user's interaction with a single video.
6259905ed7e4931a7ef3d6ad
class LayerNormLSTMCell(tf.contrib.rnn.RNNCell): <NEW_LINE> <INDENT> def __init__(self, num_units, forget_bias=1.0, use_recurrent_dropout=False, dropout_keep_prob=0.90): <NEW_LINE> <INDENT> self.num_units = num_units <NEW_LINE> self.forget_bias = forget_bias <NEW_LINE> self.use_recurrent_dropout = use_recurrent_dropout...
Layer-Norm, with Ortho Init. and Recurrent Dropout without Memory Loss. https://arxiv.org/abs/1607.06450 - Layer Norm https://arxiv.org/abs/1603.05118 - Recurrent Dropout without Memory Loss
6259905e4428ac0f6e659b90
class IntegralType(NumericType, metaclass=DataTypeSingleton): <NEW_LINE> <INDENT> pass
Integral data types.
6259905ef7d966606f7493e2
class bedParse(object): <NEW_LINE> <INDENT> def __init__(self,chrom,start,end,name=None,score=None,strand=None,thickStart=None,thickEnd=None,itemRgb=None,blockCount=None,blockSize=None,blockStarts=None): <NEW_LINE> <INDENT> self.chrom = chrom <NEW_LINE> self.start = start <NEW_LINE> self.end = end <NEW_LINE> self.name ...
a class for one line of a bed file
6259905e21a7993f00c675c0
class FileListsXml(XmlStreamedParser, PackageXmlMixIn): <NEW_LINE> <INDENT> def _registerTypes(self): <NEW_LINE> <INDENT> PackageXmlMixIn._registerTypes(self) <NEW_LINE> self._databinder.registerType(_PackageFL, name='package') <NEW_LINE> self._databinder.registerType(_FileLists, name='filelists')
Handle registering all types for parsing filelists.xml files.
6259905e2c8b7c6e89bd4e42
class CmdSaveOnTest(APITestCase): <NEW_LINE> <INDENT> def test_basic(self): <NEW_LINE> <INDENT> result = self.api.cmd_save_on() <NEW_LINE> self._test_for_success(result)
/cmd/save-on
6259905e01c39578d7f14260
class PublicKeyFromLaunchpadChecker(SSHPublicKeyDatabase): <NEW_LINE> <INDENT> credentialInterfaces = ISSHPrivateKeyWithMind, <NEW_LINE> implements(ICredentialsChecker) <NEW_LINE> def __init__(self, authserver): <NEW_LINE> <INDENT> self.authserver = authserver <NEW_LINE> <DEDENT> def checkKey(self, credentials): <NEW_L...
Cred checker for getting public keys from launchpad. It knows how to get the public keys from the authserver.
6259905e627d3e7fe0e084de
class Worker(object): <NEW_LINE> <INDENT> def __init__(self, on_start, on_end, on_result, on_log): <NEW_LINE> <INDENT> self.pid = None <NEW_LINE> self.job = None <NEW_LINE> self.prev_call = None <NEW_LINE> self.callback_on_log = on_log <NEW_LINE> self.callback_on_end = on_end <NEW_LINE> self.callback_on_start = on_star...
A Worker represents a process that persists to work on jobs.
6259905ed6c5a102081e3776
class WorkingDir(object): <NEW_LINE> <INDENT> def __init__(self, *base_dirs): <NEW_LINE> <INDENT> base_dir = os.path.join(*base_dirs) <NEW_LINE> if not os.path.isdir(base_dir): <NEW_LINE> <INDENT> os.makedirs(base_dir) <NEW_LINE> <DEDENT> os.chdir(base_dir) <NEW_LINE> self.base_dir = os.getcwd() <NEW_LINE> self.path = ...
工作目录类 用于切换下载目录和创建目录等。 属性 base_dir:工作目录的根目录,任何时候都基于这个目录; path:相对于根目录的路径。
6259905e9c8ee82313040cb4
class CryptPasswordHasher(BasePasswordHasher): <NEW_LINE> <INDENT> algorithm = "crypt" <NEW_LINE> library = "crypt" <NEW_LINE> def salt(self): <NEW_LINE> <INDENT> return get_random_string(2) <NEW_LINE> <DEDENT> def encode(self, password, salt): <NEW_LINE> <INDENT> crypt = self._load_library() <NEW_LINE> assert len(salt...
Password hashing using UNIX crypt (not recommended) The crypt module is not supported on all platforms.
6259905e32920d7e50bc769a
class BackupProtectedItemsOperations(object): <NEW_LINE> <INDENT> def __init__(self, client, config, serializer, deserializer): <NEW_LINE> <INDENT> self._client = client <NEW_LINE> self._serialize = serializer <NEW_LINE> self._deserialize = deserializer <NEW_LINE> self.api_version = "2016-12-01" <NEW_LINE> self.config ...
BackupProtectedItemsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. :ivar api_version: Client Api Version. Constant value: "2016-12-01".
6259905e379a373c97d9a678
class InstructionNodeCreator(object): <NEW_LINE> <INDENT> def __init__(self, collection=None, position_tracker=None): <NEW_LINE> <INDENT> if not collection: <NEW_LINE> <INDENT> self._collection = [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._collection = collection <NEW_LINE> <DEDENT> self._position_tracer = p...
Creates _InstructionNode instances from characters and commands, storing them internally
6259905ebaa26c4b54d508fa
class GeneticFunctions(object): <NEW_LINE> <INDENT> def probability_crossover(self): <NEW_LINE> <INDENT> return 0.75 <NEW_LINE> <DEDENT> def probability_mutation(self): <NEW_LINE> <INDENT> return 0.02 <NEW_LINE> <DEDENT> def initial(self): <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> def fitness(self, chromosome):...
docstring for GeneticFunctions
6259905e3539df3088ecd8f0
class DeferPlugin(object): <NEW_LINE> <INDENT> def pytest_xdist_setupnodes(self, config, specs): <NEW_LINE> <INDENT> print( "\n\nUsing AnyBodyCon: ", config.getoption("--anybodycon") or get_anybodycon_path(), "\n", )
Simple plugin to defer pytest-xdist hook functions.
6259905e7047854f46340a15
class EditAppointment(View): <NEW_LINE> <INDENT> model = Appointment <NEW_LINE> form_class = AppointmentForm <NEW_LINE> template_name = 'HNApp/edit_appointment.html' <NEW_LINE> def get(self, request, pk): <NEW_LINE> <INDENT> app = Appointment.objects.get(pk=pk) <NEW_LINE> form = self.form_class(None, initial={'datetime...
TODO
6259905e3c8af77a43b68a6b
class Metric: <NEW_LINE> <INDENT> def __init__(self, name, documentation): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.documentation = documentation <NEW_LINE> <DEDENT> def dump_header(self, out): <NEW_LINE> <INDENT> out('/// %s' % self.documentation) <NEW_LINE> out('RawMetric %s;' % self.name) <NEW_LINE> <DED...
A single performance metric.
6259905e7d847024c075da27
class PyDmTree(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://github.com/deepmind/tree" <NEW_LINE> pypi = "dm-tree/dm-tree-0.1.5.tar.gz" <NEW_LINE> maintainers = ['aweits'] <NEW_LINE> version('0.1.5', sha256='a951d2239111dfcc468071bc8ff792c7b1e3192cab5a3c94d33a8b2bda3127fa') <NEW_LINE> depends_on('py-setuptool...
tree is a library for working with nested data structures. In a way, tree generalizes the builtin map() function which only supports flat sequences, and allows to apply a function to each leaf preserving the overall structure.
6259905e0a50d4780f7068e9
class ICodeDiscountableMarker(Interface): <NEW_LINE> <INDENT> pass
Discount Interface
6259905ed486a94d0ba2d61d
class TwoLayerNet(object): <NEW_LINE> <INDENT> def __init__(self, input_dim=3*32*32, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0): <NEW_LINE> <INDENT> self.params = {} <NEW_LINE> self.reg = reg <NEW_LINE> self.params['W1'] = weight_scale * np.random.randn(input_dim, hidden_dim) <NEW_LINE> self.params['b1...
A two-layer fully-connected neural network with ReLU nonlinearity and softmax loss that uses a modular layer design. We assume an input dimension of D, a hidden dimension of H, and perform classification over C classes. The architecure should be affine - relu - affine - softmax. Note that this class does not implemen...
6259905ecc0a2c111447c5f9
class DNAChain(PlottableSequence): <NEW_LINE> <INDENT> def __init__(self, genome: str, chain: int = 0): <NEW_LINE> <INDENT> self.basepairs_chain0 = self._makeFromGenome(genome, chain=chain) <NEW_LINE> self.basepairs = self.basepairs_chain0 <NEW_LINE> self.center_in_z() <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def _...
*Inherits from PlottableSequence* A single DNA Chain built from a genome specified. :param genome: A string specifying the genome, e.g. 'AGTATC' :param chain: The Chain index to label this strand
6259905e627d3e7fe0e084e0
class AlcaHarvest(Builder): <NEW_LINE> <INDENT> def build(self, step, workingDir, **args): <NEW_LINE> <INDENT> stepName = nodeName(step) <NEW_LINE> stepWorkingArea = "%s/%s" % (workingDir, stepName) <NEW_LINE> self.installWorkingArea(step, stepWorkingArea) <NEW_LINE> print("Builders.AlcaHarvest.build called on %s" % st...
_AlcaHarvest_ Build a working area for a AlcaHarvest step
6259905e4e4d562566373a5c
class Command(BaseCommand): <NEW_LINE> <INDENT> def delete(self): <NEW_LINE> <INDENT> write('Deleting Synonyms') <NEW_LINE> for item in Synonym.objects.all(): <NEW_LINE> <INDENT> item.delete() <NEW_LINE> <DEDENT> write('Deleting Lookuplists') <NEW_LINE> for model in lookuplists.lookuplists(): <NEW_LINE> <INDENT> for it...
Management command to delete all lookuplists and related synonyms.
6259905ecb5e8a47e493ccb0
class PictureSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> photo_url = serializers.SerializerMethodField("get_photo_url") <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ("photo", "photo_url") <NEW_LINE> <DEDENT> def get_photo_url(self, obj): <NEW_LINE> <INDENT> return obj.pho...
[summary] [description] Extends: serializers.ModelSerializer Variables: photo_url {[type]} -- [description]
6259905ee64d504609df9ef9
class VersionedAttribute(AttributeBase): <NEW_LINE> <INDENT> class_id = 'VA' <NEW_LINE> class_name = 'versioned attribute' <NEW_LINE> class_data_len = 4 <NEW_LINE> sort_type = 'attribute' <NEW_LINE> def __init__(self, parent, name = None, atype = None, value = None, max_versions = 1): <NEW_LINE> <INDENT> super(Versione...
A single attribute. Attributes are used by pretty much every other object type. They are used to store varying types of data. Arguments: name : the attribute name. atype : the attribute type, one of: text : a unicode string. binary : a string of binary data (no encoding/decoding performed) ...
6259905e0fa83653e46f653c
class C3(parametertools.SingleParameter): <NEW_LINE> <INDENT> NDIM, TYPE, TIME, SPAN = 0, float, None, (0., .5)
Third coefficient of the muskingum working formula [-].
6259905ea79ad1619776b5e8
class GitError(Exception): <NEW_LINE> <INDENT> pass
Raised if there is an issue with the local git configuration.
6259905e67a9b606de5475cc
class TestAPIError(unittest.TestCase): <NEW_LINE> <INDENT> def test_traceback_is_added(self): <NEW_LINE> <INDENT> exception_message = 'Test exception' <NEW_LINE> try: <NEW_LINE> <INDENT> raise Exception(exception_message) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> raise APIError(...
Test APIError functionality
6259905e4e4d562566373a5d
class MyBM25Transformer(BM25Transformer): <NEW_LINE> <INDENT> def fit(self, x, y=None): <NEW_LINE> <INDENT> super().fit(x)
To be used in sklearn pipeline, transformer.fit() needs to be able to accept a "y" argument
6259905e99cbb53fe6832536
class BoardClear(BoardTest): <NEW_LINE> <INDENT> def test_clear(self): <NEW_LINE> <INDENT> for name, board in self.boards: <NEW_LINE> <INDENT> board.populate(self.test_data) <NEW_LINE> self.assertNotEqual(list(board.iterdata()), [], name) <NEW_LINE> board.clear() <NEW_LINE> expected = [] <NEW_LINE> actual = list(board....
Clearing the board removes all the data visible to the local board. That is, if this is a subboard of some larger board, only those items which fall within the local coordinate space are removed;
6259905e32920d7e50bc769d
class User(db.Model, UserMixin): <NEW_LINE> <INDENT> id = Column(Integer, primary_key=True) <NEW_LINE> email = Column(Text, unique=True) <NEW_LINE> password = Column(Text) <NEW_LINE> active = Column(Text) <NEW_LINE> roles = relationship( 'Role', secondary=roles_users, backref=db.backref('users', lazy='dynamic') )
User of proteomics database.
6259905e2ae34c7f260ac73d
class MissingQueryParameter(FilesException): <NEW_LINE> <INDENT> code = 400 <NEW_LINE> description = "Missing required query argument '{arg_name}'" <NEW_LINE> def __init__(self, arg_name, **kwargs): <NEW_LINE> <INDENT> self.arg_name = arg_name <NEW_LINE> super(MissingQueryParameter, self).__init__(**kwargs) <NEW_LINE> ...
Exception raised when missing a query parameter.
6259905e0c0af96317c5788a
class HouseStatus(Service): <NEW_LINE> <INDENT> version = (1, 0) <NEW_LINE> serviceType = 'urn:schemas-upnp-org:service:HouseStatus:1' <NEW_LINE> serviceId = 'urn:schemas-upnp-org:serviceId:HouseStatus' <NEW_LINE> serviceUrl = 'house' <NEW_LINE> type = 'House' <NEW_LINE> subscription_timeout_range = (None, None) <NEW_L...
classdocs
6259905e6e29344779b01ca5
class IRecordModifiedEvent(IRecordEvent): <NEW_LINE> <INDENT> oldValue = schema.Field(title=u'The record\'s previous value') <NEW_LINE> newValue = schema.Field(title=u'The record\'s new value')
Event fired when a record's value is modified.
6259905e7d43ff2487427f3b
class CoreFeatureSchema(FeatureSchema): <NEW_LINE> <INDENT> env = fields.Nested(EnvSchema(), default=EnvSchema()) <NEW_LINE> domain = fields.Nested(DomainSchema(), default=DomainSchema()) <NEW_LINE> project = fields.Nested(ProjectSchema(), default=ProjectSchema()) <NEW_LINE> os = fields.String(required=True, default=os...
Core feature schema.
6259905e3d592f4c4edbc532