text:
import copy

from ..common import ApiTestBase, ClientCompatPatch

class CompatPatchTests(ApiTestBase):
    """Tests for the ClientCompatPatch class."""

    @staticmethod
    def init_all(api):
        test_media_id = '1962809196194057623_25025320'
        return [
            {
                'name': 'test_compat_media',
                'test': CompatPatchTests('test_compat_media', api, media_id=test_media_id)
            },
            {
                'name': 'test_compat_comment',
                'test': CompatPatchTests('test_compat_comment', api, media_id=test_media_id)
            },
            {
                'name': 'test_compat_user',
                'test': CompatPatchTests('test_compat_user', api, user_id='124317')
            },
            {
                'name': 'test_compat_user_list',
                'test': CompatPatchTests('test_compat_user_list', api, user_id='124317')
            },
        ]

    def test_compat_media(self):
        self.api.auto_patch = False
        results = self.api.media_info(self.test_media_id)
        self.api.auto_patch = True
        media = results.get('items', [])[0]
        media_patched = copy.deepcopy(media)
        ClientCompatPatch.media(media_patched)

        self.assertIsNone(media.get('link'))
        self.assertIsNotNone(media_patched.get('link'))
        self.assertIsNone(media.get('created_time'))
        self.assertIsNotNone(media_patched.get('created_time'))
        self.assertIsNone(media.get('images'))
        self.assertIsNotNone(media_patched.get('images'))
        self.assertIsNone(media.get('type'))
        self.assertIsNotNone(media_patched.get('type'))
        self.assertIsNone(media.get('filter'))
        self.assertIsNotNone(media_patched.get('filter'))
        self.assertIsNone(media.get('user', {}).get('id'))
        self.assertIsNotNone(media_patched.get('user', {}).get('id'))
        self.assertIsNone(media.get('user', {}).get('profile_picture'))
        self.assertIsNotNone(media_patched.get('user', {}).get('profile_picture'))
        if media['caption']:
            self.assertIsNone(media.get('caption', {}).get('id'))
            self.assertIsNotNone(media_patched['caption']['id'])
            self.assertIsNone(media.get('caption', {}).get('from'))
            self.assertIsNotNone(media_patched['caption']['from'])
        media_dropped = copy.deepcopy(media)
        ClientCompatPatch.media(media_dropped, drop_incompat_keys=True)
        self.assertIsNone(media_dropped.get('pk'))

    def test_compat_comment(self):
        self.api.auto_patch = False
        results = self.api.media_comments(self.test_media_id)
        self.api.auto_patch = True
        self.assertGreater(len(results.get('comments', [])), 0, 'No items returned.')
        comment = results.get('comments', [{}])[0]
        comment_patched = copy.deepcopy(comment)
        ClientCompatPatch.comment(comment_patched)
        self.assertIsNone(comment.get('id'))
        self.assertIsNotNone(comment_patched.get('id'))
        self.assertIsNone(comment.get('created_time'))
        self.assertIsNotNone(comment_patched.get('created_time'))
        self.assertIsNone(comment.get('from'))
        self.assertIsNotNone(comment_patched.get('from'))

        comment_dropped = copy.deepcopy(comment)
        ClientCompatPatch.comment(comment_dropped, drop_incompat_keys=True)
        self.assertIsNone(comment_dropped.get('pk'))

    def test_compat_user(self):
        self.api.auto_patch = False
        results = self.api.user_info(self.test_user_id)
        self.api.auto_patch = True
        user = results.get('user', {})
        user_patched = copy.deepcopy(user)
        ClientCompatPatch.user(user_patched)
        self.assertIsNone(user.get('id'))
        self.assertIsNotNone(user_patched.get('id'))
        self.assertIsNone(user.get('bio'))
        self.assertIsNotNone(user_patched.get('bio'))
        self.assertIsNone(user.get('profile_picture'))
        self.assertIsNotNone(user_patched.get('profile_picture'))
        self.assertIsNone(user.get('website'))
        self.assertIsNotNone(user_patched.get('website'))

        user_dropped = copy.deepcopy(user)
        ClientCompatPatch.user(user_dropped, drop_incompat_keys=True)
        self.assertIsNone(user_dropped.get('pk'))

    def test_compat_user_list(self):
        self.api.auto_patch = False
        rank_token = self.api.generate_uuid()
        results = self.api.user_following(self.test_user_id, rank_token)
        self.api.auto_patch = True
        user = results.get('users', [{}])[0]
        user_patched = copy.deepcopy(user)
        ClientCompatPatch.list_user(user_patched)
        self.assertIsNone(user.get('id'))
        self.assertIsNotNone(user_patched.get('id'))
        self.assertIsNone(user.get('profile_picture'))
        self.assertIsNotNone(user_patched.get('profile_picture'))

        user_dropped = copy.deepcopy(user)
        ClientCompatPatch.list_user(user_dropped, drop_incompat_keys=True)
        self.assertIsNone(user_dropped.get('pk'))


text:
    <tractor-file-tree model="componentEditor" type="components"></tractor-file-tree>
    <tractor-panel-handle panel-name="component-file-tree"></tractor-panel-handle>
    <form class="file" name="componentEditor.fileEditor" novalidate
        ng-submit="componentEditor.showErrors() && componentEditor.saveFile()">

{{ componentEditor.fileModel.name }}

                <tractor-variable-input class="file-options__name-input"
                    ng-if="!componentEditor.fileModel.isSaved"
                    form="file-editor"
                    label="Name"
                    model="componentEditor.fileModel"
                    example="Component"
                    is-class>
                </tractor-variable-input>

                <tractor-confirm-dialog trigger="componentEditor.confirmOverWrite">

This will overwrite "{{ componentEditor.fileModel.name }}". Continue?

                </tractor-confirm-dialog>
                <tractor-submit class="file-options__save-file"
                    action="Save component file">
                </tractor-submit>
                <tractor-action class="file-options__new-file"
                    model="componentEditor"
                    action="New file">
                </tractor-action>

Elements:

{{ domElement.name }}

                                <tractor-action
                                    model="componentEditor.fileModel"
                                    action="Remove element"
                                    argument="domElement"
                                    icon="remove">
                                </tractor-action>

                                <tractor-action
                                    model="componentEditor"
                                    action="minimise"
                                    argument="domElement"
                                    icon="collapse">
                                </tractor-action>

                                <tractor-variable-input
                                    form="file-editor"
                                    label="Name"
                                    model="domElement"
                                    example="element">
                                </tractor-variable-input>
                                <tractor-select
                                    label="Type"
                                    model="domElement.selector">
                                </tractor-select>
                                <tractor-text-input
                                    form="file-editor"
                                    label="Locator"
                                    model="domElement.selector"
                                    example="someController.someModel">
                                </tractor-text-input>

Filters:

 1" as-sortable ng-model="domElement.sortableFilters" is-disabled="domElement.filters.length < 3">

                                            <tractor-action
                                                    model="domElement"
                                                    action="Remove filter"
                                                    argument="filter"
                                                    icon="remove">
                                            </tractor-action>

 2"
                                                 as-sortable-item-handle>

                                            <tractor-select ng-if="!domElement.filters[$index].isGroup"
                                                            label="Type"
                                                            model="filter">
                                            </tractor-select>
                                            <tractor-text-input
                                                    form="file-editor"
                                                    label="Locator"
                                                    model="filter"
                                                    example="someController.someModel">
                                            </tractor-text-input>

                                    <tractor-action
                                        model="domElement"
                                        action="Add filter">
                                    </tractor-action>

                    <tractor-action
                        model="componentEditor.fileModel"
                        action="Add element">
                    </tractor-action>

Actions:

{{ action.name }}

                                <tractor-action
                                    model="componentEditor.fileModel"
                                    action="Remove action"
                                    argument="action"
                                    icon="remove">
                                </tractor-action>

                                <tractor-action
                                    model="componentEditor"
                                    action="minimise"
                                    argument="action"
                                    icon="collapse">
                                </tractor-action>

                                <tractor-variable-input
                                    form="file-editor"
                                    label="Name"
                                    model="action"
                                    example="action">
                                </tractor-variable-input>

Parameters:

                                    <ol ng-if="action.parameters.length" as-sortable ng-model="action.parameters" is-disabled="action.parameters.length < 2">

                                            <tractor-action
                                                model="action"
                                                action="Remove parameter"
                                                argument="parameter"
                                                icon="remove">
                                            </tractor-action>

 1" class="file-editor__list-item-sort-handle" as-sortable-item-handle title="Drag to sort">

                                            <tractor-variable-input
                                                form="file-editor"
                                                label="Name"
                                                model="parameter"
                                                example="parameter">
                                            </tractor-variable-input>

                                    <tractor-action
                                        model="action"
                                        action="Add parameter">
                                    </tractor-action>

Interactions:

                                    <ol ng-if="action.interactions.length" as-sortable ng-model="action.interactions" is-disabled="action.interactions.length < 2">

                                            <tractor-action
                                                model="action"
                                                action="Remove interaction"
                                                argument="interaction"
                                                icon="remove">
                                            </tractor-action>

 1" class="file-editor__list-item-sort-handle" as-sortable-item-handle title="Drag to sort">

                                            <tractor-select
                                                label="Element"
                                                model="interaction"
                                                options="componentEditor.fileModel.elements"
                                                as="name">
                                            </tractor-select>
                                            <tractor-select
                                                label="Method"
                                                model="interaction"
                                                options="interaction.element.methods"
                                                as="name">
                                            </tractor-select>

                                                <tractor-literal-input
                                                    form="file-editor"
                                                    name="argument.name"
                                                    model="argument"
                                                    description="argument.description"
                                                    required="argument.required"
                                                    type="argument.type">
                                                </tractor-literal-input>

                                    <tractor-action
                                        model="action"
                                        action="Add interaction">
                                    </tractor-action>

                    <tractor-action
                        model="componentEditor.fileModel"
                        action="Add action">
                    </tractor-action>

    </form>

redpajama_set_name: RedPajamaGithub


text:
package com.github.mkolisnyk.cucumber.runner;

import org.junit.Ignore;
import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;

@RunWith(ExtendedParallelCucumber.class)
@ExtendedCucumberOptions(
    reportPrefix = "cucumber-parallel",
    jsonReport = "target/cucumber.json",
    retryCount = 3,
    threadsCount = 3,
    featureOverviewChart = true,
    detailedReport = true,
    detailedAggregatedReport = true,
    overviewReport = true,
    // coverageReport = true,
    jsonUsageReport = "target/cucumber-usage.json",
    usageReport = true,
    toPDF = true,
    breakdownReport = true,
    breakdownConfig = "src/test/resources/breakdown-source/simple.json",
    knownErrorsReport = true,
    knownErrorsConfig = "src/test/resources/known-errors-source/sample_model.json",
    consolidatedReport = true,
    consolidatedReportConfig = "src/test/resources/consolidated-source/sample_batch.json",
    excludeCoverageTags = { "@flaky" },
    includeCoverageTags = { "@passed" },
    outputFolder = "target/parallel")
@CucumberOptions(
        plugin = {
            "html:target/cucumber-html-report",
            "json:target/cucumber.json",
            "pretty:target/cucumber-pretty.txt",
            "usage:target/cucumber-usage.json",
            "junit:target/cucumber-results.xml"
        },
        features = { "./src/test/java/com/github/mkolisnyk/cucumber/features" },
        glue = { "com/github/mkolisnyk/cucumber/steps" },
        tags = { "@consistent" })
public class SampleParallelTest {

}


text:
use std::fs::File;
use std::io;
use std::os::windows::io::{
    AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle,
};
use std::path::Path;
use std::process;

/// A handle represents an owned and valid Windows handle to a file-like
/// object.
///
/// When an owned handle is dropped, then the underlying raw handle is closed.
/// To get a borrowed handle, use `HandleRef`.
#[derive(Debug)]
pub struct Handle(File);

impl AsRawHandle for Handle {
    fn as_raw_handle(&self) -> RawHandle {
        self.0.as_raw_handle()
    }
}

impl FromRawHandle for Handle {
    unsafe fn from_raw_handle(handle: RawHandle) -> Handle {
        Handle(File::from_raw_handle(handle))
    }
}

impl IntoRawHandle for Handle {
    fn into_raw_handle(self) -> RawHandle {
        self.0.into_raw_handle()
    }
}

impl Handle {
    /// Create an owned handle to the given file.
    ///
    /// When the returned handle is dropped, the file is closed.
    ///
    /// Note that if the given file represents a handle to a directory, then
    /// it is generally required that it have been opened with the
    /// [`FILE_FLAG_BACKUP_SEMANTICS`] flag in order to use it in various
    /// calls such as `information` or `typ`. To have this done automatically
    /// for you, use the `from_path_any` constructor.
    ///
    /// [`FILE_FLAG_BACKUP_SEMANTICS`]: https://docs.microsoft.com/en-us/windows/desktop/api/FileAPI/nf-fileapi-createfilea
    pub fn from_file(file: File) -> Handle {
        Handle(file)
    }

    /// Open a file to the given file path, and return an owned handle to that
    /// file.
    ///
    /// When the returned handle is dropped, the file is closed.
    ///
    /// If there was a problem opening the file, then the corresponding error
    /// is returned.
    pub fn from_path<P: AsRef<Path>>(path: P) -> io::Result<Handle> {
        Ok(Handle::from_file(File::open(path)?))
    }

    /// Like `from_path`, but supports opening directory handles as well.
    ///
    /// If you use `from_path` on a directory, then subsequent queries using
    /// that handle will fail.
    pub fn from_path_any<P: AsRef<Path>>(path: P) -> io::Result<Handle> {
        use std::fs::OpenOptions;
        use std::os::windows::fs::OpenOptionsExt;
        use winapi::um::winbase::FILE_FLAG_BACKUP_SEMANTICS;

        let file = OpenOptions::new()
            .read(true)
            .custom_flags(FILE_FLAG_BACKUP_SEMANTICS)
            .open(path)?;
        Ok(Handle::from_file(file))
    }

    /// Return this handle as a standard `File` reference.
    pub fn as_file(&self) -> &File {
        &self.0
    }

    /// Return this handle as a standard `File` mutable reference.
    pub fn as_file_mut(&mut self) -> &mut File {
        &mut self.0
    }
}

/// Represents a borrowed and valid Windows handle to a file-like object, such
/// as stdin/stdout/stderr or an actual file.
///
/// When a borrowed handle is dropped, then the underlying raw handle is
/// **not** closed. To get an owned handle, use `Handle`.
#[derive(Debug)]
pub struct HandleRef(HandleRefInner);

/// The representation of a HandleRef, on which we define a custom Drop impl
/// that avoids closing the underlying raw handle.
#[derive(Debug)]
struct HandleRefInner(Option<File>);

impl Drop for HandleRefInner {
    fn drop(&mut self) {
        self.0.take().unwrap().into_raw_handle();
    }
}

impl AsRawHandle for HandleRef {
    fn as_raw_handle(&self) -> RawHandle {
        self.as_file().as_raw_handle()
    }
}

impl Clone for HandleRef {
    fn clone(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}

impl HandleRef {
    /// Create a borrowed handle to stdin.
    ///
    /// When the returned handle is dropped, stdin is not closed.
    pub fn stdin() -> HandleRef {
        unsafe { HandleRef::from_raw_handle(io::stdin().as_raw_handle()) }
    }

    /// Create a handle to stdout.
    ///
    /// When the returned handle is dropped, stdout is not closed.
    pub fn stdout() -> HandleRef {
        unsafe { HandleRef::from_raw_handle(io::stdout().as_raw_handle()) }
    }

    /// Create a handle to stderr.
    ///
    /// When the returned handle is dropped, stderr is not closed.
    pub fn stderr() -> HandleRef {
        unsafe { HandleRef::from_raw_handle(io::stderr().as_raw_handle()) }
    }

    /// Create a borrowed handle to the given file.
    ///
    /// When the returned handle is dropped, the file is not closed.
    pub fn from_file(file: &File) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(file.as_raw_handle()) }
    }

    /// Create a borrowed handle from the given raw handle.
    ///
    /// Note that unlike the `FromRawHandle` trait, this constructor does
    /// **not** consume ownership of the given handle. That is, when the
    /// borrowed handle created by this constructor is dropped, the underlying
    /// handle will not be closed.
    ///
    /// # Safety
    ///
    /// This is unsafe because there is no guarantee that the given raw handle
    /// is a valid handle. The caller must ensure this is true before invoking
    /// this constructor.
    pub unsafe fn from_raw_handle(handle: RawHandle) -> HandleRef {
        HandleRef(HandleRefInner(Some(File::from_raw_handle(handle))))
    }

    /// Return this handle as a standard `File` reference.
    pub fn as_file(&self) -> &File {
        (self.0).0.as_ref().unwrap()
    }

    /// Return this handle as a standard `File` mutable reference.
    pub fn as_file_mut(&mut self) -> &mut File {
        (self.0).0.as_mut().unwrap()
    }
}

/// Construct borrowed and valid Windows handles from file-like objects.
pub trait AsHandleRef {
    /// A borrowed handle that wraps the raw handle of the `Self` object.
    fn as_handle_ref(&self) -> HandleRef;

    /// A convenience routine for extracting a `HandleRef` from `Self`, and
    /// then extracting a raw handle from the `HandleRef`.
    fn as_raw(&self) -> RawHandle {
        self.as_handle_ref().as_raw_handle()
    }
}

impl<'a, T: AsHandleRef> AsHandleRef for &'a T {
    fn as_handle_ref(&self) -> HandleRef {
        (**self).as_handle_ref()
    }
}

impl AsHandleRef for Handle {
    fn as_handle_ref(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}

impl AsHandleRef for HandleRef {
    fn as_handle_ref(&self) -> HandleRef {
        self.clone()
    }
}

impl AsHandleRef for File {
    fn as_handle_ref(&self) -> HandleRef {
        HandleRef::from_file(self)
    }
}

impl AsHandleRef for io::Stdin {
    fn as_handle_ref(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}

impl AsHandleRef for io::Stdout {
    fn as_handle_ref(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}

impl AsHandleRef for io::Stderr {
    fn as_handle_ref(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}

impl AsHandleRef for process::ChildStdin {
    fn as_handle_ref(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}

impl AsHandleRef for process::ChildStdout {
    fn as_handle_ref(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}

impl AsHandleRef for process::ChildStderr {
    fn as_handle_ref(&self) -> HandleRef {
        unsafe { HandleRef::from_raw_handle(self.as_raw_handle()) }
    }
}


text:
#include <linux/i2c.h>
#include <sound/core.h>
#include <sound/ac97_codec.h>
#include <media/videobuf2-core.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>

#define STK1160_VERSION		"0.9.5"
#define STK1160_VERSION_NUM	0x000905

/* Decide on number of packets for each buffer */
#define STK1160_NUM_PACKETS 64

/* Number of buffers for isoc transfers */
#define STK1160_NUM_BUFS 16
#define STK1160_MIN_BUFS 1

/* TODO: This endpoint address should be retrieved */
#define STK1160_EP_VIDEO 0x82
#define STK1160_EP_AUDIO 0x81

/* Max and min video buffers */
#define STK1160_MIN_VIDEO_BUFFERS 8
#define STK1160_MAX_VIDEO_BUFFERS 32

#define STK1160_MIN_PKT_SIZE 3072

#define STK1160_MAX_INPUT 4
#define STK1160_SVIDEO_INPUT 4

#define STK1160_I2C_TIMEOUT 100

/* TODO: Print helpers
 * I could use dev_xxx, pr_xxx, v4l2_xxx or printk.
 * However, there isn't a solid consensus on which
 * new drivers should use.
 *
 */
#define DEBUG
#ifdef DEBUG
#define stk1160_dbg(fmt, args...) \
	printk(KERN_DEBUG "stk1160: " fmt,  ## args)
#else
#define stk1160_dbg(fmt, args...)
#endif

#define stk1160_info(fmt, args...) \
	pr_info("stk1160: " fmt, ## args)

#define stk1160_warn(fmt, args...) \
	pr_warn("stk1160: " fmt, ## args)

#define stk1160_err(fmt, args...) \
	pr_err("stk1160: " fmt, ## args)

/* Buffer for one video frame */
struct stk1160_buffer {
	/* common v4l buffer stuff -- must be first */
	struct vb2_buffer vb;
	struct list_head list;

	void *mem;
	unsigned int length;		/* buffer length */
	unsigned int bytesused;		/* bytes written */
	int odd;			/* current oddity */

	/*
	 * Since we interlace two fields per frame,
	 * this is different from bytesused.
	 */
	unsigned int pos;		/* current pos inside buffer */
};

struct stk1160_isoc_ctl {
	/* max packet size of isoc transaction */
	int max_pkt_size;

	/* number of allocated urbs */
	int num_bufs;

	/* urb for isoc transfers */
	struct urb **urb;

	/* transfer buffers for isoc transfer */
	char **transfer_buffer;

	/* current buffer */
	struct stk1160_buffer *buf;
};

struct stk1160_fmt {
	char  *name;
	u32   fourcc;          /* v4l2 format id */
	int   depth;
};

struct stk1160 {
	struct v4l2_device v4l2_dev;
	struct video_device vdev;
	struct v4l2_ctrl_handler ctrl_handler;

	struct device *dev;
	struct usb_device *udev;

	/* saa7115 subdev */
	struct v4l2_subdev *sd_saa7115;

	/* isoc control struct */
	struct list_head avail_bufs;

	/* video capture */
	struct vb2_queue vb_vidq;

	/* max packet size of isoc transaction */
	int max_pkt_size;
	/* array of wMaxPacketSize */
	unsigned int *alt_max_pkt_size;
	/* alternate */
	int alt;
	/* Number of alternative settings */
	int num_alt;

	struct stk1160_isoc_ctl isoc_ctl;
	char urb_buf[255];	 /* urb control msg buffer */

	/* frame properties */
	int width;		  /* current frame width */
	int height;		  /* current frame height */
	unsigned int ctl_input;	  /* selected input */
	v4l2_std_id norm;	  /* current norm */
	struct stk1160_fmt *fmt;  /* selected format */

	unsigned int field_count; /* not sure ??? */
	enum v4l2_field field;    /* also not sure :/ */

	/* i2c i/o */
	struct i2c_adapter i2c_adap;
	struct i2c_client i2c_client;

	struct mutex v4l_lock;
	struct mutex vb_queue_lock;
	spinlock_t buf_lock;

	struct file *fh_owner;	/* filehandle ownership */

	/* EXPERIMENTAL */
	struct snd_card *snd_card;
};

struct regval {
	u16 reg;
	u16 val;
};

/* Provided by stk1160-v4l.c */
int stk1160_vb2_setup(struct stk1160 *dev);
int stk1160_video_register(struct stk1160 *dev);
void stk1160_video_unregister(struct stk1160 *dev);
void stk1160_clear_queue(struct stk1160 *dev);

/* Provided by stk1160-video.c */
int stk1160_alloc_isoc(struct stk1160 *dev);
void stk1160_free_isoc(struct stk1160 *dev);
void stk1160_cancel_isoc(struct stk1160 *dev);
void stk1160_uninit_isoc(struct stk1160 *dev);

/* Provided by stk1160-i2c.c */
int stk1160_i2c_register(struct stk1160 *dev);
int stk1160_i2c_unregister(struct stk1160 *dev);

/* Provided by stk1160-core.c */
int stk1160_read_reg(struct stk1160 *dev, u16 reg, u8 *value);
int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value);
int stk1160_write_regs_req(struct stk1160 *dev, u8 req, u16 reg,
		char *buf, int len);
int stk1160_read_reg_req_len(struct stk1160 *dev, u8 req, u16 reg,
		char *buf, int len);
void stk1160_select_input(struct stk1160 *dev);

/* Provided by stk1160-ac97.c */
#ifdef CONFIG_VIDEO_STK1160_AC97
int stk1160_ac97_register(struct stk1160 *dev);
int stk1160_ac97_unregister(struct stk1160 *dev);
#else
static inline int stk1160_ac97_register(struct stk1160 *dev) { return 0; }
static inline int stk1160_ac97_unregister(struct stk1160 *dev) { return 0; }
#endif


text:
<?php

namespace Dena\LaravelElasticEmail;

use Illuminate\Mail\TransportManager as OriginalTransportManager;

class TransportManager extends OriginalTransportManager
{
	protected function createElasticEmailDriver()
	{
		$config = $this->app['config']->get('services.elastic_email', []);
		return new ElasticTransport(
			$this->guzzle($config),
			$config['key'],
			$config['account']
		);
	}
}


text:
using System.Linq;
using QuantConnect.Data;

namespace QuantConnect.Algorithm.CSharp.Benchmarks
{
    public class ScheduledEventsBenchmark : QCAlgorithm
    {
        public override void Initialize()
        {
            SetStartDate(2011, 1, 1);
            SetEndDate(2018, 1, 1);
            SetCash(100000);
            AddEquity("SPY");
            foreach (int period in Enumerable.Range(0, 300))
            {
                Schedule.On(DateRules.EveryDay("SPY"), TimeRules.AfterMarketOpen("SPY", period), Rebalance);
                Schedule.On(DateRules.EveryDay("SPY"), TimeRules.BeforeMarketClose("SPY", period), Rebalance);
            }
        }

        public override void OnData(Slice data) { }
        private void Rebalance() { }
    }
}