Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 383
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 3837)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 383
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='''ckanext-extrafields''',
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version='0.0.1',
description='''''',
long_description=long_description,
# The project's main homepage.
url='https://github.com//ckanext-extrafields',
# Author details
author='''''',
author_email='''''',
# Choose your license
license='AGPL',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
],
# What does your project relate to?
keywords='''CKAN''',
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
# List run-time dependencies here. These will be installed by pip when your
# project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/technical.html#install-requires-vs-requirements-files
install_requires=['pycountry'],
# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
include_package_data=True,
package_data={
},
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages.
# see http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
data_files=[],
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
entry_points='''
[ckan.plugins]
extrafields=ckanext.extrafields.plugin:ExtrafieldsPlugin
''',
)
|
{
"content_hash": "7277482f881bf3a79763887ed7252c0d",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 98,
"avg_line_length": 37.1566265060241,
"alnum_prop": 0.6767185473411155,
"repo_name": "energy-data/energydata.info",
"id": "ea490324e30a62dda13182dba043d352f14b1ee1",
"size": "3084",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "ckanext-extrafields/setup.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "327156"
},
{
"name": "HTML",
"bytes": "91317"
},
{
"name": "Python",
"bytes": "23247"
},
{
"name": "Ruby",
"bytes": "717"
},
{
"name": "Shell",
"bytes": "3377"
}
]
}
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
[y] hybris Platform
Copyright (c) 2000-2013 hybris AG
All rights reserved.
This software is the confidential and proprietary information of hybris
("Confidential Information"). You shall not disclose such Confidential
Information and shall use it only in accordance with the terms of the
license agreement you entered into with hybris.
-->
<!--
ATTENTION: This is just an example file. You have to edit it according to your needs.
-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="beans.xsd">
<!--
Example Data POJO
<bean class="au.com.fujitsu.trainingcore.data.MyPojo">
<property name="id" type="String"/>
<property name="flag" type="boolean"/>
</bean>
-->
</beans>
|
{
"content_hash": "675454c209d75e81bf5df6b3baff4ab2",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 103,
"avg_line_length": 27.17241379310345,
"alnum_prop": 0.7233502538071066,
"repo_name": "kungfu-software/fujitsu-hybris-training",
"id": "5337ac2f3b80b7e3db595381377ac99ad3eaa2cb",
"size": "788",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trainingcore/resources/trainingcore-beans.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3675"
},
{
"name": "HTML",
"bytes": "2922"
},
{
"name": "Java",
"bytes": "73787"
},
{
"name": "JavaScript",
"bytes": "21409"
},
{
"name": "Smarty",
"bytes": "394"
},
{
"name": "XSLT",
"bytes": "24923"
}
]
}
|
@interface LUKeychainServices : NSObject
@property (nonatomic, copy) NSString *accessGroup;
@property (nonatomic, assign) LUKeychainAccessAccessibility accessibilityState;
@property (nonatomic, strong) NSDictionary *additionalQueryParams;
@property (nonatomic, copy) NSString *service;
+ (instancetype)keychainServices;
- (BOOL)addData:(NSData *)data forKey:(NSString *)key error:(NSError **)error;
- (NSData *)dataForKey:(NSString *)key error:(NSError **)error;
- (BOOL)deleteAllItemsWithError:(NSError **)error;
- (BOOL)deleteItemWithKey:(NSString *)key error:(NSError **)error;
- (BOOL)updateData:(NSData *)data forKey:(NSString *)key error:(NSError **)error;
@end
|
{
"content_hash": "9bd045a4ebb4410a5b16a84a0f551ba3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 81,
"avg_line_length": 44.733333333333334,
"alnum_prop": 0.7645305514157973,
"repo_name": "TheLevelUp/LUKeychainAccess",
"id": "9b4ff68d4ee3cb9e5cf601cde78f62a2fbe6479b",
"size": "1001",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LUKeychainAccess/LUKeychainServices.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "575"
},
{
"name": "Objective-C",
"bytes": "46594"
},
{
"name": "Ruby",
"bytes": "936"
}
]
}
|
<?php
namespace Symfony\Component\Console\Input;
/**
* StringInput represents an input provided as a string.
*
* Usage:
*
* $input = new StringInput('foo --bar="foobar"');
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class StringInput extends ArgvInput {
const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
/**
* Constructor.
*
* @param string $input An array of parameters from the CLI (in the argv format)
* @param InputDefinition $definition A InputDefinition instance
*
* @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead
*
* @api
*/
public function __construct($input, InputDefinition $definition = null) {
parent::__construct(array(), null);
$this->setTokens($this->tokenize($input));
if (null !== $definition) {
$this->bind($definition);
}
}
/**
* Tokenizes a string.
*
* @param string $input The input to tokenize
*
* @return array An array of tokens
*
* @throws \InvalidArgumentException When unable to parse input (should never happen)
*/
private function tokenize($input) {
$tokens = array();
$length = strlen($input);
$cursor = 0;
while ($cursor < $length) {
if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
} elseif (preg_match('/([^="\'\s]+?)(=?)(' . self::REGEX_QUOTED_STRING . '+)/A', $input, $match, null, $cursor)) {
$tokens[] = $match[1] . $match[2] . stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
} elseif (preg_match('/' . self::REGEX_QUOTED_STRING . '/A', $input, $match, null, $cursor)) {
$tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
} elseif (preg_match('/' . self::REGEX_STRING . '/A', $input, $match, null, $cursor)) {
$tokens[] = stripcslashes($match[1]);
} else {
// should never happen
throw new \InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
}
$cursor += strlen($match[0]);
}
return $tokens;
}
}
|
{
"content_hash": "88659b2d331122b5d63c8333ca9be57e",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 163,
"avg_line_length": 33.19736842105263,
"alnum_prop": 0.5132778438367024,
"repo_name": "Amaire/filmy",
"id": "17b568c8c969240a879b7f30b20a600bf6dc9561",
"size": "2752",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/symfony/console/Symfony/Component/Console/Input/StringInput.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "356"
},
{
"name": "JavaScript",
"bytes": "504"
},
{
"name": "PHP",
"bytes": "105599"
}
]
}
|
extern "Java"
{
namespace gnu
{
namespace javax
{
namespace swing
{
namespace text
{
namespace html
{
namespace css
{
class Selector;
}
}
}
}
}
}
namespace javax
{
namespace swing
{
namespace event
{
class ChangeListener;
}
namespace text
{
namespace html
{
class StyleSheet;
class StyleSheet$CSSStyle;
}
}
}
}
}
class javax::swing::text::html::StyleSheet$CSSStyle : public ::javax::swing::text::SimpleAttributeSet
{
public: // actually package-private
StyleSheet$CSSStyle(::javax::swing::text::html::StyleSheet *, jint, ::gnu::javax::swing::text::html::css::Selector *);
public:
virtual ::java::lang::String * getName();
virtual void addChangeListener(::javax::swing::event::ChangeListener *);
virtual void removeChangeListener(::javax::swing::event::ChangeListener *);
virtual jint StyleSheet$CSSStyle$compareTo(::javax::swing::text::html::StyleSheet$CSSStyle *);
virtual jint compareTo(::java::lang::Object *);
public: // actually package-private
static const jint PREC_UA = 0;
static const jint PREC_NORM = 100000;
static const jint PREC_AUTHOR_NORMAL = 200000;
static const jint PREC_AUTHOR_IMPORTANT = 300000;
static const jint PREC_USER_IMPORTANT = 400000;
private:
jint __attribute__((aligned(__alignof__( ::javax::swing::text::SimpleAttributeSet)))) precedence;
public: // actually package-private
::gnu::javax::swing::text::html::css::Selector * selector;
::javax::swing::text::html::StyleSheet * this$0;
public:
static ::java::lang::Class class$;
};
#endif // __javax_swing_text_html_StyleSheet$CSSStyle__
|
{
"content_hash": "e4c09203189fdba1e395b54f7a35d82f",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 120,
"avg_line_length": 26.529411764705884,
"alnum_prop": 0.6186252771618626,
"repo_name": "the-linix-project/linix-kernel-source",
"id": "3266efd1c00b546716b5b3685262ab9c7a7dcecb",
"size": "2046",
"binary": false,
"copies": "157",
"ref": "refs/heads/master",
"path": "gccsrc/gcc-4.7.2/libjava/javax/swing/text/html/StyleSheet$CSSStyle.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ada",
"bytes": "38139979"
},
{
"name": "Assembly",
"bytes": "3723477"
},
{
"name": "Awk",
"bytes": "83739"
},
{
"name": "C",
"bytes": "103607293"
},
{
"name": "C#",
"bytes": "55726"
},
{
"name": "C++",
"bytes": "38577421"
},
{
"name": "CLIPS",
"bytes": "6933"
},
{
"name": "CSS",
"bytes": "32588"
},
{
"name": "Emacs Lisp",
"bytes": "13451"
},
{
"name": "FORTRAN",
"bytes": "4294984"
},
{
"name": "GAP",
"bytes": "13089"
},
{
"name": "Go",
"bytes": "11277335"
},
{
"name": "Haskell",
"bytes": "2415"
},
{
"name": "Java",
"bytes": "45298678"
},
{
"name": "JavaScript",
"bytes": "6265"
},
{
"name": "Matlab",
"bytes": "56"
},
{
"name": "OCaml",
"bytes": "148372"
},
{
"name": "Objective-C",
"bytes": "995127"
},
{
"name": "Objective-C++",
"bytes": "436045"
},
{
"name": "PHP",
"bytes": "12361"
},
{
"name": "Pascal",
"bytes": "40318"
},
{
"name": "Perl",
"bytes": "358808"
},
{
"name": "Python",
"bytes": "60178"
},
{
"name": "SAS",
"bytes": "1711"
},
{
"name": "Scilab",
"bytes": "258457"
},
{
"name": "Shell",
"bytes": "2610907"
},
{
"name": "Tcl",
"bytes": "17983"
},
{
"name": "TeX",
"bytes": "1455571"
},
{
"name": "XSLT",
"bytes": "156419"
}
]
}
|
import apiparser
import string
def PrintHead():
print '; DO NOT EDIT - This file generated automatically by mesadef.py script'
print 'DESCRIPTION \'Mesa (OpenGL work-alike) for Win32\''
print 'VERSION 6.0'
print ';'
print '; Module definition file for Mesa (OPENGL32.DLL)'
print ';'
print '; Note: The OpenGL functions use the STDCALL'
print '; function calling convention. Microsoft\'s'
print '; OPENGL32 uses this convention and so must the'
print '; Mesa OPENGL32 so that the Mesa DLL can be used'
print '; as a drop-in replacement.'
print ';'
print '; The linker exports STDCALL entry points with'
print '; \'decorated\' names; e.g., _glBegin@0, where the'
print '; trailing number is the number of bytes of '
print '; parameter data pushed onto the stack. The'
print '; callee is responsible for popping this data'
print '; off the stack, usually via a RETF n instruction.'
print ';'
print '; However, the Microsoft OPENGL32.DLL does not export'
print '; the decorated names, even though the calling convention'
print '; is STDCALL. So, this module definition file is'
print '; needed to force the Mesa OPENGL32.DLL to export the'
print '; symbols in the same manner as the Microsoft DLL.'
print '; Were it not for this problem, this file would not'
print '; be needed (for the gl* functions) since the entry'
print '; points are compiled with dllexport declspec.'
print ';'
print '; However, this file is still needed to export "internal"'
print '; Mesa symbols for the benefit of the OSMESA32.DLL.'
print ';'
print 'EXPORTS'
return
#enddef
def PrintTail():
print ';'
print '; WGL API'
print '\twglChoosePixelFormat'
print '\twglCopyContext'
print '\twglCreateContext'
print '\twglCreateLayerContext'
print '\twglDeleteContext'
print '\twglDescribeLayerPlane'
print '\twglDescribePixelFormat'
print '\twglGetCurrentContext'
print '\twglGetCurrentDC'
print '\twglGetExtensionsStringARB'
print '\twglGetLayerPaletteEntries'
print '\twglGetPixelFormat'
print '\twglGetProcAddress'
print '\twglMakeCurrent'
print '\twglRealizeLayerPalette'
print '\twglSetLayerPaletteEntries'
print '\twglSetPixelFormat'
print '\twglShareLists'
print '\twglSwapBuffers'
print '\twglSwapLayerBuffers'
print '\twglUseFontBitmapsA'
print '\twglUseFontBitmapsW'
print '\twglUseFontOutlinesA'
print '\twglUseFontOutlinesW'
print ';'
print '; Mesa internals - mostly for OSMESA'
print '\t_ac_CreateContext'
print '\t_ac_DestroyContext'
print '\t_ac_InvalidateState'
print '\t_glapi_get_context'
print '\t_glapi_get_proc_address'
print '\t_mesa_buffer_data'
print '\t_mesa_buffer_map'
print '\t_mesa_buffer_subdata'
print '\t_mesa_choose_tex_format'
print '\t_mesa_compressed_texture_size'
print '\t_mesa_create_framebuffer'
print '\t_mesa_create_visual'
print '\t_mesa_delete_buffer_object'
print '\t_mesa_delete_texture_object'
print '\t_mesa_destroy_framebuffer'
print '\t_mesa_destroy_visual'
print '\t_mesa_enable_1_3_extensions'
print '\t_mesa_enable_1_4_extensions'
print '\t_mesa_enable_1_5_extensions'
print '\t_mesa_enable_sw_extensions'
print '\t_mesa_error'
print '\t_mesa_free_context_data'
print '\t_mesa_get_current_context'
print '\t_mesa_init_default_imports'
print '\t_mesa_initialize_context'
print '\t_mesa_make_current'
print '\t_mesa_new_buffer_object'
print '\t_mesa_new_texture_object'
print '\t_mesa_problem'
print '\t_mesa_store_compressed_teximage1d'
print '\t_mesa_store_compressed_teximage2d'
print '\t_mesa_store_compressed_teximage3d'
print '\t_mesa_store_compressed_texsubimage1d'
print '\t_mesa_store_compressed_texsubimage2d'
print '\t_mesa_store_compressed_texsubimage3d'
print '\t_mesa_store_teximage1d'
print '\t_mesa_store_teximage2d'
print '\t_mesa_store_teximage3d'
print '\t_mesa_store_texsubimage1d'
print '\t_mesa_store_texsubimage2d'
print '\t_mesa_store_texsubimage3d'
print '\t_mesa_test_proxy_teximage'
print '\t_mesa_Viewport'
print '\t_mesa_meta_CopyColorSubTable'
print '\t_mesa_meta_CopyColorTable'
print '\t_mesa_meta_CopyConvolutionFilter1D'
print '\t_mesa_meta_CopyConvolutionFilter2D'
print '\t_mesa_meta_CopyTexImage1D'
print '\t_mesa_meta_CopyTexImage2D'
print '\t_mesa_meta_CopyTexSubImage1D'
print '\t_mesa_meta_CopyTexSubImage2D'
print '\t_mesa_meta_CopyTexSubImage3D'
print '\t_swrast_Accum'
print '\t_swrast_alloc_buffers'
print '\t_swrast_Bitmap'
print '\t_swrast_CopyPixels'
print '\t_swrast_DrawPixels'
print '\t_swrast_GetDeviceDriverReference'
print '\t_swrast_Clear'
print '\t_swrast_choose_line'
print '\t_swrast_choose_triangle'
print '\t_swrast_CreateContext'
print '\t_swrast_DestroyContext'
print '\t_swrast_InvalidateState'
print '\t_swrast_ReadPixels'
print '\t_swrast_zbuffer_address'
print '\t_swsetup_Wakeup'
print '\t_swsetup_CreateContext'
print '\t_swsetup_DestroyContext'
print '\t_swsetup_InvalidateState'
print '\t_tnl_CreateContext'
print '\t_tnl_DestroyContext'
print '\t_tnl_InvalidateState'
print '\t_tnl_MakeCurrent'
print '\t_tnl_run_pipeline'
#enddef
records = []
def FindOffset(funcName):
for (name, alias, offset) in records:
if name == funcName:
return offset
#endif
#endfor
return -1
#enddef
def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset):
if alias == '':
dispatchName = name
else:
dispatchName = alias
if offset < 0:
offset = FindOffset(dispatchName)
if offset >= 0 and string.find(name, "unused") == -1:
print '\tgl%s' % (name)
# save this info in case we need to look up an alias later
records.append((name, dispatchName, offset))
#enddef
PrintHead()
apiparser.ProcessSpecFile("APIspec", EmitEntry)
PrintTail()
|
{
"content_hash": "cfb7a3aaae056199aac2307e2d80dfd4",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 82,
"avg_line_length": 34.69662921348315,
"alnum_prop": 0.6792422279792746,
"repo_name": "devlato/kolibrios-llvm",
"id": "77cc4a3506f82876665440c1ecefae9c4459a8de",
"size": "7558",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "contrib/sdk/sources/Mesa/src/mapi/glapi/gen/mesadef.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "15418643"
},
{
"name": "C",
"bytes": "126021466"
},
{
"name": "C++",
"bytes": "11476220"
},
{
"name": "CSS",
"bytes": "1230161"
},
{
"name": "JavaScript",
"bytes": "687"
},
{
"name": "Logos",
"bytes": "905"
},
{
"name": "Lua",
"bytes": "2055"
},
{
"name": "Objective-C",
"bytes": "482461"
},
{
"name": "Pascal",
"bytes": "6692"
},
{
"name": "Perl",
"bytes": "317449"
},
{
"name": "Puppet",
"bytes": "161697"
},
{
"name": "Python",
"bytes": "1036533"
},
{
"name": "Shell",
"bytes": "448869"
},
{
"name": "Verilog",
"bytes": "2829"
},
{
"name": "Visual Basic",
"bytes": "4346"
},
{
"name": "XSLT",
"bytes": "4325"
}
]
}
|
%> @file BLOM_polyblockChangeInputs.m
%> @brief callback function for Polyblock that changes the number of inputs
%> to the block based on user specified P and K matricies
%>
%> More detailed description of the problem.
%>
%> @param block the current handle of the block
%>
%======================================================================
function BLOM_PolyblockChangeInputs(block,P,K,inputs,inputScalar,outputScalar)
% may want to keep this code to label ports on the block itself
% paramSplit = regexp(inputs,',','split');
if inputScalar
if outputScalar
BLOM_ChangeNumberOfPorts(block,size(P,2),size(K,1));
else
BLOM_ChangeNumberOfPorts(block,size(P,2),1);
end
else
if outputScalar
BLOM_ChangeNumberOfPorts(block,1,size(K,1));
else
BLOM_ChangeNumberOfPorts(block,1,1);
end
end
end
|
{
"content_hash": "821409be4d1faff515aca8645c55281f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 32.535714285714285,
"alnum_prop": 0.610318331503842,
"repo_name": "MPC-Berkeley/BLOM",
"id": "dac6b8e47d643d75ebc2c26727c8003673967f4a",
"size": "911",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Callbacks/BLOM_PolyblockChangeInputs.m",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "123991"
},
{
"name": "C++",
"bytes": "480231"
},
{
"name": "M",
"bytes": "7967"
},
{
"name": "Matlab",
"bytes": "199902"
},
{
"name": "Mercury",
"bytes": "3424"
},
{
"name": "TeX",
"bytes": "44718"
}
]
}
|
Steps | Desired Results | Complete | Comments
--------------------------|--------------------------------------------|----------| --------
Open Open Live Writer | | |
Click on File | | |
Click on Options | | |
Click on Preferences | Ensure that the dialog box matches image below | | *Note that this is the default when selecting options*
**Test Post Window** | | |
Deselect all check boxes | | |
Click Apply | | |
Select "Use a single window .." | | |
Click OK | | |
Click on File | | |
Click on Options | | |
Click on Preferences | Ensure that the dialog box has only the radio box "Use a single window" | |
Click on OK | | |
Have an empty post | | |
Click on New Post | Ensure stays in the same window | |
Start a blog post | | |
Click on New Post | Ensure that dialog box to save post displays | |
Save Post | Ensure windows stays open with a blank post | |
Click on File | | |
Click on Options | | |
Click on Preferences | Ensure that the dialog box matches image below | | *Note that this is the default when selecting options*
Select "Open a new window for each post" | | |
Click on OK | | |
Click on New Post | Ensure that another Open Writer windows opens | |
Click on File | | |
Click on Options | | |
Click on Preferences | Ensure only "Open a new window for each post" is selected | |
Click on OK | | |
Create a new post | | |
Save it | | |
Click on File | | |
Click on New Post | Ensure that saved post is closed and new post is in the same window | |
**Test Publishing ** | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Select "View Post after publishing | | |
Deselect all other check boxes | | |
Click OK | | |
Write a blog post | | |
Publish | Observe blog post open in browswer window | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
DeSelect "View Post after publishing | | |
Deselect all other check boxes | | |
Click OK | | |
Edit blog post | | |
Publish | Observe that blog post does not open in browswer window | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Select "Close window after publishing | | |
Deselect all other check boxes | | |
Click OK | | |
Write a blog post | | |
Publish | Observe Windows Writer window close after publishing | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Deselect "Close window after publishing| | |
Delect all other check boxes | | |
Click OK | | |
Edit blog post | | |
Publish | Observe that Windows Live Explorer remains open | | |
| | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Select "Close window after publishing" | | |
Deselect all other check boxes | | |
Click OK | | |
Write a blog post | | |
Publish | Observe Open Live Writer window closes after publishing | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Deselect "Close window after publishing" | | |
Delect all other check boxes | | |
Click OK | | |
Edit blog post | | |
Publish | Observe that Open Live Writer window remains | | |
| | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Select "Remind me to type a title before publishing" | | |
Deselect all other check boxes | | |
Click OK | | |
Write a blog post - omit the title | | |
Publish | Observe title reminder message box | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Deselect "Remind me to type a title before publishing" | | |
Delect all other check boxes | | |
Click OK | | |
Edit blog post | | |
Publish | Observe no title reminder | | |
| | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button 'Remind me to add categories before publishing" | | | Appears to be default behavior
Select "Close window after publishing | | |
Deselect all other check boxes | | |
Click OK | | |
Write a blog post omitting categories | | |
Publish | Observe missing categories dialog box | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Remind me to add categories before publishing" | | | Appears to be default behavior
Deselect "Close window after publishing| | |
Delect all other check boxes | | |
Click OK | | |
Edit blog post | | |
Publish | Observe no categories message box | | |
| | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Remind me to add tags before publishing" | | | Appears to be default behavior
Select "Close window after publishing | | |
Deselect all other check boxes | | |
Click OK | | |
Write a blog post | | |
Publish | Observe Observe missing tag dialog box | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Remind me to add tags before publishing" | | | Appears to be default behavior
Deselect "Close window after publishing| | |
Delect all other check boxes | | |
Click OK | | |
Edit blog post | | |
Publish | Observe no tag message box | | |
| | |
**Test General Options** | | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Select "Save AutoRecover information periodically" | | |
Click OK | | |
Click on File | | |
Click on Options | | |
Click on Preferences | Observe Save Autorecover check | |
Click on File | | |
Click on Options | | |
Click on Preferences | | | Appears to be default behavior
Select Radio button "Open a new window for each post" | | | Appears to be default behavior
Select "Show real-time word count in status bar" | | |
Click OK | | |
Click on File | | |
Click on Options | | |
Click on Preferences | Observe Save Autorecover check | |
Click on OK | | |
Write blog post | Ensure word count is updated | |

|
{
"content_hash": "28a9afe52317ed9195145fe38ae9f932",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 129,
"avg_line_length": 41.228070175438596,
"alnum_prop": 0.6737588652482269,
"repo_name": "willduff/OpenLiveWriter-1",
"id": "6daedfafa1b29076f06ae88fe4f3b6f46884852f",
"size": "7126",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "testplan/testOptionsDialogBox/observePreferences.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "4881"
},
{
"name": "C",
"bytes": "3246"
},
{
"name": "C#",
"bytes": "18377279"
},
{
"name": "C++",
"bytes": "48027"
},
{
"name": "CSS",
"bytes": "1124"
},
{
"name": "HTML",
"bytes": "47027"
},
{
"name": "JavaScript",
"bytes": "432"
},
{
"name": "PowerShell",
"bytes": "2485"
},
{
"name": "Smalltalk",
"bytes": "12290"
},
{
"name": "XSLT",
"bytes": "6823"
}
]
}
|
/*
* 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 applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ubio.model;
import java.util.Objects;
import lombok.Getter;
import lombok.Setter;
/**
* An implementation of uBio {@code VernacularName}.
*
*
* @version 21 June 2016
* @author Nozomi `James' Ytow
*/
public class VernacularName
extends RecordedName
{
private static final long serialVersionUID = 8922761803252210481L;
@Getter
@Setter
protected String languageCode;
@Getter
@Setter
protected String languageName;
@Getter
@Setter
protected Language language;
@Getter
@Setter
protected int packageID;
@Getter
@Setter
protected String packageName;
@Getter
@Setter
protected NamebankPackage namebankPackage;
@Getter
@Setter
protected int basionymUnit;
@Getter
@Setter
protected NamebankObject basionymUnitObject;
@Getter
@Setter
protected int namebankIDLink;
@Getter
@Setter
protected NamebankObject namebankObject;
@Getter
@Setter
protected String nameStringLink;
@Getter
@Setter
protected String fullNameStringLink;
@Getter
@Setter
protected boolean saturated;
public VernacularName()
{
super();
}
public VernacularName(int namebankID,
String nameString,
String fullNameString,
String languageCode,
String languageName,
Language language,
int packageID,
String packageName,
NamebankPackage namebankPackage,
int basionymUnit,
NamebankObject basionymUnitObject,
int namebankIDLink,
NamebankObject namebankObject,
String nameStringLink,
String fullNameStringLink)
{
super(namebankID, nameString, fullNameString);
setLanguageCode(languageCode);
setLanguageName(languageName);
setLanguage(language);
setPackageID(packageID);
setPackageName(packageName);
setNamebankPackage(namebankPackage);
setBasionymUnit(basionymUnit);
setBasionymUnitObject(basionymUnitObject);
setNamebankIDLink(namebankIDLink);
setNamebankObject(namebankObject);
setNameStringLink(nameStringLink);
setFullNameStringLink(fullNameStringLink);
}
@Override
public boolean equals(Object object) {
if(object == this) return true;
if(object == null) return false;
if(getClass() != object.getClass()) return false;
final VernacularName theOther = (VernacularName) object;
return super.equals(object)
&& Objects.equals(this.getLanguageCode(), theOther.getLanguageCode())
&& Objects.equals(this.getLanguageName(), theOther.getLanguageName())
&& Objects.equals(this.getPackageID(), theOther.getPackageID())
&& Objects.equals(this.getPackageName(), theOther.getPackageName())
&& Objects.equals(this.getBasionymUnit(), theOther.getBasionymUnit())
&& Objects.equals(this.getNamebankIDLink(), theOther.getNamebankIDLink())
&& Objects.equals(this.getNameStringLink(), theOther.getNameStringLink())
&& Objects.equals(this.getFullNameStringLink(), theOther.getFullNameStringLink())
;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(),
getLanguageCode(),
getLanguageName(),
getPackageID(),
getPackageName(),
getBasionymUnit(),
getNamebankIDLink(),
getNameStringLink(),
getFullNameStringLink()
);
}
}
|
{
"content_hash": "211ba3eb2f38b351a98e06a3ff8bd3d6",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 86,
"avg_line_length": 24.884615384615383,
"alnum_prop": 0.7109737248840804,
"repo_name": "nomencurator/taxonaut",
"id": "ceab405f248d83f0522399fa14f7d5a21a5e247c",
"size": "4001",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/ubio/model/VernacularName.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3173519"
}
]
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.6.0_27) on Thu Jan 23 20:22:16 EST 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Class org.apache.solr.client.solrj.response.GroupResponse (Solr 4.6.1 API)</title>
<meta name="date" content="2014-01-23">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.solr.client.solrj.response.GroupResponse (Solr 4.6.1 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../org/apache/solr/client/solrj/response/GroupResponse.html" title="class in org.apache.solr.client.solrj.response">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/solr/client/solrj/response//class-useGroupResponse.html" target="_top">FRAMES</a></li>
<li><a href="GroupResponse.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.solr.client.solrj.response.GroupResponse" class="title">Uses of Class<br>org.apache.solr.client.solrj.response.GroupResponse</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../org/apache/solr/client/solrj/response/GroupResponse.html" title="class in org.apache.solr.client.solrj.response">GroupResponse</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.solr.client.solrj.response">org.apache.solr.client.solrj.response</a></td>
<td class="colLast">
<div class="block">Convenience classes for dealing with various types of Solr responses.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.solr.client.solrj.response">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../org/apache/solr/client/solrj/response/GroupResponse.html" title="class in org.apache.solr.client.solrj.response">GroupResponse</a> in <a href="../../../../../../../org/apache/solr/client/solrj/response/package-summary.html">org.apache.solr.client.solrj.response</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../org/apache/solr/client/solrj/response/package-summary.html">org.apache.solr.client.solrj.response</a> that return <a href="../../../../../../../org/apache/solr/client/solrj/response/GroupResponse.html" title="class in org.apache.solr.client.solrj.response">GroupResponse</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../org/apache/solr/client/solrj/response/GroupResponse.html" title="class in org.apache.solr.client.solrj.response">GroupResponse</a></code></td>
<td class="colLast"><span class="strong">QueryResponse.</span><code><strong><a href="../../../../../../../org/apache/solr/client/solrj/response/QueryResponse.html#getGroupResponse()">getGroupResponse</a></strong>()</code>
<div class="block">Returns the <a href="../../../../../../../org/apache/solr/client/solrj/response/GroupResponse.html" title="class in org.apache.solr.client.solrj.response"><code>GroupResponse</code></a> containing the group commands.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../org/apache/solr/client/solrj/response/GroupResponse.html" title="class in org.apache.solr.client.solrj.response">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/solr/client/solrj/response//class-useGroupResponse.html" target="_top">FRAMES</a></li>
<li><a href="GroupResponse.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
|
{
"content_hash": "511a0447708ade52634b2f70f5e9c12d",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 381,
"avg_line_length": 44.142857142857146,
"alnum_prop": 0.6100970873786408,
"repo_name": "arnaud71/webso-db",
"id": "44e13796ce0e1bd11064a0537d9684dc85ca7bea",
"size": "7725",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/solr-solrj/org/apache/solr/client/solrj/response/class-use/GroupResponse.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "358410"
},
{
"name": "JavaScript",
"bytes": "1852502"
},
{
"name": "Shell",
"bytes": "16381"
},
{
"name": "XSLT",
"bytes": "99846"
}
]
}
|
package com.emerchantpay.gateway.threeds.v2;
import com.emerchantpay.gateway.api.RequestBuilder;
import com.emerchantpay.gateway.api.exceptions.InvalidParamException;
import com.emerchantpay.gateway.api.requests.financial.card.Sale3DRequest;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Random;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class SdkAttributesTest {
private Sale3DRequest sale3DRequest;
private Random random;
private static final int MIN_BOUND = 1;
private static final int MAX_BOUND_NINETEEN = 19;
@Before
public void createThreedsV2Attributes() {
sale3DRequest = new Sale3DRequest();
random = new Random();
}
@Test
public void buildSdkAttributes() {
String sdkInterface = "both";
sale3DRequest.set3dsV2SDKInterface(sdkInterface);
assertEquals(sdkInterface, sale3DRequest.get3dsV2SDKInterface());
ArrayList<String> uiTypes = new ArrayList<String>();
uiTypes.add("single_select");
uiTypes.add("multi_select");
sale3DRequest.set3dsV2SDKUITypes(uiTypes);
assertEquals(uiTypes, sale3DRequest.get3dsV2SDKUITypes());
String applicationId = RandomStringUtils.randomAlphanumeric(random.nextInt(MAX_BOUND_NINETEEN) + MIN_BOUND);
sale3DRequest.set3dsV2SDKApplicationId(applicationId);
assertEquals(applicationId, sale3DRequest.get3dsV2SDKApplicationId());
String encryptedDate = RandomStringUtils.randomAlphanumeric(random.nextInt(MAX_BOUND_NINETEEN) + MIN_BOUND);
sale3DRequest.set3dsV2SDKEncryptedData(encryptedDate);
assertEquals(encryptedDate, sale3DRequest.get3dsV2SDKEncryptedData());
String ephemeralPublicKeyPair = RandomStringUtils.randomAlphanumeric(random.nextInt(MAX_BOUND_NINETEEN) + MIN_BOUND);
sale3DRequest.set3dsV2SDKEphemeralPublicKeyPair(ephemeralPublicKeyPair);
assertEquals(ephemeralPublicKeyPair, sale3DRequest.get3dsV2SDKEphemeralPublicKeyPair());
String referenceNumber = RandomStringUtils.randomAlphanumeric(random.nextInt(MAX_BOUND_NINETEEN) + MIN_BOUND);
sale3DRequest.set3dsV2SDKReferenceNumber(referenceNumber);
assertEquals(referenceNumber, sale3DRequest.get3dsV2SDKReferenceNumber());
Integer maxTimeout = random.nextInt(MAX_BOUND_NINETEEN) + 5;//should be greater than 5
sale3DRequest.set3dsV2SDKMaxTimeout(maxTimeout);
assertEquals(maxTimeout, sale3DRequest.get3dsV2SDKMaxTimeout());
assertTrue(sale3DRequest.build3DSv2SdkParams() instanceof RequestBuilder);
}
@Test(expected = InvalidParamException.class)
public void maxTimeoutError(){
Integer maxTimeout = 2;
sale3DRequest.set3dsV2SDKMaxTimeout(maxTimeout);
sale3DRequest.build3DSv2SdkParams();
}
@Test(expected = InvalidParamException.class)
public void interfaceError(){
String sdkInterface = "wrong value";
sale3DRequest.set3dsV2SDKInterface(sdkInterface);
sale3DRequest.build3DSv2SdkParams();
}
@Test(expected = InvalidParamException.class)
public void uiTypeError(){
ArrayList<String> uiTypes = new ArrayList<String>();
uiTypes.add("wrong value");
sale3DRequest.set3dsV2SDKUITypes(uiTypes);
sale3DRequest.build3DSv2SdkParams();
}
}
|
{
"content_hash": "b04ee0055a2cb4fe8da34a9924e98ff9",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 125,
"avg_line_length": 40.26744186046512,
"alnum_prop": 0.7458850707479064,
"repo_name": "GenesisGateway/genesis_java",
"id": "2ce7694d47441160b95349c6b8ad765341f1df95",
"size": "3463",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/com/emerchantpay/gateway/threeds/v2/SdkAttributesTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1513365"
}
]
}
|
import WriteStore from './WriteStore';
import generateId from '../utils/generateId';
import getTimestamp from '../utils/getTimestamp';
import TransporterError from '../errors/TransporterError';
import StoreError from '../errors/StoreError';
let customHandleError;
export function onError(callback) {
customHandleError = callback;
}
export default function createRequest(request, fetch) {
const startTime = getTimestamp();
const isMutation = request.type === 'TRANSPORTER_MUTATION';
const requestId = request.id || generateId();
const requestBody = isMutation
? request.mutation.loc.source.body
: request.query.loc.source.body;
function getStoreData(updater, state, responseData) {
const storeData = responseData ? { ...responseData } : null;
// Don't apply roots for mutations.
if (storeData && isMutation) {
delete storeData.roots;
}
if (!updater) {
return storeData;
}
const store = new WriteStore(state, storeData);
updater(store, responseData);
return store.toSource();
}
return (dispatch, getState) => {
function handleError(error, data, optimisticData) {
dispatch({
type: 'TRANSPORTER_REQUEST_ERROR',
id: requestId,
endTime: getTimestamp(),
optimisticData,
data,
error: {
type: error.type,
message: error.message,
data: error.data,
},
});
if (customHandleError) {
customHandleError(error, request);
}
return Promise.reject(error);
}
// Create optimisticData if request is of type mutation.
let optimisticData;
if (isMutation) {
try {
optimisticData = getStoreData(request.optimisticUpdater, getState());
} catch (error) {
// Error #1: Something went wrong while applying optimistic updater.
if (error.name === 'StoreError') {
const transporterError = new TransporterError(
'StoreError',
'Request failed (StoreError)',
{
error: error.message,
},
);
if (customHandleError) {
customHandleError(transporterError);
}
return Promise.reject(transporterError);
}
throw error;
}
}
// Start request.
dispatch({
type: 'TRANSPORTER_REQUEST_START',
id: requestId,
startTime,
optimisticData,
});
return fetch(requestBody, request.variables).then(
(result) =>
result.json().then(
(response) => {
// Error #2: Http error code detected, throw error.
if (!result.ok) {
return handleError(
new TransporterError(
'HttpError',
`Request failed (HttpError - ${result.status})`,
response,
result.status,
),
null,
optimisticData,
);
}
const state = getState();
// Error #3: In the meantime the store was resetted, so do not apply response.
if (state.info.lastReset >= startTime) {
const error = new StoreError(
'Store reset after request was started.',
);
return handleError(
new TransporterError(
'StoreError',
'Request failed (StoreError)',
{
error: error.message,
},
),
null,
null,
);
}
// Error #4: Response has GraphQL errors, throw error.
if (response.errors) {
response.errors.forEach((error) => {
// eslint-disable-next-line no-console
console.error(`GraphQLError: ${error.message}`);
});
return handleError(
new TransporterError(
'GraphQLError',
'Request failed (GraphQLError)',
{
errors: response.errors,
},
),
response.data,
optimisticData,
);
}
// Response is okay.
let data;
if (response.data) {
try {
data = getStoreData(request.updater, state, response.data);
} catch (error) {
// Error #5: Something went wrong while applying updater.
if (error.name === 'StoreError') {
return handleError(
new TransporterError(
'StoreError',
'Request failed (StoreError)',
{
error: error.message,
},
),
response.data,
optimisticData,
);
}
throw error;
}
}
// Complete request.
dispatch({
type: 'TRANSPORTER_REQUEST_COMPLETED',
id: requestId,
endTime: getTimestamp(),
optimisticData,
data,
});
return response.data;
},
(error) => {
// Error #6: Http error code with invalid JSON detected, throw error.
if (!result.ok) {
return handleError(
new TransporterError(
'HttpError',
`Request failed (HttpError - ${result.status})`,
null,
result.status,
),
null,
optimisticData,
);
}
// Error #7: Found JSON parsing error.
return handleError(
new TransporterError('JsonError', `${error.message} (JsonError)`),
null,
optimisticData,
);
},
),
// Error #8: Some network error occured.
(error) =>
handleError(
new TransporterError(
'NetworkError',
`${error.message} (NetworkError)`,
),
null,
optimisticData,
),
);
};
}
|
{
"content_hash": "f480d6fd1341c9d06050eb72d0529050",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 90,
"avg_line_length": 28.044052863436125,
"alnum_prop": 0.482406534715677,
"repo_name": "ProAI/react-transporter",
"id": "fc2273c917f12cc5ea4326cf8c27cd1005e0fdfc",
"size": "6366",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/request/createRequest.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "62084"
}
]
}
|
package hu.akarnokd.reactive4javaflow.tck;
import hu.akarnokd.reactive4javaflow.*;
import org.testng.annotations.Test;
import java.util.concurrent.Flow;
@Test
public class SequenceEqualTckTest extends BaseTck<Boolean> {
@Override
public Flow.Publisher<Boolean> createFlowPublisher(final long elements) {
return
Esetleg.sequenceEqual(
Folyam.range(1, 1000),
Folyam.range(1, 1001))
.toFolyam()
;
}
@Override
public long maxElementsFromPublisher() {
return 1;
}
}
|
{
"content_hash": "53e9b508187a10de5f929b72a445a446",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 77,
"avg_line_length": 21.464285714285715,
"alnum_prop": 0.6139767054908486,
"repo_name": "akarnokd/Reactive4JavaFlow",
"id": "58629ad435d7fbb1c9692d68f600262a9fa36f56",
"size": "1183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/hu/akarnokd/reactive4javaflow/tck/SequenceEqualTckTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2171"
},
{
"name": "Java",
"bytes": "3247222"
}
]
}
|
author: slowe
categories: News
comments: true
date: 2016-08-09T00:00:00Z
tags:
- Linux
- OVS
- Networking
- OSS
title: Open vSwitch Now a Linux Foundation Project
url: /2016/08/09/ovs-linux-foundation/
---
News emerged today that [Open vSwitch (OVS)][link-1] has formally moved over to the [Linux Foundation][link-2]. This is something that has been discussed within the OVS community for a while, and I for one am glad to see it happen.
Why am I glad to see it happen? The project can finally shed itself of the (unfair) claims that the governance under Nicira (and later VMware) wasn't "open enough." These accusations persisted despite numerous indications otherwise. Thomas Graf, an OVS committer---who does not work for VMware, for the record---came to this conclusion in [his OVSCon 2015 presentation][link-3]:
>OVS is one of the most effective and well governed open source projects I’ve worked on.
Moving to the Linux Foundation allows OVS to continue to grow and flourish without continued accusations of unfair governance. The project intends to continue to use its existing governance model, in which technical leadership of the project is determined by the committers, and committer status is determined by your involvement in the project via code contributions and code reviews.
For more information, refer to [the official Linux Foundation press release][link-4].
[link-1]: http://openvswitch.org/
[link-2]: https://www.linuxfoundation.org/
[link-3]: http://openvswitch.org/support/ovscon2015/17/1255-graf.pdf
[link-4]: https://www.linuxfoundation.org/announcements/open-vswitch-joins-linux-foundation-open-networking-ecosystem
|
{
"content_hash": "33fcfe23f6b42b8a6329b64383ae9725",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 385,
"avg_line_length": 56.86206896551724,
"alnum_prop": 0.7853244390539721,
"repo_name": "lowescott/weblog",
"id": "93841474e700fc77d915d8d95f5fa2666fe53e78",
"size": "1655",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "content/post/2016-08-09-ovs-linux-foundation.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "25289"
},
{
"name": "HTML",
"bytes": "16683"
}
]
}
|
<?php
namespace Concrete\Core\Entity\Express;
use Concrete\Core\Attribute\CategoryObjectInterface;
use Concrete\Core\Entity\PackageTrait;
use Concrete\Core\Entity\Site\Site;
use Concrete\Core\Export\ExportableInterface;
use Concrete\Core\Express\Search\ColumnSet\ColumnSet;
use Concrete\Core\Express\Search\ColumnSet\DefaultSet;
use Concrete\Core\Permission\ObjectInterface;
use Concrete\Core\Tree\Node\Node;
use Concrete\Core\Tree\Node\Type\ExpressEntryResults;
use Doctrine\Common\Collections\ArrayCollection;
use Concrete\Core\Export\Item\Express\Entity as EntityExporter;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="\Concrete\Core\Entity\Express\EntityRepository")
* @ORM\Table(name="ExpressEntities")
* @ORM\EntityListeners({"\Concrete\Core\Express\Entity\Listener"})
*/
class Entity implements CategoryObjectInterface, ObjectInterface, ExportableInterface
{
const DEFAULT_ITEMS_PER_PAGE = 10;
use PackageTrait;
/**
* @ORM\Id @ORM\Column(type="guid")
* @ORM\GeneratedValue(strategy="UUID")
*/
protected $id;
/**
* @ORM\Column(type="string")
*/
protected $name;
/**
* @ORM\Column(type="string", unique=true)
*/
protected $handle;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $plural_handle;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $label_mask;
/**
* @ORM\Column(type="boolean")
*/
protected $supports_custom_display_order = false;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;
/**
* @ORM\Column(type="object", nullable=true)
*/
protected $result_column_set;
/**
* @ORM\Column(type="boolean")
*/
protected $include_in_public_list = true;
/**
* @ORM\Column(type="integer")
*/
protected $entity_results_node_id;
/**
* If true, this entity splits its results by multisite. If false, it is shared across all sites. Default should
* probably be true, but for backwards compatibility it is false.
*
* @ORM\Column(type="boolean")
*/
protected $use_separate_site_result_buckets = false;
/**
* @ORM\Column(type="integer")
*/
protected $items_per_page = 10;
/**
* @ORM\OneToMany(targetEntity="\Concrete\Core\Entity\Attribute\Key\ExpressKey", mappedBy="entity", cascade={"persist", "remove"})
**/
protected $attributes;
/**
* @ORM\OneToMany(targetEntity="Association", mappedBy="source_entity", cascade={"persist", "remove"})
**/
protected $associations;
/**
* @ORM\OneToMany(targetEntity="Form", mappedBy="entity", cascade={"persist", "remove"})
**/
protected $forms;
/**
* @ORM\OneToOne(targetEntity="Form", cascade={"persist"})
**/
protected $default_view_form;
/**
* @ORM\OneToOne(targetEntity="Form", cascade={"persist"})
**/
protected $default_edit_form;
/**
* @ORM\OneToMany(targetEntity="Entry", mappedBy="entity", cascade={"persist", "remove"})
**/
protected $entries;
/**
* @ORM\Column(type="datetime")
*/
protected $created_date;
public function __construct()
{
$this->created_date = new \DateTime();
$this->attributes = new ArrayCollection();
$this->forms = new ArrayCollection();
$this->associations = new ArrayCollection();
$this->entries = new ArrayCollection();
}
/**
* @return mixed
*/
public function getEntries()
{
return $this->entries;
}
/**
* @param mixed $entries
*/
public function setEntries($entries)
{
$this->entries = $entries;
}
/**
* @return mixed
*/
public function getHandle()
{
return $this->handle;
}
/**
* @param mixed $handle
*/
public function setHandle($handle)
{
$this->handle = $handle;
}
/**
* @return mixed
*/
public function getPluralHandle()
{
return $this->plural_handle;
}
/**
* @param mixed $plural_handle
*/
public function setPluralHandle($plural_handle)
{
$this->plural_handle = $plural_handle;
}
/**
* @return mixed
*/
public function supportsCustomDisplayOrder()
{
return $this->supports_custom_display_order;
}
/**
* @param mixed $supports_custom_display_order
*/
public function setSupportsCustomDisplayOrder($supports_custom_display_order)
{
$this->supports_custom_display_order = $supports_custom_display_order;
}
/**
* If an entity supports entry-specific permissions, we will check its permissions during any listing
* events, and use simple Pager next/back cursor pagination (unless the logged-in user is the super user).
* This method determines whether this entity supports entry specific permissions. Currently, this is only
* true if the entity has separate site-specific buckets, but in the future we might make this an option
* that admins can set on the entity themselves.
*
* @return bool
*/
public function supportsEntrySpecificPermissions(): bool
{
if ($this->usesSeparateSiteResultsBuckets()) {
return true;
}
return false;
}
/**
* @return mixed
*/
public function getOwnedBy()
{
foreach($this->associations as $association) {
if ($association->isOwnedByAssociation()) {
return $association->getTargetEntity();
}
}
}
/**
* @return mixed
*/
public function getIncludeInPublicList()
{
return $this->include_in_public_list;
}
/**
* @param mixed $include_in_public_list
*/
public function setIncludeInPublicList($include_in_public_list)
{
$this->include_in_public_list = $include_in_public_list;
}
/**
* @return string
*/
public function getLabelMask()
{
return $this->label_mask ?: '';
}
/**
* @param string $label_mask
*/
public function setLabelMask($label_mask)
{
$this->label_mask = trim($label_mask);
}
/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}
/**
* @param mixed $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* @param string $format
* @return string
*/
public function getEntityDisplayDescription($format = 'html')
{
$value = $this->getDescription();
switch ($format) {
case 'html':
return h($value);
case 'text':
default:
return $value;
}
}
/**
* @return mixed
*/
public function getCreatedDate()
{
return $this->created_date;
}
/**
* @param mixed $created_date
*/
public function setCreatedDate($created_date)
{
$this->created_date = $created_date;
}
/**
* @return ColumnSet
*/
public function getResultColumnSet()
{
$set = $this->result_column_set;
if (is_object($set)) {
return $set;
} else {
return new DefaultSet($this->getAttributeKeyCategory());
}
}
/**
* @param mixed $result_column_set
*/
public function setResultColumnSet($result_column_set)
{
$this->result_column_set = $result_column_set;
}
/**
* @return mixed
*/
public function getDefaultViewForm()
{
return $this->default_view_form;
}
/**
* @param mixed $default_view_form
*/
public function setDefaultViewForm($default_view_form)
{
$this->default_view_form = $default_view_form;
}
/**
* @return mixed
*/
public function getDefaultEditForm()
{
return $this->default_edit_form;
}
/**
* @param mixed $default_edit_form
*/
public function setDefaultEditForm($default_edit_form)
{
$this->default_edit_form = $default_edit_form;
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return int
*/
public function getItemsPerPage()
{
if ($this->items_per_page) {
return $this->items_per_page;
} else {
return self::DEFAULT_ITEMS_PER_PAGE;
}
}
/**
* @param mixed $items_per_page
*/
public function setItemsPerPage($items_per_page)
{
$this->items_per_page = $items_per_page;
}
/**
* @param string $format
* @return string
*/
public function getEntityDisplayName($format = 'html')
{
$value = $this->getName();
switch ($format) {
case 'html':
return h($value);
case 'text':
default:
return $value;
}
}
/**
* @return ArrayCollection[]
*/
public function getAttributes()
{
return $this->attributes;
}
public function setAttributes($attributes)
{
$this->attributes = $attributes;
}
/**
* @return Association[]
*/
public function getAssociations()
{
return $this->associations;
}
/**
* @param mixed $associations
*/
public function setAssociations($associations)
{
$this->associations = $associations;
}
/**
* @return mixed
*/
public function getForms()
{
return $this->forms;
}
/**
* @param mixed $forms
*/
public function setForms($forms)
{
$this->forms = $forms;
}
public function getForm($name)
{
foreach($this->getForms() as $form) {
if ($form->getName() == $name) {
return $form;
}
}
}
/**
* @return mixed
*/
public function getEntityResultsNodeId()
{
return $this->entity_results_node_id;
}
public function getEntityResultsNodeObject(Site $site = null)
{
$node = Node::getByID($this->getEntityResultsNodeId());
if ($node) {
/**
* @var $node ExpressEntryResults
*/
if ($site && $this->usesSeparateSiteResultsBuckets()) {
$siteNode = $node->getSiteResultsNode($site);
if ($siteNode) {
return $siteNode;
}
}
}
return $node;
}
/**
* @param mixed $entity_results_node_id
*/
public function setEntityResultsNodeId($entity_results_node_id)
{
$this->entity_results_node_id = $entity_results_node_id;
}
public function getAttributeKeyCategory()
{
return \Core::make('\Concrete\Core\Attribute\Category\ExpressCategory', array('entity' => $this));
}
public function getPermissionObjectIdentifier()
{
return $this->getId();
}
public function getPermissionResponseClassName()
{
return '\\Concrete\\Core\\Permission\\Response\\ExpressEntityResponse';
}
public function getAssociation($handle)
{
foreach($this->associations as $association) {
if ($association->getTargetPropertyName() == $handle) {
return $association;
}
}
}
/**
* @return mixed
*/
public function usesSeparateSiteResultsBuckets()
{
return $this->use_separate_site_result_buckets;
}
/**
* @param mixed $use_separate_site_result_buckets
*/
public function setUseSeparateSiteResultBuckets($use_separate_site_result_buckets)
{
$this->use_separate_site_result_buckets = $use_separate_site_result_buckets;
}
public function getPermissionAssignmentClassName()
{
return false;
}
public function getPermissionObjectKeyCategoryHandle()
{
return false;
}
public function getExporter()
{
return new EntityExporter();
}
public function getController()
{
}
}
|
{
"content_hash": "de4d1a0656bd0afdfdf41246c319243a",
"timestamp": "",
"source": "github",
"line_count": 580,
"max_line_length": 134,
"avg_line_length": 21.901724137931033,
"alnum_prop": 0.5638038258679052,
"repo_name": "hissy/concrete5",
"id": "5d0f739ff0a6ce94f09f4a0675883ee8cf57e2b5",
"size": "12703",
"binary": false,
"copies": "4",
"ref": "refs/heads/upstream",
"path": "concrete/src/Entity/Express/Entity.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "74"
},
{
"name": "CSS",
"bytes": "140170"
},
{
"name": "HTML",
"bytes": "312828"
},
{
"name": "Hack",
"bytes": "45"
},
{
"name": "JavaScript",
"bytes": "902321"
},
{
"name": "Less",
"bytes": "472475"
},
{
"name": "PHP",
"bytes": "14907009"
},
{
"name": "PowerShell",
"bytes": "4292"
},
{
"name": "SCSS",
"bytes": "787311"
},
{
"name": "Shell",
"bytes": "6727"
}
]
}
|
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %p [%t] %C{1} - %m%n</pattern>
</encoder>
</appender>
<logger name="com.pushsignal" level="DEBUG"/>
<!--
<logger name="org.hibernate.type" level="TRACE"/>
<logger name="org.springframework" level="INFO"/>
<logger name="org.springframework.security" level="DEBUG"/>
<logger name="org.hibernate.SQL" level="DEBUG"/>
-->
<root level="WARN">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
|
{
"content_hash": "7a40b13fb49e85947651e36b0b320d6a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.6412859560067682,
"repo_name": "gdenning/bta",
"id": "68afe7557ea4a0378697be8e9ddf3342ce894545",
"size": "591",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/resources/logback.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "70503"
}
]
}
|
"""empty message
Revision ID: cf1ff3b8de01
Revises: abb327ba1c51
Create Date: 2019-04-30 13:18:57.612425
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cf1ff3b8de01'
down_revision = 'abb327ba1c51'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('link',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('linked_space_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['id'], ['field.id'], ),
sa.ForeignKeyConstraint(['linked_space_id'], ['space.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('link')
# ### end Alembic commands ###
|
{
"content_hash": "8a93738c865775da736b09c408dd58f6",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 65,
"avg_line_length": 25.38235294117647,
"alnum_prop": 0.6639629200463499,
"repo_name": "viewportvr/daysinvr",
"id": "46ff3c6f37a5757fcacb5decdf622493f8436799",
"size": "863",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/migrations/versions/cf1ff3b8de01_.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "64842"
},
{
"name": "JavaScript",
"bytes": "408410"
}
]
}
|
import * as React from "react";
import { Component, StoreComponent, dispatchAction } from "../../CarbonFlux";
import SpriteView from "../SpriteView";
import { richApp } from "../../RichApp";
import recentImagesStore, { RecentImagesStoreState, ImageType, RecentImage } from "./RecentImagesStore";
import { SymbolsOverscanCount, SymbolsColumnWidth, IconsOverscanCount, IconSize, ImageLandscapeHeight, ImagePortraitHeight } from "../LibraryDefs";
import VirtualList from "../../shared/collections/VirtualList";
import { UnsplashStencil } from "./UnsplashStore";
import { getUserImageHeight, UserImage } from "./UserImage";
import { getUnsplashImageHeight, UnsplashImage } from "./UnsplashImage";
type RecentList = new (props) => VirtualList<RecentImage>;
const RecentList = VirtualList as RecentList;
export default class RecentImages extends StoreComponent<{}, RecentImagesStoreState>{
refs: {
list: VirtualList<RecentImage>;
}
constructor(props) {
super(props, recentImagesStore);
}
componentDidUpdate(prevProps: Readonly<RecentImagesStoreState>, prevState: Readonly<RecentImagesStoreState>) {
if (prevState.configVersion !== this.state.configVersion) {
if (this.refs.list) {
this.refs.list.reset();
}
}
}
private onClicked = (e) => {
dispatchAction({ type: "Stencils_Clicked", e: {ctrlKey: e.ctrlKey, metaKey: e.metaKey, currentTarget: e.currentTarget}, stencil: { ...e.currentTarget.dataset } });
}
private getItemHeight = (stencil: RecentImage) => {
if (stencil.imageType.type === "user") {
return getUserImageHeight(stencil.imageType.stencil);
}
return getUnsplashImageHeight(stencil.imageType.stencil);
}
private renderItem = (stencil: RecentImage) => {
if (stencil.imageType.type === "user") {
return <UserImage stencilType={recentImagesStore.storeType} stencil={stencil.imageType.stencil} onClicked={this.onClicked}/>;
}
return <UnsplashImage stencilType={recentImagesStore.storeType} stencil={stencil.imageType.stencil} onClicked={this.onClicked}/>;
}
render() {
return <div className="library-page__content">
<div className="user-images__list">
<RecentList ref="list" data={this.state.images}
rowHeight={this.getItemHeight}
rowRenderer={this.renderItem}
reverse={true} />
</div>
</div>;
}
}
|
{
"content_hash": "fd1d1b048c207f5efb1971ceae574f15",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 171,
"avg_line_length": 42.166666666666664,
"alnum_prop": 0.6632411067193675,
"repo_name": "CarbonDesigns/carbon-ui",
"id": "7c4cd4bd7256c06decb57ddf77eed86c62aeeb53",
"size": "2530",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/library/images/RecentImages.tsx",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "396457"
},
{
"name": "HTML",
"bytes": "5991"
},
{
"name": "JavaScript",
"bytes": "133268"
},
{
"name": "PowerShell",
"bytes": "1365"
},
{
"name": "PureBasic",
"bytes": "2757"
},
{
"name": "TypeScript",
"bytes": "1273297"
}
]
}
|
"use strict";
var ReactComponent = require('ReactComponent');
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
var flattenChildren = require('flattenChildren');
/**
* Given a `curChild` and `newChild`, determines if `curChild` should be
* updated as opposed to being destroyed or replaced.
*
* @param {?ReactComponent} curChild
* @param {?ReactComponent} newChild
* @return {boolean} True if `curChild` should be updated with `newChild`.
* @protected
*/
function shouldUpdateChild(curChild, newChild) {
return curChild && newChild && curChild.constructor === newChild.constructor;
}
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
fromIndex: null,
textContent: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
textContent: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponent.DOMIDOperations.dangerouslyProcessChildrenUpdates(
updateQueue,
markupQueue
);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function(nestedChildren, transaction) {
var children = flattenChildren(nestedChildren);
var mountImages = [];
var index = 0;
this._renderedChildren = children;
for (var name in children) {
var child = children[name];
if (children.hasOwnProperty(name) && child) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + '.' + name;
var mountImage = child.mountComponent(
rootID,
transaction,
this._mountDepth + 1
);
child._mountImage = mountImage;
child._mountIndex = index;
mountImages.push(mountImage);
index++;
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function(nextContent) {
updateDepth++;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
prevChildren[name]) {
this._unmountChildByName(prevChildren[name], name);
}
}
// Set new text content.
this.setTextContent(nextContent);
} catch (error) {
updateDepth--;
updateDepth || clearQueue();
throw error;
}
updateDepth--;
updateDepth || processQueue();
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function(nextNestedChildren, transaction) {
updateDepth++;
try {
this._updateChildren(nextNestedChildren, transaction);
} catch (error) {
updateDepth--;
updateDepth || clearQueue();
throw error;
}
updateDepth--;
updateDepth || processQueue();
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function(nextNestedChildren, transaction) {
var nextChildren = flattenChildren(nextNestedChildren);
var prevChildren = this._renderedChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (shouldUpdateChild(prevChild, nextChild)) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild.receiveProps(nextChild.props, transaction);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChildByName(prevChild, name);
}
if (nextChild) {
this._mountChildByNameAtIndex(
nextChild, name, nextIndex, transaction
);
}
}
if (nextChild) {
nextIndex++;
}
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
prevChildren[name] &&
!(nextChildren && nextChildren[name])) {
this._unmountChildByName(prevChildren[name], name);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function() {
var renderedChildren = this._renderedChildren;
for (var name in renderedChildren) {
var renderedChild = renderedChildren[name];
if (renderedChild && renderedChild.unmountComponent) {
renderedChild.unmountComponent();
}
}
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function(child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @protected
*/
createChild: function(child) {
enqueueMarkup(this._rootNodeID, child._mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function(child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function(textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function(child, name, index, transaction) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + '.' + name;
var mountImage = child.mountComponent(
rootID,
transaction,
this._mountDepth + 1
);
child._mountImage = mountImage;
child._mountIndex = index;
this.createChild(child);
this._renderedChildren = this._renderedChildren || {};
this._renderedChildren[name] = child;
},
/**
* Unmounts a rendered child by name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
_unmountChildByName: function(child, name) {
if (ReactComponent.isValidComponent(child)) {
this.removeChild(child);
child._mountImage = null;
child._mountIndex = null;
child.unmountComponent();
delete this._renderedChildren[name];
}
}
}
};
module.exports = ReactMultiChild;
|
{
"content_hash": "b09935758d4d3b3032f98e534e9e3ded",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 80,
"avg_line_length": 28.3938679245283,
"alnum_prop": 0.6346042030068942,
"repo_name": "bevacqua/react",
"id": "e0e12cd82e07ea26c4708400b6336fdd02f60146",
"size": "12698",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/core/ReactMultiChild.js",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
#ifndef QTESTELEMENT_H
#define QTESTELEMENT_H
#include <QtTest/qtestcoreelement.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Test)
class QTestElement: public QTestCoreElement<QTestElement>
{
public:
QTestElement(int type = -1);
~QTestElement();
bool addLogElement(QTestElement *element);
QTestElement *childElements() const;
const QTestElement *parentElement() const;
void setParent(const QTestElement *p);
private:
QTestElement *listOfChildren;
const QTestElement * parent;
};
QT_END_NAMESPACE
QT_END_HEADER
#endif
|
{
"content_hash": "64277e0d7dc949fde67cc72a51f588b8",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 57,
"avg_line_length": 16.805555555555557,
"alnum_prop": 0.687603305785124,
"repo_name": "stephaneAG/PengPod700",
"id": "30af23ee3e6faa14143b60236752ee0db373a2f1",
"size": "2572",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "QtEsrc/backup_qt/qt-everywhere-opensource-src-4.8.5/src/testlib/qtestelement.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "167426"
},
{
"name": "Batchfile",
"bytes": "25368"
},
{
"name": "C",
"bytes": "3755463"
},
{
"name": "C#",
"bytes": "9282"
},
{
"name": "C++",
"bytes": "177871700"
},
{
"name": "CSS",
"bytes": "600936"
},
{
"name": "GAP",
"bytes": "758872"
},
{
"name": "GLSL",
"bytes": "32226"
},
{
"name": "Groff",
"bytes": "106542"
},
{
"name": "HTML",
"bytes": "273585110"
},
{
"name": "IDL",
"bytes": "1194"
},
{
"name": "JavaScript",
"bytes": "435912"
},
{
"name": "Makefile",
"bytes": "289373"
},
{
"name": "Objective-C",
"bytes": "1898658"
},
{
"name": "Objective-C++",
"bytes": "3222428"
},
{
"name": "PHP",
"bytes": "6074"
},
{
"name": "Perl",
"bytes": "291672"
},
{
"name": "Prolog",
"bytes": "102468"
},
{
"name": "Python",
"bytes": "22546"
},
{
"name": "QML",
"bytes": "3580408"
},
{
"name": "QMake",
"bytes": "2191574"
},
{
"name": "Scilab",
"bytes": "2390"
},
{
"name": "Shell",
"bytes": "116533"
},
{
"name": "TypeScript",
"bytes": "42452"
},
{
"name": "Visual Basic",
"bytes": "8370"
},
{
"name": "XQuery",
"bytes": "25094"
},
{
"name": "XSLT",
"bytes": "252382"
}
]
}
|
@interface TTBlendStyle : TTStyle {
CGBlendMode _blendMode;
}
@property (nonatomic) CGBlendMode blendMode;
+ (TTBlendStyle*)styleWithBlend:(CGBlendMode)blendMode next:(TTStyle*)next;
@end
|
{
"content_hash": "3ca9833301b6e0f2d38e2910cb23af30",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 21.444444444444443,
"alnum_prop": 0.772020725388601,
"repo_name": "rogerthat-platform/rogerthat-ios-client",
"id": "10e9253e832abf625799237c0565dc56d75ac987",
"size": "819",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "3rdParty/Code/3rdParty/three20/Three20Style/TTBlendStyle.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1493576"
},
{
"name": "C++",
"bytes": "705111"
},
{
"name": "JavaScript",
"bytes": "4966"
},
{
"name": "Makefile",
"bytes": "4800"
},
{
"name": "Objective-C",
"bytes": "10712054"
},
{
"name": "Objective-C++",
"bytes": "25009"
},
{
"name": "PLSQL",
"bytes": "1037"
},
{
"name": "PLpgSQL",
"bytes": "26564"
},
{
"name": "Python",
"bytes": "1770228"
},
{
"name": "Ruby",
"bytes": "1323"
},
{
"name": "Shell",
"bytes": "4216"
},
{
"name": "Swift",
"bytes": "44103"
}
]
}
|
package com.opengamma.bbg;
import static org.testng.AssertJUnit.assertEquals;
import org.apache.shiro.authz.Permission;
import org.testng.annotations.Test;
import com.opengamma.util.auth.AuthUtils;
import com.opengamma.util.test.TestGroup;
/**
* Test.
*/
@Test(groups = TestGroup.UNIT)
public class BloombergPermissionsTest {
public void testCreateEidPermission() {
Permission expected = AuthUtils.getPermissionResolver().resolvePermission(BloombergPermissions.EID_PREFIX + "1234");
assertEquals(expected, BloombergPermissions.createEidPermission(1234));
}
public void testCreateEidPermissionString() {
String expected = BloombergPermissions.EID_PREFIX + "1234";
assertEquals(expected, BloombergPermissions.createEidPermissionString(1234));
}
public void testIsEid() {
assertEquals(false, BloombergPermissions.isEid(null));
assertEquals(false, BloombergPermissions.isEid(""));
assertEquals(false, BloombergPermissions.isEid("1234"));
assertEquals(false, BloombergPermissions.isEid("Data:1234"));
assertEquals(true, BloombergPermissions.isEid(BloombergPermissions.EID_PREFIX + "1234"));
}
public void testExtractEid() {
assertEquals(1234, BloombergPermissions.extractEid(BloombergPermissions.EID_PREFIX + "1234"));
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void testExtractEid_null() {
BloombergPermissions.extractEid(null);
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void testExtractEid_empty() {
BloombergPermissions.extractEid("");
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void testExtractEid_invalid() {
BloombergPermissions.extractEid(BloombergPermissions.EID_PREFIX + "abcd");
}
}
|
{
"content_hash": "d48bf5b215052dd65f488b94c06a4612",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 120,
"avg_line_length": 32.09090909090909,
"alnum_prop": 0.7705382436260623,
"repo_name": "jerome79/OG-Platform",
"id": "962d0baa6d39ff2e1d279d6b219eaf5f496eb54d",
"size": "1903",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "projects/OG-Bloomberg/src/test/java/com/opengamma/bbg/BloombergPermissionsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4064"
},
{
"name": "CSS",
"bytes": "212432"
},
{
"name": "GAP",
"bytes": "1490"
},
{
"name": "Groovy",
"bytes": "11518"
},
{
"name": "HTML",
"bytes": "284313"
},
{
"name": "Java",
"bytes": "80970799"
},
{
"name": "JavaScript",
"bytes": "1528695"
},
{
"name": "PLSQL",
"bytes": "105"
},
{
"name": "PLpgSQL",
"bytes": "13175"
},
{
"name": "Protocol Buffer",
"bytes": "53119"
},
{
"name": "SQLPL",
"bytes": "1004"
},
{
"name": "Shell",
"bytes": "10958"
}
]
}
|
'use strict';
// MODULES //
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isReadableStreamLike = require( '@stdlib/assert/is-node-readable-stream-like' );
var isWritableStreamLike = require( '@stdlib/assert/is-node-writable-stream-like' );
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );
// MAIN //
/**
* Validates function options.
*
* @private
* @param {Object} opts - destination object
* @param {Options} options - function options
* @param {string} [options.inputPrompt] - input prompt
* @param {string} [options.outputPrompt] - output prompt
* @param {ReadableStream} [options.input=] - input stream
* @param {WritableStream} [options.output] - output stream
* @param {boolean} [options.sandbox] - boolean indicating whether to run a REPL in a sandboxed context
* @param {PositiveInteger} [options.timeout] - number of milliseconds to execute a command before terminating execution
* @param {boolean} [options.isTTY] - boolean indicating whether the input and output streams should be treated like a TTY (terminal) and whether the REPL should use ANSI/VT100 escape codes when writing to the output stream
* @param {string} [options.welcome] - welcome message
* @param {NonNegativeInteger} [options.padding] - number of empty lines between successive commands
* @param {string} [options.load] - file path specifying a JavaScript file to load and evaluate line-by-line (e.g., a previous REPL history file)
* @param {string} [options.save] - file path specifying where to save REPL command history
* @param {string} [options.log] - file path specifying where to save REPL commands and printed output
* @param {string} [options.quiet] - boolean indicating whether log information, confirmation messages, and other possible REPL diagnostics should be silenced
* @throws {Error} must provide valid options
* @returns {(Error|null)} error or null
*
* @example
* var options = {
* 'sandbox': true
* };
* var opts = {};
* var err = validate( opts, options );
* if ( err ) {
* throw err;
* }
*/
function validate( opts, options ) {
if ( !isPlainObject( options ) ) {
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'input' ) ) {
opts.input = options.input;
if ( !isReadableStreamLike( options.input ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a readable stream. Option: `%s`.', 'input', options.input ) );
}
}
if ( hasOwnProp( options, 'output' ) ) {
opts.output = options.output;
if ( !isWritableStreamLike( options.output ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a writable stream. Option: `%s`.', 'output', options.output ) );
}
}
if ( hasOwnProp( options, 'inputPrompt' ) ) {
opts.inputPrompt = options.inputPrompt;
if ( !isString( options.inputPrompt ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'inputPrompt', options.inputPrompt ) );
}
}
if ( hasOwnProp( options, 'outputPrompt' ) ) {
opts.outputPrompt = options.outputPrompt;
if ( !isString( options.outputPrompt ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'outputPrompt', options.outputPrompt ) );
}
}
if ( hasOwnProp( options, 'padding' ) ) {
opts.padding = options.padding;
if ( !isNonNegativeInteger( options.padding ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'padding', options.padding ) );
}
}
if ( hasOwnProp( options, 'welcome' ) ) {
opts.welcome = options.welcome;
if ( !isString( options.welcome ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'welcome', options.welcome ) );
}
}
if ( hasOwnProp( options, 'save' ) ) {
opts.save = options.save;
if ( !isString( options.save ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'save', options.save ) );
}
}
if ( hasOwnProp( options, 'load' ) ) {
opts.load = options.load;
if ( !isString( options.load ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'load', options.load ) );
}
}
if ( hasOwnProp( options, 'log' ) ) {
opts.log = options.log;
if ( !isString( options.log ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'log', options.log ) );
}
}
if ( hasOwnProp( options, 'timeout' ) ) {
opts.timeout = options.timeout;
if ( !isPositiveInteger( options.timeout ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'timeout', options.timeout ) );
}
}
if ( hasOwnProp( options, 'isTTY' ) ) {
opts.isTTY = options.isTTY;
if ( !isBoolean( options.isTTY ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'isTTY', options.isTTY ) );
}
}
if ( hasOwnProp( options, 'sandbox' ) ) {
opts.sandbox = options.sandbox;
if ( !isBoolean( options.sandbox ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'sandbox', options.sandbox ) );
}
}
if ( hasOwnProp( options, 'quiet' ) ) {
opts.quiet = options.quiet;
if ( !isBoolean( options.quiet ) ) {
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'quiet', options.quiet ) );
}
}
return null;
}
// EXPORTS //
module.exports = validate;
|
{
"content_hash": "ae5e1e3c35bd5d534bf8b1d02ca763ef",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 222,
"avg_line_length": 42.67142857142857,
"alnum_prop": 0.6799464345497155,
"repo_name": "stdlib-js/stdlib",
"id": "9ce9eeac16c432fe50009d18a43dc1857444a305",
"size": "6590",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "lib/node_modules/@stdlib/repl/lib/validate.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "21739"
},
{
"name": "C",
"bytes": "15336495"
},
{
"name": "C++",
"bytes": "1349482"
},
{
"name": "CSS",
"bytes": "58039"
},
{
"name": "Fortran",
"bytes": "198059"
},
{
"name": "HTML",
"bytes": "56181"
},
{
"name": "Handlebars",
"bytes": "16114"
},
{
"name": "JavaScript",
"bytes": "85975525"
},
{
"name": "Julia",
"bytes": "1508654"
},
{
"name": "Makefile",
"bytes": "4806816"
},
{
"name": "Python",
"bytes": "3343697"
},
{
"name": "R",
"bytes": "576612"
},
{
"name": "Shell",
"bytes": "559315"
},
{
"name": "TypeScript",
"bytes": "19309407"
},
{
"name": "WebAssembly",
"bytes": "5980"
}
]
}
|
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{
path: '',
data: {
title: 'Forms'
},
children: [
{
path: 'basic-forms',
loadChildren: './basic-forms/basic-forms.module#BasicFormsModule'
},
{
path: 'advanced-forms',
loadChildren: './advanced-forms/advanced-forms.module#AdvancedFormsModule'
}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class FormsRoutingModule {}
|
{
"content_hash": "93a28b7908f9d55a3c5d8ddf00e597a5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 82,
"avg_line_length": 21.59259259259259,
"alnum_prop": 0.6003430531732419,
"repo_name": "davidchristie/kaenga-housing-calculator",
"id": "a6b7a8aa7ac2e777c50ba09b9c2333f44b44ebf3",
"size": "583",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "themes/genius/Genius 2.3.1 Bootstrap 4/Angular4_CLI_Full_Project/src/app/forms/forms-routing.module.ts",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8934940"
},
{
"name": "HTML",
"bytes": "14663729"
},
{
"name": "JavaScript",
"bytes": "12216364"
},
{
"name": "PHP",
"bytes": "172065"
},
{
"name": "TypeScript",
"bytes": "99432"
}
]
}
|
export const AddInCar = function ({ dispatch, state }) {
dispatch('ADDINCAR', 1)
}
|
{
"content_hash": "9d64f7f2bd768f94f3dcbc64ef66ffe1",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 56,
"avg_line_length": 29,
"alnum_prop": 0.6551724137931034,
"repo_name": "GeoffreyQiao/vue-app",
"id": "305d3bc95cfb8935f2902ff5c65b975dba969f54",
"size": "87",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vuex/actions.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1475"
},
{
"name": "JavaScript",
"bytes": "14215"
},
{
"name": "Vue",
"bytes": "8623"
}
]
}
|
package com.evolveum.midpoint.web.component.objectdetails;
import java.util.List;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.web.component.assignment.GdprAssignmentPanel;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.web.component.prism.ObjectWrapper;
import com.evolveum.midpoint.web.model.ContainerWrapperFromObjectWrapperModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
public class FocusConsentTabPanel<F extends FocusType> extends AbstractObjectTabPanel<F>{
private static final long serialVersionUID = 1L;
private static final String ID_ROLES = "roles";
private LoadableModel<List<AssignmentType>> consentsModel;
public FocusConsentTabPanel(String id, Form<ObjectWrapper<F>> mainForm, LoadableModel<ObjectWrapper<F>> objectWrapperModel,
PageBase pageBase) {
super(id, mainForm, objectWrapperModel, pageBase);
initLayout();
}
private void initLayout() {
GdprAssignmentPanel consentRoles = new GdprAssignmentPanel(ID_ROLES,
new ContainerWrapperFromObjectWrapperModel<>(getObjectWrapperModel(), new ItemPath(FocusType.F_ASSIGNMENT)));
add(consentRoles);
consentRoles.setOutputMarkupId(true);
}
}
|
{
"content_hash": "fd586def33ec82eebe22fcf2bb0114a3",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 124,
"avg_line_length": 38.432432432432435,
"alnum_prop": 0.8157524613220816,
"repo_name": "arnost-starosta/midpoint",
"id": "f106e58e50ceed25de1c7f3b9aaacf99a9334639",
"size": "1422",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/objectdetails/FocusConsentTabPanel.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "360626"
},
{
"name": "CSS",
"bytes": "246079"
},
{
"name": "HTML",
"bytes": "1906400"
},
{
"name": "Java",
"bytes": "33331059"
},
{
"name": "JavaScript",
"bytes": "18450"
},
{
"name": "PLSQL",
"bytes": "212132"
},
{
"name": "PLpgSQL",
"bytes": "9834"
},
{
"name": "Perl",
"bytes": "13072"
},
{
"name": "Shell",
"bytes": "52"
}
]
}
|
<div class="box">
<div class="heading">
<h1><img alt="" src="<?php echo theme_url('assets/images/category.png'); ?>"> Navigation Item Edit</h1>
<div class="buttons">
<a class="button" href="#" onClick="$('#navigation_item_edit').submit()"><span>Save</span></a>
</div>
</div>
<div class="content">
<?php echo form_open(null, 'id="navigation_item_edit"') ?>
<div id="tabs">
<ul class="htabs">
<li><a href="#item-tab">Nav Item</a></li>
<li><a href="#advanced-tab">Advanced</a></li>
</ul>
<div id="item-tab">
<div class="form">
<div>
<?php echo form_label('<span class="required">*</span> Link Type:', 'type')?>
<?php echo form_dropdown('type', array('page'=>'Page', 'url'=>'URL', 'dynamic_route'=>'Dynamic Route'), set_value('type', !empty($Navigation_item->type) ? $Navigation_item->type : ''), 'id="link_type"')?>
</div>
<div class="page_div">
<?php echo form_label('<span class="required">*</span> Pages:', 'entry_id')?>
<?php echo form_dropdown('entry_id', $Pages, set_value('entry_id', !empty($Navigation_item->entry_id) ? $Navigation_item->entry_id : ''), 'id="entry_id"')?>
</div>
<div class="page_div">
<?php echo form_label('Link Text:<span class="help">Leave blank to use the page title</span>', 'title')?>
<?php echo form_input(array('name'=>'page_link_text', 'id'=>'page_link_text', 'value'=>set_value('page_link_text', !empty($Navigation_item->title) ? $Navigation_item->title : '')))?>
</div>
<div class="url_div">
<?php echo form_label('<span class="required">*</span> Link Text:', 'title')?>
<?php echo form_input(array('name'=>'title', 'id'=>'title', 'class'=>'long', 'value'=>set_value('title', !empty($Navigation_item->title) ? $Navigation_item->title : '')))?>
</div>
<div class="url_div">
<?php echo form_label('<span class="required">*</span> URL:', 'url')?>
<?php echo form_input(array('name'=>'url', 'id'=>'url', 'class'=>'long','value'=>set_value('url', !empty($Navigation_item->url) ? $Navigation_item->url : '')))?>
</div>
<div>
<?php echo form_label('Target:', 'target')?>
<?php echo form_dropdown('target', array(''=>'Current Window', '_blank'=>'New Tab / Window (_blank)'), set_value('target', !empty($Navigation_item->target) ? $Navigation_item->target : ''), 'id="target"')?>
</div>
<div>
<?php echo form_label('<span class="required">*</span> Subnav Visibility:<span class="help">Show/Hide children of this item.</span>', 'subnav_visibility')?>
<?php echo form_dropdown('subnav_visibility', array('1' => 'Always Show', '2' => 'Only Show if in Current Trail', '3' => 'Never Show'), set_value('subnav_visibility', !empty($Navigation_item->subnav_visibility) ? $Navigation_item->subnav_visibility : ''), 'id="subnav_visibility"')?>
</div>
<div>
<?php echo form_label('Hide:<span class="help">Don\'t show this item in the navigation.</span>', 'hide')?>
<?php echo form_checkbox(array('name'=>'hide', 'id'=>'hide', 'value'=>'1', 'checked'=>set_checkbox('hide', '1', (!empty($Navigation_item->hide) && $Navigation_item->hide) ? TRUE : FALSE)))?>
</div>
</div>
</div>
<div id="advanced-tab">
<div class="form">
<div>
<?php echo form_label('Tag ID:', 'tag_id')?>
<?php echo form_input(array('name'=>'tag_id', 'id'=>'tag_id', 'class'=>'long', 'value'=>set_value('tag_id', !empty($Navigation_item->tag_id) ? $Navigation_item->tag_id : '')))?>
</div>
<div>
<?php echo form_label('Class:', 'class')?>
<?php echo form_input(array('name'=>'class', 'id'=>'class', 'class'=>'long', 'value'=>set_value('class', !empty($Navigation_item->class) ? $Navigation_item->class : '')))?>
</div>
<div>
<?php echo form_label('Disable Current:<span class="help">Don\'t allow this item to be marked as current.</span>', 'disable_current')?>
<?php echo form_checkbox(array('name'=>'disable_current', 'id'=>'disable_current', 'value'=>'1', 'checked'=>set_checkbox('disable_current', '1', (!empty($Navigation_item->disable_current) && $Navigation_item->disable_current) ? TRUE : FALSE)))?>
</div>
<div>
<?php echo form_label('Disable Current Trail:<span class="help">Don\'t allow this item to be marked with current trail.</span>', 'disable_current_trail')?>
<?php echo form_checkbox(array('name'=>'disable_current_trail', 'id'=>'disable_current_trail', 'value'=>'1', 'checked'=>set_checkbox('disable_current_trail', '1', (!empty($Navigation_item->disable_current_trail) && $Navigation_item->dissable_current_trail) ? TRUE : FALSE)))?>
</div>
</div>
</div>
</div>
<?php echo form_close() ?>
</div>
</div>
<?php js_start(); ?>
<script type="text/javascript">
$(document).ready(function() {
$('#link_type').change(function() {
if ($(this).val() == 'page')
{
$('.url_div').hide();
$('.page_div').show();
}
else
{
$('.page_div').hide();
$('.url_div').show();
}
});
$('#link_type').trigger('change');
$( "#tabs" ).tabs();
});
</script>
<?php js_end(); ?>
|
{
"content_hash": "f66caf3549b9e349c81f7191e39262b5",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 307,
"avg_line_length": 61.99009900990099,
"alnum_prop": 0.47931640313049034,
"repo_name": "zurcxer/canvas_goodfood",
"id": "8d1b6d415c3b5cb8d263ddfb455c2a28467fc785",
"size": "6261",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "application/modules/navigations/views/admin/items/edit.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "213399"
},
{
"name": "JavaScript",
"bytes": "744565"
},
{
"name": "PHP",
"bytes": "2734422"
}
]
}
|
import { tail } from '../src/common/common';
import { services } from '../src/common/coreservices';
import { copy, CustomAsyncPolicy, PathNode, Resolvable, ResolveContext, StateObject } from '../src/index';
import { UIRouter } from '../src/router';
import { StateRegistry } from '../src/state/stateRegistry';
import { StateService } from '../src/state/stateService';
import { TransitionService } from '../src/transition/transitionService';
import { TestingPlugin } from './_testingPlugin';
import { tree2Array } from './_testUtils';
///////////////////////////////////////////////
let router: UIRouter,
statesMap: { [key: string]: StateObject } = {};
let $state: StateService;
let $transitions: TransitionService;
let $registry: StateRegistry;
let vals, counts, expectCounts;
let asyncCount;
function invokeLater(fn: Function, ctx: ResolveContext) {
return new Resolvable('', fn, services.$injector.annotate(fn)).get(ctx);
}
function getStates() {
return {
A: {
resolve: {
_A: function() {
return 'A';
},
_A2: function() {
return 'A2';
},
},
B: {
resolve: {
_B: function() {
return 'B';
},
_B2: function() {
return 'B2';
},
},
C: {
resolve: {
_C: function(_A, _B) {
return _A + _B + 'C';
},
_C2: function() {
return 'C2';
},
},
D: {
resolve: {
_D: function(_D2) {
return 'D1' + _D2;
},
_D2: function() {
return 'D2';
},
},
},
},
},
E: {
resolve: {
_E: function() {
return 'E';
},
},
F: {
resolve: {
_E: function() {
return '_E';
},
_F: function(_E) {
return _E + 'F';
},
},
},
},
G: {
resolve: {
_G: function() {
return 'G';
},
},
H: {
resolve: {
_G: function(_G) {
return _G + '_G';
},
_H: function(_G) {
return _G + 'H';
},
},
},
},
I: {
resolve: {
_I: function(_I) {
return 'I';
},
},
},
},
J: {
resolve: {
_J: function() {
counts['_J']++;
return 'J';
},
_J2: function(_J) {
counts['_J2']++;
return _J + 'J2';
},
},
resolvePolicy: {
_J: { when: 'EAGER' },
},
K: {
resolve: {
_K: function(_J2) {
counts['_K']++;
return _J2 + 'K';
},
},
L: {
resolve: {
_L: function(_K) {
counts['_L']++;
return _K + 'L';
},
},
M: {
resolve: {
_M: function(_L) {
counts['_M']++;
return _L + 'M';
},
},
},
},
},
N: {
resolve: [
{ token: '_N', resolveFn: _J => _J + 'N', deps: ['_J'], policy: { when: 'EAGER' } },
{ token: '_N2', resolveFn: _J => _J + 'N2', deps: ['_J'] },
{ token: '_N3', resolveFn: _J => _J + 'N3', deps: ['_J'] },
],
},
},
O: {
resolve: {
_O: function(_O2) {
return _O2 + 'O';
},
_O2: function(_O) {
return _O + 'O2';
},
},
},
};
}
function makePath(names: string[]): PathNode[] {
return names.map(name => new PathNode(statesMap[name]));
}
function getResolvedData(pathContext: ResolveContext) {
return pathContext
.getTokens()
.filter(t => t !== '$stateParams')
.map(token => pathContext.getResolvable(token))
.reduce((acc, resolvable) => {
acc[resolvable.token] = resolvable.data;
return acc;
}, {});
}
describe('Resolvables system:', function() {
afterEach(() => router.dispose());
beforeEach(function() {
router = new UIRouter();
router.plugin(TestingPlugin);
$state = router.stateService;
$transitions = router.transitionService;
$registry = router.stateRegistry;
counts = { _J: 0, _J2: 0, _K: 0, _L: 0, _M: 0, _Q: 0 };
vals = { _Q: null };
expectCounts = copy(counts);
tree2Array(getStates(), false).forEach(state => $registry.register(state));
statesMap = $registry.get().reduce((acc, state) => ((acc[state.name] = state.$$state()), acc), statesMap);
});
describe('Path.getResolvables', function() {
it('should return Resolvables from the deepest element and all ancestors', () => {
const path = makePath(['A', 'B', 'C']);
const ctx = new ResolveContext(path);
const tokens = ctx.getTokens().sort();
expect(tokens).toEqual(['_A', '_A2', '_B', '_B2', '_C', '_C2']);
});
});
describe('Path.resolvePath()', function() {
it('should resolve all resolves in a Path', done => {
const path = makePath(['A', 'B']);
const ctx = new ResolveContext(path);
ctx
.resolvePath()
.then(function() {
expect(getResolvedData(ctx)).toEqualData({ _A: 'A', _A2: 'A2', _B: 'B', _B2: 'B2' });
})
.then(done);
});
it('should resolve only eager resolves when run with "eager" policy', done => {
const path = makePath(['J', 'N']);
const ctx = new ResolveContext(path);
ctx
.resolvePath('EAGER')
.then(function() {
expect(getResolvedData(ctx)).toEqualData({ _J: 'J', _N: 'JN' });
})
.then(done);
});
it('should resolve only eager resolves when run with "eager" policy', done => {
const path = makePath(['J', 'K']);
const ctx = new ResolveContext(path);
ctx
.resolvePath('EAGER')
.then(function() {
expect(getResolvedData(ctx)).toEqualData({ _J: 'J' });
})
.then(done);
});
it('should resolve lazy and eager resolves when run with "lazy" policy', done => {
const path = makePath(['J', 'N']);
const ctx = new ResolveContext(path);
ctx
.resolvePath('LAZY')
.then(function() {
expect(getResolvedData(ctx)).toEqualData({ _J: 'J', _J2: 'JJ2', _N: 'JN', _N2: 'JN2', _N3: 'JN3' });
})
.then(done);
});
});
describe('Resolvable.resolve()', function() {
it('should resolve one Resolvable, and its deps', done => {
const path = makePath(['A', 'B', 'C']);
const ctx = new ResolveContext(path);
ctx
.getResolvable('_C')
.resolve(ctx)
.then(function() {
expect(getResolvedData(ctx)).toEqualData({ _A: 'A', _B: 'B', _C: 'ABC' });
})
.then(done);
});
});
describe('PathElement.invokeLater()', function() {
it('should resolve only the required deps, then inject the fn', done => {
const path = makePath(['A', 'B', 'C', 'D']);
const ctx = new ResolveContext(path);
let result;
const onEnter1 = function(_C2) {
result = _C2;
};
invokeLater(onEnter1, ctx)
.then(function() {
expect(result).toBe('C2');
expect(getResolvedData(ctx)).toEqualData({ _C2: 'C2' });
})
.then(done);
});
});
describe('PathElement.invokeLater()', function() {
it('should resolve the required deps on demand', done => {
const path = makePath(['A', 'B', 'C', 'D']);
const ctx = new ResolveContext(path);
let result;
const cOnEnter1 = function(_C2) {
result = _C2;
};
const cOnEnter2 = function(_C) {
result = _C;
};
invokeLater(cOnEnter1, ctx)
.then(() => {
expect(result).toBe('C2');
expect(getResolvedData(ctx)).toEqualData({ _C2: 'C2' });
})
.then(() => invokeLater(cOnEnter2, ctx))
.then(() => {
expect(result).toBe('ABC');
expect(getResolvedData(ctx)).toEqualData({ _A: 'A', _B: 'B', _C: 'ABC', _C2: 'C2' });
})
.then(done);
});
});
describe('invokeLater', function() {
it('should Error if the onEnter dependency cannot be injected', done => {
const path = makePath(['A', 'B', 'C']);
const ctx = new ResolveContext(path);
const cOnEnter = function(_D) {
throw new Error("Shouldn't get here. " + _D);
};
invokeLater(cOnEnter, ctx).catch(function(err) {
expect(err.message).toContain('Could not find Dependency Injection token: "_D"');
done();
});
});
});
describe('Resolvables', function() {
it('should be able to inject deps from the same PathElement', done => {
const path = makePath(['A', 'B', 'C', 'D']);
const ctx = new ResolveContext(path);
let result;
const dOnEnter = function(_D) {
result = _D;
};
invokeLater(dOnEnter, ctx)
.then(function() {
expect(result).toBe('D1D2');
expect(getResolvedData(ctx)).toEqualData({ _D: 'D1D2', _D2: 'D2' });
})
.then(done);
});
});
describe('Resolvables', function() {
it('should allow PathElement to override parent deps Resolvables of the same name', done => {
const path = makePath(['A', 'E', 'F']);
const ctx = new ResolveContext(path);
let result;
const fOnEnter = function(_F) {
result = _F;
};
invokeLater(fOnEnter, ctx)
.then(function() {
expect(result).toBe('_EF');
})
.then(done);
});
});
// State H has a resolve named _G which takes _G as an injected parameter. injected _G should come from state "G"
// It also has a resolve named _H which takes _G as an injected parameter. injected _G should come from state "H"
describe('Resolvables', function() {
it('of a particular name should be injected from the parent PathElements for their own name', done => {
let result,
path = makePath(['A', 'G', 'H']);
const hOnEnter = _H => {
result = _H;
};
const ctx = new ResolveContext(path);
ctx
.getResolvable('_G')
.get(ctx)
.then(data => {
expect(data).toBe('G_G');
})
.then(() => invokeLater(hOnEnter, ctx))
.then(() => {
expect(result).toBe('G_GH');
})
.then(done);
});
});
describe('Resolvables', function() {
it('should fail to inject same-name deps to self if no parent PathElement contains the name.', done => {
const path = makePath(['A', 'I']);
const ctx = new ResolveContext(path);
// let iPathElement = path.elements[1];
const iOnEnter = function(_I) {
throw new Error("Shouldn't get here. " + _I);
};
const promise = invokeLater(iOnEnter, ctx);
promise.catch(function(err) {
expect(err.message).toContain('Could not find Dependency Injection token: "_I"');
done();
});
});
});
xdescribe('Resolvables', function() {
it('should fail to inject circular dependency', done => {
const path = makePath(['O']);
const ctx = new ResolveContext(path);
const iOnEnter = function(_O) {
throw new Error("Shouldn't get here. " + _O);
};
invokeLater(iOnEnter, ctx).catch(function(err) {
expect(err.message).toContain('[$injector:unpr] Unknown provider: _IProvider ');
done();
});
});
});
describe('Resolvables', function() {
it('should not re-resolve', done => {
const path = makePath(['J', 'K']);
const ctx = new ResolveContext(path);
let result;
function checkCounts() {
expect(result).toBe('JJ2K');
expect(counts['_J']).toBe(1);
expect(counts['_J2']).toBe(1);
expect(counts['_K']).toBe(1);
}
let onEnterCount = 0;
const kOnEnter = function(_K) {
result = _K;
onEnterCount++;
};
invokeLater(kOnEnter, ctx)
.then(checkCounts)
.then(() => invokeLater(kOnEnter, ctx))
.then(checkCounts)
.then(done);
});
});
describe('Pre-Resolved Path', function() {
it('from previous resolve operation should be re-useable when used in another resolve operation', done => {
const path = makePath(['J', 'K']);
const ctx1 = new ResolveContext(path);
const path2 = path.concat(makePath(['L', 'M']));
const ctx2 = new ResolveContext(path2);
expect(counts['_J']).toBe(0);
expect(counts['_J2']).toBe(0);
ctx1
.resolvePath()
.then(function() {
expect(counts['_J']).toBe(1);
expect(counts['_J2']).toBe(1);
expect(counts['_K']).toBe(1);
asyncCount++;
})
.then(() => ctx2.resolvePath())
.then(() => {
expect(counts['_J']).toBe(1);
expect(counts['_J2']).toBe(1);
expect(counts['_K']).toBe(1);
expect(counts['_L']).toBe(1);
expect(counts['_M']).toBe(1);
})
.then(done);
});
});
describe('Path.slice()', function() {
it('should create a partial path from an original path', done => {
const path = makePath(['J', 'K', 'L']);
const ctx1 = new ResolveContext(path);
ctx1
.resolvePath()
.then(function() {
expect(counts['_J']).toBe(1);
expect(counts['_J2']).toBe(1);
expect(counts['_K']).toBe(1);
expect(counts['_L']).toBe(1);
})
.then(() => {
const slicedPath = path.slice(0, 2);
expect(slicedPath.length).toBe(2);
expect(slicedPath[0].state).toBe(path[0].state);
expect(slicedPath[1].state).toBe(path[1].state);
})
.then(() => {
const path2 = path.concat(makePath(['L', 'M']));
const ctx2 = new ResolveContext(path2);
return ctx2.resolvePath();
})
.then(() => {
expect(counts['_J']).toBe(1);
expect(counts['_J2']).toBe(1);
expect(counts['_K']).toBe(1);
expect(counts['_L']).toBe(2);
expect(counts['_M']).toBe(1);
})
.then(done);
});
});
// Test for #2641
it('should not re-resolve data, when redirecting to a child', done => {
$transitions.onStart({ to: 'J' }, $transition$ => {
const ctx = new ResolveContext($transition$.treeChanges().to);
return invokeLater(function(_J) {}, ctx).then(function() {
expect(counts._J).toEqualData(1);
return $state.target('K');
});
});
$state.go('J').then(() => {
expect($state.current.name).toBe('K');
expect(counts._J).toEqualData(1);
done();
});
});
// Test for #2796
it('should not re-resolve data, when redirecting to self with dynamic parameter update', done => {
let resolveCount = 0;
$registry.register({
name: 'dynamic',
url: '/dynamic/{param}',
params: {
param: { dynamic: true },
},
resolvePolicy: { when: 'EAGER' },
resolve: {
data: () => {
new Promise(resolve => resolve('Expensive data ' + resolveCount++));
},
},
});
$transitions.onEnter({ entering: 'dynamic' }, trans => {
if (trans.params()['param'] === 'initial') {
return $state.target('dynamic', { param: 'redirected' });
}
});
$state.go('dynamic', { param: 'initial' }).then(() => {
expect($state.current.name).toBe('dynamic');
expect($state.params['param']).toBe('redirected');
expect(resolveCount).toBe(1);
done();
});
});
describe('NOWAIT Resolve Policy', () => {
it('should allow a transition to complete before the resolve is settled', async done => {
let resolve;
const resolvePromise = new Promise(_resolve => {
resolve = _resolve;
});
$registry.register({
name: 'nowait',
resolve: {
nowait: () => resolvePromise,
},
resolvePolicy: { async: 'NOWAIT' },
});
$transitions.onSuccess({}, trans => {
expect(trans.injector().get('nowait') instanceof Promise).toBeTruthy();
expect(trans.injector().getAsync('nowait') instanceof Promise).toBeTruthy();
expect(trans.injector().getAsync('nowait')).toBe(trans.injector().get('nowait'));
const resolvable = tail(trans.treeChanges('to')).resolvables[0];
expect(resolvable.token).toBe('nowait');
expect(resolvable.resolved).toBe(false);
expect(resolvable.data).toBeUndefined();
trans
.injector()
.get('nowait')
.then(result => {
expect(result).toBe('foobar');
done();
});
resolve('foobar');
});
$state.go('nowait');
});
it('should wait for WAIT resolves and not wait for NOWAIT resolves', async done => {
let promiseResolveFn;
const resolvePromise = new Promise(resolve => {
promiseResolveFn = resolve;
});
$registry.register({
name: 'nowait',
resolve: [
{ token: 'nowait', policy: { async: 'NOWAIT' }, resolveFn: () => resolvePromise },
{ token: 'wait', policy: { async: 'WAIT' }, resolveFn: () => new Promise(resolve => resolve('should wait')) },
],
});
$transitions.onSuccess({}, trans => {
expect(trans.injector().get('nowait') instanceof Promise).toBeTruthy();
expect(trans.injector().get('wait')).toBe('should wait');
const resolvable = tail(trans.treeChanges('to')).resolvables[0];
expect(resolvable.token).toBe('nowait');
expect(resolvable.resolved).toBe(false);
expect(resolvable.data).toBeUndefined();
trans
.injector()
.get('nowait')
.then(result => {
expect(result).toBe('foobar');
done();
});
promiseResolveFn('foobar');
});
$state.go('nowait');
});
});
describe('custom Resolve Policy', () => {
let customResolvePolicy: CustomAsyncPolicy;
it('should wait for the promise to resolve before finishing the transition', async done => {
let resolve: (value: string) => void;
const resolvePromise: Promise<string> = new Promise(_resolve => {
resolve = _resolve;
});
customResolvePolicy = jasmine.createSpy('customResolvePolicy');
(customResolvePolicy as jasmine.Spy).and.callFake((data: { useMe: Promise<string> }) => {
return data.useMe;
});
resolve('myAwaitedValue');
$registry.register({
name: 'customPolicy',
resolve: {
customWait: () => ({ useMe: resolvePromise }),
},
resolvePolicy: { async: customResolvePolicy },
});
$transitions.onSuccess({}, trans => {
expect(customResolvePolicy).toHaveBeenCalledWith({ useMe: resolvePromise });
expect(trans.injector().get('customWait')).toBe('myAwaitedValue');
});
$state.go('customPolicy').then(done);
});
});
});
|
{
"content_hash": "a0984ba0e04158f1a51ae4c0eeaa0d89",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 120,
"avg_line_length": 28.630177514792898,
"alnum_prop": 0.5060452619613517,
"repo_name": "ui-router/core",
"id": "4507cace06c4889542ae061905c8efeb29f8404e",
"size": "19354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/resolveSpec.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "3217"
},
{
"name": "TypeScript",
"bytes": "754731"
}
]
}
|
<?xml version="1.1" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="chileyequil.camera" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/nachos"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<data xmlns:android="http://schemas.android.com/apk/res/android">
<external-path android:name="my_images" android:path="Android/data/chileyequil.camera/files/Pictures" />
</data>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<activity
android:name=".chileyequil"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
|
{
"content_hash": "3e1749f55fd88f7ec92dd7db914bda74",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 116,
"avg_line_length": 35.390243902439025,
"alnum_prop": 0.6099241902136457,
"repo_name": "mmiranda96/chilaiquil-api",
"id": "72464b88e5de68b0d5d408d2731f0c417d3dfbee",
"size": "1451",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Camera/app/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "13525"
},
{
"name": "Python",
"bytes": "4181"
},
{
"name": "Shell",
"bytes": "867"
}
]
}
|
<?php
/*
* How to prepare a new payment with the Mollie API.
*/
try {
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/functions.php";
/*
* Initialize the Mollie API library with your oauth access token.
*
* See: https://docs.mollie.com/connect/getting-started
*/
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setAccessToken("access_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");
/*
* Generate a unique order id for this example. It is important to include this unique attribute
* in the redirectUrl (below) so a proper return page can be shown to the customer.
*/
$orderId = time();
/*
* Determine the url parts to these example files.
*/
$protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http";
$hostname = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['REQUEST_URI'] ?? $_SERVER['PHP_SELF']);
/*
* Payment parameters:
* profileId Your profileId
* amount Amount in EUROs. This example creates a € 10,- payment.
* description Description of the payment.
* redirectUrl Redirect location. The customer will be redirected there after the payment.
* webhookUrl Webhook location, used to report when the payment changes state.
* routing Routing part of a payment to a connected account https://docs.mollie.com/connect/splitting-payments
*
* For example, the funds for the following payment will only become available on the balance of the connected account on 1 January 2025:
*/
$payment = $mollie->payments->create([
"profileId" => "pfl_v9hTwCvYqw",
"amount" => [
"currency" => "EUR",
"value" => "10.00", // You must send the correct number of decimals, thus we enforce the use of strings
],
"description" => "Order #{$orderId}",
"redirectUrl" => "{$protocol}://{$hostname}{$path}/return.php?order_id={$orderId}",
"webhookUrl" => "{$protocol}://{$hostname}{$path}/webhook.php",
"routing" => [
[
"amount" => [
"currency" => "EUR",
"value" => "7.50",
],
"destination" => [
"type" => "organization",
"organizationId" => "org_23456",
],
"releaseDate" => "2025-01-01",
],
],
]);
/*
* In this example we store the order with its payment status in a database.
*/
database_write($orderId, $payment->status);
/*
* Send the customer off to complete the payment.
* This request should always be a GET, thus we enforce 303 http response code
*/
header("Location: " . $payment->getCheckoutUrl(), true, 303);
} catch (\Mollie\Api\Exceptions\ApiException $e) {
echo "API call failed: " . htmlspecialchars($e->getMessage());
}
|
{
"content_hash": "81122a5e858a1919db95ed138ff2c4a6",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 141,
"avg_line_length": 36.916666666666664,
"alnum_prop": 0.5765881973556917,
"repo_name": "mollie/mollie-api-php",
"id": "0de662bce07484ffaf789472b9f4d369526c871d",
"size": "3103",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/payments/create-routed-payment-with-future-release-date.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "PHP",
"bytes": "671710"
}
]
}
|
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".business.developing.DevelopingActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/developing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="@string/developing_label" />
</LinearLayout>
|
{
"content_hash": "4b6cf8ccc82e912d7076e67baa659c16",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 42.22222222222222,
"alnum_prop": 0.7092105263157895,
"repo_name": "AlexMofer/AMWidget",
"id": "4806ab6bc71f4446486c08bc4f73ac16f7c2a622",
"size": "760",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/activity_developing.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "768210"
}
]
}
|
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0002_auto_20160907_1518'),
]
operations = [
migrations.AlterField(
model_name='eventpage',
name='slug_en',
field=models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug'),
),
migrations.AlterField(
model_name='eventpage',
name='slug_nl',
field=models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug'),
),
]
|
{
"content_hash": "921426098731734ad6814550c63f3fcb",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 201,
"avg_line_length": 36.52173913043478,
"alnum_prop": 0.6214285714285714,
"repo_name": "jeremy-c/unusualbusiness",
"id": "d6dca711e593c90f39eda03c540f05c2b81d765c",
"size": "912",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "unusualbusiness/events/migrations/0003_auto_20160908_2125.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "120772"
},
{
"name": "HTML",
"bytes": "136629"
},
{
"name": "JavaScript",
"bytes": "39256"
},
{
"name": "Nginx",
"bytes": "1127"
},
{
"name": "Python",
"bytes": "209333"
},
{
"name": "Shell",
"bytes": "3340"
}
]
}
|
package org.apache.camel.component.jpa;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.LockModeType;
import javax.persistence.PersistenceException;
import javax.persistence.Query;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.support.PollingConsumerSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.camel.component.jpa.JpaHelper.getTargetEntityManager;
public class JpaPollingConsumer extends PollingConsumerSupport {
private static final Logger LOG = LoggerFactory.getLogger(JpaPollingConsumer.class);
private transient ExecutorService executorService;
private final EntityManagerFactory entityManagerFactory;
private final TransactionStrategy transactionStrategy;
private String query;
private String namedQuery;
private String nativeQuery;
private LockModeType lockModeType = LockModeType.PESSIMISTIC_WRITE;
private Class<?> resultClass;
private QueryFactory queryFactory;
private Map<String, Object> parameters;
public JpaPollingConsumer(JpaEndpoint endpoint) {
super(endpoint);
this.entityManagerFactory = endpoint.getEntityManagerFactory();
this.transactionStrategy = endpoint.getTransactionStrategy();
}
@Override
public JpaEndpoint getEndpoint() {
return (JpaEndpoint) super.getEndpoint();
}
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public String getNamedQuery() {
return namedQuery;
}
public void setNamedQuery(String namedQuery) {
this.namedQuery = namedQuery;
}
public String getNativeQuery() {
return nativeQuery;
}
public void setNativeQuery(String nativeQuery) {
this.nativeQuery = nativeQuery;
}
public LockModeType getLockModeType() {
return lockModeType;
}
public void setLockModeType(LockModeType lockModeType) {
this.lockModeType = lockModeType;
}
public Class<?> getResultClass() {
return resultClass;
}
public void setResultClass(Class<?> resultClass) {
this.resultClass = resultClass;
}
public QueryFactory getQueryFactory() {
return queryFactory;
}
public void setQueryFactory(QueryFactory queryFactory) {
this.queryFactory = queryFactory;
}
public Map<String, Object> getParameters() {
return parameters;
}
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}
@Override
public Exchange receive() {
// resolve the entity manager before evaluating the expression
final EntityManager entityManager = getTargetEntityManager(null, entityManagerFactory,
getEndpoint().isUsePassedInEntityManager(), getEndpoint().isSharedEntityManager(), true);
Exchange exchange = getEndpoint().createExchange();
exchange.getIn().setHeader(JpaConstants.ENTITY_MANAGER, entityManager);
transactionStrategy.executeInTransaction(new Runnable() {
@Override
public void run() {
if (getEndpoint().isJoinTransaction()) {
entityManager.joinTransaction();
}
Query query = getQueryFactory().createQuery(entityManager);
configureParameters(query);
if (getEndpoint().isConsumeLockEntity()) {
query.setLockMode(getLockModeType());
}
LOG.trace("Created query {}", query);
Object answer;
try {
List<?> results = query.getResultList();
if (results != null && results.size() == 1) {
// we only have 1 entity so return that
answer = results.get(0);
} else {
// we have more data so return a list
answer = results;
}
// commit
LOG.debug("Flushing EntityManager");
entityManager.flush();
// must clear after flush
entityManager.clear();
} catch (PersistenceException e) {
LOG.info("Disposing EntityManager {} on {} due to coming transaction rollback", entityManager, this);
entityManager.close();
throw e;
}
exchange.getIn().setBody(answer);
}
});
return exchange;
}
@Override
public Exchange receiveNoWait() {
// call receive as-is
return receive();
}
@Override
public Exchange receive(long timeout) {
// need to use a thread pool to perform the task so we can support timeout
if (executorService == null) {
executorService = getEndpoint().getComponent().getOrCreatePollingConsumerExecutorService();
}
// the task is the receive method
Future<Exchange> future = executorService.submit((Callable<Exchange>) this::receive);
try {
return future.get(timeout, TimeUnit.MILLISECONDS);
} catch (ExecutionException | InterruptedException e) {
throw RuntimeCamelException.wrapRuntimeCamelException(e);
} catch (TimeoutException e) {
// ignore as we hit timeout then return null
}
return null;
}
@Override
protected void doInit() throws Exception {
super.doInit();
if (queryFactory == null) {
queryFactory = createQueryFactory();
if (queryFactory == null) {
throw new IllegalArgumentException(
"No queryType property configured on this consumer, nor an entityType configured on the endpoint so cannot consume");
}
}
}
@Override
protected void doStop() throws Exception {
// noop
}
protected void configureParameters(Query query) {
int maxResults = getEndpoint().getMaximumResults();
if (maxResults > 0) {
query.setMaxResults(maxResults);
}
// setup the parameter
if (parameters != null) {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
query.setParameter(entry.getKey(), entry.getValue());
}
}
}
protected Exchange createExchange(Object result, EntityManager entityManager) {
Exchange exchange = getEndpoint().createExchange();
exchange.getIn().setBody(result);
exchange.getIn().setHeader(JpaConstants.ENTITY_MANAGER, entityManager);
return exchange;
}
protected QueryFactory createQueryFactory() {
if (query != null) {
return QueryBuilder.query(query);
} else if (namedQuery != null) {
return QueryBuilder.namedQuery(namedQuery);
} else if (nativeQuery != null) {
if (resultClass != null) {
return QueryBuilder.nativeQuery(nativeQuery, resultClass);
} else {
return QueryBuilder.nativeQuery(nativeQuery);
}
} else {
Class<?> entityType = getEndpoint().getEntityType();
if (entityType == null) {
return null;
} else {
// Check if we have a property name on the @Entity annotation
String name = getEntityName(entityType);
if (name != null) {
return QueryBuilder.query("select x from " + name + " x");
} else {
// Remove package name of the entity to be conform with JPA 1.0 spec
return QueryBuilder.query("select x from " + entityType.getSimpleName() + " x");
}
}
}
}
protected String getEntityName(Class<?> clazz) {
Entity entity = clazz.getAnnotation(Entity.class);
// Check if the property name has been defined for Entity annotation
if (entity != null && !entity.name().equals("")) {
return entity.name();
} else {
return null;
}
}
}
|
{
"content_hash": "be55839f827b427428bcc221b0d1d7e0",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 141,
"avg_line_length": 31.919708029197082,
"alnum_prop": 0.6109078435856391,
"repo_name": "cunningt/camel",
"id": "538ed3a497366095a07775809d4bf8887cc58c52",
"size": "9548",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaPollingConsumer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6695"
},
{
"name": "Batchfile",
"bytes": "2353"
},
{
"name": "CSS",
"bytes": "5472"
},
{
"name": "Dockerfile",
"bytes": "5676"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "8015"
},
{
"name": "Groovy",
"bytes": "396363"
},
{
"name": "HTML",
"bytes": "212954"
},
{
"name": "Java",
"bytes": "113234282"
},
{
"name": "JavaScript",
"bytes": "103655"
},
{
"name": "Jsonnet",
"bytes": "1734"
},
{
"name": "Kotlin",
"bytes": "41869"
},
{
"name": "Mustache",
"bytes": "525"
},
{
"name": "RobotFramework",
"bytes": "8461"
},
{
"name": "Ruby",
"bytes": "88"
},
{
"name": "Shell",
"bytes": "15221"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "699"
},
{
"name": "XSLT",
"bytes": "276597"
}
]
}
|
app.controller('search_account_ctrl', function ($scope) {
$scope.options = gon.accounting_groups;
$scope.init = function(account, description) {
$scope.account = '#'+account;
$scope.description = '#'+description;
};
$scope.select_accounting_group = function() {
for (x=0; x < gon.accounting_groups.length; x++) {
if (gon.accounting_groups[x].number == $scope.accounting_group) {
$scope.accounts = gon.accounting_groups[x].accounts;
$scope.acc = gon.accounting_groups[x].accounts[0].number;
$($scope.account).val($scope.accounts[0].id);
$($scope.description).val($scope.accounts[0].description);
}
}
};
$scope.select_account = function() {
for (x=0; x < $scope.accounts.length; x++) {
if ($scope.accounts[x].number == $scope.acc) {
$($scope.account).val($scope.accounts[x].id);
$($scope.description).val($scope.accounts[x].description);
}
}
};
});
|
{
"content_hash": "e0c357e5d12dfa81499b192ac66893e6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 77,
"avg_line_length": 39.111111111111114,
"alnum_prop": 0.5539772727272727,
"repo_name": "dulvie/kinna",
"id": "9cabff772a09f9092920257ce2bfbbef55b10475",
"size": "1056",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/assets/javascripts/search_accounts.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5798"
},
{
"name": "JavaScript",
"bytes": "15115"
},
{
"name": "Ruby",
"bytes": "301120"
},
{
"name": "Shell",
"bytes": "365"
}
]
}
|
package org.gradle.test.performance.mediummonolithicjavaproject.p386;
public class Production7733 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
}
|
{
"content_hash": "a0d8c78a5e7d5ff5941cd00ba82c95e9",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 69,
"avg_line_length": 18.00952380952381,
"alnum_prop": 0.6171337916446324,
"repo_name": "oehme/analysing-gradle-performance",
"id": "5e83d09617dcab8356397a77319db694da1c5a4f",
"size": "1891",
"binary": false,
"copies": "1",
"ref": "refs/heads/before",
"path": "my-app/src/main/java/org/gradle/test/performance/mediummonolithicjavaproject/p386/Production7733.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "40770723"
}
]
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Azure.AI.FormRecognizer.DocumentAnalysis.Tests;
using Azure.Core.TestFramework;
namespace Azure.AI.FormRecognizer.DocumentAnalysis.Samples
{
public partial class DocumentAnalysisSamples : SamplesBase<DocumentAnalysisTestEnvironment>
{
[RecordedTest]
public async Task AnalyzeWithPrebuiltModelFromFileAsync()
{
string endpoint = TestEnvironment.Endpoint;
string apiKey = TestEnvironment.ApiKey;
DocumentAnalysisClient client = new DocumentAnalysisClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
#region Snippet:FormRecognizerAnalyzeWithPrebuiltModelFromFileAsync
#if SNIPPET
string filePath = "<filePath>";
#else
string filePath = DocumentAnalysisTestEnvironment.CreatePath("recommended_invoice.jpg");
#endif
using var stream = new FileStream(filePath, FileMode.Open);
AnalyzeDocumentOperation operation = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-invoice", stream);
AnalyzeResult result = operation.Value;
// To see the list of all the supported fields returned by service and its corresponding types for the
// prebuilt-invoice model, consult:
// https://aka.ms/azsdk/formrecognizer/invoicefieldschema
for (int i = 0; i < result.Documents.Count; i++)
{
Console.WriteLine($"Document {i}:");
AnalyzedDocument document = result.Documents[i];
if (document.Fields.TryGetValue("VendorName", out DocumentField vendorNameField))
{
if (vendorNameField.FieldType == DocumentFieldType.String)
{
string vendorName = vendorNameField.Value.AsString();
Console.WriteLine($"Vendor Name: '{vendorName}', with confidence {vendorNameField.Confidence}");
}
}
if (document.Fields.TryGetValue("CustomerName", out DocumentField customerNameField))
{
if (customerNameField.FieldType == DocumentFieldType.String)
{
string customerName = customerNameField.Value.AsString();
Console.WriteLine($"Customer Name: '{customerName}', with confidence {customerNameField.Confidence}");
}
}
if (document.Fields.TryGetValue("Items", out DocumentField itemsField))
{
if (itemsField.FieldType == DocumentFieldType.List)
{
foreach (DocumentField itemField in itemsField.Value.AsList())
{
Console.WriteLine("Item:");
if (itemField.FieldType == DocumentFieldType.Dictionary)
{
IReadOnlyDictionary<string, DocumentField> itemFields = itemField.Value.AsDictionary();
if (itemFields.TryGetValue("Description", out DocumentField itemDescriptionField))
{
if (itemDescriptionField.FieldType == DocumentFieldType.String)
{
string itemDescription = itemDescriptionField.Value.AsString();
Console.WriteLine($" Description: '{itemDescription}', with confidence {itemDescriptionField.Confidence}");
}
}
if (itemFields.TryGetValue("Amount", out DocumentField itemAmountField))
{
if (itemAmountField.FieldType == DocumentFieldType.Currency)
{
CurrencyValue itemAmount = itemAmountField.Value.AsCurrency();
Console.WriteLine($" Amount: '{itemAmount.Symbol}{itemAmount.Amount}', with confidence {itemAmountField.Confidence}");
}
}
}
}
}
}
if (document.Fields.TryGetValue("SubTotal", out DocumentField subTotalField))
{
if (subTotalField.FieldType == DocumentFieldType.Currency)
{
CurrencyValue subTotal = subTotalField.Value.AsCurrency();
Console.WriteLine($"Sub Total: '{subTotal.Symbol}{subTotal.Amount}', with confidence {subTotalField.Confidence}");
}
}
if (document.Fields.TryGetValue("TotalTax", out DocumentField totalTaxField))
{
if (totalTaxField.FieldType == DocumentFieldType.Currency)
{
CurrencyValue totalTax = totalTaxField.Value.AsCurrency();
Console.WriteLine($"Total Tax: '{totalTax.Symbol}{totalTax.Amount}', with confidence {totalTaxField.Confidence}");
}
}
if (document.Fields.TryGetValue("InvoiceTotal", out DocumentField invoiceTotalField))
{
if (invoiceTotalField.FieldType == DocumentFieldType.Currency)
{
CurrencyValue invoiceTotal = invoiceTotalField.Value.AsCurrency();
Console.WriteLine($"Invoice Total: '{invoiceTotal.Symbol}{invoiceTotal.Amount}', with confidence {invoiceTotalField.Confidence}");
}
}
}
#endregion
}
}
}
|
{
"content_hash": "0888b5b3349bae68bdb1cb95c84f3280",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 159,
"avg_line_length": 47.201550387596896,
"alnum_prop": 0.5424536048612252,
"repo_name": "Azure/azure-sdk-for-net",
"id": "d221d32ef4752305765f8e9b0e4eda67abd15566",
"size": "6091",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample_AnalyzeWithPrebuiltModelFromFileAsync.cs",
"mode": "33188",
"license": "mit",
"language": []
}
|
package de.lightful.maven.plugins.drools.impl.logging;
public class MavenErrorLogStream extends MavenLogStream<MavenErrorLogStream> {
@Override
public void writeToStream() {
mavenLog.error(stringBuilder.toString());
}
}
|
{
"content_hash": "24e551661fd68eddf3f19450a683074b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 78,
"avg_line_length": 21.272727272727273,
"alnum_prop": 0.7735042735042735,
"repo_name": "maven-drools/plugin.maven-drools-plugin",
"id": "5de29994b8361c1c57e6885c58252ad23af4f21f",
"size": "1062",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mojos/src/main/java/de/lightful/maven/plugins/drools/impl/logging/MavenErrorLogStream.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "91060"
}
]
}
|
using namespace IECore;
using namespace Gaffer;
using namespace GafferScene;
IE_CORE_DEFINERUNTIMETYPED( FilteredSceneProcessor );
size_t FilteredSceneProcessor::g_firstPlugIndex = 0;
FilteredSceneProcessor::FilteredSceneProcessor( const std::string &name, Filter::Result filterDefault )
: SceneProcessor( name )
{
storeIndexOfNextChild( g_firstPlugIndex );
addChild( new IntPlug( "filter", Plug::In, filterDefault, Filter::NoMatch, Filter::EveryMatch ) );
}
FilteredSceneProcessor::~FilteredSceneProcessor()
{
}
Gaffer::IntPlug *FilteredSceneProcessor::filterPlug()
{
return getChild<IntPlug>( g_firstPlugIndex );
}
const Gaffer::IntPlug *FilteredSceneProcessor::filterPlug() const
{
return getChild<IntPlug>( g_firstPlugIndex );
}
bool FilteredSceneProcessor::acceptsInput( const Gaffer::Plug *plug, const Gaffer::Plug *inputPlug ) const
{
if( !SceneProcessor::acceptsInput( plug, inputPlug ) )
{
return false;
}
if( plug == filterPlug() )
{
// we only want to accept inputs from Filter nodes, but we accept
// them from Boxes too, because the intermediate plugs there can
// be used to later connect a filter in from the outside.
const Node *n = inputPlug->source<Plug>()->node();
return runTimeCast<const Filter>( n ) || runTimeCast<const Box>( n );
}
return true;
}
|
{
"content_hash": "c46994b10874cf6e066fc6fede20db28",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 106,
"avg_line_length": 28.347826086956523,
"alnum_prop": 0.7461656441717791,
"repo_name": "davidsminor/gaffer",
"id": "935111137c4c01e044f71051a08330befc08b832",
"size": "3286",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/GafferScene/FilteredSceneProcessor.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "9286"
},
{
"name": "C++",
"bytes": "3358250"
},
{
"name": "COBOL",
"bytes": "64449"
},
{
"name": "CSS",
"bytes": "28027"
},
{
"name": "Python",
"bytes": "3267354"
},
{
"name": "Shell",
"bytes": "7055"
},
{
"name": "Slash",
"bytes": "35200"
}
]
}
|
<!--
Copyright 2017 Goldman Sachs.
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 applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.goldmansachs.obevo</groupId>
<artifactId>obevo-dependencies</artifactId>
<version>${revision}</version>
<relativePath>../obevo-dependencies</relativePath>
</parent>
<artifactId>obevo-core</artifactId>
<properties>
<jacoco.minCoverage>0.40</jacoco.minCoverage>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>javacc</id>
<goals>
<goal>javacc</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-sources/javacc</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.goldmansachs.obevo</groupId>
<artifactId>obevo-internal-test-client-01</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.goldmansachs.obevo</groupId>
<artifactId>obevo-internal-test-client-02</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-ext</artifactId>
<version>0.9.1</version>
<exclusions>
<!-- excluding these unused dependencies -->
<exclusion>
<groupId>org.tinyjee.jgraphx</groupId>
<artifactId>jgraphx</artifactId>
</exclusion>
<exclusion>
<groupId>jgraph</groupId>
<artifactId>jgraph</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.cli-parser</groupId>
<artifactId>cli</artifactId>
<version>7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<scope>runtime</scope> <!-- needed for commons-configuration2 and XML configs -->
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.juniversalchardet</groupId>
<artifactId>juniversalchardet</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<!-- VFS required apache commons logging in some form (whether the original or via jcl-over-slf4j) in the classpath -->
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections-testutils</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
|
{
"content_hash": "0ca2f90982c71e669c7820f5bb359115",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 204,
"avg_line_length": 37.14358974358974,
"alnum_prop": 0.5428689769432555,
"repo_name": "shantstepanian/obevo",
"id": "9b6eade502b542348b409c16033d6c1e5cdaebeb",
"size": "7243",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "obevo-core/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2302"
},
{
"name": "FreeMarker",
"bytes": "9115"
},
{
"name": "Java",
"bytes": "2677165"
},
{
"name": "JavaScript",
"bytes": "3135"
},
{
"name": "Kotlin",
"bytes": "232754"
},
{
"name": "PLSQL",
"bytes": "19595"
},
{
"name": "PLpgSQL",
"bytes": "24497"
},
{
"name": "PowerShell",
"bytes": "3558"
},
{
"name": "SQLPL",
"bytes": "29981"
},
{
"name": "Shell",
"bytes": "11626"
}
]
}
|
package org.jivesoftware.util;
import java.awt.Color;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A utility class that provides methods that are useful for dealing with
* Java Beans.
*/
public class BeanUtils {
private static final Logger Log = LoggerFactory.getLogger(BeanUtils.class);
/**
* The date format recognized for parsing/formattig dates.
*/
public static final String DATE_FORMAT = "MM/dd/yyyy";
private static DateFormat dateFormatter = new SimpleDateFormat(DATE_FORMAT);
/**
* Sets the properties of a Java Bean based on the String name/value pairs in
* the specifieed Map. Because this method has to know how to convert a
* String value into the correct type for the bean, only a few bean property
* types are supported. They are: String, boolean, int, long, float, double,
* Color, and Class.<p>
*
* If key/value pairs exist in the Map that don't correspond to properties
* of the bean, they will be ignored.
*
* @param bean the JavaBean to set properties on.
* @param properties String name/value pairs of the properties to set.
*/
public static void setProperties(Object bean, Map<String, String> properties) {
try {
// Loop through all the property names in the Map
for (String propName : properties.keySet()) {
try {
// Create a property descriptor for the named property. If
// the bean doesn't have the named property, an
// Introspection will be thrown.
PropertyDescriptor descriptor = new PropertyDescriptor(
propName, bean.getClass());
// Load the class type of the property.
Class propertyType = descriptor.getPropertyType();
// Get the value of the property by converting it from a
// String to the correct object type.
Object value = decode(propertyType, properties.get(propName));
// Set the value of the bean.
descriptor.getWriteMethod().invoke(bean, value);
}
catch (IntrospectionException ie) {
// Ignore. This exception means that the key in the map
// does not correspond to a property of the bean.
}
catch (InvocationTargetException ite) {
// Ignore. This exception most often occurs when a
// value in the map is null and the target method doesn't
// support null properties.
}
}
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
}
/**
* Sets the properties of a Java Bean based on the request's properties. Because
* this method has to know how to convert a String value into the correct type
* for the bean, only a few bean property types are supported. They are: String,
* boolean, int, long, float, double, Color, and Class.<p>
*
* If key/value pairs exist in the Map that don't correspond to properties
* of the bean, they will be ignored.
*
* @param bean the JavaBean to set properties on.
* @param request the HTTP request.
*/
public static void setProperties(Object bean, HttpServletRequest request) {
for (Enumeration propNames = request.getParameterNames(); propNames.hasMoreElements();) {
String propName = (String) propNames.nextElement();
try {
// Create a property descriptor for the named property. If
// the bean doesn't have the named property, an
// Introspection will be thrown.
PropertyDescriptor descriptor = new PropertyDescriptor(
propName, bean.getClass());
// Load the class type of the property.
Class propertyType = descriptor.getPropertyType();
// Get the value of the property by converting it from a
// String to the correct object type.
Object value = decode(propertyType, request.getParameter(propName));
// Set the value of the bean.
descriptor.getWriteMethod().invoke(bean, value);
}
catch (IntrospectionException ie) {
// Ignore. This exception means that the key in the map
// does not correspond to a property of the bean.
}
catch (InvocationTargetException ite) {
// Ignore. This exception most often occurs when a
// value in the map is null and the target method doesn't
// support null properties.
}
catch (IllegalAccessException e) {
Log.error(e.getMessage(), e);
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
}
}
/**
* Gets the properties from a Java Bean and returns them in a Map of String
* name/value pairs. Because this method has to know how to convert a
* bean property into a String value, only a few bean property
* types are supported. They are: String, boolean, int, long, float, double,
* Color, and Class.
*
* @param bean a Java Bean to get properties from.
* @return a Map of all properties as String name/value pairs.
*/
public static Map<String, String> getProperties(Object bean) {
Map<String, String> properties = new HashMap<>();
try {
BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
// Loop through all properties of the bean.
PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
String [] names = new String[descriptors.length];
for (int i=0; i<names.length; i++) {
// Determine the property name.
String name = descriptors[i].getName();
//Class type = descriptors[i].getPropertyType();
// Decode the property value using the property type and
// encoded String value.
Object value = descriptors[i].getReadMethod().invoke(bean,(java.lang.Object[]) null);
// Add to Map, encoding the value as a String.
properties.put(name, encode(value));
}
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
return properties;
}
/**
* Returns the PropertyDescriptor array for the specified Java Bean Class.
* The method also does a special check to see of the bean has a BeanInfo
* class that extends the JiveBeanInfo class. If yes, we load the
* PropertyDescriptor array directly from that BeanInfo class rather than
* through the Introspector in order to preserve the desired ordering of
* properties.
*
* @param beanClass the Class of the JavaBean.
* @return the PropertyDescriptor array for the specified Java Bean Class.
* @throws java.beans.IntrospectionException if there were problems accessing the descriptor
*/
public static PropertyDescriptor[] getPropertyDescriptors(Class beanClass)
throws IntrospectionException
{
// See if the Java Bean has a BeanInfo class that implements
// JiveBeanInfo. If so, return the PropertyDescriptor from that
// class. This will bypass properties of parent classes, but this is
// the normal behavior of classes that implement JiveBeanInfo.
try {
JiveBeanInfo beanInfo = (JiveBeanInfo)ClassUtils.forName(
beanClass.getName() + "BeanInfo").newInstance();
return beanInfo.getPropertyDescriptors();
}
catch (Exception e) {
// Ignore.
}
// Otherwise, return the PropertyDescriptors from the Introspector.
return Introspector.getBeanInfo(beanClass).getPropertyDescriptors();
}
/**
* Encodes a bean property value as a String. If the object type is not
* supported, null will be returned.
*
* @param value an Object to encode in a String representation.
* @return the encoded bean.
*/
private static String encode(Object value) {
if (value instanceof String) {
return (String)value;
}
if (value instanceof Boolean ||
value instanceof Integer ||
value instanceof Long ||
value instanceof Float ||
value instanceof Double)
{
return value.toString();
}
if (value instanceof Date) {
try {
return dateFormatter.format((Date)value);
}
catch (Exception ignored) {
// Ignore.
}
}
if (value instanceof Color) {
Color color = (Color)value;
return color.getRed() +","+ color.getGreen() +","+ color.getBlue();
}
if (value instanceof Class) {
return ((Class)value).getName();
}
return null;
}
/**
* Decodes a String into an object of the specified type. If the object
* type is not supported, null will be returned.
*
* @param type the type of the property.
* @param value the encode String value to decode.
* @return the String value decoded into the specified type.
* @throws Exception
*/
private static Object decode(Class type, String value) throws Exception {
if (type.getName().equals("java.lang.String")) {
return value;
}
if (type.getName().equals("boolean")) {
return Boolean.valueOf(value);
}
if (type.getName().equals("int")) {
return Integer.valueOf(value);
}
if (type.getName().equals("long")) {
return Long.valueOf(value);
}
if (type.getName().equals("float")) {
return Float.valueOf(value);
}
if (type.getName().equals("double")) {
return Double.valueOf(value);
}
if (type.getName().equals("java.util.Date")) {
try {
return dateFormatter.parse(value);
}
catch (Exception ignored) {
// Ignore.
}
}
if (type.getName().equals("java.awt.Color")) {
StringTokenizer tokens = new StringTokenizer(value, ",");
int red = Integer.parseInt(tokens.nextToken());
int green = Integer.parseInt(tokens.nextToken());
int blue = Integer.parseInt(tokens.nextToken());
return new Color(red, green, blue);
}
if (type.getName().equals("java.lang.Class")) {
return ClassUtils.forName(value);
}
return null;
}
// This class is not instantiable.
private BeanUtils() {
// do nothing.
}
}
|
{
"content_hash": "13ee59e5fef5136603db205ec54ced46",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 101,
"avg_line_length": 40.18055555555556,
"alnum_prop": 0.5922053231939164,
"repo_name": "speedy01/Openfire",
"id": "88f20f6befdf4a680a3115b5b241cbb735e21f0a",
"size": "12199",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "xmppserver/src/main/java/org/jivesoftware/util/BeanUtils.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "3721"
},
{
"name": "C",
"bytes": "3814"
},
{
"name": "CSS",
"bytes": "500100"
},
{
"name": "HTML",
"bytes": "687698"
},
{
"name": "Java",
"bytes": "13997599"
},
{
"name": "JavaScript",
"bytes": "3765620"
},
{
"name": "Makefile",
"bytes": "1322"
},
{
"name": "Objective-C",
"bytes": "6879"
},
{
"name": "PLSQL",
"bytes": "763"
},
{
"name": "Shell",
"bytes": "31303"
}
]
}
|
package com.google.cloud.dialogflow.v2beta1.samples;
// [START dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_sync]
import com.google.cloud.dialogflow.v2beta1.AgentName;
import com.google.cloud.dialogflow.v2beta1.EntityType;
import com.google.cloud.dialogflow.v2beta1.EntityTypesClient;
import com.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest;
public class SyncListEntityTypes {
public static void main(String[] args) throws Exception {
syncListEntityTypes();
}
public static void syncListEntityTypes() throws Exception {
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
ListEntityTypesRequest request =
ListEntityTypesRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (EntityType element : entityTypesClient.listEntityTypes(request).iterateAll()) {
// doThingsWith(element);
}
}
}
}
// [END dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_sync]
|
{
"content_hash": "39dfac7d980029ba48cee8ebd1f62800",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 100,
"avg_line_length": 43.054054054054056,
"alnum_prop": 0.736346516007533,
"repo_name": "googleapis/google-cloud-java",
"id": "58cefed6977f2fbaeccf39e31f8986652f547a05",
"size": "2188",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "java-dialogflow/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypes/listentitytypes/SyncListEntityTypes.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2614"
},
{
"name": "HCL",
"bytes": "28592"
},
{
"name": "Java",
"bytes": "826434232"
},
{
"name": "Jinja",
"bytes": "2292"
},
{
"name": "Python",
"bytes": "200408"
},
{
"name": "Shell",
"bytes": "97954"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 4