Datasets:

Modalities:
Text
ArXiv:
Tags:
code
Libraries:
Datasets
License:
Dataset Viewer
Auto-converted to Parquet Duplicate
repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
davidmoten/grumpy
grumpy-core/src/test/java/com/github/davidmoten/grumpy/core/PositionTest.java
// Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // public static double longitudeDiff(double a, double b) { // a = to180(a); // b = to180(b); // return Math.abs(to180(a - b)); // } // // Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // pu...
import static com.github.davidmoten.grumpy.core.Position.longitudeDiff; import static com.github.davidmoten.grumpy.core.Position.to180; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; i...
Position p = new Position(-10, 110); assertTrue(p.isOutside(squareRegion, MIN_DISTANCE_KM)); } /** * Test when a position is outside a given region consisting of several * joining points. In this test the region is a roughly square region * consisting of four segments or eight {@...
// Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // public static double longitudeDiff(double a, double b) { // a = to180(a); // b = to180(b); // return Math.abs(to180(a - b)); // } // // Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // pu...
assertEquals(0, to180(0), PRECISION);
davidmoten/grumpy
grumpy-core/src/test/java/com/github/davidmoten/grumpy/core/PositionTest.java
// Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // public static double longitudeDiff(double a, double b) { // a = to180(a); // b = to180(b); // return Math.abs(to180(a - b)); // } // // Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // pu...
import static com.github.davidmoten.grumpy.core.Position.longitudeDiff; import static com.github.davidmoten.grumpy.core.Position.to180; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; i...
Position p = new Position(20.07030897931526, 24.999999999999996); assertFalse(p.isOutside(squareRegion, MIN_DISTANCE_KM)); } /** * Test when a position is outside a given region consisting of several * joining points. In this test the region is a roughly square region * consistin...
// Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // public static double longitudeDiff(double a, double b) { // a = to180(a); // b = to180(b); // return Math.abs(to180(a - b)); // } // // Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // pu...
assertEquals(10, longitudeDiff(15, 5), PRECISION);
davidmoten/grumpy
grumpy-core/src/test/java/com/github/davidmoten/grumpy/core/PositionTest.java
// Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // public static double longitudeDiff(double a, double b) { // a = to180(a); // b = to180(b); // return Math.abs(to180(a - b)); // } // // Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // pu...
import static com.github.davidmoten.grumpy.core.Position.longitudeDiff; import static com.github.davidmoten.grumpy.core.Position.to180; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; i...
Position a = Position.create(0, 20); Position b = Position.create(0, 30); System.out.println(a.getBearingDegrees(b)); Double halfwayLat = a.getLatitudeOnGreatCircle(b, 25); assertEquals(0, halfwayLat, 0.1); } @Test public void testGetLatitudeOnGreatCircleFromLaxToJfk...
// Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // public static double longitudeDiff(double a, double b) { // a = to180(a); // b = to180(b); // return Math.abs(to180(a - b)); // } // // Path: grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java // pu...
LongitudePair candidates = a.getLongitudeOnGreatCircle(b, 36 + 23.65967428 / 60.0);
davidmoten/grumpy
grumpy-ogc/src/main/java/com/github/davidmoten/util/servlet/RequestUtil.java
// Path: grumpy-ogc/src/main/java/com/github/davidmoten/grumpy/wms/MissingMandatoryParameterException.java // public class MissingMandatoryParameterException extends Exception { // // private static final long serialVersionUID = -9206288232141856630L; // // public MissingMandatoryParameterException(String...
import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import com.github.davidmoten.grumpy.wms.MissingMandatoryParameterException;
package com.github.davidmoten.util.servlet; public class RequestUtil { private static final String COMMA = ","; public static List<String> getList(HttpServletRequest request, String parameter, boolean mandatory) { String[] items = new String[] {}; if (request.getParameter(param...
// Path: grumpy-ogc/src/main/java/com/github/davidmoten/grumpy/wms/MissingMandatoryParameterException.java // public class MissingMandatoryParameterException extends Exception { // // private static final long serialVersionUID = -9206288232141856630L; // // public MissingMandatoryParameterException(String...
boolean mandatory) throws MissingMandatoryParameterException {
juiser/juiser
spring/spring-security/src/main/java/org/juiser/spring/security/authentication/JwsToUserDetailsConverter.java
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
import org.juiser.model.User; import org.juiser.spring.security.core.userdetails.ForwardedUserDetails; import io.jsonwebtoken.Claims; import io.jsonwebtoken.lang.Assert; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.Collecti...
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
private final Function<Claims, User> claimsUserFactory;
juiser/juiser
spring/spring-security/src/main/java/org/juiser/spring/security/authentication/JwsToUserDetailsConverter.java
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
import org.juiser.model.User; import org.juiser.spring.security.core.userdetails.ForwardedUserDetails; import io.jsonwebtoken.Claims; import io.jsonwebtoken.lang.Assert; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.Collecti...
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
return new ForwardedUserDetails(user, authorities);
juiser/juiser
spring/spring-web/src/main/java/org/juiser/spring/web/SpringForwardedUserFilter.java
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
import org.juiser.model.User; import org.juiser.servlet.ForwardedUserFilter; import org.springframework.web.filter.OncePerRequestFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IO...
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
Function<HttpServletRequest, User> userFactory,
juiser/juiser
spring/spring-security/src/main/java/org/juiser/spring/security/web/authentication/HeaderAuthenticationFilter.java
// Path: spring/spring-security/src/main/java/org/juiser/spring/security/authentication/HeaderAuthenticationToken.java // public class HeaderAuthenticationToken extends AbstractAuthenticationToken { // // private final String headerName; // // private final String headerValue; // // public HeaderAuthenti...
import org.juiser.spring.security.authentication.HeaderAuthenticationToken; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.InternalAuthenticationServiceException; import org.springframe...
/** * Clears the {@link SecurityContextHolder} and returns {@code true}. */ protected boolean unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, ...
// Path: spring/spring-security/src/main/java/org/juiser/spring/security/authentication/HeaderAuthenticationToken.java // public class HeaderAuthenticationToken extends AbstractAuthenticationToken { // // private final String headerName; // // private final String headerValue; // // public HeaderAuthenti...
HeaderAuthenticationToken token = new HeaderAuthenticationToken(name, value);
juiser/juiser
core/src/main/java/org/juiser/jwt/config/ConfigJwkResolver.java
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
import java.security.PublicKey; import java.security.interfaces.ECKey; import java.security.interfaces.RSAKey; import java.util.function.Function; import org.juiser.io.DefaultResource; import org.juiser.io.Resource; import org.juiser.io.ResourceLoader; import org.juiser.jwt.AlgorithmFamily; import io.jsonwebtoken.Signa...
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
AlgorithmFamily algorithmFamily = null;
juiser/juiser
core/src/main/java/org/juiser/jwt/config/ConfigJwkResolver.java
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
import java.security.PublicKey; import java.security.interfaces.ECKey; import java.security.interfaces.RSAKey; import java.util.function.Function; import org.juiser.io.DefaultResource; import org.juiser.io.Resource; import org.juiser.io.ResourceLoader; import org.juiser.jwt.AlgorithmFamily; import io.jsonwebtoken.Signa...
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
Resource keyResource = getResource(jwk);
juiser/juiser
core/src/main/java/org/juiser/jwt/config/ConfigJwkResolver.java
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
import java.security.PublicKey; import java.security.interfaces.ECKey; import java.security.interfaces.RSAKey; import java.util.function.Function; import org.juiser.io.DefaultResource; import org.juiser.io.Resource; import org.juiser.io.ResourceLoader; import org.juiser.jwt.AlgorithmFamily; import io.jsonwebtoken.Signa...
if (keyResource != null && keyStringSpecified) { String msg = "Both the juiser.header.jwt.key.value and " + "juiser.header.jwt.key.resource properties may not be set simultaneously. " + "Please choose one."; throw new IllegalArgumentException(msg); ...
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
keyResource = new DefaultResource(bais, "juiser.header.jwt.key.value");
juiser/juiser
spring/spring-core/src/main/java/org/juiser/spring/io/SpringResourceLoader.java
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
import org.juiser.io.DefaultResource; import org.juiser.io.Resource; import org.juiser.io.ResourceLoader; import java.io.IOException;
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
public Resource getResource(String path) throws IOException {
juiser/juiser
spring/spring-core/src/main/java/org/juiser/spring/io/SpringResourceLoader.java
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
import org.juiser.io.DefaultResource; import org.juiser.io.Resource; import org.juiser.io.ResourceLoader; import java.io.IOException;
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/io/DefaultResource.java // public class DefaultResource implements Resource { // // private final InputStream is; // private final String name; // // public DefaultResource(InputStream is, String name) { // Assert.notNull(is, "InputStream cannot be null."); /...
return new DefaultResource(resource.getInputStream(), resource.getDescription());
juiser/juiser
servlet/src/main/java/org/juiser/servlet/ForwardedUserFilter.java
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
import java.util.LinkedHashSet; import java.util.function.Function; import io.jsonwebtoken.lang.Assert; import io.jsonwebtoken.lang.Collections; import io.jsonwebtoken.lang.Strings; import org.juiser.model.User; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import jav...
/* * Copyright 2017 Les Hazlewood and the respective Juiser contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
// Path: core/src/main/java/org/juiser/model/User.java // public interface User { // // /** // * Returns {@code true} if the user has been authenticated (proven their identity) or {@code false} if the user // * is considered anonymous. // * // * @return {@code true} if the user has been authent...
private final Function<HttpServletRequest, User> userFactory;
juiser/juiser
spring/spring-security/src/main/java/org/juiser/spring/security/authentication/HeaderAuthenticationProvider.java
// Path: spring/spring-security/src/main/java/org/juiser/spring/security/core/ForwardedUserAuthentication.java // public class ForwardedUserAuthentication implements Authentication { // // private final UserDetails details; // // public ForwardedUserAuthentication(UserDetails details) { // Assert.notN...
import io.jsonwebtoken.JwtException; import org.juiser.spring.security.core.ForwardedUserAuthentication; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.InternalAuthe...
public boolean supports(Class<?> authentication) { return HeaderAuthenticationToken.class.isAssignableFrom(authentication); } @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { HeaderAuthenticationToken token = (HeaderAuthentica...
// Path: spring/spring-security/src/main/java/org/juiser/spring/security/core/ForwardedUserAuthentication.java // public class ForwardedUserAuthentication implements Authentication { // // private final UserDetails details; // // public ForwardedUserAuthentication(UserDetails details) { // Assert.notN...
return new ForwardedUserAuthentication(details);
mibo/janos
janos-core/src/test/java/org/apache/olingo/odata2/janos/processor/core/util/AnnotationHelperTest.java
// Path: janos-core/src/test/java/org/apache/olingo/odata2/janos/processor/core/model/Location.java // @EdmComplexType(name = "c_Location", namespace = ModelSharedConstants.NAMESPACE_1) // public class Location { // @EdmProperty // private String country; // @EdmProperty // private City city; // // public Lo...
import junit.framework.Assert; import org.apache.olingo.odata2.api.annotation.edm.*; import org.apache.olingo.odata2.api.edm.FullQualifiedName; import org.apache.olingo.odata2.api.edm.provider.*; import org.apache.olingo.odata2.api.exception.ODataException; import org.apache.olingo.odata2.janos.processor.core.model.Loc...
@Test public void getFieldTypeForPropertyNullInstance() throws Exception { Object result = annotationHelper.getFieldTypeForProperty(null, ""); Assert.assertNull(result); } @Test public void getValueForPropertyNullInstance() throws Exception { Object result = annotationHelper.getValueForProperty(...
// Path: janos-core/src/test/java/org/apache/olingo/odata2/janos/processor/core/model/Location.java // @EdmComplexType(name = "c_Location", namespace = ModelSharedConstants.NAMESPACE_1) // public class Location { // @EdmProperty // private String country; // @EdmProperty // private City city; // // public Lo...
FullQualifiedName fqn = annotationHelper.extractComplexTypeFqn(Location.class);
mibo/janos
janos-core/src/test/java/org/apache/olingo/odata2/janos/processor/core/data/store/AnnotationValueAccessTest.java
// Path: janos-core/src/main/java/org/apache/olingo/odata2/janos/processor/core/data/access/AnnotationValueAccess.java // public class AnnotationValueAccess implements ValueAccess { // private final AnnotationHelper annotationHelper = new AnnotationHelper(); // // /** // * Retrieves the value of an EDM property...
import junit.framework.Assert; import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType; import org.apache.olingo.odata2.api.edm.EdmException; import org.apache.olingo.odata2.api.edm.EdmMapping; import org.apache.olingo.odata2.api.edm.EdmProperty; import org.apache.olingo.odata2.api.exception.ODataException; im...
/* * Copyright 2013 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicabl...
// Path: janos-core/src/main/java/org/apache/olingo/odata2/janos/processor/core/data/access/AnnotationValueAccess.java // public class AnnotationValueAccess implements ValueAccess { // private final AnnotationHelper annotationHelper = new AnnotationHelper(); // // /** // * Retrieves the value of an EDM property...
AnnotationValueAccess ava = new AnnotationValueAccess();
mibo/janos
janos-core/src/main/java/org/apache/olingo/odata2/janos/processor/core/extension/ExtensionRegistry.java
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
import org.apache.olingo.odata2.janos.processor.api.extension.Extension; import org.apache.olingo.odata2.janos.processor.api.extension.ExtensionContext; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; im...
static class ExtensionHolder { private final String entitySetName; private final Extension.Method type; private final Method method; private final Object instance; public ExtensionHolder(String entitySetName, Extension.Method type, Object instance, Method method) { this.entitySetName = enti...
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
ExtensionContext context = extProcessor.createContext();
mibo/janos
janos-ref/src/main/java/org/apache/olingo/odata2/janos/processor/ref/model/RefExtensions.java
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
import org.apache.olingo.odata2.api.processor.ODataResponse; import org.apache.olingo.odata2.api.uri.UriInfo; import org.apache.olingo.odata2.janos.processor.api.extension.Extension; import org.apache.olingo.odata2.janos.processor.api.extension.Extension.Method; import org.apache.olingo.odata2.janos.processor.api.exten...
package org.apache.olingo.odata2.janos.processor.ref.model; /** * Created by mibo on 21.02.16. */ public class RefExtensions { private static final Logger LOG = LoggerFactory.getLogger(RefExtensions.class); private static final String EXTENSION_TEST = "ExtensionTest"; @Extension(entitySetNames="Employees", ...
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
public Object logReadAccess(ExtensionContext context) throws Exception {
mibo/janos
janos-jpa-ref/src/main/java/org/apache/olingo/odata2/janos/processor/ref/jpa/model/RefExtensions.java
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
import org.apache.olingo.odata2.api.processor.ODataResponse; import org.apache.olingo.odata2.janos.processor.api.extension.Extension; import org.apache.olingo.odata2.janos.processor.api.extension.Extension.Method; import org.apache.olingo.odata2.janos.processor.api.extension.ExtensionContext; import org.slf4j.Logger; i...
package org.apache.olingo.odata2.janos.processor.ref.jpa.model; /** * Created by mibo on 21.02.16. */ public class RefExtensions { private static final Logger LOG = LoggerFactory.getLogger(RefExtensions.class); @Extension(entitySetNames="Employees", methods={Method.GET, Method.POST, Method.PUT})
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
public Object logAllAccess(ExtensionContext context) throws Exception {
mibo/janos
janos-core/src/main/java/org/apache/olingo/odata2/janos/processor/core/extension/ExtensionProcessor.java
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
import org.apache.olingo.odata2.api.edm.EdmException; import org.apache.olingo.odata2.api.processor.ODataContext; import org.apache.olingo.odata2.api.processor.ODataResponse; import org.apache.olingo.odata2.api.processor.feature.ODataProcessorFeature; import org.apache.olingo.odata2.api.uri.UriInfo; import org.apache.o...
return ext.process(this); } return handler.process(); } private Extension.Method mapMethod(String httpMethod) { switch (httpMethod) { case "GET": return Extension.Method.GET; case "POST": return Extension.Method.POST; case "PUT": return Extension.Method.PUT; case "DELETE":...
// Path: janos-api/src/main/java/org/apache/olingo/odata2/janos/processor/api/extension/ExtensionContext.java // public interface ExtensionContext { // String PARA_URI_INFO = "~uriinfo"; // String PARA_ACCEPT_HEADER = "~acceptheader"; // String PARA_REQUEST_BODY = "~requestbody"; // String PARA_REQUEST_TYPE = "...
public ExtensionContext createContext() {
colormine/colormine
demo/src/org/colormine/servlet/ServletOutput.java
// Path: colormine/src/main/org/colormine/image/profile/Profile.java // public interface Profile<K> { // /* // * Tracks an item // */ // void put(K key); // // /* // * Tracks an item // */ // void put(K key, int count); // // /* // * Returns the number of times an item has been recorded // */ // int...
import java.awt.Color; import java.io.IOException; import java.io.PrintWriter; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.colormine.image.profile.Profile; import org.json.JSONException; import org.json...
package org.colormine.servlet; public class ServletOutput { static void write(HttpServletResponse response, double data, String key) throws IOException { write(response, createJsonData(data, key)); } static void write(HttpServletResponse response, String data, String key) throws IOException { write(respons...
// Path: colormine/src/main/org/colormine/image/profile/Profile.java // public interface Profile<K> { // /* // * Tracks an item // */ // void put(K key); // // /* // * Tracks an item // */ // void put(K key, int count); // // /* // * Returns the number of times an item has been recorded // */ // int...
static void write(HttpServletResponse response, Profile<Color> profile) throws IOException {
colormine/colormine
colormine/src/test/org/colormine/image/profile/ColorProfileTest.java
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.awt.Color; import org.colormine.image.Image; import org.testng.AssertJUnit; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;
package org.colormine.image.profile; @Test public class ColorProfileTest {
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
private Image _image;
colormine/colormine
colormine/src/main/org/colormine/image/profile/filter/OutlierFilter.java
// Path: colormine/src/main/org/colormine/image/profile/ColorProfile.java // public class ColorProfile implements Profile<Color> { // // private Map<Color, Integer> _colors = new HashMap<Color, Integer>(); // private int _total = 0; // // public ColorProfile() { // } // // public ColorProfile(Image image) { // ...
import java.awt.Color; import org.colormine.image.profile.ColorProfile; import org.colormine.image.profile.Profile;
package org.colormine.image.profile.filter; /** * Removes colors that make up less than a given percentage of the image This is * best done after using something like the MapFilter to 'condense' the palette */ public final class OutlierFilter implements Filter<Profile<Color>> { private final int _percentage; ...
// Path: colormine/src/main/org/colormine/image/profile/ColorProfile.java // public class ColorProfile implements Profile<Color> { // // private Map<Color, Integer> _colors = new HashMap<Color, Integer>(); // private int _total = 0; // // public ColorProfile() { // } // // public ColorProfile(Image image) { // ...
Profile<Color> result = new ColorProfile();
colormine/colormine
colormine/src/test/org/colormine/colorspace/LabComparerTest.java
// Path: colormine/src/main/org/colormine/colorspace/Lab.java // public class Lab extends ColorTuple { // public final double L; // public final double A; // public final double B; // // /** // * Create Lab from values // * // * @param l // * @param a // * @param b // */ // public Lab(double l, doubl...
import java.text.DecimalFormat; import org.colormine.colorspace.Lab; import org.testng.AssertJUnit; import org.testng.annotations.Test;
package org.colormine.colorspace; @Test public class LabComparerTest { public void noDistance() {
// Path: colormine/src/main/org/colormine/colorspace/Lab.java // public class Lab extends ColorTuple { // public final double L; // public final double A; // public final double B; // // /** // * Create Lab from values // * // * @param l // * @param a // * @param b // */ // public Lab(double l, doubl...
equals(0.0, new Lab(1, 0, 0), new Lab(1, 0, 0));
colormine/colormine
colormine/src/main/org/colormine/image/profile/ColorProfile.java
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
import java.awt.Color; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.colormine.image.Image;
package org.colormine.image.profile; public class ColorProfile implements Profile<Color> { private Map<Color, Integer> _colors = new HashMap<Color, Integer>(); private int _total = 0; public ColorProfile() { }
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
public ColorProfile(Image image) {
colormine/colormine
colormine/src/test/org/colormine/image/profile/filter/MapFilterTest.java
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.awt.Color; import java.util.HashMap; import java.util.Map; import org.colormine.image.Image; import org.colormine.image.profile.ColorProfile; import org.colormine.image.profile.Profile; import org.testng.AssertJUnit; import org....
package org.colormine.image.profile.filter; @Test public class MapFilterTest {
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
private Image _image;
colormine/colormine
colormine/src/test/org/colormine/image/profile/filter/MapFilterTest.java
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.awt.Color; import java.util.HashMap; import java.util.Map; import org.colormine.image.Image; import org.colormine.image.profile.ColorProfile; import org.colormine.image.profile.Profile; import org.testng.AssertJUnit; import org....
package org.colormine.image.profile.filter; @Test public class MapFilterTest { private Image _image; @BeforeTest public void setup() { _image = mock(Image.class); when(_image.getHeight()).thenReturn(1); when(_image.getWidth()).thenReturn(1); when(_image.getRGB(0, 0)).thenReturn(0xFF0000); } @Test ...
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
Profile<Color> map = new ColorProfile(colors);
colormine/colormine
colormine/src/test/org/colormine/image/profile/filter/MapFilterTest.java
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.awt.Color; import java.util.HashMap; import java.util.Map; import org.colormine.image.Image; import org.colormine.image.profile.ColorProfile; import org.colormine.image.profile.Profile; import org.testng.AssertJUnit; import org....
package org.colormine.image.profile.filter; @Test public class MapFilterTest { private Image _image; @BeforeTest public void setup() { _image = mock(Image.class); when(_image.getHeight()).thenReturn(1); when(_image.getWidth()).thenReturn(1); when(_image.getRGB(0, 0)).thenReturn(0xFF0000); } @Test ...
// Path: colormine/src/main/org/colormine/image/Image.java // public interface Image { // /** // * Gets image width // * // * @return image width // */ // int getWidth(); // // /** // * Gets image height // * // * @return image height // */ // int getHeight(); // // /** // * Get Rgbs value of...
Profile<Color> map = new ColorProfile(colors);
iipc/webarchive-commons
src/main/java/org/archive/util/StreamCopy.java
// Path: src/main/java/org/archive/util/io/PushBackOneByteInputStream.java // public interface PushBackOneByteInputStream { // public void pushback() throws IOException; // public int read() throws IOException; // }
import java.io.IOException; import java.io.OutputStream; import java.io.InputStream; import org.archive.util.io.PushBackOneByteInputStream;
total += amtRead; } } return total; } public static long readToEOF(InputStream i) throws IOException { return readToEOF(i,DEFAULT_READ_SIZE); } public static long readToEOF(InputStream i, int bufferSize) throws IOException { long numBytes = 0; byte buffer[] = new byte[bufferSiz...
// Path: src/main/java/org/archive/util/io/PushBackOneByteInputStream.java // public interface PushBackOneByteInputStream { // public void pushback() throws IOException; // public int read() throws IOException; // } // Path: src/main/java/org/archive/util/StreamCopy.java import java.io.IOException; import java.io....
public static long skipChars(PushBackOneByteInputStream i, int [] skips) throws IOException {
dflick-pivotal/sentimentr-release
src/sentimentr-service-broker/src/main/java/io/pivotal/fe/sentimentr/broker/config/BrokerConfig.java
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/BrokerApiVersion.java // @Getter // @ToString // @EqualsAndHashCode // public class BrokerApiVersion { // // public final static String DEFAULT_API_VERSION_HEADER = "X-Broker-Api-Version"; // public fina...
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.cloud.servicebroker.model.BrokerApiVersion; import org.springframework.context.annotation.Bean;
package io.pivotal.fe.sentimentr.broker.config; @Configuration @ComponentScan(basePackages = "io.pivotal.fe.sentimentr.broker") public class BrokerConfig { @Bean
// Path: src/spring-cloud-cloudfoundry-service-broker/src/main/java/org/springframework/cloud/servicebroker/model/BrokerApiVersion.java // @Getter // @ToString // @EqualsAndHashCode // public class BrokerApiVersion { // // public final static String DEFAULT_API_VERSION_HEADER = "X-Broker-Api-Version"; // public fina...
public BrokerApiVersion brokerApiVersion() {
End of preview. Expand in Data Studio

Dataset Card for RepoBench-C

Dataset Summary

RepoBench-C (Completion) is a subtask of RepoBench(GitHub, arXiv), focuing on the prediction of the next line of code, given in-file context (including several preceding lines and import statements), and cross-file context.

Settings

  • cff: short for cross_file_first, indicating the cross-file module in next line is first used in the current file.

  • cfr: short for cross_file_random, indicating the cross-file module in next line is not first used in the current file.

  • if: short for in_file, indicating the next line does not contain any cross-file module.

Supported Tasks

  • python_cff: python code prediction with cross-file-first setting.
  • python_cfr: python code prediction with cross-file-random setting.
  • python_if: python code prediction with in-file setting.
  • java_cff: java code prediction with cross-file-first setting.
  • java_cfr: java code prediction with cross-file-random setting.
  • java_if: java code prediction with in-file setting.

Loading Data

For example, if you want to load the test set to test your model on Python code prediction with cff setting, you can do the following:

from datasets import load_dataset

dataset = load_dataset("tianyang/repobench-c", "python_cff", split="test")

Note: The split argument is optional. If not provided, the entire dataset will be loaded.

Dataset Structure

{
    "repo_name": "repository name of the data point",
    "file_path": "path/to/file",
    "context": "commented and concatenated cross-file context",
    "import_statement": "all import statements in the file",
    "code": "the code for next-line prediction",
    "prompt": "cross-file context + import statements + in-file code",
    "next_line": "the next line of the code"
}

Licensing Information

CC BY-NC-ND 4.0

Citation Information

@misc{liu2023repobench,
      title={RepoBench: Benchmarking Repository-Level Code Auto-Completion Systems}, 
      author={Tianyang Liu and Canwen Xu and Julian McAuley},
      year={2023},
      eprint={2306.03091},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Contributions

Thanks to @Leolty for adding this dataset.

Downloads last month
143

Paper for tianyang/repobench-c