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
|
---|---|---|---|---|---|
Java | Java | fix noopcache handling of get(key,callable) | 15c3cdd48deded4e7f8c21b07b1a88a8d097fcb2 | <ide><path>spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java
<ide> public <T> T get(Object key, Class<T> type) {
<ide>
<ide> @Override
<ide> public <T> T get(Object key, Callable<T> valueLoader) {
<del> return null;
<add> try {
<add> return valueLoader.call();
<add> }
<add> catch (Exception ex) {
<add> throw new ValueRetrievalException(key, valueLoader, ex);
<add> }
<ide> }
<ide>
<ide> @Override
<ide><path>spring-context/src/test/java/org/springframework/cache/NoOpCacheManagerTests.java
<ide>
<ide> import java.util.UUID;
<ide>
<del>import org.junit.Before;
<ide> import org.junit.Test;
<ide>
<ide> import org.springframework.cache.support.NoOpCacheManager;
<ide>
<ide> import static org.junit.Assert.*;
<ide>
<add>/**
<add> * Tests for {@link NoOpCacheManager}.
<add> *
<add> * @author Costin Leau
<add> * @author Stephane Nicoll
<add> */
<ide> public class NoOpCacheManagerTests {
<ide>
<del> private CacheManager manager;
<del>
<del> @Before
<del> public void setup() {
<del> manager = new NoOpCacheManager();
<del> }
<add> private final CacheManager manager = new NoOpCacheManager();
<ide>
<ide> @Test
<ide> public void testGetCache() throws Exception {
<del> Cache cache = manager.getCache("bucket");
<add> Cache cache = this.manager.getCache("bucket");
<ide> assertNotNull(cache);
<del> assertSame(cache, manager.getCache("bucket"));
<add> assertSame(cache, this.manager.getCache("bucket"));
<ide> }
<ide>
<ide> @Test
<ide> public void testNoOpCache() throws Exception {
<del> String name = UUID.randomUUID().toString();
<del> Cache cache = manager.getCache(name);
<add> String name = createRandomKey();
<add> Cache cache = this.manager.getCache(name);
<ide> assertEquals(name, cache.getName());
<ide> Object key = new Object();
<ide> cache.put(key, new Object());
<ide> public void testNoOpCache() throws Exception {
<ide> @Test
<ide> public void testCacheName() throws Exception {
<ide> String name = "bucket";
<del> assertFalse(manager.getCacheNames().contains(name));
<del> manager.getCache(name);
<del> assertTrue(manager.getCacheNames().contains(name));
<add> assertFalse(this.manager.getCacheNames().contains(name));
<add> this.manager.getCache(name);
<add> assertTrue(this.manager.getCacheNames().contains(name));
<add> }
<add>
<add> @Test
<add> public void testCacheCallable() throws Exception {
<add> String name = createRandomKey();
<add> Cache cache = this.manager.getCache(name);
<add> Object returnValue = new Object();
<add> Object value = cache.get(new Object(), () -> returnValue);
<add> assertEquals(returnValue, value);
<ide> }
<add>
<add> @Test
<add> public void testCacheGetCallableFail() {
<add> Cache cache = this.manager.getCache(createRandomKey());
<add> String key = createRandomKey();
<add> try {
<add> cache.get(key, () -> {
<add> throw new UnsupportedOperationException("Expected exception");
<add> });
<add> }
<add> catch (Cache.ValueRetrievalException ex) {
<add> assertNotNull(ex.getCause());
<add> assertEquals(UnsupportedOperationException.class, ex.getCause().getClass());
<add> }
<add> }
<add>
<add> private String createRandomKey() {
<add> return UUID.randomUUID().toString();
<add> }
<add>
<ide> } | 2 |
Python | Python | add dprecation warnings | e4ac566625dcb2858ce15148e38595b49eedfa1b | <ide><path>rest_framework/fields.py
<ide> class Field(object):
<ide> empty = ''
<ide> type_name = None
<ide> partial = False
<del> _use_files = None
<add> use_files = False
<ide> form_field_class = forms.CharField
<ide>
<ide> def __init__(self, source=None):
<ide> def __init__(self, source=None, read_only=False, required=None,
<ide> validators=[], error_messages=None, widget=None,
<ide> default=None, blank=None):
<ide>
<add> # 'blank' is to be deprecated in favor of 'required'
<add> if blank is not None:
<add> warnings.warn('The `blank` keyword argument is due to deprecated. '
<add> 'Use the `required` keyword argument instead.',
<add> PendingDeprecationWarning, stacklevel=2)
<add> required = not(blank)
<add>
<ide> super(WritableField, self).__init__(source=source)
<ide>
<ide> self.read_only = read_only
<ide> def __init__(self, source=None, read_only=False, required=None,
<ide>
<ide> self.validators = self.default_validators + validators
<ide> self.default = default if default is not None else self.default
<del> self.blank = blank
<ide>
<ide> # Widgets are ony used for HTML forms.
<ide> widget = widget or self.widget
<ide> def field_from_native(self, data, files, field_name, into):
<ide> return
<ide>
<ide> try:
<del> if self._use_files:
<add> if self.use_files:
<ide> files = files or {}
<ide> native = files[field_name]
<ide> else:
<ide> def __init__(self, max_length=None, min_length=None, *args, **kwargs):
<ide> if max_length is not None:
<ide> self.validators.append(validators.MaxLengthValidator(max_length))
<ide>
<del> def validate(self, value):
<del> """
<del> Validates that the value is supplied (if required).
<del> """
<del> # if empty string and allow blank
<del> if self.blank and not value:
<del> return
<del> else:
<del> super(CharField, self).validate(value)
<del>
<ide> def from_native(self, value):
<ide> if isinstance(value, basestring) or value is None:
<ide> return value
<ide> def from_native(self, value):
<ide>
<ide>
<ide> class FileField(WritableField):
<del> _use_files = True
<add> use_files = True
<ide> type_name = 'FileField'
<ide> form_field_class = forms.FileField
<ide> widget = widgets.FileInput
<ide> def to_native(self, value):
<ide>
<ide>
<ide> class ImageField(FileField):
<del> _use_files = True
<add> use_files = True
<ide> form_field_class = forms.ImageField
<ide>
<ide> default_error_messages = {
<ide><path>rest_framework/relations.py
<ide> from rest_framework.fields import Field, WritableField
<ide> from rest_framework.reverse import reverse
<ide> from urlparse import urlparse
<add>import warnings
<ide>
<ide> ##### Relational fields #####
<ide>
<ide> class RelatedField(WritableField):
<ide>
<ide> cache_choices = False
<ide> empty_label = None
<del> default_read_only = True # TODO: Remove this
<add> read_only = True
<ide> many = False
<ide>
<ide> def __init__(self, *args, **kwargs):
<ide>
<del> # 'null' will be deprecated in favor of 'required'
<add> # 'null' is to be deprecated in favor of 'required'
<ide> if 'null' in kwargs:
<add> warnings.warn('The `null` keyword argument is due to be deprecated. '
<add> 'Use the `required` keyword argument instead.',
<add> PendingDeprecationWarning, stacklevel=2)
<ide> kwargs['required'] = not kwargs.pop('null')
<ide>
<ide> self.queryset = kwargs.pop('queryset', None)
<ide> self.many = kwargs.pop('many', self.many)
<del> super(RelatedField, self).__init__(*args, **kwargs)
<del> self.read_only = kwargs.pop('read_only', self.default_read_only)
<ide> if self.many:
<ide> self.widget = self.many_widget
<ide> self.form_field_class = self.many_form_field_class
<ide>
<add> kwargs['read_only'] = kwargs.pop('read_only', self.read_only)
<add> super(RelatedField, self).__init__(*args, **kwargs)
<add>
<ide> def initialize(self, parent, field_name):
<ide> super(RelatedField, self).initialize(parent, field_name)
<ide> if self.queryset is None and not self.read_only:
<ide> class PrimaryKeyRelatedField(RelatedField):
<ide> """
<ide> Represents a relationship as a pk value.
<ide> """
<del> default_read_only = False
<add> read_only = False
<ide>
<ide> default_error_messages = {
<ide> 'does_not_exist': _("Invalid pk '%s' - object does not exist."),
<ide> class SlugRelatedField(RelatedField):
<ide> """
<ide> Represents a relationship using a unique field on the target.
<ide> """
<del> default_read_only = False
<add> read_only = False
<ide>
<ide> default_error_messages = {
<ide> 'does_not_exist': _("Object with %s=%s does not exist."),
<ide> class HyperlinkedRelatedField(RelatedField):
<ide> pk_url_kwarg = 'pk'
<ide> slug_field = 'slug'
<ide> slug_url_kwarg = None # Defaults to same as `slug_field` unless overridden
<del> default_read_only = False
<add> read_only = False
<ide>
<ide> default_error_messages = {
<ide> 'no_match': _('Invalid hyperlink - No URL match'),
<ide> class HyperlinkedIdentityField(Field):
<ide> pk_url_kwarg = 'pk'
<ide> slug_field = 'slug'
<ide> slug_url_kwarg = None # Defaults to same as `slug_field` unless overridden
<add> read_only = True
<ide>
<ide> def __init__(self, *args, **kwargs):
<ide> # TODO: Make view_name mandatory, and have the
<ide> def field_to_native(self, obj, field_name):
<ide>
<ide> class ManyRelatedField(RelatedField):
<ide> def __init__(self, *args, **kwargs):
<add> warnings.warn('`ManyRelatedField()` is due to be deprecated. '
<add> 'Use `RelatedField(many=True)` instead.',
<add> PendingDeprecationWarning, stacklevel=2)
<ide> kwargs['many'] = True
<ide> super(ManyRelatedField, self).__init__(*args, **kwargs)
<ide>
<ide>
<ide> class ManyPrimaryKeyRelatedField(PrimaryKeyRelatedField):
<ide> def __init__(self, *args, **kwargs):
<add> warnings.warn('`ManyPrimaryKeyRelatedField()` is due to be deprecated. '
<add> 'Use `PrimaryKeyRelatedField(many=True)` instead.',
<add> PendingDeprecationWarning, stacklevel=2)
<ide> kwargs['many'] = True
<ide> super(ManyPrimaryKeyRelatedField, self).__init__(*args, **kwargs)
<ide>
<ide>
<ide> class ManySlugRelatedField(SlugRelatedField):
<ide> def __init__(self, *args, **kwargs):
<add> warnings.warn('`ManySlugRelatedField()` is due to be deprecated. '
<add> 'Use `SlugRelatedField(many=True)` instead.',
<add> PendingDeprecationWarning, stacklevel=2)
<ide> kwargs['many'] = True
<ide> super(ManySlugRelatedField, self).__init__(*args, **kwargs)
<ide>
<ide>
<ide> class ManyHyperlinkedRelatedField(HyperlinkedRelatedField):
<ide> def __init__(self, *args, **kwargs):
<add> warnings.warn('`ManyHyperlinkedRelatedField()` is due to be deprecated. '
<add> 'Use `HyperlinkedRelatedField(many=True)` instead.',
<add> PendingDeprecationWarning, stacklevel=2)
<ide> kwargs['many'] = True
<ide> super(ManyHyperlinkedRelatedField, self).__init__(*args, **kwargs) | 2 |
Python | Python | make test self-sufficient | 1b2e6d61c9a5325d75145a194ff8f3981bf8fe39 | <ide><path>celery/tests/worker/test_autoscale.py
<ide> def body(self):
<ide> sys.stderr = p
<ide> _exit.assert_called_with(1)
<ide> self.assertTrue(stderr.write.call_count)
<add>
<add> def test_no_negative_scale(self):
<add> total_num_processes = []
<add> worker = Mock(name='worker')
<add> x = autoscale.Autoscaler(self.pool, 10, 3, worker=worker)
<add> x.body() #the body func scales up or down
<add>
<add> for i in range(35):
<add> state.reserved_requests.add(i)
<add> x.body()
<add> total_num_processes.append(self.pool.num_processes)
<add>
<add> for i in range(35):
<add> state.reserved_requests.remove(i)
<add> x.body()
<add> total_num_processes.append(self.pool.num_processes)
<add>
<add> self. assertTrue(all(i <= x.min_concurrency for i in total_num_processes)
<add> )
<add> self. assertTrue(all(i <= x.max_concurrency for i in total_num_processes)
<add> )
<ide>\ No newline at end of file | 1 |
Ruby | Ruby | add constants for repository names | bf60e2da3ddc49de569fd01726e0ad8a5f794fdb | <ide><path>Library/Homebrew/dev-cmd/bump.rb
<ide> def bump
<ide> next
<ide> end
<ide>
<del> "homebrew"
<add> Repology::HOMEBREW_CORE
<ide> else
<del> "homebrew_casks"
<add> Repology::HOMEBREW_CASK
<ide> end
<ide>
<ide> package_data = Repology.single_package_query(name, repository: repository)
<ide> retrieve_and_display_info(formula_or_cask, name, package_data&.values&.first, args: args)
<ide> end
<ide> else
<ide> api_response = {}
<del> api_response[:formulae] = Repology.parse_api_response(limit, repository: "homebrew") unless args.cask?
<del> api_response[:casks] = Repology.parse_api_response(limit, repository: "homebrew_casks") unless args.formula?
<add> unless args.cask?
<add> api_response[:formulae] =
<add> Repology.parse_api_response(limit, repository: Repology::HOMEBREW_CORE)
<add> end
<add> unless args.formula?
<add> api_response[:casks] =
<add> Repology.parse_api_response(limit, repository: Repology::HOMEBREW_CASK)
<add> end
<ide>
<ide> api_response.each do |package_type, outdated_packages|
<ide> repository = if package_type == :formulae
<del> "homebrew"
<add> Repology::HOMEBREW_CORE
<ide> else
<del> "homebrew_casks"
<add> Repology::HOMEBREW_CASK
<ide> end
<ide>
<ide> outdated_packages.each_with_index do |(_name, repositories), i|
<ide> def bump
<ide> next if homebrew_repo.blank?
<ide>
<ide> formula_or_cask = begin
<del> if repository == "homebrew"
<add> if repository == Repology::HOMEBREW_CORE
<ide> Formula[homebrew_repo["srcname"]]
<ide> else
<ide> Cask::CaskLoader.load(homebrew_repo["srcname"])
<ide><path>Library/Homebrew/utils/repology.rb
<ide> #
<ide> # @api private
<ide> module Repology
<add> HOMEBREW_CORE = "homebrew"
<add> HOMEBREW_CASK = "homebrew_casks"
<add>
<ide> module_function
<ide>
<ide> MAX_PAGINATION = 15
<ide> def single_package_query(name, repository:)
<ide>
<ide> def parse_api_response(limit = nil, repository:)
<ide> package_term = case repository
<del> when "homebrew"
<add> when HOMEBREW_CORE
<ide> "formula"
<del> when "homebrew_casks"
<add> when HOMEBREW_CASK
<ide> "cask"
<ide> else
<ide> "package" | 2 |
Text | Text | fix crypto "decipher.setaad()" typo | 7eb2e3ff666afdc02b747e3723354855f8ddb1d0 | <ide><path>doc/api/crypto.md
<ide> added: v1.0.0
<ide> -->
<ide>
<ide> When using an authenticated encryption mode (only `GCM` is currently
<del>supported), the `cipher.setAAD()` method sets the value used for the
<add>supported), the `decipher.setAAD()` method sets the value used for the
<ide> _additional authenticated data_ (AAD) input parameter.
<ide>
<ide> Returns `this` for method chaining. | 1 |
PHP | PHP | update cacheschedulingmutex.php | 38284c86642a7fe3c4e2db7622e116df9b0bb729 | <ide><path>src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php
<ide> class CacheSchedulingMutex implements SchedulingMutex
<ide> public $store;
<ide>
<ide> /**
<del> * Create a new overlapping strategy.
<add> * Create a new scheduling strategy.
<ide> *
<ide> * @param \Illuminate\Contracts\Cache\Factory $cache
<ide> * @return void | 1 |
Text | Text | remove recommendation to use node-eps | 9b34dfed76594992c8cdb8b293a927c87bcb1bd6 | <ide><path>COLLABORATOR_GUIDE.md
<ide> Pull requests introducing new core modules:
<ide> New core modules must be landed with a [Stability Index][] of Experimental,
<ide> and must remain Experimental until a semver-major release.
<ide>
<del>For new modules that involve significant effort, non-trivial additions to
<del>Node.js or significant new capabilities, an [Enhancement Proposal][] is
<del>recommended but not required.
<del>
<ide> ### Additions to N-API
<ide>
<ide> N-API provides an ABI stable API that we will have to support in future
<ide> When things need extra attention, are controversial, or `semver-major`:
<ide> If you cannot find who to cc for a file, `git shortlog -n -s <file>` may help.
<ide>
<ide> ["Merge Pull Request"]: https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-on-github
<del>[Enhancement Proposal]: https://github.com/nodejs/node-eps
<ide> [Stability Index]: doc/api/documentation.md#stability-index
<ide> [TSC]: https://github.com/nodejs/TSC
<ide> [_Deprecation_]: https://en.wikipedia.org/wiki/Deprecation | 1 |
Java | Java | correct import order | c515de138aa659ba9697383a07a9bc1bf5be4d81 | <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/CompoundExpression.java
<ide>
<ide> package org.springframework.expression.spel.ast;
<ide>
<add>import java.util.StringJoiner;
<add>
<ide> import org.springframework.asm.MethodVisitor;
<ide> import org.springframework.expression.EvaluationException;
<ide> import org.springframework.expression.TypedValue;
<ide> import org.springframework.expression.spel.SpelEvaluationException;
<ide> import org.springframework.lang.Nullable;
<ide>
<del>import java.util.StringJoiner;
<del>
<ide> /**
<ide> * Represents a DOT separated expression sequence, such as
<ide> * {@code 'property1.property2.methodOne()'}. | 1 |
Javascript | Javascript | remove unused parser helper | 5a5c4b1b1e49d40846aaf09347e87f1370db06e1 | <ide><path>lib/JavascriptParserHelpers.js
<ide> exports.addParsedVariableToModule = (parser, name, expression) => {
<ide> return true;
<ide> };
<ide>
<del>exports.requireFileAsExpression = (context, pathToModule) => {
<del> const moduleJsPath = exports.getModulePath(context, pathToModule);
<del> return `require(${JSON.stringify(moduleJsPath)})`;
<del>};
<del>
<ide> exports.getModulePath = (context, pathToModule) => {
<ide> let moduleJsPath = path.relative(context, pathToModule);
<ide> if (!/^[A-Z]:/i.test(moduleJsPath)) { | 1 |
Python | Python | add x86_64 arch flag if gfortran supports it | b1873ad41a86e21ab51e7f08208241f0e2d1b397 | <ide><path>numpy/distutils/fcompiler/gnu.py
<ide> def _universal_flags(self, cmd):
<ide> if not sys.platform == 'darwin':
<ide> return []
<ide> arch_flags = []
<del> for arch in ["ppc", "i686"]:
<add> for arch in ["ppc", "i686", "x86_64"]:
<ide> if _can_target(cmd, arch):
<ide> arch_flags.extend(["-arch", arch])
<ide> return arch_flags | 1 |
PHP | PHP | improve schemaloader tests | 4b5428e582e8899cca654eb75e8da26b07c521ba | <ide><path>tests/TestCase/TestSuite/Fixture/SchemaLoaderTest.php
<ide>
<ide> use Cake\Console\ConsoleIo;
<ide> use Cake\Database\Connection;
<del>use Cake\Database\DriverInterface;
<del>use Cake\Database\Schema\Collection;
<del>use Cake\Database\Schema\SchemaDialect;
<add>use Cake\Database\Driver\Sqlite;
<ide> use Cake\Database\Schema\TableSchema;
<ide> use Cake\Datasource\ConnectionManager;
<ide> use Cake\TestSuite\Fixture\SchemaCleaner;
<ide> class SchemaLoaderTest extends TestCase
<ide> */
<ide> protected $loader;
<ide>
<add> protected $truncateDbFile = TMP . 'schema_loader_test.sqlite';
<add>
<ide> public function setUp(): void
<ide> {
<ide> parent::setUp();
<ide> public function tearDown(): void
<ide>
<ide> (new SchemaCleaner())->dropTables('test', ['schema_loader_test_one', 'schema_loader_test_two']);
<ide> ConnectionManager::drop('schema_test');
<add>
<add> if (file_exists($this->truncateDbFile)) {
<add> unlink($this->truncateDbFile);
<add> }
<ide> }
<ide>
<ide> /**
<ide> public function testLoadMissingFile(): void
<ide> */
<ide> public function testDropTruncateTables(): void
<ide> {
<del> $connection = $this->createMock(Connection::class);
<del>
<del> $tableSchema = $this->createMock(TableSchema::class);
<del> $schemaDialect = $this->createMock(SchemaDialect::class);
<del> $schemaDialect
<del> ->expects($this->atLeastOnce())->method('dropConstraintSql')->with($tableSchema)->willReturn(['']);
<del> $schemaDialect
<del> ->expects($this->atLeastOnce())->method('dropTableSql')->with($tableSchema)->willReturn(['']);
<del> $schemaDialect
<del> ->expects($this->atLeastOnce())->method('truncateTableSql')->with($tableSchema)->willReturn(['']);
<del> $driver = $this->createMock(DriverInterface::class);
<del> $driver
<del> ->expects($this->atLeastOnce())->method('schemaDialect')->willReturn($schemaDialect);
<del> $connection
<del> ->expects($this->atLeastOnce())->method('getDriver')->willReturn($driver);
<del>
<del> $schemaCollection = $this->createMock(Collection::class);
<del> $schemaCollection
<del> ->expects($this->atLeastOnce())->method('listTables')->willReturn(['schema_test']);
<del> $schemaCollection
<del> ->expects($this->atLeastOnce())->method('describe')->willReturn($tableSchema);
<del> $connection
<del> ->expects($this->atLeastOnce())->method('getSchemaCollection')->willReturn($schemaCollection);
<del>
<del> ConnectionManager::setConfig('schema_test', $connection);
<del> $this->loader->loadFiles([], 'schema_test', true, true);
<add> $this->skipIf(!extension_loaded('pdo_sqlite'), 'Skipping as SQLite extension is missing');
<add> ConnectionManager::setConfig('test_schema_loader', [
<add> 'className' => Connection::class,
<add> 'driver' => Sqlite::class,
<add> 'database' => $this->truncateDbFile,
<add> ]);
<add>
<add> $schemaFile = $this->createSchemaFile('schema_loader_first');
<add> $this->loader->loadFiles($schemaFile, 'test_schema_loader');
<add> $connection = ConnectionManager::get('test_schema_loader');
<add>
<add> $result = $connection->getSchemaCollection()->listTables();
<add> $this->assertEquals(['schema_loader_first'], $result);
<add>
<add> $schemaFile = $this->createSchemaFile('schema_loader_second');
<add> $this->loader->loadFiles($schemaFile, 'test_schema_loader');
<add>
<add> $result = $connection->getSchemaCollection()->listTables();
<add> $this->assertEquals(['schema_loader_second'], $result);
<add>
<add> $statement = $connection->query('SELECT * FROM schema_loader_second');
<add> $result = $statement->fetchAll();
<add> $this->assertCount(0, $result, 'Table should be empty.');
<ide> }
<ide>
<ide> protected function createSchemaFile(string $tableName): string
<ide> protected function createSchemaFile(string $tableName): string
<ide> ->addColumn('id', 'integer')
<ide> ->addColumn('name', 'string');
<ide>
<del> $query = $schema->createSql($connection)[0];
<add> $query = $schema->createSql($connection)[0] . ';';
<add> $query .= "\nINSERT INTO {$tableName} (id, name) VALUES (1, 'testing');";
<ide> $tmpFile = tempnam(sys_get_temp_dir(), 'SchemaLoaderTest');
<ide> file_put_contents($tmpFile, $query);
<ide> | 1 |
PHP | PHP | apply fixes from styleci | c3cb531df1717c92bd1d70d30f2c018e56fd6b57 | <ide><path>src/Illuminate/Notifications/NotificationSender.php
<ide> public function sendNow($notifiables, $notification, array $channels = null)
<ide> if (empty($viaChannels = $channels ?: $notification->via($notifiable))) {
<ide> continue;
<ide> }
<del>
<add>
<ide> $notificationId = Uuid::uuid4()->toString();
<ide>
<ide> foreach ($viaChannels as $channel) { | 1 |
PHP | PHP | fix bug in bundle assets method | 2bbb9e55e9928f7fabe4c1881216b27b89691543 | <ide><path>laravel/bundle.php
<ide> public static function path($bundle)
<ide> */
<ide> public static function assets($bundle)
<ide> {
<del> return ($bundle != DEFAULT_BUNDLE) ? PUBLIC_PATH."bundles/{$bundle}/" : PUBLIC_PATH;
<add> return ($bundle != DEFAULT_BUNDLE) ? URL::base()."/bundles/{$bundle}/" : PUBLIC_PATH;
<ide> }
<ide>
<ide> /** | 1 |
PHP | PHP | add templates option to numbers() | 68883619067ad3f4538a21af37d4840a9145dc34 | <ide><path>src/View/Helper/PaginatorHelper.php
<ide> public function numbers(array $options = array()) {
<ide> $options += $defaults;
<ide>
<ide> $params = (array)$this->params($options['model']) + array('page' => 1);
<del>
<ide> if ($params['pageCount'] <= 1) {
<ide> return false;
<ide> }
<ide>
<add> $templater = $this->templater();
<add> if (isset($options['templates'])) {
<add> $templater->push();
<add> $method = is_string($options['templates']) ? 'load' : 'add';
<add> $templater->{$method}($options['templates']);
<add> }
<add>
<ide> $out = '';
<del> $ellipsis = $this->templater()->format('ellipsis', []);
<add> $ellipsis = $templater->format('ellipsis', []);
<ide>
<ide> if ($options['modulus'] && $params['pageCount'] > $options['modulus']) {
<ide> $half = intval($options['modulus'] / 2);
<ide> public function numbers(array $options = array()) {
<ide> 'text' => $i,
<ide> 'url' => $this->generateUrl(['page' => $i], $options['model']),
<ide> ];
<del> $out .= $this->templater()->format('number', $vars);
<add> $out .= $templater->format('number', $vars);
<ide> }
<ide>
<del> $out .= $this->templater()->format('current', [
<add> $out .= $templater->format('current', [
<ide> 'text' => $params['page'],
<ide> 'url' => $this->generateUrl(['page' => $params['page']], $options['model']),
<ide> ]);
<ide> public function numbers(array $options = array()) {
<ide> 'text' => $i,
<ide> 'url' => $this->generateUrl(['page' => $i], $options['model']),
<ide> ];
<del> $out .= $this->templater()->format('number', $vars);
<add> $out .= $templater->format('number', $vars);
<ide> }
<ide>
<ide> if ($end != $params['page']) {
<ide> $vars = [
<ide> 'text' => $i,
<ide> 'url' => $this->generateUrl(['page' => $end], $options['model']),
<ide> ];
<del> $out .= $this->templater()->format('number', $vars);
<add> $out .= $templater->format('number', $vars);
<ide> }
<ide>
<ide> $out .= $options['after'];
<ide> public function numbers(array $options = array()) {
<ide>
<ide> for ($i = 1; $i <= $params['pageCount']; $i++) {
<ide> if ($i == $params['page']) {
<del> $out .= $this->templater()->format('current', [
<add> $out .= $templater->format('current', [
<ide> 'text' => $params['page'],
<ide> 'url' => $this->generateUrl(['page' => $params['page']], $options['model']),
<ide> ]);
<ide> public function numbers(array $options = array()) {
<ide> 'text' => $i,
<ide> 'url' => $this->generateUrl(['page' => $i], $options['model']),
<ide> ];
<del> $out .= $this->templater()->format('number', $vars);
<add> $out .= $templater->format('number', $vars);
<ide> }
<ide> }
<ide>
<ide> $out .= $options['after'];
<ide> }
<add> if (isset($options['templates'])) {
<add> $templater->pop();
<add> }
<ide>
<ide> return $out;
<ide> }
<ide><path>tests/TestCase/View/Helper/PaginatorHelperTest.php
<ide> public function testNumbers() {
<ide> $this->assertTags($result, $expected);
<ide> }
<ide>
<add>/**
<add> * Test that numbers() lets you overwrite templates.
<add> *
<add> * The templates file has no li elements.
<add> *
<add> * @return void
<add> */
<add> public function testNumbersTemplates() {
<add> $this->Paginator->request->params['paging'] = [
<add> 'Client' => [
<add> 'page' => 8,
<add> 'current' => 3,
<add> 'count' => 30,
<add> 'prevPage' => false,
<add> 'nextPage' => 2,
<add> 'pageCount' => 15,
<add> ]
<add> ];
<add> $result = $this->Paginator->numbers(['templates' => 'htmlhelper_tags']);
<add> $expected = [
<add> ['a' => ['href' => '/index?page=4']], '4', '/a',
<add> ['a' => ['href' => '/index?page=5']], '5', '/a',
<add> ['a' => ['href' => '/index?page=6']], '6', '/a',
<add> ['a' => ['href' => '/index?page=7']], '7', '/a',
<add> 'span' => ['class' => 'active'], '8', '/span',
<add> ['a' => ['href' => '/index?page=9']], '9', '/a',
<add> ['a' => ['href' => '/index?page=10']], '10', '/a',
<add> ['a' => ['href' => '/index?page=11']], '11', '/a',
<add> ['a' => ['href' => '/index?page=12']], '12', '/a',
<add> ];
<add> $this->assertTags($result, $expected);
<add>
<add> $this->assertContains(
<add> '<li',
<add> $this->Paginator->templater()->get('current'),
<add> 'Templates were not restored.'
<add> );
<add> }
<add>
<ide> /**
<ide> * Test modulus option for numbers()
<ide> *
<ide><path>tests/test_app/config/htmlhelper_tags.php
<ide> 'formstart' => 'start form',
<ide> 'formend' => 'finish form',
<ide> 'hiddenblock' => '<div class="hidden">{{content}}</div>',
<del> 'inputContainer' => '{{content}}'
<add> 'inputContainer' => '{{content}}',
<add> 'number' => '<a href="{{url}}">{{text}}</a>',
<add> 'current' => '<span class="active">{{text}}</span>',
<ide> ]; | 3 |
Javascript | Javascript | clarify jsdoc entries | 43371dd5d2b7c3586e5f41bc30c9cd21bb000d5f | <ide><path>lib/internal/event_target.js
<ide> class EventTarget {
<ide> /**
<ide> * @callback EventTargetCallback
<ide> * @param {Event} event
<add> */
<add>
<add> /**
<ide> * @typedef {{ handleEvent: EventTargetCallback }} EventListener
<add> */
<add>
<add> /**
<ide> * @param {string} type
<ide> * @param {EventTargetCallback|EventListener} listener
<ide> * @param {{ | 1 |
Javascript | Javascript | fix currentsrc when flash returns null | c8bd862e3e2c9f1462d1f3fbb7722cd0d56ec9e5 | <ide><path>src/js/media/flash.js
<ide> vjs.Flash.prototype.currentSrc = function(){
<ide> var src = this.el_.vjs_getProperty('currentSrc');
<ide> // no src, check and see if RTMP
<ide> if (src == null) {
<del> var connection = this.rtmpConnection(),
<del> stream = this.rtmpStream();
<add> var connection = this['rtmpConnection'](),
<add> stream = this['rtmpStream']();
<ide>
<ide> if (connection && stream) {
<ide> src = vjs.Flash.streamFromParts(connection, stream); | 1 |
Javascript | Javascript | fix args order in process-getactiverequests | 981701b8090769df4b5a17f339d3879caecdc7de | <ide><path>test/parallel/test-process-getactiverequests.js
<ide> const fs = require('fs');
<ide> for (let i = 0; i < 12; i++)
<ide> fs.open(__filename, 'r', () => {});
<ide>
<del>assert.strictEqual(12, process._getActiveRequests().length);
<add>assert.strictEqual(process._getActiveRequests().length, 12); | 1 |
Python | Python | add quarter 0 to scramble orders | 44f05013291aac8c9a50097759ebf4c5d948c2d0 | <ide><path>research/astronet/light_curve_util/kepler_io.py
<ide> # Quarter order for different scrambling procedures.
<ide> # Page 9: https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20170009549.pdf.
<ide> SIMULATED_DATA_SCRAMBLE_ORDERS = {
<del> "SCR1": [13, 14, 15, 16, 9, 10, 11, 12, 5, 6, 7, 8, 1, 2, 3, 4, 17],
<del> "SCR2": [1, 2, 3, 4, 13, 14, 15, 16, 9, 10, 11, 12, 5, 6, 7, 8, 17],
<del> "SCR3": [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 17],
<add> "SCR1": [0, 13, 14, 15, 16, 9, 10, 11, 12, 5, 6, 7, 8, 1, 2, 3, 4, 17],
<add> "SCR2": [0, 1, 2, 3, 4, 13, 14, 15, 16, 9, 10, 11, 12, 5, 6, 7, 8, 17],
<add> "SCR3": [0, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 17],
<ide> }
<ide>
<ide> | 1 |
Javascript | Javascript | convert the `domcmapreaderfactory` to an es6 class | 32baa6af7a00b20172200ed0fd0757d3a0cc40ae | <ide><path>src/display/dom_utils.js
<ide> DOMCanvasFactory.prototype = {
<ide> }
<ide> };
<ide>
<del>var DOMCMapReaderFactory = (function DOMCMapReaderFactoryClosure() {
<del> function DOMCMapReaderFactory(params) {
<del> this.baseUrl = params.baseUrl || null;
<del> this.isCompressed = params.isCompressed || false;
<add>class DOMCMapReaderFactory {
<add> constructor({ baseUrl = null, isCompressed = false, }) {
<add> this.baseUrl = baseUrl;
<add> this.isCompressed = isCompressed;
<ide> }
<ide>
<del> DOMCMapReaderFactory.prototype = {
<del> fetch(params) {
<del> var name = params.name;
<del> if (!name) {
<del> return Promise.reject(new Error('CMap name must be specified.'));
<del> }
<del> return new Promise((resolve, reject) => {
<del> var url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
<add> fetch({ name, }) {
<add> if (!name) {
<add> return Promise.reject(new Error('CMap name must be specified.'));
<add> }
<add> return new Promise((resolve, reject) => {
<add> let url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
<ide>
<del> var request = new XMLHttpRequest();
<del> request.open('GET', url, true);
<add> let request = new XMLHttpRequest();
<add> request.open('GET', url, true);
<ide>
<del> if (this.isCompressed) {
<del> request.responseType = 'arraybuffer';
<add> if (this.isCompressed) {
<add> request.responseType = 'arraybuffer';
<add> }
<add> request.onreadystatechange = () => {
<add> if (request.readyState !== XMLHttpRequest.DONE) {
<add> return;
<ide> }
<del> request.onreadystatechange = () => {
<del> if (request.readyState !== XMLHttpRequest.DONE) {
<del> return;
<add> if (request.status === 200 || request.status === 0) {
<add> let data;
<add> if (this.isCompressed && request.response) {
<add> data = new Uint8Array(request.response);
<add> } else if (!this.isCompressed && request.responseText) {
<add> data = stringToBytes(request.responseText);
<ide> }
<del> if (request.status === 200 || request.status === 0) {
<del> var data;
<del> if (this.isCompressed && request.response) {
<del> data = new Uint8Array(request.response);
<del> } else if (!this.isCompressed && request.responseText) {
<del> data = stringToBytes(request.responseText);
<del> }
<del> if (data) {
<del> resolve({
<del> cMapData: data,
<del> compressionType: this.isCompressed ?
<del> CMapCompressionType.BINARY : CMapCompressionType.NONE,
<del> });
<del> return;
<del> }
<add> if (data) {
<add> resolve({
<add> cMapData: data,
<add> compressionType: this.isCompressed ?
<add> CMapCompressionType.BINARY : CMapCompressionType.NONE,
<add> });
<add> return;
<ide> }
<del> reject(new Error('Unable to load ' +
<del> (this.isCompressed ? 'binary ' : '') +
<del> 'CMap at: ' + url));
<del> };
<del>
<del> request.send(null);
<del> });
<del> },
<del> };
<add> }
<add> reject(new Error('Unable to load ' +
<add> (this.isCompressed ? 'binary ' : '') +
<add> 'CMap at: ' + url));
<add> };
<ide>
<del> return DOMCMapReaderFactory;
<del>})();
<add> request.send(null);
<add> });
<add> }
<add>}
<ide>
<ide> /**
<ide> * Optimised CSS custom property getter/setter.
<ide><path>test/unit/test_utils.js
<ide> import { CMapCompressionType } from '../../src/shared/util';
<ide>
<ide> class NodeCMapReaderFactory {
<del> constructor(params) {
<del> this.baseUrl = params.baseUrl || null;
<del> this.isCompressed = params.isCompressed || false;
<add> constructor({ baseUrl = null, isCompressed = false, }) {
<add> this.baseUrl = baseUrl;
<add> this.isCompressed = isCompressed;
<ide> }
<ide>
<del> fetch(params) {
<del> var name = params.name;
<add> fetch({ name, }) {
<ide> if (!name) {
<ide> return Promise.reject(new Error('CMap name must be specified.'));
<ide> }
<ide> return new Promise((resolve, reject) => {
<del> var url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
<add> let url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
<ide>
<del> var fs = require('fs');
<add> let fs = require('fs');
<ide> fs.readFile(url, (error, data) => {
<ide> if (error || !data) {
<ide> reject(new Error('Unable to load ' + | 2 |
Javascript | Javascript | keep trackballcontrols from consuming all events | 348c706a4679e52eaf1a0646e18636abfa9509e6 | <ide><path>examples/js/controls/TrackballControls.js
<ide> THREE.TrackballControls = function ( object, domElement ) {
<ide>
<ide> if ( _this.enabled === false ) return;
<ide>
<del> window.removeEventListener( 'keydown', keydown );
<del>
<ide> _prevState = _state;
<ide>
<ide> if ( _state !== STATE.NONE ) {
<ide> THREE.TrackballControls = function ( object, domElement ) {
<ide>
<ide> _state = _prevState;
<ide>
<del> window.addEventListener( 'keydown', keydown, false );
<del>
<ide> }
<ide>
<ide> function mousedown( event ) {
<ide>
<ide> if ( _this.enabled === false ) return;
<ide>
<del> event.preventDefault();
<del> event.stopPropagation();
<del>
<ide> if ( _state === STATE.NONE ) {
<ide>
<ide> _state = event.button;
<ide> THREE.TrackballControls = function ( object, domElement ) {
<ide>
<ide> if ( _this.enabled === false ) return;
<ide>
<del> event.preventDefault();
<del> event.stopPropagation();
<del>
<ide> if ( _state === STATE.ROTATE && ! _this.noRotate ) {
<ide>
<ide> _movePrev.copy( _moveCurr );
<ide> THREE.TrackballControls = function ( object, domElement ) {
<ide>
<ide> if ( _this.enabled === false ) return;
<ide>
<del> event.preventDefault();
<del> event.stopPropagation();
<del>
<ide> _state = STATE.NONE;
<ide>
<ide> document.removeEventListener( 'mousemove', mousemove );
<ide> THREE.TrackballControls = function ( object, domElement ) {
<ide>
<ide> if ( _this.enabled === false ) return;
<ide>
<del> event.preventDefault();
<del> event.stopPropagation();
<del>
<ide> var delta = 0;
<ide>
<ide> if ( event.wheelDelta ) {
<ide> THREE.TrackballControls = function ( object, domElement ) {
<ide>
<ide> if ( _this.enabled === false ) return;
<ide>
<del> event.preventDefault();
<del> event.stopPropagation();
<del>
<ide> switch ( event.touches.length ) {
<ide>
<ide> case 1: | 1 |
PHP | PHP | prevent a fatal error if router->current is empty | a77c6f40a2e2aa2b5eee9d4df64b4c8625012f0e | <ide><path>src/Illuminate/Routing/Router.php
<ide> public function currentRouteNamed($name)
<ide> */
<ide> public function currentRouteAction()
<ide> {
<add> if (!$this->current()) return null;
<add>
<ide> $action = $this->current()->getAction();
<ide>
<ide> return isset($action['controller']) ? $action['controller'] : null; | 1 |
Python | Python | ignore auth_user_model errors in from_state | 5182efce8d73ec552a1d7f3e86a24369bb261044 | <ide><path>django/db/migrations/autodetector.py
<ide> def _detect_changes(self):
<ide> """
<ide> # We'll store migrations as lists by app names for now
<ide> self.migrations = {}
<del> old_apps = self.from_state.render()
<add> old_apps = self.from_state.render(ignore_swappable=True)
<ide> new_apps = self.to_state.render()
<ide> # Prepare lists of old/new model keys that we care about
<ide> # (i.e. ignoring proxy ones and unmigrated ones)
<ide><path>django/db/migrations/state.py
<ide> def clone(self):
<ide> real_apps=self.real_apps,
<ide> )
<ide>
<del> def render(self, include_real=None):
<add> def render(self, include_real=None, ignore_swappable=False):
<ide> "Turns the project state into actual models in a new Apps"
<ide> if self.apps is None:
<ide> # Any apps in self.real_apps should have all their models included
<ide> def render(self, include_real=None):
<ide> try:
<ide> model = self.apps.get_model(lookup_model[0], lookup_model[1])
<ide> except LookupError:
<del> # If the lookup failed to something that looks like AUTH_USER_MODEL,
<del> # give a better error message about how you can't change it (#22563)
<del> extra_message = ""
<del> if "%s.%s" % (lookup_model[0], lookup_model[1]) == settings.AUTH_USER_MODEL:
<del> extra_message = (
<del> "\nThe missing model matches AUTH_USER_MODEL; if you've changed the value of this" +
<del> "\nsetting after making a migration, be aware that this is not supported. If you" +
<del> "\nchange AUTH_USER_MODEL you must delete and recreate migrations for its app."
<del> )
<add> if "%s.%s" % (lookup_model[0], lookup_model[1]) == settings.AUTH_USER_MODEL and ignore_swappable:
<add> continue
<ide> # Raise an error with a best-effort helpful message
<ide> # (only for the first issue). Error message should look like:
<ide> # "ValueError: Lookup failed for model referenced by
<ide> # field migrations.Book.author: migrations.Author"
<del> raise ValueError("Lookup failed for model referenced by field {field}: {model[0]}.{model[1]}{extra_message}".format(
<add> raise ValueError("Lookup failed for model referenced by field {field}: {model[0]}.{model[1]}".format(
<ide> field=operations[0][1],
<ide> model=lookup_model,
<del> extra_message=extra_message,
<ide> ))
<ide> else:
<ide> do_pending_lookups(model) | 2 |
Javascript | Javascript | fix failing test in older ie | 4a48656fbf11b985ae8943ce75c631413cb23485 | <ide><path>packages/ember-runtime/tests/system/object/destroy_test.js
<ide> test("destroyed objects should not see each others changes during teardown but a
<ide> var longLivedObject = new LongLivedObject();
<ide>
<ide> Ember.run(function () {
<del> for (var key in objs) {
<del> if (!objs.hasOwnProperty(key)) continue;
<del> objs[key].destroy();
<add> var keys = Ember.keys(objs);
<add> for (var i = 0, l = keys.length; i < l; i++) {
<add> objs[keys[i]].destroy();
<ide> }
<ide> });
<ide> | 1 |
Javascript | Javascript | introduce defaultmodulename in module.js | ea01d305f65147325866f68a93d511d076a82016 | <ide><path>lib/internal/vm/module.js
<ide> const linkingStatusMap = new WeakMap();
<ide> const initImportMetaMap = new WeakMap();
<ide> // ModuleWrap -> vm.Module
<ide> const wrapToModuleMap = new WeakMap();
<add>const defaultModuleName = 'vm:module';
<ide>
<ide> class Module {
<ide> constructor(src, options = {}) {
<ide> class Module {
<ide> }
<ide> url = new URL(url).href;
<ide> } else if (context === undefined) {
<del> url = `vm:module(${globalModuleId++})`;
<add> url = `${defaultModuleName}(${globalModuleId++})`;
<ide> } else if (perContextModuleId.has(context)) {
<ide> const curId = perContextModuleId.get(context);
<del> url = `vm:module(${curId})`;
<add> url = `${defaultModuleName}(${curId})`;
<ide> perContextModuleId.set(context, curId + 1);
<ide> } else {
<del> url = 'vm:module(0)';
<add> url = `${defaultModuleName}(0)`;
<ide> perContextModuleId.set(context, 1);
<ide> }
<ide> | 1 |
Javascript | Javascript | add type comment | bfc04315efdc38e94b74b9a17fbd7d755d41ae72 | <ide><path>lib/FlagDependencyExportsPlugin.js
<ide> class FlagDependencyExportsPlugin {
<ide> }
<ide> );
<ide>
<add> /** @type {WeakMap<Module, true | string[] | null>} */
<ide> const providedExportsCache = new WeakMap();
<ide> compilation.hooks.rebuildModule.tap(
<ide> "FlagDependencyExportsPlugin", | 1 |
Python | Python | add tests for memory overlap in ufunc reductions | dae0b12d6a790543bee4002f434a1633f8923188 | <ide><path>numpy/core/tests/test_mem_overlap.py
<ide> def random_slice_fixed_size(n, step, size):
<ide> step *= -1
<ide> return slice(start, stop, step)
<ide>
<add> # First a few regular views
<add> yield x, x
<add> for j in range(1, 7, 3):
<add> yield x[j:], x[:-j]
<add> yield x[...,j:], x[...,:-j]
<add>
<add> # Then discontiguous views
<ide> while True:
<ide> steps = tuple(rng.randint(1, 11, dtype=np.intp)
<ide> if rng.randint(0, 5, dtype=np.intp) == 0 else 1
<ide> def view_element_first_byte(x):
<ide> return np.asarray(DummyArray(interface, x))
<ide>
<ide>
<del>class TestUFuncGenericFunction(object):
<add>class TestUFunc(object):
<ide> """
<ide> Test ufunc call memory overlap handling
<ide> """
<ide>
<del> def test_overlapping_unary_ufunc_fuzz(self):
<add> def check_unary_fuzz(self, operation, get_out_axis_size, dtype=np.int16,
<add> count=5000):
<ide> shapes = [7, 13, 8, 21, 29, 32]
<del> ufunc = np.invert
<ide>
<ide> rng = np.random.RandomState(1234)
<ide>
<ide> for ndim in range(1, 6):
<del> x = rng.randint(0, 2**16, size=shapes[:ndim]).astype(np.int16)
<add> x = rng.randint(0, 2**16, size=shapes[:ndim]).astype(dtype)
<ide>
<ide> it = iter_random_view_pairs(x, same_steps=False, equal_size=True)
<ide>
<del> min_count = 5000 // (ndim + 1)**2
<add> min_count = count // (ndim + 1)**2
<ide>
<ide> overlapping = 0
<ide> while overlapping < min_count:
<ide> a, b = next(it)
<ide>
<del> if np.shares_memory(a, b):
<del> overlapping += 1
<add> a_orig = a.copy()
<add> b_orig = b.copy()
<ide>
<del> bx = b.copy()
<del> cx = ufunc(a, out=bx)
<del> c = ufunc(a, out=b)
<add> if get_out_axis_size is None:
<add> bx = b.copy()
<add> cx = operation(a, out=bx)
<add> c = operation(a, out=b)
<ide>
<del> if (c != cx).any():
<del> assert_equal(c, cx)
<add> if (c != cx).any():
<add> assert_equal(c, cx)
<add>
<add> if np.shares_memory(a, b):
<add> overlapping += 1
<add> else:
<add> for axis in itertools.chain(range(ndim), [None]):
<add> a[...] = a_orig
<add> b[...] = b_orig
<add>
<add> # Determine size for reduction axis (None if scalar)
<add> outsize, scalarize = get_out_axis_size(a, b, axis)
<add> if outsize == 'skip':
<add> continue
<add>
<add> # Slice b to get an output array of the correct size
<add> sl = [slice(None)] * ndim
<add> if axis is None:
<add> if outsize is None:
<add> sl = [slice(0, 1)] + [0]*(ndim - 1)
<add> else:
<add> sl = [slice(0, outsize)] + [0]*(ndim - 1)
<add> else:
<add> if outsize is None:
<add> k = b.shape[axis]//2
<add> if ndim == 1:
<add> sl[axis] = slice(k, k + 1)
<add> else:
<add> sl[axis] = k
<add> else:
<add> assert b.shape[axis] >= outsize
<add> sl[axis] = slice(0, outsize)
<add> b_out = b[tuple(sl)]
<add>
<add> if scalarize:
<add> b_out = b_out.reshape([])
<add>
<add> if np.shares_memory(a, b_out):
<add> overlapping += 1
<add>
<add> # Check result
<add> bx = b_out.copy()
<add> cx = operation(a, out=bx, axis=axis)
<add> c = operation(a, out=b_out, axis=axis)
<add>
<add> if (c != cx).any():
<add> assert_equal(c, cx)
<add>
<add> def test_unary_ufunc_call_fuzz(self):
<add> self.check_unary_fuzz(np.invert, None, np.int16)
<add>
<add> def test_binary_ufunc_accumulate_fuzz(self):
<add> def get_out_axis_size(a, b, axis):
<add> if axis is None:
<add> if a.ndim == 1:
<add> return a.size, False
<add> else:
<add> return 'skip', False # accumulate doesn't support this
<add> else:
<add> return a.shape[axis], False
<add>
<add> self.check_unary_fuzz(np.add.accumulate, get_out_axis_size,
<add> dtype=np.int16, count=500)
<add>
<add> def test_binary_ufunc_reduce_fuzz(self):
<add> def get_out_axis_size(a, b, axis):
<add> return None, (axis is None or a.ndim == 1)
<add>
<add> self.check_unary_fuzz(np.add.reduce, get_out_axis_size,
<add> dtype=np.int16, count=500)
<add>
<add> def test_binary_ufunc_reduceat_fuzz(self):
<add> def get_out_axis_size(a, b, axis):
<add> if axis is None:
<add> if a.ndim == 1:
<add> return a.size, False
<add> else:
<add> return 'skip', False # reduceat doesn't support this
<add> else:
<add> return a.shape[axis], False
<add>
<add> def do_reduceat(a, out, axis):
<add> if axis is None:
<add> size = len(a)
<add> step = size//len(out)
<add> else:
<add> size = a.shape[axis]
<add> step = a.shape[axis] // out.shape[axis]
<add> idx = np.arange(0, size, step)
<add> return np.add.reduceat(a, idx, out=out, axis=axis)
<add>
<add> self.check_unary_fuzz(do_reduceat, get_out_axis_size,
<add> dtype=np.int16, count=500)
<ide>
<del> def test_overlapping_unary_gufunc_fuzz(self):
<add> def test_unary_gufunc_fuzz(self):
<ide> shapes = [7, 13, 8, 21, 29, 32]
<ide> gufunc = umath_tests.euclidean_pdist
<ide>
<ide> def test_overlapping_unary_gufunc_fuzz(self):
<ide> if (c != cx).any():
<ide> assert_equal(c, cx)
<ide>
<del> def test_overlapping_unary_ufunc_1d_manual(self):
<add> def test_unary_ufunc_1d_manual(self):
<ide> # Exercise branches in PyArray_EQUIVALENTLY_ITERABLE
<ide>
<ide> def check(a, b):
<ide> def check(a, b):
<ide> check(x[:1].reshape([]), y[::-1])
<ide> check(x[-1:].reshape([]), y[::-1])
<ide>
<del> def test_overlapping_binary_ufunc_1d_manual(self):
<add> def test_binary_ufunc_1d_manual(self):
<ide> ufunc = np.add
<ide>
<ide> def check(a, b, c): | 1 |
Ruby | Ruby | remove macos specific dummy call | f4cb9a40a6d5f14659b337beedfd6b537fb14e31 | <ide><path>Library/Homebrew/keg.rb
<ide> def binary_executable_or_library_files
<ide>
<ide> def codesign_patched_binary(file); end
<ide>
<del> def dsymutil_binary(file); end
<del>
<ide> private
<ide>
<ide> def resolve_any_conflicts(dst, dry_run: false, verbose: false, overwrite: false) | 1 |
Text | Text | move zfs options doc to the storage section | b674ae0639a893c4b20a848e8ab837b8455f3aae | <ide><path>docs/reference/commandline/cli.md
<ide> Currently supported options of `devicemapper`:
<ide> > Otherwise, set this flag for migrating existing Docker daemons to
<ide> > a daemon with a supported environment.
<ide>
<del>### Docker execdriver option
<del>
<ide> Currently supported options of `zfs`:
<ide>
<ide> * `zfs.fsname`
<ide> Currently supported options of `zfs`:
<ide>
<ide> $ docker -d -s zfs --storage-opt zfs.fsname=zroot/docker
<ide>
<add>### Docker execdriver option
<add>
<ide> The Docker daemon uses a specifically built `libcontainer` execution driver as
<ide> its interface to the Linux kernel `namespaces`, `cgroups`, and `SELinux`.
<ide> | 1 |
Mixed | Text | forbid cjs globals in esm code snippets | 2481facd9ff3af57924c2391c507f13abf73ba3a | <ide><path>.eslintrc.js
<ide> module.exports = {
<ide> 'doc/api/packages.md/*.js',
<ide> ],
<ide> parserOptions: { sourceType: 'module' },
<add> rules: { 'no-restricted-globals': [
<add> 'error',
<add> {
<add> name: '__filename',
<add> message: 'Use import.meta.url instead',
<add> },
<add> {
<add> name: '__dirname',
<add> message: 'Not available in ESM',
<add> },
<add> {
<add> name: 'exports',
<add> message: 'Not available in ESM',
<add> },
<add> {
<add> name: 'module',
<add> message: 'Not available in ESM',
<add> },
<add> {
<add> name: 'require',
<add> message: 'Use import instead',
<add> },
<add> ] },
<ide> },
<ide> ],
<ide> rules: {
<ide><path>doc/api/esm.md
<ide> analysis process.
<ide>
<ide> For example, consider a CommonJS module written:
<ide>
<del>```js
<add>```cjs
<ide> // cjs.cjs
<ide> exports.name = 'exported';
<ide> ```
<ide><path>doc/api/packages.md
<ide> import { another } from 'a-package/m.mjs';
<ide> Self-referencing is also available when using `require`, both in an ES module,
<ide> and in a CommonJS one. For example, this code will also work:
<ide>
<del>```js
<add>```cjs
<ide> // ./a-module.js
<ide> const { something } = require('a-package/foo'); // Loads from ./foo.js.
<ide> ```
<ide> to be treated as ES modules, just as `"type": "commonjs"` would cause them
<ide> to be treated as CommonJS.
<ide> See [Enabling](#esm_enabling).
<ide>
<del>```js
<add>```cjs
<ide> // ./node_modules/pkg/index.cjs
<ide> exports.name = 'value';
<ide> ```
<ide> CommonJS and ES module instances of the package:
<ide> CommonJS and ES module versions of the package. For example, if the CommonJS
<ide> and ES module entry points are `index.cjs` and `index.mjs`, respectively:
<ide>
<del> ```js
<add> ```cjs
<ide> // ./node_modules/pkg/index.cjs
<ide> const state = require('./state.cjs');
<ide> module.exports.state = state;
<ide> The `"main"` field defines the script that is used when the [package directory
<ide> is loaded via `require()`](modules.md#modules_folders_as_modules). Its value
<ide> is a path.
<ide>
<del>```js
<add>```cjs
<ide> require('./path/to/directory'); // This resolves to ./path/to/directory/main.js.
<ide> ```
<ide> | 3 |
PHP | PHP | use env var | 251140ef8b2e283dec3025aa6a0cbfd6594c9dad | <ide><path>config/filesystems.php
<ide> 'public' => [
<ide> 'driver' => 'local',
<ide> 'root' => storage_path('app/public'),
<add> 'url' => env('APP_URL').'/storage',
<ide> 'visibility' => 'public',
<ide> ],
<ide> | 1 |
Go | Go | add vfs quota for daemon storage-opts | 1397b8c63ca050e76bcd05ecac3314e0f1d5205c | <ide><path>daemon/graphdriver/vfs/driver.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/daemon/graphdriver"
<ide> "github.com/docker/docker/daemon/graphdriver/quota"
<add> "github.com/docker/docker/errdefs"
<ide> "github.com/docker/docker/pkg/containerfs"
<ide> "github.com/docker/docker/pkg/idtools"
<add> "github.com/docker/docker/pkg/parsers"
<ide> "github.com/docker/docker/pkg/system"
<ide> "github.com/docker/go-units"
<ide> "github.com/opencontainers/selinux/go-selinux/label"
<add> "github.com/pkg/errors"
<ide> )
<ide>
<ide> var (
<ide> func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
<ide> home: home,
<ide> idMapping: idtools.NewIDMappingsFromMaps(uidMaps, gidMaps),
<ide> }
<add>
<add> if err := d.parseOptions(options); err != nil {
<add> return nil, err
<add> }
<add>
<ide> rootIDs := d.idMapping.RootPair()
<ide> if err := idtools.MkdirAllAndChown(home, 0700, rootIDs); err != nil {
<ide> return nil, err
<ide> }
<ide>
<ide> setupDriverQuota(d)
<ide>
<add> if size := d.getQuotaOpt(); !d.quotaSupported() && size > 0 {
<add> return nil, quota.ErrQuotaNotSupported
<add> }
<add>
<ide> return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil
<ide> }
<ide>
<ide> func (d *Driver) Cleanup() error {
<ide> return nil
<ide> }
<ide>
<add>func (d *Driver) parseOptions(options []string) error {
<add> for _, option := range options {
<add> key, val, err := parsers.ParseKeyValueOpt(option)
<add> if err != nil {
<add> return errdefs.InvalidParameter(err)
<add> }
<add> switch key {
<add> case "size":
<add> size, err := units.RAMInBytes(val)
<add> if err != nil {
<add> return errdefs.InvalidParameter(err)
<add> }
<add> if err = d.setQuotaOpt(uint64(size)); err != nil {
<add> return errdefs.InvalidParameter(errors.Wrap(err, "failed to set option size for vfs"))
<add> }
<add> default:
<add> return errdefs.InvalidParameter(errors.Errorf("unknown option %s for vfs", key))
<add> }
<add> }
<add> return nil
<add>}
<add>
<ide> // CreateReadWrite creates a layer that is writable for use as a container
<ide> // file system.
<ide> func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {
<del> var err error
<del> var size int64
<add> quotaSize := d.getQuotaOpt()
<ide>
<ide> if opts != nil {
<ide> for key, val := range opts.StorageOpt {
<ide> func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts
<ide> if !d.quotaSupported() {
<ide> return quota.ErrQuotaNotSupported
<ide> }
<del> if size, err = units.RAMInBytes(val); err != nil {
<del> return err
<add> size, err := units.RAMInBytes(val)
<add> if err != nil {
<add> return errdefs.InvalidParameter(err)
<ide> }
<add> quotaSize = uint64(size)
<ide> default:
<del> return fmt.Errorf("Storage opt %s not supported", key)
<add> return errdefs.InvalidParameter(errors.Errorf("Storage opt %s not supported", key))
<ide> }
<ide> }
<ide> }
<ide>
<del> return d.create(id, parent, uint64(size))
<add> return d.create(id, parent, quotaSize)
<ide> }
<ide>
<ide> // Create prepares the filesystem for the VFS driver and copies the directory for the given id under the parent.
<ide><path>daemon/graphdriver/vfs/quota_linux.go
<ide> import (
<ide>
<ide> type driverQuota struct {
<ide> quotaCtl *quota.Control
<add> quotaOpt quota.Quota
<ide> }
<ide>
<ide> func setupDriverQuota(driver *Driver) {
<ide> func setupDriverQuota(driver *Driver) {
<ide> }
<ide> }
<ide>
<add>func (d *Driver) setQuotaOpt(size uint64) error {
<add> d.quotaOpt.Size = size
<add> return nil
<add>}
<add>
<add>func (d *Driver) getQuotaOpt() uint64 {
<add> return d.quotaOpt.Size
<add>}
<add>
<ide> func (d *Driver) setupQuota(dir string, size uint64) error {
<ide> return d.quotaCtl.SetQuota(dir, quota.Quota{Size: size})
<ide> }
<ide><path>daemon/graphdriver/vfs/quota_unsupported.go
<ide> func setupDriverQuota(driver *Driver) error {
<ide> return nil
<ide> }
<ide>
<add>func (d *Driver) setQuotaOpt(size uint64) error {
<add> return quota.ErrQuotaNotSupported
<add>}
<add>
<add>func (d *Driver) getQuotaOpt() uint64 {
<add> return 0
<add>}
<add>
<ide> func (d *Driver) setupQuota(dir string, size uint64) error {
<ide> return quota.ErrQuotaNotSupported
<ide> } | 3 |
Javascript | Javascript | fix coding style in external/builder/builder.js | 4f6b363b2cd05ade230515e022540e05bb566935 | <ide><path>external/builder/builder.js
<add>/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
<add>/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
<ide> /* jshint node:true */
<ide> /* globals cp, ls, test */
<ide>
<ide> function preprocess(inFilename, outFilename, defines) {
<ide> }
<ide> return null;
<ide> }
<del> var writeLine = typeof outFilename === 'function' ? outFilename :
<del> function(line) {
<del> out += line + '\n';
<del> };
<add> var writeLine = (typeof outFilename === 'function' ? outFilename :
<add> function(line) {
<add> out += line + '\n';
<add> });
<ide> function include(file) {
<ide> var realPath = fs.realpathSync(inFilename);
<ide> var dir = path.dirname(realPath);
<ide> function preprocess(inFilename, outFilename, defines) {
<ide> state = stack.pop();
<ide> break;
<ide> case 'expand':
<del> if (state === 0 || state === 3)
<add> if (state === 0 || state === 3) {
<ide> expand(m[2]);
<add> }
<ide> break;
<ide> case 'include':
<del> if (state === 0 || state === 3)
<add> if (state === 0 || state === 3) {
<ide> include(m[2]);
<add> }
<ide> break;
<ide> }
<ide> } else {
<ide> function preprocess(inFilename, outFilename, defines) {
<ide> }
<ide> }
<ide> }
<del> if (state !== 0 || stack.length !== 0)
<add> if (state !== 0 || stack.length !== 0) {
<ide> throw new Error('Missing endif in preprocessor.');
<del> if (typeof outFilename !== 'function')
<add> }
<add> if (typeof outFilename !== 'function') {
<ide> fs.writeFileSync(outFilename, out);
<add> }
<ide> }
<ide> exports.preprocess = preprocess;
<ide>
<ide> function build(setup) {
<ide> sources.forEach(function(source) {
<ide> // ??? Warn if the source is wildcard and dest is file?
<ide> var destWithFolder = destination;
<del> if (test('-d', destination))
<add> if (test('-d', destination)) {
<ide> destWithFolder += '/' + path.basename(source);
<add> }
<ide> preprocess(source, destWithFolder, defines);
<ide> });
<ide> });
<ide> exports.build = build;
<ide> */
<ide> function merge(defaults, defines) {
<ide> var ret = {};
<del> for (var key in defaults)
<add> for (var key in defaults) {
<ide> ret[key] = defaults[key];
<del> for (key in defines)
<add> }
<add> for (key in defines) {
<ide> ret[key] = defines[key];
<add> }
<ide> return ret;
<ide> }
<ide> exports.merge = merge; | 1 |
Text | Text | use correct name in `with-xata` example | 9863df3fb297cb5feaa34b3332d24a0f79f51dc7 | <ide><path>examples/with-xata/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide> Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```sh
<del>npx create-next-app --example cms-contentful cms-contentful-app
<add>npx create-next-app --example with-xata with-xata-app
<ide> ```
<ide>
<ide> ```sh
<del>yarn create next-app --example cms-contentful cms-contentful-app
<add>yarn create next-app --example with-xata with-xata-app
<ide> ```
<ide>
<ide> ```sh
<del>pnpm create next-app --example cms-contentful cms-contentful-app
<add>pnpm create next-app --example with-xata with-xata-app
<ide> ```
<ide>
<ide> ### Link Your Xata Workspace and Run Codegen | 1 |
Text | Text | join parts of disrupt section in cli.md | 0ecd3c68452ff9b9709cdaf5b11b48e36c685a8e | <ide><path>doc/api/cli.md
<ide> added: v12.0.0
<ide> -->
<ide>
<ide> Enables a signal handler that causes the Node.js process to write a heap dump
<del>when the specified signal is received.
<add>when the specified signal is received. `signal` must be a valid signal name.
<add>Disabled by default.
<ide>
<ide> ```console
<ide> $ node --heapsnapshot-signal=SIGUSR2 index.js &
<ide> added: v12.4.0
<ide>
<ide> Specify the file name of the heap profile generated by `--heap-prof`.
<ide>
<del>Generates a heap snapshot each time the process receives the specified signal.
<del>`signal` must be a valid signal name. Disabled by default.
<del>
<ide> ### `--icu-data-dir=file`
<ide> <!-- YAML
<ide> added: v0.11.15 | 1 |
Ruby | Ruby | implement pr feedback | 603bdd01a81e62d6b97a5da26d75d409e839a8fa | <ide><path>Library/Homebrew/cask/lib/hbc/cli/search.rb
<ide> def self.extract_regexp(string)
<ide> def self.search_remote(query)
<ide> matches = GitHub.search_code(user: "caskroom", path: "Casks",
<ide> filename: query, extension: "rb")
<del> Array(matches).map do |match|
<add> matches.map do |match|
<ide> tap = Tap.fetch(match["repository"]["full_name"])
<ide> next if tap.installed?
<ide> "#{tap.name}/#{File.basename(match["path"], ".rb")}"
<ide><path>Library/Homebrew/cmd/search.rb
<ide> def search_taps(query)
<ide> valid_dirnames = ["Formula", "HomebrewFormula", "Casks", "."].freeze
<ide> matches = GitHub.search_code(user: ["Homebrew", "caskroom"], filename: query, extension: "rb")
<ide>
<del> Array(matches).map do |match|
<add> matches.map do |match|
<ide> dirname, filename = File.split(match["path"])
<ide> next unless valid_dirnames.include?(dirname)
<ide> tap = Tap.fetch(match["repository"]["full_name"])
<ide><path>Library/Homebrew/test/utils/github_spec.rb
<ide>
<ide> describe "::query_string" do
<ide> it "builds a query with the given hash parameters formatted as key:value" do
<del> query = subject.query_string(user: "Homebrew", repo: "Brew")
<del> expect(query).to eq("q=user%3AHomebrew+repo%3ABrew&per_page=100")
<add> query = subject.query_string(user: "Homebrew", repo: "brew")
<add> expect(query).to eq("q=user%3AHomebrew+repo%3Abrew&per_page=100")
<ide> end
<ide>
<ide> it "adds a variable number of top-level string parameters to the query when provided" do
<ide><path>Library/Homebrew/utils/github.rb
<ide> def format_parameter(key, value)
<ide> end
<ide>
<ide> def url_to(*subroutes)
<del> URI.parse(File.join(API_URL, *subroutes))
<add> URI.parse([API_URL, *subroutes].join("/"))
<ide> end
<ide>
<ide> def search(entity, *queries, **qualifiers)
<ide> uri = url_to "search", entity
<ide> uri.query = query_string(*queries, **qualifiers)
<del> open(uri) { |json| json["items"] }
<add> open(uri) { |json| Array(json["items"]) }
<ide> end
<ide> end | 4 |
Javascript | Javascript | add hooks for tests to override core behavior | 5f9bbadd713cbaca569fac413c45caa40399c836 | <ide><path>packages/ember-metal/lib/accessors.js
<ide> Ember.get = get;
<ide> */
<ide> Ember.set = set;
<ide>
<add>if (Ember.config.overrideAccessors) {
<add> Ember.config.overrideAccessors();
<add> get = Ember.get;
<add> set = Ember.set;
<add>}
<add>
<ide> // ..........................................................
<ide> // PATHS
<ide> //
<ide><path>packages/ember-metal/lib/core.js
<ide> /*globals Em:true ENV */
<ide>
<ide> if ('undefined' === typeof Ember) {
<add> // Create core object. Make it act like an instance of Ember.Namespace so that
<add> // objects assigned to it are given a sane string representation.
<add> Ember = {};
<add>}
<add>
<ide> /**
<ide> @namespace
<ide> @name Ember
<del> @version 0.9.8.1
<add> @version 1.0.pre
<ide>
<ide> All Ember methods and functions are defined inside of this namespace.
<ide> You generally should not add new properties to this namespace as it may be
<ide> if ('undefined' === typeof Ember) {
<ide> performance optimizations.
<ide> */
<ide>
<del>// Create core object. Make it act like an instance of Ember.Namespace so that
<del>// objects assigned to it are given a sane string representation.
<del>Ember = {};
<del>
<ide> // aliases needed to keep minifiers from removing the global context
<ide> if ('undefined' !== typeof window) {
<ide> window.Em = window.Ember = Em = Ember;
<ide> }
<ide>
<del>}
<del>
<ide> // Make sure these are set whether Ember was already defined or not
<ide>
<ide> Ember.isNamespace = true;
<ide> Ember.toString = function() { return "Ember"; };
<ide> /**
<ide> @static
<ide> @type String
<del> @default '0.9.8.1'
<add> @default '1.0.pre'
<ide> @constant
<ide> */
<del>Ember.VERSION = '0.9.8.1';
<add>Ember.VERSION = '1.0.pre';
<ide>
<ide> /**
<ide> @static
<ide> Ember.VERSION = '0.9.8.1';
<ide> */
<ide> Ember.ENV = 'undefined' === typeof ENV ? {} : ENV;
<ide>
<add>Ember.config = Ember.config || {};
<ide>
<ide> // ..........................................................
<ide> // BOOTSTRAP
<ide><path>packages/ember-runtime/lib/system/core_object.js
<ide> CoreObject.PrototypeMixin = Ember.Mixin.create(
<ide> }
<ide> });
<ide>
<add>if (Ember.config.overridePrototypeMixin) {
<add> Ember.config.overridePrototypeMixin(CoreObject.PrototypeMixin);
<add>}
<add>
<ide> CoreObject.__super__ = null;
<ide>
<ide> var ClassMixin = Ember.Mixin.create(
<ide> var ClassMixin = Ember.Mixin.create(
<ide>
<ide> });
<ide>
<add>if (Ember.config.overrideClassMixin) {
<add> Ember.config.overrideClassMixin(ClassMixin);
<add>}
<add>
<ide> CoreObject.ClassMixin = ClassMixin;
<ide> ClassMixin.apply(CoreObject);
<ide> | 3 |
Ruby | Ruby | fix failing test in file update checker | 33192cfa07d82e345910cdb279f15305ad463faa | <ide><path>activesupport/test/file_update_checker_test.rb
<ide> def test_should_be_robust_enough_to_handle_deleted_files
<ide>
<ide> def test_should_be_robust_to_handle_files_with_wrong_modified_time
<ide> i = 0
<del> time = 1.year.from_now # wrong mtime from the future
<add> now = Time.now
<add> time = Time.mktime(now.year + 1, now.month, now.day) # wrong mtime from the future
<ide> File.utime time, time, FILES[2]
<ide>
<ide> checker = ActiveSupport::FileUpdateChecker.new(FILES){ i += 1 }
<ide>
<del> sleep(0.1)
<add> sleep(1)
<ide> FileUtils.touch(FILES[0..1])
<ide>
<ide> assert checker.execute_if_updated | 1 |
PHP | PHP | add asserts for template/layout | e35b8085f2255cd4ffe38a3a095ff75ca14bca75 | <ide><path>src/TestSuite/IntegrationTestCase.php
<ide> public function assertResponseContains($content, $message = '') {
<ide> $this->assertContains($content, $this->_response->body(), $message);
<ide> }
<ide>
<add>/**
<add> * Assert that the search string was in the template name.
<add> *
<add> * @param string $file The content to check for.
<add> * @param string $message The failure message that will be appended to the generated message.
<add> * @return void
<add> */
<add> public function assertTemplate($content, $message = '') {
<add> if (!$this->_viewName) {
<add> $this->fail('No view name stored. ' . $message);
<add> }
<add> $this->assertContains($content, $this->_viewName, $message);
<add> }
<add>
<add>/**
<add> * Assert that the search string was in the layout name.
<add> *
<add> * @param string $file The content to check for.
<add> * @param string $message The failure message that will be appended to the generated message.
<add> * @return void
<add> */
<add> public function assertLayout($content, $message = '') {
<add> if (!$this->_layoutName) {
<add> $this->fail('No layout name stored. ' . $message);
<add> }
<add> $this->assertContains($content, $this->_layoutName, $message);
<add> }
<add>
<ide> }
<ide><path>tests/TestCase/TestSuite/IntegrationTestCaseTest.php
<ide> public function testRequestSetsProperties() {
<ide> $this->assertInstanceOf('Cake\Controller\Controller', $this->_controller);
<ide> $this->assertContains('Template' . DS . 'Posts' . DS . 'index.ctp', $this->_viewName);
<ide> $this->assertContains('Template' . DS . 'Layout' . DS . 'default.ctp', $this->_layoutName);
<add>
<add> $this->assertTemplate('index');
<add> $this->assertLayout('default');
<ide> }
<ide>
<ide> /**
<add> * Test error handling and error page rendering.
<ide> *
<add> * @return void
<ide> */
<ide> public function testPostAndErrorHandling() {
<ide> $this->post('/request_action/error_method'); | 2 |
Go | Go | remove unused package | 932759c288ef3055919388bc0319cddde0bee34a | <ide><path>vendor/github.com/spf13/cobra/doc/man_docs.go
<del>// Copyright 2015 Red Hat Inc. All rights reserved.
<del>//
<del>// Licensed under the Apache License, Version 2.0 (the "License");
<del>// you may not use this file except in compliance with the License.
<del>// You may obtain a copy of the License at
<del>// http://www.apache.org/licenses/LICENSE-2.0
<del>//
<del>// Unless required by applicable law or agreed to in writing, software
<del>// distributed under the License is distributed on an "AS IS" BASIS,
<del>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<del>// See the License for the specific language governing permissions and
<del>// limitations under the License.
<del>
<del>package doc
<del>
<del>import (
<del> "bytes"
<del> "fmt"
<del> "io"
<del> "os"
<del> "path/filepath"
<del> "sort"
<del> "strings"
<del> "time"
<del>
<del> mangen "github.com/cpuguy83/go-md2man/md2man"
<del> "github.com/spf13/cobra"
<del> "github.com/spf13/pflag"
<del>)
<del>
<del>// GenManTree will generate a man page for this command and all descendants
<del>// in the directory given. The header may be nil. This function may not work
<del>// correctly if your command names have - in them. If you have `cmd` with two
<del>// subcmds, `sub` and `sub-third`. And `sub` has a subcommand called `third`
<del>// it is undefined which help output will be in the file `cmd-sub-third.1`.
<del>func GenManTree(cmd *cobra.Command, header *GenManHeader, dir string) error {
<del> return GenManTreeFromOpts(cmd, GenManTreeOptions{
<del> Header: header,
<del> Path: dir,
<del> CommandSeparator: "_",
<del> })
<del>}
<del>
<del>// GenManTreeFromOpts generates a man page for the command and all descendants.
<del>// The pages are written to the opts.Path directory.
<del>func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error {
<del> header := opts.Header
<del> if header == nil {
<del> header = &GenManHeader{}
<del> }
<del> for _, c := range cmd.Commands() {
<del> if !c.IsAvailableCommand() || c.IsHelpCommand() {
<del> continue
<del> }
<del> if err := GenManTreeFromOpts(c, opts); err != nil {
<del> return err
<del> }
<del> }
<del> section := "1"
<del> if header.Section != "" {
<del> section = header.Section
<del> }
<del>
<del> separator := "_"
<del> if opts.CommandSeparator != "" {
<del> separator = opts.CommandSeparator
<del> }
<del> basename := strings.Replace(cmd.CommandPath(), " ", separator, -1)
<del> filename := filepath.Join(opts.Path, basename+"."+section)
<del> f, err := os.Create(filename)
<del> if err != nil {
<del> return err
<del> }
<del> defer f.Close()
<del>
<del> headerCopy := *header
<del> return GenMan(cmd, &headerCopy, f)
<del>}
<del>
<del>type GenManTreeOptions struct {
<del> Header *GenManHeader
<del> Path string
<del> CommandSeparator string
<del>}
<del>
<del>// GenManHeader is a lot like the .TH header at the start of man pages. These
<del>// include the title, section, date, source, and manual. We will use the
<del>// current time if Date if unset and will use "Auto generated by spf13/cobra"
<del>// if the Source is unset.
<del>type GenManHeader struct {
<del> Title string
<del> Section string
<del> Date *time.Time
<del> date string
<del> Source string
<del> Manual string
<del>}
<del>
<del>// GenMan will generate a man page for the given command and write it to
<del>// w. The header argument may be nil, however obviously w may not.
<del>func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
<del> if header == nil {
<del> header = &GenManHeader{}
<del> }
<del> fillHeader(header, cmd.CommandPath())
<del>
<del> b := genMan(cmd, header)
<del> _, err := w.Write(mangen.Render(b))
<del> return err
<del>}
<del>
<del>func fillHeader(header *GenManHeader, name string) {
<del> if header.Title == "" {
<del> header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1))
<del> }
<del> if header.Section == "" {
<del> header.Section = "1"
<del> }
<del> if header.Date == nil {
<del> now := time.Now()
<del> header.Date = &now
<del> }
<del> header.date = (*header.Date).Format("Jan 2006")
<del> if header.Source == "" {
<del> header.Source = "Auto generated by spf13/cobra"
<del> }
<del>}
<del>
<del>func manPreamble(out io.Writer, header *GenManHeader, cmd *cobra.Command, dashedName string) {
<del> description := cmd.Long
<del> if len(description) == 0 {
<del> description = cmd.Short
<del> }
<del>
<del> fmt.Fprintf(out, `%% %s(%s)%s
<del>%% %s
<del>%% %s
<del># NAME
<del>`, header.Title, header.Section, header.date, header.Source, header.Manual)
<del> fmt.Fprintf(out, "%s \\- %s\n\n", dashedName, cmd.Short)
<del> fmt.Fprintf(out, "# SYNOPSIS\n")
<del> fmt.Fprintf(out, "**%s**\n\n", cmd.UseLine())
<del> fmt.Fprintf(out, "# DESCRIPTION\n")
<del> fmt.Fprintf(out, "%s\n\n", description)
<del>}
<del>
<del>func manPrintFlags(out io.Writer, flags *pflag.FlagSet) {
<del> flags.VisitAll(func(flag *pflag.Flag) {
<del> if len(flag.Deprecated) > 0 || flag.Hidden {
<del> return
<del> }
<del> format := ""
<del> if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 {
<del> format = fmt.Sprintf("**-%s**, **--%s**", flag.Shorthand, flag.Name)
<del> } else {
<del> format = fmt.Sprintf("**--%s**", flag.Name)
<del> }
<del> if len(flag.NoOptDefVal) > 0 {
<del> format = format + "["
<del> }
<del> if flag.Value.Type() == "string" {
<del> // put quotes on the value
<del> format = format + "=%q"
<del> } else {
<del> format = format + "=%s"
<del> }
<del> if len(flag.NoOptDefVal) > 0 {
<del> format = format + "]"
<del> }
<del> format = format + "\n\t%s\n\n"
<del> fmt.Fprintf(out, format, flag.DefValue, flag.Usage)
<del> })
<del>}
<del>
<del>func manPrintOptions(out io.Writer, command *cobra.Command) {
<del> flags := command.NonInheritedFlags()
<del> if flags.HasFlags() {
<del> fmt.Fprintf(out, "# OPTIONS\n")
<del> manPrintFlags(out, flags)
<del> fmt.Fprintf(out, "\n")
<del> }
<del> flags = command.InheritedFlags()
<del> if flags.HasFlags() {
<del> fmt.Fprintf(out, "# OPTIONS INHERITED FROM PARENT COMMANDS\n")
<del> manPrintFlags(out, flags)
<del> fmt.Fprintf(out, "\n")
<del> }
<del>}
<del>
<del>func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
<del> // something like `rootcmd-subcmd1-subcmd2`
<del> dashCommandName := strings.Replace(cmd.CommandPath(), " ", "-", -1)
<del>
<del> buf := new(bytes.Buffer)
<del>
<del> manPreamble(buf, header, cmd, dashCommandName)
<del> manPrintOptions(buf, cmd)
<del> if len(cmd.Example) > 0 {
<del> fmt.Fprintf(buf, "# EXAMPLE\n")
<del> fmt.Fprintf(buf, "\n%s\n\n", cmd.Example)
<del> }
<del> if hasSeeAlso(cmd) {
<del> fmt.Fprintf(buf, "# SEE ALSO\n")
<del> seealsos := make([]string, 0)
<del> if cmd.HasParent() {
<del> parentPath := cmd.Parent().CommandPath()
<del> dashParentPath := strings.Replace(parentPath, " ", "-", -1)
<del> seealso := fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section)
<del> seealsos = append(seealsos, seealso)
<del> cmd.VisitParents(func(c *cobra.Command) {
<del> if c.DisableAutoGenTag {
<del> cmd.DisableAutoGenTag = c.DisableAutoGenTag
<del> }
<del> })
<del> }
<del> children := cmd.Commands()
<del> sort.Sort(byName(children))
<del> for _, c := range children {
<del> if !c.IsAvailableCommand() || c.IsHelpCommand() {
<del> continue
<del> }
<del> seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section)
<del> seealsos = append(seealsos, seealso)
<del> }
<del> fmt.Fprintf(buf, "%s\n", strings.Join(seealsos, ", "))
<del> }
<del> if !cmd.DisableAutoGenTag {
<del> fmt.Fprintf(buf, "# HISTORY\n%s Auto generated by spf13/cobra\n", header.Date.Format("2-Jan-2006"))
<del> }
<del> return buf.Bytes()
<del>}
<ide><path>vendor/github.com/spf13/cobra/doc/md_docs.go
<del>//Copyright 2015 Red Hat Inc. All rights reserved.
<del>//
<del>// Licensed under the Apache License, Version 2.0 (the "License");
<del>// you may not use this file except in compliance with the License.
<del>// You may obtain a copy of the License at
<del>// http://www.apache.org/licenses/LICENSE-2.0
<del>//
<del>// Unless required by applicable law or agreed to in writing, software
<del>// distributed under the License is distributed on an "AS IS" BASIS,
<del>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<del>// See the License for the specific language governing permissions and
<del>// limitations under the License.
<del>
<del>package doc
<del>
<del>import (
<del> "fmt"
<del> "io"
<del> "os"
<del> "path/filepath"
<del> "sort"
<del> "strings"
<del> "time"
<del>
<del> "github.com/spf13/cobra"
<del>)
<del>
<del>func printOptions(w io.Writer, cmd *cobra.Command, name string) error {
<del> flags := cmd.NonInheritedFlags()
<del> flags.SetOutput(w)
<del> if flags.HasFlags() {
<del> if _, err := fmt.Fprintf(w, "### Options\n\n```\n"); err != nil {
<del> return err
<del> }
<del> flags.PrintDefaults()
<del> if _, err := fmt.Fprintf(w, "```\n\n"); err != nil {
<del> return err
<del> }
<del> }
<del>
<del> parentFlags := cmd.InheritedFlags()
<del> parentFlags.SetOutput(w)
<del> if parentFlags.HasFlags() {
<del> if _, err := fmt.Fprintf(w, "### Options inherited from parent commands\n\n```\n"); err != nil {
<del> return err
<del> }
<del> parentFlags.PrintDefaults()
<del> if _, err := fmt.Fprintf(w, "```\n\n"); err != nil {
<del> return err
<del> }
<del> }
<del> return nil
<del>}
<del>
<del>func GenMarkdown(cmd *cobra.Command, w io.Writer) error {
<del> return GenMarkdownCustom(cmd, w, func(s string) string { return s })
<del>}
<del>
<del>func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error {
<del> name := cmd.CommandPath()
<del>
<del> short := cmd.Short
<del> long := cmd.Long
<del> if len(long) == 0 {
<del> long = short
<del> }
<del>
<del> if _, err := fmt.Fprintf(w, "## %s\n\n", name); err != nil {
<del> return err
<del> }
<del> if _, err := fmt.Fprintf(w, "%s\n\n", short); err != nil {
<del> return err
<del> }
<del> if _, err := fmt.Fprintf(w, "### Synopsis\n\n"); err != nil {
<del> return err
<del> }
<del> if _, err := fmt.Fprintf(w, "\n%s\n\n", long); err != nil {
<del> return err
<del> }
<del>
<del> if cmd.Runnable() {
<del> if _, err := fmt.Fprintf(w, "```\n%s\n```\n\n", cmd.UseLine()); err != nil {
<del> return err
<del> }
<del> }
<del>
<del> if len(cmd.Example) > 0 {
<del> if _, err := fmt.Fprintf(w, "### Examples\n\n"); err != nil {
<del> return err
<del> }
<del> if _, err := fmt.Fprintf(w, "```\n%s\n```\n\n", cmd.Example); err != nil {
<del> return err
<del> }
<del> }
<del>
<del> if err := printOptions(w, cmd, name); err != nil {
<del> return err
<del> }
<del> if hasSeeAlso(cmd) {
<del> if _, err := fmt.Fprintf(w, "### SEE ALSO\n"); err != nil {
<del> return err
<del> }
<del> if cmd.HasParent() {
<del> parent := cmd.Parent()
<del> pname := parent.CommandPath()
<del> link := pname + ".md"
<del> link = strings.Replace(link, " ", "_", -1)
<del> if _, err := fmt.Fprintf(w, "* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short); err != nil {
<del> return err
<del> }
<del> cmd.VisitParents(func(c *cobra.Command) {
<del> if c.DisableAutoGenTag {
<del> cmd.DisableAutoGenTag = c.DisableAutoGenTag
<del> }
<del> })
<del> }
<del>
<del> children := cmd.Commands()
<del> sort.Sort(byName(children))
<del>
<del> for _, child := range children {
<del> if !child.IsAvailableCommand() || child.IsHelpCommand() {
<del> continue
<del> }
<del> cname := name + " " + child.Name()
<del> link := cname + ".md"
<del> link = strings.Replace(link, " ", "_", -1)
<del> if _, err := fmt.Fprintf(w, "* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short); err != nil {
<del> return err
<del> }
<del> }
<del> if _, err := fmt.Fprintf(w, "\n"); err != nil {
<del> return err
<del> }
<del> }
<del> if !cmd.DisableAutoGenTag {
<del> if _, err := fmt.Fprintf(w, "###### Auto generated by spf13/cobra on %s\n", time.Now().Format("2-Jan-2006")); err != nil {
<del> return err
<del> }
<del> }
<del> return nil
<del>}
<del>
<del>func GenMarkdownTree(cmd *cobra.Command, dir string) error {
<del> identity := func(s string) string { return s }
<del> emptyStr := func(s string) string { return "" }
<del> return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity)
<del>}
<del>
<del>func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error {
<del> for _, c := range cmd.Commands() {
<del> if !c.IsAvailableCommand() || c.IsHelpCommand() {
<del> continue
<del> }
<del> if err := GenMarkdownTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
<del> return err
<del> }
<del> }
<del>
<del> basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".md"
<del> filename := filepath.Join(dir, basename)
<del> f, err := os.Create(filename)
<del> if err != nil {
<del> return err
<del> }
<del> defer f.Close()
<del>
<del> if _, err := io.WriteString(f, filePrepender(filename)); err != nil {
<del> return err
<del> }
<del> if err := GenMarkdownCustom(cmd, f, linkHandler); err != nil {
<del> return err
<del> }
<del> return nil
<del>}
<ide><path>vendor/github.com/spf13/cobra/doc/util.go
<del>// Copyright 2015 Red Hat Inc. All rights reserved.
<del>//
<del>// Licensed under the Apache License, Version 2.0 (the "License");
<del>// you may not use this file except in compliance with the License.
<del>// You may obtain a copy of the License at
<del>// http://www.apache.org/licenses/LICENSE-2.0
<del>//
<del>// Unless required by applicable law or agreed to in writing, software
<del>// distributed under the License is distributed on an "AS IS" BASIS,
<del>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<del>// See the License for the specific language governing permissions and
<del>// limitations under the License.
<del>
<del>package doc
<del>
<del>import "github.com/spf13/cobra"
<del>
<del>// Test to see if we have a reason to print See Also information in docs
<del>// Basically this is a test for a parent commend or a subcommand which is
<del>// both not deprecated and not the autogenerated help command.
<del>func hasSeeAlso(cmd *cobra.Command) bool {
<del> if cmd.HasParent() {
<del> return true
<del> }
<del> for _, c := range cmd.Commands() {
<del> if !c.IsAvailableCommand() || c.IsHelpCommand() {
<del> continue
<del> }
<del> return true
<del> }
<del> return false
<del>}
<del>
<del>type byName []*cobra.Command
<del>
<del>func (s byName) Len() int { return len(s) }
<del>func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
<del>func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() } | 3 |
Ruby | Ruby | fix output on newer versions of git | 591e9d6a52559c8d0e95140bd08c0666f9535705 | <ide><path>Library/Homebrew/dev-cmd/tap-new.rb
<ide> def tap_new
<ide>
<ide> unless args.no_git?
<ide> cd tap.path do
<del> safe_system "git", "init"
<add> # Would be nice to use --initial-branch here but it's not available in
<add> # older versions of Git that we support.
<add> safe_system "git", "-c", "init.defaultBranch=#{branch}", "init"
<ide> safe_system "git", "add", "--all"
<ide> safe_system "git", "commit", "-m", "Create #{tap} tap"
<ide> safe_system "git", "branch", "-m", branch | 1 |
Ruby | Ruby | check satisfaction directly | d7a479f55105f277ce96ad1b4385679c93618add | <ide><path>Library/Homebrew/requirements/java_requirement.rb
<ide> class JavaRequirement < Requirement
<ide> cask "java"
<ide> download "http://www.oracle.com/technetwork/java/javase/downloads/index.html"
<ide>
<del> satisfy(:build_env => false) { java_version }
<add> satisfy :build_env => false do
<add> args = %w[--failfast]
<add> args << "--version" << "#{@version}" if @version
<add> @java_home = Utils.popen_read("/usr/libexec/java_home", *args).chomp
<add> $?.success?
<add> end
<ide>
<ide> env do
<ide> java_home = Pathname.new(@java_home)
<ide> def initialize(tags)
<ide> super
<ide> end
<ide>
<del> def java_version
<del> args = %w[--failfast]
<del> args << "--version" << "#{@version}" if @version
<del> @java_home = Utils.popen_read("/usr/libexec/java_home", *args).chomp
<del> $?.success?
<del> end
<del>
<ide> def message
<ide> version_string = " #{@version}" if @version
<ide> | 1 |
PHP | PHP | fix broken pr | 240fc43029f30bc3291673d7894b47607547ab34 | <ide><path>src/Illuminate/Database/Query/Builder.php
<ide> public function getPaginationCount()
<ide> {
<ide> $this->backupFieldsForCount();
<ide>
<del> $columns = $this->columns;
<del>
<del> // We have to check if the value is "null" so that the count function does
<del> // not attempt to count an invalid string. Checking the value is better
<del> // here because the count function already has an optional parameter.
<del> if (is_null($columns))
<del> {
<del> $total = $this->count();
<del> }
<del> else
<del> {
<del> $total = $this->count($columns);
<del> }
<add> // Because some database engines may throw errors if we leave the ordering
<add> // statements on the query, we will "back them up" and remove them from
<add> // the query. Once we have the count we will put them back onto this.
<add> $total = $this->count();
<ide>
<ide> $this->restoreFieldsForCount();
<ide>
<del> // Once the query is run we need to put the old select columns back on the
<del> // instance so that the select query will run properly. Otherwise, they
<del> // will be cleared, then the query will fire with all of the columns.
<del> $this->columns = $columns;
<del>
<ide> return $total;
<ide> }
<ide> | 1 |
Ruby | Ruby | fix an error in isolated running of tests | 9da153c2d39f52c55af59a42b8551763b5821900 | <ide><path>actionmailer/test/old_base/url_test.rb
<ide> def signed_up_with_url(recipient)
<ide> @recipient = recipient
<ide> @welcome_url = url_for :host => "example.com", :controller => "welcome", :action => "greeting"
<ide> end
<del>
<del> class <<self
<del> attr_accessor :received_body
<del> end
<del>
<del> def receive(mail)
<del> self.class.received_body = mail.body
<del> end
<ide> end
<ide>
<ide> class ActionMailerUrlTest < Test::Unit::TestCase | 1 |
Text | Text | add some backticks to flux docs | fa154e6e21fc3010e4501d6ca198b107cfdf4707 | <ide><path>examples/todomvc-flux/readme.md
<ide> Views ---> (actions) ----> Dispatcher ---> (registerd callback) ---> Stores ----
<ide>
<ide> A unidirectional data flow is central to the Flux pattern, and in fact Flux takes its name from the Latin word for flow. In the above diagram, the ___dispatcher___, ___stores___ and ___views___ are independent nodes with distinct inputs and outputs. The ___actions___ are simply discrete, semantic helper functions that facilitate passing data to the ___dispatcher___.
<ide>
<del>All data flows through the ___dispatcher___ as a central hub. ___Actions___ most often originate from user interactions with the ___views___, and are nothing more than a call into the ___dispatcher___. The ___dispatcher___ then invokes the callbacks that the ___stores___ have registered with it, effectively dispatching the data payload contained in the ___actions___ to all ___stores___. Within their registered callbacks, ___stores___ determine which ___actions___ they are interested in, and respond accordingly. The ___stores___ then emit a "change" event to alert the ___controller-views___ that a change to the data layer has occurred. ___Controller-Views___ listen for these events and retrieve data from the ___stores___ in an event handler. The ___controller-views___ call their own render() method via setState() or forceUpdate(), updating themselves and all of their children.
<add>All data flows through the ___dispatcher___ as a central hub. ___Actions___ most often originate from user interactions with the ___views___, and are nothing more than a call into the ___dispatcher___. The ___dispatcher___ then invokes the callbacks that the ___stores___ have registered with it, effectively dispatching the data payload contained in the ___actions___ to all ___stores___. Within their registered callbacks, ___stores___ determine which ___actions___ they are interested in, and respond accordingly. The ___stores___ then emit a "change" event to alert the ___controller-views___ that a change to the data layer has occurred. ___Controller-Views___ listen for these events and retrieve data from the ___stores___ in an event handler. The ___controller-views___ call their own `render()` method via `setState()` or `forceUpdate()`, updating themselves and all of their children.
<ide>
<ide> This structure allows us to reason easily about our application in a way that is reminiscent of functional reactive programming, or more specifically data-flow programming or flow-based programming, where data flows through the application in a single direction โ there are no two-way bindings. Application state is maintained only in the ___stores___, allowing the different parts of the application to remain highly decoupled. Where dependencies do occur between ___stores___, they are kept in a strict hierarchy, with synchronous updates managed by the ___dispatcher___.
<ide>
<ide> As an application grows, the dispatcher becomes more vital, as it can manage dep
<ide>
<ide> Stores contain the application state and logic. Their role is somewhat similar to a model in a traditional MVC, but they manage the state of many objects โ they are not instances of one object. Nor are they the same as Backbone's collections. More than simply managing a collection of ORM-style objects, stores manage the application state for a particular __domain__ within the application.
<ide>
<del>For example, Facebook's [Lookback Video Editor](https://facebook.com/lookback/edit) utilized a TimeStore that kept track of the playback time position and the playback state. On the other hand, the same application's ImageStore kept track of a collection of images. The TodoStore in our the TodoMVC example is similar in that it manages a collection of to-do items. A store exhibits characteristics of both a collection of models and a singleton model of a logical domain.
<add>For example, Facebook's [Lookback Video Editor](https://facebook.com/lookback/edit) utilized a TimeStore that kept track of the playback time position and the playback state. On the other hand, the same application's ImageStore kept track of a collection of images. The TodoStore in our TodoMVC example is similar in that it manages a collection of to-do items. A store exhibits characteristics of both a collection of models and a singleton model of a logical domain.
<ide>
<ide> As mentioned above, a store registers itself with the dispatcher and provides it with a callback. This callback receives the action's data payload as a parameter. The payload contains a type attribute, identifying the action's type. Within the store's registered callback, a switch statement based on the action's type is used to interpret the payload and to provide the proper hooks into the Store's internal methods. This allows an action to result in an update to the state of the store, via the dispatcher. After the stores are updated, they broadcast an event declaring that their state has changed, so the views may query the new state and update themselves.
<ide>
<ide> As mentioned above, a store registers itself with the dispatcher and provides it
<ide>
<ide> React provides the kind of composable views we need for the view layer. Close to the top of the nested view hierarchy, a special kind of view listens for events that are broadcast by the stores that it depends on. One could call this a ___controller-view___, as it provides the glue code to get the data from the stores and to pass this data down the chain of its descendants. We might have one of these controller-views governing any significant section of the page.
<ide>
<del>When it receives the event from the store, it first requests the new data it needs via the stores' public getter methods. It then calls its own setState() or forceUpdate() methods, causing its render() method and the render() method of all its descendants to run.
<add>When it receives the event from the store, it first requests the new data it needs via the stores' public getter methods. It then calls its own `setState()` or `forceUpdate()` methods, causing its `render()` method and the `render()` method of all its descendants to run.
<ide>
<ide> We often pass the entire state of the store down the chain of views in a single object, allowing different descendants to use what they need. In addition to keeping the controller-like behavior at the top of the hierarchy, and thus keeping our descendant views as functionally pure as possible, passing down the entire state of the store in a single object also has the effect of reducing the number of props we need to manage.
<ide>
<ide> Occasionally we may need to add additional controller-views deeper in the hierar
<ide>
<ide> ### Actions
<ide>
<del>The dispatcher exposes a method that allows a view to trigger a dispatch to the stores, and to include a payload of data, or an action. The action construction may be wrapped into a semantic helper method which sends the payload to the dispatcher. For example, we may want to change the text of a to-do item in a to-do list application. We would create an action with a function signature like updateText(todoId, newText) in our TodoActions module. This method may be invoked from within our views' event handlers, so we can call it in response to a user action. This action method also adds the action type to the payload, so that when the payload is interpreted in the store, it can respond appropriately to a payload with a particular action type. In our example, this type might be named something like TODO_UPDATE_TEXT.
<add>The dispatcher exposes a method that allows a view to trigger a dispatch to the stores, and to include a payload of data, or an action. The action construction may be wrapped into a semantic helper method which sends the payload to the dispatcher. For example, we may want to change the text of a to-do item in a to-do list application. We would create an action with a function signature like `updateText(todoId, newText)` in our `TodoActions` module. This method may be invoked from within our views' event handlers, so we can call it in response to a user action. This action method also adds the action type to the payload, so that when the payload is interpreted in the store, it can respond appropriately to a payload with a particular action type. In our example, this type might be named something like `TODO_UPDATE_TEXT`.
<ide>
<ide> Actions may also come from other places, such as the server. This happens, for example, during data initialization. It may also happen when the server returns an error code or when the server has updates to provide to the application. We'll talk more about server actions in a future article. In this post we're only concerned with the basics of the data flow.
<ide> | 1 |
Ruby | Ruby | add required methods to abstractdownloadstrategy | 68b3e6f3fb4947076b94a7c0ab09281a8f19fda4 | <ide><path>Library/Homebrew/download_strategy.rb
<ide> def expand_safe_system_args args
<ide> def quiet_safe_system *args
<ide> safe_system(*expand_safe_system_args(args))
<ide> end
<add>
<add> # All download strategies are expected to implement these methods
<add> def fetch; end
<add> def stage; end
<add> def cached_location; end
<ide> end
<ide>
<ide> class CurlDownloadStrategy < AbstractDownloadStrategy | 1 |
Javascript | Javascript | remove trivial buffer imports | 1b0d9795b6b738bdc27880a71764d3fe86e68e45 | <ide><path>test/internet/test-dgram-multicast-set-interface-lo.js
<ide> if (common.isSunOS) {
<ide> }
<ide>
<ide> const networkInterfaces = require('os').networkInterfaces();
<del>const Buffer = require('buffer').Buffer;
<ide> const fork = require('child_process').fork;
<ide> const MULTICASTS = {
<ide> IPv4: ['224.0.0.115', '224.0.0.116', '224.0.0.117'],
<ide><path>test/parallel/test-buffer-from.js
<ide>
<ide> const common = require('../common');
<ide> const { deepStrictEqual, throws } = require('assert');
<del>const { Buffer } = require('buffer');
<ide> const { runInNewContext } = require('vm');
<ide>
<ide> const checkString = 'test';
<ide><path>test/parallel/test-buffer-over-max-length.js
<ide> const common = require('../common');
<ide> const assert = require('assert');
<ide>
<ide> const buffer = require('buffer');
<del>const Buffer = buffer.Buffer;
<ide> const SlowBuffer = buffer.SlowBuffer;
<ide>
<ide> const kMaxLength = buffer.kMaxLength; | 3 |
Go | Go | verify build completed | fa480403c75c90880a6bc79bab9e10b012379006 | <ide><path>integration/build/build_userns_linux_test.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/integration/internal/container"
<add> "github.com/docker/docker/pkg/jsonmessage"
<ide> "github.com/docker/docker/pkg/stdcopy"
<ide> "github.com/docker/docker/testutil/daemon"
<ide> "github.com/docker/docker/testutil/fakecontext"
<ide> func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) {
<ide> })
<ide> assert.NilError(t, err)
<ide> defer resp.Body.Close()
<del> buf := make([]byte, 1024)
<del> for {
<del> n, err := resp.Body.Read(buf)
<del> if err != nil && err != io.EOF {
<del> t.Fatalf("Error reading ImageBuild response: %v", err)
<del> break
<del> }
<del> if n == 0 {
<del> break
<del> }
<del> }
<add>
<add> buf := bytes.NewBuffer(nil)
<add> err = jsonmessage.DisplayJSONMessagesStream(resp.Body, buf, 0, false, nil)
<add> assert.NilError(t, err)
<ide>
<ide> reader, err := clientUserRemap.ImageSave(ctx, []string{imageTag})
<ide> assert.NilError(t, err, "failed to download capabilities image")
<ide> func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) {
<ide> loadResp, err := clientNoUserRemap.ImageLoad(ctx, tarReader, false)
<ide> assert.NilError(t, err, "failed to load image tar file")
<ide> defer loadResp.Body.Close()
<del> for {
<del> n, err := loadResp.Body.Read(buf)
<del> if err != nil && err != io.EOF {
<del> t.Fatalf("Error reading ImageLoad response: %v", err)
<del> break
<del> }
<del> if n == 0 {
<del> break
<del> }
<del> }
<add> buf = bytes.NewBuffer(nil)
<add> err = jsonmessage.DisplayJSONMessagesStream(loadResp.Body, buf, 0, false, nil)
<add> assert.NilError(t, err)
<ide>
<ide> cid := container.Run(ctx, t, clientNoUserRemap,
<ide> container.WithImage(imageTag), | 1 |
Javascript | Javascript | remove unused file | 4d425e7f539b4a90fc458bfe8dc62367014b6fe8 | <ide><path>examples/module/async-loaded.js
<del>export var answer = 42; | 1 |
Text | Text | fix spanish translations for bash-cat | 211300c3090a1c050c1344dbaf5e30b63f030fc1 | <ide><path>guide/spanish/bash/bash-cat/index.md
<ide> localeTitle: Bash Cat
<ide> ---
<ide> ## Bash Cat
<ide>
<del>Cat es uno de los comandos mรกs utilizados en los sistemas operativos Unix.
<add><code>cat</code> es uno de los comandos mรกs utilizados en los sistemas operativos Unix.
<ide>
<del>Cat se utiliza para leer un archivo de forma secuencial e imprimirlo en la salida estรกndar. El nombre se deriva de su funciรณn a los archivos Enate con **gato.**
<add><code>cat</code> se utiliza para leer un archivo de forma secuencial e imprimirlo en la salida estรกndar. El nombre se deriva de su funciรณn para con**cat**enar archivos.
<ide>
<ide> ### Uso
<ide>
<ide> ```bash
<del>cat [options] [file_names]
<add>cat [opciones] [nombres_de_archivos]
<ide> ```
<ide>
<ide> Opciones mรกs utilizadas:
<ide>
<ide> * `-b` , nรบmero de lรญneas de salida no en blanco
<del>* `-n` , `-n` todas las lรญneas de salida
<del>* `-s` , exprime mรบltiples lรญneas en blanco adyacentes
<del>* `-v` , muestra caracteres no imprimibles, excepto las pestaรฑas y el carรกcter de final de lรญnea
<add>* `-n` , nรบmero de todas las lรญneas de salida
<add>* `-s` , suprime mรบltiples lรญneas en blanco adyacentes
<add>* `-v` , muestra caracteres ocultos, excepto los tabuladores y el carรกcter de final de lรญnea
<ide>
<ide> ### Ejemplo
<ide>
<ide> cat file1.txt file2.txt
<ide>
<ide> #### Mรกs informaciรณn:
<ide>
<del>* Wikipedia: https://en.wikipedia.org/wiki/Cat\_(Unix)
<ide>\ No newline at end of file
<add>* Wikipedia: https://en.wikipedia.org/wiki/Cat\_(Unix) | 1 |
PHP | PHP | fix bugs in redis class | 244d4bfd0781d47d85a1bdb664c239bfe427809c | <ide><path>application/config/database.php
<ide>
<ide> 'redis' => array(
<ide>
<del> 'default' => array('host' => '127.0.0.1', 'port' => 6379),
<add> 'default' => array(
<add> 'host' => '127.0.0.1',
<add> 'port' => 6379,
<add> 'database' => 0
<add> ),
<ide>
<ide> ),
<ide>
<ide><path>laravel/redis.php
<ide> class Redis {
<ide> */
<ide> protected $port;
<ide>
<add> /**
<add> * The databse number the connection selects on load.
<add> *
<add> * @var int
<add> */
<add> protected $database;
<add>
<ide> /**
<ide> * The connection to the Redis database.
<ide> *
<ide> class Redis {
<ide> *
<ide> * @param string $host
<ide> * @param string $port
<add> * @param int $database
<ide> * @return void
<ide> */
<del> public function __construct($host, $port)
<add> public function __construct($host, $port, $database = 0)
<ide> {
<ide> $this->host = $host;
<ide> $this->port = $port;
<add> $this->database = $database;
<ide> }
<ide>
<ide> /**
<ide> public static function db($name = 'default')
<ide> throw new \Exception("Redis database [$name] is not defined.");
<ide> }
<ide>
<del> static::$databases[$name] = new static($config['host'], $config['port']);
<add> extract($config);
<add>
<add> static::$databases[$name] = new static($host, $port, $database);
<ide> }
<ide>
<ide> return static::$databases[$name];
<ide> public function run($method, $parameters)
<ide>
<ide> $response = trim(fgets($this->connection, 512));
<ide>
<add> return $this->parse($response);
<add> }
<add>
<add> /**
<add> * Parse and return the response from the Redis database.
<add> *
<add> * @param string $response
<add> * @return mixed
<add> */
<add> protected function parse($response)
<add> {
<ide> switch (substr($response, 0, 1))
<ide> {
<ide> case '-':
<ide> protected function connect()
<ide> throw new \Exception("Error making Redis connection: {$error} - {$message}");
<ide> }
<ide>
<add> $this->select($this->database);
<add>
<ide> return $this->connection;
<ide> }
<ide>
<ide> protected function bulk($head)
<ide>
<ide> list($read, $response, $size) = array(0, '', substr($head, 1));
<ide>
<del> do
<add> if ($size > 0)
<ide> {
<del> // Calculate and read the appropriate bytes off of the Redis response.
<del> // We'll read off the response in 1024 byte chunks until the entire
<del> // response has been read from the database.
<del> $block = (($remaining = $size - $read) < 1024) ? $remaining : 1024;
<add> do
<add> {
<add> // Calculate and read the appropriate bytes off of the Redis response.
<add> // We'll read off the response in 1024 byte chunks until the entire
<add> // response has been read from the database.
<add> $block = (($remaining = $size - $read) < 1024) ? $remaining : 1024;
<ide>
<del> $response .= fread($this->connection, $block);
<add> $response .= fread($this->connection, $block);
<ide>
<del> $read += $block;
<add> $read += $block;
<ide>
<del> } while ($read < $size);
<add> } while ($read < $size);
<add> }
<ide>
<ide> // The response ends with a trailing CRLF. So, we need to read that off
<ide> // of the end of the file stream to get it out of the way of the next
<ide> protected function multibulk($head)
<ide> $response = array();
<ide>
<ide> // Iterate through each bulk response in the multi-bulk and parse it out
<del> // using the "bulk" method since a multi-bulk response is just a list of
<del> // plain old bulk responses.
<add> // using the "parse" method since a multi-bulk response is just a list
<add> // of plain old Redis database responses.
<ide> for ($i = 0; $i < $count; $i++)
<ide> {
<del> $response[] = $this->bulk(trim(fgets($this->connection, 512)));
<add> $response[] = $this->parse(trim(fgets($this->connection, 512)));
<ide> }
<ide>
<ide> return $response; | 2 |
Text | Text | fill contributor agreement by robertsipek | 260c29794a1caa70f8b0702c31fcfecad6bfdadc | <ide><path>.github/contributors/robertsipek.md
<add># spaCy contributor agreement
<add>
<add>This spaCy Contributor Agreement (**"SCA"**) is based on the
<add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf).
<add>The SCA applies to any contribution that you make to any product or project
<add>managed by us (the **"project"**), and sets out the intellectual property rights
<add>you grant to us in the contributed materials. The term **"us"** shall mean
<add>[ExplosionAI GmbH](https://explosion.ai/legal). The term
<add>**"you"** shall mean the person or entity identified below.
<add>
<add>If you agree to be bound by these terms, fill in the information requested
<add>below and include the filled-in version with your first pull request, under the
<add>folder [`.github/contributors/`](/.github/contributors/). The name of the file
<add>should be your GitHub username, with the extension `.md`. For example, the user
<add>example_user would create the file `.github/contributors/example_user.md`.
<add>
<add>Read this agreement carefully before signing. These terms and conditions
<add>constitute a binding legal agreement.
<add>
<add>## Contributor Agreement
<add>
<add>1. The term "contribution" or "contributed materials" means any source code,
<add>object code, patch, tool, sample, graphic, specification, manual,
<add>documentation, or any other material posted or submitted by you to the project.
<add>
<add>2. With respect to any worldwide copyrights, or copyright applications and
<add>registrations, in your contribution:
<add>
<add> * you hereby assign to us joint ownership, and to the extent that such
<add> assignment is or becomes invalid, ineffective or unenforceable, you hereby
<add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
<add> royalty-free, unrestricted license to exercise all rights under those
<add> copyrights. This includes, at our option, the right to sublicense these same
<add> rights to third parties through multiple levels of sublicensees or other
<add> licensing arrangements;
<add>
<add> * you agree that each of us can do all things in relation to your
<add> contribution as if each of us were the sole owners, and if one of us makes
<add> a derivative work of your contribution, the one who makes the derivative
<add> work (or has it made will be the sole owner of that derivative work;
<add>
<add> * you agree that you will not assert any moral rights in your contribution
<add> against us, our licensees or transferees;
<add>
<add> * you agree that we may register a copyright in your contribution and
<add> exercise all ownership rights associated with it; and
<add>
<add> * you agree that neither of us has any duty to consult with, obtain the
<add> consent of, pay or render an accounting to the other for any use or
<add> distribution of your contribution.
<add>
<add>3. With respect to any patents you own, or that you can license without payment
<add>to any third party, you hereby grant to us a perpetual, irrevocable,
<add>non-exclusive, worldwide, no-charge, royalty-free license to:
<add>
<add> * make, have made, use, sell, offer to sell, import, and otherwise transfer
<add> your contribution in whole or in part, alone or in combination with or
<add> included in any product, work or materials arising out of the project to
<add> which your contribution was submitted, and
<add>
<add> * at our option, to sublicense these same rights to third parties through
<add> multiple levels of sublicensees or other licensing arrangements.
<add>
<add>4. Except as set out above, you keep all right, title, and interest in your
<add>contribution. The rights that you grant to us under these terms are effective
<add>on the date you first submitted a contribution to us, even if your submission
<add>took place before the date you sign these terms.
<add>
<add>5. You covenant, represent, warrant and agree that:
<add>
<add> * Each contribution that you submit is and shall be an original work of
<add> authorship and you can legally grant the rights set out in this SCA;
<add>
<add> * to the best of your knowledge, each contribution will not violate any
<add> third party's copyrights, trademarks, patents, or other intellectual
<add> property rights; and
<add>
<add> * each contribution shall be in compliance with U.S. export control laws and
<add> other applicable export and import laws. You agree to notify us if you
<add> become aware of any circumstance which would make any of the foregoing
<add> representations inaccurate in any respect. We may publicly disclose your
<add> participation in the project, including the fact that you have signed the SCA.
<add>
<add>6. This SCA is governed by the laws of the State of California and applicable
<add>U.S. Federal law. Any choice of law rules will not apply.
<add>
<add>7. Please place an โxโ on one of the applicable statement below. Please do NOT
<add>mark both statements:
<add>
<add> * [x] I am signing on behalf of myself as an individual and no other person
<add> or entity, including my employer, has or will have rights with respect to my
<add> contributions.
<add>
<add> * [ ] I am signing on behalf of my employer or a legal entity and I have the
<add> actual authority to contractually bind that entity.
<add>
<add>## Contributor Details
<add>
<add>| Field | Entry |
<add>|------------------------------- | -------------------- |
<add>| Name | Robert ล รญpek |
<add>| Company name (if applicable) | |
<add>| Title or role (if applicable) | |
<add>| Date | 22.10.2020 |
<add>| GitHub username | @robertsipek |
<add>| Website (optional) | | | 1 |
Text | Text | fix path the test environment conditions | a0fc7a4b46dd05b337de56ebde0ae38a52668c9c | <ide><path>TESTING.md
<ide> When adding new tests or modifying existing tests under `integration/`, testing
<ide> environment should be properly considered. `skip.If` from
<ide> [gotest.tools/skip](https://godoc.org/gotest.tools/skip) can be used to make the
<ide> test run conditionally. Full testing environment conditions can be found at
<del>[environment.go](https://github.com/moby/moby/blob/cb37987ee11655ed6bbef663d245e55922354c68/internal/test/environment/environment.go)
<add>[environment.go](https://github.com/moby/moby/blob/6b6eeed03b963a27085ea670f40cd5ff8a61f32e/testutil/environment/environment.go)
<ide>
<ide> Here is a quick example. If the test needs to interact with a docker daemon on
<ide> the same host, the following condition should be checked within the test code | 1 |
Javascript | Javascript | add textinput.setselection method | 771ca921b59cc3b3fd12c8fe3b08ed150bcf7a04 | <ide><path>Libraries/Components/TextInput/TextInput.js
<ide> type ImperativeMethods = $ReadOnly<{|
<ide> clear: () => void,
<ide> isFocused: () => boolean,
<ide> getNativeRef: () => ?React.ElementRef<HostComponent<mixed>>,
<add> setSelection: (start: number, end: number) => void,
<ide> |}>;
<ide>
<ide> const emptyFunctionThatReturnsTrue = () => true;
<ide> function InternalTextInput(props: Props): React.Node {
<ide> }
<ide> }
<ide>
<add> function setSelection(start: number, end: number): void {
<add> if (inputRef.current != null) {
<add> viewCommands.setTextAndSelection(
<add> inputRef.current,
<add> mostRecentEventCount,
<add> null,
<add> start,
<add> end,
<add> );
<add> }
<add> }
<add>
<ide> // TODO: Fix this returning true on null === null, when no input is focused
<ide> function isFocused(): boolean {
<ide> return TextInputState.currentlyFocusedInput() === inputRef.current;
<ide> function InternalTextInput(props: Props): React.Node {
<ide> ref.clear = clear;
<ide> ref.isFocused = isFocused;
<ide> ref.getNativeRef = getNativeRef;
<add> ref.setSelection = setSelection;
<ide> }
<ide> },
<ide> });
<ide><path>packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js
<ide> class SelectionExample extends React.Component<
<ide> $FlowFixMeProps,
<ide> SelectionExampleState,
<ide> > {
<del> _textInput: any;
<add> _textInput: React.ElementRef<typeof TextInput> | null = null;
<ide>
<ide> constructor(props) {
<ide> super(props);
<ide> class SelectionExample extends React.Component<
<ide> }
<ide>
<ide> select(start, end) {
<del> this._textInput.focus();
<add> this._textInput?.focus();
<ide> this.setState({selection: {start, end}});
<add> if (this.props.imperative) {
<add> this._textInput?.setSelection(start, end);
<add> }
<ide> }
<ide>
<ide> selectRandom() {
<ide> class SelectionExample extends React.Component<
<ide> // $FlowFixMe[method-unbinding] added when improving typing for this parameters
<ide> onSelectionChange={this.onSelectionChange.bind(this)}
<ide> ref={textInput => (this._textInput = textInput)}
<del> selection={this.state.selection}
<add> selection={this.props.imperative ? undefined : this.state.selection}
<ide> style={this.props.style}
<ide> value={this.state.value}
<ide> />
<ide> module.exports = ([
<ide> );
<ide> },
<ide> },
<add> {
<add> title: 'Text selection & cursor placement (imperative)',
<add> name: 'cursorPlacementImperative',
<add> render: function (): React.Node {
<add> return (
<add> <View>
<add> <SelectionExample
<add> testID="singlelineImperative"
<add> style={styles.default}
<add> value="text selection can be changed imperatively"
<add> imperative={true}
<add> />
<add> <SelectionExample
<add> testID="multilineImperative"
<add> multiline
<add> style={styles.multiline}
<add> value={'multiline text selection\ncan also be changed imperatively'}
<add> imperative={true}
<add> />
<add> </View>
<add> );
<add> },
<add> },
<ide> ]: Array<RNTesterModuleExample>); | 2 |
Text | Text | move expo samples to a service account | 50fbb27bd968703453685e80a5fda466b7bb8d99 | <ide><path>README.md
<ide> Follow the [Getting Started guide](https://reactnative.dev/docs/getting-started)
<ide> - [Creating a New Application][new-app]
<ide> - [Adding React Native to an Existing Application][existing]
<ide>
<del>[hello-world]: https://snack.expo.dev/@hramos/hello,-world!
<add>[hello-world]: https://snack.expo.dev/@samples/hello-world
<ide> [new-app]: https://reactnative.dev/docs/getting-started
<ide> [existing]: https://reactnative.dev/docs/integration-with-existing-apps
<ide> | 1 |
Ruby | Ruby | remove expansion config | f167e24e1384380a849da27de0c762ec71ffcd16 | <ide><path>actionpack/lib/action_view/railtie.rb
<ide> module ActionView
<ide> # = Action View Railtie
<ide> class Railtie < Rails::Railtie
<ide> config.action_view = ActiveSupport::OrderedOptions.new
<del> config.action_view.stylesheet_expansions = {}
<del> config.action_view.javascript_expansions = { :defaults => %w(jquery jquery_ujs) }
<ide> config.action_view.embed_authenticity_token_in_remote_forms = false
<ide>
<ide> config.eager_load_namespaces << ActionView | 1 |
Python | Python | fix initializers and update ops | 8e23a3ec47a2ccbf6cdd222a80886c6b9f17264f | <ide><path>keras/backend/tensorflow_backend.py
<ide> from tensorflow.python.ops import ctc_ops as ctc
<ide> from .common import floatx, epsilon, image_data_format
<ide>
<add>import sys
<ide> import functools
<ide> import threading
<ide>
<ide> def update(x, new_x):
<ide> # Returns
<ide> The variable `x` updated.
<ide> """
<del> return tf_state_ops.assign(x, new_x)
<add> op = tf_state_ops.assign(x, new_x)
<add> with tf.control_dependencies([op]):
<add> return tf.identity(x)
<ide>
<ide>
<ide> @symbolic
<ide> def update_add(x, increment):
<ide> # Returns
<ide> The variable `x` updated.
<ide> """
<del> return tf_state_ops.assign_add(x, increment)
<add> op = tf_state_ops.assign_add(x, increment)
<add> with tf.control_dependencies([op]):
<add> return tf.identity(x)
<ide>
<ide>
<ide> @symbolic
<ide> def update_sub(x, decrement):
<ide> # Returns
<ide> The variable `x` updated.
<ide> """
<del> return tf_state_ops.assign_sub(x, decrement)
<add> op = tf_state_ops.assign_sub(x, decrement)
<add> with tf.control_dependencies([op]):
<add> return tf.identity(x)
<ide>
<ide>
<ide> @symbolic
<ide> def get_variable_shape(x):
<ide> return int_shape(x)
<ide>
<ide>
<add>@symbolic
<ide> def print_tensor(x, message=''):
<ide> """Prints `message` and the tensor value when evaluated.
<ide>
<ide> def print_tensor(x, message=''):
<ide> # Returns
<ide> The same tensor `x`, unchanged.
<ide> """
<del> # TODO
<del> return tf.Print(x, [x], message)
<add> op = tf.print(message, x, output_stream=sys.stdout)
<add> with tf.control_dependencies([op]):
<add> return tf.identity(x)
<ide>
<ide>
<ide> # GRAPH MANIPULATION
<ide><path>keras/backend/theano_backend.py
<ide> def get_variable_shape(x):
<ide>
<ide>
<ide> def print_tensor(x, message=''):
<del> """Print the message and the tensor when evaluated and return the same
<del> tensor.
<add> """Print the message & the tensor when evaluated & return the same tensor.
<ide> """
<ide> p_op = Print(message)
<ide> return p_op(x)
<ide><path>keras/initializers.py
<ide> def __init__(self, mean=0., stddev=0.05, seed=None):
<ide> self.seed = seed
<ide>
<ide> def __call__(self, shape, dtype=None):
<del> return K.random_normal(shape, self.mean, self.stddev,
<del> dtype=dtype, seed=self.seed)
<add> x = K.random_normal(shape, self.mean, self.stddev,
<add> dtype=dtype, seed=self.seed)
<add> if self.seed is not None:
<add> self.seed += 1
<add> return x
<ide>
<ide> def get_config(self):
<ide> return {
<ide> def __init__(self, minval=-0.05, maxval=0.05, seed=None):
<ide> self.seed = seed
<ide>
<ide> def __call__(self, shape, dtype=None):
<del> return K.random_uniform(shape, self.minval, self.maxval,
<del> dtype=dtype, seed=self.seed)
<add> x = K.random_uniform(shape, self.minval, self.maxval,
<add> dtype=dtype, seed=self.seed)
<add> if self.seed is not None:
<add> self.seed += 1
<add> return x
<ide>
<ide> def get_config(self):
<ide> return {
<ide> def __init__(self, mean=0., stddev=0.05, seed=None):
<ide> self.seed = seed
<ide>
<ide> def __call__(self, shape, dtype=None):
<del> return K.truncated_normal(shape, self.mean, self.stddev,
<del> dtype=dtype, seed=self.seed)
<add> x = K.truncated_normal(shape, self.mean, self.stddev,
<add> dtype=dtype, seed=self.seed)
<add> if self.seed is not None:
<add> self.seed += 1
<add> return x
<ide>
<ide> def get_config(self):
<ide> return {
<ide> def __call__(self, shape, dtype=None):
<ide> if self.distribution == 'normal':
<ide> # 0.879... = scipy.stats.truncnorm.std(a=-2, b=2, loc=0., scale=1.)
<ide> stddev = np.sqrt(scale) / .87962566103423978
<del> return K.truncated_normal(shape, 0., stddev,
<del> dtype=dtype, seed=self.seed)
<add> x = K.truncated_normal(shape, 0., stddev,
<add> dtype=dtype, seed=self.seed)
<ide> else:
<ide> limit = np.sqrt(3. * scale)
<del> return K.random_uniform(shape, -limit, limit,
<del> dtype=dtype, seed=self.seed)
<add> x = K.random_uniform(shape, -limit, limit,
<add> dtype=dtype, seed=self.seed)
<add> if self.seed is not None:
<add> self.seed += 1
<add> return x
<ide>
<ide> def get_config(self):
<ide> return {
<ide> def __call__(self, shape, dtype=None):
<ide> rng = np.random
<ide> if self.seed is not None:
<ide> rng = np.random.RandomState(self.seed)
<add> self.seed += 1
<ide> a = rng.normal(0.0, 1.0, flat_shape)
<ide> u, _, v = np.linalg.svd(a, full_matrices=False)
<ide> # Pick the one with the correct shape.
<ide><path>tests/keras/backend/backend_test.py
<ide> def test_value_manipulation(self, function_name):
<ide> else:
<ide> assert_list_pairwise(v_list, shape=False, allclose=False, itself=True)
<ide>
<del> def test_print_tensor(self):
<add> def test_print_tensor(self, capsys):
<add> for k in [KTH, KTF]:
<add> x = k.placeholder((1, 1))
<add> y = k.print_tensor(x, 'msg')
<add> fn = k.function([x], [y])
<add> _ = fn([np.ones((1, 1))])
<add> out, err = capsys.readouterr()
<add> # Theano inserts "__str__ = " for no good reason
<add> assert out.replace('__str__ = ', '') == 'msg [[1.]]\n'
<add>
<ide> check_single_tensor_operation('print_tensor', (), WITH_NP)
<ide> check_single_tensor_operation('print_tensor', (2,), WITH_NP)
<del> check_single_tensor_operation('print_tensor', (4, 3), WITH_NP)
<del> check_single_tensor_operation('print_tensor', (1, 2, 3), WITH_NP)
<ide>
<ide> def test_elementwise_operations(self):
<ide> check_single_tensor_operation('max', (4, 2), WITH_NP)
<ide> def test_cumsum_cumprod(self):
<ide> def test_log(self):
<ide> check_single_tensor_operation('log', (4, 2), WITH_NP)
<ide>
<add> @pytest.mark.skipif(K.backend() == 'theano',
<add> reason='theano returns tuples for update ops')
<add> def test_update(self):
<add> x = np.ones((3, 4))
<add> x_var = K.variable(x)
<add> new_x = np.random.random((3, 4))
<add>
<add> op = K.update(x_var, new_x)
<add> K.eval(op)
<add>
<add> assert_allclose(new_x, K.eval(x_var), atol=1e-05)
<add>
<ide> @pytest.mark.skipif(K.backend() == 'theano',
<ide> reason='theano returns tuples for update ops')
<ide> def test_update_add(self):
<del> x = np.random.randn(3, 4)
<add> x = np.ones((3, 4))
<ide> x_var = K.variable(x)
<del> increment = np.random.randn(3, 4)
<add> increment = np.random.random((3, 4))
<ide>
<del> x += increment
<del> K.eval(K.update_add(x_var, increment))
<add> op = K.update_add(x_var, increment)
<add> K.eval(op)
<ide>
<del> assert_allclose(x, K.eval(x_var), atol=1e-05)
<add> assert_allclose(x + increment, K.eval(x_var), atol=1e-05)
<ide>
<ide> @pytest.mark.skipif(K.backend() == 'theano',
<ide> reason='theano returns tuples for update ops')
<ide> def test_update_sub(self):
<del> x = np.random.randn(3, 4)
<add> x = np.ones((3, 4))
<ide> x_var = K.variable(x)
<del> decrement = np.random.randn(3, 4)
<add> decrement = np.random.random((3, 4))
<ide>
<del> x -= decrement
<del> K.eval(K.update_sub(x_var, decrement))
<add> op = K.update_sub(x_var, decrement)
<add> K.eval(op)
<ide>
<del> assert_allclose(x, K.eval(x_var), atol=1e-05)
<add> assert_allclose(x - decrement, K.eval(x_var), atol=1e-05)
<ide>
<ide> @pytest.mark.skipif(K.backend() == 'cntk',
<ide> reason='cntk doesn\'t support gradient in this way.')
<ide> def test_function_tf_feed_dict(self):
<ide> assert output == [21.]
<ide> assert K.get_session().run(fetches=[x, y]) == [30., 40.]
<ide>
<del> @pytest.mark.skipif(K.backend() != 'tensorflow',
<add> @pytest.mark.skipif(K.backend() != 'tensorflow' or not KTF._is_tf_1(),
<ide> reason='Uses the `options` and `run_metadata` arguments.')
<ide> def test_function_tf_run_options_with_run_metadata(self):
<ide> from tensorflow.core.protobuf import config_pb2
<ide> def test_separable_conv(self,
<ide> assert_allclose(y1, y2, atol=1e-05)
<ide>
<ide> def test_random_normal(self):
<del> # test standard normal as well as a normal with a different set of parameters
<add> # TODO: make this a parameterized test
<ide> for mean, std in [(0., 1.), (-10., 5.)]:
<del> rand = K.eval(K.random_normal((300, 200),
<del> mean=mean, stddev=std, seed=1337))
<del> assert rand.shape == (300, 200)
<add> rand = K.eval(K.random_normal((200, 200),
<add> mean=mean,
<add> stddev=std))
<add> assert rand.shape == (200, 200)
<ide> assert np.abs(np.mean(rand) - mean) < std * 0.015
<ide> assert np.abs(np.std(rand) - std) < std * 0.015
<ide>
<del> # test that random_normal also generates different values when used
<del> # within a function
<del> r = K.random_normal((10, 10), mean=mean, stddev=std, seed=1337)
<del> samples = np.array([K.eval(r) for _ in range(200)])
<del> assert np.abs(np.mean(samples) - mean) < std * 0.015
<del> assert np.abs(np.std(samples) - std) < std * 0.015
<del>
<ide> def test_random_uniform(self):
<ide> min_val = -1.
<ide> max_val = 1.
<del> rand = K.eval(K.random_uniform((200, 100), min_val, max_val))
<del> assert rand.shape == (200, 100)
<add> rand = K.eval(K.random_uniform((200, 200), min_val, max_val))
<add> assert rand.shape == (200, 200)
<ide> assert np.abs(np.mean(rand)) < 0.015
<ide> assert max_val - 0.015 < np.max(rand) <= max_val
<ide> assert min_val + 0.015 > np.min(rand) >= min_val
<ide>
<del> r = K.random_uniform((10, 10), minval=min_val, maxval=max_val)
<del> samples = np.array([K.eval(r) for _ in range(200)])
<del> assert np.abs(np.mean(samples)) < 0.015
<del> assert max_val - 0.015 < np.max(samples) <= max_val
<del> assert min_val + 0.015 > np.min(samples) >= min_val
<del>
<ide> def test_random_binomial(self):
<ide> p = 0.5
<del> rand = K.eval(K.random_binomial((200, 100), p))
<del> assert rand.shape == (200, 100)
<add> rand = K.eval(K.random_binomial((200, 200), p))
<add> assert rand.shape == (200, 200)
<ide> assert np.abs(np.mean(rand) - p) < 0.015
<ide> assert np.max(rand) == 1
<ide> assert np.min(rand) == 0
<ide>
<del> r = K.random_binomial((10, 10), p)
<del> samples = np.array([K.eval(r) for _ in range(200)])
<del> assert np.abs(np.mean(samples) - p) < 0.015
<del> assert np.max(samples) == 1
<del> assert np.min(samples) == 0
<del>
<ide> def test_truncated_normal(self):
<ide> mean = 0.
<ide> std = 1.
<ide> min_val = -2.
<ide> max_val = 2.
<del> rand = K.eval(K.truncated_normal((300, 200),
<del> mean=mean, stddev=std, seed=1337))
<del> assert rand.shape == (300, 200)
<add> rand = K.eval(K.truncated_normal((200, 200),
<add> mean=mean,
<add> stddev=std))
<add> assert rand.shape == (200, 200)
<ide> assert np.abs(np.mean(rand) - mean) < 0.015
<ide> assert np.max(rand) <= max_val
<ide> assert np.min(rand) >= min_val
<ide> def test_clip_supports_tensor_arguments(self):
<ide> np.asarray([-5., -4., 0., 4., 9.],
<ide> dtype=np.float32))
<ide>
<del> @pytest.mark.skipif(K.backend() != 'tensorflow' or KTF._is_tf_1(),
<del> reason='This test is for tensorflow parallelism.')
<del> def test_tensorflow_session_parallelism_settings(self, monkeypatch):
<del> for threads in [1, 2]:
<del> K.clear_session()
<del> monkeypatch.setenv('OMP_NUM_THREADS', str(threads))
<del> cfg = K.get_session()._config
<del> assert cfg.intra_op_parallelism_threads == threads
<del> assert cfg.inter_op_parallelism_threads == threads
<del>
<ide>
<ide> if __name__ == '__main__':
<ide> pytest.main([__file__])
<ide><path>tests/keras/initializers_test.py
<ide> def test_one(tensor_shape):
<ide> target_mean=1., target_max=1.)
<ide>
<ide>
<add>@pytest.mark.parametrize('initializer',
<add> [initializers.orthogonal,
<add> initializers.uniform,
<add> initializers.normal,
<add> initializers.truncated_normal,
<add> initializers.VarianceScaling],
<add> ids=['orthogonal',
<add> 'uniform',
<add> 'normal',
<add> 'truncated_normal',
<add> 'variance_scaling'])
<add>def test_statefulness(initializer):
<add> # Test that calling a same seeded random initializer
<add> # in succession results in different values.
<add> init = initializer(seed=1337)
<add> samples = [init((2, 2)) for _ in range(2)]
<add> samples = [K.get_value(K.variable(x)) for x in samples]
<add> assert np.mean(np.abs(samples[0] - samples[1])) > 0.
<add>
<add>
<ide> if __name__ == '__main__':
<ide> pytest.main([__file__]) | 5 |
Javascript | Javascript | use array lookup for localized dependency ids | 242bc6928faab1305be3a420860a7f4a07348889 | <ide><path>packager/react-packager/src/JSTransformer/worker/__tests__/inline-test.js
<ide> describe('inline constants', () => {
<ide> });
<ide>
<ide> it('can work with transformed require calls', () => {
<del> const code = `__arbitrary(function() {
<del> var a = require(123, 'react-native').Platform.OS;
<add> const code = `__arbitrary(require, function(arbitraryMapName) {
<add> var a = require(arbitraryMapName[123], 'react-native').Platform.OS;
<ide> });`;
<ide> const {ast} = inline(
<ide> 'arbitrary', {code}, {dev: true, platform: 'android', isWrapped: true});
<ide><path>packager/react-packager/src/JSTransformer/worker/collect-dependencies.js
<ide> class Replacement {
<ide> );
<ide> }
<ide>
<del> getIndex(name) {
<add> getIndex(stringLiteral) {
<add> const name = stringLiteral.value;
<ide> let index = this.nameToIndex.get(name);
<ide> if (index !== undefined) {
<ide> return index;
<ide> class Replacement {
<ide> return Array.from(this.nameToIndex.keys());
<ide> }
<ide>
<del> makeArgs(newId, oldId) {
<del> return [newId, oldId];
<add> makeArgs(newId, oldId, dependencyMapIdentifier) {
<add> const mapLookup = createMapLookup(dependencyMapIdentifier, newId);
<add> return [mapLookup, oldId];
<ide> }
<ide> }
<ide>
<ide> class ProdReplacement {
<ide>
<ide> isRequireCall(callee, firstArg) {
<ide> return (
<del> callee.type === 'Identifier' && callee.name === 'require' &&
<del> firstArg && firstArg.type === 'NumericLiteral'
<add> callee.type === 'Identifier' &&
<add> callee.name === 'require' &&
<add> firstArg &&
<add> firstArg.type === 'MemberExpression' &&
<add> firstArg.property &&
<add> firstArg.property.type === 'NumericLiteral'
<ide> );
<ide> }
<ide>
<del> getIndex(id) {
<add> getIndex(memberExpression) {
<add> const id = memberExpression.property.value;
<ide> if (id in this.names) {
<del> return this.replacement.getIndex(this.names[id]);
<add> return this.replacement.getIndex({value: this.names[id]});
<ide> }
<ide>
<ide> throw new Error(
<ide> class ProdReplacement {
<ide> return this.replacement.getNames();
<ide> }
<ide>
<del> makeArgs(newId) {
<del> return [newId];
<add> makeArgs(newId, _, dependencyMapIdentifier) {
<add> const mapLookup = createMapLookup(dependencyMapIdentifier, newId);
<add> return [mapLookup];
<ide> }
<ide> }
<ide>
<del>function collectDependencies(ast, replacement) {
<add>function createMapLookup(dependencyMapIdentifier, propertyIdentifier) {
<add> return types.memberExpression(
<add> dependencyMapIdentifier,
<add> propertyIdentifier,
<add> true,
<add> );
<add>}
<add>
<add>function collectDependencies(ast, replacement, dependencyMapIdentifier) {
<add> const traversalState = {dependencyMapIdentifier};
<ide> traverse(ast, {
<del> CallExpression(path) {
<add> Program(path, state) {
<add> if (!state.dependencyMapIdentifier) {
<add> state.dependencyMapIdentifier =
<add> path.scope.generateUidIdentifier('dependencyMap');
<add> }
<add> },
<add> CallExpression(path, state) {
<ide> const node = path.node;
<ide> const arg = node.arguments[0];
<ide> if (replacement.isRequireCall(node.callee, arg)) {
<del> const index = replacement.getIndex(arg.value);
<del> node.arguments = replacement.makeArgs(types.numericLiteral(index), arg);
<add> const index = replacement.getIndex(arg);
<add> node.arguments = replacement.makeArgs(
<add> types.numericLiteral(index),
<add> arg,
<add> state.dependencyMapIdentifier,
<add> );
<ide> }
<del> }
<del> });
<add> },
<add> }, null, traversalState);
<ide>
<del> return replacement.getNames();
<add> return {
<add> dependencies: replacement.getNames(),
<add> dependencyMapName: traversalState.dependencyMapIdentifier.name,
<add> };
<ide> }
<ide>
<ide> exports = module.exports =
<ide> ast => collectDependencies(ast, new Replacement());
<ide> exports.forOptimization =
<del> (ast, names) => collectDependencies(ast, new ProdReplacement(names));
<add> (ast, names, dependencyMapName) => collectDependencies(
<add> ast,
<add> new ProdReplacement(names),
<add> dependencyMapName && types.identifier(dependencyMapName),
<add> );
<ide><path>packager/react-packager/src/JSTransformer/worker/inline.js
<ide> const plugin = () => inlinePlugin;
<ide> function checkRequireArgs(args, dependencyId) {
<ide> const pattern = t.stringLiteral(dependencyId);
<ide> return t.isStringLiteral(args[0], pattern) ||
<del> t.isNumericLiteral(args[0]) && t.isStringLiteral(args[1], pattern);
<add> t.isMemberExpression(args[0]) &&
<add> t.isNumericLiteral(args[0].property) &&
<add> t.isStringLiteral(args[1], pattern);
<ide> }
<ide>
<ide> type AstResult = {
<ide><path>packager/react-packager/src/ModuleGraph/worker.js
<ide> function optimizeModule(
<ide> }
<ide>
<ide> function makeResult(ast, filename, sourceCode, isPolyfill = false) {
<del> const dependencies = isPolyfill ? [] : collectDependencies(ast);
<del> const file = isPolyfill ? wrapPolyfill(ast) : wrapModule(ast);
<add> const {dependencies, dependencyMapName} = isPolyfill
<add> ? {dependencies: []}
<add> : collectDependencies(ast);
<add> const file = isPolyfill
<add> ? wrapPolyfill(ast)
<add> : wrapModule(ast, dependencyMapName);
<ide>
<ide> const gen = generate(file, filename, sourceCode);
<del> return {code: gen.code, map: gen.map, dependencies};
<add> return {code: gen.code, map: gen.map, dependencies, dependencyMapName};
<ide> }
<ide>
<del>function wrapModule(file) {
<add>function wrapModule(file, dependencyMapName) {
<ide> const t = babel.types;
<del> const factory = functionFromProgram(file.program, moduleFactoryParameters);
<add> const params = moduleFactoryParameters.concat(dependencyMapName);
<add> const factory = functionFromProgram(file.program, params);
<ide> const def = t.callExpression(t.identifier('__d'), [factory]);
<ide> return t.file(t.program([t.expressionStatement(def)]));
<ide> }
<ide> function optimize(transformed, file, originalCode, options) {
<ide> : collectDependencies.forOptimization(
<ide> optimized.ast,
<ide> transformed.dependencies,
<add> transformed.dependencyMapName,
<ide> );
<ide>
<ide> const inputMap = transformed.map; | 4 |
Javascript | Javascript | provide profiling bundle for react-reconciler | b8fa09e9e2b52d46e47ad604ef7c8c3529471b71 | <ide><path>scripts/rollup/bundles.js
<ide> const bundles = [
<ide>
<ide> /******* React Reconciler *******/
<ide> {
<del> bundleTypes: [NODE_DEV, NODE_PROD],
<add> bundleTypes: [NODE_DEV, NODE_PROD, NODE_PROFILING],
<ide> moduleType: RECONCILER,
<ide> entry: 'react-reconciler',
<ide> global: 'ReactReconciler',
<ide><path>scripts/rollup/wrappers.js
<ide> module.exports = function $$$reconciler($$$hostConfig) {
<ide> var exports = {};
<ide> ${source}
<ide> return exports;
<add>};`;
<add> },
<add>
<add> /***************** NODE_PROFILING (reconciler only) *****************/
<add> [NODE_PROFILING](source, globalName, filename, moduleType) {
<add> return `/** @license React v${reactVersion}
<add> * ${filename}
<add> *
<add>${license}
<add> */
<add>module.exports = function $$$reconciler($$$hostConfig) {
<add> var exports = {};
<add>${source}
<add> return exports;
<ide> };`;
<ide> },
<ide> }; | 2 |
Ruby | Ruby | fix 2nd typo in cleaner.rb | 8457fa5af5770cd940e83b804567a3cf5d7b05a9 | <ide><path>Library/Homebrew/cleaner.rb
<ide> def observe_file_removal(path)
<ide> end
<ide>
<ide> # Removes any empty directories in the formula's prefix subtree
<del> # Keeps any empty directions protected by skip_clean
<add> # Keeps any empty directories protected by skip_clean
<ide> # Removes any unresolved symlinks
<ide> def prune
<ide> dirs = [] | 1 |
Python | Python | add providers file for dns api | cabb881d062460c88eee45f8f22020b281cfb4b6 | <ide><path>libcloud/dns/providers.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.utils import get_driver as get_provider_driver
<add>from libcloud.dns.types import Provider
<add>
<add>DRIVERS = {
<add> Provider.DUMMY:
<add> ('libcloud.dns.drivers.dummy', 'DummyDNSDriver'),
<add> Provider.LINODE:
<add> ('libcloud.dns.drivers.linode', 'LinodeDNSDriver')
<add>}
<add>
<add>
<add>def get_driver(provider):
<add> return get_provider_driver(DRIVERS, provider) | 1 |
Go | Go | check syslog config on daemon start | 960791ba60621ef2b182379e7b237e681b602694 | <ide><path>daemon/logger/syslog/syslog.go
<ide> func ValidateLogOpt(cfg map[string]string) error {
<ide> return fmt.Errorf("unknown log opt '%s' for syslog log driver", key)
<ide> }
<ide> }
<add> if _, _, err := parseAddress(cfg["syslog-address"]); err != nil {
<add> return err
<add> }
<add> if _, err := parseFacility(cfg["syslog-facility"]); err != nil {
<add> return err
<add> }
<ide> return nil
<ide> }
<ide>
<ide><path>integration-cli/docker_cli_daemon_test.go
<ide> func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlway
<ide> c.Assert(err, check.IsNil)
<ide> c.Assert(strings.TrimSpace(out), check.Equals, id[:12])
<ide> }
<add>
<add>func (s *DockerDaemonSuite) TestDaemonCorruptedSyslogAddress(c *check.C) {
<add> c.Assert(s.d.Start("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:1234"), check.NotNil)
<add> runCmd := exec.Command("grep", "Failed to set log opts: syslog-address should be in form proto://address", s.d.LogfileName())
<add> if out, _, err := runCommandWithOutput(runCmd); err != nil {
<add> c.Fatalf("Expected 'Error starting daemon' message; but doesn't exist in log: %q, err: %v", out, err)
<add> }
<add>} | 2 |
Javascript | Javascript | add scheduleonce and remove flag | 0be5c862660e284a86ec35306da85325571987f3 | <ide><path>packages/ember-metal/lib/run_loop.js
<ide> function invokeOnceTimer(guid, onceTimers) {
<ide> delete timers[guid];
<ide> }
<ide>
<add>function scheduleOnce(queue, target, method, args) {
<add> var tguid = Ember.guidFor(target),
<add> mguid = Ember.guidFor(method),
<add> onceTimers = run.autorun().onceTimers,
<add> guid = onceTimers[tguid] && onceTimers[tguid][mguid],
<add> timer;
<add>
<add> if (guid && timers[guid]) {
<add> timers[guid].args = args; // replace args
<add> } else {
<add> timer = {
<add> target: target,
<add> method: method,
<add> args: args,
<add> tguid: tguid,
<add> mguid: mguid
<add> };
<add>
<add> guid = Ember.guidFor(timer);
<add> timers[guid] = timer;
<add> if (!onceTimers[tguid]) { onceTimers[tguid] = {}; }
<add> onceTimers[tguid][mguid] = guid; // so it isn't scheduled more than once
<add>
<add> run.schedule(queue, timer, invokeOnceTimer, guid, onceTimers);
<add> }
<add>
<add> return guid;
<add>}
<add>
<ide> /**
<ide> Schedules an item to run one time during the current RunLoop. Calling
<ide> this method with the same target/method combination will have no effect.
<ide> function invokeOnceTimer(guid, onceTimers) {
<ide> @returns {Object} timer
<ide> */
<ide> Ember.run.once = function(target, method) {
<del> var tguid = Ember.guidFor(target),
<del> mguid = Ember.guidFor(method),
<del> onceTimers = run.autorun().onceTimers,
<del> guid = onceTimers[tguid] && onceTimers[tguid][mguid],
<del> timer;
<del>
<del> if (guid && timers[guid]) {
<del> timers[guid].args = slice.call(arguments); // replace args
<del> } else {
<del> timer = {
<del> target: target,
<del> method: method,
<del> args: slice.call(arguments),
<del> tguid: tguid,
<del> mguid: mguid
<del> };
<del>
<del> guid = Ember.guidFor(timer);
<del> timers[guid] = timer;
<del> if (!onceTimers[tguid]) { onceTimers[tguid] = {}; }
<del> onceTimers[tguid][mguid] = guid; // so it isn't scheduled more than once
<del>
<del> run.schedule('actions', timer, invokeOnceTimer, guid, onceTimers);
<del> }
<add> return scheduleOnce('actions', target, method, slice.call(arguments));
<add>};
<ide>
<del> return guid;
<add>Ember.run.scheduleOnce = function(queue, target, method) {
<add> return scheduleOnce(queue, target, method, slice.call(arguments));
<ide> };
<ide>
<ide> var scheduledNext;
<ide><path>packages/ember-views/lib/views/container_view.js
<ide> Ember.ContainerView = Ember.View.extend({
<ide> if (currentView) {
<ide> childViews.pushObject(currentView);
<ide> }
<del> }, 'currentView')
<add> }, 'currentView'),
<add>
<add> _ensureChildrenAreInDOM: function () {
<add> this.invokeForState('ensureChildrenAreInDOM', this);
<add> }
<ide> });
<ide>
<ide> // Ember.ContainerView extends the default view states to provide different
<ide> Ember.ContainerView.states = {
<ide> },
<ide>
<ide> childViewsDidChange: function(view, views, start, added) {
<del> if (!view._ensureChildrenAreInDOMScheduled) {
<del> view._ensureChildrenAreInDOMScheduled = true;
<del> Ember.run.schedule('render', this, this.invokeForState, 'ensureChildrenAreInDOM', view);
<del> }
<add> Ember.run.scheduleOnce('render', this, '_ensureChildrenAreInDOM');
<ide> },
<ide>
<ide> ensureChildrenAreInDOM: function(view) {
<del> view._ensureChildrenAreInDOMScheduled = false;
<ide> var childViews = view.get('childViews'), i, len, childView, previous, buffer;
<ide> for (i = 0, len = childViews.length; i < len; i++) {
<ide> childView = childViews[i]; | 2 |
Go | Go | pass unix paths to testrunnodupvolumes | db1f8f7481a825a921295adea36d2e56ee8703ae | <ide><path>integration-cli/docker_cli_run_test.go
<ide> func TestVolumesFromGetsProperMode(t *testing.T) {
<ide> func TestRunNoDupVolumes(t *testing.T) {
<ide> defer deleteAllContainers()
<ide>
<del> bindPath1, err := ioutil.TempDir("", "test1")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer os.Remove(bindPath1)
<del>
<del> bindPath2, err := ioutil.TempDir("", "test2")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer os.Remove(bindPath2)
<del>
<del> mountstr1 := bindPath1 + ":/someplace"
<del> mountstr2 := bindPath2 + ":/someplace"
<add> mountstr1 := randomUnixTmpDirPath("test1") + ":/someplace"
<add> mountstr2 := randomUnixTmpDirPath("test2") + ":/someplace"
<ide>
<ide> cmd := exec.Command(dockerBinary, "run", "-v", mountstr1, "-v", mountstr2, "busybox", "true")
<ide> if out, _, err := runCommandWithOutput(cmd); err == nil { | 1 |
PHP | PHP | fix strict errors | 5936fa5930ef4a86115f74ac9586c7251c8b9e71 | <ide><path>lib/Cake/Utility/ObjectCollection.php
<ide> public function trigger($callback, $params = array(), $options = array()) {
<ide> $options[$opt] = $event->{$opt};
<ide> }
<ide> }
<del> $callback = array_pop(explode('.', $event->name()));
<add> $parts = explode('.', $event->name());
<add> $callback = array_pop($parts);
<ide> }
<ide> $options = array_merge(
<ide> array( | 1 |
Javascript | Javascript | fix strict mode violoation in test | f9c393f4fb32a1263dd64eda347bba81e40473cb | <ide><path>src/core/__tests__/ReactComponentLifeCycle-test.js
<ide> describe('ReactComponentLifeCycle', function() {
<ide> }
<ide> });
<ide> expect(function() {
<del> instance = ReactTestUtils.renderIntoDocument(<StatefulComponent />);
<add> ReactTestUtils.renderIntoDocument(<StatefulComponent />);
<ide> }).toThrow(
<ide> 'Invariant Violation: setState(...): Can only update a mounted or ' +
<del> 'mounting component. This usually means you called setState() on an ' +
<add> 'mounting component. This usually means you called setState() on an ' +
<ide> 'unmounted component.'
<ide> );
<ide> }); | 1 |
Javascript | Javascript | use latest safari in browserstack tests | 8cc453f21d243b37137e092087620db8e0a21e3d | <ide><path>testem.browserstack.js
<ide> const BrowserStackLaunchers = {
<ide> '--os',
<ide> 'OS X',
<ide> '--osv',
<del> 'Mojave',
<add> 'Big Sur',
<ide> '--b',
<ide> 'safari',
<ide> '--bv', | 1 |
Python | Python | add 3er line | d2e525abe1fc0e66686c4268130b6cd9fc941d5e | <ide><path>glances/plugins/glances_processlist.py
<ide> def msg_curse(self, args=None):
<ide>
<ide> # Add extended stats but only for the top processes
<ide> # !!! CPU consumption !!!!
<del> if first:
<add> if first and p['extended_stats']:
<ide> # Left padding
<ide> xpad = ' ' * 13
<ide> # First line is CPU affinity
<ide> def msg_curse(self, args=None):
<ide> # Second line is memory info
<ide> ret.append(self.curse_new_line())
<ide> msg = xpad + _('Memory info: ')
<del> msg += _('swap ') + self.auto_unit(p['memory_swap'], low_precision=False)
<ide> for k, v in p['memory_info_ex']._asdict().items():
<ide> # Ignore rss and vms (already displayed)
<del> if k not in ['rss', 'vms']:
<del> msg += ', ' + k + ' ' + self.auto_unit(v, low_precision=False)
<add> if k not in ['rss', 'vms'] and v is not None:
<add> msg += k + ' ' + self.auto_unit(v, low_precision=False) + ' '
<add> if p['memory_swap'] is not None:
<add> msg += _('swap ') + self.auto_unit(p['memory_swap'], low_precision=False)
<add> ret.append(self.curse_add_line(msg))
<add> # Third line is for openned files/network sessions
<add> ret.append(self.curse_new_line())
<add> msg = xpad + _('Openned: ')
<add> if p['num_threads'] is not None:
<add> msg += _('threads ') + str(p['num_threads']) + ' '
<add> if p['num_fds'] is not None:
<add> msg += _('files ') + str(p['num_fds']) + ' '
<add> if p['tcp'] is not None:
<add> msg += _('TCP ') + str(p['tcp']) + ' '
<add> if p['tcp'] is not None:
<add> msg += _('UDP ') + str(p['udp']) + ' '
<ide> ret.append(self.curse_add_line(msg))
<ide> # End of extended stats
<ide> first = False | 1 |
Ruby | Ruby | add xcode to the blacklist | 6ab97f75be351e06aea97355dee043912d549364 | <ide><path>Library/Homebrew/blacklist.rb
<ide> def blacklisted? name
<ide> EOS
<ide> when /(lib)?lzma/
<ide> "lzma is now part of the xz formula."
<add> when 'xcode' then <<-EOS.undent
<add> Xcode can be installed via the App Store (on Lion), or from:
<add> http://connect.apple.com/
<add>
<add> If you download from the App Store, make sure you run the installer
<add> placed in /Applications after the download completes.
<add> EOS
<ide> end
<ide> end | 1 |
Ruby | Ruby | update error message for validate method | a91b36f6eb502e91c9e3e2e8d3db26abc56696cf | <ide><path>activemodel/lib/active_model/validations.rb
<ide> def validates_each(*attr_names, &block)
<ide> # value.
<ide> def validate(*args, &block)
<ide> options = args.extract_options!
<add> valid_keys = [:on, :if, :unless]
<ide>
<ide> if args.all? { |arg| arg.is_a?(Symbol) }
<del> options.assert_valid_keys([:on, :if, :unless])
<add> options.each_key do |k|
<add> unless valid_keys.include?(k)
<add> raise ArgumentError.new("Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}. Perhaps you meant to call validates instead of validate.")
<add> end
<add> end
<ide> end
<ide>
<ide> if options.key?(:on) | 1 |
Text | Text | fix text to follow portuguese language syntax | f99d3ee779d1ff6dd587d21036c66a508819a72e | <ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-shrink-property-to-shrink-items.portuguese.md
<ide> localeTitle: Use a propriedade flex-shrink para reduzir os itens
<ide> ---
<ide>
<ide> ## Description
<del><section id="description"> Atรฉ agora, todas as propriedades nos desafios se aplicam ao contรชiner flex (pai dos itens flex). No entanto, existem vรกrias propriedades รบteis para os itens flexรญveis. A primeira รฉ a propriedade <code>flex-shrink</code> . Quando รฉ usado, permite que um item encolha se o contรชiner flexรญvel for muito pequeno. Os itens diminuem quando a largura do contรชiner pai รฉ menor que as larguras combinadas de todos os itens flexรญveis dentro dele. A propriedade <code>flex-shrink</code> recebe nรบmeros como valores. Quanto maior o nรบmero, mais ele serรก reduzido em comparaรงรฃo com os outros itens no contรชiner. Por exemplo, se um item tiver um valor <code>flex-shrink</code> de 1 e o outro tiver um valor <code>flex-shrink</code> de 3, aquele com o valor de 3 diminuirรก trรชs vezes mais do que o outro. </section>
<add><section id="description"> Atรฉ agora, todas as propriedades nos desafios se aplicam ao contรชiner flex (pai dos itens flex). No entanto, existem vรกrias propriedades รบteis para os itens flex.
<add>A primeira รฉ a propriedade <code>flex-shrink</code> . Quando usado, permite que um item encolha se o contรชiner flexรญvel for muito pequeno. Os itens diminuem quando a largura do contรชiner pai รฉ menor que as larguras combinadas de todos os itens flexรญveis dentro dele.
<add>A propriedade <code>flex-shrink</code> recebe nรบmeros como valores. Quanto maior o nรบmero, mais ele serรก reduzido em comparaรงรฃo com os outros itens no contรชiner. Por exemplo, se um item tiver um valor <code>flex-shrink</code> de 1 e o outro tiver um valor <code>flex-shrink</code> de 3, aquele com o valor de 3 diminuirรก trรชs vezes mais do que o outro. </section>
<ide>
<ide> ## Instructions
<del><section id="instructions"> Adicione o <code>flex-shrink</code> propriedade CSS a <code>#box-1</code> e <code>#box-2</code> . Dรช <code>#box-1</code> um valor de 1 e <code>#box-2</code> um valor de 2. </section>
<add><section id="instructions"> Adicione a propriedade CSS <code>flex-shrink</code> a ambos <code>#box-1</code> e <code>#box-2</code> . Dรช a <code>#box-1</code> um valor de 1 e a <code>#box-2</code> um valor de 2. </section>
<ide>
<ide> ## Tests
<ide> <section id='tests'>
<ide>
<ide> ```yml
<ide> tests:
<del> - text: 'O elemento <code>#box-1</code> deve ter a propriedade <code>flex-shrink</code> definida como um valor de 1.'
<add> - text: 'O elemento <code>#box-1</code> deve ter a propriedade <code>flex-shrink</code> definida com um valor de 1.'
<ide> testString: 'assert($("#box-1").css("flex-shrink") == "1", "The <code>#box-1</code> element should have the <code>flex-shrink</code> property set to a value of 1.");'
<del> - text: 'O elemento <code>#box-2</code> deve ter a propriedade <code>flex-shrink</code> definida como um valor de 2.'
<add> - text: 'O elemento <code>#box-2</code> deve ter a propriedade <code>flex-shrink</code> definida com um valor de 2.'
<ide> testString: 'assert($("#box-2").css("flex-shrink") == "2", "The <code>#box-2</code> element should have the <code>flex-shrink</code> property set to a value of 2.");'
<ide>
<ide> ``` | 1 |
Javascript | Javascript | add tests for parallel rendering | 07f2a439433cf791892a71c2695760d57ea4e993 | <ide><path>test/unit/api_spec.js
<ide> /* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor,
<ide> InvalidPDFException, MissingPDFException, StreamType, FontType,
<ide> PDFDocumentProxy, PasswordException, PasswordResponses,
<del> PDFPageProxy, createPromiseCapability */
<add> PDFPageProxy, createPromiseCapability, afterEach */
<ide>
<ide> 'use strict';
<ide>
<ide> describe('api', function() {
<ide> },
<ide> function(error) {
<ide> // Shouldn't get here.
<del> expect(false).toEqual(true);
<add> expect(error).toEqual('the promise should not have been rejected');
<ide> });
<ide> waitsFor(function() {
<ide> return resolved;
<ide> describe('api', function() {
<ide> });
<ide> });
<ide> });
<add> describe('Multiple PDFJS instances', function() {
<add> // Regression test for https://github.com/mozilla/pdf.js/issues/6205
<add> // A PDF using the Helvetica font.
<add> var pdf1 = combineUrl(window.location.href, '../pdfs/tracemonkey.pdf');
<add> // A PDF using the Times font.
<add> var pdf2 = combineUrl(window.location.href, '../pdfs/TAMReview.pdf');
<add> // A PDF using the Arial font.
<add> var pdf3 = combineUrl(window.location.href, '../pdfs/issue6068.pdf');
<add> var pdfDocuments = [];
<add>
<add> // Render the first page of the given PDF file.
<add> // Fulfills the promise with the base64-encoded version of the PDF.
<add> function renderPDF(filename) {
<add> return PDFJS.getDocument(filename)
<add> .then(function(pdf) {
<add> pdfDocuments.push(pdf);
<add> return pdf.getPage(1);
<add> }).then(function(page) {
<add> var c = document.createElement('canvas');
<add> var v = page.getViewport(1.2);
<add> c.width = v.width;
<add> c.height = v.height;
<add> return page.render({
<add> canvasContext: c.getContext('2d'),
<add> viewport: v,
<add> }).then(function() {
<add> return c.toDataURL();
<add> });
<add> });
<add> }
<add>
<add> afterEach(function() {
<add> // Issue 6205 reported an issue with font rendering, so clear the loaded
<add> // fonts so that we can see whether loading PDFs in parallel does not
<add> // cause any issues with the rendered fonts.
<add> var destroyPromises = pdfDocuments.map(function(pdfDocument) {
<add> return pdfDocument.destroy();
<add> });
<add> waitsForPromiseResolved(Promise.all(destroyPromises), function() {});
<add> });
<add>
<add> it('should correctly render PDFs in parallel', function() {
<add> var baseline1, baseline2, baseline3;
<add> var promiseDone = renderPDF(pdf1).then(function(data1) {
<add> baseline1 = data1;
<add> return renderPDF(pdf2);
<add> }).then(function(data2) {
<add> baseline2 = data2;
<add> return renderPDF(pdf3);
<add> }).then(function(data3) {
<add> baseline3 = data3;
<add> return Promise.all([
<add> renderPDF(pdf1),
<add> renderPDF(pdf2),
<add> renderPDF(pdf3),
<add> ]);
<add> }).then(function(dataUrls) {
<add> expect(dataUrls[0]).toEqual(baseline1);
<add> expect(dataUrls[1]).toEqual(baseline2);
<add> expect(dataUrls[2]).toEqual(baseline3);
<add> return true;
<add> });
<add> waitsForPromiseResolved(promiseDone, function() {});
<add> });
<add> });
<ide> }); | 1 |
Ruby | Ruby | fix #write_inheritable_attribute bug that crept in | 0a454cd73e9644b154d72b573bc58451010f0e1a | <ide><path>activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
<ide> def inheritable_attributes
<ide>
<ide> def write_inheritable_attribute(key, value)
<ide> if inheritable_attributes.equal?(EMPTY_INHERITABLE_ATTRIBUTES)
<del> inheritable_attributes = {}
<add> @inheritable_attributes = {}
<ide> end
<ide> inheritable_attributes[key] = value
<ide> end | 1 |
Text | Text | fix html plugin version badge | 5d4e1acd39b9f654c00b3e66f002bb279e65f8a3 | <ide><path>README.md
<ide> within webpack itself use this plugin interface. This makes webpack very
<ide> [i18n]: https://github.com/webpack/i18n-webpack-plugin
<ide> [i18n-npm]: https://img.shields.io/npm/v/i18n-webpack-plugin.svg
<ide> [html-plugin]: https://github.com/ampedandwired/html-webpack-plugin
<del>[html-plugin-npm]: https://img.shields.io/npm/v/component-webpack-plugin.svg
<add>[html-plugin-npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg
<ide>
<ide> ### [Loaders](https://webpack.js.org/loaders/)
<ide> | 1 |
Javascript | Javascript | move internalbinding whitelisting into loaders.js | 7bd8bbaabf4ed964476fca4bed267815b2b3967e | <ide><path>lib/internal/bootstrap/loaders.js
<ide> writable: false
<ide> });
<ide>
<add> // internalBindingWhitelist contains the name of internalBinding modules
<add> // that are whitelisted for access via process.binding()... this is used
<add> // to provide a transition path for modules that are being moved over to
<add> // internalBinding.
<add> const internalBindingWhitelist = [
<add> 'cares_wrap',
<add> 'fs_event_wrap',
<add> 'icu',
<add> 'udp_wrap',
<add> 'uv',
<add> 'pipe_wrap',
<add> 'http_parser',
<add> 'process_wrap',
<add> 'v8',
<add> 'tty_wrap',
<add> 'stream_wrap',
<add> 'signal_wrap',
<add> 'crypto',
<add> 'contextify',
<add> 'tcp_wrap',
<add> 'tls_wrap',
<add> 'util',
<add> 'async_wrap',
<add> 'url',
<add> 'spawn_sync',
<add> 'js_stream',
<add> 'zlib',
<add> 'buffer',
<add> 'natives',
<add> 'constants'
<add> ];
<add> // We will use a lazy loaded SafeSet in internalBindingWhitelistHas
<add> // for checking existence in this list.
<add> let internalBindingWhitelistSet;
<add>
<ide> // Set up process.binding() and process._linkedBinding()
<ide> {
<ide> const bindingObj = ObjectCreate(null);
<ide>
<ide> process.binding = function binding(module) {
<ide> module = String(module);
<add> // Deprecated specific process.binding() modules, but not all, allow
<add> // selective fallback to internalBinding for the deprecated ones.
<add> if (internalBindingWhitelistHas(module)) {
<add> return internalBinding(module);
<add> }
<ide> let mod = bindingObj[module];
<ide> if (typeof mod !== 'object') {
<ide> mod = bindingObj[module] = getBinding(module);
<ide> NativeModule.require('internal/process/coverage').setup();
<ide> }
<ide>
<add> function internalBindingWhitelistHas(name) {
<add> if (!internalBindingWhitelistSet) {
<add> const { SafeSet } = NativeModule.require('internal/safe_globals');
<add> internalBindingWhitelistSet = new SafeSet(internalBindingWhitelist);
<add> }
<add> return internalBindingWhitelistSet.has(name);
<add> }
<add>
<ide> // This will be passed to the bootstrapNodeJSCore function in
<ide> // bootstrap/node.js.
<ide> return loaderExports;
<ide><path>lib/internal/bootstrap/node.js
<ide> for (var i = 0; i < arguments.length; i++)
<ide> this.push(arguments[i]);
<ide> }
<del>
<del> // Deprecated specific process.binding() modules, but not all, allow
<del> // selective fallback to internalBinding for the deprecated ones.
<del> const { SafeSet } = NativeModule.require('internal/safe_globals');
<del> const processBinding = process.binding;
<del> // internalBindingWhitelist contains the name of internalBinding modules
<del> // that are whitelisted for access via process.binding()... this is used
<del> // to provide a transition path for modules that are being moved over to
<del> // internalBinding.
<del> const internalBindingWhitelist =
<del> new SafeSet([
<del> 'cares_wrap',
<del> 'fs_event_wrap',
<del> 'icu',
<del> 'udp_wrap',
<del> 'uv',
<del> 'pipe_wrap',
<del> 'http_parser',
<del> 'process_wrap',
<del> 'v8',
<del> 'tty_wrap',
<del> 'stream_wrap',
<del> 'signal_wrap',
<del> 'crypto',
<del> 'contextify',
<del> 'tcp_wrap',
<del> 'tls_wrap',
<del> 'util',
<del> 'async_wrap',
<del> 'url',
<del> 'spawn_sync',
<del> 'js_stream',
<del> 'zlib',
<del> 'buffer',
<del> 'natives',
<del> 'constants']);
<del> process.binding = function binding(name) {
<del> return internalBindingWhitelist.has(name) ?
<del> internalBinding(name) :
<del> processBinding(name);
<del> };
<ide> }
<ide>
<ide> function setupGlobalVariables() { | 2 |
Javascript | Javascript | increase timeout for tests | 5687cf71d043bff77b1410e8edd9ea5def1c1d34 | <ide><path>test/HotModuleReplacementPlugin.test.js
<ide> describe("HotModuleReplacementPlugin", () => {
<ide> });
<ide> });
<ide> });
<del> }, 60000);
<add> }, 120000);
<ide>
<ide> it("should correct working when entry is Object and key is a number", done => {
<ide> const entryFile = path.join( | 1 |
Python | Python | handle bad zip files nicely when parsing dags. | 8924cf1751e5190a1a7b4e33bb40de604b8b76b2 | <ide><path>airflow/dag_processing/manager.py
<ide> def _refresh_dag_dir(self):
<ide> dag_filelocs = []
<ide> for fileloc in self._file_paths:
<ide> if not fileloc.endswith(".py") and zipfile.is_zipfile(fileloc):
<del> with zipfile.ZipFile(fileloc) as z:
<del> dag_filelocs.extend(
<del> [
<del> os.path.join(fileloc, info.filename)
<del> for info in z.infolist()
<del> if might_contain_dag(info.filename, True, z)
<del> ]
<del> )
<add> try:
<add> with zipfile.ZipFile(fileloc) as z:
<add> dag_filelocs.extend(
<add> [
<add> os.path.join(fileloc, info.filename)
<add> for info in z.infolist()
<add> if might_contain_dag(info.filename, True, z)
<add> ]
<add> )
<add> except zipfile.BadZipFile as err:
<add> self.log.error("There was an err accessing %s, %s", fileloc, err)
<ide> else:
<ide> dag_filelocs.append(fileloc)
<ide> | 1 |
Javascript | Javascript | ignore stale xhr callbacks | d5ccabce600efb10092fdf0ae033c009026bf4cb | <ide><path>src/widgets.js
<ide> angularWidget('ng:view', function(element) {
<ide> changeCounter++;
<ide> });
<ide>
<del> this.$watch(function() {return changeCounter;}, function() {
<add> this.$watch(function() {return changeCounter;}, function(scope, newChangeCounter) {
<ide> var template = $route.current && $route.current.template;
<ide> if (template) {
<ide> //xhr's callback must be async, see commit history for more info
<ide> $xhr('GET', template, function(code, response) {
<del> element.html(response);
<del> compiler.compile(element)($route.current.scope);
<add> // ignore callback if another route change occured since
<add> if (newChangeCounter == changeCounter) {
<add> element.html(response);
<add> compiler.compile(element)($route.current.scope);
<add> }
<ide> });
<ide> } else {
<ide> element.html('');
<ide><path>test/widgetsSpec.js
<ide> describe("widget", function() {
<ide>
<ide> expect(rootScope.log).toEqual(['parent', 'init', 'child']);
<ide> });
<add>
<add> it('should discard pending xhr callbacks if a new route is requested before the current ' +
<add> 'finished loading', function() {
<add> // this is a test for a bad race condition that affected feedback
<add>
<add> $route.when('/foo', {template: 'myUrl1'});
<add> $route.when('/bar', {template: 'myUrl2'});
<add>
<add> expect(rootScope.$element.text()).toEqual('');
<add>
<add> $location.path('/foo');
<add> $browser.xhr.expectGET('myUrl1').respond('<div>{{1+3}}</div>');
<add> rootScope.$digest();
<add> $location.path('/bar');
<add> $browser.xhr.expectGET('myUrl2').respond('<div>{{1+1}}</div>');
<add> rootScope.$digest();
<add> $browser.xhr.flush(); // no that we have to requests pending, flush!
<add>
<add> expect(rootScope.$element.text()).toEqual('2');
<add> });
<ide> });
<ide>
<ide> | 2 |
Python | Python | fix error when serializer gets files but no data | 59cce01b3359aa009e697a99eabbf2ef322b28e2 | <ide><path>rest_framework/serializers.py
<ide> def __init__(self, instance=None, data=None, files=None,
<ide>
<ide> self.context = context or {}
<ide>
<del> self.init_data = data
<add> self.init_data = data or {}
<ide> self.init_files = files
<ide> self.object = instance
<ide> self.fields = self.get_fields()
<ide><path>rest_framework/tests/test_files.py
<ide> def test_validation_error_with_non_file(self):
<ide> serializer = UploadedFileSerializer(data={'created': now, 'file': 'abc'})
<ide> self.assertFalse(serializer.is_valid())
<ide> self.assertEqual(serializer.errors, {'file': [errmsg]})
<add>
<add> def test_validation_with_no_data(self):
<add> """
<add> Validation should still function when no data dictionary is provided.
<add> """
<add> now = datetime.datetime.now()
<add> file = BytesIO(six.b('stuff'))
<add> file.name = 'stuff.txt'
<add> file.size = len(file.getvalue())
<add> uploaded_file = UploadedFile(file=file, created=now)
<add>
<add> serializer = UploadedFileSerializer(files={'file': file})
<add> self.assertFalse(serializer.is_valid())
<ide>\ No newline at end of file | 2 |
Text | Text | add changelogs for cli | 7f24ec1088d1c0d346d2df1263a9bb58a20800ea | <ide><path>doc/api/cli.md
<ide> The output of this option is less detailed than this document.
<ide> ### `-e`, `--eval "script"`
<ide> <!-- YAML
<ide> added: v0.5.2
<add>changes:
<add> - version: v5.11.0
<add> pr-url: https://github.com/nodejs/node/pull/5348
<add> description: Built-in libraries are now available as predefined variables.
<ide> -->
<ide>
<ide> Evaluate the following argument as JavaScript. The modules which are
<ide> predefined in the REPL can also be used in `script`.
<ide> ### `-p`, `--print "script"`
<ide> <!-- YAML
<ide> added: v0.6.4
<add>changes:
<add> - version: v5.11.0
<add> pr-url: https://github.com/nodejs/node/pull/5348
<add> description: Built-in libraries are now available as predefined variables.
<ide> -->
<ide>
<ide> Identical to `-e` but prints the result.
<ide>
<ide>
<ide> ### `-c`, `--check`
<ide> <!-- YAML
<del>added: v5.0.0
<add>added:
<add> - v5.0.0
<add> - v4.2.0
<ide> -->
<ide>
<ide> Syntax check the script without executing. | 1 |
PHP | PHP | add missing property to testauthenticate | c6e3df4cad2001fb544be7d6a6f7075e11d2e16a | <ide><path>tests/test_app/TestApp/Auth/TestAuthenticate.php
<ide> class TestAuthenticate extends BaseAuthenticate
<ide> public $callStack = [];
<ide>
<ide> public $authenticationProvider;
<add>
<add> public $modifiedUser;
<ide>
<ide> /**
<ide> * @return array<string, mixed> | 1 |
Ruby | Ruby | make `abstractmysqladapter#version` public | d9e74ace9f0d0bba39c3b836b3d79b059d516eb0 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
<ide> def initialize_schema_migrations_table
<ide> end
<ide> end
<ide>
<add> def version
<add> @version ||= Version.new(full_version.match(/^\d+\.\d+\.\d+/)[0])
<add> end
<add>
<ide> # Returns true, since this connection adapter supports migrations.
<ide> def supports_migrations?
<ide> true
<ide> def subquery_for(key, select)
<ide> subselect.from subsubselect.distinct.as('__active_record_temp')
<ide> end
<ide>
<del> def version
<del> @version ||= Version.new(full_version.match(/^\d+\.\d+\.\d+/)[0])
<del> end
<del>
<ide> def mariadb?
<ide> full_version =~ /mariadb/i
<ide> end
<ide><path>activerecord/test/cases/helper.rb
<ide> def in_memory_db?
<ide> end
<ide>
<ide> def subsecond_precision_supported?
<del> !current_adapter?(:MysqlAdapter, :Mysql2Adapter) || ActiveRecord::Base.connection.send(:version) >= '5.6.4'
<add> !current_adapter?(:MysqlAdapter, :Mysql2Adapter) || ActiveRecord::Base.connection.version >= '5.6.4'
<ide> end
<ide>
<ide> def mysql_enforcing_gtid_consistency? | 2 |
PHP | PHP | use constants where possible | 024fb658fb26bc8f253d6142d3aebbf1450beda6 | <ide><path>lib/Cake/Database/Schema/MysqlSchema.php
<ide> public function convertFieldDescription(Table $table, $row) {
<ide> 'comment' => $row['Comment'],
<ide> ];
<ide> $table->addColumn($row['Field'], $field);
<del> if (!empty($row['Key']) && $row['Key'] === 'PRI') {
<del> $table->addConstraint('primary', [
<del> 'type' => Table::CONSTRAINT_PRIMARY,
<del> 'columns' => [$row['Field']]
<del> ]);
<del> }
<ide> }
<ide>
<ide> /**
<ide> public function convertIndexDescription(Table $table, $row) {
<ide>
<ide> $name = $row['Key_name'];
<ide> if ($name === 'PRIMARY') {
<del> $name = $type = 'primary';
<add> $name = $type = Table::CONSTRAINT_PRIMARY;
<ide> }
<ide>
<ide> $columns[] = $row['Column_name'];
<ide>
<ide> if ($row['Index_type'] === 'FULLTEXT') {
<del> $type = strtolower($row['Index_type']);
<add> $type = Table::INDEX_FULLTEXT;
<ide> } elseif ($row['Non_unique'] == 0 && $type !== 'primary') {
<del> $type = 'unique';
<add> $type = Table::CONSTRAINT_UNIQUE;
<ide> } elseif ($type !== 'primary') {
<del> $type = 'index';
<add> $type = Table::INDEX_INDEX;
<ide> }
<ide>
<ide> if (!empty($row['Sub_part'])) {
<ide> $length[$row['Column_name']] = $row['Sub_part'];
<ide> }
<ide> $isIndex = (
<del> $type == 'index' ||
<del> $type == 'fulltext'
<add> $type == Table::INDEX_INDEX ||
<add> $type == Table::INDEX_FULLTEXT
<ide> );
<ide> if ($isIndex) {
<ide> $existing = $table->index($name);
<ide> public function convertIndexDescription(Table $table, $row) {
<ide> // MySQL multi column indexes come back
<ide> // as multiple rows.
<ide> if (!empty($existing)) {
<del> $columns = array_unique(array_merge($existing['columns'], $columns));
<add> $columns = array_merge($existing['columns'], $columns);
<ide> $length = array_merge($existing['length'], $length);
<ide> }
<ide> if ($isIndex) {
<ide><path>lib/Cake/Database/Schema/PostgresSchema.php
<ide> public function convertFieldDescription(Table $table, $row) {
<ide> ];
<ide> $field['length'] = $row['char_length'] ?: $field['length'];
<ide> $table->addColumn($row['name'], $field);
<del> if (!empty($row['pk'])) {
<del> $table->addConstraint('primary', [
<del> 'type' => Table::CONSTRAINT_PRIMARY,
<del> 'columns' => [$row['name']]
<del> ]);
<del> }
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Database/Schema/SqliteSchema.php
<ide> public function convertIndexDescription(Table $table, $row) {
<ide> }
<ide> if ($row['unique']) {
<ide> $table->addConstraint($row['name'], [
<del> 'type' => 'unique',
<add> 'type' => Table::CONSTRAINT_UNIQUE,
<ide> 'columns' => $columns
<ide> ]);
<ide> } else {
<ide> $table->addIndex($row['name'], [
<del> 'type' => 'index',
<add> 'type' => Table::INDEX_INDEX,
<ide> 'columns' => $columns
<ide> ]);
<ide> } | 3 |
Text | Text | add release notes for v5.6.22 | ca75ec83c325894206283bc0653c8fca5c4fa66d | <ide><path>CHANGELOG-5.6.md
<ide> # Release Notes for 5.6.x
<ide>
<add>## v5.6.22 (2018-05-15)
<add>
<add>### Added
<add>- Added `Collection::loadMissing()` method ([#24166](https://github.com/laravel/framework/pull/24166), [#24215](https://github.com/laravel/framework/pull/24215))
<add>
<add>### Changed
<add>- Support updating NPM dependencies from preset ([#24189](https://github.com/laravel/framework/pull/24189), [a6542b0](https://github.com/laravel/framework/commit/a6542b0972a1a92c1249689d3e1b46b3bc4e59fa))
<add>- Support returning `Responsable` from middleware ([#24201](https://github.com/laravel/framework/pull/24201))
<add>
<add>
<ide> ## v5.6.21 (2018-05-08)
<ide>
<ide> ### Added | 1 |
PHP | PHP | update global config() function to use new path | cfbb08732411a180ab112ca651c47f8fccc5eb48 | <ide><path>src/basics.php
<ide> function config() {
<ide> $count = count($args);
<ide> $included = 0;
<ide> foreach ($args as $arg) {
<del> if (file_exists(APP . 'Config/' . $arg . '.php')) {
<del> include_once APP . 'Config/' . $arg . '.php';
<add> if (file_exists(CONFIG . $arg . '.php')) {
<add> include_once CONFIG . $arg . '.php';
<ide> $included++;
<ide> }
<ide> } | 1 |
Ruby | Ruby | add doctor check for unbrewed header files | e5c42895a86bb32b68a46ef00ee486d1608e00f5 | <ide><path>Library/Homebrew/cmd/doctor.rb
<ide> def check_for_stray_las
<ide> EOS
<ide> end
<ide>
<add>def check_for_stray_headers
<add> white_list = {} # TODO whitelist MacFuse/OSXFuse headers
<add>
<add> __check_stray_files "/usr/local/include/**/*.h", white_list, <<-EOS.undent
<add> Unbrewed header files were found in /usr/local/include.
<add> If you didn't put them there on purpose they could cause problems when
<add> building Homebrew formulae, and may need to be deleted.
<add>
<add> Unexpected header files:
<add> EOS
<add>end
<add>
<ide> def check_for_other_package_managers
<ide> ponk = MacOS.macports_or_fink
<ide> unless ponk.empty? | 1 |
Text | Text | update docs to v0.13.0-beta.2 | fb2f6c6747e9a388663666aaf467d204a9776f22 | <ide><path>docs/docs/ref-02-component-api.ko-KR.md
<ide> replaceState(object nextState[, function callback])
<ide> `setState()`์ ๋น์ทํ์ง๋ง ๊ธฐ์กด์ ์กด์ฌํ๋ state ์ค nextState์ ์๋ ํค๋ ๋ชจ๋ ์ญ์ ๋ฉ๋๋ค.
<ide>
<ide>
<del>### forceUpdate()
<add>### forceUpdate
<ide>
<ide> ```javascript
<ide> forceUpdate([function callback])
<ide> DOMElement getDOMNode()
<ide> ์ด ์ปดํฌ๋ํธ๊ฐ DOM์ ๋ง์ดํธ๋ ๊ฒฝ์ฐ ํด๋นํ๋ ๋ค์ดํฐ๋ธ ๋ธ๋ผ์ฐ์ DOM ์์๋ฅผ ๋ฆฌํดํฉ๋๋ค. ์ด ๋ฉ์๋๋ ํผ ํ๋์ ๊ฐ์ด๋ DOM์ ํฌ๊ธฐ/์์น ๋ฑ DOM์์ ์ ๋ณด๋ฅผ ์ฝ์ ๋ ์ ์ฉํฉ๋๋ค. `render`๊ฐ `null`์ด๋ `false`๋ฅผ ๋ฆฌํดํ์๋ค๋ฉด `this.getDOMNode()`๋ `null`์ ๋ฆฌํดํฉ๋๋ค.
<ide>
<ide>
<del>### isMounted()
<add>### isMounted
<ide>
<ide> ```javascript
<ide> bool isMounted()
<ide><path>docs/docs/ref-09-glossary.ko-KR.md
<ide> JSX๋ฅผ ์ฌ์ฉํ๋ฉด ํฉํ ๋ฆฌ๊ฐ ํ์ํ์ง ์์ต๋๋ค. ์ด๋ฏธ JSX๊ฐ `React
<ide> ## React ๋
ธ๋
<ide>
<ide> `ReactNode`๋ ๋ค์ ์ค ํ๋๊ฐ ๋ ์ ์์ต๋๋ค:
<add>
<ide> - `ReactElement`
<ide> - `string` (`ReactText`๋ก ๋ถ๋ฅด๊ธฐ๋ ํจ)
<ide> - `number` (`ReactText`๋ก ๋ถ๋ฅด๊ธฐ๋ ํจ)
<ide><path>docs/docs/tutorial.ko-KR.md
<ide> var CommentBox = React.createClass({
<ide>
<ide> ๋ฐฉ๊ธ ๋ง๋ ์ปดํฌ๋ํธ๋ค์ ์ด๋ค๋ฐฉ์์ผ๋ก HTML ํ๊ทธ๋ค๊ณผ ์์ด ์ฌ์ฉํ๋์ง ์ดํด๋ณด์ธ์. HTML ์ปดํฌ๋ํธ๋ค๋ ํ๊ฐ์ง ์ฐจ์ด๋ง ์ ์ธํ๋ค๋ฉด ์ฐ๋ฆฌ๊ฐ ์ ์ํ ๊ฒ๊ณผ ๊ฐ์ ํ์ค์ ์ธ React ์ปดํฌ๋ํธ์
๋๋ค. JSX ์ปดํ์ผ๋ฌ๊ฐ ์๋์ผ๋ก HTML ํ๊ทธ๋ค์ `React.createElement(tagName)` ํํ์์ผ๋ก ์ฌ์์ฑํ๊ณ ๋๋จธ์ง๋ ๊ทธ๋๋ก ๋ ๊ฒ์
๋๋ค. ์ด๋ ์ ์ญ ๋ค์์คํ์ด์ค๊ฐ ์ค์ผ๋๋ ๊ฒ์ ๋ง์์ค๋๋ค.
<ide>
<del>### ์ปดํฌ๋ํธ ํ๋กํผํฐ (Component Properties)
<add>### props ์ฌ์ฉํ๊ธฐ
<ide>
<del>์ด์ ์ธ ๋ฒ์งธ ์ปดํฌ๋ํธ์ธ `Comment`๋ฅผ ๋ง๋ค์ด ๋ด
์๋ค. ๊ฐ๋ณ ๋๊ธ๋ง๋ค ๊ธ์ด์ด์ ๋ด์ฉ์ ํฌํจํ๊ฒ ๋ ๊ฒ์
๋๋ค. ๋จผ์ ๋๊ธ ๋ช ๊ฐ๋ฅผ `CommentList`์ ์ถ๊ฐํด ๋ด
์๋ค:
<add>๋ถ๋ชจ๋ก ๋ถํฐ ๋ฐ์ ๋ฐ์ดํฐ์ ์์กดํ๋ `Comment` ์ปดํฌ๋ํธ๋ฅผ ๋ง๋ค์ด ๋ด
์๋ค. ๋ถ๋ชจ ์ปดํฌ๋ํธ๋ก ๋ถํฐ ๋ฐ์ ๋ฐ์ดํฐ๋ ์์ ์ปดํฌ๋ํธ์์ 'ํ๋กํผํฐ'๋ก ์ฌ์ฉ๊ฐ๋ฅ ํฉ๋๋ค. ์ด 'ํ๋กํผํฐ๋ค'์ `this.props`๋ฅผ ํตํด ์ ๊ทผํฉ๋๋ค. props๋ฅผ ์ฌ์ฉํด `CommentList`์์ ์ ๋ฌ๋ฐ์ ๋ฐ์ดํฐ๋ฅผ ์ฝ์ด๋ค์ด๊ณ , ๋งํฌ์
์ ๋ ๋ํ ์ ์์ ๊ฒ์
๋๋ค.
<ide>
<del>```javascript{6-7}
<add>
<add>```javascript
<ide> // tutorial4.js
<del>var CommentList = React.createClass({
<add>var Comment = React.createClass({
<ide> render: function() {
<ide> return (
<del> <div className="commentList">
<del> <Comment author="Pete Hunt">๋๊ธ์
๋๋ค</Comment>
<del> <Comment author="Jordan Walke">*๋ ๋ค๋ฅธ* ๋๊ธ์
๋๋ค</Comment>
<add> <div className="comment">
<add> <h2 className="commentAuthor">
<add> {this.props.author}
<add> </h2>
<add> {this.props.children}
<ide> </div>
<ide> );
<ide> }
<ide> });
<ide> ```
<ide>
<del>๋ถ๋ชจ ์ปดํฌ๋ํธ์ธ `CommentList`์์ ์์ ์ปดํฌ๋ํธ์ธ `Comment`์ ๋ฐ์ดํฐ๋ค์ ์ ๋ฌํ๊ณ ์๋๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ์ฐ๋ฆฌ๋ ์ดํธ๋ฆฌ๋ทฐํธ๋ก *Pete Hunt*๋ฅผ, XML ํ์์ ์์ ๋
ธ๋๋ก *๋๊ธ์
๋๋ค*๋ฅผ ์ฒซ ๋ฒ์งธ `Comment`๋ก ๋๊ฒผ์ต๋๋ค. ๋ถ๋ชจ์์ ์์ ์ปดํฌ๋ํธ๋ก ์ ๋ฌ๋๋ ๋ฐ์ดํฐ๋ **props**๋ผ ํฉ๋๋ค. properties์ ์ถ์ฝ์ด์ง์.
<add>JSX ๋ด๋ถ์ ์ค๊ดํธ๋ก ๋๋ฌ์ธ์ธ JavaScript ํํ์(์ดํธ๋ฆฌ๋ทฐํธ๋ ์๋ฆฌ๋จผํธ์ ์์์ผ๋ก ์ฌ์ฉ๋)์ ํตํด ํ
์คํธ๋ React ์ปดํฌ๋ํธ๋ฅผ ํธ๋ฆฌ์ ๋ํ ์ ์์ต๋๋ค. `this.props`๋ฅผ ํตํด ์ปดํฌ๋ํธ์ ์ ๋ฌ๋ ํน์ ํ ์ดํธ๋ฆฌ๋ทฐํธ๋ค์, `this.props.children`์ ํตํด ์ค์ฒฉ๋ ์๋ฆฌ๋จผํธ๋ค์ ์ ๊ทผํ ์ ์์ต๋๋ค.
<ide>
<del>### props ์ฌ์ฉํ๊ธฐ
<add>### ์ปดํฌ๋ํธ ํ๋กํผํฐ (Component Properties)
<ide>
<del>Comment ์ปดํฌ๋ํธ๋ฅผ ๋ง๋ค์ด ๋ด
์๋ค. **props**๋ฅผ ์ฌ์ฉํด `CommentList`์์ ์ ๋ฌ๋ฐ์ ๋ฐ์ดํฐ๋ฅผ ์ฝ์ด๋ค์ด๊ณ , ๋งํฌ์
์ ๋ ๋ํ ์ ์์ ๊ฒ์
๋๋ค.
<add>`Comment` ์ปดํฌ๋ํธ๋ฅผ ๋ง๋ค์์ผ๋, ์ฌ๊ธฐ์ ๊ธ์ด์ด์ ๋ด์ฉ์ ๋๊ฒจ๋ณด๋๋ก ํฉ์๋ค. ์ด๋ ๊ฒ ํจ์ผ๋ก์จ ๊ฐ ๊ณ ์ ํ comment์์ ๊ฐ์ ์ฝ๋๋ฅผ ์ฌ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋จผ์ ๋๊ธ ๋ช ๊ฐ๋ฅผ `CommentList`์ ์ถ๊ฐํด ๋ด
์๋ค:
<ide>
<del>```javascript
<add>```javascript{6-7}
<ide> // tutorial5.js
<del>var Comment = React.createClass({
<add>var CommentList = React.createClass({
<ide> render: function() {
<ide> return (
<del> <div className="comment">
<del> <h2 className="commentAuthor">
<del> {this.props.author}
<del> </h2>
<del> {this.props.children}
<add> <div className="commentList">
<add> <Comment author="Pete Hunt">๋๊ธ์
๋๋ค</Comment>
<add> <Comment author="Jordan Walke">*๋ ๋ค๋ฅธ* ๋๊ธ์
๋๋ค</Comment>
<ide> </div>
<ide> );
<ide> }
<ide> });
<ide> ```
<ide>
<del>JSX ๋ด๋ถ์ ์ค๊ดํธ๋ก ๋๋ฌ์ธ์ธ JavaScript ํํ์(์ดํธ๋ฆฌ๋ทฐํธ๋ ์๋ฆฌ๋จผํธ์ ์์์ผ๋ก ์ฌ์ฉ๋)์ ํตํด ํ
์คํธ๋ React ์ปดํฌ๋ํธ๋ฅผ ํธ๋ฆฌ์ ๋ํ ์ ์์ต๋๋ค. `this.props`๋ฅผ ํตํด ์ปดํฌ๋ํธ์ ์ ๋ฌ๋ ํน์ ํ ์ดํธ๋ฆฌ๋ทฐํธ๋ค์, `this.props.children`์ ํตํด ์ค์ฒฉ๋ ์๋ฆฌ๋จผํธ๋ค์ ์ ๊ทผํ ์ ์์ต๋๋ค.
<add>๋ถ๋ชจ ์ปดํฌ๋ํธ์ธ `CommentList`์์ ์์ ์ปดํฌ๋ํธ์ธ `Comment`์ ๋ฐ์ดํฐ๋ค์ ์ ๋ฌํ๊ณ ์๋๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ์ฐ๋ฆฌ๋ ์ดํธ๋ฆฌ๋ทฐํธ๋ก *Pete Hunt*๋ฅผ, XML ํ์์ ์์ ๋
ธ๋๋ก *๋๊ธ์
๋๋ค*๋ฅผ ์ฒซ ๋ฒ์งธ `Comment`๋ก ๋๊ฒผ์ต๋๋ค. ์์์ ์ธ๊ธํ๋ฏ์ด `Comment` ์ปดํฌ๋ํธ๋ ๊ทธ๋ค์ 'ํ๋กํผํฐ'๋ฅผ `this.props.author`, `this.props.children`๋ฅผ ํตํด ์ ๊ทผํฉ๋๋ค.
<ide>
<ide> ### Markdown ์ถ๊ฐํ๊ธฐ
<ide>
<ide> var CommentForm = React.createClass({
<ide>
<ide> ์ด์ ํผ์ ์ํธ์์ฉ์ ๋ง๋ค์ด ๋ณด๊ฒ ์ต๋๋ค. ์ฌ์ฉ์๊ฐ ํผ์ ์ญ๋ฐํ๋ ์์ ์ ์ฐ๋ฆฌ๋ ํผ์ ์ด๊ธฐํํ๊ณ ์๋ฒ์ ์์ฒญ์ ์ ์กํ๊ณ ๋๊ธ๋ชฉ๋ก์ ๊ฐฑ์ ํด์ผ ํฉ๋๋ค. ํผ์ ์ญ๋ฐ ์ด๋ฒคํธ๋ฅผ ๊ฐ์ํ๊ณ ์ด๊ธฐํ ํด์ฃผ๋ ๋ถ๋ถ๋ถํฐ ์์ํด ๋ณด์ฃ .
<ide>
<del>```javascript{3-14,17-20}
<add>```javascript{3-13,16-19}
<ide> // tutorial16.js
<ide> var CommentForm = React.createClass({
<ide> handleSubmit: function(e) {
<ide> var CommentForm = React.createClass({
<ide> // TODO: ์๋ฒ์ ์์ฒญ์ ์ ์กํฉ๋๋ค
<ide> this.refs.author.getDOMNode().value = '';
<ide> this.refs.text.getDOMNode().value = '';
<del> return;
<ide> },
<ide> render: function() {
<ide> return (
<ide> var CommentForm = React.createClass({
<ide> this.props.onCommentSubmit({author: author, text: text});
<ide> this.refs.author.getDOMNode().value = '';
<ide> this.refs.text.getDOMNode().value = '';
<del> return;
<ide> },
<ide> render: function() {
<ide> return (
<ide><path>docs/docs/videos.ko-KR.md
<ide> id: videos-ko-KR
<ide> title: ๋น๋์ค๋ค
<ide> permalink: videos-ko-KR.html
<del>prev: thinking-in-react-ko-KR.html
<add>prev: conferences-ko-KR.html
<ide> next: complementary-tools-ko-KR.html
<ide> ---
<ide>
<ide> Facebook ๊ฐ๋ฐ์ [Bill Fisher](http://twitter.com/fisherwebdev)์ [Jing Chen]
<ide>
<ide> Server-side rendering์ ์ํด [SoundCloud](https://developers.soundcloud.com/blog/)๊ฐ React ์ Flux๋ฅผ ์ฌ์ฉํ๋์ง by [Andres Suarez](https://github.com/zertosh)
<ide> [๋ฐํ ์๋ฃ์ ์์ ์ฝ๋](https://github.com/zertosh/ssr-demo-kit)
<add>
<add>### Introducing React Native (+Playlist) - React.js Conf 2015
<add>
<add><iframe width="650" height="315" src="//www.youtube.com/watch?v=KVZ-P-ZI6W4&index=1&list=PLb0IAmt7-GS1cbw4qonlQztYV1TAW0sCr" frameborder="0" allowfullscreen></iframe>
<add>
<add>2015๋
์ [Tom Occhino](https://twitter.com/tomocchino)๋์ด React์ ๊ณผ๊ฑฐ์ ํ์ฌ๋ฅผ ๋ฆฌ๋ทฐํ๊ณ ๋์๊ฐ ๋ฐฉํฅ์ ์ ์ํ์ต๋๋ค. | 4 |
Javascript | Javascript | remove deprecated property usage | 5bda245248ba084f50709f6ccee52c82f19524b6 | <ide><path>lib/AmdMainTemplatePlugin.js
<ide> class AmdMainTemplatePlugin {
<ide> const mainTemplate = compilation.mainTemplate;
<ide>
<ide> compilation.templatesPlugin("render-with-entry", (source, chunk, hash) => {
<del> const externals = chunk.modules.filter((m) => m.external);
<add> const externals = chunk.getModules().filter((m) => m.external);
<ide> const externalsDepsArray = JSON.stringify(externals.map((m) =>
<ide> typeof m.request === "object" ? m.request.amd : m.request
<ide> )); | 1 |
Text | Text | prepare js code for eslint-plugin-markdown | b6d293d2158c66a3edbb86c0c43b4c51af3484f7 | <ide><path>doc/api/child_process.md
<ide> bat.stderr.on('data', (data) => {
<ide> bat.on('exit', (code) => {
<ide> console.log(`Child exited with code ${code}`);
<ide> });
<add>```
<ide>
<add>```js
<ide> // OR...
<ide> const exec = require('child_process').exec;
<ide> exec('my.bat', (err, stdout, stderr) => {
<ide> The `options` argument may be passed as the second argument to customize how
<ide> the process is spawned. The default options are:
<ide>
<ide> ```js
<del>{
<add>const defaults = {
<ide> encoding: 'utf8',
<ide> timeout: 0,
<ide> maxBuffer: 200*1024,
<ide> killSignal: 'SIGTERM',
<ide> cwd: null,
<ide> env: null
<del>}
<add>};
<ide> ```
<ide>
<ide> If `timeout` is greater than `0`, the parent will send the signal
<ide> trigger arbitrary command execution.**
<ide> A third argument may be used to specify additional options, with these defaults:
<ide>
<ide> ```js
<del>{
<add>const defaults = {
<ide> cwd: undefined,
<ide> env: process.env
<del>}
<add>};
<ide> ```
<ide>
<ide> Use `cwd` to specify the working directory from which the process is spawned.
<ide><path>doc/api/console.md
<ide> or `console.Console`:
<ide>
<ide> ```js
<ide> const Console = require('console').Console;
<add>```
<add>
<add>```js
<ide> const Console = console.Console;
<ide> ```
<ide>
<ide><path>doc/api/fs.md
<ide> synchronous counterparts are of this type.
<ide> For a regular file [`util.inspect(stats)`][] would return a string very
<ide> similar to this:
<ide>
<del>```js
<add>```txt
<ide> Stats {
<ide> dev: 2114,
<ide> ino: 48064969,
<ide> default value of 64 kb for the same parameter.
<ide> `options` is an object or string with the following defaults:
<ide>
<ide> ```js
<del>{
<add>const defaults = {
<ide> flags: 'r',
<ide> encoding: null,
<ide> fd: null,
<ide> mode: 0o666,
<ide> autoClose: true
<del>}
<add>};
<ide> ```
<ide>
<ide> `options` can include `start` and `end` values to read a range of bytes from
<ide> Returns a new [`WriteStream`][] object. (See [Writable Stream][]).
<ide> `options` is an object or string with the following defaults:
<ide>
<ide> ```js
<del>{
<add>const defaults = {
<ide> flags: 'w',
<ide> defaultEncoding: 'utf8',
<ide> fd: null,
<ide> mode: 0o666,
<ide> autoClose: true
<del>}
<add>};
<ide> ```
<ide>
<ide> `options` may also include a `start` option to allow writing data at
<ide><path>doc/api/modules.md
<ide> object, it is common to also reassign `exports`, for example:
<ide>
<ide> ```js
<ide> module.exports = exports = function Constructor() {
<del> // ... etc.
<add> // ... etc.
<add>};
<ide> ```
<ide>
<ide> To illustrate the behavior, imagine this hypothetical implementation of
<ide><path>doc/api/process.md
<ide> running the `./configure` script.
<ide>
<ide> An example of the possible output looks like:
<ide>
<del>```js
<add>```txt
<ide> {
<ide> target_defaults:
<ide> { cflags: [],
<ide> to load modules that were compiled against a different module ABI version.
<ide> console.log(process.versions);
<ide> ```
<ide>
<del>Will generate output similar to:
<add>Will generate an object similar to:
<ide>
<ide> ```js
<ide> {
<ide><path>doc/api/tls.md
<ide> stream.
<ide> `tls.TLSSocket()`. For example, the code:
<ide>
<ide> ```js
<del>pair = tls.createSecurePair( ... );
<add>pair = tls.createSecurePair(/* ... */);
<ide> pair.encrypted.pipe(socket);
<ide> socket.pipe(pair.encrypted);
<ide> ```
<ide><path>doc/api/zlib.md
<ide> request.on('response', (response) => {
<ide> break;
<ide> }
<ide> });
<add>```
<ide>
<add>```js
<ide> // server example
<ide> // Running a gzip operation on every request is quite expensive.
<ide> // It would be much more efficient to cache the compressed buffer.
<ide> For example, to reduce the default memory requirements from 256K to 128K, the
<ide> options should be set to:
<ide>
<ide> ```js
<del>{ windowBits: 14, memLevel: 7 }
<add>const options = { windowBits: 14, memLevel: 7 };
<ide> ```
<ide>
<ide> This will, however, generally degrade compression.
<ide><path>doc/guides/using-internal-errors.md
<ide> and appending the new error codes to the end using the utility `E()` method.
<ide>
<ide> ```js
<ide> E('EXAMPLE_KEY1', 'This is the error value');
<del>E('EXAMPLE_KEY2', (a, b) => return `${a} ${b}`);
<add>E('EXAMPLE_KEY2', (a, b) => `${a} ${b}`);
<ide> ```
<ide>
<ide> The first argument passed to `E()` is the static identifier. The second
<ide><path>doc/guides/writing-tests.md
<ide> Add tests when:
<ide> Let's analyze this basic test from the Node.js test suite:
<ide>
<ide> ```javascript
<del>1 'use strict';
<del>2 const common = require('../common');
<del>3
<del>4 // This test ensures that the http-parser can handle UTF-8 characters
<del>5 // in the http header.
<del>6
<del>7 const assert = require('assert');
<del>8 const http = require('http');
<del>9
<del>10 const server = http.createServer(common.mustCall((req, res) => {
<del>11 res.end('ok');
<del>12 }));
<del>13 server.listen(0, () => {
<del>14 http.get({
<del>15 port: server.address().port,
<del>16 headers: {'Test': 'Dรผsseldorf'}
<del>17 }, common.mustCall((res) => {
<del>18 assert.strictEqual(res.statusCode, 200);
<del>19 server.close();
<del>20 }));
<del>21 });
<add>'use strict'; // 1
<add>const common = require('../common'); // 2
<add> // 3
<add>// This test ensures that the http-parser can handle UTF-8 characters // 4
<add>// in the http header. // 5
<add> // 6
<add>const assert = require('assert'); // 7
<add>const http = require('http'); // 8
<add> // 9
<add>const server = http.createServer(common.mustCall((req, res) => { // 10
<add> res.end('ok'); // 11
<add>})); // 12
<add>server.listen(0, () => { // 13
<add> http.get({ // 14
<add> port: server.address().port, // 15
<add> headers: {'Test': 'Dรผsseldorf'} // 16
<add> }, common.mustCall((res) => { // 17
<add> assert.strictEqual(res.statusCode, 200); // 18
<add> server.close(); // 19
<add> })); // 20
<add>}); // 21
<ide> ```
<ide>
<ide> ### **Lines 1-2** | 9 |
Text | Text | add domenic as collaborator | cf5020fc025cba38668b45949a29b5c480e94e3f | <ide><path>README.md
<ide> information about the governance of the io.js project, see
<ide> * **Christopher Monsanto** ([@monsanto](https://github.com/monsanto)) <[email protected]>
<ide> * **Ali Ijaz Sheikh** ([@ofrobots](https://github.com/ofrobots)) <[email protected]>
<ide> * **Oleg Elifantiev** ([@Olegas](https://github.com/Olegas)) <[email protected]>
<add>* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <[email protected]>
<ide>
<ide> Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in
<ide> maintaining the io.js project. | 1 |
Text | Text | add line number 21 (about { } ) | faadc843d0f77d5bbb8a8690285f9174372cedd4 | <ide><path>client/src/pages/guide/english/cplusplus/the-if-statement/index.md
<ide> title: C++ If Statement
<ide> // Block of statements if test expression is True
<ide> }
<ide> ```
<add>If there is only one statement after the if statement the '{ }' are not necessarily required . But if there are more number of statements after if statement, then it is mandatory to put all those statements in '{}'.
<ide>
<ide> If the value of the test expression is **true**, then the block of
<ide> code inside the if statement is executed. | 1 |
Javascript | Javascript | remove outdated todo | 5c4362dc5c30357aed829e630ca4a03bd812e482 | <ide><path>src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
<ide> describe('ReactDOMFiber', () => {
<ide> });
<ide>
<ide> it('throws if non-element passed to top-level render', () => {
<del> // FIXME: These assertions pass individually, but they leave React in
<del> // an inconsistent state. This suggests an error-handling bug. I'll fix
<del> // this in a separate PR.
<ide> const message = 'render(): Invalid component element.';
<ide> expect(() => ReactDOM.render(null, container)).toThrow(message, container);
<ide> expect(() => ReactDOM.render(undefined, container)).toThrow(message, container); | 1 |
Ruby | Ruby | add second t to overwritten | 201156b6a9f090c21953e2c69a41f28c33545a1f | <ide><path>actionpack/lib/action_view/context.rb
<ide> def _prepare_context
<ide>
<ide> # Encapsulates the interaction with the view flow so it
<ide> # returns the correct buffer on +yield+. This is usually
<del> # overwriten by helpers to add more behavior.
<add> # overwritten by helpers to add more behavior.
<ide> # :api: plugin
<ide> def _layout_for(name=nil)
<ide> name ||= :layout
<ide> view_flow.get(name).html_safe
<ide> end
<ide> end
<del>end
<ide>\ No newline at end of file
<add>end | 1 |
Text | Text | add some doc detail for invalid header chars | 45b7fc2039035f103262eec15b5b9cda01b1f695 | <ide><path>doc/api/http2.md
<ide> These will be reported using either a synchronous `throw` or via an `'error'`
<ide> event on the `Http2Stream`, `Http2Session` or HTTP/2 Server objects, depending
<ide> on where and when the error occurs.
<ide>
<add>### Invalid character handling in header names and values
<add>
<add>The HTTP/2 implementation applies stricter handling of invalid characters in
<add>HTTP header names and values than the HTTP/1 implementation.
<add>
<add>Header field names are *case-insensitive* and are transmitted over the wire
<add>strictly as lower-case strings. The API provided by Node.js allows header
<add>names to be set as mixed-case strings (e.g. `Content-Type`) but will convert
<add>those to lower-case (e.g. `content-type`) upon transmission.
<add>
<add>Header field-names *must only* contain one or more of the following ASCII
<add>characters: `a`-`z`, `A`-`Z`, `0`-`9`, `!`, `#`, `$`, `%`, `&`, `'`, `*`, `+`,
<add>`-`, `.`, `^`, `_`, `` (backtick), `|`, and `~`.
<add>
<add>Using invalid characters within an HTTP header field name will cause the
<add>stream to be closed with a protocol error being reported.
<add>
<add>Header field values are handled with more leniency but *should* not contain
<add>new-line or carriage return characters and *should* be limited to US-ASCII
<add>characters, per the requirements of the HTTP specification.
<add>
<ide> ### Push streams on the client
<ide>
<ide> To receive pushed streams on the client, set a listener for the `'stream'` | 1 |
Javascript | Javascript | add localhost hack for windows | 2876141c4292791bc12c0b8701dbcc366dde7297 | <ide><path>lib/dns_uv.js
<ide> exports.lookup = function(domain, family, callback) {
<ide> return {};
<ide> }
<ide>
<add> // Hack required for Windows because Win7 removed the
<add> // localhost entry from c:\WINDOWS\system32\drivers\etc\hosts
<add> // See http://daniel.haxx.se/blog/2011/02/21/localhost-hack-on-windows/
<add> // TODO Remove this once c-ares handles this problem.
<add> if (process.platform == 'win32' && domain == 'localhost') {
<add> callback(null, '127.0.0.1', 4);
<add> return {};
<add> }
<add>
<ide> var matchedFamily = net.isIP(domain);
<ide> if (matchedFamily) {
<ide> callback(null, domain, matchedFamily); | 1 |
Text | Text | add sharedarraybuffer to buffer documentation | bd0e36dbc60407f23dab92b57bcc7174ad2889da | <ide><path>doc/api/buffer.md
<ide> differently based on what arguments are provided:
<ide> memory.
<ide> * Passing a string, array, or `Buffer` as the first argument copies the
<ide> passed object's data into the `Buffer`.
<del>* Passing an [`ArrayBuffer`] returns a `Buffer` that shares allocated memory with
<del> the given [`ArrayBuffer`].
<add>* Passing an [`ArrayBuffer`] or a [`SharedArrayBuffer`] returns a `Buffer` that
<add> shares allocated memory with the given array buffer.
<ide>
<ide> Because the behavior of `new Buffer()` changes significantly based on the type
<ide> of value passed as the first argument, applications that do not properly
<ide> changes:
<ide> > [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][`Buffer.from(arrayBuffer)`]
<ide> > instead.
<ide>
<del>* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a
<del> [`TypedArray`].
<add>* `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`],
<add> [`SharedArrayBuffer`] or the `.buffer` property of a [`TypedArray`].
<ide> * `byteOffset` {integer} Index of first byte to expose. **Default:** `0`
<ide> * `length` {integer} Number of bytes to expose.
<ide> **Default:** `arrayBuffer.length - byteOffset`
<ide>
<del>This creates a view of the [`ArrayBuffer`] without copying the underlying
<del>memory. For example, when passed a reference to the `.buffer` property of a
<del>[`TypedArray`] instance, the newly created `Buffer` will share the same
<del>allocated memory as the [`TypedArray`].
<add>This creates a view of the [`ArrayBuffer`] or [`SharedArrayBuffer`] without
<add>copying the underlying memory. For example, when passed a reference to the
<add>`.buffer` property of a [`TypedArray`] instance, the newly created `Buffer` will
<add>share the same allocated memory as the [`TypedArray`].
<ide>
<ide> The optional `byteOffset` and `length` arguments specify a memory range within
<ide> the `arrayBuffer` that will be shared by the `Buffer`.
<ide> changes:
<ide> or `ArrayBuffer`.
<ide> -->
<ide>
<del>* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer} A value to
<del> calculate the length of.
<add>* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer|SharedArrayBuffer} A
<add> value to calculate the length of.
<ide> * `encoding` {string} If `string` is a string, this is its encoding.
<ide> **Default:** `'utf8'`
<ide> * Returns: {integer} The number of bytes contained within `string`.
<ide> console.log(`${str}: ${str.length} characters, ` +
<ide> `${Buffer.byteLength(str, 'utf8')} bytes`);
<ide> ```
<ide>
<del>When `string` is a `Buffer`/[`DataView`]/[`TypedArray`]/[`ArrayBuffer`], the
<del>actual byte length is returned.
<add>When `string` is a `Buffer`/[`DataView`]/[`TypedArray`]/[`ArrayBuffer`]/
<add>[`SharedArrayBuffer`], the actual byte length is returned.
<ide>
<ide> ### Class Method: Buffer.compare(buf1, buf2)
<ide> <!-- YAML
<ide> A `TypeError` will be thrown if `array` is not an `Array`.
<ide> added: v5.10.0
<ide> -->
<ide>
<del>* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a
<del> [`TypedArray`].
<add>* `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`],
<add> [`SharedArrayBuffer`], or the `.buffer` property of a [`TypedArray`].
<ide> * `byteOffset` {integer} Index of first byte to expose. **Default:** `0`
<ide> * `length` {integer} Number of bytes to expose.
<ide> **Default:** `arrayBuffer.length - byteOffset`
<ide> const buf = Buffer.from(ab, 0, 2);
<ide> console.log(buf.length);
<ide> ```
<ide>
<del>A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`].
<add>A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`] or a
<add>[`SharedArrayBuffer`].
<ide>
<ide> ### Class Method: Buffer.from(buffer)
<ide> <!-- YAML
<ide> This value may depend on the JS engine that is being used.
<ide> [`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
<ide> [`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
<ide> [`RangeError`]: errors.html#errors_class_rangeerror
<add>[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
<ide> [`String#indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
<ide> [`String#lastIndexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf
<ide> [`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length | 1 |
Ruby | Ruby | remove unused code | 3c2e7a83197f72693079e788ac439e18672edcba | <ide><path>activerecord/test/cases/migration_test.rb
<ide> def test_change_column_with_new_precision_and_scale
<ide>
<ide> Person.delete_all
<ide> Person.connection.add_column 'people', 'wealth', :decimal, :precision => 9, :scale => 7
<del> Person.reset_column_information
<ide>
<ide> Person.connection.change_column 'people', 'wealth', :decimal, :precision => 12, :scale => 8
<ide> Person.reset_column_information | 1 |
Javascript | Javascript | reduce delta threshold for now | a4a41d1f80e6c8d0e607d67b85efe2e0a2b954a7 | <ide><path>packages/sproutcore-touch/lib/gesture_recognizers/pinch.js
<ide> SC.PinchGestureRecognizer = SC.Gesture.extend({
<ide>
<ide> _currentDistanceBetweenTouches: null,
<ide> _previousDistanceBetweenTouches: null,
<del> _deltaThreshold: 10,
<add> _deltaThreshold: 0,
<ide>
<ide> scale: 0,
<ide> | 1 |
Javascript | Javascript | fix handling of some cameras in mirror.js | 9af3f082e8f710eb2e4704f4aee3941a74ed2cfd | <ide><path>examples/js/Mirror.js
<ide> THREE.Mirror = function ( renderer, camera, options ) {
<ide> this.textureMatrix = new THREE.Matrix4();
<ide>
<ide> this.mirrorCamera = this.camera.clone();
<add> this.mirrorCamera.matrixAutoUpdate = true;
<ide>
<ide> this.texture = new THREE.WebGLRenderTarget( width, height );
<ide> this.tempTexture = new THREE.WebGLRenderTarget( width, height );
<ide> THREE.Mirror = function ( renderer, camera, options ) {
<ide> };
<ide>
<ide> THREE.Mirror.prototype = Object.create( THREE.Object3D.prototype );
<del>THREE.Mirror.prototype.constructor = THREE.Mirror;
<add>THREE.Mirror.prototype.constructor = THREE.Mirror;
<ide>
<ide> THREE.Mirror.prototype.renderWithMirror = function ( otherMirror ) {
<ide> | 1 |
Ruby | Ruby | improve fail output | 4d2201b8beabf99a1f4bf062a5aef12b19475caa | <ide><path>Library/Homebrew/test/support/helper/integration_command_test_case.rb
<ide> def cmd_output(*args)
<ide> def cmd(*args)
<ide> output = cmd_output(*args)
<ide> status = $?.exitstatus
<del> puts "\n'brew #{args.join " "}' output: #{output}" if status.nonzero?
<del> assert_equal 0, status
<add> assert_equal 0, status, <<-EOS.undent
<add> `brew #{args.join " "}` exited with non-zero status!
<add> #{output}
<add> EOS
<ide> output
<ide> end
<ide>
<ide> def cmd_fail(*args)
<ide> output = cmd_output(*args)
<ide> status = $?.exitstatus
<del> $stderr.puts "\n'brew #{args.join " "}'" if status.zero?
<del> refute_equal 0, status
<add> refute_equal 0, status, <<-EOS.undent
<add> `brew #{args.join " "}` exited with zero status!
<add> #{output}
<add> EOS
<ide> output
<ide> end
<ide> | 1 |
Text | Text | add tpu readme | 7f87bfc910812f007c1b16a2ea4f2d85d2942ac5 | <ide><path>examples/research_projects/jax-projects/README.md
<ide> For more information, check out [this PR](https://github.com/huggingface/hugging
<ide>
<ide> ## How to setup TPU VM
<ide>
<del>TODO (should be filled by 2.07.)...
<add>In this section we will explain how you can ssh into a TPU VM that has been given to your team.
<add>If your username is in one of the officially defined projects [here](https://docs.google.com/spreadsheets/d/1GpHebL7qrwJOc9olTpIPgjf8vOS0jNb6zR_B8x_Jtik/edit?usp=sharing), you should have received two emails:
<ide>
<del>## How to use the hub for training and demo
<del>
<del>TODO (should be filled by 1.07.)...
<add>- one that states that you have been granted the role "Community Week Participants" for the project hf-flax, and
<add>- one (or more if you are in multiple projects) that gives you the TPU name and the TPU zone for the TPU of your team
<add>
<add>You should click on "Open Cloud Console" on the first mail and agree to the pop up windows that follows. It will allow you to use a TPU VM. Don't worry if you cannot access the actual project `hf-flax` visually on the google cloud console - this is expected!
<add>
<add>Great, now you and your team can access your TPU VM!
<add>
<add>In the following, we will describe how to do so using a standard console, but you should also be able to connect to the TPU VM via IDEs, like Visual Studio Code, etc.
<add>
<add>1. You need to install the Google Cloud SDK. Please follow the instructions on [cloud.google.com/sdk](https://cloud.google.com/sdk/docs/install#linux).
<add>
<add>2. Once you've installed the google cloud sdk, you should set your account by running the following command. Make sure that `<your-email-address>` corresponds to the gmail address you used to sign up for this event.
<add>
<add>```bash
<add>$ gcloud config set account <your-email-adress>
<add>```
<add>
<add>3. Next, you will need to authenticate yourself. You can do so by running:
<add>
<add>```bash
<add>$ gcloud auth login
<add>```
<add>
<add>This should give you a link to a website, where you can authenticate your gmail account.
<add>
<add>4. Finally, you can ssh into the TPU VM! Please run the following command by setting <zone> to either `europe-west4-a` or `us-central1-a` (depending on what is stated in the second email you received) and <tpu-name> to the TPU name also sent to you in the second email.
<add>
<add>```bash
<add>$ gcloud alpha compute tpus tpu-vm ssh <tpu-name> --zone <zone> --project hf-flax
<add>```
<add>
<add>This should ssh you into the TPU VM!
<add>Now you can follow the steps of the section [How to install relevant libraries](#how-to-install-relevant-libraries) to install all necessary
<add>libraries. Make sure to carefully follow the explanations of the "**IMPORTANT**" statement to correctly install JAX on TPU.
<add>Also feel free to install other `python` or `apt` packages on your machine if it helps you to work more efficiently!
<ide>
<ide> ## Project evaluation
<ide> | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.