content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
PHP
PHP
tweak a method
68b2fd0ae1e996ff9faac977eea8dda265797745
<ide><path>src/Illuminate/Routing/ResourceRegistrar.php <ide> protected function getResourceName($resource, $method, $options) <ide> // the resource action. Otherwise we'll just use an empty string for here. <ide> $prefix = isset($options['as']) ? $options['as'].'.' : ''; <ide> <del> if (empty($this->router->getGroupStack())) <add> if ( ! $this->router->hasGroupStack()) <ide> { <ide> return $prefix.$resource.'.'.$method; <ide> } <ide><path>src/Illuminate/Routing/Router.php <ide> protected function prepareResponse($request, $response) <ide> return $response->prepare($request); <ide> } <ide> <add> /** <add> * Determine if the router currently has a group stack. <add> * <add> * @return bool <add> */ <add> public function hasGroupStack() <add> { <add> return ! empty($this->groupStack); <add> } <add> <ide> /** <ide> * Get the current group stack for the router. <ide> *
2
Text
Text
update pr template
b1eeb0fb117e780f567e9cc6d5578043546b2b2e
<ide><path>.github/PULL_REQUEST_TEMPLATE.md <ide> Checklist: <ide> - [ ] I have read [freeCodeCamp's contribution guidelines](https://contribute.freecodecamp.org). <ide> - [ ] My pull request has a descriptive title (not a vague title like `Update index.md`) <ide> - [ ] My pull request targets the `main` branch of freeCodeCamp. <del>- [ ] All the files I changed are in the same world language, for example: only English changes, or only Chinese changes, etc. <add>- [ ] I have tested these changes either locally on my machine, or GitPod. <ide> <ide> <!--If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.--> <ide>
1
Go
Go
fix nits in comments
6fb05778ba241b344dd9014ff1091e3f70a8b40c
<ide><path>api/types/time/timestamp.go <ide> func GetTimestamp(value string, reference time.Time) (string, error) { <ide> } <ide> <ide> if err != nil { <del> // if there is a `-` then its an RFC3339 like timestamp otherwise assume unixtimestamp <add> // if there is a `-` then it's an RFC3339 like timestamp otherwise assume unixtimestamp <ide> if strings.Contains(value, "-") { <ide> return "", err // was probably an RFC3339 like timestamp but the parser failed with an error <ide> } <ide><path>builder/dockerfile/internals.go <ide> func (b *Builder) runContextCommand(args []string, allowRemote bool, allowLocalD <ide> <ide> comment := fmt.Sprintf("%s %s in %s", cmdName, origPaths, dest) <ide> <del> // Twiddle the destination when its a relative path - meaning, make it <add> // Twiddle the destination when it's a relative path - meaning, make it <ide> // relative to the WORKINGDIR <ide> if dest, err = normaliseDest(cmdName, b.runConfig.WorkingDir, dest); err != nil { <ide> return err <ide> func (b *Builder) processImageFrom(img builder.Image) error { <ide> } <ide> <ide> // Check to see if we have a default PATH, note that windows won't <del> // have one as its set by HCS <add> // have one as it's set by HCS <ide> if system.DefaultPathEnv != "" { <ide> // Convert the slice of strings that represent the current list <ide> // of env vars into a map so we can see if PATH is already set. <del> // If its not set then go ahead and give it our default value <add> // If it's not set then go ahead and give it our default value <ide> configEnv := opts.ConvertKVStringsToMap(b.runConfig.Env) <ide> if _, ok := configEnv["PATH"]; !ok { <ide> b.runConfig.Env = append(b.runConfig.Env, <ide><path>cli/command/swarm/unlock.go <ide> func runUnlock(dockerCli *command.DockerCli, opts unlockOptions) error { <ide> client := dockerCli.Client() <ide> ctx := context.Background() <ide> <del> // First see if the node is actually part of a swarm, and if it's is actually locked first. <add> // First see if the node is actually part of a swarm, and if it is actually locked first. <ide> // If it's in any other state than locked, don't ask for the key. <ide> info, err := client.Info(ctx) <ide> if err != nil { <ide><path>daemon/config.go <ide> func parseClusterAdvertiseSettings(clusterStore, clusterAdvertise string) (strin <ide> return advertise, nil <ide> } <ide> <del>// GetConflictFreeLabels validate Labels for conflict <add>// GetConflictFreeLabels validates Labels for conflict <ide> // In swarm the duplicates for labels are removed <ide> // so we only take same values here, no conflict values <ide> // If the key-value is the same we will only take the last label <ide><path>daemon/daemon.go <ide> func NewDaemon(config *Config, registryService registry.Service, containerdRemot <ide> logrus.Infof("Graph migration to content-addressability took %.2f seconds", time.Since(migrationStart).Seconds()) <ide> <ide> // Discovery is only enabled when the daemon is launched with an address to advertise. When <del> // initialized, the daemon is registered and we can store the discovery backend as its read-only <add> // initialized, the daemon is registered and we can store the discovery backend as it's read-only <ide> if err := d.initDiscovery(config); err != nil { <ide> return nil, err <ide> } <ide><path>daemon/daemon_solaris.go <ide> func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. <ide> return warnings, nil <ide> } <ide> <del>// platformReload update configuration with platform specific options <add>// platformReload updates configuration with platform specific options <ide> func (daemon *Daemon) platformReload(config *Config) map[string]string { <ide> return map[string]string{} <ide> } <ide><path>daemon/daemon_unix.go <ide> func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. <ide> return warnings, nil <ide> } <ide> <del>// platformReload update configuration with platform specific options <add>// platformReload updates configuration with platform specific options <ide> func (daemon *Daemon) platformReload(config *Config) map[string]string { <ide> if config.IsValueSet("runtimes") { <ide> daemon.configStore.Runtimes = config.Runtimes <ide><path>daemon/daemon_windows.go <ide> func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. <ide> return warnings, err <ide> } <ide> <del>// platformReload update configuration with platform specific options <add>// platformReload updates configuration with platform specific options <ide> func (daemon *Daemon) platformReload(config *Config) map[string]string { <ide> return map[string]string{} <ide> } <ide><path>daemon/kill.go <ide> func (daemon *Daemon) Kill(container *container.Container) error { <ide> if err := daemon.killPossiblyDeadProcess(container, int(syscall.SIGKILL)); err != nil { <ide> // While normally we might "return err" here we're not going to <ide> // because if we can't stop the container by this point then <del> // its probably because its already stopped. Meaning, between <add> // it's probably because it's already stopped. Meaning, between <ide> // the time of the IsRunning() call above and now it stopped. <ide> // Also, since the err return will be environment specific we can't <ide> // look for any particular (common) error that would indicate <ide><path>daemon/stop.go <ide> func (daemon *Daemon) containerStop(container *container.Container, seconds int) <ide> if err := daemon.killPossiblyDeadProcess(container, stopSignal); err != nil { <ide> // While normally we might "return err" here we're not going to <ide> // because if we can't stop the container by this point then <del> // its probably because its already stopped. Meaning, between <add> // it's probably because it's already stopped. Meaning, between <ide> // the time of the IsRunning() call above and now it stopped. <ide> // Also, since the err return will be environment specific we can't <ide> // look for any particular (common) error that would indicate
10
Python
Python
add option `--skip-init` to db reset command
44c0edb34ec5a91b1e0021eba2b37707c378ce11
<ide><path>airflow/cli/cli_parser.py <ide> def string_lower_type(val): <ide> action="store_true", <ide> default=False, <ide> ) <add>ARG_DB_SKIP_INIT = Arg( <add> ("-s", "--skip-init"), <add> help="Only remove tables; do not perform db init.", <add> action="store_true", <add> default=False, <add>) <ide> <ide> # webserver <ide> ARG_PORT = Arg( <ide> class GroupCommand(NamedTuple): <ide> name='reset', <ide> help="Burn down and rebuild the metadata database", <ide> func=lazy_load_command('airflow.cli.commands.db_command.resetdb'), <del> args=(ARG_YES,), <add> args=(ARG_YES, ARG_DB_SKIP_INIT), <ide> ), <ide> ActionCommand( <ide> name='upgrade', <ide><path>airflow/cli/commands/db_command.py <ide> def initdb(args): <ide> def resetdb(args): <ide> """Resets the metadata database""" <ide> print("DB: " + repr(settings.engine.url)) <del> if args.yes or input("This will drop existing tables if they exist. Proceed? (y/n)").upper() == "Y": <del> db.resetdb() <del> else: <del> print("Cancelled") <add> if not (args.yes or input("This will drop existing tables if they exist. Proceed? (y/n)").upper() == "Y"): <add> raise SystemExit("Cancelled") <add> db.resetdb(skip_init=args.skip_init) <ide> <ide> <ide> @cli_utils.action_cli(check_db=False) <ide><path>airflow/utils/db.py <ide> def upgradedb( <ide> <ide> <ide> @provide_session <del>def resetdb(session: Session = NEW_SESSION): <add>def resetdb(session: Session = NEW_SESSION, skip_init: bool = False): <ide> """Clear out the database""" <ide> if not settings.engine: <ide> raise RuntimeError("The settings.engine must be set. This is a critical assertion") <ide> def resetdb(session: Session = NEW_SESSION): <ide> drop_flask_models(connection) <ide> drop_airflow_moved_tables(session) <ide> <del> initdb(session=session) <add> if not skip_init: <add> initdb(session=session) <ide> <ide> <ide> @provide_session <ide><path>tests/cli/commands/test_db_command.py <ide> def test_cli_initdb(self, mock_initdb): <ide> def test_cli_resetdb(self, mock_resetdb): <ide> db_command.resetdb(self.parser.parse_args(['db', 'reset', '--yes'])) <ide> <del> mock_resetdb.assert_called_once_with() <add> mock_resetdb.assert_called_once_with(skip_init=False) <add> <add> @mock.patch("airflow.cli.commands.db_command.db.resetdb") <add> def test_cli_resetdb_skip_init(self, mock_resetdb): <add> db_command.resetdb(self.parser.parse_args(['db', 'reset', '--yes', '--skip-init'])) <add> mock_resetdb.assert_called_once_with(skip_init=True) <ide> <ide> @mock.patch("airflow.cli.commands.db_command.db.check_migrations") <ide> def test_cli_check_migrations(self, mock_wait_for_migrations): <ide><path>tests/utils/test_db.py <ide> def test_downgrade_with_from(self, mock_om): <ide> actual = mock_om.call_args[1]['revision'] <ide> assert actual == 'abc' <ide> <add> @pytest.mark.parametrize('skip_init', [False, True]) <ide> @mock.patch('airflow.utils.db.create_global_lock', new=MagicMock) <ide> @mock.patch('airflow.utils.db.drop_airflow_models') <ide> @mock.patch('airflow.utils.db.drop_flask_models') <add> @mock.patch('airflow.utils.db.drop_airflow_moved_tables') <ide> @mock.patch('airflow.utils.db.initdb') <ide> @mock.patch('airflow.settings.engine.connect') <ide> def test_resetdb( <ide> self, <ide> mock_connect, <ide> mock_init, <add> mock_drop_moved, <ide> mock_drop_flask, <ide> mock_drop_airflow, <add> skip_init, <ide> ): <ide> session_mock = MagicMock() <del> resetdb(session_mock) <add> resetdb(session_mock, skip_init=skip_init) <ide> mock_drop_airflow.assert_called_once_with(mock_connect.return_value) <ide> mock_drop_flask.assert_called_once_with(mock_connect.return_value) <del> mock_init.assert_called_once_with(session=session_mock) <add> mock_drop_moved.assert_called_once_with(session_mock) <add> if skip_init: <add> mock_init.assert_not_called() <add> else: <add> mock_init.assert_called_once_with(session=session_mock)
5
Python
Python
add cinder support libcloud-874
557e1e5fa661eb2dedc914913606ea5cdb7fcb90
<ide><path>libcloud/compute/drivers/openstack.py <ide> def create_volume(self, size, name, location=None, snapshot=None, <ide> volume['snapshot_id'] = snapshot.id <ide> <ide> resp = self.volumev2_connection.request('/volumes', <del> method='POST', <del> data={'volume': volume}) <add> method='POST', <add> data={'volume': volume}) <ide> return self._to_volume(resp.object) <ide> <ide> def destroy_volume(self, volume): <ide> return self.volumev2_connection.request('/volumes/%s' % volume.id, <del> method='DELETE').success() <add> method='DELETE').success() <ide> <ide> def ex_list_snapshots(self): <ide> return self._to_snapshots( <ide> def create_volume_snapshot(self, volume, name=None, ex_description=None, <ide> if ex_description is not None: <ide> data['snapshot']['description'] = ex_description <ide> <del> return self._to_snapshot(self.volumev2_connection.request('/snapshots', <del> method='POST', <del> data=data).object) <add> return self._to_snapshot( <add> self.volumev2_connection.request('/snapshots', method='POST', <add> data=data).object) <ide> <ide> def destroy_volume_snapshot(self, snapshot): <ide> resp = self.volumev2_connection.request('/snapshots/%s' % snapshot.id, <del> method='DELETE') <add> method='DELETE') <ide> return resp.status == httplib.ACCEPTED <ide> <ide>
1
Javascript
Javascript
ignore .gitignore (and more) from bower packages
ceec907bee33d39da68cb7af111400622aefee23
<ide><path>gulpfile.js <ide> function bowerTask() { <ide> homepage: package.homepage, <ide> license: package.license, <ide> version: package.version, <del> main: outDir + "Chart.js" <add> main: outDir + "Chart.js", <add> ignore: [ <add> '.github', <add> '.codeclimate.yml', <add> '.gitignore', <add> '.npmignore', <add> '.travis.yml', <add> 'scripts' <add> ] <ide> }, null, 2); <ide> <ide> return file('bower.json', json, { src: true })
1
Text
Text
remove new v2 tags
3478ff1eb0fd57c48a332e7787efe6ea47492e13
<ide><path>website/README.md <ide> import Tag from 'components/tag' <ide> <ide> > ```jsx <ide> > <Tag>method</Tag> <del>> <Tag variant="new">2.1</Tag> <add>> <Tag variant="new">4</Tag> <ide> > <Tag variant="model">tagger, parser</Tag> <ide> > ``` <ide> <ide> installed. <ide> <ide> <InlineList> <ide> <del><Tag>method</Tag> <Tag variant="new">2</Tag> <Tag variant="model">tagger, <add><Tag>method</Tag> <Tag variant="new">4</Tag> <Tag variant="model">tagger, <ide> parser</Tag> <ide> <ide> </InlineList> <ide><path>website/docs/api/cli.md <ide> $ python -m spacy download [model] [--direct] [--sdist] [pip_args] <ide> | `--direct`, `-D` | Force direct download of exact package version. ~~bool (flag)~~ | <ide> | `--sdist`, `-S` <Tag variant="new">3</Tag> | Download the source package (`.tar.gz` archive) instead of the default pre-built binary wheel. ~~bool (flag)~~ | <ide> | `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <del>| pip args <Tag variant="new">2.1</Tag> | Additional installation options to be passed to `pip install` when installing the pipeline package. For example, `--user` to install to the user home directory or `--no-deps` to not install package dependencies. ~~Any (option/flag)~~ | <add>| pip args | Additional installation options to be passed to `pip install` when installing the pipeline package. For example, `--user` to install to the user home directory or `--no-deps` to not install package dependencies. ~~Any (option/flag)~~ | <ide> | **CREATES** | The installed pipeline package in your `site-packages` directory. | <ide> <ide> ## info {#info tag="command"} <ide> $ python -m spacy info [--markdown] [--silent] [--exclude] <ide> $ python -m spacy info [model] [--markdown] [--silent] [--exclude] <ide> ``` <ide> <del>| Name | Description | <del>| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- | <del>| `model` | A trained pipeline, i.e. package name or path (optional). ~~Optional[str] \(option)~~ | <del>| `--markdown`, `-md` | Print information as Markdown. ~~bool (flag)~~ | <del>| `--silent`, `-s` <Tag variant="new">2.0.12</Tag> | Don't print anything, just return the values. ~~bool (flag)~~ | <del>| `--exclude`, `-e` | Comma-separated keys to exclude from the print-out. Defaults to `"labels"`. ~~Optional[str]~~ | <del>| `--url`, `-u` <Tag variant="new">3.5.0</Tag> | Print the URL to download the most recent compatible version of the pipeline. Requires a pipeline name. ~~bool (flag)~~ | <del>| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <del>| **PRINTS** | Information about your spaCy installation. | <add>| Name | Description | <add>| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | <add>| `model` | A trained pipeline, i.e. package name or path (optional). ~~Optional[str] \(option)~~ | <add>| `--markdown`, `-md` | Print information as Markdown. ~~bool (flag)~~ | <add>| `--silent`, `-s` | Don't print anything, just return the values. ~~bool (flag)~~ | <add>| `--exclude`, `-e` | Comma-separated keys to exclude from the print-out. Defaults to `"labels"`. ~~Optional[str]~~ | <add>| `--url`, `-u` <Tag variant="new">3.5.0</Tag> | Print the URL to download the most recent compatible version of the pipeline. Requires a pipeline name. ~~bool (flag)~~ | <add>| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <add>| **PRINTS** | Information about your spaCy installation. | <ide> <ide> ## validate {#validate new="2" tag="command"} <ide> <ide> chosen based on the file extension of the input file. <ide> $ python -m spacy convert [input_file] [output_dir] [--converter] [--file-type] [--n-sents] [--seg-sents] [--base] [--morphology] [--merge-subtokens] [--ner-map] [--lang] <ide> ``` <ide> <del>| Name | Description | <del>| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | <del>| `input_path` | Input file or directory. ~~Path (positional)~~ | <del>| `output_dir` | Output directory for converted file. Defaults to `"-"`, meaning data will be written to `stdout`. ~~Optional[Path] \(option)~~ | <del>| `--converter`, `-c` <Tag variant="new">2</Tag> | Name of converter to use (see below). ~~str (option)~~ | <del>| `--file-type`, `-t` <Tag variant="new">2.1</Tag> | Type of file to create. Either `spacy` (default) for binary [`DocBin`](/api/docbin) data or `json` for v2.x JSON format. ~~str (option)~~ | <del>| `--n-sents`, `-n` | Number of sentences per document. Supported for: `conll`, `conllu`, `iob`, `ner` ~~int (option)~~ | <del>| `--seg-sents`, `-s` <Tag variant="new">2.2</Tag> | Segment sentences. Supported for: `conll`, `ner` ~~bool (flag)~~ | <del>| `--base`, `-b`, `--model` | Trained spaCy pipeline for sentence segmentation to use as base (for `--seg-sents`). ~~Optional[str](option)~~ | <del>| `--morphology`, `-m` | Enable appending morphology to tags. Supported for: `conllu` ~~bool (flag)~~ | <del>| `--merge-subtokens`, `-T` | Merge CoNLL-U subtokens ~~bool (flag)~~ | <del>| `--ner-map`, `-nm` | NER tag mapping (as JSON-encoded dict of entity types). Supported for: `conllu` ~~Optional[Path](option)~~ | <del>| `--lang`, `-l` <Tag variant="new">2.1</Tag> | Language code (if tokenizer required). ~~Optional[str] \(option)~~ | <del>| `--concatenate`, `-C` | Concatenate output to a single file ~~bool (flag)~~ | <del>| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <del>| **CREATES** | Binary [`DocBin`](/api/docbin) training data that can be used with [`spacy train`](/api/cli#train). | <add>| Name | Description | <add>| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | <add>| `input_path` | Input file or directory. ~~Path (positional)~~ | <add>| `output_dir` | Output directory for converted file. Defaults to `"-"`, meaning data will be written to `stdout`. ~~Optional[Path] \(option)~~ | <add>| `--converter`, `-c` | Name of converter to use (see below). ~~str (option)~~ | <add>| `--file-type`, `-t` | Type of file to create. Either `spacy` (default) for binary [`DocBin`](/api/docbin) data or `json` for v2.x JSON format. ~~str (option)~~ | <add>| `--n-sents`, `-n` | Number of sentences per document. Supported for: `conll`, `conllu`, `iob`, `ner` ~~int (option)~~ | <add>| `--seg-sents`, `-s` | Segment sentences. Supported for: `conll`, `ner` ~~bool (flag)~~ | <add>| `--base`, `-b`, `--model` | Trained spaCy pipeline for sentence segmentation to use as base (for `--seg-sents`). ~~Optional[str](option)~~ | <add>| `--morphology`, `-m` | Enable appending morphology to tags. Supported for: `conllu` ~~bool (flag)~~ | <add>| `--merge-subtokens`, `-T` | Merge CoNLL-U subtokens ~~bool (flag)~~ | <add>| `--ner-map`, `-nm` | NER tag mapping (as JSON-encoded dict of entity types). Supported for: `conllu` ~~Optional[Path](option)~~ | <add>| `--lang`, `-l` | Language code (if tokenizer required). ~~Optional[str] \(option)~~ | <add>| `--concatenate`, `-C` | Concatenate output to a single file ~~bool (flag)~~ | <add>| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <add>| **CREATES** | Binary [`DocBin`](/api/docbin) training data that can be used with [`spacy train`](/api/cli#train). | <ide> <ide> ### Converters {#converters} <ide> <ide> report span characteristics such as the average span length and the span (or <ide> span boundary) distinctiveness. The distinctiveness measure shows how different <ide> the tokens are with respect to the rest of the corpus using the KL-divergence of <ide> the token distributions. To learn more, you can check out Papay et al.'s work on <del>[*Dissecting Span Identification Tasks with Performance Prediction* (EMNLP <del>2020)](https://aclanthology.org/2020.emnlp-main.396/). <add>[*Dissecting Span Identification Tasks with Performance Prediction* (EMNLP 2020)](https://aclanthology.org/2020.emnlp-main.396/). <ide> <ide> </Infobox> <ide> <ide> $ python -m spacy package [input_dir] [output_dir] [--code] [--meta-path] [--cre <ide> > $ pip install dist/en_pipeline-0.0.0.tar.gz <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `input_dir` | Path to directory containing pipeline data. ~~Path (positional)~~ | <del>| `output_dir` | Directory to create package folder in. ~~Path (positional)~~ | <del>| `--code`, `-c` <Tag variant="new">3</Tag> | Comma-separated paths to Python files to be included in the package and imported in its `__init__.py`. This allows including [registering functions](/usage/training#custom-functions) and [custom components](/usage/processing-pipelines#custom-components). ~~str (option)~~ | <del>| `--meta-path`, `-m` <Tag variant="new">2</Tag> | Path to [`meta.json`](/api/data-formats#meta) file (optional). ~~Optional[Path] \(option)~~ | <del>| `--create-meta`, `-C` <Tag variant="new">2</Tag> | Create a `meta.json` file on the command line, even if one already exists in the directory. If an existing file is found, its entries will be shown as the defaults in the command line prompt. ~~bool (flag)~~ | <del>| `--build`, `-b` <Tag variant="new">3</Tag> | Comma-separated artifact formats to build. Can be `sdist` (for a `.tar.gz` archive) and/or `wheel` (for a binary `.whl` file), or `none` if you want to run this step manually. The generated artifacts can be installed by `pip install`. Defaults to `sdist`. ~~str (option)~~ | <del>| `--name`, `-n` <Tag variant="new">3</Tag> | Package name to override in meta. ~~Optional[str] \(option)~~ | <del>| `--version`, `-v` <Tag variant="new">3</Tag> | Package version to override in meta. Useful when training new versions, as it doesn't require editing the meta template. ~~Optional[str] \(option)~~ | <del>| `--force`, `-f` | Force overwriting of existing folder in output directory. ~~bool (flag)~~ | <del>| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <del>| **CREATES** | A Python package containing the spaCy pipeline. | <add>| Name | Description | <add>| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `input_dir` | Path to directory containing pipeline data. ~~Path (positional)~~ | <add>| `output_dir` | Directory to create package folder in. ~~Path (positional)~~ | <add>| `--code`, `-c` <Tag variant="new">3</Tag> | Comma-separated paths to Python files to be included in the package and imported in its `__init__.py`. This allows including [registering functions](/usage/training#custom-functions) and [custom components](/usage/processing-pipelines#custom-components). ~~str (option)~~ | <add>| `--meta-path`, `-m` | Path to [`meta.json`](/api/data-formats#meta) file (optional). ~~Optional[Path] \(option)~~ | <add>| `--create-meta`, `-C` | Create a `meta.json` file on the command line, even if one already exists in the directory. If an existing file is found, its entries will be shown as the defaults in the command line prompt. ~~bool (flag)~~ | <add>| `--build`, `-b` <Tag variant="new">3</Tag> | Comma-separated artifact formats to build. Can be `sdist` (for a `.tar.gz` archive) and/or `wheel` (for a binary `.whl` file), or `none` if you want to run this step manually. The generated artifacts can be installed by `pip install`. Defaults to `sdist`. ~~str (option)~~ | <add>| `--name`, `-n` <Tag variant="new">3</Tag> | Package name to override in meta. ~~Optional[str] \(option)~~ | <add>| `--version`, `-v` <Tag variant="new">3</Tag> | Package version to override in meta. Useful when training new versions, as it doesn't require editing the meta template. ~~Optional[str] \(option)~~ | <add>| `--force`, `-f` | Force overwriting of existing folder in output directory. ~~bool (flag)~~ | <add>| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <add>| **CREATES** | A Python package containing the spaCy pipeline. | <ide> <ide> ## project {#project new="3"} <ide> <ide><path>website/docs/api/doc.md <ide> alignment mode `"strict". <ide> > assert span.text == "New York" <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `start` | The index of the first character of the span. ~~int~~ | <del>| `end` | The index of the last character after the span. ~~int~~ | <del>| `label` | A label to attach to the span, e.g. for named entities. ~~Union[int, str]~~ | <del>| `kb_id` <Tag variant="new">2.2</Tag> | An ID from a knowledge base to capture the meaning of a named entity. ~~Union[int, str]~~ | <del>| `vector` | A meaning representation of the span. ~~numpy.ndarray[ndim=1, dtype=float32]~~ | <del>| `alignment_mode` | How character indices snap to token boundaries. Options: `"strict"` (no snapping), `"contract"` (span of all tokens completely within the character span), `"expand"` (span of all tokens at least partially covered by the character span). Defaults to `"strict"`. ~~str~~ | <del>| **RETURNS** | The newly constructed object or `None`. ~~Optional[Span]~~ | <add>| Name | Description | <add>| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `start` | The index of the first character of the span. ~~int~~ | <add>| `end` | The index of the last character after the span. ~~int~~ | <add>| `label` | A label to attach to the span, e.g. for named entities. ~~Union[int, str]~~ | <add>| `kb_id` | An ID from a knowledge base to capture the meaning of a named entity. ~~Union[int, str]~~ | <add>| `vector` | A meaning representation of the span. ~~numpy.ndarray[ndim=1, dtype=float32]~~ | <add>| `alignment_mode` | How character indices snap to token boundaries. Options: `"strict"` (no snapping), `"contract"` (span of all tokens completely within the character span), `"expand"` (span of all tokens at least partially covered by the character span). Defaults to `"strict"`. ~~str~~ | <add>| **RETURNS** | The newly constructed object or `None`. ~~Optional[Span]~~ | <ide> <ide> ## Doc.set_ents {#set_ents tag="method" new="3"} <ide> <ide> The L2 norm of the document's vector representation. <ide> <ide> ## Attributes {#attributes} <ide> <del>| Name | Description | <del>| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | <del>| `text` | A string representation of the document text. ~~str~~ | <del>| `text_with_ws` | An alias of `Doc.text`, provided for duck-type compatibility with `Span` and `Token`. ~~str~~ | <del>| `mem` | The document's local memory heap, for all C data it owns. ~~cymem.Pool~~ | <del>| `vocab` | The store of lexical types. ~~Vocab~~ | <del>| `tensor` <Tag variant="new">2</Tag> | Container for dense vector representations. ~~numpy.ndarray~~ | <del>| `user_data` | A generic storage area, for user custom data. ~~Dict[str, Any]~~ | <del>| `lang` <Tag variant="new">2.1</Tag> | Language of the document's vocabulary. ~~int~~ | <del>| `lang_` <Tag variant="new">2.1</Tag> | Language of the document's vocabulary. ~~str~~ | <del>| `sentiment` | The document's positivity/negativity score, if available. ~~float~~ | <del>| `user_hooks` | A dictionary that allows customization of the `Doc`'s properties. ~~Dict[str, Callable]~~ | <del>| `user_token_hooks` | A dictionary that allows customization of properties of `Token` children. ~~Dict[str, Callable]~~ | <del>| `user_span_hooks` | A dictionary that allows customization of properties of `Span` children. ~~Dict[str, Callable]~~ | <del>| `has_unknown_spaces` | Whether the document was constructed without known spacing between tokens (typically when created from gold tokenization). ~~bool~~ | <del>| `_` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). ~~Underscore~~ | <add>| Name | Description | <add>| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | <add>| `text` | A string representation of the document text. ~~str~~ | <add>| `text_with_ws` | An alias of `Doc.text`, provided for duck-type compatibility with `Span` and `Token`. ~~str~~ | <add>| `mem` | The document's local memory heap, for all C data it owns. ~~cymem.Pool~~ | <add>| `vocab` | The store of lexical types. ~~Vocab~~ | <add>| `tensor` | Container for dense vector representations. ~~numpy.ndarray~~ | <add>| `user_data` | A generic storage area, for user custom data. ~~Dict[str, Any]~~ | <add>| `lang` | Language of the document's vocabulary. ~~int~~ | <add>| `lang_` | Language of the document's vocabulary. ~~str~~ | <add>| `sentiment` | The document's positivity/negativity score, if available. ~~float~~ | <add>| `user_hooks` | A dictionary that allows customization of the `Doc`'s properties. ~~Dict[str, Callable]~~ | <add>| `user_token_hooks` | A dictionary that allows customization of properties of `Token` children. ~~Dict[str, Callable]~~ | <add>| `user_span_hooks` | A dictionary that allows customization of properties of `Span` children. ~~Dict[str, Callable]~~ | <add>| `has_unknown_spaces` | Whether the document was constructed without known spacing between tokens (typically when created from gold tokenization). ~~bool~~ | <add>| `_` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). ~~Underscore~~ | <ide> <ide> ## Serialization fields {#serialization-fields} <ide> <ide><path>website/docs/api/language.md <ide> spaCy loads a model under the hood based on its <ide> > nlp = Language.from_config(config) <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `config` | The loaded config. ~~Union[Dict[str, Any], Config]~~ | <del>| _keyword-only_ | | <del>| `vocab` | A `Vocab` object. If `True`, a vocab is created using the default language data settings. ~~Vocab~~ | <add>| Name | Description | <add>| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | <add>| `config` | The loaded config. ~~Union[Dict[str, Any], Config]~~ | <add>| _keyword-only_ | | <add>| `vocab` | A `Vocab` object. If `True`, a vocab is created using the default language data settings. ~~Vocab~~ | <ide> | `disable` | Name(s) of pipeline component(s) to [disable](/usage/processing-pipelines#disabling). Disabled pipes will be loaded but they won't be run unless you explicitly enable them by calling [nlp.enable_pipe](/api/language#enable_pipe). Is merged with the config entry `nlp.disabled`. ~~Union[str, Iterable[str]]~~ | <del>| `enable` <Tag variant="new">3.4</Tag> | Name(s) of pipeline component(s) to [enable](/usage/processing-pipelines#disabling). All other pipes will be disabled, but can be enabled again using [nlp.enable_pipe](/api/language#enable_pipe). ~~Union[str, Iterable[str]]~~ | <del>| `exclude` | Name(s) of pipeline component(s) to [exclude](/usage/processing-pipelines#disabling). Excluded components won't be loaded. ~~Union[str, Iterable[str]]~~ | <del>| `meta` | [Meta data](/api/data-formats#meta) overrides. ~~Dict[str, Any]~~ | <del>| `auto_fill` | Whether to automatically fill in missing values in the config, based on defaults and function argument annotations. Defaults to `True`. ~~bool~~ | <del>| `validate` | Whether to validate the component config and arguments against the types expected by the factory. Defaults to `True`. ~~bool~~ | <del>| **RETURNS** | The initialized object. ~~Language~~ | <add>| `enable` <Tag variant="new">3.4</Tag> | Name(s) of pipeline component(s) to [enable](/usage/processing-pipelines#disabling). All other pipes will be disabled, but can be enabled again using [nlp.enable_pipe](/api/language#enable_pipe). ~~Union[str, Iterable[str]]~~ | <add>| `exclude` | Name(s) of pipeline component(s) to [exclude](/usage/processing-pipelines#disabling). Excluded components won't be loaded. ~~Union[str, Iterable[str]]~~ | <add>| `meta` | [Meta data](/api/data-formats#meta) overrides. ~~Dict[str, Any]~~ | <add>| `auto_fill` | Whether to automatically fill in missing values in the config, based on defaults and function argument annotations. Defaults to `True`. ~~bool~~ | <add>| `validate` | Whether to validate the component config and arguments against the types expected by the factory. Defaults to `True`. ~~bool~~ | <add>| **RETURNS** | The initialized object. ~~Language~~ | <ide> <ide> ## Language.component {#component tag="classmethod" new="3"} <ide> <ide> tokenization is skipped but the rest of the pipeline is run. <ide> > assert doc.has_annotation("DEP") <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `texts` | A sequence of strings (or `Doc` objects). ~~Iterable[Union[str, Doc]]~~ | <del>| _keyword-only_ | | <del>| `as_tuples` | If set to `True`, inputs should be a sequence of `(text, context)` tuples. Output will then be a sequence of `(doc, context)` tuples. Defaults to `False`. ~~bool~~ | <del>| `batch_size` | The number of texts to buffer. ~~Optional[int]~~ | <del>| `disable` | Names of pipeline components to [disable](/usage/processing-pipelines#disabling). ~~List[str]~~ | <del>| `component_cfg` | Optional dictionary of keyword arguments for components, keyed by component names. Defaults to `None`. ~~Optional[Dict[str, Dict[str, Any]]]~~ | <del>| `n_process` <Tag variant="new">2.2.2</Tag> | Number of processors to use. Defaults to `1`. ~~int~~ | <del>| **YIELDS** | Documents in the order of the original text. ~~Doc~~ | <add>| Name | Description | <add>| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `texts` | A sequence of strings (or `Doc` objects). ~~Iterable[Union[str, Doc]]~~ | <add>| _keyword-only_ | | <add>| `as_tuples` | If set to `True`, inputs should be a sequence of `(text, context)` tuples. Output will then be a sequence of `(doc, context)` tuples. Defaults to `False`. ~~bool~~ | <add>| `batch_size` | The number of texts to buffer. ~~Optional[int]~~ | <add>| `disable` | Names of pipeline components to [disable](/usage/processing-pipelines#disabling). ~~List[str]~~ | <add>| `component_cfg` | Optional dictionary of keyword arguments for components, keyed by component names. Defaults to `None`. ~~Optional[Dict[str, Dict[str, Any]]]~~ | <add>| `n_process` | Number of processors to use. Defaults to `1`. ~~int~~ | <add>| **YIELDS** | Documents in the order of the original text. ~~Doc~~ | <ide> <ide> ## Language.set_error_handler {#set_error_handler tag="method" new="3"} <ide> <ide> details. <ide> <ide> ## Attributes {#attributes} <ide> <del>| Name | Description | <del>| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `vocab` | A container for the lexical types. ~~Vocab~~ | <del>| `tokenizer` | The tokenizer. ~~Tokenizer~~ | <del>| `make_doc` | Callable that takes a string and returns a `Doc`. ~~Callable[[str], Doc]~~ | <del>| `pipeline` | List of `(name, component)` tuples describing the current processing pipeline, in order. ~~List[Tuple[str, Callable[[Doc], Doc]]]~~ | <del>| `pipe_names` <Tag variant="new">2</Tag> | List of pipeline component names, in order. ~~List[str]~~ | <del>| `pipe_labels` <Tag variant="new">2.2</Tag> | List of labels set by the pipeline components, if available, keyed by component name. ~~Dict[str, List[str]]~~ | <del>| `pipe_factories` <Tag variant="new">2.2</Tag> | Dictionary of pipeline component names, mapped to their factory names. ~~Dict[str, str]~~ | <del>| `factories` | All available factory functions, keyed by name. ~~Dict[str, Callable[[...], Callable[[Doc], Doc]]]~~ | <del>| `factory_names` <Tag variant="new">3</Tag> | List of all available factory names. ~~List[str]~~ | <del>| `components` <Tag variant="new">3</Tag> | List of all available `(name, component)` tuples, including components that are currently disabled. ~~List[Tuple[str, Callable[[Doc], Doc]]]~~ | <del>| `component_names` <Tag variant="new">3</Tag> | List of all available component names, including components that are currently disabled. ~~List[str]~~ | <del>| `disabled` <Tag variant="new">3</Tag> | Names of components that are currently disabled and don't run as part of the pipeline. ~~List[str]~~ | <del>| `path` <Tag variant="new">2</Tag> | Path to the pipeline data directory, if a pipeline is loaded from a path or package. Otherwise `None`. ~~Optional[Path]~~ | <add>| Name | Description | <add>| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `vocab` | A container for the lexical types. ~~Vocab~~ | <add>| `tokenizer` | The tokenizer. ~~Tokenizer~~ | <add>| `make_doc` | Callable that takes a string and returns a `Doc`. ~~Callable[[str], Doc]~~ | <add>| `pipeline` | List of `(name, component)` tuples describing the current processing pipeline, in order. ~~List[Tuple[str, Callable[[Doc], Doc]]]~~ | <add>| `pipe_names` | List of pipeline component names, in order. ~~List[str]~~ | <add>| `pipe_labels` | List of labels set by the pipeline components, if available, keyed by component name. ~~Dict[str, List[str]]~~ | <add>| `pipe_factories` | Dictionary of pipeline component names, mapped to their factory names. ~~Dict[str, str]~~ | <add>| `factories` | All available factory functions, keyed by name. ~~Dict[str, Callable[[...], Callable[[Doc], Doc]]]~~ | <add>| `factory_names` <Tag variant="new">3</Tag> | List of all available factory names. ~~List[str]~~ | <add>| `components` <Tag variant="new">3</Tag> | List of all available `(name, component)` tuples, including components that are currently disabled. ~~List[Tuple[str, Callable[[Doc], Doc]]]~~ | <add>| `component_names` <Tag variant="new">3</Tag> | List of all available component names, including components that are currently disabled. ~~List[str]~~ | <add>| `disabled` <Tag variant="new">3</Tag> | Names of components that are currently disabled and don't run as part of the pipeline. ~~List[str]~~ | <add>| `path` | Path to the pipeline data directory, if a pipeline is loaded from a path or package. Otherwise `None`. ~~Optional[Path]~~ | <ide> <ide> ## Class attributes {#class-attributes} <ide> <ide><path>website/docs/api/lexeme.md <ide> The L2 norm of the lexeme's vector representation. <ide> <ide> ## Attributes {#attributes} <ide> <del>| Name | Description | <del>| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `vocab` | The lexeme's vocabulary. ~~Vocab~~ | <del>| `text` | Verbatim text content. ~~str~~ | <del>| `orth` | ID of the verbatim text content. ~~int~~ | <del>| `orth_` | Verbatim text content (identical to `Lexeme.text`). Exists mostly for consistency with the other attributes. ~~str~~ | <del>| `rank` | Sequential ID of the lexeme's lexical type, used to index into tables, e.g. for word vectors. ~~int~~ | <del>| `flags` | Container of the lexeme's binary flags. ~~int~~ | <del>| `norm` | The lexeme's norm, i.e. a normalized form of the lexeme text. ~~int~~ | <del>| `norm_` | The lexeme's norm, i.e. a normalized form of the lexeme text. ~~str~~ | <del>| `lower` | Lowercase form of the word. ~~int~~ | <del>| `lower_` | Lowercase form of the word. ~~str~~ | <del>| `shape` | Transform of the word's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~int~~ | <del>| `shape_` | Transform of the word's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~str~~ | <del>| `prefix` | Length-N substring from the start of the word. Defaults to `N=1`. ~~int~~ | <del>| `prefix_` | Length-N substring from the start of the word. Defaults to `N=1`. ~~str~~ | <del>| `suffix` | Length-N substring from the end of the word. Defaults to `N=3`. ~~int~~ | <del>| `suffix_` | Length-N substring from the start of the word. Defaults to `N=3`. ~~str~~ | <del>| `is_alpha` | Does the lexeme consist of alphabetic characters? Equivalent to `lexeme.text.isalpha()`. ~~bool~~ | <del>| `is_ascii` | Does the lexeme consist of ASCII characters? Equivalent to `[any(ord(c) >= 128 for c in lexeme.text)]`. ~~bool~~ | <del>| `is_digit` | Does the lexeme consist of digits? Equivalent to `lexeme.text.isdigit()`. ~~bool~~ | <del>| `is_lower` | Is the lexeme in lowercase? Equivalent to `lexeme.text.islower()`. ~~bool~~ | <del>| `is_upper` | Is the lexeme in uppercase? Equivalent to `lexeme.text.isupper()`. ~~bool~~ | <del>| `is_title` | Is the lexeme in titlecase? Equivalent to `lexeme.text.istitle()`. ~~bool~~ | <del>| `is_punct` | Is the lexeme punctuation? ~~bool~~ | <del>| `is_left_punct` | Is the lexeme a left punctuation mark, e.g. `(`? ~~bool~~ | <del>| `is_right_punct` | Is the lexeme a right punctuation mark, e.g. `)`? ~~bool~~ | <del>| `is_space` | Does the lexeme consist of whitespace characters? Equivalent to `lexeme.text.isspace()`. ~~bool~~ | <del>| `is_bracket` | Is the lexeme a bracket? ~~bool~~ | <del>| `is_quote` | Is the lexeme a quotation mark? ~~bool~~ | <del>| `is_currency` <Tag variant="new">2.0.8</Tag> | Is the lexeme a currency symbol? ~~bool~~ | <del>| `like_url` | Does the lexeme resemble a URL? ~~bool~~ | <del>| `like_num` | Does the lexeme represent a number? e.g. "10.9", "10", "ten", etc. ~~bool~~ | <del>| `like_email` | Does the lexeme resemble an email address? ~~bool~~ | <del>| `is_oov` | Is the lexeme out-of-vocabulary (i.e. does it not have a word vector)? ~~bool~~ | <del>| `is_stop` | Is the lexeme part of a "stop list"? ~~bool~~ | <del>| `lang` | Language of the parent vocabulary. ~~int~~ | <del>| `lang_` | Language of the parent vocabulary. ~~str~~ | <del>| `prob` | Smoothed log probability estimate of the lexeme's word type (context-independent entry in the vocabulary). ~~float~~ | <del>| `cluster` | Brown cluster ID. ~~int~~ | <del>| `sentiment` | A scalar value indicating the positivity or negativity of the lexeme. ~~float~~ | <add>| Name | Description | <add>| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `vocab` | The lexeme's vocabulary. ~~Vocab~~ | <add>| `text` | Verbatim text content. ~~str~~ | <add>| `orth` | ID of the verbatim text content. ~~int~~ | <add>| `orth_` | Verbatim text content (identical to `Lexeme.text`). Exists mostly for consistency with the other attributes. ~~str~~ | <add>| `rank` | Sequential ID of the lexeme's lexical type, used to index into tables, e.g. for word vectors. ~~int~~ | <add>| `flags` | Container of the lexeme's binary flags. ~~int~~ | <add>| `norm` | The lexeme's norm, i.e. a normalized form of the lexeme text. ~~int~~ | <add>| `norm_` | The lexeme's norm, i.e. a normalized form of the lexeme text. ~~str~~ | <add>| `lower` | Lowercase form of the word. ~~int~~ | <add>| `lower_` | Lowercase form of the word. ~~str~~ | <add>| `shape` | Transform of the word's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~int~~ | <add>| `shape_` | Transform of the word's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~str~~ | <add>| `prefix` | Length-N substring from the start of the word. Defaults to `N=1`. ~~int~~ | <add>| `prefix_` | Length-N substring from the start of the word. Defaults to `N=1`. ~~str~~ | <add>| `suffix` | Length-N substring from the end of the word. Defaults to `N=3`. ~~int~~ | <add>| `suffix_` | Length-N substring from the start of the word. Defaults to `N=3`. ~~str~~ | <add>| `is_alpha` | Does the lexeme consist of alphabetic characters? Equivalent to `lexeme.text.isalpha()`. ~~bool~~ | <add>| `is_ascii` | Does the lexeme consist of ASCII characters? Equivalent to `[any(ord(c) >= 128 for c in lexeme.text)]`. ~~bool~~ | <add>| `is_digit` | Does the lexeme consist of digits? Equivalent to `lexeme.text.isdigit()`. ~~bool~~ | <add>| `is_lower` | Is the lexeme in lowercase? Equivalent to `lexeme.text.islower()`. ~~bool~~ | <add>| `is_upper` | Is the lexeme in uppercase? Equivalent to `lexeme.text.isupper()`. ~~bool~~ | <add>| `is_title` | Is the lexeme in titlecase? Equivalent to `lexeme.text.istitle()`. ~~bool~~ | <add>| `is_punct` | Is the lexeme punctuation? ~~bool~~ | <add>| `is_left_punct` | Is the lexeme a left punctuation mark, e.g. `(`? ~~bool~~ | <add>| `is_right_punct` | Is the lexeme a right punctuation mark, e.g. `)`? ~~bool~~ | <add>| `is_space` | Does the lexeme consist of whitespace characters? Equivalent to `lexeme.text.isspace()`. ~~bool~~ | <add>| `is_bracket` | Is the lexeme a bracket? ~~bool~~ | <add>| `is_quote` | Is the lexeme a quotation mark? ~~bool~~ | <add>| `is_currency` | Is the lexeme a currency symbol? ~~bool~~ | <add>| `like_url` | Does the lexeme resemble a URL? ~~bool~~ | <add>| `like_num` | Does the lexeme represent a number? e.g. "10.9", "10", "ten", etc. ~~bool~~ | <add>| `like_email` | Does the lexeme resemble an email address? ~~bool~~ | <add>| `is_oov` | Is the lexeme out-of-vocabulary (i.e. does it not have a word vector)? ~~bool~~ | <add>| `is_stop` | Is the lexeme part of a "stop list"? ~~bool~~ | <add>| `lang` | Language of the parent vocabulary. ~~int~~ | <add>| `lang_` | Language of the parent vocabulary. ~~str~~ | <add>| `prob` | Smoothed log probability estimate of the lexeme's word type (context-independent entry in the vocabulary). ~~float~~ | <add>| `cluster` | Brown cluster ID. ~~int~~ | <add>| `sentiment` | A scalar value indicating the positivity or negativity of the lexeme. ~~float~~ | <ide><path>website/docs/api/matcher.md <ide> rule-based matching are: <ide> | Attribute | Description | <ide> | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | <ide> | `ORTH` | The exact verbatim text of a token. ~~str~~ | <del>| `TEXT` <Tag variant="new">2.1</Tag> | The exact verbatim text of a token. ~~str~~ | <add>| `TEXT` | The exact verbatim text of a token. ~~str~~ | <ide> | `NORM` | The normalized form of the token text. ~~str~~ | <ide> | `LOWER` | The lowercase form of the token text. ~~str~~ | <ide> | `LENGTH` | The length of the token text. ~~int~~ | <ide> rule-based matching are: <ide> | `ENT_IOB` | The IOB part of the token's entity tag. ~~str~~ | <ide> | `ENT_ID` | The token's entity ID (`ent_id`). ~~str~~ | <ide> | `ENT_KB_ID` | The token's entity knowledge base ID (`ent_kb_id`). ~~str~~ | <del>| `_` <Tag variant="new">2.1</Tag> | Properties in [custom extension attributes](/usage/processing-pipelines#custom-components-attributes). ~~Dict[str, Any]~~ | <add>| `_` | Properties in [custom extension attributes](/usage/processing-pipelines#custom-components-attributes). ~~Dict[str, Any]~~ | <ide> | `OP` | Operator or quantifier to determine how often to match a token pattern. ~~str~~ | <ide> <ide> Operators and quantifiers define **how often** a token pattern should be <ide> matched: <ide> > ``` <ide> <ide> | OP | Description | <del>|---------|------------------------------------------------------------------------| <add>| ------- | ---------------------------------------------------------------------- | <ide> | `!` | Negate the pattern, by requiring it to match exactly 0 times. | <ide> | `?` | Make the pattern optional, by allowing it to match 0 or 1 times. | <ide> | `+` | Require the pattern to match 1 or more times. | <ide> string where an integer is expected) or unexpected property names. <ide> > matcher = Matcher(nlp.vocab) <ide> > ``` <ide> <del>| Name | Description | <del>| --------------------------------------- | ----------------------------------------------------------------------------------------------------- | <del>| `vocab` | The vocabulary object, which must be shared with the documents the matcher will operate on. ~~Vocab~~ | <del>| `validate` <Tag variant="new">2.1</Tag> | Validate all patterns added to this matcher. ~~bool~~ | <add>| Name | Description | <add>| ---------- | ----------------------------------------------------------------------------------------------------- | <add>| `vocab` | The vocabulary object, which must be shared with the documents the matcher will operate on. ~~Vocab~~ | <add>| `validate` | Validate all patterns added to this matcher. ~~bool~~ | <ide> <ide> ## Matcher.\_\_call\_\_ {#call tag="method"} <ide> <ide><path>website/docs/api/phrasematcher.md <ide> be shown. <ide> > matcher = PhraseMatcher(nlp.vocab) <ide> > ``` <ide> <del>| Name | Description | <del>| --------------------------------------- | ------------------------------------------------------------------------------------------------------ | <del>| `vocab` | The vocabulary object, which must be shared with the documents the matcher will operate on. ~~Vocab~~ | <del>| `attr` <Tag variant="new">2.1</Tag> | The token attribute to match on. Defaults to `ORTH`, i.e. the verbatim token text. ~~Union[int, str]~~ | <del>| `validate` <Tag variant="new">2.1</Tag> | Validate patterns added to the matcher. ~~bool~~ | <add>| Name | Description | <add>| ---------- | ------------------------------------------------------------------------------------------------------ | <add>| `vocab` | The vocabulary object, which must be shared with the documents the matcher will operate on. ~~Vocab~~ | <add>| `attr` | The token attribute to match on. Defaults to `ORTH`, i.e. the verbatim token text. ~~Union[int, str]~~ | <add>| `validate` | Validate patterns added to the matcher. ~~bool~~ | <ide> <ide> ## PhraseMatcher.\_\_call\_\_ {#call tag="method"} <ide> <ide><path>website/docs/api/span.md <ide> the character indices don't map to a valid span. <ide> > assert span.text == "New York" <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------ | ----------------------------------------------------------------------------------------- | <del>| `start` | The index of the first character of the span. ~~int~~ | <del>| `end` | The index of the last character after the span. ~~int~~ | <del>| `label` | A label to attach to the span, e.g. for named entities. ~~Union[int, str]~~ | <del>| `kb_id` <Tag variant="new">2.2</Tag> | An ID from a knowledge base to capture the meaning of a named entity. ~~Union[int, str]~~ | <del>| `vector` | A meaning representation of the span. ~~numpy.ndarray[ndim=1, dtype=float32]~~ | <del>| **RETURNS** | The newly constructed object or `None`. ~~Optional[Span]~~ | <add>| Name | Description | <add>| ----------- | ----------------------------------------------------------------------------------------- | <add>| `start` | The index of the first character of the span. ~~int~~ | <add>| `end` | The index of the last character after the span. ~~int~~ | <add>| `label` | A label to attach to the span, e.g. for named entities. ~~Union[int, str]~~ | <add>| `kb_id` | An ID from a knowledge base to capture the meaning of a named entity. ~~Union[int, str]~~ | <add>| `vector` | A meaning representation of the span. ~~numpy.ndarray[ndim=1, dtype=float32]~~ | <add>| **RETURNS** | The newly constructed object or `None`. ~~Optional[Span]~~ | <ide> <ide> ## Span.similarity {#similarity tag="method" model="vectors"} <ide> <ide> overlaps with will be returned. <ide> <ide> ## Attributes {#attributes} <ide> <del>| Name | Description | <del>| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | <del>| `doc` | The parent document. ~~Doc~~ | <del>| `tensor` <Tag variant="new">2.1.7</Tag> | The span's slice of the parent `Doc`'s tensor. ~~numpy.ndarray~~ | <del>| `start` | The token offset for the start of the span. ~~int~~ | <del>| `end` | The token offset for the end of the span. ~~int~~ | <del>| `start_char` | The character offset for the start of the span. ~~int~~ | <del>| `end_char` | The character offset for the end of the span. ~~int~~ | <del>| `text` | A string representation of the span text. ~~str~~ | <del>| `text_with_ws` | The text content of the span with a trailing whitespace character if the last token has one. ~~str~~ | <del>| `orth` | ID of the verbatim text content. ~~int~~ | <del>| `orth_` | Verbatim text content (identical to `Span.text`). Exists mostly for consistency with the other attributes. ~~str~~ | <del>| `label` | The hash value of the span's label. ~~int~~ | <del>| `label_` | The span's label. ~~str~~ | <del>| `lemma_` | The span's lemma. Equivalent to `"".join(token.text_with_ws for token in span)`. ~~str~~ | <del>| `kb_id` | The hash value of the knowledge base ID referred to by the span. ~~int~~ | <del>| `kb_id_` | The knowledge base ID referred to by the span. ~~str~~ | <del>| `ent_id` | The hash value of the named entity the root token is an instance of. ~~int~~ | <del>| `ent_id_` | The string ID of the named entity the root token is an instance of. ~~str~~ | <del>| `id` | The hash value of the span's ID. ~~int~~ | <del>| `id_` | The span's ID. ~~str~~ | <del>| `sentiment` | A scalar value indicating the positivity or negativity of the span. ~~float~~ | <del>| `_` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). ~~Underscore~~ | <add>| Name | Description | <add>| -------------- | ----------------------------------------------------------------------------------------------------------------------------- | <add>| `doc` | The parent document. ~~Doc~~ | <add>| `tensor` | The span's slice of the parent `Doc`'s tensor. ~~numpy.ndarray~~ | <add>| `start` | The token offset for the start of the span. ~~int~~ | <add>| `end` | The token offset for the end of the span. ~~int~~ | <add>| `start_char` | The character offset for the start of the span. ~~int~~ | <add>| `end_char` | The character offset for the end of the span. ~~int~~ | <add>| `text` | A string representation of the span text. ~~str~~ | <add>| `text_with_ws` | The text content of the span with a trailing whitespace character if the last token has one. ~~str~~ | <add>| `orth` | ID of the verbatim text content. ~~int~~ | <add>| `orth_` | Verbatim text content (identical to `Span.text`). Exists mostly for consistency with the other attributes. ~~str~~ | <add>| `label` | The hash value of the span's label. ~~int~~ | <add>| `label_` | The span's label. ~~str~~ | <add>| `lemma_` | The span's lemma. Equivalent to `"".join(token.text_with_ws for token in span)`. ~~str~~ | <add>| `kb_id` | The hash value of the knowledge base ID referred to by the span. ~~int~~ | <add>| `kb_id_` | The knowledge base ID referred to by the span. ~~str~~ | <add>| `ent_id` | The hash value of the named entity the root token is an instance of. ~~int~~ | <add>| `ent_id_` | The string ID of the named entity the root token is an instance of. ~~str~~ | <add>| `id` | The hash value of the span's ID. ~~int~~ | <add>| `id_` | The span's ID. ~~str~~ | <add>| `sentiment` | A scalar value indicating the positivity or negativity of the span. ~~float~~ | <add>| `_` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). ~~Underscore~~ | <ide><path>website/docs/api/token.md <ide> The L2 norm of the token's vector representation. <ide> <ide> ## Attributes {#attributes} <ide> <del>| Name | Description | <del>| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `doc` | The parent document. ~~Doc~~ | <del>| `lex` <Tag variant="new">3</Tag> | The underlying lexeme. ~~Lexeme~~ | <del>| `sent` <Tag variant="new">2.0.12</Tag> | The sentence span that this token is a part of. ~~Span~~ | <del>| `text` | Verbatim text content. ~~str~~ | <del>| `text_with_ws` | Text content, with trailing space character if present. ~~str~~ | <del>| `whitespace_` | Trailing space character if present. ~~str~~ | <del>| `orth` | ID of the verbatim text content. ~~int~~ | <del>| `orth_` | Verbatim text content (identical to `Token.text`). Exists mostly for consistency with the other attributes. ~~str~~ | <del>| `vocab` | The vocab object of the parent `Doc`. ~~vocab~~ | <del>| `tensor` <Tag variant="new">2.1.7</Tag> | The token's slice of the parent `Doc`'s tensor. ~~numpy.ndarray~~ | <del>| `head` | The syntactic parent, or "governor", of this token. ~~Token~~ | <del>| `left_edge` | The leftmost token of this token's syntactic descendants. ~~Token~~ | <del>| `right_edge` | The rightmost token of this token's syntactic descendants. ~~Token~~ | <del>| `i` | The index of the token within the parent document. ~~int~~ | <del>| `ent_type` | Named entity type. ~~int~~ | <del>| `ent_type_` | Named entity type. ~~str~~ | <del>| `ent_iob` | IOB code of named entity tag. `3` means the token begins an entity, `2` means it is outside an entity, `1` means it is inside an entity, and `0` means no entity tag is set. ~~int~~ | <del>| `ent_iob_` | IOB code of named entity tag. "B" means the token begins an entity, "I" means it is inside an entity, "O" means it is outside an entity, and "" means no entity tag is set. ~~str~~ | <del>| `ent_kb_id` <Tag variant="new">2.2</Tag> | Knowledge base ID that refers to the named entity this token is a part of, if any. ~~int~~ | <del>| `ent_kb_id_` <Tag variant="new">2.2</Tag> | Knowledge base ID that refers to the named entity this token is a part of, if any. ~~str~~ | <del>| `ent_id` | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. ~~int~~ | <del>| `ent_id_` | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. ~~str~~ | <del>| `lemma` | Base form of the token, with no inflectional suffixes. ~~int~~ | <del>| `lemma_` | Base form of the token, with no inflectional suffixes. ~~str~~ | <del>| `norm` | The token's norm, i.e. a normalized form of the token text. Can be set in the language's [tokenizer exceptions](/usage/linguistic-features#language-data). ~~int~~ | <del>| `norm_` | The token's norm, i.e. a normalized form of the token text. Can be set in the language's [tokenizer exceptions](/usage/linguistic-features#language-data). ~~str~~ | <del>| `lower` | Lowercase form of the token. ~~int~~ | <del>| `lower_` | Lowercase form of the token text. Equivalent to `Token.text.lower()`. ~~str~~ | <del>| `shape` | Transform of the token's string to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~int~~ | <del>| `shape_` | Transform of the token's string to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~str~~ | <del>| `prefix` | Hash value of a length-N substring from the start of the token. Defaults to `N=1`. ~~int~~ | <del>| `prefix_` | A length-N substring from the start of the token. Defaults to `N=1`. ~~str~~ | <del>| `suffix` | Hash value of a length-N substring from the end of the token. Defaults to `N=3`. ~~int~~ | <del>| `suffix_` | Length-N substring from the end of the token. Defaults to `N=3`. ~~str~~ | <del>| `is_alpha` | Does the token consist of alphabetic characters? Equivalent to `token.text.isalpha()`. ~~bool~~ | <del>| `is_ascii` | Does the token consist of ASCII characters? Equivalent to `all(ord(c) < 128 for c in token.text)`. ~~bool~~ | <del>| `is_digit` | Does the token consist of digits? Equivalent to `token.text.isdigit()`. ~~bool~~ | <del>| `is_lower` | Is the token in lowercase? Equivalent to `token.text.islower()`. ~~bool~~ | <del>| `is_upper` | Is the token in uppercase? Equivalent to `token.text.isupper()`. ~~bool~~ | <del>| `is_title` | Is the token in titlecase? Equivalent to `token.text.istitle()`. ~~bool~~ | <del>| `is_punct` | Is the token punctuation? ~~bool~~ | <del>| `is_left_punct` | Is the token a left punctuation mark, e.g. `"("` ? ~~bool~~ | <del>| `is_right_punct` | Is the token a right punctuation mark, e.g. `")"` ? ~~bool~~ | <del>| `is_sent_start` | Does the token start a sentence? ~~bool~~ or `None` if unknown. Defaults to `True` for the first token in the `Doc`. | <del>| `is_sent_end` | Does the token end a sentence? ~~bool~~ or `None` if unknown. | <del>| `is_space` | Does the token consist of whitespace characters? Equivalent to `token.text.isspace()`. ~~bool~~ | <del>| `is_bracket` | Is the token a bracket? ~~bool~~ | <del>| `is_quote` | Is the token a quotation mark? ~~bool~~ | <del>| `is_currency` <Tag variant="new">2.0.8</Tag> | Is the token a currency symbol? ~~bool~~ | <del>| `like_url` | Does the token resemble a URL? ~~bool~~ | <del>| `like_num` | Does the token represent a number? e.g. "10.9", "10", "ten", etc. ~~bool~~ | <del>| `like_email` | Does the token resemble an email address? ~~bool~~ | <del>| `is_oov` | Is the token out-of-vocabulary (i.e. does it not have a word vector)? ~~bool~~ | <del>| `is_stop` | Is the token part of a "stop list"? ~~bool~~ | <del>| `pos` | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/u/pos/). ~~int~~ | <del>| `pos_` | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/u/pos/). ~~str~~ | <del>| `tag` | Fine-grained part-of-speech. ~~int~~ | <del>| `tag_` | Fine-grained part-of-speech. ~~str~~ | <del>| `morph` <Tag variant="new">3</Tag> | Morphological analysis. ~~MorphAnalysis~~ | <del>| `dep` | Syntactic dependency relation. ~~int~~ | <del>| `dep_` | Syntactic dependency relation. ~~str~~ | <del>| `lang` | Language of the parent document's vocabulary. ~~int~~ | <del>| `lang_` | Language of the parent document's vocabulary. ~~str~~ | <del>| `prob` | Smoothed log probability estimate of token's word type (context-independent entry in the vocabulary). ~~float~~ | <del>| `idx` | The character offset of the token within the parent document. ~~int~~ | <del>| `sentiment` | A scalar value indicating the positivity or negativity of the token. ~~float~~ | <del>| `lex_id` | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. ~~int~~ | <del>| `rank` | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. ~~int~~ | <del>| `cluster` | Brown cluster ID. ~~int~~ | <del>| `_` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). ~~Underscore~~ | <add>| Name | Description | <add>| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `doc` | The parent document. ~~Doc~~ | <add>| `lex` <Tag variant="new">3</Tag> | The underlying lexeme. ~~Lexeme~~ | <add>| `sent` | The sentence span that this token is a part of. ~~Span~~ | <add>| `text` | Verbatim text content. ~~str~~ | <add>| `text_with_ws` | Text content, with trailing space character if present. ~~str~~ | <add>| `whitespace_` | Trailing space character if present. ~~str~~ | <add>| `orth` | ID of the verbatim text content. ~~int~~ | <add>| `orth_` | Verbatim text content (identical to `Token.text`). Exists mostly for consistency with the other attributes. ~~str~~ | <add>| `vocab` | The vocab object of the parent `Doc`. ~~vocab~~ | <add>| `tensor` | The token's slice of the parent `Doc`'s tensor. ~~numpy.ndarray~~ | <add>| `head` | The syntactic parent, or "governor", of this token. ~~Token~~ | <add>| `left_edge` | The leftmost token of this token's syntactic descendants. ~~Token~~ | <add>| `right_edge` | The rightmost token of this token's syntactic descendants. ~~Token~~ | <add>| `i` | The index of the token within the parent document. ~~int~~ | <add>| `ent_type` | Named entity type. ~~int~~ | <add>| `ent_type_` | Named entity type. ~~str~~ | <add>| `ent_iob` | IOB code of named entity tag. `3` means the token begins an entity, `2` means it is outside an entity, `1` means it is inside an entity, and `0` means no entity tag is set. ~~int~~ | <add>| `ent_iob_` | IOB code of named entity tag. "B" means the token begins an entity, "I" means it is inside an entity, "O" means it is outside an entity, and "" means no entity tag is set. ~~str~~ | <add>| `ent_kb_id` | Knowledge base ID that refers to the named entity this token is a part of, if any. ~~int~~ | <add>| `ent_kb_id_` | Knowledge base ID that refers to the named entity this token is a part of, if any. ~~str~~ | <add>| `ent_id` | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. ~~int~~ | <add>| `ent_id_` | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. ~~str~~ | <add>| `lemma` | Base form of the token, with no inflectional suffixes. ~~int~~ | <add>| `lemma_` | Base form of the token, with no inflectional suffixes. ~~str~~ | <add>| `norm` | The token's norm, i.e. a normalized form of the token text. Can be set in the language's [tokenizer exceptions](/usage/linguistic-features#language-data). ~~int~~ | <add>| `norm_` | The token's norm, i.e. a normalized form of the token text. Can be set in the language's [tokenizer exceptions](/usage/linguistic-features#language-data). ~~str~~ | <add>| `lower` | Lowercase form of the token. ~~int~~ | <add>| `lower_` | Lowercase form of the token text. Equivalent to `Token.text.lower()`. ~~str~~ | <add>| `shape` | Transform of the token's string to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~int~~ | <add>| `shape_` | Transform of the token's string to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. ~~str~~ | <add>| `prefix` | Hash value of a length-N substring from the start of the token. Defaults to `N=1`. ~~int~~ | <add>| `prefix_` | A length-N substring from the start of the token. Defaults to `N=1`. ~~str~~ | <add>| `suffix` | Hash value of a length-N substring from the end of the token. Defaults to `N=3`. ~~int~~ | <add>| `suffix_` | Length-N substring from the end of the token. Defaults to `N=3`. ~~str~~ | <add>| `is_alpha` | Does the token consist of alphabetic characters? Equivalent to `token.text.isalpha()`. ~~bool~~ | <add>| `is_ascii` | Does the token consist of ASCII characters? Equivalent to `all(ord(c) < 128 for c in token.text)`. ~~bool~~ | <add>| `is_digit` | Does the token consist of digits? Equivalent to `token.text.isdigit()`. ~~bool~~ | <add>| `is_lower` | Is the token in lowercase? Equivalent to `token.text.islower()`. ~~bool~~ | <add>| `is_upper` | Is the token in uppercase? Equivalent to `token.text.isupper()`. ~~bool~~ | <add>| `is_title` | Is the token in titlecase? Equivalent to `token.text.istitle()`. ~~bool~~ | <add>| `is_punct` | Is the token punctuation? ~~bool~~ | <add>| `is_left_punct` | Is the token a left punctuation mark, e.g. `"("` ? ~~bool~~ | <add>| `is_right_punct` | Is the token a right punctuation mark, e.g. `")"` ? ~~bool~~ | <add>| `is_sent_start` | Does the token start a sentence? ~~bool~~ or `None` if unknown. Defaults to `True` for the first token in the `Doc`. | <add>| `is_sent_end` | Does the token end a sentence? ~~bool~~ or `None` if unknown. | <add>| `is_space` | Does the token consist of whitespace characters? Equivalent to `token.text.isspace()`. ~~bool~~ | <add>| `is_bracket` | Is the token a bracket? ~~bool~~ | <add>| `is_quote` | Is the token a quotation mark? ~~bool~~ | <add>| `is_currency` | Is the token a currency symbol? ~~bool~~ | <add>| `like_url` | Does the token resemble a URL? ~~bool~~ | <add>| `like_num` | Does the token represent a number? e.g. "10.9", "10", "ten", etc. ~~bool~~ | <add>| `like_email` | Does the token resemble an email address? ~~bool~~ | <add>| `is_oov` | Is the token out-of-vocabulary (i.e. does it not have a word vector)? ~~bool~~ | <add>| `is_stop` | Is the token part of a "stop list"? ~~bool~~ | <add>| `pos` | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/u/pos/). ~~int~~ | <add>| `pos_` | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/u/pos/). ~~str~~ | <add>| `tag` | Fine-grained part-of-speech. ~~int~~ | <add>| `tag_` | Fine-grained part-of-speech. ~~str~~ | <add>| `morph` <Tag variant="new">3</Tag> | Morphological analysis. ~~MorphAnalysis~~ | <add>| `dep` | Syntactic dependency relation. ~~int~~ | <add>| `dep_` | Syntactic dependency relation. ~~str~~ | <add>| `lang` | Language of the parent document's vocabulary. ~~int~~ | <add>| `lang_` | Language of the parent document's vocabulary. ~~str~~ | <add>| `prob` | Smoothed log probability estimate of token's word type (context-independent entry in the vocabulary). ~~float~~ | <add>| `idx` | The character offset of the token within the parent document. ~~int~~ | <add>| `sentiment` | A scalar value indicating the positivity or negativity of the token. ~~float~~ | <add>| `lex_id` | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. ~~int~~ | <add>| `rank` | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. ~~int~~ | <add>| `cluster` | Brown cluster ID. ~~int~~ | <add>| `_` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). ~~Underscore~~ | <ide><path>website/docs/api/top-level.md <ide> specified separately using the new `exclude` keyword argument. <ide> > nlp = spacy.load("en_core_web_sm", exclude=["parser", "tagger"]) <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `name` | Pipeline to load, i.e. package name or path. ~~Union[str, Path]~~ | <del>| _keyword-only_ | | <del>| `vocab` | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~ | <add>| Name | Description | <add>| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | <add>| `name` | Pipeline to load, i.e. package name or path. ~~Union[str, Path]~~ | <add>| _keyword-only_ | | <add>| `vocab` | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~ | <ide> | `disable` | Name(s) of pipeline component(s) to [disable](/usage/processing-pipelines#disabling). Disabled pipes will be loaded but they won't be run unless you explicitly enable them by calling [nlp.enable_pipe](/api/language#enable_pipe). Is merged with the config entry `nlp.disabled`. ~~Union[str, Iterable[str]]~~ | <del>| `enable` <Tag variant="new">3.4</Tag> | Name(s) of pipeline component(s) to [enable](/usage/processing-pipelines#disabling). All other pipes will be disabled. ~~Union[str, Iterable[str]]~~ | <del>| `exclude` <Tag variant="new">3</Tag> | Name(s) of pipeline component(s) to [exclude](/usage/processing-pipelines#disabling). Excluded components won't be loaded. ~~Union[str, Iterable[str]]~~ | <del>| `config` <Tag variant="new">3</Tag> | Optional config overrides, either as nested dict or dict keyed by section value in dot notation, e.g. `"components.name.value"`. ~~Union[Dict[str, Any], Config]~~ | <del>| **RETURNS** | A `Language` object with the loaded pipeline. ~~Language~~ | <add>| `enable` <Tag variant="new">3.4</Tag> | Name(s) of pipeline component(s) to [enable](/usage/processing-pipelines#disabling). All other pipes will be disabled. ~~Union[str, Iterable[str]]~~ | <add>| `exclude` <Tag variant="new">3</Tag> | Name(s) of pipeline component(s) to [exclude](/usage/processing-pipelines#disabling). Excluded components won't be loaded. ~~Union[str, Iterable[str]]~~ | <add>| `config` <Tag variant="new">3</Tag> | Optional config overrides, either as nested dict or dict keyed by section value in dot notation, e.g. `"components.name.value"`. ~~Union[Dict[str, Any], Config]~~ | <add>| **RETURNS** | A `Language` object with the loaded pipeline. ~~Language~~ | <ide> <ide> Essentially, `spacy.load()` is a convenience wrapper that reads the pipeline's <ide> [`config.cfg`](/api/data-formats#config), uses the language and pipeline <ide> If a setting is not present in the options, the default value will be used. <ide> > displacy.serve(doc, style="dep", options=options) <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `fine_grained` | Use fine-grained part-of-speech tags (`Token.tag_`) instead of coarse-grained tags (`Token.pos_`). Defaults to `False`. ~~bool~~ | <del>| `add_lemma` <Tag variant="new">2.2.4</Tag> | Print the lemmas in a separate row below the token texts. Defaults to `False`. ~~bool~~ | <del>| `collapse_punct` | Attach punctuation to tokens. Can make the parse more readable, as it prevents long arcs to attach punctuation. Defaults to `True`. ~~bool~~ | <del>| `collapse_phrases` | Merge noun phrases into one token. Defaults to `False`. ~~bool~~ | <del>| `compact` | "Compact mode" with square arrows that takes up less space. Defaults to `False`. ~~bool~~ | <del>| `color` | Text color (HEX, RGB or color names). Defaults to `"#000000"`. ~~str~~ | <del>| `bg` | Background color (HEX, RGB or color names). Defaults to `"#ffffff"`. ~~str~~ | <del>| `font` | Font name or font family for all text. Defaults to `"Arial"`. ~~str~~ | <del>| `offset_x` | Spacing on left side of the SVG in px. Defaults to `50`. ~~int~~ | <del>| `arrow_stroke` | Width of arrow path in px. Defaults to `2`. ~~int~~ | <del>| `arrow_width` | Width of arrow head in px. Defaults to `10` in regular mode and `8` in compact mode. ~~int~~ | <del>| `arrow_spacing` | Spacing between arrows in px to avoid overlaps. Defaults to `20` in regular mode and `12` in compact mode. ~~int~~ | <del>| `word_spacing` | Vertical spacing between words and arcs in px. Defaults to `45`. ~~int~~ | <del>| `distance` | Distance between words in px. Defaults to `175` in regular mode and `150` in compact mode. ~~int~~ | <add>| Name | Description | <add>| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `fine_grained` | Use fine-grained part-of-speech tags (`Token.tag_`) instead of coarse-grained tags (`Token.pos_`). Defaults to `False`. ~~bool~~ | <add>| `add_lemma` | Print the lemmas in a separate row below the token texts. Defaults to `False`. ~~bool~~ | <add>| `collapse_punct` | Attach punctuation to tokens. Can make the parse more readable, as it prevents long arcs to attach punctuation. Defaults to `True`. ~~bool~~ | <add>| `collapse_phrases` | Merge noun phrases into one token. Defaults to `False`. ~~bool~~ | <add>| `compact` | "Compact mode" with square arrows that takes up less space. Defaults to `False`. ~~bool~~ | <add>| `color` | Text color (HEX, RGB or color names). Defaults to `"#000000"`. ~~str~~ | <add>| `bg` | Background color (HEX, RGB or color names). Defaults to `"#ffffff"`. ~~str~~ | <add>| `font` | Font name or font family for all text. Defaults to `"Arial"`. ~~str~~ | <add>| `offset_x` | Spacing on left side of the SVG in px. Defaults to `50`. ~~int~~ | <add>| `arrow_stroke` | Width of arrow path in px. Defaults to `2`. ~~int~~ | <add>| `arrow_width` | Width of arrow head in px. Defaults to `10` in regular mode and `8` in compact mode. ~~int~~ | <add>| `arrow_spacing` | Spacing between arrows in px to avoid overlaps. Defaults to `20` in regular mode and `12` in compact mode. ~~int~~ | <add>| `word_spacing` | Vertical spacing between words and arcs in px. Defaults to `45`. ~~int~~ | <add>| `distance` | Distance between words in px. Defaults to `175` in regular mode and `150` in compact mode. ~~int~~ | <ide> <ide> #### Named Entity Visualizer options {#displacy_options-ent} <ide> <ide> If a setting is not present in the options, the default value will be used. <ide> | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> | `ents` | Entity types to highlight or `None` for all types (default). ~~Optional[List[str]]~~ | <ide> | `colors` | Color overrides. Entity types should be mapped to color names or values. ~~Dict[str, str]~~ | <del>| `template` <Tag variant="new">2.2</Tag> | Optional template to overwrite the HTML used to render entity spans. Should be a format string and can use `{bg}`, `{text}` and `{label}`. See [`templates.py`](%%GITHUB_SPACY/spacy/displacy/templates.py) for examples. ~~Optional[str]~~ | <add>| `template` | Optional template to overwrite the HTML used to render entity spans. Should be a format string and can use `{bg}`, `{text}` and `{label}`. See [`templates.py`](%%GITHUB_SPACY/spacy/displacy/templates.py) for examples. ~~Optional[str]~~ | <ide> | `kb_url_template` <Tag variant="new">3.2.1</Tag> | Optional template to construct the KB url for the entity to link to. Expects a python f-string format with single field to fill in. ~~Optional[str]~~ | <ide> <ide> #### Span Visualizer options {#displacy_options-span} <ide><path>website/docs/api/vocab.md <ide> Create the vocabulary. <ide> > vocab = Vocab(strings=["hello", "world"]) <ide> > ``` <ide> <del>| Name | Description | <del>| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `lex_attr_getters` | A dictionary mapping attribute IDs to functions to compute them. Defaults to `None`. ~~Optional[Dict[str, Callable[[str], Any]]]~~ | <del>| `strings` | A [`StringStore`](/api/stringstore) that maps strings to hash values, and vice versa, or a list of strings. ~~Union[List[str], StringStore]~~ | <del>| `lookups` | A [`Lookups`](/api/lookups) that stores the `lexeme_norm` and other large lookup tables. Defaults to `None`. ~~Optional[Lookups]~~ | <del>| `oov_prob` | The default OOV probability. Defaults to `-20.0`. ~~float~~ | <del>| `vectors_name` <Tag variant="new">2.2</Tag> | A name to identify the vectors table. ~~str~~ | <del>| `writing_system` | A dictionary describing the language's writing system. Typically provided by [`Language.Defaults`](/api/language#defaults). ~~Dict[str, Any]~~ | <del>| `get_noun_chunks` | A function that yields base noun phrases used for [`Doc.noun_chunks`](/api/doc#noun_chunks). ~~Optional[Callable[[Union[Doc, Span], Iterator[Tuple[int, int, int]]]]]~~ | <add>| Name | Description | <add>| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `lex_attr_getters` | A dictionary mapping attribute IDs to functions to compute them. Defaults to `None`. ~~Optional[Dict[str, Callable[[str], Any]]]~~ | <add>| `strings` | A [`StringStore`](/api/stringstore) that maps strings to hash values, and vice versa, or a list of strings. ~~Union[List[str], StringStore]~~ | <add>| `lookups` | A [`Lookups`](/api/lookups) that stores the `lexeme_norm` and other large lookup tables. Defaults to `None`. ~~Optional[Lookups]~~ | <add>| `oov_prob` | The default OOV probability. Defaults to `-20.0`. ~~float~~ | <add>| `vectors_name` | A name to identify the vectors table. ~~str~~ | <add>| `writing_system` | A dictionary describing the language's writing system. Typically provided by [`Language.Defaults`](/api/language#defaults). ~~Dict[str, Any]~~ | <add>| `get_noun_chunks` | A function that yields base noun phrases used for [`Doc.noun_chunks`](/api/doc#noun_chunks). ~~Optional[Callable[[Union[Doc, Span], Iterator[Tuple[int, int, int]]]]]~~ | <ide> <ide> ## Vocab.\_\_len\_\_ {#len tag="method"} <ide> <ide> Load state from a binary string. <ide> | Name | Description | <ide> | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> | `strings` | A table managing the string-to-int mapping. ~~StringStore~~ | <del>| `vectors` <Tag variant="new">2</Tag> | A table associating word IDs to word vectors. ~~Vectors~~ | <add>| `vectors` | A table associating word IDs to word vectors. ~~Vectors~~ | <ide> | `vectors_length` | Number of dimensions for each word vector. ~~int~~ | <ide> | `lookups` | The available lookup tables in this vocab. ~~Lookups~~ | <del>| `writing_system` <Tag variant="new">2.1</Tag> | A dict with information about the language's writing system. ~~Dict[str, Any]~~ | <add>| `writing_system` | A dict with information about the language's writing system. ~~Dict[str, Any]~~ | <ide> | `get_noun_chunks` <Tag variant="new">3.0</Tag> | A function that yields base noun phrases used for [`Doc.noun_chunks`](/ap/doc#noun_chunks). ~~Optional[Callable[[Union[Doc, Span], Iterator[Tuple[int, int, int]]]]]~~ | <ide> <ide> ## Serialization fields {#serialization-fields} <ide><path>website/docs/usage/rule-based-matching.md <ide> rule-based matching are: <ide> | Attribute | Description | <ide> | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> | `ORTH` | The exact verbatim text of a token. ~~str~~ | <del>| `TEXT` <Tag variant="new">2.1</Tag> | The exact verbatim text of a token. ~~str~~ | <add>| `TEXT` | The exact verbatim text of a token. ~~str~~ | <ide> | `NORM` | The normalized form of the token text. ~~str~~ | <ide> | `LOWER` | The lowercase form of the token text. ~~str~~ | <ide> | `LENGTH` | The length of the token text. ~~int~~ | <ide> rule-based matching are: <ide> | `SPACY` | Token has a trailing space. ~~bool~~ | <ide> | `POS`, `TAG`, `MORPH`, `DEP`, `LEMMA`, `SHAPE` | The token's simple and extended part-of-speech tag, morphological analysis, dependency label, lemma, shape. Note that the values of these attributes are case-sensitive. For a list of available part-of-speech tags and dependency labels, see the [Annotation Specifications](/api/annotation). ~~str~~ | <ide> | `ENT_TYPE` | The token's entity label. ~~str~~ | <del>| `_` <Tag variant="new">2.1</Tag> | Properties in [custom extension attributes](/usage/processing-pipelines#custom-components-attributes). ~~Dict[str, Any]~~ | <add>| `_` | Properties in [custom extension attributes](/usage/processing-pipelines#custom-components-attributes). ~~Dict[str, Any]~~ | <ide> | `OP` | [Operator or quantifier](#quantifiers) to determine how often to match a token pattern. ~~str~~ | <ide> <ide> <Accordion title="Does it matter if the attribute names are uppercase or lowercase?"> <ide> scoped quantifiers – instead, you can build those behaviors with `on_match` <ide> callbacks. <ide> <ide> | OP | Description | <del>|---------|------------------------------------------------------------------------| <add>| ------- | ---------------------------------------------------------------------- | <ide> | `!` | Negate the pattern, by requiring it to match exactly 0 times. | <ide> | `?` | Make the pattern optional, by allowing it to match 0 or 1 times. | <ide> | `+` | Require the pattern to match 1 or more times. | <ide><path>website/docs/usage/saving-loading.md <ide> pipeline component factories, language classes and other settings. To make spaCy <ide> use your entry points, your package needs to expose them and it needs to be <ide> installed in the same environment – that's it. <ide> <del>| Entry point | Description | <del>| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| [`spacy_factories`](#entry-points-components) | Group of entry points for pipeline component factories, keyed by component name. Can be used to expose custom components defined by another package. | <del>| [`spacy_languages`](#entry-points-languages) | Group of entry points for custom [`Language` subclasses](/usage/linguistic-features#language-data), keyed by language shortcut. | <del>| `spacy_lookups` <Tag variant="new">2.2</Tag> | Group of entry points for custom [`Lookups`](/api/lookups), including lemmatizer data. Used by spaCy's [`spacy-lookups-data`](https://github.com/explosion/spacy-lookups-data) package. | <del>| [`spacy_displacy_colors`](#entry-points-displacy) <Tag variant="new">2.2</Tag> | Group of entry points of custom label colors for the [displaCy visualizer](/usage/visualizers#ent). The key name doesn't matter, but it should point to a dict of labels and color values. Useful for custom models that predict different entity types. | <add>| Entry point | Description | <add>| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| [`spacy_factories`](#entry-points-components) | Group of entry points for pipeline component factories, keyed by component name. Can be used to expose custom components defined by another package. | <add>| [`spacy_languages`](#entry-points-languages) | Group of entry points for custom [`Language` subclasses](/usage/linguistic-features#language-data), keyed by language shortcut. | <add>| `spacy_lookups` | Group of entry points for custom [`Lookups`](/api/lookups), including lemmatizer data. Used by spaCy's [`spacy-lookups-data`](https://github.com/explosion/spacy-lookups-data) package. | <add>| [`spacy_displacy_colors`](#entry-points-displacy) | Group of entry points of custom label colors for the [displaCy visualizer](/usage/visualizers#ent). The key name doesn't matter, but it should point to a dict of labels and color values. Useful for custom models that predict different entity types. | <ide> <ide> ### Custom components via entry points {#entry-points-components} <ide>
13
Java
Java
add type variances for dooneach actions
e42777f61bb5d7df18a0e54955cdddd3b3facf48
<ide><path>rxjava-core/src/main/java/rx/Observable.java <ide> public Observable<T> doOnEach(Observer<? super T> observer) { <ide> * @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#dooneach">RxJava Wiki: doOnEach()</a> <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229804.aspx">MSDN: Observable.Do</a> <ide> */ <del> public Observable<T> doOnEach(final Action1<T> onNext) { <add> public Observable<T> doOnEach(final Action1<? super T> onNext) { <ide> Observer<T> observer = new Observer<T>() { <ide> @Override <ide> public void onCompleted() {} <ide> public void onNext(T args) { } <ide> * @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#dooneach">RxJava Wiki: doOnEach()</a> <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229539.aspx">MSDN: Observable.Do</a> <ide> */ <del> public Observable<T> doOnEach(final Action1<T> onNext, final Action1<Throwable> onError) { <add> public Observable<T> doOnEach(final Action1<? super T> onNext, final Action1<Throwable> onError) { <ide> Observer<T> observer = new Observer<T>() { <ide> @Override <ide> public void onCompleted() {} <ide> public void onNext(T args) { <ide> * @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#dooneach">RxJava Wiki: doOnEach()</a> <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229830.aspx">MSDN: Observable.Do</a> <ide> */ <del> public Observable<T> doOnEach(final Action1<T> onNext, final Action1<Throwable> onError, final Action0 onCompleted) { <add> public Observable<T> doOnEach(final Action1<? super T> onNext, final Action1<Throwable> onError, final Action0 onCompleted) { <ide> Observer<T> observer = new Observer<T>() { <ide> @Override <ide> public void onCompleted() {
1
Python
Python
chain some exceptions.
489de42a9585615ca9962a83882896069357ab97
<ide><path>numpy/core/_dtype.py <ide> def _kind_name(dtype): <ide> try: <ide> return _kind_to_stem[dtype.kind] <del> except KeyError: <add> except KeyError as e: <ide> raise RuntimeError( <ide> "internal dtype error, unknown kind {!r}" <ide> .format(dtype.kind) <del> ) <add> ) from None <ide> <ide> <ide> def __str__(dtype): <ide><path>numpy/core/fromnumeric.py <ide> def put(a, ind, v, mode='raise'): <ide> """ <ide> try: <ide> put = a.put <del> except AttributeError: <add> except AttributeError as e: <ide> raise TypeError("argument 1 must be numpy.ndarray, " <del> "not {name}".format(name=type(a).__name__)) <add> "not {name}".format(name=type(a).__name__)) from e <ide> <ide> return put(ind, v, mode=mode) <ide> <ide><path>numpy/core/records.py <ide> def __getattribute__(self, attr): <ide> fielddict = ndarray.__getattribute__(self, 'dtype').fields <ide> try: <ide> res = fielddict[attr][:2] <del> except (TypeError, KeyError): <del> raise AttributeError("recarray has no attribute %s" % attr) <add> except (TypeError, KeyError) as e: <add> raise AttributeError("recarray has no attribute %s" % attr) from e <ide> obj = self.getfield(*res) <ide> <ide> # At this point obj will always be a recarray, since (see <ide> def __setattr__(self, attr, val): <ide> return ret <ide> try: <ide> res = fielddict[attr][:2] <del> except (TypeError, KeyError): <del> raise AttributeError("record array has no attribute %s" % attr) <add> except (TypeError, KeyError) as e: <add> raise AttributeError( <add> "record array has no attribute %s" % attr <add> ) from e <ide> return self.setfield(val, *res) <ide> <ide> def __getitem__(self, indx): <ide><path>numpy/ctypeslib.py <ide> def ndpointer(dtype=None, ndim=None, shape=None, flags=None): <ide> if num is None: <ide> try: <ide> flags = [x.strip().upper() for x in flags] <del> except Exception: <del> raise TypeError("invalid flags specification") <add> except Exception as e: <add> raise TypeError("invalid flags specification") from e <ide> num = _num_fromflags(flags) <ide> <ide> # normalize shape to an Optional[tuple] <ide> def _ctype_from_dtype_scalar(dtype): <ide> dtype_native = dtype.newbyteorder('=') <ide> try: <ide> ctype = _scalar_type_map[dtype_native] <del> except KeyError: <add> except KeyError as e: <ide> raise NotImplementedError( <ide> "Converting {!r} to a ctypes type".format(dtype) <del> ) <add> ) from None <ide> <ide> if dtype_with_endian.byteorder == '>': <ide> ctype = ctype.__ctype_be__
4
Javascript
Javascript
fix ssr usecallback in render phase
ccb14e270c3376ed47ca43c0c39722ba6bf6eced
<ide><path>packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.internal.js <ide> describe('ReactDOMServerHooks', () => { <ide> expect(domNode.tagName).toEqual('SPAN'); <ide> expect(domNode.textContent).toEqual('Count: 0'); <ide> }); <add> <add> itRenders('should support render time callbacks', async render => { <add> function Counter(props) { <add> const renderCount = useCallback(increment => { <add> return 'Count: ' + (props.count + increment); <add> }); <add> return <Text text={renderCount(3)} />; <add> } <add> const domNode = await render(<Counter count={2} />); <add> expect(clearYields()).toEqual(['Count: 5']); <add> expect(domNode.tagName).toEqual('SPAN'); <add> expect(domNode.textContent).toEqual('Count: 5'); <add> }); <ide> }); <ide> <ide> describe('useImperativeMethods', () => { <ide><path>packages/react-dom/src/server/ReactPartialRendererHooks.js <ide> function dispatchAction<A>( <ide> } <ide> <ide> function noop(): void {} <add>function identity(fn: Function): Function { <add> return fn; <add>} <ide> <ide> export let currentThreadID: ThreadID = 0; <ide> <ide> export const Dispatcher = { <ide> useState, <ide> useMutationEffect, <ide> useLayoutEffect, <add> // Callbacks are passed as they are in the server environment. <add> useCallback: identity, <ide> // useImperativeMethods is not run in the server environment <ide> useImperativeMethods: noop, <del> // Callbacks are not run in the server environment. <del> useCallback: noop, <ide> // Effects are not run in the server environment. <ide> useEffect: noop, <ide> };
2
Javascript
Javascript
keep autofocus attribute in the dom
2228f497f34e623367796a3db03d6582b36fb2f9
<ide><path>fixtures/ssr/src/components/Page.js <ide> import React, {Component} from 'react'; <ide> <ide> import './Page.css'; <ide> <add>const autofocusedInputs = [ <add> <input key="0" autoFocus placeholder="Has auto focus" />, <add> <input key="1" autoFocus placeholder="Has auto focus" />, <add>]; <add> <ide> export default class Page extends Component { <ide> state = {active: false}; <ide> handleClick = e => { <ide> export default class Page extends Component { <ide> <p suppressHydrationWarning={true}> <ide> A random number: {Math.random()} <ide> </p> <add> <p> <add> Autofocus on page load: {autofocusedInputs} <add> </p> <ide> <p> <ide> {!this.state.active ? link : 'Thanks!'} <ide> </p> <add> {this.state.active && <add> <p> <add> Autofocus on update: {autofocusedInputs} <add> </p>} <ide> </div> <ide> ); <ide> } <ide><path>src/renderers/dom/fiber/ReactDOMFiberComponent.js <ide> var registrationNameModules = EventPluginRegistry.registrationNameModules; <ide> var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML'; <ide> var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning'; <ide> var SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning'; <add>var AUTOFOCUS = 'autoFocus'; <ide> var CHILDREN = 'children'; <ide> var STYLE = 'style'; <ide> var HTML = '__html'; <ide> function setInitialDOMProperties( <ide> propKey === SUPPRESS_HYDRATION_WARNING <ide> ) { <ide> // Noop <add> } else if (propKey === AUTOFOCUS) { <add> // We polyfill it separately on the client during commit. <add> // We blacklist it here rather than in the property list because we emit it in SSR. <ide> } else if (registrationNameModules.hasOwnProperty(propKey)) { <ide> if (nextProp != null) { <ide> if (__DEV__ && typeof nextProp !== 'function') { <ide> var ReactDOMFiberComponent = { <ide> propKey === SUPPRESS_HYDRATION_WARNING <ide> ) { <ide> // Noop <add> } else if (propKey === AUTOFOCUS) { <add> // Noop. It doesn't work on updates anyway. <ide> } else if (registrationNameModules.hasOwnProperty(propKey)) { <ide> // This is a special case. If any listener updates we need to ensure <ide> // that the "current" fiber pointer gets updated so we need a commit <ide><path>src/renderers/dom/shared/DOMProperty.js <ide> var invariant = require('fbjs/lib/invariant'); <ide> var RESERVED_PROPS = { <ide> children: true, <ide> dangerouslySetInnerHTML: true, <del> autoFocus: true, <ide> defaultValue: true, <ide> defaultChecked: true, <ide> innerHTML: true, <ide><path>src/renderers/dom/shared/HTMLDOMPropertyConfig.js <ide> var HTMLDOMPropertyConfig = { <ide> // name warnings. <ide> Properties: { <ide> allowFullScreen: HAS_BOOLEAN_VALUE, <add> autoFocus: HAS_STRING_BOOLEAN_VALUE, <ide> // specifies target context for links with `preload` type <ide> async: HAS_BOOLEAN_VALUE, <ide> // autoFocus is polyfilled/normalized by AutoFocusUtils <ide><path>src/renderers/dom/shared/__tests__/ReactServerRendering-test.js <ide> describe('ReactDOMServer', () => { <ide> expect(numClicks).toEqual(2); <ide> }); <ide> <add> // We have a polyfill for autoFocus on the client, but we intentionally don't <add> // want it to call focus() when hydrating because this can mess up existing <add> // focus before the JS has loaded. <add> it('should emit autofocus on the server but not focus() when hydrating', () => { <add> var element = document.createElement('div'); <add> element.innerHTML = ReactDOMServer.renderToString( <add> <input autoFocus={true} />, <add> ); <add> expect(element.firstChild.autofocus).toBe(true); <add> <add> // It should not be called on mount. <add> element.firstChild.focus = jest.fn(); <add> ReactDOM.hydrate(<input autoFocus={true} />, element); <add> expect(element.firstChild.focus).not.toHaveBeenCalled(); <add> <add> // Or during an update. <add> ReactDOM.render(<input autoFocus={true} />, element); <add> expect(element.firstChild.focus).not.toHaveBeenCalled(); <add> }); <add> <ide> it('should throw with silly args', () => { <ide> expect( <ide> ReactDOMServer.renderToString.bind(ReactDOMServer, {x: 123}),
5
Ruby
Ruby
simplify conditional as suggested
76607bbb6fae52fcd32cda339c22121c3e0a23ec
<ide><path>Library/Homebrew/dev-cmd/bottle.rb <ide> bottle do <ide> <% if [HOMEBREW_BOTTLE_DEFAULT_DOMAIN.to_s, <ide> "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}/bottles"].exclude?(root_url) %> <del> root_url "<%= root_url %>"<% unless download_strategy.blank? %>, <add> root_url "<%= root_url %>"<% if download_strategy.present? %>, <ide> using: <%= download_strategy %> <ide> <% end %> <ide> <% end %>
1
Text
Text
fix typo in contributing.md
30c93b4a9521e74f7cffe7faa04eee2b4f7f1bd9
<ide><path>CONTRIBUTING.md <ide> Example: <ide> > 2. This is the second step <ide> > 3. Further steps, etc. <ide> > <del>> Screenshot (if usefull) <add>> Screenshot (if useful) <ide> > <ide> > Any other information you want to share that is relevant to the issue being <ide> > reported. This might include the lines of code that you have identified as
1
PHP
PHP
fix php cs
94e55961871d1f0be8869efecb55e5089de26dc0
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function lists($column, $key = null) <ide> */ <ide> public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) <ide> { <del> if( $perPage <= 0) { <add> if ($perPage <= 0) { <ide> throw new InvalidArgumentException("Negative values can't be used to query results"); <ide> } <ide>
1
Javascript
Javascript
fix modren typo
7b1de1ea2f58e16b42cf76882369ccfe2ab91b5c
<ide><path>common/app/routes/Challenges/utils/index.js <ide> export const viewTypes = { <ide> [ challengeTypes.bonfire ]: 'classic', <ide> [ challengeTypes.frontEndProject ]: 'project', <ide> [ challengeTypes.backEndProject ]: 'project', <del> [ challengeTypes.modern ]: 'modren', <add> [ challengeTypes.modern ]: 'modern', <ide> [ challengeTypes.step ]: 'step', <ide> [ challengeTypes.quiz ]: 'quiz', <ide> [ challengeTypes.backend ]: 'backend'
1
Python
Python
fix missing return
7fbac39e5e1715fea4dd51fee79554e789447bd2
<ide><path>numpy/linalg/linalg.py <ide> def cholesky(a): <ide> s = triu(a, k=0).transpose() <ide> if (s.dtype != result_t): <ide> return s.astype(result_t) <add> return s <ide> <ide> # Eigenvalues <ide> def eigvals(a):
1
Ruby
Ruby
extract checkout from #stage
02ad6442e771d63a365cd9502e1c994780a1b12b
<ide><path>Library/Homebrew/download_strategy.rb <ide> def fetch <ide> Dir.chdir(@clone) do <ide> config_repo <ide> fetch_repo <add> checkout <add> update_submodules if submodules? <ide> end <ide> elsif @clone.exist? <ide> puts "Removing invalid .git repo from cache" <ide> def stage <ide> Dir.chdir @clone do <ide> if @spec and @ref <ide> ohai "Checking out #@spec #@ref" <del> case @spec <del> when :branch <del> nostdout { quiet_safe_system @@git, 'checkout', { :quiet_flag => '-q' }, "origin/#{@ref}", '--' } <del> when :tag, :revision <del> nostdout { quiet_safe_system @@git, 'checkout', { :quiet_flag => '-q' }, @ref, '--' } <del> end <ide> else <ide> # otherwise the checkout-index won't checkout HEAD <ide> # https://github.com/mxcl/homebrew/issues/7124 <ide> def fetch_repo <ide> <ide> def clone_repo <ide> safe_system @@git, *clone_args <add> @clone.cd do <add> checkout <add> update_submodules if submodules? <add> end <add> end <add> <add> def checkout <add> ref = case @spec <add> when :branch then "origin/#@ref" <add> when :tag, :revision then @ref <add> end <add> <add> nostdout do <add> quiet_safe_system @@git, 'checkout', { :quiet_flag => '-q' }, ref, '--' <add> end <ide> end <ide> <ide> def update_submodules
1
Text
Text
fix broken links in image.md
e4a9f09d45541399627730b9bae353780e386f2a
<ide><path>docs/api-reference/next/image.md <ide> When using `layout="intrinsic"`, `layout="fixed"`, or `layout="raw"`, the `width <ide> <ide> When using `layout="responsive"`, `layout="fill"`, the `width` property represents the _original_ width in pixels, so it will only affect the aspect ratio. <ide> <del>The `width` property is required, except for [statically imported images](#local-images), or those with `layout="fill"`. <add>The `width` property is required, except for [statically imported images](/docs/basic-features/image-optimization.md#local-images), or those with `layout="fill"`. <ide> <ide> ### height <ide> <ide> When using `layout="intrinsic"`, `layout="fixed"`, or `layout="raw"`, the `heigh <ide> <ide> When using `layout="responsive"`, `layout="fill"`, the `height` property represents the _original_ height in pixels, so it will only affect the aspect ratio. <ide> <del>The `height` property is required, except for [statically imported images](#local-images), or those with `layout="fill"`. <add>The `height` property is required, except for [statically imported images](/docs/basic-features/image-optimization.md#local-images), or those with `layout="fill"`. <ide> <ide> ## Optional Props <ide>
1
Mixed
Go
add formatter for service inspect
54ba82beab8ef8b71f5a6a2f7082ed7759b40df3
<ide><path>cli/command/formatter/formatter.go <ide> import ( <ide> "github.com/docker/docker/utils/templates" <ide> ) <ide> <add>// Format keys used to specify certain kinds of output formats <ide> const ( <del> // TableFormatKey is the key used to format as a table <del> TableFormatKey = "table" <del> // RawFormatKey is the key used to format as raw JSON <del> RawFormatKey = "raw" <add> TableFormatKey = "table" <add> RawFormatKey = "raw" <add> PrettyFormatKey = "pretty" <ide> <ide> defaultQuietFormat = "{{.ID}}" <ide> ) <ide><path>cli/command/formatter/service.go <add>package formatter <add> <add>import ( <add> "fmt" <add> "strings" <add> "time" <add> <add> mounttypes "github.com/docker/docker/api/types/mount" <add> "github.com/docker/docker/api/types/swarm" <add> "github.com/docker/docker/cli/command/inspect" <add> units "github.com/docker/go-units" <add>) <add> <add>const serviceInspectPrettyTemplate Format = ` <add>ID: {{.ID}} <add>Name: {{.Name}} <add>{{- if .Labels }} <add>Labels: <add>{{- range $k, $v := .Labels }} <add> {{ $k }}{{if $v }}={{ $v }}{{ end }} <add>{{- end }}{{ end }} <add>Mode: <add>{{- if .IsModeGlobal }} Global <add>{{- else }} Replicated <add>{{- if .ModeReplicatedReplicas }} <add> Replicas: {{ .ModeReplicatedReplicas }} <add>{{- end }}{{ end }} <add>{{- if .HasUpdateStatus }} <add>UpdateStatus: <add> State: {{ .UpdateStatusState }} <add> Started: {{ .UpdateStatusStarted }} <add>{{- if .UpdateIsCompleted }} <add> Completed: {{ .UpdateStatusCompleted }} <add>{{- end }} <add> Message: {{ .UpdateStatusMessage }} <add>{{- end }} <add>Placement: <add>{{- if .TaskPlacementConstraints -}} <add> Contraints: {{ .TaskPlacementConstraints }} <add>{{- end }} <add>{{- if .HasUpdateConfig }} <add>UpdateConfig: <add> Parallelism: {{ .UpdateParallelism }} <add>{{- if .HasUpdateDelay -}} <add> Delay: {{ .UpdateDelay }} <add>{{- end }} <add> On failure: {{ .UpdateOnFailure }} <add>{{- end }} <add>ContainerSpec: <add> Image: {{ .ContainerImage }} <add>{{- if .ContainerArgs }} <add> Args: {{ range $arg := .ContainerArgs }}{{ $arg }} {{ end }} <add>{{- end -}} <add>{{- if .ContainerEnv }} <add> Env: {{ range $env := .ContainerEnv }}{{ $env }} {{ end }} <add>{{- end -}} <add>{{- if .ContainerWorkDir }} <add> Dir: {{ .ContainerWorkDir }} <add>{{- end -}} <add>{{- if .ContainerUser }} <add> User: {{ .ContainerUser }} <add>{{- end }} <add>{{- if .ContainerMounts }} <add>Mounts: <add>{{- end }} <add>{{- range $mount := .ContainerMounts }} <add> Target = {{ $mount.Target }} <add> Source = {{ $mount.Source }} <add> ReadOnly = {{ $mount.ReadOnly }} <add> Type = {{ $mount.Type }} <add>{{- end -}} <add>{{- if .HasResources }} <add>Resources: <add>{{- if .HasResourceReservations }} <add> Reservations: <add>{{- end }} <add>{{- if gt .ResourceReservationNanoCPUs 0.0 }} <add> CPU: {{ .ResourceReservationNanoCPUs }} <add>{{- end }} <add>{{- if .ResourceReservationMemory }} <add> Memory: {{ .ResourceReservationMemory }} <add>{{- end }} <add>{{- if .HasResourceLimits }} <add> Limits: <add>{{- end }} <add>{{- if gt .ResourceLimitsNanoCPUs 0.0 }} <add> CPU: {{ .ResourceLimitsNanoCPUs }} <add>{{- end }} <add>{{- if .ResourceLimitMemory }} <add> Memory: {{ .ResourceLimitMemory }} <add>{{- end }}{{ end }} <add>{{- if .Networks }} <add>Networks: <add>{{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }} <add>{{- if .Ports }} <add>Ports: <add>{{- range $port := .Ports }} <add> PublishedPort {{ $port.PublishedPort }} <add> Protocol = {{ $port.Protocol }} <add> TargetPort = {{ $port.TargetPort }} <add>{{- end }} {{ end -}} <add>` <add> <add>// NewServiceFormat returns a Format for rendering using a Context <add>func NewServiceFormat(source string) Format { <add> switch source { <add> case PrettyFormatKey: <add> return serviceInspectPrettyTemplate <add> default: <add> return Format(strings.TrimPrefix(source, RawFormatKey)) <add> } <add>} <add> <add>// ServiceInspectWrite renders the context for a list of services <add>func ServiceInspectWrite(ctx Context, refs []string, getRef inspect.GetRefFunc) error { <add> if ctx.Format != serviceInspectPrettyTemplate { <add> return inspect.Inspect(ctx.Output, refs, string(ctx.Format), getRef) <add> } <add> render := func(format func(subContext subContext) error) error { <add> for _, ref := range refs { <add> serviceI, _, err := getRef(ref) <add> if err != nil { <add> return err <add> } <add> service, ok := serviceI.(swarm.Service) <add> if !ok { <add> return fmt.Errorf("got wrong object to inspect") <add> } <add> if err := format(&serviceInspectContext{Service: service}); err != nil { <add> return err <add> } <add> } <add> return nil <add> } <add> return ctx.Write(&serviceInspectContext{}, render) <add>} <add> <add>type serviceInspectContext struct { <add> swarm.Service <add> subContext <add>} <add> <add>func (ctx *serviceInspectContext) ID() string { <add> return ctx.Service.ID <add>} <add> <add>func (ctx *serviceInspectContext) Name() string { <add> return ctx.Service.Spec.Name <add>} <add> <add>func (ctx *serviceInspectContext) Labels() map[string]string { <add> return ctx.Service.Spec.Labels <add>} <add> <add>func (ctx *serviceInspectContext) IsModeGlobal() bool { <add> return ctx.Service.Spec.Mode.Global != nil <add>} <add> <add>func (ctx *serviceInspectContext) ModeReplicatedReplicas() *uint64 { <add> return ctx.Service.Spec.Mode.Replicated.Replicas <add>} <add> <add>func (ctx *serviceInspectContext) HasUpdateStatus() bool { <add> return ctx.Service.UpdateStatus.State != "" <add>} <add> <add>func (ctx *serviceInspectContext) UpdateStatusState() swarm.UpdateState { <add> return ctx.Service.UpdateStatus.State <add>} <add> <add>func (ctx *serviceInspectContext) UpdateStatusStarted() string { <add> return units.HumanDuration(time.Since(ctx.Service.UpdateStatus.StartedAt)) <add>} <add> <add>func (ctx *serviceInspectContext) UpdateIsCompleted() bool { <add> return ctx.Service.UpdateStatus.State == swarm.UpdateStateCompleted <add>} <add> <add>func (ctx *serviceInspectContext) UpdateStatusCompleted() string { <add> return units.HumanDuration(time.Since(ctx.Service.UpdateStatus.CompletedAt)) <add>} <add> <add>func (ctx *serviceInspectContext) UpdateStatusMessage() string { <add> return ctx.Service.UpdateStatus.Message <add>} <add> <add>func (ctx *serviceInspectContext) TaskPlacementConstraints() []string { <add> if ctx.Service.Spec.TaskTemplate.Placement != nil { <add> return ctx.Service.Spec.TaskTemplate.Placement.Constraints <add> } <add> return nil <add>} <add> <add>func (ctx *serviceInspectContext) HasUpdateConfig() bool { <add> return ctx.Service.Spec.UpdateConfig != nil <add>} <add> <add>func (ctx *serviceInspectContext) UpdateParallelism() uint64 { <add> return ctx.Service.Spec.UpdateConfig.Parallelism <add>} <add> <add>func (ctx *serviceInspectContext) HasUpdateDelay() bool { <add> return ctx.Service.Spec.UpdateConfig.Delay.Nanoseconds() > 0 <add>} <add> <add>func (ctx *serviceInspectContext) UpdateDelay() time.Duration { <add> return ctx.Service.Spec.UpdateConfig.Delay <add>} <add> <add>func (ctx *serviceInspectContext) UpdateOnFailure() string { <add> return ctx.Service.Spec.UpdateConfig.FailureAction <add>} <add> <add>func (ctx *serviceInspectContext) ContainerImage() string { <add> return ctx.Service.Spec.TaskTemplate.ContainerSpec.Image <add>} <add> <add>func (ctx *serviceInspectContext) ContainerArgs() []string { <add> return ctx.Service.Spec.TaskTemplate.ContainerSpec.Args <add>} <add> <add>func (ctx *serviceInspectContext) ContainerEnv() []string { <add> return ctx.Service.Spec.TaskTemplate.ContainerSpec.Env <add>} <add> <add>func (ctx *serviceInspectContext) ContainerWorkDir() string { <add> return ctx.Service.Spec.TaskTemplate.ContainerSpec.Dir <add>} <add> <add>func (ctx *serviceInspectContext) ContainerUser() string { <add> return ctx.Service.Spec.TaskTemplate.ContainerSpec.User <add>} <add> <add>func (ctx *serviceInspectContext) ContainerMounts() []mounttypes.Mount { <add> return ctx.Service.Spec.TaskTemplate.ContainerSpec.Mounts <add>} <add> <add>func (ctx *serviceInspectContext) HasResources() bool { <add> return ctx.Service.Spec.TaskTemplate.Resources != nil <add>} <add> <add>func (ctx *serviceInspectContext) HasResourceReservations() bool { <add> return ctx.Service.Spec.TaskTemplate.Resources.Reservations.NanoCPUs > 0 || ctx.Service.Spec.TaskTemplate.Resources.Reservations.MemoryBytes > 0 <add>} <add> <add>func (ctx *serviceInspectContext) ResourceReservationNanoCPUs() float64 { <add> if ctx.Service.Spec.TaskTemplate.Resources.Reservations.NanoCPUs == 0 { <add> return float64(0) <add> } <add> return float64(ctx.Service.Spec.TaskTemplate.Resources.Reservations.NanoCPUs) / 1e9 <add>} <add> <add>func (ctx *serviceInspectContext) ResourceReservationMemory() string { <add> if ctx.Service.Spec.TaskTemplate.Resources.Reservations.MemoryBytes == 0 { <add> return "" <add> } <add> return units.BytesSize(float64(ctx.Service.Spec.TaskTemplate.Resources.Reservations.MemoryBytes)) <add>} <add> <add>func (ctx *serviceInspectContext) HasResourceLimits() bool { <add> return ctx.Service.Spec.TaskTemplate.Resources.Limits.NanoCPUs > 0 || ctx.Service.Spec.TaskTemplate.Resources.Limits.MemoryBytes > 0 <add>} <add> <add>func (ctx *serviceInspectContext) ResourceLimitsNanoCPUs() float64 { <add> return float64(ctx.Service.Spec.TaskTemplate.Resources.Limits.NanoCPUs) / 1e9 <add>} <add> <add>func (ctx *serviceInspectContext) ResourceLimitMemory() string { <add> if ctx.Service.Spec.TaskTemplate.Resources.Limits.MemoryBytes == 0 { <add> return "" <add> } <add> return units.BytesSize(float64(ctx.Service.Spec.TaskTemplate.Resources.Limits.MemoryBytes)) <add>} <add> <add>func (ctx *serviceInspectContext) Networks() []string { <add> var out []string <add> for _, n := range ctx.Service.Spec.Networks { <add> out = append(out, n.Target) <add> } <add> return out <add>} <add> <add>func (ctx *serviceInspectContext) Ports() []swarm.PortConfig { <add> return ctx.Service.Endpoint.Ports <add>} <ide><path>cli/command/service/inspect.go <ide> package service <ide> <ide> import ( <ide> "fmt" <del> "io" <ide> "strings" <del> "time" <ide> <ide> "golang.org/x/net/context" <ide> <del> "github.com/docker/docker/api/types/swarm" <ide> "github.com/docker/docker/cli" <ide> "github.com/docker/docker/cli/command" <del> "github.com/docker/docker/cli/command/inspect" <add> "github.com/docker/docker/cli/command/formatter" <ide> apiclient "github.com/docker/docker/client" <del> "github.com/docker/docker/pkg/ioutils" <del> "github.com/docker/go-units" <ide> "github.com/spf13/cobra" <ide> ) <ide> <ide> func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error { <ide> client := dockerCli.Client() <ide> ctx := context.Background() <ide> <add> if opts.pretty { <add> opts.format = "pretty" <add> } <add> <ide> getRef := func(ref string) (interface{}, []byte, error) { <ide> service, _, err := client.ServiceInspectWithRaw(ctx, ref) <ide> if err == nil || !apiclient.IsErrServiceNotFound(err) { <ide> func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error { <ide> return nil, nil, fmt.Errorf("Error: no such service: %s", ref) <ide> } <ide> <del> if !opts.pretty { <del> return inspect.Inspect(dockerCli.Out(), opts.refs, opts.format, getRef) <del> } <del> <del> return printHumanFriendly(dockerCli.Out(), opts.refs, getRef) <del>} <del> <del>func printHumanFriendly(out io.Writer, refs []string, getRef inspect.GetRefFunc) error { <del> for idx, ref := range refs { <del> obj, _, err := getRef(ref) <del> if err != nil { <del> return err <del> } <del> printService(out, obj.(swarm.Service)) <del> <del> // TODO: better way to do this? <del> // print extra space between objects, but not after the last one <del> if idx+1 != len(refs) { <del> fmt.Fprintf(out, "\n\n") <del> } <del> } <del> return nil <del>} <del> <del>// TODO: use a template <del>func printService(out io.Writer, service swarm.Service) { <del> fmt.Fprintf(out, "ID:\t\t%s\n", service.ID) <del> fmt.Fprintf(out, "Name:\t\t%s\n", service.Spec.Name) <del> if service.Spec.Labels != nil { <del> fmt.Fprintln(out, "Labels:") <del> for k, v := range service.Spec.Labels { <del> fmt.Fprintf(out, " - %s=%s\n", k, v) <del> } <del> } <del> <del> if service.Spec.Mode.Global != nil { <del> fmt.Fprintln(out, "Mode:\t\tGlobal") <del> } else { <del> fmt.Fprintln(out, "Mode:\t\tReplicated") <del> if service.Spec.Mode.Replicated.Replicas != nil { <del> fmt.Fprintf(out, " Replicas:\t%d\n", *service.Spec.Mode.Replicated.Replicas) <del> } <del> } <del> <del> if service.UpdateStatus.State != "" { <del> fmt.Fprintln(out, "Update status:") <del> fmt.Fprintf(out, " State:\t\t%s\n", service.UpdateStatus.State) <del> fmt.Fprintf(out, " Started:\t%s ago\n", strings.ToLower(units.HumanDuration(time.Since(service.UpdateStatus.StartedAt)))) <del> if service.UpdateStatus.State == swarm.UpdateStateCompleted { <del> fmt.Fprintf(out, " Completed:\t%s ago\n", strings.ToLower(units.HumanDuration(time.Since(service.UpdateStatus.CompletedAt)))) <del> } <del> fmt.Fprintf(out, " Message:\t%s\n", service.UpdateStatus.Message) <del> } <del> <del> fmt.Fprintln(out, "Placement:") <del> if service.Spec.TaskTemplate.Placement != nil && len(service.Spec.TaskTemplate.Placement.Constraints) > 0 { <del> ioutils.FprintfIfNotEmpty(out, " Constraints\t: %s\n", strings.Join(service.Spec.TaskTemplate.Placement.Constraints, ", ")) <del> } <del> if service.Spec.UpdateConfig != nil { <del> fmt.Fprintf(out, "UpdateConfig:\n") <del> fmt.Fprintf(out, " Parallelism:\t%d\n", service.Spec.UpdateConfig.Parallelism) <del> if service.Spec.UpdateConfig.Delay.Nanoseconds() > 0 { <del> fmt.Fprintf(out, " Delay:\t\t%s\n", service.Spec.UpdateConfig.Delay) <add> f := opts.format <add> if len(f) == 0 { <add> f = "raw" <add> if len(dockerCli.ConfigFile().ServiceInspectFormat) > 0 { <add> f = dockerCli.ConfigFile().ServiceInspectFormat <ide> } <del> fmt.Fprintf(out, " On failure:\t%s\n", service.Spec.UpdateConfig.FailureAction) <ide> } <ide> <del> fmt.Fprintf(out, "ContainerSpec:\n") <del> printContainerSpec(out, service.Spec.TaskTemplate.ContainerSpec) <del> <del> resources := service.Spec.TaskTemplate.Resources <del> if resources != nil { <del> fmt.Fprintln(out, "Resources:") <del> printResources := func(out io.Writer, requirement string, r *swarm.Resources) { <del> if r == nil || (r.MemoryBytes == 0 && r.NanoCPUs == 0) { <del> return <del> } <del> fmt.Fprintf(out, " %s:\n", requirement) <del> if r.NanoCPUs != 0 { <del> fmt.Fprintf(out, " CPU:\t\t%g\n", float64(r.NanoCPUs)/1e9) <del> } <del> if r.MemoryBytes != 0 { <del> fmt.Fprintf(out, " Memory:\t%s\n", units.BytesSize(float64(r.MemoryBytes))) <del> } <del> } <del> printResources(out, "Reservations", resources.Reservations) <del> printResources(out, "Limits", resources.Limits) <del> } <del> if len(service.Spec.Networks) > 0 { <del> fmt.Fprintf(out, "Networks:") <del> for _, n := range service.Spec.Networks { <del> fmt.Fprintf(out, " %s", n.Target) <del> } <del> fmt.Fprintln(out, "") <add> // check if the user is trying to apply a template to the pretty format, which <add> // is not supported <add> if strings.HasPrefix(f, "pretty") && f != "pretty" { <add> return fmt.Errorf("Cannot supply extra formatting options to the pretty template") <ide> } <ide> <del> if len(service.Endpoint.Ports) > 0 { <del> fmt.Fprintln(out, "Ports:") <del> for _, port := range service.Endpoint.Ports { <del> ioutils.FprintfIfNotEmpty(out, " Name = %s\n", port.Name) <del> fmt.Fprintf(out, " Protocol = %s\n", port.Protocol) <del> fmt.Fprintf(out, " TargetPort = %d\n", port.TargetPort) <del> fmt.Fprintf(out, " PublishedPort = %d\n", port.PublishedPort) <del> } <add> serviceCtx := formatter.Context{ <add> Output: dockerCli.Out(), <add> Format: formatter.NewServiceFormat(f), <ide> } <del>} <ide> <del>func printContainerSpec(out io.Writer, containerSpec swarm.ContainerSpec) { <del> fmt.Fprintf(out, " Image:\t\t%s\n", containerSpec.Image) <del> if len(containerSpec.Args) > 0 { <del> fmt.Fprintf(out, " Args:\t\t%s\n", strings.Join(containerSpec.Args, " ")) <del> } <del> if len(containerSpec.Env) > 0 { <del> fmt.Fprintf(out, " Env:\t\t%s\n", strings.Join(containerSpec.Env, " ")) <del> } <del> ioutils.FprintfIfNotEmpty(out, " Dir\t\t%s\n", containerSpec.Dir) <del> ioutils.FprintfIfNotEmpty(out, " User\t\t%s\n", containerSpec.User) <del> if len(containerSpec.Mounts) > 0 { <del> fmt.Fprintln(out, " Mounts:") <del> for _, v := range containerSpec.Mounts { <del> fmt.Fprintf(out, " Target = %s\n", v.Target) <del> fmt.Fprintf(out, " Source = %s\n", v.Source) <del> fmt.Fprintf(out, " ReadOnly = %v\n", v.ReadOnly) <del> fmt.Fprintf(out, " Type = %v\n", v.Type) <del> } <add> if err := formatter.ServiceInspectWrite(serviceCtx, opts.refs, getRef); err != nil { <add> return cli.StatusError{StatusCode: 1, Status: err.Error()} <ide> } <add> return nil <ide> } <ide><path>cli/command/service/inspect_test.go <ide> import ( <ide> "time" <ide> <ide> "github.com/docker/docker/api/types/swarm" <add> "github.com/docker/docker/cli/command/formatter" <ide> ) <ide> <ide> func TestPrettyPrintWithNoUpdateConfig(t *testing.T) { <ide> func TestPrettyPrintWithNoUpdateConfig(t *testing.T) { <ide> }, <ide> } <ide> <del> printService(b, s) <add> ctx := formatter.Context{ <add> Output: b, <add> Format: formatter.NewServiceFormat("pretty"), <add> } <add> <add> err := formatter.ServiceInspectWrite(ctx, []string{"de179gar9d0o7ltdybungplod"}, func(ref string) (interface{}, []byte, error) { <add> return s, nil, nil <add> }) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <ide> if strings.Contains(b.String(), "UpdateStatus") { <ide> t.Fatal("Pretty print failed before parsing UpdateStatus") <ide> } <ide><path>cliconfig/configfile/file.go <ide> const ( <ide> <ide> // ConfigFile ~/.docker/config.json file info <ide> type ConfigFile struct { <del> AuthConfigs map[string]types.AuthConfig `json:"auths"` <del> HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` <del> PsFormat string `json:"psFormat,omitempty"` <del> ImagesFormat string `json:"imagesFormat,omitempty"` <del> NetworksFormat string `json:"networksFormat,omitempty"` <del> VolumesFormat string `json:"volumesFormat,omitempty"` <del> DetachKeys string `json:"detachKeys,omitempty"` <del> CredentialsStore string `json:"credsStore,omitempty"` <del> Filename string `json:"-"` // Note: for internal use only <add> AuthConfigs map[string]types.AuthConfig `json:"auths"` <add> HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` <add> PsFormat string `json:"psFormat,omitempty"` <add> ImagesFormat string `json:"imagesFormat,omitempty"` <add> NetworksFormat string `json:"networksFormat,omitempty"` <add> VolumesFormat string `json:"volumesFormat,omitempty"` <add> DetachKeys string `json:"detachKeys,omitempty"` <add> CredentialsStore string `json:"credsStore,omitempty"` <add> Filename string `json:"-"` // Note: for internal use only <add> ServiceInspectFormat string `json:"serviceInspectFormat,omitempty"` <ide> } <ide> <ide> // LegacyLoadFromReader reads the non-nested configuration data given and sets up the <ide><path>docs/reference/commandline/cli.md <ide> Docker's client uses this property. If this property is not set, the client <ide> falls back to the default table format. For a list of supported formatting <ide> directives, see the [**Formatting** section in the `docker images` documentation](images.md) <ide> <add>The property `serviceInspectFormat` specifies the default format for `docker <add>service inspect` output. When the `--format` flag is not provided with the <add>`docker service inspect` command, Docker's client uses this property. If this <add>property is not set, the client falls back to the default json format. For a <add>list of supported formatting directives, see the <add>[**Formatting** section in the `docker service inspect` documentation](service_inspect.md) <add> <ide> Following is a sample `config.json` file: <ide> <ide> { <ide> Following is a sample `config.json` file: <ide> }, <ide> "psFormat": "table {{.ID}}\\t{{.Image}}\\t{{.Command}}\\t{{.Labels}}", <ide> "imagesFormat": "table {{.ID}}\\t{{.Repository}}\\t{{.Tag}}\\t{{.CreatedAt}}", <add> "serviceInspectFormat": "pretty", <ide> "detachKeys": "ctrl-e,e" <ide> } <ide> <ide><path>docs/reference/commandline/service_inspect.md <ide> Ports: <ide> PublishedPort = 4443 <ide> ``` <ide> <add>You can also use `--format pretty` for the same effect. <add> <ide> <ide> ### Finding the number of tasks running as part of a service <ide>
7
Python
Python
update tokenizer.explain tests
2e7c896fe5541c188b9e9984210687e57cef614c
<ide><path>spacy/tests/tokenizer/test_explain.py <ide> # coding: utf-8 <ide> from __future__ import unicode_literals <ide> <del>import importlib <ide> import pytest <ide> from spacy.util import get_lang_class <ide> <del> <del># fmt: off <ide> # Only include languages with no external dependencies <del># excluded: ja, ru, th, uk, vi, zh <del>LANGUAGES = ["af", "ar", "bg", "bn", "ca", "cs", "da", "de", "el", "en", "es", <del> "et", "fa", "fi", "fr", "ga", "he", "hi", "hr", "hu", "id", "is", <del> "it", "kn", "lt", "lv", "nb", "nl", "pl", "pt", "ro", "si", "sk", <del> "sl", "sq", "sr", "sv", "ta", "te", "tl", "tr", "tt", "ur"] <del># fmt: on <del> <add># "is" seems to confuse importlib, so we're also excluding it for now <add># excluded: ja, ru, th, uk, vi, zh, is <add>LANGUAGES = [ <add> "af", <add> "ar", <add> "bg", <add> "bn", <add> pytest.param("ca", marks=pytest.mark.xfail()), <add> "cs", <add> "da", <add> "de", <add> "el", <add> "en", <add> "es", <add> "et", <add> "fa", <add> "fi", <add> pytest.param("fr", marks=pytest.mark.xfail()), <add> "ga", <add> "he", <add> "hi", <add> "hr", <add> pytest.param("hu", marks=pytest.mark.xfail()), <add> "id", <add> "it", <add> "kn", <add> "lt", <add> "lv", <add> "nb", <add> "nl", <add> pytest.param("pl", marks=pytest.mark.xfail()), <add> "pt", <add> "ro", <add> "si", <add> "sk", <add> "sl", <add> "sq", <add> "sr", <add> "sv", <add> "ta", <add> "te", <add> "tl", <add> "tr", <add> "tt", <add> "ur", <add>] <ide> <del>@pytest.mark.slow <add># @pytest.mark.slow <ide> @pytest.mark.parametrize("lang", LANGUAGES) <ide> def test_tokenizer_explain(lang): <ide> nlp = get_lang_class(lang)() <del> try: <del> examples = importlib.import_module("spacy.lang." + lang + ".examples") <del> for sentence in examples.sentences: <del> tokens = [t.text for t in nlp.tokenizer(sentence) if not t.is_space] <del> debug_tokens = [t[1] for t in nlp.tokenizer.explain(sentence)] <del> assert tokens == debug_tokens <del> except: <del> pass <add> examples = pytest.importorskip("spacy.lang.{}.examples".format(lang)) <add> for sentence in examples.sentences: <add> tokens = [t.text for t in nlp.tokenizer(sentence) if not t.is_space] <add> debug_tokens = [t[1] for t in nlp.tokenizer.explain(sentence)] <add> assert tokens == debug_tokens
1
Ruby
Ruby
increase readall test timeout
ec81d43519e9d334f994c8dc10fdba17779def82
<ide><path>Library/Homebrew/test/cmd/readall_spec.rb <ide> it_behaves_like "parseable arguments" <ide> end <ide> <del>describe "brew readall", :integration_test, timeout: 180 do <add>describe "brew readall", :integration_test, timeout: 240 do <ide> it "imports all Formulae for a given Tap" do <ide> formula_file = setup_test_formula "testball" <ide>
1
Javascript
Javascript
remove morph target changes
6406684fdfd294f7523c05fe2967727a6dd368e8
<ide><path>examples/js/loaders/FBXLoader.js <ide> THREE.FBXLoader = ( function () { <ide> <ide> }, <ide> <add> <ide> // Parse single node mesh geometry in FBXTree.Objects.Geometry <ide> parseMeshGeometry: function ( relationships, geoNode, deformers ) { <ide> <ide> var skeletons = deformers.skeletons; <del> var morphTargets = []; <add> var morphTargets = deformers.morphTargets; <ide> <ide> var modelNodes = relationships.parents.map( function ( parent ) { <ide> <ide> THREE.FBXLoader = ( function () { <ide> <ide> }, null ); <ide> <del> relationships.children.forEach( function( child ) { <del> <del> if ( deformers.morphTargets[ child.ID ] !== undefined ) { <add> var morphTarget = relationships.children.reduce( function ( morphTarget, child ) { <ide> <del> morphTargets.push( deformers.morphTargets[ child.ID ] ); <add> if ( morphTargets[ child.ID ] !== undefined ) morphTarget = morphTargets[ child.ID ]; <ide> <del> } <add> return morphTarget; <ide> <del> } ); <add> }, null ); <ide> <ide> // Assume one model and get the preRotation from that <ide> // if there is more than one model associated with the geometry this may cause problems <ide> THREE.FBXLoader = ( function () { <ide> <ide> var transform = generateTransform( transformData ); <ide> <del> return this.genGeometry( geoNode, skeleton, morphTargets, transform ); <add> return this.genGeometry( geoNode, skeleton, morphTarget, transform ); <ide> <ide> }, <ide> <ide> // Generate a THREE.BufferGeometry from a node in FBXTree.Objects.Geometry <del> genGeometry: function ( geoNode, skeleton, morphTargets, preTransform ) { <add> genGeometry: function ( geoNode, skeleton, morphTarget, preTransform ) { <ide> <ide> var geo = new THREE.BufferGeometry(); <ide> if ( geoNode.attrName ) geo.name = geoNode.attrName; <ide> THREE.FBXLoader = ( function () { <ide> <ide> } <ide> <del> this.addMorphTargets( geo, geoNode, morphTargets, preTransform ); <add> this.addMorphTargets( geo, geoNode, morphTarget, preTransform ); <ide> <ide> return geo; <ide> <ide> THREE.FBXLoader = ( function () { <ide> <ide> }, <ide> <del> addMorphTargets: function ( parentGeo, parentGeoNode, morphTargets, preTransform ) { <add> addMorphTargets: function ( parentGeo, parentGeoNode, morphTarget, preTransform ) { <ide> <del> if ( morphTargets.length === 0 ) return; <add> if ( morphTarget === null ) return; <ide> <ide> parentGeo.morphAttributes.position = []; <ide> // parentGeo.morphAttributes.normal = []; // not implemented <ide> <del> var self = this; <del> morphTargets.forEach( function( morphTarget ) { <del> <del> morphTarget.rawTargets.forEach( function ( rawTarget ) { <del> <del> var morphGeoNode = fbxTree.Objects.Geometry[ rawTarget.geoID ]; <add> var self = this; <add> morphTarget.rawTargets.forEach( function ( rawTarget ) { <ide> <del> if ( morphGeoNode !== undefined ) { <add> var morphGeoNode = fbxTree.Objects.Geometry[ rawTarget.geoID ]; <ide> <del> self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name ); <add> if ( morphGeoNode !== undefined ) { <ide> <del> } <add> self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name ); <ide> <del> } ); <add> } <ide> <ide> } ); <ide> <ide> THREE.FBXLoader = ( function () { <ide> // Normal and position attributes only have data for the vertices that are affected by the morph <ide> genMorphGeometry: function ( parentGeo, parentGeoNode, morphGeoNode, preTransform, name ) { <ide> <del> console.log(parentGeo, parentGeoNode, morphGeoNode, preTransform, name); <ide> var morphGeo = new THREE.BufferGeometry(); <ide> if ( morphGeoNode.attrName ) morphGeo.name = morphGeoNode.attrName; <ide>
1
Ruby
Ruby
add note about xeon
7e723c107b81f24498ec851161b0e12d68e89394
<ide><path>Library/Homebrew/hw.model.rb <ide> def hw_model <ide> <ide> when "MacPro" <ide> $unknown_hw_model=true if major > 3 <add> # 'Xeon' is a marketing term, not a specific CPU: <add> # http://en.wikipedia.org/wiki/Xeon <add> # adamv says: I have a Mac Pro at work (MacPro4,1) and will try <add> # some compiler options out. <ide> :xeon <ide> <ide> when "PowerBook", "PowerMac", "RackMac" then :ppc
1
Mixed
Go
fix a minor typo
471006c02f03d9451721dfbd7e3d62f0db0fc7c7
<ide><path>docker/flags.go <ide> func init() { <ide> {"images", "List images"}, <ide> {"import", "Create a new filesystem image from the contents of a tarball"}, <ide> {"info", "Display system-wide information"}, <del> {"inspect", "Return low-level information on a container"}, <add> {"inspect", "Return low-level information on a container or image"}, <ide> {"kill", "Kill a running container"}, <ide> {"load", "Load an image from a tar archive"}, <ide> {"login", "Register or log in to a Docker registry server"}, <ide><path>docs/man/docker.1.md <ide> unix://[/path/to/socket] to use. <ide> Display system-wide information <ide> <ide> **docker-inspect(1)** <del> Return low-level information on a container <add> Return low-level information on a container or image <ide> <ide> **docker-kill(1)** <ide> Kill a running container (which includes the wrapper process and everything
2
Javascript
Javascript
add integration test for suspense and streaming
57b4134c8811e18421c78555226112739be35232
<ide><path>test/integration/react-streaming-and-server-components/app/pages/streaming.js <add>import { Suspense } from 'react' <add> <add>let result <add>let promise <add>function Data() { <add> if (result) return result <add> if (!promise) <add> promise = new Promise((res) => { <add> setTimeout(() => { <add> result = 'next_streaming_data' <add> res() <add> }, 500) <add> }) <add> throw promise <add>} <add> <add>export default function Page() { <add> return ( <add> <Suspense fallback="next_streaming_fallback"> <add> <Data /> <add> </Suspense> <add> ) <add>} <ide><path>test/integration/react-streaming-and-server-components/test/index.test.js <ide> async function runBasicTests(context) { <ide> expect(html).toContain('bar.server.js:') <ide> expect(html).toContain('foo.client') <ide> }) <add> <add> it('should support streaming', async () => { <add> await fetchViaHTTP(context.appPort, '/streaming', null, {}).then( <add> async (response) => { <add> let result = '' <add> let gotFallback = false <add> let gotData = false <add> <add> await new Promise((resolve) => { <add> response.body.on('data', (chunk) => { <add> result += chunk.toString() <add> <add> gotData = result.includes('next_streaming_data') <add> if (!gotFallback) { <add> gotFallback = result.includes('next_streaming_fallback') <add> if (gotFallback) { <add> expect(gotData).toBe(false) <add> } <add> } <add> }) <add> <add> response.body.on('end', () => resolve()) <add> }) <add> <add> expect(gotFallback).toBe(true) <add> expect(gotData).toBe(true) <add> } <add> ) <add> <add> // Should end up with "next_streaming_data". <add> const browser = await webdriver(context.appPort, '/streaming') <add> const content = await browser.eval(`window.document.body.innerText`) <add> expect(content).toMatchInlineSnapshot('"next_streaming_data"') <add> }) <ide> } <ide> <ide> function runSuite(suiteName, env, { runTests, before, after }) {
2
Text
Text
add 2048-react to open-source demos
f627ddfb742089d50e6846c36de2a1985a8e7cd5
<ide><path>docs/docs/examples.md <ide> prev: complementary-tools.html <ide> * **[Khan Academy question editor](https://github.com/khan/perseus)** (Browse their GitHub account for many more production apps!) <ide> * **[github-issue-viewer](https://github.com/jaredly/github-issues-viewer)** <ide> * **[hn-react](https://github.com/prabirshrestha/hn-react)** Dead-simple Hacker News client. <add>* **[2048-react](https://github.com/IvanVergiliev/2048-react)** A clone of the 2048 game.
1
Javascript
Javascript
unify glimmer and htmlbars `{{#each}}` tests
a6f3fc4fbbe4371820f66a7c952822aa2e784e60
<ide><path>packages/ember-glimmer/tests/integration/syntax/each-test.js <ide> class ArrayLike { <ide> <ide> // The following methods are APIs used by the tests <ide> <del> clear() { <del> this._array.length = 0; <del> propertyDidChange(this, 'length'); <del> } <del> <ide> objectAt(idx) { <ide> return this._array[idx]; <ide> } <ide> <add> clear() { <add> this._array.length = 0; <add> this.arrayContentDidChange(); <add> } <add> <ide> replace(idx, del, ins) { <ide> this._array.splice(idx, del, ...ins); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> } <ide> <ide> unshiftObject(obj) { <ide> this._array.unshift(obj); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> } <ide> <ide> unshiftObjects(arr) { <ide> this._array.unshift(...arr); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> } <ide> <ide> pushObject(obj) { <ide> this._array.push(obj); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> } <ide> <ide> pushObjects(arr) { <ide> this._array.push(...arr); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> } <ide> <ide> shiftObject() { <ide> let obj = this._array.shift(); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> return obj; <ide> } <ide> <ide> popObject() { <ide> let obj = this._array.pop(); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> return obj; <ide> } <ide> <ide> insertAt(idx, obj) { <ide> this._array.splice(idx, 0, obj); <del> propertyDidChange(this, 'length'); <add> this.arrayContentDidChange(); <ide> } <ide> <ide> removeAt(idx, len = 1) { <ide> this._array.splice(idx, len); <add> this.arrayContentDidChange(); <add> } <add> <add> arrayContentDidChange() { <add> propertyDidChange(this, '[]'); <ide> propertyDidChange(this, 'length'); <ide> } <ide> <ide> moduleFor('Syntax test: {{#each}} with array-like objects', class extends Single <ide> return this.list = new ArrayLike(list); <ide> } <ide> <del> runTask(taskFunc) { <del> // This feature requires manual re-render in HTMLBars <del> if (this.isGlimmer) { <del> return super.runTask(taskFunc); <del> } else { <del> return super.runTask(() => { <del> taskFunc(); <del> this.rerender(); <del> }); <del> } <del> } <del> <ide> }); <ide> <ide> moduleFor('Syntax test: {{#each}} with array proxies, replacing itself', class extends SingleEachTest {
1
Javascript
Javascript
name anonymous functions
de03b362cffe26a8d58cea00568259df2707cb1c
<ide><path>pdf.js <ide> function shadow(obj, prop, value) { <ide> configurable: true, <ide> writable: false }); <ide> } catch (e) { <del> obj.__defineGetter__(prop, function() { <add> obj.__defineGetter__(prop, function shadowDefineGetter() { <ide> return value; <ide> }); <ide> } <ide> function stringToPDFString(str) { <ide> return str2; <ide> } <ide> <del>var Stream = (function() { <add>var Stream = (function streamStream() { <ide> function constructor(arrayBuffer, start, length, dict) { <ide> this.bytes = new Uint8Array(arrayBuffer); <ide> this.start = start || 0; <ide> var Stream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var StringStream = (function() { <add>var StringStream = (function stringStream() { <ide> function constructor(str) { <ide> var length = str.length; <ide> var bytes = new Uint8Array(length); <ide> var StringStream = (function() { <ide> })(); <ide> <ide> // super class for the decoding streams <del>var DecodeStream = (function() { <add>var DecodeStream = (function decodeStream() { <ide> function constructor() { <ide> this.pos = 0; <ide> this.bufferLength = 0; <ide> var DecodeStream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var FakeStream = (function() { <add>var FakeStream = (function fakeStream() { <ide> function constructor(stream) { <ide> this.dict = stream.dict; <ide> DecodeStream.call(this); <ide> } <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function fakeStreamReadBlock() { <ide> var bufferLength = this.bufferLength; <ide> bufferLength += 1024; <ide> var buffer = this.ensureBuffer(bufferLength); <ide> this.bufferLength = bufferLength; <ide> }; <ide> <del> constructor.prototype.getBytes = function(length) { <add> constructor.prototype.getBytes = function fakeStreamGetBytes(length) { <ide> var end, pos = this.pos; <ide> <ide> if (length) { <ide> var FakeStream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var StreamsSequenceStream = (function() { <add>var StreamsSequenceStream = (function streamSequenceStream() { <ide> function constructor(streams) { <ide> this.streams = streams; <ide> DecodeStream.call(this); <ide> } <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function streamSequenceStreamReadBlock() { <ide> var streams = this.streams; <ide> if (streams.length == 0) { <ide> this.eof = true; <ide> var StreamsSequenceStream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var FlateStream = (function() { <add>var FlateStream = (function flateStream() { <ide> var codeLenCodeMap = new Uint32Array([ <ide> 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 <ide> ]); <ide> var FlateStream = (function() { <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.getBits = function(bits) { <add> constructor.prototype.getBits = function flateStreamGetBits(bits) { <ide> var codeSize = this.codeSize; <ide> var codeBuf = this.codeBuf; <ide> var bytes = this.bytes; <ide> var FlateStream = (function() { <ide> return b; <ide> }; <ide> <del> constructor.prototype.getCode = function(table) { <add> constructor.prototype.getCode = function flateStreamGetCode(table) { <ide> var codes = table[0]; <ide> var maxLen = table[1]; <ide> var codeSize = this.codeSize; <ide> var FlateStream = (function() { <ide> return codeVal; <ide> }; <ide> <del> constructor.prototype.generateHuffmanTable = function(lengths) { <add> constructor.prototype.generateHuffmanTable = <add> function flateStreamGenerateHuffmanTable(lengths) { <ide> var n = lengths.length; <ide> <ide> // find max code length <ide> var FlateStream = (function() { <ide> return [codes, maxLen]; <ide> }; <ide> <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function flateStreamReadBlock() { <ide> // read block header <ide> var hdr = this.getBits(3); <ide> if (hdr & 1) <ide> var FlateStream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var PredictorStream = (function() { <add>var PredictorStream = (function predictorStream() { <ide> function constructor(stream, params) { <ide> var predictor = this.predictor = params.get('Predictor') || 1; <ide> <ide> var PredictorStream = (function() { <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.readBlockTiff = function() { <add> constructor.prototype.readBlockTiff = <add> function predictorStreamReadBlockTiff() { <ide> var rowBytes = this.rowBytes; <ide> <ide> var bufferLength = this.bufferLength; <ide> var PredictorStream = (function() { <ide> this.bufferLength += rowBytes; <ide> }; <ide> <del> constructor.prototype.readBlockPng = function() { <add> constructor.prototype.readBlockPng = function predictorStreamReadBlockPng() { <ide> var rowBytes = this.rowBytes; <ide> var pixBytes = this.pixBytes; <ide> <ide> var PredictorStream = (function() { <ide> <ide> // A JpegStream can't be read directly. We use the platform to render <ide> // the underlying JPEG data for us. <del>var JpegStream = (function() { <add>var JpegStream = (function jpegStream() { <ide> function isYcckImage(bytes) { <ide> var maxBytesScanned = Math.max(bytes.length - 16, 1024); <ide> // Looking for APP14, 'Adobe' and transform = 2 <ide> var JpegStream = (function() { <ide> <ide> // create DOM image <ide> var img = new Image(); <del> img.onload = (function() { <add> img.onload = (function jpegStreamOnload() { <ide> this.loaded = true; <ide> if (this.onLoad) <ide> this.onLoad(); <ide> var JpegStream = (function() { <ide> } <ide> <ide> constructor.prototype = { <del> getImage: function() { <add> getImage: function jpegStreamGetImage() { <ide> return this.domImage; <ide> }, <del> getChar: function() { <add> getChar: function jpegStreamGetChar() { <ide> error('internal error: getChar is not valid on JpegStream'); <ide> } <ide> }; <ide> var JpegStream = (function() { <ide> // Initialy for every that is in loading call imageLoading() <ide> // and, when images onload is fired, call imageLoaded() <ide> // When all images are loaded, the onLoad event is fired. <del>var ImagesLoader = (function() { <add>var ImagesLoader = (function imagesLoader() { <ide> function constructor() { <ide> this.loading = 0; <ide> } <ide> <ide> constructor.prototype = { <del> imageLoading: function() { <add> imageLoading: function imagesLoaderImageLoading() { <ide> ++this.loading; <ide> }, <ide> <del> imageLoaded: function() { <add> imageLoaded: function imagesLoaderImageLoaded() { <ide> if (--this.loading == 0 && this.onLoad) { <ide> this.onLoad(); <ide> delete this.onLoad; <ide> } <ide> }, <ide> <del> bind: function(jpegStream) { <add> bind: function imagesLoaderBind(jpegStream) { <ide> if (jpegStream.loaded) <ide> return; <ide> this.imageLoading(); <ide> jpegStream.onLoad = this.imageLoaded.bind(this); <ide> }, <ide> <del> notifyOnLoad: function(callback) { <add> notifyOnLoad: function imagesLoaderNotifyOnLoad(callback) { <ide> if (this.loading == 0) <ide> callback(); <ide> this.onLoad = callback; <ide> var ImagesLoader = (function() { <ide> return constructor; <ide> })(); <ide> <del>var DecryptStream = (function() { <add>var DecryptStream = (function decryptStream() { <ide> function constructor(str, decrypt) { <ide> this.str = str; <ide> this.dict = str.dict; <ide> var DecryptStream = (function() { <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function decryptStreamReadBlock() { <ide> var chunk = this.str.getBytes(chunkSize); <ide> if (!chunk || chunk.length == 0) { <ide> this.eof = true; <ide> var DecryptStream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var Ascii85Stream = (function() { <add>var Ascii85Stream = (function ascii85Stream() { <ide> function constructor(str) { <ide> this.str = str; <ide> this.dict = str.dict; <ide> var Ascii85Stream = (function() { <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function ascii85StreamReadBlock() { <ide> var tildaCode = '~'.charCodeAt(0); <ide> var zCode = 'z'.charCodeAt(0); <ide> var str = this.str; <ide> var Ascii85Stream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var AsciiHexStream = (function() { <add>var AsciiHexStream = (function asciiHexStream() { <ide> function constructor(str) { <ide> this.str = str; <ide> this.dict = str.dict; <ide> var AsciiHexStream = (function() { <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function asciiHexStreamReadBlock() { <ide> var gtCode = '>'.charCodeAt(0), bytes = this.str.getBytes(), c, n, <ide> decodeLength, buffer, bufferLength, i, length; <ide> <ide> var AsciiHexStream = (function() { <ide> return constructor; <ide> })(); <ide> <del>var CCITTFaxStream = (function() { <add>var CCITTFaxStream = (function cCITTFaxStream() { <ide> <ide> var ccittEOL = -2; <ide> var twoDimPass = 0; <ide> var CCITTFaxStream = (function() { <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function cCITTFaxStreamReadBlock() { <ide> while (!this.eof) { <ide> var c = this.lookChar(); <ide> this.buf = EOF; <ide> var CCITTFaxStream = (function() { <ide> } <ide> }; <ide> <del> constructor.prototype.addPixels = function(a1, blackPixels) { <add> constructor.prototype.addPixels = <add> function cCITTFaxStreamAddPixels(a1, blackPixels) { <ide> var codingLine = this.codingLine; <ide> var codingPos = this.codingPos; <ide> <ide> var CCITTFaxStream = (function() { <ide> this.codingPos = codingPos; <ide> }; <ide> <del> constructor.prototype.addPixelsNeg = function(a1, blackPixels) { <add> constructor.prototype.addPixelsNeg = <add> function cCITTFaxStreamAddPixelsNeg(a1, blackPixels) { <ide> var codingLine = this.codingLine; <ide> var codingPos = this.codingPos; <ide> <ide> var CCITTFaxStream = (function() { <ide> this.codingPos = codingPos; <ide> }; <ide> <del> constructor.prototype.lookChar = function() { <add> constructor.prototype.lookChar = function cCITTFaxStreamLookChar() { <ide> if (this.buf != EOF) <ide> return this.buf; <ide> <ide> var CCITTFaxStream = (function() { <ide> return this.buf; <ide> }; <ide> <del> constructor.prototype.getTwoDimCode = function() { <add> constructor.prototype.getTwoDimCode = function cCITTFaxStreamGetTwoDimCode() { <ide> var code = 0; <ide> var p; <ide> if (this.eoblock) { <ide> var CCITTFaxStream = (function() { <ide> return EOF; <ide> }; <ide> <del> constructor.prototype.getWhiteCode = function() { <add> constructor.prototype.getWhiteCode = function cCITTFaxStreamGetWhiteCode() { <ide> var code = 0; <ide> var p; <ide> var n; <ide> var CCITTFaxStream = (function() { <ide> return 1; <ide> }; <ide> <del> constructor.prototype.getBlackCode = function() { <add> constructor.prototype.getBlackCode = function cCITTFaxStreamGetBlackCode() { <ide> var code, p; <ide> if (this.eoblock) { <ide> code = this.lookBits(13); <ide> var CCITTFaxStream = (function() { <ide> return 1; <ide> }; <ide> <del> constructor.prototype.lookBits = function(n) { <add> constructor.prototype.lookBits = function cCITTFaxStreamLookBits(n) { <ide> var c; <ide> while (this.inputBits < n) { <ide> if ((c = this.str.getByte()) == null) { <ide> var CCITTFaxStream = (function() { <ide> return (this.inputBuf >> (this.inputBits - n)) & (0xFFFF >> (16 - n)); <ide> }; <ide> <del> constructor.prototype.eatBits = function(n) { <add> constructor.prototype.eatBits = function cCITTFaxStreamEatBits(n) { <ide> if ((this.inputBits -= n) < 0) <ide> this.inputBits = 0; <ide> }; <ide> <ide> return constructor; <ide> })(); <ide> <del>var LZWStream = (function() { <add>var LZWStream = (function lZWStream() { <ide> function constructor(str, earlyChange) { <ide> this.str = str; <ide> this.dict = str.dict; <ide> var LZWStream = (function() { <ide> <ide> constructor.prototype = Object.create(DecodeStream.prototype); <ide> <del> constructor.prototype.readBits = function(n) { <add> constructor.prototype.readBits = function lZWStreamReadBits(n) { <ide> var bitsCached = this.bitsCached; <ide> var cachedData = this.cachedData; <ide> while (bitsCached < n) { <ide> var LZWStream = (function() { <ide> return (cachedData >>> bitsCached) & ((1 << n) - 1); <ide> }; <ide> <del> constructor.prototype.readBlock = function() { <add> constructor.prototype.readBlock = function lZWStreamReadBlock() { <ide> var blockSize = 512; <ide> var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize; <ide> var i, j, q; <ide> var LZWStream = (function() { <ide> })(); <ide> <ide> <del>var Name = (function() { <add>var Name = (function nameName() { <ide> function constructor(name) { <ide> this.name = name; <ide> } <ide> var Name = (function() { <ide> return constructor; <ide> })(); <ide> <del>var Cmd = (function() { <add>var Cmd = (function cmdCmd() { <ide> function constructor(cmd) { <ide> this.cmd = cmd; <ide> } <ide> var Cmd = (function() { <ide> return constructor; <ide> })(); <ide> <del>var Dict = (function() { <add>var Dict = (function dictDict() { <ide> function constructor() { <ide> this.map = Object.create(null); <ide> } <ide> <ide> constructor.prototype = { <del> get: function(key1, key2, key3) { <add> get: function dictGet(key1, key2, key3) { <ide> var value; <ide> if (typeof (value = this.map[key1]) != 'undefined' || key1 in this.map || <ide> typeof key2 == 'undefined') { <ide> var Dict = (function() { <ide> return this.map[key3] || null; <ide> }, <ide> <del> set: function(key, value) { <add> set: function dictSet(key, value) { <ide> this.map[key] = value; <ide> }, <ide> <del> has: function(key) { <add> has: function dictHas(key) { <ide> return key in this.map; <ide> }, <ide> <del> forEach: function(callback) { <add> forEach: function dictForEach(callback) { <ide> for (var key in this.map) { <ide> callback(key, this.map[key]); <ide> } <ide> var Dict = (function() { <ide> return constructor; <ide> })(); <ide> <del>var Ref = (function() { <add>var Ref = (function refRef() { <ide> function constructor(num, gen) { <ide> this.num = num; <ide> this.gen = gen; <ide> var Ref = (function() { <ide> <ide> // The reference is identified by number and generation, <ide> // this structure stores only one instance of the reference. <del>var RefSet = (function() { <add>var RefSet = (function refSet() { <ide> function constructor() { <ide> this.dict = {}; <ide> } <ide> <ide> constructor.prototype = { <del> has: function(ref) { <add> has: function refSetHas(ref) { <ide> return !!this.dict['R' + ref.num + '.' + ref.gen]; <ide> }, <ide> <del> put: function(ref) { <add> put: function refSetPut(ref) { <ide> this.dict['R' + ref.num + '.' + ref.gen] = ref; <ide> } <ide> }; <ide> function IsNone(v) { <ide> return v == None; <ide> } <ide> <del>var Lexer = (function() { <add>var Lexer = (function lexer() { <ide> function constructor(stream) { <ide> this.stream = stream; <ide> } <ide> <del> constructor.isSpace = function(ch) { <add> constructor.isSpace = function lexerIsSpace(ch) { <ide> return ch == ' ' || ch == '\t' || ch == '\x0d' || ch == '\x0a'; <ide> }; <ide> <ide> var Lexer = (function() { <ide> } <ide> <ide> constructor.prototype = { <del> getNumber: function(ch) { <add> getNumber: function lexerGetNumber(ch) { <ide> var floating = false; <ide> var str = ch; <ide> var stream = this.stream; <ide> var Lexer = (function() { <ide> error('Invalid floating point number: ' + value); <ide> return value; <ide> }, <del> getString: function() { <add> getString: function lexerGetString() { <ide> var numParen = 1; <ide> var done = false; <ide> var str = ''; <ide> var Lexer = (function() { <ide> } while (!done); <ide> return str; <ide> }, <del> getName: function(ch) { <add> getName: function lexerGetName(ch) { <ide> var str = ''; <ide> var stream = this.stream; <ide> while (!!(ch = stream.lookChar()) && !specialChars[ch.charCodeAt(0)]) { <ide> var Lexer = (function() { <ide> str.length); <ide> return new Name(str); <ide> }, <del> getHexString: function(ch) { <add> getHexString: function lexerGetHexString(ch) { <ide> var str = ''; <ide> var stream = this.stream; <ide> for (;;) { <ide> var Lexer = (function() { <ide> } <ide> return str; <ide> }, <del> getObj: function() { <add> getObj: function lexerGetObj() { <ide> // skip whitespace and comments <ide> var comment = false; <ide> var stream = this.stream; <ide> var Lexer = (function() { <ide> return null; <ide> return new Cmd(str); <ide> }, <del> skipToNextLine: function() { <add> skipToNextLine: function lexerSkipToNextLine() { <ide> var stream = this.stream; <ide> while (true) { <ide> var ch = stream.getChar(); <ide> var Lexer = (function() { <ide> } <ide> } <ide> }, <del> skip: function() { <add> skip: function lexerSkip() { <ide> this.stream.skip(); <ide> } <ide> }; <ide> <ide> return constructor; <ide> })(); <ide> <del>var Parser = (function() { <add>var Parser = (function parserParser() { <ide> function constructor(lexer, allowStreams, xref) { <ide> this.lexer = lexer; <ide> this.allowStreams = allowStreams; <ide> var Parser = (function() { <ide> } <ide> <ide> constructor.prototype = { <del> refill: function() { <add> refill: function parserRefill() { <ide> this.buf1 = this.lexer.getObj(); <ide> this.buf2 = this.lexer.getObj(); <ide> }, <del> shift: function() { <add> shift: function parserShift() { <ide> if (IsCmd(this.buf2, 'ID')) { <ide> this.buf1 = this.buf2; <ide> this.buf2 = null; <ide> var Parser = (function() { <ide> this.buf2 = this.lexer.getObj(); <ide> } <ide> }, <del> getObj: function(cipherTransform) { <add> getObj: function parserGetObj(cipherTransform) { <ide> if (IsCmd(this.buf1, 'BI')) { // inline image <ide> this.shift(); <ide> return this.makeInlineImage(cipherTransform); <ide> var Parser = (function() { <ide> this.shift(); <ide> return obj; <ide> }, <del> makeInlineImage: function(cipherTransform) { <add> makeInlineImage: function parserMakeInlineImage(cipherTransform) { <ide> var lexer = this.lexer; <ide> var stream = lexer.stream; <ide> <ide> var Parser = (function() { <ide> <ide> return imageStream; <ide> }, <del> makeStream: function(dict, cipherTransform) { <add> makeStream: function parserMakeStream(dict, cipherTransform) { <ide> var lexer = this.lexer; <ide> var stream = lexer.stream; <ide> <ide> var Parser = (function() { <ide> stream.parameters = dict; <ide> return stream; <ide> }, <del> filter: function(stream, dict, length) { <add> filter: function parserFilter(stream, dict, length) { <ide> var filter = dict.get('Filter', 'F'); <ide> var params = dict.get('DecodeParms', 'DP'); <ide> if (IsName(filter)) <ide> var Parser = (function() { <ide> } <ide> return stream; <ide> }, <del> makeFilter: function(stream, name, length, params) { <add> makeFilter: function parserMakeFilter(stream, name, length, params) { <ide> if (name == 'FlateDecode' || name == 'Fl') { <ide> if (params) { <ide> return new PredictorStream(new FlateStream(stream), params); <ide> var Parser = (function() { <ide> return constructor; <ide> })(); <ide> <del>var Linearization = (function() { <add>var Linearization = (function linearizationLinearization() { <ide> function constructor(stream) { <ide> this.parser = new Parser(new Lexer(stream), false); <ide> var obj1 = this.parser.getObj(); <ide> var Linearization = (function() { <ide> } <ide> <ide> constructor.prototype = { <del> getInt: function(name) { <add> getInt: function linearizationGetInt(name) { <ide> var linDict = this.linDict; <ide> var obj; <ide> if (IsDict(linDict) && <ide> var Linearization = (function() { <ide> error('"' + name + '" field in linearization table is invalid'); <ide> return 0; <ide> }, <del> getHint: function(index) { <add> getHint: function linearizationGetHint(index) { <ide> var linDict = this.linDict; <ide> var obj1, obj2; <ide> if (IsDict(linDict) && <ide> var Linearization = (function() { <ide> return constructor; <ide> })(); <ide> <del>var XRef = (function() { <add>var XRef = (function xRefXRef() { <ide> function constructor(stream, startXRef, mainXRefEntriesOffset) { <ide> this.stream = stream; <ide> this.entries = []; <ide> var XRef = (function() { <ide> error('Invalid XRef'); <ide> return null; <ide> }, <del> getEntry: function(i) { <add> getEntry: function xRefGetEntry(i) { <ide> var e = this.entries[i]; <ide> if (e.free) <ide> error('reading an XRef stream not implemented yet'); <ide> return e; <ide> }, <del> fetchIfRef: function(obj) { <add> fetchIfRef: function xRefFetchIfRef(obj) { <ide> if (!IsRef(obj)) <ide> return obj; <ide> return this.fetch(obj); <ide> }, <del> fetch: function(ref, suppressEncryption) { <add> fetch: function xRefFetch(ref, suppressEncryption) { <ide> var num = ref.num; <ide> var e = this.cache[num]; <ide> if (e) <ide> var XRef = (function() { <ide> } <ide> return e; <ide> }, <del> getCatalogObj: function() { <add> getCatalogObj: function xRefGetCatalogObj() { <ide> return this.fetch(this.root); <ide> } <ide> }; <ide> <ide> return constructor; <ide> })(); <ide> <del>var Page = (function() { <add>var Page = (function pagePage() { <ide> function constructor(xref, pageNumber, pageDict, ref) { <ide> this.pageNumber = pageNumber; <ide> this.pageDict = pageDict; <ide> var Page = (function() { <ide> } <ide> <ide> constructor.prototype = { <del> getPageProp: function(key) { <add> getPageProp: function pageGetPageProp(key) { <ide> return this.xref.fetchIfRef(this.pageDict.get(key)); <ide> }, <del> inheritPageProp: function(key) { <add> inheritPageProp: function pageInheritPageProp(key) { <ide> var dict = this.pageDict; <ide> var obj = dict.get(key); <ide> while (obj === undefined) { <ide> var Page = (function() { <ide> } <ide> return shadow(this, 'rotate', rotate); <ide> }, <del> startRendering: function(canvasCtx, continuation) { <add> startRendering: function pageStartRendering(canvasCtx, continuation) { <ide> var self = this; <ide> var stats = self.stats; <ide> stats.compile = stats.fonts = stats.render = 0; <ide> var Page = (function() { <ide> this.compile(gfx, fonts, images); <ide> stats.compile = Date.now(); <ide> <del> var displayContinuation = function() { <add> var displayContinuation = function pageDisplayContinuation() { <ide> // Always defer call to display() to work around bug in <ide> // Firefox error reporting from XHR callbacks. <del> setTimeout(function() { <add> setTimeout(function pageSetTimeout() { <ide> var exc = null; <ide> try { <ide> self.display(gfx); <ide> var Page = (function() { <ide> <ide> var fontObjs = FontLoader.bind( <ide> fonts, <del> function() { <add> function pageFontObjs() { <ide> stats.fonts = Date.now(); <del> images.notifyOnLoad(function() { <add> images.notifyOnLoad(function pageNotifyOnLoad() { <ide> stats.images = Date.now(); <ide> displayContinuation(); <ide> }); <ide> var Page = (function() { <ide> }, <ide> <ide> <del> compile: function(gfx, fonts, images) { <add> compile: function pageCompile(gfx, fonts, images) { <ide> if (this.code) { <ide> // content was compiled <ide> return; <ide> var Page = (function() { <ide> } <ide> this.code = gfx.compile(content, xref, resources, fonts, images); <ide> }, <del> display: function(gfx) { <add> display: function pageDisplay(gfx) { <ide> assert(this.code instanceof Function, <ide> 'page content must be compiled first'); <ide> var xref = this.xref; <ide> var Page = (function() { <ide> gfx.execute(this.code, xref, resources); <ide> gfx.endDrawing(); <ide> }, <del> rotatePoint: function(x, y) { <add> rotatePoint: function pageRotatePoint(x, y) { <ide> var rotate = this.rotate; <ide> switch (rotate) { <ide> case 180: <ide> var Page = (function() { <ide> return {x: x, y: this.height - y}; <ide> } <ide> }, <del> getLinks: function() { <add> getLinks: function pageGetLinks() { <ide> var xref = this.xref; <ide> var annotations = xref.fetchIfRef(this.annotations) || []; <ide> var i, n = annotations.length; <ide> var Page = (function() { <ide> return constructor; <ide> })(); <ide> <del>var Catalog = (function() { <add>var Catalog = (function catalogCatalog() { <ide> function constructor(xref) { <ide> this.xref = xref; <ide> var obj = xref.getCatalogObj(); <ide> var Catalog = (function() { <ide> // shadow the prototype getter <ide> return shadow(this, 'num', obj); <ide> }, <del> traverseKids: function(pagesDict) { <add> traverseKids: function catalogTraverseKids(pagesDict) { <ide> var pageCache = this.pageCache; <ide> var kids = pagesDict.get('Kids'); <ide> assertWellFormed(IsArray(kids), <ide> var Catalog = (function() { <ide> if (nameDictionaryRef) { <ide> // reading simple destination dictionary <ide> obj = xref.fetchIfRef(nameDictionaryRef); <del> obj.forEach(function(key, value) { <add> obj.forEach(function catalogForEach(key, value) { <ide> if (!value) return; <ide> dests[key] = fetchDestination(xref, value); <ide> }); <ide> var Catalog = (function() { <ide> } <ide> return shadow(this, 'destinations', dests); <ide> }, <del> getPage: function(n) { <add> getPage: function catalogGetPage(n) { <ide> var pageCache = this.pageCache; <ide> if (!pageCache) { <ide> pageCache = this.pageCache = []; <ide> var Catalog = (function() { <ide> return constructor; <ide> })(); <ide> <del>var PDFDoc = (function() { <add>var PDFDoc = (function pDFDoc() { <ide> function constructor(stream) { <ide> assertWellFormed(stream.length > 0, 'stream must have data'); <ide> this.stream = stream; <ide> var PDFDoc = (function() { <ide> }, <ide> // Find the header, remove leading garbage and setup the stream <ide> // starting from the header. <del> checkHeader: function() { <add> checkHeader: function pDFDocCheckHeader() { <ide> var stream = this.stream; <ide> stream.reset(); <ide> if (find(stream, '%PDF-', 1024)) { <ide> var PDFDoc = (function() { <ide> } <ide> // May not be a PDF file, continue anyway. <ide> }, <del> setup: function(ownerPassword, userPassword) { <add> setup: function pDFDocSetup(ownerPassword, userPassword) { <ide> this.checkHeader(); <ide> this.xref = new XRef(this.stream, <ide> this.startXRef, <ide> var PDFDoc = (function() { <ide> // shadow the prototype getter <ide> return shadow(this, 'numPages', num); <ide> }, <del> getPage: function(n) { <add> getPage: function pDFDocGetPage(n) { <ide> return this.catalog.getPage(n); <ide> } <ide> }; <ide> var Encodings = { <ide> <ide> var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; <ide> <del>var EvalState = (function() { <add>var EvalState = (function evalState() { <ide> function constructor() { <ide> // Are soft masks and alpha values shapes or opacities? <ide> this.alphaIsShape = false; <ide> var EvalState = (function() { <ide> return constructor; <ide> })(); <ide> <del>var PartialEvaluator = (function() { <add>var PartialEvaluator = (function partialEvaluator() { <ide> function constructor() { <ide> this.state = new EvalState(); <ide> this.stateStack = []; <ide> var PartialEvaluator = (function() { <ide> }; <ide> <ide> constructor.prototype = { <del> evaluate: function(stream, xref, resources, fonts, images) { <add> evaluate: function partialEvaluatorEvaluate(stream, xref, resources, fonts, <add> images) { <ide> resources = xref.fetchIfRef(resources) || new Dict(); <ide> var xobjs = xref.fetchIfRef(resources.get('XObject')) || new Dict(); <ide> var patterns = xref.fetchIfRef(resources.get('Pattern')) || new Dict(); <ide> var PartialEvaluator = (function() { <ide> } <ide> } <ide> <del> return function(gfx) { <add> return function partialEvaluatorReturn(gfx) { <ide> for (var i = 0, length = argsArray.length; i < length; i++) <ide> gfx[fnArray[i]].apply(gfx, argsArray[i]); <ide> }; <ide> }, <ide> <del> extractEncoding: function(dict, xref, properties) { <add> extractEncoding: function partialEvaluatorExtractEncoding(dict, <add> xref, <add> properties) { <ide> var type = properties.type, encoding; <ide> if (properties.composite) { <ide> if (type == 'CIDFontType2') { <ide> var PartialEvaluator = (function() { <ide> return glyphs; <ide> }, <ide> <del> translateFont: function(dict, xref, resources) { <add> translateFont: function partialEvaluatorTranslateFont(dict, xref, <add> resources) { <ide> var baseDict = dict; <ide> var type = dict.get('Subtype'); <ide> assertWellFormed(IsName(type), 'invalid font Subtype'); <ide> var PartialEvaluator = (function() { <ide> flags: descriptor.get('Flags'), <ide> italicAngle: descriptor.get('ItalicAngle'), <ide> differences: [], <del> widths: (function() { <add> widths: (function partialEvaluatorWidths() { <ide> var glyphWidths = {}; <ide> for (var i = 0; i < widths.length; i++) <ide> glyphWidths[firstChar++] = widths[i]; <ide> var PartialEvaluator = (function() { <ide> <ide> // <canvas> contexts store most of the state we need natively. <ide> // However, PDF needs a bit more state, which we store here. <del>var CanvasExtraState = (function() { <add>var CanvasExtraState = (function canvasExtraState() { <ide> function constructor(old) { <ide> // Are soft masks and alpha values shapes or opacities? <ide> this.alphaIsShape = false; <ide> function ScratchCanvas(width, height) { <ide> return canvas; <ide> } <ide> <del>var CanvasGraphics = (function() { <add>var CanvasGraphics = (function canvasGraphics() { <ide> function constructor(canvasCtx, imageCanvas) { <ide> this.ctx = canvasCtx; <ide> this.current = new CanvasExtraState(); <ide> var CanvasGraphics = (function() { <ide> var EO_CLIP = {}; <ide> <ide> constructor.prototype = { <del> beginDrawing: function(mediaBox) { <add> beginDrawing: function canvasGraphicsBeginDrawing(mediaBox) { <ide> var cw = this.ctx.canvas.width, ch = this.ctx.canvas.height; <ide> this.ctx.save(); <ide> switch (mediaBox.rotate) { <ide> var CanvasGraphics = (function() { <ide> this.ctx.scale(cw / mediaBox.width, ch / mediaBox.height); <ide> }, <ide> <del> compile: function(stream, xref, resources, fonts, images) { <add> compile: function canvasGraphicsCompile(stream, xref, resources, fonts, <add> images) { <ide> var pe = new PartialEvaluator(); <ide> return pe.evaluate(stream, xref, resources, fonts, images); <ide> }, <ide> <del> execute: function(code, xref, resources) { <add> execute: function canvasGraphicsExecute(code, xref, resources) { <ide> resources = xref.fetchIfRef(resources) || new Dict(); <ide> var savedXref = this.xref, savedRes = this.res, savedXobjs = this.xobjs; <ide> this.xref = xref; <ide> var CanvasGraphics = (function() { <ide> this.xref = savedXref; <ide> }, <ide> <del> endDrawing: function() { <add> endDrawing: function canvasGraphicsEndDrawing() { <ide> this.ctx.restore(); <ide> }, <ide> <ide> // Graphics state <del> setLineWidth: function(width) { <add> setLineWidth: function canvasGraphicsSetLineWidth(width) { <ide> this.ctx.lineWidth = width; <ide> }, <del> setLineCap: function(style) { <add> setLineCap: function canvasGraphicsSetLineCap(style) { <ide> this.ctx.lineCap = LINE_CAP_STYLES[style]; <ide> }, <del> setLineJoin: function(style) { <add> setLineJoin: function canvasGraphicsSetLineJoin(style) { <ide> this.ctx.lineJoin = LINE_JOIN_STYLES[style]; <ide> }, <del> setMiterLimit: function(limit) { <add> setMiterLimit: function canvasGraphicsSetMiterLimit(limit) { <ide> this.ctx.miterLimit = limit; <ide> }, <del> setDash: function(dashArray, dashPhase) { <add> setDash: function canvasGraphicsSetDash(dashArray, dashPhase) { <ide> this.ctx.mozDash = dashArray; <ide> this.ctx.mozDashOffset = dashPhase; <ide> }, <del> setRenderingIntent: function(intent) { <add> setRenderingIntent: function canvasGraphicsSetRenderingIntent(intent) { <ide> TODO('set rendering intent: ' + intent); <ide> }, <del> setFlatness: function(flatness) { <add> setFlatness: function canvasGraphicsSetFlatness(flatness) { <ide> TODO('set flatness: ' + flatness); <ide> }, <del> setGState: function(dictName) { <add> setGState: function canvasGraphicsSetGState(dictName) { <ide> TODO('set graphics state from dict: ' + dictName); <ide> }, <del> save: function() { <add> save: function canvasGraphicsSave() { <ide> this.ctx.save(); <ide> if (this.ctx.$saveCurrentX) { <ide> this.ctx.$saveCurrentX(); <ide> var CanvasGraphics = (function() { <ide> this.stateStack.push(old); <ide> this.current = old.clone(); <ide> }, <del> restore: function() { <add> restore: function canvasGraphicsRestore() { <ide> var prev = this.stateStack.pop(); <ide> if (prev) { <ide> if (this.ctx.$restoreCurrentX) { <ide> var CanvasGraphics = (function() { <ide> this.ctx.restore(); <ide> } <ide> }, <del> transform: function(a, b, c, d, e, f) { <add> transform: function canvasGraphicsTransform(a, b, c, d, e, f) { <ide> this.ctx.transform(a, b, c, d, e, f); <ide> }, <ide> <ide> // Path <del> moveTo: function(x, y) { <add> moveTo: function canvasGraphicsMoveTo(x, y) { <ide> this.ctx.moveTo(x, y); <ide> this.current.setCurrentPoint(x, y); <ide> }, <del> lineTo: function(x, y) { <add> lineTo: function canvasGraphicsLineTo(x, y) { <ide> this.ctx.lineTo(x, y); <ide> this.current.setCurrentPoint(x, y); <ide> }, <del> curveTo: function(x1, y1, x2, y2, x3, y3) { <add> curveTo: function canvasGraphicsCurveTo(x1, y1, x2, y2, x3, y3) { <ide> this.ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3); <ide> this.current.setCurrentPoint(x3, y3); <ide> }, <del> curveTo2: function(x2, y2, x3, y3) { <add> curveTo2: function canvasGraphicsCurveTo2(x2, y2, x3, y3) { <ide> var current = this.current; <ide> this.ctx.bezierCurveTo(current.x, current.y, x2, y2, x3, y3); <ide> current.setCurrentPoint(x3, y3); <ide> }, <del> curveTo3: function(x1, y1, x3, y3) { <add> curveTo3: function canvasGraphicsCurveTo3(x1, y1, x3, y3) { <ide> this.curveTo(x1, y1, x3, y3, x3, y3); <ide> this.current.setCurrentPoint(x3, y3); <ide> }, <del> closePath: function() { <add> closePath: function canvasGraphicsClosePath() { <ide> this.ctx.closePath(); <ide> }, <del> rectangle: function(x, y, width, height) { <add> rectangle: function canvasGraphicsRectangle(x, y, width, height) { <ide> this.ctx.rect(x, y, width, height); <ide> }, <del> stroke: function() { <add> stroke: function canvasGraphicsStroke() { <ide> var ctx = this.ctx; <ide> var strokeColor = this.current.strokeColor; <ide> if (strokeColor && strokeColor.type === 'Pattern') { <ide> var CanvasGraphics = (function() { <ide> <ide> this.consumePath(); <ide> }, <del> closeStroke: function() { <add> closeStroke: function canvasGraphicsCloseStroke() { <ide> this.closePath(); <ide> this.stroke(); <ide> }, <del> fill: function() { <add> fill: function canvasGraphicsFill() { <ide> var ctx = this.ctx; <ide> var fillColor = this.current.fillColor; <ide> <ide> var CanvasGraphics = (function() { <ide> <ide> this.consumePath(); <ide> }, <del> eoFill: function() { <add> eoFill: function canvasGraphicsEoFill() { <ide> var savedFillRule = this.setEOFillRule(); <ide> this.fill(); <ide> this.restoreFillRule(savedFillRule); <ide> }, <del> fillStroke: function() { <add> fillStroke: function canvasGraphicsFillStroke() { <ide> var ctx = this.ctx; <ide> <ide> var fillColor = this.current.fillColor; <ide> var CanvasGraphics = (function() { <ide> <ide> this.consumePath(); <ide> }, <del> eoFillStroke: function() { <add> eoFillStroke: function canvasGraphicsEoFillStroke() { <ide> var savedFillRule = this.setEOFillRule(); <ide> this.fillStroke(); <ide> this.restoreFillRule(savedFillRule); <ide> }, <del> closeFillStroke: function() { <add> closeFillStroke: function canvasGraphicsCloseFillStroke() { <ide> return this.fillStroke(); <ide> }, <del> closeEOFillStroke: function() { <add> closeEOFillStroke: function canvasGraphicsCloseEOFillStroke() { <ide> var savedFillRule = this.setEOFillRule(); <ide> this.fillStroke(); <ide> this.restoreFillRule(savedFillRule); <ide> }, <del> endPath: function() { <add> endPath: function canvasGraphicsEndPath() { <ide> this.consumePath(); <ide> }, <ide> <ide> // Clipping <del> clip: function() { <add> clip: function canvasGraphicsClip() { <ide> this.pendingClip = NORMAL_CLIP; <ide> }, <del> eoClip: function() { <add> eoClip: function canvasGraphicsEoClip() { <ide> this.pendingClip = EO_CLIP; <ide> }, <ide> <ide> // Text <del> beginText: function() { <add> beginText: function canvasGraphicsBeginText() { <ide> this.current.textMatrix = IDENTITY_MATRIX; <ide> if (this.ctx.$setCurrentX) { <ide> this.ctx.$setCurrentX(0); <ide> } <ide> this.current.x = this.current.lineX = 0; <ide> this.current.y = this.current.lineY = 0; <ide> }, <del> endText: function() { <add> endText: function canvasGraphicsEndText() { <ide> }, <del> setCharSpacing: function(spacing) { <add> setCharSpacing: function canvasGraphicsSetCharSpacing(spacing) { <ide> this.current.charSpacing = spacing; <ide> }, <del> setWordSpacing: function(spacing) { <add> setWordSpacing: function canvasGraphicsSetWordSpacing(spacing) { <ide> this.current.wordSpacing = spacing; <ide> }, <del> setHScale: function(scale) { <add> setHScale: function canvasGraphicsSetHScale(scale) { <ide> this.current.textHScale = scale / 100; <ide> }, <del> setLeading: function(leading) { <add> setLeading: function canvasGraphicsSetLeading(leading) { <ide> this.current.leading = -leading; <ide> }, <del> setFont: function(fontRef, size) { <add> setFont: function canvasGraphicsSetFont(fontRef, size) { <ide> var font = this.xref.fetchIfRef(this.res.get('Font')); <ide> if (!IsDict(font)) <ide> return; <ide> var CanvasGraphics = (function() { <ide> this.ctx.font = rule; <ide> } <ide> }, <del> setTextRenderingMode: function(mode) { <add> setTextRenderingMode: function canvasGraphicsSetTextRenderingMode(mode) { <ide> TODO('text rendering mode: ' + mode); <ide> }, <del> setTextRise: function(rise) { <add> setTextRise: function canvasGraphicsSetTextRise(rise) { <ide> TODO('text rise: ' + rise); <ide> }, <del> moveText: function(x, y) { <add> moveText: function canvasGraphicsMoveText(x, y) { <ide> this.current.x = this.current.lineX += x; <ide> this.current.y = this.current.lineY += y; <ide> if (this.ctx.$setCurrentX) { <ide> this.ctx.$setCurrentX(this.current.x); <ide> } <ide> }, <del> setLeadingMoveText: function(x, y) { <add> setLeadingMoveText: function canvasGraphicsSetLeadingMoveText(x, y) { <ide> this.setLeading(-y); <ide> this.moveText(x, y); <ide> }, <del> setTextMatrix: function(a, b, c, d, e, f) { <add> setTextMatrix: function canvasGraphicsSetTextMatrix(a, b, c, d, e, f) { <ide> this.current.textMatrix = [a, b, c, d, e, f]; <ide> <ide> if (this.ctx.$setCurrentX) { <ide> var CanvasGraphics = (function() { <ide> this.current.x = this.current.lineX = 0; <ide> this.current.y = this.current.lineY = 0; <ide> }, <del> nextLine: function() { <add> nextLine: function canvasGraphicsNextLine() { <ide> this.moveText(0, this.current.leading); <ide> }, <del> showText: function(text) { <add> showText: function canvasGraphicsShowText(text) { <ide> var ctx = this.ctx; <ide> var current = this.current; <ide> var font = current.font; <ide> var CanvasGraphics = (function() { <ide> <ide> this.ctx.restore(); <ide> }, <del> showSpacedText: function(arr) { <add> showSpacedText: function canvasGraphicsShowSpacedText(arr) { <ide> for (var i = 0; i < arr.length; ++i) { <ide> var e = arr[i]; <ide> if (IsNum(e)) { <ide> var CanvasGraphics = (function() { <ide> } <ide> } <ide> }, <del> nextLineShowText: function(text) { <add> nextLineShowText: function canvasGraphicsNextLineShowText(text) { <ide> this.nextLine(); <ide> this.showText(text); <ide> }, <del> nextLineSetSpacingShowText: function(wordSpacing, charSpacing, text) { <add> nextLineSetSpacingShowText: <add> function canvasGraphicsNextLineSetSpacingShowText(wordSpacing, <add> charSpacing, <add> text) { <ide> this.setWordSpacing(wordSpacing); <ide> this.setCharSpacing(charSpacing); <ide> this.nextLineShowText(text); <ide> }, <ide> <ide> // Type3 fonts <del> setCharWidth: function(xWidth, yWidth) { <add> setCharWidth: function canvasGraphicsSetCharWidth(xWidth, yWidth) { <ide> TODO('type 3 fonts ("d0" operator) xWidth: ' + xWidth + ' yWidth: ' + <ide> yWidth); <ide> }, <del> setCharWidthAndBounds: function(xWidth, yWidth, llx, lly, urx, ury) { <add> setCharWidthAndBounds: function canvasGraphicsSetCharWidthAndBounds(xWidth, <add> yWidth, <add> llx, <add> lly, <add> urx, <add> ury) { <ide> TODO('type 3 fonts ("d1" operator) xWidth: ' + xWidth + ' yWidth: ' + <ide> yWidth + ' llx: ' + llx + ' lly: ' + lly + ' urx: ' + urx + <ide> ' ury ' + ury); <ide> }, <ide> <ide> // Color <del> setStrokeColorSpace: function(space) { <add> setStrokeColorSpace: function canvasGraphicsSetStrokeColorSpace(space) { <ide> this.current.strokeColorSpace = <ide> ColorSpace.parse(space, this.xref, this.res); <ide> }, <del> setFillColorSpace: function(space) { <add> setFillColorSpace: function canvasGraphicsSetFillColorSpace(space) { <ide> this.current.fillColorSpace = <ide> ColorSpace.parse(space, this.xref, this.res); <ide> }, <del> setStrokeColor: function(/*...*/) { <add> setStrokeColor: function canvasGraphicsSetStrokeColor(/*...*/) { <ide> var cs = this.current.strokeColorSpace; <ide> var color = cs.getRgb(arguments); <ide> this.setStrokeRGBColor.apply(this, color); <ide> }, <del> setStrokeColorN: function(/*...*/) { <add> setStrokeColorN: function canvasGraphicsSetStrokeColorN(/*...*/) { <ide> var cs = this.current.strokeColorSpace; <ide> <ide> if (cs.name == 'Pattern') { <ide> var CanvasGraphics = (function() { <ide> this.setStrokeColor.apply(this, arguments); <ide> } <ide> }, <del> setFillColor: function(/*...*/) { <add> setFillColor: function canvasGraphicsSetFillColor(/*...*/) { <ide> var cs = this.current.fillColorSpace; <ide> var color = cs.getRgb(arguments); <ide> this.setFillRGBColor.apply(this, color); <ide> }, <del> setFillColorN: function(/*...*/) { <add> setFillColorN: function canvasGraphicsSetFillColorN(/*...*/) { <ide> var cs = this.current.fillColorSpace; <ide> <ide> if (cs.name == 'Pattern') { <ide> var CanvasGraphics = (function() { <ide> this.setFillColor.apply(this, arguments); <ide> } <ide> }, <del> setStrokeGray: function(gray) { <add> setStrokeGray: function canvasGraphicsSetStrokeGray(gray) { <ide> this.setStrokeRGBColor(gray, gray, gray); <ide> }, <del> setFillGray: function(gray) { <add> setFillGray: function canvasGraphicsSetFillGray(gray) { <ide> this.setFillRGBColor(gray, gray, gray); <ide> }, <del> setStrokeRGBColor: function(r, g, b) { <add> setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) { <ide> var color = Util.makeCssRgb(r, g, b); <ide> this.ctx.strokeStyle = color; <ide> this.current.strokeColor = color; <ide> }, <del> setFillRGBColor: function(r, g, b) { <add> setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) { <ide> var color = Util.makeCssRgb(r, g, b); <ide> this.ctx.fillStyle = color; <ide> this.current.fillColor = color; <ide> }, <del> setStrokeCMYKColor: function(c, m, y, k) { <add> setStrokeCMYKColor: function canvasGraphicsSetStrokeCMYKColor(c, m, y, k) { <ide> var color = Util.makeCssCmyk(c, m, y, k); <ide> this.ctx.strokeStyle = color; <ide> this.current.strokeColor = color; <ide> }, <del> setFillCMYKColor: function(c, m, y, k) { <add> setFillCMYKColor: function canvasGraphicsSetFillCMYKColor(c, m, y, k) { <ide> var color = Util.makeCssCmyk(c, m, y, k); <ide> this.ctx.fillStyle = color; <ide> this.current.fillColor = color; <ide> }, <ide> <ide> // Shading <del> shadingFill: function(shadingName) { <add> shadingFill: function canvasGraphicsShadingFill(shadingName) { <ide> var xref = this.xref; <ide> var res = this.res; <ide> var ctx = this.ctx; <ide> var CanvasGraphics = (function() { <ide> }, <ide> <ide> // Images <del> beginInlineImage: function() { <add> beginInlineImage: function canvasGraphicsBeginInlineImage() { <ide> error('Should not call beginInlineImage'); <ide> }, <del> beginImageData: function() { <add> beginImageData: function canvasGraphicsBeginImageData() { <ide> error('Should not call beginImageData'); <ide> }, <del> endInlineImage: function(image) { <add> endInlineImage: function canvasGraphicsEndInlineImage(image) { <ide> this.paintImageXObject(null, image, true); <ide> }, <ide> <ide> // XObjects <del> paintXObject: function(obj) { <add> paintXObject: function canvasGraphicsPaintXObject(obj) { <ide> var xobj = this.xobjs.get(obj.name); <ide> if (!xobj) <ide> return; <ide> var CanvasGraphics = (function() { <ide> } <ide> }, <ide> <del> paintFormXObject: function(ref, stream) { <add> paintFormXObject: function canvasGraphicsPaintFormXObject(ref, stream) { <ide> this.save(); <ide> <ide> var matrix = stream.dict.get('Matrix'); <ide> var CanvasGraphics = (function() { <ide> this.restore(); <ide> }, <ide> <del> paintImageXObject: function(ref, image, inline) { <add> paintImageXObject: function canvasGraphicsPaintImageXObject(ref, image, <add> inline) { <ide> this.save(); <ide> <ide> var ctx = this.ctx; <ide> var CanvasGraphics = (function() { <ide> <ide> // Marked content <ide> <del> markPoint: function(tag) { <add> markPoint: function canvasGraphicsMarkPoint(tag) { <ide> TODO('Marked content'); <ide> }, <del> markPointProps: function(tag, properties) { <add> markPointProps: function canvasGraphicsMarkPointProps(tag, properties) { <ide> TODO('Marked content'); <ide> }, <del> beginMarkedContent: function(tag) { <add> beginMarkedContent: function canvasGraphicsBeginMarkedContent(tag) { <ide> TODO('Marked content'); <ide> }, <del> beginMarkedContentProps: function(tag, properties) { <add> beginMarkedContentProps: <add> function canvasGraphicsBeginMarkedContentProps(tag, properties) { <ide> TODO('Marked content'); <ide> }, <del> endMarkedContent: function() { <add> endMarkedContent: function canvasGraphicsEndMarkedContent() { <ide> TODO('Marked content'); <ide> }, <ide> <ide> // Compatibility <ide> <del> beginCompat: function() { <add> beginCompat: function canvasGraphicsBeginCompat() { <ide> TODO('ignore undefined operators (should we do that anyway?)'); <ide> }, <del> endCompat: function() { <add> endCompat: function canvasGraphicsEndCompat() { <ide> TODO('stop ignoring undefined operators'); <ide> }, <ide> <ide> // Helper functions <ide> <del> consumePath: function() { <add> consumePath: function canvasGraphicsConsumePath() { <ide> if (this.pendingClip) { <ide> var savedFillRule = null; <ide> if (this.pendingClip == EO_CLIP) <ide> var CanvasGraphics = (function() { <ide> // We generally keep the canvas context set for <ide> // nonzero-winding, and just set evenodd for the operations <ide> // that need them. <del> setEOFillRule: function() { <add> setEOFillRule: function canvasGraphicsSetEOFillRule() { <ide> var savedFillRule = this.ctx.mozFillRule; <ide> this.ctx.mozFillRule = 'evenodd'; <ide> return savedFillRule; <ide> }, <del> restoreFillRule: function(rule) { <add> restoreFillRule: function canvasGraphicsRestoreFillRule(rule) { <ide> this.ctx.mozFillRule = rule; <ide> } <ide> }; <ide> <ide> return constructor; <ide> })(); <ide> <del>var Util = (function() { <add>var Util = (function utilUtil() { <ide> function constructor() {} <ide> constructor.makeCssRgb = function makergb(r, g, b) { <ide> var ri = (255 * r) | 0, gi = (255 * g) | 0, bi = (255 * b) | 0; <ide> var Util = (function() { <ide> return constructor; <ide> })(); <ide> <del>var ColorSpace = (function() { <add>var ColorSpace = (function colorSpaceColorSpace() { <ide> // Constructor should define this.numComps, this.defaultColor, this.name <ide> function constructor() { <ide> error('should not call ColorSpace constructor'); <ide> var ColorSpace = (function() { <ide> return constructor; <ide> })(); <ide> <del>var SeparationCS = (function() { <add>var SeparationCS = (function separationCS() { <ide> function constructor(base, tintFn) { <ide> this.name = 'Separation'; <ide> this.numComps = 1; <ide> var SeparationCS = (function() { <ide> return constructor; <ide> })(); <ide> <del>var PatternCS = (function() { <add>var PatternCS = (function patternCS() { <ide> function constructor(baseCS) { <ide> this.name = 'Pattern'; <ide> this.base = baseCS; <ide> var PatternCS = (function() { <ide> return constructor; <ide> })(); <ide> <del>var IndexedCS = (function() { <add>var IndexedCS = (function indexedCS() { <ide> function constructor(base, highVal, lookup) { <ide> this.name = 'Indexed'; <ide> this.numComps = 1; <ide> var IndexedCS = (function() { <ide> return constructor; <ide> })(); <ide> <del>var DeviceGrayCS = (function() { <add>var DeviceGrayCS = (function deviceGrayCS() { <ide> function constructor() { <ide> this.name = 'DeviceGray'; <ide> this.numComps = 1; <ide> var DeviceGrayCS = (function() { <ide> return constructor; <ide> })(); <ide> <del>var DeviceRgbCS = (function() { <add>var DeviceRgbCS = (function deviceRgbCS() { <ide> function constructor(bits) { <ide> this.name = 'DeviceRGB'; <ide> this.numComps = 3; <ide> var DeviceRgbCS = (function() { <ide> return constructor; <ide> })(); <ide> <del>var DeviceCmykCS = (function() { <add>var DeviceCmykCS = (function deviceCmykCS() { <ide> function constructor() { <ide> this.name = 'DeviceCMYK'; <ide> this.numComps = 4; <ide> var DeviceCmykCS = (function() { <ide> return constructor; <ide> })(); <ide> <del>var Pattern = (function() { <add>var Pattern = (function patternPattern() { <ide> // Constructor should define this.getPattern <ide> function constructor() { <ide> error('should not call Pattern constructor'); <ide> var Pattern = (function() { <ide> return constructor; <ide> })(); <ide> <del>var DummyShading = (function() { <add>var DummyShading = (function dummyShading() { <ide> function constructor() { <ide> this.type = 'Pattern'; <ide> } <ide> var DummyShading = (function() { <ide> <ide> // Radial and axial shading have very similar implementations <ide> // If needed, the implementations can be broken into two classes <del>var RadialAxialShading = (function() { <add>var RadialAxialShading = (function radialAxialShading() { <ide> function constructor(dict, matrix, xref, res, ctx) { <ide> this.matrix = matrix; <ide> this.coordsArr = dict.get('Coords'); <ide> var RadialAxialShading = (function() { <ide> } <ide> <ide> constructor.prototype = { <del> getPattern: function() { <add> getPattern: function radialAxialShadingGetPattern() { <ide> var coordsArr = this.coordsArr; <ide> var type = this.shadingType; <ide> var p0, p1, r0, r1; <ide> var RadialAxialShading = (function() { <ide> return constructor; <ide> })(); <ide> <del>var TilingPattern = (function() { <add>var TilingPattern = (function tilingPattern() { <ide> var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2; <ide> <ide> function constructor(pattern, code, dict, color, xref, ctx) { <ide> var TilingPattern = (function() { <ide> })(); <ide> <ide> <del>var PDFImage = (function() { <add>var PDFImage = (function pDFImage() { <ide> function constructor(xref, res, image, inline) { <ide> this.image = image; <ide> if (image.getParams) { <ide> var PDFImage = (function() { <ide> return constructor; <ide> })(); <ide> <del>var PDFFunction = (function() { <add>var PDFFunction = (function pDFFunction() { <ide> function constructor(xref, fn) { <ide> var dict = fn.dict; <ide> if (!dict) <ide> var PDFFunction = (function() { <ide> } <ide> <ide> constructor.prototype = { <del> constructSampled: function(str, dict) { <add> constructSampled: function pDFFunctionConstructSampled(str, dict) { <ide> var domain = dict.get('Domain'); <ide> var range = dict.get('Range'); <ide> <ide> var PDFFunction = (function() { <ide> <ide> var samples = this.getSampleArray(size, outputSize, bps, str); <ide> <del> this.func = function(args) { <del> var clip = function(v, min, max) { <add> this.func = function pDFFunctionFunc(args) { <add> var clip = function pDFFunctionClip(v, min, max) { <ide> if (v > max) <ide> v = max; <ide> else if (v < min) <ide> var PDFFunction = (function() { <ide> return output; <ide> }; <ide> }, <del> getSampleArray: function(size, outputSize, bps, str) { <add> getSampleArray: function pDFFunctionGetSampleArray(size, outputSize, bps, <add> str) { <ide> var length = 1; <ide> for (var i = 0; i < size.length; i++) <ide> length *= size[i]; <ide> var PDFFunction = (function() { <ide> } <ide> return array; <ide> }, <del> constructInterpolated: function(str, dict) { <add> constructInterpolated: function pDFFunctionConstructInterpolated(str, <add> dict) { <ide> var c0 = dict.get('C0') || [0]; <ide> var c1 = dict.get('C1') || [1]; <ide> var n = dict.get('N'); <ide> var PDFFunction = (function() { <ide> for (var i = 0; i < length; ++i) <ide> diff.push(c1[i] - c0[i]); <ide> <del> this.func = function(args) { <add> this.func = function pDFFunctionConstructInterpolatedFunc(args) { <ide> var x = args[0]; <ide> <ide> var out = [];
1
PHP
PHP
convert spaces to tabs
0cd120a75090480af98b32e3b7f3adc24890c842
<ide><path>src/Illuminate/Routing/Router.php <ide> public function dispatchToRoute(Request $request) <ide> { <ide> $route = $this->findRoute($request); <ide> <del> $this->events->fire('router.matched', array($route, $request)); <add> $this->events->fire('router.matched', array($route, $request)); <ide> <ide> // Once we have successfully matched the incoming request to a given route we <ide> // can call the before filters on that route. This works similar to global
1
PHP
PHP
add tests for
901bb07c7126e27bdfed30aed7cac21c667da24b
<ide><path>tests/TestCase/I18n/TranslatorFactoryTest.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since 3.3.14 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\I18n; <add> <add>use Aura\Intl\Translator as AuraTranslator; <add>use Cake\I18n\TranslatorFactory; <add>use Cake\TestSuite\TestCase; <add> <add>/** <add> * TranslatorFactory Test class <add> */ <add>class TranslatorFactoryTest extends TestCase <add>{ <add> /** <add> * Test that errors are emitted when stale cache files are found. <add> * <add> * @expectedException RuntimeException <add> * @expectedExceptionMessage Translator fallback class <add> */ <add> public function testNewInstanceErrorOnFallback() <add> { <add> $formatter = $this->getMockBuilder('Aura\Intl\FormatterInterface')->getMock(); <add> $fallback = new AuraTranslator('en_CA', [], $formatter, null); <add> $factory = new TranslatorFactory(); <add> $factory->newInstance('en_CA', [], $formatter, $fallback); <add> } <add>}
1
Ruby
Ruby
add missing require
e6d4dc3ec4e6e3d4dd9e5db6cdd91f691d546609
<ide><path>activesupport/lib/active_support/core_ext/time/calculations.rb <ide> require 'active_support/duration' <ide> require 'active_support/core_ext/time/conversions' <add>require 'active_support/time_with_zone' <ide> <ide> class Time <ide> COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
1
Text
Text
add new templates and update readme files
9c1429cf48c56d9ee47d5e35f3253a51e257db13
<ide><path>.github/PULL_REQUEST_TEMPLATE/pull_request_template.md <add># Description <add> <add>> :memo: Please include a summary of the change. <add>> <add>> * Please also include relevant motivation and context. <add>> * List any dependencies that are required for this change. <add> <add>## Type of change <add> <add>Please delete options that are not relevant. <add> <add>- [ ] Bug fix (non-breaking change which fixes an issue) <add>- [ ] Documentation update <add>- [ ] TensorFlow 2 migration <add>- [ ] New feature (non-breaking change which adds functionality) <add>- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) <add>- [ ] A new research paper code implementation <add> <add>## Tests <add> <add>> :memo: Please describe the tests that you ran to verify your changes. <add>> <add>> * Provide instructions so we can reproduce. <add>> * Please also list any relevant details for your test configuration. <add> <add>**Test Configuration**: <add> <add>## Checklist <add> <add>- [ ] I have signed the [Contributor License Agreement](../../wiki/Contributor-License-Agreements). <add>- [ ] I have read [guidelines for pull request](../../wiki/Submitting-a-pull-request). <add>- [ ] My code follows the [coding guidelines](../../wiki/Coding-Guidelines). <add>- [ ] I have performed a self [code review](../../wiki/Code-review) of my own code. <add>- [ ] I have commented my code, particularly in hard-to-understand areas. <add>- [ ] I have made corresponding changes to the documentation. <add>- [ ] My changes generate no new warnings. <add>- [ ] I have added tests that prove my fix is effective or that my feature works. <ide><path>.github/README_TEMPLATE.md <add>> :memo: A README.md template for releasing a paper code implementation to a GitHub repository. <add>> <add>> * Template version: 1.0.2020.125 <add>> * Please modify sections depending on needs. <add> <add># Model name, Paper title, or Project Name <add> <add>> :memo: Add a badge for the ArXiv identifier of your paper (arXiv:YYMM.NNNNN) <add> <add>[![Paper](http://img.shields.io/badge/paper-arXiv.YYMM.NNNNN-B3181B.svg)](https://arxiv.org/abs/...) <add> <add>This repository is the official or unofficial implementation of the following paper. <add> <add>* Paper title: [Paper Title](https://arxiv.org/abs/YYMM.NNNNN) <add> <add>## Description <add> <add>> :memo: Provide description of the model. <add>> <add>> * Provide brief information of the algorithms used. <add>> * Provide links for demos, blog posts, etc. <add> <add>## History <add> <add>> :memo: Provide a changelog. <add> <add>## Maintainers <add> <add>> :memo: Provide maintainer information. <add> <add>* Last name, First name ([@GitHub username](https://github.com/username)) <add>* Last name, First name ([@GitHub username](https://github.com/username)) <add> <add>## Table of Contents <add> <add>> :memo: Provide a table of contents to help readers navigate a lengthy README document. <add> <add>## Requirements <add> <add>[![tensorFlow 2.1+](https://img.shields.io/badge/TensorFlow-2.1-brightgreen)](https://github.com/tensorflow/tensorflow/releases/tag/v2.1.0) <add>[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/) <add> <add>> :memo: Provide details of the software required. <add>> <add>> * Add a `requirements.txt` file to the root directory for installing the necessary dependencies. <add>> * Describe how to install requirements using pip. <add>> * Alternatively, create INSTALL.md. <add> <add>To install requirements: <add> <add>```setup <add>pip install -r requirements.txt <add>``` <add> <add>## Results <add> <add>> :memo: Provide a table with results. (e.g., accuracy, latency) <add>> <add>> * Provide links to the pre-trained models (checkpoint, SavedModel files). <add>> * Publish TensorFlow SavedModel files on TensorFlow Hub (tfhub.dev) if possible. <add>> * Add links to [TensorBoard.dev](https://tensorboard.dev/) for visualizing metrics. <add>> <add>> An example table for image classification results <add>> <add>> ### Image Classification <add>> <add>> | Model name | Download | Top 1 Accuracy | Top 5 Accuracy | <add>> |------------|----------|----------------|----------------| <add>> | Model name | [Checkpoint](https://drive.google.com/...), [SavedModel](https://tfhub.dev/...) | xx% | xx% | <add> <add>## Dataset <add> <add>> :memo: Provide information of the dataset used. <add> <add>## Training <add> <add>> :memo: Provide training information. <add>> <add>> * Provide details for preprocessing, hyperparameters, random seeds, and environment. <add>> * Provide a command line example for training. <add> <add>Please run this command line for training. <add> <add>```shell <add>python3 ... <add>``` <add> <add>## Evaluation <add> <add>> :memo: Provide an evaluation script with details of how to reproduce results. <add>> <add>> * Describe data preprocessing / postprocessing steps. <add>> * Provide a command line example for evaluation. <add> <add>Please run this command line for evaluation. <add> <add>```shell <add>python3 ... <add>``` <add> <add>## References <add> <add>> :memo: Provide links to references. <add> <add>## License <add> <add>> :memo: Place your license text in a file named LICENSE in the root of the repository. <add>> <add>> * Include information about your license. <add>> * Reference: [Adding a license to a repository](https://help.github.com/en/github/building-a-strong-community/adding-a-license-to-a-repository) <add> <add>This project is licensed under the terms of the **Apache License 2.0**. <add> <add>## Citation <add> <add>> :memo: Make your repository citable. <add>> <add>> * Reference: [Making Your Code Citable](https://guides.github.com/activities/citable-code/) <add> <add>If you want to cite this repository in your research paper, please use the following information. <ide><path>CONTRIBUTING.md <del># Contributing guidelines <add># How to contribute <ide> <del>If you have created a model and would like to publish it here, please send us a <del>pull request. For those just getting started with pull requests, GitHub has a <del>[howto](https://help.github.com/articles/using-pull-requests/). <add>![Contributors](https://img.shields.io/github/contributors/tensorflow/models) <ide> <del>The code for any model in this repository is licensed under the Apache License <del>2.0. <add>We encourage you to contribute to the TensorFlow Model Garden. <ide> <del>In order to accept our code, we have to make sure that we can publish your code: <del>You have to sign a Contributor License Agreement (CLA). <add>Please read our [guidelines](../../wiki/How-to-contribute) for details. <ide> <del>***NOTE***: Only [code owners](./CODEOWNERS) are allowed to merge a pull request. <add>**NOTE**: Only [code owners](./CODEOWNERS) are allowed to merge a pull request. <ide> Please contact the code owners of each model to merge your pull request. <del> <del>### Contributor License Agreements <del> <del>Please fill out either the individual or corporate Contributor License Agreement (CLA). <del> <del> * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). <del> * If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). <del> <del>Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests. <del> <del>***NOTE***: Only original source code from you and other people that have signed the CLA can be accepted into the repository. <del> <ide><path>README.md <ide> <ide> The TensorFlow Model Garden is a repository with a number of different implementations of state-of-the-art (SOTA) models and modeling solutions for TensorFlow users. We aim to demonstrate the best practices for modeling so that TensorFlow users can take full advantage of TensorFlow for their research and product development. <ide> <del>## Structure <del> <del>| Folder | Description | <add>| Directory | Description | <ide> |-----------|-------------| <del>| [official](official) | • **A collection of example implementations for SOTA models using the latest TensorFlow 2's high-level APIs**<br />• Officially maintained, supported, and kept up to date with the latest TensorFlow 2 APIs<br />• Reasonably optimized for fast performance while still being easy to read | <del>| [research](research) | • A collection of research model implementations in TensorFlow 1 or 2 by researchers<br />• Up to the individual researchers to maintain the model implementations and/or provide support on issues and pull requests | <add>| [official](official) | • A collection of example implementations for SOTA models using the latest TensorFlow 2's high-level APIs<br />• Officially maintained, supported, and kept up to date with the latest TensorFlow 2 APIs by TensorFlow<br />• Reasonably optimized for fast performance while still being easy to read | <add>| [research](research) | • A collection of research model implementations in TensorFlow 1 or 2 by researchers<br />• Maintained and supported by researchers | <ide> | [community](community) | • A curated list of the GitHub repositories with machine learning models and implementations powered by TensorFlow 2 | <ide> <del>## Contribution guidelines <add>## [Announcements](../../wiki/Announcements) <add> <add>* March 31, 2020: [Introducing the Model Garden for TensorFlow 2](https://blog.tensorflow.org/2020/03/introducing-model-garden-for-tensorflow-2.html) ([Tweet](https://twitter.com/TensorFlow/status/1245029834633297921)) <add> <add>## Contributions <ide> <del>If you want to contribute to models, please review the [contribution guidelines](CONTRIBUTING.md). <add>If you want to contribute, please review the [contribution guidelines](../../wiki/How-to-contribute). <ide> <ide> ## License <ide> <ide><path>community/README.md <ide> <ide> This repository provides a curated list of the GitHub repositories with machine learning models and implementations powered by TensorFlow 2. <ide> <del>**Disclosure**: Contributing companies or individuals are responsible for maintaining their repositories. <add>**Note**: Contributing companies or individuals are responsible for maintaining their repositories. <ide> <ide> ## Models / Implementations <ide> <ide> This repository provides a curated list of the GitHub repositories with machine <ide> | [Mask R-CNN](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow2/Segmentation/MaskRCNN) | [Mask R-CNN](https://arxiv.org/abs/1703.06870) | • Automatic Mixed Precision<br/>• Multi-GPU training support with Horovod<br/>• TensorRT | [NVIDIA](https://github.com/NVIDIA) | <ide> | [U-Net Medical Image Segmentation](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow2/Segmentation/UNet_Medical) | [U-Net: Convolutional Networks for Biomedical Image Segmentation](https://arxiv.org/abs/1505.04597) | • Automatic Mixed Precision<br/>• Multi-GPU training support with Horovod<br/>• TensorRT | [NVIDIA](https://github.com/NVIDIA) | <ide> <del> <ide> ## Contributions <del>If you have a suggestion for the community model repository, please submit a pull request. <add> <add>If you want to contribute, please review the [contribution guidelines](../../../wiki/How-to-contribute). <ide><path>official/README.md <ide> The TensorFlow official models are a collection of models <ide> that use TensorFlow’s high-level APIs. <ide> They are intended to be well-maintained, tested, and kept up to date <ide> with the latest TensorFlow API. <add> <ide> They should also be reasonably optimized for fast performance while still <ide> being easy to read. <ide> These models are used as end-to-end tests, ensuring that the models run <ide> with the same or improved speed and performance with each new TensorFlow build. <ide> <del>## Model Implementations <add>## More models to come! <ide> <del>### Natural Language Processing <add>The team is actively developing new models. <add>In the near future, we will add: <add> <add>* State-of-the-art language understanding models: <add> More members in Transformer family <add>* Start-of-the-art image classification models: <add> EfficientNet, MnasNet, and variants <add>* A set of excellent objection detection models. <add> <add>## Table of Contents <ide> <del>| Model | Description | Reference | <del>| ----- | ----------- | --------- | <del>| [ALBERT](nlp/albert) | A Lite BERT for Self-supervised Learning of Language Representations | [arXiv:1909.11942](https://arxiv.org/abs/1909.11942) | <del>| [BERT](nlp/bert) | A powerful pre-trained language representation model: BERT (Bidirectional Encoder Representations from Transformers) | [arXiv:1810.04805](https://arxiv.org/abs/1810.04805) | <del>| [NHNet](nlp/nhnet) | A transformer-based multi-sequence to sequence model: Generating Representative Headlines for News Stories | [arXiv:2001.09386](https://arxiv.org/abs/2001.09386) | <del>| [Transformer](nlp/transformer) | A transformer model to translate the WMT English to German dataset | [arXiv:1706.03762](https://arxiv.org/abs/1706.03762) | <del>| [XLNet](nlp/xlnet) | XLNet: Generalized Autoregressive Pretraining for Language Understanding | [arXiv:1906.08237](https://arxiv.org/abs/1906.08237) | <add>- [Models and Implementations](#models-and-implementations) <add> * [Computer Vision](#computer-vision) <add> + [Image Classification](#image-classification) <add> + [Object Detection and Segmentation](#object-detection-and-segmentation) <add> * [Natural Language Processing](#natural-language-processing) <add> * [Recommendation](#recommendation) <add>- [How to get started with the official models](#how-to-get-started-with-the-official-models) <add> <add>## Models and Implementations <ide> <ide> ### Computer Vision <ide> <del>| Model | Description | Reference | <del>| ----- | ----------- | --------- | <del>| [MNIST](vision/image_classification) | A basic model to classify digits from the MNIST dataset | [Link](http://yann.lecun.com/exdb/mnist/) | <del>| [ResNet](vision/image_classification) | A deep residual network for image recognition | [arXiv:1512.03385](https://arxiv.org/abs/1512.03385) | <del>| [RetinaNet](vision/detection) | A fast and powerful object detector | [arXiv:1708.02002](https://arxiv.org/abs/1708.02002) | <del>| [Mask R-CNN](vision/detection) | An object detection and instance segmentation model | [arXiv:1703.06870](https://arxiv.org/abs/1703.06870) | <add>#### Image Classification <add> <add>| Model | Reference (Paper) | <add>|-------|-------------------| <add>| [MNIST](vision/image_classification) | A basic model to classify digits from the [MNIST dataset](http://yann.lecun.com/exdb/mnist/) | <add>| [ResNet](vision/image_classification) | [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) | <ide> <del>### Other models <add>#### Object Detection and Segmentation <ide> <del>| Model | Description | Reference | <del>| ----- | ----------- | --------- | <del>| [NCF](recommendation) | Neural Collaborative Filtering model for recommendation tasks | [arXiv:1708.05031](https://arxiv.org/abs/1708.05031) | <add>| Model | Reference (Paper) | <add>|-------|-------------------| <add>| [RetinaNet](vision/detection) | [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002) | <add>| [Mask R-CNN](vision/detection) | [Mask R-CNN](https://arxiv.org/abs/1703.06870) | <add> <add>### Natural Language Processing <ide> <del>--- <add>| Model | Reference (Paper) | <add>|-------|-------------------| <add>| [ALBERT (A Lite BERT)](nlp/albert) | [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942) | <add>| [BERT (Bidirectional Encoder Representations from Transformers)](nlp/bert) | [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) | <add>| [NHNet (News Headline generation model)](nlp/nhnet) | [Generating Representative Headlines for News Stories](https://arxiv.org/abs/2001.09386) | <add>| [Transformer](nlp/transformer) | [Attention Is All You Need](https://arxiv.org/abs/1706.03762) | <add>| [XLNet](nlp/xlnet) | [XLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) | <ide> <del>## How to get started with the Model Garden official models <add>### Recommendation <add> <add>| Model | Reference (Paper) | <add>|-------|-------------------| <add>| [NCF](recommendation) | [Neural Collaborative Filtering](https://arxiv.org/abs/1708.05031) | <add> <add>## How to get started with the official models <ide> <ide> * The models in the master branch are developed using TensorFlow 2, <ide> and they target the TensorFlow [nightly binaries](https://github.com/tensorflow/tensorflow#installation) <ide> os.environ['PYTHONPATH'] += ":/path/to/models" <ide> pip3 install --user -r official/requirements.txt <ide> ``` <ide> <del>--- <del> <del>## More models to come! <del> <del>The team is actively developing new models. <del>In the near future, we will add: <del> <del>- State-of-the-art language understanding models: <del> More members in Transformer family <del>- Start-of-the-art image classification models: <del> EfficientNet, MnasNet and variants. <del>- A set of excellent objection detection models. <del> <del>If you would like to make any fixes or improvements to the models, please <del>[submit a pull request](https://github.com/tensorflow/models/compare). <del> <del>--- <del> <ide> ## Contributions <ide> <del>Every model should follow our guidelines to uphold our objectives of readable, <del>usable, and maintainable code. <del> <del>### General Guidelines <del> <del>- Code should be well documented and tested. <del>- Runnable from a blank environment with ease. <del>- Trainable on: single GPU/CPU (baseline), multiple GPUs & TPUs <del>- Compatible with Python 3 (using [six](https://pythonhosted.org/six/) <del>when being compatible with Python 2 is necessary) <del>- Conform to <del> [Google Python Style Guide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md) <del> <del>### Implementation Guidelines <del> <del>These guidelines are to ensure consistent model implementations for <del>better readability and maintainability. <del> <del>- Use [common utility functions](utils) <del>- Export SavedModel at the end of the training. <del>- Consistent flags and flag-parsing library ([read more here](utils/flags/guidelines.md)) <add>If you want to contribute, please review the [contribution guidelines](../../../wiki/How-to-contribute). <ide><path>research/README.md <ide> <ide> # TensorFlow Research Models <ide> <del>This folder contains machine learning models implemented by researchers in [TensorFlow](https://tensorflow.org). <add>This directory contains code implementations and pre-trained models of published research papers. <ide> <del>The research models are maintained by their respective authors. <add>The research models are maintained by their respective authors. <ide> <del>**Note: Some research models are stale and have not updated to the latest TensorFlow 2 yet.** <add>## Table of Contents <add>- [Modeling Libraries and Models](#modeling-libraries-and-models) <add>- [Models and Implementations](#models-and-implementations) <add> * [Computer Vision](#computer-vision) <add> * [Natural Language Processing](#natural-language-processing) <add> * [Audio and Speech](#audio-and-speech) <add> * [Reinforcement Learning](#reinforcement-learning) <add> * [Others](#others) <add>- [Archived Models and Implementations](#warning-archived-models-and-implementations) (:no_entry_sign: No longer maintained) <ide> <del>--- <add>## Modeling Libraries and Models <add> <add>| Directory | Name | Description | Maintainer(s) | <add>|-----------|------|-------------|---------------| <add>| [object_detection](object_detection) | TensorFlow Object Detection API | A framework that makes it easy to construct, train and deploy object detection models<br /><br />A collection of object detection models pre-trained on the COCO dataset, the Kitti dataset, the Open Images dataset, the AVA v2.1 dataset, and the iNaturalist Species Detection Dataset| @jch1, @tombstone, @pkulzc | <add>| [slim](slim) | TensorFlow-Slim Image Classification Model Library | A lightweight high-level API of TensorFlow for defining, training and evaluating image classification models <br />• Inception V1/V2/V3/V4<br />• Inception-ResNet-v2<br />• ResNet V1/V2<br />• VGG 16/19<br />• MobileNet V1/V2/V3<br />• NASNet-A_Mobile/Large<br />• PNASNet-5_Large/Mobile | @sguada, @marksandler2 | <add> <add>## Models and Implementations <add> <add>### Computer Vision <add> <add>| Directory | Referenece (Paper) | Maintainer(s) | <add>|-----------|--------------------|---------------| <add>| [attention_ocr](attention_ocr) | [Attention-based Extraction of Structured Information from Street View Imagery](https://arxiv.org/abs/1704.03549) | xavigibert | <add>| [autoaugment](autoaugment) | [1] [AutoAugment](https://arxiv.org/abs/1805.09501)<br />[2] [Wide Residual Networks](https://arxiv.org/abs/1605.07146)<br />[3] [Shake-Shake regularization](https://arxiv.org/abs/1705.07485)<br />[4] [ShakeDrop Regularization for Deep Residual Learning](https://arxiv.org/abs/1802.02375) | barretzoph | <add>| [deeplab](deeplab) | [1] [DeepLabv1](https://arxiv.org/abs/1412.7062)<br />[2] [DeepLabv2](https://arxiv.org/abs/1606.00915)<br />[3] [DeepLabv3](https://arxiv.org/abs/1802.02611)<br />[4] [DeepLabv3+](https://arxiv.org/abs/1706.05587) | aquariusjay, yknzhu | <add>| [delf](delf) | [1] DELF (DEep Local Features): [Large-Scale Image Retrieval with Attentive Deep Local Features](https://arxiv.org/abs/1612.06321)<br />[2] [Detect-to-Retrieve](https://arxiv.org/abs/1812.01584) | andrefaraujo | <add>| [lstm_object_detection](lstm_object_detection) | [Mobile Video Object Detection with Temporally-Aware Feature Maps](https://arxiv.org/abs/1711.06368) | yinxiaoli, yongzhe2160, lzyuan | <add>| [marco](marco) | [Classification of crystallization outcomes using deep convolutional neural networks](https://arxiv.org/abs/1803.10342) | vincentvanhoucke | <add>| [vid2depth](vid2depth) | [Unsupervised Learning of Depth and Ego-Motion from Monocular Video Using 3D Geometric Constraints](https://arxiv.org/abs/1802.05522) | rezama | <add> <add>### Natural Language Processing <add> <add>| Directory | Referenece (Paper) | Maintainer(s) | <add>|-----------|--------------------|---------------| <add>| [adversarial_text](adversarial_text) | [1] [Adversarial Training Methods for Semi-Supervised Text](https://arxiv.org/abs/1605.07725) Classification<br />[2] [Semi-supervised Sequence Learning](https://arxiv.org/abs/1511.01432) | rsepassi, a-dai | <add>| [cvt_text](cvt_text) | [Semi-supervised sequence learning with cross-view training](https://arxiv.org/abs/1809.08370) | clarkkev, lmthang | <add> <add>### Audio and Speech <ide> <del>## Frameworks / APIs with Models <del>| Folder | Framework | Description | Maintainer(s) | <del>|--------|-----------|-------------|---------------| <del>| [object_detection](object_detection) | TensorFlow Object Detection API | A framework that makes it easy to construct, train and deploy object detection models<br/> | jch1, tombstone, derekjchow, jesu9, dreamdragon, pkulzc | <del>| [slim](slim) | TensorFlow-Slim Image Classification Model Library | A lightweight high-level API of TensorFlow for defining, training and evaluating image classification models <br/>• Inception V1/V2/V3/V4<br/>• Inception-ResNet-v2<br/>• ResNet V1/V2<br/>• VGG 16/19<br/>• MobileNet V1/V2/V3<br/>• NASNet-A_Mobile/Large<br/>• PNASNet-5_Large/Mobile | sguada, nathansilberman | <add>| Directory | Referenece (Paper) | Maintainer(s) | <add>|-----------|--------------------|---------------| <add>| [audioset](audioset) | [1] [AudioSet: A Large Scale Dataset of Audio Events](https://research.google/pubs/pub45857/)<br />[2] [CNN Architectures for Large-Scale Audio Classification](https://research.google/pubs/pub45611/) | plakal, dpwe | <add> <add>### Reinforcement Learning <add> <add>| Directory | Referenece (Paper) | Maintainer(s) | <add>|-----------|--------------------|---------------| <add>| [efficient-hrl](efficient-hrl) | [1] [Data-Efficient Hierarchical Reinforcement Learning](https://arxiv.org/abs/1805.08296)<br />[2] [Near-Optimal Representation Learning for Hierarchical Reinforcement Learning](https://arxiv.org/abs/1810.01257) | ofirnachum | <add>| [pcl_rl](pcl_rl) | [1] [Improving Policy Gradient by Exploring Under-appreciated Rewards](https://arxiv.org/abs/1611.09321)<br />[2] [Bridging the Gap Between Value and Policy Based Reinforcement Learning](https://arxiv.org/abs/1702.08892)<br />[3] [Trust-PCL: An Off-Policy Trust Region Method for Continuous Control](https://arxiv.org/abs/1707.01891) | ofirnachum | <add> <add>### Others <add> <add>| Directory | Referenece (Paper) | Maintainer(s) | <add>|-----------|--------------------|---------------| <add>| [lfads](lfads) | [LFADS - Latent Factor Analysis via Dynamical Systems](https://doi.org/10.1101/152884) | jazcollins, sussillo | <add>| [rebar](rebar) | [REBAR: Low-variance, unbiased gradient estimates for discrete latent variable models](https://arxiv.org/abs/1703.07370) | gjtucker | <ide> <ide> --- <ide> <del>## Models / Implementations <del> <del>| Folder | Paper(s) | Description | Maintainer(s) | <del>|--------|----------|-------------|---------------| <del>| [adv_imagenet<br />_models](adv_imagenet_models) | [1] [Adversarial Machine Learning at Scale](https://arxiv.org/abs/1611.01236)<br/>[2] [Ensemble Adversarial Training: Attacks and Defenses](https://arxiv.org/abs/1705.07204) | Adversarially trained ImageNet models | alexeykurakin | <del>| [adversarial_crypto](adversarial_crypto) | [Learning to Protect Communications with Adversarial Neural Cryptography](https://arxiv.org/abs/1610.06918) | Code to train encoder/decoder/adversary network triplets and evaluate their effectiveness on randomly generated input and key pairs | dave-andersen | <del>| [adversarial<br />_logit_pairing](adversarial_logit_pairing) | [Adversarial Logit Pairing](https://arxiv.org/abs/1803.06373) | Implementation of Adversarial logit pairing paper as well as few models pre-trained on ImageNet and Tiny ImageNet | alexeykurakin | <del>| [adversarial_text](adversarial_text) | [1] [Adversarial Training Methods for Semi-Supervised Text](https://arxiv.org/abs/1605.07725) Classification<br/>[2] [Semi-supervised Sequence Learning](https://arxiv.org/abs/1511.01432) | Adversarial Training Methods for Semi-Supervised Text Classification| rsepassi, a-dai | <del>| [attention_ocr](attention_ocr) | [Attention-based Extraction of Structured Information from Street View Imagery](https://arxiv.org/abs/1704.03549) | | xavigibert | <del>| [audioset](audioset) | Models for AudioSet: A Large Scale Dataset of Audio Events | | plakal, dpwe | <del>| [autoaugment](autoaugment) | [1] [AutoAugment](https://arxiv.org/abs/1805.09501)<br/>[2] [Wide Residual Networks](https://arxiv.org/abs/1605.07146)<br/>[3] [Shake-Shake regularization](https://arxiv.org/abs/1705.07485)<br/>[4] [ShakeDrop Regularization for Deep Residual Learning](https://arxiv.org/abs/1802.02375) | Train Wide-ResNet, Shake-Shake and ShakeDrop models on CIFAR-10 and CIFAR-100 dataset with AutoAugment | barretzoph | <del>| [autoencoder](autoencoder) | Various autoencoders | | snurkabill | <del>| [brain_coder](brain_coder) | [Neural Program Synthesis with Priority Queue Training](https://arxiv.org/abs/1801.03526) | Program synthesis with reinforcement learning | danabo | <del>| [cognitive_mapping<br />_and_planning](cognitive_mapping_and_planning) | [Cognitive Mapping and Planning for Visual Navigation](https://arxiv.org/abs/1702.03920) | Implementation of a spatial memory based mapping and planning architecture for visual navigation | s-gupta | <del>| [compression](compression) | [Full Resolution Image Compression with Recurrent Neural Networks](https://arxiv.org/abs/1608.05148) | | nmjohn | <del>| [cvt_text](cvt_text) | [Semi-supervised sequence learning with cross-view training](https://arxiv.org/abs/1809.08370) | | clarkkev, lmthang | <del>| [deep_contextual<br />_bandits](deep_contextual_bandits) | [Deep Bayesian Bandits Showdown: An Empirical Comparison of Bayesian Deep Networks for Thompson Sampling](https://arxiv.org/abs/1802.09127) | | rikel | <del>| [deep_speech](deep_speech) | [Deep Speech 2](https://arxiv.org/abs/1512.02595) | End-to-End Speech Recognition in English and Mandarin | | <del>| [deeplab](deeplab) | [1] [DeepLabv1](https://arxiv.org/abs/1412.7062)<br/>[2] [DeepLabv2](https://arxiv.org/abs/1606.00915)<br/>[3] [DeepLabv3](https://arxiv.org/abs/1802.02611)<br/>[4] [DeepLabv3+](https://arxiv.org/abs/1706.05587) | DeepLab models for semantic image segmentation | aquariusjay, yknzhu, gpapan | <del>| [delf](delf) | [1] [Large-Scale Image Retrieval with Attentive Deep Local Features](https://arxiv.org/abs/1612.06321) <br/>[2] [Detect-to-Retrieve](https://arxiv.org/abs/1812.01584) | DELF: DEep Local Features | andrefaraujo | <del>| [domain_adaptation](domain_adaptation) | [1] [Domain Separation Networks](https://arxiv.org/abs/1608.06019) <br/>[2] [Unsupervised Pixel-Level Domain Adaptation with Generative Adversarial Networks](https://arxiv.org/abs/1612.05424) | Code used for two domain adaptation papers| bousmalis, dmrd | <del>| [efficient-hrl](efficient-hrl) | [1] [Data-Efficient Hierarchical Reinforcement Learning](https://arxiv.org/abs/1805.08296)<br/>[2] [Near-Optimal Representation Learning for Hierarchical Reinforcement Learning](https://arxiv.org/abs/1810.01257) | Code for performing hierarchical reinforcement learning | ofirnachum | <del>| [feelvos](feelvos)| [FEELVOS](https://arxiv.org/abs/1902.09513) | Fast End-to-End Embedding Learning for Video Object Segmentation | | <del>| [fivo](fivo)| [Filtering variational objectives for training generative sequence models](https://arxiv.org/abs/1705.09279) | | dieterichlawson | <del>| [global_objectives](global_objectives) | [Scalable Learning of Non-Decomposable Objectives](https://arxiv.org/abs/1608.04802) | TensorFlow loss functions that optimize directly for a variety of objectives including AUC, recall at precision, and more | mackeya-google | <del>| [im2txt](im2txt) | [Show and Tell: Lessons learned from the 2015 MSCOCO Image Captioning Challenge](https://arxiv.org/abs/1609.06647) | Image-to-text neural network for image captioning| cshallue | <del>| [inception](inception) | [Rethinking the Inception Architecture for Computer Vision](https://arxiv.org/abs/1512.00567) | Deep convolutional networks for computer vision | shlens, vincentvanhoucke | <del>| [keypointnet](keypointnet) | [KeypointNet](https://arxiv.org/abs/1807.03146) | Discovery of Latent 3D Keypoints via End-to-end Geometric Reasoning | mnorouzi | <del>| [learned_optimizer](learned_optimizer) | [Learned Optimizers that Scale and Generalize](https://arxiv.org/abs/1703.04813) | | olganw, nirum | <del>| [learning_to<br />_remember<br />_rare_events](learning_to_remember_rare_events) | [Learning to Remember Rare Events](https://arxiv.org/abs/1703.03129) | A large-scale life-long memory module for use in deep learning | lukaszkaiser, ofirnachum | <del>| [learning<br />_unsupervised<br />_learning](learning_unsupervised_learning) | [Meta-Learning Update Rules for Unsupervised Representation Learning](https://arxiv.org/abs/1804.00222) | A meta-learned unsupervised learning update rule| lukemetz, nirum | <del>| [lexnet_nc](lexnet_nc) | LexNET | Noun Compound Relation Classification | vered1986, waterson | <del>| [lfads](lfads) | [LFADS - Latent Factor Analysis via Dynamical Systems](https://doi.org/10.1101/152884) | Sequential variational autoencoder for analyzing neuroscience data| jazcollins, sussillo | <del>| [lm_1b](lm_1b) | [Exploring the Limits of Language Modeling](https://arxiv.org/abs/1602.02410) | Language modeling on the one billion word benchmark | oriolvinyals, panyx0718 | <del>| [lm_commonsense](lm_commonsense) | [A Simple Method for Commonsense Reasoning](https://arxiv.org/abs/1806.02847) | Commonsense reasoning using language models | thtrieu | <del>| [lstm_object_detection](lstm_object_detection) | [Mobile Video Object Detection with Temporally-Aware Feature Maps](https://arxiv.org/abs/1711.06368) | | dreamdragon, masonliuw, yinxiaoli, yongzhe2160 | <del>| [marco](marco) | [Classification of crystallization outcomes using deep convolutional neural networks](https://arxiv.org/abs/1803.10342) | | vincentvanhoucke | <del>| [maskgan](maskgan)| [MaskGAN: Better Text Generation via Filling in the______](https://arxiv.org/abs/1801.07736) | Text generation with GANs | liamb315, a-dai | <del>| [namignizer](namignizer)| Namignizer | Recognize and generate names | knathanieltucker | <del>| [neural_gpu](neural_gpu)| [Neural GPUs Learn Algorithms](https://arxiv.org/abs/1511.08228) | Highly parallel neural computer | lukaszkaiser | <del>| [neural_programmer](neural_programmer) | [Learning a Natural Language Interface with Neural Programmer](https://arxiv.org/abs/1611.08945) | Neural network augmented with logic and mathematic operations| arvind2505 | <del>| [next_frame<br />_prediction](next_frame_prediction) | [Visual Dynamics](https://arxiv.org/abs/1607.02586) | Probabilistic Future Frame Synthesis via Cross Convolutional Networks| panyx0718 | <del>| [pcl_rl](pcl_rl) | [1] [Improving Policy Gradient by Exploring Under-appreciated Rewards](https://arxiv.org/abs/1611.09321)<br/>[2] [Bridging the Gap Between Value and Policy Based Reinforcement Learning](https://arxiv.org/abs/1702.08892)<br/>[3] [Trust-PCL: An Off-Policy Trust Region Method for Continuous Control](https://arxiv.org/abs/1707.01891) | Code for several reinforcement learning algorithms | ofirnachum | <del>| [ptn](ptn) | [Perspective Transformer Nets](https://arxiv.org/abs/1612.00814) | Learning Single-View 3D Object Reconstruction without 3D Supervision | xcyan, arkanath, hellojas, honglaklee | <del>| [qa_kg](qa_kg) | [Learning to Reason](https://arxiv.org/abs/1704.05526) | End-to-End Module Networks for Visual Question Answering | yuyuz | <del>| [real_nvp](real_nvp) | [Density estimation using Real NVP](https://arxiv.org/abs/1605.08803) | | laurent-dinh | <del>| [rebar](rebar) | [REBAR](https://arxiv.org/abs/1703.07370) | Low-variance, unbiased gradient estimates for discrete latent variable models | gjtucker | <del>| [sentiment<br />_analysis](sentiment_analysis)| [Effective Use of Word Order for Text Categorization with Convolutional Neural Networks](https://arxiv.org/abs/1412.1058) | A simple model to classify a document's sentiment | sculd | <del>| [seq2species](seq2species) | [Seq2Species: A deep learning approach to pattern recognition for short DNA sequences](https://doi.org/10.1101/353474) | Neural Network Models for Species Classification| apbusia, depristo | <del>| [skip_thoughts](skip_thoughts) | [Skip-Thought Vectors](https://arxiv.org/abs/1506.06726) | Recurrent neural network sentence-to-vector encoder | cshallue| <del>| [steve](steve) | [Sample-Efficient Reinforcement Learning with Stochastic Ensemble Value Expansion](https://arxiv.org/abs/1807.01675) | A hybrid model-based/model-free reinforcement learning algorithm for sample-efficient continuous control | buckman-google | <del>| [street](street) | [End-to-End Interpretation of the French Street Name Signs Dataset](https://arxiv.org/abs/1702.03970) | Identify the name of a street (in France) from an image using a Deep RNN| theraysmith | <del>| [struct2depth](struct2depth)| [Depth Prediction Without the Sensors: Leveraging Structure for Unsupervised Learning from Monocular Videos](https://arxiv.org/abs/1811.06152) | Unsupervised learning of depth and ego-motion| aneliaangelova | <del>| [swivel](swivel) | [Swivel: Improving Embeddings by Noticing What's Missing](https://arxiv.org/abs/1602.02215) | The Swivel algorithm for generating word embeddings | waterson | <del>| [tcn](tcn) | [Time-Contrastive Networks: Self-Supervised Learning from Video](https://arxiv.org/abs/1704.06888) | Self-supervised representation learning from multi-view video | coreylynch, sermanet | <del>| [textsum](textsum)| Sequence-to-sequence with attention model for text summarization | | panyx0718, peterjliu | <del>| [transformer](transformer) | [Spatial Transformer Network](https://arxiv.org/abs/1506.02025) | Spatial transformer network that allows the spatial manipulation of data within the network| daviddao| <del>| [vid2depth](vid2depth) | [Unsupervised Learning of Depth and Ego-Motion from Monocular Video Using 3D Geometric Constraints](https://arxiv.org/abs/1802.05522) | Learning depth and ego-motion unsupervised from raw monocular video | rezama | <del>| [video<br />_prediction](video_prediction) | [Unsupervised Learning for Physical Interaction through Video Prediction](https://arxiv.org/abs/1605.07157) | Predicting future video frames with neural advection| cbfinn | <add>## :warning: Archived Models and Implementations <add> <add>The following research models are no longer maintained. <add> <add>**Note**: We will remove archived models from the master branch in June, 2020. <add>After removal, you will still be able to access archived models in the archive branch. <add> <add>| Directory | Referenece (Paper) | Maintainer(s) | <add>|-----------|--------------------|---------------| <add>| [adv_imagenet_models](adv_imagenet_models) | [1] [Adversarial Machine Learning at Scale](https://arxiv.org/abs/1611.01236)<br />[2] [Ensemble Adversarial Training: Attacks and Defenses](https://arxiv.org/abs/1705.07204) | alexeykurakin | <add>| [adversarial_crypto](adversarial_crypto) | [Learning to Protect Communications with Adversarial Neural Cryptography](https://arxiv.org/abs/1610.06918) | dave-andersen | <add>| [adversarial_logit_pairing](adversarial_logit_pairing) | [Adversarial Logit Pairing](https://arxiv.org/abs/1803.06373) | alexeykurakin | <add>| [autoencoder](autoencoder) | Various autoencoders | snurkabill | <add>| [brain_coder](brain_coder) | [Neural Program Synthesis with Priority Queue Training](https://arxiv.org/abs/1801.03526) | danabo, mnorouzi | <add>| [cognitive_mapping_and_planning](cognitive_mapping_and_planning) | [Cognitive Mapping and Planning for Visual Navigation](https://arxiv.org/abs/1702.03920) | s-gupta | <add>| [compression](compression) | [Full Resolution Image Compression with Recurrent Neural Networks](https://arxiv.org/abs/1608.05148) | nmjohn | <add>| [deep_contextual_bandits](deep_contextual_bandits) | [Deep Bayesian Bandits Showdown: An Empirical Comparison of Bayesian Deep Networks for Thompson Sampling](https://arxiv.org/abs/1802.09127) | rikel | <add>| [deep_speech](deep_speech) | [Deep Speech 2](https://arxiv.org/abs/1512.02595) | yhliang2018 | <add>| [domain_adaptation](domain_adaptation) | [1] [Domain Separation Networks](https://arxiv.org/abs/1608.06019) <br />[2] [Unsupervised Pixel-Level Domain Adaptation with Generative Adversarial Networks](https://arxiv.org/abs/1612.05424) | bousmalis, dmrd | <add>| [feelvos](feelvos)| [FEELVOS](https://arxiv.org/abs/1902.09513) | pvoigtlaender, yuningchai, aquariusjay | <add>| [fivo](fivo)| [Filtering variational objectives for training generative sequence models](https://arxiv.org/abs/1705.09279) | dieterichlawson | <add>| [global_objectives](global_objectives) | [Scalable Learning of Non-Decomposable Objectives](https://arxiv.org/abs/1608.04802) | mackeya-google | <add>| [im2txt](im2txt) | [Show and Tell: Lessons learned from the 2015 MSCOCO Image Captioning Challenge](https://arxiv.org/abs/1609.06647) | cshallue | <add>| [inception](inception) | [Rethinking the Inception Architecture for Computer Vision](https://arxiv.org/abs/1512.00567) | shlens, vincentvanhoucke | <add>| [keypointnet](keypointnet) | [KeypointNet](https://arxiv.org/abs/1807.03146) | mnorouzi | <add>| [learned_optimizer](learned_optimizer) | [Learned Optimizers that Scale and Generalize](https://arxiv.org/abs/1703.04813) | olganw, nirum | <add>| [learning_to_remember_rare_events](learning_to_remember_rare_events) | [Learning to Remember Rare Events](https://arxiv.org/abs/1703.03129) | lukaszkaiser, ofirnachum | <add>| [learning_unsupervised_learning](learning_unsupervised_learning) | [Meta-Learning Update Rules for Unsupervised Representation Learning](https://arxiv.org/abs/1804.00222) | lukemetz, nirum | <add>| [lexnet_nc](lexnet_nc) | [Olive Oil is Made of Olives, Baby Oil is Made for Babies: Interpreting Noun Compounds using Paraphrases in a Neural Model](https://arxiv.org/abs/1803.08073) | vered1986, waterson | <add>| [lm_1b](lm_1b) | [Exploring the Limits of Language Modeling](https://arxiv.org/abs/1602.02410) | oriolvinyals, panyx0718 | <add>| [lm_commonsense](lm_commonsense) | [A Simple Method for Commonsense Reasoning](https://arxiv.org/abs/1806.02847) | thtrieu | <add>| [maskgan](maskgan)| [MaskGAN: Better Text Generation via Filling in the______](https://arxiv.org/abs/1801.07736) | liamb315, a-dai | <add>| [namignizer](namignizer)| Namignizer | knathanieltucker | <add>| [neural_gpu](neural_gpu)| [Neural GPUs Learn Algorithms](https://arxiv.org/abs/1511.08228) | lukaszkaiser | <add>| [neural_programmer](neural_programmer) | [Learning a Natural Language Interface with Neural Programmer](https://arxiv.org/abs/1611.08945) | arvind2505 | <add>| [next_frame_prediction](next_frame_prediction) | [Visual Dynamics](https://arxiv.org/abs/1607.02586) | panyx0718 | <add>| [ptn](ptn) | [Perspective Transformer Nets](https://arxiv.org/abs/1612.00814) | xcyan, arkanath, hellojas, honglaklee | <add>| [qa_kg](qa_kg) | [Learning to Reason](https://arxiv.org/abs/1704.05526) | yuyuz | <add>| [real_nvp](real_nvp) | [Density estimation using Real NVP](https://arxiv.org/abs/1605.08803) | laurent-dinh | <add>| [sentiment_analysis](sentiment_analysis)| [Effective Use of Word Order for Text Categorization with Convolutional Neural Networks](https://arxiv.org/abs/1412.1058) | sculd | <add>| [seq2species](seq2species) | [Seq2Species: A deep learning approach to pattern recognition for short DNA sequences](https://doi.org/10.1101/353474) | apbusia, depristo | <add>| [skip_thoughts](skip_thoughts) | [Skip-Thought Vectors](https://arxiv.org/abs/1506.06726) | cshallue | <add>| [steve](steve) | [Sample-Efficient Reinforcement Learning with Stochastic Ensemble Value Expansion](https://arxiv.org/abs/1807.01675) | buckman-google | <add>| [street](street) | [End-to-End Interpretation of the French Street Name Signs Dataset](https://arxiv.org/abs/1702.03970) | theraysmith | <add>| [struct2depth](struct2depth)| [Depth Prediction Without the Sensors: Leveraging Structure for Unsupervised Learning from Monocular Videos](https://arxiv.org/abs/1811.06152) | aneliaangelova | <add>| [swivel](swivel) | [Swivel: Improving Embeddings by Noticing What's Missing](https://arxiv.org/abs/1602.02215) | waterson | <add>| [tcn](tcn) | [Time-Contrastive Networks: Self-Supervised Learning from Video](https://arxiv.org/abs/1704.06888) | coreylynch, sermanet | <add>| [textsum](textsum)| [A Neural Attention Model for Abstractive Sentence Summarization](https://arxiv.org/abs/1509.00685) | panyx0718, peterjliu | <add>| [transformer](transformer) | [Spatial Transformer Network](https://arxiv.org/abs/1506.02025) | daviddao| <add>| [video_prediction](video_prediction) | [Unsupervised Learning for Physical Interaction through Video Prediction](https://arxiv.org/abs/1605.07157) | cbfinn | <ide> <ide> --- <ide> <ide> ## Contributions <ide> <del>If you want to contribute a new model, please submit a pull request. <add>If you want to contribute, please review the [contribution guidelines](../../../wiki/How-to-contribute).
7
Ruby
Ruby
require the files we test
19dd2166103cc1d39d7346714c46f32191958981
<ide><path>activerecord/test/cases/tasks/database_tasks_test.rb <ide> require 'cases/helper' <add>require 'active_record/tasks/database_tasks' <ide> <ide> module ActiveRecord <ide> module DatabaseTasksSetupper
1
Javascript
Javascript
use const in viewer_compatibility.js
b777e775f4865222d24281ca51724ac3f210b6a2
<ide><path>web/viewer_compatibility.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <add>/* eslint no-var: error, prefer-const: error */ <ide> <del>let compatibilityParams = Object.create(null); <add>const compatibilityParams = Object.create(null); <ide> if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { <ide> const userAgent = <ide> (typeof navigator !== 'undefined' && navigator.userAgent) || '';
1
Ruby
Ruby
improve hash#compact! documentation and tests
0dd23446a32b4e4974572a39582ea4c11475b80a
<ide><path>activesupport/lib/active_support/core_ext/hash/compact.rb <ide> class Hash <ide> # Returns a hash with non +nil+ values. <ide> # <ide> # hash = { a: true, b: false, c: nil } <del> # hash.compact # => { a: true, b: false } <del> # hash # => { a: true, b: false, c: nil } <del> # { c: nil }.compact # => {} <add> # hash.compact # => { a: true, b: false } <add> # hash # => { a: true, b: false, c: nil } <add> # { c: nil }.compact # => {} <add> # { c: true }.compact # => { c: true } <ide> def compact <ide> self.select { |_, value| !value.nil? } <ide> end <ide> <ide> # Replaces current hash with non +nil+ values. <add> # Returns nil if no changes were made, otherwise returns the hash. <ide> # <ide> # hash = { a: true, b: false, c: nil } <del> # hash.compact! # => { a: true, b: false } <del> # hash # => { a: true, b: false } <add> # hash.compact! # => { a: true, b: false } <add> # hash # => { a: true, b: false } <add> # { c: true }.compact! # => nil <ide> def compact! <ide> self.reject! { |_, value| value.nil? } <ide> end <ide><path>activesupport/test/core_ext/hash_ext_test.rb <ide> def test_compact <ide> h = hash_with_only_nil_values.dup <ide> assert_equal({}, h.compact) <ide> assert_equal(hash_with_only_nil_values, h) <add> <add> h = @symbols.dup <add> assert_equal(@symbols, h.compact) <add> assert_equal(@symbols, h) <ide> end <ide> <ide> def test_compact! <ide> def test_compact! <ide> h = hash_with_only_nil_values.dup <ide> assert_equal({}, h.compact!) <ide> assert_equal({}, h) <add> <add> h = @symbols.dup <add> assert_equal(nil, h.compact!) <add> assert_equal(@symbols, h) <ide> end <ide> <ide> def test_new_with_to_hash_conversion
2
Python
Python
use only ascii chars to build the progress bar
ee6d7e4b5c9acc14e9646519afbd9a3fdb95f3f8
<ide><path>glances/outputs/glances_bars.py <ide> <ide> """Manage bars for Glances output.""" <ide> <del># Import system lib <del>import locale <add>from __future__ import division <add> <ide> from math import modf <ide> <add>curses_bars = [' ', ' ', ' ', ' ', '|', '|', '|', '|', '|'] <add> <ide> <ide> class Bar(object): <ide> <ide> class Bar(object): <ide> sys.stdout.flush() <ide> """ <ide> <del> def __init__(self, size, <del> pre_char='[', <del> post_char=']', <del> empty_char='_', <del> with_text=True): <add> def __init__(self, size, pre_char='[', post_char=']', empty_char=' ', with_text=True): <ide> # Bar size <ide> self.__size = size <ide> # Bar current percent <ide> def __init__(self, size, <ide> self.__post_char = post_char <ide> self.__empty_char = empty_char <ide> self.__with_text = with_text <del> # Char used for the bar <del> self.curses_bars = self.__get_curses_bars() <del> <del> def __get_curses_bars(self): <del> # Return the chars used to display the bar <del> if locale.getdefaultlocale()[1] == 'UTF-8': <del> return [" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉", "█"] <del> else: <del> return [" ", " ", " ", " ", "|", "|", "|", "|", "|"] <ide> <ide> @property <ide> def size(self, with_decoration=False): <ide> def percent(self, value): <ide> assert value <= 100 <ide> self.__percent = value <ide> <add> @property <add> def pre_char(self): <add> return self.__pre_char <add> <add> @property <add> def post_char(self): <add> return self.__post_char <add> <ide> def __str__(self): <ide> """Return the bars.""" <ide> frac, whole = modf(self.size * self.percent / 100.0) <del> ret = self.curses_bars[8] * int(whole) <add> ret = curses_bars[8] * int(whole) <ide> if frac > 0: <del> ret += self.curses_bars[int(frac * 8)] <add> ret += curses_bars[int(frac * 8)] <ide> whole += 1 <ide> ret += self.__empty_char * int(self.size - whole) <ide> if self.__with_text: <ide> ret = '{0}{1:>5}%'.format(ret, self.percent) <del> return self.__pre_char + ret + self.__post_char <add> return ret <ide><path>glances/plugins/glances_quicklook.py <ide> def msg_curse(self, args=None, max_width=10): <ide> return ret <ide> <ide> # Define the bar <del> bar = Bar(max_width, pre_char='|', post_char='|', empty_char=' ') <add> bar = Bar(max_width) <ide> <ide> # Build the string message <ide> for key in ['cpu', 'mem', 'swap']: <ide> bar.percent = self.stats[key] <del> msg = '{0:>4} '.format(key.upper()) <add> msg = '{0:4} '.format(key.upper()) <ide> ret.append(self.curse_add_line(msg)) <del> msg = '{0}'.format(bar) <del> ret.append(self.curse_add_line(msg, <del> self.get_views(key=key, <del> option='decoration'))) <add> ret.append(self.curse_add_line(bar.pre_char, decoration='BOLD')) <add> ret.append(self.curse_add_line(str(bar), self.get_views(key=key, option='decoration'))) <add> ret.append(self.curse_add_line(bar.post_char, decoration='BOLD')) <ide> ret.append(self.curse_new_line()) <ide> <ide> # Return the message with decoration
2
Go
Go
reduce string-matching in tests
de10c7d0136dc054abdb40ca624211c04334bdc0
<ide><path>client/checkpoint_create_test.go <ide> func TestCheckpointCreateError(t *testing.T) { <ide> Exit: true, <ide> }) <ide> <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/checkpoint_delete_test.go <ide> func TestCheckpointDeleteError(t *testing.T) { <ide> CheckpointID: "checkpoint_id", <ide> }) <ide> <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/checkpoint_list_test.go <ide> func TestCheckpointListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.CheckpointList(context.Background(), "container_id", types.CheckpointListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/config_create_test.go <ide> func TestConfigCreateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ConfigCreate(context.Background(), swarm.ConfigSpec{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/config_inspect_test.go <ide> func TestConfigInspectError(t *testing.T) { <ide> } <ide> <ide> _, _, err := client.ConfigInspectWithRaw(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/config_list_test.go <ide> func TestConfigListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.ConfigList(context.Background(), types.ConfigListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/config_remove_test.go <ide> func TestConfigRemoveError(t *testing.T) { <ide> } <ide> <ide> err := client.ConfigRemove(context.Background(), "config_id") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/config_update_test.go <ide> func TestConfigUpdateError(t *testing.T) { <ide> } <ide> <ide> err := client.ConfigUpdate(context.Background(), "config_id", swarm.Version{}, swarm.ConfigSpec{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_commit_test.go <ide> func TestContainerCommitError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerCommit(context.Background(), "nothing", types.ContainerCommitOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_copy_test.go <ide> func TestContainerStatPathError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerStatPath(context.Background(), "container_id", "path") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestCopyToContainerError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.CopyToContainer(context.Background(), "container_id", "path/to/file", bytes.NewReader([]byte("")), types.CopyToContainerOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestCopyFromContainerError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, _, err := client.CopyFromContainer(context.Background(), "container_id", "path/to/file") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_create_test.go <ide> func TestContainerCreateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerCreate(context.Background(), nil, nil, nil, "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error while testing StatusInternalServerError, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <ide> t.Fatalf("expected a Server Error while testing StatusInternalServerError, got %T", err) <ide> } <ide> func TestContainerCreateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusNotFound, "Server error")), <ide> } <ide> _, err = client.ContainerCreate(context.Background(), nil, nil, nil, "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error while testing StatusNotFound, got %v", err) <del> } <ide> if err == nil || !IsErrNotFound(err) { <ide> t.Fatalf("expected a Server Error while testing StatusNotFound, got %T", err) <ide> } <ide><path>client/container_diff_test.go <ide> func TestContainerDiffError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerDiff(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_exec_test.go <ide> func TestContainerExecCreateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerExecCreate(context.Background(), "container_id", types.ExecConfig{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestContainerExecStartError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerExecStart(context.Background(), "nothing", types.ExecStartCheck{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestContainerExecInspectError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerExecInspect(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_export_test.go <ide> func TestContainerExportError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerExport(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_inspect_test.go <ide> func TestContainerInspectError(t *testing.T) { <ide> } <ide> <ide> _, err := client.ContainerInspect(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_kill_test.go <ide> func TestContainerKillError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerKill(context.Background(), "nothing", "SIGKILL") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_list_test.go <ide> func TestContainerListError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerList(context.Background(), types.ContainerListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_logs_test.go <ide> import ( <ide> "time" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/errdefs" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> ) <ide> func TestContainerLogsError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{}) <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> _, err = client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{ <ide> Since: "2006-01-02TZ", <ide> }) <ide><path>client/container_pause_test.go <ide> func TestContainerPauseError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerPause(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_prune_test.go <ide> import ( <ide> <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/api/types/filters" <add> "github.com/docker/docker/errdefs" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> ) <ide> func TestContainersPruneError(t *testing.T) { <ide> filters := filters.NewArgs() <ide> <ide> _, err := client.ContainersPrune(context.Background(), filters) <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestContainersPrune(t *testing.T) { <ide><path>client/container_remove_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/errdefs" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> ) <ide> func TestContainerRemoveError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerRemove(context.Background(), "container_id", types.ContainerRemoveOptions{}) <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestContainerRemoveNotFoundError(t *testing.T) { <ide><path>client/container_rename_test.go <ide> func TestContainerRenameError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerRename(context.Background(), "nothing", "newNothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_resize_test.go <ide> func TestContainerResizeError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerResize(context.Background(), "container_id", types.ResizeOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestContainerExecResizeError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerExecResize(context.Background(), "exec_id", types.ResizeOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_restart_test.go <ide> func TestContainerRestartError(t *testing.T) { <ide> } <ide> timeout := 0 * time.Second <ide> err := client.ContainerRestart(context.Background(), "nothing", &timeout) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_start_test.go <ide> func TestContainerStartError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerStart(context.Background(), "nothing", types.ContainerStartOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_stats_test.go <ide> func TestContainerStatsError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerStats(context.Background(), "nothing", false) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_stop_test.go <ide> func TestContainerStopError(t *testing.T) { <ide> } <ide> timeout := 0 * time.Second <ide> err := client.ContainerStop(context.Background(), "nothing", &timeout) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_top_test.go <ide> func TestContainerTopError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerTop(context.Background(), "nothing", []string{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_unpause_test.go <ide> func TestContainerUnpauseError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> err := client.ContainerUnpause(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_update_test.go <ide> func TestContainerUpdateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerUpdate(context.Background(), "nothing", container.UpdateConfig{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/container_wait_test.go <ide> func TestContainerWaitError(t *testing.T) { <ide> case result := <-resultC: <ide> t.Fatalf("expected to not get a wait result, got %d", result.StatusCode) <ide> case err := <-errC: <del> if err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> } <ide><path>client/disk_usage_test.go <ide> func TestDiskUsageError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.DiskUsage(context.Background()) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/events_test.go <ide> func TestEventsErrorFromServer(t *testing.T) { <ide> } <ide> _, errs := client.Events(context.Background(), types.EventsOptions{}) <ide> err := <-errs <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_build_test.go <ide> func TestImageBuildError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImageBuild(context.Background(), nil, types.ImageBuildOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_create_test.go <ide> func TestImageCreateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImageCreate(context.Background(), "reference", types.ImageCreateOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_history_test.go <ide> func TestImageHistoryError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImageHistory(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_import_test.go <ide> func TestImageImportError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImageImport(context.Background(), types.ImageImportSource{}, "image:tag", types.ImageImportOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_inspect_test.go <ide> func TestImageInspectError(t *testing.T) { <ide> } <ide> <ide> _, _, err := client.ImageInspectWithRaw(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_list_test.go <ide> func TestImageListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.ImageList(context.Background(), types.ImageListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_load_test.go <ide> func TestImageLoadError(t *testing.T) { <ide> } <ide> <ide> _, err := client.ImageLoad(context.Background(), nil, true) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_prune_test.go <ide> import ( <ide> "strings" <ide> "testing" <ide> <add> "github.com/docker/docker/errdefs" <add> <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/api/types/filters" <ide> "gotest.tools/assert" <ide> func TestImagesPruneError(t *testing.T) { <ide> version: "1.25", <ide> } <ide> <del> filters := filters.NewArgs() <del> <del> _, err := client.ImagesPrune(context.Background(), filters) <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> _, err := client.ImagesPrune(context.Background(), filters.NewArgs()) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestImagesPrune(t *testing.T) { <ide><path>client/image_pull_test.go <ide> func TestImagePullAnyError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImagePull(context.Background(), "myimage", types.ImagePullOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestImagePullStatusUnauthorizedError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")), <ide> } <ide> _, err := client.ImagePull(context.Background(), "myimage", types.ImagePullOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Unauthorized error" { <del> t.Fatalf("expected an Unauthorized Error, got %v", err) <add> if !errdefs.IsUnauthorized(err) { <add> t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestImagePullWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T) <ide> _, err := client.ImagePull(context.Background(), "myimage", types.ImagePullOptions{ <ide> PrivilegeFunc: privilegeFunc, <ide> }) <del> if err == nil || err.Error() != "Error response from daemon: Unauthorized error" { <del> t.Fatalf("expected an Unauthorized Error, got %v", err) <add> if !errdefs.IsUnauthorized(err) { <add> t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_push_test.go <ide> func TestImagePushAnyError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestImagePushStatusUnauthorizedError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")), <ide> } <ide> _, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Unauthorized error" { <del> t.Fatalf("expected an Unauthorized Error, got %v", err) <add> if !errdefs.IsUnauthorized(err) { <add> t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestImagePushWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T) <ide> _, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{ <ide> PrivilegeFunc: privilegeFunc, <ide> }) <del> if err == nil || err.Error() != "Error response from daemon: Unauthorized error" { <del> t.Fatalf("expected an Unauthorized Error, got %v", err) <add> if !errdefs.IsUnauthorized(err) { <add> t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_remove_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/errdefs" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> ) <ide> func TestImageRemoveError(t *testing.T) { <ide> } <ide> <ide> _, err := client.ImageRemove(context.Background(), "image_id", types.ImageRemoveOptions{}) <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestImageRemoveImageNotFound(t *testing.T) { <ide><path>client/image_save_test.go <ide> func TestImageSaveError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImageSave(context.Background(), []string{"nothing"}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_search_test.go <ide> func TestImageSearchAnyError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ImageSearch(context.Background(), "some-image", types.ImageSearchOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestImageSearchStatusUnauthorizedError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")), <ide> } <ide> _, err := client.ImageSearch(context.Background(), "some-image", types.ImageSearchOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Unauthorized error" { <del> t.Fatalf("expected an Unauthorized Error, got %v", err) <add> if !errdefs.IsUnauthorized(err) { <add> t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide> func TestImageSearchWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing. <ide> _, err := client.ImageSearch(context.Background(), "some-image", types.ImageSearchOptions{ <ide> PrivilegeFunc: privilegeFunc, <ide> }) <del> if err == nil || err.Error() != "Error response from daemon: Unauthorized error" { <del> t.Fatalf("expected an Unauthorized Error, got %v", err) <add> if !errdefs.IsUnauthorized(err) { <add> t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/image_tag_test.go <ide> func TestImageTagError(t *testing.T) { <ide> } <ide> <ide> err := client.ImageTag(context.Background(), "image_id", "repo:tag") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/info_test.go <ide> func TestInfoServerError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.Info(context.Background()) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/network_connect_test.go <ide> func TestNetworkConnectError(t *testing.T) { <ide> } <ide> <ide> err := client.NetworkConnect(context.Background(), "network_id", "container_id", nil) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/network_create_test.go <ide> func TestNetworkCreateError(t *testing.T) { <ide> } <ide> <ide> _, err := client.NetworkCreate(context.Background(), "mynetwork", types.NetworkCreate{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/network_disconnect_test.go <ide> func TestNetworkDisconnectError(t *testing.T) { <ide> } <ide> <ide> err := client.NetworkDisconnect(context.Background(), "network_id", "container_id", false) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/network_inspect_test.go <ide> import ( <ide> <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/api/types/network" <add> "github.com/docker/docker/errdefs" <ide> "github.com/pkg/errors" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> func TestNetworkInspectError(t *testing.T) { <ide> } <ide> <ide> _, err := client.NetworkInspect(context.Background(), "nothing", types.NetworkInspectOptions{}) <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestNetworkInspectNotFoundError(t *testing.T) { <ide><path>client/network_list_test.go <ide> func TestNetworkListError(t *testing.T) { <ide> _, err := client.NetworkList(context.Background(), types.NetworkListOptions{ <ide> Filters: filters.NewArgs(), <ide> }) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/network_prune_test.go <ide> func TestNetworksPruneError(t *testing.T) { <ide> filters := filters.NewArgs() <ide> <ide> _, err := client.NetworksPrune(context.Background(), filters) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/network_remove_test.go <ide> func TestNetworkRemoveError(t *testing.T) { <ide> } <ide> <ide> err := client.NetworkRemove(context.Background(), "network_id") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/node_inspect_test.go <ide> func TestNodeInspectError(t *testing.T) { <ide> } <ide> <ide> _, _, err := client.NodeInspectWithRaw(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/node_list_test.go <ide> func TestNodeListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.NodeList(context.Background(), types.NodeListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/node_remove_test.go <ide> func TestNodeRemoveError(t *testing.T) { <ide> } <ide> <ide> err := client.NodeRemove(context.Background(), "node_id", types.NodeRemoveOptions{Force: false}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/node_update_test.go <ide> func TestNodeUpdateError(t *testing.T) { <ide> } <ide> <ide> err := client.NodeUpdate(context.Background(), "node_id", swarm.Version{}, swarm.NodeSpec{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/plugin_disable_test.go <ide> func TestPluginDisableError(t *testing.T) { <ide> } <ide> <ide> err := client.PluginDisable(context.Background(), "plugin_name", types.PluginDisableOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/plugin_enable_test.go <ide> func TestPluginEnableError(t *testing.T) { <ide> } <ide> <ide> err := client.PluginEnable(context.Background(), "plugin_name", types.PluginEnableOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/plugin_inspect_test.go <ide> func TestPluginInspectError(t *testing.T) { <ide> } <ide> <ide> _, _, err := client.PluginInspectWithRaw(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/plugin_list_test.go <ide> func TestPluginListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.PluginList(context.Background(), filters.NewArgs()) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/plugin_push_test.go <ide> func TestPluginPushError(t *testing.T) { <ide> } <ide> <ide> _, err := client.PluginPush(context.Background(), "plugin_name", "") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/plugin_remove_test.go <ide> func TestPluginRemoveError(t *testing.T) { <ide> } <ide> <ide> err := client.PluginRemove(context.Background(), "plugin_name", types.PluginRemoveOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/plugin_set_test.go <ide> func TestPluginSetError(t *testing.T) { <ide> } <ide> <ide> err := client.PluginSet(context.Background(), "plugin_name", []string{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/request_test.go <ide> func TestPlainTextError(t *testing.T) { <ide> client: newMockClient(plainTextErrorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ContainerList(context.Background(), types.ContainerListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/secret_create_test.go <ide> func TestSecretCreateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.SecretCreate(context.Background(), swarm.SecretSpec{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/secret_inspect_test.go <ide> func TestSecretInspectError(t *testing.T) { <ide> } <ide> <ide> _, _, err := client.SecretInspectWithRaw(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/secret_list_test.go <ide> func TestSecretListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.SecretList(context.Background(), types.SecretListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/secret_remove_test.go <ide> func TestSecretRemoveError(t *testing.T) { <ide> } <ide> <ide> err := client.SecretRemove(context.Background(), "secret_id") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/secret_update_test.go <ide> func TestSecretUpdateError(t *testing.T) { <ide> } <ide> <ide> err := client.SecretUpdate(context.Background(), "secret_id", swarm.Version{}, swarm.SecretSpec{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/service_create_test.go <ide> func TestServiceCreateError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ServiceCreate(context.Background(), swarm.ServiceSpec{}, types.ServiceCreateOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/service_inspect_test.go <ide> func TestServiceInspectError(t *testing.T) { <ide> } <ide> <ide> _, _, err := client.ServiceInspectWithRaw(context.Background(), "nothing", types.ServiceInspectOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/service_list_test.go <ide> func TestServiceListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.ServiceList(context.Background(), types.ServiceListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/service_logs_test.go <ide> import ( <ide> "time" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/errdefs" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> ) <ide> func TestServiceLogsError(t *testing.T) { <ide> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <ide> } <ide> _, err := client.ServiceLogs(context.Background(), "service_id", types.ContainerLogsOptions{}) <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> _, err = client.ServiceLogs(context.Background(), "service_id", types.ContainerLogsOptions{ <ide> Since: "2006-01-02TZ", <ide> }) <ide><path>client/service_remove_test.go <ide> import ( <ide> "strings" <ide> "testing" <ide> <add> "github.com/docker/docker/errdefs" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> ) <ide> func TestServiceRemoveError(t *testing.T) { <ide> } <ide> <ide> err := client.ServiceRemove(context.Background(), "service_id") <del> assert.Check(t, is.Error(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestServiceRemoveNotFoundError(t *testing.T) { <ide><path>client/service_update_test.go <ide> func TestServiceUpdateError(t *testing.T) { <ide> } <ide> <ide> _, err := client.ServiceUpdate(context.Background(), "service_id", swarm.Version{}, swarm.ServiceSpec{}, types.ServiceUpdateOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/swarm_get_unlock_key_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/errdefs" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> ) <ide> func TestSwarmGetUnlockKeyError(t *testing.T) { <ide> } <ide> <ide> _, err := client.SwarmGetUnlockKey(context.Background()) <del> assert.Check(t, is.ErrorContains(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestSwarmGetUnlockKey(t *testing.T) { <ide><path>client/swarm_init_test.go <ide> func TestSwarmInitError(t *testing.T) { <ide> } <ide> <ide> _, err := client.SwarmInit(context.Background(), swarm.InitRequest{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/swarm_inspect_test.go <ide> func TestSwarmInspectError(t *testing.T) { <ide> } <ide> <ide> _, err := client.SwarmInspect(context.Background()) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/swarm_join_test.go <ide> func TestSwarmJoinError(t *testing.T) { <ide> } <ide> <ide> err := client.SwarmJoin(context.Background(), swarm.JoinRequest{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/swarm_leave_test.go <ide> func TestSwarmLeaveError(t *testing.T) { <ide> } <ide> <ide> err := client.SwarmLeave(context.Background(), false) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/swarm_unlock_test.go <ide> func TestSwarmUnlockError(t *testing.T) { <ide> } <ide> <ide> err := client.SwarmUnlock(context.Background(), swarm.UnlockRequest{UnlockKey: "SWMKEY-1-y6guTZNTwpQeTL5RhUfOsdBdXoQjiB2GADHSRJvbXeU"}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/swarm_update_test.go <ide> func TestSwarmUpdateError(t *testing.T) { <ide> } <ide> <ide> err := client.SwarmUpdate(context.Background(), swarm.Version{}, swarm.Spec{}, swarm.UpdateFlags{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/task_inspect_test.go <ide> func TestTaskInspectError(t *testing.T) { <ide> } <ide> <ide> _, _, err := client.TaskInspectWithRaw(context.Background(), "nothing") <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/task_list_test.go <ide> func TestTaskListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.TaskList(context.Background(), types.TaskListOptions{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/volume_create_test.go <ide> func TestVolumeCreateError(t *testing.T) { <ide> } <ide> <ide> _, err := client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{}) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/volume_inspect_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/errdefs" <ide> "github.com/pkg/errors" <ide> "gotest.tools/assert" <ide> is "gotest.tools/assert/cmp" <ide> func TestVolumeInspectError(t *testing.T) { <ide> } <ide> <ide> _, err := client.VolumeInspect(context.Background(), "nothing") <del> assert.Check(t, is.ErrorContains(err, "Error response from daemon: Server error")) <add> if !errdefs.IsSystem(err) { <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <add> } <ide> } <ide> <ide> func TestVolumeInspectNotFound(t *testing.T) { <ide><path>client/volume_list_test.go <ide> func TestVolumeListError(t *testing.T) { <ide> } <ide> <ide> _, err := client.VolumeList(context.Background(), filters.NewArgs()) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide> <ide><path>client/volume_remove_test.go <ide> func TestVolumeRemoveError(t *testing.T) { <ide> } <ide> <ide> err := client.VolumeRemove(context.Background(), "volume_id", false) <del> if err == nil || err.Error() != "Error response from daemon: Server error" { <del> t.Fatalf("expected a Server Error, got %v", err) <del> } <ide> if !errdefs.IsSystem(err) { <del> t.Fatalf("expected a Server Error, got %T", err) <add> t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) <ide> } <ide> } <ide>
91
Ruby
Ruby
fix ci failure due to remaining tagging records
b2b559c75cf7c8f1dc6f22057b7780c72f45af51
<ide><path>activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb <ide> def setup <ide> ActiveRecord::Base.store_full_sti_class = store_full_sti_class <ide> <ide> post = Namespaced::Post.create(title: "Great stuff", body: "This is not", author_id: 1) <del> @tagging = Tagging.create(taggable: post) <add> @tagging = post.create_tagging! <ide> end <ide> <ide> def teardown
1
PHP
PHP
bugfix - alternative
4d770fd9a31ad02f724428ec0d15ca38a81cc3d1
<ide><path>src/Illuminate/Redis/Connections/PhpRedisConnection.php <ide> public function command($method, array $parameters = []) <ide> try { <ide> return parent::command($method, $parameters); <ide> } catch (RedisException $e) { <del> if (str_contains($e->getMessage(), 'went away')) { <add> if (str_contains($e->getMessage(), 'went away') || str_contains($e->getMessage(), 'socket')) { <ide> $this->client = $this->connector ? call_user_func($this->connector) : $this->client; <ide> } <ide>
1
Text
Text
fix typo + grammar in viewsets docs
df11198c6cfd543925eabc95d10c596c40ab3ab5
<ide><path>docs/api-guide/viewsets.md <ide> A `ViewSet` class is simply **a type of class-based View, that does not provide <ide> <ide> The method handlers for a `ViewSet` are only bound to the corresponding actions at the point of finalizing the view, using the `.as_view()` method. <ide> <del>Typically, rather than exlicitly registering the views in a viewset in the urlconf, you'll register the viewset with a router class, that automatically determines the urlconf for you. <add>Typically, rather than explicitly registering the views in a viewset in the urlconf, you'll register the viewset with a router class, that automatically determines the urlconf for you. <ide> <ide> ## Example <ide> <del>Let's define a simple viewset that can be used to listing or retrieving all the users in the system. <add>Let's define a simple viewset that can be used to list or retrieve all the users in the system. <ide> <ide> class UserViewSet(viewsets.ViewSet): <ide> """
1
Javascript
Javascript
remove unused flag
b4e314891826da7e65ce600cdcf320041dafc0d2
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.js <ide> import { <ide> warnAboutUnmockedScheduler, <ide> flushSuspenseFallbacksInTests, <ide> disableSchedulerTimeoutBasedOnReactExpirationTime, <del> enableTrainModelFix, <ide> } from 'shared/ReactFeatureFlags'; <ide> import ReactSharedInternals from 'shared/ReactSharedInternals'; <ide> import invariant from 'shared/invariant'; <ide> function getNextRootExpirationTimeToWorkOn(root: FiberRoot): ExpirationTime { <ide> lastPingedTime > nextKnownPendingLevel <ide> ? lastPingedTime <ide> : nextKnownPendingLevel; <del> if ( <del> enableTrainModelFix && <del> nextLevel <= Idle && <del> firstPendingTime !== nextLevel <del> ) { <add> if (nextLevel <= Idle && firstPendingTime !== nextLevel) { <ide> // Don't work on Idle/Never priority unless everything else is committed. <ide> return NoWork; <ide> } <ide> export function pingSuspendedRoot( <ide> // Mark the time at which this ping was scheduled. <ide> root.lastPingedTime = suspendedTime; <ide> <del> if (!enableTrainModelFix && root.finishedExpirationTime === suspendedTime) { <del> // If there's a pending fallback waiting to commit, throw it away. <del> root.finishedExpirationTime = NoWork; <del> root.finishedWork = null; <del> } <del> <ide> ensureRootIsScheduled(root); <ide> schedulePendingInteractions(root, suspendedTime); <ide> } <ide><path>packages/shared/ReactFeatureFlags.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> <del>export const enableTrainModelFix = true; <del> <ide> export const enableTrustedTypesIntegration = false; <ide> <ide> // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> export const warnAboutStringRefs = false; <ide> export const disableLegacyContext = false; <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <del>export const enableTrainModelFix = true; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = false; <ide> export const disableMapsAsChildren = false; <ide><path>packages/shared/forks/ReactFeatureFlags.native-oss.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> export const warnAboutStringRefs = false; <ide> export const disableLegacyContext = false; <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <del>export const enableTrainModelFix = true; <ide> export const enableTrustedTypesIntegration = false; <ide> export const enableNativeTargetAsInstance = false; <ide> export const disableTextareaChildren = false; <ide><path>packages/shared/forks/ReactFeatureFlags.persistent.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> export const warnAboutStringRefs = false; <ide> export const disableLegacyContext = false; <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <del>export const enableTrainModelFix = true; <ide> export const enableTrustedTypesIntegration = false; <ide> export const enableNativeTargetAsInstance = false; <ide> export const disableTextareaChildren = false; <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> export const warnAboutStringRefs = false; <ide> export const disableLegacyContext = false; <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <del>export const enableTrainModelFix = true; <ide> export const enableTrustedTypesIntegration = false; <ide> export const enableNativeTargetAsInstance = false; <ide> export const disableTextareaChildren = false; <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.www.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> export const warnAboutStringRefs = false; <ide> export const disableLegacyContext = false; <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <del>export const enableTrainModelFix = true; <ide> export const enableTrustedTypesIntegration = false; <ide> export const enableNativeTargetAsInstance = false; <ide> export const disableTextareaChildren = false; <ide><path>packages/shared/forks/ReactFeatureFlags.testing.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> export const warnAboutStringRefs = false; <ide> export const disableLegacyContext = false; <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <del>export const enableTrainModelFix = true; <ide> export const enableTrustedTypesIntegration = false; <ide> export const enableNativeTargetAsInstance = false; <ide> export const disableTextareaChildren = false; <ide><path>packages/shared/forks/ReactFeatureFlags.testing.www.js <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> export const warnAboutStringRefs = false; <ide> export const disableLegacyContext = __EXPERIMENTAL__; <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <del>export const enableTrainModelFix = true; <ide> export const enableTrustedTypesIntegration = false; <ide> export const enableNativeTargetAsInstance = false; <ide> export const disableTextareaChildren = __EXPERIMENTAL__; <ide><path>packages/shared/forks/ReactFeatureFlags.www.js <ide> export const disableLegacyContext = __EXPERIMENTAL__; <ide> export const warnAboutStringRefs = false; <ide> export const warnAboutDefaultPropsOnFunctionComponents = false; <ide> <del>export const enableTrainModelFix = true; <del> <ide> export const enableSuspenseServerRenderer = true; <ide> export const enableSelectiveHydration = true; <ide>
10
Text
Text
update changelog with pr changes
ca114316475326962493c294df3e9a1b3922474e
<ide><path>actionpack/CHANGELOG.md <add>* Add the following permissions policy directives: `hid`, `idle-detection`, `screen-wake-lock`, <add> `serial`, `sync-xhr`, `web-share`. <add> <add> *Guillaume Cabanel* <add> <ide> * The `speaker`, `vibrate`, and `vr` permissions policy directives are now <ide> deprecated. <ide>
1
Javascript
Javascript
remove trailing whitespace
22392ef949904c699f409d0cfa14756cf86df7a1
<ide><path>src/ng/compile.js <ide> * `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an <ide> * object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a <ide> * component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will <del> * also be called when your bindings are initialized. <add> * also be called when your bindings are initialized. <ide> * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on <ide> * changes. Any actions that you wish to take in response to the changes that you detect must be <ide> * invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook
1
Text
Text
add reference to wiki for deploying to github
0fdd379eee33ac9708a74cd994ba3fdfbffbdee0
<ide><path>readme.md <ide> Then you've a static version of your app in the “out" directory. <ide> <ide> > You can also customize the output directory. For that run `next export -h` for the help. <ide> <del>Now you can deploy that directory to any static hosting service. <add>Now you can deploy that directory to any static hosting service. Note that there is an additional step for deploying to GitHub Pages, [documented here](https://github.com/zeit/next.js/wiki/Deploying-a-Next.js-app-into-GitHub-Pages). <ide> <ide> For an example, simply visit the “out” directory and run following command to deploy your app to [ZEIT now](https://zeit.co/now). <ide>
1
Python
Python
change weight path
c9e5b0d67b211a88ad2d849327df4b748ffbe2d6
<ide><path>keras/applications/convnext.py <ide> import tensorflow.compat.v2 as tf <ide> from tensorflow.python.util.tf_export import keras_export <ide> <del>BASE_WEIGHTS_PATH = "https://storage.googleapis.com/convnext-tf/keras-applications-temp/convnext/" <add>BASE_WEIGHTS_PATH = "https://storage.googleapis.com/tensorflow/keras-applications/convnext/" <ide> <ide> WEIGHTS_HASHES = { <ide> "tiny":
1
Ruby
Ruby
adjust rebuild handling
95b44eab4964c9b6ebf615a0fc58d013fb23582c
<ide><path>Library/Homebrew/github_packages.rb <ide> def upload_bottles(bottles_hash, dry_run:) <ide> end <ide> end <ide> <del> def self.version_rebuild(version, rebuild) <del> return version.to_s unless rebuild.to_i.positive? <add> def self.version_rebuild(version, rebuild, bottle_tag = nil) <add> bottle_tag = (".#{bottle_tag}" if bottle_tag.present?) <add> <add> rebuild = if rebuild.to_i.positive? <add> if bottle_tag <add> ".#{rebuild}" <add> else <add> "-#{rebuild}" <add> end <add> end <ide> <del> "#{version}.#{rebuild}" <add> "#{version}#{bottle_tag}#{rebuild}" <ide> end <ide> <ide> def self.repo_without_prefix(repo) <ide> def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:) <ide> formulae_dir = tag_hash["formulae_brew_sh_path"] <ide> documentation = "https://formulae.brew.sh/#{formulae_dir}/#{formula_name}" if formula_core_tap <ide> <del> rebuild = ".#{rebuild}" if rebuild.to_i.positive? <del> tag = "#{version}.#{bottle_tag}#{rebuild}" <add> tag = GitHubPackages.version_rebuild(version, rebuild, bottle_tag) <ide> <ide> annotations_hash = formula_annotations_hash.merge({ <ide> "org.opencontainers.image.created" => created_date,
1
Javascript
Javascript
remove todo and add a description instead
57fd70fc7d3918a6bd4c714fe479488391a563f6
<ide><path>lib/_stream_transform.js <ide> function done(stream, er, data) { <ide> if (data != null) // Single equals check for both `null` and `undefined` <ide> stream.push(data); <ide> <del> // TODO(BridgeAR): Write a test for these two error cases <del> // if there's nothing in the write buffer, then that means <del> // that nothing more will ever be provided <add> // These two error cases are coherence checks that can likely not be tested. <ide> if (stream._writableState.length) <ide> throw new ERR_TRANSFORM_WITH_LENGTH_0(); <ide>
1
Text
Text
add chat badge
9fd7a9f58f06bae8122c9c243f71a9af863e5444
<ide><path>README.md <ide> [![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/) <ide> [![Open Source Helpers](https://www.codetriage.com/freecodecamp/freecodecamp/badges/users.svg)](https://www.codetriage.com/freecodecamp/freecodecamp) <ide> [![Setup Automated](https://img.shields.io/badge/setup-automated-blue?logo=gitpod)](https://gitpod.io/from-referrer/) <add>[![Rocket.Chat](https://chat.freecodecamp.org/api/v1/shield.svg?type=online&icon=false&name=Chat)](https://chat.freecodecamp.org/) <ide> <ide> ## freeCodeCamp.org's open-source codebase and curriculum <ide>
1
Ruby
Ruby
simplify logic (#538)
91a47a9ed6d85c1bf8f507cdfef4462a07f61831
<ide><path>Library/Homebrew/os/mac/linkage_checker.rb <ide> def check_dylibs <ide> def check_undeclared_deps <ide> filter_out = proc do |dep| <ide> next true if dep.build? <del> dep.optional? && !dep.option_names.any? { |n| formula.build.with?(n) } <add> next false unless dep.optional? || dep.recommended? <add> formula.build.without?(dep) <ide> end <ide> declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name) <ide> declared_requirement_deps = formula.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact
1
Javascript
Javascript
simplify assert usage in test-stream2-basic
7bb9fd203522cb37424629dad777f966a81dd03d
<ide><path>test/pummel/test-stream2-basic.js <ide> function run() { <ide> const fn = next[1]; <ide> console.log('# %s', name); <ide> fn({ <del> same: assert.deepStrictEqual, <del> ok: assert, <del> equal: assert.strictEqual, <ide> end: function() { <ide> count--; <ide> run(); <ide> test('a most basic test', function(t) { <ide> 'xxxxxxxxxxxxxxxxxxxxx' ]; <ide> <ide> r.on('end', function() { <del> assert.strict(reads, expect); <add> assert.deepStrictEqual(reads, expect); <ide> t.end(); <ide> }); <ide> <ide> test('pipe', function(t) { <ide> const w = new TestWriter(); <ide> <ide> w.on('end', function(received) { <del> assert.strict(received, expect); <add> assert.deepStrictEqual(received, expect); <ide> t.end(); <ide> }); <ide> <ide> test('pipe', function(t) { <ide> w[0].on('write', function() { <ide> if (--writes === 0) { <ide> r.unpipe(); <del> t.equal(r._readableState.pipes, null); <add> assert.strictEqual(r._readableState.pipes, null); <ide> w[0].end(); <ide> r.pipe(w[1]); <del> t.equal(r._readableState.pipes, w[1]); <add> assert.strictEqual(r._readableState.pipes, w[1]); <ide> } <ide> }); <ide> <ide> test('pipe', function(t) { <ide> let ended0 = false; <ide> let ended1 = false; <ide> w[0].on('end', function(results) { <del> t.equal(ended0, false); <add> assert.strictEqual(ended0, false); <ide> ended0 = true; <ide> ended++; <del> assert.strict(results, expect[0]); <add> assert.deepStrictEqual(results, expect[0]); <ide> }); <ide> <ide> w[1].on('end', function(results) { <del> t.equal(ended1, false); <add> assert.strictEqual(ended1, false); <ide> ended1 = true; <ide> ended++; <del> t.equal(ended, 2); <del> assert.strict(results, expect[1]); <add> assert.strictEqual(ended, 2); <add> assert.deepStrictEqual(results, expect[1]); <ide> t.end(); <ide> }); <ide> <ide> test('multipipe', function(t) { <ide> <ide> let c = 2; <ide> w[0].on('end', function(received) { <del> assert.strict(received, expect, 'first'); <add> assert.deepStrictEqual(received, expect, 'first'); <ide> if (--c === 0) t.end(); <ide> }); <ide> w[1].on('end', function(received) { <del> assert.strict(received, expect, 'second'); <add> assert.deepStrictEqual(received, expect, 'second'); <ide> if (--c === 0) t.end(); <ide> }); <ide> <ide> test('multipipe', function(t) { <ide> <ide> w[0].on('end', function(results) { <ide> ended++; <del> assert.strict(results, expect[0]); <add> assert.deepStrictEqual(results, expect[0]); <ide> }); <ide> <ide> w[1].on('end', function(results) { <ide> ended++; <del> t.equal(ended, 2); <del> assert.strict(results, expect[1]); <add> assert.strictEqual(ended, 2); <add> assert.deepStrictEqual(results, expect[1]); <ide> t.end(); <ide> }); <ide> <ide> test('adding readable triggers data flow', function(t) { <ide> }); <ide> <ide> r.on('end', function() { <del> t.equal(readCalled, 3); <del> t.ok(onReadable); <add> assert.strictEqual(readCalled, 3); <add> assert.ok(onReadable); <ide> t.end(); <ide> }); <ide> }); <ide> test('chainable', function(t) { <ide> const r = new R(); <ide> r._read = common.mustCall(); <ide> const r2 = r.setEncoding('utf8').pause().resume().pause(); <del> t.equal(r, r2); <add> assert.strictEqual(r, r2); <ide> t.end(); <ide> });
1
Javascript
Javascript
bugfix some edge cases
e44e51fa5b9268445090dc0071584239f89def27
<ide><path>lib/Compilation.js <ide> BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si <ide> */ <ide> _addEntryItem(context, entry, target, options, callback) { <ide> const { name } = options; <del> let entryData = name ? this.entries.get(name) : this.globalEntry; <add> let entryData = <add> name !== undefined ? this.entries.get(name) : this.globalEntry; <ide> if (entryData === undefined) { <ide> entryData = { <ide> dependencies: [], <ide><path>lib/EntryPlugin.js <ide> class EntryPlugin { <ide> constructor(context, entry, options) { <ide> this.context = context; <ide> this.entry = entry; <del> this.options = options; <add> this.options = options || ""; <ide> } <ide> <ide> /**
2
Ruby
Ruby
fix debug strategy info printing
e73524b09325c4aa2e45a945bb2a62fafdfda62f
<ide><path>Library/Homebrew/livecheck/livecheck.rb <ide> def latest_version( <ide> end <ide> <ide> if debug <del> puts "URL (strategy): #{strategy_data[:url]}" if strategy_data[:url] != url <del> puts "URL (final): #{strategy_data[:final_url]}" if strategy_data[:final_url] <del> puts "Regex (strategy): #{strategy_data[:regex].inspect}" if strategy_data[:regex] != livecheck_regex <add> if strategy_data[:url].present? && strategy_data[:url] != url <add> puts "URL (strategy): #{strategy_data[:url]}" <add> end <add> puts "URL (final): #{strategy_data[:final_url]}" if strategy_data[:final_url].present? <add> if strategy_data[:regex].present? && strategy_data[:regex] != livecheck_regex <add> puts "Regex (strategy): #{strategy_data[:regex].inspect}" <add> end <ide> puts "Cached?: Yes" if strategy_data[:cached] == true <ide> end <ide>
1
Ruby
Ruby
fix reloader to work with new executor signature
f9a2ad03943d5c2ba54e1d45f155442b519c75da
<ide><path>activesupport/lib/active_support/reloader.rb <ide> def self.reload! <ide> prepare! <ide> end <ide> <del> def self.run! # :nodoc: <add> def self.run!(reset: false) # :nodoc: <ide> if check! <ide> super <ide> else
1
Ruby
Ruby
add sh.brew.tab to the image manifest
f35baa27522997712b6c1a45ef19793ad839b6f9
<ide><path>Library/Homebrew/github_packages.rb <ide> def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:) <ide> "org.opencontainers.image.title" => "#{formula_full_name} #{tag}", <ide> "com.github.package.type" => GITHUB_PACKAGE_TYPE, <ide> "sh.brew.bottle.glibc.version" => glibc_version, <add> "sh.brew.tab" => tab.to_json, <ide> }).compact.sort.to_h <ide> <ide> image_manifest = {
1
Java
Java
consider negative border radii and widths invalid
99d294bf3d2be24cb2950e0785bebd645a660771
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java <ide> public void setAccessible(ReactViewGroup view, boolean accessible) { <ide> defaultFloat = YogaConstants.UNDEFINED <ide> ) <ide> public void setBorderRadius(ReactViewGroup view, int index, float borderRadius) { <add> if (!YogaConstants.isUndefined(borderRadius) && borderRadius < 0) { <add> borderRadius = YogaConstants.UNDEFINED; <add> } <add> <ide> if (!YogaConstants.isUndefined(borderRadius)) { <ide> borderRadius = PixelUtil.toPixelFromDIP(borderRadius); <ide> } <ide> public void setNeedsOffscreenAlphaCompositing( <ide> defaultFloat = YogaConstants.UNDEFINED <ide> ) <ide> public void setBorderWidth(ReactViewGroup view, int index, float width) { <add> if (!YogaConstants.isUndefined(width) && width < 0) { <add> width = YogaConstants.UNDEFINED; <add> } <add> <ide> if (!YogaConstants.isUndefined(width)) { <ide> width = PixelUtil.toPixelFromDIP(width); <ide> } <add> <ide> view.setBorderWidth(SPACING_TYPES[index], width); <ide> } <ide>
1
Javascript
Javascript
fix strict javascript warning in canvasgraphics
7da3c68c48a4e3351fca50e049f6c0e44e23b26a
<ide><path>pdf.js <ide> var CanvasGraphics = (function canvasGraphics() { <ide> var tmpCtx = tmpCanvas.getContext('2d'); <ide> if (imageObj.imageMask) { <ide> var fillColor = this.current.fillColor; <del> tmpCtx.fillStyle = (fillColor && fillColor.type === 'Pattern') ? <del> fillColor.getPattern(tmpCtx) : fillColor; <add> tmpCtx.fillStyle = (fillColor && fillColor.hasOwnProperty('type') && <add> fillColor.type === 'Pattern') ? <add> fillColor.getPattern(tmpCtx) : fillColor; <ide> tmpCtx.fillRect(0, 0, w, h); <ide> } <ide> var imgData = tmpCtx.getImageData(0, 0, w, h);
1
PHP
PHP
return a new collection from shuffle
238f638b08428a86a5fb6ee06715620bcbcf8532
<ide><path>src/Illuminate/Support/Collection.php <ide> public function shift() <ide> /** <ide> * Shuffle the items in the collection. <ide> * <del> * @return $this <add> * @return static <ide> */ <ide> public function shuffle() <ide> { <del> shuffle($this->items); <add> $items = $this->items; <ide> <del> return $this; <add> array_shuffle($items); <add> <add> return new static($items); <ide> } <ide> <ide> /**
1
Python
Python
improve laguerre and legendre efficiency
1f79addc9d546690984896fc4a35298aab289ba5
<ide><path>numpy/polynomial/laguerre.py <ide> def laggauss(deg): <ide> # matrix is symmetric in this case in order to obtain better zeros. <ide> c = np.array([0]*deg + [1]) <ide> m = lagcompanion(c) <del> x = la.eigvals(m) <del> x.sort() <add> x = la.eigvalsh(m) <ide> <ide> # improve roots by one application of Newton <ide> dy = lagval(x, c) <ide><path>numpy/polynomial/legendre.py <ide> def leggauss(deg): <ide> c = np.array([0]*deg + [1]) <ide> m = legcompanion(c) <ide> x = la.eigvalsh(m) <del> x.sort() <ide> <ide> # improve roots by one application of Newton <ide> dy = legval(x, c)
2
Ruby
Ruby
remove another unused default argument
0fc906b03d9d385a77512acd895520092e244c93
<ide><path>Library/Homebrew/formula_versions.rb <ide> def formula_at_revision(rev) <ide> end <ide> end <ide> <del> def bottle_version_map(branch="HEAD") <add> def bottle_version_map(branch) <ide> map = Hash.new { |h, k| h[k] = [] } <ide> rev_list(branch) do |rev| <ide> formula_at_revision(rev) do |f|
1
Ruby
Ruby
remove warnings on as/test/cache/stores
5606c35697fbde4f3fccc8fdf49a530b50daa8e1
<ide><path>activesupport/test/cache/stores/mem_cache_store_test.rb <ide> def setup <ide> end <ide> <ide> def after_teardown <add> return unless defined?(@_stores) # because skipped test <add> <ide> stores, @_stores = @_stores, [] <ide> stores.each do |store| <ide> # Eagerly closing Dalli connection avoid file descriptor exhaustion. <ide><path>activesupport/test/cache/stores/redis_cache_store_test.rb <ide> def build(**kwargs) <ide> <ide> class StoreTest < ActiveSupport::TestCase <ide> setup do <add> @cache = nil <ide> skip "redis server is not up" unless REDIS_UP <ide> @namespace = "test-#{SecureRandom.hex}" <ide>
2
Python
Python
remove legacy code from regularizers
1c630c3e3c8969b40a47d07b9f2edda50ec69720
<ide><path>keras/regularizers.py <ide> from __future__ import absolute_import <ide> from . import backend as K <ide> from .utils.generic_utils import get_from_module <del>import warnings <ide> <ide> <ide> class Regularizer(object): <ide> """Regularizer base class. <ide> """ <ide> <ide> def __call__(self, x): <del> return 0 <add> return 0. <ide> <del> def get_config(self): <del> return {'name': self.__class__.__name__} <del> <del> def set_param(self, _): <del> warnings.warn('The `set_param` method on regularizers is deprecated. ' <del> 'It no longer does anything, ' <del> 'and it will be removed after 06/2017.') <del> <del> def set_layer(self, _): <del> warnings.warn('The `set_layer` method on regularizers is deprecated. ' <del> 'It no longer does anything, ' <del> 'and it will be removed after 06/2017.') <del> <del> <del>class EigenvalueRegularizer(Regularizer): <del> """Regularizer based on the eignvalues of a weight matrix. <del> <del> Only available for tensors of rank 2. <del> <del> # Arguments <del> k: Float; modulates the amount of regularization to apply. <del> """ <ide> <del> def __init__(self, k): <del> self.k = k <del> <del> def __call__(self, x): <del> if K.ndim(x) != 2: <del> raise ValueError('EigenvalueRegularizer ' <del> 'is only available for tensors of rank 2.') <del> covariance = K.dot(K.transpose(x), x) <del> dim1, dim2 = K.eval(K.shape(covariance)) <del> <del> # Power method for approximating the dominant eigenvector: <del> power = 9 # Number of iterations of the power method. <del> o = K.ones([dim1, 1]) # Initial values for the dominant eigenvector. <del> main_eigenvect = K.dot(covariance, o) <del> for n in range(power - 1): <del> main_eigenvect = K.dot(covariance, main_eigenvect) <del> covariance_d = K.dot(covariance, main_eigenvect) <del> <del> # The corresponding dominant eigenvalue: <del> main_eigenval = (K.dot(K.transpose(covariance_d), main_eigenvect) / <del> K.dot(K.transpose(main_eigenvect), main_eigenvect)) <del> # Multiply by the given regularization gain. <del> regularization = (main_eigenval ** 0.5) * self.k <del> return K.sum(regularization) <del> <del> <del>class L1L2Regularizer(Regularizer): <add>class L1L2(Regularizer): <ide> """Regularizer for L1 and L2 regularization. <ide> <ide> # Arguments <ide> def __init__(self, l1=0., l2=0.): <ide> self.l2 = K.cast_to_floatx(l2) <ide> <ide> def __call__(self, x): <del> regularization = 0 <add> regularization = 0. <ide> if self.l1: <ide> regularization += K.sum(self.l1 * K.abs(x)) <ide> if self.l2: <ide> def get_config(self): <ide> <ide> # Aliases. <ide> <del>WeightRegularizer = L1L2Regularizer <del>ActivityRegularizer = L1L2Regularizer <del> <ide> <ide> def l1(l=0.01): <del> return L1L2Regularizer(l1=l) <add> return L1L2(l1=l) <ide> <ide> <ide> def l2(l=0.01): <del> return L1L2Regularizer(l2=l) <add> return L1L2(l2=l) <ide> <ide> <ide> def l1l2(l1=0.01, l2=0.01): <del> return L1L2Regularizer(l1=l1, l2=l2) <del> <del> <del>def activity_l1(l=0.01): <del> return L1L2Regularizer(l1=l) <del> <del> <del>def activity_l2(l=0.01): <del> return L1L2Regularizer(l2=l) <del> <del> <del>def activity_l1l2(l1=0.01, l2=0.01): <del> return L1L2Regularizer(l1=l1, l2=l2) <add> return L1L2(l1=l1, l2=l2) <ide> <ide> <ide> def get(identifier, kwargs=None):
1
Javascript
Javascript
provide event parameters as object
28f56a383e9d1ff378e3568a3039e941c7ffb1d8
<ide><path>src/ngScenario/browserTrigger.js <ide> * not specified. <ide> * <ide> * @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement <del> * @param {string} eventType Optional event type. <del> * @param {Array.<string>=} keys Optional list of pressed keys <del> * (valid values: 'alt', 'meta', 'shift', 'ctrl') <del> * @param {number} x Optional x-coordinate for mouse/touch events. <del> * @param {number} y Optional y-coordinate for mouse/touch events. <add> * @param {string} eventType Optional event type <add> * @param {Object=} eventData An optional object which contains additional event data (such as x,y coordinates, keys, etc...) that <add> * are passed into the event when triggered <ide> */ <del> window.browserTrigger = function browserTrigger(element, eventType, keys, x, y) { <add> window.browserTrigger = function browserTrigger(element, eventType, eventData) { <ide> if (element && !element.nodeName) element = element[0]; <ide> if (!element) return; <ide> <add> eventData = eventData || {}; <add> var keys = eventData.keys; <add> var x = eventData.x; <add> var y = eventData.y; <add> <ide> var inputType = (element.type) ? element.type.toLowerCase() : null, <ide> nodeName = element.nodeName.toLowerCase(); <ide> <ide> } <ide> return ret; <ide> } else { <del> var evnt = document.createEvent('MouseEvents'), <del> originalPreventDefault = evnt.preventDefault, <add> var evnt; <add> if(/transitionend/.test(eventType)) { <add> if(window.WebKitTransitionEvent) { <add> evnt = new WebKitTransitionEvent(eventType, eventData); <add> evnt.initEvent(eventType, false, true); <add> } <add> else { <add> evnt = document.createEvent('TransitionEvent'); <add> evnt.initTransitionEvent(eventType, null, null, null, eventData.elapsedTime); <add> } <add> } <add> else if(/animationend/.test(eventType)) { <add> if(window.WebKitAnimationEvent) { <add> evnt = new WebKitAnimationEvent(eventType, eventData); <add> evnt.initEvent(eventType, false, true); <add> } <add> else { <add> evnt = document.createEvent('AnimationEvent'); <add> evnt.initAnimationEvent(eventType, null, null, null, eventData.elapsedTime); <add> } <add> } <add> else { <add> evnt = document.createEvent('MouseEvents'); <add> x = x || 0; <add> y = y || 0; <add> evnt.initMouseEvent(eventType, true, true, window, 0, x, y, x, y, pressed('ctrl'), pressed('alt'), <add> pressed('shift'), pressed('meta'), 0, element); <add> } <add> <add> if(!evnt) return; <add> <add> var originalPreventDefault = evnt.preventDefault, <ide> appWindow = element.ownerDocument.defaultView, <ide> fakeProcessDefault = true, <ide> finalProcessDefault, <ide> return originalPreventDefault.apply(evnt, arguments); <ide> }; <ide> <del> x = x || 0; <del> y = y || 0; <del> evnt.initMouseEvent(eventType, true, true, window, 0, x, y, x, y, pressed('ctrl'), pressed('alt'), <del> pressed('shift'), pressed('meta'), 0, element); <del> <ide> element.dispatchEvent(evnt); <ide> finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault); <ide> <ide><path>test/ngTouch/directive/ngClickSpec.js <ide> describe('ngClick (touch)', function() { <ide> expect($rootScope.count).toBe(0); <ide> <ide> time = 10; <del> browserTrigger(element, 'touchstart', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> time = 900; <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count).toBe(0); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> <ide> expect($rootScope.tapped).toBeUndefined(); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <del> browserTrigger(element, 'touchend', [], 400, 400); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 400, <add> y: 400 <add> }); <ide> <ide> expect($rootScope.tapped).toBeUndefined(); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> <ide> expect($rootScope.tapped).toBeUndefined(); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> browserTrigger(element, 'touchmove'); <del> browserTrigger(element, 'touchend', [], 400, 400); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 400, <add> y: 400 <add> }); <ide> <ide> expect($rootScope.tapped).toBeUndefined(); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> var CSS_CLASS = 'ng-click-active'; <ide> <ide> expect(element.hasClass(CSS_CLASS)).toBe(false); <del> browserTrigger(element, 'touchstart', 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> expect(element.hasClass(CSS_CLASS)).toBe(true); <del> browserTrigger(element, 'touchend', 10, 10); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> expect(element.hasClass(CSS_CLASS)).toBe(false); <ide> expect($rootScope.tapped).toBe(true); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> <ide> // Fire touchstart at 10ms, touchend at 50ms, the click at 300ms. <ide> time = 10; <del> browserTrigger(element, 'touchstart', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> time = 50; <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count).toBe(1); <ide> <ide> time = 100; <del> browserTrigger(element, 'click', [], 10, 10); <add> browserTrigger(element, 'click',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count).toBe(1); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> expect($rootScope.count2).toBe(0); <ide> <ide> time = 10; <del> browserTrigger(element1, 'touchstart', [], 10, 10); <add> browserTrigger(element1, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> time = 50; <del> browserTrigger(element1, 'touchend', [], 10, 10); <add> browserTrigger(element1, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count1).toBe(1); <ide> <ide> time = 100; <del> browserTrigger(element2, 'click', [], 10, 10); <add> browserTrigger(element2, 'click',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count1).toBe(1); <ide> expect($rootScope.count2).toBe(0); <ide> describe('ngClick (touch)', function() { <ide> expect($rootScope.count2).toBe(0); <ide> <ide> time = 10; <del> browserTrigger(element1, 'touchstart', [], 10, 10); <add> browserTrigger(element1, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> time = 50; <del> browserTrigger(element1, 'touchend', [], 10, 10); <add> browserTrigger(element1, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count1).toBe(1); <ide> <ide> time = 90; <ide> // Verify that it is blured so we don't get soft-keyboard <ide> element1[0].blur = jasmine.createSpy('blur'); <del> browserTrigger(element1, 'click', [], 10, 10); <add> browserTrigger(element1, 'click',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> expect(element1[0].blur).toHaveBeenCalled(); <ide> <ide> expect($rootScope.count1).toBe(1); <ide> <ide> time = 100; <del> browserTrigger(element1, 'touchstart', [], 10, 10); <add> browserTrigger(element1, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> time = 130; <del> browserTrigger(element1, 'touchend', [], 10, 10); <add> browserTrigger(element1, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count1).toBe(2); <ide> <ide> // Click on other element that should go through. <ide> time = 150; <del> browserTrigger(element2, 'touchstart', [], 100, 120); <del> browserTrigger(element2, 'touchend', [], 100, 120); <del> browserTrigger(element2, 'click', [], 100, 120); <add> browserTrigger(element2, 'touchstart',{ <add> keys: [], <add> x: 100, <add> y: 120 <add> }); <add> browserTrigger(element2, 'touchend',{ <add> keys: [], <add> x: 100, <add> y: 120 <add> }); <add> browserTrigger(element2, 'click',{ <add> keys: [], <add> x: 100, <add> y: 120 <add> }); <ide> <ide> expect($rootScope.count2).toBe(1); <ide> <ide> // Click event for the element that should be busted. <ide> time = 200; <del> browserTrigger(element1, 'click', [], 10, 10); <add> browserTrigger(element1, 'click',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count1).toBe(2); <ide> expect($rootScope.count2).toBe(1); <ide> describe('ngClick (touch)', function() { <ide> expect($rootScope.count).toBe(0); <ide> <ide> time = 10; <del> browserTrigger(element1, 'touchstart', [], 10, 10); <add> browserTrigger(element1, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> time = 50; <del> browserTrigger(element1, 'touchend', [], 10, 10); <add> browserTrigger(element1, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> expect($rootScope.count).toBe(1); <ide> <ide> time = 2700; <del> browserTrigger(element1, 'click', [], 10, 10); <add> browserTrigger(element1, 'click',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count).toBe(2); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> expect($rootScope.count).toBe(0); <ide> <ide> time = 10; <del> browserTrigger(element1, 'touchstart', [], 10, 10); <add> browserTrigger(element1, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> time = 50; <del> browserTrigger(element1, 'touchend', [], 10, 10); <add> browserTrigger(element1, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count).toBe(1); <ide> <ide> time = 2700; <del> browserTrigger(element1, 'click', [], 10, 10); <add> browserTrigger(element1, 'click',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.count).toBe(2); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> $rootScope.disabled = true; <ide> $rootScope.$digest(); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.event).toBeUndefined(); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> $rootScope.disabled = false; <ide> $rootScope.$digest(); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.event).toBeDefined(); <ide> })); <ide> it('should not trigger click if regular disabled is true', inject(function($rootScope, $compile) { <ide> element = $compile('<div ng-click="event = $event" disabled="true"></div>')($rootScope); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.event).toBeUndefined(); <ide> })); <ide> it('should not trigger click if regular disabled is present', inject(function($rootScope, $compile) { <ide> element = $compile('<button ng-click="event = $event" disabled ></button>')($rootScope); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.event).toBeUndefined(); <ide> })); <ide> it('should trigger click if regular disabled is not present', inject(function($rootScope, $compile) { <ide> element = $compile('<div ng-click="event = $event" ></div>')($rootScope); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect($rootScope.event).toBeDefined(); <ide> })); <ide> describe('ngClick (touch)', function() { <ide> called = true; <ide> }); <ide> <del> browserTrigger(element, 'touchstart', [], 10, 10); <del> browserTrigger(element, 'touchend', [], 10, 10); <add> browserTrigger(element, 'touchstart',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <add> browserTrigger(element, 'touchend',{ <add> keys: [], <add> x: 10, <add> y: 10 <add> }); <ide> <ide> expect(called).toEqual(true); <ide> })); <ide><path>test/ngTouch/directive/ngSwipeSpec.js <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> $rootScope.$digest(); <ide> expect($rootScope.swiped).toBeUndefined(); <ide> <del> browserTrigger(element, startEvent, [], 100, 20); <del> browserTrigger(element, endEvent, [], 20, 20); <add> browserTrigger(element, startEvent, { <add> keys : [], <add> x : 100, <add> y : 20 <add> }); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 20, <add> y: 20 <add> }); <ide> expect($rootScope.swiped).toBe(true); <ide> })); <ide> <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> $rootScope.$digest(); <ide> expect($rootScope.swiped).toBeUndefined(); <ide> <del> browserTrigger(element, startEvent, [], 20, 20); <del> browserTrigger(element, endEvent, [], 90, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 20, <add> y: 20 <add> }); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 90, <add> y: 20 <add> }); <ide> expect($rootScope.swiped).toBe(true); <ide> })); <ide> <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> <del> browserTrigger(element, startEvent, [], 90, 20); <del> browserTrigger(element, moveEvent, [], 70, 200); <del> browserTrigger(element, endEvent, [], 20, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 90, <add> y: 20 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 70, <add> y: 200 <add> }); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 20, <add> y: 20 <add> }); <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> })); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> <del> browserTrigger(element, startEvent, [], 90, 20); <del> browserTrigger(element, endEvent, [], 80, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 90, <add> y: 20 <add> }); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 80, <add> y: 20 <add> }); <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> })); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> <del> browserTrigger(element, startEvent, [], 20, 20); <del> browserTrigger(element, moveEvent, [], 40, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 20, <add> y: 20 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 40, <add> y: 20 <add> }); <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> })); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> <del> browserTrigger(element, moveEvent, [], 10, 20); <del> browserTrigger(element, endEvent, [], 90, 20); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 10, <add> y: 20 <add> }); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 90, <add> y: 20 <add> }); <ide> <ide> expect($rootScope.swiped).toBeUndefined(); <ide> })); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> eventFired = true; <ide> }); <ide> <del> browserTrigger(element, startEvent, [], 100, 20); <del> browserTrigger(element, endEvent, [], 20, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 100, <add> y: 20 <add> }); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 20, <add> y: 20 <add> }); <ide> expect(eventFired).toEqual(true); <ide> })); <ide> <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> eventFired = true; <ide> }); <ide> <del> browserTrigger(element, startEvent, [], 20, 20); <del> browserTrigger(element, endEvent, [], 100, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 20, <add> y: 20 <add> }); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 100, <add> y: 20 <add> }); <ide> expect(eventFired).toEqual(true); <ide> })); <ide> }); <ide><path>test/ngTouch/swipeSpec.js <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, startEvent, [], 100, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 100, <add> y: 20 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, startEvent, [], 100, 20); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 100, <add> y: 20 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> <ide> expect(events.move).not.toHaveBeenCalled(); <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, moveEvent, [], 140, 20); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 140, <add> y: 20 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> expect(events.move).toHaveBeenCalled(); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, moveEvent, [], 100, 40); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 100, <add> y: 40 <add> }); <ide> <ide> expect(events.start).not.toHaveBeenCalled(); <ide> expect(events.move).not.toHaveBeenCalled(); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, endEvent, [], 100, 40); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 100, <add> y: 40 <add> }); <ide> <ide> expect(events.start).not.toHaveBeenCalled(); <ide> expect(events.move).not.toHaveBeenCalled(); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, startEvent, [], 100, 40); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 100, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> <ide> expect(events.move).not.toHaveBeenCalled(); <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, moveEvent, [], 120, 40); <del> browserTrigger(element, moveEvent, [], 130, 40); <del> browserTrigger(element, moveEvent, [], 140, 40); <del> browserTrigger(element, moveEvent, [], 150, 40); <del> browserTrigger(element, moveEvent, [], 160, 40); <del> browserTrigger(element, moveEvent, [], 170, 40); <del> browserTrigger(element, moveEvent, [], 180, 40); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 120, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 130, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 140, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 150, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 160, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 170, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 180, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> expect(events.move.calls.length).toBe(7); <ide> <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, endEvent, [], 200, 40); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 200, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> expect(events.move.calls.length).toBe(7); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, startEvent, [], 100, 40); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 100, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> <ide> expect(events.move).not.toHaveBeenCalled(); <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, moveEvent, [], 101, 40); <del> browserTrigger(element, moveEvent, [], 105, 40); <del> browserTrigger(element, moveEvent, [], 110, 40); <del> browserTrigger(element, moveEvent, [], 115, 40); <del> browserTrigger(element, moveEvent, [], 120, 40); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 101, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 105, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 110, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 115, <add> y: 40 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 120, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> expect(events.move.calls.length).toBe(3); <ide> <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, endEvent, [], 200, 40); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 200, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> expect(events.move.calls.length).toBe(3); <ide> var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, startEvent, [], 100, 40); <add> browserTrigger(element, startEvent,{ <add> keys: [], <add> x: 100, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> <ide> expect(events.move).not.toHaveBeenCalled(); <ide> expect(events.cancel).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, moveEvent, [], 101, 41); <del> browserTrigger(element, moveEvent, [], 105, 55); <del> browserTrigger(element, moveEvent, [], 110, 60); <del> browserTrigger(element, moveEvent, [], 115, 70); <del> browserTrigger(element, moveEvent, [], 120, 80); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 101, <add> y: 41 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 105, <add> y: 55 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 110, <add> y: 60 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 115, <add> y: 70 <add> }); <add> browserTrigger(element, moveEvent,{ <add> keys: [], <add> x: 120, <add> y: 80 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> expect(events.cancel).toHaveBeenCalled(); <ide> <ide> expect(events.move).not.toHaveBeenCalled(); <ide> expect(events.end).not.toHaveBeenCalled(); <ide> <del> browserTrigger(element, endEvent, [], 200, 40); <add> browserTrigger(element, endEvent,{ <add> keys: [], <add> x: 200, <add> y: 40 <add> }); <ide> <ide> expect(events.start).toHaveBeenCalled(); <ide> expect(events.cancel).toHaveBeenCalled();
4
Text
Text
fix version cakephp 3.4
2f29fc4023bc8d23da2c187c56ec33cff77920de
<ide><path>README.md <ide> recommend using the [app skeleton](https://github.com/cakephp/app) as <ide> a starting point. For existing applications you can run the following: <ide> <ide> ``` bash <del>$ composer require cakephp/cakephp:"~3.3" <add>$ composer require cakephp/cakephp:"~3.4" <ide> ``` <ide> <ide> ## Running Tests
1
Ruby
Ruby
fix fallback dependencies with multiple kegs
01e1f7d49e91b6f02037997ffb465b37d2426b80
<ide><path>Library/Homebrew/keg.rb <ide> def self.find_some_installed_dependents(kegs) <ide> # <ide> # This happens after the initial dependency check because it's sloooow. <ide> remaining_formulae = Formula.installed.select do |f| <del> f.installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? } <add> installed_kegs = f.installed_kegs <add> <add> # All installed kegs are going to be removed anyway, <add> # so it doesn't matter what they depend on. <add> next false if (installed_kegs - kegs).empty? <add> <add> installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? } <ide> end <ide> <ide> keg_names = kegs.map(&:name) <ide><path>Library/Homebrew/test/keg_test.rb <ide> def test_missing_formula_dependency <ide> assert_equal [[@keg], ["bar"]], Keg.find_some_installed_dependents([@keg]) <ide> end <ide> <add> def test_uninstalling_dependent_and_dependency <add> dependencies nil <add> Formula["bar"].class.depends_on "foo" <add> assert_empty @keg.installed_dependents <add> assert_nil Keg.find_some_installed_dependents([@keg, @dependent]) <add> end <add> <ide> def test_empty_dependencies_in_tab <ide> dependencies [] <ide> assert_empty @keg.installed_dependents
2
Javascript
Javascript
add remainingtimedisplay method to player
445eb267227b1b0ac4f37f124fa4a8811a54752c
<ide><path>src/js/control-bar/time-controls/remaining-time-display.js <ide> class RemainingTimeDisplay extends TimeDisplay { <ide> return; <ide> } <ide> <del> this.updateFormattedTime_(this.player_.remainingTime()); <add> this.updateFormattedTime_(this.player_.remainingTimeDisplay()); <ide> } <ide> <ide> /** <ide><path>src/js/player.js <ide> class Player extends Component { <ide> return this.duration() - this.currentTime(); <ide> } <ide> <add> /** <add> * A remaining time function that is intented to be used when <add> * the time is to be displayed directly to the user. <add> * <add> * @return {number} <add> * The rounded time remaining in seconds <add> */ <add> remainingTimeDisplay() { <add> return Math.floor(this.duration()) - Math.floor(this.currentTime()); <add> } <add> <ide> // <ide> // Kind of like an array of portions of the video that have been downloaded. <ide>
2
Python
Python
remove similar branches from linalg.lstsq
a1af647b13b33963eca3f9504f1d4b2603c3e4a3
<ide><path>numpy/linalg/linalg.py <ide> def lstsq(a, b, rcond="warn"): <ide> 0, work, lwork, iwork, 0) <ide> if results['info'] > 0: <ide> raise LinAlgError('SVD did not converge in Linear Least Squares') <del> resids = array([], result_real_t) <del> if is_1d: <del> x = array(ravel(bstar)[:n], dtype=result_t, copy=True) <del> if results['rank'] == n and m > n: <del> if isComplexType(t): <del> resids = array([sum(abs(ravel(bstar)[n:])**2)], <del> dtype=result_real_t) <del> else: <del> resids = array([sum((ravel(bstar)[n:])**2)], <del> dtype=result_real_t) <add> <add> # undo transpose imposed by fortran-order arrays <add> b_out = bstar.T <add> <add> # b_out contains both the solution and the components of the residuals <add> x = b_out[:n,:] <add> r_parts = b_out[n:,:] <add> if isComplexType(t): <add> resids = sum(abs(r_parts)**2, axis=-2) <ide> else: <del> x = array(bstar.T[:n,:], dtype=result_t, copy=True) <del> if results['rank'] == n and m > n: <del> if isComplexType(t): <del> resids = sum(abs(bstar.T[n:,:])**2, axis=0).astype( <del> result_real_t, copy=False) <del> else: <del> resids = sum((bstar.T[n:,:])**2, axis=0).astype( <del> result_real_t, copy=False) <add> resids = sum(r_parts**2, axis=-2) <ide> <del> st = s[:min(n, m)].astype(result_real_t, copy=True) <del> return wrap(x), wrap(resids), results['rank'], st <add> rank = results['rank'] <add> <add> # remove the axis we added <add> if is_1d: <add> x = x.squeeze(axis=-1) <add> # we probably should squeeze resids too, but we can't <add> # without breaking compatibility. <add> <add> # as documented <add> if rank != n or m <= n: <add> resids = array([], result_real_t) <add> <add> # coerce output arrays <add> s = s.astype(result_real_t, copy=True) <add> resids = resids.astype(result_real_t, copy=False) # array is temporary <add> x = x.astype(result_t, copy=True) <add> return wrap(x), wrap(resids), rank, s <ide> <ide> <ide> def _multi_svd_norm(x, row_axis, col_axis, op):
1
Ruby
Ruby
write bottles in correct order
3dccea251fd03fd35626de1654ab0e930ae6c53d
<ide><path>Library/Homebrew/software_spec.rb <ide> def checksum_for(tag) <ide> <ide> def checksums <ide> tags = collector.keys.sort_by do |tag| <del> "#{OS::Mac::Version.from_symbol(tag)}_#{tag}" <add> version = OS::Mac::Version.from_symbol(tag) <add> # Give arm64 bottles a higher priority so they are first <add> priority = version.arch == :arm64 ? "2" : "1" <add> "#{priority}.#{version}_#{tag}" <ide> rescue MacOSVersionError <ide> # Sort non-MacOS tags below MacOS tags. <ide> "0.#{tag}" <ide><path>Library/Homebrew/test/dev-cmd/bottle_spec.rb <ide> end <ide> <ide> before do <add> Pathname("#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json").write stub_hash( <add> name: "testball", <add> version: "1.0", <add> path: "#{core_tap.path}/Formula/testball.rb", <add> cellar: "any_skip_relocation", <add> os: "arm64_big_sur", <add> filename: "testball-1.0.arm64_big_sur.bottle.tar.gz", <add> local_filename: "testball--1.0.arm64_big_sur.bottle.tar.gz", <add> sha256: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149", <add> ) <add> <ide> Pathname("#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json").write stub_hash( <ide> name: "testball", <ide> version: "1.0", <ide> end <ide> <ide> after do <add> FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json" <ide> FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" <ide> FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json" <ide> end <ide> brew "bottle", <ide> "--merge", <ide> "--write", <add> "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" <ide> }.to output(<<~EOS).to_stdout <ide> ==> testball <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <ide> end <ide> EOS <ide> <ide> class Testball < Formula <ide> <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <ide> end <ide> <ide> option "with-foo", "Build with foo" <ide> def install <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <ide> cellar :any_skip_relocation <del> sha256 big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" <del> sha256 catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" <add> sha256 "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" => :big_sur <add> sha256 "c3c650d75f5188f5d6edd351dd3215e141b73b8ec1cf9144f30e39cbc45de72e" => :arm64_big_sur <add> sha256 "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" => :catalina <ide> end <ide> EOS <ide> system "git", "add", "--all" <ide> def install <ide> brew "bottle", <ide> "--merge", <ide> "--write", <add> "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" <ide> }.to output(<<~EOS).to_stdout <ide> ==> testball <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <ide> end <ide> EOS <ide> <ide> class Testball < Formula <ide> <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <ide> end <ide> <ide> def install <ide> def install <ide> <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" <del> sha256 cellar: :any_skip_relocation, catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "c3c650d75f5188f5d6edd351dd3215e141b73b8ec1cf9144f30e39cbc45de72e" <add> sha256 cellar: :any_skip_relocation, big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" <add> sha256 cellar: :any_skip_relocation, catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" <ide> end <ide> EOS <ide> system "git", "add", "--all" <ide> def install <ide> brew "bottle", <ide> "--merge", <ide> "--write", <add> "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" <ide> }.to output(<<~EOS).to_stdout <ide> ==> testball <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <ide> end <ide> EOS <ide> <ide> class Testball < Formula <ide> <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <ide> end <ide> <ide> def install <ide> def install <ide> "--merge", <ide> "--write", <ide> "--keep-old", <add> "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" <ide> }.to output("Error: `--keep-old` was passed but there was no existing bottle block!\n").to_stderr <ide> def install <ide> "--merge", <ide> "--write", <ide> "--keep-old", <add> "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" <ide> }.to output(<<~EOS).to_stdout <ide> ==> testball <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <del> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <ide> end <ide> EOS <ide> <ide> class Testball < Formula <ide> <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <del> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <ide> end <ide> <ide> def install <ide> def install <ide> "--merge", <ide> "--write", <ide> "--keep-old", <add> "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", <ide> "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" <ide> }.to output(<<~EOS).to_stdout <ide> ==> testball <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <del> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <ide> end <ide> EOS <ide> <ide> class Testball < Formula <ide> <ide> bottle do <ide> root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" <del> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <del> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <del> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <add> sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" <add> sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" <add> sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" <add> sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" <ide> end <ide> <ide> def install
2
PHP
PHP
apply fixes from styleci
cab1de36ad2e5e42a0111b1e5070d5c62e933f86
<ide><path>src/Illuminate/Queue/Jobs/Job.php <ide> public function maxExceptions() <ide> } <ide> <ide> /** <del> * The number of seconds to wait before retrying a job that encountered an uncaught exception <add> * The number of seconds to wait before retrying a job that encountered an uncaught exception. <ide> * <ide> * @return int|null <ide> */ <ide><path>src/Illuminate/Queue/WorkerOptions.php <ide> class WorkerOptions <ide> { <ide> /** <del> * The number of seconds to wait before retrying a job that encountered an uncaught exception <add> * The number of seconds to wait before retrying a job that encountered an uncaught exception. <ide> * <ide> * @var int <ide> */
2
Python
Python
remove some vestigial print statements
d7e2d9ad427fe276d1d4f22d86a02433df99c99e
<ide><path>numpy/core/tests/test_defchararray.py <ide> def test_decode(self): <ide> <ide> def test_encode(self): <ide> B = self.B.encode('unicode_escape') <del> print B[0][0] <ide> assert B[0][0] == r' \u03a3 ' <ide> <ide> def test_expandtabs(self): <ide> T = self.A.expandtabs() <del> print T <ide> assert T[2][0] == '123 345' <ide> <ide> def test_join(self):
1
Python
Python
add examples telemetry
3cab90279fdd0c81c892de1f2e28923b3b7acbfc
<ide><path>examples/flax/image-captioning/run_image_captioning_flax.py <ide> HfArgumentParser, <ide> is_tensorboard_available, <ide> ) <del>from transformers.utils import get_full_repo_name, is_offline_mode <add>from transformers.utils import get_full_repo_name, is_offline_mode, send_example_telemetry <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_image_captioning", model_args, data_args, framework="flax") <add> <ide> if ( <ide> os.path.exists(training_args.output_dir) <ide> and os.listdir(training_args.output_dir) <ide><path>examples/flax/language-modeling/run_clm_flax.py <ide> set_seed, <ide> ) <ide> from transformers.testing_utils import CaptureLogger <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_clm", model_args, data_args, framework="flax") <add> <ide> if ( <ide> os.path.exists(training_args.output_dir) <ide> and os.listdir(training_args.output_dir) <ide><path>examples/flax/language-modeling/run_mlm_flax.py <ide> is_tensorboard_available, <ide> set_seed, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> <ide> <ide> MODEL_CONFIG_CLASSES = list(FLAX_MODEL_FOR_MASKED_LM_MAPPING.keys()) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_mlm", model_args, data_args, framework="flax") <add> <ide> if ( <ide> os.path.exists(training_args.output_dir) <ide> and os.listdir(training_args.output_dir) <ide><path>examples/flax/language-modeling/run_t5_mlm_flax.py <ide> set_seed, <ide> ) <ide> from transformers.models.t5.modeling_flax_t5 import shift_tokens_right <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> <ide> <ide> MODEL_CONFIG_CLASSES = list(FLAX_MODEL_FOR_MASKED_LM_MAPPING.keys()) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_t5_mlm", model_args, data_args, framework="flax") <add> <ide> if ( <ide> os.path.exists(training_args.output_dir) <ide> and os.listdir(training_args.output_dir) <ide><path>examples/flax/question-answering/run_qa.py <ide> PreTrainedTokenizerFast, <ide> is_tensorboard_available, <ide> ) <del>from transformers.utils import check_min_version, get_full_repo_name <add>from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry <ide> from utils_qa import postprocess_qa_predictions <ide> <ide> <ide> def main(): <ide> model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1])) <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <add> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_qa", model_args, data_args, framework="flax") <ide> # endregion <ide> <ide> # region Logging <ide><path>examples/flax/summarization/run_summarization_flax.py <ide> HfArgumentParser, <ide> is_tensorboard_available, <ide> ) <del>from transformers.utils import get_full_repo_name, is_offline_mode <add>from transformers.utils import get_full_repo_name, is_offline_mode, send_example_telemetry <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_summarization", model_args, data_args, framework="flax") <add> <ide> if ( <ide> os.path.exists(training_args.output_dir) <ide> and os.listdir(training_args.output_dir) <ide><path>examples/flax/text-classification/run_flax_glue.py <ide> TrainingArguments, <ide> is_tensorboard_available, <ide> ) <del>from transformers.utils import check_min_version, get_full_repo_name <add>from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_glue", model_args, data_args, framework="flax") <add> <ide> # Make one log on every process with the configuration for debugging. <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/flax/token-classification/run_flax_ner.py <ide> HfArgumentParser, <ide> is_tensorboard_available, <ide> ) <del>from transformers.utils import check_min_version, get_full_repo_name <add>from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_ner", model_args, data_args, framework="flax") <add> <ide> # Make one log on every process with the configuration for debugging. <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/flax/vision/run_image_classification.py <ide> is_tensorboard_available, <ide> set_seed, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_image_classification", model_args, data_args, framework="flax") <add> <ide> if ( <ide> os.path.exists(training_args.output_dir) <ide> and os.listdir(training_args.output_dir) <ide><path>examples/pytorch/audio-classification/run_audio_classification.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_audio_classification", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/contrastive-image-text/run_clip.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_clip", model_args, data_args) <add> <ide> # 2. Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/image-classification/run_image_classification.py <ide> TrainingArguments, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_image_classification", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/image-classification/run_image_classification_no_trainer.py <ide> SchedulerType, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_image_classification_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/image-pretraining/run_mae.py <ide> ViTMAEForPreTraining, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_mae", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/image-pretraining/run_mim.py <ide> TrainingArguments, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_mim", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/language-modeling/run_clm.py <ide> ) <ide> from transformers.testing_utils import CaptureLogger <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_clm", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/language-modeling/run_clm_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_clm_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/language-modeling/run_mlm.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_mlm", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/language-modeling/run_mlm_no_trainer.py <ide> SchedulerType, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_mlm_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/language-modeling/run_plm.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_plm", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/multiple-choice/run_swag.py <ide> ) <ide> from transformers.tokenization_utils_base import PreTrainedTokenizerBase <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import PaddingStrategy, check_min_version <add>from transformers.utils import PaddingStrategy, check_min_version, send_example_telemetry <ide> <ide> <ide> # Will error if the minimal version of Transformers is not installed. Remove at your own risks. <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_swag", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/multiple-choice/run_swag_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import PaddingStrategy, get_full_repo_name <add>from transformers.utils import PaddingStrategy, get_full_repo_name, send_example_telemetry <ide> <ide> <ide> logger = get_logger(__name__) <ide> def __call__(self, features): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_swag_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/question-answering/run_qa.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> from utils_qa import postprocess_qa_predictions <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_qa", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/question-answering/run_qa_beam_search.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> from utils_qa import postprocess_qa_predictions_with_beam_search <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_qa_beam_search", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import check_min_version, get_full_repo_name <add>from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> from utils_qa import postprocess_qa_predictions_with_beam_search <ide> <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_qa_beam_search_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will pick up all supported trackers in the environment <ide> accelerator = Accelerator(log_with="all", logging_dir=args.output_dir) if args.with_tracking else Accelerator() <ide><path>examples/pytorch/question-answering/run_qa_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import check_min_version, get_full_repo_name <add>from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> from utils_qa import postprocess_qa_predictions <ide> <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_qa_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/question-answering/run_seq2seq_qa.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import EvalLoopOutput, EvalPrediction, get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_seq2seq_qa", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/semantic-segmentation/run_semantic_segmentation.py <ide> default_data_collator, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_semantic_segmentation", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_semantic_segmentation_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/speech-pretraining/run_wav2vec2_pretraining_no_trainer.py <ide> set_seed, <ide> ) <ide> from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices, _sample_negative_indices <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> <ide> <ide> logger = get_logger(__name__) <ide> def main(): <ide> # We now keep distinct sets of args, for a cleaner separation of concerns. <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_wav2vec2_pretraining_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> accelerator = Accelerator() <ide> logger.info(accelerator.state, main_process_only=False) <ide><path>examples/pytorch/speech-recognition/run_speech_recognition_ctc.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint, is_main_process <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_speech_recognition_ctc", model_args, data_args) <add> <ide> # Detecting last checkpoint. <ide> last_checkpoint = None <ide> if os.path.isdir(training_args.output_dir) and training_args.do_train and not training_args.overwrite_output_dir: <ide><path>examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint, is_main_process <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_speech_recognition_seq2seq", model_args, data_args) <add> <ide> # 2. Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/summarization/run_summarization.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version, is_offline_mode <add>from transformers.utils import check_min_version, is_offline_mode, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_summarization", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/summarization/run_summarization_no_trainer.py <ide> SchedulerType, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name, is_offline_mode <add>from transformers.utils import get_full_repo_name, is_offline_mode, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> <ide> def main(): <ide> args = parse_args() <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_summarization_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/text-classification/run_glue.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_glue", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/text-classification/run_glue_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> <ide> def main(): <ide> args = parse_args() <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_glue_no_trainer", args) <ide> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide><path>examples/pytorch/text-classification/run_xnli.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> class DataTrainingArguments: <ide> ) <ide> }, <ide> ) <del> server_ip: Optional[str] = field(default=None, metadata={"help": "For distant debugging."}) <del> server_port: Optional[str] = field(default=None, metadata={"help": "For distant debugging."}) <ide> <ide> <ide> @dataclass <ide> def main(): <ide> parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments)) <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <del> # Setup distant debugging if needed <del> if data_args.server_ip and data_args.server_port: <del> # Distant debugging - see https://code.visualstudio.com/docs/python/debugging#_attach-to-a-local-script <del> import ptvsd <del> <del> print("Waiting for debugger attach") <del> ptvsd.enable_attach(address=(data_args.server_ip, data_args.server_port), redirect_output=True) <del> ptvsd.wait_for_attach() <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_xnli", model_args) <ide> <ide> # Setup logging <ide> logging.basicConfig( <ide><path>examples/pytorch/token-classification/run_ner.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_ner", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/token-classification/run_ner_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_ner_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/pytorch/translation/run_translation.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_translation", model_args, data_args) <add> <ide> # Setup logging <ide> logging.basicConfig( <ide> format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", <ide><path>examples/pytorch/translation/run_translation_no_trainer.py <ide> default_data_collator, <ide> get_scheduler, <ide> ) <del>from transformers.utils import get_full_repo_name <add>from transformers.utils import get_full_repo_name, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> # Parse the arguments <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_translation_no_trainer", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers <ide> # in the environment <ide><path>examples/tensorflow/language-modeling/run_clm.py <ide> create_optimizer, <ide> set_seed, <ide> ) <add>from transformers.utils import send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_clm", model_args, data_args, framework="tensorflow") <add> <ide> # Sanity checks <ide> if data_args.dataset_name is None and data_args.train_file is None and data_args.validation_file is None: <ide> raise ValueError("Need either a dataset name or a training/validation file.") <ide><path>examples/tensorflow/language-modeling/run_mlm.py <ide> create_optimizer, <ide> set_seed, <ide> ) <add>from transformers.utils import send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_mlm", model_args, data_args, framework="tensorflow") <add> <ide> # Sanity checks <ide> if data_args.dataset_name is None and data_args.train_file is None and data_args.validation_file is None: <ide> raise ValueError("Need either a dataset name or a training/validation file.") <ide><path>examples/tensorflow/multiple-choice/run_swag.py <ide> set_seed, <ide> ) <ide> from transformers.tokenization_utils_base import PreTrainedTokenizerBase <del>from transformers.utils import PaddingStrategy, check_min_version <add>from transformers.utils import PaddingStrategy, check_min_version, send_example_telemetry <ide> <ide> <ide> # Will error if the minimal version of Transformers is not installed. Remove at your own risks. <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_swag", model_args, data_args, framework="tensorflow") <add> <ide> output_dir = Path(training_args.output_dir) <ide> output_dir.mkdir(parents=True, exist_ok=True) <ide> # endregion <ide><path>examples/tensorflow/question-answering/run_qa.py <ide> TFTrainingArguments, <ide> set_seed, <ide> ) <del>from transformers.utils import CONFIG_NAME, TF2_WEIGHTS_NAME, check_min_version <add>from transformers.utils import CONFIG_NAME, TF2_WEIGHTS_NAME, check_min_version, send_example_telemetry <ide> from utils_qa import postprocess_qa_predictions <ide> <ide> <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_qa", model_args, data_args, framework="tensorflow") <add> <ide> output_dir = Path(training_args.output_dir) <ide> output_dir.mkdir(parents=True, exist_ok=True) <ide> # endregion <ide><path>examples/tensorflow/summarization/run_summarization.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version, is_offline_mode <add>from transformers.utils import check_min_version, is_offline_mode, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1])) <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <add> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_summarization", model_args, data_args, framework="tensorflow") <ide> # endregion <ide> <ide> # region Logging <ide><path>examples/tensorflow/text-classification/run_glue.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint, is_main_process <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> <ide> <ide> # region Helper functions <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_glue", model_args, data_args, framework="tensorflow") <add> <ide> if not (training_args.do_train or training_args.do_eval or training_args.do_predict): <ide> exit("Must specify at least one of --do_train, --do_eval or --do_predict!") <ide> # endregion <ide><path>examples/tensorflow/text-classification/run_text_classification.py <ide> TFTrainingArguments, <ide> set_seed, <ide> ) <del>from transformers.utils import CONFIG_NAME, TF2_WEIGHTS_NAME <add>from transformers.utils import CONFIG_NAME, TF2_WEIGHTS_NAME, send_example_telemetry <ide> <ide> <ide> os.environ["TF_CPP_MIN_LOG_LEVEL"] = "1" # Reduce the amount of console output from TF <ide> def main(): <ide> model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1])) <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <add> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_text_classification", model_args, data_args, framework="tensorflow") <add> <ide> output_dir = Path(training_args.output_dir) <ide> output_dir.mkdir(parents=True, exist_ok=True) <ide> # endregion <ide><path>examples/tensorflow/token-classification/run_ner.py <ide> create_optimizer, <ide> set_seed, <ide> ) <add>from transformers.utils import send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> # region Argument Parsing <ide> parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TFTrainingArguments)) <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <add> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_ner", model_args, data_args, framework="tensorflow") <ide> # endregion <ide> <ide> # region Setup logging <ide><path>examples/tensorflow/translation/run_translation.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <del>from transformers.utils import check_min_version <add>from transformers.utils import check_min_version, send_example_telemetry <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def main(): <ide> model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1])) <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <add> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_translation", model_args, data_args, framework="tensorflow") <ide> # endregion <ide> <ide> # region Logging <ide><path>src/transformers/utils/__init__.py <ide> is_local_clone, <ide> is_offline_mode, <ide> is_remote_url, <add> send_example_telemetry, <ide> url_to_filename, <ide> ) <ide> from .import_utils import ( <ide><path>src/transformers/utils/hub.py <ide> def is_offline_mode(): <ide> HUGGINGFACE_CO_RESOLVE_ENDPOINT = os.environ.get("HUGGINGFACE_CO_RESOLVE_ENDPOINT", None) <ide> HUGGINGFACE_CO_RESOLVE_ENDPOINT = os.environ.get("HF_ENDPOINT", HUGGINGFACE_CO_RESOLVE_ENDPOINT) <ide> HUGGINGFACE_CO_PREFIX = HUGGINGFACE_CO_RESOLVE_ENDPOINT + "/{model_id}/resolve/{revision}/{filename}" <add>HUGGINGFACE_CO_EXAMPLES_TELEMETRY = HUGGINGFACE_CO_RESOLVE_ENDPOINT + "/telemetry/examples" <ide> <ide> <ide> def is_remote_url(url_or_filename): <ide> def get_full_repo_name(model_id: str, organization: Optional[str] = None, token: <ide> return f"{username}/{model_id}" <ide> else: <ide> return f"{organization}/{model_id}" <add> <add> <add>def send_example_telemetry(example_name, *example_args, framework="pytorch"): <add> """ <add> Sends telemetry that helps tracking the examples use. <add> <add> Args: <add> example_name (`str`): The name of the example. <add> *example_args (dataclasses or `argparse.ArgumentParser`): The arguments to the script. This function will only <add> try to extract the model and dataset name from those. Nothing else is tracked. <add> framework (`str`, *optional*, defaults to `"pytorch"`): The framework for the example. <add> """ <add> if is_offline_mode(): <add> return <add> <add> data = {"example": example_name, "framework": framework} <add> for args in example_args: <add> args_as_dict = {k: v for k, v in args.__dict__.items() if not k.startswith("_") and v is not None} <add> if "model_name_or_path" in args_as_dict: <add> model_name = args_as_dict["model_name_or_path"] <add> # Filter out local paths <add> if not os.path.isdir(model_name): <add> data["model_name"] = args_as_dict["model_name_or_path"] <add> if "dataset_name" in args_as_dict: <add> data["dataset_name"] = args_as_dict["dataset_name"] <add> elif "task_name" in args_as_dict: <add> # Extract script name from the example_name <add> script_name = example_name.replace("tf_", "").replace("flax_", "").replace("run_", "") <add> script_name = script_name.replace("_no_trainer", "") <add> data["dataset_name"] = f"{script_name}-{args_as_dict['task_name']}" <add> <add> headers = {"user-agent": http_user_agent(data)} <add> try: <add> r = requests.head(HUGGINGFACE_CO_EXAMPLES_TELEMETRY, headers=headers) <add> r.raise_for_status() <add> except Exception: <add> # We don't want to error in case of connection errors of any kind. <add> pass <ide><path>templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py <ide> set_seed, <ide> ) <ide> from transformers.trainer_utils import get_last_checkpoint <add>from transformers.utils import send_example_telemetry <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def main(): <ide> else: <ide> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_{{cookiecutter.example_shortcut}}", model_args, data_args) <add> <ide> # Detecting last checkpoint. <ide> last_checkpoint = None <ide> if os.path.isdir(training_args.output_dir) and training_args.do_train and not training_args.overwrite_output_dir: <ide> def _mp_fn(index): <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.utils import send_example_telemetry <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def parse_args(): <ide> def main(): <ide> args = parse_args() <ide> <add> # Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The <add> # information sent is the one passed as arguments along with your Python/PyTorch versions. <add> send_example_telemetry("run_{{cookiecutter.example_shortcut}", args) <add> <ide> # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. <ide> accelerator = Accelerator() <ide> # Make one log on every process with the configuration for debugging.
53
Python
Python
fix poly_val description for 'x' input
33140978603936fe2c93555e6badce55a841d432
<ide><path>numpy/lib/polynomial.py <ide> def poly(seq_of_zeros): <ide> <ide> See Also <ide> -------- <del> polyval : Evaluate a polynomial at a point. <add> polyval : Compute polynomial values. <ide> roots : Return the roots of a polynomial. <ide> polyfit : Least squares polynomial fit. <ide> poly1d : A one-dimensional polynomial class. <ide> def roots(p): <ide> -------- <ide> poly : Find the coefficients of a polynomial with a given sequence <ide> of roots. <del> polyval : Evaluate a polynomial at a point. <add> polyval : Compute polynomial values. <ide> polyfit : Least squares polynomial fit. <ide> poly1d : A one-dimensional polynomial class. <ide> <ide> def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False): <ide> <ide> See Also <ide> -------- <del> polyval : Computes polynomial values. <add> polyval : Compute polynomial values. <ide> linalg.lstsq : Computes a least-squares fit. <ide> scipy.interpolate.UnivariateSpline : Computes spline fits. <ide> <ide> def polyval(p, x): <ide> to zero) from highest degree to the constant term, or an <ide> instance of poly1d. <ide> x : array_like or poly1d object <del> A number, a 1D array of numbers, or an instance of poly1d, "at" <add> A number, an array of numbers, or an instance of poly1d, at <ide> which to evaluate `p`. <ide> <ide> Returns
1
PHP
PHP
add test case for abort()
f2cecec85ae3e76ac505b21bc120284319ddc0a1
<ide><path>src/Console/ConsoleIo.php <ide> public function success($message = null, $newlines = 1, $level = self::NORMAL) <ide> } <ide> <ide> /** <del> * @param string $message <del> * @param int $code <add> * Halts the the current process with a StopException. <add> * <add> * @param string $message Error message. <add> * @param int $code Error code. <ide> * @return void <ide> * @throws \Cake\Console\Exception\StopException <ide> */ <ide><path>src/Console/Shell.php <ide> public function hr($newlines = 0, $width = 63) <ide> <ide> /** <ide> * Displays a formatted error message <del> * and exits the application with status code 1 <add> * and exits the application with an error code. <ide> * <ide> * @param string $message The error message <ide> * @param int $exitCode The exit code for the shell task. <ide><path>tests/TestCase/Console/ConsoleIoTest.php <ide> public function testAbort() <ide> $this->io->abort('Some error'); <ide> } <ide> <add> /** <add> * Tests abort() wrapper. <add> * <add> * @expectedException \Cake\Console\Exception\StopException <add> * @expectedExceptionMessage 99 <add> * @return void <add> */ <add> public function testAbortCustomCode() <add> { <add> $this->err->expects($this->at(0)) <add> ->method('write') <add> ->with('<error>Some error</error>', 1); <add> <add> $this->io->abort('Some error', 99); <add> } <add> <ide> /** <ide> * testNl <ide> *
3
Text
Text
fix added version for readable.closed/destroyed
fc032498891a521d7b8a02cb67a6df7b894c663f
<ide><path>doc/api/stream.md <ide> Implementors should not override this method, but instead implement <ide> ##### `readable.closed` <ide> <ide> <!-- YAML <del>added: v8.0.0 <add>added: v18.0.0 <ide> --> <ide> <ide> * {boolean} <ide> Is `true` after `'close'` has been emitted. <ide> ##### `readable.destroyed` <ide> <ide> <!-- YAML <del>added: v18.0.0 <add>added: v8.0.0 <ide> --> <ide> <ide> * {boolean}
1
Javascript
Javascript
seperate instanceinitializer into its own section
16eb4f803ca751c1f869f2c1e7e2c9b7ae79a7e6
<ide><path>packages/ember-application/lib/system/application.js <ide> var Application = Namespace.extend(RegistryProxy, { <ide> }); <ide> <ide> Application.reopenClass({ <add> /** <add> Instance initializers run after all initializers have run. Because <add> instance initializers run after the app is fully set up. We have access <add> to the store, container, and other items. However, these initializers run <add> after code has loaded and are not allowed to defer readiness. <add> <add> Instance initializer receives an object which has the following attributes: <add> `name`, `before`, `after`, `initialize`. The only required attribute is <add> `initialize`, all others are optional. <add> <add> * `name` allows you to specify under which name the instanceInitializer is <add> registered. This must be a unique name, as trying to register two <add> instanceInitializer with the same name will result in an error. <add> <add> ```javascript <add> Ember.Application.instanceInitializer({ <add> name: 'namedinstanceInitializer', <add> <add> initialize: function(application) { <add> Ember.debug('Running namedInitializer!'); <add> } <add> }); <add> ``` <add> <add> * `before` and `after` are used to ensure that this initializer is ran prior <add> or after the one identified by the value. This value can be a single string <add> or an array of strings, referencing the `name` of other initializers. <add> <add> * See Ember.Application.initializer for discussion on the usage of before <add> and after. <add> <add> Example instanceInitializer to preload data into the store. <add> <add> ```javascript <add> Ember.Application.initializer({ <add> name: 'preload-data', <add> <add> initialize: function(application) { <add> var userConfig, userConfigEncoded, store; <add> // We have a HTML escaped JSON representation of the user's basic <add> // configuration generated server side and stored in the DOM of the main <add> // index.html file. This allows the app to have access to a set of data <add> // without making any additional remote calls. Good for basic data that is <add> // needed for immediate rendering of the page. Keep in mind, this data, <add> // like all local models and data can be manipulated by the user, so it <add> // should not be relied upon for security or authorization. <add> // <add> // Grab the encoded data from the meta tag <add> userConfigEncoded = Ember.$('head meta[name=app-user-config]').attr('content'); <add> // Unescape the text, then parse the resulting JSON into a real object <add> userConfig = JSON.parse(unescape(userConfigEncoded)); <add> // Lookup the store <add> store = application.lookup('service:store'); <add> // Push the encoded JSON into the store <add> store.pushPayload(userConfig); <add> } <add> }); <add> ``` <add> <add> @method instanceInitializer <add> @param instanceInitializer <add> @public <add> */ <ide> instanceInitializer: buildInitializerMethod('instanceInitializers', 'instance initializer') <ide> }); <ide> <ide> Application.reopenClass({ <ide> instanceInitializers: new EmptyObject(), <ide> <ide> /** <add> The goal of initializers should be to register dependencies and injections. <add> This phase runs once. Because these initializers may load code, they are <add> allowed to defer application readiness and advance it. If you need to access <add> the container or store you should use an InstanceInitializer that will be run <add> after all initializers and therefore after all code is loaded and the app is <add> ready. <add> <ide> Initializer receives an object which has the following attributes: <ide> `name`, `before`, `after`, `initialize`. The only required attribute is <ide> `initialize`, all others are optional. <ide> Application.reopenClass({ <ide> @method initializer <ide> @param initializer {Object} <ide> @public <del> */ <add> */ <add> <ide> initializer: buildInitializerMethod('initializers', 'initializer'), <ide> <ide> /**
1
Javascript
Javascript
remove old reference to inst._wrapperstate
d0d4280640967eca2faad0d96be6fca08ac846a6
<ide><path>packages/react-dom/src/events/ChangeEventPlugin.js <ide> function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) { <ide> } <ide> } <ide> <del>function handleControlledInputBlur(inst, node) { <del> // TODO: In IE, inst is occasionally null. Why? <del> if (inst == null) { <del> return; <del> } <del> <del> // Fiber and ReactDOM keep wrapper state in separate places <del> let state = inst._wrapperState || node._wrapperState; <add>function handleControlledInputBlur(node) { <add> let state = node._wrapperState; <ide> <ide> if (!state || !state.controlled || node.type !== 'number') { <ide> return; <ide> const ChangeEventPlugin = { <ide> <ide> // When blurring, set the value attribute for number inputs <ide> if (topLevelType === TOP_BLUR) { <del> handleControlledInputBlur(targetInst, targetNode); <add> handleControlledInputBlur(targetNode); <ide> } <ide> }, <ide> };
1
Text
Text
update version numbers of ruby and rails
c332393f751fdbd2bf1c821e2ac1fa5f06fea7b6
<ide><path>guides/source/getting_started.md <ide> Open up a command line prompt. On a mac this is called terminal, on windows it i <ide> <ide> ```bash <ide> $ ruby -v <del>ruby 1.9.3p194 <add>ruby 1.9.3p327 <ide> ``` <ide> <ide> To install Rails, use the `gem install` command provided by RubyGems: <ide> To verify that you have everything installed correctly, you should be able to ru <ide> $ rails --version <ide> ``` <ide> <del>If it says something like "Rails 3.2.8" you are ready to continue. <add>If it says something like "Rails 3.2.9" you are ready to continue. <ide> <ide> ### Creating the Blog Application <ide>
1
Text
Text
add activeclassname to link examples
8217597848ae06596c64c553a5f7bf805fca2b06
<ide><path>docs/api-reference/next/link.md <ide> description: Enable client-side transitions between routes with the built-in Lin <ide> <summary><b>Examples</b></summary> <ide> <ul> <ide> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/hello-world">Hello World</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/active-class-name">Active className on Link</a></li> <ide> </ul> <ide> </details> <ide>
1
Java
Java
remove activities from module constructors
c06efc0831b9156ee6261d7ddd2086ed87cbc0aa
<ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java <ide> * have a static method, and so cannot (in Java < 8), be one. <ide> */ <ide> public abstract class ReactInstanceManager { <add> <add> /** <add> * Listener interface for react instance events. <add> */ <add> public interface ReactInstanceEventListener { <add> /** <add> * Called when the react context is initialized (all modules registered). Always called on the <add> * UI thread. <add> */ <add> void onReactContextInitialized(ReactContext context); <add> } <add> <ide> public abstract DevSupportManager getDevSupportManager(); <ide> <ide> /** <ide> public abstract void onResume( <ide> public abstract List<ViewManager> createAllViewManagers( <ide> ReactApplicationContext catalystApplicationContext); <ide> <add> /** <add> * Add a listener to be notified of react instance events. <add> */ <add> public abstract void addReactInstanceEventListener(ReactInstanceEventListener listener); <add> <ide> @VisibleForTesting <ide> public abstract @Nullable ReactContext getCurrentReactContext(); <ide> <ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerImpl.java <ide> import javax.annotation.Nullable; <ide> <ide> import java.util.ArrayList; <add>import java.util.Collection; <ide> import java.util.List; <add>import java.util.concurrent.ConcurrentLinkedQueue; <ide> <ide> import android.app.Activity; <del>import android.app.Application; <ide> import android.content.Context; <ide> import android.content.Intent; <ide> import android.os.AsyncTask; <ide> private @Nullable DefaultHardwareBackBtnHandler mDefaultBackButtonImpl; <ide> private String mSourceUrl; <ide> private @Nullable Activity mCurrentActivity; <add> private final Collection<ReactInstanceEventListener> mReactInstanceEventListeners = <add> new ConcurrentLinkedQueue<>(); <ide> private volatile boolean mHasStartedCreatingInitialContext = false; <ide> private final UIImplementationProvider mUIImplementationProvider; <ide> <ide> public void onDestroy() { <ide> mCurrentReactContext = null; <ide> mHasStartedCreatingInitialContext = false; <ide> } <add> mCurrentActivity = null; <ide> } <ide> <ide> @Override <ide> public List<ViewManager> createAllViewManagers( <ide> } <ide> } <ide> <add> @Override <add> public void addReactInstanceEventListener(ReactInstanceEventListener listener) { <add> mReactInstanceEventListeners.add(listener); <add> } <add> <ide> @VisibleForTesting <ide> @Override <ide> public @Nullable ReactContext getCurrentReactContext() { <ide> private void setupReactContext(ReactApplicationContext reactContext) { <ide> for (ReactRootView rootView : mAttachedRootViews) { <ide> attachMeasuredRootViewToInstance(rootView, catalystInstance); <ide> } <add> <add> for (ReactInstanceEventListener listener : mReactInstanceEventListeners) { <add> listener.onReactContextInitialized(reactContext); <add> } <ide> } <ide> <ide> private void attachMeasuredRootViewToInstance( <ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java <ide> public void onResume(@Nullable Activity activity) { <ide> */ <ide> public void onPause() { <ide> UiThreadUtil.assertOnUiThread(); <del> mCurrentActivity = null; <ide> for (LifecycleEventListener listener : mLifecycleEventListeners) { <ide> listener.onHostPause(); <ide> } <ide> public void onDestroy() { <ide> if (mCatalystInstance != null) { <ide> mCatalystInstance.destroy(); <ide> } <add> mCurrentActivity = null; <ide> } <ide> <ide> /** <ide> public boolean startActivityForResult(Intent intent, int code, Bundle bundle) { <ide> mCurrentActivity.startActivityForResult(intent, code, bundle); <ide> return true; <ide> } <add> <add> /** <add> * Get the activity to which this context is currently attached, or {@code null} if not attached. <add> * DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE <add> * MEMORY LEAKS. <add> */ <add> /* package */ @Nullable Activity getCurrentActivity() { <add> return mCurrentActivity; <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java <ide> <ide> package com.facebook.react.bridge; <ide> <add>import javax.annotation.Nullable; <add> <add>import android.app.Activity; <add> <ide> /** <ide> * Base class for Catalyst native modules that require access to the {@link ReactContext} <ide> * instance. <ide> public ReactContextBaseJavaModule(ReactApplicationContext reactContext) { <ide> protected final ReactApplicationContext getReactApplicationContext() { <ide> return mReactApplicationContext; <ide> } <add> <add> /** <add> * Get the activity to which this context is currently attached, or {@code null} if not attached. <add> * <add> * DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE <add> * MEMORY LEAKS. <add> * <add> * For example, never store the value returned by this method in a member variable. Instead, call <add> * this method whenever you actually need the Activity and make sure to check for {@code null}. <add> */ <add> protected @Nullable final Activity getCurrentActivity() { <add> return mReactApplicationContext.getCurrentActivity(); <add> } <ide> }
4
Python
Python
fix docs for flask.test_client_class
22933a8cb424ffd65f2bec5bbfdbfa7e42105470
<ide><path>src/flask/app.py <ide> class Flask(Scaffold): <ide> #: .. versionadded:: 1.1.0 <ide> url_map_class = Map <ide> <del> #: the test client that is used with when `test_client` is used. <add> #: The :meth:`test_client` method creates an instance of this test <add> #: client class. Defaults to :class:`~flask.testing.FlaskClient`. <ide> #: <ide> #: .. versionadded:: 0.7 <ide> test_client_class: t.Optional[t.Type["FlaskClient"]] = None
1
Python
Python
add line separators in the terminal output
13ba034e929ddbea57852080b159acdff51e360d
<ide><path>glances/main.py <ide> def init_args(self): <ide> help='display modules (plugins & exports) list and exit', <ide> ) <ide> parser.add_argument( <del> '--disable-plugin', '--disable-plugins', dest='disable_plugin', help='disable plugin (comma separed list)' <add> '--disable-plugin', <add> '--disable-plugins', <add> dest='disable_plugin', <add> help='disable plugin (comma separed list)' <ide> ) <ide> parser.add_argument( <del> '--enable-plugin', '--enable-plugins', dest='enable_plugin', help='enable plugin (comma separed list)' <add> '--enable-plugin', <add> '--enable-plugins', <add> dest='enable_plugin', <add> help='enable plugin (comma separed list)' <ide> ) <ide> parser.add_argument( <ide> '--disable-process', <ide> def init_args(self): <ide> help='disable background colors in the terminal', <ide> ) <ide> parser.add_argument( <del> '--enable-irq', action='store_true', default=False, dest='enable_irq', help='enable IRQ module' <add> '--enable-irq', <add> action='store_true', <add> default=False, <add> dest='enable_irq', <add> help='enable IRQ module' <ide> ), <ide> parser.add_argument( <ide> '--enable-process-extended', <ide> def init_args(self): <ide> dest='enable_process_extended', <ide> help='enable extended stats on top process', <ide> ) <add> parser.add_argument( <add> '--separator', <add> '--enable-separator', <add> action='store_true', <add> default=False, <add> dest='enable_separator', <add> help='enable separator in the UI' <add> ), <ide> # Sort processes list <ide> parser.add_argument( <ide> '--sort-processes', <ide><path>glances/outputs/glances_curses.py <ide> from glances.logger import logger <ide> from glances.events import glances_events <ide> from glances.processes import glances_processes, sort_processes_key_list <add>from glances.outputs.glances_unicode import unicode_message <ide> from glances.timer import Timer <ide> <ide> # Import curses library for "normal" operating system <ide> def init_column(self): <ide> self.column = 0 <ide> self.next_column = 0 <ide> <del> def new_line(self): <add> def new_line(self, separator=False): <ide> """New line in the curses interface.""" <ide> self.line = self.next_line <ide> <ide> def new_column(self): <ide> """New column in the curses interface.""" <ide> self.column = self.next_column <ide> <add> def separator_line(self, color='TITLE'): <add> """New separator line in the curses interface.""" <add> if not self.args.enable_separator: <add> return <add> self.new_line() <add> self.line -= 1 <add> line_width = self.term_window.getmaxyx()[1] - self.column <add> self.term_window.addnstr(self.line, self.column, <add> unicode_message('MEDIUM_LINE', self.args) * line_width, <add> line_width, <add> self.colors_list[color]) <add> <ide> def __get_stat_display(self, stats, layer): <ide> """Return a dict of dict with all the stats display. <ide> # TODO: Drop extra parameter <ide> def display(self, stats, cs_status=None): <ide> # Optionally: Cloud on second line <ide> # ===================================== <ide> self.__display_header(__stat_display) <add> self.separator_line() <ide> <ide> # ============================================================== <ide> # Display second line (<SUMMARY>+CPU|PERCPU+<GPU>+LOAD+MEM+SWAP) <ide> # ============================================================== <ide> self.__display_top(__stat_display, stats) <add> self.init_column() <add> self.separator_line() <ide> <ide> # ================================================================== <ide> # Display left sidebar (NETWORK+PORTS+DISKIO+FS+SENSORS+Current time) <ide> def __display_header(self, stat_display): <ide> self.display_plugin(stat_display["ip"]) <ide> self.new_column() <ide> self.display_plugin( <del> stat_display["uptime"], add_space=-(self.get_stats_display_width(stat_display["cloud"]) != 0) <add> stat_display["uptime"], <add> add_space=-(self.get_stats_display_width(stat_display["cloud"]) != 0) <ide> ) <del> # Second line (optional) <ide> self.init_column() <del> self.new_line() <del> self.display_plugin(stat_display["cloud"]) <add> if self.get_stats_display_width(stat_display["cloud"]) != 0: <add> # Second line (optional) <add> self.new_line() <add> self.display_plugin(stat_display["cloud"]) <ide> <ide> def __display_top(self, stat_display, stats): <ide> """Display the second line in the Curses interface. <ide><path>glances/outputs/glances_unicode.py <ide> 'ARROW_DOWN': [u'\u2193', u'v'], <ide> 'CHECK': [u'\u2713', u''], <ide> 'PROCESS_SELECTOR': [u'>', u'>'], <add> 'MEDIUM_LINE': [u'\u23AF', u'-'], <add> 'LOW_LINE': [u'\u2581', u'_'], <ide> } <ide> <del> <ide> def unicode_message(key, args=None): <ide> """Return the unicode message for the given key.""" <ide> if args and hasattr(args, 'disable_unicode') and args.disable_unicode:
3
Python
Python
use unittest.mock as we are py3 now
4b8f80c3d31dffce153e4954b309cf52afc2c51a
<ide><path>official/recommendation/ncf_test.py <ide> import math <ide> import unittest <ide> <del>import mock <ide> import numpy as np <ide> import tensorflow as tf <ide> <ide> def test_hit_rate_and_ndcg(self): <ide> _BASE_END_TO_END_FLAGS = ['-batch_size', '1044', '-train_epochs', '1'] <ide> <ide> @unittest.skipIf(keras_utils.is_v2_0(), "TODO(b/136018594)") <del> @mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <add> @unittest.mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <ide> def test_end_to_end_estimator(self): <ide> integration.run_synthetic( <ide> ncf_estimator_main.main, tmp_root=self.get_temp_dir(), <ide> extra_flags=self._BASE_END_TO_END_FLAGS) <ide> <ide> @unittest.skipIf(keras_utils.is_v2_0(), "TODO(b/136018594)") <del> @mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <add> @unittest.mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <ide> def test_end_to_end_estimator_mlperf(self): <ide> integration.run_synthetic( <ide> ncf_estimator_main.main, tmp_root=self.get_temp_dir(), <ide> extra_flags=self._BASE_END_TO_END_FLAGS + ['-ml_perf', 'True']) <ide> <del> @mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <add> @unittest.mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <ide> def test_end_to_end_keras_no_dist_strat(self): <ide> integration.run_synthetic( <ide> ncf_keras_main.main, tmp_root=self.get_temp_dir(), <ide> extra_flags=self._BASE_END_TO_END_FLAGS + <ide> ['-distribution_strategy', 'off']) <ide> <del> @mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <add> @unittest.mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <ide> @unittest.skipUnless(keras_utils.is_v2_0(), 'TF 2.0 only test.') <ide> def test_end_to_end_keras_dist_strat(self): <ide> integration.run_synthetic( <ide> ncf_keras_main.main, tmp_root=self.get_temp_dir(), <ide> extra_flags=self._BASE_END_TO_END_FLAGS + ['-num_gpus', '0']) <ide> <del> @mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <add> @unittest.mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <ide> @unittest.skipUnless(keras_utils.is_v2_0(), 'TF 2.0 only test.') <ide> def test_end_to_end_keras_dist_strat_ctl(self): <ide> flags = (self._BASE_END_TO_END_FLAGS + <ide> def test_end_to_end_keras_dist_strat_ctl(self): <ide> ncf_keras_main.main, tmp_root=self.get_temp_dir(), <ide> extra_flags=flags) <ide> <del> @mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <add> @unittest.mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <ide> @unittest.skipUnless(keras_utils.is_v2_0(), 'TF 2.0 only test.') <ide> def test_end_to_end_keras_1_gpu_dist_strat_fp16(self): <ide> if context.num_gpus() < 1: <ide> def test_end_to_end_keras_1_gpu_dist_strat_fp16(self): <ide> extra_flags=self._BASE_END_TO_END_FLAGS + ['-num_gpus', '1', <ide> '--dtype', 'fp16']) <ide> <del> @mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <add> @unittest.mock.patch.object(rconst, "SYNTHETIC_BATCHES_PER_EPOCH", 100) <ide> @unittest.skipUnless(keras_utils.is_v2_0(), 'TF 2.0 only test.') <ide> def test_end_to_end_keras_1_gpu_dist_strat_ctl_fp16(self): <ide> if context.num_gpus() < 1: <ide> def test_end_to_end_keras_1_gpu_dist_strat_ctl_fp16(self): <ide> '--dtype', 'fp16', <ide> '--keras_use_ctl']) <ide> <del> @mock.patch.object(rconst, 'SYNTHETIC_BATCHES_PER_EPOCH', 100) <add> @unittest.mock.patch.object(rconst, 'SYNTHETIC_BATCHES_PER_EPOCH', 100) <ide> @unittest.skipUnless(keras_utils.is_v2_0(), 'TF 2.0 only test.') <ide> def test_end_to_end_keras_2_gpu_fp16(self): <ide> if context.num_gpus() < 2:
1
PHP
PHP
update typehints for cache/
b49634da57bc1d470fe1c0f628e09a1f26a56207
<ide><path>src/Cache/Cache.php <ide> protected static function _buildEngine(string $name): void <ide> * @return \Cake\Cache\CacheEngine <ide> * @deprecated 3.7.0 Use Cache::pool() instead. This method will be removed in 5.0. <ide> */ <del> public static function engine(string $config) <add> public static function engine(string $config): \Cake\Cache\CacheEngine <ide> { <ide> return static::pool($config); <ide> } <ide> public static function engine(string $config) <ide> * @param string $config The name of the configured cache backend. <ide> * @return \Cake\Cache\CacheEngine <ide> */ <del> public static function pool(string $config) <add> public static function pool(string $config): \Cake\Cache\CacheEngine <ide> { <ide> if (!static::$_enabled) { <ide> return new NullEngine(); <ide> public static function write(string $key, $value, $config = 'default'): bool <ide> * @return bool True on success, false on failure <ide> * @throws \Cake\Cache\InvalidArgumentException <ide> */ <del> public static function writeMany($data, string $config = 'default'): bool <add> public static function writeMany(iterable $data, string $config = 'default'): bool <ide> { <ide> return static::pool($config)->setMultiple($data); <ide> } <ide> public static function read(string $key, string $config = 'default') <ide> * the cached data or false if cached data could not be retrieved. <ide> * @throws \Cake\Cache\InvalidArgumentException <ide> */ <del> public static function readMany($keys, string $config = 'default'): array <add> public static function readMany(iterable $keys, string $config = 'default'): array <ide> { <ide> return static::pool($config)->getMultiple($keys); <ide> } <ide> public static function delete(string $key, string $config = 'default'): bool <ide> * @return bool True on success, false on failure. <ide> * @throws \Cake\Cache\InvalidArgumentException <ide> */ <del> public static function deleteMany($keys, string $config = 'default'): bool <add> public static function deleteMany(iterable $keys, string $config = 'default'): bool <ide> { <ide> return static::pool($config)->deleteMultiple($keys); <ide> } <ide><path>src/Cache/CacheEngine.php <ide> public function init(array $config = []): bool <ide> * @return void <ide> * @throws \Cake\Cache\InvalidArgumentException When the key is not valid. <ide> */ <del> protected function ensureValidKey($key) <add> protected function ensureValidKey(string $key): void <ide> { <ide> if (!is_string($key) || strlen($key) === 0) { <ide> throw new InvalidArgumentException('A cache key must be a non-empty string.'); <ide> protected function ensureValidKey($key) <ide> * @return void <ide> * @throws \Cake\Cache\InvalidArgumentException <ide> */ <del> protected function ensureValidType($iterable, string $check = self::CHECK_VALUE) <add> protected function ensureValidType($iterable, string $check = self::CHECK_VALUE): void <ide> { <ide> if (!is_iterable($iterable)) { <ide> throw new InvalidArgumentException(sprintf( <ide> public function deleteMultiple($keys): bool <ide> * @return bool <ide> * @throws \Cake\Cache\InvalidArgumentException If the $key string is not a legal value. <ide> */ <del> public function has($key) <add> public function has($key): bool <ide> { <ide> return $this->get($key) !== null; <ide> } <ide> abstract public function get($key, $default = null); <ide> * @throws \Cake\Cache\InvalidArgumentException <ide> * MUST be thrown if the $key string is not a legal value. <ide> */ <del> abstract public function set($key, $value, $ttl = null); <add> abstract public function set($key, $value, $ttl = null): bool; <ide> <ide> /** <ide> * Increment a number under the key and return incremented value <ide> abstract public function decrement(string $key, int $offset = 1); <ide> * @param string $key Identifier for the data <ide> * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed <ide> */ <del> abstract public function delete($key); <add> abstract public function delete($key): bool; <ide> <ide> /** <ide> * Delete all keys from the cache <ide> * <ide> * @return bool True if the cache was successfully cleared, false otherwise <ide> */ <del> abstract public function clear(); <add> abstract public function clear(): bool; <ide> <ide> /** <ide> * Add a key to the cache if it does not already exist. <ide> public function groups(): array <ide> * @return string Prefixed key with potentially unsafe characters replaced. <ide> * @throws \Cake\Cache\InvalidArgumentException If key's value is invalid. <ide> */ <del> protected function _key($key) <add> protected function _key($key): string <ide> { <ide> $this->ensureValidKey($key); <ide> <ide><path>src/Cache/CacheRegistry.php <ide> protected function _throwMissingClassError(string $class, ?string $plugin): void <ide> * @return \Cake\Cache\CacheEngine The constructed CacheEngine class. <ide> * @throws \RuntimeException when an object doesn't implement the correct interface. <ide> */ <del> protected function _create($class, string $alias, array $config) <add> protected function _create($class, string $alias, array $config): \Cake\Cache\CacheEngine <ide> { <ide> $instance = null; <ide> if (is_object($class)) { <ide><path>src/Cache/Engine/ApcuEngine.php <ide> public function init(array $config = []): bool <ide> * @return bool True on success and false on failure. <ide> * @link https://secure.php.net/manual/en/function.apcu-store.php <ide> */ <del> public function set($key, $value, $ttl = null) <add> public function set($key, $value, $ttl = null): bool <ide> { <ide> $key = $this->_key($key); <ide> $duration = $this->duration($ttl); <ide> public function decrement(string $key, int $offset = 1) <ide> * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed <ide> * @link https://secure.php.net/manual/en/function.apcu-delete.php <ide> */ <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> $key = $this->_key($key); <ide> <ide> public function delete($key) <ide> * @link https://secure.php.net/manual/en/function.apcu-cache-info.php <ide> * @link https://secure.php.net/manual/en/function.apcu-delete.php <ide> */ <del> public function clear() <add> public function clear(): bool <ide> { <ide> if (class_exists('APCuIterator', false)) { <ide> $iterator = new APCuIterator( <ide><path>src/Cache/Engine/ArrayEngine.php <ide> class ArrayEngine extends CacheEngine <ide> * for it or let the driver take care of that. <ide> * @return bool True on success and false on failure. <ide> */ <del> public function set($key, $data, $ttl = null) <add> public function set($key, $data, $ttl = null): bool <ide> { <ide> $key = $this->_key($key); <ide> $expires = time() + $this->duration($ttl); <ide> public function decrement(string $key, int $offset = 1) <ide> * @param string $key Identifier for the data <ide> * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed <ide> */ <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> $key = $this->_key($key); <ide> unset($this->data[$key]); <ide> public function delete($key) <ide> * <ide> * @return bool True Returns true. <ide> */ <del> public function clear() <add> public function clear(): bool <ide> { <ide> $this->data = []; <ide> <ide><path>src/Cache/Engine/FileEngine.php <ide> public function init(array $config = []): bool <ide> * for it or let the driver take care of that. <ide> * @return bool True on success and false on failure. <ide> */ <del> public function set($key, $data, $ttl = null) <add> public function set($key, $data, $ttl = null): bool <ide> { <ide> if ($data === '' || !$this->_init) { <ide> return false; <ide> public function get($key, $default = null) <ide> * @return bool True if the value was successfully deleted, false if it didn't <ide> * exist or couldn't be removed <ide> */ <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> $key = $this->_key($key); <ide> <ide> public function delete($key) <ide> * <ide> * @return bool True if the cache was successfully cleared, false otherwise <ide> */ <del> public function clear() <add> public function clear(): bool <ide> { <ide> if (!$this->_init) { <ide> return false; <ide> protected function _clearDirectory(string $path): void <ide> * @return void <ide> * @throws \LogicException <ide> */ <del> public function decrement(string $key, int $offset = 1) <add> public function decrement(string $key, int $offset = 1): void <ide> { <ide> throw new LogicException('Files cannot be atomically decremented.'); <ide> } <ide> public function decrement(string $key, int $offset = 1) <ide> * @return void <ide> * @throws \LogicException <ide> */ <del> public function increment(string $key, int $offset = 1) <add> public function increment(string $key, int $offset = 1): void <ide> { <ide> throw new LogicException('Files cannot be atomically incremented.'); <ide> } <ide> protected function _active(): bool <ide> /** <ide> * @inheritDoc <ide> */ <del> protected function _key($key) <add> protected function _key($key): string <ide> { <ide> $key = parent::_key($key); <ide> <ide><path>src/Cache/Engine/MemcachedEngine.php <ide> public function getOption($name) <ide> * @return bool True if the data was successfully cached, false on failure <ide> * @see https://secure.php.net/manual/en/memcache.set.php <ide> */ <del> public function set($key, $value, $ttl = null) <add> public function set($key, $value, $ttl = null): bool <ide> { <ide> $duration = $this->duration($ttl); <ide> if ($duration > 30 * DAY) { <ide> public function set($key, $value, $ttl = null) <ide> /** <ide> * Write many cache entries to the cache at once <ide> * <del> * @param array $data An array of data to be stored in the cache <add> * @param iterable $data An array of data to be stored in the cache <ide> * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and <ide> * the driver supports TTL then the library may set a default value <ide> * for it or let the driver take care of that. <ide> * @return bool Whether the write was successful or not. <ide> */ <del> public function setMultiple($data, $ttl = null): bool <add> public function setMultiple(array $data, $ttl = null): bool <ide> { <ide> $cacheData = []; <ide> foreach ($data as $key => $value) { <ide> public function get($key, $default = null) <ide> /** <ide> * Read many keys from the cache at once <ide> * <del> * @param array $keys An array of identifiers for the data <add> * @param iterable $keys An array of identifiers for the data <ide> * @param mixed $default Default value to return for keys that do not exist. <ide> * @return array An array containing, for each of the given $keys, the cached data or <ide> * false if cached data could not be retrieved. <ide> public function decrement(string $key, int $offset = 1) <ide> * @return bool True if the value was successfully deleted, false if it didn't <ide> * exist or couldn't be removed. <ide> */ <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> return $this->_Memcached->delete($this->_key($key)); <ide> } <ide> <ide> /** <ide> * Delete many keys from the cache at once <ide> * <del> * @param array $keys An array of identifiers for the data <add> * @param iterable $keys An array of identifiers for the data <ide> * @return bool of boolean values that are true if the key was successfully <ide> * deleted, false if it didn't exist or couldn't be removed. <ide> */ <ide> public function deleteMultiple($keys): bool <ide> * <ide> * @return bool True if the cache was successfully cleared, false otherwise <ide> */ <del> public function clear() <add> public function clear(): bool <ide> { <ide> $keys = $this->_Memcached->getAllKeys(); <ide> if ($keys === false) { <ide><path>src/Cache/Engine/NullEngine.php <ide> public function init(array $config = []): bool <ide> /** <ide> * @inheritDoc <ide> */ <del> public function set($key, $value, $ttl = null) <add> public function set($key, $value, $ttl = null): bool <ide> { <ide> return true; <ide> } <ide> public function decrement(string $key, int $offset = 1) <ide> /** <ide> * @inheritDoc <ide> */ <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> return true; <ide> } <ide> public function deleteMultiple($keys): bool <ide> /** <ide> * @inheritDoc <ide> */ <del> public function clear() <add> public function clear(): bool <ide> { <ide> return false; <ide> } <ide><path>src/Cache/Engine/RedisEngine.php <ide> protected function _connect(): bool <ide> * for it or let the driver take care of that. <ide> * @return bool True if the data was successfully cached, false on failure <ide> */ <del> public function set($key, $value, $ttl = null) <add> public function set($key, $value, $ttl = null): bool <ide> { <ide> $key = $this->_key($key); <ide> <ide> public function decrement(string $key, int $offset = 1) <ide> * @param string $key Identifier for the data <ide> * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed <ide> */ <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> $key = $this->_key($key); <ide> <ide> public function delete($key) <ide> * <ide> * @return bool True if the cache was successfully cleared, false otherwise <ide> */ <del> public function clear() <add> public function clear(): bool <ide> { <ide> $keys = $this->_Redis->getKeys($this->_config['prefix'] . '*'); <ide> <ide><path>src/Cache/Engine/WincacheEngine.php <ide> public function init(array $config = []): bool <ide> * for it or let the driver take care of that. <ide> * @return bool True if the data was successfully cached, false on failure <ide> */ <del> public function set($key, $value, $ttl = null) <add> public function set($key, $value, $ttl = null): bool <ide> { <ide> $key = $this->_key($key); <ide> $duration = $this->duration($ttl); <ide> public function decrement(string $key, int $offset = 1) <ide> * @param string $key Identifier for the data <ide> * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed <ide> */ <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> $key = $this->_key($key); <ide> <ide> public function delete($key) <ide> * <ide> * @return bool True Returns true. <ide> */ <del> public function clear() <add> public function clear(): bool <ide> { <ide> $info = wincache_ucache_info(); <ide> $cacheKeys = $info['ucache_entries']; <ide><path>tests/TestCase/Cache/Engine/ApcuEngineTest.php <ide> public static function setUpBeforeClass(): void <ide> */ <ide> public static function teardownAfterClass(): void <ide> { <del> ini_set('apc.use_request_time', static::$useRequestTime); <add> ini_set('apc.use_request_time', static::$useRequestTime ? '1' : '0'); <ide> } <ide> <ide> /** <ide><path>tests/test_app/Plugin/TestPlugin/src/Cache/Engine/TestPluginCacheEngine.php <ide> <ide> class TestPluginCacheEngine extends CacheEngine <ide> { <del> public function set($key, $value, $ttl = null) <add> public function set($key, $value, $ttl = null): bool <ide> { <ide> } <ide> <ide> public function decrement(string $key, int $offset = 1) <ide> { <ide> } <ide> <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> } <ide> <del> public function clear() <add> public function clear(): bool <ide> { <ide> } <ide> <ide><path>tests/test_app/TestApp/Cache/Engine/TestAppCacheEngine.php <ide> <ide> class TestAppCacheEngine extends CacheEngine <ide> { <del> public function set($key, $value, $ttl = null) <add> public function set($key, $value, $ttl = null): bool <ide> { <ide> if ($key === 'fail') { <ide> return false; <ide> public function decrement(string $key, int $offset = 1) <ide> { <ide> } <ide> <del> public function delete($key) <add> public function delete($key): bool <ide> { <ide> } <ide> <del> public function clear() <add> public function clear(): bool <ide> { <ide> } <ide>
13
Text
Text
fix broken link to recaptcha.net [ci skip]
88dc74b78468546748fdfdc4133e153efcc1f1c9
<ide><path>guides/source/security.md <ide> Depending on your web application, there may be more ways to hijack the user's a <ide> <ide> INFO: _A CAPTCHA is a challenge-response test to determine that the response is not generated by a computer. It is often used to protect registration forms from attackers and comment forms from automatic spam bots by asking the user to type the letters of a distorted image. This is the positive CAPTCHA, but there is also the negative CAPTCHA. The idea of a negative CAPTCHA is not for a user to prove that they are human, but reveal that a robot is a robot._ <ide> <del>A popular positive CAPTCHA API is [reCAPTCHA](http://recaptcha.net/) which displays two distorted images of words from old books. It also adds an angled line, rather than a distorted background and high levels of warping on the text as earlier CAPTCHAs did, because the latter were broken. As a bonus, using reCAPTCHA helps to digitize old books. [ReCAPTCHA](https://github.com/ambethia/recaptcha/) is also a Rails plug-in with the same name as the API. <add>A popular positive CAPTCHA API is [reCAPTCHA](https://developers.google.com/recaptcha/) which displays two distorted images of words from old books. It also adds an angled line, rather than a distorted background and high levels of warping on the text as earlier CAPTCHAs did, because the latter were broken. As a bonus, using reCAPTCHA helps to digitize old books. [ReCAPTCHA](https://github.com/ambethia/recaptcha/) is also a Rails plug-in with the same name as the API. <ide> <ide> You will get two keys from the API, a public and a private key, which you have to put into your Rails environment. After that you can use the recaptcha_tags method in the view, and the verify_recaptcha method in the controller. Verify_recaptcha will return false if the validation fails. <ide> The problem with CAPTCHAs is that they have a negative impact on the user experience. Additionally, some visually impaired users have found certain kinds of distorted CAPTCHAs difficult to read. Still, positive CAPTCHAs are one of the best methods to prevent all kinds of bots from submitting forms.
1
Text
Text
use sup tag for power in readme.md instead of ^
0f3ab059997e5fb039cfe6457a4e5c4684ede0cb
<ide><path>README.md <ide> These are for demonstration purposes only. There are many implementations of sor <ide> From [Wikipedia][bubble-wiki]: Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. <ide> <ide> __Properties__ <del>* Worst case performance O(n^2) <add>* Worst case performance O(n<sup>2</sup>) <ide> * Best case performance O(n) <del>* Average case performance O(n^2) <add>* Average case performance O(n<sup>2</sup>) <ide> <ide> ###### View the algorithm in [action][bubble-toptal] <ide> <ide> __Properties__ <ide> From [Wikipedia][bucket-wiki]: Bucket sort, or bin sort, is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting algorithm. <ide> <ide> __Properties__ <del>* Worst case performance O(n^2) <add>* Worst case performance O(n<sup>2</sup>) <ide> * Best case performance O(n+k) <ide> * Average case performance O(n+k) <ide> <ide> __Properties__ <ide> From [Wikipedia][cocktail-shaker-wiki]: Cocktail shaker sort, also known as bidirectional bubble sort, cocktail sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuffle sort, or shuttle sort, is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort. The algorithm differs from a bubble sort in that it sorts in both directions on each pass through the list. <ide> <ide> __Properties__ <del>* Worst case performance O(n^2) <add>* Worst case performance O(n<sup>2</sup>) <ide> * Best case performance O(n) <del>* Average case performance O(n^2) <add>* Average case performance O(n<sup>2</sup>) <ide> <ide> <ide> ### Insertion <ide> __Properties__ <ide> From [Wikipedia][insertion-wiki]: Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. <ide> <ide> __Properties__ <del>* Worst case performance O(n^2) <add>* Worst case performance O(n<sup>2</sup>) <ide> * Best case performance O(n) <del>* Average case performance O(n^2) <add>* Average case performance O(n<sup>2</sup>) <ide> <ide> ###### View the algorithm in [action][insertion-toptal] <ide> <ide> __Properties__ <ide> From [Wikipedia][quick-wiki]: Quicksort (sometimes called partition-exchange sort) is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order. <ide> <ide> __Properties__ <del>* Worst case performance O(n^2) <add>* Worst case performance O(n<sup>2</sup>) <ide> * Best case performance O(n log n) or O(n) with three-way partition <ide> * Average case performance O(n log n) <ide> <ide> __Properties__ <ide> From [Wikipedia][selection-wiki]: The algorithm divides the input list into two parts: the sublist of items already sorted, which is built up from left to right at the front (left) of the list, and the sublist of items remaining to be sorted that occupy the rest of the list. Initially, the sorted sublist is empty and the unsorted sublist is the entire input list. The algorithm proceeds by finding the smallest (or largest, depending on sorting order) element in the unsorted sublist, exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right. <ide> <ide> __Properties__ <del>* Worst case performance O(n^2) <del>* Best case performance O(n^2) <del>* Average case performance O(n^2) <add>* Worst case performance O(n<sup>2</sup>) <add>* Best case performance O(n<sup>2</sup>) <add>* Average case performance O(n<sup>2</sup>) <ide> <ide> ###### View the algorithm in [action][selection-toptal] <ide>
1
Javascript
Javascript
move html and svg configs into domproperty
8ec2ed4089053e6eaf00de6e9bddc793d27b74e8
<ide><path>packages/react-dom/src/client/ReactDOM.js <ide> import type { <ide> } from 'react-reconciler/src/ReactFiberRoot'; <ide> <ide> import '../shared/checkReact'; <del>import '../shared/ReactDOMInjection'; <ide> import './ReactDOMClientInjection'; <ide> <ide> import ReactFiberReconciler from 'react-reconciler'; <ide><path>packages/react-dom/src/server/ReactDOMServerBrowser.js <ide> * LICENSE file in the root directory of this source tree. <ide> */ <ide> <del>import '../shared/ReactDOMInjection'; <ide> import ReactVersion from 'shared/ReactVersion'; <ide> import invariant from 'fbjs/lib/invariant'; <ide> <ide><path>packages/react-dom/src/server/ReactDOMServerNode.js <ide> * LICENSE file in the root directory of this source tree. <ide> */ <ide> <del>import '../shared/ReactDOMInjection'; <ide> import ReactVersion from 'shared/ReactVersion'; <ide> <ide> import {renderToString, renderToStaticMarkup} from './ReactDOMStringRenderer'; <ide><path>packages/react-dom/src/shared/DOMProperty.js <ide> * LICENSE file in the root directory of this source tree. <ide> */ <ide> <del>import invariant from 'fbjs/lib/invariant'; <add>import warning from 'fbjs/lib/warning'; <ide> <ide> // These attributes should be all lowercase to allow for <ide> // case insensitive checks <ide> function checkMask(value, bitmask) { <ide> return (value & bitmask) === bitmask; <ide> } <ide> <del>var DOMPropertyInjection = { <del> /** <del> * Mapping from normalized, camelcased property names to a configuration that <del> * specifies how the associated DOM property should be accessed or rendered. <del> */ <del> MUST_USE_PROPERTY: 0x1, <del> HAS_BOOLEAN_VALUE: 0x4, <del> HAS_NUMERIC_VALUE: 0x8, <del> HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, <del> HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, <del> HAS_STRING_BOOLEAN_VALUE: 0x40, <del> <del> /** <del> * Inject some specialized knowledge about the DOM. This takes a config object <del> * with the following properties: <del> * <del> * Properties: object mapping DOM property name to one of the <del> * DOMPropertyInjection constants or null. If your attribute isn't in here, <del> * it won't get written to the DOM. <del> * <del> * DOMAttributeNames: object mapping React attribute name to the DOM <del> * attribute name. Attribute names not specified use the **lowercase** <del> * normalized name. <del> * <del> * DOMAttributeNamespaces: object mapping React attribute name to the DOM <del> * attribute namespace URL. (Attribute names not specified use no namespace.) <del> * <del> * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. <del> * Property names not specified use the normalized name. <del> * <del> * @param {object} domPropertyConfig the config as described above. <del> */ <del> injectDOMPropertyConfig: function(domPropertyConfig) { <del> var Injection = DOMPropertyInjection; <del> var Properties = domPropertyConfig.Properties || {}; <del> var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; <del> var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; <del> <del> for (var propName in Properties) { <del> invariant( <add>const MUST_USE_PROPERTY = 0x1; <add>const HAS_BOOLEAN_VALUE = 0x4; <add>const HAS_NUMERIC_VALUE = 0x8; <add>const HAS_POSITIVE_NUMERIC_VALUE = 0x10 | 0x8; <add>const HAS_OVERLOADED_BOOLEAN_VALUE = 0x20; <add>const HAS_STRING_BOOLEAN_VALUE = 0x40; <add> <add>function injectDOMPropertyConfig(domPropertyConfig) { <add> var Properties = domPropertyConfig.Properties || {}; <add> var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; <add> var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; <add> <add> for (var propName in Properties) { <add> if (__DEV__) { <add> warning( <ide> !properties.hasOwnProperty(propName), <ide> "injectDOMPropertyConfig(...): You're trying to inject DOM property " + <ide> "'%s' which has already been injected. You may be accidentally " + <ide> 'injecting the same DOM property config twice, or you may be ' + <ide> 'injecting two configs that have conflicting property names.', <ide> propName, <ide> ); <add> } <add> <add> var lowerCased = propName.toLowerCase(); <add> var propConfig = Properties[propName]; <ide> <del> var lowerCased = propName.toLowerCase(); <del> var propConfig = Properties[propName]; <del> <del> var propertyInfo = { <del> attributeName: lowerCased, <del> attributeNamespace: null, <del> propertyName: propName, <del> <del> mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), <del> hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), <del> hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), <del> hasPositiveNumericValue: checkMask( <del> propConfig, <del> Injection.HAS_POSITIVE_NUMERIC_VALUE, <del> ), <del> hasOverloadedBooleanValue: checkMask( <del> propConfig, <del> Injection.HAS_OVERLOADED_BOOLEAN_VALUE, <del> ), <del> hasStringBooleanValue: checkMask( <del> propConfig, <del> Injection.HAS_STRING_BOOLEAN_VALUE, <del> ), <del> }; <del> invariant( <add> var propertyInfo = { <add> attributeName: lowerCased, <add> attributeNamespace: null, <add> propertyName: propName, <add> <add> mustUseProperty: checkMask(propConfig, MUST_USE_PROPERTY), <add> hasBooleanValue: checkMask(propConfig, HAS_BOOLEAN_VALUE), <add> hasNumericValue: checkMask(propConfig, HAS_NUMERIC_VALUE), <add> hasPositiveNumericValue: checkMask( <add> propConfig, <add> HAS_POSITIVE_NUMERIC_VALUE, <add> ), <add> hasOverloadedBooleanValue: checkMask( <add> propConfig, <add> HAS_OVERLOADED_BOOLEAN_VALUE, <add> ), <add> hasStringBooleanValue: checkMask(propConfig, HAS_STRING_BOOLEAN_VALUE), <add> }; <add> if (__DEV__) { <add> warning( <ide> propertyInfo.hasBooleanValue + <ide> propertyInfo.hasNumericValue + <ide> propertyInfo.hasOverloadedBooleanValue <= <ide> var DOMPropertyInjection = { <ide> 'numeric value, but not a combination: %s', <ide> propName, <ide> ); <add> } <ide> <del> if (DOMAttributeNames.hasOwnProperty(propName)) { <del> var attributeName = DOMAttributeNames[propName]; <del> <del> propertyInfo.attributeName = attributeName; <del> } <add> if (DOMAttributeNames.hasOwnProperty(propName)) { <add> var attributeName = DOMAttributeNames[propName]; <ide> <del> if (DOMAttributeNamespaces.hasOwnProperty(propName)) { <del> propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; <del> } <add> propertyInfo.attributeName = attributeName; <add> } <ide> <del> // Downcase references to whitelist properties to check for membership <del> // without case-sensitivity. This allows the whitelist to pick up <del> // `allowfullscreen`, which should be written using the property configuration <del> // for `allowFullscreen` <del> properties[propName] = propertyInfo; <add> if (DOMAttributeNamespaces.hasOwnProperty(propName)) { <add> propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; <ide> } <del> }, <del>}; <add> <add> // Downcase references to whitelist properties to check for membership <add> // without case-sensitivity. This allows the whitelist to pick up <add> // `allowfullscreen`, which should be written using the property configuration <add> // for `allowFullscreen` <add> properties[propName] = propertyInfo; <add> } <add>} <ide> <ide> /* eslint-disable max-len */ <ide> export const ATTRIBUTE_NAME_START_CHAR = <ide> export function isReservedProp(name) { <ide> return RESERVED_PROPS.hasOwnProperty(name); <ide> } <ide> <del>export const injection = DOMPropertyInjection; <add>var HTMLDOMPropertyConfig = { <add> // When adding attributes to this list, be sure to also add them to <add> // the `possibleStandardNames` module to ensure casing and incorrect <add> // name warnings. <add> Properties: { <add> allowFullScreen: HAS_BOOLEAN_VALUE, <add> // specifies target context for links with `preload` type <add> async: HAS_BOOLEAN_VALUE, <add> // Note: there is a special case that prevents it from being written to the DOM <add> // on the client side because the browsers are inconsistent. Instead we call focus(). <add> autoFocus: HAS_BOOLEAN_VALUE, <add> autoPlay: HAS_BOOLEAN_VALUE, <add> capture: HAS_OVERLOADED_BOOLEAN_VALUE, <add> checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <add> cols: HAS_POSITIVE_NUMERIC_VALUE, <add> contentEditable: HAS_STRING_BOOLEAN_VALUE, <add> controls: HAS_BOOLEAN_VALUE, <add> default: HAS_BOOLEAN_VALUE, <add> defer: HAS_BOOLEAN_VALUE, <add> disabled: HAS_BOOLEAN_VALUE, <add> download: HAS_OVERLOADED_BOOLEAN_VALUE, <add> draggable: HAS_STRING_BOOLEAN_VALUE, <add> formNoValidate: HAS_BOOLEAN_VALUE, <add> hidden: HAS_BOOLEAN_VALUE, <add> loop: HAS_BOOLEAN_VALUE, <add> // Caution; `option.selected` is not updated if `select.multiple` is <add> // disabled with `removeAttribute`. <add> multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <add> muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <add> noValidate: HAS_BOOLEAN_VALUE, <add> open: HAS_BOOLEAN_VALUE, <add> playsInline: HAS_BOOLEAN_VALUE, <add> readOnly: HAS_BOOLEAN_VALUE, <add> required: HAS_BOOLEAN_VALUE, <add> reversed: HAS_BOOLEAN_VALUE, <add> rows: HAS_POSITIVE_NUMERIC_VALUE, <add> rowSpan: HAS_NUMERIC_VALUE, <add> scoped: HAS_BOOLEAN_VALUE, <add> seamless: HAS_BOOLEAN_VALUE, <add> selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <add> size: HAS_POSITIVE_NUMERIC_VALUE, <add> start: HAS_NUMERIC_VALUE, <add> // support for projecting regular DOM Elements via V1 named slots ( shadow dom ) <add> span: HAS_POSITIVE_NUMERIC_VALUE, <add> spellCheck: HAS_STRING_BOOLEAN_VALUE, <add> // Style must be explicitly set in the attribute list. React components <add> // expect a style object <add> style: 0, <add> // Keep it in the whitelist because it is case-sensitive for SVG. <add> tabIndex: 0, <add> // itemScope is for for Microdata support. <add> // See http://schema.org/docs/gs.html <add> itemScope: HAS_BOOLEAN_VALUE, <add> // These attributes must stay in the white-list because they have <add> // different attribute names (see DOMAttributeNames below) <add> acceptCharset: 0, <add> className: 0, <add> htmlFor: 0, <add> httpEquiv: 0, <add> // Set the string boolean flag to allow the behavior <add> value: HAS_STRING_BOOLEAN_VALUE, <add> }, <add> DOMAttributeNames: { <add> acceptCharset: 'accept-charset', <add> className: 'class', <add> htmlFor: 'for', <add> httpEquiv: 'http-equiv', <add> }, <add>}; <add> <add>var NS = { <add> xlink: 'http://www.w3.org/1999/xlink', <add> xml: 'http://www.w3.org/XML/1998/namespace', <add>}; <add> <add>/** <add> * This is a list of all SVG attributes that need special casing, <add> * namespacing, or boolean value assignment. <add> * <add> * When adding attributes to this list, be sure to also add them to <add> * the `possibleStandardNames` module to ensure casing and incorrect <add> * name warnings. <add> * <add> * SVG Attributes List: <add> * https://www.w3.org/TR/SVG/attindex.html <add> * SMIL Spec: <add> * https://www.w3.org/TR/smil <add> */ <add>var SVG_ATTRS = [ <add> 'accent-height', <add> 'alignment-baseline', <add> 'arabic-form', <add> 'baseline-shift', <add> 'cap-height', <add> 'clip-path', <add> 'clip-rule', <add> 'color-interpolation', <add> 'color-interpolation-filters', <add> 'color-profile', <add> 'color-rendering', <add> 'dominant-baseline', <add> 'enable-background', <add> 'fill-opacity', <add> 'fill-rule', <add> 'flood-color', <add> 'flood-opacity', <add> 'font-family', <add> 'font-size', <add> 'font-size-adjust', <add> 'font-stretch', <add> 'font-style', <add> 'font-variant', <add> 'font-weight', <add> 'glyph-name', <add> 'glyph-orientation-horizontal', <add> 'glyph-orientation-vertical', <add> 'horiz-adv-x', <add> 'horiz-origin-x', <add> 'image-rendering', <add> 'letter-spacing', <add> 'lighting-color', <add> 'marker-end', <add> 'marker-mid', <add> 'marker-start', <add> 'overline-position', <add> 'overline-thickness', <add> 'paint-order', <add> 'panose-1', <add> 'pointer-events', <add> 'rendering-intent', <add> 'shape-rendering', <add> 'stop-color', <add> 'stop-opacity', <add> 'strikethrough-position', <add> 'strikethrough-thickness', <add> 'stroke-dasharray', <add> 'stroke-dashoffset', <add> 'stroke-linecap', <add> 'stroke-linejoin', <add> 'stroke-miterlimit', <add> 'stroke-opacity', <add> 'stroke-width', <add> 'text-anchor', <add> 'text-decoration', <add> 'text-rendering', <add> 'underline-position', <add> 'underline-thickness', <add> 'unicode-bidi', <add> 'unicode-range', <add> 'units-per-em', <add> 'v-alphabetic', <add> 'v-hanging', <add> 'v-ideographic', <add> 'v-mathematical', <add> 'vector-effect', <add> 'vert-adv-y', <add> 'vert-origin-x', <add> 'vert-origin-y', <add> 'word-spacing', <add> 'writing-mode', <add> 'x-height', <add> 'xlink:actuate', <add> 'xlink:arcrole', <add> 'xlink:href', <add> 'xlink:role', <add> 'xlink:show', <add> 'xlink:title', <add> 'xlink:type', <add> 'xml:base', <add> 'xmlns:xlink', <add> 'xml:lang', <add> 'xml:space', <add>]; <add> <add>var SVGDOMPropertyConfig = { <add> Properties: { <add> autoReverse: HAS_STRING_BOOLEAN_VALUE, <add> externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE, <add> preserveAlpha: HAS_STRING_BOOLEAN_VALUE, <add> }, <add> DOMAttributeNames: { <add> autoReverse: 'autoReverse', <add> externalResourcesRequired: 'externalResourcesRequired', <add> preserveAlpha: 'preserveAlpha', <add> }, <add> DOMAttributeNamespaces: { <add> xlinkActuate: NS.xlink, <add> xlinkArcrole: NS.xlink, <add> xlinkHref: NS.xlink, <add> xlinkRole: NS.xlink, <add> xlinkShow: NS.xlink, <add> xlinkTitle: NS.xlink, <add> xlinkType: NS.xlink, <add> xmlBase: NS.xml, <add> xmlLang: NS.xml, <add> xmlSpace: NS.xml, <add> }, <add>}; <add> <add>var CAMELIZE = /[\-\:]([a-z])/g; <add>var capitalize = token => token[1].toUpperCase(); <add> <add>SVG_ATTRS.forEach(original => { <add> var reactName = original.replace(CAMELIZE, capitalize); <add> <add> SVGDOMPropertyConfig.Properties[reactName] = 0; <add> SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original; <add>}); <add> <add>injectDOMPropertyConfig(HTMLDOMPropertyConfig); <add>injectDOMPropertyConfig(SVGDOMPropertyConfig); <ide><path>packages/react-dom/src/shared/HTMLDOMPropertyConfig.js <del>/** <del> * Copyright (c) 2013-present, Facebook, Inc. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> */ <del> <del>import {injection} from './DOMProperty'; <del> <del>var MUST_USE_PROPERTY = injection.MUST_USE_PROPERTY; <del>var HAS_BOOLEAN_VALUE = injection.HAS_BOOLEAN_VALUE; <del>var HAS_NUMERIC_VALUE = injection.HAS_NUMERIC_VALUE; <del>var HAS_POSITIVE_NUMERIC_VALUE = injection.HAS_POSITIVE_NUMERIC_VALUE; <del>var HAS_OVERLOADED_BOOLEAN_VALUE = injection.HAS_OVERLOADED_BOOLEAN_VALUE; <del>var HAS_STRING_BOOLEAN_VALUE = injection.HAS_STRING_BOOLEAN_VALUE; <del> <del>var HTMLDOMPropertyConfig = { <del> // When adding attributes to this list, be sure to also add them to <del> // the `possibleStandardNames` module to ensure casing and incorrect <del> // name warnings. <del> Properties: { <del> allowFullScreen: HAS_BOOLEAN_VALUE, <del> // specifies target context for links with `preload` type <del> async: HAS_BOOLEAN_VALUE, <del> // Note: there is a special case that prevents it from being written to the DOM <del> // on the client side because the browsers are inconsistent. Instead we call focus(). <del> autoFocus: HAS_BOOLEAN_VALUE, <del> autoPlay: HAS_BOOLEAN_VALUE, <del> capture: HAS_OVERLOADED_BOOLEAN_VALUE, <del> checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <del> cols: HAS_POSITIVE_NUMERIC_VALUE, <del> contentEditable: HAS_STRING_BOOLEAN_VALUE, <del> controls: HAS_BOOLEAN_VALUE, <del> default: HAS_BOOLEAN_VALUE, <del> defer: HAS_BOOLEAN_VALUE, <del> disabled: HAS_BOOLEAN_VALUE, <del> download: HAS_OVERLOADED_BOOLEAN_VALUE, <del> draggable: HAS_STRING_BOOLEAN_VALUE, <del> formNoValidate: HAS_BOOLEAN_VALUE, <del> hidden: HAS_BOOLEAN_VALUE, <del> loop: HAS_BOOLEAN_VALUE, <del> // Caution; `option.selected` is not updated if `select.multiple` is <del> // disabled with `removeAttribute`. <del> multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <del> muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <del> noValidate: HAS_BOOLEAN_VALUE, <del> open: HAS_BOOLEAN_VALUE, <del> playsInline: HAS_BOOLEAN_VALUE, <del> readOnly: HAS_BOOLEAN_VALUE, <del> required: HAS_BOOLEAN_VALUE, <del> reversed: HAS_BOOLEAN_VALUE, <del> rows: HAS_POSITIVE_NUMERIC_VALUE, <del> rowSpan: HAS_NUMERIC_VALUE, <del> scoped: HAS_BOOLEAN_VALUE, <del> seamless: HAS_BOOLEAN_VALUE, <del> selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <del> size: HAS_POSITIVE_NUMERIC_VALUE, <del> start: HAS_NUMERIC_VALUE, <del> // support for projecting regular DOM Elements via V1 named slots ( shadow dom ) <del> span: HAS_POSITIVE_NUMERIC_VALUE, <del> spellCheck: HAS_STRING_BOOLEAN_VALUE, <del> // Style must be explicitly set in the attribute list. React components <del> // expect a style object <del> style: 0, <del> // Keep it in the whitelist because it is case-sensitive for SVG. <del> tabIndex: 0, <del> // itemScope is for for Microdata support. <del> // See http://schema.org/docs/gs.html <del> itemScope: HAS_BOOLEAN_VALUE, <del> // These attributes must stay in the white-list because they have <del> // different attribute names (see DOMAttributeNames below) <del> acceptCharset: 0, <del> className: 0, <del> htmlFor: 0, <del> httpEquiv: 0, <del> // Attributes with mutation methods must be specified in the whitelist <del> // Set the string boolean flag to allow the behavior <del> value: HAS_STRING_BOOLEAN_VALUE, <del> }, <del> DOMAttributeNames: { <del> acceptCharset: 'accept-charset', <del> className: 'class', <del> htmlFor: 'for', <del> httpEquiv: 'http-equiv', <del> }, <del>}; <del> <del>export default HTMLDOMPropertyConfig; <ide><path>packages/react-dom/src/shared/ReactDOMInjection.js <del>/** <del> * Copyright (c) 2013-present, Facebook, Inc. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> */ <del> <del>import * as DOMProperty from './DOMProperty'; <del>import HTMLDOMPropertyConfig from './HTMLDOMPropertyConfig'; <del>import SVGDOMPropertyConfig from './SVGDOMPropertyConfig'; <del> <del>DOMProperty.injection.injectDOMPropertyConfig(HTMLDOMPropertyConfig); <del>DOMProperty.injection.injectDOMPropertyConfig(SVGDOMPropertyConfig); <ide><path>packages/react-dom/src/shared/SVGDOMPropertyConfig.js <del>/** <del> * Copyright (c) 2013-present, Facebook, Inc. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> */ <del> <del>import {injection} from './DOMProperty'; <del> <del>var {HAS_STRING_BOOLEAN_VALUE} = injection; <del> <del>var NS = { <del> xlink: 'http://www.w3.org/1999/xlink', <del> xml: 'http://www.w3.org/XML/1998/namespace', <del>}; <del> <del>/** <del> * This is a list of all SVG attributes that need special casing, <del> * namespacing, or boolean value assignment. <del> * <del> * When adding attributes to this list, be sure to also add them to <del> * the `possibleStandardNames` module to ensure casing and incorrect <del> * name warnings. <del> * <del> * SVG Attributes List: <del> * https://www.w3.org/TR/SVG/attindex.html <del> * SMIL Spec: <del> * https://www.w3.org/TR/smil <del> */ <del>var ATTRS = [ <del> 'accent-height', <del> 'alignment-baseline', <del> 'arabic-form', <del> 'baseline-shift', <del> 'cap-height', <del> 'clip-path', <del> 'clip-rule', <del> 'color-interpolation', <del> 'color-interpolation-filters', <del> 'color-profile', <del> 'color-rendering', <del> 'dominant-baseline', <del> 'enable-background', <del> 'fill-opacity', <del> 'fill-rule', <del> 'flood-color', <del> 'flood-opacity', <del> 'font-family', <del> 'font-size', <del> 'font-size-adjust', <del> 'font-stretch', <del> 'font-style', <del> 'font-variant', <del> 'font-weight', <del> 'glyph-name', <del> 'glyph-orientation-horizontal', <del> 'glyph-orientation-vertical', <del> 'horiz-adv-x', <del> 'horiz-origin-x', <del> 'image-rendering', <del> 'letter-spacing', <del> 'lighting-color', <del> 'marker-end', <del> 'marker-mid', <del> 'marker-start', <del> 'overline-position', <del> 'overline-thickness', <del> 'paint-order', <del> 'panose-1', <del> 'pointer-events', <del> 'rendering-intent', <del> 'shape-rendering', <del> 'stop-color', <del> 'stop-opacity', <del> 'strikethrough-position', <del> 'strikethrough-thickness', <del> 'stroke-dasharray', <del> 'stroke-dashoffset', <del> 'stroke-linecap', <del> 'stroke-linejoin', <del> 'stroke-miterlimit', <del> 'stroke-opacity', <del> 'stroke-width', <del> 'text-anchor', <del> 'text-decoration', <del> 'text-rendering', <del> 'underline-position', <del> 'underline-thickness', <del> 'unicode-bidi', <del> 'unicode-range', <del> 'units-per-em', <del> 'v-alphabetic', <del> 'v-hanging', <del> 'v-ideographic', <del> 'v-mathematical', <del> 'vector-effect', <del> 'vert-adv-y', <del> 'vert-origin-x', <del> 'vert-origin-y', <del> 'word-spacing', <del> 'writing-mode', <del> 'x-height', <del> 'xlink:actuate', <del> 'xlink:arcrole', <del> 'xlink:href', <del> 'xlink:role', <del> 'xlink:show', <del> 'xlink:title', <del> 'xlink:type', <del> 'xml:base', <del> 'xmlns:xlink', <del> 'xml:lang', <del> 'xml:space', <del>]; <del> <del>var SVGDOMPropertyConfig = { <del> Properties: { <del> autoReverse: HAS_STRING_BOOLEAN_VALUE, <del> externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE, <del> preserveAlpha: HAS_STRING_BOOLEAN_VALUE, <del> }, <del> DOMAttributeNames: { <del> autoReverse: 'autoReverse', <del> externalResourcesRequired: 'externalResourcesRequired', <del> preserveAlpha: 'preserveAlpha', <del> }, <del> DOMAttributeNamespaces: { <del> xlinkActuate: NS.xlink, <del> xlinkArcrole: NS.xlink, <del> xlinkHref: NS.xlink, <del> xlinkRole: NS.xlink, <del> xlinkShow: NS.xlink, <del> xlinkTitle: NS.xlink, <del> xlinkType: NS.xlink, <del> xmlBase: NS.xml, <del> xmlLang: NS.xml, <del> xmlSpace: NS.xml, <del> }, <del>}; <del> <del>var CAMELIZE = /[\-\:]([a-z])/g; <del>var capitalize = token => token[1].toUpperCase(); <del> <del>ATTRS.forEach(original => { <del> var reactName = original.replace(CAMELIZE, capitalize); <del> <del> SVGDOMPropertyConfig.Properties[reactName] = 0; <del> SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original; <del>}); <del> <del>export default SVGDOMPropertyConfig;
7
Ruby
Ruby
remove travis seed
5c5c416d1cb2df75f430c30a8044c82e041f530c
<ide><path>Library/Homebrew/cask/cmd/brew-cask-tests.rb <ide> def run_tests(executable, files, args = []) <ide> rspec = ARGV.flag?("--rspec") || !ARGV.flag?("--minitest") <ide> minitest = ARGV.flag?("--minitest") || !ARGV.flag?("--rspec") <ide> <del> # TODO: setting the --seed here is an ugly temporary hack, to remain only <del> # until test-suite glitches are fixed. <del> ENV["TESTOPTS"] = "--seed=14830" if ENV["TRAVIS"] <del> <ide> ENV["HOMEBREW_TESTS_COVERAGE"] = "1" if ARGV.flag?("--coverage") <ide> <ide> if rspec
1
Javascript
Javascript
fix bad assumption in pummel/test-vm-memleak
7e648da834faa7b837806cd5e214582b0359a03a
<ide><path>test/pummel/test-vm-memleak.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <add>// Flags: --max_old_space_size=32 <add> <ide> var assert = require('assert'); <ide> var common = require('../common'); <ide> <ide> var start = Date.now(); <ide> var maxMem = 0; <ide> <add>var ok = process.execArgv.some(function(arg) { <add> return arg === '--max_old_space_size=32'; <add>}); <add>assert(ok, 'Run this test with --max_old_space_size=32.'); <add> <ide> var interval = setInterval(function() { <ide> try { <ide> require('vm').runInNewContext('throw 1;'); <ide> var interval = setInterval(function() { <ide> var rss = process.memoryUsage().rss; <ide> maxMem = Math.max(rss, maxMem); <ide> <del> <ide> if (Date.now() - start > 5 * 1000) { <ide> // wait 10 seconds. <ide> clearInterval(interval); <ide> function testContextLeak() { <ide> <ide> process.on('exit', function() { <ide> console.error('max mem: %dmb', Math.round(maxMem / (1024 * 1024))); <del> // make sure we stay below 100mb <del> assert.ok(maxMem < 50 * 1024 * 1024); <add> assert.ok(maxMem < 64 * 1024 * 1024); <ide> });
1
Ruby
Ruby
update formula template for new x11 dependency
168ccb2821f1e4adb1129b2a73b51805743aee51
<ide><path>Library/Homebrew/cmd/create.rb <ide> class #{Formula.class_s name} < Formula <ide> <% elsif mode == nil %> <ide> # depends_on 'cmake' => :build <ide> <% end %> <add> depends_on :x11 # if your formula requires any X11/XQuartz components <ide> <ide> def install <del> # ENV.x11 # if your formula requires any X11 headers <ide> # ENV.j1 # if your formula's build system can't parallelize <ide> <ide> <% if mode == :cmake %>
1
Python
Python
add basic example for using the lxdcontainerdriver
4e66df468b104d8e95184322082a7775838a4f87
<ide><path>example_lxd.py <add># Licensed to the Apache Software Foundation (ASF) under one or more <add># contributor license agreements. See the NOTICE file distributed with <add># this work for additional information regarding copyright ownership. <add># The ASF licenses this file to You under the Apache License, Version 2.0 <add># (the "License"); you may not use this file except in compliance with <add># the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, software <add># distributed under the License is distributed on an "AS IS" BASIS, <add># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add># See the License for the specific language governing permissions and <add># limitations under the License. <add> <add>from libcloud.container.types import Provider <add>from libcloud.container.providers import get_driver <add> <add> <add>def main(): <add> <add> # LXD API specification can be found at: <add> # https://github.com/lxc/lxd/blob/master/doc/rest-api.md#10containersnamemetadata <add> <add> # LXD host change accordingly <add> host_lxd = 'https://192.168.2.4' <add> <add> # port that LXD server is listening at <add> # change this according to your configuration <add> port_id = 8443 <add> <add> # get the libcloud LXD driver <add> lxd_driver = get_driver(Provider.LXD) <add> <add> # acquire the connection. <add> # certificates should have been added to the LXD server <add> # here we assume they are on the same directory change <add> # accordingly <add> conn = lxd_driver(key='', secret='', secure=False, <add> host=host_lxd, port=port_id, key_file='lxd.key', cert_file='lxd.crt') <add> <add> # this API call does not require authentication <add> api_end_points = conn.get_api_endpoints() <add> print(api_end_points.parse_body()) <add> <add> # this API call is allowed for everyone (but result varies) <add> api_version = conn.get_to_version() <add> print(api_version.parse_body()) <add> <add> # get the list of the containers <add> containers = conn.list_containers() <add> print(containers) <add> <add> <add>if __name__ == '__main__': <add> main() <ide>\ No newline at end of file
1
Text
Text
fix a typo
41a6d2de955fc7cc9006789ca017ca8020d8297e
<ide><path>docs/recipes/ReducingBoilerplate.md <ide> We just modified how `addTodo` action creator behaves, completely invisible to t <ide> <ide> Some frameworks like [Flummox](https://github.com/acdlite/flummox) generate action type constants automatically from the action creator function definitions. The idea is that you don’t need to both define `ADD_TODO` constant and `addTodo()` action creator. Under the hood, such solutions still generate action type constants, but they’re created implicitly so it’s a level of indirection and can cause confusion. We recommend creating your action type constants explicitly. <ide> <del> Writing simple action creators can be tiresome and often ends up generating redundant boilerplate code: <add>Writing simple action creators can be tiresome and often ends up generating redundant boilerplate code: <ide> <ide> ```js <ide> export function addTodo(text) { <ide> export const addTodo = makeActionCreator(ADD_TODO, 'todo'); <ide> export const editTodo = makeActionCreator(EDIT_TODO, 'id', 'todo'); <ide> export const removeTodo = makeActionCreator(REMOVE_TODO, 'id'); <ide> ``` <del>There are also utility libraries to aid in generating action creators, such as [redux-action-utils](https://github.com/insin/redux-action-utils) and [redux-actions](https://github.com/acdlite/redux-actions). These can help with reducing your boilerplate code and adhereing to standards such as [Flux Standard Action (FSA)](https://github.com/acdlite/flux-standard-action). <add>There are also utility libraries to aid in generating action creators, such as [redux-action-utils](https://github.com/insin/redux-action-utils) and [redux-actions](https://github.com/acdlite/redux-actions). These can help with reducing your boilerplate code and adhering to standards such as [Flux Standard Action (FSA)](https://github.com/acdlite/flux-standard-action). <ide> <ide> ## Async Action Creators <ide>
1
Text
Text
add v4.0.0-beta.7 to changelog
dfd1da52eaafcb02e6c019ae0c10a914b07e0c5a
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v4.0.0-beta.7 (November 1, 2021) <add> <add>- [#19677](https://github.com/emberjs/ember.js/pull/19677) [CLEANUP] Remove jQuery from build <add> <ide> ### v4.0.0-beta.6 (October 26, 2021) <ide> <ide> - [#19799](https://github.com/emberjs/ember.js/pull/19799) / [glimmerjs/glimmer-vm#1354](https://github.com/glimmerjs/glimmer-vm/pull/1354) Fixes for errors while precompiling inline templates (introduced in 3.28.2)
1
Go
Go
keep walkroot clean if source is /
7410f1a859063d4ed3d8fca44f27bdde4c2cb5a3
<ide><path>pkg/archive/archive_unix.go <ide> import ( <ide> "errors" <ide> "os" <ide> "path/filepath" <add> "strings" <ide> "syscall" <ide> <ide> "github.com/docker/docker/pkg/idtools" <ide> func fixVolumePathPrefix(srcPath string) string { <ide> // can't use filepath.Join(srcPath,include) because this will clean away <ide> // a trailing "." or "/" which may be important. <ide> func getWalkRoot(srcPath string, include string) string { <del> return srcPath + string(filepath.Separator) + include <add> return strings.TrimSuffix(srcPath, string(filepath.Separator)) + string(filepath.Separator) + include <ide> } <ide> <ide> // CanonicalTarNameForPath returns platform-specific filepath
1
PHP
PHP
give a path to fix deprecation
282575c95abef18bb6b1b212e9b5d3ff7e78400e
<ide><path>src/Http/ServerRequest.php <ide> protected function normalizeHeaderName($name) <ide> * <ide> * @param string $name Name of the header you want. <ide> * @return string|null Either null on no header being set or the value of the header. <del> * @deprecated 4.0.0 The automatic fallback to env() will be removed in 4.0.0 <add> * @deprecated 4.0.0 The automatic fallback to env() will be removed in 4.0.0, see getHeader() <ide> */ <ide> public function header($name) <ide> {
1
Javascript
Javascript
add example for a custom put request
3174f7333672c96613825976c883f79ad4d41016
<ide><path>src/ngResource/resource.js <ide> function shallowClearAndCopy(src, dst) { <ide> * when a param value needs to be obtained for a request (unless the param was overridden). <ide> * <ide> * Each key value in the parameter object is first bound to url template if present and then any <del> * excess keys are appended to the url search query after the `?`. <add> * excess keys are appended to the url seapph query after the `?`. <ide> * <ide> * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in <ide> * URL `/path/greet?salutation=Hello`. <ide> function shallowClearAndCopy(src, dst) { <ide> }); <ide> }); <ide> </pre> <add> <add> * @example <add> * # Creating a custom 'PUT' request <add> * In this example we create a custom method on our resource to make a PUT request <add> <pre> <add> var app = angular.module('app', ['ngResource', 'ngRoute']); <add> <add> // Some APIs expect a PUT request in the format URL/object/ID <add> // Here we are creating an 'update' method <add> app.factory('Notes', ['$resource', function($resource) { <add> return $resource('/notes/:id', null, <add> { <add> 'update': { method:'PUT' } <add> }); <add> }]); <add> <add> // In our controller we get the ID from the URL using ngRoute and $routeParams <add> // We pass in $routeParams and our Notes factory along with $scope <add> app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes', function($scope, $routeParams, Notes) { <add> // First get a note object from the factory <add> var note = Notes.get({ id:$routeParams.id }); <add> $id = note.id; <add> <add> // Now call update passing in the ID first then the object you are updating <add> Notes.update({ id:$id }, note); <add> <add> // This will PUT /notes/ID with the note object in the request payload <add> }]); <add> </pre> <ide> */ <ide> angular.module('ngResource', ['ng']). <ide> factory('$resource', ['$http', '$q', function($http, $q) {
1
Javascript
Javascript
fix flashvar name
f4e68d1a47872176a67394c575fe53c2569c7a72
<ide><path>compare/compare.js <del>_V_.flash.prototype.swf = "../flash/video-js.swf"; <add>_V_.options.flash.swf = "../flash/video-js.swf"; <ide> <ide> $(function(){ <ide> var tech, i, tname, player, <ide> techList = ["html5","flash"], <ide> props = "error,currentSrc,networkState,buffered,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoWidth,videoHeight,textTracks,preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,controls,volume,muted,defaultMuted,poster".split(","), <ide> methods = "play,pause,src,load,canPlayType,addTextTrack", <ide> notUsed = "mediaGroup,controller,videoTracks,audioTracks,defaultPlaybackRate"; <del> <ide> <ide> for (i=0; i < techList.length; i++) { <ide> tech = techList[i]; <ide><path>src/tech.js <ide> _V_.flash = _V_.PlaybackTech.extend({ <ide> <ide> // If source was supplied pass as a flash var. <ide> if (source) { <del> flashvars.src = source.src; <add> flashVars.src = source.src; <ide> } <ide> <ide> _V_.insertFirst(placeHolder, player.el);
2
PHP
PHP
fix broken case. add test
9d2a7ca049e71d39e453ba8c34addb657b71b237
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> class Builder <ide> */ <ide> protected $passthru = [ <ide> 'insert', 'insertGetId', 'getBindings', 'toSql', <del> 'exists', 'count', 'min', 'max', 'avg', 'sum', 'getConnection', <add> 'exists', 'doesntExist', 'count', 'min', 'max', 'avg', 'sum', 'getConnection', <ide> ]; <ide> <ide> /** <ide><path>src/Illuminate/Database/Query/Builder.php <ide> public function exists() <ide> * <ide> * @return bool <ide> */ <del> public function notExists() <add> public function doesntExist() <ide> { <ide> return ! $this->exists(); <ide> } <ide><path>tests/Database/DatabaseEloquentIntegrationTest.php <ide> public function testBasicModelRetrieval() <ide> <ide> $this->assertEquals(2, EloquentTestUser::count()); <ide> <add> $this->assertFalse(EloquentTestUser::where('email', 'taylorotwell@gmail.com')->doesntExist()); <add> $this->assertTrue(EloquentTestUser::where('email', 'mohamed@laravel.com')->doesntExist()); <add> <ide> $model = EloquentTestUser::where('email', 'taylorotwell@gmail.com')->first(); <ide> $this->assertEquals('taylorotwell@gmail.com', $model->email); <ide> $this->assertTrue(isset($model->email)); <ide><path>tests/Database/DatabaseQueryBuilderTest.php <ide> public function testAggregateFunctions() <ide> <ide> $builder = $this->getBuilder(); <ide> $builder->getConnection()->shouldReceive('select')->once()->with('select exists(select * from "users") as "exists"', [], true)->andReturn([['exists' => 0]]); <del> $results = $builder->from('users')->notExists(); <add> $results = $builder->from('users')->doesntExist(); <ide> $this->assertTrue($results); <ide> <ide> $builder = $this->getBuilder();
4
Text
Text
update pairwise in spanish
f96953edff885f2bc5b9825f1eca155cee268495
<ide><path>curriculum/challenges/spanish/08-coding-interview-prep/algorithms/pairwise.spanish.md <ide> localeTitle: Por pares <ide> --- <ide> <ide> ## Description <del><section id="description"> Dada una matriz <code>arr</code> , encuentre pares de elementos cuya suma sea igual al segundo argumento <code>arg</code> y devuelva la suma de sus índices. Puede usar varios pares que tengan los mismos elementos numéricos pero diferentes índices. Cada par debe usar los índices disponibles más bajos posibles. Una vez que se ha utilizado un elemento, no puede reutilizarse para emparejarse con otro elemento. Por ejemplo, por <code>pairwise([1, 1, 2], 3)</code> crea un par <code>[2, 1]</code> usando el 1 en el índice 0 en lugar del 1 en el índice 1, porque 0 + 2 &lt;1 + 2. Por ejemplo, por <code>pairwise([7, 9, 11, 13, 15], 20)</code> devuelve <code>6</code> . Los pares que suman 20 son <code>[7, 13]</code> y <code>[9, 11]</code> . Luego podemos escribir la matriz con sus índices y valores. <table class="table"><tbody><tr><th> <strong>Índice</strong> </th><th> 0 </th><th> 1 </th><th> 2 </th><th> 3 </th><th> 4 </th></tr><tr><td> Valor </td><td> 7 </td><td> 9 </td><td> 11 </td><td> 13 </td><td> 15 </td></tr></tbody></table> A continuación tomaremos sus índices correspondientes y los añadiremos. 7 + 13 = 20 → Índices 0 + 3 = 3 <br> 9 + 11 = 20 → Índices 1 + 2 = 3 <br> 3 + 3 = 6 → Volver <code>6</code> Recuerde usar <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Lectura-Búsqueda-Preguntar</a> si se atasca. Trate de emparejar el programa. Escribe tu propio código. </section> <add><section id="description"> Dada una matriz <code>arr</code> , encuentre pares de elementos cuya suma sea igual al segundo argumento <code>arg</code> y devuelva la suma de sus índices. Puede usar varios pares que tengan los mismos elementos numéricos pero diferentes índices. Cada par debe usar los índices disponibles más bajos posibles. Una vez que se ha utilizado un elemento, no puede reutilizarse para emparejarse con otro elemento. Por ejemplo, por <code>pairwise([1, 1, 2], 3)</code> crea un par <code>[2, 1]</code> usando el 1 en el índice 0 en lugar del 1 en el índice 1, porque 0 + 2 &lt;1 + 2. Por ejemplo, por <code>pairwise([7, 9, 11, 13, 15], 20)</code> devuelve <code>6</code> . Los pares que suman 20 son <code>[7, 13]</code> y <code>[9, 11]</code> . Luego podemos escribir la matriz con sus índices y valores. <table class="table"><tbody><tr><th> <strong>Índice</strong> </th><th> 0 </th><th> 1 </th><th> 2 </th><th> 3 </th><th> 4 </th></tr><tr><td> Valor </td><td> 7 </td><td> 9 </td><td> 11 </td><td> 13 </td><td> 15 </td></tr></tbody></table> A continuación tomaremos sus índices correspondientes y los añadiremos. 7 + 13 = 20 → Índices 0 + 3 = 3 <br> 9 + 11 = 20 → Índices 1 + 2 = 3 <br> 3 + 3 = 6 → Volver <code>6</code> Recuerde usar <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Lectura-Búsqueda-Preguntar</a> si se atasca. Trate de hacer programación en pareja. Escribe tu propio código. </section> <ide> <ide> ## Instructions <ide> <section id="instructions">
1
Go
Go
get tests to compile again
a2812895154da7a32a1b24a0535b5cba4088eb89
<ide><path>integration/service/network_test.go <ide> func TestDockerNetworkReConnect(t *testing.T) { <ide> ctx := context.Background() <ide> <ide> name := t.Name() + "dummyNet" <del> net.CreateNoError(t, ctx, client, name, <add> net.CreateNoError(ctx, t, client, name, <ide> net.WithDriver("overlay"), <ide> net.WithAttachable(), <ide> ) <ide> <del> c1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) { <add> c1 := container.Create(ctx, t, client, func(c *container.TestContainerConfig) { <ide> c.NetworkingConfig = &network.NetworkingConfig{ <ide> EndpointsConfig: map[string]*network.EndpointSettings{ <ide> name: {},
1
Java
Java
use computeifabsent in resourcebundlemessagesource
d60c55c2960ca6c86ce4cfb219e6bba4cf723815
<ide><path>spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java <ide> * <ide> * @author Rod Johnson <ide> * @author Juergen Hoeller <add> * @author Qimiao Chen <ide> * @see #setBasenames <ide> * @see ReloadableResourceBundleMessageSource <ide> * @see java.util.ResourceBundle <ide> protected MessageFormat getMessageFormat(ResourceBundle bundle, String code, Loc <ide> String msg = getStringOrNull(bundle, code); <ide> if (msg != null) { <ide> if (codeMap == null) { <del> codeMap = new ConcurrentHashMap<>(); <del> Map<String, Map<Locale, MessageFormat>> existing = <del> this.cachedBundleMessageFormats.putIfAbsent(bundle, codeMap); <del> if (existing != null) { <del> codeMap = existing; <del> } <add> codeMap = this.cachedBundleMessageFormats.computeIfAbsent(bundle, b -> new ConcurrentHashMap<>()); <ide> } <ide> if (localeMap == null) { <del> localeMap = new ConcurrentHashMap<>(); <del> Map<Locale, MessageFormat> existing = codeMap.putIfAbsent(code, localeMap); <del> if (existing != null) { <del> localeMap = existing; <del> } <add> localeMap = codeMap.computeIfAbsent(code, c -> new ConcurrentHashMap<>()); <ide> } <ide> MessageFormat result = createMessageFormat(msg, locale); <ide> localeMap.put(locale, result);
1
Ruby
Ruby
add a space after the emoji for terminals
14ae87d5c907165dcce7554edaf0c82ec89c2881
<ide><path>Library/Homebrew/test/emoji_spec.rb <ide> ENV.delete("HOMEBREW_INSTALL_BADGE") <ide> end <ide> <del> it "returns 🍺 by default" do <add> it "returns 🍺 by default" do <ide> expect(subject).to eq "🍺" <ide> end <ide>
1