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 1004
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 1786)
              
              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 1004
              
              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 dataset

Need 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
#include <folly/detail/RangeCommon.h> #include <bitset> #include <folly/container/SparseByteSet.h> namespace folly { namespace detail { size_t qfind_first_byte_of_bitset( const StringPieceLite haystack, const StringPieceLite needles) { std::bitset<256> s; for (auto needle : needles) { s[(uint8_t)needle] = true; } for (size_t index = 0; index < haystack.size(); ++index) { if (s[(uint8_t)haystack[index]]) { return index; } } return std::string::npos; } size_t qfind_first_byte_of_byteset( const StringPieceLite haystack, const StringPieceLite needles) { SparseByteSet s; for (auto needle : needles) { s.add(uint8_t(needle)); } for (size_t index = 0; index < haystack.size(); ++index) { if (s.contains(uint8_t(haystack[index]))) { return index; } } return std::string::npos; } } // namespace detail } // namespace folly
{ "content_hash": "d31b9239b92dd21f4eb0ed3db7396fe7", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 60, "avg_line_length": 21.046511627906977, "alnum_prop": 0.6464088397790055, "repo_name": "Orvid/folly", "id": "87467b6204d3292a74393ad912a7582e94c306c7", "size": "1500", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "folly/detail/RangeCommon.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "4324" }, { "name": "C", "bytes": "58996" }, { "name": "C++", "bytes": "8487843" }, { "name": "CMake", "bytes": "63672" }, { "name": "CSS", "bytes": "165" }, { "name": "M4", "bytes": "85007" }, { "name": "Makefile", "bytes": "36824" }, { "name": "Python", "bytes": "40534" }, { "name": "Ruby", "bytes": "1531" }, { "name": "Shell", "bytes": "8546" } ] }
Scala wrapper for the Codacy API. [![Codacy Badge](https://api.codacy.com/project/badge/Grade/46749e1408d94e6fbb785201c1eb9bd8)](https://www.codacy.com/gh/codacy/codacy-api-scala?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=codacy/codacy-api-scala&amp;utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/46749e1408d94e6fbb785201c1eb9bd8)](https://www.codacy.com/gh/codacy/codacy-api-scala?utm_source=github.com&utm_medium=referral&utm_content=codacy/codacy-api-scala&utm_campaign=Badge_Coverage) [![Circle CI](https://circleci.com/gh/codacy/codacy-api-scala/tree/master.svg?style=shield)](https://circleci.com/gh/codacy/codacy-api-scala/tree/master) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.codacy/codacy-api-scala_2.11/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.codacy/codacy-api-scala_2.11) ## Usage If you use Maven you can declare the dependency: ```xml <dependency>     <groupId>com.codacy</groupId>     <artifactId>codacy-api-java</artifactId>     <version>VERSION</version> </dependency> ``` First, declare the dependency on SBT: ```xml "com.codacy" %% "codacy-api-scala" % "VERSION" ``` Usage example (extracted from our [sbt-codacy-coverage tool](https://github.com/codacy/sbt-codacy-coverage/blob/c10e67fa6fe62992c871e9811c41603ae0a76870/src/main/scala/com/codacy/CodacyCoveragePlugin.scala#L56-L69): ```xml val apiUrl = "https://api.codacy.com/" val projectToken = "randomizedTokenGeneratedByCodacy" val codacyClient = new CodacyClient(Some(apiUrl), projectToken = Some(projectToken)) val coverageServices = new CoverageServices(codacyClient) val commitUUID = "gitCommitUUID" val report = ... coverageServices.sendReport(commitUUID, Language.Scala, report) match { case requestResponse if requestResponse.hasError => logger.error(s"Failed to upload data. Reason: ${requestResponse.message}") state.exit(ok = false) Left(requestResponse.message) case requestResponse => logger.success(s"Coverage data uploaded. ${requestResponse.message}") Right(state) } ``` ## Creators 1. Rodrigo Fernandes ## Contributors 1. Rafael Cortês 2. João Machado 3. João Caxaria 4. Pedro Rijo ## What is Codacy [Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews. ### Among Codacy’s features - Identify new Static Analysis issues - Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories) - Auto-comments on Commits and Pull Requests - Integrations with Slack, HipChat, Jira - Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity. Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others. ## Free for Open Source Codacy is free for Open Source projects. ## License codacy-api-scala is available under the MIT license. See the LICENSE file for more info.
{ "content_hash": "984ef57428484115d4b07afd45ed4fc6", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 260, "avg_line_length": 38.95180722891566, "alnum_prop": 0.7553356016084133, "repo_name": "codacy/codacy-api-scala", "id": "2c099b1461aaed94cb5c7571cf1cbabe4ba43acb", "size": "3277", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Scala", "bytes": "24655" } ] }
package io.github.agileluo.rest; import java.net.InetAddress; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.zookeeper.KeeperException.NoNodeException; import org.apache.zookeeper.KeeperException.NodeExistsException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import io.github.agileluo.smartroute.constant.SmartRuleConstant; import io.github.agileluo.smartroute.context.IpUtil; import io.github.agileluo.vo.Rule; @RestController @RequestMapping("/rule") public class RuleController { private static final Logger log = LoggerFactory.getLogger(RuleController.class); @Autowired CuratorFramework client; private static String ENCODE = "UTF-8"; @RequestMapping("/get") public Rule get() throws Exception{ String rule = getRule(); return new Rule().setRule(rule); } @RequestMapping("/set") public boolean set(@RequestBody Rule rule) throws Exception{ if(StringUtils.equals(rule.getRule(), getRule())){ return true; } try { client.setData().forPath(SmartRuleConstant.CONFIG_PATH, rule.getRule().getBytes(ENCODE)); } catch (NodeExistsException | NoNodeException e) { client.create().creatingParentContainersIfNeeded().forPath(SmartRuleConstant.CONFIG_PATH, rule.getRule().getBytes(ENCODE)); } return true; } @RequestMapping("/getip") public String getIp(HttpServletRequest req){ String ip = req.getRemoteHost(); if(IpUtil.isLocalIp(ip)){ ip = IpUtil.getLocalRemoteIp(); } return ip; } private String getRule(){ try { byte[] data = client.getData().forPath(SmartRuleConstant.CONFIG_PATH); if(data == null){ return null; } return new String(data, ENCODE); } catch (Exception e) { log.error("获取角色出错", e); } return null; } }
{ "content_hash": "3d2273e675cb9ea2158333bb6502e9cf", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 126, "avg_line_length": 31.58823529411765, "alnum_prop": 0.7397579143389199, "repo_name": "agileluo/smart-route", "id": "a40e46094d5009663d3e96279ca342368c00939c", "size": "2160", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "smart-route-starter-server/src/main/java/io/github/agileluo/rest/RuleController.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "2348" }, { "name": "Java", "bytes": "24881" } ] }
 namespace RzRpgLib { public enum GameEntityPropertyCollectionChangedAction { Add, Remove } public struct GameEntityPropertyCollectionChangedEventArgs { public GameEntityPropertyCollectionChangedAction Action; public IGameEntityProperty ChangedProperty; public GameEntityPropertyCollectionChangedEventArgs( GameEntityPropertyCollectionChangedAction action, IGameEntityProperty changedProperty ) { Action = action; ChangedProperty = changedProperty; } } }
{ "content_hash": "aaa44d8d4f57fd6e2800de9b396fcc24", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 148, "avg_line_length": 26.761904761904763, "alnum_prop": 0.7099644128113879, "repo_name": "robzhu/RzRpgLib", "id": "86323a3fdb57a0706ca6d666a82a7088b78e9a0a", "size": "564", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RzRpgLib/GameEntityPropertyChanged.cs", "mode": "33261", "license": "mit", "language": [ { "name": "C#", "bytes": "183391" } ] }
<?php namespace Geptool\Bundle\JiraApiBundle\Service; /** * Base class that contains common features needed by services with paged results. */ abstract class AbstractPagedService extends AbstractService { /** * @var int */ protected $start = 0; /** * @var int */ protected $limit = 50; /** * @var string [fields] */ protected $fields; /** * Adds the start and limit parameters to each request. * * {@inheritDoc} */ protected function createUrl($path, array $params = array()) { $params = array_merge( array( 'startAt' => $this->start, 'maxResults' => $this->limit ), $params ); if ($this->fields) { $params['fields'] = $this->fields; } $url = parent::createUrl($path, $params); return $url; } /** * Set the start of the current result start. * * @param int $start * * @return \JiraApiBundle\Service\AbstractPagedService */ public function setStart($start) { $this->start = $start; return $this; } /** * Returns the start of the current result page. * * @return bool|int */ public function getStart() { return $this->start; } /** * Set the start of the current result fields clause. * * @param string $fields * * @return \JiraApiBundle\Service\AbstractPagedService */ public function setFields($fields) { $this->fields = $fields; return $this; } /** * Returns the field clause of the current result page. * * @return bool|string */ public function getFields() { return $this->fields; } /** * Set the result limit. * * @param integer $limit * * @return \JiraApiBundle\Service\AbstractPagedService */ public function setLimit($limit) { $this->limit = $limit; return $this; } /** * Returns the result limit. * * @return bool|int */ public function getLimit() { return $this->limit; } }
{ "content_hash": "80792c0b1f534065c12b28283eddfd4c", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 82, "avg_line_length": 18.65, "alnum_prop": 0.5192135835567471, "repo_name": "sirko/geptool", "id": "d29edc07ca6c785aea311fe4d50b126733f9e031", "size": "2238", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Geptool/Bundle/JiraApiBundle/Service/AbstractPagedService.php", "mode": "33188", "license": "apache-2.0", "language": [] }
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> <year>2004</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> 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. </legalnotice> <title>asn1 Release Notes</title> <prepared>otp_appnotes</prepared> <docno>nil</docno> <date>nil</date> <rev>nil</rev> <file>notes.xml</file> </header> <p>This document describes the changes made to the asn1 application.</p> <section><title>Asn1 4.0.3</title> <section><title>Improvements and New Features</title> <list> <item> <p> Internal changes</p> <p> Own Id: OTP-13551</p> </item> </list> </section> </section> <section><title>Asn1 4.0.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> When compiling to the PER format, the ASN.1 compiler would crash when attempting to compile an ASN.1 module with a constrained INTEGER with more than 65536 values and named values. (Thanks to Ingars for reporting this bug.)</p> <p> Own Id: OTP-13257</p> </item> <item> <p>The ASN.1 compiler will now emit Dialyzer suppressions for improper lists. Thus, there is no longer any need to use <c>--Wno_improper_lists</c> when analyzing modules generated by the ASN.1 compiler.</p> <p> Own Id: OTP-13324</p> </item> </list> </section> </section> <section><title>Asn1 4.0.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Trying to encode an empty named BIT STRING in BER would fail with a <c>function_clause</c> exception. (Thanks to Svilen Ivanov for reporting this bug.)</p> <p> Own Id: OTP-13149</p> </item> </list> </section> </section> <section><title>Asn1 4.0</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Many bugs have been eliminated in the the ASN.1 compiler so that it can now successfully compile many more ASN.1 specifications. Error messages have also been improved.</p> <p> Own Id: OTP-12395</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p>The documentation for <c>asn1ct:test/1,2,3</c> and <c>asn1ct:value/2</c> has been updated with information about the limitations of the functions.</p> <p> Own Id: OTP-12765 Aux Id: seq12866, seq12867 </p> </item> </list> </section> </section> <section><title>Asn1 3.0.4</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p>The ASN.1 compiler would crash if a SEQUENCE ended with a double set of ellipses (<c>...</c>).</p> <p> Own Id: OTP-12546 Aux Id: seq12815 </p> </item> </list> </section> </section> <section><title>Asn1 3.0.3</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> When decoding BER, primitives with an indefinite length will be immediately rejected. (Thanks to Simon Cornish for reporting this bug.)</p> <p> Own Id: OTP-12205</p> </item> <item> <p> BER: A bug with compliance to X.680 (200811) s31.2.7 has been fixed. Basically, when TagDefault is AUTOMATIC then tags are IMPLICIT unless EXPLICIT is given.</p> <p> Own Id: OTP-12318</p> </item> <item> <p> Usage of the <c>EXTERNAL</c> 1994 variant type was broken.</p> <p> Own Id: OTP-12326</p> </item> </list> </section> </section> <section><title>Asn1 3.0.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Several problems where the ASN.1 compiler would crash when attempting to compile correct specifications have been corrected.</p> <p> Own Id: OTP-12125</p> </item> <item> <p> Robustness when decoding incorrect BER messages has been improved.</p> <p> Own Id: OTP-12145</p> </item> </list> </section> </section> <section><title>Asn1 3.0.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> The ASN.1 compiler now generates code that don't trigger Dialyzer warnings. Along the way, a few minor bugs were fixed.</p> <p> Own Id: OTP-11372 Aux Id: seq12397 </p> </item> </list> </section> </section> <section><title>Asn1 3.0</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Subtyping an extensible ENUMERATED would cause an compilation error. (Thanks to Morten Nygaard Åsnes for reporting this bug.)</p> <p> Own Id: OTP-11700</p> </item> <item> <p>When specifying the value for an OCTET STRING in a specification, the ASN.1 standard clearly states that the value must be either a bstring or an hstring, but NOT a cstring. The ASN.1 compiler will now generate a compilation error if the value of an OCTET STRING is given as a character string.</p> <p>That is, the following example is now illegal:</p> <p><c>string OCTET STRING ::= "Now illegal"</c></p> <p> *** POTENTIAL INCOMPATIBILITY ***</p> <p> Own Id: OTP-11727</p> </item> <item> <p> Application upgrade (appup) files are corrected for the following applications: </p> <p> <c>asn1, common_test, compiler, crypto, debugger, dialyzer, edoc, eldap, erl_docgen, et, eunit, gs, hipe, inets, observer, odbc, os_mon, otp_mibs, parsetools, percept, public_key, reltool, runtime_tools, ssh, syntax_tools, test_server, tools, typer, webtool, wx, xmerl</c></p> <p> A new test utility for testing appup files is added to test_server. This is now used by most applications in OTP.</p> <p> (Thanks to Tobias Schlager)</p> <p> Own Id: OTP-11744</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> By giving --enable-static-{nifs,drivers} to configure it is now possible to statically linking of nifs and drivers to the main Erlang VM binary. At the moment only the asn1 and crypto nifs of the Erlang/OTP nifs and drivers have been prepared to be statically linked. For more details see the Installation Guide in the System documentation.</p> <p> Own Id: OTP-11258</p> </item> <item> <p>Code generation for the <c>per</c> and <c>uper</c> backends has been somewhat improved.</p> <p> Own Id: OTP-11573</p> </item> <item> <p>The OCTET STRING and BIT STRING types now have a more natural mapping to Erlang types (binary and bitstring, respectively), which is more efficient and will avoid useless conversions between lists and binaries/bitstrings.</p> <p>This is an incompatible change. To revert to the old mapping to support existing applications, use the <c>legacy_erlang_types</c> option.</p> <p>Impact: There is a potential for better performance, as it is now possible to avoid conversions between lists and binaries both in the generated ASN.1 encode/decode code and in the application itself.</p> <p> *** POTENTIAL INCOMPATIBILITY ***</p> <p> Own Id: OTP-11594</p> </item> <item> <p>All functions in the <c>asn1rt</c> module, as well as <c>asn1ct:decode/3</c> and <c>asn1ct:encode/3</c>, are now deprecated.</p> <p> Own Id: OTP-11731</p> </item> <item> <p> Generated .hrl files are now protected from being included more than once.</p> <p> Own Id: OTP-11804</p> </item> </list> </section> </section> <section><title>Asn1 2.0.4</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> The default value for a <c>BIT STRING</c> would not always be recognized, causing the encoding to be incorrect for the DER/PER/UPER encodings.</p> <p> Own Id: OTP-11319</p> </item> <item> <p> The ASN.1 application would fail to build if the <c>.erlang</c> file printed something to standard output.</p> <p> Own Id: OTP-11360</p> </item> <item> <p>An union of integer ranges in an INTEGER constraint could sometimes be interpreted as the intersection of the range.</p> <p> Own Id: OTP-11411 Aux Id: seq12443 </p> </item> <item> <p> Extensible, multiple single value constraints (such as <c>INTEGER (1|17, ...)</c>) would be incorrectly encoded.</p> <p> Own Id: OTP-11415</p> </item> <item> <p> The ASN.1 compiler would fail to compile a constraint with values given for for the extension part (such as <c>INTEGER (1..10, ..., 11..20)</c>).</p> <p> Own Id: OTP-11504</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> The new option '<c>no_ok_wrapper</c>' generates M:encode/2 and M:decode/2 functions that don't wrap the return value in an {ok,...} tuple.</p> <p> Own Id: OTP-11314</p> </item> </list> </section> </section> <section><title>Asn1 2.0.3</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Open types greater than 16383 bytes will now be correctly encoded and decoded.</p> <p> Own Id: OTP-11262 Aux Id: seq12386, OTP-11223 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p>For the PER and UPER formats, code generation especially for encoding has been improved.</p> <p>When encoding BIT STRINGs, values longer than the maximum size for the BIT STRING type would be truncated silently - they now cause an exception.</p> <p>Open types greater than 16383 bytes will now be correctly encoded and decoded.</p> <p>IMPORTANT NOTE: For ASN.1 specifications that depend on each other, such as the S1AP-* specifications, it is important to recompile all specifications (compiling some with this version of the compiler and some with an older version will not work).</p> <p> Own Id: OTP-11300</p> </item> </list> </section> </section> <section><title>Asn1 2.0.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Fix some Makefile rules that didn't support silent rules. Thanks to Anthony Ramine.</p> <p> Own Id: OTP-11111</p> </item> <item> <p>PER/UPER: A semi-constrained INTEGER with a non-zero lower bound would be incorrectly decoded. This bug was introduced in R16.</p> <p>PER/UPER: Given <c>INTEGER (10..MAX, ...)</c>, attempting to decode any integer below 10 would cause the encoder to enter an infinite loop.</p> <p>PER/UPER: For a type with an extensible SIZE constraint, sizes outside of the root range were incorrectly encoded.</p> <p>Given a constraint such as <c>(SIZE (5, ...))</c>, encoding a size less than 5 would fail (PER/UPER). Similarly, for BER decoding would fail.</p> <p>PER: The encoder did not align a known multiplier string (such as IA5String) of length 16 bits (exactly) to an octet boundary.</p> <p>In rare circumstances, DEFAULT values for the UPER backend could be wrongly encoded.</p> <p> Own Id: OTP-11134</p> </item> <item> <p>UPER: The compiler would crash when compiling an ENUMERATED having more than 63 extended values.</p> <p>PER/UPER: A SEQUENCE with more 64 extended values could not be decoded.</p> <p> Own Id: OTP-11153</p> </item> <item> <p> When decoding a SEQUENCE defined inline inside a an extension addition group, the record named generated by the decoding code would not match the name in the generated .hrl file.</p> <p> Own Id: OTP-11154 Aux Id: seq12339 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Postscript files no longer needed for the generation of PDF files have been removed. </p> <p> Own Id: OTP-11016</p> </item> </list> </section> </section> <section><title>Asn1 2.0.1.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> When an object set is an actual parameter, the extension marker for the object set could get lost (which would cause the decoding of unknown values to fail).</p> <p> Own Id: OTP-10995 Aux Id: seq12290 </p> </item> </list> </section> </section> <section><title>Asn1 2.0.1.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p>The generated decoder for the 'per' and 'uper' backends did not correctly decode ENUMERATEDs with a single value.</p> <p>The generated encoder for the 'per' and 'uper' backends generated an empty binary for a top-level type that did not need to be encoded (such as an ENUMERATED with a single value). The correct result should be a binary containing a 0 byte.</p> <p> Own Id: OTP-10916 Aux Id: seq12270 </p> </item> </list> </section> </section> <section><title>Asn1 2.0.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Fixed broken table constraints within a SET OF or SEQUENCE OF for the BER backend.</p> <p> Own Id: OTP-10853 Aux Id: seq12245 </p> </item> </list> </section> </section> <section><title>Asn1 2.0</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Encoding SEQUENCEs with multiple extension addition groups with optional values could fail (depending both on the specification and whether all values were provided).</p> <p> Own Id: OTP-10664</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p>The options for the ASN.1 compiler has been drastically simplified. The backend is chosen by using <c>ber</c>, <c>per</c>, or <c>uper</c>. The options <c>optimize</c>, <c>nif</c>, and <c>driver</c> are no longer needed. The old options will still work, but will issue a warning.</p> <p>Another change is that generated <c>encode/2</c> function will always return a binary (some backends used to return an iolist).</p> <p> *** POTENTIAL INCOMPATIBILITY ***</p> <p> Own Id: OTP-10410 Aux Id: kunagi-254 [165] </p> </item> <item> <p> The ASN.1 compiler generates faster decode functions for PER and UPER. Some minor improvements have also been made for PER/UPER encoding, and to the BER backend.</p> <p> Own Id: OTP-10519 Aux Id: kunagi-322 [233] </p> </item> <item> <p>The ASN.1 compiler will now always include necessary run-time functions in the generated Erlang modules (except for <c>asn1rt_nif</c> which is still neeeded). If the option '<c>inline</c>' is used the ASN.1 compiler will generate a warning. But if '<c>{inline,OutputFile}</c>' is use, the ASN.1 compiler will refuse to compile the file. (Use a <c>.set.asn</c> file if you need to remove the output file.)</p> <p>The '<c>BIT STRING</c>' type will now be decoded as Erlang bitstrings by default. Use the new <c>legacy_bit_string</c> option to encode as lists of ones and zeroes. (The <c>compact_bit_string</c> option still works as before.)</p> <p>Open types are now always returned as binaries (when there is no information allowing them to be decoded).</p> <p> *** POTENTIAL INCOMPATIBILITY ***</p> <p> Own Id: OTP-10588 Aux Id: kunagi-341 [252] </p> </item> </list> </section> </section> <section><title>Asn1 1.8.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> ASN.1 decoders generated with the options <c>-bber_bin +optimize +nif</c> would decode open types with a size larger than 511 incorrectly. That bug could cause decoding by <c>public_key</c> to fail. The bug was in the NIF library <c>asn1_erl_nif.so</c>; therefore there is no need re-compile ASN.1 specifications that had the problem.</p> <p> Own Id: OTP-10805 Aux Id: seq12244 </p> </item> <item> <p> Encoding SEQUENCEs with multiple extension addition groups with optional values could fail (depending both on the specification and whether all values were provided).</p> <p> Own Id: OTP-10811 Aux Id: OTP-10664 </p> </item> </list> </section> </section> <section><title>Asn1 1.8</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Encoding and decoding of integer ranges can now be done with an upper bound larger than the previous limit of 16^10. The new upper bound in per encoding and decodings for constrained whole numbers is 2^2040 (close to 16^508)</p> <p> Own Id: OTP-10128</p> </item> <item> <p> Per encoding/decoding now works correctly for single value subtyping of an integer type where a subtype is a predefined value. Previously a predefined value could cause a non-valid range-check in the generated Erlang code for per encoding/decoding due to a bug in the constraint checking.</p> <p> Own Id: OTP-10139</p> </item> <item> <p> Fix typo error in selected decode function (Thanks to Artem Teslenko)</p> <p> Own Id: OTP-10152</p> </item> <item> <p> Better error indication when detecting unexpected tags during decoding of BER encoded data.</p> <p> Own Id: OTP-10186</p> </item> <item> <p> asn1rt_check: Fix transform_to_EXTERNAL1990 for binary input (Thanks to Harald Welte)</p> <p> Own Id: OTP-10233</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Add support for multiple ExtensionAdditionGroups</p> <p> Own Id: OTP-10058</p> </item> <item> <p> Add support for extensible enumeration types in n2n generated functions.</p> <p> Own Id: OTP-10144</p> </item> </list> </section> </section> <section><title>Asn1 1.7</title> <section><title>Improvements and New Features</title> <list> <item> <p> Some ASN.1 INTEGER type and SEQUENCE constructor variants previously not handled by the ASN.1 compiler are now correctly handled</p> <p> Own Id: OTP-9688</p> </item> <item> <p> An INTEGER with a value constraint where unions are used e.g. X1 ::= INTEGER (1..4 | 6 | 8 | 10 | 20) is not handled correctly. For PER the value is encoded in wrong number of bits.</p> <p> Own Id: OTP-9946</p> </item> </list> </section> </section> <section><title>Asn1 1.6.19</title> <section><title>Improvements and New Features</title> <list> <item> <p> The linked-in driver used for ber decode and per encode has been replaced with nifs. To enable the usage of nifs pass the nif option to erlc or asn1rt:compile when compiling. If you previously used the linked-in driver, you have to recompile your ASN1 modules with the current version of asn1 application as the linked-in driver modules have been removed.</p> <p> *** POTENTIAL INCOMPATIBILITY ***</p> <p> Own Id: OTP-9419</p> </item> <item> <p> A few of the heavy calculations which are done for encoding and decoding operations when dealing with SEQUENCE OF and DEFAULT in runtime have been moved to be done in compile time instead.</p> <p> Own Id: OTP-9440</p> </item> <item> <p> When compiling an ASN.1 ber module with the +nif option, the module will use a new nif for ber encoding, increasing performance by about 5%.</p> <p> Own Id: OTP-9441</p> </item> <item> <p> Tuple funs (a two-element tuple with a module name and a function) are now officially deprecated and will be removed in R16. Use '<c>fun M:F/A</c>' instead. To make you aware that your system uses tuple funs, the very first time a tuple fun is applied, a warning will be sent to the error logger.</p> <p> Own Id: OTP-9649</p> </item> </list> </section> </section> <section><title>Asn1 1.6.18</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Implement or fix -Werror option</p> <p> If -Werror is enabled and there are warnings no output file is written. Also make sure that error/warning reporting is consistent. (Thanks to Tuncer Ayaz)</p> <p> Own Id: OTP-9536</p> </item> </list> </section> </section> <section><title>Asn1 1.6.17</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Test cases which started failing when timer:tc was changed to not catch are corrected.</p> <p> Own Id: OTP-9286</p> </item> <item> <p> The bounds checking in the asn1_erl_driver when the length value of a TLV is a Long Definite Length is corrected. Thanks to Vance Shipley.</p> <p> Own Id: OTP-9303</p> </item> </list> </section> </section> <section><title>Asn1 1.6.16</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> asn1ct: Make formatting of errors and warnings consistent</p> <p> Consistently format warning and error reports. Warning and error options from erlc now also work in asnc1ct. (thanks to Tuncer Ayaz)</p> <p> Own Id: OTP-9062</p> </item> <item> <p> Shut off some dialyzer warnings</p> <p> Own Id: OTP-9063</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Crash in asn1ct_check, componentrelation_leadingattr fixed. (Thanks to Stephane Pamelard for finding the bug)</p> <p> Own Id: OTP-9092</p> </item> </list> </section> </section> <section><title>Asn1 1.6.15</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> The encoding of ExtensionAdditionGroup (for PER and UPER) is corrected.</p> <p> Own Id: OTP-8866 Aux Id: OTP-8797, SEQ-11557 </p> </item> <item> <p> A race condition when several processes in parallel start to do encode/decode using the driver could cause an error log regarding crashing port owner process. This race is now eliminated.</p> <p> Own Id: OTP-8948 Aux Id: seq11733 </p> </item> </list> </section> </section> <section><title>Asn1 1.6.14.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Extension Addition Groups are now supported by the parser and in all backends.</p> <p> Own Id: OTP-8598 Aux Id: seq-11557 </p> </item> <item> <p> Extension Addition Groups are now supported in nested types within a SEQUENCE and CHOICE as well (missed that in previous fix)</p> <p> Own Id: OTP-8797 Aux Id: seq-11557 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Bug in UNALIGNED PER regarding encoding and decoding of constrained numbers with a valuerange > 1024. (Thanks to Vincent de Phily)</p> <p> Own Id: OTP-8779</p> </item> <item> <p> Minor corrections in the User Guide.</p> <p> Own Id: OTP-8829</p> </item> </list> </section> </section> <section><title>Asn1 1.6.14</title> <section><title>Improvements and New Features</title> <list> <item> <p> By default, the ASN.1 compiler is now silent in the absence of warnings or errors. The new '<c>verbose</c>' option or the '<c>-v</c>' option for <c>erlc</c> can be given to show extra information (for instance, about the files that are generated). (Thanks to Tuncer Ayaz.)</p> <p> Own Id: OTP-8565</p> </item> </list> </section> </section> <section><title>Asn1 1.6.13</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Harmless buffer overflow by one byte in asn1 and ram_file_drv.</p> <p> Own Id: OTP-8451</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p>Cross compilation improvements and other build system improvements.</p> <p>Most notable:</p> <list><item> Lots of cross compilation improvements. The old cross compilation support was more or less non-existing as well as broken. Please, note that the cross compilation support should still be considered as experimental. Also note that old cross compilation configurations cannot be used without modifications. For more information on cross compiling Erlang/OTP see the <c>$ERL_TOP/INSTALL-CROSS.md</c> file. </item><item> Support for staged install using <url href="http://www.gnu.org/prep/standards/html_node/DESTDIR.html">DESTDIR</url>. The old broken <c>INSTALL_PREFIX</c> has also been fixed. For more information see the <c>$ERL_TOP/INSTALL.md</c> file. </item><item> Documentation of the <c>release</c> target of the top <c>Makefile</c>. For more information see the <c>$ERL_TOP/INSTALL.md</c> file. </item><item> <c>make install</c> now by default creates relative symbolic links instead of absolute ones. For more information see the <c>$ERL_TOP/INSTALL.md</c> file. </item><item> <c>$ERL_TOP/configure --help=recursive</c> now works and prints help for all applications with <c>configure</c> scripts. </item><item> Doing <c>make install</c>, or <c>make release</c> directly after <c>make all</c> no longer triggers miscellaneous rebuilds. </item><item> Existing bootstrap system is now used when doing <c>make install</c>, or <c>make release</c> without a preceding <c>make all</c>. </item><item> The <c>crypto</c> and <c>ssl</c> applications use the same runtime library path when dynamically linking against <c>libssl.so</c> and <c>libcrypto.so</c>. The runtime library search path has also been extended. </item><item> The <c>configure</c> scripts of <c>erl_interface</c> and <c>odbc</c> now search for thread libraries and thread library quirks the same way as ERTS do. </item><item> The <c>configure</c> script of the <c>odbc</c> application now also looks for odbc libraries in <c>lib64</c> and <c>lib/64</c> directories when building on a 64-bit system. </item><item> The <c>config.h.in</c> file in the <c>erl_interface</c> application is now automatically generated in instead of statically updated which reduces the risk of <c>configure</c> tests without any effect. </item></list> <p>(Thanks to Henrik Riomar for suggestions and testing)</p> <p>(Thanks to Winston Smith for the AVR32-Linux cross configuration and testing)</p> <p> *** POTENTIAL INCOMPATIBILITY ***</p> <p> Own Id: OTP-8323</p> </item> <item> <p> Add support for prefixing macro names generated by the compiler</p> <p> This is useful when multiple protocols that contains macros with identical names are included in a single module.</p> <p> Add the missing <c>record_name_prefix</c> compiler option to the documentation.</p> <p> Own Id: OTP-8453</p> </item> <item> <p> Cleanups suggested by tidier and modernization of types and specs.</p> <p> Own Id: OTP-8455</p> </item> <item> <p> Support for <c>EXTENSIBILITY IMPLIED</c> and <c>SET/SEQ OF NamedType</c> is added.</p> <p> Own Id: OTP-8463</p> </item> </list> </section> </section> <section><title>Asn1 1.6.12</title> <section><title>Improvements and New Features</title> <list> <item> <p> The documentation is now built with open source tools (xsltproc and fop) that exists on most platforms. One visible change is that the frames are removed.</p> <p> Own Id: OTP-8256</p> </item> </list> </section> </section> <section><title>Asn1 1.6.11</title> <section><title>Improvements and New Features</title> <list> <item> <p> A new option <c>{n2n,TypeName}</c> can be used to enable generation of conversion functions from name to number and vice versa for selected ENUMERATION types. The option can be repeated many times in order to specify several types in the same file.<br/> If the <c>TypeName</c> specified does not exists or is not an ENUMERATION type, the compilation will be terminated with an error code.<br/> Below follows an example on how to use the option from the command line with <c>erlc</c>:<br/> <c>erlc -bper+"{n2n,'CauseMisc'}" +"{n2n,'CausePcl'}" MyModyle.asn</c> </p> <p> Own Id: OTP-8136 Aux Id: seq11347 </p> </item> <item> <p> Range checks added for BIT STRING with fixed SIZE constraint.</p> <p> Own Id: OTP-7972 Aux Id: seq11280 </p> </item> <item> <p> Now support multiple-line comments in asn1-specs as specified in ASN1 X.680 (07/2002), section 11.6.4</p> <p> Own Id: OTP-8043</p> </item> <item> <p> Now parses and adds abstract syntax for PATTERN subtype constraint. No other action is taken on this type of constraint.</p> <p> Own Id: OTP-8046</p> </item> <item> <p> The ASN1 subtype constraint <c>CONTAINING Type</c>, <c>CONTAINING Type ENCODED BY Value</c> and <c>ENCODED BY Value</c> now is parsed. Abstract syntax is added but no further action in generated code is taken.</p> <p> Own Id: OTP-8047</p> </item> </list> </section> </section> <section><title>Asn1 1.6.10</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> A faulty receive case that catch-ed all messages in the initialization of the driver has been removed, the initialization has been restructured.</p> <p> Own Id: OTP-7954 Aux Id: seq11220 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> The anonymous part of the decode that splits the ASN1 TLV into Tag Value tuples has been optimized.</p> <p> Own Id: OTP-7953</p> </item> </list> </section> </section> <section><title>Asn1 1.6.9</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Error that caused crash when drivers were loaded is now corrected. Parallel driver for asn1 now enabled.</p> <p> Own Id: OTP-7904 Aux Id: seq11220 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Optimized code for ENUMERATION type in encoder/decoder.</p> <p> Own Id: OTP-7909</p> </item> </list> </section> </section> <section><title>Asn1 1.6.8.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Removed parallel-driver functionality due to failure when loading the driver.</p> <p> Own Id: OTP-7900 Aux Id: seq11220 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Generated code now uses guards that is not obsolete, e.g. <c>is_integer/1</c> instead of <c>integer/1</c>.</p> <p> Own Id: OTP-7910</p> </item> </list> </section> </section> <section><title>Asn1 1.6.8</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> A BIT STRING with a size constraint that has a single value and an extension as in <c> BIT STRING (SIZE (16,...))</c> was erroneous encoded/decoded. This is now corrected and follows X.691 Section 15.6.</p> <p> Own Id: OTP-7876 Aux Id: seq11220 </p> </item> </list> </section> </section> <section><title>Asn1 1.6.7</title> <section><title>Improvements and New Features</title> <list> <item> <p> Now asn1 starts multiple drivers to enable simultaneous encode/decode in different processes for the asn1-backends using linked-in driver.</p> <p> Own Id: OTP-7801</p> </item> </list> </section> </section> <section><title>Asn1 1.6.6</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Decode of an open_type when the value was empty tagged type encoded with indefinite length failed. This is now corrected.</p> <p> Own Id: OTP-7759 Aux Id: seq11166 </p> </item> <item> <p> Encode of BIT STRING with size of exact length, on compact_bit_string format in UNALIGNED PER failed when value had the right size, i.e. no padding needed.</p> <p> Own Id: OTP-7763 Aux Id: seq11182 </p> </item> </list> </section> </section> <section><title>Asn1 1.6.5</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> For a BIT STRING with SIZE constraint higher than 255 compiled with <c>[per_bin,optimize, compact_bit_string]</c> an improper io-list was created and sent to the c-driver for complete encoding. This error has been resolved.</p> <p> Own Id: OTP-7734 Aux Id: seq11170 </p> </item> </list> </section> </section> <section><title>Asn1 1.6.4</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> A a SEQUENCE OF with a type that is a CHOICE with ellipses occurred falsely a compile error. The error causing that is now removed.</p> <p> Own Id: OTP-7708 Aux Id: seq11136 </p> </item> </list> </section> </section> <section><title>Asn1 1.6.3</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> constrained number with a value-range greater than 512 now has the proper interpretation of the values that causes shift to the next number of units (bits), According to limit condition <c>2^m &lt; "range" =&lt; 2^(m + 1)</c> then the number of bits are m + 1.</p> <p> Own Id: OTP-7681 Aux Id: seq11114 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Can now handle default values of simple types that is provided on its own format, i.e. not just as asn1_DEFAULT.</p> <p> Own Id: OTP-7678 Aux Id: seq11114 </p> </item> </list> </section> </section> <section><title>Asn1 1.6.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> comparison of two value definitions failed due to new module name field in valuedef record. It is now corrected.</p> <p> Own Id: OTP-7608</p> </item> </list> </section> </section> <section><title>Asn1 1.6.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Bug regarding propagation of parameters of parameterized type fixed.</p> <p> Own Id: OTP-7174 Aux Id: seq10864 </p> </item> <item> <p> A bug, related to instantiation of a parameterized type with a type definition in the parameter-list, has been removed. The definition of the parameter type was in another module than the instance definition causing limited module info.</p> <p> Own Id: OTP-7299 Aux Id: seq10864 </p> </item> <item> <p> Removed hard-coded name that may cause name collision.</p> <p> Own Id: OTP-7322 Aux Id: seq10864 </p> </item> <item> <p> Object set of a class with id with properties UNIQUE OPTIONAL and the id field is lacking in the object is for now treated as a object without a unique identifier, i.e. no table is generated for this object.</p> <p> Own Id: OTP-7332 Aux Id: seq10864 </p> </item> <item> <p> Compiler crashed when failed to handle a OID as ValueFromObject.</p> <p> Own Id: OTP-7476 Aux Id: seq10999 </p> </item> <item> <p> A corrupted encoding may cause a loop when a buffer of at least two bytes of zero matches tag and length of a SET component. This behavior occurred only with decoder generated with <c>ber</c> or <c>ber_bin</c> options. Now a control breaks the loop.</p> <p> Own Id: OTP-7533</p> </item> <item> <p> Encode of BIT STRING longer than 255 bits with a <c>SIZE(integer())</c> constraint caused a crash when spec was compiled with <c>per_bin, optimize</c> options.</p> <p> Own Id: OTP-7602 Aux Id: seq11079 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Now supports REAL type of base 2 and 10</p> <p> Own Id: OTP-7166 Aux Id: seq10864 </p> </item> <item> <p> By the asn1 compiler option <c>{record_name_prefix Name}</c> a prefix is chosen to the name of the record generated in the .hrl and used in the generated .erl files.</p> <p> Own Id: OTP-7204 Aux Id: seq10853 </p> </item> <item> <p> The TypeFromObject production now covered</p> <p> Own Id: OTP-7295 Aux Id: seq10468 </p> </item> <item> <p> Extended support for ObjectSetFromObjects. Production occurred as a part of the RootElementSetSpec of the ObjectSetSpec. Added also support for Exclusion of Element in ObjectSetSpec.</p> <p> Own Id: OTP-7306 Aux Id: seq10864 </p> </item> <item> <p> Now implements RELATIVE-OID</p> <p> Own Id: OTP-7334 Aux Id: seq10864 </p> </item> </list> </section> </section> <section><title>Asn1 1.6</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Now is ordering, according to the canonical order, of components in a SET added. Canonical order is described in X.691 9.2 and X.680 8.6</p> <p> Own Id: OTP-7375 Aux Id: unaligned PER </p> </item> <item> <p> The precedence rules for extended constraints have been misinterpreted. The rule says for instance that if there are more than one constraint on a type that have extension-mark, only the last of the extension-marks would be kept. This affects the encoding of PER and is now corrected.</p> <p> Own Id: OTP-7400 Aux Id: OTP-7335 </p> </item> <item> <p> A constrained number with a single-value constraint that is extensible was falsely encoded/decoded in aligned/unaligned PER. This is now corrected.</p> <p> Own Id: OTP-7403</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> The ASN.1 compiler has got a new backend supporting PER UNALIGNED. Previously it was only support for PER ALIGNED.</p> <p> Own Id: OTP-7335</p> </item> <item> <p> Now the asn1-compiler handles unions and intersections of PermittedAlphabet constraints.</p> <p> Own Id: OTP-7374 Aux Id: unaligned PER </p> </item> <item> <p> With the undocumented option <c>no_final_padding</c> the whole encoded message is not padded to a border of a byte. Thus the returned encoded message is a <c>bitstring</c>.</p> <p> Own Id: OTP-7407</p> </item> </list> </section> </section> <section><title>Asn1 1.5.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> When duplicates of object fields were removed only one table access function for each unique identifier value was generated. This can occur when several object sets are merged by use of ObjectSetFromObjects.</p> <p> Own Id: OTP-7263 Aux Id: seq10864 </p> </item> <item> <p> DER: For some complex types and components with reference to type in several steps the default value check function was not generated. This is now fixed.</p> <p> Own Id: OTP-7268 Aux Id: seq10684 </p> </item> <item> <p> Now is the tag in a tagged type as parameter propagated to the instance.</p> <p> Own Id: OTP-7273 Aux Id: seq10864 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Added type T61String that is similar to TeletexString</p> <p> Own Id: OTP-7264 Aux Id: seq10864 </p> </item> </list> </section> </section> <section><title>Asn1 1.5.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> A bug related to renaming of types has been fixed.This occurred using the .set.asn functionality.</p> <p> Own Id: OTP-7149 Aux Id: seq10853 </p> </item> <item> <p> syntax error in ASN1 value now correctly shown</p> <p> Own Id: OTP-7154 Aux Id: seq10864 </p> </item> <item> <p> Now a COMPONENTS OF construct in a parameterized type is expanded correctly</p> <p> Own Id: OTP-7155 Aux Id: seq10864 </p> </item> <item> <p> Now the asn1-compiler also handles empty SEQUENCE DEFAULT values as <c>{}</c>.</p> <p> Own Id: OTP-7169 Aux Id: seq10864 </p> </item> <item> <p> Now SelectionType gets the tag of the selected type.</p> <p> Own Id: OTP-7171 Aux Id: seq10864 </p> </item> <item> <p> Correction of generated code for decode of an open type in a SEQUECNE OF/ SET OF</p> <p> Own Id: OTP-7193 Aux Id: seq10875 </p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Misc improvements and bug corrections regarding default values.</p> <p> Own Id: OTP-7199 Aux Id: seq10864 </p> </item> </list> </section> </section> <section><title>Asn1 1.5</title> <section><title>Improvements and New Features</title> <list> <item> <p> Now generating records in .hrl file for instances of parameterized SEQUENCE or SET.</p> <p> Own Id: OTP-6835</p> </item> <item> <p> Optimization using bitstr in encode/decode functions. Active with <c>[per_bin, optimize]</c> options.</p> <p> *** POTENTIAL INCOMPATIBILITY ***</p> <p> Own Id: OTP-6882</p> </item> </list> </section> </section> <section><title>Asn1 1.4.6</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> <p> Parsing and encoding/decoding of type constrained with SIZE with extension is now recovered.</p> <p> Own Id: OTP-6763</p> </item> <item> <p> <c>inline</c> failed because trying to use a removed module.</p> <p> Own Id: OTP-6769</p> </item> <item> <p> Fixed problem with a reference to a type from an object. The failure was caused bye change of type name when using <c>inline</c> option.</p> <p> Own Id: OTP-6770</p> </item> <item> <p> Handling of decode pattern for exclusive decode was false in the case when an un-decoded component had more than one following elements that should be decoded.</p> <p> Own Id: OTP-6786</p> </item> </list> </section> <section><title>Improvements and New Features</title> <list> <item> <p> Now the asn1-compiler supports two root lists in SEQUENCE and SET according to alternative three in ComponentTypeLists (X.680 07/2002 section 24.1), i.e. with an extension list between two ellipses.</p> <p> Own Id: OTP-5067 Aux Id: seq8452 </p> </item> </list> </section> </section> <section> <title>Asn1 1.4.5</title> <section> <title>Fixed Bugs and Malfunctions</title> <list type="bulleted"> <item> <p>Merging modules by <c>inline</c> earlier disabled the driver (used in modules generated with [optimized]/[optimized,driver] options). Now this is repaired.</p> <p>Own Id: OTP-6601</p> </item> <item> <p>Checking phase now aware of which module an INSTANCE OF is declared in.</p> <p>Own Id: OTP-6702</p> </item> </list> </section> <section> <title>Improvements and New Features</title> <list type="bulleted"> <item> <p>The compiler now handle all forms of ObjectSetSpec according to ITU-T recommendation X.681 (ISO/IEC 8824-2:2002).</p> <p>Own Id: OTP-6698</p> </item> <item> <p>Enhanced support of referencing object sets by ObjectSetFromObjects.</p> <p>Own Id: OTP-6707</p> </item> <item> <p>Support for parameterized object in an object set.</p> <p>Own Id: OTP-6717</p> </item> </list> </section> <!-- p>There are also release notes for <url href="notes_history.html">older versions</url>.</p --> </section> </chapter>
{ "content_hash": "04ef015a1b02f5a4d388483b3fab5a9f", "timestamp": "", "source": "github", "line_count": 1765, "max_line_length": 103, "avg_line_length": 29.30311614730878, "alnum_prop": 0.5633990719257541, "repo_name": "ahmedshafeeq/otp", "id": "ac3d9c828e63290d22760bfdec0b6fd18d8fc995", "size": "51721", "binary": false, "copies": "1", "ref": "refs/heads/maint", "path": "lib/asn1/doc/src/notes.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "30325" }, { "name": "Assembly", "bytes": "135079" }, { "name": "Batchfile", "bytes": "1110" }, { "name": "C", "bytes": "13421688" }, { "name": "C++", "bytes": "1969015" }, { "name": "CSS", "bytes": "12318" }, { "name": "DIGITAL Command Language", "bytes": "21" }, { "name": "DTrace", "bytes": "231080" }, { "name": "Emacs Lisp", "bytes": "398675" }, { "name": "Erlang", "bytes": "73451638" }, { "name": "Groff", "bytes": "1954" }, { "name": "HTML", "bytes": "430372" }, { "name": "Java", "bytes": "666915" }, { "name": "JavaScript", "bytes": "33014" }, { "name": "Logos", "bytes": "8702" }, { "name": "M4", "bytes": "346189" }, { "name": "Makefile", "bytes": "1438754" }, { "name": "NSIS", "bytes": "27852" }, { "name": "Objective-C", "bytes": "717" }, { "name": "Perl", "bytes": "99717" }, { "name": "Python", "bytes": "117385" }, { "name": "Ruby", "bytes": "8160" }, { "name": "Shell", "bytes": "369668" }, { "name": "Tcl", "bytes": "9372" }, { "name": "XSLT", "bytes": "226965" } ] }
/* eslint-disable consistent-return */ const chalk = require('chalk'); const _ = require('lodash'); const prompts = require('./prompts'); const BaseGenerator = require('../generator-base'); const writeFiles = require('./files').writeFiles; const packagejs = require('../../package.json'); const crypto = require('crypto'); const os = require('os'); const constants = require('../generator-constants'); let useBlueprint; module.exports = class extends BaseGenerator { constructor(args, opts) { super(args, opts); this.configOptions = this.options.configOptions || {}; // This adds support for a `--[no-]client-hook` flag this.option('client-hook', { desc: 'Enable Webpack hook from maven/gradle build', type: Boolean, defaults: false }); // This adds support for a `--[no-]i18n` flag this.option('i18n', { desc: 'Disable or enable i18n when skipping client side generation, has no effect otherwise', type: Boolean, defaults: true }); // This adds support for a `--protractor` flag this.option('protractor', { desc: 'Enable protractor tests', type: Boolean, defaults: false }); // This adds support for a `--cucumber` flag this.option('cucumber', { desc: 'Enable cucumber tests', type: Boolean, defaults: false }); // This adds support for a `--skip-user-management` flag this.option('skip-user-management', { desc: 'Skip the user management module during app generation', type: Boolean, defaults: false }); // This adds support for a `--experimental` flag which can be used to enable experimental features this.option('experimental', { desc: 'Enable experimental features. Please note that these features may be unstable and may undergo breaking changes at any time', type: Boolean, defaults: false }); this.setupServerOptions(this); const blueprint = this.options.blueprint || this.configOptions.blueprint || this.config.get('blueprint'); if (!opts.fromBlueprint) { // use global variable since getters dont have access to instance property useBlueprint = this.composeBlueprint( blueprint, 'server', { 'client-hook': !this.skipClient, configOptions: this.configOptions, force: this.options.force } ); } else { useBlueprint = false; } } // Public API method used by the getter and also by Blueprints _initializing() { return { displayLogo() { if (this.logo) { this.printJHipsterLogo(); } }, setupServerconsts() { // Make constants available in templates this.MAIN_DIR = constants.MAIN_DIR; this.TEST_DIR = constants.TEST_DIR; this.CLIENT_MAIN_SRC_DIR = constants.CLIENT_MAIN_SRC_DIR; this.CLIENT_TEST_SRC_DIR = constants.CLIENT_TEST_SRC_DIR; this.SERVER_MAIN_SRC_DIR = constants.SERVER_MAIN_SRC_DIR; this.SERVER_MAIN_RES_DIR = constants.SERVER_MAIN_RES_DIR; this.SERVER_TEST_SRC_DIR = constants.SERVER_TEST_SRC_DIR; this.SERVER_TEST_RES_DIR = constants.SERVER_TEST_RES_DIR; this.DOCKER_JHIPSTER_REGISTRY = constants.DOCKER_JHIPSTER_REGISTRY; this.DOCKER_JAVA_JRE = constants.DOCKER_JAVA_JRE; this.DOCKER_MYSQL = constants.DOCKER_MYSQL; this.DOCKER_MARIADB = constants.DOCKER_MARIADB; this.DOCKER_POSTGRESQL = constants.DOCKER_POSTGRESQL; this.DOCKER_MONGODB = constants.DOCKER_MONGODB; this.DOCKER_COUCHBASE = constants.DOCKER_COUCHBASE; this.DOCKER_MSSQL = constants.DOCKER_MSSQL; this.DOCKER_ORACLE = constants.DOCKER_ORACLE; this.DOCKER_HAZELCAST_MANAGEMENT_CENTER = constants.DOCKER_HAZELCAST_MANAGEMENT_CENTER; this.DOCKER_MEMCACHED = constants.DOCKER_MEMCACHED; this.DOCKER_CASSANDRA = constants.DOCKER_CASSANDRA; this.DOCKER_ELASTICSEARCH = constants.DOCKER_ELASTICSEARCH; this.DOCKER_KEYCLOAK = constants.DOCKER_KEYCLOAK; this.DOCKER_KAFKA = constants.DOCKER_KAFKA; this.DOCKER_ZOOKEEPER = constants.DOCKER_ZOOKEEPER; this.DOCKER_SONAR = constants.DOCKER_SONAR; this.DOCKER_JHIPSTER_CONSOLE = constants.DOCKER_JHIPSTER_CONSOLE; this.DOCKER_JHIPSTER_ELASTICSEARCH = constants.DOCKER_JHIPSTER_ELASTICSEARCH; this.DOCKER_JHIPSTER_LOGSTASH = constants.DOCKER_JHIPSTER_LOGSTASH; this.DOCKER_TRAEFIK = constants.DOCKER_TRAEFIK; this.DOCKER_CONSUL = constants.DOCKER_CONSUL; this.DOCKER_CONSUL_CONFIG_LOADER = constants.DOCKER_CONSUL_CONFIG_LOADER; this.DOCKER_SWAGGER_EDITOR = constants.DOCKER_SWAGGER_EDITOR; this.JAVA_VERSION = constants.JAVA_VERSION; this.SCALA_VERSION = constants.SCALA_VERSION; this.NODE_VERSION = constants.NODE_VERSION; this.YARN_VERSION = constants.YARN_VERSION; this.NPM_VERSION = constants.NPM_VERSION; this.packagejs = packagejs; const configuration = this.getAllJhipsterConfig(this, true); this.applicationType = configuration.get('applicationType') || this.configOptions.applicationType; if (!this.applicationType) { this.applicationType = 'monolith'; } this.packageName = configuration.get('packageName'); this.serverPort = configuration.get('serverPort'); if (this.serverPort === undefined) { this.serverPort = '8080'; } this.websocket = configuration.get('websocket') === 'no' ? false : configuration.get('websocket'); this.searchEngine = configuration.get('searchEngine') === 'no' ? false : configuration.get('searchEngine'); if (this.searchEngine === undefined) { this.searchEngine = false; } this.jhiPrefix = this.configOptions.jhiPrefix || configuration.get('jhiPrefix'); this.jhiTablePrefix = this.getTableName(this.jhiPrefix); this.messageBroker = configuration.get('messageBroker') === 'no' ? false : configuration.get('messageBroker'); if (this.messageBroker === undefined) { this.messageBroker = false; } this.enableSwaggerCodegen = configuration.get('enableSwaggerCodegen'); this.serviceDiscoveryType = configuration.get('serviceDiscoveryType') === 'no' ? false : configuration.get('serviceDiscoveryType'); if (this.serviceDiscoveryType === undefined) { this.serviceDiscoveryType = false; } this.cacheProvider = configuration.get('cacheProvider') || configuration.get('hibernateCache') || 'no'; this.enableHibernateCache = configuration.get('enableHibernateCache') || (configuration.get('hibernateCache') !== undefined && configuration.get('hibernateCache') !== 'no' && configuration.get('hibernateCache') !== 'memcached'); this.databaseType = configuration.get('databaseType'); if (this.databaseType === 'mongodb') { this.devDatabaseType = 'mongodb'; this.prodDatabaseType = 'mongodb'; this.enableHibernateCache = false; } else if (this.databaseType === 'couchbase') { this.devDatabaseType = 'couchbase'; this.prodDatabaseType = 'couchbase'; this.enableHibernateCache = false; } else if (this.databaseType === 'cassandra') { this.devDatabaseType = 'cassandra'; this.prodDatabaseType = 'cassandra'; this.enableHibernateCache = false; } else if (this.databaseType === 'no') { // no database, only available for microservice applications this.devDatabaseType = 'no'; this.prodDatabaseType = 'no'; this.enableHibernateCache = false; } else { // sql this.devDatabaseType = configuration.get('devDatabaseType'); this.prodDatabaseType = configuration.get('prodDatabaseType'); } // Hazelcast is mandatory for Gateways, as it is used for rate limiting if (this.applicationType === 'gateway' && this.serviceDiscoveryType) { this.cacheProvider = 'hazelcast'; } this.buildTool = configuration.get('buildTool'); this.jhipsterVersion = packagejs.version; if (this.jhipsterVersion === undefined) { this.jhipsterVersion = configuration.get('jhipsterVersion'); } this.authenticationType = configuration.get('authenticationType'); if (this.authenticationType === 'session') { this.rememberMeKey = configuration.get('rememberMeKey'); } this.jwtSecretKey = configuration.get('jwtSecretKey'); this.nativeLanguage = configuration.get('nativeLanguage'); this.languages = configuration.get('languages'); this.uaaBaseName = configuration.get('uaaBaseName'); this.clientFramework = configuration.get('clientFramework'); const testFrameworks = configuration.get('testFrameworks'); if (testFrameworks) { this.testFrameworks = testFrameworks; } const baseName = configuration.get('baseName'); if (baseName) { // to avoid overriding name from configOptions this.baseName = baseName; } // force variables unused by microservice applications if (this.applicationType === 'microservice' || this.applicationType === 'uaa') { this.websocket = false; } const serverConfigFound = this.packageName !== undefined && this.authenticationType !== undefined && this.cacheProvider !== undefined && this.enableHibernateCache !== undefined && this.websocket !== undefined && this.databaseType !== undefined && this.devDatabaseType !== undefined && this.prodDatabaseType !== undefined && this.searchEngine !== undefined && this.buildTool !== undefined; if (this.baseName !== undefined && serverConfigFound) { // Generate remember me key if key does not already exist in config if (this.authenticationType === 'session' && this.rememberMeKey === undefined) { this.rememberMeKey = crypto.randomBytes(20).toString('hex'); } // Generate JWT secret key if key does not already exist in config if (this.authenticationType === 'jwt' && this.jwtSecretKey === undefined) { this.jwtSecretKey = crypto.randomBytes(20).toString('hex'); } // If translation is not defined, it is enabled by default if (this.enableTranslation === undefined) { this.enableTranslation = true; } if (this.nativeLanguage === undefined) { this.nativeLanguage = 'en'; } if (this.languages === undefined) { this.languages = ['en', 'fr']; } // user-management will be handled by UAA app, oauth expects users to be managed in IpP if ((this.applicationType === 'gateway' && this.authenticationType === 'uaa') || this.authenticationType === 'oauth2') { this.skipUserManagement = true; } this.log(chalk.green('This is an existing project, using the configuration from your .yo-rc.json file \n' + 'to re-generate the project...\n')); this.existingProject = true; } } }; } get initializing() { if (useBlueprint) return; return this._initializing(); } // Public API method used by the getter and also by Blueprints _prompting() { return { askForModuleName: prompts.askForModuleName, askForServerSideOpts: prompts.askForServerSideOpts, askForOptionalItems: prompts.askForOptionalItems, askFori18n: prompts.askFori18n, setSharedConfigOptions() { this.configOptions.packageName = this.packageName; this.configOptions.cacheProvider = this.cacheProvider; this.configOptions.enableHibernateCache = this.enableHibernateCache; this.configOptions.websocket = this.websocket; this.configOptions.databaseType = this.databaseType; this.configOptions.devDatabaseType = this.devDatabaseType; this.configOptions.prodDatabaseType = this.prodDatabaseType; this.configOptions.searchEngine = this.searchEngine; this.configOptions.messageBroker = this.messageBroker; this.configOptions.serviceDiscoveryType = this.serviceDiscoveryType; this.configOptions.buildTool = this.buildTool; this.configOptions.enableSwaggerCodegen = this.enableSwaggerCodegen; this.configOptions.authenticationType = this.authenticationType; this.configOptions.uaaBaseName = this.uaaBaseName; this.configOptions.serverPort = this.serverPort; // Make dist dir available in templates if (this.buildTool === 'maven') { this.BUILD_DIR = 'target/'; } else { this.BUILD_DIR = 'build/'; } this.CLIENT_DIST_DIR = this.BUILD_DIR + constants.CLIENT_DIST_DIR; // Make documentation URL available in templates this.DOCUMENTATION_URL = constants.JHIPSTER_DOCUMENTATION_URL; this.DOCUMENTATION_ARCHIVE_URL = `${constants.JHIPSTER_DOCUMENTATION_URL + constants.JHIPSTER_DOCUMENTATION_ARCHIVE_PATH}v${this.jhipsterVersion}`; } }; } get prompting() { if (useBlueprint) return; return this._prompting(); } // Public API method used by the getter and also by Blueprints _configuring() { return { insight() { const insight = this.insight(); insight.trackWithEvent('generator', 'server'); insight.track('app/authenticationType', this.authenticationType); insight.track('app/cacheProvider', this.cacheProvider); insight.track('app/enableHibernateCache', this.enableHibernateCache); insight.track('app/websocket', this.websocket); insight.track('app/databaseType', this.databaseType); insight.track('app/devDatabaseType', this.devDatabaseType); insight.track('app/prodDatabaseType', this.prodDatabaseType); insight.track('app/searchEngine', this.searchEngine); insight.track('app/messageBroker', this.messageBroker); insight.track('app/serviceDiscoveryType', this.serviceDiscoveryType); insight.track('app/buildTool', this.buildTool); insight.track('app/enableSwaggerCodegen', this.enableSwaggerCodegen); }, configureGlobal() { // Application name modified, using each technology's conventions this.angularAppName = this.getAngularAppName(); this.camelizedBaseName = _.camelCase(this.baseName); this.dasherizedBaseName = _.kebabCase(this.baseName); this.lowercaseBaseName = this.baseName.toLowerCase(); this.humanizedBaseName = _.startCase(this.baseName); this.mainClass = this.getMainClassName(); this.cacheManagerIsAvailable = ['ehcache', 'hazelcast', 'infinispan', 'memcached'].includes(this.cacheProvider); this.pkType = this.getPkType(this.databaseType); this.packageFolder = this.packageName.replace(/\./g, '/'); if (!this.nativeLanguage) { // set to english when translation is set to false this.nativeLanguage = 'en'; } }, saveConfig() { this.config.set('jhipsterVersion', packagejs.version); this.config.set('applicationType', this.applicationType); this.config.set('baseName', this.baseName); this.config.set('packageName', this.packageName); this.config.set('packageFolder', this.packageFolder); this.config.set('serverPort', this.serverPort); this.config.set('authenticationType', this.authenticationType); this.config.set('uaaBaseName', this.uaaBaseName); this.config.set('cacheProvider', this.cacheProvider); this.config.set('enableHibernateCache', this.enableHibernateCache); this.config.set('websocket', this.websocket); this.config.set('databaseType', this.databaseType); this.config.set('devDatabaseType', this.devDatabaseType); this.config.set('prodDatabaseType', this.prodDatabaseType); this.config.set('searchEngine', this.searchEngine); this.config.set('messageBroker', this.messageBroker); this.config.set('serviceDiscoveryType', this.serviceDiscoveryType); this.config.set('buildTool', this.buildTool); this.config.set('enableSwaggerCodegen', this.enableSwaggerCodegen); this.config.set('jwtSecretKey', this.jwtSecretKey); this.config.set('rememberMeKey', this.rememberMeKey); this.config.set('enableTranslation', this.enableTranslation); if (this.enableTranslation && !this.configOptions.skipI18nQuestion) { this.config.set('nativeLanguage', this.nativeLanguage); this.config.set('languages', this.languages); } } }; } get configuring() { if (useBlueprint) return; return this._configuring(); } // Public API method used by the getter and also by Blueprints _default() { return { getSharedConfigOptions() { this.useSass = this.configOptions.useSass ? this.configOptions.useSass : false; if (this.configOptions.enableTranslation !== undefined) { this.enableTranslation = this.configOptions.enableTranslation; } if (this.configOptions.nativeLanguage !== undefined) { this.nativeLanguage = this.configOptions.nativeLanguage; } if (this.configOptions.languages !== undefined) { this.languages = this.configOptions.languages; } if (this.configOptions.testFrameworks) { this.testFrameworks = this.configOptions.testFrameworks; } if (this.configOptions.clientFramework) { this.clientFramework = this.configOptions.clientFramework; } this.protractorTests = this.testFrameworks.includes('protractor'); this.gatlingTests = this.testFrameworks.includes('gatling'); this.cucumberTests = this.testFrameworks.includes('cucumber'); }, composeLanguages() { if (this.configOptions.skipI18nQuestion) return; this.composeLanguagesSub(this, this.configOptions, 'server'); } }; } get default() { if (useBlueprint) return; return this._default(); } // Public API method used by the getter and also by Blueprints _writing() { return writeFiles(); } get writing() { if (useBlueprint) return; return this._writing(); } // Public API method used by the getter and also by Blueprints _end() { return { end() { if (this.prodDatabaseType === 'oracle') { this.log('\n\n'); this.warning(`${chalk.yellow.bold('You have selected Oracle database.\n') }Please follow our documentation on using Oracle to set up the \n` + 'Oracle proprietary JDBC driver.'); } this.log(chalk.green.bold('\nServer application generated successfully.\n')); let executable = 'mvnw'; if (this.buildTool === 'gradle') { executable = 'gradlew'; } let logMsgComment = ''; if (os.platform() === 'win32') { logMsgComment = ` (${chalk.yellow.bold(executable)} if using Windows Command Prompt)`; } this.log(chalk.green(`${'Run your Spring Boot application:' + '\n '}${chalk.yellow.bold(`./${executable}`)}${logMsgComment}`)); } }; } get end() { if (useBlueprint) return; return this._end(); } };
{ "content_hash": "fa4ca71d9470d20292a022e1d1228dd4", "timestamp": "", "source": "github", "line_count": 466, "max_line_length": 244, "avg_line_length": 48.61158798283262, "alnum_prop": 0.5637663885578069, "repo_name": "erikkemperman/generator-jhipster", "id": "86b07a5026c767c43ce11e14b2441c8abf3f8301", "size": "23405", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "generators/server/index.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "74907" }, { "name": "HTML", "bytes": "424410" }, { "name": "Java", "bytes": "975372" }, { "name": "JavaScript", "bytes": "1139583" }, { "name": "Shell", "bytes": "26594" }, { "name": "TypeScript", "bytes": "866164" } ] }
import { Injectable } from '@angular/core'; import { GeoItem } from '../geo-item.interface'; import * as L from 'leaflet'; import { TranslateService } from '@ngx-translate/core'; import { BehaviorSubject } from 'rxjs'; import { filter, map, take } from 'rxjs/operators'; import { GeoInfoService } from '../geo-info/geo-info.service'; import { GeoSelectedService } from '../geo-selected/geo-selected.service'; import { GeoModeService } from '../geo-mode/geo-mode.service'; import { GeoModule } from '../geo.module'; import { GeoPinComponent } from '../geo-pin/geo-pin.component'; import { GeoMapPopupComponent } from '../geo-map-popup/geo-map-popup.component'; import { AppState } from '../../../../../../app/reducers/index'; import { Store } from '@ngrx/store'; import { GeoApiService } from '../geo-api/geo-api.service'; import { ComponentsHelperService } from '../../../../../shared/services/components-helper.service'; import { GeoSearchService } from '../geo-search/geo-search.service'; @Injectable() export class GeoMapService { map; _pinMode = new BehaviorSubject<boolean>(false); zoom = 1; latitude = 51.505; longitude = -0.09; tileLayer; popup; itemsMap = {}; pinMode = this._pinMode.asObservable(); /** * Toggle pin mode */ togglePinMode () { const pinMode = this._pinMode.getValue(); this._pinMode.next(!pinMode); } /** * Create all item's layers, combine them to feature group and add this group to the map * @param item */ drawItem (item: GeoItem) { const marker = this.getMarkerLayer(item); const polygon = this.setPolygonsLayer(item); const radius = this.getRadiusLayer(item); const featureGroup = L.featureGroup([marker, polygon, radius]); this.itemsMap[item.key] = { marker: marker, polygon: polygon, radius: radius, featureGroup: featureGroup }; featureGroup.addTo(this.map); } /** * Focus map on the passed item * If this item is not on the map, draw it before focus * @param item */ focusItem (item: GeoItem) { // Draw item if is not drown or has no layers if (!this.itemsMap[item.key] || !this.itemsMap[item.key].featureGroup.getLayers().length) { this.drawItem(item); } if (item.type === 'country_group') { this.setView(item.latitude, item.longitude); // Show message when map is open this._store.pipe( this.geoSearchService.getModel, take(1), map(({isMapOpen}) => isMapOpen) ) .subscribe((isMapOpen) => { if (isMapOpen) { this.geoInfoService.showInfo({ message: this.translateService.instant(`app-geo-map.COUNTRY_GROUP`, { name: item.name }) }); } }); } else { this.map.fitBounds(this.itemsMap[item.key].featureGroup.getBounds()); } } /** * Set map view to passed latitude, longitude and zoom or use defaults (world perspective) * @param latitude * @param longitude * @param zoom */ setView (latitude = this.latitude, longitude = this.longitude, zoom = this.zoom) { this.map.setView([latitude, longitude], zoom); } /** * Return green or red customized marker layer for included or excluded item * @param item * @returns {Marker} */ getMarkerLayer (item: GeoItem) { const pinRef = this.componentsHelperService.getComponentRef( GeoModule, GeoPinComponent, {excluded: item.excluded} ); const popupRef = this.componentsHelperService.getComponentRef( GeoModule, GeoMapPopupComponent, {item: item} ); const pinElement: HTMLElement = pinRef.location.nativeElement; const svg = pinElement.querySelector('svg'); const myIcon = L.divIcon({ className: 'app-geo-map__pin', popupAnchor: [0, -35], html: (<any>svg).outerHTML }); pinRef.destroy(); return L.marker([item.latitude, item.longitude], {icon: myIcon}) .bindPopup(popupRef.location.nativeElement, { closeButton: false }); } /** * Return radius layer (red or green depending on excluded flag) for passed item * @param item * @returns {Circle} */ getRadiusLayer (item: GeoItem) { const radius = item.radius || 0; return L.circle([item.latitude, item.longitude], { color: item.excluded ? '#f47564' : '#4d6aa4', weight: 1, radius: item.distance_unit === 'mile' ? radius * 1609.34 : radius * 1000 }); } /** * Return polygon layer for passed item * @param item * @returns {Polygon} */ setPolygonsLayer (item: GeoItem) { // Set empty array when item.polygons is undefined const polygons = item.polygons || []; const processedPolygon = polygons.map((coordinates) => { if (coordinates.length) { const newCoordinates = []; coordinates.forEach((coordinate) => { newCoordinates.push([coordinate.lat, coordinate.lng]); }); return newCoordinates; } else { return [(<any>coordinates).lat, (<any>coordinates).lng]; } }); return L.polygon(processedPolygon, { color: item.excluded ? '#f47564' : '#4d6aa4', weight: 1 }); } /** * Return tile url for current lang * @returns {string} */ getTileUrl (lang = this.translateService.currentLang) { return `https://external.xx.fbcdn.net/map_tile.php?v=26&x={x}&y={y}&z={z}&size=512&ppi=250&language=${lang}`; } /** * Update tile layer url and redraw it * @param tileUrl * @param noRedraw */ setTileUrl (tileUrl = this.getTileUrl(), noRedraw = false) { this.tileLayer.setUrl(tileUrl, noRedraw); this.tileLayer.redraw(); } /** * Initialize map using default view */ initializeMap (mapContainerElement: HTMLHtmlElement) { if (this.map) { this.map.remove(); } this.map = L.map(mapContainerElement, { center: [this.latitude, this.longitude], zoom: this.zoom }); this.tileLayer = L.tileLayer(this.getTileUrl(), {}) .addTo(this.map); this.popup = L.popup(); } onMapClick = (e) => { const latitude = e.latlng.lat; const longitude = e.latlng.lng; const key = `(${latitude}, ${longitude})`; this.geoApiService.metaData({custom_locations: [key]}) .pipe( map((metaData) => { if (!metaData) { return; } return Object.values(metaData['custom_locations'])[0]; }), filter((item) => Boolean(item)) ) .subscribe((item: GeoItem) => { // Show message if coordinates don't belong to any country (e.g. deep-deep ocean) if (!item.country_code) { const message = this.translateService.instant(`app-geo-input.INVALID_LOCATION`); this.geoInfoService.showInfo({message}); return; } this._store.pipe( this.geoModeService.getModel, take(1) ) .subscribe( (model) => item.excluded = model.selectedMode.id === 'exclude' ); this.geoSelectedService.addItems([item]); this.togglePinMode(); }); } enterPinMode () { this.map.on('click', this.onMapClick); } exitPinMode () { this.map.off('click', this.onMapClick); } constructor (private _store: Store<AppState>, private geoSearchService: GeoSearchService, private translateService: TranslateService, private geoInfoService: GeoInfoService, private geoApiService: GeoApiService, private componentsHelperService: ComponentsHelperService, private geoModeService: GeoModeService, private geoSelectedService: GeoSelectedService) {} }
{ "content_hash": "3df5b62629a50045a9b70900f2663a27", "timestamp": "", "source": "github", "line_count": 273, "max_line_length": 113, "avg_line_length": 29.24175824175824, "alnum_prop": 0.5993987222848554, "repo_name": "aitarget/aitarget-components", "id": "214be1ad96595f79f31937c97a676ccb2d0b466e", "size": "7983", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/lib/components/targeting/targeting-form/geo/geo-map/geo-map.service.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "38874" }, { "name": "HTML", "bytes": "39663" }, { "name": "JavaScript", "bytes": "6581" }, { "name": "TypeScript", "bytes": "407434" } ] }
namespace RemovingNegative { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SumAndAvarageOfList; class RemovingNegative { //05. Write a program that removes from given sequence all negative numbers. static void Main() { // from task 1 var generatedList = SumAndAvarageOfList.RandomGeneratedList(15, 20, -10, 11); Console.WriteLine("The list is :"); Console.WriteLine(string.Join(", ", generatedList) + "\n"); var answer = RemovingNegatives(generatedList).Reverse(); Console.WriteLine("With removed negatives :"); Console.WriteLine(string.Join(", ", answer) + "\n"); } public static Stack<int> RemovingNegatives(List<int> inputList) { // I'm using stack for quick adding. If needed, in the end can be changet - stack.ToList() Stack<int> stack = new Stack<int>(); foreach (var element in inputList) { if (element >= 0) { stack.Push(element); } } return stack; } } }
{ "content_hash": "14f25660419d590d0cfa9df257fd6d07", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 102, "avg_line_length": 28.727272727272727, "alnum_prop": 0.5522151898734177, "repo_name": "TsvetanKT/TelerikHomeworks", "id": "f00462e20169cbde5ede4dff97f0ff03b5042fce", "size": "1266", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DataStructuresAndAlgorithms/02.LinearDataStructures/05.RemovingNegative/RemovingNegative.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "8070" }, { "name": "C#", "bytes": "1071835" }, { "name": "CSS", "bytes": "83000" }, { "name": "CoffeeScript", "bytes": "943" }, { "name": "JavaScript", "bytes": "326048" }, { "name": "PHP", "bytes": "5957" }, { "name": "XSLT", "bytes": "4692" } ] }
namespace VEngine { namespace FileSystem { class MediaInterface; } namespace Renderer { namespace Internal { class VulkanDevice; struct ImageData { public: int width, height, channelCount; void* data; }; class VulkanInternalImage { public: VulkanInternalImage(VulkanDevice * vulkan, uint32_t width, uint32_t height, uint32_t depth, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImageAspectFlags aspectFlags, VkImageLayout initialLayout, bool mipmapped); VulkanInternalImage(VulkanDevice * device, VkFormat format, VkImage imageHandle, VkImageView viewHandle); VulkanInternalImage(VulkanDevice * device, FileSystem::MediaInterface* media, std::string mediakey); VulkanInternalImage(VulkanDevice * device, uint32_t width, uint32_t height, uint32_t channelCount, void* data); ~VulkanInternalImage(); VkSampler getSampler(); VkImageView getImageView(); VkImageView getFirstMipmapImageView(); VkFormat getFormat(); void regenerateMipmaps(); private: VulkanDevice * device; VkImage image; VulkanSingleAllocation imageMemory; VkImageView imageView; VkImageView firstMipmapImageView; uint32_t width; uint32_t height; uint32_t depth; uint32_t mipLevels = 1; VkFormat format; VkImageTiling tiling; VkImageUsageFlags usage; VkMemoryPropertyFlags properties; VkImageAspectFlags aspectFlags; VkImageLayout initialLayout; VkImageLayout currentLayout; VkSampler sampler; bool samplerCreated = false; void initalize(); ImageData readFileImageData(std::string path); void createTexture(const ImageData &img, VkFormat format); void generateMipmaps(VkImage image, int32_t texWidth, int32_t texHeight, uint32_t mipLevels); VkCommandBuffer beginSingleTimeCommands(); void endSingleTimeCommands(VkCommandBuffer commandBuffer); void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size); void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout); void transitionImageLayoutExistingCommandBuffer(VkCommandBuffer buffer, uint32_t mipmap, VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout , VkPipelineStageFlags sourceStage, VkPipelineStageFlags destinationStage); void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height); }; } } }
{ "content_hash": "7e02b966421573e236c37ddf92827734", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 185, "avg_line_length": 41.09090909090909, "alnum_prop": 0.6033501896333755, "repo_name": "achlubek/venginenative", "id": "c1bfde1936f62bd2c4b3145650c357d4a9f4c8f2", "size": "3247", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "VEngine/Renderer/Internal/VulkanInternalImage.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "19412" }, { "name": "C++", "bytes": "242604" }, { "name": "GLSL", "bytes": "5483" }, { "name": "Makefile", "bytes": "1578" }, { "name": "Shell", "bytes": "287" } ] }
heroku apps:destroy -a $1 --confirm $1
{ "content_hash": "acfb8e34926b9a160e6a533dddf3e1a3", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 38, "avg_line_length": 39, "alnum_prop": 0.6923076923076923, "repo_name": "lawwantsin/auto-heroku", "id": "3c3945b3a5abd1e60027542a2941349c865fd2f2", "size": "136", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean.sh", "mode": "33261", "license": "mit", "language": [ { "name": "Shell", "bytes": "905" } ] }
package Paws::Firehose::KinesisStreamSourceDescription; use Moose; has DeliveryStartTimestamp => (is => 'ro', isa => 'Str'); has KinesisStreamARN => (is => 'ro', isa => 'Str'); has RoleARN => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::Firehose::KinesisStreamSourceDescription =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::Firehose::KinesisStreamSourceDescription object: $service_obj->Method(Att1 => { DeliveryStartTimestamp => $value, ..., RoleARN => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::Firehose::KinesisStreamSourceDescription object: $result = $service_obj->Method(...); $result->Att1->DeliveryStartTimestamp =head1 DESCRIPTION Details about a Kinesis stream used as the source for a Kinesis Firehose delivery stream. =head1 ATTRIBUTES =head2 DeliveryStartTimestamp => Str Kinesis Firehose starts retrieving records from the Kinesis stream starting with this time stamp. =head2 KinesisStreamARN => Str The ARN of the source Kinesis stream. =head2 RoleARN => Str The ARN of the role used by the source Kinesis stream. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::Firehose> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
{ "content_hash": "4c86211c9ea53a6979b3338b0022c990", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 117, "avg_line_length": 25.242857142857144, "alnum_prop": 0.7430673457838144, "repo_name": "ioanrogers/aws-sdk-perl", "id": "1a4c974568cd3cad751df6428bf0b1542c5059ad", "size": "1767", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "auto-lib/Paws/Firehose/KinesisStreamSourceDescription.pm", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "1292" }, { "name": "Perl", "bytes": "20360380" }, { "name": "Perl 6", "bytes": "99393" }, { "name": "Shell", "bytes": "445" } ] }
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>Spring 3 MVC</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>proxoolServletConfigurator</servlet-name> <servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class> <init-param> <param-name>xmlFile</param-name> <param-value>/WEB-INF/proxool.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>DBPpoll</servlet-name> <servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>DBPpoll</servlet-name> <url-pattern>/Admin/XDBPoll</url-pattern> </servlet-mapping> <!--解决spring乱码问题 --> <filter> <filter-name>encoding</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
{ "content_hash": "69d95a82c99496ee2d232059e8f77506", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 105, "avg_line_length": 34.58064516129032, "alnum_prop": 0.7243470149253731, "repo_name": "xingweijie/bmanager", "id": "8cecce9188a527fe861cdf8aa5212866b2a63a96", "size": "2156", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "WebRoot/WEB-INF/web.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "391294" }, { "name": "Java", "bytes": "83510" } ] }
title: Account layout: usermanual-page.hbs position: 3 --- The Account tab lets you edit your global profile settings. From here you can control your account and billing info and see your cloud storage use. ![account_page][1] [1]: /images/platform/account.png "Account"
{ "content_hash": "b4f016e96e38993746a796fb136fe816", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 147, "avg_line_length": 27.3, "alnum_prop": 0.7619047619047619, "repo_name": "playcanvas/developer.playcanvas.com", "id": "6532d8e087bd5af2adc99254cefaa1cd7bffd3e5", "size": "277", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "content/en/user-manual/profile/account.md", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "92" }, { "name": "CSS", "bytes": "30884" }, { "name": "Handlebars", "bytes": "27174" }, { "name": "JavaScript", "bytes": "75342" }, { "name": "Python", "bytes": "11031" }, { "name": "SCSS", "bytes": "28690" } ] }
from ..shared import bases from ..shared.utils import assertions class AcceptRanges(bases.TokensHeaderBase): """ Sent by Server only. The ``Accept-Ranges`` header field allows a\ server to indicate that it supports range\ requests for the target resource. Example:: AcceptRanges([Ranges.bytes]) AcceptRanges(['bytes']) `Ref. <http://httpwg.org/specs/rfc7233.html#header.accept-ranges>`_ """ name = 'accept-ranges' # todo: validate is either just none or token list
{ "content_hash": "a475a501b5b0a09b605a24c66d30b4af", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 71, "avg_line_length": 22.083333333333332, "alnum_prop": 0.6679245283018868, "repo_name": "nitely/http-lazy-headers", "id": "7aaf5da840b1341b94d00a0c89ed9e429b2e7c8e", "size": "555", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "http_lazy_headers/fields/accept_ranges.py", "mode": "33188", "license": "mit", "language": [ { "name": "Makefile", "bytes": "254" }, { "name": "Python", "bytes": "319634" } ] }
using System; namespace eidss.model.Reports.AberrationAnalisys { public class ILISyndromicAberrationModel : AberrationModel { public ILISyndromicAberrationModel (string language, DateTime startDate, DateTime endDate, long? regionId, long? rayonId, string location, decimal threshold, int timeInterval, string timeIntervalText, int baseline, int lag, string[] dateFilter, string dateFilterText, int ageGroup, string ageGroupText, long? hospital, string hospitalText, bool useArchive) : base( language, startDate, endDate, regionId, rayonId, null, location, threshold, timeInterval, timeIntervalText, baseline, lag, dateFilter, dateFilterText, useArchive) { AgeGroup = ageGroup; AgeGroupText = ageGroupText; Hospital = hospital; HospitalText = hospitalText; } public int AgeGroup { get; set; } public string AgeGroupText { get; set; } public long? Hospital { get; set; } public string HospitalText { get; set; } } }
{ "content_hash": "b3981d8947a8e04a6d755afe97808fe0", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 144, "avg_line_length": 37.5625, "alnum_prop": 0.6048252911813644, "repo_name": "EIDSS/EIDSS-Legacy", "id": "4c3ea777168f3a9ccfedd6993a6d211ec5498f91", "size": "1204", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "EIDSS v6/eidss.model/Reports/AberrationAnalisys/ILISyndromicAberrationModel.cs", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "ASP", "bytes": "256377" }, { "name": "Batchfile", "bytes": "30009" }, { "name": "C#", "bytes": "106160789" }, { "name": "CSS", "bytes": "833586" }, { "name": "HTML", "bytes": "7507" }, { "name": "Java", "bytes": "2188690" }, { "name": "JavaScript", "bytes": "17000221" }, { "name": "PLSQL", "bytes": "2499" }, { "name": "PLpgSQL", "bytes": "6422" }, { "name": "Pascal", "bytes": "159898" }, { "name": "PowerShell", "bytes": "339522" }, { "name": "Puppet", "bytes": "3758" }, { "name": "SQLPL", "bytes": "12198" }, { "name": "Smalltalk", "bytes": "301266" }, { "name": "Visual Basic", "bytes": "20819564" }, { "name": "XSLT", "bytes": "4253600" } ] }
""" Provides widget classes and functions. .. warning:: All PyQt4/PySide gui classes are exposed but when you use PyQt5, those classes are not available. Therefore, you should treat/use this package as if it was ``PyQt5.QtWidgets`` module. """ import os from qtpy import QT_API from qtpy import PYQT5_API from qtpy import PYQT4_API from qtpy import PYSIDE_API from qtpy import PythonQtError if os.environ[QT_API] in PYQT5_API: from PyQt5.QtWidgets import * # analysis:ignore elif os.environ[QT_API] in PYQT4_API: from PyQt4.QtGui import * # analysis:ignore from PyQt4.QtGui import QFileDialog as OldFileDialog class QFileDialog(OldFileDialog): @staticmethod def getOpenFileName(parent=None, caption='', directory='', filter='', selectedFilter='', options=OldFileDialog.Options()): return OldFileDialog.getOpenFileNameAndFilter( parent, caption, directory, filter, selectedFilter, options) @staticmethod def getOpenFileNames(parent=None, caption='', directory='', filter='', selectedFilter='', options=OldFileDialog.Options()): return OldFileDialog.getOpenFileNamesAndFilter( parent, caption, directory, filter, selectedFilter, options) @staticmethod def getSaveFileName(parent=None, caption='', directory='', filter='', selectedFilter='', options=OldFileDialog.Options()): return OldFileDialog.getSaveFileNameAndFilter( parent, caption, directory, filter, selectedFilter, options) elif os.environ[QT_API] in PYSIDE_API: from PySide.QtGui import * # analysis:ignore else: raise PythonQtError('No Qt bindings could be found')
{ "content_hash": "46de02d62665d29501835f295cd3febd", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 79, "avg_line_length": 39.31372549019608, "alnum_prop": 0.600498753117207, "repo_name": "MrLeeh/qtpy", "id": "e1c19c69e0414bfa1e7d2dd745be0a09378e6056", "size": "2188", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "qtpy/QtWidgets.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "24080" } ] }
package io.sarl.lang.mwe2.keywords; import static org.eclipse.xtext.EcoreUtil2.eAllContentsAsList; import static org.eclipse.xtext.EcoreUtil2.typeSelect; import java.lang.ref.SoftReference; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; import java.util.regex.Pattern; import com.google.common.base.Objects; import com.google.inject.Inject; import com.google.inject.Injector; import org.apache.log4j.Logger; import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.EnumRule; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.Keyword; import org.eclipse.xtext.ParserRule; import org.eclipse.xtext.util.Strings; import org.eclipse.xtext.xbase.compiler.JavaKeywords; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ListExtensions; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; /** * A {@link AbstractXtextGeneratorFragment} that enables to create a code builder for the generated language. * * <p>The generated builder could be used for helping to create Eobjects from scratch * (in ui wizard for example). * * @author $Author: sgalland$ * @version $FullVersion$ * @mavengroupid $GroupId$ * @mavenartifactid $ArtifactId$ */ public class GrammarKeywordAccessFragment2 extends AbstractXtextGeneratorFragment { private static final Logger LOG = Logger.getLogger(GrammarKeywordAccessFragment2.class); @Inject private FileAccessFactory fileAccessFactory; @Inject private XtextGeneratorNaming naming; @Inject private GrammarAccessExtensions grammarAccessExtensions; @Inject private GrammarKeywordAccessConfig configuration; @Inject private JavaKeywords javaKeywords; /** Replies the language name. * * @return the language name. */ @Pure public String getLanguageName() { return Strings.toFirstUpper(GrammarUtil.getSimpleName(getGrammar()).toLowerCase()); } /** Replies the base package for the language. * * @return the base package. */ @Pure public String getBasePackage() { final Grammar grammar = getGrammar(); final String basePackage = this.naming.getRuntimeBasePackage(grammar); return basePackage + ".services"; //$NON-NLS-1$ } /** Replies the type of the accessor. * * @return the accessor's type. */ @Pure public TypeReference getAccessorType() { return new TypeReference(getBasePackage() + "." //$NON-NLS-1$ + getLanguageName().toUpperCase() + "GrammarKeywordAccess"); //$NON-NLS-1$ } @Override public void initialize(Injector injector) { super.initialize(injector); } @Override public void generate() { LOG.info("Generating the grammar keyword access for " + getLanguageName()); //$NON-NLS-1$ final StringConcatenationClient content = new StringConcatenationClient() { @SuppressWarnings("synthetic-access") @Override protected void appendTo(TargetStringConcatenation it) { it.append("/** Set of SARL keywords that are not directly supported by the"); //$NON-NLS-1$ it.newLine(); it.append(" * {@link SARLGrammarAccess} or hardly accessible."); //$NON-NLS-1$ it.newLine(); it.append(" */"); //$NON-NLS-1$ it.newLine(); it.append("@"); //$NON-NLS-1$ it.append(SuppressWarnings.class); it.append("(\"all\")"); //$NON-NLS-1$ it.newLine(); it.append("public class "); //$NON-NLS-1$ it.append(getAccessorType().getSimpleName()); it.append(" {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t@"); //$NON-NLS-1$ it.append(Inject.class); it.newLine(); it.append("\tprivate "); //$NON-NLS-1$ it.append(GrammarKeywordAccessFragment2.this.grammarAccessExtensions.getGrammarAccess(getGrammar())); it.append(" grammarAccess;"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); final Set<String> addedKeywords = new HashSet<>(); final Map<String, String> getters = new HashMap<>(); final LinkedList<Grammar> grammars = new LinkedList<>(); grammars.add(getGrammar()); while (!grammars.isEmpty()) { final Grammar grammar = grammars.removeFirst(); if (isValidGrammar(grammar)) { it.append(generateMembers(grammar, addedKeywords, getters)); if (GrammarKeywordAccessFragment2.this.configuration.getDependencyGrammarInheritance()) { grammars.addAll(getEffectivelyUsedGrammars(grammar)); } } } it.append(generateMembersFromConfig(addedKeywords, getters)); it.append(generateAccessors(addedKeywords, getters)); it.append("}"); //$NON-NLS-1$ it.newLine(); it.newLineIfNotEmpty(); it.newLine(); } }; final JavaFileAccess javaFile = this.fileAccessFactory.createJavaFile( getAccessorType(), content); javaFile.writeTo(getProjectConfig().getRuntime().getSrcGen()); } /** Replies if the given grammar may be treated. * * @param grammar the grammar to test. * @return <code>true</code> if the grammar could be treated. */ @SuppressWarnings("static-method") protected boolean isValidGrammar(Grammar grammar) { return !Objects.equal(grammar.getName(), "org.eclipse.xtext.common.Terminals"); //$NON-NLS-1$ } /** Generate the members of the accessors. * * @param addedKeywords the set of keywords that are added to the output. * @param getters filled by this function with the getters' names. * @return the content. */ protected StringConcatenationClient generateMembersFromConfig(Set<String> addedKeywords, Map<String, String> getters) { final List<StringConcatenationClient> clients = new ArrayList<>(); for (final String keyword : this.configuration.getKeywords()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } for (final String keyword : this.configuration.getLiterals()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { for (final StringConcatenationClient client : clients) { it.append(client); } } }; } /** Generate the members of the accessors. * * @param grammar the grammar for which the keyword accessors must be generated. * @param addedKeywords the set of keywords that are added to the output. * @param getters filled by this function with the getters' names. * @return the content. */ protected StringConcatenationClient generateMembers(Grammar grammar, Set<String> addedKeywords, Map<String, String> getters) { final List<StringConcatenationClient> clients = new ArrayList<>(); for (final Keyword grammarKeyword : getAllKeywords(grammar)) { final String keyword = grammarKeyword.getValue().trim(); if (!keyword.isEmpty()) { if (!addedKeywords.contains(keyword) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(grammarKeyword, grammar.getName(), getters)); addedKeywords.add(keyword); } } } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { for (final StringConcatenationClient client : clients) { it.append(client); } } }; } /** Replies the keywords in the given grammar. * * @param grammar the grammar. * @return the keywords. */ protected static Iterable<Keyword> getAllKeywords(Grammar grammar) { final Map<String, Keyword> keywords = new HashMap<>(); final List<ParserRule> rules = GrammarUtil.allParserRules(grammar); for (final ParserRule parserRule : rules) { final List<Keyword> list = typeSelect(eAllContentsAsList(parserRule), Keyword.class); for (final Keyword keyword : list) { keywords.put(keyword.getValue(), keyword); } } final List<EnumRule> enumRules = GrammarUtil.allEnumRules(grammar); for (final EnumRule enumRule : enumRules) { final List<Keyword> list = typeSelect(eAllContentsAsList(enumRule), Keyword.class); for (final Keyword keyword : list) { keywords.put(keyword.getValue(), keyword); } } return keywords.values(); } /** Generate a basic keyword. * * @param keyword the keyword to add. * @param comment a comment for the javadoc. * @param getters filled by this function with the getters' names. * @return the content. */ protected StringConcatenationClient generateKeyword(final String keyword, final String comment, Map<String, String> getters) { final String fieldName = keyword.toUpperCase().replaceAll("[^a-zA-Z0-9_]+", "_"); //$NON-NLS-1$ //$NON-NLS-2$ final String methodName = Strings.toFirstUpper(keyword.replaceAll("[^a-zA-Z0-9_]+", "_")) //$NON-NLS-1$ //$NON-NLS-2$ + "Keyword"; //$NON-NLS-1$ if (getters != null) { getters.put(methodName, keyword); } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("\tprivate static final String "); //$NON-NLS-1$ it.append(fieldName); it.append(" = \""); //$NON-NLS-1$ it.append(Strings.convertToJavaString(keyword)); it.append("\";"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t/** Keyword: {@code "); //$NON-NLS-1$ it.append(protectCommentKeyword(keyword)); it.append("}."); //$NON-NLS-1$ it.newLine(); if (!Strings.isEmpty(comment)) { it.append("\t * Source: "); //$NON-NLS-1$ it.append(comment); it.newLine(); } it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\tpublic String get"); //$NON-NLS-1$ it.append(methodName); it.append("() {"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn "); //$NON-NLS-1$ it.append(fieldName); it.append(";"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } }; } /** Generate a grammar keyword. * * @param keyword the keyword to add. * @param comment a comment for the javadoc. * @param getters filled by this function with the getters' names. * @return the content. */ protected StringConcatenationClient generateKeyword(final Keyword keyword, final String comment, Map<String, String> getters) { try { final String methodName = getIdentifier(keyword); final String accessor = GrammarKeywordAccessFragment2.this.grammarAccessExtensions.gaAccessor(keyword); if (!Strings.isEmpty(methodName) && !Strings.isEmpty(accessor)) { if (getters != null) { getters.put(methodName, keyword.getValue()); } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("\t/** Keyword: {@code "); //$NON-NLS-1$ it.append(protectCommentKeyword(keyword.getValue())); it.append("}."); //$NON-NLS-1$ it.newLine(); if (!Strings.isEmpty(comment)) { it.append("\t * Source: "); //$NON-NLS-1$ it.append(comment); it.newLine(); } it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\tpublic String get"); //$NON-NLS-1$ it.append(methodName); it.append("() {"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn this.grammarAccess."); //$NON-NLS-1$ it.append(accessor); it.append(".getValue();"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } }; } } catch (Exception e) { // } return null; } /** Replies the identifier for the given keyword. * * @param keyword the keyword. * @return the identifier. */ protected String getIdentifier(Keyword keyword) { return this.grammarAccessExtensions.gaElementIdentifier(keyword) .replaceFirst("[0-9_]+$", ""); //$NON-NLS-1$ //$NON-NLS-2$ } /** Protect the keywword for Java comments. * * @param keyword the keyword to protect. * @return the protected keyword. */ @SuppressWarnings("static-method") protected String protectCommentKeyword(String keyword) { if ("*/".equals(keyword)) { //$NON-NLS-1$ return "* /"; //$NON-NLS-1$ } if ("/*".equals(keyword)) { //$NON-NLS-1$ return "/ *"; //$NON-NLS-1$ } if ("//".equals(keyword)) { //$NON-NLS-1$ return "/ /"; //$NON-NLS-1$ } return keyword; } /** Returns all grammars from the hierarchy that are used from rules of this grammar. * * @param grammar the grammar. * @return the used grammars. */ protected static List<Grammar> getEffectivelyUsedGrammars(final Grammar grammar) { final List<AbstractRule> allRules = GrammarUtil.allRules(grammar); final List<Grammar> map = ListExtensions.<AbstractRule, Grammar>map(allRules, it -> GrammarUtil.getGrammar(it)); final Iterable<Grammar> filter = IterableExtensions.<Grammar>filter(map, it -> Boolean.valueOf(it != grammar)); final Set<Grammar> set = IterableExtensions.<Grammar>toSet(filter); return IterableExtensions.<Grammar>toList(set); } /** Generate the members of the accessors. * * @param addedKeywords the set of keywords that are added to the output. * @param getters filled by this function with the getters' names. * @return the content. */ @SuppressWarnings("checkstyle:anoninnerlength") protected StringConcatenationClient generateAccessors(Set<String> addedKeywords, Map<String, String> getters) { return new StringConcatenationClient() { @SuppressWarnings("synthetic-access") @Override protected void appendTo(TargetStringConcatenation it) { it.append("\tprivate "); //$NON-NLS-1$ it.append(SoftReference.class); it.append("<"); //$NON-NLS-1$ it.append(Set.class); it.append("<String>> allKeywords;"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t/** Replies the SARL keywords."); //$NON-NLS-1$ it.newLine(); it.append("\t * @return the SARL keywords."); //$NON-NLS-1$ it.newLine(); it.append("\t * @see #getPureKeywords()"); //$NON-NLS-1$ it.newLine(); it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\tpublic "); //$NON-NLS-1$ it.append(Set.class); it.append("<String> getKeywords() {"); //$NON-NLS-1$ it.newLine(); it.append("\t\t"); //$NON-NLS-1$ it.append(Set.class); it.append("<String> kws = this.allKeywords == null ? null : this.allKeywords.get();"); //$NON-NLS-1$ it.newLine(); it.append("\t\tif (kws == null) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\t\tkws = new "); //$NON-NLS-1$ it.append(TreeSet.class); it.append("<>();"); //$NON-NLS-1$ it.newLine(); final Pattern pattern = Pattern.compile("^[a-zA-Z_$]+$"); //$NON-NLS-1$ for (final Entry<String, String> getter : getters.entrySet()) { if (pattern.matcher(getter.getValue()).matches()) { it.append("\t\t\tkws.add(get"); //$NON-NLS-1$ it.append(getter.getKey()); it.append("());"); //$NON-NLS-1$ it.newLine(); } } it.append("\t\t\tthis.allKeywords = new "); //$NON-NLS-1$ it.append(SoftReference.class); it.append("<>(kws);"); //$NON-NLS-1$ it.newLine(); it.append("\t\t}"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn "); //$NON-NLS-1$ it.append(Collections.class); it.append(".unmodifiableSet(kws);"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t/** Replies if the given string of characters is a SARL keyword."); //$NON-NLS-1$ it.newLine(); it.append("\t * @param str the string of characters."); //$NON-NLS-1$ it.newLine(); it.append("\t * @return <code>true</code> if the string of characters is a SARL keyword."); //$NON-NLS-1$ it.newLine(); it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\tpublic boolean isKeyword(String str) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\tassert !"); //$NON-NLS-1$ it.append(Strings.class); it.append(".isEmpty(str);"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn getKeywords().contains(str);"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\tprivate "); //$NON-NLS-1$ it.append(SoftReference.class); it.append("<"); //$NON-NLS-1$ it.append(Set.class); it.append("<String>> pureSarlKeywords;"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t/** Replies the pure SARL keywords."); //$NON-NLS-1$ it.newLine(); it.append("\t * Pure SARL keywords are SARL keywords that are not Java keywords."); //$NON-NLS-1$ it.newLine(); it.append("\t * @return the pure SARL keywords."); //$NON-NLS-1$ it.newLine(); it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\tpublic "); //$NON-NLS-1$ it.append(Set.class); it.append("<String> getPureKeywords() {"); //$NON-NLS-1$ it.newLine(); it.append("\t\t"); //$NON-NLS-1$ it.append(Set.class); it.append("<String> kws = this.pureSarlKeywords == null ? null : this.pureSarlKeywords.get();"); //$NON-NLS-1$ it.newLine(); it.append("\t\tif (kws == null) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\t\tkws = new "); //$NON-NLS-1$ it.append(HashSet.class); it.append("<>();"); //$NON-NLS-1$ it.newLine(); for (final Entry<String, String> getter : getters.entrySet()) { if (pattern.matcher(getter.getValue()).matches() && !GrammarKeywordAccessFragment2.this.javaKeywords.isJavaKeyword(getter.getValue())) { it.append("\t\t\tkws.add(get"); //$NON-NLS-1$ it.append(getter.getKey()); it.append("());"); //$NON-NLS-1$ it.newLine(); } } it.append("\t\t\tthis.pureSarlKeywords = new "); //$NON-NLS-1$ it.append(SoftReference.class); it.append("<>(kws);"); //$NON-NLS-1$ it.newLine(); it.append("\t\t}"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn "); //$NON-NLS-1$ it.append(Collections.class); it.append(".unmodifiableSet(kws);"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t/** Replies if the given string of characters is a pure SARL keyword."); //$NON-NLS-1$ it.newLine(); it.append("\t * Pure SARL keywords are SARL keywords that are not Java keywords."); //$NON-NLS-1$ it.newLine(); it.append("\t * @param str the string of characters."); //$NON-NLS-1$ it.newLine(); it.append("\t * @return <code>true</code> if the string of characters is a SARL keyword."); //$NON-NLS-1$ it.newLine(); it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\tpublic boolean isPureKeyword(String str) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\tassert !"); //$NON-NLS-1$ it.append(Strings.class); it.append(".isEmpty(str);"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn getPureKeywords().contains(str);"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t/** Protect the given text if it is a keyword."); //$NON-NLS-1$ it.newLine(); it.append("\t * @param text the text to protect."); //$NON-NLS-1$ it.newLine(); it.append("\t * @return the protected text."); //$NON-NLS-1$ it.newLine(); it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\tpublic String protectKeyword(String text) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\tif (!"); //$NON-NLS-1$ it.append(Strings.class); it.append(".isEmpty(text) && isKeyword(text)) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\t\treturn \""); //$NON-NLS-1$ it.append(Strings.convertToJavaString(GrammarKeywordAccessFragment2.this.configuration.getKeywordProtectionSymbol())); it.append("\" + text;"); //$NON-NLS-1$ it.newLine(); it.append("\t\t}"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn text;"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } }; } }
{ "content_hash": "16e90c6a57b2d8f880fbc2c41bdcd556", "timestamp": "", "source": "github", "line_count": 585, "max_line_length": 127, "avg_line_length": 35.95213675213675, "alnum_prop": 0.6588531761125903, "repo_name": "sarl/sarl", "id": "7f289b76f6b30a9f4d26c40bcf63cf907fc16d9a", "size": "21767", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/keywords/GrammarKeywordAccessFragment2.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1718" }, { "name": "GAP", "bytes": "1574648" }, { "name": "HTML", "bytes": "1314" }, { "name": "Java", "bytes": "24901728" }, { "name": "JavaScript", "bytes": "2352" }, { "name": "Perl", "bytes": "28685" }, { "name": "Python", "bytes": "35706" }, { "name": "Shell", "bytes": "10357" }, { "name": "TeX", "bytes": "12146" }, { "name": "Vim Script", "bytes": "5516" }, { "name": "Xtend", "bytes": "1612" } ] }
<!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 (1.8.0_121) on Tue Mar 28 17:38:10 CET 2017 --> <title>kariminf.langpi.basic.hungarian (LangPi 1.1.1 API)</title> <meta name="date" content="2017-03-28"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <h1 class="bar"><a href="../../../../kariminf/langpi/basic/hungarian/package-summary.html" target="classFrame">kariminf.langpi.basic.hungarian</a></h1> <div class="indexContainer"> <h2 title="Classes">Classes</h2> <ul title="Classes"> <li><a href="HuInfo.html" title="class in kariminf.langpi.basic.hungarian" target="classFrame">HuInfo</a></li> <li><a href="HuNormalizer.html" title="class in kariminf.langpi.basic.hungarian" target="classFrame">HuNormalizer</a></li> <li><a href="HuSegmenter.html" title="class in kariminf.langpi.basic.hungarian" target="classFrame">HuSegmenter</a></li> <li><a href="HuStemmer.html" title="class in kariminf.langpi.basic.hungarian" target="classFrame">HuStemmer</a></li> <li><a href="HuSWEliminator.html" title="class in kariminf.langpi.basic.hungarian" target="classFrame">HuSWEliminator</a></li> </ul> </div> </body> </html>
{ "content_hash": "2d2bb53fee028176b09317b5b151c227", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 151, "avg_line_length": 56.625, "alnum_prop": 0.7019867549668874, "repo_name": "kariminf/LangPi", "id": "56c3dbc52168feb9201ed80cec73b0dbe03fd53f", "size": "1359", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "docs/kariminf/langpi/basic/hungarian/package-frame.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "351158" } ] }
<?php namespace Oro\Bundle\EntityBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use FOS\Rest\Util\Codes; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Oro\Bundle\EntityBundle\ORM\OroEntityManager; use Oro\Bundle\EntityConfigBundle\Config\ConfigInterface; use Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider; use Oro\Bundle\EntityConfigBundle\Tools\FieldAccessor; use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope; use Oro\Bundle\SecurityBundle\SecurityFacade; /** * Entities controller. * @Route("/entity") * todo: Discuss ACL permissions for controller */ class EntitiesController extends Controller { /** * Grid of Custom/Extend entity. * @Route( * "/{id}", * name="oro_entity_index", * defaults={"id"=0} * ) * @Template() */ public function indexAction($id) { $extendEntityName = str_replace('_', '\\', $id); $this->checkAccess('VIEW', $extendEntityName); /** @var ConfigProvider $entityConfigProvider */ $entityConfigProvider = $this->get('oro_entity_config.provider.entity'); if (!$entityConfigProvider->hasConfig($extendEntityName)) { throw $this->createNotFoundException(); } $entityConfig = $entityConfigProvider->getConfig($extendEntityName); return [ 'entity_id' => $id, 'entity_class' => $extendEntityName, 'label' => $entityConfig->get('label'), 'plural_label' => $entityConfig->get('plural_label') ]; } /** * @Route( * "/detailed/{id}/{className}/{fieldName}", * name="oro_entity_detailed", * defaults={"id"=0, "className"="", "fieldName"=""} * ) * @Template * * @param integer $id Related entity ID * @param string $className Self ClassName * @param string $fieldName Self FieldName (relation description) * * @return array */ public function detailedAction($id, $className, $fieldName) { $className = str_replace('_', '\\', $className); $this->checkAccess('VIEW', $className); $entityProvider = $this->get('oro_entity_config.provider.entity'); $extendProvider = $this->get('oro_entity_config.provider.extend'); $relationConfig = $extendProvider->getConfig($className, $fieldName); $fields = $extendProvider->filter( function (ConfigInterface $config) use ($relationConfig) { return !$config->is('state', ExtendScope::STATE_NEW) && !$config->is('is_deleted') && in_array($config->getId()->getFieldName(), $relationConfig->get('target_detailed')); }, $relationConfig->get('target_entity') ); $entity = $this->getDoctrine()->getRepository($relationConfig->get('target_entity'))->find($id); if ($entity->getId()) { $dynamicRow = array(); foreach ($fields as $field) { $fieldName = $field->getId()->getFieldName(); $label = $entityProvider->getConfigById($field->getId())->get('label') ? : $fieldName; $dynamicRow[$label] = FieldAccessor::getValue($entity, $fieldName); } return array( 'dynamic' => $dynamicRow, 'entity' => $entity ); } } /** * Grid of Custom/Extend entity. * @Route( * "/relation/{id}/{className}/{fieldName}", * name="oro_entity_relation", * defaults={"id"=0, "className"="", "fieldName"=""} * ) * @Template() */ public function relationAction($id, $className, $fieldName) { $extendEntityName = str_replace('_', '\\', $className); $this->checkAccess('VIEW', $extendEntityName); /** @var ConfigProvider $entityConfigProvider */ $entityConfigProvider = $this->get('oro_entity_config.provider.entity'); $extendConfigProvider = $this->get('oro_entity_config.provider.extend'); if (!$entityConfigProvider->hasConfig($extendEntityName)) { throw $this->createNotFoundException(); } $entityConfig = $entityConfigProvider->getConfig($extendEntityName); $fieldConfig = $extendConfigProvider->getConfig($extendEntityName, $fieldName); return [ 'entity_id' => $className, 'entity_class' => $extendEntityName, 'label' => $entityConfig->get('label'), 'entity_provider' => $entityConfigProvider, 'extend_provider' => $extendConfigProvider, 'relation' => $fieldConfig ]; } /** * View custom entity instance. * @Route( * "/view/{entity_id}/item/{id}", * name="oro_entity_view", * defaults={"entity_id"=0, "id"=0} * ) * @Template() */ public function viewAction($entity_id, $id) { $extendEntityName = str_replace('_', '\\', $entity_id); $this->checkAccess('VIEW', $extendEntityName); /** @var OroEntityManager $em */ $em = $this->getDoctrine()->getManager(); $entityConfigProvider = $this->get('oro_entity_config.provider.entity'); $record = $em->getRepository($extendEntityName)->find($id); if (!$record) { throw $this->createNotFoundException(); } return [ 'parent' => $entity_id, 'entity' => $record, 'id' => $id, 'entity_config' => $entityConfigProvider->getConfig($extendEntityName), 'entity_class' => $extendEntityName, ]; } /** * Update custom entity instance. * @Route( * "/update/{entity_id}/item/{id}", * name="oro_entity_update", * defaults={"entity_id"=0, "id"=0} * ) * @Template() */ public function updateAction(Request $request, $entity_id, $id) { $extendEntityName = str_replace('_', '\\', $entity_id); $this->checkAccess(!$id ? 'CREATE' : 'EDIT', $extendEntityName); /** @var OroEntityManager $em */ $em = $this->getDoctrine()->getManager(); /** @var ConfigProvider $entityConfigProvider */ $entityConfigProvider = $this->get('oro_entity_config.provider.entity'); $entityConfig = $entityConfigProvider->getConfig($extendEntityName); $extendEntityRepository = $em->getRepository($extendEntityName); $record = !$id ? new $extendEntityName : $extendEntityRepository->find($id); $form = $this->createForm( 'custom_entity_type', $record, array( 'class_name' => $extendEntityName, 'block_config' => array( 'general' => array( 'title' => 'General' ) ), ) ); if ($request->getMethod() == 'POST') { $form->submit($request); if ($form->isValid()) { $em->persist($record); $em->flush(); $id = $record->getId(); $this->get('session')->getFlashBag()->add( 'success', $this->get('translator')->trans('oro.entity.controller.message.saved') ); return $this->get('oro_ui.router')->redirectAfterSave( ['route' => 'oro_entity_update', 'parameters' => ['entity_id' => $entity_id, 'id'=> $id]], ['route' => 'oro_entity_view', 'parameters' => ['entity_id' => $entity_id, 'id' => $id]] ); } } return [ 'entity' => $record, 'entity_id' => $entity_id, 'entity_config' => $entityConfig, 'entity_class' => $extendEntityName, 'form' => $form->createView(), ]; } /** * Delete custom entity instance. * @Route( * "/delete/{entity_id}/item/{id}", * name="oro_entity_delete", * defaults={"entity_id"=0, "id"=0} * ) */ public function deleteAction($entity_id, $id) { $extendEntityName = str_replace('_', '\\', $entity_id); $this->checkAccess('DELETE', $extendEntityName); /** @var OroEntityManager $em */ $em = $this->getDoctrine()->getManager(); $extendEntityRepository = $em->getRepository($extendEntityName); $record = $extendEntityRepository->find($id); if (!$record) { return new JsonResponse('', Codes::HTTP_FORBIDDEN); } $em->remove($record); $em->flush(); return new JsonResponse('', Codes::HTTP_OK); } /** * Checks if an access to the given entity is granted or not * * @param string $permission * @param string $entityName * @return bool * @throws AccessDeniedException */ private function checkAccess($permission, $entityName) { /** @var SecurityFacade $securityFacade */ $securityFacade = $this->get('oro_security.security_facade'); $isGranted = $securityFacade->isGranted($permission, 'entity:' . $entityName); if (!$isGranted) { throw new AccessDeniedException('Access denied.'); } } }
{ "content_hash": "36159c7d352909aa1ef50fdcf86d01fb", "timestamp": "", "source": "github", "line_count": 294, "max_line_length": 115, "avg_line_length": 33.244897959183675, "alnum_prop": 0.5462451401677921, "repo_name": "MarkThink/OROCRM", "id": "0a60cfb8a55fe958a0b0cac5df9bdd6fac2661a9", "size": "9774", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "vendor/oro/platform/src/Oro/Bundle/EntityBundle/Controller/EntitiesController.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "712403" }, { "name": "JavaScript", "bytes": "3629750" }, { "name": "PHP", "bytes": "228039" } ] }
package org.bremersee.data.ldaptive; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import lombok.extern.slf4j.Slf4j; import org.bremersee.data.ldaptive.app.GroupMapper; import org.bremersee.data.ldaptive.app.PersonMapper; import org.bremersee.data.ldaptive.app.TestConfiguration; import org.junit.jupiter.api.Test; import org.ldaptive.LdapEntry; import org.ldaptive.SearchRequest; import org.ldaptive.SearchScope; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; /** * The ldaptive integration test. * * @author Christian Bremer */ @SpringBootTest( classes = TestConfiguration.class, webEnvironment = WebEnvironment.NONE, properties = { "spring.application.name=ldaptive-test", "spring.ldap.embedded.base-dn=dc=bremersee,dc=org", "spring.ldap.embedded.credential.username=uid=admin", "spring.ldap.embedded.credential.password=secret", "spring.ldap.embedded.ldif=classpath:schema.ldif", "spring.ldap.embedded.port=11389", "spring.ldap.embedded.validation.enabled=false", "bremersee.ldaptive.enabled=true", "bremersee.ldaptive.ldap-url=ldap://localhost:11389", "bremersee.ldaptive.use-start-tls=false", "bremersee.ldaptive.bind-dn=uid=admin", "bremersee.ldaptive.bind-credentials=secret", "bremersee.ldaptive.pooled=false", "bremersee.ldaptive.search-validator.search-request.base-dn=ou=people,dc=bremersee,dc=org", "bremersee.ldaptive.search-validator.search-request.search-filter.filer=uid=anna", "bremersee.ldaptive.search-validator.search-request.size-limit=1", "bremersee.ldaptive.search-validator.search-request.search-scope=ONELEVEL", }) @Slf4j class LdaptiveIntegrationTest { @Value("${spring.ldap.embedded.base-dn}") private String baseDn; @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Autowired private LdaptiveTemplate ldaptiveTemplate; @Autowired private GroupMapper groupMapper; @Autowired private PersonMapper personMapper; /** * Find existing persons. */ @Test void findExistingPersons() { SearchRequest searchRequest = SearchRequest.builder() .dn("ou=people," + baseDn) .filter("(objectclass=inetOrgPerson)") .scope(SearchScope.ONELEVEL) .build(); // without mapper Collection<LdapEntry> entries = ldaptiveTemplate.findAll(searchRequest); entries.forEach(ldapEntry -> log.info("Ldap entry found with cn = {}", ldapEntry.getAttribute("cn").getStringValue())); assertTrue(entries.stream() .anyMatch(entry -> "Anna Livia Plurabelle" .equalsIgnoreCase(entry.getAttribute("cn").getStringValue()))); assertTrue(entries.stream() .anyMatch(entry -> "Gustav Anias Horn" .equalsIgnoreCase(entry.getAttribute("cn").getStringValue()))); assertTrue(entries.stream() .anyMatch(entry -> "Hans Castorp" .equalsIgnoreCase(entry.getAttribute("cn").getStringValue()))); // with mapper assertTrue(ldaptiveTemplate.findAll(searchRequest, personMapper) .anyMatch(entry -> "Anna Livia Plurabelle" .equalsIgnoreCase(entry.getCn()))); assertTrue(ldaptiveTemplate.findAll(searchRequest, personMapper) .anyMatch(entry -> "Gustav Anias Horn" .equalsIgnoreCase(entry.getCn()))); assertTrue(ldaptiveTemplate.findAll(searchRequest, personMapper) .anyMatch(entry -> "Hans Castorp" .equalsIgnoreCase(entry.getCn()))); } /** * Find existing groups. */ @Test void findExistingGroups() { SearchRequest searchRequest = SearchRequest.builder() .dn("ou=groups," + baseDn) .filter("(objectclass=groupOfUniqueNames)") .scope(SearchScope.ONELEVEL) .build(); // without mapper Collection<LdapEntry> entries = ldaptiveTemplate.findAll(searchRequest); entries.forEach(ldapEntry -> log.info("Ldap entry found with cn = {}", ldapEntry.getAttribute("cn").getStringValue())); assertTrue(entries.stream() .anyMatch(entry -> "developers" .equalsIgnoreCase(entry.getAttribute("cn").getStringValue()))); assertTrue(entries.stream() .anyMatch(entry -> "managers" .equalsIgnoreCase(entry.getAttribute("cn").getStringValue()))); // with mapper assertTrue(ldaptiveTemplate.findAll(searchRequest, groupMapper) .anyMatch(entry -> "developers" .equalsIgnoreCase(entry.getCn()))); assertTrue(ldaptiveTemplate.findAll(searchRequest, groupMapper) .anyMatch(entry -> "managers" .equalsIgnoreCase(entry.getCn()))); } }
{ "content_hash": "8617f1e88685c87a9f73bdfb2376dc98", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 99, "avg_line_length": 37.27272727272727, "alnum_prop": 0.7022357723577236, "repo_name": "bremersee/common", "id": "3b61707192180d60401b03af65cf8dbc11a21931", "size": "5540", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "common-base-autoconfigure/src/test/java/org/bremersee/data/ldaptive/LdaptiveIntegrationTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "256290" } ] }
<?php namespace Magento\Payment\Block\Transparent; /** * Iframe block for register specific params in layout * * @author Magento Core Team <core@magentocommerce.com> */ class Iframe extends \Magento\Framework\View\Element\Template { const REGISTRY_KEY = 'transparent_form_params'; /** * Core registry * * @var \Magento\Framework\Registry */ protected $coreRegistry; /** * Constructor * * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Registry $registry * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, array $data = [] ) { $this->coreRegistry = $registry; parent::__construct($context, $data); } /** * Preparing layout * * @return $this */ protected function _prepareLayout() { $params = $this->coreRegistry->registry(self::REGISTRY_KEY); $this->setParams($params); return parent::_prepareLayout(); } }
{ "content_hash": "13fbeaf59bb417f66d50c886b7230966", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 71, "avg_line_length": 23.8125, "alnum_prop": 0.6141732283464567, "repo_name": "j-froehlich/magento2_wk", "id": "5a544674b1552e5f6d00c4db45b6a93305226d97", "size": "1251", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "vendor/magento/module-payment/Block/Transparent/Iframe.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "13636" }, { "name": "CSS", "bytes": "2076720" }, { "name": "HTML", "bytes": "6151072" }, { "name": "JavaScript", "bytes": "2488727" }, { "name": "PHP", "bytes": "12466046" }, { "name": "Shell", "bytes": "6088" }, { "name": "XSLT", "bytes": "19979" } ] }
package be.rubus.web.testing.widget.extension.angularwidgets.internal; import be.rubus.web.testing.widget.extension.angularwidgets.AbstractAngularWidgetsWidget; import be.rubus.web.testing.widget.extension.angularwidgets.PuiGrowl.Severity; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import javax.annotation.PostConstruct; /** * */ public class GrowlMessage extends AbstractAngularWidgetsWidget { @FindBy(className = "pui-growl-icon-close") private WebElement closeIcon; @FindBy(className = "pui-growl-image") private WebElement growlSeverityImage; @FindBy(className = "pui-growl-message") private WebElement growlMessage; @FindBy(className = "pui-growl-title") private WebElement growlTitle; private String message; private Severity severity; @PostConstruct public void getData() { message = growlMessage.findElement(By.tagName("p")).getText(); severity = GrowlMessage.getSeverity(getStyleClasses(growlSeverityImage)); } public String getTitle() { return growlTitle.getText(); } public String getMessage() { return message; } public Severity getSeverity() { return severity; } public void close() { /* Actions builder = new Actions(driver); builder.moveToElement(closeIcon).build().perform(); new WebDriverWait(driver,1). until(ExpectedConditions.visibilityOf(closeIcon)); closeIcon.click(); */ /* Actions builder = new Actions(driver); builder.moveToElement(closeIcon).click().build().perform(); */ // Both versions not working, going the JavaScript way if (driver instanceof JavascriptExecutor) { ((JavascriptExecutor) driver).executeScript("arguments[0].click();", closeIcon); } else { throw new UnsupportedOperationException("close growl message only works on JavaScript enabled browsers"); } } private static Severity getSeverity(String classNames) { Severity result = null; if (classNames.contains("pui-growl-image-info")) { result = Severity.INFO; } if (classNames.contains("pui-growl-image-error")) { result = Severity.ERROR; } if (classNames.contains("pui-growl-image-warn")) { result = Severity.WARN; } if (classNames.contains("pui-growl-image-fatal")) { result = Severity.FATAL; } return result; } }
{ "content_hash": "4766d6e3c146b7ff55c68f17de046a58", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 117, "avg_line_length": 28.634408602150536, "alnum_prop": 0.6575291025159594, "repo_name": "rdebusscher/grafaces", "id": "55de6380338bb0bffeb78b2659b872b2a7433a1b", "size": "2663", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/be/rubus/web/testing/widget/extension/angularwidgets/internal/GrowlMessage.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "186444" } ] }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/title_txt" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="24dp" android:paddingBottom="20dp" android:paddingLeft="24dp" android:singleLine="true" android:paddingRight="24dp" android:gravity="start" android:textColor="@color/main_text" android:textSize="@dimen/dialog_title"/> <include layout="@layout/splitter" /> <include layout="@layout/loading" /> <github.yaa110.memento.widget.MaxHeightScrollView android:id="@+id/content_holder" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" /> <include layout="@layout/splitter" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="8dp"> <TextView android:id="@+id/positive_btn" android:layout_width="wrap_content" android:layout_height="@dimen/dialog_button_height" android:gravity="center" android:minWidth="@dimen/dialog_button_width" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:padding="8dp" android:clickable="true" android:background="@drawable/ripple_rect" android:textSize="@dimen/dialog_button" android:textColor="@color/main_color"/> <TextView android:id="@+id/negative_btn" android:layout_width="wrap_content" android:layout_height="@dimen/dialog_button_height" android:gravity="center" android:minWidth="@dimen/dialog_button_width" android:layout_toRightOf="@+id/positive_btn" android:layout_toEndOf="@+id/positive_btn" android:layout_marginLeft="5dp" android:layout_marginStart="5dp" android:padding="8dp" android:clickable="true" android:background="@drawable/ripple_rect" android:textSize="@dimen/dialog_button" android:textColor="@color/secondary_text"/> <TextView android:id="@+id/neutral_btn" android:layout_width="wrap_content" android:layout_height="@dimen/dialog_button_height" android:gravity="center" android:minWidth="@dimen/dialog_button_width" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:padding="8dp" android:clickable="true" android:background="@drawable/ripple_rect" android:textSize="@dimen/dialog_button" android:textColor="@color/main_color" tools:ignore="RelativeOverlap"/> </RelativeLayout> </LinearLayout>
{ "content_hash": "7ba47a566318cc369a5f4f0f8cf76f72", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 63, "avg_line_length": 37.694117647058825, "alnum_prop": 0.6186017478152309, "repo_name": "yaa110/Memento", "id": "443203765a7be8df2e5e9c6ba998ec59ccaafeb0", "size": "3204", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/layout/dialog_content.xml", "mode": "33261", "license": "mit", "language": [ { "name": "Java", "bytes": "131700" } ] }
module.exports = { fbUrl: 'https://graph.facebook.com', dbName: 'data.db', };
{ "content_hash": "2e8fbded01602bf3e68761912dc1e68f", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 38, "avg_line_length": 16.6, "alnum_prop": 0.6144578313253012, "repo_name": "suricactus/fb-group-members", "id": "0bab7fdb3df87a4fcdfdc7012a4a0fb7fa0e00b9", "size": "83", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "22141" }, { "name": "JavaScript", "bytes": "5758" } ] }
"""Urls for the Zinnia sitemap""" from django.conf.urls import url from django.conf.urls import patterns from zinnia.views.sitemap import Sitemap urlpatterns = patterns( '', url(r'^$', Sitemap.as_view(), name='zinnia_sitemap'), )
{ "content_hash": "08d095ef79644a1bc5256057a2d8afb0", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 40, "avg_line_length": 20.75, "alnum_prop": 0.6827309236947792, "repo_name": "lu18887/perhapsgeekblog", "id": "0f446bdcd8845e9c313f05fd34ddf6cdf6b403e6", "size": "249", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "perhapsgeek/zinnia/urls/sitemap.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "104297" }, { "name": "JavaScript", "bytes": "489185" }, { "name": "PHP", "bytes": "2156" }, { "name": "Perl", "bytes": "35147" }, { "name": "Python", "bytes": "674489" }, { "name": "Ruby", "bytes": "249" } ] }
<!-- Safe sample input : get the UserData field of $_SESSION sanitize : settype (float) File : use of untrusted data in a double quoted string in a script --> <!--Copyright 2015 Bertrand STIVALET Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.--> <!DOCTYPE html> <html> <head> <script> <?php $tainted = $_SESSION['UserData']; if(settype($tainted, "float")) $tainted = $tainted ; else $tainted = 0.0 ; echo "alert(\"". $tainted ."\")" ; ?> </script> </head> <body> <h1>Hello World!</h1> </body> </html>
{ "content_hash": "0015c21e3dc5d43cf7cc510a86afe9da", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 75, "avg_line_length": 21.5, "alnum_prop": 0.7441860465116279, "repo_name": "stivalet/PHP-Vulnerability-test-suite", "id": "c7329f9a60f1e69e8b729f32ec243242e4ab98c4", "size": "1333", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "XSS/CWE_79/safe/CWE_79__SESSION__CAST-func_settype_float__Use_untrusted_data_script-doublequoted_String.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "64184004" } ] }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectLevelVcsManager" settingsEditedManually="false"> <OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Remove" /> <OptionsSetting value="true" id="Checkout" /> <OptionsSetting value="true" id="Update" /> <OptionsSetting value="true" id="Status" /> <OptionsSetting value="true" id="Edit" /> <ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Remove" /> </component> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5.1 (D:\Program Files (x86)\Python\python.exe)" project-jdk-type="Python SDK" /> </project>
{ "content_hash": "809075754067a4d42a5b0259d936e4b3", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 158, "avg_line_length": 50.285714285714285, "alnum_prop": 0.6832386363636364, "repo_name": "VCarnaval/Estrutura-de-Dados", "id": "73a1839cd05078506faa90b6022608e5a42b9024", "size": "704", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".idea/misc.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "527" } ] }
package wikidata.hashtaginclude.com.wikidataexplorer.api; import android.view.View; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import org.json.JSONObject; import java.util.AbstractMap; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.RetrofitError; import retrofit.client.Response; import retrofit.converter.GsonConverter; import retrofit.mime.TypedString; import wikidata.hashtaginclude.com.wikidataexplorer.WikidataLog; import wikidata.hashtaginclude.com.wikidataexplorer.models.ClaimQueryModel; import wikidata.hashtaginclude.com.wikidataexplorer.models.GetEntityResponseModel; import wikidata.hashtaginclude.com.wikidataexplorer.models.LabelListResponseModel; import wikidata.hashtaginclude.com.wikidataexplorer.models.RecentResponseModel; import wikidata.hashtaginclude.com.wikidataexplorer.models.SearchEntityResponseModel; /** * Created by matthewmichaud on 1/18/15. */ public class WikidataLookup { private static String TAG = "WikidataLookup"; static WikidataService wikidataService; static WikidataQueryService wikidataQueryService; static Map<String, String> properties; static { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("https://www.wikidata.org") .setLogLevel(RestAdapter.LogLevel.BASIC) .build(); wikidataService = restAdapter.create(WikidataService.class); RestAdapter restQueryAdapter = new RestAdapter.Builder() .setEndpoint("http://wdq.wmflabs.org") .setLogLevel(RestAdapter.LogLevel.FULL) .build(); wikidataQueryService = restQueryAdapter.create(WikidataQueryService.class); properties = new HashMap<String, String>(); } public static void getRecent(final Callback<RecentResponseModel> callback) { wikidataService.getRecent("query", "recentchanges", "json", 25, "title|timestamp|parsedcomment", callback); } public static void getRecent(String timestamp, final Callback<RecentResponseModel> callback) { wikidataService.getRecent("query", "recentchanges", "json", 25, timestamp, "title|timestamp|parsedcomment", callback); } public static void getLabel(String q, Callback<String> callback) { getLabel(q, "en", callback); } public static void getLabel(String q, final int position, final Object viewHolder, final Callback<LabelListResponseModel> callback) { getLabel(q, "en", new Callback<String>() { @Override public void success(String s, Response response) { LabelListResponseModel model = new LabelListResponseModel(s, position, viewHolder); callback.success(model, response); } @Override public void failure(RetrofitError error) { callback.failure(error); } }); } public static void getLabel(final String q, final String language, final Callback<String> callback) { wikidataService.getEntity("wbgetentities", q, language, "json", new Callback<JsonElement>() { @Override public void success(JsonElement jsonElement, Response response) { JsonObject jsonObject = jsonElement.getAsJsonObject(); if (jsonObject == null || jsonObject.getAsJsonObject("entities") == null) { callback.success("", response); return; } JsonObject entity = jsonObject.getAsJsonObject("entities").getAsJsonObject(q); if (entity != null) { JsonObject labels = entity.getAsJsonObject("labels"); if (labels == null) { callback.success("", response); return; } JsonObject labelLang = labels.getAsJsonObject(language); if (labelLang == null) { // couldnt find it in the language you want, just giving you the first one then Set<Map.Entry<String, JsonElement>> set = labels.entrySet(); Iterator<Map.Entry<String, JsonElement>> i = set.iterator(); while (i.hasNext()) { Map.Entry<String, JsonElement> entry = i.next(); JsonObject obj = entry.getValue().getAsJsonObject(); JsonPrimitive prim = obj.getAsJsonPrimitive("value"); callback.success(prim.getAsString(), response); return; } callback.success("", response); return; } else { JsonPrimitive labelValue = labelLang.getAsJsonPrimitive("value"); String label = labelValue.getAsString(); callback.success(label, response); return; } } callback.success("", response); } @Override public void failure(RetrofitError error) { WikidataLog.e(TAG, "Failed to get label for: " + q, error.getCause()); callback.failure(error); } }); } public static void searchEntities(String search, Callback<SearchEntityResponseModel> callback) { wikidataService.searchEntities("wbsearchentities", search, "en", "item", 1, 0, "json", callback); } public static void searchEntities(String search, int limit, Callback<SearchEntityResponseModel> callback) { wikidataService.searchEntities("wbsearchentities", search, "en", "item", limit, 0, "json", callback); } public static void searchEntities(String search, String language, String type, int limit, int continueQuery, Callback<SearchEntityResponseModel> callback) { wikidataService.searchEntities("wbsearchentities", search, language, type, limit, continueQuery, "json", callback); } public static void getEntities(String ids, String sites, String titles, String redirects, String props, String languages, String languageFallback, String normalize, String ungroupedlist, String siteFilter, Callback<JsonElement> callback) { wikidataService.getEntities("wbgetentities", ids, sites, titles, redirects, props, languages, languageFallback, normalize, ungroupedlist, siteFilter, "json", callback); } public static void getEntities(String ids, Callback<JsonElement> callback) { getEntities(ids, "", "", "yes", "info|sitelinks|aliases|labels|descriptions|claims|datatype", "en", "", "", "", "", callback); } public static void getProperty(final String propertyId, final Callback<String> callback) { if (properties.containsKey(propertyId)) { callback.success(properties.get(properties), null); return; } getLabel(propertyId, "en", new Callback<String>() { @Override public void success(String s, Response response) { callback.success(s, response); } @Override public void failure(RetrofitError error) { callback.failure(error); } }); } public static void getPropertyValue(final String property, final String valueId, final Callback<AbstractMap.SimpleEntry<String, String>> callback) { WikidataLookup.getLabel("Q" + valueId, new Callback<String>() { @Override public void success(String label, Response response) { if (label != null) { callback.success(new AbstractMap.SimpleEntry<String, String>(property, label), response); WikidataLog.d(TAG, "property value = " + label); } else { WikidataLog.e(TAG, "response was null"); } } @Override public void failure(RetrofitError error) { WikidataLog.e(TAG, "Could not get value from Q"+valueId, error); } }); } public static void queryClaim(int item, int property, Callback<ClaimQueryModel> callback) { wikidataQueryService.queryClaim(("CLAIM["+property+":"+item+"]"), callback); } }
{ "content_hash": "d75d0ff89190809348583ec3a5fc06d4", "timestamp": "", "source": "github", "line_count": 206, "max_line_length": 152, "avg_line_length": 42.36407766990291, "alnum_prop": 0.6178526412283717, "repo_name": "hashtag-include/wikibase-explorer", "id": "4e74324fa027ec49420b8a1310cc46307fe410aa", "size": "8727", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/wikidata/hashtaginclude/com/wikidataexplorer/api/WikidataLookup.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "146809" } ] }
@implementation DHColorDefaults +(UIFont*)getDefaultInstructionViewFontWithSize:(float)fontSize{ return [UIFont fontWithName:@"HelveticaNeue-Light" size:fontSize]; } +(UIColor*)getLightVioletColor{ return [UIColor colorWithRed:0.6 green:0.6 blue:1.0 alpha:1.0f]; } +(UIColor*)getLightGreenColor{ return [UIColor colorWithRed:0.4 green:1.0 blue:0.7 alpha:1.0f]; } +(UIColor*)getAquaBlueColor{ return [UIColor colorWithRed:0.6 green:1.0 blue:1.0 alpha:1.0f]; } +(UIColor*)getLightOrangeColor{ return [UIColor colorWithRed:0.96 green:0.7 blue:0.235 alpha:1.0f]; } @end
{ "content_hash": "2255bd17003579e6a612381e0b51368d", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 75, "avg_line_length": 27.90909090909091, "alnum_prop": 0.7117263843648208, "repo_name": "jayesh15111988/DHMathematicsGame", "id": "3aa28da7e1bf84cfcfa1722a494524516bd8d852", "size": "793", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DHMathematicsGame/DHColorDefaults.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "39778" } ] }
(function() { 'use strict'; angular .module('uniConnectApp') .factory('JhiHealthService', JhiHealthService); JhiHealthService.$inject = ['$rootScope', '$http']; function JhiHealthService ($rootScope, $http) { var separator = '.'; var service = { checkHealth: checkHealth, transformHealthData: transformHealthData, getBaseName: getBaseName, getSubSystemName: getSubSystemName }; return service; function checkHealth () { return $http.get('management/health').then(function (response) { return response.data; }); } function transformHealthData (data) { var response = []; flattenHealthData(response, null, data); return response; } function getBaseName (name) { if (name) { var split = name.split('.'); return split[0]; } } function getSubSystemName (name) { if (name) { var split = name.split('.'); split.splice(0, 1); var remainder = split.join('.'); return remainder ? ' - ' + remainder : ''; } } /* private methods */ function flattenHealthData (result, path, data) { angular.forEach(data, function (value, key) { if (isHealthObject(value)) { if (hasSubSystem(value)) { addHealthObject(result, false, value, getModuleName(path, key)); flattenHealthData(result, getModuleName(path, key), value); } else { addHealthObject(result, true, value, getModuleName(path, key)); } } }); return result; } function addHealthObject (result, isLeaf, healthObject, name) { var healthData = { 'name': name }; var details = {}; var hasDetails = false; angular.forEach(healthObject, function (value, key) { if (key === 'status' || key === 'error') { healthData[key] = value; } else { if (!isHealthObject(value)) { details[key] = value; hasDetails = true; } } }); // Add the of the details if (hasDetails) { angular.extend(healthData, { 'details': details}); } // Only add nodes if they provide additional information if (isLeaf || hasDetails || healthData.error) { result.push(healthData); } return healthData; } function getModuleName (path, name) { var result; if (path && name) { result = path + separator + name; } else if (path) { result = path; } else if (name) { result = name; } else { result = ''; } return result; } function hasSubSystem (healthObject) { var result = false; angular.forEach(healthObject, function (value) { if (value && value.status) { result = true; } }); return result; } function isHealthObject (healthObject) { var result = false; angular.forEach(healthObject, function (value, key) { if (key === 'status') { result = true; } }); return result; } } })();
{ "content_hash": "655e08291ee538eeb088469b97fd413f", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 88, "avg_line_length": 29.876923076923077, "alnum_prop": 0.4461894953656025, "repo_name": "smb564/UniConnect", "id": "724cf64d0b4a4e04415306456b2b71fdef03f5f3", "size": "3884", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/webapp/app/admin/health/health.service.js", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "5006" }, { "name": "CSS", "bytes": "8951" }, { "name": "HTML", "bytes": "169198" }, { "name": "Java", "bytes": "350609" }, { "name": "JavaScript", "bytes": "287268" }, { "name": "Shell", "bytes": "7058" } ] }
/* Implementation of utility functions to verify unit tests aren't performing SMP-unsafe DPORT reads. */ #include "unity.h" #include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "soc/uart_reg.h" #include "test_apb_dport_access.h" #include "test_utils.h" #ifndef CONFIG_FREERTOS_UNICORE static void apb_access_loop_task(void *ignore); static volatile bool apb_access_corrupt; static TaskHandle_t apb_task_handle; void start_apb_access_loop() { apb_access_corrupt = false; xTaskCreatePinnedToCore(apb_access_loop_task, "accessAPB", 2048, NULL, UNITY_FREERTOS_PRIORITY - 1, &apb_task_handle, !UNITY_FREERTOS_CPU); } void verify_apb_access_loop() { vTaskDelete(apb_task_handle); apb_task_handle = NULL; TEST_ASSERT_FALSE(apb_access_corrupt); printf("Verified no APB corruption from operations\n"); } static void apb_access_loop_task(void *ignore) { uint32_t initial = REG_READ(UART_DATE_REG(0)); while(1) { if (REG_READ(UART_DATE_REG(0)) != initial) { apb_access_corrupt = true; } } } #else /*CONFIG_FREERTOS_UNICORE */ void start_apb_access_loop() { } void verify_apb_access_loop() { } #endif
{ "content_hash": "81cf54b4a7970948eafcd42c47d759f1", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 74, "avg_line_length": 22.5, "alnum_prop": 0.6626984126984127, "repo_name": "krzychb/rtd-test-bed", "id": "6cd763f947a4bbf9abafc0b816ac8c571793a23a", "size": "1260", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "components/mbedtls/test/test_apb_dport_access.c", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "248929" }, { "name": "Batchfile", "bytes": "9428" }, { "name": "C", "bytes": "42611901" }, { "name": "C++", "bytes": "10437923" }, { "name": "CMake", "bytes": "316611" }, { "name": "CSS", "bytes": "1340" }, { "name": "Dockerfile", "bytes": "4319" }, { "name": "GDB", "bytes": "2764" }, { "name": "Go", "bytes": "146670" }, { "name": "HCL", "bytes": "468" }, { "name": "HTML", "bytes": "115431" }, { "name": "Inno Setup", "bytes": "14977" }, { "name": "Lex", "bytes": "7273" }, { "name": "M4", "bytes": "189150" }, { "name": "Makefile", "bytes": "439631" }, { "name": "Objective-C", "bytes": "133538" }, { "name": "PHP", "bytes": "498" }, { "name": "Pawn", "bytes": "151052" }, { "name": "Perl", "bytes": "141532" }, { "name": "Python", "bytes": "1868534" }, { "name": "Roff", "bytes": "102712" }, { "name": "Ruby", "bytes": "206821" }, { "name": "Shell", "bytes": "625528" }, { "name": "Smarty", "bytes": "5972" }, { "name": "Tcl", "bytes": "110" }, { "name": "TeX", "bytes": "1961" }, { "name": "Visual Basic", "bytes": "294" }, { "name": "XSLT", "bytes": "80335" }, { "name": "Yacc", "bytes": "15875" } ] }
package com.ltg.app1.domain; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.time.Instant; import java.util.HashMap; import java.util.Map; /** * Persist AuditEvent managed by the Spring Boot actuator. * * @see org.springframework.boot.actuate.audit.AuditEvent */ @Entity @Table(name = "jhi_persistent_audit_event") public class PersistentAuditEvent implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @SequenceGenerator(name = "sequenceGenerator") @Column(name = "event_id") private Long id; @NotNull @Column(nullable = false) private String principal; @Column(name = "event_date") private Instant auditEventDate; @Column(name = "event_type") private String auditEventType; @ElementCollection @MapKeyColumn(name = "name") @Column(name = "value") @CollectionTable(name = "jhi_persistent_audit_evt_data", joinColumns=@JoinColumn(name="event_id")) private Map<String, String> data = new HashMap<>(); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getPrincipal() { return principal; } public void setPrincipal(String principal) { this.principal = principal; } public Instant getAuditEventDate() { return auditEventDate; } public void setAuditEventDate(Instant auditEventDate) { this.auditEventDate = auditEventDate; } public String getAuditEventType() { return auditEventType; } public void setAuditEventType(String auditEventType) { this.auditEventType = auditEventType; } public Map<String, String> getData() { return data; } public void setData(Map<String, String> data) { this.data = data; } }
{ "content_hash": "b2e794b52548268a529928147ff7926e", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 102, "avg_line_length": 23.9875, "alnum_prop": 0.6727462219906201, "repo_name": "mrtequino/JSW", "id": "edaa185c42b95dac2e27e592b601d4fb7f11ab6d", "size": "1919", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jhipster/src/main/java/com/ltg/app1/domain/PersistentAuditEvent.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "243783" }, { "name": "HTML", "bytes": "137440" }, { "name": "Java", "bytes": "360339" }, { "name": "JavaScript", "bytes": "93395" }, { "name": "TypeScript", "bytes": "291910" }, { "name": "Vue", "bytes": "14811" } ] }
require 'digest/sha2' require 'seth/digester' class Seth module Mixin module Checksum def checksum(file) Seth::Digester.checksum_for_file(file) end end end end
{ "content_hash": "ed8dcbc19025b6b8f953213b3fee2de4", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 46, "avg_line_length": 13.928571428571429, "alnum_prop": 0.6564102564102564, "repo_name": "danielsdeleo/seth", "id": "11f28da867a97d0faa2a4878545fe8ed29db67c1", "size": "876", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/seth/mixin/checksum.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "21554" }, { "name": "JavaScript", "bytes": "49785" }, { "name": "Perl", "bytes": "64" }, { "name": "Python", "bytes": "9730" }, { "name": "Ruby", "bytes": "5459776" }, { "name": "Shell", "bytes": "18654" } ] }
End of preview.