commit
stringlengths 40
40
| old_file
stringlengths 4
184
| new_file
stringlengths 4
184
| old_contents
stringlengths 1
3.6k
| new_contents
stringlengths 5
3.38k
| subject
stringlengths 15
778
| message
stringlengths 16
6.74k
| lang
stringclasses 201
values | license
stringclasses 13
values | repos
stringlengths 6
116k
| config
stringclasses 201
values | content
stringlengths 137
7.24k
| diff
stringlengths 26
5.55k
| diff_length
int64 1
123
| relative_diff_length
float64 0.01
89
| n_lines_added
int64 0
108
| n_lines_deleted
int64 0
106
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e22be0e4d4338c4698cb88ed9300a8e8d7254453 | app/models/renalware/hd/session/dna.rb | app/models/renalware/hd/session/dna.rb | module Renalware
module HD
class Session::DNA < Session
def self.policy_class
DNASessionPolicy
end
def immutable?
return true unless persisted?
temporary_editing_window_has_elapsed?
end
private
def temporary_editing_window_has_elapsed?
delay = Renalware.config.delay_after_which_a_finished_session_becomes_immutable
(Time.zone.now - delay) > created_at
end
# DNA sessions have a nil jsonb `document` but to avoid clumsy nil? checks
# wherever session.documents are being used, always return a NullSessionDocument
# which will even allow you to do eg session.document.objecta.objectb.attribute1 without
# issue. Inspired by Avdi Grim's confident ruby approach and using his naught gem.
def document
super || NullSessionDocument.instance
end
end
end
end
| module Renalware
module HD
class Session::DNA < Session
def self.policy_class
DNASessionPolicy
end
def immutable?
return true unless persisted?
temporary_editing_window_has_elapsed?
end
private
def temporary_editing_window_has_elapsed?
delay = Renalware.config.delay_after_which_a_finished_session_becomes_immutable
(Time.zone.now - delay) > created_at
end
end
end
end
| Remove DNA null session document | Remove DNA null session document
Its causing issues elsewhere. Reinstate later,
| Ruby | mit | airslie/renalware-core,airslie/renalware-core,airslie/renalware-core,airslie/renalware-core | ruby | ## Code Before:
module Renalware
module HD
class Session::DNA < Session
def self.policy_class
DNASessionPolicy
end
def immutable?
return true unless persisted?
temporary_editing_window_has_elapsed?
end
private
def temporary_editing_window_has_elapsed?
delay = Renalware.config.delay_after_which_a_finished_session_becomes_immutable
(Time.zone.now - delay) > created_at
end
# DNA sessions have a nil jsonb `document` but to avoid clumsy nil? checks
# wherever session.documents are being used, always return a NullSessionDocument
# which will even allow you to do eg session.document.objecta.objectb.attribute1 without
# issue. Inspired by Avdi Grim's confident ruby approach and using his naught gem.
def document
super || NullSessionDocument.instance
end
end
end
end
## Instruction:
Remove DNA null session document
Its causing issues elsewhere. Reinstate later,
## Code After:
module Renalware
module HD
class Session::DNA < Session
def self.policy_class
DNASessionPolicy
end
def immutable?
return true unless persisted?
temporary_editing_window_has_elapsed?
end
private
def temporary_editing_window_has_elapsed?
delay = Renalware.config.delay_after_which_a_finished_session_becomes_immutable
(Time.zone.now - delay) > created_at
end
end
end
end
| module Renalware
module HD
class Session::DNA < Session
def self.policy_class
DNASessionPolicy
end
def immutable?
return true unless persisted?
temporary_editing_window_has_elapsed?
end
private
def temporary_editing_window_has_elapsed?
delay = Renalware.config.delay_after_which_a_finished_session_becomes_immutable
(Time.zone.now - delay) > created_at
end
-
- # DNA sessions have a nil jsonb `document` but to avoid clumsy nil? checks
- # wherever session.documents are being used, always return a NullSessionDocument
- # which will even allow you to do eg session.document.objecta.objectb.attribute1 without
- # issue. Inspired by Avdi Grim's confident ruby approach and using his naught gem.
- def document
- super || NullSessionDocument.instance
- end
end
end
end | 8 | 0.275862 | 0 | 8 |
30e742a56a04c8227f82db3d8e9da1808cb0526b | tests/integration/src/Graze/Monolog/LoggerBuilderIntegrationTest.php | tests/integration/src/Graze/Monolog/LoggerBuilderIntegrationTest.php | <?php
namespace Graze\Monolog;
use Monolog\Logger;
class LoggerBuilderIntegrationTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->builder = new LoggerBuilder();
}
public function testBuild()
{
$logger = $this->builder->build();
$this->assertSame(LoggerBuilder::DEFAULT_NAME, $logger->getName());
}
}
| <?php
namespace Graze\Monolog;
use Monolog\Logger;
class LoggerBuilderIntegrationTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->builder = new LoggerBuilder();
}
public function assertDefaultHandlers(Logger $logger)
{
$handlers = array();
do {
try {
$handlers[] = $handler = $logger->popHandler();
} catch (\Exception $e) {
}
} while (!isset($e));
$this->assertSame(array(), $handlers, 'There are more handlers defined than should be');
}
public function assertDefaultProcessors(Logger $logger)
{
$processors = array();
do {
try {
$processors[] = $processor = $logger->popProcessor();
} catch (\Exception $e) {
}
} while (!isset($e));
$this->assertInstanceOf('Graze\Monolog\Processor\ExceptionMessageProcessor', array_shift($processors));
$this->assertInstanceOf('Graze\Monolog\Processor\EnvironmentProcessor', array_shift($processors));
$this->assertInstanceOf('Graze\Monolog\Processor\HttpProcessor', array_shift($processors));
$this->assertSame(array(), $processors, 'There are more processors defined than should be');
}
public function testBuild()
{
$logger = $this->builder->build();
$this->assertSame(LoggerBuilder::DEFAULT_NAME, $logger->getName());
$this->assertDefaultHandlers($logger);
$this->assertDefaultProcessors($logger);
}
}
| Test default values are set on the built logger | Test default values are set on the built logger
| PHP | mit | Lead-iD/monolog-extensions,graze/monolog-extensions | php | ## Code Before:
<?php
namespace Graze\Monolog;
use Monolog\Logger;
class LoggerBuilderIntegrationTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->builder = new LoggerBuilder();
}
public function testBuild()
{
$logger = $this->builder->build();
$this->assertSame(LoggerBuilder::DEFAULT_NAME, $logger->getName());
}
}
## Instruction:
Test default values are set on the built logger
## Code After:
<?php
namespace Graze\Monolog;
use Monolog\Logger;
class LoggerBuilderIntegrationTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->builder = new LoggerBuilder();
}
public function assertDefaultHandlers(Logger $logger)
{
$handlers = array();
do {
try {
$handlers[] = $handler = $logger->popHandler();
} catch (\Exception $e) {
}
} while (!isset($e));
$this->assertSame(array(), $handlers, 'There are more handlers defined than should be');
}
public function assertDefaultProcessors(Logger $logger)
{
$processors = array();
do {
try {
$processors[] = $processor = $logger->popProcessor();
} catch (\Exception $e) {
}
} while (!isset($e));
$this->assertInstanceOf('Graze\Monolog\Processor\ExceptionMessageProcessor', array_shift($processors));
$this->assertInstanceOf('Graze\Monolog\Processor\EnvironmentProcessor', array_shift($processors));
$this->assertInstanceOf('Graze\Monolog\Processor\HttpProcessor', array_shift($processors));
$this->assertSame(array(), $processors, 'There are more processors defined than should be');
}
public function testBuild()
{
$logger = $this->builder->build();
$this->assertSame(LoggerBuilder::DEFAULT_NAME, $logger->getName());
$this->assertDefaultHandlers($logger);
$this->assertDefaultProcessors($logger);
}
}
| <?php
namespace Graze\Monolog;
use Monolog\Logger;
class LoggerBuilderIntegrationTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->builder = new LoggerBuilder();
}
+ public function assertDefaultHandlers(Logger $logger)
+ {
+ $handlers = array();
+ do {
+ try {
+ $handlers[] = $handler = $logger->popHandler();
+ } catch (\Exception $e) {
+ }
+ } while (!isset($e));
+
+ $this->assertSame(array(), $handlers, 'There are more handlers defined than should be');
+ }
+
+ public function assertDefaultProcessors(Logger $logger)
+ {
+ $processors = array();
+ do {
+ try {
+ $processors[] = $processor = $logger->popProcessor();
+ } catch (\Exception $e) {
+ }
+ } while (!isset($e));
+
+ $this->assertInstanceOf('Graze\Monolog\Processor\ExceptionMessageProcessor', array_shift($processors));
+ $this->assertInstanceOf('Graze\Monolog\Processor\EnvironmentProcessor', array_shift($processors));
+ $this->assertInstanceOf('Graze\Monolog\Processor\HttpProcessor', array_shift($processors));
+ $this->assertSame(array(), $processors, 'There are more processors defined than should be');
+ }
+
public function testBuild()
{
$logger = $this->builder->build();
$this->assertSame(LoggerBuilder::DEFAULT_NAME, $logger->getName());
+ $this->assertDefaultHandlers($logger);
+ $this->assertDefaultProcessors($logger);
}
} | 31 | 1.631579 | 31 | 0 |
e0490ccd8de93deb1af0a410dcf89190f5b609f9 | js/explore.js | js/explore.js | // take input string
// create empty output string
// remove last letter of input string
// add that letter to empty string
// keep doing this until the input string is empty
// return output string
function reverse(str) {
var newString = ""
for (var i = str.length; i > 0, i--)
newString += str[i]
} | // take input string
// create empty output string
// get the last letter of the input string
// add that letter to empty string
// keep doing this until we've gone through the entire input string
// return output string
function reverse(str) {
var newString = "";
for (var i = str.length-1; i >= 0; i--) {
newString += str[i]
}
console.log(newString);
return newString
}
// driver code to test program
var test1 = reverse("Ellie");
var test2 = reverse("elephant");
var test3 = reverse("unencumbered");
console.log(test1)
if (1==1) {
console.log(test2)
} | Add driver code to test function | Add driver code to test function
| JavaScript | mit | elliedori/phase-0-tracks,elliedori/phase-0-tracks,elliedori/phase-0-tracks | javascript | ## Code Before:
// take input string
// create empty output string
// remove last letter of input string
// add that letter to empty string
// keep doing this until the input string is empty
// return output string
function reverse(str) {
var newString = ""
for (var i = str.length; i > 0, i--)
newString += str[i]
}
## Instruction:
Add driver code to test function
## Code After:
// take input string
// create empty output string
// get the last letter of the input string
// add that letter to empty string
// keep doing this until we've gone through the entire input string
// return output string
function reverse(str) {
var newString = "";
for (var i = str.length-1; i >= 0; i--) {
newString += str[i]
}
console.log(newString);
return newString
}
// driver code to test program
var test1 = reverse("Ellie");
var test2 = reverse("elephant");
var test3 = reverse("unencumbered");
console.log(test1)
if (1==1) {
console.log(test2)
} | // take input string
// create empty output string
- // remove last letter of input string
? ^ ^^^
+ // get the last letter of the input string
? ^ ^^^^ ++++
// add that letter to empty string
- // keep doing this until the input string is empty
+ // keep doing this until we've gone through the entire input string
// return output string
+
function reverse(str) {
+
- var newString = ""
+ var newString = "";
? +
+
- for (var i = str.length; i > 0, i--)
? ^
+ for (var i = str.length-1; i >= 0; i--) {
? ++ + ^ ++
newString += str[i]
+ }
+
+ console.log(newString);
+ return newString
}
+
+
+ // driver code to test program
+
+ var test1 = reverse("Ellie");
+ var test2 = reverse("elephant");
+ var test3 = reverse("unencumbered");
+
+ console.log(test1)
+
+ if (1==1) {
+ console.log(test2)
+ } | 28 | 2.333333 | 24 | 4 |
8de284f26728b529642cc79fbac71edbe295c967 | .codacy.yaml | .codacy.yaml | ---
exclude_paths:
- "api-java/src/test/**/*.*"
- "client/src/test/**/*.*"
| ---
exclude_paths:
- "api-java/src/test/**/*.*"
- "client/src/test/**/*.*"
- "firebase-endpoint/src/test/**/*.*"
| Exclude tests from Codacy check. | Exclude tests from Codacy check.
| YAML | apache-2.0 | SpineEventEngine/todo-list,SpineEventEngine/todo-list,SpineEventEngine/todo-list,SpineEventEngine/todo-list,SpineEventEngine/todo-list,SpineEventEngine/todo-list | yaml | ## Code Before:
---
exclude_paths:
- "api-java/src/test/**/*.*"
- "client/src/test/**/*.*"
## Instruction:
Exclude tests from Codacy check.
## Code After:
---
exclude_paths:
- "api-java/src/test/**/*.*"
- "client/src/test/**/*.*"
- "firebase-endpoint/src/test/**/*.*"
| ---
exclude_paths:
- "api-java/src/test/**/*.*"
- "client/src/test/**/*.*"
+ - "firebase-endpoint/src/test/**/*.*" | 1 | 0.25 | 1 | 0 |
a9cc67b9defeffc76091bd204f230a431db80196 | traftrack/image.py | traftrack/image.py | import PIL.Image
import PIL.ImageMath
import urllib.request
from io import BytesIO
def load_img_url(url):
req = urllib.request.urlopen(url)
data = BytesIO(req.read())
return PIL.Image.open(data)
def load_img_file(fname):
return PIL.Image.open(fname)
def compute_histo_RYG(img, mask):
img = img.convert(mode='RGB')
mask = mask.convert(mode='1')
black = PIL.Image.new('RGB', mask.size, color=(0, 0, 0, 0))
masked = PIL.Image.composite(img, black, mask)
palette = PIL.Image.new('P', (1, 1))
palette.putpalette(
[0, 0, 0, # black
255, 0, 0, # red
255, 255, 0, # yellow
0, 255, 0]) # green
quantized = masked.quantize(palette=palette)
colors = quantized.getcolors()
return colors[1][0], colors[2][0], colors[3][0]
| import PIL.Image
import PIL.ImageMath
import urllib.request
from io import BytesIO
def load_img_url(url):
req = urllib.request.urlopen(url)
data = BytesIO(req.read())
return PIL.Image.open(data)
def load_img_file(fname):
return PIL.Image.open(fname)
def compute_histo_RYG(img, mask):
img = img.convert(mode='RGB')
mask = mask.convert(mode='1')
black = PIL.Image.new('RGB', mask.size, color=(0, 0, 0, 0))
masked = PIL.Image.composite(img, black, mask)
palette = PIL.Image.new('P', (1, 1))
palette.putpalette(
[0, 0, 0, # black
255, 0, 0, # red
255, 255, 0, # yellow
0, 255, 0]) # green
quantized = masked.quantize(palette=palette)
colors = quantized.getcolors()
r = next((c[0] for c in colors if c[1] == 1), 0)
y = next((c[0] for c in colors if c[1] == 2), 0)
g = next((c[0] for c in colors if c[1] == 3), 0)
return r, y, g
| Fix issue with non-existing color in compute_histo_RYG | Fix issue with non-existing color in compute_histo_RYG
| Python | mit | asavonic/traftrack | python | ## Code Before:
import PIL.Image
import PIL.ImageMath
import urllib.request
from io import BytesIO
def load_img_url(url):
req = urllib.request.urlopen(url)
data = BytesIO(req.read())
return PIL.Image.open(data)
def load_img_file(fname):
return PIL.Image.open(fname)
def compute_histo_RYG(img, mask):
img = img.convert(mode='RGB')
mask = mask.convert(mode='1')
black = PIL.Image.new('RGB', mask.size, color=(0, 0, 0, 0))
masked = PIL.Image.composite(img, black, mask)
palette = PIL.Image.new('P', (1, 1))
palette.putpalette(
[0, 0, 0, # black
255, 0, 0, # red
255, 255, 0, # yellow
0, 255, 0]) # green
quantized = masked.quantize(palette=palette)
colors = quantized.getcolors()
return colors[1][0], colors[2][0], colors[3][0]
## Instruction:
Fix issue with non-existing color in compute_histo_RYG
## Code After:
import PIL.Image
import PIL.ImageMath
import urllib.request
from io import BytesIO
def load_img_url(url):
req = urllib.request.urlopen(url)
data = BytesIO(req.read())
return PIL.Image.open(data)
def load_img_file(fname):
return PIL.Image.open(fname)
def compute_histo_RYG(img, mask):
img = img.convert(mode='RGB')
mask = mask.convert(mode='1')
black = PIL.Image.new('RGB', mask.size, color=(0, 0, 0, 0))
masked = PIL.Image.composite(img, black, mask)
palette = PIL.Image.new('P', (1, 1))
palette.putpalette(
[0, 0, 0, # black
255, 0, 0, # red
255, 255, 0, # yellow
0, 255, 0]) # green
quantized = masked.quantize(palette=palette)
colors = quantized.getcolors()
r = next((c[0] for c in colors if c[1] == 1), 0)
y = next((c[0] for c in colors if c[1] == 2), 0)
g = next((c[0] for c in colors if c[1] == 3), 0)
return r, y, g
| import PIL.Image
import PIL.ImageMath
import urllib.request
from io import BytesIO
def load_img_url(url):
req = urllib.request.urlopen(url)
data = BytesIO(req.read())
return PIL.Image.open(data)
def load_img_file(fname):
return PIL.Image.open(fname)
def compute_histo_RYG(img, mask):
img = img.convert(mode='RGB')
mask = mask.convert(mode='1')
black = PIL.Image.new('RGB', mask.size, color=(0, 0, 0, 0))
masked = PIL.Image.composite(img, black, mask)
palette = PIL.Image.new('P', (1, 1))
palette.putpalette(
[0, 0, 0, # black
255, 0, 0, # red
255, 255, 0, # yellow
0, 255, 0]) # green
quantized = masked.quantize(palette=palette)
colors = quantized.getcolors()
- return colors[1][0], colors[2][0], colors[3][0]
+ r = next((c[0] for c in colors if c[1] == 1), 0)
+ y = next((c[0] for c in colors if c[1] == 2), 0)
+ g = next((c[0] for c in colors if c[1] == 3), 0)
+
+ return r, y, g | 6 | 0.176471 | 5 | 1 |
cee330e9fd976475949013ae35153e866aee6feb | _posts/2017-02-04-binary-search-implementation-in-go.md | _posts/2017-02-04-binary-search-implementation-in-go.md | ---
layout: post
title: Implementation of Binary Search Algorithm in Go
---
Last few days, I am looking into the go programming language.It seems like to me the C programing language with less complexity.As a very beginner of the language, I tried to implement the basic binary search algorithm in go.
here is the code --
{% highlight go %}
package main
import "fmt"
func BinarySearch(arr [] int, x int) bool{
var lowerBound int = 0
var higherBound int = len(arr) - 1
for lowerBound <= higherBound {
var midPoint = lowerBound + (higherBound - lowerBound) /2
if arr[midPoint] < x {
lowerBound = midPoint + 1
}
if arr[midPoint] > x {
higherBound = midPoint - 1
}
if arr[midPoint] == x {
return true
}
}
return false;
}
func main() {
fmt.Println("BinarySearch")
arry := [] int{1,2,3,4,5}
fmt.Println(BinarySearch(arry,4))
}
{% endhighlight %} | ---
layout: post
title: Implementation of Binary Search Algorithm in go programming language
---
Last few days, I am looking into the go programming language.It seems like to me the C programing language with less complexity.As a very beginner of the language, I tried to implement the basic binary search algorithm in go.
here is the code --
{% highlight go %}
package main
import "fmt"
func BinarySearch(arr [] int, x int) bool{
var lowerBound int = 0
var higherBound int = len(arr) - 1
for lowerBound <= higherBound {
var midPoint = lowerBound + (higherBound - lowerBound) /2
if arr[midPoint] < x {
lowerBound = midPoint + 1
}
if arr[midPoint] > x {
higherBound = midPoint - 1
}
if arr[midPoint] == x {
return true
}
}
return false;
}
func main() {
fmt.Println("BinarySearch")
arry := [] int{1,2,3,4,5}
fmt.Println(BinarySearch(arry,4))
}
{% endhighlight %} | Revert "added the go algorithms" | Revert "added the go algorithms"
This reverts commit 985cda0d4c6efb7f2de1f3ed7fd22ffd434560fd.
| Markdown | mit | frhan/frhan.github.io,frhan/frhan.github.io | markdown | ## Code Before:
---
layout: post
title: Implementation of Binary Search Algorithm in Go
---
Last few days, I am looking into the go programming language.It seems like to me the C programing language with less complexity.As a very beginner of the language, I tried to implement the basic binary search algorithm in go.
here is the code --
{% highlight go %}
package main
import "fmt"
func BinarySearch(arr [] int, x int) bool{
var lowerBound int = 0
var higherBound int = len(arr) - 1
for lowerBound <= higherBound {
var midPoint = lowerBound + (higherBound - lowerBound) /2
if arr[midPoint] < x {
lowerBound = midPoint + 1
}
if arr[midPoint] > x {
higherBound = midPoint - 1
}
if arr[midPoint] == x {
return true
}
}
return false;
}
func main() {
fmt.Println("BinarySearch")
arry := [] int{1,2,3,4,5}
fmt.Println(BinarySearch(arry,4))
}
{% endhighlight %}
## Instruction:
Revert "added the go algorithms"
This reverts commit 985cda0d4c6efb7f2de1f3ed7fd22ffd434560fd.
## Code After:
---
layout: post
title: Implementation of Binary Search Algorithm in go programming language
---
Last few days, I am looking into the go programming language.It seems like to me the C programing language with less complexity.As a very beginner of the language, I tried to implement the basic binary search algorithm in go.
here is the code --
{% highlight go %}
package main
import "fmt"
func BinarySearch(arr [] int, x int) bool{
var lowerBound int = 0
var higherBound int = len(arr) - 1
for lowerBound <= higherBound {
var midPoint = lowerBound + (higherBound - lowerBound) /2
if arr[midPoint] < x {
lowerBound = midPoint + 1
}
if arr[midPoint] > x {
higherBound = midPoint - 1
}
if arr[midPoint] == x {
return true
}
}
return false;
}
func main() {
fmt.Println("BinarySearch")
arry := [] int{1,2,3,4,5}
fmt.Println(BinarySearch(arry,4))
}
{% endhighlight %} | ---
layout: post
- title: Implementation of Binary Search Algorithm in Go
? ^
+ title: Implementation of Binary Search Algorithm in go programming language
? ^ +++++++++++++++++++++
---
Last few days, I am looking into the go programming language.It seems like to me the C programing language with less complexity.As a very beginner of the language, I tried to implement the basic binary search algorithm in go.
here is the code --
{% highlight go %}
package main
import "fmt"
func BinarySearch(arr [] int, x int) bool{
var lowerBound int = 0
var higherBound int = len(arr) - 1
for lowerBound <= higherBound {
var midPoint = lowerBound + (higherBound - lowerBound) /2
if arr[midPoint] < x {
lowerBound = midPoint + 1
}
if arr[midPoint] > x {
higherBound = midPoint - 1
}
if arr[midPoint] == x {
return true
}
}
return false;
}
func main() {
fmt.Println("BinarySearch")
arry := [] int{1,2,3,4,5}
fmt.Println(BinarySearch(arry,4))
}
{% endhighlight %} | 2 | 0.044444 | 1 | 1 |
f8db46b40629cfdb145a4a000d47277f72090c5b | powerline/lib/memoize.py | powerline/lib/memoize.py |
from functools import wraps
import time
def default_cache_key(**kwargs):
return frozenset(kwargs.items())
class memoize(object):
'''Memoization decorator with timeout.'''
def __init__(self, timeout, cache_key=default_cache_key, cache_reg_func=None):
self.timeout = timeout
self.cache_key = cache_key
self.cache = {}
self.cache_reg_func = cache_reg_func
def __call__(self, func):
@wraps(func)
def decorated_function(**kwargs):
if self.cache_reg_func:
self.cache_reg_func(self.cache)
self.cache_reg_func = None
key = self.cache_key(**kwargs)
try:
cached = self.cache.get(key, None)
except TypeError:
return func(**kwargs)
if cached is None or time.time() - cached['time'] > self.timeout:
cached = self.cache[key] = {
'result': func(**kwargs),
'time': time.time(),
}
return cached['result']
return decorated_function
|
from functools import wraps
try:
# Python>=3.3, the only valid clock source for this job
from time import monotonic as time
except ImportError:
# System time, is affected by clock updates.
from time import time
def default_cache_key(**kwargs):
return frozenset(kwargs.items())
class memoize(object):
'''Memoization decorator with timeout.'''
def __init__(self, timeout, cache_key=default_cache_key, cache_reg_func=None):
self.timeout = timeout
self.cache_key = cache_key
self.cache = {}
self.cache_reg_func = cache_reg_func
def __call__(self, func):
@wraps(func)
def decorated_function(**kwargs):
if self.cache_reg_func:
self.cache_reg_func(self.cache)
self.cache_reg_func = None
key = self.cache_key(**kwargs)
try:
cached = self.cache.get(key, None)
except TypeError:
return func(**kwargs)
# Handle case when time() appears to be less then cached['time'] due
# to clock updates. Not applicable for monotonic clock, but this
# case is currently rare.
if cached is None or not (cached['time'] < time() < cached['time'] + self.timeout):
cached = self.cache[key] = {
'result': func(**kwargs),
'time': time(),
}
return cached['result']
return decorated_function
| Use proper clock if possible | Use proper clock if possible
| Python | mit | Liangjianghao/powerline,kenrachynski/powerline,darac/powerline,darac/powerline,bezhermoso/powerline,firebitsbr/powerline,bartvm/powerline,cyrixhero/powerline,junix/powerline,prvnkumar/powerline,s0undt3ch/powerline,S0lll0s/powerline,Luffin/powerline,EricSB/powerline,dragon788/powerline,prvnkumar/powerline,wfscheper/powerline,xfumihiro/powerline,magus424/powerline,IvanAli/powerline,cyrixhero/powerline,seanfisk/powerline,bartvm/powerline,wfscheper/powerline,dragon788/powerline,xfumihiro/powerline,magus424/powerline,cyrixhero/powerline,xxxhycl2010/powerline,dragon788/powerline,lukw00/powerline,DoctorJellyface/powerline,blindFS/powerline,seanfisk/powerline,blindFS/powerline,IvanAli/powerline,IvanAli/powerline,keelerm84/powerline,Luffin/powerline,s0undt3ch/powerline,Liangjianghao/powerline,blindFS/powerline,S0lll0s/powerline,EricSB/powerline,lukw00/powerline,junix/powerline,areteix/powerline,junix/powerline,QuLogic/powerline,prvnkumar/powerline,seanfisk/powerline,bezhermoso/powerline,QuLogic/powerline,russellb/powerline,bezhermoso/powerline,russellb/powerline,bartvm/powerline,darac/powerline,lukw00/powerline,kenrachynski/powerline,firebitsbr/powerline,areteix/powerline,magus424/powerline,xfumihiro/powerline,Luffin/powerline,keelerm84/powerline,s0undt3ch/powerline,DoctorJellyface/powerline,wfscheper/powerline,xxxhycl2010/powerline,xxxhycl2010/powerline,firebitsbr/powerline,russellb/powerline,EricSB/powerline,DoctorJellyface/powerline,Liangjianghao/powerline,areteix/powerline,S0lll0s/powerline,kenrachynski/powerline,QuLogic/powerline | python | ## Code Before:
from functools import wraps
import time
def default_cache_key(**kwargs):
return frozenset(kwargs.items())
class memoize(object):
'''Memoization decorator with timeout.'''
def __init__(self, timeout, cache_key=default_cache_key, cache_reg_func=None):
self.timeout = timeout
self.cache_key = cache_key
self.cache = {}
self.cache_reg_func = cache_reg_func
def __call__(self, func):
@wraps(func)
def decorated_function(**kwargs):
if self.cache_reg_func:
self.cache_reg_func(self.cache)
self.cache_reg_func = None
key = self.cache_key(**kwargs)
try:
cached = self.cache.get(key, None)
except TypeError:
return func(**kwargs)
if cached is None or time.time() - cached['time'] > self.timeout:
cached = self.cache[key] = {
'result': func(**kwargs),
'time': time.time(),
}
return cached['result']
return decorated_function
## Instruction:
Use proper clock if possible
## Code After:
from functools import wraps
try:
# Python>=3.3, the only valid clock source for this job
from time import monotonic as time
except ImportError:
# System time, is affected by clock updates.
from time import time
def default_cache_key(**kwargs):
return frozenset(kwargs.items())
class memoize(object):
'''Memoization decorator with timeout.'''
def __init__(self, timeout, cache_key=default_cache_key, cache_reg_func=None):
self.timeout = timeout
self.cache_key = cache_key
self.cache = {}
self.cache_reg_func = cache_reg_func
def __call__(self, func):
@wraps(func)
def decorated_function(**kwargs):
if self.cache_reg_func:
self.cache_reg_func(self.cache)
self.cache_reg_func = None
key = self.cache_key(**kwargs)
try:
cached = self.cache.get(key, None)
except TypeError:
return func(**kwargs)
# Handle case when time() appears to be less then cached['time'] due
# to clock updates. Not applicable for monotonic clock, but this
# case is currently rare.
if cached is None or not (cached['time'] < time() < cached['time'] + self.timeout):
cached = self.cache[key] = {
'result': func(**kwargs),
'time': time(),
}
return cached['result']
return decorated_function
|
from functools import wraps
- import time
+ try:
+ # Python>=3.3, the only valid clock source for this job
+ from time import monotonic as time
+ except ImportError:
+ # System time, is affected by clock updates.
+ from time import time
def default_cache_key(**kwargs):
return frozenset(kwargs.items())
class memoize(object):
'''Memoization decorator with timeout.'''
def __init__(self, timeout, cache_key=default_cache_key, cache_reg_func=None):
self.timeout = timeout
self.cache_key = cache_key
self.cache = {}
self.cache_reg_func = cache_reg_func
def __call__(self, func):
@wraps(func)
def decorated_function(**kwargs):
if self.cache_reg_func:
self.cache_reg_func(self.cache)
self.cache_reg_func = None
key = self.cache_key(**kwargs)
try:
cached = self.cache.get(key, None)
except TypeError:
return func(**kwargs)
+ # Handle case when time() appears to be less then cached['time'] due
+ # to clock updates. Not applicable for monotonic clock, but this
+ # case is currently rare.
- if cached is None or time.time() - cached['time'] > self.timeout:
? ^ ^ ^
+ if cached is None or not (cached['time'] < time() < cached['time'] + self.timeout):
? +++++++++++++ ^^^^^ ^ ^ +
cached = self.cache[key] = {
'result': func(**kwargs),
- 'time': time.time(),
? -----
+ 'time': time(),
}
return cached['result']
return decorated_function | 14 | 0.388889 | 11 | 3 |
59c6d2fc157976b1b39f57acf745b41d6e33a783 | lib/ab_admin/i18n_tools/google_translate.rb | lib/ab_admin/i18n_tools/google_translate.rb | require 'multi_json'
require 'rest-client'
module AbAdmin
module I18nTools
module GoogleTranslate
def self.t(text, from, to)
return '' if text.blank?
return text if from == to
base = 'https://www.googleapis.com/language/translate/v2'
params = {
key: ENV['GOOGLE_API_KEY'] || Settings.data.else.try!(:google_api_key),
format: 'html',
source: from,
target: to,
q: text
}
response = RestClient.post(base, params, 'X-HTTP-Method-Override' => 'GET')
if response.code == 200
json = MultiJson.decode(response)
json['data']['translations'][0]['translatedText']
else
raise StandardError, response.inspect
end
end
end
end
end
| require 'multi_json'
require 'rest-client'
module AbAdmin
module I18nTools
module GoogleTranslate
def self.t(text, from, to)
return '' if text.blank?
return text if from == to
base = 'https://www.googleapis.com/language/translate/v2'
params = {
key: ENV['GOOGLE_API_KEY'] || Settings.data.else.try!(:google_api_key),
format: 'html',
source: from,
target: to,
q: text
}
response = RestClient.post(base, params, 'X-HTTP-Method-Override' => 'GET')
if response.code == 200
json = MultiJson.decode(response)
res = json['data']['translations'][0]['translatedText'].to_s.gsub(/%\s{/, ' %{')
res = "#{res[0].upcase}#{res[1..-1]}" if text.first[/[[:upper:]]/]
res
else
raise StandardError, response.inspect
end
end
end
end
end
| Add formatting to google translate endpoint | Add formatting to google translate endpoint
| Ruby | mit | leschenko/ab_admin,leschenko/ab_admin,leschenko/ab_admin | ruby | ## Code Before:
require 'multi_json'
require 'rest-client'
module AbAdmin
module I18nTools
module GoogleTranslate
def self.t(text, from, to)
return '' if text.blank?
return text if from == to
base = 'https://www.googleapis.com/language/translate/v2'
params = {
key: ENV['GOOGLE_API_KEY'] || Settings.data.else.try!(:google_api_key),
format: 'html',
source: from,
target: to,
q: text
}
response = RestClient.post(base, params, 'X-HTTP-Method-Override' => 'GET')
if response.code == 200
json = MultiJson.decode(response)
json['data']['translations'][0]['translatedText']
else
raise StandardError, response.inspect
end
end
end
end
end
## Instruction:
Add formatting to google translate endpoint
## Code After:
require 'multi_json'
require 'rest-client'
module AbAdmin
module I18nTools
module GoogleTranslate
def self.t(text, from, to)
return '' if text.blank?
return text if from == to
base = 'https://www.googleapis.com/language/translate/v2'
params = {
key: ENV['GOOGLE_API_KEY'] || Settings.data.else.try!(:google_api_key),
format: 'html',
source: from,
target: to,
q: text
}
response = RestClient.post(base, params, 'X-HTTP-Method-Override' => 'GET')
if response.code == 200
json = MultiJson.decode(response)
res = json['data']['translations'][0]['translatedText'].to_s.gsub(/%\s{/, ' %{')
res = "#{res[0].upcase}#{res[1..-1]}" if text.first[/[[:upper:]]/]
res
else
raise StandardError, response.inspect
end
end
end
end
end
| require 'multi_json'
require 'rest-client'
module AbAdmin
module I18nTools
module GoogleTranslate
def self.t(text, from, to)
return '' if text.blank?
return text if from == to
base = 'https://www.googleapis.com/language/translate/v2'
params = {
key: ENV['GOOGLE_API_KEY'] || Settings.data.else.try!(:google_api_key),
format: 'html',
source: from,
target: to,
q: text
}
response = RestClient.post(base, params, 'X-HTTP-Method-Override' => 'GET')
if response.code == 200
json = MultiJson.decode(response)
- json['data']['translations'][0]['translatedText']
+ res = json['data']['translations'][0]['translatedText'].to_s.gsub(/%\s{/, ' %{')
? ++++++ +++++++++++++++++++++++++
+ res = "#{res[0].upcase}#{res[1..-1]}" if text.first[/[[:upper:]]/]
+ res
else
raise StandardError, response.inspect
end
end
end
end
end | 4 | 0.137931 | 3 | 1 |
c2ec8cda0c53dc675068df471c8c44b331dc2aea | Resources/views/Layout/tb.html.twig | Resources/views/Layout/tb.html.twig | {% extends 'KnpRadBundle:Layout:h5bp.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap.min.css') }}" />
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap-responsive.min.css') }}" />
{% endblock %}
{% block javascripts %}
<script src="{{ asset('bundles/knprad/common/js/jquery-1.8.2.min.js') }}"></script>
<script src="{{ asset('bundles/knprad/bootstrap/js/bootstrap.min.js') }}"></script>
{% endblock %}
{% block flashes %}
<div class="knprad-flashes" style="position:absolute;width:500px;z-index:1000;left:50%;margin-left:-250px;top:10px;">
{% for name, flash in app.session.flashes %}
<div class="alert alert-block alert-{{ name }}">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ flash.message|default(flash)|trans(flash.parameters|default({}))|raw }}
</div>
{% endfor %}
</div>
{% endblock %}
{% block body %}
{% endblock %}
| {% extends 'KnpRadBundle:Layout:h5bp.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap.min.css') }}" />
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap-responsive.min.css') }}" />
{% endblock %}
{% block javascripts %}
<script src="{{ asset('bundles/knprad/common/js/jquery-1.8.2.min.js') }}"></script>
<script src="{{ asset('bundles/knprad/bootstrap/js/bootstrap.min.js') }}"></script>
{% endblock %}
{% block flashes %}
{% flashes %}
<div class="alert alert-{{ type }}">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ message }}
</div>
{% endflashes %}
{% endblock %}
{% block body %}
{% endblock %}
| Use the flashes tag in the twitter bootstrap layout | Use the flashes tag in the twitter bootstrap layout
| Twig | mit | KnpLabs/KnpRadBundle,KnpLabs/KnpRadBundle,KnpLabs/KnpRadBundle | twig | ## Code Before:
{% extends 'KnpRadBundle:Layout:h5bp.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap.min.css') }}" />
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap-responsive.min.css') }}" />
{% endblock %}
{% block javascripts %}
<script src="{{ asset('bundles/knprad/common/js/jquery-1.8.2.min.js') }}"></script>
<script src="{{ asset('bundles/knprad/bootstrap/js/bootstrap.min.js') }}"></script>
{% endblock %}
{% block flashes %}
<div class="knprad-flashes" style="position:absolute;width:500px;z-index:1000;left:50%;margin-left:-250px;top:10px;">
{% for name, flash in app.session.flashes %}
<div class="alert alert-block alert-{{ name }}">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ flash.message|default(flash)|trans(flash.parameters|default({}))|raw }}
</div>
{% endfor %}
</div>
{% endblock %}
{% block body %}
{% endblock %}
## Instruction:
Use the flashes tag in the twitter bootstrap layout
## Code After:
{% extends 'KnpRadBundle:Layout:h5bp.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap.min.css') }}" />
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap-responsive.min.css') }}" />
{% endblock %}
{% block javascripts %}
<script src="{{ asset('bundles/knprad/common/js/jquery-1.8.2.min.js') }}"></script>
<script src="{{ asset('bundles/knprad/bootstrap/js/bootstrap.min.js') }}"></script>
{% endblock %}
{% block flashes %}
{% flashes %}
<div class="alert alert-{{ type }}">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ message }}
</div>
{% endflashes %}
{% endblock %}
{% block body %}
{% endblock %}
| {% extends 'KnpRadBundle:Layout:h5bp.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap.min.css') }}" />
<link rel="stylesheet" href="{{ asset('bundles/knprad/bootstrap/css/bootstrap-responsive.min.css') }}" />
{% endblock %}
{% block javascripts %}
<script src="{{ asset('bundles/knprad/common/js/jquery-1.8.2.min.js') }}"></script>
<script src="{{ asset('bundles/knprad/bootstrap/js/bootstrap.min.js') }}"></script>
{% endblock %}
{% block flashes %}
+ {% flashes %}
- <div class="knprad-flashes" style="position:absolute;width:500px;z-index:1000;left:50%;margin-left:-250px;top:10px;">
- {% for name, flash in app.session.flashes %}
- <div class="alert alert-block alert-{{ name }}">
? ------------ ^^^
+ <div class="alert alert-{{ type }}">
? ^^^
- <button type="button" class="close" data-dismiss="alert">×</button>
? ^
+ <button type="button" class="close" data-dismiss="alert">×</button>
? ^^^^^^^
- {{ flash.message|default(flash)|trans(flash.parameters|default({}))|raw }}
+ {{ message }}
</div>
- {% endfor %}
? ^^
+ {% endflashes %}
? ^^^^^^
- </div>
{% endblock %}
{% block body %}
{% endblock %} | 12 | 0.48 | 5 | 7 |
883d4808be8f5a5e8a9badf05e893eae1c4cefd3 | README.md | README.md | <!-- Nikita Kouevda -->
<!-- 2012/12/23 -->
# Imgur Album Downloader
Command-line downloading of Imgur albums.
## Usage
bash imgur.sh [-v] [album ...]
or (with execute permission):
./imgur.sh [-v] [album ...]
## Options
-v
Verbose output.
## Examples
./imgur.sh adkET
or
./imgur.sh http://imgur.com/a/adkET
## License
Licensed under the [MIT License](http://www.opensource.org/licenses/MIT).
| <!-- Nikita Kouevda -->
<!-- 2012/12/24 -->
# Imgur Album Downloader
Command-line downloading of Imgur albums.
## Usage
bash imgur.sh [-h] [-v] [album ...]
or (with execute permission):
./imgur.sh [-h] [-v] [album ...]
## Options
-h
Show the help message.
-v
Enable verbose output.
## Examples
./imgur.sh adkET
or
./imgur.sh http://imgur.com/a/adkET
## License
Licensed under the [MIT License](http://www.opensource.org/licenses/MIT).
| Update readme to document help option. | Update readme to document help option.
| Markdown | mit | nkouevda/albumr | markdown | ## Code Before:
<!-- Nikita Kouevda -->
<!-- 2012/12/23 -->
# Imgur Album Downloader
Command-line downloading of Imgur albums.
## Usage
bash imgur.sh [-v] [album ...]
or (with execute permission):
./imgur.sh [-v] [album ...]
## Options
-v
Verbose output.
## Examples
./imgur.sh adkET
or
./imgur.sh http://imgur.com/a/adkET
## License
Licensed under the [MIT License](http://www.opensource.org/licenses/MIT).
## Instruction:
Update readme to document help option.
## Code After:
<!-- Nikita Kouevda -->
<!-- 2012/12/24 -->
# Imgur Album Downloader
Command-line downloading of Imgur albums.
## Usage
bash imgur.sh [-h] [-v] [album ...]
or (with execute permission):
./imgur.sh [-h] [-v] [album ...]
## Options
-h
Show the help message.
-v
Enable verbose output.
## Examples
./imgur.sh adkET
or
./imgur.sh http://imgur.com/a/adkET
## License
Licensed under the [MIT License](http://www.opensource.org/licenses/MIT).
| <!-- Nikita Kouevda -->
- <!-- 2012/12/23 -->
? ^
+ <!-- 2012/12/24 -->
? ^
# Imgur Album Downloader
Command-line downloading of Imgur albums.
## Usage
- bash imgur.sh [-v] [album ...]
+ bash imgur.sh [-h] [-v] [album ...]
? +++++
or (with execute permission):
- ./imgur.sh [-v] [album ...]
+ ./imgur.sh [-h] [-v] [album ...]
? +++++
## Options
+ -h
+
+ Show the help message.
+
-v
- Verbose output.
? ^
+ Enable verbose output.
? ^^^^^^^^
## Examples
./imgur.sh adkET
or
./imgur.sh http://imgur.com/a/adkET
## License
Licensed under the [MIT License](http://www.opensource.org/licenses/MIT). | 12 | 0.375 | 8 | 4 |
f3382812806a7997a38a5bb0cf143a78ee328335 | docs-parts/definition/11-ERD_lang1.rst | docs-parts/definition/11-ERD_lang1.rst |
To plot the ERD for an entire schema in Python, an ERD object can be initialized with the schema object (which is normally used to decorate table objects)
.. code-block:: python
import datajoint as dj
schema = dj.schema('my_database')
dj.ERD(schema).draw()
or, alternatively an object that has the schema object as an attribute, such as the module defining a schema:
.. code-block:: python
import datajoint as dj
import seq # import the sequence module defining the seq database
dj.ERD(seq).draw() # draw the ERD
Note that calling the ``.draw()`` method is not necessary when working in a Jupyter notebook.
The preferred workflow is to simply let the object display itself, for example by writing ``dj.ERD(seq)``.
The ERD will then render in the notebook using its ``_repr_html_`` method.
An ERD displayed without ``.draw()`` will be rendered as an SVG, and hovering the mouse over a table will reveal a compact version of the output of the ``.describe()`` method.
|
To plot the ERD for an entire schema, an ERD object can be initialized with the schema object (which is normally used to decorate table objects)
.. code-block:: python
import datajoint as dj
schema = dj.schema('my_database')
dj.ERD(schema).draw()
or alternatively an object that has the schema object as an attribute, such as the module defining a schema:
.. code-block:: python
import datajoint as dj
import seq # import the sequence module defining the seq database
dj.ERD(seq).draw() # draw the ERD
Note that calling the ``.draw()`` method is not necessary when working in a Jupyter notebook.
The preferred workflow is to simply let the object display itself, for example by writing ``dj.ERD(seq)``.
The ERD will then render in the notebook using its ``_repr_html_`` method.
An ERD displayed without ``.draw()`` will be rendered as an SVG, and hovering the mouse over a table will reveal a compact version of the output of the ``.describe()`` method.
| Clean up ERD Python refs. | Clean up ERD Python refs.
| reStructuredText | lgpl-2.1 | dimitri-yatsenko/datajoint-python,eywalker/datajoint-python,datajoint/datajoint-python | restructuredtext | ## Code Before:
To plot the ERD for an entire schema in Python, an ERD object can be initialized with the schema object (which is normally used to decorate table objects)
.. code-block:: python
import datajoint as dj
schema = dj.schema('my_database')
dj.ERD(schema).draw()
or, alternatively an object that has the schema object as an attribute, such as the module defining a schema:
.. code-block:: python
import datajoint as dj
import seq # import the sequence module defining the seq database
dj.ERD(seq).draw() # draw the ERD
Note that calling the ``.draw()`` method is not necessary when working in a Jupyter notebook.
The preferred workflow is to simply let the object display itself, for example by writing ``dj.ERD(seq)``.
The ERD will then render in the notebook using its ``_repr_html_`` method.
An ERD displayed without ``.draw()`` will be rendered as an SVG, and hovering the mouse over a table will reveal a compact version of the output of the ``.describe()`` method.
## Instruction:
Clean up ERD Python refs.
## Code After:
To plot the ERD for an entire schema, an ERD object can be initialized with the schema object (which is normally used to decorate table objects)
.. code-block:: python
import datajoint as dj
schema = dj.schema('my_database')
dj.ERD(schema).draw()
or alternatively an object that has the schema object as an attribute, such as the module defining a schema:
.. code-block:: python
import datajoint as dj
import seq # import the sequence module defining the seq database
dj.ERD(seq).draw() # draw the ERD
Note that calling the ``.draw()`` method is not necessary when working in a Jupyter notebook.
The preferred workflow is to simply let the object display itself, for example by writing ``dj.ERD(seq)``.
The ERD will then render in the notebook using its ``_repr_html_`` method.
An ERD displayed without ``.draw()`` will be rendered as an SVG, and hovering the mouse over a table will reveal a compact version of the output of the ``.describe()`` method.
|
- To plot the ERD for an entire schema in Python, an ERD object can be initialized with the schema object (which is normally used to decorate table objects)
? ----------
+ To plot the ERD for an entire schema, an ERD object can be initialized with the schema object (which is normally used to decorate table objects)
.. code-block:: python
import datajoint as dj
schema = dj.schema('my_database')
dj.ERD(schema).draw()
- or, alternatively an object that has the schema object as an attribute, such as the module defining a schema:
? -
+ or alternatively an object that has the schema object as an attribute, such as the module defining a schema:
.. code-block:: python
import datajoint as dj
import seq # import the sequence module defining the seq database
dj.ERD(seq).draw() # draw the ERD
Note that calling the ``.draw()`` method is not necessary when working in a Jupyter notebook.
The preferred workflow is to simply let the object display itself, for example by writing ``dj.ERD(seq)``.
The ERD will then render in the notebook using its ``_repr_html_`` method.
An ERD displayed without ``.draw()`` will be rendered as an SVG, and hovering the mouse over a table will reveal a compact version of the output of the ``.describe()`` method. | 4 | 0.190476 | 2 | 2 |
d2fb1f22be6c6434873f2bcafb6b8a9b714acde9 | website/archiver/decorators.py | website/archiver/decorators.py | import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import utils
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
return func(*args, **kwargs)
except HTTPError as e:
_inject_nodes(kwargs)
registration = kwargs['node']
utils.handle_archive_fail(
ARCHIVER_UNCAUGHT_ERROR,
registration.registered_from,
registration,
registration.registered_user,
str(e)
)
return wrapped
| import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import signals
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
return func(*args, **kwargs)
except HTTPError as e:
_inject_nodes(kwargs)
registration = kwargs['node']
signals.send.archive_fail(
registration,
ARCHIVER_UNCAUGHT_ERROR,
[str(e)]
)
return wrapped
| Use fail signal in fail_archive_on_error decorator | Use fail signal in fail_archive_on_error decorator
| Python | apache-2.0 | amyshi188/osf.io,caneruguz/osf.io,TomHeatwole/osf.io,SSJohns/osf.io,mluke93/osf.io,DanielSBrown/osf.io,Nesiehr/osf.io,jeffreyliu3230/osf.io,chrisseto/osf.io,acshi/osf.io,mattclark/osf.io,billyhunt/osf.io,caneruguz/osf.io,cosenal/osf.io,SSJohns/osf.io,njantrania/osf.io,mattclark/osf.io,alexschiller/osf.io,samchrisinger/osf.io,HarryRybacki/osf.io,MerlinZhang/osf.io,mluo613/osf.io,TomBaxter/osf.io,mattclark/osf.io,kch8qx/osf.io,baylee-d/osf.io,chennan47/osf.io,asanfilippo7/osf.io,asanfilippo7/osf.io,amyshi188/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,brandonPurvis/osf.io,acshi/osf.io,bdyetton/prettychart,danielneis/osf.io,brianjgeiger/osf.io,kch8qx/osf.io,emetsger/osf.io,reinaH/osf.io,ticklemepierce/osf.io,felliott/osf.io,hmoco/osf.io,SSJohns/osf.io,danielneis/osf.io,wearpants/osf.io,HalcyonChimera/osf.io,jmcarp/osf.io,TomHeatwole/osf.io,ZobairAlijan/osf.io,mfraezz/osf.io,cldershem/osf.io,adlius/osf.io,laurenrevere/osf.io,jolene-esposito/osf.io,sloria/osf.io,Johnetordoff/osf.io,doublebits/osf.io,MerlinZhang/osf.io,caneruguz/osf.io,monikagrabowska/osf.io,Nesiehr/osf.io,billyhunt/osf.io,crcresearch/osf.io,njantrania/osf.io,brianjgeiger/osf.io,TomBaxter/osf.io,mfraezz/osf.io,hmoco/osf.io,jinluyuan/osf.io,monikagrabowska/osf.io,danielneis/osf.io,aaxelb/osf.io,Nesiehr/osf.io,caseyrygt/osf.io,kwierman/osf.io,cldershem/osf.io,brandonPurvis/osf.io,cwisecarver/osf.io,fabianvf/osf.io,amyshi188/osf.io,petermalcolm/osf.io,adlius/osf.io,rdhyee/osf.io,brandonPurvis/osf.io,laurenrevere/osf.io,rdhyee/osf.io,samanehsan/osf.io,haoyuchen1992/osf.io,asanfilippo7/osf.io,dplorimer/osf,leb2dg/osf.io,mfraezz/osf.io,abought/osf.io,amyshi188/osf.io,doublebits/osf.io,sbt9uc/osf.io,lyndsysimon/osf.io,dplorimer/osf,caneruguz/osf.io,laurenrevere/osf.io,ticklemepierce/osf.io,lyndsysimon/osf.io,DanielSBrown/osf.io,jmcarp/osf.io,baylee-d/osf.io,GageGaskins/osf.io,chennan47/osf.io,fabianvf/osf.io,cldershem/osf.io,jmcarp/osf.io,jnayak1/osf.io,binoculars/osf.io,zamattiac/osf.io,acshi/osf.io,crcresearch/osf.io,jinluyuan/osf.io,jnayak1/osf.io,binoculars/osf.io,Ghalko/osf.io,jinluyuan/osf.io,cosenal/osf.io,RomanZWang/osf.io,wearpants/osf.io,cslzchen/osf.io,ticklemepierce/osf.io,wearpants/osf.io,samchrisinger/osf.io,SSJohns/osf.io,jeffreyliu3230/osf.io,abought/osf.io,zachjanicki/osf.io,rdhyee/osf.io,DanielSBrown/osf.io,bdyetton/prettychart,MerlinZhang/osf.io,pattisdr/osf.io,chennan47/osf.io,bdyetton/prettychart,caseyrygt/osf.io,samanehsan/osf.io,pattisdr/osf.io,reinaH/osf.io,sloria/osf.io,caseyrollins/osf.io,zamattiac/osf.io,bdyetton/prettychart,caseyrollins/osf.io,TomHeatwole/osf.io,jeffreyliu3230/osf.io,cldershem/osf.io,mluo613/osf.io,KAsante95/osf.io,lyndsysimon/osf.io,zamattiac/osf.io,ZobairAlijan/osf.io,petermalcolm/osf.io,billyhunt/osf.io,chrisseto/osf.io,GageGaskins/osf.io,RomanZWang/osf.io,Ghalko/osf.io,petermalcolm/osf.io,zachjanicki/osf.io,TomHeatwole/osf.io,ckc6cz/osf.io,njantrania/osf.io,billyhunt/osf.io,CenterForOpenScience/osf.io,erinspace/osf.io,ckc6cz/osf.io,alexschiller/osf.io,DanielSBrown/osf.io,leb2dg/osf.io,cwisecarver/osf.io,billyhunt/osf.io,GageGaskins/osf.io,dplorimer/osf,arpitar/osf.io,dplorimer/osf,baylee-d/osf.io,adlius/osf.io,monikagrabowska/osf.io,HalcyonChimera/osf.io,doublebits/osf.io,kwierman/osf.io,adlius/osf.io,aaxelb/osf.io,jnayak1/osf.io,haoyuchen1992/osf.io,KAsante95/osf.io,cwisecarver/osf.io,hmoco/osf.io,HalcyonChimera/osf.io,brianjgeiger/osf.io,MerlinZhang/osf.io,RomanZWang/osf.io,RomanZWang/osf.io,ticklemepierce/osf.io,pattisdr/osf.io,erinspace/osf.io,arpitar/osf.io,icereval/osf.io,felliott/osf.io,KAsante95/osf.io,danielneis/osf.io,leb2dg/osf.io,caseyrygt/osf.io,GageGaskins/osf.io,petermalcolm/osf.io,mluo613/osf.io,KAsante95/osf.io,HalcyonChimera/osf.io,jeffreyliu3230/osf.io,zachjanicki/osf.io,zamattiac/osf.io,HarryRybacki/osf.io,ZobairAlijan/osf.io,cwisecarver/osf.io,njantrania/osf.io,chrisseto/osf.io,monikagrabowska/osf.io,CenterForOpenScience/osf.io,emetsger/osf.io,cosenal/osf.io,sbt9uc/osf.io,RomanZWang/osf.io,hmoco/osf.io,reinaH/osf.io,Ghalko/osf.io,icereval/osf.io,cslzchen/osf.io,arpitar/osf.io,reinaH/osf.io,zachjanicki/osf.io,jolene-esposito/osf.io,fabianvf/osf.io,alexschiller/osf.io,GageGaskins/osf.io,cslzchen/osf.io,brandonPurvis/osf.io,samchrisinger/osf.io,rdhyee/osf.io,Ghalko/osf.io,Johnetordoff/osf.io,mluo613/osf.io,brandonPurvis/osf.io,haoyuchen1992/osf.io,brianjgeiger/osf.io,samchrisinger/osf.io,caseyrygt/osf.io,erinspace/osf.io,kwierman/osf.io,monikagrabowska/osf.io,aaxelb/osf.io,HarryRybacki/osf.io,KAsante95/osf.io,leb2dg/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,kwierman/osf.io,caseyrollins/osf.io,sbt9uc/osf.io,samanehsan/osf.io,wearpants/osf.io,abought/osf.io,ckc6cz/osf.io,crcresearch/osf.io,chrisseto/osf.io,lyndsysimon/osf.io,jolene-esposito/osf.io,fabianvf/osf.io,binoculars/osf.io,kch8qx/osf.io,icereval/osf.io,mluke93/osf.io,Johnetordoff/osf.io,jmcarp/osf.io,mluo613/osf.io,acshi/osf.io,asanfilippo7/osf.io,saradbowman/osf.io,Nesiehr/osf.io,kch8qx/osf.io,mluke93/osf.io,mfraezz/osf.io,TomBaxter/osf.io,samanehsan/osf.io,mluke93/osf.io,arpitar/osf.io,jolene-esposito/osf.io,alexschiller/osf.io,cslzchen/osf.io,sbt9uc/osf.io,ZobairAlijan/osf.io,haoyuchen1992/osf.io,jinluyuan/osf.io,alexschiller/osf.io,jnayak1/osf.io,cosenal/osf.io,sloria/osf.io,HarryRybacki/osf.io,ckc6cz/osf.io,doublebits/osf.io,saradbowman/osf.io,abought/osf.io,doublebits/osf.io,kch8qx/osf.io,Johnetordoff/osf.io,emetsger/osf.io,emetsger/osf.io,acshi/osf.io,aaxelb/osf.io | python | ## Code Before:
import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import utils
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
return func(*args, **kwargs)
except HTTPError as e:
_inject_nodes(kwargs)
registration = kwargs['node']
utils.handle_archive_fail(
ARCHIVER_UNCAUGHT_ERROR,
registration.registered_from,
registration,
registration.registered_user,
str(e)
)
return wrapped
## Instruction:
Use fail signal in fail_archive_on_error decorator
## Code After:
import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import signals
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
return func(*args, **kwargs)
except HTTPError as e:
_inject_nodes(kwargs)
registration = kwargs['node']
signals.send.archive_fail(
registration,
ARCHIVER_UNCAUGHT_ERROR,
[str(e)]
)
return wrapped
| import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
- from website.archiver import utils
? ^^
+ from website.archiver import signals
? ^ +++
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
return func(*args, **kwargs)
except HTTPError as e:
_inject_nodes(kwargs)
registration = kwargs['node']
- utils.handle_archive_fail(
? ^^ ^^ ^^^
+ signals.send.archive_fail(
? ^ +++ ^^ ^
+ registration,
ARCHIVER_UNCAUGHT_ERROR,
- registration.registered_from,
- registration,
- registration.registered_user,
- str(e)
+ [str(e)]
? + +
)
return wrapped | 10 | 0.4 | 4 | 6 |
9c6ff62d31b2a611140b1ba86dff60dfc38e2b3f | .github/workflows/build-dev.yml | .github/workflows/build-dev.yml | name: Build and deploy
on:
push:
paths-ignore:
- 'docs/**'
- 'yarn.lock'
- 'package.json'
branches:
- dev
tags:
- '*'
jobs:
test-netcore-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.201'
- name: Run tests netcoreapp3.1
run: dotnet test -c Release -f netcoreapp3.1
test-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Run tests on Windows for all targets
run: dotnet test -c Release
nuget:
runs-on: windows-latest
needs: [test-win,test-netcore-linux]
steps:
- uses: actions/checkout@v1
- name: Create and push NuGet package
run: |
dotnet pack -c Release -o nuget -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | name: Build and deploy
on:
push:
paths-ignore:
- 'docs/**'
- 'yarn.lock'
- 'package.json'
branches:
- dev
tags:
- '*'
jobs:
# test-netcore-linux:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v1
# - uses: actions/setup-dotnet@v1
# with:
# dotnet-version: '3.1.201'
#
# - name: Run tests netcoreapp3.1
# run: dotnet test -c Release -f netcoreapp3.1
test-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Run tests on Windows for all targets
run: dotnet test -c Release
nuget:
runs-on: windows-latest
needs: [test-win,test-netcore-linux]
steps:
- uses: actions/checkout@v1
- name: Create and push NuGet package
run: |
dotnet pack -c Release -o nuget -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | Disable tests on Linux for now | Disable tests on Linux for now
| YAML | apache-2.0 | restsharp/RestSharp | yaml | ## Code Before:
name: Build and deploy
on:
push:
paths-ignore:
- 'docs/**'
- 'yarn.lock'
- 'package.json'
branches:
- dev
tags:
- '*'
jobs:
test-netcore-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.201'
- name: Run tests netcoreapp3.1
run: dotnet test -c Release -f netcoreapp3.1
test-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Run tests on Windows for all targets
run: dotnet test -c Release
nuget:
runs-on: windows-latest
needs: [test-win,test-netcore-linux]
steps:
- uses: actions/checkout@v1
- name: Create and push NuGet package
run: |
dotnet pack -c Release -o nuget -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
## Instruction:
Disable tests on Linux for now
## Code After:
name: Build and deploy
on:
push:
paths-ignore:
- 'docs/**'
- 'yarn.lock'
- 'package.json'
branches:
- dev
tags:
- '*'
jobs:
# test-netcore-linux:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v1
# - uses: actions/setup-dotnet@v1
# with:
# dotnet-version: '3.1.201'
#
# - name: Run tests netcoreapp3.1
# run: dotnet test -c Release -f netcoreapp3.1
test-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Run tests on Windows for all targets
run: dotnet test -c Release
nuget:
runs-on: windows-latest
needs: [test-win,test-netcore-linux]
steps:
- uses: actions/checkout@v1
- name: Create and push NuGet package
run: |
dotnet pack -c Release -o nuget -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | name: Build and deploy
on:
push:
paths-ignore:
- 'docs/**'
- 'yarn.lock'
- 'package.json'
branches:
- dev
tags:
- '*'
jobs:
- test-netcore-linux:
+ # test-netcore-linux:
? +
- runs-on: ubuntu-latest
+ # runs-on: ubuntu-latest
? +
-
+ #
- steps:
+ # steps:
? +
- - uses: actions/checkout@v1
+ # - uses: actions/checkout@v1
? +
- - uses: actions/setup-dotnet@v1
+ # - uses: actions/setup-dotnet@v1
? +
- with:
+ # with:
? +
- dotnet-version: '3.1.201'
+ # dotnet-version: '3.1.201'
? +
-
+ #
- - name: Run tests netcoreapp3.1
+ # - name: Run tests netcoreapp3.1
? +
- run: dotnet test -c Release -f netcoreapp3.1
+ # run: dotnet test -c Release -f netcoreapp3.1
? +
test-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Run tests on Windows for all targets
run: dotnet test -c Release
nuget:
runs-on: windows-latest
needs: [test-win,test-netcore-linux]
steps:
- uses: actions/checkout@v1
- name: Create and push NuGet package
run: |
dotnet pack -c Release -o nuget -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | 22 | 0.478261 | 11 | 11 |
ab0ee453d7385484106de7a79baa86caceaba05f | lib/api/com.js | lib/api/com.js | var $ = require('zepto-browserify').$;
var name = '.COM API';
var baseUrl = 'https://public-api.wordpress.com/rest/';
function getRequestUrl(request) {
var version = request.version || 'v1';
return baseUrl + version + request.path;
}
function getDiscoveryUrl(version) {
return baseUrl + version + '/help';
}
function parseEndpoints(data, version) {
return data;
}
function loadVersions(callback) {
// Strange having to specify a version to retrieve versions :)
$.ajax({
type: 'GET',
url: baseUrl + 'v1.1/versions?include_dev=true',
headers: $.extend({'accept':'application/json'}),
success: function(data) {
callback(undefined, data.versions.map(version => 'v' + version), 'v' + data.current_version);
},
error: function(xhr, errorType, error) {
callback({
status: xhr.status,
error: error,
errorType: errorType,
body: xhr.response,
});
}
});
}
module.exports = {
name: name,
baseUrl: baseUrl,
getRequestUrl: getRequestUrl,
getDiscoveryUrl: getDiscoveryUrl,
parseEndpoints: parseEndpoints,
loadVersions: loadVersions
};
| var $ = require('zepto-browserify').$;
var name = '.COM API';
var baseUrl = 'https://public-api.wordpress.com/rest/';
function getRequestUrl(request) {
var version = request.version || 'v1';
return baseUrl + version + request.path;
}
function getDiscoveryUrl(version) {
return baseUrl + version + '/help';
}
function parseEndpoints(data, version) {
return data;
}
function loadVersions(callback) {
// Strange having to specify a version to retrieve versions :)
$.ajax({
type: 'GET',
url: baseUrl + 'v1.1/versions?include_dev=true',
headers: $.extend({'accept':'application/json'}),
success: function(data) {
callback(
undefined,
data.versions.map(function(version) {
return 'v' + version;
}),
'v' + data.current_version
);
},
error: function(xhr, errorType, error) {
callback({
status: xhr.status,
error: error,
errorType: errorType,
body: xhr.response,
});
}
});
}
module.exports = {
name: name,
baseUrl: baseUrl,
getRequestUrl: getRequestUrl,
getDiscoveryUrl: getDiscoveryUrl,
parseEndpoints: parseEndpoints,
loadVersions: loadVersions
};
| Remove arrow function to fix the build | Remove arrow function to fix the build
events.js:165
throw err;
^
Error: Uncaught, unspecified "error" event. (SyntaxError: Unexpected
token: operator (>) while parsing file: [...]/lib/api/com.js
(line: 27, col: 53, pos: 695)
Error
at new JS_Parse_Error (eval at <anonymous>
([...]/node_modules/uglify-js/tools/node .js:28:1), <anonymous>:1545:18)
| JavaScript | mit | HamptonParkhp2w/Marong,Hamiltonz6x6/Dungog,Gawlerydyh/Geelong,Hamiltonz6x6/Dungog,Alexandriabez1/Gordon,Oatlandsuvdi/Mentone,Harveypahl/Beachmere,Vermontnapk/Silverwater,Oxleylrej/RingwoodEast,Automattic/rest-api-console2,PortMacquarieghp4/Revesby,Tuggeranongyqe2/Belair,paltasipse/stehnd,Redfernyrzj/Lilydale,Richmondfk5a/Malvern,luzelena57/fragtood,Invermayrxtr/LittleBay,Kambaldad1zd/Wahroonga,Redfernyrzj/Lilydale,Vermontnapk/Silverwater,Tuncurryfbcn/Milton,Braddonrcdz/EdgeHill,roena/startyack,Woodstocksw7m/Ridgley,CribPointsmid/Rocklea,noknarulmo/hestero,BrandyHillp17d/Wyongah,Geraldtonobww/CroydonNorth,Alexandriabez1/Gordon,Killarapbkw/Semaphore,Seafordnc6p/Ashburton,Morangodax/PortLincoln,Nunawadinger32/Kempsey,PointLonsdaleqsf3/LakeHeights,Lewistonx1sr/Bargara,HamptonParkhp2w/Marong,PortMacquarieghp4/Revesby,Parkhurstb1tl/BigPatsCreek,Nunawadinger32/Kempsey,wddesbvsp/winetest,Automattic/rest-api-console2,Woodstocksw7m/Ridgley,paltasipse/stehnd,Romseytrxx/Freeling,heisokjss/goedoo,Lewistonx1sr/Bargara,Ashgroveoszc/Carlingford,Kensingtonkadi/Kallista,Richmondfk5a/Malvern,Beaconsfieldkvb1/LakesEntrance,Yendadi04/OakPark,Morangodax/PortLincoln,Broadwaterudtp/Tanunda,BrandyHillp17d/Wyongah,Kelsolnty/MarsdenPark,Riverstonezbni/Gosforth,Tuncurryfbcn/Milton,SandyHollowx8d5/Waterloo,Kambaldad1zd/Wahroonga,Riverstonezbni/Gosforth,Beaconsfieldkvb1/LakesEntrance,Duralhc9a/Williams,Baringhupz067/Camperdown,Harveypahl/Beachmere,Broadwaterudtp/Tanunda,SandyHollowx8d5/Waterloo,Duralhc9a/Williams,Tuggeranongyqe2/Belair,OldBeachseep/SalamanderBay,GreenHilll75f/Tennyson,LongPointcaf0/Kyabram,heisokjss/goedoo,Daceyvilleuaex/SpringField,roena/startyack,Kensingtonkadi/Kallista,CribPointsmid/Rocklea,FreemansReachqsyh/Braeside,Rockhamptonm0x2/Sandringham,Geraldtonobww/CroydonNorth,Baringhupz067/Camperdown,PointLonsdaleqsf3/LakeHeights,Oxleylrej/RingwoodEast,OldBeachseep/SalamanderBay,Ashgroveoszc/Carlingford,Kelsolnty/MarsdenPark,LongPointcaf0/Kyabram,Romseytrxx/Freeling,Gawlerydyh/Geelong,Seafordnc6p/Ashburton,Killarapbkw/Semaphore,GreenHilll75f/Tennyson,Parkhurstb1tl/BigPatsCreek,Oatlandsuvdi/Mentone,noknarulmo/hestero,luzelena57/fragtood,wddesbvsp/winetest,Daceyvilleuaex/SpringField,Rockhamptonm0x2/Sandringham,Yendadi04/OakPark,FreemansReachqsyh/Braeside,Invermayrxtr/LittleBay,Braddonrcdz/EdgeHill | javascript | ## Code Before:
var $ = require('zepto-browserify').$;
var name = '.COM API';
var baseUrl = 'https://public-api.wordpress.com/rest/';
function getRequestUrl(request) {
var version = request.version || 'v1';
return baseUrl + version + request.path;
}
function getDiscoveryUrl(version) {
return baseUrl + version + '/help';
}
function parseEndpoints(data, version) {
return data;
}
function loadVersions(callback) {
// Strange having to specify a version to retrieve versions :)
$.ajax({
type: 'GET',
url: baseUrl + 'v1.1/versions?include_dev=true',
headers: $.extend({'accept':'application/json'}),
success: function(data) {
callback(undefined, data.versions.map(version => 'v' + version), 'v' + data.current_version);
},
error: function(xhr, errorType, error) {
callback({
status: xhr.status,
error: error,
errorType: errorType,
body: xhr.response,
});
}
});
}
module.exports = {
name: name,
baseUrl: baseUrl,
getRequestUrl: getRequestUrl,
getDiscoveryUrl: getDiscoveryUrl,
parseEndpoints: parseEndpoints,
loadVersions: loadVersions
};
## Instruction:
Remove arrow function to fix the build
events.js:165
throw err;
^
Error: Uncaught, unspecified "error" event. (SyntaxError: Unexpected
token: operator (>) while parsing file: [...]/lib/api/com.js
(line: 27, col: 53, pos: 695)
Error
at new JS_Parse_Error (eval at <anonymous>
([...]/node_modules/uglify-js/tools/node .js:28:1), <anonymous>:1545:18)
## Code After:
var $ = require('zepto-browserify').$;
var name = '.COM API';
var baseUrl = 'https://public-api.wordpress.com/rest/';
function getRequestUrl(request) {
var version = request.version || 'v1';
return baseUrl + version + request.path;
}
function getDiscoveryUrl(version) {
return baseUrl + version + '/help';
}
function parseEndpoints(data, version) {
return data;
}
function loadVersions(callback) {
// Strange having to specify a version to retrieve versions :)
$.ajax({
type: 'GET',
url: baseUrl + 'v1.1/versions?include_dev=true',
headers: $.extend({'accept':'application/json'}),
success: function(data) {
callback(
undefined,
data.versions.map(function(version) {
return 'v' + version;
}),
'v' + data.current_version
);
},
error: function(xhr, errorType, error) {
callback({
status: xhr.status,
error: error,
errorType: errorType,
body: xhr.response,
});
}
});
}
module.exports = {
name: name,
baseUrl: baseUrl,
getRequestUrl: getRequestUrl,
getDiscoveryUrl: getDiscoveryUrl,
parseEndpoints: parseEndpoints,
loadVersions: loadVersions
};
| var $ = require('zepto-browserify').$;
var name = '.COM API';
var baseUrl = 'https://public-api.wordpress.com/rest/';
function getRequestUrl(request) {
var version = request.version || 'v1';
return baseUrl + version + request.path;
}
function getDiscoveryUrl(version) {
return baseUrl + version + '/help';
}
function parseEndpoints(data, version) {
return data;
}
function loadVersions(callback) {
// Strange having to specify a version to retrieve versions :)
$.ajax({
type: 'GET',
url: baseUrl + 'v1.1/versions?include_dev=true',
headers: $.extend({'accept':'application/json'}),
success: function(data) {
- callback(undefined, data.versions.map(version => 'v' + version), 'v' + data.current_version);
+ callback(
+ undefined,
+ data.versions.map(function(version) {
+ return 'v' + version;
+ }),
+ 'v' + data.current_version
+ );
},
error: function(xhr, errorType, error) {
callback({
status: xhr.status,
error: error,
errorType: errorType,
body: xhr.response,
});
}
});
}
module.exports = {
name: name,
baseUrl: baseUrl,
getRequestUrl: getRequestUrl,
getDiscoveryUrl: getDiscoveryUrl,
parseEndpoints: parseEndpoints,
loadVersions: loadVersions
}; | 8 | 0.170213 | 7 | 1 |
aee2f4e61308de0cf7793ff86686fef373cb3709 | chippery/settings.sls | chippery/settings.sls |
{% set chippery = pillar.get('chippery', {}) %}
{% set settings = chippery.get('settings', {}) %}
# Set a default UMASK for the machine
{% if 'default_umask' in settings %}
.Set default UMASK on the minion:
file.replace:
- name: /etc/login.defs
- pattern: ^UMASK\s+[\dx]+
- repl: UMASK\t\t{{ settings['default_umask'] }}
- flags: ['IGNORECASE']
- backup: False
{% endif %}
|
{% set chippery = pillar.get('chippery', {}) %}
{% set settings = chippery.get('settings', {}) %}
| Remove UMASK setter into state formula system.states.default_umask | Remove UMASK setter into state formula system.states.default_umask
| SaltStack | bsd-2-clause | hipikat/chippery-formula | saltstack | ## Code Before:
{% set chippery = pillar.get('chippery', {}) %}
{% set settings = chippery.get('settings', {}) %}
# Set a default UMASK for the machine
{% if 'default_umask' in settings %}
.Set default UMASK on the minion:
file.replace:
- name: /etc/login.defs
- pattern: ^UMASK\s+[\dx]+
- repl: UMASK\t\t{{ settings['default_umask'] }}
- flags: ['IGNORECASE']
- backup: False
{% endif %}
## Instruction:
Remove UMASK setter into state formula system.states.default_umask
## Code After:
{% set chippery = pillar.get('chippery', {}) %}
{% set settings = chippery.get('settings', {}) %}
|
{% set chippery = pillar.get('chippery', {}) %}
{% set settings = chippery.get('settings', {}) %}
- # Set a default UMASK for the machine
- {% if 'default_umask' in settings %}
- .Set default UMASK on the minion:
- file.replace:
- - name: /etc/login.defs
- - pattern: ^UMASK\s+[\dx]+
- - repl: UMASK\t\t{{ settings['default_umask'] }}
- - flags: ['IGNORECASE']
- - backup: False
- {% endif %} | 10 | 0.666667 | 0 | 10 |
74be6c3d995a95c2c0dd541203e5d3e85bac053c | app/views/manage-projects.html | app/views/manage-projects.html | <md-content ng-cloak>
<md-content>
<md-list>
<md-list-item class="md-3-line" ng-repeat="project in projects">
<div class="md-list-item-text">
<h3>{{ ::project.title }} ({{ ::project.participants.length }})</h3>
<h4>
<translate>VIEWS.MANAGE.PROJECTS.CREATOR</translate>: {{ ::getUserFullName(project.creator) }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.OWNER</translate>: {{ ::getUserFullName(project.owner) }}
</h4>
<p>
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.START_DATE</translate>: {{ ::project.start }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.END_DATE</translate>: {{ ::project.end }}
<translate>GENERAL.CREATED</translate>: {{ ::project.created }}
<translate>GENERAL.UPDATED</translate>: {{ ::project.updated }}
</p>
</div>
<md-button class="md-secondary" translate="GENERAL.OPEN"></md-button>
<md-divider ng-if="!$last"></md-divider>
</md-list-item>
</md-list>
</md-content>
</md-content>
| <md-content ng-cloak>
<md-content>
<md-list>
<md-list-item class="md-3-line" ng-repeat="project in projects">
<div class="md-list-item-text">
<h3>{{ ::project.title }} ({{ ::project.participants.length }})</h3>
<h4>
<translate>VIEWS.MANAGE.PROJECTS.CREATOR</translate>: {{ ::getUserFullName(project.creator) }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.OWNER</translate>: {{ ::getUserFullName(project.owner) }}
</h4>
<p>
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.START_DATE</translate>: {{ ::project.start | tlDate }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.END_DATE</translate>: {{ ::project.end | tlDate }}
<translate>GENERAL.CREATED</translate>: {{ ::project.created | tlDate }}
<translate>GENERAL.UPDATED</translate>: {{ ::project.updated | tlDate }}
</p>
</div>
<md-button class="md-secondary" translate="GENERAL.OPEN"></md-button>
<md-divider ng-if="!$last"></md-divider>
</md-list-item>
</md-list>
</md-content>
</md-content>
| Handle dates in a few more places. | Handle dates in a few more places.
| HTML | mit | learning-layers/timeliner-client,learning-layers/timeliner-client | html | ## Code Before:
<md-content ng-cloak>
<md-content>
<md-list>
<md-list-item class="md-3-line" ng-repeat="project in projects">
<div class="md-list-item-text">
<h3>{{ ::project.title }} ({{ ::project.participants.length }})</h3>
<h4>
<translate>VIEWS.MANAGE.PROJECTS.CREATOR</translate>: {{ ::getUserFullName(project.creator) }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.OWNER</translate>: {{ ::getUserFullName(project.owner) }}
</h4>
<p>
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.START_DATE</translate>: {{ ::project.start }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.END_DATE</translate>: {{ ::project.end }}
<translate>GENERAL.CREATED</translate>: {{ ::project.created }}
<translate>GENERAL.UPDATED</translate>: {{ ::project.updated }}
</p>
</div>
<md-button class="md-secondary" translate="GENERAL.OPEN"></md-button>
<md-divider ng-if="!$last"></md-divider>
</md-list-item>
</md-list>
</md-content>
</md-content>
## Instruction:
Handle dates in a few more places.
## Code After:
<md-content ng-cloak>
<md-content>
<md-list>
<md-list-item class="md-3-line" ng-repeat="project in projects">
<div class="md-list-item-text">
<h3>{{ ::project.title }} ({{ ::project.participants.length }})</h3>
<h4>
<translate>VIEWS.MANAGE.PROJECTS.CREATOR</translate>: {{ ::getUserFullName(project.creator) }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.OWNER</translate>: {{ ::getUserFullName(project.owner) }}
</h4>
<p>
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.START_DATE</translate>: {{ ::project.start | tlDate }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.END_DATE</translate>: {{ ::project.end | tlDate }}
<translate>GENERAL.CREATED</translate>: {{ ::project.created | tlDate }}
<translate>GENERAL.UPDATED</translate>: {{ ::project.updated | tlDate }}
</p>
</div>
<md-button class="md-secondary" translate="GENERAL.OPEN"></md-button>
<md-divider ng-if="!$last"></md-divider>
</md-list-item>
</md-list>
</md-content>
</md-content>
| <md-content ng-cloak>
<md-content>
<md-list>
<md-list-item class="md-3-line" ng-repeat="project in projects">
<div class="md-list-item-text">
<h3>{{ ::project.title }} ({{ ::project.participants.length }})</h3>
<h4>
<translate>VIEWS.MANAGE.PROJECTS.CREATOR</translate>: {{ ::getUserFullName(project.creator) }}
<translate>VIEWS.PROJECT_LIST.LIST_TITLES.OWNER</translate>: {{ ::getUserFullName(project.owner) }}
</h4>
<p>
- <translate>VIEWS.PROJECT_LIST.LIST_TITLES.START_DATE</translate>: {{ ::project.start }}
+ <translate>VIEWS.PROJECT_LIST.LIST_TITLES.START_DATE</translate>: {{ ::project.start | tlDate }}
? +++++++++
- <translate>VIEWS.PROJECT_LIST.LIST_TITLES.END_DATE</translate>: {{ ::project.end }}
+ <translate>VIEWS.PROJECT_LIST.LIST_TITLES.END_DATE</translate>: {{ ::project.end | tlDate }}
? +++++++++
- <translate>GENERAL.CREATED</translate>: {{ ::project.created }}
+ <translate>GENERAL.CREATED</translate>: {{ ::project.created | tlDate }}
? +++++++++
- <translate>GENERAL.UPDATED</translate>: {{ ::project.updated }}
+ <translate>GENERAL.UPDATED</translate>: {{ ::project.updated | tlDate }}
? +++++++++
</p>
</div>
<md-button class="md-secondary" translate="GENERAL.OPEN"></md-button>
<md-divider ng-if="!$last"></md-divider>
</md-list-item>
</md-list>
</md-content>
</md-content> | 8 | 0.347826 | 4 | 4 |
8b97da7968fd946d597820c241cf6bd5e7d9edf5 | home/.vim/plugin/filetypes.vim | home/.vim/plugin/filetypes.vim | augroup set_filetype_group
autocmd!
autocmd BufNewFile,BufRead Guardfile set filetype=ruby
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd BufNewFile,BufRead *.pde set filetype=processing
autocmd BufRead,BufNewFile *.scss set filetype=scss.css
augroup END
| augroup set_filetype_group
autocmd!
autocmd BufNewFile,BufRead Guardfile set filetype=ruby
autocmd BufNewFile,BufRead Vagrantfile set filetype=ruby
autocmd BufNewFile,BufRead .jshintrc set filetype=javascript
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd BufNewFile,BufRead *.pde set filetype=processing
autocmd BufRead,BufNewFile *.scss set filetype=scss.css
augroup END
| Use correct filetype for Vagrantfile and .jshintrc | Use correct filetype for Vagrantfile and .jshintrc
| VimL | mit | lpil/vimrc | viml | ## Code Before:
augroup set_filetype_group
autocmd!
autocmd BufNewFile,BufRead Guardfile set filetype=ruby
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd BufNewFile,BufRead *.pde set filetype=processing
autocmd BufRead,BufNewFile *.scss set filetype=scss.css
augroup END
## Instruction:
Use correct filetype for Vagrantfile and .jshintrc
## Code After:
augroup set_filetype_group
autocmd!
autocmd BufNewFile,BufRead Guardfile set filetype=ruby
autocmd BufNewFile,BufRead Vagrantfile set filetype=ruby
autocmd BufNewFile,BufRead .jshintrc set filetype=javascript
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd BufNewFile,BufRead *.pde set filetype=processing
autocmd BufRead,BufNewFile *.scss set filetype=scss.css
augroup END
| augroup set_filetype_group
autocmd!
autocmd BufNewFile,BufRead Guardfile set filetype=ruby
+ autocmd BufNewFile,BufRead Vagrantfile set filetype=ruby
+ autocmd BufNewFile,BufRead .jshintrc set filetype=javascript
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd BufNewFile,BufRead *.pde set filetype=processing
autocmd BufRead,BufNewFile *.scss set filetype=scss.css
augroup END | 2 | 0.285714 | 2 | 0 |
042d21e46474090d36db1c18ee7ca851d640426a | config/prisons/KMI-kirkham.yml | config/prisons/KMI-kirkham.yml | ---
name: Kirkham
nomis_id: KMI
address:
- Freckleton Road
- ' Kirkham'
- PR4 2RN
email: [email protected]
enabled: true
estate: Kirkham
phone:
slots:
fri:
- 1300-1530
sat:
- 1300-1530
sun:
- 1300-1530
unbookable:
- 2014-12-25
| ---
name: Kirkham
nomis_id: KMI
address:
- Freckleton Road
- ' Kirkham'
- PR4 2RN
email: [email protected]
enabled: true
estate: Kirkham
phone:
slot_anomalies:
2015-12-23:
- 1315-1540
2015-12-30:
- 1315-1540
slots:
fri:
- 1300-1530
sat:
- 1300-1530
sun:
- 1300-1530
unbookable:
- 2014-12-25
- 2015-12-24
- 2015-12-25
- 2015-12-31
- 2016-01-01
| Update Kirkham Christmas visit slots | Update Kirkham Christmas visit slots
Unbookable:
- Christmas Eve
- Christmas Day
- New Year's Eve
- New Year's Day
Additional:
- 23rd Dec 1315-1540
- 30th Dec 1315-1540 | YAML | mit | ministryofjustice/prison-visits,ministryofjustice/prison-visits,ministryofjustice/prison-visits | yaml | ## Code Before:
---
name: Kirkham
nomis_id: KMI
address:
- Freckleton Road
- ' Kirkham'
- PR4 2RN
email: [email protected]
enabled: true
estate: Kirkham
phone:
slots:
fri:
- 1300-1530
sat:
- 1300-1530
sun:
- 1300-1530
unbookable:
- 2014-12-25
## Instruction:
Update Kirkham Christmas visit slots
Unbookable:
- Christmas Eve
- Christmas Day
- New Year's Eve
- New Year's Day
Additional:
- 23rd Dec 1315-1540
- 30th Dec 1315-1540
## Code After:
---
name: Kirkham
nomis_id: KMI
address:
- Freckleton Road
- ' Kirkham'
- PR4 2RN
email: [email protected]
enabled: true
estate: Kirkham
phone:
slot_anomalies:
2015-12-23:
- 1315-1540
2015-12-30:
- 1315-1540
slots:
fri:
- 1300-1530
sat:
- 1300-1530
sun:
- 1300-1530
unbookable:
- 2014-12-25
- 2015-12-24
- 2015-12-25
- 2015-12-31
- 2016-01-01
| ---
name: Kirkham
nomis_id: KMI
address:
- Freckleton Road
- ' Kirkham'
- PR4 2RN
email: [email protected]
enabled: true
estate: Kirkham
phone:
+ slot_anomalies:
+ 2015-12-23:
+ - 1315-1540
+ 2015-12-30:
+ - 1315-1540
slots:
fri:
- 1300-1530
sat:
- 1300-1530
sun:
- 1300-1530
unbookable:
- 2014-12-25
+ - 2015-12-24
+ - 2015-12-25
+ - 2015-12-31
+ - 2016-01-01 | 9 | 0.45 | 9 | 0 |
d37bef6459cc2810660dfe702e46f5a303a02601 | composer.json | composer.json | {
"name": "flipbox/lumen-generator",
"description": "A Lumen Generator You Are Missing",
"type": "library",
"require": {
"illuminate/support": "^5.4|^6.0",
"symfony/var-dumper": "^3.1|^4.1|^4.2|^4.3",
"psy/psysh": "0.8.*|0.9.*",
"classpreloader/classpreloader": "^3.0|^4.0"
},
"license": "MIT",
"authors": [
{
"name": "Krisan Alfa Timur",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Flipbox\\LumenGenerator\\": "src/LumenGenerator/"
}
}
}
| {
"name": "flipbox/lumen-generator",
"description": "A Lumen Generator You Are Missing",
"type": "library",
"require": {
"illuminate/support": "^5.4|^6.0|^7.0",
"symfony/var-dumper": "^3.1|^4.1|^4.2|^4.3|^5.0",
"psy/psysh": "0.8.*|0.9.*",
"classpreloader/classpreloader": "^3.0|^4.0"
},
"license": "MIT",
"authors": [
{
"name": "Krisan Alfa Timur",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Flipbox\\LumenGenerator\\": "src/LumenGenerator/"
}
}
} | Add support for Lumen ^7.x | Add support for Lumen ^7.x
| JSON | mit | flipboxstudio/lumen-generator | json | ## Code Before:
{
"name": "flipbox/lumen-generator",
"description": "A Lumen Generator You Are Missing",
"type": "library",
"require": {
"illuminate/support": "^5.4|^6.0",
"symfony/var-dumper": "^3.1|^4.1|^4.2|^4.3",
"psy/psysh": "0.8.*|0.9.*",
"classpreloader/classpreloader": "^3.0|^4.0"
},
"license": "MIT",
"authors": [
{
"name": "Krisan Alfa Timur",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Flipbox\\LumenGenerator\\": "src/LumenGenerator/"
}
}
}
## Instruction:
Add support for Lumen ^7.x
## Code After:
{
"name": "flipbox/lumen-generator",
"description": "A Lumen Generator You Are Missing",
"type": "library",
"require": {
"illuminate/support": "^5.4|^6.0|^7.0",
"symfony/var-dumper": "^3.1|^4.1|^4.2|^4.3|^5.0",
"psy/psysh": "0.8.*|0.9.*",
"classpreloader/classpreloader": "^3.0|^4.0"
},
"license": "MIT",
"authors": [
{
"name": "Krisan Alfa Timur",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Flipbox\\LumenGenerator\\": "src/LumenGenerator/"
}
}
} | {
"name": "flipbox/lumen-generator",
"description": "A Lumen Generator You Are Missing",
"type": "library",
"require": {
- "illuminate/support": "^5.4|^6.0",
+ "illuminate/support": "^5.4|^6.0|^7.0",
? +++++
- "symfony/var-dumper": "^3.1|^4.1|^4.2|^4.3",
+ "symfony/var-dumper": "^3.1|^4.1|^4.2|^4.3|^5.0",
? +++++
"psy/psysh": "0.8.*|0.9.*",
"classpreloader/classpreloader": "^3.0|^4.0"
},
"license": "MIT",
"authors": [
{
"name": "Krisan Alfa Timur",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Flipbox\\LumenGenerator\\": "src/LumenGenerator/"
}
}
} | 4 | 0.173913 | 2 | 2 |
d7d5c4fd076951df4ba171329b4b99e250c8282f | lib/data_kitten/origins/git.rb | lib/data_kitten/origins/git.rb | module DataKitten
module Origins
# Git origin module. Automatically mixed into {Dataset} for datasets that are loaded from Git repositories.
#
# @see Dataset
#
module Git
private
def self.supported?(uri)
uri =~ /\A(git|https?):\/\/.*\.git\Z/
end
public
# The origin type of the dataset.
# @return [Symbol] +:git+
# @see Dataset#origin
def origin
:git
end
# A history of changes to the Dataset, taken from the full git changelog
# @see Dataset#change_history
def change_history
@change_history ||= begin
repository.log.map{|commit| commit}
end
end
protected
def load_file(path)
# Make sure we have a working copy
repository
# read file
File.read(File.join(working_copy_path, path))
end
private
def working_copy_path
# Create holding directory
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), 'tmp', 'repositories'))
# generate working copy dir
File.join(File.dirname(__FILE__), 'tmp', 'repositories', @access_url.gsub('/','-'))
end
def repository
@repository ||= begin
repo = ::Git.open(working_copy_path)
repo.pull("origin", "master")
repo
rescue ArgumentError
repo = ::Git.clone(@access_url, working_copy_path)
end
end
end
end
end | module DataKitten
module Origins
# Git origin module. Automatically mixed into {Dataset} for datasets that are loaded from Git repositories.
#
# @see Dataset
#
module Git
private
def self.supported?(uri)
uri =~ /\A(git|https?):\/\/.*\.git\Z/
end
public
# The origin type of the dataset.
# @return [Symbol] +:git+
# @see Dataset#origin
def origin
:git
end
# A history of changes to the Dataset, taken from the full git changelog
# @see Dataset#change_history
def change_history
@change_history ||= begin
repository.log.map{|commit| commit}
end
end
protected
def load_file(path)
# Make sure we have a working copy
repository
# read file
File.read(File.join(working_copy_path, path))
end
private
def working_copy_path
# Create holding directory
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories'))
# generate working copy dir
File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories', @access_url.gsub('/','-'))
end
def repository
@repository ||= begin
repo = ::Git.open(working_copy_path)
repo.pull("origin", "master")
repo
rescue ArgumentError
repo = ::Git.clone(@access_url, working_copy_path)
end
end
end
end
end | Make tmp folder in gem root | Make tmp folder in gem root
| Ruby | mit | theodi/data_kitten | ruby | ## Code Before:
module DataKitten
module Origins
# Git origin module. Automatically mixed into {Dataset} for datasets that are loaded from Git repositories.
#
# @see Dataset
#
module Git
private
def self.supported?(uri)
uri =~ /\A(git|https?):\/\/.*\.git\Z/
end
public
# The origin type of the dataset.
# @return [Symbol] +:git+
# @see Dataset#origin
def origin
:git
end
# A history of changes to the Dataset, taken from the full git changelog
# @see Dataset#change_history
def change_history
@change_history ||= begin
repository.log.map{|commit| commit}
end
end
protected
def load_file(path)
# Make sure we have a working copy
repository
# read file
File.read(File.join(working_copy_path, path))
end
private
def working_copy_path
# Create holding directory
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), 'tmp', 'repositories'))
# generate working copy dir
File.join(File.dirname(__FILE__), 'tmp', 'repositories', @access_url.gsub('/','-'))
end
def repository
@repository ||= begin
repo = ::Git.open(working_copy_path)
repo.pull("origin", "master")
repo
rescue ArgumentError
repo = ::Git.clone(@access_url, working_copy_path)
end
end
end
end
end
## Instruction:
Make tmp folder in gem root
## Code After:
module DataKitten
module Origins
# Git origin module. Automatically mixed into {Dataset} for datasets that are loaded from Git repositories.
#
# @see Dataset
#
module Git
private
def self.supported?(uri)
uri =~ /\A(git|https?):\/\/.*\.git\Z/
end
public
# The origin type of the dataset.
# @return [Symbol] +:git+
# @see Dataset#origin
def origin
:git
end
# A history of changes to the Dataset, taken from the full git changelog
# @see Dataset#change_history
def change_history
@change_history ||= begin
repository.log.map{|commit| commit}
end
end
protected
def load_file(path)
# Make sure we have a working copy
repository
# read file
File.read(File.join(working_copy_path, path))
end
private
def working_copy_path
# Create holding directory
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories'))
# generate working copy dir
File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories', @access_url.gsub('/','-'))
end
def repository
@repository ||= begin
repo = ::Git.open(working_copy_path)
repo.pull("origin", "master")
repo
rescue ArgumentError
repo = ::Git.clone(@access_url, working_copy_path)
end
end
end
end
end | module DataKitten
module Origins
# Git origin module. Automatically mixed into {Dataset} for datasets that are loaded from Git repositories.
#
# @see Dataset
#
module Git
private
def self.supported?(uri)
uri =~ /\A(git|https?):\/\/.*\.git\Z/
end
public
# The origin type of the dataset.
# @return [Symbol] +:git+
# @see Dataset#origin
def origin
:git
end
# A history of changes to the Dataset, taken from the full git changelog
# @see Dataset#change_history
def change_history
@change_history ||= begin
repository.log.map{|commit| commit}
end
end
protected
def load_file(path)
# Make sure we have a working copy
repository
# read file
File.read(File.join(working_copy_path, path))
end
private
def working_copy_path
# Create holding directory
- FileUtils.mkdir_p(File.join(File.dirname(__FILE__), 'tmp', 'repositories'))
+ FileUtils.mkdir_p(File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories'))
? ++++++++++++++++++
# generate working copy dir
- File.join(File.dirname(__FILE__), 'tmp', 'repositories', @access_url.gsub('/','-'))
+ File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories', @access_url.gsub('/','-'))
? ++++++++++++++++++
end
def repository
@repository ||= begin
repo = ::Git.open(working_copy_path)
repo.pull("origin", "master")
repo
rescue ArgumentError
repo = ::Git.clone(@access_url, working_copy_path)
end
end
end
end
end | 4 | 0.060606 | 2 | 2 |
e1245fdf5db15718a26fc4ce3dddf4ebad639052 | source/nuPickers/Shared/CustomLabel/CustomLabelConfig.html | source/nuPickers/Shared/CustomLabel/CustomLabelConfig.html |
<div ng-controller="nuPickers.Shared.CustomLabel.CustomLabelConfigController" class="nuPickers-config">
<div>
<label for="">
Custom Label
<small>(optional) process each item though a macro, can use the parameters: key, keys, counter and total</small>
</label>
<div>
<select ng-model="model.value"
ng-options="macro.alias as macro.name for macro in macros">
<option value=""></option>
</select>
</div>
</div>
</div> |
<div ng-controller="nuPickers.Shared.CustomLabel.CustomLabelConfigController" class="nuPickers-config">
<div>
<label for="">
Custom Label
<small>(optional) process each item through a macro; Can use the parameters: contextId, propertyAlias, key, label, keys, counter and total</small>
</label>
<div>
<select ng-model="model.value"
ng-options="macro.alias as macro.name for macro in macros">
<option value=""></option>
</select>
</div>
</div>
</div> | Fix typo and add missing keys | Fix typo and add missing keys
| HTML | mit | abjerner/nuPickers,LottePitcher/nuPickers,abjerner/nuPickers,JimBobSquarePants/nuPickers,uComponents/nuPickers,iahdevelop/nuPickers,JimBobSquarePants/nuPickers,uComponents/nuPickers,LottePitcher/nuPickers,abjerner/nuPickers,JimBobSquarePants/nuPickers,uComponents/nuPickers,LottePitcher/nuPickers,iahdevelop/nuPickers,iahdevelop/nuPickers | html | ## Code Before:
<div ng-controller="nuPickers.Shared.CustomLabel.CustomLabelConfigController" class="nuPickers-config">
<div>
<label for="">
Custom Label
<small>(optional) process each item though a macro, can use the parameters: key, keys, counter and total</small>
</label>
<div>
<select ng-model="model.value"
ng-options="macro.alias as macro.name for macro in macros">
<option value=""></option>
</select>
</div>
</div>
</div>
## Instruction:
Fix typo and add missing keys
## Code After:
<div ng-controller="nuPickers.Shared.CustomLabel.CustomLabelConfigController" class="nuPickers-config">
<div>
<label for="">
Custom Label
<small>(optional) process each item through a macro; Can use the parameters: contextId, propertyAlias, key, label, keys, counter and total</small>
</label>
<div>
<select ng-model="model.value"
ng-options="macro.alias as macro.name for macro in macros">
<option value=""></option>
</select>
</div>
</div>
</div> |
<div ng-controller="nuPickers.Shared.CustomLabel.CustomLabelConfigController" class="nuPickers-config">
<div>
<label for="">
Custom Label
- <small>(optional) process each item though a macro, can use the parameters: key, keys, counter and total</small>
? ^ ^
+ <small>(optional) process each item through a macro; Can use the parameters: contextId, propertyAlias, key, label, keys, counter and total</small>
? + ^ ^ ++++++++++++++++++++++++++ +++++++
</label>
<div>
<select ng-model="model.value"
ng-options="macro.alias as macro.name for macro in macros">
<option value=""></option>
</select>
</div>
</div>
</div> | 2 | 0.090909 | 1 | 1 |
122c5dec3f15037f2ae3decc8661cdebdbc16f68 | README.md | README.md |
The paper and code can be found [here](http://sanghosuh.github.io/data/lens_nmf_icdm.pdf) and [there](https://github.com/sanghosuh/lens_nmf-matlab), respectively.
Full citation is as follows.
1. Suh, Sangho, et al. "L-EnsNMF: Boosted Local Topic Discovery via Ensemble of Nonnegative Matrix Factorization."
Proceedings of the IEEE International Conference on Data Mining (ICDM), 2016, Barcelona, Spain.
Best Student Paper Award (out of 917 total submissions).
|
The paper and code can be found [here](http://sanghosuh.github.io/papers/lensnmf_icdm.pdf) and [there](https://github.com/sanghosuh/lens_nmf-matlab), respectively.
To check out the presentation, click [here](https://sanghosuh.github.io/lens_nmf-icdm/).
Full citation is as follows.
1. Suh, Sangho, et al. "L-EnsNMF: Boosted Local Topic Discovery via Ensemble of Nonnegative Matrix Factorization."
Proceedings of the IEEE International Conference on Data Mining (ICDM), 2016, Barcelona, Spain.
Best Student Paper Award (out of 917 total submissions).
| Fix link to paper and add link to presentation | Fix link to paper and add link to presentation | Markdown | mit | sanghosuh/lens_nmf-icdm,sanghosuh/lens_nmf-icdm | markdown | ## Code Before:
The paper and code can be found [here](http://sanghosuh.github.io/data/lens_nmf_icdm.pdf) and [there](https://github.com/sanghosuh/lens_nmf-matlab), respectively.
Full citation is as follows.
1. Suh, Sangho, et al. "L-EnsNMF: Boosted Local Topic Discovery via Ensemble of Nonnegative Matrix Factorization."
Proceedings of the IEEE International Conference on Data Mining (ICDM), 2016, Barcelona, Spain.
Best Student Paper Award (out of 917 total submissions).
## Instruction:
Fix link to paper and add link to presentation
## Code After:
The paper and code can be found [here](http://sanghosuh.github.io/papers/lensnmf_icdm.pdf) and [there](https://github.com/sanghosuh/lens_nmf-matlab), respectively.
To check out the presentation, click [here](https://sanghosuh.github.io/lens_nmf-icdm/).
Full citation is as follows.
1. Suh, Sangho, et al. "L-EnsNMF: Boosted Local Topic Discovery via Ensemble of Nonnegative Matrix Factorization."
Proceedings of the IEEE International Conference on Data Mining (ICDM), 2016, Barcelona, Spain.
Best Student Paper Award (out of 917 total submissions).
|
+ The paper and code can be found [here](http://sanghosuh.github.io/papers/lensnmf_icdm.pdf) and [there](https://github.com/sanghosuh/lens_nmf-matlab), respectively.
- The paper and code can be found [here](http://sanghosuh.github.io/data/lens_nmf_icdm.pdf) and [there](https://github.com/sanghosuh/lens_nmf-matlab), respectively.
+ To check out the presentation, click [here](https://sanghosuh.github.io/lens_nmf-icdm/).
Full citation is as follows.
1. Suh, Sangho, et al. "L-EnsNMF: Boosted Local Topic Discovery via Ensemble of Nonnegative Matrix Factorization."
Proceedings of the IEEE International Conference on Data Mining (ICDM), 2016, Barcelona, Spain.
Best Student Paper Award (out of 917 total submissions).
| 3 | 0.3 | 2 | 1 |
d6092f14a4755ba9f19b3c39e1e5b7fcbcebebda | mkdocs.yml | mkdocs.yml | site_name: Peering Manager
pages:
- 'Introduction': 'index.md'
- 'Setup':
- 'PostgreSQL': 'setup/postgresql.md'
- 'Peering Manager': 'setup/peering-manager.md'
- 'Web Server': 'setup/web-server.md'
- 'Logging': 'setup/logging.md'
- 'LDAP': 'setup/ldap.md'
- 'Upgrading': 'setup/upgrading.md'
- 'Scheduled Tasks': 'setup/scheduled-tasks.md'
- 'User Manual': 'man.md'
- 'Templating': 'config-template.md'
- 'Integration': 'integration.md'
markdown_extensions:
- admonition:
theme: readthedocs
| site_name: Peering Manager
pages:
- 'Introduction': 'index.md'
- 'Setup':
- 'PostgreSQL': 'setup/postgresql.md'
- 'Peering Manager': 'setup/peering-manager.md'
- 'Web Server': 'setup/web-server.md'
- 'Logging': 'setup/logging.md'
- 'LDAP': 'setup/ldap.md'
- 'Upgrading': 'setup/upgrading.md'
- 'Scheduled Tasks': 'setup/scheduled-tasks.md'
- 'User Manual': 'man.md'
- 'Templating': 'config-template.md'
- 'Integration': 'integration.md'
theme: readthedocs
| Remove useless mardown extension for doc generation. | Remove useless mardown extension for doc generation.
| YAML | apache-2.0 | respawner/peering-manager,respawner/peering-manager,respawner/peering-manager,respawner/peering-manager | yaml | ## Code Before:
site_name: Peering Manager
pages:
- 'Introduction': 'index.md'
- 'Setup':
- 'PostgreSQL': 'setup/postgresql.md'
- 'Peering Manager': 'setup/peering-manager.md'
- 'Web Server': 'setup/web-server.md'
- 'Logging': 'setup/logging.md'
- 'LDAP': 'setup/ldap.md'
- 'Upgrading': 'setup/upgrading.md'
- 'Scheduled Tasks': 'setup/scheduled-tasks.md'
- 'User Manual': 'man.md'
- 'Templating': 'config-template.md'
- 'Integration': 'integration.md'
markdown_extensions:
- admonition:
theme: readthedocs
## Instruction:
Remove useless mardown extension for doc generation.
## Code After:
site_name: Peering Manager
pages:
- 'Introduction': 'index.md'
- 'Setup':
- 'PostgreSQL': 'setup/postgresql.md'
- 'Peering Manager': 'setup/peering-manager.md'
- 'Web Server': 'setup/web-server.md'
- 'Logging': 'setup/logging.md'
- 'LDAP': 'setup/ldap.md'
- 'Upgrading': 'setup/upgrading.md'
- 'Scheduled Tasks': 'setup/scheduled-tasks.md'
- 'User Manual': 'man.md'
- 'Templating': 'config-template.md'
- 'Integration': 'integration.md'
theme: readthedocs
| site_name: Peering Manager
pages:
- 'Introduction': 'index.md'
- 'Setup':
- 'PostgreSQL': 'setup/postgresql.md'
- 'Peering Manager': 'setup/peering-manager.md'
- 'Web Server': 'setup/web-server.md'
- 'Logging': 'setup/logging.md'
- 'LDAP': 'setup/ldap.md'
- 'Upgrading': 'setup/upgrading.md'
- 'Scheduled Tasks': 'setup/scheduled-tasks.md'
- 'User Manual': 'man.md'
- 'Templating': 'config-template.md'
- 'Integration': 'integration.md'
- markdown_extensions:
- - admonition:
-
theme: readthedocs | 3 | 0.15 | 0 | 3 |
3990e3aa64cff288def07ee36e24026cc15282c0 | taiga/projects/issues/serializers.py | taiga/projects/issues/serializers.py |
from rest_framework import serializers
from taiga.base.serializers import PickleField, NeighborsSerializerMixin
from . import models
class IssueSerializer(serializers.ModelSerializer):
tags = PickleField(required=False)
comment = serializers.SerializerMethodField("get_comment")
is_closed = serializers.Field(source="is_closed")
class Meta:
model = models.Issue
def get_comment(self, obj):
return ""
class IssueNeighborsSerializer(NeighborsSerializerMixin, IssueSerializer):
def serialize_neighbor(self, neighbor):
return NeighborIssueSerializer(neighbor).data
class NeighborIssueSerializer(serializers.ModelSerializer):
class Meta:
model = models.Issue
fields = ("id", "ref", "subject")
depth = 0
|
from rest_framework import serializers
from taiga.base.serializers import PickleField, NeighborsSerializerMixin
from . import models
class IssueSerializer(serializers.ModelSerializer):
tags = PickleField(required=False)
is_closed = serializers.Field(source="is_closed")
class Meta:
model = models.Issue
class IssueNeighborsSerializer(NeighborsSerializerMixin, IssueSerializer):
def serialize_neighbor(self, neighbor):
return NeighborIssueSerializer(neighbor).data
class NeighborIssueSerializer(serializers.ModelSerializer):
class Meta:
model = models.Issue
fields = ("id", "ref", "subject")
depth = 0
| Remove unnecessary field from IssueSerializer | Remove unnecessary field from IssueSerializer
| Python | agpl-3.0 | forging2012/taiga-back,EvgeneOskin/taiga-back,xdevelsistemas/taiga-back-community,seanchen/taiga-back,bdang2012/taiga-back-casting,Rademade/taiga-back,crr0004/taiga-back,dayatz/taiga-back,rajiteh/taiga-back,dycodedev/taiga-back,crr0004/taiga-back,obimod/taiga-back,Zaneh-/bearded-tribble-back,seanchen/taiga-back,gauravjns/taiga-back,joshisa/taiga-back,19kestier/taiga-back,jeffdwyatt/taiga-back,taigaio/taiga-back,WALR/taiga-back,joshisa/taiga-back,astronaut1712/taiga-back,taigaio/taiga-back,coopsource/taiga-back,gam-phon/taiga-back,Rademade/taiga-back,obimod/taiga-back,obimod/taiga-back,CMLL/taiga-back,frt-arch/taiga-back,dycodedev/taiga-back,bdang2012/taiga-back-casting,Tigerwhit4/taiga-back,19kestier/taiga-back,EvgeneOskin/taiga-back,EvgeneOskin/taiga-back,astagi/taiga-back,bdang2012/taiga-back-casting,Zaneh-/bearded-tribble-back,dayatz/taiga-back,CoolCloud/taiga-back,astronaut1712/taiga-back,jeffdwyatt/taiga-back,crr0004/taiga-back,WALR/taiga-back,gam-phon/taiga-back,CMLL/taiga-back,seanchen/taiga-back,astagi/taiga-back,gauravjns/taiga-back,gam-phon/taiga-back,WALR/taiga-back,jeffdwyatt/taiga-back,Tigerwhit4/taiga-back,Zaneh-/bearded-tribble-back,seanchen/taiga-back,xdevelsistemas/taiga-back-community,coopsource/taiga-back,astagi/taiga-back,EvgeneOskin/taiga-back,obimod/taiga-back,gam-phon/taiga-back,coopsource/taiga-back,CoolCloud/taiga-back,rajiteh/taiga-back,dycodedev/taiga-back,bdang2012/taiga-back-casting,19kestier/taiga-back,astronaut1712/taiga-back,forging2012/taiga-back,CMLL/taiga-back,frt-arch/taiga-back,astagi/taiga-back,WALR/taiga-back,forging2012/taiga-back,rajiteh/taiga-back,frt-arch/taiga-back,Rademade/taiga-back,xdevelsistemas/taiga-back-community,taigaio/taiga-back,joshisa/taiga-back,gauravjns/taiga-back,Rademade/taiga-back,crr0004/taiga-back,forging2012/taiga-back,joshisa/taiga-back,CMLL/taiga-back,dycodedev/taiga-back,coopsource/taiga-back,CoolCloud/taiga-back,Rademade/taiga-back,astronaut1712/taiga-back,jeffdwyatt/taiga-back,CoolCloud/taiga-back,gauravjns/taiga-back,rajiteh/taiga-back,dayatz/taiga-back,Tigerwhit4/taiga-back,Tigerwhit4/taiga-back | python | ## Code Before:
from rest_framework import serializers
from taiga.base.serializers import PickleField, NeighborsSerializerMixin
from . import models
class IssueSerializer(serializers.ModelSerializer):
tags = PickleField(required=False)
comment = serializers.SerializerMethodField("get_comment")
is_closed = serializers.Field(source="is_closed")
class Meta:
model = models.Issue
def get_comment(self, obj):
return ""
class IssueNeighborsSerializer(NeighborsSerializerMixin, IssueSerializer):
def serialize_neighbor(self, neighbor):
return NeighborIssueSerializer(neighbor).data
class NeighborIssueSerializer(serializers.ModelSerializer):
class Meta:
model = models.Issue
fields = ("id", "ref", "subject")
depth = 0
## Instruction:
Remove unnecessary field from IssueSerializer
## Code After:
from rest_framework import serializers
from taiga.base.serializers import PickleField, NeighborsSerializerMixin
from . import models
class IssueSerializer(serializers.ModelSerializer):
tags = PickleField(required=False)
is_closed = serializers.Field(source="is_closed")
class Meta:
model = models.Issue
class IssueNeighborsSerializer(NeighborsSerializerMixin, IssueSerializer):
def serialize_neighbor(self, neighbor):
return NeighborIssueSerializer(neighbor).data
class NeighborIssueSerializer(serializers.ModelSerializer):
class Meta:
model = models.Issue
fields = ("id", "ref", "subject")
depth = 0
|
from rest_framework import serializers
from taiga.base.serializers import PickleField, NeighborsSerializerMixin
from . import models
class IssueSerializer(serializers.ModelSerializer):
tags = PickleField(required=False)
- comment = serializers.SerializerMethodField("get_comment")
is_closed = serializers.Field(source="is_closed")
class Meta:
model = models.Issue
-
- def get_comment(self, obj):
- return ""
class IssueNeighborsSerializer(NeighborsSerializerMixin, IssueSerializer):
def serialize_neighbor(self, neighbor):
return NeighborIssueSerializer(neighbor).data
class NeighborIssueSerializer(serializers.ModelSerializer):
class Meta:
model = models.Issue
fields = ("id", "ref", "subject")
depth = 0 | 4 | 0.129032 | 0 | 4 |
a37656c1325a0e5afbd469070013aa2ee5184b65 | docs/library/sys.rst | docs/library/sys.rst | :mod:`sys` -- system specific functions
=======================================
.. module:: sys
:synopsis: system specific functions
Functions
---------
.. function:: exit([retval])
Raise a ``SystemExit`` exception. If an argument is given, it is the
value given to ``SystemExit``.
.. function:: print_exception(exc, [file])
Print exception with a traceback to a file-like object ``file`` (or
``sys.stdout`` by default).
.. admonition:: Difference to CPython
This function appears in the ``traceback`` module in CPython.
Constants
---------
.. data:: argv
a mutable list of arguments this program started with
.. data:: byteorder
the byte order of the system ("little" or "big")
.. data:: path
a mutable list of directories to search for imported modules
.. data:: platform
The platform that Micro Python is running on. This is "pyboard" on the
pyboard and provides a robust way of determining if a script is running
on the pyboard or not.
.. data:: stderr
standard error (connected to USB VCP, and optional UART object)
.. data:: stdin
standard input (connected to USB VCP, and optional UART object)
.. data:: stdout
standard output (connected to USB VCP, and optional UART object)
.. data:: version
Python language version that this implementation conforms to, as a string
.. data:: version_info
Python language version that this implementation conforms to, as a tuple of ints
| :mod:`sys` -- system specific functions
=======================================
.. module:: sys
:synopsis: system specific functions
Functions
---------
.. function:: exit([retval])
Raise a ``SystemExit`` exception. If an argument is given, it is the
value given to ``SystemExit``.
.. function:: print_exception(exc, [file])
Print exception with a traceback to a file-like object ``file`` (or
``sys.stdout`` by default).
.. admonition:: Difference to CPython
:class: attention
This function appears in the ``traceback`` module in CPython.
Constants
---------
.. data:: argv
a mutable list of arguments this program started with
.. data:: byteorder
the byte order of the system ("little" or "big")
.. data:: path
a mutable list of directories to search for imported modules
.. data:: platform
The platform that Micro Python is running on. This is "pyboard" on the
pyboard and provides a robust way of determining if a script is running
on the pyboard or not.
.. data:: stderr
standard error (connected to USB VCP, and optional UART object)
.. data:: stdin
standard input (connected to USB VCP, and optional UART object)
.. data:: stdout
standard output (connected to USB VCP, and optional UART object)
.. data:: version
Python language version that this implementation conforms to, as a string
.. data:: version_info
Python language version that this implementation conforms to, as a tuple of ints
| Make admonition for CPy-difference use "attention" class. | docs: Make admonition for CPy-difference use "attention" class.
This renders it in yellow/orange box on RTD server.
| reStructuredText | mit | infinnovation/micropython,paul-xxx/micropython,kerneltask/micropython,hosaka/micropython,bvernoux/micropython,MrSurly/micropython,Peetz0r/micropython-esp32,supergis/micropython,aethaniel/micropython,henriknelson/micropython,xyb/micropython,dinau/micropython,neilh10/micropython,PappaPeppar/micropython,selste/micropython,pfalcon/micropython,AriZuu/micropython,vriera/micropython,cnoviello/micropython,hiway/micropython,HenrikSolver/micropython,danicampora/micropython,xyb/micropython,galenhz/micropython,omtinez/micropython,misterdanb/micropython,MrSurly/micropython-esp32,vriera/micropython,infinnovation/micropython,galenhz/micropython,toolmacher/micropython,SHA2017-badge/micropython-esp32,swegener/micropython,alex-robbins/micropython,utopiaprince/micropython,SHA2017-badge/micropython-esp32,mpalomer/micropython,kostyll/micropython,ganshun666/micropython,HenrikSolver/micropython,Vogtinator/micropython,puuu/micropython,dhylands/micropython,tuc-osg/micropython,praemdonck/micropython,jmarcelino/pycom-micropython,skybird6672/micropython,firstval/micropython,vitiral/micropython,blmorris/micropython,danicampora/micropython,toolmacher/micropython,jlillest/micropython,micropython/micropython-esp32,adafruit/circuitpython,heisewangluo/micropython,AriZuu/micropython,EcmaXp/micropython,dinau/micropython,alex-march/micropython,heisewangluo/micropython,slzatz/micropython,noahwilliamsson/micropython,bvernoux/micropython,lowRISC/micropython,drrk/micropython,alex-robbins/micropython,EcmaXp/micropython,aethaniel/micropython,feilongfl/micropython,infinnovation/micropython,utopiaprince/micropython,oopy/micropython,orionrobots/micropython,MrSurly/micropython,cwyark/micropython,ericsnowcurrently/micropython,feilongfl/micropython,xhat/micropython,paul-xxx/micropython,firstval/micropython,deshipu/micropython,kostyll/micropython,pfalcon/micropython,noahwilliamsson/micropython,TDAbboud/micropython,praemdonck/micropython,martinribelotta/micropython,blazewicz/micropython,adafruit/circuitpython,puuu/micropython,tobbad/micropython,ChuckM/micropython,ceramos/micropython,chrisdearman/micropython,cloudformdesign/micropython,ahotam/micropython,dhylands/micropython,tdautc19841202/micropython,turbinenreiter/micropython,rubencabrera/micropython,noahchense/micropython,micropython/micropython-esp32,utopiaprince/micropython,ChuckM/micropython,tuc-osg/micropython,stonegithubs/micropython,jimkmc/micropython,slzatz/micropython,adamkh/micropython,stonegithubs/micropython,suda/micropython,tdautc19841202/micropython,PappaPeppar/micropython,mgyenik/micropython,adafruit/circuitpython,ernesto-g/micropython,cwyark/micropython,matthewelse/micropython,xuxiaoxin/micropython,noahchense/micropython,redbear/micropython,jlillest/micropython,ernesto-g/micropython,dxxb/micropython,chrisdearman/micropython,misterdanb/micropython,dinau/micropython,torwag/micropython,slzatz/micropython,xhat/micropython,noahwilliamsson/micropython,HenrikSolver/micropython,SHA2017-badge/micropython-esp32,chrisdearman/micropython,firstval/micropython,henriknelson/micropython,ernesto-g/micropython,suda/micropython,puuu/micropython,SungEun-Steve-Kim/test-mp,ganshun666/micropython,MrSurly/micropython-esp32,Timmenem/micropython,tralamazza/micropython,hiway/micropython,mpalomer/micropython,emfcamp/micropython,MrSurly/micropython,mianos/micropython,ahotam/micropython,selste/micropython,paul-xxx/micropython,henriknelson/micropython,xuxiaoxin/micropython,mpalomer/micropython,slzatz/micropython,SungEun-Steve-Kim/test-mp,mpalomer/micropython,cnoviello/micropython,dhylands/micropython,orionrobots/micropython,vitiral/micropython,trezor/micropython,xyb/micropython,pozetroninc/micropython,HenrikSolver/micropython,trezor/micropython,matthewelse/micropython,aethaniel/micropython,cloudformdesign/micropython,MrSurly/micropython-esp32,pramasoul/micropython,trezor/micropython,supergis/micropython,pramasoul/micropython,vriera/micropython,PappaPeppar/micropython,dmazzella/micropython,lbattraw/micropython,paul-xxx/micropython,jlillest/micropython,kerneltask/micropython,ericsnowcurrently/micropython,feilongfl/micropython,mpalomer/micropython,warner83/micropython,pfalcon/micropython,xuxiaoxin/micropython,xhat/micropython,ceramos/micropython,pfalcon/micropython,tobbad/micropython,deshipu/micropython,ryannathans/micropython,hosaka/micropython,stonegithubs/micropython,blazewicz/micropython,KISSMonX/micropython,ryannathans/micropython,cloudformdesign/micropython,tobbad/micropython,mianos/micropython,omtinez/micropython,blmorris/micropython,ericsnowcurrently/micropython,ryannathans/micropython,hosaka/micropython,bvernoux/micropython,selste/micropython,xhat/micropython,oopy/micropython,Peetz0r/micropython-esp32,adamkh/micropython,MrSurly/micropython-esp32,swegener/micropython,trezor/micropython,mgyenik/micropython,utopiaprince/micropython,lbattraw/micropython,matthewelse/micropython,stonegithubs/micropython,suda/micropython,ceramos/micropython,xuxiaoxin/micropython,turbinenreiter/micropython,redbear/micropython,xhat/micropython,supergis/micropython,KISSMonX/micropython,lowRISC/micropython,drrk/micropython,orionrobots/micropython,pozetroninc/micropython,tdautc19841202/micropython,adafruit/micropython,lowRISC/micropython,adafruit/micropython,noahwilliamsson/micropython,rubencabrera/micropython,warner83/micropython,TDAbboud/micropython,pramasoul/micropython,chrisdearman/micropython,lbattraw/micropython,neilh10/micropython,heisewangluo/micropython,TDAbboud/micropython,AriZuu/micropython,pramasoul/micropython,misterdanb/micropython,lbattraw/micropython,tralamazza/micropython,KISSMonX/micropython,MrSurly/micropython-esp32,supergis/micropython,dxxb/micropython,skybird6672/micropython,mianos/micropython,ruffy91/micropython,micropython/micropython-esp32,warner83/micropython,deshipu/micropython,blazewicz/micropython,redbear/micropython,warner83/micropython,cwyark/micropython,dhylands/micropython,toolmacher/micropython,turbinenreiter/micropython,lowRISC/micropython,hiway/micropython,infinnovation/micropython,xyb/micropython,kostyll/micropython,redbear/micropython,SHA2017-badge/micropython-esp32,feilongfl/micropython,kerneltask/micropython,skybird6672/micropython,ceramos/micropython,tdautc19841202/micropython,noahchense/micropython,warner83/micropython,alex-robbins/micropython,ericsnowcurrently/micropython,misterdanb/micropython,kostyll/micropython,SungEun-Steve-Kim/test-mp,kerneltask/micropython,emfcamp/micropython,hosaka/micropython,neilh10/micropython,praemdonck/micropython,blmorris/micropython,hiway/micropython,tobbad/micropython,ruffy91/micropython,Vogtinator/micropython,adamkh/micropython,dxxb/micropython,aethaniel/micropython,danicampora/micropython,jlillest/micropython,jimkmc/micropython,vitiral/micropython,cnoviello/micropython,alex-robbins/micropython,suda/micropython,adafruit/circuitpython,PappaPeppar/micropython,swegener/micropython,skybird6672/micropython,tuc-osg/micropython,suda/micropython,martinribelotta/micropython,dmazzella/micropython,pozetroninc/micropython,torwag/micropython,ChuckM/micropython,jlillest/micropython,ganshun666/micropython,rubencabrera/micropython,EcmaXp/micropython,omtinez/micropython,hiway/micropython,ahotam/micropython,torwag/micropython,cloudformdesign/micropython,bvernoux/micropython,noahchense/micropython,Vogtinator/micropython,torwag/micropython,martinribelotta/micropython,tralamazza/micropython,ruffy91/micropython,pozetroninc/micropython,emfcamp/micropython,paul-xxx/micropython,kostyll/micropython,rubencabrera/micropython,ruffy91/micropython,firstval/micropython,galenhz/micropython,mhoffma/micropython,micropython/micropython-esp32,selste/micropython,ericsnowcurrently/micropython,praemdonck/micropython,alex-march/micropython,utopiaprince/micropython,orionrobots/micropython,neilh10/micropython,dxxb/micropython,cnoviello/micropython,TDAbboud/micropython,firstval/micropython,toolmacher/micropython,pramasoul/micropython,alex-march/micropython,henriknelson/micropython,adamkh/micropython,praemdonck/micropython,bvernoux/micropython,blmorris/micropython,adafruit/micropython,blmorris/micropython,drrk/micropython,MrSurly/micropython,oopy/micropython,Peetz0r/micropython-esp32,KISSMonX/micropython,adafruit/circuitpython,SungEun-Steve-Kim/test-mp,matthewelse/micropython,mhoffma/micropython,KISSMonX/micropython,jmarcelino/pycom-micropython,mianos/micropython,jimkmc/micropython,puuu/micropython,hosaka/micropython,ryannathans/micropython,cnoviello/micropython,ganshun666/micropython,vitiral/micropython,slzatz/micropython,noahchense/micropython,danicampora/micropython,ganshun666/micropython,neilh10/micropython,henriknelson/micropython,misterdanb/micropython,dinau/micropython,ChuckM/micropython,Peetz0r/micropython-esp32,ceramos/micropython,adafruit/circuitpython,stonegithubs/micropython,mhoffma/micropython,ruffy91/micropython,torwag/micropython,blazewicz/micropython,jimkmc/micropython,Timmenem/micropython,dxxb/micropython,mgyenik/micropython,oopy/micropython,Vogtinator/micropython,martinribelotta/micropython,cloudformdesign/micropython,SHA2017-badge/micropython-esp32,puuu/micropython,heisewangluo/micropython,xuxiaoxin/micropython,TDAbboud/micropython,pfalcon/micropython,redbear/micropython,emfcamp/micropython,martinribelotta/micropython,tralamazza/micropython,toolmacher/micropython,feilongfl/micropython,emfcamp/micropython,dhylands/micropython,oopy/micropython,alex-robbins/micropython,matthewelse/micropython,noahwilliamsson/micropython,vriera/micropython,adamkh/micropython,AriZuu/micropython,tuc-osg/micropython,jimkmc/micropython,omtinez/micropython,swegener/micropython,matthewelse/micropython,alex-march/micropython,lbattraw/micropython,kerneltask/micropython,Timmenem/micropython,omtinez/micropython,AriZuu/micropython,EcmaXp/micropython,Timmenem/micropython,skybird6672/micropython,Peetz0r/micropython-esp32,selste/micropython,ryannathans/micropython,danicampora/micropython,turbinenreiter/micropython,SungEun-Steve-Kim/test-mp,ahotam/micropython,cwyark/micropython,mgyenik/micropython,cwyark/micropython,aethaniel/micropython,HenrikSolver/micropython,mhoffma/micropython,mgyenik/micropython,tuc-osg/micropython,adafruit/micropython,ernesto-g/micropython,drrk/micropython,drrk/micropython,dinau/micropython,dmazzella/micropython,rubencabrera/micropython,EcmaXp/micropython,adafruit/micropython,blazewicz/micropython,deshipu/micropython,ernesto-g/micropython,MrSurly/micropython,heisewangluo/micropython,Timmenem/micropython,Vogtinator/micropython,mhoffma/micropython,jmarcelino/pycom-micropython,xyb/micropython,mianos/micropython,ChuckM/micropython,galenhz/micropython,vitiral/micropython,jmarcelino/pycom-micropython,micropython/micropython-esp32,PappaPeppar/micropython,infinnovation/micropython,dmazzella/micropython,swegener/micropython,galenhz/micropython,supergis/micropython,turbinenreiter/micropython,vriera/micropython,tobbad/micropython,deshipu/micropython,jmarcelino/pycom-micropython,orionrobots/micropython,trezor/micropython,lowRISC/micropython,tdautc19841202/micropython,pozetroninc/micropython,ahotam/micropython,alex-march/micropython,chrisdearman/micropython | restructuredtext | ## Code Before:
:mod:`sys` -- system specific functions
=======================================
.. module:: sys
:synopsis: system specific functions
Functions
---------
.. function:: exit([retval])
Raise a ``SystemExit`` exception. If an argument is given, it is the
value given to ``SystemExit``.
.. function:: print_exception(exc, [file])
Print exception with a traceback to a file-like object ``file`` (or
``sys.stdout`` by default).
.. admonition:: Difference to CPython
This function appears in the ``traceback`` module in CPython.
Constants
---------
.. data:: argv
a mutable list of arguments this program started with
.. data:: byteorder
the byte order of the system ("little" or "big")
.. data:: path
a mutable list of directories to search for imported modules
.. data:: platform
The platform that Micro Python is running on. This is "pyboard" on the
pyboard and provides a robust way of determining if a script is running
on the pyboard or not.
.. data:: stderr
standard error (connected to USB VCP, and optional UART object)
.. data:: stdin
standard input (connected to USB VCP, and optional UART object)
.. data:: stdout
standard output (connected to USB VCP, and optional UART object)
.. data:: version
Python language version that this implementation conforms to, as a string
.. data:: version_info
Python language version that this implementation conforms to, as a tuple of ints
## Instruction:
docs: Make admonition for CPy-difference use "attention" class.
This renders it in yellow/orange box on RTD server.
## Code After:
:mod:`sys` -- system specific functions
=======================================
.. module:: sys
:synopsis: system specific functions
Functions
---------
.. function:: exit([retval])
Raise a ``SystemExit`` exception. If an argument is given, it is the
value given to ``SystemExit``.
.. function:: print_exception(exc, [file])
Print exception with a traceback to a file-like object ``file`` (or
``sys.stdout`` by default).
.. admonition:: Difference to CPython
:class: attention
This function appears in the ``traceback`` module in CPython.
Constants
---------
.. data:: argv
a mutable list of arguments this program started with
.. data:: byteorder
the byte order of the system ("little" or "big")
.. data:: path
a mutable list of directories to search for imported modules
.. data:: platform
The platform that Micro Python is running on. This is "pyboard" on the
pyboard and provides a robust way of determining if a script is running
on the pyboard or not.
.. data:: stderr
standard error (connected to USB VCP, and optional UART object)
.. data:: stdin
standard input (connected to USB VCP, and optional UART object)
.. data:: stdout
standard output (connected to USB VCP, and optional UART object)
.. data:: version
Python language version that this implementation conforms to, as a string
.. data:: version_info
Python language version that this implementation conforms to, as a tuple of ints
| :mod:`sys` -- system specific functions
=======================================
.. module:: sys
:synopsis: system specific functions
Functions
---------
.. function:: exit([retval])
Raise a ``SystemExit`` exception. If an argument is given, it is the
value given to ``SystemExit``.
.. function:: print_exception(exc, [file])
Print exception with a traceback to a file-like object ``file`` (or
``sys.stdout`` by default).
.. admonition:: Difference to CPython
+ :class: attention
This function appears in the ``traceback`` module in CPython.
Constants
---------
.. data:: argv
a mutable list of arguments this program started with
.. data:: byteorder
the byte order of the system ("little" or "big")
.. data:: path
a mutable list of directories to search for imported modules
.. data:: platform
The platform that Micro Python is running on. This is "pyboard" on the
pyboard and provides a robust way of determining if a script is running
on the pyboard or not.
.. data:: stderr
standard error (connected to USB VCP, and optional UART object)
.. data:: stdin
standard input (connected to USB VCP, and optional UART object)
.. data:: stdout
standard output (connected to USB VCP, and optional UART object)
.. data:: version
Python language version that this implementation conforms to, as a string
.. data:: version_info
Python language version that this implementation conforms to, as a tuple of ints | 1 | 0.015873 | 1 | 0 |
ed434c7724cf2e7731c0b0b91a4b8efa7c424106 | nbt/src/main/java/com/voxelwind/nbt/util/CompoundTagBuilder.java | nbt/src/main/java/com/voxelwind/nbt/util/CompoundTagBuilder.java | package com.voxelwind.nbt.util;
import com.voxelwind.nbt.tags.CompoundTag;
import com.voxelwind.nbt.tags.Tag;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CompoundTagBuilder {
private final Map<String, Tag<?>> tagMap = new HashMap<>();
public static CompoundTagBuilder builder() {
return new CompoundTagBuilder();
}
public static CompoundTagBuilder from(CompoundTag tag) {
CompoundTagBuilder builder = new CompoundTagBuilder();
builder.tagMap.putAll(tag.getValue());
return builder;
}
public CompoundTagBuilder tag(Tag<?> tag) {
tagMap.put(tag.getName(), tag);
return this;
}
public CompoundTag buildRootTag() {
return new CompoundTag("", tagMap);
}
public CompoundTag build(String tagName) {
return new CompoundTag(tagName, tagMap);
}
}
| package com.voxelwind.nbt.util;
import com.voxelwind.nbt.tags.*;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CompoundTagBuilder {
private final Map<String, Tag<?>> tagMap = new HashMap<>();
public static CompoundTagBuilder builder() {
return new CompoundTagBuilder();
}
public static CompoundTagBuilder from(CompoundTag tag) {
CompoundTagBuilder builder = new CompoundTagBuilder();
builder.tagMap.putAll(tag.getValue());
return builder;
}
public CompoundTagBuilder tag(Tag<?> tag) {
tagMap.put(tag.getName(), tag);
return this;
}
public CompoundTagBuilder tag(String name, byte value) {
return tag(new ByteTag(name, value));
}
public CompoundTagBuilder tag(String name, byte [] value) {
return tag(new ByteArrayTag(name, value));
}
public CompoundTagBuilder tag(String name, double value) {
return tag(new DoubleTag(name, value));
}
public CompoundTagBuilder tag(String name, float value) {
return tag(new FloatTag(name, value));
}
public CompoundTagBuilder tag(String name, int[] value) {
return tag(new IntArrayTag(name, value));
}
public CompoundTagBuilder tag(String name, int value) {
return tag(new IntTag(name, value));
}
public CompoundTagBuilder tag(String name, long value) {
return tag(new LongTag(name, value));
}
public CompoundTagBuilder tag(String name, short value) {
return tag(new ShortTag(name, value));
}
public CompoundTagBuilder tag(String name, String value) {
return tag(new StringTag(name, value));
}
public CompoundTag buildRootTag() {
return new CompoundTag("", tagMap);
}
public CompoundTag build(String tagName) {
return new CompoundTag(tagName, tagMap);
}
}
| Add type-related tag methods to nbt-builder | Add type-related tag methods to nbt-builder
| Java | mit | voxelwind/voxelwind,voxelwind/voxelwind,minecrafter/voxelwind,voxelwind/voxelwind,minecrafter/voxelwind,minecrafter/voxelwind,minecrafter/voxelwind,voxelwind/voxelwind | java | ## Code Before:
package com.voxelwind.nbt.util;
import com.voxelwind.nbt.tags.CompoundTag;
import com.voxelwind.nbt.tags.Tag;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CompoundTagBuilder {
private final Map<String, Tag<?>> tagMap = new HashMap<>();
public static CompoundTagBuilder builder() {
return new CompoundTagBuilder();
}
public static CompoundTagBuilder from(CompoundTag tag) {
CompoundTagBuilder builder = new CompoundTagBuilder();
builder.tagMap.putAll(tag.getValue());
return builder;
}
public CompoundTagBuilder tag(Tag<?> tag) {
tagMap.put(tag.getName(), tag);
return this;
}
public CompoundTag buildRootTag() {
return new CompoundTag("", tagMap);
}
public CompoundTag build(String tagName) {
return new CompoundTag(tagName, tagMap);
}
}
## Instruction:
Add type-related tag methods to nbt-builder
## Code After:
package com.voxelwind.nbt.util;
import com.voxelwind.nbt.tags.*;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CompoundTagBuilder {
private final Map<String, Tag<?>> tagMap = new HashMap<>();
public static CompoundTagBuilder builder() {
return new CompoundTagBuilder();
}
public static CompoundTagBuilder from(CompoundTag tag) {
CompoundTagBuilder builder = new CompoundTagBuilder();
builder.tagMap.putAll(tag.getValue());
return builder;
}
public CompoundTagBuilder tag(Tag<?> tag) {
tagMap.put(tag.getName(), tag);
return this;
}
public CompoundTagBuilder tag(String name, byte value) {
return tag(new ByteTag(name, value));
}
public CompoundTagBuilder tag(String name, byte [] value) {
return tag(new ByteArrayTag(name, value));
}
public CompoundTagBuilder tag(String name, double value) {
return tag(new DoubleTag(name, value));
}
public CompoundTagBuilder tag(String name, float value) {
return tag(new FloatTag(name, value));
}
public CompoundTagBuilder tag(String name, int[] value) {
return tag(new IntArrayTag(name, value));
}
public CompoundTagBuilder tag(String name, int value) {
return tag(new IntTag(name, value));
}
public CompoundTagBuilder tag(String name, long value) {
return tag(new LongTag(name, value));
}
public CompoundTagBuilder tag(String name, short value) {
return tag(new ShortTag(name, value));
}
public CompoundTagBuilder tag(String name, String value) {
return tag(new StringTag(name, value));
}
public CompoundTag buildRootTag() {
return new CompoundTag("", tagMap);
}
public CompoundTag build(String tagName) {
return new CompoundTag(tagName, tagMap);
}
}
| package com.voxelwind.nbt.util;
- import com.voxelwind.nbt.tags.CompoundTag;
- import com.voxelwind.nbt.tags.Tag;
? ^^^
+ import com.voxelwind.nbt.tags.*;
? ^
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CompoundTagBuilder {
private final Map<String, Tag<?>> tagMap = new HashMap<>();
public static CompoundTagBuilder builder() {
return new CompoundTagBuilder();
}
public static CompoundTagBuilder from(CompoundTag tag) {
CompoundTagBuilder builder = new CompoundTagBuilder();
builder.tagMap.putAll(tag.getValue());
return builder;
}
public CompoundTagBuilder tag(Tag<?> tag) {
tagMap.put(tag.getName(), tag);
return this;
}
+ public CompoundTagBuilder tag(String name, byte value) {
+ return tag(new ByteTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, byte [] value) {
+ return tag(new ByteArrayTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, double value) {
+ return tag(new DoubleTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, float value) {
+ return tag(new FloatTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, int[] value) {
+ return tag(new IntArrayTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, int value) {
+ return tag(new IntTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, long value) {
+ return tag(new LongTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, short value) {
+ return tag(new ShortTag(name, value));
+ }
+
+ public CompoundTagBuilder tag(String name, String value) {
+ return tag(new StringTag(name, value));
+ }
+
public CompoundTag buildRootTag() {
return new CompoundTag("", tagMap);
}
public CompoundTag build(String tagName) {
return new CompoundTag(tagName, tagMap);
}
} | 39 | 1.054054 | 37 | 2 |
6122600692d8a44cd84ff85c3f8f6437aa536387 | config/initializers/secret_token.rb | config/initializers/secret_token.rb | PopHealth::Application.config.secret_token = 'd2d8152dfb0736f5ae682c88a0e416c0104b9c0271ac9834d7349653c96f38715b94fc9bad48641725b149a83e59e77d0e7554cd407bb1771f9d343ce217c596'
| PopHealth::Application.config.secret_token = 'd2d8152dfb0736f5ae682c88a0e416c0104b9c0271ac9834d7349653c96f38715b94fc9bad48641725b149a83e59e77d0e7554cd407bb1771f9d343ce217c596'
PopHealth::Application.config.secret_key_base = '3e393dd55e17e1836ea8c7feb65595d120bc2f23a58e811f1e2256dc6de615704b99c964f4149c33b4728f566a16bde4bae2a1eecc49fe7715057de4932f0f8f' | Add secret_key_base since not adding it causes depreciation errors in rails 4. | Add secret_key_base since not adding it causes depreciation errors in rails 4.
| Ruby | apache-2.0 | lrasmus/popHealth,yss-miawptgm/popHealth,lrasmus/popHealth,pophealth/popHealth,ELXR/popHealth,eedrummer/popHealth,smc-ssiddiqui/popHealth,OSEHRA/popHealth,jeremyklein/popHealth,yss-miawptgm/popHealth,ELXR/popHealth,q-centrix/popHealth,smc-ssiddiqui/popHealth,OSEHRA/popHealth,eedrummer/popHealth,lrasmus/popHealth,jeremyklein/popHealth,q-centrix/popHealth,OSEHRA/popHealth,smc-ssiddiqui/popHealth,smc-ssiddiqui/popHealth,pophealth/popHealth,pophealth/popHealth,ELXR/popHealth,alabama-medicaid-mu/popHealth,alabama-medicaid-mu/popHealth,OSEHRA/popHealth,q-centrix/popHealth,alabama-medicaid-mu/popHealth,yss-miawptgm/popHealth,jeremyklein/popHealth,jeremyklein/popHealth,lrasmus/popHealth,yss-miawptgm/popHealth,eedrummer/popHealth,q-centrix/popHealth,ELXR/popHealth,eedrummer/popHealth,alabama-medicaid-mu/popHealth | ruby | ## Code Before:
PopHealth::Application.config.secret_token = 'd2d8152dfb0736f5ae682c88a0e416c0104b9c0271ac9834d7349653c96f38715b94fc9bad48641725b149a83e59e77d0e7554cd407bb1771f9d343ce217c596'
## Instruction:
Add secret_key_base since not adding it causes depreciation errors in rails 4.
## Code After:
PopHealth::Application.config.secret_token = 'd2d8152dfb0736f5ae682c88a0e416c0104b9c0271ac9834d7349653c96f38715b94fc9bad48641725b149a83e59e77d0e7554cd407bb1771f9d343ce217c596'
PopHealth::Application.config.secret_key_base = '3e393dd55e17e1836ea8c7feb65595d120bc2f23a58e811f1e2256dc6de615704b99c964f4149c33b4728f566a16bde4bae2a1eecc49fe7715057de4932f0f8f' | PopHealth::Application.config.secret_token = 'd2d8152dfb0736f5ae682c88a0e416c0104b9c0271ac9834d7349653c96f38715b94fc9bad48641725b149a83e59e77d0e7554cd407bb1771f9d343ce217c596'
+
+ PopHealth::Application.config.secret_key_base = '3e393dd55e17e1836ea8c7feb65595d120bc2f23a58e811f1e2256dc6de615704b99c964f4149c33b4728f566a16bde4bae2a1eecc49fe7715057de4932f0f8f' | 2 | 2 | 2 | 0 |
76a5e9b2d32311b07ad1a9736f9725c24406b05e | notes/lang/elixir/index.md | notes/lang/elixir/index.md | ---
layout: page
title: 'Elixir'
date: 2014-06-07 12:00:00
---
**Installation**
{% highlight ruby %}
brew install erlang elixir
{% endhighlight %}
**Videos**
- [Elixir - A modern approach to programming for the Erlang VM on Vimeo](https://vimeo.com/53221562), Jose Valim
- [Introduction to Elixir](http://www.youtube.com/watch?v=a-off4Vznjs&feature=youtu.be), Dave Thomas
- [Think Different](https://www.youtube.com/watch?v=5hDVftaPQwY), Dave Thomas keynote at Elixir Conf 2014
| ---
layout: page
title: 'Elixir'
date: 2014-06-07 12:00:00
---
**Installation**
{% highlight ruby %}
brew install erlang elixir
{% endhighlight %}
**Bookmarks**
* [Elixir lang](http://elixir-lang.org/)
* [Phoenix guides](https://github.com/lancehalvorsen/phoenix-guides) - Guides for the Phoenix web framework
**Videos**
- [Elixir - A modern approach to programming for the Erlang VM on Vimeo](https://vimeo.com/53221562), Jose Valim
- [Introduction to Elixir](http://www.youtube.com/watch?v=a-off4Vznjs&feature=youtu.be), Dave Thomas
- [Think Different](https://www.youtube.com/watch?v=5hDVftaPQwY), Dave Thomas keynote at Elixir Conf 2014
| Add bookmark to Phoenix guides | Add bookmark to Phoenix guides
| Markdown | mit | nithinbekal/nithinbekal.github.io,nithinbekal/nithinbekal.github.io | markdown | ## Code Before:
---
layout: page
title: 'Elixir'
date: 2014-06-07 12:00:00
---
**Installation**
{% highlight ruby %}
brew install erlang elixir
{% endhighlight %}
**Videos**
- [Elixir - A modern approach to programming for the Erlang VM on Vimeo](https://vimeo.com/53221562), Jose Valim
- [Introduction to Elixir](http://www.youtube.com/watch?v=a-off4Vznjs&feature=youtu.be), Dave Thomas
- [Think Different](https://www.youtube.com/watch?v=5hDVftaPQwY), Dave Thomas keynote at Elixir Conf 2014
## Instruction:
Add bookmark to Phoenix guides
## Code After:
---
layout: page
title: 'Elixir'
date: 2014-06-07 12:00:00
---
**Installation**
{% highlight ruby %}
brew install erlang elixir
{% endhighlight %}
**Bookmarks**
* [Elixir lang](http://elixir-lang.org/)
* [Phoenix guides](https://github.com/lancehalvorsen/phoenix-guides) - Guides for the Phoenix web framework
**Videos**
- [Elixir - A modern approach to programming for the Erlang VM on Vimeo](https://vimeo.com/53221562), Jose Valim
- [Introduction to Elixir](http://www.youtube.com/watch?v=a-off4Vznjs&feature=youtu.be), Dave Thomas
- [Think Different](https://www.youtube.com/watch?v=5hDVftaPQwY), Dave Thomas keynote at Elixir Conf 2014
| ---
layout: page
title: 'Elixir'
date: 2014-06-07 12:00:00
---
**Installation**
{% highlight ruby %}
brew install erlang elixir
{% endhighlight %}
+ **Bookmarks**
+
+ * [Elixir lang](http://elixir-lang.org/)
+ * [Phoenix guides](https://github.com/lancehalvorsen/phoenix-guides) - Guides for the Phoenix web framework
+
**Videos**
- [Elixir - A modern approach to programming for the Erlang VM on Vimeo](https://vimeo.com/53221562), Jose Valim
- [Introduction to Elixir](http://www.youtube.com/watch?v=a-off4Vznjs&feature=youtu.be), Dave Thomas
- [Think Different](https://www.youtube.com/watch?v=5hDVftaPQwY), Dave Thomas keynote at Elixir Conf 2014 | 5 | 0.294118 | 5 | 0 |
014e4fe380cddcdcc5ca12a32ab6af35e87ee56e | common/postgresqlfix.py | common/postgresqlfix.py |
from django.db.models import QuerySet
def new_exclude(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
if len(new_kwargs):
return old_exclude(self, *args, **new_kwargs)
else:
return self
def new_filter(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
if len(new_kwargs):
return old_filter(self, *args, **new_kwargs)
else:
return self
old_exclude = QuerySet.exclude
QuerySet.exclude = new_exclude
old_filter = QuerySet.filter
QuerySet.filter = new_filter |
from django.db.models import QuerySet
def new_exclude(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
return old_exclude(self, *args, **new_kwargs)
def new_filter(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
return old_filter(self, *args, **new_kwargs)
old_exclude = QuerySet.exclude
QuerySet.exclude = new_exclude
old_filter = QuerySet.filter
QuerySet.filter = new_filter | Fix buggy patched QuerySet methods | Fix buggy patched QuerySet methods
| Python | agpl-3.0 | m4tx/egielda,m4tx/egielda,m4tx/egielda | python | ## Code Before:
from django.db.models import QuerySet
def new_exclude(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
if len(new_kwargs):
return old_exclude(self, *args, **new_kwargs)
else:
return self
def new_filter(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
if len(new_kwargs):
return old_filter(self, *args, **new_kwargs)
else:
return self
old_exclude = QuerySet.exclude
QuerySet.exclude = new_exclude
old_filter = QuerySet.filter
QuerySet.filter = new_filter
## Instruction:
Fix buggy patched QuerySet methods
## Code After:
from django.db.models import QuerySet
def new_exclude(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
return old_exclude(self, *args, **new_kwargs)
def new_filter(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
return old_filter(self, *args, **new_kwargs)
old_exclude = QuerySet.exclude
QuerySet.exclude = new_exclude
old_filter = QuerySet.filter
QuerySet.filter = new_filter |
from django.db.models import QuerySet
def new_exclude(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
- if len(new_kwargs):
- return old_exclude(self, *args, **new_kwargs)
? ----
+ return old_exclude(self, *args, **new_kwargs)
- else:
- return self
def new_filter(self, *args, **kwargs):
new_kwargs = dict()
for key, value in kwargs.items():
if not ((isinstance(value, list) and not value) or (isinstance(value, QuerySet) and not value)):
new_kwargs[key] = value
- if len(new_kwargs):
- return old_filter(self, *args, **new_kwargs)
? ----
+ return old_filter(self, *args, **new_kwargs)
- else:
- return self
old_exclude = QuerySet.exclude
QuerySet.exclude = new_exclude
old_filter = QuerySet.filter
QuerySet.filter = new_filter | 10 | 0.30303 | 2 | 8 |
6d107312c1bcca56ead5b4cc27b89c028f2eafeb | README.rst | README.rst | fmn.lib
=======
`fmn <https://github.com/fedora-infra/fmn>`_ is a family of systems to manage
end-user notifications triggered by
`fedmsg, the Fedora FEDerated MESsage bus <http://fedmsg.com>`_.
This module contains the internal API components and data model for Fedora
Notifications
There is a parental placeholder repo with some useful information you might
want to read through, like an `overview
<https://github.com/fedora-infra/fmn/#fedora-notifications>`_, a little
`architecture diagram <https://github.com/fedora-infra/fmn/#architecture>`_,
and some `development instructions
<https://github.com/fedora-infra/fmn/#hacking>`_ to help you get set up and
coding.
| fmn.lib
=======
`fmn <https://github.com/fedora-infra/fmn>`_ is a family of systems to manage
end-user notifications triggered by
`fedmsg, the Fedora FEDerated MESsage bus <http://fedmsg.com>`_.
This module contains the internal API components and data model for Fedora
Notifications
There is a parental placeholder repo with some useful information you might
want to read through, like an `overview
<https://github.com/fedora-infra/fmn/#fedora-notifications>`_, a little
`architecture diagram <https://github.com/fedora-infra/fmn/#architecture>`_,
and some `development instructions
<https://github.com/fedora-infra/fmn/#hacking>`_ to help you get set up and
coding.
To run the test suite, make sure you have `fmn.rules
<https://github.com/fedora-infra/fmn.rules>`_ checked out.
Then cd into fmn/lib/tests, and run nosetests.
If you have fmn.rules installed in a virtual environment,
make sure you also run nosetests from the same venv.
| Add some documentation on testing fmn.lib | Add some documentation on testing fmn.lib
Signed-off-by: Patrick Uiterwijk <[email protected]>
| reStructuredText | lgpl-2.1 | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | restructuredtext | ## Code Before:
fmn.lib
=======
`fmn <https://github.com/fedora-infra/fmn>`_ is a family of systems to manage
end-user notifications triggered by
`fedmsg, the Fedora FEDerated MESsage bus <http://fedmsg.com>`_.
This module contains the internal API components and data model for Fedora
Notifications
There is a parental placeholder repo with some useful information you might
want to read through, like an `overview
<https://github.com/fedora-infra/fmn/#fedora-notifications>`_, a little
`architecture diagram <https://github.com/fedora-infra/fmn/#architecture>`_,
and some `development instructions
<https://github.com/fedora-infra/fmn/#hacking>`_ to help you get set up and
coding.
## Instruction:
Add some documentation on testing fmn.lib
Signed-off-by: Patrick Uiterwijk <[email protected]>
## Code After:
fmn.lib
=======
`fmn <https://github.com/fedora-infra/fmn>`_ is a family of systems to manage
end-user notifications triggered by
`fedmsg, the Fedora FEDerated MESsage bus <http://fedmsg.com>`_.
This module contains the internal API components and data model for Fedora
Notifications
There is a parental placeholder repo with some useful information you might
want to read through, like an `overview
<https://github.com/fedora-infra/fmn/#fedora-notifications>`_, a little
`architecture diagram <https://github.com/fedora-infra/fmn/#architecture>`_,
and some `development instructions
<https://github.com/fedora-infra/fmn/#hacking>`_ to help you get set up and
coding.
To run the test suite, make sure you have `fmn.rules
<https://github.com/fedora-infra/fmn.rules>`_ checked out.
Then cd into fmn/lib/tests, and run nosetests.
If you have fmn.rules installed in a virtual environment,
make sure you also run nosetests from the same venv.
| fmn.lib
=======
`fmn <https://github.com/fedora-infra/fmn>`_ is a family of systems to manage
end-user notifications triggered by
`fedmsg, the Fedora FEDerated MESsage bus <http://fedmsg.com>`_.
This module contains the internal API components and data model for Fedora
Notifications
There is a parental placeholder repo with some useful information you might
want to read through, like an `overview
<https://github.com/fedora-infra/fmn/#fedora-notifications>`_, a little
`architecture diagram <https://github.com/fedora-infra/fmn/#architecture>`_,
and some `development instructions
<https://github.com/fedora-infra/fmn/#hacking>`_ to help you get set up and
coding.
+
+ To run the test suite, make sure you have `fmn.rules
+ <https://github.com/fedora-infra/fmn.rules>`_ checked out.
+ Then cd into fmn/lib/tests, and run nosetests.
+ If you have fmn.rules installed in a virtual environment,
+ make sure you also run nosetests from the same venv. | 6 | 0.352941 | 6 | 0 |
9f54b2574c5826738e76119a305547f950b24b1d | docs/index.rst | docs/index.rst | .. indoctrinate documentation master file, created by
sphinx-quickstart on Tue Nov 18 19:52:51 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to indoctrinate's documentation!
========================================
Contents:
.. toctree::
:maxdepth: 2
api/modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
| .. indoctrinate documentation master file, created by
sphinx-quickstart on Tue Nov 18 19:52:51 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to indoctrinate's documentation!
========================================
Installation
------------
Use pip_:
.. code-block:: bash
$ pip install cybox
You might also want to consider using a virtualenv_.
.. note::
I wouldn't recommend actually installing this, since it doesn't really do
anything!
.. _pip: http://pip.readthedocs.org/
.. _virtualenv: http://virtualenv.readthedocs.org/
API Documentation
-----------------
.. toctree::
:maxdepth: 2
api/modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
| Add text to documentation home page. | Add text to documentation home page.
| reStructuredText | mit | gtback/indoctrinate | restructuredtext | ## Code Before:
.. indoctrinate documentation master file, created by
sphinx-quickstart on Tue Nov 18 19:52:51 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to indoctrinate's documentation!
========================================
Contents:
.. toctree::
:maxdepth: 2
api/modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
## Instruction:
Add text to documentation home page.
## Code After:
.. indoctrinate documentation master file, created by
sphinx-quickstart on Tue Nov 18 19:52:51 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to indoctrinate's documentation!
========================================
Installation
------------
Use pip_:
.. code-block:: bash
$ pip install cybox
You might also want to consider using a virtualenv_.
.. note::
I wouldn't recommend actually installing this, since it doesn't really do
anything!
.. _pip: http://pip.readthedocs.org/
.. _virtualenv: http://virtualenv.readthedocs.org/
API Documentation
-----------------
.. toctree::
:maxdepth: 2
api/modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
| .. indoctrinate documentation master file, created by
sphinx-quickstart on Tue Nov 18 19:52:51 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to indoctrinate's documentation!
========================================
- Contents:
+ Installation
+ ------------
+
+ Use pip_:
+
+ .. code-block:: bash
+
+ $ pip install cybox
+
+ You might also want to consider using a virtualenv_.
+
+ .. note::
+ I wouldn't recommend actually installing this, since it doesn't really do
+ anything!
+
+ .. _pip: http://pip.readthedocs.org/
+ .. _virtualenv: http://virtualenv.readthedocs.org/
+
+
+ API Documentation
+ -----------------
.. toctree::
:maxdepth: 2
api/modules
-
-
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
| 24 | 1 | 21 | 3 |
4e35b16b8aed2ccb9dbc34a2bb56ce129450546b | mode/formatter/format_server.py | mode/formatter/format_server.py | import socket
from struct import pack, unpack
import sys
import autopep8
PORT = 10011
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10011)
sock.bind(server_address)
sock.listen(1)
print >>sys.stderr, 'Format server up on %s port %s' % server_address
while True:
connection, client_address = sock.accept()
try:
buf = connection.recv(4)
(size,) = unpack('>i', buf)
if size == -1:
print >>sys.stderr, 'Format server exiting.'
sys.exit(0)
src = ''
while len(src) < size:
src += connection.recv(4096)
src = src.decode('utf-8')
reformatted = autopep8.fix_code(src)
encoded = reformatted.encode('utf-8')
connection.sendall(pack('>i', len(encoded)))
connection.sendall(encoded)
finally:
connection.close() | import socket
from struct import pack, unpack
import sys
import autopep8
PORT = 10011
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10011)
sock.bind(server_address)
sock.listen(1)
print >>sys.stderr, 'Format server up on %s port %s' % server_address
while True:
connection, client_address = sock.accept()
try:
buf = ''
while len(buf) < 4:
buf += connection.recv(4 - len(buf))
(size,) = unpack('>i', buf)
if size == -1:
print >>sys.stderr, 'Format server exiting.'
sys.exit(0)
src = ''
while len(src) < size:
src += connection.recv(4096)
src = src.decode('utf-8')
reformatted = autopep8.fix_code(src)
encoded = reformatted.encode('utf-8')
connection.sendall(pack('>i', len(encoded)))
connection.sendall(encoded)
finally:
connection.close()
| Fix a bug in format server not fully reading 4-byte length. | Fix a bug in format server not fully reading 4-byte length.
| Python | apache-2.0 | tildebyte/processing.py,mashrin/processing.py,Luxapodular/processing.py,tildebyte/processing.py,Luxapodular/processing.py,tildebyte/processing.py,mashrin/processing.py,mashrin/processing.py,jdf/processing.py,jdf/processing.py,Luxapodular/processing.py,jdf/processing.py | python | ## Code Before:
import socket
from struct import pack, unpack
import sys
import autopep8
PORT = 10011
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10011)
sock.bind(server_address)
sock.listen(1)
print >>sys.stderr, 'Format server up on %s port %s' % server_address
while True:
connection, client_address = sock.accept()
try:
buf = connection.recv(4)
(size,) = unpack('>i', buf)
if size == -1:
print >>sys.stderr, 'Format server exiting.'
sys.exit(0)
src = ''
while len(src) < size:
src += connection.recv(4096)
src = src.decode('utf-8')
reformatted = autopep8.fix_code(src)
encoded = reformatted.encode('utf-8')
connection.sendall(pack('>i', len(encoded)))
connection.sendall(encoded)
finally:
connection.close()
## Instruction:
Fix a bug in format server not fully reading 4-byte length.
## Code After:
import socket
from struct import pack, unpack
import sys
import autopep8
PORT = 10011
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10011)
sock.bind(server_address)
sock.listen(1)
print >>sys.stderr, 'Format server up on %s port %s' % server_address
while True:
connection, client_address = sock.accept()
try:
buf = ''
while len(buf) < 4:
buf += connection.recv(4 - len(buf))
(size,) = unpack('>i', buf)
if size == -1:
print >>sys.stderr, 'Format server exiting.'
sys.exit(0)
src = ''
while len(src) < size:
src += connection.recv(4096)
src = src.decode('utf-8')
reformatted = autopep8.fix_code(src)
encoded = reformatted.encode('utf-8')
connection.sendall(pack('>i', len(encoded)))
connection.sendall(encoded)
finally:
connection.close()
| import socket
from struct import pack, unpack
import sys
import autopep8
PORT = 10011
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10011)
sock.bind(server_address)
sock.listen(1)
print >>sys.stderr, 'Format server up on %s port %s' % server_address
while True:
connection, client_address = sock.accept()
try:
+ buf = ''
+ while len(buf) < 4:
- buf = connection.recv(4)
+ buf += connection.recv(4 - len(buf))
? ++++ + ++++++++++ +
(size,) = unpack('>i', buf)
if size == -1:
print >>sys.stderr, 'Format server exiting.'
sys.exit(0)
src = ''
while len(src) < size:
src += connection.recv(4096)
src = src.decode('utf-8')
reformatted = autopep8.fix_code(src)
encoded = reformatted.encode('utf-8')
connection.sendall(pack('>i', len(encoded)))
connection.sendall(encoded)
finally:
connection.close() | 4 | 0.133333 | 3 | 1 |
c3d3dc14031c44510b948ad17b4c395906603cc6 | database/factories/UserFactory.php | database/factories/UserFactory.php | <?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm',
'remember_token' => str_random(10),
];
});
| <?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});
| Add comment with the value of the hashed password | Add comment with the value of the hashed password | PHP | apache-2.0 | hackel/laravel,tinywitch/laravel,hackel/laravel,slimkit/thinksns-plus,cbnuke/FilesCollection,cbnuke/FilesCollection,slimkit/thinksns-plus,hackel/laravel | php | ## Code Before:
<?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm',
'remember_token' => str_random(10),
];
});
## Instruction:
Add comment with the value of the hashed password
## Code After:
<?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});
| <?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
- 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm',
+ 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
? ++++++++++
'remember_token' => str_random(10),
];
}); | 2 | 0.086957 | 1 | 1 |
cb6689fc1b0c1da1f3596f5cb4017aa71a28189b | src/index.coffee | src/index.coffee | sysPath = require 'path'
compileHBS = require './ember-handlebars-compiler'
module.exports = class EmberHandlebarsCompiler
brunchPlugin: yes
type: 'template'
extension: 'hbs'
precompile: off
root: null
modulesPrefix: 'module.exports = '
constructor: (@config) ->
if @config.files.templates.precompile is on
@precompile = on
if @config.files.templates.root?
@root = sysPath.join 'app', @config.files.templates.root, sysPath.sep
if @config.modules.wrapper is off
@modulesPrefix = ''
null
compile: (data, path, callback) ->
try
tmplPath = path.replace @root, ''
tmplPath = tmplPath.replace /\\/g, '/'
tmplPath = tmplPath.substr 0, tmplPath.length - sysPath.extname(tmplPath).length
tmplName = "Ember.TEMPLATES['#{tmplPath}']"
if @precompile is on
content = compileHBS data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.template(#{content});"
else
content = JSON.stringify data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.compile(#{content});"
catch err
error = err
finally
callback error, result
| sysPath = require 'path'
compileHBS = require './ember-handlebars-compiler'
module.exports = class EmberHandlebarsCompiler
brunchPlugin: yes
type: 'template'
extension: 'hbs'
precompile: off
root: null
modulesPrefix: 'module.exports = '
constructor: (@config) ->
if @config.files.templates.precompile is on
@precompile = on
if @config.files.templates.root?
@root = sysPath.join 'app', @config.files.templates.root, sysPath.sep
if @config.modules.wrapper is off
@modulesPrefix = ''
if @config.files.templates.defaultExtension?
@extension = @config.files.templates.defaultExtension
null
compile: (data, path, callback) ->
try
tmplPath = path.replace @root, ''
tmplPath = tmplPath.replace /\\/g, '/'
tmplPath = tmplPath.substr 0, tmplPath.length - sysPath.extname(tmplPath).length
tmplName = "Ember.TEMPLATES['#{tmplPath}']"
if @precompile is on
content = compileHBS data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.template(#{content});"
else
content = JSON.stringify data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.compile(#{content});"
catch err
error = err
finally
callback error, result
| Use the configured default extension | Use the configured default extension
Right now the code does not take defaultExtension into account.
| CoffeeScript | mit | bartsqueezy/ember-handlebars-brunch,rvermillion/ember-handlebars-brunch | coffeescript | ## Code Before:
sysPath = require 'path'
compileHBS = require './ember-handlebars-compiler'
module.exports = class EmberHandlebarsCompiler
brunchPlugin: yes
type: 'template'
extension: 'hbs'
precompile: off
root: null
modulesPrefix: 'module.exports = '
constructor: (@config) ->
if @config.files.templates.precompile is on
@precompile = on
if @config.files.templates.root?
@root = sysPath.join 'app', @config.files.templates.root, sysPath.sep
if @config.modules.wrapper is off
@modulesPrefix = ''
null
compile: (data, path, callback) ->
try
tmplPath = path.replace @root, ''
tmplPath = tmplPath.replace /\\/g, '/'
tmplPath = tmplPath.substr 0, tmplPath.length - sysPath.extname(tmplPath).length
tmplName = "Ember.TEMPLATES['#{tmplPath}']"
if @precompile is on
content = compileHBS data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.template(#{content});"
else
content = JSON.stringify data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.compile(#{content});"
catch err
error = err
finally
callback error, result
## Instruction:
Use the configured default extension
Right now the code does not take defaultExtension into account.
## Code After:
sysPath = require 'path'
compileHBS = require './ember-handlebars-compiler'
module.exports = class EmberHandlebarsCompiler
brunchPlugin: yes
type: 'template'
extension: 'hbs'
precompile: off
root: null
modulesPrefix: 'module.exports = '
constructor: (@config) ->
if @config.files.templates.precompile is on
@precompile = on
if @config.files.templates.root?
@root = sysPath.join 'app', @config.files.templates.root, sysPath.sep
if @config.modules.wrapper is off
@modulesPrefix = ''
if @config.files.templates.defaultExtension?
@extension = @config.files.templates.defaultExtension
null
compile: (data, path, callback) ->
try
tmplPath = path.replace @root, ''
tmplPath = tmplPath.replace /\\/g, '/'
tmplPath = tmplPath.substr 0, tmplPath.length - sysPath.extname(tmplPath).length
tmplName = "Ember.TEMPLATES['#{tmplPath}']"
if @precompile is on
content = compileHBS data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.template(#{content});"
else
content = JSON.stringify data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.compile(#{content});"
catch err
error = err
finally
callback error, result
| sysPath = require 'path'
compileHBS = require './ember-handlebars-compiler'
module.exports = class EmberHandlebarsCompiler
brunchPlugin: yes
type: 'template'
extension: 'hbs'
precompile: off
root: null
modulesPrefix: 'module.exports = '
constructor: (@config) ->
if @config.files.templates.precompile is on
@precompile = on
if @config.files.templates.root?
@root = sysPath.join 'app', @config.files.templates.root, sysPath.sep
if @config.modules.wrapper is off
@modulesPrefix = ''
+ if @config.files.templates.defaultExtension?
+ @extension = @config.files.templates.defaultExtension
null
compile: (data, path, callback) ->
try
tmplPath = path.replace @root, ''
tmplPath = tmplPath.replace /\\/g, '/'
tmplPath = tmplPath.substr 0, tmplPath.length - sysPath.extname(tmplPath).length
tmplName = "Ember.TEMPLATES['#{tmplPath}']"
if @precompile is on
content = compileHBS data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.template(#{content});"
else
content = JSON.stringify data.toString()
result = "#{@modulesPrefix}#{tmplName} = Ember.Handlebars.compile(#{content});"
catch err
error = err
finally
callback error, result | 2 | 0.055556 | 2 | 0 |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 0