diff --git "a/github_sample.jsonl" "b/github_sample.jsonl"
--- "a/github_sample.jsonl"
+++ "b/github_sample.jsonl"
@@ -8,3 +8,57 @@
{"text": "\ufeff// --------------------------------------------------------------------------------------------\r\n// \r\n// Copyright (C) 2011-2014 Effort Team\r\n//\r\n// Permission is hereby granted, free of charge, to any person obtaining a copy\r\n// of this software and associated documentation files (the \"Software\"), to deal\r\n// in the Software without restriction, including without limitation the rights\r\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n// copies of the Software, and to permit persons to whom the Software is\r\n// furnished to do so, subject to the following conditions:\r\n//\r\n// The above copyright notice and this permission notice shall be included in\r\n// all copies or substantial portions of the Software.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n// THE SOFTWARE.\r\n// \r\n// --------------------------------------------------------------------------------------------\r\n\r\nnamespace Effort.Provider\r\n{\r\n using System;\r\n using System.Data;\r\n using System.Data.Common;\r\n#if !EFOLD\r\n using System.Data.Entity.Core.Common;\r\n#endif\r\n\r\n /// \r\n /// Represents a set of methods for creating instances of the \r\n /// provider's implementation of the data source classes.\r\n /// \r\n public class EffortProviderFactory : DbProviderFactory, IServiceProvider\r\n {\r\n /// \r\n /// Provides a singleton instance of the class.\r\n /// \r\n public static readonly EffortProviderFactory Instance = new EffortProviderFactory();\r\n\r\n /// \r\n /// Prevents a default instance of the class\r\n /// from being created.\r\n /// \r\n private EffortProviderFactory()\r\n {\r\n }\r\n\r\n /// \r\n /// Returns a new instance of the class.\r\n /// \r\n /// \r\n /// A new instance of .\r\n /// \r\n public override DbConnection CreateConnection()\r\n {\r\n return new EffortConnection();\r\n }\r\n\r\n /// \r\n /// Gets the service object of the specified type.\r\n /// \r\n /// \r\n /// An object that specifies the type of service object to get.\r\n /// \r\n /// \r\n /// A service object of type .-or- null if there is\r\n /// no service object of type .\r\n /// \r\n public object GetService(Type serviceType)\r\n {\r\n if (serviceType == typeof(DbProviderServices))\r\n {\r\n return EffortProviderServices.Instance;\r\n }\r\n\r\n return null;\r\n }\r\n }\r\n}\r\n", "meta": {"content_hash": "767841cdd80110458b083c02f09c4e70", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 96, "avg_line_length": 42.023809523809526, "alnum_prop": 0.5781869688385269, "repo_name": "wertzui/effort", "id": "62bcbbc5cb1dad86155bd8a97196855269b6d236", "size": "3532", "binary": false, "copies": "3", "ref": "refs/heads/develop", "path": "Main/Source/Effort/Provider/EffortProviderFactory.cs", "mode": "33188", "license": "mit", "language": [{"name": "Batchfile", "bytes": "1104"}, {"name": "C#", "bytes": "2446943"}]}}
{"text": "import { VGrid } from '../v-grid';\nimport { BindingContextInterface, OverrideContextInterface } from '../../interfaces';\nexport declare class VGridAttributesImageFix {\n private vGrid;\n private element;\n private value;\n private bindingContext;\n private overrideContext;\n constructor(element: HTMLImageElement, vGrid: VGrid);\n valueChanged(newValue: string): void;\n bind(bindingContext: BindingContextInterface, overrideContext: OverrideContextInterface): void;\n}\n", "meta": {"content_hash": "288050943bddd389f02d6c1488f7c9da", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 99, "avg_line_length": 40.5, "alnum_prop": 0.7551440329218106, "repo_name": "vegarringdal/vGrid", "id": "7a892151b3f517aeff4464ab7de2c01ac475f8d0", "size": "486", "binary": false, "copies": "4", "ref": "refs/heads/dev-rebuild", "path": "dist/es2015/grid/attributes/v-image.d.ts", "mode": "33188", "license": "mit", "language": [{"name": "CSS", "bytes": "24447"}, {"name": "HTML", "bytes": "19771"}, {"name": "JavaScript", "bytes": "7057"}, {"name": "TypeScript", "bytes": "1639454"}]}}
{"text": "layout: page\ntitle: Cliffs Tech Executive Retreat\ndate: 2016-05-24\nauthor: Beverly Snyder\ntags: weekly links, java\nstatus: published\nsummary: Vivamus sed ligula quis mi cursus venenatis sed sed nunc.\nbanner: images/banner/people.jpg\nbooking:\n startDate: 05/29/2018\n endDate: 05/31/2018\n ctyhocn: HSTFLHX\n groupCode: CTER\npublished: true\n---\nMauris id odio eget libero fermentum egestas vel vitae ligula. Suspendisse vestibulum ipsum sem, vel ornare ex lacinia ac. Etiam a sem auctor, dignissim tellus vitae, consequat arcu. Cras rutrum lorem metus, sed lacinia nunc sollicitudin non. Praesent quam mi, aliquet ut lorem at, dictum faucibus ante. Vivamus sit amet ligula vulputate, sollicitudin arcu at, ullamcorper elit. Aenean aliquet molestie tincidunt. Nulla sed lectus diam. Donec gravida enim ut lorem blandit, sed ultricies arcu auctor. Donec odio ante, fringilla id lacus vel, sagittis dignissim elit. Duis mattis turpis tellus, at pulvinar leo commodo at. Etiam in lectus odio. Curabitur ipsum nisi, tincidunt eu ligula ac, cursus pellentesque lacus. Quisque enim sem, tempor non convallis maximus, semper id nisl. Donec eu sapien vel sapien posuere semper. Cras nisi justo, rhoncus ac urna at, cursus scelerisque libero.\n\n1 Proin bibendum tortor at ipsum commodo, vel gravida elit pretium\n1 Phasellus tincidunt lorem vitae elit ultrices, id volutpat mi fermentum\n1 Nunc interdum orci vel lobortis sodales.\n\nPraesent at risus ipsum. Morbi mattis blandit mauris, in fermentum nibh condimentum ut. In mattis risus et diam sagittis euismod. Sed vel dolor id dui dapibus viverra. Praesent efficitur ut quam et auctor. Sed venenatis convallis ex, nec vulputate est tincidunt vitae. In pulvinar faucibus odio, eu viverra tortor pharetra iaculis. Nunc cursus sagittis mauris, at blandit nisi auctor eget. Sed mollis diam eu volutpat pulvinar. In a luctus felis. Integer lobortis purus id lacus porta rutrum. Etiam sit amet lobortis magna. Nulla id libero convallis, luctus lorem ac, fermentum orci. Integer vel maximus sapien, non blandit sapien. Vivamus a tempus purus.\n", "meta": {"content_hash": "43f9f6179677a71fbbce864c5125cf6a", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 887, "avg_line_length": 94.31818181818181, "alnum_prop": 0.8043373493975904, "repo_name": "KlishGroup/prose-pogs", "id": "6f3c04ea1edb8b269359b353872dd5964911f4eb", "size": "2079", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "pogs/H/HSTFLHX/CTER/index.md", "mode": "33188", "license": "mit", "language": []}}
+{"text": "namespace igl\n{\n // Subdivide a mesh without moving vertices: loop subdivision but odd\n // vertices stay put and even vertices are just edge midpoints\n // \n // Templates:\n // MatV matrix for vertex positions, e.g. MatrixXd\n // MatF matrix for vertex positions, e.g. MatrixXi\n // Inputs:\n // V #V by dim mesh vertices\n // F #F by 3 mesh triangles\n // Outputs:\n // NV new vertex positions, V is guaranteed to be at top\n // NF new list of face indices\n //\n // NOTE: V should not be the same as NV,\n // NOTE: F should not be the same as NF, use other proto\n //\n // Known issues:\n // - assumes (V,F) is edge-manifold.\n template <\n typename DerivedV, \n typename DerivedF,\n typename DerivedNV,\n typename DerivedNF>\n IGL_INLINE void upsample(\n const Eigen::PlainObjectBase& V,\n const Eigen::PlainObjectBase& F,\n Eigen::PlainObjectBase& NV,\n Eigen::PlainObjectBase& NF);\n // Virtually in place wrapper\n template <\n typename MatV, \n typename MatF>\n IGL_INLINE void upsample(\n MatV& V,\n MatF& F);\n}\n\n#ifndef IGL_STATIC_LIBRARY\n# include \"upsample.cpp\"\n#endif\n\n#endif\n", "meta": {"content_hash": "a1cdb7cff1bb173dd9cbbff48005f1e2", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 71, "avg_line_length": 26.772727272727273, "alnum_prop": 0.6612903225806451, "repo_name": "FabianRepository/SinusProject", "id": "5ca05336dfac2db8a87a07b48ee4c4d7219d853e", "size": "1710", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "Code/include/igl/upsample.h", "mode": "33188", "license": "bsd-3-clause", "language": [{"name": "C", "bytes": "1822674"}, {"name": "C++", "bytes": "11420706"}, {"name": "CMake", "bytes": "20858"}, {"name": "Makefile", "bytes": "4050"}, {"name": "Objective-C", "bytes": "11880"}, {"name": "Shell", "bytes": "15321"}]}}
+{"text": "/*___Generated_by_IDEA___*/\n\npackage com.grafixartist.androidn;\n\n/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */\npublic final class BuildConfig {\n public final static boolean DEBUG = Boolean.parseBoolean(null);\n}", "meta": {"content_hash": "26542977f302c1033ce570a5d275b19c", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 101, "avg_line_length": 33.375, "alnum_prop": 0.7490636704119851, "repo_name": "Suleiman19/Android-N-Sample", "id": "3f2817dcd993334f72e2c9570e2c1671e560df79", "size": "267", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gen/com/grafixartist/androidn/BuildConfig.java", "mode": "33188", "license": "mit", "language": [{"name": "Java", "bytes": "10473"}]}}
+{"text": "fieldhandler = $fieldhandler;\n $this->database_prefix = $database_prefix;\n }\n\n /**\n * Get SQL\n *\n * At this point, all values have been input, filtered and set in element-specific item arrays\n * Now, generate the full SQL statement, building the SQL statement and quoting/escaping data\n *\n * @param null|string $sql\n *\n * @return string\n * @since 1.0.0\n */\n public function getSql($sql = null)\n {\n if ($sql === null || trim($sql) === '') {\n $this->generateSql();\n } else {\n $this->sql = '';\n $this->getExternalSql($sql);\n }\n\n return $this->sql;\n }\n\n /**\n * Get the current value (or default) of the specified property\n *\n * @param string $key `````\n * @param mixed $default\n *\n * @return mixed\n * @since 1.0.0\n */\n public function get($key, $default = null)\n {\n if ($this->$key === null) {\n $this->$key = $default;\n }\n\n return $this->$key;\n }\n\n /**\n * Clear Query String\n *\n * @return $this\n * @since 1.0.0\n */\n public function clearQuery()\n {\n $this->query_type = 'select';\n $this->distinct = false;\n $this->columns = array();\n $this->update_columns = array();\n $this->values = array();\n $this->from = array();\n $this->insert_into_table = null;\n $this->where_group = array();\n $this->where = array();\n $this->group_by = array();\n $this->having_group = array();\n $this->having = array();\n $this->query_object = 'list';\n $this->order_by = array();\n $this->use_pagination = 0;\n $this->offset = 0;\n $this->limit = 0;\n $this->sql = '';\n\n return $this;\n }\n\n /**\n * Set Query Type\n *\n * @param string $query_type\n *\n * @return $this\n * @since 1.0.0\n */\n public function setType($query_type = 'select')\n {\n if (in_array(strtolower($query_type), $this->query_type_array)) {\n $this->query_type = strtolower($query_type);\n } else {\n $this->query_type = 'select';\n }\n\n return $this;\n }\n\n /**\n * Retrieves the current date and time formatted in a manner compliant with the database driver\n *\n * @return string\n * @since 1.0.0\n */\n public function getDate()\n {\n $date = new DateTime();\n\n return $date->format($this->date_format);\n }\n\n /**\n * Returns a value for null date that is compliant with the database driver\n *\n * @return string\n * @since 1.0.0\n */\n public function getNullDate()\n {\n return $this->null_date;\n }\n\n /**\n * Retrieves the PHP date format compliant with the database driver\n *\n * @return string\n * @since 1.0.0\n */\n public function getDateFormat()\n {\n return $this->date_format;\n }\n\n /**\n * Set Distinct Indicator\n *\n * @param boolean $distinct\n *\n * @return $this\n * @since 1.0.0\n */\n public function setDistinct($distinct = false)\n {\n if ($distinct === true) {\n $this->distinct = true;\n } else {\n $this->distinct = false;\n }\n\n return $this;\n }\n\n /**\n * Used for select, insert, and update to specify column name, alias (optional)\n * For Insert and Update, only, value and data_type\n *\n * @param string $column_name\n * @param null|string $alias\n * @param null|mixed $value\n * @param null|string $data_type\n *\n * @return $this\n * @since 1.0.0\n */\n public function select($column_name, $alias = null, $value = null, $data_type = null)\n {\n $this->editRequired('column_name', $column_name);\n\n if ($data_type === 'special') {\n } else {\n if ($value === null) {\n $data_type = 'column';\n }\n }\n\n $this->columns[$column_name]\n = $this->setItem($column_name, $data_type, $value, $alias, null, false);\n\n return $this;\n }\n\n /**\n * Set From table name and optional value for alias\n *\n * @param string $table_name\n * @param null|string $alias\n * @param boolean $primary\n *\n * @return $this\n * @since 1.0.0\n */\n public function from($table_name, $alias = null, $primary = false)\n {\n $this->editRequired('table_name', $table_name);\n\n $key = $this->setFromKey($table_name, $alias);\n\n $this->from[$key] = $this->setItem($table_name, 'string', null, $alias, null, false);\n\n if ($this->findFromPrimary() === true && $primary === false) {\n return $this;\n }\n\n $this->setFromPrimary($key);\n\n return $this;\n }\n\n /**\n * Set Insert Into Table Name\n *\n * @param string $table_name\n *\n * @return $this\n * @since 1.0.0\n */\n public function setInsertInto($table_name)\n {\n $this->editRequired('table_name', $table_name);\n\n $this->insert_into_table = (string)$table_name;\n\n return $this;\n }\n\n /**\n * Set From table key\n *\n * @param string $table_name\n * @param null|string $alias\n *\n * @return $this\n * @since 1.0.0\n */\n public function setFromKey($table_name, $alias = null)\n {\n return ($table_name . ' ' . $alias);\n }\n\n /**\n * Create a grouping for 'and' or 'or' groups of where conditions\n *\n * @param string $group\n * @param string $group_connector\n *\n * @return $this\n * @since 1.0.0\n */\n public function whereGroup($group, $group_connector = 'AND')\n {\n $this->where_group\n = $this->setGroup($group, $group_connector, 'where', $this->where_group);\n\n return $this;\n }\n\n /**\n * Create a grouping for 'and' or 'or' groups of having conditions\n *\n * @param string $group\n * @param string $group_connector\n *\n * @return $this\n * @since 1.0.0\n */\n public function havingGroup($group, $group_connector = 'AND')\n {\n $this->having_group\n = $this->setGroup($group, $group_connector, 'having', $this->having_group);\n\n return $this;\n }\n\n /**\n * Set Where Conditions for Query\n *\n * @param string $left_filter\n * @param string $left\n * @param string $condition\n * @param string $right_filter\n * @param string $right\n * @param string $connector\n * @param null|string $group\n *\n * @return $this\n * @since 1.0.0\n */\n public function where(\n $left_filter = 'column',\n $left = '',\n $condition = '',\n $right_filter = 'column',\n $right = '',\n $connector = 'and',\n $group = null\n ) {\n $item = $this->setLeftRightConditionals(\n $left_filter,\n $left,\n $condition,\n $right_filter,\n $right,\n $connector,\n $group\n );\n\n $this->where[] = $item;\n\n return $this;\n }\n\n /**\n * Set Having Conditions for Query\n *\n * @param string $left_filter\n * @param string $left\n * @param string $condition\n * @param string $right_filter\n * @param string $right\n * @param string $connector\n * @param null|string $group\n *\n * @return $this\n * @since 1.0.0\n */\n public function having(\n $left_filter = 'column',\n $left = '',\n $condition = '',\n $right_filter = 'column',\n $right = '',\n $connector = 'and',\n $group = null\n ) {\n $item = $this->setLeftRightConditionals(\n $left_filter,\n $left,\n $condition,\n $right_filter,\n $right,\n $connector,\n $group\n );\n\n $this->having[] = $item;\n\n return $this;\n }\n\n /**\n * Group By column name\n *\n * @param string $column_name\n *\n * @return $this\n * @since 1.0.0\n */\n public function groupBy($column_name)\n {\n $this->group_by[] = $this->setGroupByOrderBy($column_name, 'group by');\n\n return $this;\n }\n\n /**\n * Order By column name\n *\n * @param string $column_name\n * @param null|string $direction\n *\n * @return $this\n * @since 1.0.0\n */\n public function orderBy($column_name, $direction = 'ASC')\n {\n $this->order_by[] = $this->setGroupByOrderBy($column_name, 'order by', $direction);\n\n return $this;\n }\n\n /**\n * Offset and Limit\n *\n * @param int $offset\n * @param int $limit\n *\n * @return $this\n * @since 1.0.0\n */\n public function setOffsetAndLimit($offset = 0, $limit = 0)\n {\n $this->setOffsetOrLimit($offset, $type = 'offset');\n $this->setOffsetOrLimit($limit, $type = 'limit');\n\n return $this;\n }\n}\n", "meta": {"content_hash": "4cba7c7b8d58f8f451db992b967927b1", "timestamp": "", "source": "github", "line_count": 423, "max_line_length": 99, "avg_line_length": 23.6903073286052, "alnum_prop": 0.4923660313341982, "repo_name": "Molajo/Query", "id": "35418dea65445de82454beeae6395b58c24ef1b5", "size": "10218", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Source/Query/Builder/Sql.php", "mode": "33188", "license": "mit", "language": [{"name": "PHP", "bytes": "512092"}]}}
+{"text": "\n\npackage org.apache.beam.sdk.extensions.sql.impl.interpreter.operator.math;\n\nimport java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.List;\nimport org.apache.beam.sdk.extensions.sql.impl.interpreter.BeamSqlFnExecutorTestBase;\nimport org.apache.beam.sdk.extensions.sql.impl.interpreter.operator.BeamSqlExpression;\nimport org.apache.beam.sdk.extensions.sql.impl.interpreter.operator.BeamSqlPrimitive;\nimport org.apache.calcite.sql.type.SqlTypeName;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n * Test for {@link BeamSqlMathUnaryExpression}.\n */\npublic class BeamSqlMathUnaryExpressionTest extends BeamSqlFnExecutorTestBase {\n\n @Test public void testForGreaterThanOneOperands() {\n List operands = new ArrayList<>();\n\n // operands more than 1 not allowed\n operands.add(BeamSqlPrimitive.of(SqlTypeName.INTEGER, 2));\n operands.add(BeamSqlPrimitive.of(SqlTypeName.INTEGER, 4));\n Assert.assertFalse(new BeamSqlAbsExpression(operands).accept());\n }\n\n @Test public void testForOperandsType() {\n List operands = new ArrayList<>();\n\n // varchar operand not allowed\n operands.add(BeamSqlPrimitive.of(SqlTypeName.VARCHAR, \"2\"));\n Assert.assertFalse(new BeamSqlAbsExpression(operands).accept());\n }\n\n @Test public void testForUnaryExpressions() {\n List operands = new ArrayList<>();\n\n // test for sqrt function\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n\n // test for abs function\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.BIGINT, -28965734597L));\n Assert.assertEquals(28965734597L,\n new BeamSqlAbsExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForLnExpression() {\n List operands = new ArrayList<>();\n\n // test for LN function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Math.log(2),\n new BeamSqlLnExpression(operands).evaluate(record, null).getValue());\n\n // test for LN function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert\n .assertEquals(Math.log(2.4),\n new BeamSqlLnExpression(operands).evaluate(record, null).getValue());\n // test for LN function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(Math.log(2.56),\n new BeamSqlLnExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForLog10Expression() {\n List operands = new ArrayList<>();\n\n // test for log10 function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Math.log10(2),\n new BeamSqlLogExpression(operands).evaluate(record, null).getValue());\n // test for log10 function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert.assertEquals(Math.log10(2.4),\n new BeamSqlLogExpression(operands).evaluate(record, null).getValue());\n // test for log10 function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(Math.log10(2.56),\n new BeamSqlLogExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForExpExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Math.exp(2),\n new BeamSqlExpExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert.assertEquals(Math.exp(2.4),\n new BeamSqlExpExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(Math.exp(2.56),\n new BeamSqlExpExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForAcosExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Double.NaN,\n new BeamSqlAcosExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 0.45));\n Assert.assertEquals(Math.acos(0.45),\n new BeamSqlAcosExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(-0.367)));\n Assert.assertEquals(Math.acos(-0.367),\n new BeamSqlAcosExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForAsinExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type double\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 0.45));\n Assert.assertEquals(Math.asin(0.45),\n new BeamSqlAsinExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(-0.367)));\n Assert.assertEquals(Math.asin(-0.367),\n new BeamSqlAsinExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForAtanExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type double\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 0.45));\n Assert.assertEquals(Math.atan(0.45),\n new BeamSqlAtanExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(-0.367)));\n Assert.assertEquals(Math.atan(-0.367),\n new BeamSqlAtanExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForCosExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type double\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 0.45));\n Assert.assertEquals(Math.cos(0.45),\n new BeamSqlCosExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(-0.367)));\n Assert.assertEquals(Math.cos(-0.367),\n new BeamSqlCosExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForCotExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type double\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, .45));\n Assert.assertEquals(1.0d / Math.tan(0.45),\n new BeamSqlCotExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(-.367)));\n Assert.assertEquals(1.0d / Math.tan(-0.367),\n new BeamSqlCotExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForDegreesExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Math.toDegrees(2),\n new BeamSqlDegreesExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert.assertEquals(Math.toDegrees(2.4),\n new BeamSqlDegreesExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(Math.toDegrees(2.56),\n new BeamSqlDegreesExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForRadiansExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Math.toRadians(2),\n new BeamSqlRadiansExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert.assertEquals(Math.toRadians(2.4),\n new BeamSqlRadiansExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(Math.toRadians(2.56),\n new BeamSqlRadiansExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForSinExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Math.sin(2),\n new BeamSqlSinExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert.assertEquals(Math.sin(2.4),\n new BeamSqlSinExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(Math.sin(2.56),\n new BeamSqlSinExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForTanExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals(Math.tan(2),\n new BeamSqlTanExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert.assertEquals(Math.tan(2.4),\n new BeamSqlTanExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(Math.tan(2.56),\n new BeamSqlTanExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForSignExpression() {\n List operands = new ArrayList<>();\n\n // test for exp function with operand type smallint\n operands.add(BeamSqlPrimitive.of(SqlTypeName.SMALLINT, Short.valueOf(\"2\")));\n Assert.assertEquals((short) 1\n , new BeamSqlSignExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type double\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.4));\n Assert.assertEquals(1.0, new BeamSqlSignExpression(operands).evaluate(record, null).getValue());\n // test for exp function with operand type decimal\n operands.clear();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DECIMAL, BigDecimal.valueOf(2.56)));\n Assert.assertEquals(BigDecimal.ONE,\n new BeamSqlSignExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForPi() {\n Assert.assertEquals(Math.PI, new BeamSqlPiExpression().evaluate(record, null).getValue());\n }\n\n @Test public void testForCeil() {\n List operands = new ArrayList<>();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.68687979));\n Assert.assertEquals(Math.ceil(2.68687979),\n new BeamSqlCeilExpression(operands).evaluate(record, null).getValue());\n }\n\n @Test public void testForFloor() {\n List operands = new ArrayList<>();\n operands.add(BeamSqlPrimitive.of(SqlTypeName.DOUBLE, 2.68687979));\n Assert.assertEquals(Math.floor(2.68687979),\n new BeamSqlFloorExpression(operands).evaluate(record, null).getValue());\n }\n\n}\n", "meta": {"content_hash": "0f912d403eeb23eb9c577b43291462b1", "timestamp": "", "source": "github", "line_count": 296, "max_line_length": 100, "avg_line_length": 44.7195945945946, "alnum_prop": 0.72675077434464, "repo_name": "wangyum/beam", "id": "d80a67071e9aebc3146dcaa4f1479f5802c1f00f", "size": "14042", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/impl/interpreter/operator/math/BeamSqlMathUnaryExpressionTest.java", "mode": "33188", "license": "apache-2.0", "language": [{"name": "Go", "bytes": "109377"}, {"name": "Groovy", "bytes": "84452"}, {"name": "Java", "bytes": "14117162"}, {"name": "Python", "bytes": "3165393"}, {"name": "Shell", "bytes": "55385"}]}}
+{"text": "set -e\ngit clone https://github.com/nanomsg/nnpy.git\n# top of tree won't install\ncd nnpy\ngit checkout c7e718a5173447c85182dc45f99e2abcf9cd4065\nsudo pip install cffi\nsudo pip install .\ncd ..\n", "meta": {"content_hash": "2df4b09d1debc62ee0178e0ebf554c12", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 53, "avg_line_length": 23.75, "alnum_prop": 0.7947368421052632, "repo_name": "hanw/behavioral-model", "id": "77a7d63afe47a1741d549f97580015fe9cbc31ca", "size": "200", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "travis/install-nnpy.sh", "mode": "33188", "license": "apache-2.0", "language": [{"name": "C", "bytes": "93627"}, {"name": "C++", "bytes": "2126481"}, {"name": "M4", "bytes": "69750"}, {"name": "Makefile", "bytes": "44234"}, {"name": "P4", "bytes": "37531"}, {"name": "Python", "bytes": "271835"}, {"name": "Ruby", "bytes": "5182"}, {"name": "Shell", "bytes": "11424"}, {"name": "Thrift", "bytes": "25904"}]}}
+{"text": "\npackage au.net.zeus.rmi.tls;\n\nimport java.net.Socket;\nimport java.security.AccessController;\nimport java.security.GeneralSecurityException;\nimport java.security.NoSuchAlgorithmException;\nimport java.security.NoSuchProviderException;\nimport java.security.Principal;\nimport java.security.cert.CertPath;\nimport java.security.cert.CertificateException;\nimport java.security.cert.X509Certificate;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\nimport javax.security.auth.Subject;\nimport javax.security.auth.x500.X500PrivateCredential;\nimport net.jini.io.UnsupportedConstraintException;\nimport net.jini.security.AuthenticationPermission;\nimport org.apache.river.logging.Levels;\n\n/**\n *\n * @author peter\n */\nclass ClientSubjectKeyManager extends SubjectKeyManager {\n /** Client logger */\n private static final Logger logger = CLIENT_LOGGER;\n \n \n /** Returns the client logger */\n Logger getLogger() {\n\treturn logger;\n }\n \n ClientSubjectKeyManager(Subject subject) throws NoSuchAlgorithmException, NoSuchProviderException {\n\tsuper(subject);\n }\n\n @Override\n public String[] getClientAliases(String keyType, Principal[] issuers) {\n\tList certPaths = getCertificateChains(getSubject());\n\tif (certPaths == null) {\n\t return null;\n\t}\n\tCollection result = null;\n\tfor (int i = certPaths.size(); --i >= 0;) {\n\t CertPath chain = (CertPath) certPaths.get(i);\n\t Exception exception;\n\t try {\n\t\tif (checkChain(chain, keyType, issuers) != null) {\n\t\t if (result == null) {\n\t\t\tresult = new ArrayList(certPaths.size());\n\t\t }\n\t\t result.add(getCertificateName(firstX509Cert(chain)));\n\t\t}\n\t\tcontinue;\n\t } catch (SecurityException e) {\n\t\texception = e;\n\t } catch (GeneralSecurityException ex) {\n\t\texception = ex;\n\t }\n\t Logger logger = Logger.getLogger(SubjectKeyManager.class.getName());\n\t if (logger.isLoggable(Levels.HANDLED)) {\n\t\tlogger.log(Levels.HANDLED, \"Swallowed SecurityException thrown\", exception);\n\t }\n\t}\n\tif (result == null) {\n\t return null;\n\t} else {\n\t return (String[]) result.toArray(new String[result.size()]);\n\t}\n }\n\n @Override\n public synchronized String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket) {\n\t/*\n\t * Only choose new client credentials for the first handshake.\n\t * Otherwise, just use the previous client credentials.\n\t */\n\tif (clientCredential == null) {\n\t for (String keyType : keyTypes) {\n\t\ttry {\n\t\t if (exceptionMap.get(keyType) != null) {\n\t\t\t// Prior exception found for keytype\n\t\t\treturn null;\n\t\t }\n\n\t\t clientCredential = chooseCredential(keyType, issuers);\n\t\t if (clientCredential != null) {\n // clientCredential found\n\t\t\texceptionMap.put(keyType, null);\n\t\t\tbreak;\n \n } else {\n\t\t\texceptionMap.put(keyType,\n new GeneralSecurityException(\"Credentials not found\"));\n\t\t }\n\t\t continue;\n \n\t\t} catch (GeneralSecurityException e) {\n\t\t exceptionMap.put(keyType, e);\n\t\t} catch (SecurityException e) {\n\t\t exceptionMap.put(keyType, e);\n\t\t}\n\t }\n\t if (clientCredential == null) {\n\t\treturn null;\n\t }\n\t}\n \n\tX509Certificate cert = clientCredential.getCertificate();\n\tclientPrincipal = cert.getSubjectX500Principal();\n\tcredentialsValidUntil = Math.min(credentialsValidUntil, certificatesValidUntil(getCertificateChain(getSubject(), cert)));\n\tauthenticationPermission = getAuthenticationPermission(cert);\n\tString result = getCertificateName(clientCredential.getCertificate());\n\t\tif (logger.isLoggable(Level.FINE)) {\n\t\t logger.log(\n\t\t\tLevel.FINE,\n\t\t\t\"choose client alias for key types {0}\\nand issuers {1}\\n\" +\n\t\t\t\"returns {2}\",\n\t\t\tnew Object[] { toString(keyTypes), toString(issuers), result });\n\t\t}\n\treturn result;\n }\n\n /* -- X500TrustManager -- */\n /**\n * Override this X509TrustManager method in order to cache the server\n * principal and to continue to choose the same one.\n */\n @Override\n public synchronized void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {\n\tsuper.checkServerTrusted(chain, authType);\n\tif (serverPrincipal == null) {\n\t serverCredential = chain[0];\n\t serverPrincipal = serverCredential.getSubjectX500Principal();\n\t setPermittedRemotePrincipals(Collections.singleton(serverPrincipal));\n\t credentialsValidUntil = certificatesValidUntil(chain);\n\t} else if (!serverCredential.equals(chain[0])) {\n\t throw new CertificateException(\"Server credentials changed\");\n\t}\n }\n\n @Override\n public String[] getServerAliases(String arg0, Principal[] arg1) {\n\treturn null;\n }\n\n @Override\n public String chooseServerAlias(String arg0, Principal[] arg1, Socket arg2) {\n\treturn null;\n }\n\n /**\n * Returns the permission needed to connect to the last server principal\n * with the specified client certificate.\n */\n AuthenticationPermission getAuthenticationPermission(X509Certificate cert) {\n\tSet client = Collections.singleton(cert.getSubjectX500Principal());\n\tSet server = (serverPrincipal == null) ? null : Collections.singleton(serverPrincipal);\n\treturn new AuthenticationPermission(client, server, \"connect\");\n }\n\n /**\n * Gets the private credential for the specified X.509 certificate,\n * checking for AuthenticationPermission to connect with the last server\n * principal.\n *\n * @param cert the certificate for the local principal\n * @return the associated private credential or null if not found\n * @throws SecurityException if the access control context does not have\n *\t the proper AuthenticationPermission\n */\n @Override\n synchronized X500PrivateCredential getPrivateCredential(X509Certificate cert) {\n\treturn getPrivateCredential(cert, getAuthenticationPermission(cert));\n }\n\n /**\n * Gets the private credential for the specified X.509 certificate,\n * checking for the specified AuthenticationPermission.\n *\n * @param cert the certificate for the local principal\n * @param ap the permission needed to connect to the peer\n * @return the associated private credential or null if not found\n * @throws SecurityException if the access control context does not have\n *\t the proper AuthenticationPermission\n */\n protected X500PrivateCredential getPrivateCredential(X509Certificate cert, AuthenticationPermission ap) {\n\tSubject subject = getSubject();\n\tif (subject == null) {\n\t return null;\n\t}\n\tSecurityManager sm = System.getSecurityManager();\n\tif (sm != null) {\n\t sm.checkPermission(ap);\n\t}\n\treturn (X500PrivateCredential) AccessController.doPrivileged(new GetPrivateCredentialAction(subject, cert));\n }\n \n \n /**\n * Checks if the subject still contains the proper credentials, and the\n * current access control context has the proper AuthenticationPermission,\n * to use the current session. Callers should only call this method if\n * client authentication is being used.\n *\n * @throws SecurityException if the access control context does not have\n *\t the proper AuthenticationPermission\n * @throws UnsupportedConstraintException if the subject does not contain\n *\t the proper credentials\n */\n synchronized void checkAuthentication()\n\tthrows GeneralSecurityException\n {\n\tif (clientCredential == null) {\n\t throw new GeneralSecurityException(\n\t\t\"Client is not authenticated\");\n\t} else if (clientCredential.isDestroyed()) {\n\t throw new GeneralSecurityException(\n\t\t\"Private credentials are destroyed\");\n\t} else if (System.currentTimeMillis() > credentialsValidUntil) {\n\t throw new GeneralSecurityException(\n\t\t\"Certificates are no longer valid\");\n\t}\n\tif (subjectIsReadOnly) {\n\t SecurityManager sm = System.getSecurityManager();\n\t if (sm != null) {\n\t\tsm.checkPermission(authenticationPermission);\n\t }\n\t} else {\n\t Subject subject = getSubject();\n\t X509Certificate cert = clientCredential.getCertificate();\n\t if (getPrincipal(subject, cert) == null) {\n\t\tthrow new GeneralSecurityException(\"Missing principal\");\n\t }\n\t CertPath chain =\n\t\tgetCertificateChain(subject, cert);\n\t if (chain == null) {\n\t\tthrow new GeneralSecurityException(\n\t\t \"Missing public credentials\");\n\t }\n\t X500PrivateCredential pc = getPrivateCredential(\n\t\tcert, authenticationPermission);\n\t if (pc == null) {\n\t\tthrow new GeneralSecurityException(\n\t\t \"Missing private credentials\");\n\t } else if (!equalPrivateCredentials(clientCredential, pc)) {\n\t\tthrow new GeneralSecurityException(\n\t\t \"Wrong private credentials\");\n\t }\n\t}\n }\n}\n", "meta": {"content_hash": "527a69c207200fca5e44fa300086269f", "timestamp": "", "source": "github", "line_count": 259, "max_line_length": 122, "avg_line_length": 33.87258687258687, "alnum_prop": 0.7045480451384931, "repo_name": "pfirmstone/river-internet", "id": "01c4d486d5a17fffaaacedcc4db47435ee148cca", "size": "9363", "binary": false, "copies": "2", "ref": "refs/heads/trunk", "path": "JGDMS/jgdms-rmi-tls/src/main/java/au/net/zeus/rmi/tls/ClientSubjectKeyManager.java", "mode": "33188", "license": "apache-2.0", "language": [{"name": "CSS", "bytes": "2047"}, {"name": "Groff", "bytes": "863"}, {"name": "Groovy", "bytes": "35711"}, {"name": "HTML", "bytes": "4398920"}, {"name": "Java", "bytes": "33660467"}, {"name": "Makefile", "bytes": "3046"}, {"name": "Shell", "bytes": "69126"}]}}
+{"text": "(function(root) {\n\n//------------------------------------------------------------------//\n// Compatibility\n//------------------------------------------------------------------//\n\nvar emptyFn = function() {};\nvar console = root.console || {};\nvar document = root.document;\n\nconsole.error = console.error || emptyFn;\n\nroot.GLOBAL = root;\n\n//------------------------------------------------------------------//\n// Base64 encoding\n//------------------------------------------------------------------//\n\nfunction toBase64Digit(value) {\n\tvar digits =\n\t\t'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +\n\t\t'abcdefghijklmnopqrstuvwxyz' +\n\t\t'0123456789+/';\n\treturn digits[value & 0x3F];\n}\n\nfunction strToUTF8Base64(str) {\n\n\tfunction decodeSurrogatePair(hi, lo) {\n\t\tvar resultChar = 0x010000;\n\t\tresultChar += lo - 0xDC00;\n\t\tresultChar += (hi - 0xD800) << 10;\n\t\treturn resultChar;\n\t}\n\n\tvar bytes = [0, 0, 0];\n\tvar byteIndex = 0;\n\tvar result = [];\n\n\tfunction output(s) {\n\t\tresult.push(s);\n\t}\n\n\tfunction emitBase64() {\n\n\t\tvar toDigit = toBase64Digit;\n\n\t\t// --Byte 0-- --Byte 1-- --Byte 2--\n\t\t// 1111 1122 2222 3333 3344 4444\n\n\t\tvar d1 = toDigit(bytes[0] >> 2);\n\t\tvar d2 = toDigit(\n\t\t\t((bytes[0] & 0x03) << 4) |\n\t\t\t(bytes[1] >> 4));\n\t\tvar d3 = toDigit(\n\t\t\t((bytes[1] & 0x0F) << 2) |\n\t\t\t(bytes[2] >> 6));\n\t\tvar d4 = toDigit(\n\t\t\tbytes[2] & 0x3F);\n\n\t\tif (byteIndex === 1) {\n\t\t\toutput(d1 + d2 + '==');\n\t\t}\n\t\telse if (byteIndex === 2) {\n\t\t\toutput(d1 + d2 + d3 + '=');\n\t\t}\n\t\telse {\n\t\t\toutput(d1 + d2 + d3 + d4);\n\t\t}\n\t}\n\n\tfunction emit(chr) {\n\t\tbytes[byteIndex++] = chr;\n\t\tif (byteIndex === 3) {\n\t\t\temitBase64();\n\t\t\tbytes[0] = 0;\n\t\t\tbytes[1] = 0;\n\t\t\tbytes[2] = 0;\n\t\t\tbyteIndex = 0;\n\t\t}\n\t}\n\n\tfunction emitLast() {\n\t\tif (byteIndex > 0) {\n\t\t\temitBase64();\n\t\t}\n\t}\n\n\t// Converts the string to UTF8:\n\n\tvar i, chr;\n\tvar hi, lo;\n\tfor (i = 0; i < str.length; i++) {\n\t\tchr = str.charCodeAt(i);\n\n\t\t// Test and decode surrogate pairs in the string\n\t\tif (chr >= 0xD800 && chr <= 0xDBFF) {\n\t\t\thi = chr;\n\t\t\tlo = str.charCodeAt(i + 1);\n\t\t\tif (lo >= 0xDC00 && lo <= 0xDFFF) {\n\t\t\t\tchr = decodeSurrogatePair(hi, lo);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\t// Encode the character as UTF-8.\n\t\tif (chr < 0x80) {\n\t\t\temit(chr);\n\t\t}\n\t\telse if (chr < 0x0800) {\n\t\t\temit((chr >> 6) | 0xC0);\n\t\t\temit(((chr >> 0) & 0x3F) | 0x80);\n\t\t}\n\t\telse if (chr < 0x10000) {\n\t\t\temit((chr >> 12) | 0xE0);\n\t\t\temit(((chr >> 6) & 0x3F) | 0x80);\n\t\t\temit(((chr >> 0) & 0x3F) | 0x80);\n\t\t}\n\t\telse if (chr < 0x110000) {\n\t\t\temit((chr >> 18) | 0xF0);\n\t\t\temit(((chr >> 12) & 0x3F) | 0x80);\n\t\t\temit(((chr >> 6) & 0x3F) | 0x80);\n\t\t\temit(((chr >> 0) & 0x3F) | 0x80);\n\t\t}\n\t}\n\n\temitLast();\n\n\treturn result.join('');\n}\n\n// VLQ Base64 encoding used in source maps\n\nfunction toVLQ(value) {\n\n\tvar vlq, result, digit;\n\n\t// The LSB in the encoded result is used to indicate the sign of\n\t// the original value\n\tvlq = value < 0 ? ((-value) << 1) + 1 : (value << 1);\n\n\t// Digits are encoded least significant first.\n\n\tresult = '';\n\tdo {\n\t\t// Each Base64 digit encodes 5 bits. The sixth bit is a\n\t\t// continuation bit.\n\t\tdigit = vlq & 0x1F;\n\t\tvlq = vlq >> 5;\n\t\tdigit = digit | (vlq > 0 ? 0x20 : 0);\n\t\tresult += toBase64Digit(digit);\n\t}\n\twhile (vlq > 0);\n\n\treturn result;\n}\n\n//------------------------------------------------------------------//\n// Source maps\n//------------------------------------------------------------------//\n\nfunction getSourceMap(file, source, lineOffset) {\n\tvar mappings = [];\n\tvar lineCount = source.split(/\\r\\n?|\\n/).length;\n\tvar map;\n\tvar curLine, i;\n\n\tvar lastOriginalLine = 0;\n\tfunction addLineMapping(originalLine) {\n\t\tvar generatedColumn = 0;\n\t\tvar sourceIndex = 0;\n\t\tvar originalColumn = 0;\n\t\tvar segment = [\n\t\t\ttoVLQ(generatedColumn),\n\t\t\ttoVLQ(sourceIndex),\n\t\t\ttoVLQ(originalLine - lastOriginalLine),\n\t\t\ttoVLQ(originalColumn)\n\t\t].join('');\n\t\tlastOriginalLine = originalLine;\n\t\tmappings.push(segment);\n\t}\n\n\tfor (i = 0; i < lineOffset; i++) {\n\t\tmappings.push('');\n\t}\n\n\tfor (i = 0; i < lineCount; i++) {\n\t\taddLineMapping(i);\n\t}\n\n\tmap = [\n\t\t'{',\n\t\t'\"version\":3,',\n\t\t'\"sources\":[',\n\t\tJSON.stringify(file),\n\t\t'],',\n\t\t'\"names\":[],',\n\t\t'\"mappings\":',\n\t\tJSON.stringify(mappings.join(';')),\n\t\t',',\n\t\t'\"sourcesContent\":[',\n\t\tJSON.stringify(source),\n\t\t']',\n\t\t'}'\n\t].join('');\n\n\treturn map;\n}\n\n//------------------------------------------------------------------//\n// Path manipulation\n//------------------------------------------------------------------//\n\nvar basePath = window.location.pathname.replace(/\\/[^\\/]*$/, '');\nvar hrefOrigin = window.location.origin;\n\nfunction concatPath(basePath, path) {\n\tvar baseParts, pathParts, i, it;\n\tvar result = [];\n\n\t// If path is absolute, ignore the base path.\n\tif (path[0] === '/') {\n\t\t// Run the concatPath to normalize path.\n\t\treturn concatPath(path, '');\n\t}\n\n\t// Remove leading and trailing slashes and split the base path.\n\t// Note that basePath is always handled as absolute.\n\tbaseParts = basePath.replace(/^\\/|\\/$/g, '').split('/');\n\n\t// Remove any trailing slash and split the path.\n\tpathParts = path.replace(/^\\/$/, '').split('/');\n\n\t// Append the parts of basePath to the result, solving . and ..\n\t// in the path.\n\tfor (i = 0; i < baseParts.length; i++) {\n\t\tit = baseParts[i];\n\t\tif (it === '.' || (i === 0 && it === '')) {\n\t\t\t// Ignore '.' or an empty part (result of an empty\n\t\t\t// basePath).\n\t\t\tcontinue;\n\t\t}\n\t\telse if (it === '..') {\n\t\t\tresult.pop();\n\t\t}\n\t\telse {\n\t\t\tresult.push(it);\n\t\t}\n\t}\n\n\t// Append the parts of path to the result, again solving . and ..\n\tfor (i = 0; i < pathParts.length; i++) {\n\t\tit = pathParts[i];\n\t\tif (it === '.' || it === '') {\n\t\t\t// Ignore '.' or an empty part (result of an empty path).\n\t\t\tcontinue;\n\t\t}\n\t\telse if (it === '..') {\n\t\t\tresult.pop();\n\t\t}\n\t\telse {\n\t\t\tresult.push(it);\n\t\t}\n\t}\n\n\treturn '/' + result.join('/');\n}\n\nfunction solvePossiblePaths(path, relativeTo) {\n\tvar isRelative = /^(\\.){0,2}\\//.test(path);\n\tvar possiblePaths = [];\n\tvar basePath, curPath;\n\n\tif (!/\\.js/i.test(path)) {\n\t\tpath += '.js';\n\t}\n\n\tif (isRelative) {\n\t\tcurPath = concatPath(relativeTo, path);\n\t\tpossiblePaths.push(curPath);\n\t}\n\telse {\n\t\tbasePath = relativeTo;\n\t\twhile (true) {\n\t\t\tcurPath = concatPath(basePath, 'node_modules');\n\t\t\tcurPath = concatPath(curPath, path);\n\t\t\tif (possiblePaths.indexOf(curPath) >= 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpossiblePaths.push(curPath);\n\t\t\t}\n\t\t\tbasePath = concatPath(basePath, '..');\n\t\t}\n\t}\n\n\treturn possiblePaths;\n}\n\n//------------------------------------------------------------------//\n// Ajax request\n//------------------------------------------------------------------//\n\nvar requestCache = {};\nvar pendingRequests = {};\n\nfunction sendRequest(path, callback) {\n\tvar request, pending;\n\n\t// Check for a cached result\n\tif (requestCache[path]) {\n\t\tsetTimeout(function() {\n\t\t\tcallback(requestCache[path]);\n\t\t}, 0);\n\t\treturn;\n\t}\n\telse if (pendingRequests[path]) {\n\t\tpendingRequests[path].callbacks.push(callback);\n\t\treturn;\n\t}\n\n\t// If the request is not on the cache, makes the Ajax request:\n\n\tif (root.XMLHttpRequest) {\n\t\trequest = new root.XMLHttpRequest();\n\t}\n\telse if (root.ActiveXObject) {\n\t\trequest = new root.ActiveXObject('Microsoft.XMLHTTP');\n\t}\n\n\tpending = pendingRequests[path] = { callbacks: [callback] };\n\n\trequest.onreadystatechange = function() {\n\t\tvar response, callbacks, i, cb;\n\t\tif (request.readyState === 4) {\n\t\t\trequestCache[path] = response = parseResponse(request);\n\t\t\tresponse.originPath = path;\n\t\t\tcallbacks = pendingRequests[path].callbacks;\n\t\t\tdelete pendingRequests[path];\n\t\t\tfor (i = 0; i < callbacks.length; i++) {\n\t\t\t\tcb = callbacks[i];\n\t\t\t\tcb(response);\n\t\t\t}\n\t\t}\n\t};\n\n\trequest.open('GET', path, true);\n\trequest.send(null);\n}\n\nfunction parseResponse(request) {\n\tvar result = {};\n\tif (request.status === 200) {\n\t\tresult.success = true;\n\t\tresult.source = request.responseText;\n\t}\n\telse if (request.status === 404) {\n\t\tresult.success = false;\n\t\tresult.notFound = true;\n\t\tresult.error = 'Not found (404)';\n\t}\n\telse {\n\t\tresult.success = false;\n\t\tresult.error = 'Server error (' + request.status + ')';\n\t}\n\treturn result;\n}\n\n//------------------------------------------------------------------//\n// Module loading\n//------------------------------------------------------------------//\n\nvar pending = [];\nvar moduleMap = {};\nvar moduleError = {};\nvar execOrder = [];\n\nfunction getRequires(source) {\n\tvar len;\n\tvar lines;\n\tvar i, it, match;\n\tvar requires = [];\n\n\t// Strips multiline comments from source.\n\tdo {\n\t\tlen = source.length;\n\t\tsource = source.replace(/\\/\\*([^\\*]|\\*(?!\\/))*(\\*\\/|$)/, '');\n\t}\n\twhile (len !== source.length);\n\n\tlines = source.split(/\\r\\n?|\\n/);\n\tfor (i = 0; i < lines.length; i++) {\n\t\tit = lines[i];\n\t\tit = it.replace(/^\\s*((?:var)?\\s*(?:\\w+\\s*=))?\\s*/, '');\n\t\tmatch = it.match(\n\t\t\t/^require\\s*\\(\\s*(\\'|\\\")((?:(?!\\1).)+)\\1\\s*\\)\\s*(;|$)/);\n\t\tif (match) {\n\t\t\trequires.push(match[2]);\n\t\t}\n\t}\n\n\treturn requires;\n}\n\nfunction loadModule(response, request, callback) {\n\tvar originPath = response.originPath;\n\tvar pendingIndex = pending.indexOf(request);\n\tvar module;\n\tvar requireCount = 0;\n\tvar requires, i, it;\n\n\tfunction callCallbackWhenOver() {\n\t\tif (requireCount <= 0 && typeof callback === 'function') {\n\t\t\tcallback(module, request);\n\t\t}\n\t}\n\n\tfunction onRequiredLoaded(depModule, depRequest) {\n\t\tmodule.dependencies.push(depModule.path);\n\t\tmodule.requireMap[depRequest.path] = depModule.path;\n\t\trequireCount -= 1;\n\t\tcallCallbackWhenOver();\n\t}\n\n\tpending.splice(pendingIndex, 1);\n\n\tmodule = moduleMap[originPath];\n\tif (!module) {\n\t\tmodule = moduleMap[originPath] = {\n\t\t\tpath: originPath,\n\t\t\tbasePath: concatPath(originPath, '..'),\n\t\t\terror: response.success ? false : response.error,\n\t\t\trequest: request,\n\t\t\tresponse: response,\n\t\t\tsource: response.source,\n\t\t\tdependencies: [],\n\t\t\trequireMap: {},\n\t\t\tmoduleObject: {\n\t\t\t\texports: {}\n\t\t\t}\n\t\t};\n\n\t\tif (!module.error) {\n\t\t\trequires = module.requires = getRequires(module.source);\n\t\t\trequireCount = requires.length;\n\n\t\t\tfor (i = 0; i < requires.length; i++) {\n\t\t\t\tit = requires[i];\n\t\t\t\tloadFile(it, module.basePath, module.path, onRequiredLoaded);\n\t\t\t}\n\n\t\t\tcallCallbackWhenOver();\n\t\t}\n\t\telse {\n\t\t\tcallCallbackWhenOver();\n\t\t}\n\t}\n\telse {\n\t\tcallCallbackWhenOver();\n\t}\n}\n\nfunction loadFile(path, relativeTo, requestedBy, callback) {\n\n\tvar requestInfo = {\n\t\tpath: path,\n\t\tbasePath: relativeTo,\n\t\tsolvedPaths: solvePossiblePaths(path, relativeTo),\n\t\tnextIndex: 0\n\t};\n\n\tpending.push(requestInfo);\n\n\tfunction onSuccess(response) {\n\t\tloadModule(response, requestInfo, callback);\n\t}\n\n\tfunction onError(response) {\n\t\tconsole.error(\n\t\t\t\t'Failed to load `' + path +\n\t\t\t\t'` requested by `' + requestedBy +\n\t\t\t\t'`: ' + response.error);\n\t\tloadModule(response, requestInfo, callback);\n\t}\n\n\tfunction tryLoadNext() {\n\t\tvar nextPath = requestInfo.solvedPaths[requestInfo.nextIndex++];\n\t\tvar isLast = requestInfo.nextIndex >= requestInfo.solvedPaths.length;\n\n\t\t// Send the request for the next possible path.\n\t\tsendRequest(nextPath, function(response) {\n\t\t\tif (response.success) {\n\t\t\t\t// The file was successfully loaded, process the\n\t\t\t\t// result.\n\t\t\t\tonSuccess(response);\n\t\t\t}\n\t\t\telse if (response.notFound && !isLast) {\n\t\t\t\t// The file was not found, but there are other\n\t\t\t\t// possible paths, so continue trying.\n\t\t\t\ttryLoadNext();\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// The request failed or the last possible path was\n\t\t\t\t// not found. Generate an error.\n\t\t\t\tonError(response);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Try load the first possible path.\n\ttryLoadNext();\n}\n\n//------------------------------------------------------------------//\n// Module execution\n//------------------------------------------------------------------//\n\nfunction getModule(modulePath) {\n\tvar module = moduleMap[modulePath];\n\tif (!module) {\n\t\tthrow new Error('Module `' + modulePath + '` not loaded');\n\t}\n\treturn module;\n}\n\nfunction getLoadingOrder(module) {\n\tvar result = [];\n\tvar deps, i, it, subResult;\n\tif (module && !module.visited) {\n\t\tmodule.visited = true;\n\t\tdeps = module.dependencies;\n\t\tfor (i = 0; i < deps.length; i++) {\n\t\t\tit = getModule(deps[i]);\n\t\t\tsubResult = getLoadingOrder(it);\n\t\t\tresult = result.concat(subResult);\n\t\t}\n\t\tresult.push(module);\n\t}\n\treturn result;\n}\n\nfunction beforeModuleLoading(module) {\n}\n\nfunction afterModuleLoading(module) {\n\tif (!axloader._moduleFn) {\n\t\t// Assume a syntax error.\n\t\tmodule.syntaxError = true;\n\t}\n\tmodule.moduleFunction = axloader._moduleFn;\n\tmodule.executed = false;\n\tdelete axloader._moduleFn;\n}\n\nfunction executeModule(module, afterCallback) {\n\tvar order = getLoadingOrder(module);\n\n\tfunction loadNext() {\n\t\tvar nextModule = order.shift();\n\t\tvar script, source, sourceMap;\n\t\tif (nextModule && !nextModule.error) {\n\t\t\tbeforeModuleLoading(nextModule);\n\n\t\t\tsource = 'axloader._moduleFn = (' +\n\t\t\t\t'function(require, module, exports, global) { // ' +\n\t\t\t\tnextModule.path + '\\n' +\n\t\t\t\tnextModule.source +\n\t\t\t\t'\\n})';\n\t\t\tsource += '\\n//# sourceMappingURL=' +\n\t\t\t\t'data:application/json;charset=utf-8;base64,';\n\t\t\tsourceMap = getSourceMap(\n\t\t\t\threfOrigin + nextModule.path, nextModule.source, 1);\n\t\t\tsource += strToUTF8Base64(sourceMap);\n\n\t\t\tscript = document.createElement('script');\n\t\t\tscript.id = nextModule.path;\n\t\t\tscript.type = 'text/javascript';\n\t\t\tscript.src =\n\t\t\t\t'data:text/javascript;charset=utf-8;base64,' +\n\t\t\t\tstrToUTF8Base64(source);\n\t\t\tscript.innerHTML = source;\n\t\t\tscript.onload = function() {\n\t\t\t\tafterModuleLoading(nextModule);\n\t\t\t\tsetTimeout(loadNext, 0);\n\t\t\t};\n\t\t\tdocument.head.appendChild(script);\n\t\t}\n\t\telse if (nextModule) {\n\t\t\tnextModule.notFound = true;\n\t\t\tsetTimeout(loadNext, 0);\n\t\t}\n\t\telse {\n\t\t\tdoExecute(module);\n\t\t\tif (typeof afterCallback === 'function') {\n\t\t\t\tafterCallback();\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction doExecute(theModule) {\n\n\t\tfunction require(path) {\n\t\t\tvar solvedPath = theModule.requireMap[path];\n\t\t\tvar requiredModule = solvedPath && getModule(solvedPath);\n\t\t\tif (!requiredModule) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'require: the module `' + path + '` was not preloaded');\n\t\t\t}\n\t\t\telse if (requiredModule.notFound) {\n\t\t\t\tthrow new Error('Cannot find module \\'' + path + '\\'');\n\t\t\t}\n\t\t\telse if (requiredModule.error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'require: the module `' + path + '` could not be loaded: ' +\n\t\t\t\t\trequiredModule.error);\n\t\t\t}\n\n\t\t\tif (!requiredModule.executed && !requiredModule.executing) {\n\t\t\t\tdoExecute(requiredModule);\n\t\t\t}\n\n\t\t\treturn requiredModule.moduleObject.exports;\n\t\t}\n\n\t\tvar fn = theModule.moduleFunction;\n\t\tvar moduleObject = theModule.moduleObject;\n\t\tvar moduleExports = moduleObject.exports;\n\n\t\tif (theModule.syntaxError) {\n\t\t\tthrow new SyntaxError(theModule.path);\n\t\t}\n\t\telse if (theModule.notFound) {\n\t\t\tthrow new Error('module not found: ' + theModule.path);\n\t\t}\n\n\t\ttry {\n\t\t\ttheModule.executing = true;\n\t\t\tfn.call(root, require, moduleObject, moduleExports, root);\n\t\t}\n\t\tfinally {\n\t\t\ttheModule.executing = false;\n\t\t}\n\t\ttheModule.executed = true;\n\t}\n\n\tloadNext();\n}\n\n//------------------------------------------------------------------//\n// Public API\n//------------------------------------------------------------------//\n\nvar axloader = {};\n\naxloader.require = function require(path, afterCallback) {\n\tloadFile(path, basePath, 'axloader.require', function(module) {\n\t\texecuteModule(module, afterCallback);\n\t});\n};\n\naxloader.getPending = function getPending() {\n\treturn pending;\n};\n\naxloader.getModuleMap = function getModuleMap() {\n\treturn moduleMap;\n};\n\nroot.axloader = axloader;\n\n}(this));\n", "meta": {"content_hash": "4743262d432c18a51e55f21bb8262f7e", "timestamp": "", "source": "github", "line_count": 671, "max_line_length": 71, "avg_line_length": 22.758569299552907, "alnum_prop": 0.5774998362910091, "repo_name": "ricardobm/ax-loader", "id": "26a7854d505d1e5992646f05b596e9df22dda295", "size": "15271", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/ax-loader.js", "mode": "33188", "license": "mit", "language": [{"name": "JavaScript", "bytes": "21108"}]}}
+{"text": "package jugsaar12.nio.networking;\n\nimport java.net.ServerSocket;\nimport java.net.Socket;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\n\n/**\n * TODO MAX_POOL_SIZE to 1000\n * \n * TODO show RejectedExecutionHandler -> Default AbortPolicy, CallerRunsPolicy\n */\npublic class C_ExecutorServiceMultiThreadedEchoServer {\n\n public static void main(String[] args) throws Exception {\n\n System.out.println(\"C_ExecutorServiceMultiThreadedEchoServer running\");\n\n ExecutorService es = Executors.newCachedThreadPool();\n\n try (ServerSocket ss = new ServerSocket(1337)) {\n\n while (true) {\n\n Socket s = ss.accept(); // blocking-call, never returns null!\n es.submit(() -> Util.process(s));\n }\n }\n }\n}", "meta": {"content_hash": "35befc48d23f03d692415d764e21ff48", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 78, "avg_line_length": 25.333333333333332, "alnum_prop": 0.7144736842105263, "repo_name": "jugsaar/jugsaar-meeting-12", "id": "aec0332d325665aa4bb0aec3abf2abd31679f07c", "size": "760", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "java-nio-networking/code/jugsaar12-java-nio-networking/src/main/java/jugsaar12/nio/networking/C_ExecutorServiceMultiThreadedEchoServer.java", "mode": "33188", "license": "apache-2.0", "language": [{"name": "Java", "bytes": "17468"}]}}
+{"text": "import pyxb.binding.generate\nimport pyxb.utils.domutils\nfrom xml.dom import Node\n\nimport os.path\nschema_path = os.path.abspath(os.path.join(os.path.dirname(__file__),\n '../schemas/po1.xsd'))\ncode = pyxb.binding.generate.GeneratePython(schema_location=schema_path)\n\n#file('code.py', 'w').write(code)\nrv = compile(code, 'test', 'exec')\neval(rv)\n\nfrom pyxb.exceptions_ import *\n\nfrom pyxb.utils import domutils\n\ndef ToDOM (instance, tag=None, dom_support=None):\n return instance.toDOM(dom_support).documentElement\n\nimport unittest\n\nclass TestPO1 (unittest.TestCase):\n street_content = '''95 Main St.\nAnytown, AS 12345-6789'''\n street_xml = '%s' % (street_content,)\n street_dom = pyxb.utils.domutils.StringToDOM(street_xml).documentElement\n\n address1_xml = 'Customer95 Main St'\n address2_xml = 'Sugar Mama24 E. Dearling Ave.'\n\n def tearDown (self):\n pyxb.RequireValidWhenGenerating(True)\n pyxb.RequireValidWhenParsing(True)\n\n def testPythonElementSimpleContent (self):\n elt = USAddress._ElementMap['street'].elementBinding()(self.street_content)\n self.assertEqual(self.street_content, elt)\n self.assertEqual(ToDOM(elt).toxml(\"utf-8\"), self.street_xml)\n\n def testDOMElementSimpleContent (self):\n elt = USAddress._ElementMap['street'].elementBinding().createFromDOM(self.street_dom)\n self.assertEqual(ToDOM(elt).toxml(\"utf-8\"), self.street_xml)\n\n def testPythonElementComplexContent_Element (self):\n addr = USAddress(name='Customer', street='95 Main St')\n self.assertEqual('95 Main St', addr.street)\n addr = USAddress('Customer', '95 Main St')\n self.assertEqual('95 Main St', addr.street)\n addr.street = '43 West Oak'\n self.assertEqual('43 West Oak', addr.street)\n #self.assertEqual('%s' % (self.address1_xml,), ToDOM(addr, tag='s').toxml(\"utf-8\"))\n\n def testDOM_CTD_element (self):\n # NB: USAddress is a CTD, not an element.\n xml = '%s' % (self.address1_xml,)\n dom = pyxb.utils.domutils.StringToDOM(xml)\n addr2 = USAddress.Factory(_dom_node=dom.documentElement)\n #self.assertEqual(xml, ToDOM(addr2, tag='shipTo').toxml(\"utf-8\"))\n\n def testPurchaseOrder (self):\n po = purchaseOrder(shipTo=USAddress(name='Customer', street='95 Main St'),\n billTo=USAddress(name='Sugar Mama', street='24 E. Dearling Ave'),\n comment='Thanks!')\n xml = ToDOM(po).toxml(\"utf-8\")\n xml1 = 'Customer95 Main StSugar Mama24 E. Dearling AveThanks!'\n self.assertEqual(xml, xml1)\n\n dom = pyxb.utils.domutils.StringToDOM(xml)\n po2 = purchaseOrder.createFromDOM(dom.documentElement)\n self.assertEqual(xml1, ToDOM(po2).toxml(\"utf-8\"))\n loc = po2.shipTo._location()\n self.assertTrue((not isinstance(loc, pyxb.utils.utility.Locatable_mixin)) or (58 == loc.columnNumber))\n loc = po2.billTo.name._location()\n self.assertTrue((not isinstance(loc, pyxb.utils.utility.Locatable_mixin)) or (131 == loc.columnNumber))\n\n po2 = CreateFromDocument(xml)\n self.assertEqual(xml1, ToDOM(po2).toxml(\"utf-8\"))\n loc = po2.shipTo._location()\n self.assertTrue((not isinstance(loc, pyxb.utils.utility.Locatable_mixin)) or (58 == loc.columnNumber))\n loc = po2.billTo.name._location()\n self.assertTrue((not isinstance(loc, pyxb.utils.utility.Locatable_mixin)) or (131 == loc.columnNumber))\n\n\n xml2 = 'Customer95 Main StSugar Mama24 E. Dearling AveThanks!'\n bds = pyxb.utils.domutils.BindingDOMSupport()\n bds.setDefaultNamespace(Namespace)\n self.assertEqual(xml2, ToDOM(po2, dom_support=bds).toxml(\"utf-8\"))\n\n def testGenerationValidation (self):\n ship_to = USAddress('Robert Smith', 'General Delivery')\n po = purchaseOrder(ship_to)\n self.assertEqual('General Delivery', po.shipTo.street)\n self.assertTrue(po.billTo is None)\n\n self.assertTrue(pyxb.RequireValidWhenGenerating())\n self.assertRaises(pyxb.DOMGenerationError, po.toxml)\n try:\n pyxb.RequireValidWhenGenerating(False)\n self.assertFalse(pyxb.RequireValidWhenGenerating())\n xmls = po.toxml(\"utf-8\", root_only=True)\n self.assertEqual('General DeliveryRobert Smith', xmls)\n finally:\n pyxb.RequireValidWhenGenerating(True)\n self.assertRaises(pyxb.UnrecognizedContentError, CreateFromDocument, xmls)\n self.assertTrue(pyxb.RequireValidWhenParsing())\n try:\n pyxb.RequireValidWhenParsing(False)\n self.assertFalse(pyxb.RequireValidWhenParsing())\n po2 = CreateFromDocument(xmls)\n finally:\n pyxb.RequireValidWhenParsing(True)\n self.assertEqual('General Delivery', po2.shipTo.street)\n self.assertTrue(po2.billTo is None)\n\nif __name__ == '__main__':\n unittest.main()\n \n \n", "meta": {"content_hash": "919acf526bf392f33f5376056b08089f", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 269, "avg_line_length": 46.739495798319325, "alnum_prop": 0.6650485436893204, "repo_name": "jonfoster/pyxb1", "id": "bf3c9d2f0c5635eae42a36b08b6241bea6e6e94f", "size": "5562", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/drivers/test-po1.py", "mode": "33188", "license": "apache-2.0", "language": [{"name": "Python", "bytes": "1564427"}, {"name": "Shell", "bytes": "18946"}]}}
+{"text": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\n\nnamespace VJeek.Microdata.Intangible.StructuredValue\n{\n\tpublic partial class OpeningHoursSpecification : StructuredValue\n\t{\n\t\t[JsonProperty(\"closes\")]\n\t\tpublic TimeSpan Closes { get; set; }\n\n\t\t[JsonProperty(\"dayOfWeek\")]\n\t\tpublic DayOfWeek DayOfWeek { get; set; }\n\n\t\t[JsonProperty(\"opens\")]\n\t\tpublic TimeSpan Opens { get; set; }\n\n\t\t[JsonProperty(\"validFrom\")]\n\t\tpublic DateTime ValidFrom { get; set; }\n\n\t\t[JsonProperty(\"validThrough\")]\n\t\tpublic DateTime ValidThrough { get; set; }\n\t}\n}\n", "meta": {"content_hash": "ebe952e1b2b29a2152f4caea184b6845", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 65, "avg_line_length": 23.22222222222222, "alnum_prop": 0.7384370015948963, "repo_name": "vjeek/microdata", "id": "eee2c6ba0e8520d9bd949baba07a99f7c5b3b95c", "size": "629", "binary": false, "copies": "1", "ref": "refs/heads/development", "path": "Sources/VJeek.Microdata/Intangible/StructuredValue/OpeningHoursSpecification.cs", "mode": "33188", "license": "mit", "language": [{"name": "Batchfile", "bytes": "746"}, {"name": "C#", "bytes": "19991"}, {"name": "PowerShell", "bytes": "95259"}]}}
+{"text": "The GraphQL module allows client applications to query the content handled by an Orchard website. \nIt enables the GraphiQL Explorer view to test GraphQL queries, and provides HTTP endpoints to send client queries.\n\n## HTTP Methods, Headers, and Body\n\n### GET request\n\nWhen receiving an HTTP GET request, the GraphQL query should be specified in the \"query\" query string. For example, if we wanted to execute the following GraphQL query:\n\n```graphql\n{\n me {\n name\n }\n}\n```\n\nThis request could be sent via an HTTP GET like so:\n\n`http://myapi/graphql?query={me{name}}`\n\nQuery variables can be sent as a JSON-encoded string in an additional query parameter called variables. If the query contains several named operations, an operationName query parameter can be used to control which one should be executed.\n\n### POST request \n\n#### application/json content type\n\nA standard GraphQL POST request should use the `application/json` content-type header, and include a JSON-encoded body of the following form:\n\n```graphql\n{\n \"query\": \"...\",\n \"operationName\": \"...\",\n \"variables\": { \"myVariable\": \"someValue\", ... }\n}\n```\n\n`operationName` and `variables` are optional fields. `operationName` is only required if multiple operations are present in the query.\n\n#### application/graphql content type\n\nAnother option is to use the `application/graphql` content-type header, and the HTTP POST body contents is treated as the GraphQL query string.\n\n#### query string\n\nIn addition to the above, If the \"query\" query string parameter is present (as in the GET example above), it will be parsed and handled in the same way as the HTTP GET case.\n\n### Response\n\nRegardless of the method by which the query and variables were sent, the response is returned in the body of the request in JSON format. \nA query might result in some data and some errors, and those are returned in a JSON object of the form:\n\n```json\n{\n \"data\": { ... },\n \"errors\": [ ... ]\n}\n```\n\nIf there were no errors returned, the \"errors\" field is not present on the response. \nIf no data is returned the \"data\" field is only included if the error occurred during execution.\n\n## Authentication\n\nExecuting a GraphQL query requires the issuer to have the `ExecuteGraphQL` permission. Like any other API in Orchard Core, the GraphQL API supports \ncookie and OAuth 2.0 authentication. This means it's compatible with the OpenId module and supports JSON Web Token (JWT).\n\nBy default anonymous users are not able to execute a GraphQL query.\n\n## Configuration\n\nIt's possible to configure graphql options for exposing exceptions and max depth, max complexity and field impact.\n\nConfiguration is done via the standard shell configuration, as follows.\n\n```json\n{\n \"OrchardCore\": {\n \"OrchardCore_Apis_GraphQL\": {\n \"ExposeExceptions\": true,\n \"MaxDepth\": 50, \n \"MaxComplexity\": 100, \n \"FieldImpact\": 2.0,\n \"DefaultNumberOfResults\": 100,\n \"MaxNumberOfResults\": 1000,\n \"MaxNumberOfResultsValidationMode\": \"Default\"\n }\n }\n}\n```\n\n*ExposeExceptions (bool, Default: false for production, true for development)*\n\nIf set to true stack traces are exposed to graphql clients\n\n*DefaultNumberOfResults (int, Default: 100)*\nThe default number of results returned by all paged fields/types.\n\n*MaxNumberOfResults (int, Default: 1000)*\nThe maximum number of results returned by all paged fields/types.\n\n*MaxNumberOfResultsValidationMode (enum, Values: Default|Enabled|Disabled, Default: Default)()*\nSpecify the validation behaviour if the max number of results is exceeded in a pager parameter\n\n* Default - In production info will be logged and only the max number of results will be returned. In development a graphql validation error will be raised.\n* Enabled - a graphql validation error will be raised\n* Disabled - Info will be logged and only the max number of results will be returned\n\n*MaxDepth (int?, Default: 20)*\n\nEnforces the total maximum nesting across all queries in a request.\n\n*MaxComplexity (int?, Default: null)*\n\n*FieldImpact (double?, Default: null)*\n\nFor more information on MaxDepth, MaxComplexity, FieldImpact & protecting against malicious queries view the graphql-dot-net documentation at \n", "meta": {"content_hash": "8ee80330a70b8aded11c89b2578ddc87", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 237, "avg_line_length": 36.43589743589744, "alnum_prop": 0.7522871217452498, "repo_name": "xkproject/Orchard2", "id": "2a44f43220f1cc656cf5d84f218eeb9a33797940", "size": "4308", "binary": false, "copies": "3", "ref": "refs/heads/master_PCCOM", "path": "src/docs/reference/modules/Apis.GraphQL/README.md", "mode": "33188", "license": "bsd-3-clause", "language": [{"name": "C#", "bytes": "7779422"}, {"name": "CSS", "bytes": "2900240"}, {"name": "Dockerfile", "bytes": "424"}, {"name": "HTML", "bytes": "1472436"}, {"name": "JavaScript", "bytes": "2184254"}, {"name": "Liquid", "bytes": "43273"}, {"name": "PHP", "bytes": "2484"}, {"name": "PowerShell", "bytes": "142165"}, {"name": "Pug", "bytes": "55503"}, {"name": "SCSS", "bytes": "215570"}, {"name": "TypeScript", "bytes": "41644"}]}}
+{"text": "Namespace Ribbons.Document.Create\n\n Public Class FromProfile\n Inherits RibbonButtonBase\n\n Public Sub New()\n _Image = \"\"\n _Order = 1\n _Text = \"From Profile\"\n _ToolTip = \"\"\n End Sub\n\n Protected Friend Overrides Sub OnClick()\n\n End Sub\n\n Protected Friend Overrides Sub OnIsEnabled()\n\n End Sub\n\n End Class\n\nEnd Namespace\n\n", "meta": {"content_hash": "81adc258cf3c3d2de8198ac49cb880ff", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 52, "avg_line_length": 17.375, "alnum_prop": 0.5539568345323741, "repo_name": "nublet/DMS", "id": "51e57b874a4c962bdaa2f2ba00ff815d1485c81b", "size": "417", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DMS.Forms/Ribbons/Items/Document/Create/FromProfile.vb", "mode": "33188", "license": "mit", "language": [{"name": "Visual Basic", "bytes": "2291940"}]}}
+{"text": "package com.dfyy.bussiness;\n\nimport java.io.Serializable;\nimport java.util.Date;\n\nimport javax.persistence.Column;\nimport javax.persistence.Entity;\nimport javax.persistence.FetchType;\nimport javax.persistence.GeneratedValue;\nimport javax.persistence.Id;\nimport javax.persistence.JoinColumn;\nimport javax.persistence.ManyToOne;\nimport javax.persistence.Table;\nimport javax.xml.bind.annotation.XmlAccessType;\nimport javax.xml.bind.annotation.XmlAccessorType;\nimport javax.xml.bind.annotation.XmlElement;\nimport javax.xml.bind.annotation.XmlRootElement;\nimport javax.xml.bind.annotation.XmlTransient;\nimport javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;\n\nimport org.hibernate.annotations.GenericGenerator;\n\nimport com.dfyy.util.JaxbDateSerializer;\n\n@Entity\n@Table(name = \"user\")\n@XmlRootElement\n@XmlAccessorType(XmlAccessType.NONE)\npublic class User implements Serializable {\n\tprivate static final long serialVersionUID = 8517308475246169441L;\n\n\t@Id\n\t@Column(name = \"id\")\n\t@GenericGenerator(name = \"idGenerator\", strategy = \"assigned\")\n\t@GeneratedValue(generator = \"idGenerator\")\n\t@XmlElement\n\tprivate String id;\n\n\t@Column(name = \"phone\")\n\t@XmlElement\n\tprivate String phone;\n\n\t@Column(name = \"password\")\n\t@XmlTransient\n\tprivate String password;\n\n\t@Column(name = \"alias\")\n\t@XmlElement\n\tprivate String alias;\n\n\t@Column(name = \"thumbnail\")\n\t@XmlElement\n\tprivate String thumbnail;\n\n\t@Column(name = \"address\")\n\t@XmlElement\n\tprivate String address;\n\n\t@Column(name = \"point\")\n\t@XmlElement\n\tprivate Integer point;\n\n\t@Column(name = \"description\")\n\t@XmlElement\n\tprivate String description;\n\n\t@Column(name = \"status\")\n\t@XmlElement\n\tprivate Integer status;\n\n\t@Column(name = \"x\")\n\t@XmlElement\n\tprivate Double x;\n\n\t@Column(name = \"y\")\n\t@XmlElement\n\tprivate Double y;\n\n\t@Column(name = \"currency\")\n\t@XmlElement\n\tprivate Integer currency;\n\t\n\t\n\t@Column(name = \"money\")\n\t@XmlElement\n\tprivate Integer money;\n\n\t@Column(name = \"scoring\")\n\t@XmlElement\n\tprivate Double scoring;\n\n\t@Column(name = \"tjcode\")\n\t@XmlElement\n\tprivate String tjcode;\n\t\n\t@Column(name = \"tjcoin\")\n\t@XmlElement\n\tprivate Integer tjcoin;\n\t\n\t\n\t@Column(name = \"time\")\n\t@XmlJavaTypeAdapter(JaxbDateSerializer.class)\n\tprivate Date time;\n\n\t@ManyToOne(fetch = FetchType.EAGER)\n\t@JoinColumn(name = \"level\")\n\t@XmlElement\n\tprivate UserLevel level;\n\n\t@ManyToOne(fetch = FetchType.EAGER)\n\t@JoinColumn(name = \"aid\")\n\t@XmlElement\n\tprivate Area area;\n\t\n\t@Column(name = \"activity\")\n\tprivate Integer activity;\n\t\n\t@Column(name = \"teamwork\")\n\t@XmlElement\n\tprivate boolean teamwork;\n\t\n\t\n\t@Column(name = \"acceptcoupon\")\n\t@XmlElement\n\tprivate boolean acceptCoupon;\n\n\tpublic User() {\n\n\t}\n\n\tpublic String getId() {\n\t\treturn id;\n\t}\n\n\tpublic void setId(String id) {\n\t\tthis.id = id;\n\t}\n\n\tpublic String getPhone() {\n\t\treturn phone;\n\t}\n\n\tpublic void setPhone(String phone) {\n\t\tthis.phone = phone;\n\t}\n\n\tpublic String getPassword() {\n\t\treturn password;\n\t}\n\n\tpublic void setPassword(String password) {\n\t\tthis.password = password;\n\t}\n\n\tpublic String getAlias() {\n\t\treturn alias;\n\t}\n\n\tpublic void setAlias(String alias) {\n\t\tthis.alias = alias;\n\t}\n\n\tpublic String getThumbnail() {\n\t\treturn thumbnail;\n\t}\n\n\tpublic void setThumbnail(String thumbnail) {\n\t\tthis.thumbnail = thumbnail;\n\t}\n\n\tpublic String getAddress() {\n\t\treturn address;\n\t}\n\n\tpublic void setAddress(String address) {\n\t\tthis.address = address;\n\t}\n\n\tpublic Integer getPoint() {\n\t\treturn point;\n\t}\n\n\tpublic void setPoint(Integer point) {\n\t\tthis.point = point;\n\t}\n\n\tpublic String getDescription() {\n\t\treturn description;\n\t}\n\n\tpublic void setDescription(String description) {\n\t\tthis.description = description;\n\t}\n\n\tpublic Integer getStatus() {\n\t\treturn status;\n\t}\n\n\tpublic void setStatus(Integer status) {\n\t\tthis.status = status;\n\t}\n\n\tpublic Double getX() {\n\t\treturn x;\n\t}\n\n\tpublic void setX(Double x) {\n\t\tthis.x = x;\n\t}\n\n\tpublic Double getY() {\n\t\treturn y;\n\t}\n\n\tpublic void setY(Double y) {\n\t\tthis.y = y;\n\t}\n\n\tpublic Integer getCurrency() {\n\t\treturn currency;\n\t}\n\n\tpublic void setCurrency(Integer currency) {\n\t\tthis.currency = currency;\n\t}\n\n\tpublic Double getScoring() {\n\t\treturn scoring;\n\t}\n\n\tpublic void setScoring(Double scoring) {\n\t\tthis.scoring = scoring;\n\t}\n\n\tpublic Date getTime() {\n\t\treturn time;\n\t}\n\n\tpublic void setTime(Date time) {\n\t\tthis.time = time;\n\t}\n\n\tpublic UserLevel getLevel() {\n\t\treturn level;\n\t}\n\n\tpublic void setLevel(UserLevel level) {\n\t\tthis.level = level;\n\t}\n\n\tpublic Area getArea() {\n\t\treturn area;\n\t}\n\n\tpublic void setArea(Area area) {\n\t\tthis.area = area;\n\t}\n\n\tpublic String getTjcode() {\n\t\treturn tjcode;\n\t}\n\n\tpublic void setTjcode(String tjcode) {\n\t\tthis.tjcode = tjcode;\n\t}\n\t\n\tpublic Integer getActivity() {\n\t\treturn activity;\n\t}\n\n\tpublic void setActivity(Integer activity) {\n\t\tthis.activity = activity;\n\t}\n\n\t@XmlElement\n\tpublic String getIdentifier() {\n\t\tif (activity == null) {\n\t\t\treturn \"\u65b0\u4eba\";\n\t\t} else if (activity >= 2000) {\n\t\t\treturn \"\u7279\u7ea7\";\n\t\t} else if (activity >= 1000 && activity <= 1999) {\n\t\t\treturn \"\u9ad8\u7ea7\";\n\t\t} else if (activity >= 500 && activity <= 999) {\n\t\t\treturn \"\u4e2d\u7ea7\";\n\t\t} else if (activity >= 200 && activity <= 499) {\n\t\t\treturn \"\u521d\u7ea7\";\n\t\t}\n\t\treturn \"\u65b0\u4eba\";\n\t}\n\n\tpublic boolean isTeamwork() {\n\t\treturn teamwork;\n\t}\n\n\tpublic void setTeamwork(boolean teamwork) {\n\t\tthis.teamwork = teamwork;\n\t}\n\t\n\tpublic Integer getTjcoin() {\n\t\treturn tjcoin;\n\t}\n\n\tpublic void setTjcoin(Integer tjcoin) {\n\t\tthis.tjcoin = tjcoin;\n\t}\n\n\tpublic boolean isAcceptCoupon() {\n\t\treturn acceptCoupon;\n\t}\n\n\tpublic void setAcceptCoupon(boolean acceptCoupon) {\n\t\tthis.acceptCoupon = acceptCoupon;\n\t}\n\n\tpublic Integer getMoney() {\n\t\treturn money;\n\t}\n\n\tpublic void setMoney(Integer money) {\n\t\tthis.money = money;\n\t}\n\t\n}\n", "meta": {"content_hash": "09961152c255dd2b8ffd2e6fccc1ddbc", "timestamp": "", "source": "github", "line_count": 323, "max_line_length": 67, "avg_line_length": 17.340557275541794, "alnum_prop": 0.7064809855382967, "repo_name": "secondflying/dfyy", "id": "b7211ffdebc40d47216eaaef59f1a68cb1ada1fc", "size": "5625", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/dfyy/bussiness/User.java", "mode": "33188", "license": "apache-2.0", "language": [{"name": "ActionScript", "bytes": "70896"}, {"name": "Batchfile", "bytes": "113"}, {"name": "CSS", "bytes": "215364"}, {"name": "Java", "bytes": "2098669"}, {"name": "JavaScript", "bytes": "1312338"}, {"name": "PHP", "bytes": "1193"}]}}
+{"text": "In order to translate the labels of the families and attributes, as well as some few other things, you only need to\ncreate a standard Symfony translation file with the proper syntax.\n\n| WARNING |\n| ------- |\n| Data translation is done using [*EAV* context](09-context.md) |\n\n### Translating Families\n\nThe label of a family can be directly provided in the configuration of the family by setting the \"label\" configuration\nkey. This is not recommended as it will not allow you to translate the attribute in multiple languages.\n\nThe translation system will look for this keys in order to translate a family:\n\n````yml\neav:\n family:\n :\n label: