code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class FileAlreadyExists(Exception): <NEW_LINE> <INDENT> pass | Raise File already exists exception | 6259906aa219f33f346c7ffd |
class News_SourceTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.new_source = News_Source("CBSN","CBSN NEWS","CBSN is the leading free news platform","cbsn.com","business","us", "en") <NEW_LINE> <DEDENT> def test_instance(self): <NEW_LINE> <INDENT> self.assertTrue(isinstance(self.... | Test Class to test the behaviour of the News class | 6259906a3317a56b869bf13e |
class WingSect(XMLContainer): <NEW_LINE> <INDENT> XMLTAG = 'Section' <NEW_LINE> driver = Enum(_MS_AR_TR_S, iotype='in', xmltag='Driver', values=(_MS_AR_TR_A, _MS_AR_TR_S, _MS_AR_TR_TC, _MS_AR_TR_RC, _MS_S_TC_RC, _MS_A_TC_RC, _MS_TR_S_A, _MS_AR_A_RC), aliases=('AR-TR-Area', 'AR-TR-Span', 'AR-TR-TC', 'AR-TR-RC', 'Span-TC... | XML parameters for one section of a multi-section wing. | 6259906a91f36d47f2231a8a |
class LazyConnection: <NEW_LINE> <INDENT> def __init__(self, address, family=AF_INET, type=SOCK_STREAM): <NEW_LINE> <INDENT> self.address = address <NEW_LINE> self.family = family <NEW_LINE> self.type = type <NEW_LINE> self.local = threading.local() <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> if hasatt... | 该类实现了一个上下文管理器,用来创建线程独立的socket连接。 | 6259906a92d797404e389756 |
class Cert_Ldaps(Collection): <NEW_LINE> <INDENT> def __init__(self, auth): <NEW_LINE> <INDENT> super(Cert_Ldaps, self).__init__(auth) <NEW_LINE> self._meta_data['allowed_lazy_attributes'] = [Cert_Ldap] <NEW_LINE> self._meta_data['attribute_registry'] = {'tm:auth:cert-ldap:cert-ldapstate': Cert_Ldap} | BIG-IP® ldap server collection | 6259906a4428ac0f6e659d29 |
class ClockDataParser(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def new_split(cls, start, name=None): <NEW_LINE> <INDENT> return backend.new_dict(dict(name=name, start=start, end=None, data=None, duration=None)) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def close_split(cls, split, split_end, name=None): <N... | Parse things to do with clock data | 6259906aa17c0f6771d5d7a3 |
class SocialLoginCorrectPermissionsMixin(object): <NEW_LINE> <INDENT> def test_get_authstatus(self): <NEW_LINE> <INDENT> response = self.client.get(reverse('sociallogin:status')) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> response_content = response.content <NEW_LINE> if six.PY3: <NEW_LINE> <INDE... | Mixins for user testing the views is logged if the user has the required permissions. | 6259906a67a9b606de54769d |
@adapter(IFolderish) <NEW_LINE> @implementer(ISliderConfig) <NEW_LINE> class SliderConfigAdapter(object): <NEW_LINE> <INDENT> height = PrefixedFieldProperty(ISliderConfig['height'], STORAGE_PREFIX) <NEW_LINE> interval = PrefixedFieldProperty(ISliderConfig['interval'], STORAGE_PREFIX) <NEW_LINE> wrap = PrefixedFieldProp... | Adapter for storing config values | 6259906a7047854f46340bac |
class JsMathPattern(markdown.inlinepatterns.Pattern): <NEW_LINE> <INDENT> def __init__(self, tag, pattern): <NEW_LINE> <INDENT> super(JsMathPattern, self).__init__(pattern) <NEW_LINE> self.math_tag_class = 'math' <NEW_LINE> self.tag = tag <NEW_LINE> <DEDENT> def handleMatch(self, m): <NEW_LINE> <INDENT> node = markdown... | Inline markdown processing of math. | 6259906a7b25080760ed88dd |
class ProjectsLocationsService(base_api.BaseApiService): <NEW_LINE> <INDENT> _NAME = u'projects_locations' <NEW_LINE> def __init__(self, client): <NEW_LINE> <INDENT> super(ContainerV1beta1.ProjectsLocationsService, self).__init__(client) <NEW_LINE> self._upload_configs = { } <NEW_LINE> <DEDENT> def GetServerConfig(self... | Service class for the projects_locations resource. | 6259906a3539df3088ecda96 |
class MockUSBServoBoardDevice(usb.core.Device): <NEW_LINE> <INDENT> def __init__(self, serial_number: str, fw_version: int = 2): <NEW_LINE> <INDENT> self.serial = serial_number <NEW_LINE> self.firmware_version = fw_version <NEW_LINE> self._ctx = MockUSBContext() <NEW_LINE> self.timers_initialised = False <NEW_LINE> <DE... | This class mocks the behaviour of a USB device for a Servo Board. | 6259906abaa26c4b54d50a9f |
class World: <NEW_LINE> <INDENT> def __init__(self, game: str): <NEW_LINE> <INDENT> self.tiles, self.current_tile = self.load(game) <NEW_LINE> [tile.discover_tiles(self) for tile in self.tiles] <NEW_LINE> logging.debug(f"Loaded Tiles: {self.tiles}") <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def load(game_places: pat... | Word-class, that holds information about available tiles and items. | 6259906ae5267d203ee6cfb9 |
class generator(nn.Module): <NEW_LINE> <INDENT> def __init__(self, nz, nc, ngf): <NEW_LINE> <INDENT> super(generator, self).__init__() <NEW_LINE> self.net = nn.Sequential( nn.ConvTranspose2d(nz, ngf * 8, 4, 1, 0, bias=False), nn.ReLU(True), nn.ConvTranspose2d(ngf * 8, ngf * 4, 4, 2, 1, bias=False), nn.BatchNorm2d(ngf *... | dc_gan for lsun datasets | 6259906a23849d37ff8528ac |
class TestTimeSpan(unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> cls.start = datetime(2011, 12, 13, 14, 15, 16) <NEW_LINE> cls.end = datetime(2011, 12, 14, 14, 15, 16) <NEW_LINE> <DEDENT> def test_constructor(self): <NEW_LINE> <INDENT> span = doto.model.TimeSpa... | Unittest for the TimeSpan class. | 6259906ad268445f2663a758 |
class RedirectAddress(object): <NEW_LINE> <INDENT> def __init__(self, request, address, relative=True, carry_get=False, ignore_get=None): <NEW_LINE> <INDENT> self.request = request <NEW_LINE> self.address = address <NEW_LINE> self.relative = relative <NEW_LINE> self.carry_get = carry_get <NEW_LINE> self.ignore_get = ig... | Helper to determine where to redirect to.
:param request: Object representing current Django request.
:param address: String representing the address to modify into a redirect url
:param relative: If we should be redirecting relative to the current page we're on
:param carry_get: If we should use the GET parameters fr... | 6259906a7cff6e4e811b7241 |
class Category(models.Model): <NEW_LINE> <INDENT> lang = models.CharField(max_length=2, choices=LANGUAGES) <NEW_LINE> title = models.CharField(max_length=100) <NEW_LINE> desc = models.TextField() <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return _(self.title) <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDEN... | A Category related to a single language | 6259906a66673b3332c31bf5 |
class AgentSettings(Settings): <NEW_LINE> <INDENT> def __init__(self, lambda_termination=0.05, lambda_proposal=0.05, lambda_utterance=0.001, hidden_state_size=100, vocab_size=11, utterance_len=6, dim_size=100, discount_factor=0.99, learning_rate=0.001, proposal_channel=True, linguistic_channel=False, ): <NEW_LINE> <IND... | Agent specific settings. | 6259906a009cb60464d02d31 |
class CertificateFingerprintView(generics.ListAPIView): <NEW_LINE> <INDENT> permission_classes = (rest_permissions.AllowAny,) <NEW_LINE> serializer_class = local_serializers.CertificateFingerprintSerializer <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> name = self.kwargs['host'] <NEW_LINE> res = local_models.C... | Provides the server certificate fingerprint | 6259906a44b2445a339b755b |
class StrandTest(ColorCycle): <NEW_LINE> <INDENT> def init_parameters(self): <NEW_LINE> <INDENT> super().init_parameters() <NEW_LINE> self.set_parameter('num_steps_per_cycle', self.strip.num_leds) <NEW_LINE> <DEDENT> def before_start(self): <NEW_LINE> <INDENT> self.color = 0x000000 <NEW_LINE> <DEDENT> def update(self, ... | Displays a classical LED test
No parameters necessary | 6259906a99cbb53fe68326de |
class PasswordEntry(): <NEW_LINE> <INDENT> def __init__(self, master, center=True): <NEW_LINE> <INDENT> self.master = master <NEW_LINE> self.top = tkinter.Toplevel(master=master) <NEW_LINE> self.top.transient(master) <NEW_LINE> self.top.grab_set() <NEW_LINE> self.top.title = 'Password required' <NEW_LINE> tkinter.Label... | Creates a tkinter entry box that shows stars
instead of password in clear | 6259906a38b623060ffaa44e |
class PoolScanPnpC(AbstractCallbackScanner): <NEW_LINE> <INDENT> checks = [ ('PoolTagCheck', dict(tag = "PnpC")), ('CheckPoolSize', dict(condition = lambda x: x >= 0x38)), ('CheckPoolType', dict(non_paged = True, paged = True, free = True)), ('CheckPoolIndex', dict(value = 1)), ] | PoolScanner for PnpC (EventCategoryTargetDeviceChange) | 6259906a796e427e5384ff6f |
class Publisher(object): <NEW_LINE> <INDENT> def __init__(self, registry): <NEW_LINE> <INDENT> self.registry = registry <NEW_LINE> self.directory_publishers = {} <NEW_LINE> <DEDENT> @webob.dec.wsgify <NEW_LINE> def __call__(self, request): <NEW_LINE> <INDENT> first = request.path_info_peek() <NEW_LINE> if first is None... | Fanstatic publisher WSGI application.
This WSGI application serves Fanstatic :py:class:`Library`
instances. Libraries are published as
``<library_name>/<optional_version>/path/to/resource.js``.
All static resources contained in the libraries will be published
to the web. If a step prefixed with ``:version:`` appears ... | 6259906a16aa5153ce401cd2 |
class GameModel(models.Model): <NEW_LINE> <INDENT> title = models.CharField(default='', max_length=255) <NEW_LINE> ini_file = models.FileField(upload_to='ini_files') <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.title | Model of Game Ini Files. | 6259906a7d847024c075dbd3 |
class BasecampFileConfig(BasecampConfig): <NEW_LINE> <INDENT> DEFAULT_CONFIG_FILE_LOCATIONS = [ "basecamp.conf", constants.DEFAULT_CONFIG_FILE, "/etc/basecamp.conf", ] <NEW_LINE> def __init__(self, client_id=None, client_secret=None, redirect_uri=None, access_token=None, refresh_token=None, account_id=None, filepath=No... | Stores credentials to a .conf file in INI format. | 6259906a5fc7496912d48e64 |
class HttpCache(object): <NEW_LINE> <INDENT> def __init__(self, ttl): <NEW_LINE> <INDENT> self.base_path = os.path.join(sublime.packages_path(), 'User', 'CoreBuilder.cache') <NEW_LINE> if not os.path.exists(self.base_path): <NEW_LINE> <INDENT> os.mkdir(self.base_path) <NEW_LINE> <DEDENT> self.clear(int(ttl)) <NEW_LINE>... | A data store for caching HTTP response data. | 6259906add821e528d6da57d |
class NonUniqueNameException(Error): <NEW_LINE> <INDENT> pass | Exception when the name is already registered. | 6259906ae5267d203ee6cfba |
class ResourceNotFound(ResourceError): <NEW_LINE> <INDENT> default_message = "resource '{path}' not found" | Required resource not found. | 6259906a5fcc89381b266d53 |
class NoteFileParserTest(unittest.TestCase): <NEW_LINE> <INDENT> def parse_notes_test(self): <NEW_LINE> <INDENT> notes, durations, volumes = note_file_parser('tests/notefile.txt') <NEW_LINE> self.assertEqual(notes, ['C4', 'D4', 'E4', 'F4', 'G4']) <NEW_LINE> self.assertEqual(durations, [1.0, 1.0, 1.0, 1.0, 1.0]) <NEW_LI... | Tests for note parsing from file | 6259906a5fdd1c0f98e5f77e |
class _GetLoadsTemplateProcessor(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.jinja_env = jinja2.Environment( extensions=[jinja_extensions.LoadExtension], ) <NEW_LINE> self.jinja_env.makejank_load_callback = self.load_callback <NEW_LINE> self.loads = [] <NEW_LINE> <DEDENT> def load_callback... | Janky version of template_processor.TemplateProcessor | 6259906a1b99ca4002290132 |
class CacheBase(object): <NEW_LINE> <INDENT> def __init__(self,default_timeout = 0): <NEW_LINE> <INDENT> self.default_timeout = default_timeout <NEW_LINE> <DEDENT> def add(self, key, value, timeout=None): <NEW_LINE> <INDENT> self.set(key,value,timeout) <NEW_LINE> <DEDENT> def get(self, key, default=None): <NEW_LINE> <I... | ducktype a django cache
Credits: Django:
http://code.djangoproject.com/browser/django/trunk/django/core/cache/backends/base.py | 6259906aa8370b77170f1bbf |
class TransactionAccountDelegate(QStyledItemDelegate): <NEW_LINE> <INDENT> def createEditor(self, parent, option, index): <NEW_LINE> <INDENT> self.accounts = Accounts.all() <NEW_LINE> self.accountNames = [account.name for account in self.accounts] <NEW_LINE> comboBox = QComboBox(parent) <NEW_LINE> comboBox.insertItems(... | Transaction Account View Delegate | 6259906acb5e8a47e493cd80 |
class Menu(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=32) <NEW_LINE> url_name = models.CharField(max_length=64) <NEW_LINE> menu_choice=((0,'related'), (1,'direct') ) <NEW_LINE> type=models.SmallIntegerField(choices=menu_choice) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.nam... | 菜单 | 6259906a56ac1b37e63038df |
class UserDetailAPIView(APIView): <NEW_LINE> <INDENT> permission_classes = [IsAuthenticated] <NEW_LINE> authentication_classes = [JWTAuthentication] <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> return Response("ok") | 只能登录以后在访问 | 6259906a21bff66bcd724460 |
class MonitorMgr(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._monitor_list = [] <NEW_LINE> <DEDENT> def init_monitors(self, monitor_cfgs, context): <NEW_LINE> <INDENT> LOG.debug("monitorMgr config: %s" % monitor_cfgs) <NEW_LINE> for monitor_cfg in monitor_cfgs: <NEW_LINE> <INDENT> monitor_... | docstring for MonitorMgr | 6259906a4f88993c371f111c |
class ExchangeRateFetcher: <NEW_LINE> <INDENT> def __init__(self, api_currency_code: str): <NEW_LINE> <INDENT> self.api_currency_code = api_currency_code <NEW_LINE> <DEDENT> def fetch_rate_for_date(self, date) -> float: <NEW_LINE> <INDENT> params = {endpoints.API_REQUEST_SINGLE_DATE: ApiDatesConverter(date).to_string()... | ExchangeRateFetcher must be initialized with correct CBR API currency
code to work properly. | 6259906af7d966606f7494b8 |
class RelationshipProfile(osid_managers.OsidProfile, relationship_managers.RelationshipProfile): <NEW_LINE> <INDENT> def __init__(self, interface_name): <NEW_LINE> <INDENT> osid_managers.OsidProfile.__init__(self) <NEW_LINE> <DEDENT> def _get_hierarchy_session(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return ... | Adapts underlying RelationshipProfile methodswith authorization checks. | 6259906b009cb60464d02d34 |
class Server(object): <NEW_LINE> <INDENT> def __init__(self, sock_server, quitcmd, spawncmd, destroycmd, updatecmd, players, idalloc): <NEW_LINE> <INDENT> self.sock_server = sock_server <NEW_LINE> self.quitcmd = quitcmd <NEW_LINE> self.spawncmd = spawncmd <NEW_LINE> self.destroycmd = destroycmd <NEW_LINE> self.updatecm... | Handle updating entities and socket server | 6259906a4a966d76dd5f06ec |
class ActiveSubscriptionAPIView(SubscriptionSmartListMixin, ActiveSubscriptionBaseAPIView): <NEW_LINE> <INDENT> serializer_class = ProvidedSubscriptionSerializer <NEW_LINE> filter_backends = (SubscriptionSmartListMixin.filter_backends + (DateRangeFilter,)) | Lists active subscriptions
Lists all ``Subscription`` to a plan whose provider is
``{organization}`` and which are currently in progress.
Optionnaly when an ``ends_at`` query parameter is specified,
returns a queryset of ``Subscription`` that were active
at ``ends_at``. When a ``start_at`` query parameter is specifie... | 6259906b435de62698e9d605 |
class States(Enum): <NEW_LINE> <INDENT> S_START = "0" <NEW_LINE> S_ENTER_NAME = "1" <NEW_LINE> S_ENTER_KOFE = "2" <NEW_LINE> S_SET_PAYMENT = "3" | Мы используем БД Vedis, в которой хранимые значения всегда строки,
поэтому и тут будем использовать тоже строки (str) | 6259906b16aa5153ce401cd4 |
class DescribeSecurityGroups(Choreography): <NEW_LINE> <INDENT> def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/Amazon/EC2/DescribeSecurityGroups') <NEW_LINE> <DEDENT> def new_input_set(self): <NEW_LINE> <INDENT> return DescribeSecurityGroupsInputSet() <NEW_... | Create a new instance of the DescribeSecurityGroups Choreography. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied. | 6259906b56b00c62f0fb40c9 |
class FromStreamLoaderMixin(LoaderMixin): <NEW_LINE> <INDENT> def load_from_string(self, content, container, **kwargs): <NEW_LINE> <INDENT> return self.load_from_stream(anyconfig.compat.StringIO(content), container, **kwargs) <NEW_LINE> <DEDENT> def load_from_path(self, filepath, container, **kwargs): <NEW_LINE> <INDEN... | Abstract config parser provides a method to load configuration from string
content to help implement parser of which backend lacks of such function.
Parser classes inherit this class have to override the method
:meth:`load_from_stream` at least. | 6259906b097d151d1a2c2869 |
class ReciprocalFit(ScatterFit): <NEW_LINE> <INDENT> def __init__(self, interp): <NEW_LINE> <INDENT> ScatterFit.__init__(self) <NEW_LINE> self._interp = copy.deepcopy(interp) <NEW_LINE> <DEDENT> def fit(self, x, y): <NEW_LINE> <INDENT> y = np.asarray(y) <NEW_LINE> self._interp.fit(x, 1.0 / y) <NEW_LINE> <DEDENT> def __... | Interpolate the reciprocal of data.
This allows any ScatterFit object to fit the reciprocal of a data set,
without having to invert the data and the results explicitly.
Parameters
----------
interp : object
ScatterFit object to use on the reciprocal of the data | 6259906b5fc7496912d48e65 |
class HomeView(TemplateView): <NEW_LINE> <INDENT> template_name = 'home.html' | View class for the homepage. | 6259906ba8370b77170f1bc0 |
class QAData(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.vocabulary = Vocabulary("./data/vocab_all.txt") <NEW_LINE> self.dec_timesteps=150 <NEW_LINE> self.enc_timesteps=150 <NEW_LINE> self.answers = pickle.load(open("./data/answers.pkl",'rb')) <NEW_LINE> self.training_set = pickle.load(open("./d... | Load the train/predecit/test data | 6259906bdd821e528d6da57e |
class WSSHTTPServer(SSLMixIn, ThreadingHTTPServer): <NEW_LINE> <INDENT> pass | HTTP server with multi-threading, SSL configuration, and origin tracking.
This aggregates all (pertinent) functionality from this package. | 6259906bac7a0e7691f73ce2 |
class PublicIPFilter(logging.Filter): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def filter(self, record): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ipv4 = re.findall(r'[0-9]+(?:\.[0-9]+){3}(?!\d*-[a-z0-9]{6})', record.msg) <NEW_LINE> for ip in ipv4: <NEW_LINE> <INDENT> if h... | Log filter for public IP addresses | 6259906b99cbb53fe68326e1 |
class Game(object): <NEW_LINE> <INDENT> def __init__(self, table, wheel): <NEW_LINE> <INDENT> self.table = table <NEW_LINE> self.wheel = wheel <NEW_LINE> <DEDENT> def cycle(self, player): <NEW_LINE> <INDENT> def resolve_bets(): <NEW_LINE> <INDENT> for bet in self.table.__iter__(): <NEW_LINE> <INDENT> if bet.outcome in ... | A Game of roulette, allows Players to play rounds. | 6259906b5fdd1c0f98e5f780 |
class Downloader(object): <NEW_LINE> <INDENT> def send_request(self, request): <NEW_LINE> <INDENT> if request.method.upper() == "GET": <NEW_LINE> <INDENT> response = requests.get( url = request.url, headers = request.headers, params = request.params, proxies = request.proxy ) <NEW_LINE> <DEDENT> elif request.method.upp... | 框架按设计的下载器组件,通过requests模块发送请求,构建并返回对应的Response对象 | 6259906b3d592f4c4edbc6db |
class GeoBAM: <NEW_LINE> <INDENT> GEOBAM = importr("geoBAMr") <NEW_LINE> def __init__(self, input_data): <NEW_LINE> <INDENT> self.input_data = input_data <NEW_LINE> self.geobam_data = None <NEW_LINE> self.priors = None <NEW_LINE> <DEDENT> def bam_data(self): <NEW_LINE> <INDENT> numpy2ri.activate() <NEW_LINE> nrows_node... | Class that represents a run of geoBAM to extract priors.
Serves as an API to geoBAM functions which are written in R.
Attributes
----------
input_data: dictionary
dictionary of formatted input data | 6259906b71ff763f4b5e8fa1 |
class EmailSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ('id','email') <NEW_LINE> extra_kwargs = { 'email':{ 'required':True } } <NEW_LINE> <DEDENT> from django.core.mail import send_mail <NEW_LINE> def update(self, instance, validated_dat... | 邮箱序列化器 | 6259906b1b99ca4002290133 |
class SeqRef(ExprRef): <NEW_LINE> <INDENT> def sort(self): <NEW_LINE> <INDENT> return SeqSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx) <NEW_LINE> <DEDENT> def __add__(self, other): <NEW_LINE> <INDENT> return Concat(self, other) <NEW_LINE> <DEDENT> def __radd__(self, other): <NEW_LINE> <INDENT> return Co... | Sequence expression. | 6259906bd6c5a102081e3924 |
class ChangeCoursesStudentForm(forms.ModelForm): <NEW_LINE> <INDENT> courses = forms.ModelMultipleChoiceField(queryset=Course.objects.all(), widget=forms.widgets.CheckboxSelectMultiple()) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Student <NEW_LINE> fields = ['courses'] <NEW_LINE> <DEDENT> def __init__(self, *a... | ChangeCoursesStudentForm
Base model that allows the user to change their courses | 6259906b5166f23b2e244bcd |
class BaseExtension(MapperExtension): <NEW_LINE> <INDENT> def before_insert(self, mapper, connection, instance): <NEW_LINE> <INDENT> datetime_now = datetime.datetime.now() <NEW_LINE> instance.created_at = datetime_now <NEW_LINE> if not instance.updated_at: <NEW_LINE> <INDENT> instance.updated_at = datetime_now <NEW_LIN... | Base entension class for all entity | 6259906b1f5feb6acb1643e9 |
class WrongOptions(Exception): <NEW_LINE> <INDENT> def __init__(self, option): <NEW_LINE> <INDENT> self.option = option <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "Option {} is not available".format(self.option) | Exception raised when options are not available | 6259906b7c178a314d78e7e9 |
class VMD(Loader): <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> super(VMD, self).__init__(filename) <NEW_LINE> self.atoms = self.constants['atoms'] <NEW_LINE> <DEDENT> def gofr_tcl(self, center, around, s=5000, e=-1, freq=1): <NEW_LINE> <INDENT> i = self.atoms.index(center) + 1 <NEW_LINE> j = s... | control VMD | 6259906b66673b3332c31bf9 |
class NdmpLogs(object): <NEW_LINE> <INDENT> swagger_types = { 'errors': 'list[NodeStatusCpuError]', 'nodes': 'list[NdmpLogsNode]', 'total': 'int' } <NEW_LINE> attribute_map = { 'errors': 'errors', 'nodes': 'nodes', 'total': 'total' } <NEW_LINE> def __init__(self, errors=None, nodes=None, total=None): <NEW_LINE> <INDENT... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259906bcb5e8a47e493cd81 |
class UID: <NEW_LINE> <INDENT> @property <NEW_LINE> def id(self): <NEW_LINE> <INDENT> return "%0.9u" % randint(0, 999999999) | Helper class, used to generate unique ids required by .cproject symbols. | 6259906b8a43f66fc4bf398e |
class BufferedWriter(_BufferedIOMixin): <NEW_LINE> <INDENT> def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): <NEW_LINE> <INDENT> if not raw.writable(): <NEW_LINE> <INDENT> raise OSError('"raw" argument must be writable.') <NEW_LINE> <DEDENT> _BufferedIOMixin.__init__(self, raw) <NEW_LINE> if buffer_size <= 0: ... | A buffer for a writeable sequential RawIO object.
The constructor creates a BufferedWriter for the given writeable raw
stream. If the buffer_size is not given, it defaults to
DEFAULT_BUFFER_SIZE. | 6259906ba219f33f346c8003 |
class FKApplication(models.Model): <NEW_LINE> <INDENT> state = FSMKeyField('testapp.DbState', default='new', on_delete=models.CASCADE) <NEW_LINE> @transition(field=state, source='new', target='draft') <NEW_LINE> def draft(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @transition(field=state, source=['new', 'draft... | Student application need to be approved by dept chair and dean.
Test workflow for FSMKeyField | 6259906b4f88993c371f111d |
class ImageFolderWithPaths(datasets.ImageFolder): <NEW_LINE> <INDENT> def __getitem__(self, index): <NEW_LINE> <INDENT> original_tuple = super(ImageFolderWithPaths, self).__getitem__(index) <NEW_LINE> path = self.imgs[index][0] <NEW_LINE> tuple_with_path = (original_tuple + (path,)) <NEW_LINE> return tuple_with_path | Custom dataset that includes image file paths. Extends torchvision.datasets.ImageFolder | 6259906b4e4d562566373c02 |
class HTMLResources(): <NEW_LINE> <INDENT> from gradingResource import const <NEW_LINE> const.MAIN_HTML = '/main.html' <NEW_LINE> const.USER_SIGNIN_HTML = '/user_signin.html' <NEW_LINE> const.ID_CHECK_HTML = '/id_check.html' <NEW_LINE> const.EDIT_PERSONAL_HTML = 'edit_personal.html' <NEW_LINE> const.BOARD_HTML = '/arti... | HTML Resources | 6259906b0a50d4780f7069be |
class _AlgoType(ProxyType): <NEW_LINE> <INDENT> _typeID = '_AlgorithmType' <NEW_LINE> _typeEnum = 'AlgorithmType' <NEW_LINE> _propGroup = 'SolverAlgorithm' <NEW_LINE> _proxyName = '_algo' <NEW_LINE> @classmethod <NEW_LINE> def setDefaultTypeID(mcs,obj,name=None): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> nam... | SciPy minimize algorithm meta class | 6259906b442bda511e95d956 |
@attr.s(slots=True, frozen=True) <NEW_LINE> class TimeslotEntry: <NEW_LINE> <INDENT> start = attr.ib(type=str, default=None) <NEW_LINE> stop = attr.ib(type=str, default=None) <NEW_LINE> conditions = attr.ib(type=[ConditionEntry], default=[]) <NEW_LINE> condition_type = attr.ib(type=str, default=None) <NEW_LINE> actions... | Timeslot storage Entry. | 6259906b92d797404e389759 |
class OcrmypdfPluginManager(pluggy.PluginManager): <NEW_LINE> <INDENT> def __init__( self, *args, plugins: List[Union[str, Path]], builtins: bool = True, **kwargs, ): <NEW_LINE> <INDENT> self.__init_args = args <NEW_LINE> self.__init_kwargs = kwargs <NEW_LINE> self.__plugins = plugins <NEW_LINE> self.__builtins = built... | pluggy.PluginManager that can fork.
Capable of reconstructing itself in child workers.
Arguments:
setup_func: callback that initializes the plugin manager with all
standard plugins | 6259906b7d847024c075dbd7 |
class PipelineResult: <NEW_LINE> <INDENT> def __init__(self, stdout, stderr, returncode): <NEW_LINE> <INDENT> self._stdout = stdout <NEW_LINE> self._stderr = stderr <NEW_LINE> self.returncode = returncode <NEW_LINE> <DEDENT> def __bool__(self): <NEW_LINE> <INDENT> return self.returncode == 0 <NEW_LINE> <DEDENT> def __r... | Represents the result of executing a pipeline | 6259906b01c39578d7f14333 |
class AuthError(Exception): <NEW_LINE> <INDENT> def __init__(self, error, status_code): <NEW_LINE> <INDENT> self.error = error <NEW_LINE> self.status_code = status_code | A standardized way to communicate auth failure modes. | 6259906ba8370b77170f1bc2 |
class RPCMethods(object): <NEW_LINE> <INDENT> _dotted_whitelist = ['subprocess'] <NEW_LINE> def __init__(self, server): <NEW_LINE> <INDENT> self._server = server <NEW_LINE> self.subprocess = process.Process <NEW_LINE> <DEDENT> def _dispatch(self, method, params): <NEW_LINE> <INDENT> obj = self <NEW_LINE> if '.' in meth... | Class exposing RPC methods. | 6259906bbaa26c4b54d50aa4 |
class SelectorDIC(ModelSelector): <NEW_LINE> <INDENT> def select(self): <NEW_LINE> <INDENT> warnings.filterwarnings("ignore", category=DeprecationWarning) <NEW_LINE> models = [] <NEW_LINE> for num_of_components in range(self.min_n_components, self.max_n_components + 1): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> mode... | select best model based on Discriminative Information Criterion
Biem, Alain. "A model selection criterion for classification: Application to hmm topology optimization."
Document Analysis and Recognition, 2003. Proceedings. Seventh International Conference on. IEEE, 2003.
http://citeseerx.ist.psu.edu/viewdoc/download?d... | 6259906b26068e7796d4e137 |
class ClassList(models.Model): <NEW_LINE> <INDENT> name = models.CharField("班级名称", max_length=32) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | 班级 | 6259906b5fdd1c0f98e5f782 |
class ParserTestCase(integration_tests.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self.useFixture(fixtures.EnvironmentVariable('TMPDIR', self.path)) <NEW_LINE> <DEDENT> def call_parser(self, wiki_path, expect_valid, expect_output=True): <NEW_LINE> <INDENT> part_file =... | Test bin/snapcraft-parser | 6259906b3539df3088ecda9c |
class ComponentTests(ossie.utils.testing.ScaComponentTestCase): <NEW_LINE> <INDENT> def testScaBasicBehavior(self): <NEW_LINE> <INDENT> execparams = self.getPropertySet(kinds=("execparam",), modes=("readwrite", "writeonly"), includeNil=False) <NEW_LINE> execparams = dict([(x.id, any.from_any(x.value)) for x in execpara... | Test for all component implementations in lms_dd_equalizer_cc | 6259906bd268445f2663a75b |
class BoardUnitListe(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._list = [] <NEW_LINE> <DEDENT> def add(self,BU): <NEW_LINE> <INDENT> if BU._name.strip() not in self._list: <NEW_LINE> <INDENT> self._list.append(BU) <NEW_LINE> <DEDENT> <DEDENT> def byName(self, name): <NEW_LINE> <INDENT> fo... | Contains all Boardunits/ECUs of a canmatrix in a list | 6259906b23849d37ff8528b2 |
class KamajiError(Exception): <NEW_LINE> <INDENT> default_message = 'Kamaji Error' <NEW_LINE> def __init__(self, message=None, *args, **kwargs): <NEW_LINE> <INDENT> if not message: <NEW_LINE> <INDENT> message = self.default_message <NEW_LINE> <DEDENT> super(KamajiError, self).__init__(message, *args, **kwargs) | The base exception for all Kamaji Errors. | 6259906b99cbb53fe68326e4 |
class Wannabe(object): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.__args = args <NEW_LINE> self.__kwargs = kwargs <NEW_LINE> self.__calls = list() <NEW_LINE> <DEDENT> def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.__args = args <NEW_LINE> self.__kwargs = kwargs <NEW... | An object that will become another. | 6259906b97e22403b383c70a |
class MemoryLog(Log): <NEW_LINE> <INDENT> def __init__(self, part_processor: Msg.PartProcessor = None) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._part_processor = part_processor <NEW_LINE> self._content = "" <NEW_LINE> <DEDENT> def __getstate__(self) -> dict: <NEW_LINE> <INDENT> state = super().__... | Log implementation that stores a log in memory. | 6259906b44b2445a339b755e |
class AppRouteURLKeyError(KeyError): <NEW_LINE> <INDENT> pass | An app route was constructed without required keyword match arguments. | 6259906b2c8b7c6e89bd4fe3 |
class SyncListList(ListResource): <NEW_LINE> <INDENT> def __init__(self, version, service_sid): <NEW_LINE> <INDENT> super(SyncListList, self).__init__(version) <NEW_LINE> self._solution = {'service_sid': service_sid, } <NEW_LINE> self._uri = '/Services/{service_sid}/Lists'.format(**self._solution) <NEW_LINE> <DEDENT> d... | PLEASE NOTE that this class contains beta products that are subject to
change. Use them with caution. | 6259906b8a43f66fc4bf3990 |
class NumDB(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.prefixes = [] <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def _merge(results): <NEW_LINE> <INDENT> ml = max(len(x) for x in results) <NEW_LINE> results = [x + (ml - len(x)) * [None] for x in results] <NEW_LINE> for parts in zip(*resu... | Number database. | 6259906b56ac1b37e63038e1 |
class FoundationSampleForm(forms.Form): <NEW_LINE> <INDENT> title = forms.CharField(label=ugettext("title"), max_length=255, required=True) <NEW_LINE> content = forms.CharField(label=ugettext("content"), max_length=255, required=True, widget=forms.Textarea) <NEW_LINE> first_name = forms.CharField(label=ugettext("first_... | Sample form | 6259906b76e4537e8c3f0d80 |
class ColourItem: <NEW_LINE> <INDENT> def __init__(self, internal_colour): <NEW_LINE> <INDENT> self.internal_colour = internal_colour <NEW_LINE> self._colours = jef_colours.colour_mappings[internal_colour] <NEW_LINE> <DEDENT> def data(self, thread_type): <NEW_LINE> <INDENT> code = self._colours[thread_type] <NEW_LINE> ... | ColourItem
Represents an internal Janome colour and its interpretations in different
thread types. | 6259906b8e7ae83300eea88c |
class ST_parser(FixedWidthParser): <NEW_LINE> <INDENT> page_sequence = FixedWidthField(0, 3) <NEW_LINE> record_type = FixedWidthField(3, 2) <NEW_LINE> election_id = FixedWidthField(5, 4) <NEW_LINE> statistical_text = FixedWidthField(15, 26) <NEW_LINE> statistical_text_cont = FixedWidthField(44, 26) | LAC doesn't appear to be using this in 2016 election. | 6259906b4e4d562566373c04 |
class StepUpdateView(LoginRequiredMixin, UpdateView): <NEW_LINE> <INDENT> model = Step <NEW_LINE> form_class = UpdateStepForm <NEW_LINE> template_name = 'directions_edit.html' <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(**kwargs) <NEW_LINE> context['recipe_pk'... | Page where user can update an ingredient. | 6259906b8e7ae83300eea88d |
class TemplateInstanceNode(BXmlNode): <NEW_LINE> <INDENT> def __init__(self, buf, offset, chunk, parent): <NEW_LINE> <INDENT> super(TemplateInstanceNode, self).__init__(buf, offset, chunk, parent) <NEW_LINE> self.declare_field("byte", "token", 0x0) <NEW_LINE> self.declare_field("byte", "unknown0") <NEW_LINE> self.decla... | The binary XML node for the system token 0x0C. | 6259906b009cb60464d02d37 |
class GeojsonAPIView(APIView): <NEW_LINE> <INDENT> def get(self, request, *args, **keywords): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> encjson = serialize('geojson', Border.objects.filter(n03_004="中原区"),srid=4326, geometry_field='geom', fields=('n03_004',) ) <NEW_LINE> result = json.loads(encjson) <NEW_LINE> res... | GeoJsonデータ取得
@return geojson形式 | 6259906b32920d7e50bc7844 |
class ProcessThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, type, status, module, command, cwd, callback, shell, env): <NEW_LINE> <INDENT> self.process = None <NEW_LINE> self._code = 2000 <NEW_LINE> self._output = "" <NEW_LINE> self.lock = threading.RLock() <NEW_LINE> self.type = type <NEW_LINE> self.... | Base class for running tasks | 6259906b4428ac0f6e659d30 |
class Cat: <NEW_LINE> <INDENT> def __init__( self, na, brd, vacc, tat, ag ): <NEW_LINE> <INDENT> self.name = na <NEW_LINE> self.breed = brd <NEW_LINE> self.vaccinated = vacc <NEW_LINE> self.age = ag <NEW_LINE> self.tattooed = tat <NEW_LINE> <DEDENT> def isVaccinated( self ): <NEW_LINE> <INDENT> retu... | a class that implements a cat and its
information. Name, breed, vaccinated,
tattooed, and age. | 6259906b67a9b606de5476a1 |
class TestRelatedCategoricalDataTable(DistributionTestCaseMixins, TestCase): <NEW_LINE> <INDENT> def test_render_single_related_categorical(self): <NEW_LINE> <INDENT> language_ids = self.create_test_languages() <NEW_LINE> language_distribution = self.get_distribution(language_ids) <NEW_LINE> language_name_distribution ... | Tests for categorical dimensions only, on a related table. | 6259906b2ae34c7f260ac8e7 |
class Trip(models.Model): <NEW_LINE> <INDENT> REQUESTED = 'REQUESTED' <NEW_LINE> STARTED = 'STARTED' <NEW_LINE> IN_PROGRESS = 'IN_PROGRESS' <NEW_LINE> COMPLETED = 'COMPLETED' <NEW_LINE> STATUSES = ( (REQUESTED, REQUESTED), (STARTED, STARTED), (IN_PROGRESS, IN_PROGRESS), (COMPLETED, COMPLETED), ) <NEW_LINE> id = models.... | Trip model | 6259906b7d847024c075dbd9 |
class Conv4d(_ConvNd): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, kernel_size, groups=1,bias=True, pre_permuted_filters=True): <NEW_LINE> <INDENT> stride=1 <NEW_LINE> dilation=1 <NEW_LINE> padding = 0 <NEW_LINE> kernel_size = _quadruple(kernel_size) <NEW_LINE> stride = _quadruple(stride) <NEW_LIN... | Applies a 4D convolution over an input signal composed of several input
planes. | 6259906b7047854f46340bb4 |
class ServiceChainInstance(gquota.GBPQuotaBase, model_base.BASEV2, models_v2.HasId, models_v2.HasTenant): <NEW_LINE> <INDENT> __tablename__ = 'sc_instances' <NEW_LINE> name = sa.Column(sa.String(50)) <NEW_LINE> description = sa.Column(sa.String(255)) <NEW_LINE> config_param_values = sa.Column(sa.String(4096)) <NEW_LINE... | Service chain instances | 6259906bb7558d5895464b30 |
class ProductMigrationSourceViewSet(viewsets.ReadOnlyModelViewSet): <NEW_LINE> <INDENT> queryset = ProductMigrationSource.objects.all().order_by("name") <NEW_LINE> serializer_class = ProductMigrationSourceSerializer <NEW_LINE> lookup_field = 'id' <NEW_LINE> filter_backends = ( filters.DjangoFilterBackend, filters.Searc... | API endpoint for the ProductMigrationSource objects | 6259906b379a373c97d9a81e |
class Block(Base): <NEW_LINE> <INDENT> __tablename__ = 'block' <NEW_LINE> id = Column(String(32), primary_key=True) <NEW_LINE> secondary_id = Column(String(32)) <NEW_LINE> contig = Column(String(5)) <NEW_LINE> start = Column(Integer) <NEW_LINE> end = Column(Integer) <NEW_LINE> strand = Column(String(1)) <NEW_LINE> supe... | Set of non-overlapping intervals.
A :class:`Block` can *only* be related to a single superset.
Args:
block_id (str): unique block id (e.g. CCDS transcript id)
contig (str): contig/chromosome id
start (int): 1-based start of the block (first interval)
end (int): 1-based end of the block (last interval, no UTR)... | 6259906b7047854f46340bb5 |
class LocalStorage(Storage): <NEW_LINE> <INDENT> def __init__(self, tarball_dir: str = '/src/contrib'): <NEW_LINE> <INDENT> self.tarball_dir = tarball_dir <NEW_LINE> super(LocalStorage, self).__init__() <NEW_LINE> <DEDENT> def store_tarball(self, category: str, doc_name: str, tmp_tarball_fp: str): <NEW_LINE> <INDENT> l... | Storage class extension to store document tarballs locally.
Args:
tarball_dir (str): Directory in which to store incoming tarballs. | 6259906b32920d7e50bc7845 |
class Department(models.Model): <NEW_LINE> <INDENT> id = models.AutoField(primary_key=True) <NEW_LINE> name = models.CharField(verbose_name='部门名称', max_length=32) | 部门表 | 6259906badb09d7d5dc0bd69 |
class RemoveSchemaChange(UpgradeChange): <NEW_LINE> <INDENT> def __init__(self, schema_object: SchemaObject): <NEW_LINE> <INDENT> UpgradeChange.__init__(self, schema_object.order, [], []) | Simple removal of an existing object. | 6259906b23849d37ff8528b5 |
class SudokuSquare: <NEW_LINE> <INDENT> def __init__(self, number=None, offsetX = 0, offsetY = 0, edit="Y", xLoc = 0, yLoc = 0): <NEW_LINE> <INDENT> if number is not None: <NEW_LINE> <INDENT> number = str(number) <NEW_LINE> self.color = (2, 204, 186) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> number = "" <NEW_LINE> ... | A sudoku square class. | 6259906bf548e778e596cd8b |
class Squid(HTTPProcess): <NEW_LINE> <INDENT> protocol = 'HTTP' <NEW_LINE> subprotocol = 'HEADER' <NEW_LINE> re_expr = re.compile("^squid/?(?P<version>[\w\.]+)?\s?(\((?P<os>\w*)\))?", re.IGNORECASE) <NEW_LINE> def process(self, data, metadata): <NEW_LINE> <INDENT> server = self.get_header_field(data, 'server') <NEW_LIN... | http://www.squid-cache.org/ | 6259906b7c178a314d78e7eb |
class SpotifyEpisode(SpotifyBase): <NEW_LINE> <INDENT> @scopes() <NEW_LINE> @send_and_process(single(FullEpisode)) <NEW_LINE> def episode( self, episode_id: str, market: str = None ) -> FullEpisode: <NEW_LINE> <INDENT> return self._get('episodes/' + episode_id, market=market) <NEW_LINE> <DEDENT> @scopes() <NEW_LINE> @c... | Episode API endpoints. | 6259906b38b623060ffaa452 |
class RandomDisplacementBounds(object): <NEW_LINE> <INDENT> def __init__(self, xmin, xmax, stepsize=0.05): <NEW_LINE> <INDENT> self.xmin = xmin <NEW_LINE> self.xmax = xmax <NEW_LINE> self.stepsize = stepsize <NEW_LINE> <DEDENT> def __call__(self, x): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> xnew = x + np.ran... | random displacement with bounds | 6259906b796e427e5384ff77 |
class Item(object): <NEW_LINE> <INDENT> __slots__ = ("id", "value", "type") <NEW_LINE> def __init__(self, id: str, value: Any) -> None: <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.value = value <NEW_LINE> self.type = type(value) | A class representing the defined item in a stored dataset.
:ivar str id: The ID of the item.
:ivar Any value: The item itself.
:ivar Type type: The ID type representation. | 6259906b8e7ae83300eea88e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.