text
stringlengths
4
5.48M
meta
stringlengths
14
6.54k
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.ovirt.engine</groupId> <artifactId>root</artifactId> <version>3.0.0-0001</version> </parent> <artifactId>engine-server-ear</artifactId> <packaging>ear</packaging> <name>oVirt Server EAR</name> <description>oVirt server EAR</description> <distributionManagement> <repository> <id>engine.redhat.com</id> <url>file://${maven.repository.root}</url> </repository> </distributionManagement> <properties> <earDirectory>${project.build.directory}/${project.build.finalName}</earDirectory> <backendConfFiles>${project.parent.basedir}/backend/manager/conf</backendConfFiles> <thirdPartyConfFiles>${project.parent.basedir}/backend/manager/3rdparty</thirdPartyConfFiles> </properties> <dependencies> <!-- Internal Deps --> <!-- ** JARs --> <dependency> <groupId>org.ovirt.engine.core</groupId> <artifactId>compat</artifactId> <version>${engine.version}</version> <type>jar</type> </dependency> <dependency> <groupId>org.ovirt.engine.core</groupId> <artifactId>common</artifactId> <version>${engine.version}</version> <type>jar</type> </dependency> <dependency> <groupId>org.ovirt.engine.core</groupId> <artifactId>dal</artifactId> <version>${engine.version}</version> <type>jar</type> </dependency> <!-- WARS --> <dependency> <groupId>org.ovirt.engine.ui</groupId> <artifactId>rmw-war</artifactId> <version>${engine.version}</version> <type>war</type> </dependency> <dependency> <groupId>org.ovirt.engine.ui</groupId> <artifactId>rm-war</artifactId> <version>${engine.version}</version> <type>war</type> </dependency> <dependency> <groupId>org.ovirt.engine.ui</groupId> <artifactId>components-war</artifactId> <version>${engine.version}</version> <type>war</type> </dependency> <dependency> <groupId>org.ovirt.engine.ui</groupId> <artifactId>components-war</artifactId> <version>${engine.version}</version> <type>war</type> </dependency> <dependency> <groupId>org.ovirt.engine.api</groupId> <artifactId>restapi-webapp</artifactId> <version>${engine.version}</version> <type>war</type> </dependency> <dependency> <groupId>org.ovirt.engine.ui</groupId> <artifactId>userportal</artifactId> <version>${engine.version}</version> <type>war</type> </dependency> <dependency> <groupId>org.ovirt.engine.ui</groupId> <artifactId>webadmin</artifactId> <version>${engine.version}</version> <type>war</type> </dependency> <!-- ** EJB-JARs --> <dependency> <groupId>org.ovirt.engine.ui</groupId> <artifactId>genericapi</artifactId> <version>${engine.version}</version> <type>ejb</type> </dependency> <dependency> <groupId>org.ovirt.engine.core</groupId> <artifactId>scheduler</artifactId> <version>${engine.version}</version> <type>ejb</type> </dependency> <dependency> <groupId>org.ovirt.engine.core</groupId> <artifactId>vdsbrokerbean</artifactId> <version>${engine.version}</version> <type>ejb</type> </dependency> <dependency> <groupId>org.ovirt.engine.core</groupId> <artifactId>bll</artifactId> <version>${engine.version}</version> <type>ejb</type> </dependency> <!-- ** WARs --> <!-- 3rd Party Deps --> <!-- ** WARs --> <!-- ** JARs --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-agent</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> </dependencies> <build> <finalName>engine</finalName> <plugins> <plugin> <artifactId>maven-ear-plugin</artifactId> <configuration> <!-- params common to ear:ear and ear:generate-application-xml --> <defaultLibBundleDir>lib</defaultLibBundleDir> <workDirectory>${earDirectory}</workDirectory> <version>1.4</version> <!-- J2EE version --> <!-- params for ear:ear --> <resourcesDir>${basedir}/target/classes</resourcesDir> <unpackTypes>war,ejb,sar</unpackTypes> <!-- params for ear:generate-application-xml --> <displayName>ENGINE</displayName> <modules> <!-- ** JARs --> <jarModule> <groupId>org.ovirt.engine.core</groupId> <artifactId>common</artifactId> <bundleFileName>engine-common.jar</bundleFileName> </jarModule> <jarModule> <groupId>org.ovirt.engine.core</groupId> <artifactId>compat</artifactId> <bundleFileName>engine-compat.jar</bundleFileName> </jarModule> <jarModule> <groupId>org.ovirt.engine.core</groupId> <artifactId>dal</artifactId> <bundleFileName>engine-dal.jar</bundleFileName> </jarModule> <!-- ** WARs --> <webModule> <groupId>org.ovirt.engine.ui</groupId> <artifactId>rmw-war</artifactId> <bundleFileName>engineanagerweb.war</bundleFileName> <contextRoot>/ENGINEanagerWeb</contextRoot> </webModule> <webModule> <groupId>org.ovirt.engine.ui</groupId> <artifactId>rm-war</artifactId> <bundleFileName>engineanager.war</bundleFileName> <contextRoot>/ENGINEanager</contextRoot> </webModule> <webModule> <groupId>org.ovirt.engine.ui</groupId> <artifactId>components-war</artifactId> <bundleFileName>components.war</bundleFileName> <contextRoot>/Components</contextRoot> </webModule> <webModule> <groupId>org.ovirt.engine.api</groupId> <artifactId>restapi-webapp</artifactId> <bundleFileName>restapi.war</bundleFileName> <contextRoot>/api</contextRoot> </webModule> <webModule> <groupId>org.ovirt.engine.ui</groupId> <artifactId>userportal</artifactId> <bundleFileName>userportal.war</bundleFileName> <contextRoot>/UserPortal</contextRoot> </webModule> <webModule> <groupId>org.ovirt.engine.ui</groupId> <artifactId>webadmin</artifactId> <bundleFileName>webadmin.war</bundleFileName> <contextRoot>/webadmin</contextRoot> </webModule> <!-- ** EJB-JARs --> <ejbModule> <groupId>org.ovirt.engine.core</groupId> <artifactId>vdsbrokerbean</artifactId> <bundleFileName>engine-vdsbroker.jar</bundleFileName> <unpack>true</unpack> </ejbModule> <ejbModule> <groupId>org.ovirt.engine.ui</groupId> <artifactId>genericapi</artifactId> <bundleFileName>engine-genericapi.jar</bundleFileName> <unpack>true</unpack> </ejbModule> <ejbModule> <groupId>org.ovirt.engine.core</groupId> <artifactId>scheduler</artifactId> <bundleFileName>engine-scheduler.jar</bundleFileName> <unpack>true</unpack> </ejbModule> <ejbModule> <groupId>org.ovirt.engine.core</groupId> <artifactId>bll</artifactId> <bundleFileName>engine-bll.jar</bundleFileName> <unpack>true</unpack> </ejbModule> </modules> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-quartz-jar</id> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>${quartz.version}</version> <type>jar</type> <overWrite>true</overWrite> <destFileName>quartz-${quartz.version}.jar</destFileName> <outputDirectory>${project.build.directory}/quartz</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> <profiles> <profile> <id>remoteServer</id> <properties> <jbossServer>/var/autofs/suzuki</jbossServer> </properties> </profile> <profile> <id>dep</id> <properties> <engine.rootDir>..</engine.rootDir> <engine.deploymentName>${project.build.finalName}.ear</engine.deploymentName> <engine.deploymentsDir>${jbossServer}/deployments</engine.deploymentsDir> <engine.deploymentDir>${engine.deploymentsDir}/${engine.deploymentName}</engine.deploymentDir> </properties> <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>deploy</id> <phase>package</phase> <configuration> <tasks> <property name="deployment.dir" location="${engine.deploymentDir}"/> <echo>*** Copying updated files from target${file.separator}${project.build.finalName}${file.separator} to ${deployment.dir}${file.separator}...</echo> <copy todir="${deployment.dir}" verbose="true"> <fileset dir="${basedir}/target/${project.build.finalName}"/> </copy> <property name="deployment.descriptor.file" location="${deployment.dir}/META-INF/application.xml"/> <echo>*** Touching ${deployment.descriptor.file} to force redeployment of ${engine.deploymentName}...</echo> <touch file="${deployment.descriptor.file}"/> <echo>*** Touching ${engine.deploymentName}.dodeploy to force deployment of ${engine.deploymentName}...</echo> <touch file="${jbossServer}/deployments/${engine.deploymentName}.dodeploy"/> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> <execution> <id>deploy-ear-meta-inf</id> <phase>package</phase> <configuration> <tasks> <unjar src="${project.build.directory}/${project.build.finalName}.ear" dest="${engine.deploymentDir}"> <patternset> <include name="META-INF/**"/> </patternset> </unjar> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> <execution> <id>undeploy</id> <phase>clean</phase> <configuration> <tasks> <property name="deployment.dir" location="${engine.deploymentDir}"/> <echo>*** Deleting ${deployment.dir}${file.separator}...</echo> <delete dir="${deployment.dir}"/> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>setup</id> <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>setup</id> <phase>install</phase> <configuration> <tasks> <echo>*** Copying configuration file from ${backendConfFiles}/standalone.xml to ${jbossServer}/configuration</echo> <copy overwrite="true" file="${backendConfFiles}/standalone.xml" todir="${jbossServer}/configuration"/> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> <execution> <id>copy-module-changes</id> <phase>install</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo>*** Copying ${project.parent.basedir}/deployment/modules to ${jbossHome}/modules</echo> <copy todir="${jbossHome}/modules" verbose="true" overwrite="true"> <fileset dir="${project.parent.basedir}/deployment/modules"/> </copy> </tasks> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-postgresql-jdbc-jar</id> <phase>install</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>${postgres.jdbc.version}</version> <type>jar</type> <overWrite>true</overWrite> <outputDirectory>${jbossHome}/modules/org/postgresql/main</outputDirectory> <destFileName>postgresql-jdbc.jar</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> </project>
{'content_hash': 'c29c17f27dbf7bf76168a49d6c45f4e4', 'timestamp': '', 'source': 'github', 'line_count': 463, 'max_line_length': 201, 'avg_line_length': 33.40820734341253, 'alnum_prop': 0.5447375226273597, 'repo_name': 'raksha-rao/gluster-ovirt', 'id': 'eafd491e7138e3a278b5591f8daaf704697bf9d4', 'size': '15468', 'binary': False, 'copies': '1', 'ref': 'refs/heads/ovirt-upstream-rebased', 'path': 'ear/pom.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '4300'}, {'name': 'Java', 'bytes': '15806279'}, {'name': 'JavaScript', 'bytes': '28877'}, {'name': 'Python', 'bytes': '1057716'}, {'name': 'Shell', 'bytes': '78518'}]}
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Manual changes to this file may cause unexpected behavior in your application. // Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Entity.Model { using System; using System.Data.Entity; using System.Data.Entity.Infrastructure; public partial class Entities : DbContext { public Entities() : base("name=Entities") { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { throw new UnintentionalCodeFirstException(); } public DbSet<Accmdmentype> Accmdmentype { get; set; } public DbSet<AddDescript1> AddDescript1 { get; set; } public DbSet<AddDescript2> AddDescript2 { get; set; } public DbSet<Aircraft> Aircraft { get; set; } public DbSet<Airline> Airline { get; set; } public DbSet<Airport> Airport { get; set; } public DbSet<AirSeason> AirSeason { get; set; } public DbSet<AirService> AirService { get; set; } public DbSet<Cabine> Cabine { get; set; } public DbSet<CategoriesOfHotel> CategoriesOfHotel { get; set; } public DbSet<Charter> Charter { get; set; } public DbSet<CityDictionary> CityDictionary { get; set; } public DbSet<ExcurDictionary> ExcurDictionary { get; set; } public DbSet<HotelDictionary> HotelDictionary { get; set; } public DbSet<HotelRooms> HotelRooms { get; set; } public DbSet<Pansion> Pansion { get; set; } public DbSet<Rates> Rates { get; set; } public DbSet<Resorts> Resorts { get; set; } public DbSet<Rooms> Rooms { get; set; } public DbSet<RoomsCategory> RoomsCategory { get; set; } public DbSet<Service> Service { get; set; } public DbSet<ServiceList> ServiceList { get; set; } public DbSet<Ship> Ship { get; set; } public DbSet<tbl_Country> tbl_Country { get; set; } public DbSet<TipTur> TipTur { get; set; } public DbSet<TP_Prices> TP_Prices { get; set; } public DbSet<TP_ServiceLists> TP_ServiceLists { get; set; } public DbSet<TP_Services> TP_Services { get; set; } public DbSet<TP_Tours> TP_Tours { get; set; } public DbSet<TP_TurDates> TP_TurDates { get; set; } public DbSet<Transfer> Transfer { get; set; } public DbSet<Transport> Transport { get; set; } public DbSet<tbl_TurList> tbl_TurList { get; set; } public DbSet<TP_Lists> TP_Lists { get; set; } public DbSet<DNK_XML> DNK_XML { get; set; } public DbSet<DNK_XMLLOG> DNK_XMLLOG { get; set; } } }
{'content_hash': '1b4421590affdd69376018b1185ed830', 'timestamp': '', 'source': 'github', 'line_count': 65, 'max_line_length': 84, 'avg_line_length': 44.723076923076924, 'alnum_prop': 0.5916752665978672, 'repo_name': 'sdimons/Danko2015', 'id': 'e243ef51c8956ff30960e80d623e05a5dcbe843c', 'size': '2909', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Source/Entity.Model/EntityDataModel.Context.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '92615'}, {'name': 'C#', 'bytes': '1374188'}, {'name': 'CSS', 'bytes': '779'}, {'name': 'HTML', 'bytes': '42921'}, {'name': 'JavaScript', 'bytes': '26446'}, {'name': 'PLpgSQL', 'bytes': '1757'}, {'name': 'SQLPL', 'bytes': '1604'}]}
package com.ctrip.framework.apollo.portal.controller; import com.google.common.base.Splitter; import com.ctrip.framework.apollo.common.dto.InstanceDTO; import com.ctrip.framework.apollo.common.dto.PageDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.entity.vo.Number; import com.ctrip.framework.apollo.portal.service.InstanceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @RestController public class InstanceController { private static final Splitter RELEASES_SPLITTER = Splitter.on(",").omitEmptyStrings() .trimResults(); @Autowired private InstanceService instanceService; @RequestMapping(value = "/envs/{env}/instances/by-release", method = RequestMethod.GET) public PageDTO<InstanceDTO> getByRelease(@PathVariable String env, @RequestParam long releaseId, @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "20") int size) { return instanceService.getByRelease(Env.valueOf(env), releaseId, page, size); } @RequestMapping(value = "/envs/{env}/instances/by-namespace", method = RequestMethod.GET) public PageDTO<InstanceDTO> getByNamespace(@PathVariable String env, @RequestParam String appId, @RequestParam String clusterName, @RequestParam String namespaceName, @RequestParam(required = false) String instanceAppId, @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "20") int size) { return instanceService.getByNamespace(Env.valueOf(env), appId, clusterName, namespaceName, instanceAppId, page, size); } @RequestMapping(value = "/envs/{env}/instances/by-namespace/count", method = RequestMethod.GET) public ResponseEntity<Number> getInstanceCountByNamespace(@PathVariable String env, @RequestParam String appId, @RequestParam String clusterName, @RequestParam String namespaceName) { int count = instanceService.getInstanceCountByNamepsace(appId, Env.valueOf(env), clusterName, namespaceName); return ResponseEntity.ok(new Number(count)); } @RequestMapping(value = "/envs/{env}/instances/by-namespace-and-releases-not-in", method = RequestMethod.GET) public List<InstanceDTO> getByReleasesNotIn(@PathVariable String env, @RequestParam String appId, @RequestParam String clusterName, @RequestParam String namespaceName, @RequestParam String releaseIds) { Set<Long> releaseIdSet = RELEASES_SPLITTER.splitToList(releaseIds).stream().map(Long::parseLong) .collect(Collectors.toSet()); if (CollectionUtils.isEmpty(releaseIdSet)) { throw new BadRequestException("release ids can not be empty"); } return instanceService.getByReleasesNotIn(Env.valueOf(env), appId, clusterName, namespaceName, releaseIdSet); } }
{'content_hash': '1463259a766add6bea24e3e94e3521bd', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 126, 'avg_line_length': 50.142857142857146, 'alnum_prop': 0.6762496762496762, 'repo_name': 'timothynode/apollo', 'id': '88c1b5e8fe4e06c7339ced627bed0a76c75661c2', 'size': '3861', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/InstanceController.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '12222'}, {'name': 'HTML', 'bytes': '243805'}, {'name': 'Java', 'bytes': '1590553'}, {'name': 'JavaScript', 'bytes': '249110'}, {'name': 'Shell', 'bytes': '13170'}, {'name': 'TSQL', 'bytes': '53777'}]}
// ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version: 16.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ namespace Blueprint41.Neo4j.Refactoring.Templates { using System.Linq; using System.Text; using System.Collections.Generic; using System.Diagnostics; using Blueprint41; using System; /// <summary> /// Class to produce the template output /// </summary> #line 1 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetLabel.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] internal partial class SetLabel : SetLabelBase { #line hidden /// <summary> /// Create the template output /// </summary> public override string TransformText() { #line 7 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetLabel.tt" Debug.WriteLine(" executing {0} -> {1} set label {2}", this.GetType().Name, Entity.Name, Label); #line default #line hidden this.Write("MATCH (node:"); #line 12 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetLabel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Entity.Label.Name)); #line default #line hidden this.Write(") WHERE NONE(label IN labels(node) WHERE label = \'"); #line 12 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetLabel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Label)); #line default #line hidden this.Write("\') WITH node LIMIT 10000 SET node:"); #line 12 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetLabel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Label)); #line default #line hidden this.Write("\r\n"); return this.GenerationEnvironment.ToString(); } } #line default #line hidden }
{'content_hash': 'ab49fd93bbec962c41115f025567711d', 'timestamp': '', 'source': 'github', 'line_count': 71, 'max_line_length': 113, 'avg_line_length': 35.28169014084507, 'alnum_prop': 0.566067864271457, 'repo_name': 'xirqlz/blueprint41', 'id': '63885a4e271a76b90fc4b3ace9cd8fdaa40a0657', 'size': '2507', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Blueprint41/Neo4j/Refactoring/Templates/SetLabel.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '144'}, {'name': 'C#', 'bytes': '5438662'}, {'name': 'sed', 'bytes': '875'}]}
<?xml version="1.0"?> <!-- --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="sales_creditmemo.grid.container"> <block class="Magento\Backend\Block\Widget\Grid" name="sales.creditmemo.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">sales_creditmemo_grid</argument> <argument name="dataSource" xsi:type="object">Magento\Sales\Model\Resource\Order\Creditmemo\Grid\Collection</argument> <argument name="use_ajax" xsi:type="boolean">true</argument> <argument name="default_sort" xsi:type="string">created_at</argument> <argument name="default_dir" xsi:type="string">DESC</argument> <argument name="grid_url" xsi:type="url" path="sales/creditmemo/grid"> <param name="_current">1</param> </argument> </arguments> <block class="Magento\Backend\Block\Widget\Grid\Massaction" name="sales.creditmemo.grid.massaction" as="grid.massaction"> <arguments> <argument name="massaction_id_field" xsi:type="string">entity_id</argument> <argument name="form_field_name" xsi:type="string">creditmemo_ids</argument> <argument name="use_select_all" xsi:type="boolean">false</argument> <argument name="options" xsi:type="array"> <item name="print_creditmemos" xsi:type="array"> <item name="label" xsi:type="string" translate="true">PDF Credit Memos</item> <item name="url" xsi:type="string">sales/creditmemo/pdfcreditmemos</item> </item> </argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Export" name="sales.creditmemo.grid.export" as="grid.export"> <arguments> <argument name="exportTypes" xsi:type="array"> <item name="csv" xsi:type="array"> <item name="urlPath" xsi:type="string">*/*/exportCsv</item> <item name="label" xsi:type="string" translate="true">CSV</item> </item> <item name="excel" xsi:type="array"> <item name="urlPath" xsi:type="string">*/*/exportExcel</item> <item name="label" xsi:type="string" translate="true">Excel XML</item> </item> </argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="sales.creditmemo.grid.columnSet"> <arguments> <argument name="id" xsi:type="string">sales_creditmemo_grid</argument> <argument name="rowupdaterUrl" xsi:type="array"> <item name="generatorClass" xsi:type="string">Magento\Sales\Model\Order\Grid\Row\UrlGenerator</item> <item name="path" xsi:type="string">sales/creditmemo/view</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="creditmemo_id" xsi:type="string">getId</item> </item> </argument> </arguments> <block class="Magento\Backend\Block\Widget\Grid\Column" as="real_creditmemo_id"> <arguments> <argument name="header" xsi:type="string" translate="true">Credit Memo</argument> <argument name="type" xsi:type="string">text</argument> <argument name="index" xsi:type="string">increment_id</argument> <argument name="id" xsi:type="string">real_creditmemo_id</argument> <argument name="header_css_class" xsi:type="string">col-memo-number</argument> <argument name="column_css_class" xsi:type="string">col-memo-number</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="created_at"> <arguments> <argument name="header" xsi:type="string" translate="true">Created</argument> <argument name="type" xsi:type="string">datetime</argument> <argument name="index" xsi:type="string">created_at</argument> <argument name="id" xsi:type="string">created_at</argument> <argument name="header_css_class" xsi:type="string">col-period</argument> <argument name="column_css_class" xsi:type="string">col-period</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="order_increment_id"> <arguments> <argument name="header" xsi:type="string" translate="true">Order</argument> <argument name="type" xsi:type="string">text</argument> <argument name="index" xsi:type="string">order_increment_id</argument> <argument name="id" xsi:type="string">order_increment_id</argument> <argument name="header_css_class" xsi:type="string">col-order-number</argument> <argument name="column_css_class" xsi:type="string">col-order-number</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="order_created_at"> <arguments> <argument name="header" xsi:type="string" translate="true">Order Date</argument> <argument name="type" xsi:type="string">datetime</argument> <argument name="index" xsi:type="string">order_created_at</argument> <argument name="id" xsi:type="string">order_created_at</argument> <argument name="header_css_class" xsi:type="string">col-period</argument> <argument name="column_css_class" xsi:type="string">col-period</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="billing_name"> <arguments> <argument name="id" xsi:type="string">billing_name</argument> <argument name="header" xsi:type="string" translate="true">Bill-to Name</argument> <argument name="index" xsi:type="string">billing_name</argument> <argument name="header_css_class" xsi:type="string">col-bill-to-name</argument> <argument name="column_css_class" xsi:type="string">col-bill-to-name</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="state"> <arguments> <argument name="id" xsi:type="string">state</argument> <argument name="header" xsi:type="string" translate="true">Status</argument> <argument name="type" xsi:type="string">options</argument> <argument name="index" xsi:type="string">state</argument> <argument name="options" xsi:type="options" model="Magento\Sales\Model\Resource\Order\Creditmemo\Grid\StatusList"/> <argument name="header_css_class" xsi:type="string">col-status</argument> <argument name="column_css_class" xsi:type="string">col-status</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="base_grand_total"> <arguments> <argument name="id" xsi:type="string">grand_total</argument> <argument name="header" xsi:type="string" translate="true">Refunded</argument> <argument name="type" xsi:type="string">currency</argument> <argument name="currency" xsi:type="string">order_currency_code</argument> <argument name="rate" xsi:type="string">1</argument> <argument name="index" xsi:type="string">grand_total</argument> <argument name="header_css_class" xsi:type="string">col-refunded</argument> <argument name="column_css_class" xsi:type="string">col-refunded</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="action" acl="Magento_Sales::actions_view"> <arguments> <argument name="id" xsi:type="string">action</argument> <argument name="header" xsi:type="string" translate="true">Action</argument> <argument name="type" xsi:type="string">action</argument> <argument name="getter" xsi:type="string">getId</argument> <argument name="filter" xsi:type="boolean">false</argument> <argument name="sortable" xsi:type="boolean">false</argument> <argument name="is_system" xsi:type="boolean">true</argument> <argument name="actions" xsi:type="array"> <item name="view_action" xsi:type="array"> <item name="caption" xsi:type="string" translate="true">View</item> <item name="url" xsi:type="array"> <item name="base" xsi:type="string">sales/creditmemo/view</item> </item> <item name="field" xsi:type="string">creditmemo_id</item> </item> </argument> <argument name="header_css_class" xsi:type="string">col-actions</argument> <argument name="column_css_class" xsi:type="string">col-actions</argument> </arguments> </block> </block> </block> </referenceBlock> </body> </page>
{'content_hash': 'b0344d9a4b4bc1b2dd9685183ac3ae40', 'timestamp': '', 'source': 'github', 'line_count': 155, 'max_line_length': 183, 'avg_line_length': 73.19354838709677, 'alnum_prop': 0.5016306743058616, 'repo_name': 'webadvancedservicescom/magento', 'id': '0ee6fba5ebd6092440fc0a5f757c59c4b23b3c36', 'size': '11435', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/code/Magento/Sales/view/adminhtml/layout/sales_creditmemo_grid_block.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ApacheConf', 'bytes': '16380'}, {'name': 'CSS', 'bytes': '2592299'}, {'name': 'HTML', 'bytes': '9192193'}, {'name': 'JavaScript', 'bytes': '2874762'}, {'name': 'PHP', 'bytes': '41399372'}, {'name': 'Shell', 'bytes': '3084'}, {'name': 'VCL', 'bytes': '3547'}, {'name': 'XSLT', 'bytes': '19817'}]}
Reflection Method -> is ? --FILE-- <?php abstract class Foo { private function test1(){} protected function test2(){} public function test3(){} static function test4(){} final function test5(){} abstract function test6(); } echo "Foo::test1 is private: " . (new ReflectionMethod('Foo', 'test1')->isPrivate()), "\n"; echo "Foo::test2 is protected: " . (new ReflectionMethod('Foo', 'test2')->isProtected()), "\n"; echo "Foo::test3 is public: " . (new ReflectionMethod('Foo', 'test3')->isPublic()), "\n"; echo "Foo::test4 is static: " . (new ReflectionMethod('Foo', 'test4')->isStatic()), "\n"; echo "Foo::test5 is final: " . (new ReflectionMethod('Foo', 'test5')->isFinal()), "\n"; echo "Foo::test5 is abstract: " . (new ReflectionMethod('Foo', 'test6')->isAbstract()), "\n"; --EXPECTF-- Foo::test1 is private: 1 Foo::test2 is protected: 1 Foo::test3 is public: 1 Foo::test4 is static: 1 Foo::test5 is final: 1 Foo::test5 is abstract: 1
{'content_hash': '01e3e47ceb0c5d44bea2ae475e73c3f5', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 95, 'avg_line_length': 35.592592592592595, 'alnum_prop': 0.6451612903225806, 'repo_name': 'jphp-compiler/jphp', 'id': 'd711e76f58413a2c21500f0a6ed903dd728ed092', 'size': '970', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'jphp-core/tests/resources/ext/reflection/ReflectionMethod_002.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '2124'}, {'name': 'HTML', 'bytes': '4259'}, {'name': 'Inno Setup', 'bytes': '2041'}, {'name': 'Java', 'bytes': '4396883'}, {'name': 'PHP', 'bytes': '1570052'}, {'name': 'Shell', 'bytes': '5234'}]}
<?xml version="1.0" encoding="UTF-8" ?> <class xmlns="http://xml.phpdox.net/src" full="DOMComment" namespace="" name="DOMComment"> <extends name="DOMCharacterData" full="DOMCharacterData"/> <constructor name="__construct" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact="&#10; Creates a new DOMComment object&#10; "/> <return type="void"/> </docblock> <parameter name="value" optional="true" byreference="false" type="string"/> </constructor> <method name="appendData" abstract="false" static="false" final="false"> <docblock> <description compact=""/> <return type="void"/> </docblock> <parameter name="data" optional="false" byreference="false" type="string"/> </method> <method name="deleteData" abstract="false" static="false" final="false"> <docblock> <description compact=""/> <return type="void"/> </docblock> <parameter name="offset" optional="false" byreference="false" type="int"/> <parameter name="count" optional="false" byreference="false" type="int"/> </method> <method name="insertData" abstract="false" static="false" final="false"> <docblock> <description compact=""/> <return type="void"/> </docblock> <parameter name="offset" optional="false" byreference="false" type="int"/> <parameter name="data" optional="false" byreference="false" type="string"/> </method> <method name="replaceData" abstract="false" static="false" final="false"> <docblock> <description compact=""/> <return type="void"/> </docblock> <parameter name="offset" optional="false" byreference="false" type="int"/> <parameter name="count" optional="false" byreference="false" type="int"/> <parameter name="data" optional="false" byreference="false" type="string"/> </method> <method name="substringData" abstract="false" static="false" final="false"> <docblock> <description compact=""/> <return type="string"/> </docblock> <parameter name="offset" optional="false" byreference="false" type="int"/> <parameter name="count" optional="false" byreference="false" type="int"/> </method> <method name="appendChild" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="DOMNode"/> </docblock> <parameter name="newnode" optional="false" byreference="false" type="object" class="DOMNode"/> </method> <method name="C14N" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="string"/> </docblock> <parameter name="exclusive" optional="true" byreference="false" type="object" class="bool"/> <parameter name="with_comments" optional="true" byreference="false" type="object" class="bool"/> <parameter name="xpath" optional="true" byreference="false" type="object" class="array"/> <parameter name="ns_prefixes" optional="true" byreference="false" type="object" class="array"/> </method> <method name="C14NFile" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="int"/> </docblock> <parameter name="uri" optional="false" byreference="false" type="string"/> <parameter name="exclusive" optional="true" byreference="false" type="object" class="bool"/> <parameter name="with_comments" optional="true" byreference="false" type="object" class="bool"/> <parameter name="xpath" optional="true" byreference="false" type="object" class="array"/> <parameter name="ns_prefixes" optional="true" byreference="false" type="object" class="array"/> </method> <method name="cloneNode" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="DOMNode"/> </docblock> <parameter name="deep" optional="true" byreference="false" type="object" class="bool"/> </method> <method name="getLineNo" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="int"/> </docblock> </method> <method name="getNodePath" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="string"/> </docblock> </method> <method name="hasAttributes" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="bool"/> </docblock> </method> <method name="hasChildNodes" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="bool"/> </docblock> </method> <method name="insertBefore" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="DOMNode"/> </docblock> <parameter name="newnode" optional="false" byreference="false" type="object" class="DOMNode"/> <parameter name="refnode" optional="true" byreference="false" type="object" class="DOMNode"/> </method> <method name="isDefaultNamespace" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="bool"/> </docblock> <parameter name="namespaceURI" optional="false" byreference="false" type="string"/> </method> <method name="isSameNode" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="bool"/> </docblock> <parameter name="node" optional="false" byreference="false" type="object" class="DOMNode"/> </method> <method name="isSupported" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="bool"/> </docblock> <parameter name="feature" optional="false" byreference="false" type="string"/> <parameter name="version" optional="false" byreference="false" type="string"/> </method> <method name="lookupNamespaceURI" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="string"/> </docblock> <parameter name="prefix" optional="false" byreference="false" type="string"/> </method> <method name="lookupPrefix" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="string"/> </docblock> <parameter name="namespaceURI" optional="false" byreference="false" type="string"/> </method> <method name="normalize" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="void"/> </docblock> </method> <method name="removeChild" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="DOMNode"/> </docblock> <parameter name="oldnode" optional="false" byreference="false" type="object" class="DOMNode"/> </method> <method name="replaceChild" abstract="false" static="false" visibility="public" final="false"> <docblock> <description compact=""/> <return type="DOMNode"/> </docblock> <parameter name="newnode" optional="false" byreference="false" type="object" class="DOMNode"/> <parameter name="oldnode" optional="false" byreference="false" type="object" class="DOMNode"/> </method> </class>
{'content_hash': 'ec58108b3aa32cc0b8021b56f8eb1e6e', 'timestamp': '', 'source': 'github', 'line_count': 175, 'max_line_length': 102, 'avg_line_length': 43.988571428571426, 'alnum_prop': 0.6599116653676279, 'repo_name': 'FireWalkerX/phpdox', 'id': 'df3f75cb02c38a0033960d4e5fe5083d68a5d978', 'size': '7698', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'dependencies/php/classes/DOMComment.xml', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Batchfile', 'bytes': '1735'}, {'name': 'CSS', 'bytes': '14559'}, {'name': 'HTML', 'bytes': '8328'}, {'name': 'PHP', 'bytes': '684264'}, {'name': 'Smarty', 'bytes': '490'}, {'name': 'XSLT', 'bytes': '94199'}]}
package stun import ( "errors" "fmt" "net/url" "strconv" ) // Scheme definitions from RFC 7064 Section 3.2. const ( Scheme = "stun" SchemeSecure = "stuns" ) // URI as defined in RFC 7064. type URI struct { Scheme string Host string Port int } func (u URI) String() string { if u.Port != 0 { return fmt.Sprintf("%s:%s:%d", u.Scheme, u.Host, u.Port, ) } return u.Scheme + ":" + u.Host } // ParseURI parses URI from string. func ParseURI(rawURI string) (URI, error) { // Carefully reusing URI parser from net/url. u, urlParseErr := url.Parse(rawURI) if urlParseErr != nil { return URI{}, urlParseErr } if u.Scheme != Scheme && u.Scheme != SchemeSecure { return URI{}, fmt.Errorf("unknown uri scheme %q", u.Scheme) } if u.Opaque == "" { return URI{}, errors.New("invalid uri format: expected opaque") } // Using URL methods to split host. u.Host = u.Opaque host, rawPort := u.Hostname(), u.Port() uri := URI{ Scheme: u.Scheme, Host: host, } if len(rawPort) > 0 { port, portErr := strconv.Atoi(rawPort) if portErr == nil { // URL parser already verifies that port is integer. uri.Port = port } } return uri, nil }
{'content_hash': 'eb5bf941f0ca1fdb2c1ddaff6b2dfa7e', 'timestamp': '', 'source': 'github', 'line_count': 60, 'max_line_length': 65, 'avg_line_length': 19.716666666666665, 'alnum_prop': 0.6339814032121724, 'repo_name': 'cydev/stun', 'id': 'b706fcfe97c38f0f605fb3a6b0341ac4bc27b0b9', 'size': '1183', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'uri.go', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Go', 'bytes': '60732'}, {'name': 'Makefile', 'bytes': '1765'}, {'name': 'Shell', 'bytes': '672'}]}
package vips_test import ( "fmt" "os" "reflect" "runtime" "strings" "github.com/DMarby/picsum-photos/internal/logger" "github.com/DMarby/picsum-photos/internal/vips" "go.uber.org/zap" "testing" "io/ioutil" ) func TestVips(t *testing.T) { imageBuffer := setup(t) defer vips.Shutdown() t.Run("SaveToJpegBuffer", func(t *testing.T) { t.Run("saves an image to buffer", func(t *testing.T) { _, err := vips.SaveToJpegBuffer(resizeImage(t, imageBuffer)) if err != nil { t.Error(err) } }) t.Run("errors on an invalid image", func(t *testing.T) { _, err := vips.SaveToJpegBuffer(vips.NewEmptyImage()) if err == nil || !strings.Contains(err.Error(), "error saving to jpeg buffer") || !strings.Contains(err.Error(), "vips_image_pio_input: no image data") { t.Error(err) } }) }) t.Run("SaveToWebPBuffer", func(t *testing.T) { t.Run("saves an image to buffer", func(t *testing.T) { _, err := vips.SaveToWebPBuffer(resizeImage(t, imageBuffer)) if err != nil { t.Error(err) } }) t.Run("errors on an invalid image", func(t *testing.T) { _, err := vips.SaveToWebPBuffer(vips.NewEmptyImage()) if err == nil || !strings.Contains(err.Error(), "error saving to webp buffer") || !strings.Contains(err.Error(), "vips_image_pio_input: no image data") { t.Error(err) } }) }) t.Run("ResizeImage", func(t *testing.T) { t.Run("loads and resizes an image as jpeg", func(t *testing.T) { image, err := vips.ResizeImage(imageBuffer, 500, 500) if err != nil { t.Error(err) } buf, _ := vips.SaveToJpegBuffer(image) resultFixture := readFixture("resize", "jpg") if !reflect.DeepEqual(buf, resultFixture) { t.Error("image data doesn't match") } }) t.Run("loads and resizes an image as webp", func(t *testing.T) { image, err := vips.ResizeImage(imageBuffer, 500, 500) if err != nil { t.Error(err) } buf, _ := vips.SaveToWebPBuffer(image) resultFixture := readFixture("resize", "webp") if !reflect.DeepEqual(buf, resultFixture) { t.Error("image data doesn't match") } }) t.Run("errors when given an empty buffer", func(t *testing.T) { var buf []byte _, err := vips.ResizeImage(buf, 500, 500) if err == nil || err.Error() != "empty buffer" { t.Error(err) } }) t.Run("errors when given an invalid image", func(t *testing.T) { _, err := vips.ResizeImage(make([]byte, 5), 500, 500) if err == nil || err.Error() != "error processing image from buffer VipsForeignLoad: buffer is not in a known format\n" { t.Error(err) } }) }) t.Run("Grayscale", func(t *testing.T) { t.Run("converts an image to grayscale as jpeg", func(t *testing.T) { image, err := vips.Grayscale(resizeImage(t, imageBuffer)) if err != nil { t.Error(err) } buf, _ := vips.SaveToJpegBuffer(image) resultFixture := readFixture("grayscale", "jpg") if !reflect.DeepEqual(buf, resultFixture) { t.Error("image data doesn't match") } }) t.Run("converts an image to grayscale as webp", func(t *testing.T) { image, err := vips.Grayscale(resizeImage(t, imageBuffer)) if err != nil { t.Error(err) } buf, _ := vips.SaveToWebPBuffer(image) resultFixture := readFixture("grayscale", "webp") if !reflect.DeepEqual(buf, resultFixture) { t.Error("image data doesn't match") } }) t.Run("errors when given an invalid image", func(t *testing.T) { _, err := vips.Grayscale(vips.NewEmptyImage()) if err == nil || err.Error() != "error changing image colorspace vips_image_pio_input: no image data\n" { t.Error(err) } }) }) t.Run("Blur", func(t *testing.T) { t.Run("blurs an image as jpeg", func(t *testing.T) { image, err := vips.Blur(resizeImage(t, imageBuffer), 5) if err != nil { t.Error(err) } buf, _ := vips.SaveToJpegBuffer(image) resultFixture := readFixture("blur", "jpg") if !reflect.DeepEqual(buf, resultFixture) { t.Error("image data doesn't match") } }) t.Run("blurs an image as webp", func(t *testing.T) { image, err := vips.Blur(resizeImage(t, imageBuffer), 5) if err != nil { t.Error(err) } buf, _ := vips.SaveToWebPBuffer(image) resultFixture := readFixture("blur", "webp") if !reflect.DeepEqual(buf, resultFixture) { t.Error("image data doesn't match") } }) t.Run("errors when given an invalid image", func(t *testing.T) { _, err := vips.Blur(vips.NewEmptyImage(), 5) if err == nil || err.Error() != "error applying blur to image vips_image_pio_input: no image data\n" { t.Error(err) } }) }) } // Utility function for regenerating the fixtures func TestFixtures(t *testing.T) { if os.Getenv("GENERATE_FIXTURES") != "1" { t.SkipNow() } imageBuffer := setup(t) defer vips.Shutdown() // Resize image, _ := vips.ResizeImage(imageBuffer, 500, 500) resizeJpeg, _ := vips.SaveToJpegBuffer(image) ioutil.WriteFile(fixturePath("resize", "jpg"), resizeJpeg, 644) image, _ = vips.ResizeImage(imageBuffer, 500, 500) resizeWebP, _ := vips.SaveToWebPBuffer(image) ioutil.WriteFile(fixturePath("resize", "webp"), resizeWebP, 644) // Grayscale image, _ = vips.Grayscale(resizeImage(t, imageBuffer)) grayscaleJpeg, _ := vips.SaveToJpegBuffer(image) ioutil.WriteFile(fixturePath("grayscale", "jpg"), grayscaleJpeg, 644) image, _ = vips.Grayscale(resizeImage(t, imageBuffer)) grayscaleWebP, _ := vips.SaveToWebPBuffer(image) ioutil.WriteFile(fixturePath("grayscale", "webp"), grayscaleWebP, 644) // Blur image, _ = vips.Blur(resizeImage(t, imageBuffer), 5) blurJpeg, _ := vips.SaveToJpegBuffer(image) ioutil.WriteFile(fixturePath("blur", "jpg"), blurJpeg, 644) image, _ = vips.Blur(resizeImage(t, imageBuffer), 5) blurWebP, _ := vips.SaveToWebPBuffer(image) ioutil.WriteFile(fixturePath("blur", "webp"), blurWebP, 644) } func setup(t *testing.T) []byte { log := logger.New(zap.FatalLevel) defer log.Sync() err := vips.Initialize(log) if err != nil { t.Fatal(err) } imageBuffer, err := ioutil.ReadFile("../../test/fixtures/fixture.jpg") if err != nil { t.Fatal(err) } return imageBuffer } func resizeImage(t *testing.T, imageBuffer []byte) vips.Image { resizedImage, err := vips.ResizeImage(imageBuffer, 500, 500) if err != nil { t.Fatal(err) } vips.SetUserComment(resizedImage, "Test") return resizedImage } func readFixture(fixtureName string, extension string) []byte { fixture, _ := ioutil.ReadFile(fixturePath(fixtureName, extension)) return fixture } func fixturePath(fixtureName string, extension string) string { return fmt.Sprintf("../../test/fixtures/vips/%s_result_%s.%s", fixtureName, runtime.GOOS, extension) }
{'content_hash': 'a3b4e313898559f3817b1ec8353763a0', 'timestamp': '', 'source': 'github', 'line_count': 240, 'max_line_length': 156, 'avg_line_length': 27.804166666666667, 'alnum_prop': 0.6530795744043159, 'repo_name': 'DMarby/unsplash-it', 'id': 'e6455b61f678252ca700bbbabe9a96c19bb6288b', 'size': '6673', 'binary': False, 'copies': '1', 'ref': 'refs/heads/dependabot/npm_and_yarn/hosted-git-info-2.8.9', 'path': 'internal/vips/vips_test.go', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '3207'}, {'name': 'HTML', 'bytes': '16420'}, {'name': 'JavaScript', 'bytes': '15774'}, {'name': 'Nginx', 'bytes': '4416'}]}
class ProjectPolicy attr_reader :user, :project def initialize(user, project) @user = user @project = project end def show? project.accepted? end def edit? project.accepted? && project.user == user end def update? project.accepted? && project.user == user end def follow? project.accepted? end end
{'content_hash': '777831c54aa03cbe8a801d8d3607ff3a', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 45, 'avg_line_length': 14.541666666666666, 'alnum_prop': 0.6446991404011462, 'repo_name': 'fakenine/mymarvin', 'id': '740de5ff53ed2eb119fc68b3d91fe6e6d1801906', 'size': '413', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/policies/project_policy.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '4632'}, {'name': 'CoffeeScript', 'bytes': '2384'}, {'name': 'HTML', 'bytes': '23436'}, {'name': 'JavaScript', 'bytes': '1509'}, {'name': 'Ruby', 'bytes': '104495'}]}
<!doctype html><html lang=en dir=auto> <head><meta charset=utf-8> <meta http-equiv=x-ua-compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"> <meta name=robots content="index, follow"> <title>Tags | ExampleSite</title> <meta name=keywords content> <meta name=description content="ExampleSite description"> <meta name=author content="Me"> <link rel=canonical href=https://arkadiusz-cholewa.github.io/tags/> <meta name=google-site-verification content="XYZabc"> <meta name=yandex-verification content="XYZabc"> <meta name=msvalidate.01 content="XYZabc"> <link crossorigin=anonymous href=/assets/css/stylesheet.min.c88963fe2d79462000fd0fb1b3737783c32855d340583e4523343f8735c787f0.css integrity="sha256-yIlj/i15RiAA/Q+xs3N3g8MoVdNAWD5FIzQ/hzXHh/A=" rel="preload stylesheet" as=style> <link rel=icon href=https://arkadiusz-cholewa.github.io/favicon.ico> <link rel=icon type=image/png sizes=16x16 href=https://arkadiusz-cholewa.github.io/favicon-16x16.png> <link rel=icon type=image/png sizes=32x32 href=https://arkadiusz-cholewa.github.io/favicon-32x32.png> <link rel=apple-touch-icon href=https://arkadiusz-cholewa.github.io/apple-touch-icon.png> <link rel=mask-icon href=https://arkadiusz-cholewa.github.io/safari-pinned-tab.svg> <meta name=theme-color content="#2e2e33"> <meta name=msapplication-TileColor content="#2e2e33"> <meta name=generator content="Hugo 0.89.4"> <link rel=alternate type=application/rss+xml href=https://arkadiusz-cholewa.github.io/tags/index.xml> <noscript> <style>#theme-toggle,.top-link{display:none}</style> <style>@media(prefers-color-scheme:dark){:root{--theme:rgb(29, 30, 32);--entry:rgb(46, 46, 51);--primary:rgb(218, 218, 219);--secondary:rgb(155, 156, 157);--tertiary:rgb(65, 66, 68);--content:rgb(196, 196, 197);--hljs-bg:rgb(46, 46, 51);--code-bg:rgb(55, 56, 62);--border:rgb(51, 51, 51)}.list{background:var(--theme)}.list:not(.dark)::-webkit-scrollbar-track{background:0 0}.list:not(.dark)::-webkit-scrollbar-thumb{border-color:var(--theme)}}</style> </noscript> <script type=application/javascript>var doNotTrack=!1;doNotTrack||(function(a,e,f,g,b,c,d){a.GoogleAnalyticsObject=b,a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)},a[b].l=1*new Date,c=e.createElement(f),d=e.getElementsByTagName(f)[0],c.async=1,c.src=g,d.parentNode.insertBefore(c,d)}(window,document,'script','https://www.google-analytics.com/analytics.js','ga'),ga('create','UA-123-45','auto'),ga('send','pageview'))</script><meta property="og:title" content="Tags"> <meta property="og:description" content="ExampleSite description"> <meta property="og:type" content="website"> <meta property="og:url" content="https://arkadiusz-cholewa.github.io/tags/"><meta property="og:image" content="https://arkadiusz-cholewa.github.io/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E"><meta property="og:site_name" content="ExampleSite"> <meta name=twitter:card content="summary_large_image"> <meta name=twitter:image content="https://arkadiusz-cholewa.github.io/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E"> <meta name=twitter:title content="Tags"> <meta name=twitter:description content="ExampleSite description"> </head> <body class=list id=top> <script>localStorage.getItem("pref-theme")==="dark"?document.body.classList.add('dark'):localStorage.getItem("pref-theme")==="light"?document.body.classList.remove('dark'):window.matchMedia('(prefers-color-scheme: dark)').matches&&document.body.classList.add('dark')</script> <header class=header> <nav class=nav> <div class=logo> <a href=https://arkadiusz-cholewa.github.io/ accesskey=h title="Arek Cholewa (Alt + H)">Arek Cholewa</a> <span class=logo-switches> <button id=theme-toggle accesskey=t title="(Alt + T)"><svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg><svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg> </button> </span> </div> <ul id=menu> <li> <a href=https://arkadiusz-cholewa.github.io/categories/ title=categories> <span>categories</span> </a> </li> <li> <a href=https://arkadiusz-cholewa.github.io/tags/ title=tags> <span class=active>tags</span> </a> </li> <li> <a href=https://example.org title=example.org> <span>example.org</span> </a> </li> </ul> </nav> </header> <main class=main> <header class=page-header> <h1>Tags</h1> </header> <ul class=terms-tags> </ul> </main> <footer class=footer> <span>&copy; 2021 <a href=https://arkadiusz-cholewa.github.io/>ExampleSite</a></span> <span> Powered by <a href=https://gohugo.io/ rel="noopener noreferrer" target=_blank>Hugo</a> & <a href=https://git.io/hugopapermod rel=noopener target=_blank>PaperMod</a> </span> </footer> <a href=#top aria-label="go to top" title="Go to Top (Alt + G)" class=top-link id=top-link accesskey=g><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentcolor"><path d="M12 6H0l6-6z"/></svg> </a> <script>let menu=document.getElementById('menu');menu&&(menu.scrollLeft=localStorage.getItem("menu-scroll-position"),menu.onscroll=function(){localStorage.setItem("menu-scroll-position",menu.scrollLeft)}),document.querySelectorAll('a[href^="#"]').forEach(a=>{a.addEventListener("click",function(b){b.preventDefault();var a=this.getAttribute("href").substr(1);window.matchMedia('(prefers-reduced-motion: reduce)').matches?document.querySelector(`[id='${decodeURIComponent(a)}']`).scrollIntoView():document.querySelector(`[id='${decodeURIComponent(a)}']`).scrollIntoView({behavior:"smooth"}),a==="top"?history.replaceState(null,null," "):history.pushState(null,null,`#${a}`)})})</script> <script>var mybutton=document.getElementById("top-link");window.onscroll=function(){document.body.scrollTop>800||document.documentElement.scrollTop>800?(mybutton.style.visibility="visible",mybutton.style.opacity="1"):(mybutton.style.visibility="hidden",mybutton.style.opacity="0")}</script> <script>document.getElementById("theme-toggle").addEventListener("click",()=>{document.body.className.includes("dark")?(document.body.classList.remove('dark'),localStorage.setItem("pref-theme",'light')):(document.body.classList.add('dark'),localStorage.setItem("pref-theme",'dark'))})</script> </body> </html>
{'content_hash': 'dcb144ef1f69aa5e15a82ea954f78287', 'timestamp': '', 'source': 'github', 'line_count': 88, 'max_line_length': 881, 'avg_line_length': 78.29545454545455, 'alnum_prop': 0.7287373004354136, 'repo_name': 'arkadiusz-cholewa/arkadiusz-cholewa.github.io', 'id': '8cef972a0021daa4c3ef30306e61907a02a2257d', 'size': '6890', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'tags/index.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '11691'}, {'name': 'HTML', 'bytes': '8944'}, {'name': 'Ruby', 'bytes': '2418'}]}
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{'content_hash': '458ab8c7320d98c288f4113bbfb8551a', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 10.23076923076923, 'alnum_prop': 0.6917293233082706, 'repo_name': 'mdoering/backbone', 'id': '950bfa2cbb3011ff0d84d79b9fc4961e4736a398', 'size': '186', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Ericales/Sapotaceae/Payena/Payena leerii/ Syn. Isonandra benjamina/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
<?php namespace CodeIgniter\Models; use Tests\Support\Models\UserModel; /** * @group DatabaseLive * * @internal */ final class AffectedRowsTest extends LiveModelTestCase { /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5137 */ public function testAffectedRowsWithEmptyUpdate(): void { $this->createModel(UserModel::class); $notExistsId = -1; $this->model ->set('country', 'US') ->where('id', $notExistsId) ->update(); $this->assertSame(0, $this->model->affectedRows()); } }
{'content_hash': 'c23bc6eec13374b7d18a501d7d7104d0', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 68, 'avg_line_length': 19.8, 'alnum_prop': 0.5993265993265994, 'repo_name': 'kenjis/CodeIgniter4', 'id': '43e14c1ec638af58a4db74f04a0f73e5203f778b', 'size': '837', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'tests/system/Models/AffectedRowsTest.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '764'}, {'name': 'CSS', 'bytes': '31287'}, {'name': 'Clojure', 'bytes': '2862'}, {'name': 'HTML', 'bytes': '679'}, {'name': 'Hack', 'bytes': '346'}, {'name': 'JavaScript', 'bytes': '32757'}, {'name': 'Makefile', 'bytes': '638'}, {'name': 'PHP', 'bytes': '4994059'}, {'name': 'Python', 'bytes': '5152'}, {'name': 'SCSS', 'bytes': '16951'}, {'name': 'Shell', 'bytes': '14183'}, {'name': 'Smarty', 'bytes': '4883'}]}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_33) on Wed Sep 05 21:26:31 PDT 2012 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> com.fasterxml.jackson.dataformat.xml.ser (Jackson-dataformat-XML 2.0.5 API) </TITLE> <META NAME="date" CONTENT="2012-09-05"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <FONT size="+1" CLASS="FrameTitleFont"> <A HREF="../../../../../../com/fasterxml/jackson/dataformat/xml/ser/package-summary.html" target="classFrame">com.fasterxml.jackson.dataformat.xml.ser</A></FONT> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Classes</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="ToXmlGenerator.html" title="class in com.fasterxml.jackson.dataformat.xml.ser" target="classFrame">ToXmlGenerator</A> <BR> <A HREF="XmlBeanPropertyWriter.html" title="class in com.fasterxml.jackson.dataformat.xml.ser" target="classFrame">XmlBeanPropertyWriter</A> <BR> <A HREF="XmlBeanSerializer.html" title="class in com.fasterxml.jackson.dataformat.xml.ser" target="classFrame">XmlBeanSerializer</A> <BR> <A HREF="XmlBeanSerializerModifier.html" title="class in com.fasterxml.jackson.dataformat.xml.ser" target="classFrame">XmlBeanSerializerModifier</A> <BR> <A HREF="XmlSerializerProvider.html" title="class in com.fasterxml.jackson.dataformat.xml.ser" target="classFrame">XmlSerializerProvider</A></FONT></TD> </TR> </TABLE> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Enums</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="ToXmlGenerator.Feature.html" title="enum in com.fasterxml.jackson.dataformat.xml.ser" target="classFrame">ToXmlGenerator.Feature</A></FONT></TD> </TR> </TABLE> </BODY> </HTML>
{'content_hash': 'f0bc2b646767b24cc2ed077e0ac59adf', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 161, 'avg_line_length': 38.11538461538461, 'alnum_prop': 0.7209889001009082, 'repo_name': 'FasterXML/jackson-dataformat-xml', 'id': '07cc24cc92615dc6fb0d9feac9be4a46b719f2b3', 'size': '1982', 'binary': False, 'copies': '1', 'ref': 'refs/heads/2.15', 'path': 'docs/javadoc/2.0.5/com/fasterxml/jackson/dataformat/xml/ser/package-frame.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '796457'}, {'name': 'Logos', 'bytes': '24505'}]}
{% include cart-philosophies/sheet-numbering/03-image.svg %}
{'content_hash': '0401fd37883d2dd745a82b50dd9cb91e', 'timestamp': '', 'source': 'github', 'line_count': 1, 'max_line_length': 60, 'avg_line_length': 60.0, 'alnum_prop': 0.7833333333333333, 'repo_name': 'bvn-architecture/styleguide', 'id': '2647801716994e77ad9b9dc02e6780b86ed272e6', 'size': '60', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_includes/cart-philosophies/sheet-numbering/03-block.markdown', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '71196'}, {'name': 'HTML', 'bytes': '13156'}, {'name': 'JavaScript', 'bytes': '6365'}, {'name': 'Ruby', 'bytes': '5595'}]}
@interface SSZipArchive () + (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime; @end @implementation SSZipArchive { NSString *_path; NSString *_filename; zipFile _zip; } #pragma mark - Unzipping + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination { return [self unzipFileAtPath:path toDestination:destination delegate:nil]; } + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error { return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:error delegate:nil progressHandler:nil completionHandler:nil]; } + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate { return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil delegate:delegate progressHandler:nil completionHandler:nil]; } + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id<SSZipArchiveDelegate>)delegate { return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:error delegate:delegate progressHandler:nil completionHandler:nil]; } + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler { return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler]; } + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler { return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler]; } + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id<SSZipArchiveDelegate>)delegate progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler { // Begin opening zipFile zip = unzOpen((const char*)[path UTF8String]); if (zip == NULL) { NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open zip file"}; NSError *err = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-1 userInfo:userInfo]; if (error) { *error = err; } if (completionHandler) { completionHandler(nil, NO, err); } return NO; } NSDictionary * fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil]; unsigned long long fileSize = [fileAttributes[NSFileSize] unsignedLongLongValue]; unsigned long long currentPosition = 0; unz_global_info globalInfo = {0ul, 0ul}; unzGetGlobalInfo(zip, &globalInfo); // Begin unzipping if (unzGoToFirstFile(zip) != UNZ_OK) { NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open first file in zip file"}; NSError *err = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-2 userInfo:userInfo]; if (error) { *error = err; } if (completionHandler) { completionHandler(nil, NO, err); } return NO; } BOOL success = YES; BOOL canceled = NO; int ret = 0; int crc_ret =0; unsigned char buffer[4096] = {0}; NSFileManager *fileManager = [NSFileManager defaultManager]; NSMutableSet *directoriesModificationDates = [[NSMutableSet alloc] init]; // Message delegate if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipArchiveAtPath:zipInfo:)]) { [delegate zipArchiveWillUnzipArchiveAtPath:path zipInfo:globalInfo]; } if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { [delegate zipArchiveProgressEvent:currentPosition total:fileSize]; } int currentFileNumber = 0; do { @autoreleasepool { if ([password length] == 0) { ret = unzOpenCurrentFile(zip); } else { ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]); } if (ret != UNZ_OK) { success = NO; break; } // Reading data and write to file unz_file_info fileInfo; memset(&fileInfo, 0, sizeof(unz_file_info)); ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); if (ret != UNZ_OK) { success = NO; unzCloseCurrentFile(zip); break; } currentPosition += fileInfo.compressed_size; // Message delegate if ([delegate respondsToSelector:@selector(zipArchiveShouldUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { if (![delegate zipArchiveShouldUnzipFileAtIndex:currentFileNumber totalFiles:(int)globalInfo.number_entry archivePath:path fileInfo:fileInfo]) { success = NO; canceled = YES; break; } } if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { [delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber totalFiles:(int)globalInfo.number_entry archivePath:path fileInfo:fileInfo]; } if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { [delegate zipArchiveProgressEvent:(int)currentPosition total:(int)fileSize]; } char *filename = (char *)malloc(fileInfo.size_filename + 1); if (filename == NULL) { return NO; } unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); filename[fileInfo.size_filename] = '\0'; // // Determine whether this is a symbolic link: // - File is stored with 'version made by' value of UNIX (3), // as per http://www.pkware.com/documents/casestudies/APPNOTE.TXT // in the upper byte of the version field. // - BSD4.4 st_mode constants are stored in the high 16 bits of the // external file attributes (defacto standard, verified against libarchive) // // The original constants can be found here: // http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/include/sys/stat.h // const uLong ZipUNIXVersion = 3; const uLong BSD_SFMT = 0170000; const uLong BSD_IFLNK = 0120000; BOOL fileIsSymbolicLink = NO; if (((fileInfo.version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo.external_fa >> 16))) { fileIsSymbolicLink = NO; } // Check if it contains directory NSString *strPath = @(filename); BOOL isDirectory = NO; if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') { isDirectory = YES; } free(filename); // Contains a path if ([strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location != NSNotFound) { strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; } NSString *fullPath = [destination stringByAppendingPathComponent:strPath]; NSError *err = nil; NSDate *modDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; NSDictionary *directoryAttr = @{NSFileCreationDate: modDate, NSFileModificationDate: modDate}; if (isDirectory) { [fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err]; } else { [fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:directoryAttr error:&err]; } if (nil != err) { NSLog(@"[SSZipArchive] Error: %@", err.localizedDescription); } if(!fileIsSymbolicLink) [directoriesModificationDates addObject: @{@"path": fullPath, @"modDate": modDate}]; if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) { //FIXME: couldBe CRC Check? unzCloseCurrentFile(zip); ret = unzGoToNextFile(zip); continue; } if (!fileIsSymbolicLink) { FILE *fp = fopen((const char*)[fullPath UTF8String], "wb"); while (fp) { int readBytes = unzReadCurrentFile(zip, buffer, 4096); if (readBytes > 0) { fwrite(buffer, readBytes, 1, fp ); } else { break; } } if (fp) { if ([[[fullPath pathExtension] lowercaseString] isEqualToString:@"zip"]) { NSLog(@"Unzipping nested .zip file: %@", [fullPath lastPathComponent]); if ([self unzipFileAtPath:fullPath toDestination:[fullPath stringByDeletingLastPathComponent] overwrite:overwrite password:password error:nil delegate:nil]) { [[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil]; } } fclose(fp); // Set the original datetime property if (fileInfo.dosDate != 0) { NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; NSDictionary *attr = @{NSFileModificationDate: orgDate}; if (attr) { if ([fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] == NO) { // Can't set attributes NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting modification date"); } } } // Set the original permissions on the file uLong permissions = fileInfo.external_fa >> 16; if (permissions != 0) { // Store it into a NSNumber NSNumber *permissionsValue = @(permissions); // Retrieve any existing attributes NSMutableDictionary *attrs = [[NSMutableDictionary alloc] initWithDictionary:[fileManager attributesOfItemAtPath:fullPath error:nil]]; // Set the value in the attributes dict attrs[NSFilePosixPermissions] = permissionsValue; // Update attributes if ([fileManager setAttributes:attrs ofItemAtPath:fullPath error:nil] == NO) { // Unable to set the permissions attribute NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting permissions"); } #if !__has_feature(objc_arc) [attrs release]; #endif } } } else { // Assemble the path for the symbolic link NSMutableString* destinationPath = [NSMutableString string]; int bytesRead = 0; while((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0) { buffer[bytesRead] = (int)0; [destinationPath appendString:@((const char*)buffer)]; } // Create the symbolic link (making sure it stays relative if it was relative before) int symlinkError = symlink([destinationPath cStringUsingEncoding:NSUTF8StringEncoding], [fullPath cStringUsingEncoding:NSUTF8StringEncoding]); if(symlinkError != 0) { NSLog(@"Failed to create symbolic link at \"%@\" to \"%@\". symlink() error code: %d", fullPath, destinationPath, errno); } } crc_ret = unzCloseCurrentFile( zip ); if (crc_ret == UNZ_CRCERROR) { //CRC ERROR success = NO; break; } ret = unzGoToNextFile( zip ); // Message delegate if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { [delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(int)globalInfo.number_entry archivePath:path fileInfo:fileInfo]; } else if ([delegate respondsToSelector: @selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:unzippedFilePath:)]) { [delegate zipArchiveDidUnzipFileAtIndex: currentFileNumber totalFiles: (int)globalInfo.number_entry archivePath:path unzippedFilePath: fullPath]; } currentFileNumber++; if (progressHandler) { progressHandler(strPath, fileInfo, currentFileNumber, globalInfo.number_entry); } } } while(ret == UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE); // Close unzClose(zip); // The process of decompressing the .zip archive causes the modification times on the folders // to be set to the present time. So, when we are done, they need to be explicitly set. // set the modification date on all of the directories. NSError * err = nil; for (NSDictionary * d in directoriesModificationDates) { if (![[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate: d[@"modDate"]} ofItemAtPath:d[@"path"] error:&err]) { NSLog(@"[SSZipArchive] Set attributes failed for directory: %@.", d[@"path"]); } if (err) { NSLog(@"[SSZipArchive] Error setting directory file modification date attribute: %@",err.localizedDescription); } } #if !__has_feature(objc_arc) [directoriesModificationDates release]; #endif // Message delegate if (success && [delegate respondsToSelector:@selector(zipArchiveDidUnzipArchiveAtPath:zipInfo:unzippedPath:)]) { [delegate zipArchiveDidUnzipArchiveAtPath:path zipInfo:globalInfo unzippedPath:destination]; } // final progress event = 100% if (!canceled && [delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { [delegate zipArchiveProgressEvent:fileSize total:fileSize]; } NSError *retErr = nil; if (crc_ret == UNZ_CRCERROR) { NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"crc check failed for file"}; retErr = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-3 userInfo:userInfo]; } if (error) { *error = retErr; } if (completionHandler) { completionHandler(path, success, retErr); } return success; } #pragma mark - Zipping + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths { return [SSZipArchive createZipFileAtPath:path withFilesAtPaths:paths withPassword:nil]; } + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath{ return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath withPassword:nil]; } + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirector{ return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:keepParentDirector withPassword:nil]; } + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(NSString *)password { BOOL success = NO; SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; if ([zipArchive open]) { for (NSString *filePath in paths) { [zipArchive writeFile:filePath withPassword:password]; } success = [zipArchive close]; } #if !__has_feature(objc_arc) [zipArchive release]; #endif return success; } + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(NSString *)password{ return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:NO withPassword:password]; } + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(NSString *)password{ BOOL success = NO; NSFileManager *fileManager = nil; SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; if ([zipArchive open]) { // use a local filemanager (queue/thread compatibility) fileManager = [[NSFileManager alloc] init]; NSDirectoryEnumerator *dirEnumerator = [fileManager enumeratorAtPath:directoryPath]; NSString *fileName; while ((fileName = [dirEnumerator nextObject])) { BOOL isDir; NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName]; [fileManager fileExistsAtPath:fullFilePath isDirectory:&isDir]; if (keepParentDirectory) { fileName = [[directoryPath lastPathComponent] stringByAppendingPathComponent:fileName]; } if (!isDir) { [zipArchive writeFileAtPath:fullFilePath withFileName:fileName withPassword:password]; } else { if([[NSFileManager defaultManager] subpathsOfDirectoryAtPath:fullFilePath error:nil].count == 0) { NSString *tempFilePath = [self _temporaryPathForDiscardableFile]; NSString *tempFileFilename = [fileName stringByAppendingPathComponent:tempFilePath.lastPathComponent]; [zipArchive writeFileAtPath:tempFilePath withFileName:tempFileFilename withPassword:password]; } } } success = [zipArchive close]; } #if !__has_feature(objc_arc) [fileManager release]; [zipArchive release]; #endif return success; } - (instancetype)initWithPath:(NSString *)path { if ((self = [super init])) { _path = [path copy]; } return self; } #if !__has_feature(objc_arc) - (void)dealloc { [_path release]; [super dealloc]; } #endif - (BOOL)open { NSAssert((_zip == NULL), @"Attempting open an archive which is already open"); _zip = zipOpen([_path UTF8String], APPEND_STATUS_CREATE); return (NULL != _zip); } - (void)zipInfo:(zip_fileinfo*)zipInfo setDate:(NSDate*)date { NSCalendar *currentCalendar = [NSCalendar currentCalendar]; #if defined(__IPHONE_8_0) || defined(__MAC_10_10) uint flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; #else uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; #endif NSDateComponents *components = [currentCalendar components:flags fromDate:date]; zipInfo->tmz_date.tm_sec = (unsigned int)components.second; zipInfo->tmz_date.tm_min = (unsigned int)components.minute; zipInfo->tmz_date.tm_hour = (unsigned int)components.hour; zipInfo->tmz_date.tm_mday = (unsigned int)components.day; zipInfo->tmz_date.tm_mon = (unsigned int)components.month - 1; zipInfo->tmz_date.tm_year = (unsigned int)components.year; } - (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(NSString *)password { NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened"); zip_fileinfo zipInfo = {{0}}; NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil]; if( attr ) { NSDate *fileDate = (NSDate *)attr[NSFileModificationDate]; if( fileDate ) { [self zipInfo:&zipInfo setDate: fileDate ]; } // Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727 // Get the permissions value from the files attributes NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions]; if (permissionsValue) { // Get the short value for the permissions short permissionsShort = permissionsValue.shortValue; // Convert this into an octal by adding 010000, 010000 being the flag for a regular file int permissionsOctal = 0100000 + permissionsShort; // Convert this into a long value uLong permissionsLong = @(permissionsOctal).unsignedLongValue; // Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte zipInfo.external_fa = permissionsLong << 16L; } } unsigned int len = 0; zipOpenNewFileInZip3(_zip, [[folderName stringByAppendingString:@"/"] UTF8String], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_NO_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, [password UTF8String], 0); zipWriteInFileInZip(_zip, &len, 0); zipCloseFileInZip(_zip); return YES; } - (BOOL)writeFile:(NSString *)path withPassword:(NSString *)password; { return [self writeFileAtPath:path withFileName:nil withPassword:password]; } // supports writing files with logical folder/directory structure // *path* is the absolute path of the file that will be compressed // *fileName* is the relative name of the file how it is stored within the zip e.g. /folder/subfolder/text1.txt - (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName withPassword:(NSString *)password { NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened"); FILE *input = fopen([path UTF8String], "r"); if (NULL == input) { return NO; } const char *afileName; if (!fileName) { afileName = [path.lastPathComponent UTF8String]; } else { afileName = [fileName UTF8String]; } zip_fileinfo zipInfo = {{0}}; NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil]; if( attr ) { NSDate *fileDate = (NSDate *)attr[NSFileModificationDate]; if( fileDate ) { [self zipInfo:&zipInfo setDate: fileDate ]; } // Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727 // Get the permissions value from the files attributes NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions]; if (permissionsValue) { // Get the short value for the permissions short permissionsShort = permissionsValue.shortValue; // Convert this into an octal by adding 010000, 010000 being the flag for a regular file int permissionsOctal = 0100000 + permissionsShort; // Convert this into a long value uLong permissionsLong = @(permissionsOctal).unsignedLongValue; // Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte zipInfo.external_fa = permissionsLong << 16L; } } void *buffer = malloc(CHUNK); if (buffer == NULL) { return NO; } zipOpenNewFileInZip3(_zip, afileName, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, [password UTF8String], 0); unsigned int len = 0; while (!feof(input)) { len = (unsigned int) fread(buffer, 1, CHUNK, input); zipWriteInFileInZip(_zip, buffer, len); } zipCloseFileInZip(_zip); free(buffer); fclose(input); return YES; } - (BOOL)writeData:(NSData *)data filename:(NSString *)filename withPassword:(NSString *)password; { if (!_zip) { return NO; } if (!data) { return NO; } zip_fileinfo zipInfo = {{0,0,0,0,0,0},0,0,0}; [self zipInfo:&zipInfo setDate:[NSDate date]]; zipOpenNewFileInZip3(_zip, [filename UTF8String], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, [password UTF8String], 0); zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length); zipCloseFileInZip(_zip); return YES; } - (BOOL)close { NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened"); zipClose(_zip, NULL); return YES; } #pragma mark - Private + (NSString *)_temporaryPathForDiscardableFile { static NSString *discardableFileName = @".DS_Store"; static NSString *discardableFilePath = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSString *temporaryDirectoryName = [[NSUUID UUID] UUIDString]; NSString *temporaryDirectory = [NSTemporaryDirectory() stringByAppendingPathComponent:temporaryDirectoryName]; BOOL directoryCreated = [[NSFileManager defaultManager] createDirectoryAtPath:temporaryDirectory withIntermediateDirectories:YES attributes:nil error:nil]; discardableFilePath = directoryCreated ? [temporaryDirectory stringByAppendingPathComponent:discardableFileName] : nil; [@"" writeToFile:discardableFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; }); return discardableFilePath; } // Format from http://newsgroups.derkeiler.com/Archive/Comp/comp.os.msdos.programmer/2009-04/msg00060.html // Two consecutive words, or a longword, YYYYYYYMMMMDDDDD hhhhhmmmmmmsssss // YYYYYYY is years from 1980 = 0 // sssss is (seconds/2). // // 3658 = 0011 0110 0101 1000 = 0011011 0010 11000 = 27 2 24 = 2007-02-24 // 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 3 = 14:33:06 + (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime { static const UInt32 kYearMask = 0xFE000000; static const UInt32 kMonthMask = 0x1E00000; static const UInt32 kDayMask = 0x1F0000; static const UInt32 kHourMask = 0xF800; static const UInt32 kMinuteMask = 0x7E0; static const UInt32 kSecondMask = 0x1F; static NSCalendar *gregorian; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ #if defined(__IPHONE_8_0) || defined(__MAC_10_10) gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; #else gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; #endif }); NSDateComponents *components = [[NSDateComponents alloc] init]; NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up"); [components setYear:1980 + ((msdosDateTime & kYearMask) >> 25)]; [components setMonth:(msdosDateTime & kMonthMask) >> 21]; [components setDay:(msdosDateTime & kDayMask) >> 16]; [components setHour:(msdosDateTime & kHourMask) >> 11]; [components setMinute:(msdosDateTime & kMinuteMask) >> 5]; [components setSecond:(msdosDateTime & kSecondMask) * 2]; NSDate *date = [NSDate dateWithTimeInterval:0 sinceDate:[gregorian dateFromComponents:components]]; #if !__has_feature(objc_arc) [components release]; #endif return date; } @end
{'content_hash': '77804b16c8a0382a845ace5f215c30e4', 'timestamp': '', 'source': 'github', 'line_count': 710, 'max_line_length': 202, 'avg_line_length': 42.32676056338028, 'alnum_prop': 0.6209237321975243, 'repo_name': 'ABTSoftware/SciChartiOSTutorial', 'id': '5b765d223506a854a30ae8940c9f99eb0fe958aa', 'size': '30337', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'v2.x/Examples/SciChartDemo/SSZipArchive/SSZipArchive.m', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Swift', 'bytes': '77055'}]}
<?php namespace oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2; /** * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 * @xmlType AttributeIDType * @xmlName AttributeID * @var oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2\AttributeID */ class AttributeID extends AttributeIDType { } // end class AttributeID
{'content_hash': '2bdd93c7c23543cc987cd714465002b5', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 85, 'avg_line_length': 24.375, 'alnum_prop': 0.7923076923076923, 'repo_name': 'heroicstudios/quickbooks-php-sdk', 'id': '48306b7c128073be1e7133af1c6e83fdf518f10f', 'size': '390', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'sdk/Dependencies/XSD2PHP/test/data/expected/ubl2.0/oasis/names/specification/ubl/schema/xsd/CommonBasicComponents_2/AttributeID.php', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '19489'}, {'name': 'JavaScript', 'bytes': '47994'}, {'name': 'PHP', 'bytes': '5852540'}, {'name': 'Perl', 'bytes': '2024'}, {'name': 'Shell', 'bytes': '99'}, {'name': 'XSLT', 'bytes': '11481'}]}
<?php namespace Symfony\Component\Translation\Loader; use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Exception\InvalidResourceException; /** * LoaderInterface is the interface implemented by all translation loaders. * * @author Fabien Potencier <[email protected]> * * @api */ interface LoaderInterface { /** * Loads a locale. * * @param mixed $resource A resource * @param string $locale A locale * @param string $domain The domain * * @return MessageCatalogue A MessageCatalogue instance * * @api * * @throws NotFoundResourceException when the resource cannot be found * @throws InvalidResourceException when the resource cannot be loaded */ public function load($resource, $locale, $domain = 'messages'); }
{'content_hash': '280ac0ce650740b20402ff0f23d82632', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 75, 'avg_line_length': 25.705882352941178, 'alnum_prop': 0.6681922196796338, 'repo_name': 'Clempops/edeli', 'id': 'fbaff727c0f20832cceaaf1eec3aa417efc69b2f', 'size': '1110', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'vendor/symfony/symfony/src/Symfony/Component/Translation/Loader/LoaderInterface.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '7570'}, {'name': 'PHP', 'bytes': '45605'}]}
(function () { 'use strict'; angular.module('app.dashboard', ['app.core', 'app.widgets']); })();
{'content_hash': '0aef7ff06e255a32296dcea6807e7505', 'timestamp': '', 'source': 'github', 'line_count': 5, 'max_line_length': 65, 'avg_line_length': 21.0, 'alnum_prop': 0.5619047619047619, 'repo_name': 'blessonkavala/cp', 'id': 'cf6e161095c137d2f60c40e67ab9dbd4135bef32', 'size': '105', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'cashportal/src/main/resources/static/app/modules/dashboard/dashboard.module.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '5006'}, {'name': 'CSS', 'bytes': '9164'}, {'name': 'HTML', 'bytes': '100979'}, {'name': 'Java', 'bytes': '155589'}, {'name': 'JavaScript', 'bytes': '96196'}, {'name': 'Shell', 'bytes': '7058'}]}
import Enum from '../../lib/Enum'; export default new Enum([ 'internalServerError', 'conferenceForbidden', 'conferenceBadRequest', 'conferenceNotFound', 'conferenceConflict', 'modeError', 'makeConferenceFailed', 'bringInFailed', ], 'conferenceCall');
{'content_hash': 'bb1ce9d3920da4930a46f08bf9837859', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 34, 'avg_line_length': 22.333333333333332, 'alnum_prop': 0.7126865671641791, 'repo_name': 'u9520107/ringcentral-js-widget', 'id': 'dd3fae8962437f2c737183c01c83a87f40739e23', 'size': '268', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'packages/ringcentral-integration/modules/ConferenceCall/conferenceCallErrors.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '90533'}, {'name': 'HTML', 'bytes': '2967'}, {'name': 'JavaScript', 'bytes': '433434'}, {'name': 'Shell', 'bytes': '1001'}]}
using System; using System.Collections.Generic; using System.Linq; using System.Text; using log4net.Ext.Json.Xunit.General; using Xunit; using Assert = NUnit.Framework.Assert; using StringAssert = NUnit.Framework.StringAssert; using log4net.Core; using System.Collections; namespace log4net.Ext.Json.Xunit.Log { public class StructurallyJsonDotNetIn : RepoTest { protected override string GetConfig() { return @"<log4net> <root> <level value='DEBUG'/> <appender-ref ref='TestAppender'/> </root> <appender name='TestAppender' type='log4net.Ext.Json.Xunit.General.TestAppender, log4net.Ext.Json.Xunit'> <layout type='log4net.Layout.SerializedLayout, log4net.Ext.Json'> <renderer type='log4net.ObjectRenderer.JsonDotNetRenderer, log4net.Ext.Json.Net'> </renderer> <default /> <remove value='message' /> <member value='data:messageobject' /> </layout> </appender> </log4net>"; } protected override void RunTestLog(log4net.ILog log) { log.Info(new { A = 1, B = new { X = DateTime.Parse("2014-01-01") } }); var events = GetEventStrings(log.Logger); Assert.AreEqual(1, events.Length, "events Count"); var le = events.Single(); Assert.IsNotNull(le, "loggingevent"); StringAssert.Contains(@"""A"":1", le, "le has structured message"); StringAssert.Contains(@"""X"":""2014-01-01", le, "le has structured message"); } } }
{'content_hash': 'bb52c713a08a87cea83b4b0f8b94fff0', 'timestamp': '', 'source': 'github', 'line_count': 54, 'max_line_length': 129, 'avg_line_length': 34.907407407407405, 'alnum_prop': 0.5188328912466843, 'repo_name': 'robajz/log4net.Ext.Json', 'id': '5e5280bfa2f17647270000aaf52a092dd15c947f', 'size': '1887', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'log4net.Ext.Json.Xunit/Log/StructurallyJsonDotNet.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C#', 'bytes': '218416'}, {'name': 'Shell', 'bytes': '1662'}]}
NSString *const PFNOTECONFIG_THEME_TYPE = @"theme_type"; NSString *const PFNOTECONFIG_PROPERTY_GRID_TYPE = @"grid_type"; NSString *const PFNOTECONFIG_PROPERTY_GRID_COLOR_INDEX = @"grid_color_index"; NSString *const PFNOTECONFIG_PROPERTY_STROKE_TYPE = @"stroke_type"; @implementation PFNoteConfig @synthesize themeType; -(NSString *) getType { return @"com.pettyfun.bucket.view.note.PFNoteConfig"; } -(void) dealloc { [themeType release]; [super dealloc]; } -(void) onInit { [super onInit]; } -(void) onInitWithData:(NSDictionary *)data { [super onInitWithData:data]; PFOBJECT_GET_STRING(PFNOTECONFIG_THEME_TYPE, themeType) } -(void) onGetData:(NSMutableDictionary *)data { [super onGetData:data]; PFOBJECT_SET_STRING(PFNOTECONFIG_THEME_TYPE, themeType) } #pragma mark - #pragma mark Specific Methods -(void) setToDefaultValues { [super setToDefaultValues]; } -(void) updateTo:(id) config { [super updateTo:config]; if ([[config class] isSubclassOfClass: [PFNoteConfig class]]) { [themeType release]; PFNoteConfig *noteConfig = (PFNoteConfig *) config; themeType = [noteConfig.themeType copy]; [self updateProperty:PFNOTECONFIG_PROPERTY_GRID_TYPE to:config]; [self updateProperty:PFNOTECONFIG_PROPERTY_GRID_COLOR_INDEX to:config]; [self updateProperty:PFNOTECONFIG_PROPERTY_STROKE_TYPE to:config]; } } -(void) setGridType:(NSString *)gridType { [self setProperty:gridType forKey:PFNOTECONFIG_PROPERTY_GRID_TYPE]; } -(NSString *) getGridType { return [self getProperty:PFNOTECONFIG_PROPERTY_GRID_TYPE]; } -(void) setStrokeType:(NSString *)strokeType { [self setProperty:strokeType forKey:PFNOTECONFIG_PROPERTY_STROKE_TYPE]; } -(NSString *) getStrokeType { return [self getProperty:PFNOTECONFIG_PROPERTY_STROKE_TYPE]; } -(void) setGridColorIndex:(NSInteger)gridColorIndex { NSString *value = [[NSNumber numberWithInt:gridColorIndex] stringValue]; [self setProperty:value forKey:PFNOTECONFIG_PROPERTY_GRID_COLOR_INDEX]; } -(NSInteger) getGridColorIndex { NSInteger result = 0; NSString *value = [self getProperty:PFNOTECONFIG_PROPERTY_GRID_COLOR_INDEX]; if (value) { result = [value intValue]; } return result; } @end
{'content_hash': '12d34422f13f2e96d187b0166a33d7d7', 'timestamp': '', 'source': 'github', 'line_count': 85, 'max_line_length': 80, 'avg_line_length': 27.08235294117647, 'alnum_prop': 0.7080799304952216, 'repo_name': 'pettyfun/MovableWrite', 'id': '5e6e2d0e79713fb59969bf587ed0d2c2b27138d1', 'size': '2507', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Common/model/note/PFNoteConfig.m', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'C', 'bytes': '19819'}, {'name': 'Objective-C', 'bytes': '1833984'}]}
<?php /** * @category Zend * @package Zend_Tool * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Tool_Framework_Client_Interactive_InputInterface { /** * Handle Interactive Input Request * * @param Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest * @return Zend_Tool_Framework_Client_Interactive_InputResponse|string */ public function handleInteractiveInputRequest(Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest); public function getMissingParameterPromptString(Zend_Tool_Framework_Provider_Interface $provider, Zend_Tool_Framework_Action_Interface $actionInterface, $missingParameterName); }
{'content_hash': '4527b1b2ddaab82b02e8c5ff69e6e082', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 180, 'avg_line_length': 35.91304347826087, 'alnum_prop': 0.7372881355932204, 'repo_name': 'jodier/tmpdddf', 'id': 'a4bb1d01105275567a1f73910cec73e481f218a8', 'size': '1586', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'web/private/tine20/library/Zend/Tool/Framework/Client/Interactive/InputInterface.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'PHP', 'bytes': '44010'}, {'name': 'Perl', 'bytes': '794'}, {'name': 'Shell', 'bytes': '286'}]}
<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="theme" content="hugo-academic"> <meta name="generator" content="Hugo 0.20.7" /> <meta name="author" content="Ashley Redman"> <meta name="description" content="BSc Computing Student"> <link rel="stylesheet" href="/ashleyredman.github.io/css/highlight.min.css"> <link rel="stylesheet" href="/ashleyredman.github.io/css/bootstrap.min.css"> <link rel="stylesheet" href="/ashleyredman.github.io/css/font-awesome.min.css"> <link rel="stylesheet" href="/ashleyredman.github.io/css/academicons.min.css"> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:400,700%7CMerriweather%7CRoboto+Mono"> <link rel="stylesheet" href="/ashleyredman.github.io/css/hugo-academic.css"> <link rel="alternate" href="ashleyredman.github.io/tags/uni/index.xml" type="application/rss+xml" title="@AJ_Redman"> <link rel="feed" href="ashleyredman.github.io/tags/uni/index.xml" type="application/rss+xml" title="@AJ_Redman"> <link rel="icon" type="image/png" href="/ashleyredman.github.io/img/icon.png"> <link rel="apple-touch-icon" type="image/png" href="/ashleyredman.github.io/img/apple-touch-icon.png"> <link rel="canonical" href="ashleyredman.github.io/tags/uni/"> <title>Uni | @AJ_Redman</title> </head> <body id="top" data-spy="scroll" data-target="#navbar-main" data-offset="71"> <nav class="navbar navbar-default navbar-fixed-top" id="navbar-main"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/ashleyredman.github.io/">@AJ_Redman</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li class="nav-item"> <a href="/ashleyredman.github.io/#about"> <span>Home</span> </a> </li> <li class="nav-item"> <a href="/ashleyredman.github.io/#publications"> <span>Publications</span> </a> </li> <li class="nav-item"> <a href="/ashleyredman.github.io/#posts"> <span>Posts</span> </a> </li> <li class="nav-item"> <a href="/ashleyredman.github.io/#projects"> <span>Projects</span> </a> </li> <li class="nav-item"> <a href="/ashleyredman.github.io/#contact"> <span>Contact</span> </a> </li> </ul> </div> </div> </nav> <div class="universal-wrapper"> <h1>Uni</h1> <div> <h2><a href="ashleyredman.github.io/project/asp.net-cms/">ASP.net Content Management System</a></h2> <div class="article-style"> Web based project management system built with ASP.net web forms </div> </div> <div> <h2><a href="ashleyredman.github.io/project/mvc-project/">ASP.net MVC5 Project</a></h2> <div class="article-style"> A MVC based project for second year Advanced Programming </div> </div> <div> <h2><a href="ashleyredman.github.io/project/js-game/">JavaScript Canvas Game</a></h2> <div class="article-style"> A browser game built with JavaScript </div> </div> <div> <h2><a href="ashleyredman.github.io/project/mobileshop/">Mobile Phone Shop System</a></h2> <div class="article-style"> Local Mobile Phone shop system built with Windows Forms </div> </div> <div> <h2><a href="ashleyredman.github.io/project/htmlcomic/">Online Comic Book</a></h2> <div class="article-style"> An online comic book created with pure HTML &amp; CSS along with Photoshop </div> </div> </div> <footer class="site-footer"> <div class="container"> <p class="powered-by"> &copy; 2017 Ashley Redman &middot; Powered by the <a href="https://github.com/gcushen/hugo-academic" target="_blank">Academic theme</a> for <a href="http://gohugo.io" target="_blank">Hugo</a>. <span class="pull-right" aria-hidden="true"> <a href="#" id="back_to_top"> <span class="button_icon"> <i class="fa fa-chevron-up fa-2x"></i> </span> </a> </span> </p> </div> </footer> <script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.18.4/TweenMax.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/ScrollToPlugin.min.js"></script> <script src="/ashleyredman.github.io/js/jquery-1.12.3.min.js"></script> <script src="/ashleyredman.github.io/js/bootstrap.min.js"></script> <script src="/ashleyredman.github.io/js/isotope.pkgd.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.1/imagesloaded.pkgd.min.js"></script> <script src="/ashleyredman.github.io/js/hugo-academic.js"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-100890259-1', 'auto'); ga('send', 'pageview'); var links = document.querySelectorAll('a'); Array.prototype.map.call(links, function(item) { if (item.host != document.location.host) { item.addEventListener('click', function() { var action = item.getAttribute('data-action') || 'follow'; ga('send', 'event', 'outbound', action, item.href); }); } }); </script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> </body> </html>
{'content_hash': '822e2f2f04a1092d49e76fac79a8d253', 'timestamp': '', 'source': 'github', 'line_count': 265, 'max_line_length': 119, 'avg_line_length': 25.539622641509435, 'alnum_prop': 0.5759456264775413, 'repo_name': 'AshleyRedman/ashleyredman.github.io', 'id': 'f4bf18d3941db6987ae1606392cbd6dd9b6c9d5c', 'size': '6768', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'tags/uni/index.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '19391'}, {'name': 'HTML', 'bytes': '207399'}, {'name': 'JavaScript', 'bytes': '6851'}]}
package org.perfcake.ide.editor.view; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.Point2D; import java.util.List; import org.perfcake.ide.editor.actions.ActionType; import org.perfcake.ide.editor.colors.ColorScheme; import org.perfcake.ide.editor.layout.LayoutData; /** * Base type for a view in editor MVC. * * @author jknetl */ public interface View { /** * @return true if the view is currently selected. */ boolean isSelected(); /** * toggle the view selection. * * @param selected set as selected? */ void setSelected(boolean selected); /** * draw view on the surface. * * @param g2d Graphics context */ void draw(Graphics2D g2d); /** * @return Shape which completely encloses this view graphical representation. */ Shape getViewBounds(); /** * Computes a minimum angular extent which this comonent require in order to be able to draw itself. If the assigned extent for * drawing will be smaller than minimum extent, then component or layoutmanager may decide not to draw the component. * The constraint argument is used as a constraint for the size. So if some dimension of constraint argument is N, * then returned value in that dimension cannot be larger than N. If some dimension of constraint argument is zero, * then there is no constraint on that dimension. * * @param constraint constraint * @param g2d Graphics context * @return Minimum size of the inspector according to given constraints. */ double getMinimumAngularExtent(LayoutData constraint, Graphics2D g2d); /** * Computes preferred angular extend which is recommended by the component for ideal drawing. * The constraint argument is used as a constraint for the size. So if some dimension of constraint argument is N, * then returned value in that dimension cannot be larger than N. If some dimension of constraint argument is zero, * then there is no constraint on that dimension. * * @param constraint constraint * @param g2d Graphics context * @return preferred angular extent for given component */ double getPreferredAngularExtent(LayoutData constraint, Graphics2D g2d); /** * @return Actual layoutData of the view. */ LayoutData getLayoutData(); /** * Sets layout data which are provided to this view and its children views. * * @param data layout data to be set */ void setLayoutData(LayoutData data); /** * @return <b>unmodifiable list of</b> views that acts as a child of current view (they are inside of the view). */ List<View> getChildren(); /** * @return view which is parent of the view. Root view will return null. */ View getParent(); /** * Sets a parent of this view. * * @param parent parent view */ void setParent(View parent); /** * Adds child view. * * @param view view to add */ void addChild(View view); /** * @return true if the view is valid (up to date). */ boolean isValid(); /** * @return Colorscheme used by this view. */ ColorScheme getColorScheme(); /** * Sets colorscheme for this view. * * @param colorScheme color scheme */ void setColorScheme(ColorScheme colorScheme); /** * Invalidates view to indicate that it needs to be redrawn. */ void invalidate(); /** * Validates the view and the view of the children. It means that it sets view sizes and positions so that consequent draw operation * will draw it on proper place with proper size. * * @param g2d Graphics context */ void validate(Graphics2D g2d); /** * Remove child view. * * @param view child view to be removed * @return true if the view was removed or false if the view is not children of this view. */ boolean removeChild(View view); /** * Returns action which should be performed as a result of mouse click on particular location. * * @param location location of the click * @return Action which should be performed. If no Action should be performed, then {@link ActionType#NONE} is returned. This method * must not return null. */ ActionType getAction(Point2D location); /** * Get tooltip for location inside this view bounds.. * * @param location location <b>inside this view bounds</b>. * @return tooltip or null if no tooltip should be displayed */ String getToolTip(Point2D location); }
{'content_hash': '8df90e57be70b3f0885a907380996596', 'timestamp': '', 'source': 'github', 'line_count': 160, 'max_line_length': 136, 'avg_line_length': 29.36875, 'alnum_prop': 0.6560970419238136, 'repo_name': 'PerfCake/pc4ide', 'id': '3011e714a88e0a0a8f8fe4632f1358246a2d1522', 'size': '5466', 'binary': False, 'copies': '1', 'ref': 'refs/heads/devel', 'path': 'pc4ide-editor/src/main/java/org/perfcake/ide/editor/view/View.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '6932'}, {'name': 'Java', 'bytes': '1187002'}, {'name': 'Perl', 'bytes': '1896'}, {'name': 'Shell', 'bytes': '2488'}]}
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ActionDispatch::RemoteIp::IpSpoofAttackError</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" /> <script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script> <script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script> <script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div class="banner"> <span>Ruby on Rails 4.2.1</span><br /> <h1> <span class="type">Class</span> ActionDispatch::RemoteIp::IpSpoofAttackError <span class="parent">&lt; StandardError </span> </h1> <ul class="files"> <li><a href="../../../files/__/__/__/__/_rvm/gems/ruby-2_2_2/gems/actionpack-4_2_1/lib/action_dispatch/middleware/remote_ip_rb.html">/Users/Bonobo/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.1/lib/action_dispatch/middleware/remote_ip.rb</a></li> </ul> </div> <div id="bodyContent"> <div id="content"> <!-- Methods --> </div> </div> </body> </html>
{'content_hash': '230d1ad40edf653421ce27ad8c015e81', 'timestamp': '', 'source': 'github', 'line_count': 78, 'max_line_length': 254, 'avg_line_length': 24.94871794871795, 'alnum_prop': 0.5313463514902363, 'repo_name': 'TomMulvaney/AudioFlow', 'id': '248645dfda090cfa85e6463594d9c7a37ca501f8', 'size': '1946', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'doc/api/classes/ActionDispatch/RemoteIp/IpSpoofAttackError.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '60402'}, {'name': 'CoffeeScript', 'bytes': '1073'}, {'name': 'HTML', 'bytes': '9191'}, {'name': 'JavaScript', 'bytes': '24013'}, {'name': 'Ruby', 'bytes': '29957'}]}
.. automodule:: pyaaf.core AxGPITrigger ------------ .. autoclass:: AxGPITrigger :members: :undoc-members: :show-inheritance:
{'content_hash': 'a9618e7164bef1bb5985863ca1d6351d', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 31, 'avg_line_length': 15.916666666666666, 'alnum_prop': 0.450261780104712, 'repo_name': 'DIT-Tools/pyaaf', 'id': '24cbb4c4679064db77af0365b646e52db2a19d56', 'size': '193', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/core/AxGPITrigger.rst', 'mode': '33188', 'license': 'mit', 'language': []}
package org.sweble.wikitext.engine.config; public interface EngineConfig { public abstract boolean isTrimTransparentBeforeParsing(); }
{'content_hash': '2e3bf9c94684ffe5486192cd3f50107a', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 58, 'avg_line_length': 14.3, 'alnum_prop': 0.7972027972027972, 'repo_name': 'pumpadump/sweble-wikitext', 'id': '193ce74e957eda6820dba16a12ce1d4924a28a5b', 'size': '809', 'binary': False, 'copies': '2', 'ref': 'refs/heads/alpha', 'path': 'swc-engine/src/main/java/org/sweble/wikitext/engine/config/EngineConfig.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AspectJ', 'bytes': '12580'}, {'name': 'CSS', 'bytes': '9166'}, {'name': 'HTML', 'bytes': '1403'}, {'name': 'Java', 'bytes': '1695302'}, {'name': 'Lex', 'bytes': '5110'}, {'name': 'Shell', 'bytes': '17378'}]}
package moe.tristan.easyfxml.samples.form.user.view.userform.fields.lastname; import org.springframework.stereotype.Component; import moe.tristan.easyfxml.api.FxmlController; import moe.tristan.easyfxml.api.FxmlFile; import moe.tristan.easyfxml.api.FxmlComponent; @Component public class LastnameComponent implements FxmlComponent { public static final String LAST_NAME_FIELD_NAME = "Last name"; @Override public FxmlFile getFile() { return () -> "Lastname.fxml"; } @Override public Class<? extends FxmlController> getControllerClass() { return LastnameController.class; } }
{'content_hash': '5ef0958bd3acf87074fa557fa626c024', 'timestamp': '', 'source': 'github', 'line_count': 26, 'max_line_length': 77, 'avg_line_length': 24.153846153846153, 'alnum_prop': 0.7436305732484076, 'repo_name': 'Tristan971/EasyFXML', 'id': '018bec0fb080ea15a1a750f411c555f204925b74', 'size': '1278', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'easyfxml-samples/easyfxml-sample-form-user/src/main/java/moe/tristan/easyfxml/samples/form/user/view/userform/fields/lastname/LastnameComponent.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '1615'}, {'name': 'Dockerfile', 'bytes': '344'}, {'name': 'Java', 'bytes': '249320'}, {'name': 'Shell', 'bytes': '2067'}]}
@interface OverlayWindow : NSPanel<NSWindowDelegate> @end
{'content_hash': 'a191c3055b7fddd4842703dbf635c4b4', 'timestamp': '', 'source': 'github', 'line_count': 3, 'max_line_length': 52, 'avg_line_length': 19.666666666666668, 'alnum_prop': 0.8135593220338984, 'repo_name': 'nthloop/Objektiv', 'id': '9397a4aabfb2965e01a71d97e3c07b57fa43227e', 'size': '223', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Objektiv/OverlayWindow.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Objective-C', 'bytes': '79464'}, {'name': 'Ruby', 'bytes': '92'}]}
CCapturedFrame::~CCapturedFrame() { m_pVisual.Release(); m_pSurface.Release(); } HRESULT CCapturedFrame::Initialize(IDCompositionDevice* pDevice, IDCompositionVisual* pContainer, CWnd* pSource) { ASSERT(pDevice && pContainer && pSource); HRESULT hr = !(pDevice && pContainer && pSource) ? E_INVALIDARG : S_OK; HDC hSurfaceDC = NULL; CComPtr<IDXGISurface1> pDXGISurface; POINT pointOffset = {}; CRect rcClient; pSource->GetClientRect(&rcClient); if (SUCCEEDED(hr)) { // Create a DirectComposition-compatible surface that is the same size // as the window. hr = pDevice->CreateSurface(rcClient.Width(), rcClient.Height(), DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_ALPHA_MODE_IGNORE, &m_pSurface); } ASSERT(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { hr = m_pSurface->BeginDraw(NULL, __uuidof(IDXGISurface1), reinterpret_cast<void**>(&pDXGISurface), &pointOffset); } ASSERT(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { pDXGISurface->GetDC(FALSE, &hSurfaceDC); hr = hSurfaceDC ? S_OK : E_FAIL; } ASSERT(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { CDC* pDC = pSource->GetDC(); ASSERT(pDC); BitBlt(hSurfaceDC, pointOffset.x, pointOffset.y, rcClient.Width(), rcClient.Height(), pDC->GetSafeHdc(), 0, 0, SRCCOPY); pDXGISurface->ReleaseDC(NULL); } if (m_pSurface) { m_pSurface->EndDraw(); } if (SUCCEEDED(hr)) { hr = DCompHelpers::CreateVisualForContent(pDevice, m_pSurface, &m_pVisual); } ASSERT(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { hr = pContainer->AddVisual(m_pVisual, FALSE, nullptr); } return hr; }
{'content_hash': '3a45e77bf391fe9813041b3a55b1d49e', 'timestamp': '', 'source': 'github', 'line_count': 78, 'max_line_length': 103, 'avg_line_length': 23.743589743589745, 'alnum_prop': 0.5766738660907127, 'repo_name': 'TheAlmightyBob/MDIComp', 'id': '1547a717026281d014d3e32a6831839897182b97', 'size': '1944', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'MDIComp/CapturedFrame.cpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '698'}, {'name': 'C++', 'bytes': '86157'}, {'name': 'Objective-C', 'bytes': '1481'}]}
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE127_Buffer_Underread__char_declare_loop_15.c Label Definition File: CWE127_Buffer_Underread.stack.label.xml Template File: sources-sink-15.tmpl.c */ /* * @description * CWE: 127 Buffer Under-read * BadSource: Set data pointer to before the allocated memory buffer * GoodSource: Set data pointer to the allocated memory buffer * Sink: loop * BadSink : Copy data to string using a loop * Flow Variant: 15 Control flow: switch(6) * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE127_Buffer_Underread__char_declare_loop_15_bad() { char * data; char dataBuffer[100]; memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; switch(6) { case 6: /* FLAW: Set data pointer to before the allocated memory buffer */ data = dataBuffer - 8; break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } { size_t i; char dest[100]; memset(dest, 'C', 100-1); /* fill with 'C's */ dest[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copy from a memory location located before the source buffer */ for (i = 0; i < 100; i++) { dest[i] = data[i]; } /* Ensure null termination */ dest[100-1] = '\0'; printLine(dest); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the switch to switch(5) */ static void goodG2B1() { char * data; char dataBuffer[100]; memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; switch(5) { case 6: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; default: /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; break; } { size_t i; char dest[100]; memset(dest, 'C', 100-1); /* fill with 'C's */ dest[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copy from a memory location located before the source buffer */ for (i = 0; i < 100; i++) { dest[i] = data[i]; } /* Ensure null termination */ dest[100-1] = '\0'; printLine(dest); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the switch */ static void goodG2B2() { char * data; char dataBuffer[100]; memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; switch(6) { case 6: /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } { size_t i; char dest[100]; memset(dest, 'C', 100-1); /* fill with 'C's */ dest[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copy from a memory location located before the source buffer */ for (i = 0; i < 100; i++) { dest[i] = data[i]; } /* Ensure null termination */ dest[100-1] = '\0'; printLine(dest); } } void CWE127_Buffer_Underread__char_declare_loop_15_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE127_Buffer_Underread__char_declare_loop_15_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE127_Buffer_Underread__char_declare_loop_15_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
{'content_hash': 'fc85445379f3f624b871dd3b1a65d639', 'timestamp': '', 'source': 'github', 'line_count': 161, 'max_line_length': 99, 'avg_line_length': 27.608695652173914, 'alnum_prop': 0.5628796400449944, 'repo_name': 'JianpingZeng/xcc', 'id': 'dba7009390f16f209c89fddf563219f3acf41c4b', 'size': '4445', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'xcc/test/juliet/testcases/CWE127_Buffer_Underread/s01/CWE127_Buffer_Underread__char_declare_loop_15.c', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>raytracer: raytracer/include/tracer/MultiObjects.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], }); </script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">raytracer </div> <div id="projectbrief">Aprojectforlearningraytracing</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>File&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_7789eca64cf92b9bffa841e402491abd.html">raytracer</a></li><li class="navelem"><a class="el" href="dir_103d1b30db6be83791b37408ae4c78e9.html">include</a></li><li class="navelem"><a class="el" href="dir_89942d6d10439dbcf62e81bdab2f38b2.html">tracer</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">MultiObjects.h</div> </div> </div><!--header--> <div class="contents"> <a href="_multi_objects_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#pragma once</span></div> <div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="_ray_tracer_8h.html">tracer/RayTracer.h</a>&gt;</span></div> <div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;</div> <div class="line"><a name="l00004"></a><span class="lineno"><a class="line" href="class_multi_objects.html"> 4</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_multi_objects.html">MultiObjects</a> : <span class="keyword">public</span> <a class="code" href="class_ray_tracer.html">RayTracer</a></div> <div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;{</div> <div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="keyword">public</span>:</div> <div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160; <a class="code" href="class_multi_objects.html#a20d6708c1c945bd058ab9bd5840eb8e3">MultiObjects</a>(<a class="code" href="class_world.html">World</a>* <a class="code" href="class_ray_tracer.html#a0f6b1f71e4ba4aa387c8bffe0b916c1b">world</a>);</div> <div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160; <a class="code" href="class_r_g_b_color.html">RGBColor</a> <a class="code" href="class_multi_objects.html#aaa2b5692917976c50f7a9a33947a40cd">TraceRay</a>(<span class="keyword">const</span> <a class="code" href="class_ray.html">Ray</a>&amp; ray) <span class="keyword">const</span>;</div> <div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;};</div> <div class="ttc" id="class_multi_objects_html"><div class="ttname"><a href="class_multi_objects.html">MultiObjects</a></div><div class="ttdef"><b>Definition:</b> MultiObjects.h:4</div></div> <div class="ttc" id="class_r_g_b_color_html"><div class="ttname"><a href="class_r_g_b_color.html">RGBColor</a></div><div class="ttdef"><b>Definition:</b> RGBColor.h:4</div></div> <div class="ttc" id="class_multi_objects_html_aaa2b5692917976c50f7a9a33947a40cd"><div class="ttname"><a href="class_multi_objects.html#aaa2b5692917976c50f7a9a33947a40cd">MultiObjects::TraceRay</a></div><div class="ttdeci">RGBColor TraceRay(const Ray &amp;ray) const </div><div class="ttdef"><b>Definition:</b> MultiObjects.cpp:12</div></div> <div class="ttc" id="class_world_html"><div class="ttname"><a href="class_world.html">World</a></div><div class="ttdef"><b>Definition:</b> World.h:13</div></div> <div class="ttc" id="class_ray_tracer_html_a0f6b1f71e4ba4aa387c8bffe0b916c1b"><div class="ttname"><a href="class_ray_tracer.html#a0f6b1f71e4ba4aa387c8bffe0b916c1b">RayTracer::world</a></div><div class="ttdeci">World * world</div><div class="ttdef"><b>Definition:</b> RayTracer.h:16</div></div> <div class="ttc" id="class_ray_tracer_html"><div class="ttname"><a href="class_ray_tracer.html">RayTracer</a></div><div class="ttdef"><b>Definition:</b> RayTracer.h:9</div></div> <div class="ttc" id="_ray_tracer_8h_html"><div class="ttname"><a href="_ray_tracer_8h.html">RayTracer.h</a></div></div> <div class="ttc" id="class_multi_objects_html_a20d6708c1c945bd058ab9bd5840eb8e3"><div class="ttname"><a href="class_multi_objects.html#a20d6708c1c945bd058ab9bd5840eb8e3">MultiObjects::MultiObjects</a></div><div class="ttdeci">MultiObjects(World *world)</div><div class="ttdef"><b>Definition:</b> MultiObjects.cpp:7</div></div> <div class="ttc" id="class_ray_html"><div class="ttname"><a href="class_ray.html">Ray</a></div><div class="ttdoc">Class modelling a ray. </div><div class="ttdef"><b>Definition:</b> Ray.h:13</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Jul 23 2015 12:10:20 for raytracer by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.5 </small></address> </body> </html>
{'content_hash': '57f59e12225ed9bdaf6ecc259c260479', 'timestamp': '', 'source': 'github', 'line_count': 123, 'max_line_length': 684, 'avg_line_length': 71.82926829268293, 'alnum_prop': 0.6778720996038483, 'repo_name': 'phaser/raytracer', 'id': 'b2ca1fd3ced6307738ab184cc1982e1ff2dccf3c', 'size': '8835', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/html/_multi_objects_8h_source.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '74985'}, {'name': 'CMake', 'bytes': '3146'}]}
'use strict'; module.exports = function(grunt) { // Project configuration. grunt.initConfig({ jshint: { all: [ 'Gruntfile.js', 'tasks/*.js', '<%= nodeunit.tests %>' ], options: { jshintrc: '.jshintrc' } }, // Before generating any new files, remove any previously-created files. clean: { tests: ['.tmp'] }, // Configuration to be run (and then tested). svgfit: { expand: { files: [ { expand: true, cwd: 'test/svg/', src: ['*.svg'], dest: 'tmp/expand/', }, { expand: true, cwd: 'test/svg/', src: ['*.svg'], dest: 'tmp/expand2/', } ] }, compact: { src: ['test/svg/*.svg'], dest: 'tmp/compact/' }, fileObject: { files: { 'tmp/fileObject/test.svg': ['test/svg/search.svg'] } }, fileArray: { files: [ {src: ['test/svg/search.svg'], dest: 'tmp/fileArray/'} ] } }, // Unit tests. nodeunit: { tests: ['test/*_test.js'] }, bump: { options: { files: ['package.json'], commit: true, commitMessage: 'Release v%VERSION%', commitFiles: ['package.json'], createTag: true, tagName: 'v%VERSION%', tagMessage: 'Version %VERSION%', push: true, pushTo: 'origin', gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d', globalReplace: false, prereleaseName: false, metadata: '', regExp: false } } }); // Actually load this plugin's task(s). grunt.loadTasks('tasks'); // These plugins provide necessary tasks. grunt.loadNpmTasks('grunt-bump'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-nodeunit'); // Whenever the "test" task is run, first clean the ".tmp" dir, then run this // plugin's task(s), then test the result. grunt.registerTask('test', ['clean', 'svgfit', 'nodeunit']); // By default, lint and run all tests. grunt.registerTask('default', ['jshint', 'test']); };
{'content_hash': 'c62b15f7e3b3a28d5bd9f08f6c580214', 'timestamp': '', 'source': 'github', 'line_count': 101, 'max_line_length': 79, 'avg_line_length': 22.683168316831683, 'alnum_prop': 0.5024006983849847, 'repo_name': 'mikemellor11/grunt-svgfit', 'id': 'fd17af1e7337131409f2a3472be075eaed9bd55d', 'size': '2389', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Gruntfile.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '5979'}]}
var request = require("../request"); function command(argv,result) { var module = argv._[1]; var url = argv._[2]; if (!module) { return result.help(command); } var data = {}; var m = /^(.+)@(.+)$/.exec(module); if (m) { data.module = m[1]; data.version = m[2]; } else { data.module = module; } if (url) { data.url = url; } return request.request('/nodes', { method: "POST", data: data }).then(result.logDetails); } command.alias = "install"; command.usage = command.alias+" <module> [<url>]"; command.description = "Install a module."; module.exports = command;
{'content_hash': 'e3ec2a8287fac9953792e7694aa2d560', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 50, 'avg_line_length': 20.484848484848484, 'alnum_prop': 0.5266272189349113, 'repo_name': 'node-red/node-red-admin', 'id': '08eecdd2fd7badf83d33666168d46029f1d3f464', 'size': '1314', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/commands/install.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'JavaScript', 'bytes': '82225'}, {'name': 'Mustache', 'bytes': '21215'}]}
package ca.wimsc.client.common.model; import java.io.Serializable; import com.google.gwt.user.client.rpc.IsSerializable; public class Direction implements Serializable, IsSerializable { private static final long serialVersionUID = 1L; private String myName; private String myTag; public String getName() { return myName; } public String getTag() { return myTag; } public void setName(String theName) { myName = theName; } public void setTag(String theTag) { myTag = theTag; } }
{'content_hash': 'ff37d2151137b147b96b9f7bb133a725', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 64, 'avg_line_length': 20.413793103448278, 'alnum_prop': 0.6334459459459459, 'repo_name': 'jamesagnew/whereismystreetcar', 'id': '516ce134f380520e7de426f05ede03cf6ad2a3d3', 'size': '592', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/ca/wimsc/client/common/model/Direction.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '818049'}, {'name': 'Shell', 'bytes': '194'}]}
static Display *dpy; static int hasinit = 0; void output_x(char *str) { if (hasinit == 0) { if (!(dpy = XOpenDisplay(NULL))) { fprintf(stderr, "cannot open display.\n"); exit(1); } hasinit = 1; } XStoreName(dpy, DefaultRootWindow(dpy), str); XSync(dpy, False); }
{'content_hash': 'c9aeee2a3a4f996cf3b574586a33414e', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 54, 'avg_line_length': 20.5625, 'alnum_prop': 0.5319148936170213, 'repo_name': 'jgke/haapa', 'id': '3c09807af115cae085f8d06fec06be07639c40e3', 'size': '431', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/output_x.c', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '58235'}, {'name': 'C++', 'bytes': '1981'}, {'name': 'Makefile', 'bytes': '2039'}, {'name': 'Shell', 'bytes': '761'}]}
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>buffered_stream::close</title> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../../boost_asio.html" title="Boost.Asio"> <link rel="up" href="../buffered_stream.html" title="buffered_stream"> <link rel="prev" href="buffered_stream/overload2.html" title="buffered_stream::buffered_stream (2 of 2 overloads)"> <link rel="next" href="close/overload1.html" title="buffered_stream::close (1 of 2 overloads)"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="buffered_stream/overload2.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../buffered_stream.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="close/overload1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> <a name="boost_asio.reference.buffered_stream.close"></a><a class="link" href="close.html" title="buffered_stream::close">buffered_stream::close</a> </h4></div></div></div> <p> <a class="indexterm" name="idp66772704"></a> Close the stream. </p> <pre class="programlisting"><span class="keyword">void</span> <a class="link" href="close/overload1.html" title="buffered_stream::close (1 of 2 overloads)">close</a><span class="special">();</span> <span class="emphasis"><em>&#187; <a class="link" href="close/overload1.html" title="buffered_stream::close (1 of 2 overloads)">more...</a></em></span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <a class="link" href="close/overload2.html" title="buffered_stream::close (2 of 2 overloads)">close</a><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span><span class="special">);</span> <span class="emphasis"><em>&#187; <a class="link" href="close/overload2.html" title="buffered_stream::close (2 of 2 overloads)">more...</a></em></span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2015 Christopher M. Kohlhoff<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="buffered_stream/overload2.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../buffered_stream.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="close/overload1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{'content_hash': '2b0effe72f1b8e17b93495059f6e73f4', 'timestamp': '', 'source': 'github', 'line_count': 55, 'max_line_length': 453, 'avg_line_length': 76.54545454545455, 'alnum_prop': 0.6446555819477434, 'repo_name': 'nicecapj/crossplatfromMmorpgServer', 'id': '458da5ea3f50934f7a49b0973a5bfb30a43a1aaf', 'size': '4210', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'ThirdParty/boost_1_61_0/libs/asio/doc/html/boost_asio/reference/buffered_stream/close.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '223360'}, {'name': 'Batchfile', 'bytes': '33694'}, {'name': 'C', 'bytes': '3967798'}, {'name': 'C#', 'bytes': '2093216'}, {'name': 'C++', 'bytes': '197077824'}, {'name': 'CMake', 'bytes': '203207'}, {'name': 'CSS', 'bytes': '427824'}, {'name': 'CWeb', 'bytes': '174166'}, {'name': 'Cuda', 'bytes': '52444'}, {'name': 'DIGITAL Command Language', 'bytes': '6246'}, {'name': 'Emacs Lisp', 'bytes': '7822'}, {'name': 'Fortran', 'bytes': '1856'}, {'name': 'Go', 'bytes': '8549'}, {'name': 'HTML', 'bytes': '234971359'}, {'name': 'IDL', 'bytes': '14'}, {'name': 'Java', 'bytes': '3809828'}, {'name': 'JavaScript', 'bytes': '1112586'}, {'name': 'Lex', 'bytes': '1231'}, {'name': 'M4', 'bytes': '135271'}, {'name': 'Makefile', 'bytes': '1266088'}, {'name': 'Max', 'bytes': '36857'}, {'name': 'Objective-C', 'bytes': '2928243'}, {'name': 'Objective-C++', 'bytes': '3527'}, {'name': 'PHP', 'bytes': '59372'}, {'name': 'Perl', 'bytes': '38649'}, {'name': 'Perl6', 'bytes': '2053'}, {'name': 'Protocol Buffer', 'bytes': '1576976'}, {'name': 'Python', 'bytes': '3257634'}, {'name': 'QML', 'bytes': '593'}, {'name': 'QMake', 'bytes': '16692'}, {'name': 'Rebol', 'bytes': '354'}, {'name': 'Roff', 'bytes': '5189'}, {'name': 'Ruby', 'bytes': '97584'}, {'name': 'Shell', 'bytes': '787152'}, {'name': 'Swift', 'bytes': '20519'}, {'name': 'Tcl', 'bytes': '1172'}, {'name': 'TeX', 'bytes': '32117'}, {'name': 'Vim script', 'bytes': '3759'}, {'name': 'XSLT', 'bytes': '552736'}, {'name': 'Yacc', 'bytes': '19623'}]}
namespace MS.Internal.Xml.XPath { using System; using Microsoft.Xml; using Microsoft.Xml.XPath; using System.Diagnostics; internal sealed class FollowingQuery : BaseAxisQuery { private XPathNavigator _input; private XPathNodeIterator _iterator; public FollowingQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest) : base(qyInput, name, prefix, typeTest) { } private FollowingQuery(FollowingQuery other) : base(other) { _input = Clone(other._input); _iterator = Clone(other._iterator); } public override void Reset() { _iterator = null; base.Reset(); } public override XPathNavigator Advance() { if (_iterator == null) { _input = qyInput.Advance(); if (_input == null) { return null; } XPathNavigator prev; do { prev = _input.Clone(); _input = qyInput.Advance(); } while (prev.IsDescendant(_input)); _input = prev; _iterator = XPathEmptyIterator.Instance; } while (!_iterator.MoveNext()) { bool matchSelf; if (_input.NodeType == XPathNodeType.Attribute || _input.NodeType == XPathNodeType.Namespace) { _input.MoveToParent(); matchSelf = false; } else { while (!_input.MoveToNext()) { if (!_input.MoveToParent()) { return null; } } matchSelf = true; } if (NameTest) { _iterator = _input.SelectDescendants(Name, Namespace, matchSelf); } else { _iterator = _input.SelectDescendants(TypeTest, matchSelf); } } position++; currentNode = _iterator.Current; return currentNode; } public override XPathNodeIterator Clone() { return new FollowingQuery(this); } } }
{'content_hash': 'fe1dd4d55d3ecd685135814717bdc942', 'timestamp': '', 'source': 'github', 'line_count': 82, 'max_line_length': 140, 'avg_line_length': 29.975609756097562, 'alnum_prop': 0.4422294548413344, 'repo_name': 'imcarolwang/wcf', 'id': '7d0043b5e052258e2d3fd6eeaf6fd5769efac36c', 'size': '2662', 'binary': False, 'copies': '3', 'ref': 'refs/heads/main', 'path': 'src/dotnet-svcutil/lib/src/FrameworkFork/Microsoft.Xml/Xml/XPath/Internal/followingquery.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP.NET', 'bytes': '16996'}, {'name': 'Batchfile', 'bytes': '39038'}, {'name': 'C#', 'bytes': '32563454'}, {'name': 'C++', 'bytes': '79430'}, {'name': 'CMake', 'bytes': '12939'}, {'name': 'PowerShell', 'bytes': '172711'}, {'name': 'Shell', 'bytes': '122456'}, {'name': 'VBScript', 'bytes': '251'}]}
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using MonoMac.CoreFoundation; namespace MonoMac.AudioToolbox { public enum AudioSessionErrors { None = 0, NotInitialized = 0x21696e69, // '!ini', AlreadyInitialized = 0x696e6974, // 'init', InitializationError = 0x696e693f, // 'ini?', UnsupportedPropertyError = 0x7074793f, // 'pty?', BadPropertySizeError = 0x2173697a, // '!siz', NotActiveError = 0x21616374, // '!act', NoHardwareError = 0x6e6f6877, // 'nohw' IncompatibleCategory = 0x21636174, // '!cat' NoCategorySet = 0x3f636174, // '?cat' UnspecifiedError = 0x77686371, // 'what' } public enum AudioSessionInterruptionState { End = 0, Begin = 1, } public enum AudioSessionCategory { AmbientSound = 0x616d6269, // 'ambi' SoloAmbientSound = 0x736f6c6f, // 'solo' MediaPlayback = 0x6d656469, // 'medi' RecordAudio = 0x72656361, // 'reca' PlayAndRecord = 0x706c6172, // 'plar' AudioProcessing = 0x70726f63 // 'proc' } public enum AudioSessionRoutingOverride { None = 0, Speaker = 0x73706b72, // 'spkr' } public enum AudioSessionRouteChangeReason { Unknown = 0, NewDeviceAvailable = 1, OldDeviceUnavailable = 2, CategoryChange = 3, Override = 4, WakeFromSleep = 6, NoSuitableRouteForCategory = 7 } public enum AudioSessionInterruptionType { ShouldResume = 1769108333, // 'irsm' ShouldNotResume = 561148781, // '!rsm' } // Should be internal with AudioSessionPropertyListener public public enum AudioSessionProperty { PreferredHardwareSampleRate = 0x68777372, PreferredHardwareIOBufferDuration = 0x696f6264, AudioCategory = 0x61636174, [Obsolete ("Use AudioRouteDescription")] AudioRoute = 0x726f7574, AudioRouteChange = 0x726f6368, CurrentHardwareSampleRate = 0x63687372, CurrentHardwareInputNumberChannels = 0x63686963, CurrentHardwareOutputNumberChannels = 0x63686f63, CurrentHardwareOutputVolume = 0x63686f76, CurrentHardwareInputLatency = 0x63696c74, CurrentHardwareOutputLatency = 0x636f6c74, CurrentHardwareIOBufferDuration = 0x63686264, OtherAudioIsPlaying = 0x6f746872, OverrideAudioRoute = 0x6f767264, AudioInputAvailable = 0x61696176, ServerDied = 0x64696564, OtherMixableAudioShouldDuck = 0x6475636b, OverrideCategoryMixWithOthers = 0x636d6978, OverrideCategoryDefaultToSpeaker = 0x6373706b, //'cspk' OverrideCategoryEnableBluetoothInput = 0x63626c75, //'cblu' InterruptionType = 0x2172736d, Mode = 0x6d6f6465, InputSources = 0x73726373, // 'srcs' OutputDestinations = 0x64737473, // 'dsts' InputSource = 0x69737263, // 'isrc' OutputDestination = 0x6f647374, // 'odst' InputGainAvailable = 0x69676176, // 'igav' InputGainScalar = 0x69677363, // 'igsc' AudioRouteDescription = 0x63726172, // 'crar' } public enum AudioSessionMode { Default = 0x64666c74, VoiceChat = 0x76636374, VideoRecording = 0x76726364, Measurement = 0x6d736d74, // 'msmt' GameChat = 0x676d6374, // 'gmct' } public enum AudioSessionActiveFlags: uint { NotifyOthersOnDeactivation = (1 << 0) } public enum AudioSessionInputRouteKind { None, LineIn, BuiltInMic, HeadsetMic, BluetoothHFP, USBAudio, } public enum AudioSessionOutputRouteKind { None, LineOut, Headphones, BluetoothHFP, BluetoothA2DP, BuiltInReceiver, BuiltInSpeaker, USBAudio, HDMI, AirPlay, } }
{'content_hash': '7b8967f0a6dde967dba3be4502c80a89', 'timestamp': '', 'source': 'github', 'line_count': 125, 'max_line_length': 64, 'avg_line_length': 29.696, 'alnum_prop': 0.6734913793103449, 'repo_name': 'jorik041/maccore', 'id': '6de6df804843eed3577893cbeb6cfad9a82ab694', 'size': '4921', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/AudioToolbox/AudioSessions.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C#', 'bytes': '2252141'}]}
<?php /* TwigBundle:Exception:exception.txt.twig */ class __TwigTemplate_5315f8f2d831873b801e01845f8ac41aa16123834d0a8d4de50c0f52207b56fc extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); $this->parent = false; $this->blocks = array( ); } protected function doDisplay(array $context, array $blocks = array()) { // line 1 echo "[exception] "; echo (((((isset($context["status_code"]) ? $context["status_code"] : $this->getContext($context, "status_code")) . " | ") . (isset($context["status_text"]) ? $context["status_text"] : $this->getContext($context, "status_text"))) . " | ") . $this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "class", array())); echo " [message] "; // line 2 echo $this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "message", array()); echo " "; // line 3 $context['_parent'] = (array) $context; $context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "toarray", array())); foreach ($context['_seq'] as $context["i"] => $context["e"]) { // line 4 echo "["; echo ($context["i"] + 1); echo "] "; echo $this->getAttribute($context["e"], "class", array()); echo ": "; echo $this->getAttribute($context["e"], "message", array()); echo " "; // line 5 $this->env->loadTemplate("TwigBundle:Exception:traces.txt.twig")->display(array("exception" => $context["e"])); // line 6 echo " "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['i'], $context['e'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; } public function getTemplateName() { return "TwigBundle:Exception:exception.txt.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 43 => 6, 41 => 5, 32 => 4, 28 => 3, 24 => 2, 19 => 1,); } }
{'content_hash': '62754d4ffc4e043527244f003dd6793f', 'timestamp': '', 'source': 'github', 'line_count': 65, 'max_line_length': 386, 'avg_line_length': 37.69230769230769, 'alnum_prop': 0.5489795918367347, 'repo_name': 'sergiu3dmd/ProjectPoftaBuna', 'id': '0a45a37c1c1d3a59c01b51880cec66ff0185d61e', 'size': '2450', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/cache/dev/twig/53/15/f8f2d831873b801e01845f8ac41aa16123834d0a8d4de50c0f52207b56fc.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '3073'}, {'name': 'CSS', 'bytes': '181804'}, {'name': 'JavaScript', 'bytes': '972'}, {'name': 'PHP', 'bytes': '121662'}]}
// Package framework contains provider-independent helper code for // building and running E2E tests with Ginkgo. The actual Ginkgo test // suites gets assembled by combining this framework, the optional // provider support code and specific tests via a separate .go file // like Kubernetes' test/e2e.go. package framework import ( "bufio" "bytes" "fmt" "math/rand" "os" "strings" "sync" "time" "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/discovery" cacheddiscovery "k8s.io/client-go/discovery/cached/memory" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" "k8s.io/client-go/restmapper" scaleclient "k8s.io/client-go/scale" "k8s.io/kubernetes/test/e2e/framework/metrics" testutils "k8s.io/kubernetes/test/utils" "github.com/onsi/ginkgo" "github.com/onsi/gomega" ) const ( maxKubectlExecRetries = 5 // DefaultNamespaceDeletionTimeout is timeout duration for waiting for a namespace deletion. // TODO(mikedanese): reset this to 5 minutes once #47135 is resolved. // ref https://github.com/kubernetes/kubernetes/issues/47135 DefaultNamespaceDeletionTimeout = 10 * time.Minute ) // Framework supports common operations used by e2e tests; it will keep a client & a namespace for you. // Eventual goal is to merge this with integration test framework. type Framework struct { BaseName string // Set together with creating the ClientSet and the namespace. // Guaranteed to be unique in the cluster even when running the same // test multiple times in parallel. UniqueName string ClientSet clientset.Interface KubemarkExternalClusterClientSet clientset.Interface DynamicClient dynamic.Interface ScalesGetter scaleclient.ScalesGetter SkipNamespaceCreation bool // Whether to skip creating a namespace Namespace *v1.Namespace // Every test has at least one namespace unless creation is skipped namespacesToDelete []*v1.Namespace // Some tests have more than one. NamespaceDeletionTimeout time.Duration SkipPrivilegedPSPBinding bool // Whether to skip creating a binding to the privileged PSP in the test namespace gatherer *ContainerResourceGatherer // Constraints that passed to a check which is executed after data is gathered to // see if 99% of results are within acceptable bounds. It has to be injected in the test, // as expectations vary greatly. Constraints are grouped by the container names. AddonResourceConstraints map[string]ResourceConstraint logsSizeWaitGroup sync.WaitGroup logsSizeCloseChannel chan bool logsSizeVerifier *LogsSizeVerifier // Flaky operation failures in an e2e test can be captured through this. flakeReport *FlakeReport // To make sure that this framework cleans up after itself, no matter what, // we install a Cleanup action before each test and clear it after. If we // should abort, the AfterSuite hook should run all Cleanup actions. cleanupHandle CleanupActionHandle // configuration for framework's client Options Options // Place where various additional data is stored during test run to be printed to ReportDir, // or stdout if ReportDir is not set once test ends. TestSummaries []TestDataSummary // Place to keep ClusterAutoscaler metrics from before test in order to compute delta. clusterAutoscalerMetricsBeforeTest metrics.Collection } // TestDataSummary is an interface for managing test data. type TestDataSummary interface { SummaryKind() string PrintHumanReadable() string PrintJSON() string } // Options is a struct for managing test framework options. type Options struct { ClientQPS float32 ClientBurst int GroupVersion *schema.GroupVersion } // NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for // you (you can write additional before/after each functions). func NewDefaultFramework(baseName string) *Framework { options := Options{ ClientQPS: 20, ClientBurst: 50, } return NewFramework(baseName, options, nil) } // NewFramework creates a test framework. func NewFramework(baseName string, options Options, client clientset.Interface) *Framework { f := &Framework{ BaseName: baseName, AddonResourceConstraints: make(map[string]ResourceConstraint), Options: options, ClientSet: client, } ginkgo.BeforeEach(f.BeforeEach) ginkgo.AfterEach(f.AfterEach) return f } // BeforeEach gets a client and makes a namespace. func (f *Framework) BeforeEach() { // The fact that we need this feels like a bug in ginkgo. // https://github.com/onsi/ginkgo/issues/222 f.cleanupHandle = AddCleanupAction(f.AfterEach) if f.ClientSet == nil { ginkgo.By("Creating a kubernetes client") config, err := LoadConfig() testDesc := ginkgo.CurrentGinkgoTestDescription() if len(testDesc.ComponentTexts) > 0 { componentTexts := strings.Join(testDesc.ComponentTexts, " ") config.UserAgent = fmt.Sprintf( "%v -- %v", rest.DefaultKubernetesUserAgent(), componentTexts) } ExpectNoError(err) config.QPS = f.Options.ClientQPS config.Burst = f.Options.ClientBurst if f.Options.GroupVersion != nil { config.GroupVersion = f.Options.GroupVersion } if TestContext.KubeAPIContentType != "" { config.ContentType = TestContext.KubeAPIContentType } f.ClientSet, err = clientset.NewForConfig(config) ExpectNoError(err) f.DynamicClient, err = dynamic.NewForConfig(config) ExpectNoError(err) // node.k8s.io is based on CRD, which is served only as JSON jsonConfig := config jsonConfig.ContentType = "application/json" ExpectNoError(err) // create scales getter, set GroupVersion and NegotiatedSerializer to default values // as they are required when creating a REST client. if config.GroupVersion == nil { config.GroupVersion = &schema.GroupVersion{} } if config.NegotiatedSerializer == nil { config.NegotiatedSerializer = scheme.Codecs } restClient, err := rest.RESTClientFor(config) ExpectNoError(err) discoClient, err := discovery.NewDiscoveryClientForConfig(config) ExpectNoError(err) cachedDiscoClient := cacheddiscovery.NewMemCacheClient(discoClient) restMapper := restmapper.NewDeferredDiscoveryRESTMapper(cachedDiscoClient) restMapper.Reset() resolver := scaleclient.NewDiscoveryScaleKindResolver(cachedDiscoClient) f.ScalesGetter = scaleclient.New(restClient, restMapper, dynamic.LegacyAPIPathResolverFunc, resolver) TestContext.CloudConfig.Provider.FrameworkBeforeEach(f) } if !f.SkipNamespaceCreation { ginkgo.By(fmt.Sprintf("Building a namespace api object, basename %s", f.BaseName)) namespace, err := f.CreateNamespace(f.BaseName, map[string]string{ "e2e-framework": f.BaseName, }) ExpectNoError(err) f.Namespace = namespace if TestContext.VerifyServiceAccount { ginkgo.By("Waiting for a default service account to be provisioned in namespace") err = WaitForDefaultServiceAccountInNamespace(f.ClientSet, namespace.Name) ExpectNoError(err) } else { Logf("Skipping waiting for service account") } f.UniqueName = f.Namespace.GetName() } else { // not guaranteed to be unique, but very likely f.UniqueName = fmt.Sprintf("%s-%08x", f.BaseName, rand.Int31()) } if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" { var err error var nodeMode NodesSet switch TestContext.GatherKubeSystemResourceUsageData { case "master": nodeMode = MasterNodes case "masteranddns": nodeMode = MasterAndDNSNodes default: nodeMode = AllNodes } f.gatherer, err = NewResourceUsageGatherer(f.ClientSet, ResourceGathererOptions{ InKubemark: ProviderIs("kubemark"), Nodes: nodeMode, ResourceDataGatheringPeriod: 60 * time.Second, ProbeDuration: 15 * time.Second, PrintVerboseLogs: false, }, nil) if err != nil { Logf("Error while creating NewResourceUsageGatherer: %v", err) } else { go f.gatherer.StartGatheringData() } } if TestContext.GatherLogsSizes { f.logsSizeWaitGroup = sync.WaitGroup{} f.logsSizeWaitGroup.Add(1) f.logsSizeCloseChannel = make(chan bool) f.logsSizeVerifier = NewLogsVerifier(f.ClientSet, f.logsSizeCloseChannel) go func() { f.logsSizeVerifier.Run() f.logsSizeWaitGroup.Done() }() } gatherMetricsAfterTest := TestContext.GatherMetricsAfterTest == "true" || TestContext.GatherMetricsAfterTest == "master" if gatherMetricsAfterTest && TestContext.IncludeClusterAutoscalerMetrics { grabber, err := metrics.NewMetricsGrabber(f.ClientSet, f.KubemarkExternalClusterClientSet, !ProviderIs("kubemark"), false, false, false, TestContext.IncludeClusterAutoscalerMetrics) if err != nil { Logf("Failed to create MetricsGrabber (skipping ClusterAutoscaler metrics gathering before test): %v", err) } else { f.clusterAutoscalerMetricsBeforeTest, err = grabber.Grab() if err != nil { Logf("MetricsGrabber failed to grab CA metrics before test (skipping metrics gathering): %v", err) } else { Logf("Gathered ClusterAutoscaler metrics before test") } } } f.flakeReport = NewFlakeReport() } // AfterEach deletes the namespace, after reading its events. func (f *Framework) AfterEach() { RemoveCleanupAction(f.cleanupHandle) // DeleteNamespace at the very end in defer, to avoid any // expectation failures preventing deleting the namespace. defer func() { nsDeletionErrors := map[string]error{} // Whether to delete namespace is determined by 3 factors: delete-namespace flag, delete-namespace-on-failure flag and the test result // if delete-namespace set to false, namespace will always be preserved. // if delete-namespace is true and delete-namespace-on-failure is false, namespace will be preserved if test failed. if TestContext.DeleteNamespace && (TestContext.DeleteNamespaceOnFailure || !ginkgo.CurrentGinkgoTestDescription().Failed) { for _, ns := range f.namespacesToDelete { ginkgo.By(fmt.Sprintf("Destroying namespace %q for this suite.", ns.Name)) timeout := DefaultNamespaceDeletionTimeout if f.NamespaceDeletionTimeout != 0 { timeout = f.NamespaceDeletionTimeout } if err := deleteNS(f.ClientSet, f.DynamicClient, ns.Name, timeout); err != nil { if !apierrors.IsNotFound(err) { nsDeletionErrors[ns.Name] = err } else { Logf("Namespace %v was already deleted", ns.Name) } } } } else { if !TestContext.DeleteNamespace { Logf("Found DeleteNamespace=false, skipping namespace deletion!") } else { Logf("Found DeleteNamespaceOnFailure=false and current test failed, skipping namespace deletion!") } } // Paranoia-- prevent reuse! f.Namespace = nil f.ClientSet = nil f.namespacesToDelete = nil // if we had errors deleting, report them now. if len(nsDeletionErrors) != 0 { messages := []string{} for namespaceKey, namespaceErr := range nsDeletionErrors { messages = append(messages, fmt.Sprintf("Couldn't delete ns: %q: %s (%#v)", namespaceKey, namespaceErr, namespaceErr)) } Failf(strings.Join(messages, ",")) } }() // Print events if the test failed. if ginkgo.CurrentGinkgoTestDescription().Failed && TestContext.DumpLogsOnFailure { // Pass both unversioned client and versioned clientset, till we have removed all uses of the unversioned client. if !f.SkipNamespaceCreation { DumpAllNamespaceInfo(f.ClientSet, f.Namespace.Name) } } if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" && f.gatherer != nil { ginkgo.By("Collecting resource usage data") summary, resourceViolationError := f.gatherer.StopAndSummarize([]int{90, 99, 100}, f.AddonResourceConstraints) defer ExpectNoError(resourceViolationError) f.TestSummaries = append(f.TestSummaries, summary) } if TestContext.GatherLogsSizes { ginkgo.By("Gathering log sizes data") close(f.logsSizeCloseChannel) f.logsSizeWaitGroup.Wait() f.TestSummaries = append(f.TestSummaries, f.logsSizeVerifier.GetSummary()) } if TestContext.GatherMetricsAfterTest != "false" { ginkgo.By("Gathering metrics") // Grab apiserver, scheduler, controller-manager metrics and (optionally) nodes' kubelet metrics. grabMetricsFromKubelets := TestContext.GatherMetricsAfterTest != "master" && !ProviderIs("kubemark") grabber, err := metrics.NewMetricsGrabber(f.ClientSet, f.KubemarkExternalClusterClientSet, grabMetricsFromKubelets, true, true, true, TestContext.IncludeClusterAutoscalerMetrics) if err != nil { Logf("Failed to create MetricsGrabber (skipping metrics gathering): %v", err) } else { received, err := grabber.Grab() if err != nil { Logf("MetricsGrabber failed to grab some of the metrics: %v", err) } (*MetricsForE2E)(&received).computeClusterAutoscalerMetricsDelta(f.clusterAutoscalerMetricsBeforeTest) f.TestSummaries = append(f.TestSummaries, (*MetricsForE2E)(&received)) } } TestContext.CloudConfig.Provider.FrameworkAfterEach(f) // Report any flakes that were observed in the e2e test and reset. if f.flakeReport != nil && f.flakeReport.GetFlakeCount() > 0 { f.TestSummaries = append(f.TestSummaries, f.flakeReport) f.flakeReport = nil } PrintSummaries(f.TestSummaries, f.BaseName) // Check whether all nodes are ready after the test. // This is explicitly done at the very end of the test, to avoid // e.g. not removing namespace in case of this failure. if err := AllNodesReady(f.ClientSet, 3*time.Minute); err != nil { Failf("All nodes should be ready after test, %v", err) } } // CreateNamespace creates a namespace for e2e testing. func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*v1.Namespace, error) { createTestingNS := TestContext.CreateTestingNS if createTestingNS == nil { createTestingNS = CreateTestingNS } ns, err := createTestingNS(baseName, f.ClientSet, labels) // check ns instead of err to see if it's nil as we may // fail to create serviceAccount in it. f.AddNamespacesToDelete(ns) if err == nil && !f.SkipPrivilegedPSPBinding { createPrivilegedPSPBinding(f, ns.Name) } return ns, err } // RecordFlakeIfError records flakeness info if error happens. // NOTE: This function is not used at any places yet, but we are in progress for https://github.com/kubernetes/kubernetes/issues/66239 which requires this. Please don't remove this. func (f *Framework) RecordFlakeIfError(err error, optionalDescription ...interface{}) { f.flakeReport.RecordFlakeIfError(err, optionalDescription) } // AddNamespacesToDelete adds one or more namespaces to be deleted when the test // completes. func (f *Framework) AddNamespacesToDelete(namespaces ...*v1.Namespace) { for _, ns := range namespaces { if ns == nil { continue } f.namespacesToDelete = append(f.namespacesToDelete, ns) } } // WaitForPodTerminated waits for the pod to be terminated with the given reason. func (f *Framework) WaitForPodTerminated(podName, reason string) error { return waitForPodTerminatedInNamespace(f.ClientSet, podName, reason, f.Namespace.Name) } // WaitForPodNotFound waits for the pod to be completely terminated (not "Get-able"). func (f *Framework) WaitForPodNotFound(podName string, timeout time.Duration) error { return waitForPodNotFoundInNamespace(f.ClientSet, podName, f.Namespace.Name, timeout) } // WaitForPodRunning waits for the pod to run in the namespace. func (f *Framework) WaitForPodRunning(podName string) error { return WaitForPodNameRunningInNamespace(f.ClientSet, podName, f.Namespace.Name) } // WaitForPodReady waits for the pod to flip to ready in the namespace. func (f *Framework) WaitForPodReady(podName string) error { return waitTimeoutForPodReadyInNamespace(f.ClientSet, podName, f.Namespace.Name, PodStartTimeout) } // WaitForPodRunningSlow waits for the pod to run in the namespace. // It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout). func (f *Framework) WaitForPodRunningSlow(podName string) error { return waitForPodRunningInNamespaceSlow(f.ClientSet, podName, f.Namespace.Name) } // WaitForPodNoLongerRunning waits for the pod to no longer be running in the namespace, for either // success or failure. func (f *Framework) WaitForPodNoLongerRunning(podName string) error { return WaitForPodNoLongerRunningInNamespace(f.ClientSet, podName, f.Namespace.Name) } // TestContainerOutput runs the given pod in the given namespace and waits // for all of the containers in the podSpec to move into the 'Success' status, and tests // the specified container log against the given expected output using a substring matcher. func (f *Framework) TestContainerOutput(scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string) { f.testContainerOutputMatcher(scenarioName, pod, containerIndex, expectedOutput, gomega.ContainSubstring) } // TestContainerOutputRegexp runs the given pod in the given namespace and waits // for all of the containers in the podSpec to move into the 'Success' status, and tests // the specified container log against the given expected output using a regexp matcher. func (f *Framework) TestContainerOutputRegexp(scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string) { f.testContainerOutputMatcher(scenarioName, pod, containerIndex, expectedOutput, gomega.MatchRegexp) } // WriteFileViaContainer writes a file using kubectl exec echo <contents> > <path> via specified container // because of the primitive technique we're using here, we only allow ASCII alphanumeric characters func (f *Framework) WriteFileViaContainer(podName, containerName string, path string, contents string) error { ginkgo.By("writing a file in the container") allowedCharacters := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" for _, c := range contents { if !strings.ContainsRune(allowedCharacters, c) { return fmt.Errorf("Unsupported character in string to write: %v", c) } } command := fmt.Sprintf("echo '%s' > '%s'", contents, path) stdout, stderr, err := kubectlExecWithRetry(f.Namespace.Name, podName, containerName, "--", "/bin/sh", "-c", command) if err != nil { Logf("error running kubectl exec to write file: %v\nstdout=%v\nstderr=%v)", err, string(stdout), string(stderr)) } return err } // ReadFileViaContainer reads a file using kubectl exec cat <path>. func (f *Framework) ReadFileViaContainer(podName, containerName string, path string) (string, error) { ginkgo.By("reading a file in the container") stdout, stderr, err := kubectlExecWithRetry(f.Namespace.Name, podName, containerName, "--", "cat", path) if err != nil { Logf("error running kubectl exec to read file: %v\nstdout=%v\nstderr=%v)", err, string(stdout), string(stderr)) } return string(stdout), err } // CheckFileSizeViaContainer returns the list of file size under the specified path. func (f *Framework) CheckFileSizeViaContainer(podName, containerName, path string) (string, error) { ginkgo.By("checking a file size in the container") stdout, stderr, err := kubectlExecWithRetry(f.Namespace.Name, podName, containerName, "--", "ls", "-l", path) if err != nil { Logf("error running kubectl exec to read file: %v\nstdout=%v\nstderr=%v)", err, string(stdout), string(stderr)) } return string(stdout), err } // CreateServiceForSimpleAppWithPods is a convenience wrapper to create a service and its matching pods all at once. func (f *Framework) CreateServiceForSimpleAppWithPods(contPort int, svcPort int, appName string, podSpec func(n v1.Node) v1.PodSpec, count int, block bool) (*v1.Service, error) { var err error theService := f.CreateServiceForSimpleApp(contPort, svcPort, appName) f.CreatePodsPerNodeForSimpleApp(appName, podSpec, count) if block { err = testutils.WaitForPodsWithLabelRunning(f.ClientSet, f.Namespace.Name, labels.SelectorFromSet(labels.Set(theService.Spec.Selector))) } return theService, err } // CreateServiceForSimpleApp returns a service that selects/exposes pods (send -1 ports if no exposure needed) with an app label. func (f *Framework) CreateServiceForSimpleApp(contPort, svcPort int, appName string) *v1.Service { if appName == "" { panic(fmt.Sprintf("no app name provided")) } serviceSelector := map[string]string{ "app": appName + "-pod", } // For convenience, user sending ports are optional. portsFunc := func() []v1.ServicePort { if contPort < 1 || svcPort < 1 { return nil } return []v1.ServicePort{{ Protocol: v1.ProtocolTCP, Port: int32(svcPort), TargetPort: intstr.FromInt(contPort), }} } Logf("Creating a service-for-%v for selecting app=%v-pod", appName, appName) service, err := f.ClientSet.CoreV1().Services(f.Namespace.Name).Create(&v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "service-for-" + appName, Labels: map[string]string{ "app": appName + "-service", }, }, Spec: v1.ServiceSpec{ Ports: portsFunc(), Selector: serviceSelector, }, }) ExpectNoError(err) return service } // CreatePodsPerNodeForSimpleApp creates pods w/ labels. Useful for tests which make a bunch of pods w/o any networking. func (f *Framework) CreatePodsPerNodeForSimpleApp(appName string, podSpec func(n v1.Node) v1.PodSpec, maxCount int) map[string]string { nodes := GetReadySchedulableNodesOrDie(f.ClientSet) labels := map[string]string{ "app": appName + "-pod", } for i, node := range nodes.Items { // one per node, but no more than maxCount. if i <= maxCount { Logf("%v/%v : Creating container with label app=%v-pod", i, maxCount, appName) _, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(&v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf(appName+"-pod-%v", i), Labels: labels, }, Spec: podSpec(node), }) ExpectNoError(err) } } return labels } // KubeUser is a struct for managing kubernetes user info. type KubeUser struct { Name string `yaml:"name"` User struct { Username string `yaml:"username"` Password string `yaml:"password"` Token string `yaml:"token"` } `yaml:"user"` } // KubeCluster is a struct for managing kubernetes cluster info. type KubeCluster struct { Name string `yaml:"name"` Cluster struct { CertificateAuthorityData string `yaml:"certificate-authority-data"` Server string `yaml:"server"` } `yaml:"cluster"` } // KubeConfig is a struct for managing kubernetes config. type KubeConfig struct { Contexts []struct { Name string `yaml:"name"` Context struct { Cluster string `yaml:"cluster"` User string } `yaml:"context"` } `yaml:"contexts"` Clusters []KubeCluster `yaml:"clusters"` Users []KubeUser `yaml:"users"` } // FindUser returns user info which is the specified user name. func (kc *KubeConfig) FindUser(name string) *KubeUser { for _, user := range kc.Users { if user.Name == name { return &user } } return nil } // FindCluster returns cluster info which is the specified cluster name. func (kc *KubeConfig) FindCluster(name string) *KubeCluster { for _, cluster := range kc.Clusters { if cluster.Name == name { return &cluster } } return nil } func kubectlExecWithRetry(namespace string, podName, containerName string, args ...string) ([]byte, []byte, error) { for numRetries := 0; numRetries < maxKubectlExecRetries; numRetries++ { if numRetries > 0 { Logf("Retrying kubectl exec (retry count=%v/%v)", numRetries+1, maxKubectlExecRetries) } stdOutBytes, stdErrBytes, err := kubectlExec(namespace, podName, containerName, args...) if err != nil { if strings.Contains(strings.ToLower(string(stdErrBytes)), "i/o timeout") { // Retry on "i/o timeout" errors Logf("Warning: kubectl exec encountered i/o timeout.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes)) continue } if strings.Contains(strings.ToLower(string(stdErrBytes)), "container not found") { // Retry on "container not found" errors Logf("Warning: kubectl exec encountered container not found.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes)) time.Sleep(2 * time.Second) continue } } return stdOutBytes, stdErrBytes, err } err := fmt.Errorf("Failed: kubectl exec failed %d times with \"i/o timeout\". Giving up", maxKubectlExecRetries) return nil, nil, err } func kubectlExec(namespace string, podName, containerName string, args ...string) ([]byte, []byte, error) { var stdout, stderr bytes.Buffer cmdArgs := []string{ "exec", fmt.Sprintf("--namespace=%v", namespace), podName, fmt.Sprintf("-c=%v", containerName), } cmdArgs = append(cmdArgs, args...) cmd := KubectlCmd(cmdArgs...) cmd.Stdout, cmd.Stderr = &stdout, &stderr Logf("Running '%s %s'", cmd.Path, strings.Join(cmdArgs, " ")) err := cmd.Run() return stdout.Bytes(), stderr.Bytes(), err } // KubeDescribe is wrapper function for ginkgo describe. Adds namespacing. // TODO: Support type safe tagging as well https://github.com/kubernetes/kubernetes/pull/22401. func KubeDescribe(text string, body func()) bool { return ginkgo.Describe("[k8s.io] "+text, body) } // ConformanceIt is wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier. func ConformanceIt(text string, body interface{}, timeout ...float64) bool { return ginkgo.It(text+" [Conformance]", body, timeout...) } // PodStateVerification represents a verification of pod state. // Any time you have a set of pods that you want to operate against or query, // this struct can be used to declaratively identify those pods. type PodStateVerification struct { // Optional: only pods that have k=v labels will pass this filter. Selectors map[string]string // Required: The phases which are valid for your pod. ValidPhases []v1.PodPhase // Optional: only pods passing this function will pass the filter // Verify a pod. // As an optimization, in addition to specifying filter (boolean), // this function allows specifying an error as well. // The error indicates that the polling of the pod spectrum should stop. Verify func(v1.Pod) (bool, error) // Optional: only pods with this name will pass the filter. PodName string } // ClusterVerification is a struct for a verification of cluster state. type ClusterVerification struct { client clientset.Interface namespace *v1.Namespace // pointer rather than string, since ns isn't created until before each. podState PodStateVerification } // NewClusterVerification creates a new cluster verification. func (f *Framework) NewClusterVerification(namespace *v1.Namespace, filter PodStateVerification) *ClusterVerification { return &ClusterVerification{ f.ClientSet, namespace, filter, } } func passesPodNameFilter(pod v1.Pod, name string) bool { return name == "" || strings.Contains(pod.Name, name) } func passesVerifyFilter(pod v1.Pod, verify func(p v1.Pod) (bool, error)) (bool, error) { if verify == nil { return true, nil } verified, err := verify(pod) // If an error is returned, by definition, pod verification fails if err != nil { return false, err } return verified, nil } func passesPhasesFilter(pod v1.Pod, validPhases []v1.PodPhase) bool { passesPhaseFilter := false for _, phase := range validPhases { if pod.Status.Phase == phase { passesPhaseFilter = true } } return passesPhaseFilter } // filterLabels returns a list of pods which have labels. func filterLabels(selectors map[string]string, cli clientset.Interface, ns string) (*v1.PodList, error) { var err error var selector labels.Selector var pl *v1.PodList // List pods based on selectors. This might be a tiny optimization rather then filtering // everything manually. if len(selectors) > 0 { selector = labels.SelectorFromSet(labels.Set(selectors)) options := metav1.ListOptions{LabelSelector: selector.String()} pl, err = cli.CoreV1().Pods(ns).List(options) } else { pl, err = cli.CoreV1().Pods(ns).List(metav1.ListOptions{}) } return pl, err } // filter filters pods which pass a filter. It can be used to compose // the more useful abstractions like ForEach, WaitFor, and so on, which // can be used directly by tests. func (p *PodStateVerification) filter(c clientset.Interface, namespace *v1.Namespace) ([]v1.Pod, error) { if len(p.ValidPhases) == 0 || namespace == nil { panic(fmt.Errorf("Need to specify a valid pod phases (%v) and namespace (%v). ", p.ValidPhases, namespace)) } ns := namespace.Name pl, err := filterLabels(p.Selectors, c, ns) // Build an v1.PodList to operate against. Logf("Selector matched %v pods for %v", len(pl.Items), p.Selectors) if len(pl.Items) == 0 || err != nil { return pl.Items, err } unfilteredPods := pl.Items filteredPods := []v1.Pod{} ReturnPodsSoFar: // Next: Pod must match at least one of the states that the user specified for _, pod := range unfilteredPods { if !(passesPhasesFilter(pod, p.ValidPhases) && passesPodNameFilter(pod, p.PodName)) { continue } passesVerify, err := passesVerifyFilter(pod, p.Verify) if err != nil { Logf("Error detected on %v : %v !", pod.Name, err) break ReturnPodsSoFar } if passesVerify { filteredPods = append(filteredPods, pod) } } return filteredPods, err } // WaitFor waits for some minimum number of pods to be verified, according to the PodStateVerification // definition. func (cl *ClusterVerification) WaitFor(atLeast int, timeout time.Duration) ([]v1.Pod, error) { pods := []v1.Pod{} var returnedErr error err := wait.Poll(1*time.Second, timeout, func() (bool, error) { pods, returnedErr = cl.podState.filter(cl.client, cl.namespace) // Failure if returnedErr != nil { Logf("Cutting polling short: We got an error from the pod filtering layer.") // stop polling if the pod filtering returns an error. that should never happen. // it indicates, for example, that the client is broken or something non-pod related. return false, returnedErr } Logf("Found %v / %v", len(pods), atLeast) // Success if len(pods) >= atLeast { return true, nil } // Keep trying... return false, nil }) Logf("WaitFor completed with timeout %v. Pods found = %v out of %v", timeout, len(pods), atLeast) return pods, err } // WaitForOrFail provides a shorthand WaitFor with failure as an option if anything goes wrong. func (cl *ClusterVerification) WaitForOrFail(atLeast int, timeout time.Duration) { pods, err := cl.WaitFor(atLeast, timeout) if err != nil || len(pods) < atLeast { Failf("Verified %v of %v pods , error : %v", len(pods), atLeast, err) } } // ForEach runs a function against every verifiable pod. Be warned that this doesn't wait for "n" pods to verify, // so it may return very quickly if you have strict pod state requirements. // // For example, if you require at least 5 pods to be running before your test will pass, // its smart to first call "clusterVerification.WaitFor(5)" before you call clusterVerification.ForEach. func (cl *ClusterVerification) ForEach(podFunc func(v1.Pod)) error { pods, err := cl.podState.filter(cl.client, cl.namespace) if err == nil { if len(pods) == 0 { Failf("No pods matched the filter.") } Logf("ForEach: Found %v pods from the filter. Now looping through them.", len(pods)) for _, p := range pods { podFunc(p) } } else { Logf("ForEach: Something went wrong when filtering pods to execute against: %v", err) } return err } // GetLogToFileFunc is a convenience function that returns a function that have the same interface as // Logf, but writes to a specified file. func GetLogToFileFunc(file *os.File) func(format string, args ...interface{}) { return func(format string, args ...interface{}) { writer := bufio.NewWriter(file) if _, err := fmt.Fprintf(writer, format, args...); err != nil { Logf("Failed to write file %v with test performance data: %v", file.Name(), err) } writer.Flush() } }
{'content_hash': 'd1e2c4dc7f54517788a669ef0d5e07af', 'timestamp': '', 'source': 'github', 'line_count': 870, 'max_line_length': 183, 'avg_line_length': 37.0551724137931, 'alnum_prop': 0.734785036292574, 'repo_name': 'madhanrm/kubernetes', 'id': '07b343b515f5c7f8eec16dab1387994a18f6620f', 'size': '32807', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'test/e2e/framework/framework.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '2840'}, {'name': 'Dockerfile', 'bytes': '61390'}, {'name': 'Go', 'bytes': '46279119'}, {'name': 'HTML', 'bytes': '38'}, {'name': 'Lua', 'bytes': '17200'}, {'name': 'Makefile', 'bytes': '76743'}, {'name': 'PowerShell', 'bytes': '97180'}, {'name': 'Python', 'bytes': '3180856'}, {'name': 'Ruby', 'bytes': '431'}, {'name': 'Shell', 'bytes': '1564054'}, {'name': 'sed', 'bytes': '11992'}]}
package com.jfinal.ext2.kit; /** * Upload file path * @author BruceZCQ */ final public class UploadPathKit { /** * Upload file path ref current datetime * @return */ public static String getDatePath() { return DateTimeKit.formatNowToStyle("/yyyy/M/d"); } }
{'content_hash': '509df471c28bbdac9fc1194f9c7522fe', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 51, 'avg_line_length': 16.176470588235293, 'alnum_prop': 0.6763636363636364, 'repo_name': 'OpeningO/JFinal-ext2', 'id': 'e3c1cfa01b5a2bf09835dff3eedb2bc2b43dec61', 'size': '898', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/jfinal/ext2/kit/UploadPathKit.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '491599'}]}
module Gitlab module Auth module OAuth class AuthHash attr_reader :auth_hash def initialize(auth_hash) @auth_hash = auth_hash end def uid @uid ||= Gitlab::Utils.force_utf8(auth_hash.uid.to_s) end def provider @provider ||= auth_hash.provider.to_s end def name @name ||= get_info(:name) || "#{get_info(:first_name)} #{get_info(:last_name)}" end def username @username ||= username_and_email[:username].to_s end def email @email ||= username_and_email[:email].to_s end def password @password ||= Gitlab::Utils.force_utf8(Devise.friendly_token[0, 8].downcase) end def location location = get_info(:address) if location.is_a?(Hash) [location.locality.presence, location.country.presence].compact.join(', ') else location end end def has_attribute?(attribute) if attribute == :location get_info(:address).present? else get_info(attribute).present? end end private def info auth_hash.info end def get_info(key) value = info[key] Gitlab::Utils.force_utf8(value) if value value end def username_and_email @username_and_email ||= begin username = get_info(:username).presence || get_info(:nickname).presence email = get_info(:email).presence username ||= generate_username(email) if email email ||= generate_temporarily_email(username) if username { username: username, email: email } end end # Get the first part of the email address (before @) # In addtion in removes illegal characters def generate_username(email) email.match(/^[^@]*/)[0].mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/, '').to_s end def generate_temporarily_email(username) "temp-email-for-oauth-#{username}@gitlab.localhost" end end end end end
{'content_hash': '9c4aef4728ef61bb068d1b35c25d77c0', 'timestamp': '', 'source': 'github', 'line_count': 90, 'max_line_length': 89, 'avg_line_length': 25.466666666666665, 'alnum_prop': 0.5191972076788831, 'repo_name': 'jirutka/gitlabhq', 'id': 'ed8fba943050f88467bcb3525a92b393063be43e', 'size': '2355', 'binary': False, 'copies': '2', 'ref': 'refs/heads/11-3-stable', 'path': 'lib/gitlab/auth/o_auth/auth_hash.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '651536'}, {'name': 'Clojure', 'bytes': '79'}, {'name': 'Dockerfile', 'bytes': '1676'}, {'name': 'HTML', 'bytes': '1281244'}, {'name': 'JavaScript', 'bytes': '3887640'}, {'name': 'Ruby', 'bytes': '17664250'}, {'name': 'Shell', 'bytes': '30673'}, {'name': 'Vue', 'bytes': '967573'}]}
ACCEPTED #### According to Index Fungorum #### Published in Arch. Derm. , Amer. Med. Ass. 22: 161 (1944) #### Original name Candida blancii Catanei ### Remarks null
{'content_hash': '6ca7ff4ab0d238097e02ac8e86b672ed', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 44, 'avg_line_length': 12.923076923076923, 'alnum_prop': 0.6785714285714286, 'repo_name': 'mdoering/backbone', 'id': '9f34559f1b1f4b4c92c6aef3c4a749c274494fbc', 'size': '215', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Fungi/Ascomycota/Saccharomycetes/Saccharomycetales/Candida/Candida blancii/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
<?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="OutletHasUser" table="outlet_has_user"> <id name="id" type="integer" column="id"> <generator strategy="IDENTITY"/> </id> <field name="birthday" type="string" column="birthday" length="45" nullable="true"/> <field name="facebookId" type="string" column="facebook_id" length="45" nullable="true"/> <field name="twitterId" type="string" column="twitter_id" length="45" nullable="true"/> <field name="createdAt" type="datetime" column="created_at" nullable="true"/> <field name="updatedAt" type="datetime" column="updated_at" nullable="true"/> <many-to-one field="outlet" target-entity="Outlet"> <join-columns> <join-column name="outlet_id" referenced-column-name="id"/> </join-columns> </many-to-one> <many-to-one field="user" target-entity="User"> <join-columns> <join-column name="user_id" referenced-column-name="id"/> </join-columns> </many-to-one> </entity> </doctrine-mapping>
{'content_hash': '6d51bb59ad372978523e146f16cffa18', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 276, 'avg_line_length': 56.69565217391305, 'alnum_prop': 0.678680981595092, 'repo_name': 'TESCHGlobal/Reachwhere_web', 'id': 'f26f27bdc7d8331248fbf4928e8b12dd09e19c12', 'size': '1304', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/Reachwhere/WebAppBundle/Resources/config/doctrine/metadata/orm_backup/OutletHasUser.orm.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '1302'}, {'name': 'JavaScript', 'bytes': '15875'}, {'name': 'PHP', 'bytes': '596306'}]}
<?xml version='1.0'?> <test xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation="unsignedLong_minInclusive003.xsd" > <!-- facet=minInclusive and value=1 and document value=5 --> <foo>5</foo> </test>
{'content_hash': 'f447caff65df3b5ce765486b9a25a201', 'timestamp': '', 'source': 'github', 'line_count': 5, 'max_line_length': 127, 'avg_line_length': 46.8, 'alnum_prop': 0.7222222222222222, 'repo_name': 'titellus/schematron', 'id': 'f8f4ba33c339cb54d982157f1e83f173cf2264f4', 'size': '234', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'xsd2sch/test/msData/datatypes/Facets/unsignedLong/unsignedLong_minInclusive003.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2398'}, {'name': 'Java', 'bytes': '68299'}, {'name': 'Red', 'bytes': '9003'}, {'name': 'Shell', 'bytes': '593'}, {'name': 'XProc', 'bytes': '16202'}, {'name': 'XSLT', 'bytes': '1003199'}]}
/** * */ package org.opensaml.saml2.metadata.validator; import org.opensaml.saml2.metadata.Organization; import org.opensaml.xml.validation.ValidationException; import org.opensaml.xml.validation.Validator; /** * Checks {@link org.opensaml.saml2.metadata.Organization} for Schema compliance. */ public class OrganizationSchemaValidator implements Validator<Organization> { /** Constructor */ public OrganizationSchemaValidator() { } /** {@inheritDoc} */ public void validate(Organization organization) throws ValidationException { validateName(organization); validateDisplayName(organization); validateURL(organization); } /** * Checks that at least one Organization Name is present. * * @param organization * @throws ValidationException */ protected void validateName(Organization organization) throws ValidationException { if (organization.getOrganizationNames() == null || organization.getOrganizationNames().size() < 1) { throw new ValidationException("Must have one or more Organization Names."); } } /** * Checks that at least one Display Name is present. * * @param organization * @throws ValidationException */ protected void validateDisplayName(Organization organization) throws ValidationException { if (organization.getDisplayNames() == null || organization.getDisplayNames().size() < 1) { throw new ValidationException("Must have one or more Display Names."); } } /** * Checks that at least one Organization URL is present. * * @param organization * @throws ValidationException */ protected void validateURL(Organization organization) throws ValidationException { if (organization.getURLs() == null || organization.getURLs().size() < 1) { throw new ValidationException("Must have one or more Organization URLs."); } } }
{'content_hash': '9a257a416027bf4f3acdf0e23e4a11d8', 'timestamp': '', 'source': 'github', 'line_count': 65, 'max_line_length': 108, 'avg_line_length': 30.661538461538463, 'alnum_prop': 0.6783743100852986, 'repo_name': 'Safewhere/kombit-service-java', 'id': '0cc8308f9d85d05c6363497a60746fb9a1743a9d', 'size': '2837', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'OpenSaml/src/org/opensaml/saml2/metadata/validator/OrganizationSchemaValidator.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '73985'}, {'name': 'Java', 'bytes': '5965174'}]}
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Parent-App")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Parent-App")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
{'content_hash': '37b5c4ec3598870adb43e05fbe9ca35b', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 84, 'avg_line_length': 35.758620689655174, 'alnum_prop': 0.7386692381870781, 'repo_name': 'Ouay/Ouay-HackZurich', 'id': '0db8fa3fd8ffce8e6e20f97ddcfe791e03a51835', 'size': '1040', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Parent-App/Properties/AssemblyInfo.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '66289'}]}
import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'WSystem.is_shattered' db.add_column(u'Map_wsystem', 'is_shattered', self.gf('django.db.models.fields.NullBooleanField')(default=False, null=True, blank=True), keep_default=False) def backwards(self, orm): # Deleting field 'WSystem.is_shattered' db.delete_column(u'Map_wsystem', 'is_shattered') models = { u'Map.destination': { 'Meta': {'object_name': 'Destination'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'system': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'destinations'", 'to': u"orm['Map.KSystem']"}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'destinations'", 'null': 'True', 'to': u"orm['account.EWSUser']"}) }, u'Map.ksystem': { 'Meta': {'object_name': 'KSystem', '_ormbases': [u'Map.System']}, 'jumps': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'sov': ('django.db.models.fields.CharField', [], {'max_length': '100'}), u'system_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['Map.System']", 'unique': 'True', 'primary_key': 'True'}) }, u'Map.map': { 'Meta': {'object_name': 'Map'}, 'explicitperms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), 'root': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'root'", 'to': u"orm['Map.System']"}), 'truncate_allowed': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) }, u'Map.maplog': { 'Meta': {'object_name': 'MapLog'}, 'action': ('django.db.models.fields.CharField', [], {'max_length': '255'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'map': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'logentries'", 'to': u"orm['Map.Map']"}), 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'maplogs'", 'to': u"orm['account.EWSUser']"}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'Map.mappermission': { 'Meta': {'object_name': 'MapPermission'}, 'access': ('django.db.models.fields.IntegerField', [], {}), 'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'mappermissions'", 'to': u"orm['auth.Group']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'map': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'grouppermissions'", 'to': u"orm['Map.Map']"}) }, u'Map.mapsystem': { 'Meta': {'object_name': 'MapSystem'}, 'friendlyname': ('django.db.models.fields.CharField', [], {'max_length': '255'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'interesttime': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'map': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'systems'", 'to': u"orm['Map.Map']"}), 'parentsystem': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'childsystems'", 'null': 'True', 'to': u"orm['Map.MapSystem']"}), 'system': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'maps'", 'to': u"orm['Map.System']"}) }, u'Map.signature': { 'Meta': {'ordering': "['sigid']", 'unique_together': "(('system', 'sigid'),)", 'object_name': 'Signature'}, 'activated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'downtimes': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'info': ('django.db.models.fields.CharField', [], {'max_length': '65', 'null': 'True', 'blank': 'True'}), 'lastescalated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'signatures'", 'null': 'True', 'to': u"orm['account.EWSUser']"}), 'modified_time': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), 'owned_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sigs_owned'", 'null': 'True', 'to': u"orm['account.EWSUser']"}), 'owned_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'ratscleared': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'sigid': ('django.db.models.fields.CharField', [], {'max_length': '10'}), 'sigtype': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'sigs'", 'null': 'True', 'to': u"orm['Map.SignatureType']"}), 'system': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'signatures'", 'to': u"orm['Map.System']"}), 'updated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'Map.signaturetype': { 'Meta': {'object_name': 'SignatureType'}, 'escalatable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'longname': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'shortname': ('django.db.models.fields.CharField', [], {'max_length': '6'}), 'sleeprsite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'Map.sitespawn': { 'Meta': {'object_name': 'SiteSpawn'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'sigtype': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['Map.SignatureType']"}), 'sitename': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'spawns': ('django.db.models.fields.TextField', [], {}), 'sysclass': ('django.db.models.fields.IntegerField', [], {}) }, u'Map.snapshot': { 'Meta': {'object_name': 'Snapshot'}, 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'json': ('django.db.models.fields.TextField', [], {}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'snapshots'", 'to': u"orm['account.EWSUser']"}) }, u'Map.system': { 'Meta': {'object_name': 'System', '_ormbases': [u'core.SystemData']}, 'first_visited': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'importance': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'info': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'last_visited': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'lastscanned': ('django.db.models.fields.DateTimeField', [], {}), 'npckills': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'occupied': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'podkills': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'shipkills': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'sysclass': ('django.db.models.fields.IntegerField', [], {}), u'systemdata_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['core.SystemData']", 'unique': 'True', 'primary_key': 'True'}), 'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) }, u'Map.wormhole': { 'Meta': {'object_name': 'Wormhole'}, 'bottom': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'parent_wormhole'", 'unique': 'True', 'null': 'True', 'to': u"orm['Map.MapSystem']"}), 'bottom_bubbled': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), 'bottom_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': u"orm['Map.WormholeType']"}), 'collapsed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), 'eol_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'map': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'wormholes'", 'to': u"orm['Map.Map']"}), 'mass_status': ('django.db.models.fields.IntegerField', [], {}), 'time_status': ('django.db.models.fields.IntegerField', [], {}), 'top': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'child_wormholes'", 'to': u"orm['Map.MapSystem']"}), 'top_bubbled': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), 'top_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': u"orm['Map.WormholeType']"}), 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) }, u'Map.wormholetype': { 'Meta': {'object_name': 'WormholeType'}, 'destination': ('django.db.models.fields.IntegerField', [], {}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'jumpmass': ('django.db.models.fields.BigIntegerField', [], {}), 'lifetime': ('django.db.models.fields.IntegerField', [], {}), 'maxmass': ('django.db.models.fields.BigIntegerField', [], {}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '4'}), 'source': ('django.db.models.fields.CharField', [], {'max_length': '2'}), 'target': ('django.db.models.fields.CharField', [], {'max_length': '15'}) }, u'Map.wsystem': { 'Meta': {'object_name': 'WSystem', '_ormbases': [u'Map.System']}, 'effect': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), 'is_shattered': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}), 'static1': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'primary_statics'", 'null': 'True', 'to': u"orm['Map.WormholeType']"}), 'static2': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'secondary_statics'", 'null': 'True', 'to': u"orm['Map.WormholeType']"}), u'system_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['Map.System']", 'unique': 'True', 'primary_key': 'True'}) }, u'account.ewsuser': { 'Meta': {'object_name': 'EWSUser'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'defaultmap': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'defaultusers'", 'null': 'True', 'to': u"orm['Map.Map']"}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, u'auth.group': { 'Meta': {'object_name': 'Group'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, u'auth.permission': { 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, u'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, u'core.constellation': { 'Meta': {'object_name': 'Constellation', 'db_table': "'mapConstellations'", 'managed': 'False'}, 'id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True', 'db_column': "'constellationID'"}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_column': "'constellationName'"}), 'region': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'constellations'", 'db_column': "'regionID'", 'to': u"orm['core.Region']"}), 'x': ('django.db.models.fields.FloatField', [], {}), 'y': ('django.db.models.fields.FloatField', [], {}), 'z': ('django.db.models.fields.FloatField', [], {}) }, u'core.region': { 'Meta': {'object_name': 'Region', 'db_table': "'mapRegions'", 'managed': 'False'}, 'id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True', 'db_column': "'regionID'"}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_column': "'regionName'"}), 'x': ('django.db.models.fields.FloatField', [], {}), 'y': ('django.db.models.fields.FloatField', [], {}), 'z': ('django.db.models.fields.FloatField', [], {}) }, u'core.systemdata': { 'Meta': {'object_name': 'SystemData', 'db_table': "'mapSolarSystems'", 'managed': 'False'}, 'constellation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'systems'", 'db_column': "'constellationID'", 'to': u"orm['core.Constellation']"}), 'id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True', 'db_column': "'solarSystemID'"}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_column': "'solarSystemName'"}), 'region': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'systems'", 'db_column': "'regionID'", 'to': u"orm['core.Region']"}), 'security': ('django.db.models.fields.FloatField', [], {}), 'x': ('django.db.models.fields.FloatField', [], {}), 'y': ('django.db.models.fields.FloatField', [], {}), 'z': ('django.db.models.fields.FloatField', [], {}) } } complete_apps = ['Map']
{'content_hash': '3cec78bbdd05ce53861b6a7a78820ae7', 'timestamp': '', 'source': 'github', 'line_count': 226, 'max_line_length': 195, 'avg_line_length': 79.63274336283186, 'alnum_prop': 0.5471467466800022, 'repo_name': 'gpapaz/eve-wspace', 'id': '79b8dd12f5c43d296159d106ccbc23c9cc33660c', 'size': '18021', 'binary': False, 'copies': '5', 'ref': 'refs/heads/develop', 'path': 'evewspace/Map/migrations/0018_auto__add_field_wsystem_is_shattered.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '45009'}, {'name': 'HTML', 'bytes': '155151'}, {'name': 'JavaScript', 'bytes': '91241'}, {'name': 'Nginx', 'bytes': '109'}, {'name': 'Puppet', 'bytes': '6781'}, {'name': 'Python', 'bytes': '1149356'}, {'name': 'Shell', 'bytes': '2632'}]}
<div ng-include="setMenu()"></div> About
{'content_hash': '92eb3208c7f34f39371e452c650c4f2f', 'timestamp': '', 'source': 'github', 'line_count': 2, 'max_line_length': 34, 'avg_line_length': 20.5, 'alnum_prop': 0.6585365853658537, 'repo_name': 'Rickcy/AngularShop', 'id': '03ddb6ca4df02c51ccb9c1b7ae05c82d47d50f96', 'size': '41', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/page/about.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '63478'}, {'name': 'HTML', 'bytes': '48999'}, {'name': 'JavaScript', 'bytes': '93548'}]}
#include <aws/autoscaling/model/EnterStandbyResult.h> #include <aws/core/utils/xml/XmlSerializer.h> #include <aws/core/AmazonWebServiceResult.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/logging/LogMacros.h> #include <utility> using namespace Aws::AutoScaling::Model; using namespace Aws::Utils::Xml; using namespace Aws::Utils::Logging; using namespace Aws::Utils; using namespace Aws; EnterStandbyResult::EnterStandbyResult() { } EnterStandbyResult::EnterStandbyResult(const AmazonWebServiceResult<XmlDocument>& result) { *this = result; } EnterStandbyResult& EnterStandbyResult::operator =(const AmazonWebServiceResult<XmlDocument>& result) { const XmlDocument& xmlDocument = result.GetPayload(); XmlNode rootNode = xmlDocument.GetRootElement(); XmlNode resultNode = rootNode; if (rootNode.GetName() != "EnterStandbyResult") { resultNode = rootNode.FirstChild("EnterStandbyResult"); } if(!resultNode.IsNull()) { XmlNode activitiesNode = resultNode.FirstChild("Activities"); if(!activitiesNode.IsNull()) { XmlNode activitiesMember = activitiesNode.FirstChild("member"); while(!activitiesMember.IsNull()) { m_activities.push_back(activitiesMember); activitiesMember = activitiesMember.NextNode("member"); } } } XmlNode responseMetadataNode = rootNode.FirstChild("ResponseMetadata"); m_responseMetadata = responseMetadataNode; AWS_LOGSTREAM_DEBUG("Aws::AutoScaling::Model::EnterStandbyResult", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() ); return *this; }
{'content_hash': '9547e0ec94390332fae35b59a61ea07b', 'timestamp': '', 'source': 'github', 'line_count': 55, 'max_line_length': 130, 'avg_line_length': 28.963636363636365, 'alnum_prop': 0.743879472693032, 'repo_name': 'kahkeng/aws-sdk-cpp', 'id': 'a3fc5492521f3403e13f18e19abd18377be1a892', 'size': '2164', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'aws-cpp-sdk-autoscaling/source/model/EnterStandbyResult.cpp', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '7595'}, {'name': 'C++', 'bytes': '37744404'}, {'name': 'CMake', 'bytes': '265388'}, {'name': 'Java', 'bytes': '214644'}, {'name': 'Python', 'bytes': '46021'}]}
url_filter.filters module ========================= .. automodule:: url_filter.filters :members: :undoc-members: :show-inheritance:
{'content_hash': '27f28394bbdc9e2b4f38ded1fbbd631a', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 34, 'avg_line_length': 20.714285714285715, 'alnum_prop': 0.5655172413793104, 'repo_name': 'barseghyanartur/django-url-filter', 'id': '7d708ca35bee12eeac07b28153c98a0f253595da', 'size': '145', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'docs/api/url_filter.filters.rst', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Makefile', 'bytes': '1569'}, {'name': 'Python', 'bytes': '72820'}]}
<?php namespace FOS\RestBundle\DependencyInjection; use Symfony\Component\Config\Definition\Processor, Symfony\Component\HttpKernel\DependencyInjection\Extension, Symfony\Component\DependencyInjection\Loader\XmlFileLoader, Symfony\Component\DependencyInjection\ContainerBuilder, Symfony\Component\Config\FileLocator; /* * This file is part of the FOS/RestBundle * * (c) Lukas Kahwe Smith <[email protected]> * (c) Konstantin Kudryashov <[email protected]> * (c) Bulat Shakirzyanov <[email protected]> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ class FOSRestExtension extends Extension { /** * Loads the services based on your application configuration. * * @param array $configs * @param ContainerBuilder $container */ public function load(array $configs, ContainerBuilder $container) { // TODO move this to the Configuration class as soon as it supports setting such a default array_unshift($configs, array( 'formats' => array( 'json' => 'fos_rest.encoder.json', 'xml' => 'fos_rest.encoder.xml', 'html' => 'fos_rest.encoder.html', ) )); $processor = new Processor(); $configuration = new Configuration(); $config = $processor->process($configuration->getConfigTree(), $configs); $loader = $this->getFileLoader($container); $loader->load('view.xml'); $loader->load('routing.xml'); foreach ($config['class'] as $key => $value) { $container->setParameter($this->getAlias().'.'.$key.'.class', $value); } $container->setParameter($this->getAlias().'.formats', $config['formats']); if (!empty($config['frameworkextra'])) { $loader->load('frameworkextra.xml'); } } /** * Get File Loader * * @param ContainerBuilder $container */ public function getFileLoader($container) { return new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); } }
{'content_hash': '90768fae9b06e20b881cc4b241a8ee8b', 'timestamp': '', 'source': 'github', 'line_count': 69, 'max_line_length': 98, 'avg_line_length': 31.434782608695652, 'alnum_prop': 0.627939142461964, 'repo_name': 'mathieu-axiocode/RestBundle', 'id': '16d032b3fe416d0ca981f6e6f090f03823448154', 'size': '2169', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'DependencyInjection/FOSRestExtension.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'PHP', 'bytes': '75319'}]}
{% extends "base.html" %} {% block content %} <h1 id="error-type">Four Oh Three</h1> <h2 id="error-reason">Slow your roll</h2> <p>Yeah, you really shouldn't be here. It's no big deal, I'm sure it was an accident. Right?</p> <p><a href="/">Back from whence ye came</a></p> {% endblock %}
{'content_hash': 'ec56bc40fd2405180de5d1153845c825', 'timestamp': '', 'source': 'github', 'line_count': 8, 'max_line_length': 96, 'avg_line_length': 36.0, 'alnum_prop': 0.6423611111111112, 'repo_name': 'ColeKettler/site', 'id': 'e63b042b994daf734ccf3329955674f532e628ce', 'size': '288', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/templates/403.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '30400'}, {'name': 'HTML', 'bytes': '15897'}, {'name': 'JavaScript', 'bytes': '599'}, {'name': 'Mako', 'bytes': '412'}, {'name': 'Python', 'bytes': '53315'}]}
from __future__ import unicode_literals import threading import warnings from datetime import datetime, timedelta from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections from django.db.models.fields import Field from django.db.models.fields.related import ForeignObjectRel from django.db.models.manager import BaseManager from django.db.models.query import EmptyQuerySet, QuerySet from django.test import ( TestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature, ) from django.utils import six from django.utils.translation import ugettext_lazy from .models import Article, ArticleSelectOnSave, SelfRef class ModelInstanceCreationTests(TestCase): def test_object_is_not_written_to_database_until_save_was_called(self): a = Article( id=None, headline='Area man programs in Python', pub_date=datetime(2005, 7, 28), ) self.assertIsNone(a.id) self.assertEqual(Article.objects.all().count(), 0) # Save it into the database. You have to call save() explicitly. a.save() self.assertIsNotNone(a.id) self.assertEqual(Article.objects.all().count(), 1) def test_can_initialize_model_instance_using_positional_arguments(self): """ You can initialize a model instance using positional arguments, which should match the field order as defined in the model. """ a = Article(None, 'Second article', datetime(2005, 7, 29)) a.save() self.assertEqual(a.headline, 'Second article') self.assertEqual(a.pub_date, datetime(2005, 7, 29, 0, 0)) def test_can_create_instance_using_kwargs(self): a = Article( id=None, headline='Third article', pub_date=datetime(2005, 7, 30), ) a.save() self.assertEqual(a.headline, 'Third article') self.assertEqual(a.pub_date, datetime(2005, 7, 30, 0, 0)) def test_autofields_generate_different_values_for_each_instance(self): a1 = Article.objects.create(headline='First', pub_date=datetime(2005, 7, 30, 0, 0)) a2 = Article.objects.create(headline='First', pub_date=datetime(2005, 7, 30, 0, 0)) a3 = Article.objects.create(headline='First', pub_date=datetime(2005, 7, 30, 0, 0)) self.assertNotEqual(a3.id, a1.id) self.assertNotEqual(a3.id, a2.id) def test_can_mix_and_match_position_and_kwargs(self): # You can also mix and match position and keyword arguments, but # be sure not to duplicate field information. a = Article(None, 'Fourth article', pub_date=datetime(2005, 7, 31)) a.save() self.assertEqual(a.headline, 'Fourth article') def test_cannot_create_instance_with_invalid_kwargs(self): six.assertRaisesRegex( self, TypeError, "'foo' is an invalid keyword argument for this function", Article, id=None, headline='Some headline', pub_date=datetime(2005, 7, 31), foo='bar', ) def test_can_leave_off_value_for_autofield_and_it_gets_value_on_save(self): """ You can leave off the value for an AutoField when creating an object, because it'll get filled in automatically when you save(). """ a = Article(headline='Article 5', pub_date=datetime(2005, 7, 31)) a.save() self.assertEqual(a.headline, 'Article 5') self.assertNotEqual(a.id, None) def test_leaving_off_a_field_with_default_set_the_default_will_be_saved(self): a = Article(pub_date=datetime(2005, 7, 31)) a.save() self.assertEqual(a.headline, 'Default headline') def test_for_datetimefields_saves_as_much_precision_as_was_given(self): """as much precision in *seconds*""" a1 = Article( headline='Article 7', pub_date=datetime(2005, 7, 31, 12, 30), ) a1.save() self.assertEqual(Article.objects.get(id__exact=a1.id).pub_date, datetime(2005, 7, 31, 12, 30)) a2 = Article( headline='Article 8', pub_date=datetime(2005, 7, 31, 12, 30, 45), ) a2.save() self.assertEqual(Article.objects.get(id__exact=a2.id).pub_date, datetime(2005, 7, 31, 12, 30, 45)) def test_saving_an_object_again_does_not_create_a_new_object(self): a = Article(headline='original', pub_date=datetime(2014, 5, 16)) a.save() current_id = a.id a.save() self.assertEqual(a.id, current_id) a.headline = 'Updated headline' a.save() self.assertEqual(a.id, current_id) def test_querysets_checking_for_membership(self): headlines = [ 'Area man programs in Python', 'Second article', 'Third article'] some_pub_date = datetime(2014, 5, 16, 12, 1) for headline in headlines: Article(headline=headline, pub_date=some_pub_date).save() a = Article(headline='Some headline', pub_date=some_pub_date) a.save() # You can use 'in' to test for membership... self.assertIn(a, Article.objects.all()) # ... but there will often be more efficient ways if that is all you need: self.assertTrue(Article.objects.filter(id=a.id).exists()) class ModelTest(TestCase): def test_objects_attribute_is_only_available_on_the_class_itself(self): six.assertRaisesRegex( self, AttributeError, "Manager isn't accessible via Article instances", getattr, Article(), "objects", ) self.assertFalse(hasattr(Article(), 'objects')) self.assertTrue(hasattr(Article, 'objects')) def test_queryset_delete_removes_all_items_in_that_queryset(self): headlines = [ 'An article', 'Article One', 'Amazing article', 'Boring article'] some_pub_date = datetime(2014, 5, 16, 12, 1) for headline in headlines: Article(headline=headline, pub_date=some_pub_date).save() self.assertQuerysetEqual(Article.objects.all().order_by('headline'), ["<Article: Amazing article>", "<Article: An article>", "<Article: Article One>", "<Article: Boring article>"]) Article.objects.filter(headline__startswith='A').delete() self.assertQuerysetEqual(Article.objects.all().order_by('headline'), ["<Article: Boring article>"]) def test_not_equal_and_equal_operators_behave_as_expected_on_instances(self): some_pub_date = datetime(2014, 5, 16, 12, 1) a1 = Article.objects.create(headline='First', pub_date=some_pub_date) a2 = Article.objects.create(headline='Second', pub_date=some_pub_date) self.assertNotEqual(a1, a2) self.assertEqual(a1, Article.objects.get(id__exact=a1.id)) self.assertNotEqual(Article.objects.get(id__exact=a1.id), Article.objects.get(id__exact=a2.id)) @skipUnlessDBFeature('supports_microsecond_precision') def test_microsecond_precision(self): # In PostgreSQL, microsecond-level precision is available. a9 = Article( headline='Article 9', pub_date=datetime(2005, 7, 31, 12, 30, 45, 180), ) a9.save() self.assertEqual(Article.objects.get(pk=a9.pk).pub_date, datetime(2005, 7, 31, 12, 30, 45, 180)) @skipIfDBFeature('supports_microsecond_precision') def test_microsecond_precision_not_supported(self): # In MySQL, microsecond-level precision isn't available. You'll lose # microsecond-level precision once the data is saved. a9 = Article( headline='Article 9', pub_date=datetime(2005, 7, 31, 12, 30, 45, 180), ) a9.save() self.assertEqual(Article.objects.get(id__exact=a9.id).pub_date, datetime(2005, 7, 31, 12, 30, 45)) def test_manually_specify_primary_key(self): # You can manually specify the primary key when creating a new object. a101 = Article( id=101, headline='Article 101', pub_date=datetime(2005, 7, 31, 12, 30, 45), ) a101.save() a101 = Article.objects.get(pk=101) self.assertEqual(a101.headline, 'Article 101') def test_create_method(self): # You can create saved objects in a single step a10 = Article.objects.create( headline="Article 10", pub_date=datetime(2005, 7, 31, 12, 30, 45), ) self.assertEqual(Article.objects.get(headline="Article 10"), a10) def test_year_lookup_edge_case(self): # Edge-case test: A year lookup should retrieve all objects in # the given year, including Jan. 1 and Dec. 31. Article.objects.create( headline='Article 11', pub_date=datetime(2008, 1, 1), ) Article.objects.create( headline='Article 12', pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999), ) self.assertQuerysetEqual(Article.objects.filter(pub_date__year=2008), ["<Article: Article 11>", "<Article: Article 12>"]) def test_unicode_data(self): # Unicode data works, too. a = Article( headline='\u6797\u539f \u3081\u3050\u307f', pub_date=datetime(2005, 7, 28), ) a.save() self.assertEqual(Article.objects.get(pk=a.id).headline, '\u6797\u539f \u3081\u3050\u307f') def test_hash_function(self): # Model instances have a hash function, so they can be used in sets # or as dictionary keys. Two models compare as equal if their primary # keys are equal. a10 = Article.objects.create( headline="Article 10", pub_date=datetime(2005, 7, 31, 12, 30, 45), ) a11 = Article.objects.create( headline='Article 11', pub_date=datetime(2008, 1, 1), ) a12 = Article.objects.create( headline='Article 12', pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999), ) s = {a10, a11, a12} self.assertIn(Article.objects.get(headline='Article 11'), s) def test_field_ordering(self): """ Field instances have a `__lt__` comparison function to define an ordering based on their creation. Prior to #17851 this ordering comparison relied on the now unsupported `__cmp__` and was assuming compared objects were both Field instances raising `AttributeError` when it should have returned `NotImplemented`. """ f1 = Field() f2 = Field(auto_created=True) f3 = Field() self.assertLess(f2, f1) self.assertGreater(f3, f1) self.assertIsNotNone(f1) self.assertNotIn(f2, (None, 1, '')) def test_extra_method_select_argument_with_dashes_and_values(self): # The 'select' argument to extra() supports names with dashes in # them, as long as you use values(). Article.objects.create( headline="Article 10", pub_date=datetime(2005, 7, 31, 12, 30, 45), ) Article.objects.create( headline='Article 11', pub_date=datetime(2008, 1, 1), ) Article.objects.create( headline='Article 12', pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999), ) dicts = Article.objects.filter( pub_date__year=2008).extra( select={'dashed-value': '1'}).values('headline', 'dashed-value') self.assertEqual([sorted(d.items()) for d in dicts], [[('dashed-value', 1), ('headline', 'Article 11')], [('dashed-value', 1), ('headline', 'Article 12')]]) def test_extra_method_select_argument_with_dashes(self): # If you use 'select' with extra() and names containing dashes on a # query that's *not* a values() query, those extra 'select' values # will silently be ignored. Article.objects.create( headline="Article 10", pub_date=datetime(2005, 7, 31, 12, 30, 45), ) Article.objects.create( headline='Article 11', pub_date=datetime(2008, 1, 1), ) Article.objects.create( headline='Article 12', pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999), ) articles = Article.objects.filter( pub_date__year=2008).extra(select={'dashed-value': '1', 'undashedvalue': '2'}) self.assertEqual(articles[0].undashedvalue, 2) def test_create_relation_with_ugettext_lazy(self): """ Test that ugettext_lazy objects work when saving model instances through various methods. Refs #10498. """ notlazy = 'test' lazy = ugettext_lazy(notlazy) Article.objects.create(headline=lazy, pub_date=datetime.now()) article = Article.objects.get() self.assertEqual(article.headline, notlazy) # test that assign + save works with Promise objects article.headline = lazy article.save() self.assertEqual(article.headline, notlazy) # test .update() Article.objects.update(headline=lazy) article = Article.objects.get() self.assertEqual(article.headline, notlazy) # still test bulk_create() Article.objects.all().delete() Article.objects.bulk_create([Article(headline=lazy, pub_date=datetime.now())]) article = Article.objects.get() self.assertEqual(article.headline, notlazy) def test_emptyqs(self): # Can't be instantiated with self.assertRaises(TypeError): EmptyQuerySet() self.assertIsInstance(Article.objects.none(), EmptyQuerySet) def test_emptyqs_values(self): # test for #15959 Article.objects.create(headline='foo', pub_date=datetime.now()) with self.assertNumQueries(0): qs = Article.objects.none().values_list('pk') self.assertIsInstance(qs, EmptyQuerySet) self.assertEqual(len(qs), 0) def test_emptyqs_customqs(self): # A hacky test for custom QuerySet subclass - refs #17271 Article.objects.create(headline='foo', pub_date=datetime.now()) class CustomQuerySet(QuerySet): def do_something(self): return 'did something' qs = Article.objects.all() qs.__class__ = CustomQuerySet qs = qs.none() with self.assertNumQueries(0): self.assertEqual(len(qs), 0) self.assertIsInstance(qs, EmptyQuerySet) self.assertEqual(qs.do_something(), 'did something') def test_emptyqs_values_order(self): # Tests for ticket #17712 Article.objects.create(headline='foo', pub_date=datetime.now()) with self.assertNumQueries(0): self.assertEqual(len(Article.objects.none().values_list('id').order_by('id')), 0) with self.assertNumQueries(0): self.assertEqual(len(Article.objects.none().filter( id__in=Article.objects.values_list('id', flat=True))), 0) @skipUnlessDBFeature('can_distinct_on_fields') def test_emptyqs_distinct(self): # Tests for #19426 Article.objects.create(headline='foo', pub_date=datetime.now()) with self.assertNumQueries(0): self.assertEqual(len(Article.objects.none().distinct('headline', 'pub_date')), 0) def test_ticket_20278(self): sr = SelfRef.objects.create() with self.assertRaises(ObjectDoesNotExist): SelfRef.objects.get(selfref=sr) def test_eq(self): self.assertEqual(Article(id=1), Article(id=1)) self.assertNotEqual(Article(id=1), object()) self.assertNotEqual(object(), Article(id=1)) a = Article() self.assertEqual(a, a) self.assertNotEqual(Article(), a) def test_hash(self): # Value based on PK self.assertEqual(hash(Article(id=1)), hash(1)) with self.assertRaises(TypeError): # No PK value -> unhashable (because save() would then change # hash) hash(Article()) class ModelLookupTest(TestCase): def setUp(self): # Create an Article. self.a = Article( id=None, headline='Area woman programs in Python', pub_date=datetime(2005, 7, 28), ) # Save it into the database. You have to call save() explicitly. self.a.save() def test_all_lookup(self): # Change values by changing the attributes, then calling save(). self.a.headline = 'Area man programs in Python' self.a.save() # Article.objects.all() returns all the articles in the database. self.assertQuerysetEqual(Article.objects.all(), ['<Article: Area man programs in Python>']) def test_rich_lookup(self): # Django provides a rich database lookup API. self.assertEqual(Article.objects.get(id__exact=self.a.id), self.a) self.assertEqual(Article.objects.get(headline__startswith='Area woman'), self.a) self.assertEqual(Article.objects.get(pub_date__year=2005), self.a) self.assertEqual(Article.objects.get(pub_date__year=2005, pub_date__month=7), self.a) self.assertEqual(Article.objects.get(pub_date__year=2005, pub_date__month=7, pub_date__day=28), self.a) self.assertEqual(Article.objects.get(pub_date__week_day=5), self.a) def test_equal_lookup(self): # The "__exact" lookup type can be omitted, as a shortcut. self.assertEqual(Article.objects.get(id=self.a.id), self.a) self.assertEqual(Article.objects.get(headline='Area woman programs in Python'), self.a) self.assertQuerysetEqual( Article.objects.filter(pub_date__year=2005), ['<Article: Area woman programs in Python>'], ) self.assertQuerysetEqual( Article.objects.filter(pub_date__year=2004), [], ) self.assertQuerysetEqual( Article.objects.filter(pub_date__year=2005, pub_date__month=7), ['<Article: Area woman programs in Python>'], ) self.assertQuerysetEqual( Article.objects.filter(pub_date__week_day=5), ['<Article: Area woman programs in Python>'], ) self.assertQuerysetEqual( Article.objects.filter(pub_date__week_day=6), [], ) def test_does_not_exist(self): # Django raises an Article.DoesNotExist exception for get() if the # parameters don't match any object. six.assertRaisesRegex( self, ObjectDoesNotExist, "Article matching query does not exist.", Article.objects.get, id__exact=2000, ) # To avoid dict-ordering related errors check only one lookup # in single assert. self.assertRaises( ObjectDoesNotExist, Article.objects.get, pub_date__year=2005, pub_date__month=8, ) six.assertRaisesRegex( self, ObjectDoesNotExist, "Article matching query does not exist.", Article.objects.get, pub_date__week_day=6, ) def test_lookup_by_primary_key(self): # Lookup by a primary key is the most common case, so Django # provides a shortcut for primary-key exact lookups. # The following is identical to articles.get(id=a.id). self.assertEqual(Article.objects.get(pk=self.a.id), self.a) # pk can be used as a shortcut for the primary key name in any query. self.assertQuerysetEqual(Article.objects.filter(pk__in=[self.a.id]), ["<Article: Area woman programs in Python>"]) # Model instances of the same type and same ID are considered equal. a = Article.objects.get(pk=self.a.id) b = Article.objects.get(pk=self.a.id) self.assertEqual(a, b) def test_too_many(self): # Create a very similar object a = Article( id=None, headline='Area man programs in Python', pub_date=datetime(2005, 7, 28), ) a.save() self.assertEqual(Article.objects.count(), 2) # Django raises an Article.MultipleObjectsReturned exception if the # lookup matches more than one object six.assertRaisesRegex( self, MultipleObjectsReturned, "get\(\) returned more than one Article -- it returned 2!", Article.objects.get, headline__startswith='Area', ) six.assertRaisesRegex( self, MultipleObjectsReturned, "get\(\) returned more than one Article -- it returned 2!", Article.objects.get, pub_date__year=2005, ) six.assertRaisesRegex( self, MultipleObjectsReturned, "get\(\) returned more than one Article -- it returned 2!", Article.objects.get, pub_date__year=2005, pub_date__month=7, ) class ConcurrentSaveTests(TransactionTestCase): available_apps = ['basic'] @skipUnlessDBFeature('test_db_allows_multiple_connections') def test_concurrent_delete_with_save(self): """ Test fetching, deleting and finally saving an object - we should get an insert in this case. """ a = Article.objects.create(headline='foo', pub_date=datetime.now()) exceptions = [] def deleter(): try: # Do not delete a directly - doing so alters its state. Article.objects.filter(pk=a.pk).delete() except Exception as e: exceptions.append(e) finally: connections[DEFAULT_DB_ALIAS].close() self.assertEqual(len(exceptions), 0) t = threading.Thread(target=deleter) t.start() t.join() a.save() self.assertEqual(Article.objects.get(pk=a.pk).headline, 'foo') class ManagerTest(TestCase): QUERYSET_PROXY_METHODS = [ 'none', 'count', 'dates', 'datetimes', 'distinct', 'extra', 'get', 'get_or_create', 'update_or_create', 'create', 'bulk_create', 'filter', 'aggregate', 'annotate', 'complex_filter', 'exclude', 'in_bulk', 'iterator', 'earliest', 'latest', 'first', 'last', 'order_by', 'select_for_update', 'select_related', 'prefetch_related', 'values', 'values_list', 'update', 'reverse', 'defer', 'only', 'using', 'exists', '_insert', '_update', 'raw', ] def test_manager_methods(self): """ This test ensures that the correct set of methods from `QuerySet` are copied onto `Manager`. It's particularly useful to prevent accidentally leaking new methods into `Manager`. New `QuerySet` methods that should also be copied onto `Manager` will need to be added to `ManagerTest.QUERYSET_PROXY_METHODS`. """ self.assertEqual( sorted(BaseManager._get_queryset_methods(QuerySet).keys()), sorted(self.QUERYSET_PROXY_METHODS), ) class SelectOnSaveTests(TestCase): def test_select_on_save(self): a1 = Article.objects.create(pub_date=datetime.now()) with self.assertNumQueries(1): a1.save() asos = ArticleSelectOnSave.objects.create(pub_date=datetime.now()) with self.assertNumQueries(2): asos.save() with self.assertNumQueries(1): asos.save(force_update=True) Article.objects.all().delete() with self.assertRaises(DatabaseError): with self.assertNumQueries(1): asos.save(force_update=True) def test_select_on_save_lying_update(self): """ Test that select_on_save works correctly if the database doesn't return correct information about matched rows from UPDATE. """ # Change the manager to not return "row matched" for update(). # We are going to change the Article's _base_manager class # dynamically. This is a bit of a hack, but it seems hard to # test this properly otherwise. Article's manager, because # proxy models use their parent model's _base_manager. orig_class = Article._base_manager.__class__ class FakeQuerySet(QuerySet): # Make sure the _update method below is in fact called. called = False def _update(self, *args, **kwargs): FakeQuerySet.called = True super(FakeQuerySet, self)._update(*args, **kwargs) return 0 class FakeManager(orig_class): def get_queryset(self): return FakeQuerySet(self.model) try: Article._base_manager.__class__ = FakeManager asos = ArticleSelectOnSave.objects.create(pub_date=datetime.now()) with self.assertNumQueries(3): asos.save() self.assertTrue(FakeQuerySet.called) # This is not wanted behavior, but this is how Django has always # behaved for databases that do not return correct information # about matched rows for UPDATE. with self.assertRaises(DatabaseError): asos.save(force_update=True) with self.assertRaises(DatabaseError): asos.save(update_fields=['pub_date']) finally: Article._base_manager.__class__ = orig_class class ModelRefreshTests(TestCase): def _truncate_ms(self, val): # MySQL < 5.6.4 removes microseconds from the datetimes which can cause # problems when comparing the original value to that loaded from DB return val - timedelta(microseconds=val.microsecond) def test_refresh(self): a = Article.objects.create(pub_date=self._truncate_ms(datetime.now())) Article.objects.create(pub_date=self._truncate_ms(datetime.now())) Article.objects.filter(pk=a.pk).update(headline='new headline') with self.assertNumQueries(1): a.refresh_from_db() self.assertEqual(a.headline, 'new headline') orig_pub_date = a.pub_date new_pub_date = a.pub_date + timedelta(10) Article.objects.update(headline='new headline 2', pub_date=new_pub_date) with self.assertNumQueries(1): a.refresh_from_db(fields=['headline']) self.assertEqual(a.headline, 'new headline 2') self.assertEqual(a.pub_date, orig_pub_date) with self.assertNumQueries(1): a.refresh_from_db() self.assertEqual(a.pub_date, new_pub_date) def test_refresh_fk(self): s1 = SelfRef.objects.create() s2 = SelfRef.objects.create() s3 = SelfRef.objects.create(selfref=s1) s3_copy = SelfRef.objects.get(pk=s3.pk) s3_copy.selfref.touched = True s3.selfref = s2 s3.save() with self.assertNumQueries(1): s3_copy.refresh_from_db() with self.assertNumQueries(1): # The old related instance was thrown away (the selfref_id has # changed). It needs to be reloaded on access, so one query # executed. self.assertFalse(hasattr(s3_copy.selfref, 'touched')) self.assertEqual(s3_copy.selfref, s2) def test_refresh_unsaved(self): pub_date = self._truncate_ms(datetime.now()) a = Article.objects.create(pub_date=pub_date) a2 = Article(id=a.pk) with self.assertNumQueries(1): a2.refresh_from_db() self.assertEqual(a2.pub_date, pub_date) self.assertEqual(a2._state.db, "default") def test_refresh_no_fields(self): a = Article.objects.create(pub_date=self._truncate_ms(datetime.now())) with self.assertNumQueries(0): a.refresh_from_db(fields=[]) class TestRelatedObjectDeprecation(TestCase): def test_field_related_deprecation(self): field = SelfRef._meta.get_field('selfref') with warnings.catch_warnings(record=True) as warns: warnings.simplefilter('always') self.assertIsInstance(field.related, ForeignObjectRel) self.assertEqual(len(warns), 1) self.assertEqual( str(warns.pop().message), 'Usage of field.related has been deprecated. Use field.rel instead.' )
{'content_hash': 'a92e4c1a02feadcb70e36dddf6f8aae9', 'timestamp': '', 'source': 'github', 'line_count': 763, 'max_line_length': 115, 'avg_line_length': 38.10484927916121, 'alnum_prop': 0.5998486620348077, 'repo_name': 'digimarc/django', 'id': 'd851d858de4c65c152e09ac059b551bf6ae6d795', 'size': '29074', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'tests/basic/tests.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '42307'}, {'name': 'HTML', 'bytes': '169002'}, {'name': 'JavaScript', 'bytes': '106009'}, {'name': 'Makefile', 'bytes': '125'}, {'name': 'Python', 'bytes': '10508501'}, {'name': 'Shell', 'bytes': '3056'}]}
import functools from ovsdbapp.schema.open_vswitch import helpers from neutron.agent.common import utils enable_connection_uri = functools.partial( helpers.enable_connection_uri, execute=utils.execute, run_as_root=True, log_fail_as_error=False, check_exit_code=False)
{'content_hash': '2ccb526d356c4db41f8c6c80f1a2d6d6', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 75, 'avg_line_length': 31.0, 'alnum_prop': 0.7885304659498208, 'repo_name': 'noironetworks/neutron', 'id': '47c37ca67f3a8b4c73a9ff58b79f86328313466b', 'size': '889', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'neutron/agent/ovsdb/native/helpers.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Mako', 'bytes': '1047'}, {'name': 'Python', 'bytes': '11420614'}, {'name': 'Shell', 'bytes': '38791'}]}
"use strict"; exports.__esModule = true; exports.Parser = Parser; var _reservedWords$keywords = require("./identifier"); var _tt$lineBreak = require("./tokentype"); function Parser(options, input, startPos) { this.options = options; this.loadPlugins(this.options.plugins); this.sourceFile = this.options.sourceFile || null; this.isKeyword = _reservedWords$keywords.keywords[this.options.ecmaVersion >= 6 ? 6 : 5]; this.isReservedWord = _reservedWords$keywords.reservedWords[this.options.ecmaVersion]; this.input = input; // Set up token state // The current position of the tokenizer in the input. if (startPos) { this.pos = startPos; this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos)); this.curLine = this.input.slice(0, this.lineStart).split(_tt$lineBreak.lineBreak).length; } else { this.pos = this.lineStart = 0; this.curLine = 1; } // Properties of the current token: // Its type this.type = _tt$lineBreak.types.eof; // For tokens that include more information than their type, the value this.value = null; // Its start and end offset this.start = this.end = this.pos; // And, if locations are used, the {line, column} object // corresponding to those offsets this.startLoc = this.endLoc = null; // Position information for the previous token this.lastTokEndLoc = this.lastTokStartLoc = null; this.lastTokStart = this.lastTokEnd = this.pos; // The context stack is used to superficially track syntactic // context to predict whether a regular expression is allowed in a // given position. this.context = this.initialContext(); this.exprAllowed = true; // Figure out if it's a module code. this.inModule = this.options.sourceType === "module"; this.strict = this.options.strictMode === false ? false : this.inModule; // Used to signify the start of a potential arrow function this.potentialArrowAt = -1; // Flags to track whether we are in a function, a generator. this.inFunction = this.inGenerator = false; // Labels in scope. this.labels = []; this.decorators = []; // If enabled, skip leading hashbang line. if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === "#!") this.skipLineComment(2); } Parser.prototype.extend = function (name, f) { this[name] = f(this[name]); }; // Registered plugins var plugins = {}; exports.plugins = plugins; Parser.prototype.loadPlugins = function (plugins) { for (var _name in plugins) { var plugin = exports.plugins[_name]; if (!plugin) throw new Error("Plugin '" + _name + "' not found"); plugin(this, plugins[_name]); } };
{'content_hash': 'c4caeb99bfd9406f098660647cb44d62', 'timestamp': '', 'source': 'github', 'line_count': 84, 'max_line_length': 111, 'avg_line_length': 31.511904761904763, 'alnum_prop': 0.690970910464677, 'repo_name': 'one-gulp/one-gulp', 'id': 'f67df15085c901c8b97eb140bf58099edea1c6db', 'size': '2647', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'node_modules/babel/node_modules/babel-core/lib/acorn/src/state.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '1109'}, {'name': 'CoffeeScript', 'bytes': '430'}, {'name': 'HTML', 'bytes': '1669'}, {'name': 'JavaScript', 'bytes': '32924'}, {'name': 'TypeScript', 'bytes': '442'}]}
"""A base class for a configurable application.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function import json import logging import os import re import sys from copy import deepcopy from collections import defaultdict from IPython.external.decorator import decorator from IPython.config.configurable import SingletonConfigurable from IPython.config.loader import ( KVArgParseConfigLoader, PyFileConfigLoader, Config, ArgumentError, ConfigFileNotFound, JSONFileConfigLoader ) from IPython.utils.traitlets import ( Unicode, List, Enum, Dict, Instance, TraitError ) from IPython.utils.importstring import import_item from IPython.utils.text import indent, wrap_paragraphs, dedent from IPython.utils import py3compat from IPython.utils.py3compat import string_types, iteritems #----------------------------------------------------------------------------- # Descriptions for the various sections #----------------------------------------------------------------------------- # merge flags&aliases into options option_description = """ Arguments that take values are actually convenience aliases to full Configurables, whose aliases are listed on the help line. For more information on full configurables, see '--help-all'. """.strip() # trim newlines of front and back keyvalue_description = """ Parameters are set from command-line arguments of the form: `--Class.trait=value`. This line is evaluated in Python, so simple expressions are allowed, e.g.:: `--C.a='range(3)'` For setting C.a=[0,1,2]. """.strip() # trim newlines of front and back # sys.argv can be missing, for example when python is embedded. See the docs # for details: http://docs.python.org/2/c-api/intro.html#embedding-python if not hasattr(sys, "argv"): sys.argv = [""] subcommand_description = """ Subcommands are launched as `{app} cmd [args]`. For information on using subcommand 'cmd', do: `{app} cmd -h`. """ # get running program name #----------------------------------------------------------------------------- # Application class #----------------------------------------------------------------------------- @decorator def catch_config_error(method, app, *args, **kwargs): """Method decorator for catching invalid config (Trait/ArgumentErrors) during init. On a TraitError (generally caused by bad config), this will print the trait's message, and exit the app. For use on init methods, to prevent invoking excepthook on invalid input. """ try: return method(app, *args, **kwargs) except (TraitError, ArgumentError) as e: app.print_help() app.log.fatal("Bad config encountered during initialization:") app.log.fatal(str(e)) app.log.debug("Config at the time: %s", app.config) app.exit(1) class ApplicationError(Exception): pass class LevelFormatter(logging.Formatter): """Formatter with additional `highlevel` record This field is empty if log level is less than highlevel_limit, otherwise it is formatted with self.highlevel_format. Useful for adding 'WARNING' to warning messages, without adding 'INFO' to info, etc. """ highlevel_limit = logging.WARN highlevel_format = " %(levelname)s |" def format(self, record): if record.levelno >= self.highlevel_limit: record.highlevel = self.highlevel_format % record.__dict__ else: record.highlevel = "" return super(LevelFormatter, self).format(record) class Application(SingletonConfigurable): """A singleton application with full configuration support.""" # The name of the application, will usually match the name of the command # line application name = Unicode(u'application') # The description of the application that is printed at the beginning # of the help. description = Unicode(u'This is an application.') # default section descriptions option_description = Unicode(option_description) keyvalue_description = Unicode(keyvalue_description) subcommand_description = Unicode(subcommand_description) # The usage and example string that goes at the end of the help string. examples = Unicode() # A sequence of Configurable subclasses whose config=True attributes will # be exposed at the command line. classes = [] @property def _help_classes(self): """Define `App.help_classes` if CLI classes should differ from config file classes""" return getattr(self, 'help_classes', self.classes) @property def _config_classes(self): """Define `App.config_classes` if config file classes should differ from CLI classes.""" return getattr(self, 'config_classes', self.classes) # The version string of this application. version = Unicode(u'0.0') # the argv used to initialize the application argv = List() # The log level for the application log_level = Enum((0,10,20,30,40,50,'DEBUG','INFO','WARN','ERROR','CRITICAL'), default_value=logging.WARN, config=True, help="Set the log level by value or name.") def _log_level_changed(self, name, old, new): """Adjust the log level when log_level is set.""" if isinstance(new, string_types): new = getattr(logging, new) self.log_level = new self.log.setLevel(new) _log_formatter_cls = LevelFormatter log_datefmt = Unicode("%Y-%m-%d %H:%M:%S", config=True, help="The date format used by logging formatters for %(asctime)s" ) def _log_datefmt_changed(self, name, old, new): self._log_format_changed('log_format', self.log_format, self.log_format) log_format = Unicode("[%(name)s]%(highlevel)s %(message)s", config=True, help="The Logging format template", ) def _log_format_changed(self, name, old, new): """Change the log formatter when log_format is set.""" _log_handler = self.log.handlers[0] _log_formatter = self._log_formatter_cls(fmt=new, datefmt=self.log_datefmt) _log_handler.setFormatter(_log_formatter) log = Instance(logging.Logger) def _log_default(self): """Start logging for this application. The default is to log to stderr using a StreamHandler, if no default handler already exists. The log level starts at logging.WARN, but this can be adjusted by setting the ``log_level`` attribute. """ log = logging.getLogger(self.__class__.__name__) log.setLevel(self.log_level) log.propagate = False _log = log # copied from Logger.hasHandlers() (new in Python 3.2) while _log: if _log.handlers: return log if not _log.propagate: break else: _log = _log.parent if sys.executable.endswith('pythonw.exe'): # this should really go to a file, but file-logging is only # hooked up in parallel applications _log_handler = logging.StreamHandler(open(os.devnull, 'w')) else: _log_handler = logging.StreamHandler() _log_formatter = self._log_formatter_cls(fmt=self.log_format, datefmt=self.log_datefmt) _log_handler.setFormatter(_log_formatter) log.addHandler(_log_handler) return log # the alias map for configurables aliases = Dict({'log-level' : 'Application.log_level'}) # flags for loading Configurables or store_const style flags # flags are loaded from this dict by '--key' flags # this must be a dict of two-tuples, the first element being the Config/dict # and the second being the help string for the flag flags = Dict() def _flags_changed(self, name, old, new): """ensure flags dict is valid""" for key,value in iteritems(new): assert len(value) == 2, "Bad flag: %r:%s"%(key,value) assert isinstance(value[0], (dict, Config)), "Bad flag: %r:%s"%(key,value) assert isinstance(value[1], string_types), "Bad flag: %r:%s"%(key,value) # subcommands for launching other applications # if this is not empty, this will be a parent Application # this must be a dict of two-tuples, # the first element being the application class/import string # and the second being the help string for the subcommand subcommands = Dict() # parse_command_line will initialize a subapp, if requested subapp = Instance('IPython.config.application.Application', allow_none=True) # extra command-line arguments that don't set config values extra_args = List(Unicode) def __init__(self, **kwargs): SingletonConfigurable.__init__(self, **kwargs) # Ensure my class is in self.classes, so my attributes appear in command line # options and config files. if self.__class__ not in self.classes: self.classes.insert(0, self.__class__) def _config_changed(self, name, old, new): SingletonConfigurable._config_changed(self, name, old, new) self.log.debug('Config changed:') self.log.debug(repr(new)) @catch_config_error def initialize(self, argv=None): """Do the basic steps to configure me. Override in subclasses. """ self.parse_command_line(argv) def start(self): """Start the app mainloop. Override in subclasses. """ if self.subapp is not None: return self.subapp.start() def print_alias_help(self): """Print the alias part of the help.""" if not self.aliases: return lines = [] classdict = {} for cls in self._help_classes: # include all parents (up to, but excluding Configurable) in available names for c in cls.mro()[:-3]: classdict[c.__name__] = c for alias, longname in iteritems(self.aliases): classname, traitname = longname.split('.',1) cls = classdict[classname] trait = cls.class_traits(config=True)[traitname] help = cls.class_get_trait_help(trait).splitlines() # reformat first line help[0] = help[0].replace(longname, alias) + ' (%s)'%longname if len(alias) == 1: help[0] = help[0].replace('--%s='%alias, '-%s '%alias) lines.extend(help) # lines.append('') print(os.linesep.join(lines)) def print_flag_help(self): """Print the flag part of the help.""" if not self.flags: return lines = [] for m, (cfg,help) in iteritems(self.flags): prefix = '--' if len(m) > 1 else '-' lines.append(prefix+m) lines.append(indent(dedent(help.strip()))) # lines.append('') print(os.linesep.join(lines)) def print_options(self): if not self.flags and not self.aliases: return lines = ['Options'] lines.append('-'*len(lines[0])) lines.append('') for p in wrap_paragraphs(self.option_description): lines.append(p) lines.append('') print(os.linesep.join(lines)) self.print_flag_help() self.print_alias_help() print() def print_subcommands(self): """Print the subcommand part of the help.""" if not self.subcommands: return lines = ["Subcommands"] lines.append('-'*len(lines[0])) lines.append('') for p in wrap_paragraphs(self.subcommand_description.format( app=self.name)): lines.append(p) lines.append('') for subc, (cls, help) in iteritems(self.subcommands): lines.append(subc) if help: lines.append(indent(dedent(help.strip()))) lines.append('') print(os.linesep.join(lines)) def print_help(self, classes=False): """Print the help for each Configurable class in self.classes. If classes=False (the default), only flags and aliases are printed. """ self.print_description() self.print_subcommands() self.print_options() if classes: help_classes = self._help_classes if help_classes: print("Class parameters") print("----------------") print() for p in wrap_paragraphs(self.keyvalue_description): print(p) print() for cls in help_classes: cls.class_print_help() print() else: print("To see all available configurables, use `--help-all`") print() self.print_examples() def print_description(self): """Print the application description.""" for p in wrap_paragraphs(self.description): print(p) print() def print_examples(self): """Print usage and examples. This usage string goes at the end of the command line help string and should contain examples of the application's usage. """ if self.examples: print("Examples") print("--------") print() print(indent(dedent(self.examples.strip()))) print() def print_version(self): """Print the version string.""" print(self.version) def update_config(self, config): """Fire the traits events when the config is updated.""" # Save a copy of the current config. newconfig = deepcopy(self.config) # Merge the new config into the current one. newconfig.merge(config) # Save the combined config as self.config, which triggers the traits # events. self.config = newconfig @catch_config_error def initialize_subcommand(self, subc, argv=None): """Initialize a subcommand with argv.""" subapp,help = self.subcommands.get(subc) if isinstance(subapp, string_types): subapp = import_item(subapp) # clear existing instances self.__class__.clear_instance() # instantiate self.subapp = subapp.instance(config=self.config) # and initialize subapp self.subapp.initialize(argv) def flatten_flags(self): """flatten flags and aliases, so cl-args override as expected. This prevents issues such as an alias pointing to InteractiveShell, but a config file setting the same trait in TerminalInteraciveShell getting inappropriate priority over the command-line arg. Only aliases with exactly one descendent in the class list will be promoted. """ # build a tree of classes in our list that inherit from a particular # it will be a dict by parent classname of classes in our list # that are descendents mro_tree = defaultdict(list) for cls in self._help_classes: clsname = cls.__name__ for parent in cls.mro()[1:-3]: # exclude cls itself and Configurable,HasTraits,object mro_tree[parent.__name__].append(clsname) # flatten aliases, which have the form: # { 'alias' : 'Class.trait' } aliases = {} for alias, cls_trait in iteritems(self.aliases): cls,trait = cls_trait.split('.',1) children = mro_tree[cls] if len(children) == 1: # exactly one descendent, promote alias cls = children[0] aliases[alias] = '.'.join([cls,trait]) # flatten flags, which are of the form: # { 'key' : ({'Cls' : {'trait' : value}}, 'help')} flags = {} for key, (flagdict, help) in iteritems(self.flags): newflag = {} for cls, subdict in iteritems(flagdict): children = mro_tree[cls] # exactly one descendent, promote flag section if len(children) == 1: cls = children[0] newflag[cls] = subdict flags[key] = (newflag, help) return flags, aliases @catch_config_error def parse_command_line(self, argv=None): """Parse the command line arguments.""" argv = sys.argv[1:] if argv is None else argv self.argv = [ py3compat.cast_unicode(arg) for arg in argv ] if argv and argv[0] == 'help': # turn `ipython help notebook` into `ipython notebook -h` argv = argv[1:] + ['-h'] if self.subcommands and len(argv) > 0: # we have subcommands, and one may have been specified subc, subargv = argv[0], argv[1:] if re.match(r'^\w(\-?\w)*$', subc) and subc in self.subcommands: # it's a subcommand, and *not* a flag or class parameter return self.initialize_subcommand(subc, subargv) # Arguments after a '--' argument are for the script IPython may be # about to run, not IPython iteslf. For arguments parsed here (help and # version), we want to only search the arguments up to the first # occurrence of '--', which we're calling interpreted_argv. try: interpreted_argv = argv[:argv.index('--')] except ValueError: interpreted_argv = argv if any(x in interpreted_argv for x in ('-h', '--help-all', '--help')): self.print_help('--help-all' in interpreted_argv) self.exit(0) if '--version' in interpreted_argv or '-V' in interpreted_argv: self.print_version() self.exit(0) # flatten flags&aliases, so cl-args get appropriate priority: flags,aliases = self.flatten_flags() loader = KVArgParseConfigLoader(argv=argv, aliases=aliases, flags=flags, log=self.log) config = loader.load_config() self.update_config(config) # store unparsed args in extra_args self.extra_args = loader.extra_args @classmethod def _load_config_files(cls, basefilename, path=None, log=None): """Load config files (py,json) by filename and path. yield each config object in turn. """ if not isinstance(path, list): path = [path] for path in path[::-1]: # path list is in descending priority order, so load files backwards: pyloader = PyFileConfigLoader(basefilename+'.py', path=path, log=log) jsonloader = JSONFileConfigLoader(basefilename+'.json', path=path, log=log) config = None for loader in [pyloader, jsonloader]: try: config = loader.load_config() except ConfigFileNotFound: pass except Exception: # try to get the full filename, but it will be empty in the # unlikely event that the error raised before filefind finished filename = loader.full_filename or basefilename # problem while running the file if log: log.error("Exception while loading config file %s", filename, exc_info=True) else: if log: log.debug("Loaded config file: %s", loader.full_filename) if config: yield config raise StopIteration @catch_config_error def load_config_file(self, filename, path=None): """Load config files by filename and path.""" filename, ext = os.path.splitext(filename) loaded = [] for config in self._load_config_files(filename, path=path, log=self.log): loaded.append(config) self.update_config(config) if len(loaded) > 1: collisions = loaded[0].collisions(loaded[1]) if collisions: self.log.warn("Collisions detected in {0}.py and {0}.json config files." " {0}.json has higher priority: {1}".format( filename, json.dumps(collisions, indent=2), )) def generate_config_file(self): """generate default config file from Configurables""" lines = ["# Configuration file for %s."%self.name] lines.append('') lines.append('c = get_config()') lines.append('') for cls in self._config_classes: lines.append(cls.class_config_section()) return '\n'.join(lines) def exit(self, exit_status=0): self.log.debug("Exiting application: %s" % self.name) sys.exit(exit_status) @classmethod def launch_instance(cls, argv=None, **kwargs): """Launch a global instance of this Application If a global instance already exists, this reinitializes and starts it """ app = cls.instance(**kwargs) app.initialize(argv) app.start() #----------------------------------------------------------------------------- # utility functions, for convenience #----------------------------------------------------------------------------- def boolean_flag(name, configurable, set_help='', unset_help=''): """Helper for building basic --trait, --no-trait flags. Parameters ---------- name : str The name of the flag. configurable : str The 'Class.trait' string of the trait to be set/unset with the flag set_help : unicode help string for --name flag unset_help : unicode help string for --no-name flag Returns ------- cfg : dict A dict with two keys: 'name', and 'no-name', for setting and unsetting the trait, respectively. """ # default helpstrings set_help = set_help or "set %s=True"%configurable unset_help = unset_help or "set %s=False"%configurable cls,trait = configurable.split('.') setter = {cls : {trait : True}} unsetter = {cls : {trait : False}} return {name : (setter, set_help), 'no-'+name : (unsetter, unset_help)} def get_config(): """Get the config object for the global Application instance, if there is one otherwise return an empty config object """ if Application.initialized(): return Application.instance().config else: return Config()
{'content_hash': '45ed8885366010979a0aa3115159394a', 'timestamp': '', 'source': 'github', 'line_count': 620, 'max_line_length': 111, 'avg_line_length': 36.68709677419355, 'alnum_prop': 0.5881913303437967, 'repo_name': 'wolfram74/numerical_methods_iserles_notes', 'id': '264d3793a1fa0594c1478b5ce9d10c81c8cc6a98', 'size': '22764', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'venv/lib/python2.7/site-packages/IPython/config/application.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '282435'}, {'name': 'C++', 'bytes': '59801'}, {'name': 'CSS', 'bytes': '2038'}, {'name': 'FORTRAN', 'bytes': '3707'}, {'name': 'Groff', 'bytes': '6753'}, {'name': 'HTML', 'bytes': '37522'}, {'name': 'JavaScript', 'bytes': '1368241'}, {'name': 'Python', 'bytes': '31296026'}, {'name': 'Shell', 'bytes': '3869'}, {'name': 'Smarty', 'bytes': '21425'}, {'name': 'XSLT', 'bytes': '366202'}]}
<?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.github.ckwen</groupId> <artifactId>je-spring-boot</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>je-spring-boot-mybatis</artifactId> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> </dependencies> </project>
{'content_hash': '989fee8c7baa01a7972347fe2942e285', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 107, 'avg_line_length': 28.896551724137932, 'alnum_prop': 0.7243436754176611, 'repo_name': 'ckwen/je', 'id': 'd6e0e7b772b1d308df6988c5efd5f1f9307c2bc5', 'size': '838', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'je-spring-boot/je-spring-boot-mybatis/pom.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '817'}, {'name': 'Java', 'bytes': '464120'}, {'name': 'Shell', 'bytes': '3556'}]}
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{'content_hash': '2315f4371382f998d150d3e53b37d521', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 10.23076923076923, 'alnum_prop': 0.6917293233082706, 'repo_name': 'mdoering/backbone', 'id': 'd1a9c835d4042ef923373f03f2d98519627dcebf', 'size': '190', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Krigia/Krigia montana/ Syn. Adopogon montanus/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Dependator.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Dependator.Core")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7a3f556e-480c-40d5-ac15-394de9b39b69")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{'content_hash': '951f1bb3fa982c5a980fb91beae1a170', 'timestamp': '', 'source': 'github', 'line_count': 36, 'max_line_length': 84, 'avg_line_length': 38.97222222222222, 'alnum_prop': 0.744832501781896, 'repo_name': 'dmitry-merzlyakov/dependator', 'id': 'dd2627ea018a4771554857ed8d19360851c9a06e', 'size': '1406', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Dependator.Core/Properties/AssemblyInfo.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '309'}, {'name': 'C#', 'bytes': '38855'}]}
/* * Returns array of CSV headers * Used for data column selection */ function getCSVFields(callback, CSV) { var dataset = Papa.parse(CSV, { download: true, complete: function(results) { return parseFields(results.data, callback); } }); } /* * Parse fields from papa parsed object */ function parseFields(data, callback) { fields = []; fields.push({ name: "None", id: "none" }); for (var i = 0; i < data[0].length; i++) { var field = data[0][i]; fields.push({ name: field, id: field, key: field }); } callback(fields); } function updateZoom() { var scale = zoom.scale(); layer.attr("transform", "translate(" + zoom.translate() + ") " + "scale(" + [scale, scale] + ")"); } /* * Loads topojson in and sets regions */ function initTopo() { var features = carto.features(topology, geometries), path = d3.geo.path() .projection(proj); states = states.data(features) .enter() .append("path") .attr("class", "state") .attr("id", function(d) { return d.properties.NAME; }) .attr("fill", "#fff") .attr("d", path); states.append("title"); parseHash(); } /* * Original graph that is loaded */ function reset() { body.classed("updating", false); var features = carto.features(topology, geometries), path = d3.geo.path() .projection(proj); states.data(features) .transition() .duration(750) .ease("linear") .attr("fill", "#fff") .attr("d", path); states.select("title") .text(function(d) { return d.properties.NAME; }); } /* * Empty the CSV column input menu */ function clearMenu() { var select = document.getElementById("field"); select.options.length = 0; } /* * Anything that needs to be periodically updated getCSVFields * run in here */ function update() { // Current column being rendered var key = field.key; var fmt = (typeof field.format === "function") ? field.format : d3.format(field.format || ","), value = function(d) { return +d.properties[key]; }, values = states.data() .map(value) .filter(function(n) { return !isNaN(n); }) .sort(d3.ascending), lo = values[0], hi = values[values.length - 1]; // Sets color based off selecte data var color = d3.scale.linear() .range(colors) .domain(lo < 0 ? [lo, 0, hi] : [lo, d3.mean(values), hi]); // Normalize the scale to positive numbers var scale = d3.scale.linear() .domain([lo, hi]) .range([1, 1000]); // Cartogram to use the scaled values carto.value(function(d) { return scale(value(d)); }); // Generate the new features, pre-projected var features = carto(topology, geometries).features; // Update the data on the D3 visualization states.data(features) .select("title") .text(function(d) { return [d.properties.NAME, fmt(value(d))].join(": "); }); // Animation to make it not jump states.transition() .duration(750) .ease("linear") .attr("fill", function(d) { return color(value(d)); }) .attr("d", carto.path); } /* * Gets application data from url hash */ function parseHash(fieldsById) { var parts = location.hash.substr(1).split("/"), desiredFieldId = parts[0], desiredYear = +parts[1]; var field = fieldsById[desiredFieldId] || fields[0]; fieldSelect.property("selectedIndex", fields.indexOf(field)); if (field.id === "none") { reset(); } else { deferredUpdate(); } location.replace("#" + field.id); hashish.attr("href", function(href) { return href + location.hash; }); }
{'content_hash': '06e6ddd1198fb9759858ab15a26d8e95', 'timestamp': '', 'source': 'github', 'line_count': 173, 'max_line_length': 66, 'avg_line_length': 23.248554913294797, 'alnum_prop': 0.5445052212829438, 'repo_name': 'CaseyHillers/cartograms4all', 'id': '5853fd031eb7d4abbe8bed51397a75c5b1fd4b04', 'size': '4022', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/js/functions.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '879'}, {'name': 'HTML', 'bytes': '9412'}, {'name': 'JavaScript', 'bytes': '37560'}, {'name': 'PHP', 'bytes': '4106'}]}
<h3 id="installation">Installation</h3> <p>I’d strongly recommend you to fork <a href="http://github.com/bk2dcradle/accent">accent</a> and use the “upstream” strategy described on <a href="https://help.github.com/articles/fork-a-repo/">this page</a> to keep accent up to date.</p> <p>If you don’t want to do that, just clone <a href="http://github.com/bk2dcradle/accent">accent</a> and use</p> <div class="highlight"><pre><code class="language-bash" data-lang="bash">bundle <span class="nb">exec </span>jekyll serve</code></pre></div> <p>in the root of the accent directory, or, simply <a href="https://github.com/bk2dcradle/accent/archive/gh-pages.zip">download</a> accent.</p> <h3 id="customization">Customization</h3> <p>You can edit the variables in <code>_config.yml</code> as per your needs. Edit only the variables under the section marked <em>User Settings</em>.</p> <p>Most of the variables are self explanatory. Notes about few of the non obvious ones:</p> <ol> <li> <p>You can change the <strong>hex value</strong> of the variable <code>$accent-color</code> in <code>_sass/_style.scss</code> to any color value that you want. This will change the accent of the theme.</p> </li> <li> <p>Set <code>intro</code> to <code>true</code> to reveal a short bio section on the index page.</p> </li> <li> <p>Setting <code>about_footer</code> to <em>true</em> or <em>false</em> will turn the <code>about</code> section at the bottom of every post to <em>on</em> or <em>off</em> respectively.</p> </li> <li> <p><code>description</code> is the summary that will show up in places like facebook thumbnails, twitter cards and google search results.</p> </li> </ol> <p><em>Note:</em> Don’t change any variable under <em>Build Settings</em>.</p> <hr /> <h3 id="usage">Usage</h3> <ul> <li>To create a new post, simply save the <code>.markdown</code> file in the <code>_posts</code> directory in the format.</li> </ul> <div class="highlight"><pre><code class="language-text" data-lang="text">year-month-day-name-of-the-file.markdown</code></pre></div> <ul> <li> <p>For Syntax highlighting, accent uses <em>Rouge</em> which is the default highlighter in Jekyll 3 and above. If you don’t know how to highlight a code block, <a href="http://jekyllrb.com/docs/templates/">refer</a>.</p> </li> <li> <p>To set up Google Analytics tracking id, just set the <code>tracking_id</code> variable in <code>_config.yml</code>.</p> </li> <li> <p>For comments, <em>accent</em> uses <a class="button disabled">Disqus</a>. To set comments on your site, just paste the <strong>universal code</strong> in <code>_includes/disqus.html</code>.</p> </li> </ul> <hr /> <h3 id="license">License</h3> <p><a href="https://github.com/bk2dcradle/accent/blob/gh-pages/LICENSE">MIT</a>. Copyright © <a href="http://twitter.com/AnkitSultana">Ankit Sultana</a></p>
{'content_hash': 'e1b1b14137cf65b698df060ef49d6312', 'timestamp': '', 'source': 'github', 'line_count': 63, 'max_line_length': 224, 'avg_line_length': 45.98412698412698, 'alnum_prop': 0.6886434242319641, 'repo_name': 'vigor95/vigor95.github.io', 'id': '1d37dd2747ebe5dd102fec9012379d07af83cfbe', 'size': '2910', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_site/documentation.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '20363'}, {'name': 'HTML', 'bytes': '112738'}]}
<?php class HomeController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { // action body } }
{'content_hash': '621d855017737e17cff0e494d97cab61', 'timestamp': '', 'source': 'github', 'line_count': 18, 'max_line_length': 51, 'avg_line_length': 12.444444444444445, 'alnum_prop': 0.5892857142857143, 'repo_name': 'leomastakusuma/Zend-Framework', 'id': '2bbb5f1cafaf3777bfad332b0d044120130ac128', 'size': '224', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'application/controllers/HomeController.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '11619'}, {'name': 'JavaScript', 'bytes': '2843'}, {'name': 'PHP', 'bytes': '62610'}]}
/** * Author : Aman Gupta * Email Id : [email protected] * Design Pattern : Filter */ package com.example.pattern.filter; import java.util.List; /** * @author Aman Gupta ([email protected]) * @version 1.0 */ public class AndCriteria implements Criteria { private Criteria firstCriteria; private Criteria secondCriteria; public AndCriteria(Criteria firstCriteria, Criteria secondCriteria) { this.firstCriteria = firstCriteria; this.secondCriteria = secondCriteria; } @Override public List<Person> meetCriteria(List<Person> persons) { List<Person> firstCriteriaPersons = firstCriteria.meetCriteria(persons); return secondCriteria.meetCriteria(firstCriteriaPersons); } }
{'content_hash': '883bf31e6844d0bbcee484477aabdc58', 'timestamp': '', 'source': 'github', 'line_count': 31, 'max_line_length': 74, 'avg_line_length': 23.70967741935484, 'alnum_prop': 0.7251700680272108, 'repo_name': 'AmanGupta-2210/com.example.designpatterns', 'id': '21824f547bb45867f071c8604096e3c118adea03', 'size': '735', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'com.example.designpatterns/src/main/java/com/example/pattern/filter/AndCriteria.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '86031'}]}
var transparent = false; var antialias = false; var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', this, transparent, antialias); function preload() { game.load.image('girl', 'assets/pics/manga-girl.png'); } function create() { game.stage.backgroundColor = '#0076a3'; var sprite = game.add.sprite(32, -100, 'girl'); sprite.scale.set(4); } function render () { game.debug.text("Anti-alias: " + game.antialias, 10, 32); // game.debug.text("Anti-alias: " + Phaser.Canvas.getSmoothingEnabled(game.context), 10, 32); // game.debug.text("Anti-alias: " + game.renderer.renderSession.smoothProperty, 10, 32); }
{'content_hash': '9be49d364761502b6411c82f5dac98ee', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 100, 'avg_line_length': 24.48148148148148, 'alnum_prop': 0.6671709531013615, 'repo_name': 'gerardogrimaldi/gerardogrimaldi.github.io', 'id': '6a4b53d7d2e818781ad7c42954539adebfbb2dd7', 'size': '662', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'phaser-examples-master/examples/misc/antialias game.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '54787'}, {'name': 'GLSL', 'bytes': '2028'}, {'name': 'HTML', 'bytes': '85868'}, {'name': 'JavaScript', 'bytes': '11364753'}, {'name': 'PHP', 'bytes': '204019'}]}
namespace SomeTest { public class Class1 { public bool isCalled { get; set; } public void Log(string message) { this.isCalled = true; } } public static class ClassTest { public static bool hm { get; set; } public static void SomeMethod() { var logger = new Class1(); logger.Log("aaff"); hm = logger.isCalled; } } }
{'content_hash': '5d674a677255c2dfc4b78e18e96799eb', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 43, 'avg_line_length': 18.916666666666668, 'alnum_prop': 0.4911894273127753, 'repo_name': 'iliyaST/TelerikAcademy', 'id': 'cb9fdc82f48cfec6b70e4f44b758fc22614ec390', 'size': '456', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'OOP/7-Exams/Some-Test/SomeTest/TEst/SomeTest.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '303'}, {'name': 'C#', 'bytes': '2931171'}, {'name': 'CSS', 'bytes': '169885'}, {'name': 'CoffeeScript', 'bytes': '1076'}, {'name': 'HTML', 'bytes': '8977397'}, {'name': 'JavaScript', 'bytes': '1658788'}, {'name': 'PLSQL', 'bytes': '4342'}]}
package org.jboss.hal.client.configuration.subsystem.infinispan; import java.util.List; import elemental2.dom.HTMLElement; import org.jboss.gwt.elemento.core.Elements; import org.jboss.gwt.elemento.core.IsElement; import org.jboss.hal.ballroom.Attachable; import org.jboss.hal.ballroom.EmptyState; import org.jboss.hal.ballroom.form.Form; import org.jboss.hal.core.mbui.form.ModelNodeForm; import org.jboss.hal.core.mvp.HasPresenter; import org.jboss.hal.dmr.ModelNode; import org.jboss.hal.dmr.Property; import org.jboss.hal.meta.Metadata; import org.jboss.hal.meta.MetadataRegistry; import org.jboss.hal.resources.Ids; import org.jboss.hal.resources.Names; import org.jboss.hal.resources.Resources; import static org.jboss.gwt.elemento.core.Elements.div; import static org.jboss.gwt.elemento.core.Elements.h; import static org.jboss.gwt.elemento.core.Elements.p; import static org.jboss.hal.dmr.ModelDescriptionConstants.NONE; /** * Element to view and modify the {@code transport=jgroups} singleton of a cache container. Kind of a fail safe form * with the difference that we need to take care of {@code transport=none}. */ class TransportElement implements IsElement<HTMLElement>, Attachable, HasPresenter<CacheContainerPresenter> { private final EmptyState emptyState; private final Form<ModelNode> form; private final HTMLElement root; private CacheContainerPresenter presenter; TransportElement(MetadataRegistry metadataRegistry, Resources resources) { emptyState = new EmptyState.Builder(Ids.CACHE_CONTAINER_TRANSPORT_EMPTY, resources.constants().noTransport()) .description(resources.messages().noTransport()) .primaryAction(resources.constants().add(), () -> presenter.addJgroups()) .build(); Metadata metadata = metadataRegistry.lookup(AddressTemplates.TRANSPORT_JGROUPS_TEMPLATE); form = new ModelNodeForm.Builder<>(Ids.CACHE_CONTAINER_TRANSPORT_FORM, metadata) .onSave((f, changedValues) -> presenter.saveJgroups(changedValues)) .prepareReset(f -> presenter.resetJgroups(f)) .build(); root = div() .add(h(1).textContent(Names.JGROUPS)) .add(p().textContent(metadata.getDescription().getDescription())) .add(emptyState) .add(form).element(); Elements.setVisible(emptyState.element(), false); Elements.setVisible(form.element(), false); } @Override public HTMLElement element() { return root; } @Override public void attach() { form.attach(); } @Override public void detach() { form.detach(); } @Override public void setPresenter(CacheContainerPresenter presenter) { this.presenter = presenter; } void update(List<Property> transports) { if (transports.isEmpty() || NONE.equals(transports.get(0).getName())) { emptyStateMode(); } else { formMode(); form.view(transports.get(0).getValue()); } } private void emptyStateMode() { Elements.setVisible(emptyState.element(), true); Elements.setVisible(form.element(), false); } private void formMode() { Elements.setVisible(emptyState.element(), false); Elements.setVisible(form.element(), true); } }
{'content_hash': '771d1ac0cd705c756016d6816d47a762', 'timestamp': '', 'source': 'github', 'line_count': 100, 'max_line_length': 117, 'avg_line_length': 34.2, 'alnum_prop': 0.6824561403508772, 'repo_name': 'hpehl/hal.next', 'id': '6fc72a9d4a69a36e52d8ecec75dbebf8173c9379', 'size': '4047', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'app/src/main/java/org/jboss/hal/client/configuration/subsystem/infinispan/TransportElement.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '28923'}, {'name': 'FreeMarker', 'bytes': '10423'}, {'name': 'HTML', 'bytes': '113886'}, {'name': 'Java', 'bytes': '1389150'}, {'name': 'JavaScript', 'bytes': '4311'}, {'name': 'Shell', 'bytes': '633'}]}
use "Northwind" /*Select (ord.UnitPrice * ord.Quantity) - (ord.UnitPrice*ord.Quantity * Discount) as TotalPrice, * from dbo."Order Details" as ord*/ Select SUM((ord.UnitPrice * ord.Quantity) - (ord.UnitPrice*ord.Quantity * Discount)) as Totals from dbo."Order Details" as ord
{'content_hash': '5c3b2e942689df81892fa8aaa0bd5ba6', 'timestamp': '', 'source': 'github', 'line_count': 3, 'max_line_length': 133, 'avg_line_length': 92.66666666666667, 'alnum_prop': 0.7302158273381295, 'repo_name': 'AlexOAnder/AdvancedCSharpStudy', 'id': '3018c3e5f217939c2f3f329fe7844483ce9bea0b', 'size': '280', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Lesson5Sql/Database1/Database1/Script-211.sql', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '104'}, {'name': 'C#', 'bytes': '482053'}, {'name': 'CSS', 'bytes': '1139'}, {'name': 'JavaScript', 'bytes': '233639'}, {'name': 'PLpgSQL', 'bytes': '812'}]}
from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance attributes. :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop("api_version", "2022-04-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-monitor/{}".format(VERSION)) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( self.credential, *self.credential_scopes, **kwargs )
{'content_hash': '77cfe1e8589f0bdad182d5bb0cb1a915', 'timestamp': '', 'source': 'github', 'line_count': 58, 'max_line_length': 107, 'avg_line_length': 53.05172413793103, 'alnum_prop': 0.7195320116997075, 'repo_name': 'Azure/azure-sdk-for-python', 'id': '077f9e2dcc34ad352c3aebb5c9a374128b5d5292', 'size': '3545', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_04_01/aio/_configuration.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '1224'}, {'name': 'Bicep', 'bytes': '24196'}, {'name': 'CSS', 'bytes': '6089'}, {'name': 'Dockerfile', 'bytes': '4892'}, {'name': 'HTML', 'bytes': '12058'}, {'name': 'JavaScript', 'bytes': '8137'}, {'name': 'Jinja', 'bytes': '10377'}, {'name': 'Jupyter Notebook', 'bytes': '272022'}, {'name': 'PowerShell', 'bytes': '518535'}, {'name': 'Python', 'bytes': '715484989'}, {'name': 'Shell', 'bytes': '3631'}]}
(function() { /** * Wedge constructor * @constructor * @augments Kinetic.Shape * @param {Object} config * @param {Number} config.angle in degrees * @param {Number} config.radius * @param {Boolean} [config.clockwise] * @@shapeParams * @@nodeParams * @example * // draw a wedge that's pointing downwards * var wedge = new Kinetic.Wedge({ * radius: 40, * fill: 'red', * stroke: 'black' * strokeWidth: 5, * angleDeg: 60, * rotationDeg: -120 * }); */ Kinetic.Wedge = function(config) { this.___init(config); }; Kinetic.Wedge.prototype = { ___init: function(config) { // call super constructor Kinetic.Shape.call(this, config); this.className = 'Wedge'; this.sceneFunc(this._sceneFunc); }, _sceneFunc: function(context) { context.beginPath(); context.arc(0, 0, this.getRadius(), 0, Kinetic.getAngle(this.getAngle()), this.getClockwise()); context.lineTo(0, 0); context.closePath(); context.fillStrokeShape(this); } }; Kinetic.Util.extend(Kinetic.Wedge, Kinetic.Shape); // add getters setters Kinetic.Factory.addGetterSetter(Kinetic.Wedge, 'radius', 0); /** * get/set radius * @name radius * @method * @memberof Kinetic.Wedge.prototype * @param {Number} radius * @returns {Number} * @example * // get radius * var radius = wedge.radius(); * * // set radius * wedge.radius(10); */ Kinetic.Factory.addGetterSetter(Kinetic.Wedge, 'angle', 0); /** * get/set angle in degrees * @name angle * @method * @memberof Kinetic.Wedge.prototype * @param {Number} angle * @returns {Number} * @example * // get angle * var angle = wedge.angle(); * * // set angle * wedge.angle(20); */ Kinetic.Factory.addGetterSetter(Kinetic.Wedge, 'clockwise', false); /** * get/set clockwise flag * @name clockwise * @method * @memberof Kinetic.Wedge.prototype * @param {Number} clockwise * @returns {Number} * @example * // get clockwise flag * var clockwise = wedge.clockwise(); * * // draw wedge counter-clockwise * wedge.clockwise(false); * * // draw wedge clockwise * wedge.clockwise(true); */ Kinetic.Factory.backCompat(Kinetic.Wedge, { angleDeg: 'angle', getAngleDeg: 'getAngle', setAngleDeg: 'setAngle' }); Kinetic.Collection.mapMethods(Kinetic.Wedge); })();
{'content_hash': '1ad806863265331f7ecdb43285f3a016', 'timestamp': '', 'source': 'github', 'line_count': 106, 'max_line_length': 107, 'avg_line_length': 25.433962264150942, 'alnum_prop': 0.5515578635014837, 'repo_name': 'xixizhang96/Example', 'id': '946ff578dadc54fea3027c9c0f21e7d61a5530da', 'size': '2696', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'imoocstudy/KineticJS-master/src/shapes/Wedge.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '637'}, {'name': 'CSS', 'bytes': '600771'}, {'name': 'HTML', 'bytes': '3354834'}, {'name': 'Hack', 'bytes': '92'}, {'name': 'Java', 'bytes': '1049028'}, {'name': 'JavaScript', 'bytes': '8414678'}, {'name': 'PHP', 'bytes': '156518'}, {'name': 'Ruby', 'bytes': '1119'}, {'name': 'Smarty', 'bytes': '172'}, {'name': 'TypeScript', 'bytes': '123'}, {'name': 'Vue', 'bytes': '483715'}]}
package io.cloudslang.content.nutanix.prism.actions.tasks; import com.hp.oo.sdk.content.annotations.Action; import com.hp.oo.sdk.content.annotations.Output; import com.hp.oo.sdk.content.annotations.Param; import com.hp.oo.sdk.content.annotations.Response; import com.jayway.jsonpath.JsonPath; import io.cloudslang.content.constants.ReturnCodes; import io.cloudslang.content.nutanix.prism.entities.NutanixCommonInputs; import io.cloudslang.content.nutanix.prism.entities.NutanixGetTaskDetailsInputs; import io.cloudslang.content.utils.StringUtilities; import java.util.List; import java.util.Map; import static com.hp.oo.sdk.content.plugin.ActionMetadata.MatchType.COMPARE_EQUAL; import static com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType.ERROR; import static com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType.RESOLVED; import static io.cloudslang.content.constants.OutputNames.*; import static io.cloudslang.content.constants.ResponseNames.FAILURE; import static io.cloudslang.content.constants.ResponseNames.SUCCESS; import static io.cloudslang.content.httpclient.entities.HttpClientInputs.*; import static io.cloudslang.content.nutanix.prism.services.TaskImpl.getTaskDetails; import static io.cloudslang.content.nutanix.prism.utils.Constants.Common.*; import static io.cloudslang.content.nutanix.prism.utils.Constants.GetTaskDetailsConstants.*; import static io.cloudslang.content.nutanix.prism.utils.Descriptions.Common.*; import static io.cloudslang.content.nutanix.prism.utils.Descriptions.GetTaskDetails.*; import static io.cloudslang.content.nutanix.prism.utils.HttpUtils.*; import static io.cloudslang.content.nutanix.prism.utils.Inputs.CommonInputs.PASSWORD; import static io.cloudslang.content.nutanix.prism.utils.Inputs.CommonInputs.PROXY_HOST; import static io.cloudslang.content.nutanix.prism.utils.Inputs.CommonInputs.PROXY_PASSWORD; import static io.cloudslang.content.nutanix.prism.utils.Inputs.CommonInputs.PROXY_PORT; import static io.cloudslang.content.nutanix.prism.utils.Inputs.CommonInputs.PROXY_USERNAME; import static io.cloudslang.content.nutanix.prism.utils.Inputs.CommonInputs.USERNAME; import static io.cloudslang.content.nutanix.prism.utils.Inputs.CommonInputs.*; import static io.cloudslang.content.nutanix.prism.utils.Inputs.GetTaskDetailsInputs.INCLUDE_SUBTASKS_INFO; import static io.cloudslang.content.nutanix.prism.utils.Inputs.GetTaskDetailsInputs.TASK_UUID; import static io.cloudslang.content.nutanix.prism.utils.InputsValidation.verifyCommonInputs; import static io.cloudslang.content.nutanix.prism.utils.Outputs.GetTaskDetailsOutputs.TASK_STATUS; import static io.cloudslang.content.nutanix.prism.utils.Outputs.GetTaskDetailsOutputs.VM_UUID; import static io.cloudslang.content.utils.OutputUtilities.getFailureResultsMap; import static org.apache.commons.lang3.StringUtils.*; public class GetTaskDetails { @Action(name = GET_TASK_DETAILS_OPERATION_NAME, description = GET_TASK_DETAILS_OPERATION_DESC, outputs = { @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC), @Output(value = EXCEPTION, description = EXCEPTION_DESC), @Output(value = STATUS_CODE, description = STATUS_CODE_DESC), @Output(value = VM_UUID, description = VM_UUID_DESC), @Output(value = TASK_STATUS, description = TASK_STATUS_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = SUCCESS_DESC), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = FAILURE_DESC)}) public Map<String, String> execute(@Param(value = HOSTNAME, required = true, description = HOSTNAME_DESC) String hostname, @Param(value = PORT, description = PORT_DESC) String port, @Param(value = USERNAME, required = true, description = USERNAME_DESC) String username, @Param(value = PASSWORD, encrypted = true, required = true, description = PASSWORD_DESC) String password, @Param(value = TASK_UUID, required = true, description = TASK_UUID_DESC) String taskUUID, @Param(value = INCLUDE_SUBTASKS_INFO, description = INCLUDE_SUBTASKS_INFO_DESC) String includeSubtasksInfo, @Param(value = API_VERSION, description = API_VERSION_DESC) String apiVersion, @Param(value = PROXY_HOST, description = PROXY_HOST_DESC) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESC) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESC) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true, description = PROXY_PASSWORD_DESC) String proxyPassword, @Param(value = TRUST_ALL_ROOTS, description = TRUST_ALL_ROOTS_DESC) String trustAllRoots, @Param(value = X509_HOSTNAME_VERIFIER, description = X509_DESC) String x509HostnameVerifier, @Param(value = TRUST_KEYSTORE, description = TRUST_KEYSTORE_DESC) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true, description = TRUST_PASSWORD_DESC) String trustPassword, @Param(value = CONNECT_TIMEOUT, description = CONNECT_TIMEOUT_DESC) String connectTimeout, @Param(value = SOCKET_TIMEOUT, description = SOCKET_TIMEOUT_DESC) String socketTimeout, @Param(value = KEEP_ALIVE, description = KEEP_ALIVE_DESC) String keepAlive, @Param(value = CONNECTIONS_MAX_PER_ROUTE, description = CONN_MAX_ROUTE_DESC) String connectionsMaxPerRoute, @Param(value = CONNECTIONS_MAX_TOTAL, description = CONN_MAX_TOTAL_DESC) String connectionsMaxTotal) { port = defaultIfEmpty(port, DEFAULT_NUTANIX_PORT); apiVersion = defaultIfEmpty(apiVersion, DEFAULT_API_VERSION); proxyHost = defaultIfEmpty(proxyHost, EMPTY); proxyPort = defaultIfEmpty(proxyPort, DEFAULT_PROXY_PORT); proxyUsername = defaultIfEmpty(proxyUsername, EMPTY); proxyPassword = defaultIfEmpty(proxyPassword, EMPTY); trustAllRoots = defaultIfEmpty(trustAllRoots, BOOLEAN_FALSE); includeSubtasksInfo = defaultIfEmpty(includeSubtasksInfo, BOOLEAN_FALSE); x509HostnameVerifier = defaultIfEmpty(x509HostnameVerifier, STRICT); trustKeystore = defaultIfEmpty(trustKeystore, DEFAULT_JAVA_KEYSTORE); trustPassword = defaultIfEmpty(trustPassword, CHANGEIT); connectTimeout = defaultIfEmpty(connectTimeout, CONNECT_TIMEOUT_CONST); socketTimeout = defaultIfEmpty(socketTimeout, ZERO); keepAlive = defaultIfEmpty(keepAlive, BOOLEAN_TRUE); connectionsMaxPerRoute = defaultIfEmpty(connectionsMaxPerRoute, CONNECTIONS_MAX_PER_ROUTE_CONST); connectionsMaxTotal = defaultIfEmpty(connectionsMaxTotal, CONNECTIONS_MAX_TOTAL_CONST); final List<String> exceptionMessage = verifyCommonInputs(proxyPort, trustAllRoots, connectTimeout, socketTimeout, keepAlive, connectionsMaxPerRoute, connectionsMaxTotal); if (!exceptionMessage.isEmpty()) { return getFailureResultsMap(StringUtilities.join(exceptionMessage, NEW_LINE)); } try { final Map<String, String> result = getTaskDetails(NutanixGetTaskDetailsInputs.builder() .taskUUID(taskUUID) .includeSubtasksInfo(includeSubtasksInfo) .commonInputs(NutanixCommonInputs.builder() .hostname(hostname) .port(port) .username(username) .password(password) .apiVersion(apiVersion) .proxyHost(proxyHost) .proxyPort(proxyPort) .proxyUsername(proxyUsername) .proxyPassword(proxyPassword) .trustAllRoots(trustAllRoots) .x509HostnameVerifier(x509HostnameVerifier) .trustKeystore(trustKeystore) .trustPassword(trustPassword) .connectTimeout(connectTimeout) .socketTimeout(socketTimeout) .keepAlive(keepAlive) .connectionsMaxPerRoot(connectionsMaxPerRoute) .connectionsMaxTotal(connectionsMaxTotal) .build()).build()); final String returnMessage = result.get(RETURN_RESULT); final Map<String, String> results = getOperationResults(result, returnMessage, returnMessage, returnMessage); final int statusCode = Integer.parseInt(result.get(STATUS_CODE)); String taskStatus = JsonPath.read(returnMessage, TASK_STATUS_PATH); if (statusCode >= 200 && statusCode < 300) { results.put(TASK_STATUS, taskStatus); } else { return getTaskFailureResults(hostname, statusCode, taskStatus, returnMessage, returnMessage); } return results; } catch (Exception exception) { return getFailureResultsMap(exception); } } }
{'content_hash': '6fc41fd13b03cee76484c8a989175c34', 'timestamp': '', 'source': 'github', 'line_count': 143, 'max_line_length': 146, 'avg_line_length': 70.04195804195804, 'alnum_prop': 0.6592452076677316, 'repo_name': 'CloudSlang/cs-actions', 'id': '10262740d56ddf493568cb4f983d991e4c8cf994', 'size': '10641', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'cs-nutanix-prism/src/main/java/io/cloudslang/content/nutanix/prism/actions/tasks/GetTaskDetails.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '168'}, {'name': 'Java', 'bytes': '10254264'}, {'name': 'Scala', 'bytes': '480429'}, {'name': 'XSLT', 'bytes': '544'}]}
#ifndef D_LCDIntfMock_h #define D_LCDIntfMock_h #include <stdint.h> extern "C" { #include "MockPeriphIO.h" }; enum { LCDINTFMOCK_WRITE_INSTRUCTION_CALL = 1, LCDINTFMOCK_WRITE_DATA_CALL, LCDINTFMOCK_READ_INSTRUCTION_CALL, LCDINTFMOCK_READ_DATA_CALL, LCDINTFMOCK_WAIT_WHILE_BUSY_CALL, LCDINTFMOCK_WAIT_COMPLETE, LCDINTFMOCK_WAIT_TIMEOUT, }; inline void LCDIntfMock_Expect_WriteInstruction(int32_t i) { MockPeriphIO_Expect_Write(LCDINTFMOCK_WRITE_INSTRUCTION_CALL, i); } inline void LCDIntfMock_Expect_WriteData(int32_t d) { MockPeriphIO_Expect_Write(LCDINTFMOCK_WRITE_DATA_CALL, d); } inline void LCDIntfMock_Expect_ReadDataThenReturn(int32_t retVal) { MockPeriphIO_Expect_ReadThenReturn(LCDINTFMOCK_READ_DATA_CALL, retVal); } inline void LCDIntfMock_Expect_ReadInstructionThenReturn(int32_t retVal) { MockPeriphIO_Expect_ReadThenReturn(LCDINTFMOCK_READ_INSTRUCTION_CALL, retVal); } inline void LCDIntfMock_Expect_WaitWhileBusyThenReturn(int32_t retVal) { MockPeriphIO_Expect_ReadThenReturn(LCDINTFMOCK_WAIT_WHILE_BUSY_CALL, retVal); } #endif /* #ifndef D_LCDIntfMock_h */
{'content_hash': 'beab84087dd255e72066a036c8e23ade', 'timestamp': '', 'source': 'github', 'line_count': 51, 'max_line_length': 75, 'avg_line_length': 22.41176470588235, 'alnum_prop': 0.7550306211723534, 'repo_name': 'tkorenko/LCDDriver', 'id': '5f27a0445873cee63d9ece48b9d7e5ba8e5cd227', 'size': '1143', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'tests/LCDDriver/LCDIntfMock.h', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'C', 'bytes': '32786'}, {'name': 'C++', 'bytes': '54613'}, {'name': 'Makefile', 'bytes': '2712'}, {'name': 'Shell', 'bytes': '1414'}]}
<?xml version="1.0" ?><!DOCTYPE TS><TS language="gu_IN" version="2.0"> <defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About Ocoin</source> <translation>બીટકોઈન વિષે</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;Ocoin&lt;/b&gt; version</source> <translation type="unfinished"/> </message> <message> <location line="+57"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"/> </message> <message> <location filename="../aboutdialog.cpp" line="+14"/> <source>Copyright</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Dr. Kimoto Chan</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Double-click to edit address or label</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation type="unfinished"/> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation type="unfinished"/> </message> <message> <location filename="../addressbookpage.cpp" line="+63"/> <source>These are your Ocoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation type="unfinished"/> </message> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>&amp;Copy Address</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a Ocoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Export</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Verify a message to ensure it was signed with a specified Ocoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../addressbookpage.cpp" line="-5"/> <source>These are your Ocoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Copy &amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&amp;Edit</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send &amp;Coins</source> <translation type="unfinished"/> </message> <message> <location line="+260"/> <source>Export Address Book Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <source>(no label)</source> <translation type="unfinished"/> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation type="unfinished"/> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+33"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR BOUNTYCOINS&lt;/b&gt;!</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation type="unfinished"/> </message> <message> <location line="-130"/> <location line="+58"/> <source>Wallet encrypted</source> <translation type="unfinished"/> </message> <message> <location line="-56"/> <source>Ocoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your Ocoins from being stolen by malware infecting your computer.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+42"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation type="unfinished"/> </message> <message> <location line="-54"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <location line="+48"/> <source>The supplied passphrases do not match.</source> <translation type="unfinished"/> </message> <message> <location line="-37"/> <source>Wallet unlock failed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+11"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation type="unfinished"/> </message> </context> <context> <name>OcoinGUI</name> <message> <location filename="../Ocoingui.cpp" line="+233"/> <source>Sign &amp;message...</source> <translation type="unfinished"/> </message> <message> <location line="+280"/> <source>Synchronizing with network...</source> <translation type="unfinished"/> </message> <message> <location line="-349"/> <source>&amp;Overview</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>&amp;Transactions</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Edit the list of stored addresses and labels</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Show the list of addresses for receiving payments</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>E&amp;xit</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Quit application</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Show information about Ocoin</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>&amp;Encrypt Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation type="unfinished"/> </message> <message> <location line="+285"/> <source>Importing blocks from disk...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Reindexing blocks on disk...</source> <translation type="unfinished"/> </message> <message> <location line="-347"/> <source>Send coins to a Ocoin address</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Modify configuration options for Ocoin</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Backup wallet to another location</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>&amp;Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation type="unfinished"/> </message> <message> <location line="-4"/> <source>&amp;Verify message...</source> <translation type="unfinished"/> </message> <message> <location line="-165"/> <location line="+530"/> <source>Ocoin</source> <translation type="unfinished"/> </message> <message> <location line="-530"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+101"/> <source>&amp;Send</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Receive</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Addresses</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>&amp;About Ocoin</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show or hide the main Window</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Encrypt the private keys that belong to your wallet</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Sign messages with your Ocoin addresses to prove you own them</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Verify messages to ensure they were signed with specified Ocoin addresses</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>&amp;File</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Settings</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>&amp;Help</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Tabs toolbar</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <location line="+10"/> <source>[testnet]</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Ocoin client</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+141"/> <source>%n active connection(s) to Ocoin network</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+22"/> <source>No block source available...</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Processed %1 of %2 (estimated) blocks of transaction history.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Processed %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+20"/> <source>%n hour(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n week(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>%1 behind</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Last received block was generated %1 ago.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transactions after this will not yet be visible.</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+70"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="-140"/> <source>Up to date</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Catching up...</source> <translation type="unfinished"/> </message> <message> <location line="+113"/> <source>Confirm transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Sent transaction</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Incoming transaction</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation type="unfinished"/> </message> <message> <location line="+33"/> <location line="+23"/> <source>URI handling</source> <translation type="unfinished"/> </message> <message> <location line="-23"/> <location line="+23"/> <source>URI can not be parsed! This can be caused by an invalid Ocoin address or malformed URI parameters.</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../Ocoin.cpp" line="+111"/> <source>A fatal error occurred. Ocoin can no longer continue safely and will quit.</source> <translation type="unfinished"/> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+104"/> <source>Network Alert</source> <translation type="unfinished"/> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation type="unfinished"/> </message> <message> <location filename="../editaddressdialog.cpp" line="+21"/> <source>New receiving address</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>New sending address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid Ocoin address.</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation type="unfinished"/> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+424"/> <location line="+12"/> <source>Ocoin-Qt</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>version</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>UI options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"/> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Automatically start Ocoin after logging in to the system.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Start Ocoin on system login</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Reset all client options to default.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Reset Options</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>&amp;Network</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Automatically open the Ocoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Connect to the Ocoin network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting Ocoin.</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Whether to show Ocoin addresses in the transaction list or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../optionsdialog.cpp" line="+53"/> <source>default</source> <translation type="unfinished"/> </message> <message> <location line="+130"/> <source>Confirm options reset</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Some settings may require a client restart to take effect.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Do you want to proceed?</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <location line="+9"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting Ocoin.</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation type="unfinished"/> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <location line="+166"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the Ocoin network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"/> </message> <message> <location line="-124"/> <source>Balance:</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation type="unfinished"/> </message> <message> <location line="-78"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+107"/> <source>Immature:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-101"/> <source>Your current balance</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location filename="../overviewpage.cpp" line="+116"/> <location line="+1"/> <source>out of sync</source> <translation type="unfinished"/> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start Ocoin: click-to-pay handler</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Label:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Message:</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation type="unfinished"/> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation type="unfinished"/> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+339"/> <source>N/A</source> <translation type="unfinished"/> </message> <message> <location line="-217"/> <source>Client version</source> <translation type="unfinished"/> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation type="unfinished"/> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Startup time</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>On testnet</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Block chain</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Last block time</source> <translation type="unfinished"/> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Show the Ocoin-Qt help message to get a list with possible Ocoin command-line options.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation type="unfinished"/> </message> <message> <location line="-260"/> <source>Build date</source> <translation type="unfinished"/> </message> <message> <location line="-104"/> <source>Ocoin - Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Ocoin Core</source> <translation type="unfinished"/> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Open the Ocoin debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Clear console</source> <translation type="unfinished"/> </message> <message> <location filename="../rpcconsole.cpp" line="-30"/> <source>Welcome to the Ocoin RPC console.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+124"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <source>Send to multiple recipients at once</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Balance:</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>123.456 MEC</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-59"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed!</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <location filename="../sendcoinsentry.cpp" line="+26"/> <source>Enter a label for this address to add it to your address book</source> <translation type="unfinished"/> </message> <message> <location line="-78"/> <source>&amp;Label:</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Choose address from address book</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a Ocoin address (e.g. MNS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source> <translation type="unfinished"/> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>&amp;Sign Message</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+213"/> <source>Choose an address from the address book</source> <translation type="unfinished"/> </message> <message> <location line="-203"/> <location line="+213"/> <source>Alt+A</source> <translation type="unfinished"/> </message> <message> <location line="-203"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Signature</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Copy the current signature to the system clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this Ocoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Reset all sign message fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified Ocoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Verify &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Reset all verify message fields</source> <translation type="unfinished"/> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a Ocoin address (e.g. MNS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Enter Ocoin signature</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation type="unfinished"/> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation type="unfinished"/> </message> </context> <context> <name>SplashScreen</name> <message> <location filename="../splashscreen.cpp" line="+22"/> <source>Dr. Kimoto Chan</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>[testnet]</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+20"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>%1/offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Status</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Source</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Generated</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation type="unfinished"/> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>label</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation type="unfinished"/> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Net amount</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Message</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Comment</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Debug information</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Transaction</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Inputs</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>true</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>false</source> <translation type="unfinished"/> </message> <message> <location line="-209"/> <source>, has not been successfully broadcast yet</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-35"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+70"/> <source>unknown</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+225"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Amount</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+57"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+3"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Offline (%1 confirmations)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirmed (%1 confirmations)</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+8"/> <source>Mined balance will be available when it matures in %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+5"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+43"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Received from</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation type="unfinished"/> </message> <message> <location line="+199"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+52"/> <location line="+16"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <source>Today</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This week</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Last month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This year</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Range...</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>To yourself</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Other</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Min amount</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+139"/> <source>Export Transaction Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>ID</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <source>Range:</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>to</source> <translation type="unfinished"/> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+193"/> <source>Send Coins</source> <translation type="unfinished"/> </message> </context> <context> <name>WalletView</name> <message> <location filename="../walletview.cpp" line="+42"/> <source>&amp;Export</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="+193"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Backup Successful</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The wallet data was successfully saved to the new location.</source> <translation type="unfinished"/> </message> </context> <context> <name>Ocoin-core</name> <message> <location filename="../Ocoinstrings.cpp" line="+94"/> <source>Ocoin version</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Send command to -server or Ocoind</source> <translation type="unfinished"/> </message> <message> <location line="-23"/> <source>List commands</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>Get help for a command</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Options:</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Specify configuration file (default: Ocoin.conf)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Specify pid file (default: Ocoind.pid)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <source>Set database cache size in megabytes (default: 25)</source> <translation type="unfinished"/> </message> <message> <location line="-28"/> <source>Listen for connections on &lt;port&gt; (default: 7951 or testnet: 17951)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation type="unfinished"/> </message> <message> <location line="-48"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <source>Specify your own public address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="-134"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 7950 or testnet: 17950)</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <source>Accept command line and JSON-RPC commands</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>Run in the background as a daemon and accept commands</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <source>Use the test network</source> <translation type="unfinished"/> </message> <message> <location line="-112"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation type="unfinished"/> </message> <message> <location line="-80"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=bitcoinrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;Ocoin Alert&quot; [email protected] </source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Cannot obtain a lock on data directory %s. Ocoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong Ocoin will not work properly.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Block creation options:</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Connect only to the specified node(s)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Corrupted block database detected</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Do you want to rebuild the block database now?</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error initializing block database</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error initializing wallet database environment %s!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading block database</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error opening block database</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error: Wallet locked, unable to create transaction!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error: system error: </source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to read block info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to read block</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to sync block index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write file info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write to coin database</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write transaction index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write undo data</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Find peers using DNS lookup (default: 1 unless -connect)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Generate coins (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 288, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-4, default: 3)</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Not enough file descriptors available.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Rebuild block chain index from current blk000??.dat files</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Set the number of threads to service RPC calls (default: 4)</source> <translation type="unfinished"/> </message> <message> <location line="+26"/> <source>Verifying blocks...</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Verifying wallet...</source> <translation type="unfinished"/> </message> <message> <location line="-69"/> <source>Imports blocks from external blk000??.dat file</source> <translation type="unfinished"/> </message> <message> <location line="-76"/> <source>Set the number of script verification threads (up to 16, 0 = auto, &lt;0 = leave that many cores free, default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+77"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount for -mintxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Maintain a full transaction index (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Only accept block chain matching built-in checkpoints (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>SSL options: (see the Ocoin Wiki for SSL setup instructions)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Signing transaction failed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>System error: </source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Transaction amount too small</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction amounts must be positive</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction too large</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Username for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>You need to rebuild the databases using -reindex to change -txindex</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>wallet.dat corrupt, salvage failed</source> <translation type="unfinished"/> </message> <message> <location line="-50"/> <source>Password for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="-67"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="-120"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation type="unfinished"/> </message> <message> <location line="+147"/> <source>Upgrade wallet to latest format</source> <translation type="unfinished"/> </message> <message> <location line="-21"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>Rescan the block chain for missing wallet transactions</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="-26"/> <source>Server certificate file (default: server.cert)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation type="unfinished"/> </message> <message> <location line="-151"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+165"/> <source>This help message</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation type="unfinished"/> </message> <message> <location line="-91"/> <source>Connect through socks proxy</source> <translation type="unfinished"/> </message> <message> <location line="-10"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation type="unfinished"/> </message> <message> <location line="+55"/> <source>Loading addresses...</source> <translation type="unfinished"/> </message> <message> <location line="-35"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading wallet.dat: Wallet requires newer version of Ocoin</source> <translation type="unfinished"/> </message> <message> <location line="+93"/> <source>Wallet needed to be rewritten: restart Ocoin to complete</source> <translation type="unfinished"/> </message> <message> <location line="-95"/> <source>Error loading wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation type="unfinished"/> </message> <message> <location line="-96"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount</source> <translation type="unfinished"/> </message> <message> <location line="-6"/> <source>Insufficient funds</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Loading block index...</source> <translation type="unfinished"/> </message> <message> <location line="-57"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Unable to bind to %s on this computer. Ocoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="+64"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Loading wallet...</source> <translation type="unfinished"/> </message> <message> <location line="-52"/> <source>Cannot downgrade wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Cannot write default address</source> <translation type="unfinished"/> </message> <message> <location line="+64"/> <source>Rescanning...</source> <translation type="unfinished"/> </message> <message> <location line="-57"/> <source>Done loading</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <source>To use the %s option</source> <translation type="unfinished"/> </message> <message> <location line="-74"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="-31"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation type="unfinished"/> </message> </context> </TS>
{'content_hash': '4de5251c00dca568b21765d8179f70a3', 'timestamp': '', 'source': 'github', 'line_count': 2917, 'max_line_length': 395, 'avg_line_length': 34.00788481316421, 'alnum_prop': 0.5671112186369089, 'repo_name': 'bankonme/OSC', 'id': '2081fa309836f447dcb2c1692a8d4453457961cf', 'size': '99223', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'src/qt/locale/Ocoin_gu_IN.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '9230'}, {'name': 'C++', 'bytes': '1608562'}, {'name': 'Makefile', 'bytes': '3840'}, {'name': 'NSIS', 'bytes': '6015'}, {'name': 'Objective-C', 'bytes': '791'}, {'name': 'Objective-C++', 'bytes': '2550'}, {'name': 'OpenEdge ABL', 'bytes': '2490234'}, {'name': 'Python', 'bytes': '2994'}, {'name': 'QMake', 'bytes': '12225'}, {'name': 'Shell', 'bytes': '1153'}]}
(function () { 'use strict'; describe('Schoolsubjects List Controller Tests', function () { // Initialize global variables var SchoolsubjectsListController, $scope, $httpBackend, $state, Authentication, SchoolsubjectsService, mockSchoolsubject; // The $resource service augments the response object with methods for updating and deleting the resource. // If we were to use the standard toEqual matcher, our tests would fail because the test values would not match // the responses exactly. To solve the problem, we define a new toEqualData Jasmine matcher. // When the toEqualData matcher compares two objects, it takes only object properties into // account and ignores methods. beforeEach(function () { jasmine.addMatchers({ toEqualData: function (util, customEqualityTesters) { return { compare: function (actual, expected) { return { pass: angular.equals(actual, expected) }; } }; } }); }); // Then we can start by loading the main application module beforeEach(module(ApplicationConfiguration.applicationModuleName)); // The injector ignores leading and trailing underscores here (i.e. _$httpBackend_). // This allows us to inject a service but then attach it to a variable // with the same name as the service. beforeEach(inject(function ($controller, $rootScope, _$state_, _$httpBackend_, _Authentication_, _SchoolsubjectsService_) { // Set a new global scope $scope = $rootScope.$new(); // Point global variables to injected services $httpBackend = _$httpBackend_; $state = _$state_; Authentication = _Authentication_; SchoolsubjectsService = _SchoolsubjectsService_; // create mock article mockSchoolsubject = new SchoolsubjectsService({ _id: '525a8422f6d0f87f0e407a33', name: 'Schoolsubject Name' }); // Mock logged in user Authentication.user = { roles: ['user'] }; // Initialize the Schoolsubjects List controller. SchoolsubjectsListController = $controller('SchoolsubjectsListController as vm', { $scope: $scope }); // Spy on state go spyOn($state, 'go'); })); describe('Instantiate', function () { var mockSchoolsubjectList; beforeEach(function () { mockSchoolsubjectList = [mockSchoolsubject, mockSchoolsubject]; }); it('should send a GET request and return all Schoolsubjects', inject(function (SchoolsubjectsService) { // Set POST response $httpBackend.expectGET('api/schoolsubjects').respond(mockSchoolsubjectList); $httpBackend.flush(); // Test form inputs are reset expect($scope.vm.schoolsubjects.length).toEqual(2); expect($scope.vm.schoolsubjects[0]).toEqual(mockSchoolsubject); expect($scope.vm.schoolsubjects[1]).toEqual(mockSchoolsubject); })); }); }); }());
{'content_hash': '46f49b26bcb7e5d5915e9bc7fa7ac47c', 'timestamp': '', 'source': 'github', 'line_count': 91, 'max_line_length': 127, 'avg_line_length': 33.68131868131868, 'alnum_prop': 0.6456769983686786, 'repo_name': 'georgekach/assess', 'id': 'c776c561bcfec5893ba9252889731b609438da5f', 'size': '3065', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'modules/schoolsubjects/tests/client/list-schoolsubjects.client.controller.tests.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '206350'}, {'name': 'CoffeeScript', 'bytes': '1656'}, {'name': 'HTML', 'bytes': '279028'}, {'name': 'JavaScript', 'bytes': '1705089'}, {'name': 'Makefile', 'bytes': '3906'}, {'name': 'PowerShell', 'bytes': '468'}, {'name': 'Shell', 'bytes': '685'}]}
var chai = require('chai'); var chaihttp = require('chai-http'); chai.use(chaihttp); var expect = chai.expect; process.env.MONGO_URL = 'mongodb://localhost/notes_test'; require(__dirname + '/../server'); var mongoose = require('mongoose'); var User = require(__dirname + '/../models/user'); var eatauth = require(__dirname + '/../lib/eat_auth'); var httpBasic = require(__dirname + '/../lib/http_basic'); describe('httpbasic', function() { it('should be able to parse http basic auth', function() { var req = { headers: { authorization: 'Basic ' + (new Buffer('test:foobar123')).toString('base64') } }; httpBasic(req, {}, function() { expect(typeof req.auth).to.eql('object'); expect(req.auth.username).to.eql('test'); expect(req.auth.password).to.eql('foobar123'); }); }); }); describe('auth', function() { after(function(done){ mongoose.connection.db.dropDatabase(function() { done(); }); }); it('should be able to create a user', function(done) { chai.request('localhost:3000/api') .post('/signup') .send({username: 'testuser', password: 'foobar123'}) .end(function(err, res) { expect(err).to.eql(null); expect(res.body.token).to.have.length.above(0); done(); }); }); describe('user already in database', function() { before(function(done) { var user = new User(); user.username = 'test'; user.basic.username = 'test'; user.generateHash('foobar123', function(err, res) { if (err) throw err; user.save(function(err, data) { if (err) throw err; user.generateToken(function(err, token) { if (err) throw err; this.token = token; done(); }.bind(this)); }.bind(this)); }.bind(this)); }); it('should be able to sign in', function(done) { chai.request('localhost:3000/api') .get('/signin') .auth('test', 'foobar123') .end(function(err, res) { expect(err).to.eql(null); expect(res.body.token).to.have.length.above(0); done(); }); }); it('should be able to authenticate with eat auth', function(done) { var token = this.token; var req = { headers: { token: token } }; eatauth(req, {}, function() { expect(req.user.username).to.eql('test'); done(); }); }); }); });
{'content_hash': 'e525d1ad53a3ea458644aa919599f1b8', 'timestamp': '', 'source': 'github', 'line_count': 89, 'max_line_length': 83, 'avg_line_length': 27.921348314606742, 'alnum_prop': 0.5533199195171026, 'repo_name': 'kasimsiddiqui/single-resource-rest-api', 'id': '05e7a995265c1bf51fd1ae7fc7975d42e1ec700c', 'size': '2485', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'test/auth_test.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '335'}, {'name': 'JavaScript', 'bytes': '12706'}]}
export const dbURI = (() => { if (process.env.NODE_ENV === "dev" || process.env.NODE_ENV === "test") { return "mongodb://localhost/trelloService"; } else { return "mongodb://trellodb:27017/trelloService"; } })(); export const dbTestURI = (() => { if (process.env.NODE_ENV === "docker-test") { return "mongodb://trellodb:27017/trelloService"; } else if (process.env.NODE_ENV === "test") { return "mongodb://localhost/trelloServiceTest"; } })(); export const usersMicroserviceUrl = (() => { if (process.env.NODE_ENV === "dev" || process.env.NODE_ENV === "test") { return "http://localhost:3002/"; } else { return "http://usersmicroservice:3002/"; } })(); export const port = 3001;
{'content_hash': 'a079e71fa8528bddfbf564e0ee657531', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 74, 'avg_line_length': 28.96, 'alnum_prop': 0.6104972375690608, 'repo_name': 'Madmous/Trello-Clone', 'id': '4b96b4bcd328527aa7c7b5a92b7bec071d4f37d9', 'size': '724', 'binary': False, 'copies': '2', 'ref': 'refs/heads/develop', 'path': 'server/trello-microservice/src/config/config.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '23184'}, {'name': 'HTML', 'bytes': '1757'}, {'name': 'JavaScript', 'bytes': '285322'}, {'name': 'Python', 'bytes': '10261'}, {'name': 'Vue', 'bytes': '2212'}]}
<?php namespace Drupal\Tests\migrate_drupal\Kernel\d7; use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait; use Drupal\migrate\Audit\AuditResult; use Drupal\migrate\Audit\IdAuditor; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait; use Drupal\Tests\migrate_drupal\Traits\CreateTestContentEntitiesTrait; /** * Tests the migration auditor for ID conflicts. * * @group migrate_drupal */ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase { use FileSystemModuleDiscoveryDataProviderTrait; use CreateTestContentEntitiesTrait; use ContentModerationTestTrait; /** * {@inheritdoc} */ protected function setUp(): void { // Enable all modules. self::$modules = array_keys($this->coreModuleListDataProvider()); parent::setUp(); // Install required entity schemas. $this->installEntitySchemas(); // Install required schemas. $this->installSchema('book', ['book']); $this->installSchema('dblog', ['watchdog']); $this->installSchema('forum', ['forum_index']); $this->installSchema('node', ['node_access']); $this->installSchema('search', ['search_dataset']); $this->installSchema('system', ['sequences']); $this->installSchema('tracker', ['tracker_node', 'tracker_user']); // Enable content moderation for nodes of type page. $this->installEntitySchema('content_moderation_state'); $this->installConfig('content_moderation'); NodeType::create(['type' => 'page'])->save(); $workflow = $this->createEditorialWorkflow(); $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'page'); $workflow->save(); } /** * Tests multiple migrations to the same destination with no ID conflicts. */ public function testMultipleMigrationWithoutIdConflicts() { // Create a node of type page. $node = Node::create(['type' => 'page', 'title' => 'foo']); $node->moderation_state->value = 'published'; $node->save(); // Insert data in the d7_node:page migration mapping table to simulate a // previously migrated node. $id_map = $this->getMigration('d7_node:page')->getIdMap(); $table_name = $id_map->mapTableName(); $id_map->getDatabase()->insert($table_name) ->fields([ 'source_ids_hash' => 1, 'sourceid1' => 1, 'destid1' => 1, ]) ->execute(); // Audit the IDs of the d7_node migrations for the page & article node type. // There should be no conflicts since the highest destination ID should be // equal to the highest migrated ID, as found in the aggregated mapping // tables of the two node migrations. $migrations = [ $this->getMigration('d7_node:page'), $this->getMigration('d7_node:article'), ]; $results = (new IdAuditor())->auditMultiple($migrations); /** @var \Drupal\migrate\Audit\AuditResult $result */ foreach ($results as $result) { $this->assertInstanceOf(AuditResult::class, $result); $this->assertTrue($result->passed()); } } /** * Tests all migrations with no ID conflicts. */ public function testAllMigrationsWithNoIdConflicts() { $migrations = $this->container ->get('plugin.manager.migration') ->createInstancesByTag('Drupal 7'); // Audit the IDs of all Drupal 7 migrations. There should be no conflicts // since no content has been created. $results = (new IdAuditor())->auditMultiple($migrations); /** @var \Drupal\migrate\Audit\AuditResult $result */ foreach ($results as $result) { $this->assertInstanceOf(AuditResult::class, $result); $this->assertTrue($result->passed()); } } /** * Tests all migrations with ID conflicts. */ public function testAllMigrationsWithIdConflicts() { $migrations = $this->container ->get('plugin.manager.migration') ->createInstancesByTag('Drupal 7'); // Create content. $this->createContent(); // Audit the IDs of all Drupal 7 migrations. There should be conflicts since // content has been created. $conflicts = array_map( function (AuditResult $result) { return $result->passed() ? NULL : $result->getMigration()->getBaseId(); }, (new IdAuditor())->auditMultiple($migrations) ); $expected = [ // @todo Remove aggregator in https://www.drupal.org/project/drupal/issues/3264120 'd7_aggregator_feed', 'd7_aggregator_item', 'd7_comment', 'd7_custom_block', 'd7_file', 'd7_file_private', 'd7_menu_links', 'd7_node', 'd7_node_complete', 'd7_node_revision', 'd7_taxonomy_term', 'd7_user', 'node_translation_menu_links', ]; $this->assertEmpty(array_diff(array_filter($conflicts), $expected)); } /** * Tests draft revisions ID conflicts. */ public function testDraftRevisionIdConflicts() { // Create a published node of type page. $node = Node::create(['type' => 'page', 'title' => 'foo']); $node->moderation_state->value = 'published'; $node->save(); // Create a draft revision. $node->moderation_state->value = 'draft'; $node->setNewRevision(TRUE); $node->save(); // Insert data in the d7_node_revision:page migration mapping table to // simulate a previously migrated node revision. $id_map = $this->getMigration('d7_node_revision:page')->getIdMap(); $table_name = $id_map->mapTableName(); $id_map->getDatabase()->insert($table_name) ->fields([ 'source_ids_hash' => 1, 'sourceid1' => 1, 'destid1' => 1, ]) ->execute(); // Audit the IDs of the d7_node_revision migration. There should be // conflicts since a draft revision has been created. /** @var \Drupal\migrate\Audit\AuditResult $result */ $result = (new IdAuditor())->audit($this->getMigration('d7_node_revision:page')); $this->assertInstanceOf(AuditResult::class, $result); $this->assertFalse($result->passed()); } /** * Tests ID conflicts for inaccessible nodes. */ public function testNodeGrantsIdConflicts() { // Enable the node_test module to restrict access to page nodes. $this->enableModules(['node_test']); // Create a published node of type page. $node = Node::create(['type' => 'page', 'title' => 'foo']); $node->moderation_state->value = 'published'; $node->save(); // Audit the IDs of the d7_node migration. There should be conflicts // even though the new node is not accessible. /** @var \Drupal\migrate\Audit\AuditResult $result */ $result = (new IdAuditor())->audit($this->getMigration('d7_node:page')); $this->assertInstanceOf(AuditResult::class, $result); $this->assertFalse($result->passed()); } }
{'content_hash': 'f5cda3d85383309e97f4ee40c788760c', 'timestamp': '', 'source': 'github', 'line_count': 202, 'max_line_length': 88, 'avg_line_length': 33.73762376237624, 'alnum_prop': 0.6501834189288335, 'repo_name': 'electric-eloquence/fepper-drupal', 'id': '09b1247f747ca87e47180c8696a0bebd0c9b5305', 'size': '6815', 'binary': False, 'copies': '6', 'ref': 'refs/heads/dev', 'path': 'backend/drupal/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2300765'}, {'name': 'HTML', 'bytes': '68444'}, {'name': 'JavaScript', 'bytes': '2453602'}, {'name': 'Mustache', 'bytes': '40698'}, {'name': 'PHP', 'bytes': '41684915'}, {'name': 'PowerShell', 'bytes': '755'}, {'name': 'Shell', 'bytes': '72896'}, {'name': 'Stylus', 'bytes': '32803'}, {'name': 'Twig', 'bytes': '1820730'}, {'name': 'VBScript', 'bytes': '466'}]}
import './BeforePIXI'; import * as PIXI from 'pixi.js'; import { Dimensions } from 'react-native'; import GLWrap from './GLWrap'; export default GLWrap('Basic pixi.js use', async (gl) => { const { scale: resolution } = Dimensions.get('window'); const width = gl.drawingBufferWidth / resolution; const height = gl.drawingBufferHeight / resolution; const app = new PIXI.Application({ context: gl, width, height, resolution, backgroundColor: 0xffffff, }); app.ticker.add(() => gl.endFrameEXP()); const graphics = new PIXI.Graphics(); graphics.lineStyle(0); graphics.beginFill(0x00ff00); graphics.drawCircle(width / 2, height / 2, 50); graphics.endFill(); app.stage.addChild(graphics); });
{'content_hash': '5035eed3d2746442373682490b4f5758', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 58, 'avg_line_length': 27.185185185185187, 'alnum_prop': 0.6798365122615804, 'repo_name': 'exponent/exponent', 'id': '806aa5e74393316552ce81a0b6bc0f7cea7bc7c6', 'size': '734', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'apps/native-component-list/src/screens/GL/PIXIBasicScreen.tsx', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Assembly', 'bytes': '113276'}, {'name': 'Batchfile', 'bytes': '127'}, {'name': 'C', 'bytes': '1744836'}, {'name': 'C++', 'bytes': '1801159'}, {'name': 'CSS', 'bytes': '7854'}, {'name': 'HTML', 'bytes': '176329'}, {'name': 'IDL', 'bytes': '897'}, {'name': 'Java', 'bytes': '6251130'}, {'name': 'JavaScript', 'bytes': '4416558'}, {'name': 'Makefile', 'bytes': '18061'}, {'name': 'Objective-C', 'bytes': '13971362'}, {'name': 'Objective-C++', 'bytes': '725480'}, {'name': 'Perl', 'bytes': '5860'}, {'name': 'Prolog', 'bytes': '287'}, {'name': 'Python', 'bytes': '125673'}, {'name': 'Ruby', 'bytes': '61190'}, {'name': 'Shell', 'bytes': '4441'}]}
<h1 class="paragraph"> <span class="text" data-lrv-text="tables"></span> <a href="#main-index=components-tab&components-index=tables-tab" class="custom-link"> <i class="fa fa-link"></i> </a> </h1> <p class="paragraph text" data-lrv-text="tables-introduction"></p> <div class="custom-code" id="tables1" data-custom-model="table"></div>
{'content_hash': '0120cd11b96cb333d55785a48b487c32', 'timestamp': '', 'source': 'github', 'line_count': 8, 'max_line_length': 89, 'avg_line_length': 44.25, 'alnum_prop': 0.6581920903954802, 'repo_name': 'oknalv/larvae', 'id': 'a258a29b7b14dadf62296897a0f0c74284432b7f', 'size': '354', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'sections/tables.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '18832'}, {'name': 'HTML', 'bytes': '28728'}, {'name': 'JavaScript', 'bytes': '97191'}]}
using UnityEngine; using System.Collections; using Rayman; public class ActorFSMComp : ActorBaseFSMComp { protected override void Start(){ base.Start(); _fsm.RegisterState(new ActorBorningState(_entity)); _fsm.RegisterState(new ActorRunState(_entity)); _fsm.RegisterState(new ActorIdleState(_entity)); _fsm.RegisterState(new ActorPreAtkState(_entity)); _fsm.RegisterState(new ActorAttackState(_entity)); _fsm.RegisterState(new ActorDieState(_entity)); _fsm.RegisterGlobalState(new ActorGlobalState(_entity)); SetDefaultState(); } public void SetDefaultState(){ _fsm.SetCurrState(ActorBorningState.STATE); } }
{'content_hash': '324a90d42ff4d7e1423afd55a147687a', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 58, 'avg_line_length': 27.695652173913043, 'alnum_prop': 0.7629513343799058, 'repo_name': 'yimogod/boom', 'id': 'a27d00a9a7aa60eff1f1a43e08630f0ccd3c52d5', 'size': '637', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'trunk/tank/Assets/Scripts/Game/Actor/ActorFSMComp.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '599'}, {'name': 'C', 'bytes': '458289'}, {'name': 'C#', 'bytes': '4680670'}, {'name': 'C++', 'bytes': '2220'}, {'name': 'GLSL', 'bytes': '2473085'}, {'name': 'JavaScript', 'bytes': '45607'}, {'name': 'Lua', 'bytes': '1124798'}, {'name': 'Perl', 'bytes': '45928'}]}
"""The tests for the notify.group platform.""" import unittest from unittest.mock import MagicMock, patch from homeassistant.setup import setup_component import homeassistant.components.notify as notify from homeassistant.components.notify import group, demo from homeassistant.util.async import run_coroutine_threadsafe from tests.common import assert_setup_component, get_test_home_assistant class TestNotifyGroup(unittest.TestCase): """Test the notify.group platform.""" def setUp(self): # pylint: disable=invalid-name """Setup things to be run when tests are started.""" self.hass = get_test_home_assistant() self.events = [] self.service1 = demo.DemoNotificationService(self.hass) self.service2 = demo.DemoNotificationService(self.hass) self.service1.send_message = MagicMock(autospec=True) self.service2.send_message = MagicMock(autospec=True) def mock_get_service(hass, config, discovery_info=None): if config['name'] == 'demo1': return self.service1 else: return self.service2 with assert_setup_component(2), \ patch.object(demo, 'get_service', mock_get_service): setup_component(self.hass, notify.DOMAIN, { 'notify': [{ 'name': 'demo1', 'platform': 'demo' }, { 'name': 'demo2', 'platform': 'demo' }] }) self.service = run_coroutine_threadsafe( group.async_get_service(self.hass, {'services': [ {'service': 'demo1'}, {'service': 'demo2', 'data': {'target': 'unnamed device', 'data': {'test': 'message'}}}]}), self.hass.loop ).result() assert self.service is not None def tearDown(self): # pylint: disable=invalid-name """"Stop everything that was started.""" self.hass.stop() def test_send_message_with_data(self): """Test sending a message with to a notify group.""" run_coroutine_threadsafe( self.service.async_send_message( 'Hello', title='Test notification', data={'hello': 'world'}), self.hass.loop).result() self.hass.block_till_done() assert self.service1.send_message.mock_calls[0][1][0] == 'Hello' assert self.service1.send_message.mock_calls[0][2] == { 'title': 'Test notification', 'data': {'hello': 'world'} } assert self.service2.send_message.mock_calls[0][1][0] == 'Hello' assert self.service2.send_message.mock_calls[0][2] == { 'target': ['unnamed device'], 'title': 'Test notification', 'data': {'hello': 'world', 'test': 'message'} }
{'content_hash': 'd9a9593479e81207ae5233849e68b6fa', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 77, 'avg_line_length': 37.62337662337662, 'alnum_prop': 0.5709354504659994, 'repo_name': 'ewandor/home-assistant', 'id': 'ed988b0f9b58c14ef1b7d48195d70e727d9f583d', 'size': '2897', 'binary': False, 'copies': '20', 'ref': 'refs/heads/dev', 'path': 'tests/components/notify/test_group.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Python', 'bytes': '8860790'}, {'name': 'Ruby', 'bytes': '517'}, {'name': 'Shell', 'bytes': '12639'}]}
using Microsoft.Azure; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Queue; using Microsoft.WindowsAzure.Storage.Table; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace EncoderSim { public class Program { static void Main(string[] args) { ProcessQueue(); Console.ReadLine(); } private static async void ProcessQueue() { // Retrieve storage account from connection string. var storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); // Create the queue client. var queueClient = storageAccount.CreateCloudQueueClient(); var tableClient = storageAccount.CreateCloudTableClient(); // Retrieve a reference to a container. var queue = queueClient.GetQueueReference("myqueue"); // Create the table client. // Retrieve a reference to the table. var table = tableClient.GetTableReference("messages"); // Create the table if it doesn't exist. table.CreateIfNotExists(); // Create the queue if it doesn't already exist queue.CreateIfNotExists(); while (true) { queue.FetchAttributes(); if (queue.ApproximateMessageCount != null && queue.ApproximateMessageCount > 0) { var msg = await queue.GetMessageAsync(); if (msg != null) { var content = msg.AsString; var row = new MessageEntity(Environment.MachineName); row.Message = content; var insertOperation = TableOperation.Insert(row); // Execute the insert operation. await table.ExecuteAsync(insertOperation); await queue.DeleteMessageAsync(msg); } } Thread.Sleep(10); } } public class MessageEntity : TableEntity { public MessageEntity(string id) { this.PartitionKey = id; this.RowKey = Guid.NewGuid().ToString(); Node = id; } public MessageEntity() { } public string Message { get; set; } public string Node { get; set; } } } }
{'content_hash': 'f844a1239312c3fec816b74d7fde3816', 'timestamp': '', 'source': 'github', 'line_count': 82, 'max_line_length': 95, 'avg_line_length': 33.4390243902439, 'alnum_prop': 0.525893508388038, 'repo_name': 'torosent/azure-batch-hpc', 'id': 'fe8fb5f0ae6f4724cabad7e56e905ff71d7b5b5f', 'size': '2744', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'EncoderSim/Program.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '30890'}]}
import urllib from discord import Embed from urllib.error import URLError from discord.ext import commands from bs4 import BeautifulSoup from cogs.utils.session import Session, Page from cogs.utils.http_handler import HTTPHandler class Games: def __init__(self, bot): self.bot = bot @commands.command(pass_context=True) async def 메타(self, ctx, *args): if len(args) == 0: await self.bot.say("검색할 내용을 추가로 입력해주세용") return await self.bot.send_typing(ctx.message.channel) searchText = " ".join([arg for arg in args]) encText = urllib.parse.quote(searchText.encode("utf-8")) baseUrl = "http://www.metacritic.com" searchUrl = "{}/search/all/{}/results".format(baseUrl, encText) headers = {} headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36" http = HTTPHandler() try: response = http.get(searchUrl, headers) except URLError: await self.bot.say("문서가 존재하지 않아용") return html = BeautifulSoup(response.read().decode(), "html.parser") results = html.find("ul", {"class": "search_results"}) if not results: recommendation = html.find("div", {"class": "search_results"}).find('a').get_text() await self.bot.say("검색결과가 존재하지 않아용, 혹시 **{}**을(를) 검색하려던거 아닌가용?".format(recommendation)) else: results = results.find_all("li") pages = list() for result in results: stats = result.find("div", {"class": "main_stats"}) score = stats.find("span", {"class": "metascore_w"}) if not score: continue score = score.get_text() title = stats.find("h3", {"class": "product_title"}).get_text().strip() url = stats.find("h3", {"class": "product_title"}).find('a')['href'] url = "{}{}".format(baseUrl, url) genre = stats.find("p").get_text().strip() desc = result.find("p", {"class": "basic_stat"}) if desc: desc = desc.get_text() if genre.count('\n'): genres = genre.split('\n') platform = genres[0] type_year = genres[2].strip().split(',') genre = "{}[{}]".format(type_year[0], platform) year = type_year[1].lstrip() else: year = genre.split(',')[1].lstrip() genre = genre.split(',')[0] thumb = result.find("img")['src'] try: score = int(score) if score > 60: color = 0x66cc33 elif score > 40: color = 0xffcc33 else: color = 0xff0000 except ValueError: color = Embed.Empty page = Page(title=title, desc=desc, url=url, thumb=thumb, color=color) page.add_field('score', "**{}**".format(score)) page.add_field('genre', genre) page.add_field('year', year) pages.append(page) session = Session(self.bot, ctx.message, pages, show_footer=True) await session.start() def setup(bot): cog = Games(bot) bot.add_cog(cog)
{'content_hash': '149a9a78a7dc3fe038f0e30b187d5547', 'timestamp': '', 'source': 'github', 'line_count': 88, 'max_line_length': 134, 'avg_line_length': 40.38636363636363, 'alnum_prop': 0.49831176139561056, 'repo_name': 'WoodNeck/tataru', 'id': '9f8603ef5516c895f52db889c72d5a8db387dfec', 'size': '3660', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'cogs/game.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Python', 'bytes': '100405'}]}
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <!-- Copyright 2008-2009 The Kuali Foundation Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php 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. --> <bean id="CustomerInvoiceDocument" parent="CustomerInvoiceDocument-parentBean"/> <bean id="CustomerInvoiceDocument-parentBean" abstract="true" parent="TransactionalDocumentEntry"> <property name="allowsErrorCorrection" value="true"/> <property name="documentTypeName" value="INV"/> <property name="documentClass" value="org.kuali.kfs.module.ar.document.CustomerInvoiceDocument"/> <property name="baseDocumentClass" value="org.kuali.kfs.module.ar.document.CustomerInvoiceDocument"/> <property name="businessRulesClass" value="org.kuali.kfs.sys.document.validation.impl.AccountingRuleEngineRuleBase"/> <property name="promptBeforeValidationClass" value="org.kuali.kfs.module.ar.document.validation.impl.CustomerInvoiceDocumentPreRules"/> <property name="documentAuthorizerClass" value="org.kuali.kfs.module.ar.document.authorization.CustomerInvoiceDocumentAuthorizer"/> <property name="documentPresentationControllerClass" value="org.kuali.kfs.module.ar.document.authorization.CustomerInvoiceDocumentPresentationController"/> <property name="allowsCopy" value="true"/> <property name="accountingLineGroups"> <map> <entry> <key><value>source</value></key> <ref bean="CustomerInvoiceDocument-sourceAccountingLineGroup" parent="AccountingLineGroup"/> </entry> </map> </property> <property name="importedLineParserClass" value="org.kuali.kfs.module.ar.businessobject.CustomerInvoiceAccountingLineParser"/> <property name="attributes"> <list> <ref bean="CustomerInvoiceDocument-documentHeader.documentDescription"/> <ref bean="CustomerInvoiceDocument-documentNumber"/> <ref bean="CustomerInvoiceDocument-invoiceHeaderText"/> <ref bean="CustomerInvoiceDocument-invoiceAttentionLineText"/> <ref bean="CustomerInvoiceDocument-invoiceDueDate"/> <ref bean="CustomerInvoiceDocument-billingDate"/> <ref bean="CustomerInvoiceDocument-printDate"/> <ref bean="CustomerInvoiceDocument-invoiceTermsText"/> <ref bean="CustomerInvoiceDocument-organizationInvoiceNumber"/> <ref bean="CustomerInvoiceDocument-parentInvoiceNumber"/> <ref bean="CustomerInvoiceDocument-customerPurchaseOrderNumber"/> <ref bean="CustomerInvoiceDocument-printInvoiceIndicator"/> <ref bean="CustomerInvoiceDocument-customerPurchaseOrderDate"/> <ref bean="CustomerInvoiceDocument-billByChartOfAccountCode"/> <ref bean="CustomerInvoiceDocument-billedByOrganizationCode"/> <ref bean="CustomerInvoiceDocument-customerShipToAddressIdentifier"/> <ref bean="CustomerInvoiceDocument-customerBillToAddressIdentifier"/> <ref bean="CustomerInvoiceDocument-customerSpecialProcessingCode"/> <ref bean="CustomerInvoiceDocument-customerRecordAttachmentIndicator"/> <ref bean="CustomerInvoiceDocument-openInvoiceIndicator"/> <ref bean="CustomerInvoiceDocument-sourceTotal"/> <ref bean="CustomerInvoiceDocument-paymentChartOfAccountsCode"/> <ref bean="CustomerInvoiceDocument-paymentFinancialObjectCode"/> <ref bean="CustomerInvoiceDocument-paymentAccountNumber"/> <ref bean="CustomerInvoiceDocument-paymentOrganizationReferenceIdentifier"/> <ref bean="CustomerInvoiceDocument-paymentSubAccountNumber"/> <ref bean="CustomerInvoiceDocument-paymentProjectCode"/> <ref bean="CustomerInvoiceDocument-paymentFinancialSubObjectCode"/> <ref bean="CustomerInvoiceDocument-billingDateForDisplay"/> <ref bean="CustomerInvoiceDocument-versionNumber"/> <ref bean="CustomerInvoiceDocument-openAmount"/> <ref bean="CustomerInvoiceDocument-age"/> <ref bean="CustomerInvoiceDocument-customerName"/> <ref bean="CustomerInvoiceDocument-billingAddressName"/> <ref bean="CustomerInvoiceDocument-billingCityName"/> <ref bean="CustomerInvoiceDocument-billingStateCode"/> <ref bean="CustomerInvoiceDocument-billingZipCode"/> <ref bean="CustomerInvoiceDocument-billingCountryCode"/> <ref bean="CustomerInvoiceDocument-billingAddressInternationalProvinceName"/> <ref bean="CustomerInvoiceDocument-billingInternationalMailCode"/> <ref bean="CustomerInvoiceDocument-billingEmailAddress"/> <ref bean="CustomerInvoiceDocument-billingAddressTypeCode"/> <ref bean="CustomerInvoiceDocument-shippingAddressName"/> <ref bean="CustomerInvoiceDocument-shippingCityName"/> <ref bean="CustomerInvoiceDocument-shippingStateCode"/> <ref bean="CustomerInvoiceDocument-shippingZipCode"/> <ref bean="CustomerInvoiceDocument-shippingCountryCode"/> <ref bean="CustomerInvoiceDocument-shippingAddressInternationalProvinceName"/> <ref bean="CustomerInvoiceDocument-shippingInternationalMailCode"/> <ref bean="CustomerInvoiceDocument-shippingEmailAddress"/> <ref bean="CustomerInvoiceDocument-shippingAddressTypeCode"/> <ref bean="CustomerInvoiceDocument-billingLine1StreetAddress"/> <ref bean="CustomerInvoiceDocument-billingLine2StreetAddress"/> <ref bean="CustomerInvoiceDocument-shippingLine1StreetAddress"/> <ref bean="CustomerInvoiceDocument-shippingLine2StreetAddress"/> <ref bean="CustomerInvoiceDocument-recurredInvoiceIndicator"/> </list> </property> <property name="validationMap" ref="CustomerInvoiceDocument-validations"/> <property name="workflowAttributes"> <ref bean="CustomerInvoiceDocument-workflowAttributes"/> </property> </bean> <!-- Attribute Definitions --> <!-- accounting line groups --> <bean id="CustomerInvoiceDocument-sourceAccountingLineGroup" parent="CustomerInvoiceDocument-sourceAccountingLineGroup-parentBean"/> <bean id="CustomerInvoiceDocument-sourceAccountingLineGroup-parentBean" parent="AccountingLineGroup" abstract="true"> <property name="accountingLineView" ref="AccountsReceivable-CustomerInvoice-accountingLineView"/> <property name="accountingLineClass" value="org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail"/> <property name="groupLabel" value="Source"/> <property name="accountingLineAuthorizerClass" value="org.kuali.kfs.module.ar.document.authorization.CustomerInvoiceDocumentSourceLinesAuthorizer"/> <property name="importedLinePropertyPrefix" value="source"/> <property name="totals" ref="AccountingDocument-sourceGroupTotals"/> <property name="errorKey" value="document.sourceAccounting*,sourceAccountingLines,newSourceLine*"/> <!-- note people copying this: AV and JV have extra things that belong here --> </bean> <bean id="CustomerInvoiceDocument-documentNumber" parent="CustomerInvoiceDocument-documentNumber-parentBean"/> <bean id="CustomerInvoiceDocument-documentNumber-parentBean" abstract="true" parent="DocumentHeader-documentNumber"/> <bean id="CustomerInvoiceDocument-documentHeader.documentDescription" parent="CustomerInvoiceDocument-documentHeader.documentDescription-parentBean"/> <bean id="CustomerInvoiceDocument-documentHeader.documentDescription-parentBean" abstract="true" parent="DocumentHeader-documentDescription"> <property name="name" value="documentHeader.documentDescription"/> </bean> <bean id="CustomerInvoiceDocument-invoiceHeaderText" parent="CustomerInvoiceDocument-invoiceHeaderText-parentBean"/> <bean id="CustomerInvoiceDocument-invoiceHeaderText-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="invoiceHeaderText"/> <property name="forceUppercase" value="false"/> <property name="label" value="Header Text"/> <property name="shortLabel" value="Header"/> <property name="maxLength" value="120"/> <property name="required" value="false"/> <property name="control"> <bean parent="TextControlDefinition" p:size="50"/> </property> </bean> <bean id="CustomerInvoiceDocument-age" parent="CustomerInvoiceDocument-age-parentBean"/> <bean id="CustomerInvoiceDocument-age-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="age"/> <property name="forceUppercase" value="false"/> <property name="label" value="Age"/> <property name="shortLabel" value="Age"/> <property name="maxLength" value="5"/> <property name="required" value="false"/> <property name="control"> <bean parent="TextControlDefinition" p:size="5"/> </property> </bean> <bean id="CustomerInvoiceDocument-invoiceAttentionLineText" parent="CustomerInvoiceDocument-invoiceAttentionLineText-parentBean"/> <bean id="CustomerInvoiceDocument-invoiceAttentionLineText-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="invoiceAttentionLineText"/> <property name="forceUppercase" value="false"/> <property name="label" value="Attention Line Text"/> <property name="shortLabel" value="Attention Line"/> <property name="maxLength" value="80"/> <property name="required" value="false"/> <property name="control"> <bean parent="TextControlDefinition" p:size="80"/> </property> </bean> <bean id="CustomerInvoiceDocument-invoiceDueDate" parent="CustomerInvoiceDocument-invoiceDueDate-parentBean"/> <bean id="CustomerInvoiceDocument-invoiceDueDate-parentBean" abstract="true" parent="GenericAttributes-genericDate"> <property name="name" value="invoiceDueDate"/> <property name="label" value="Due Date"/> <property name="shortLabel" value="Due Date"/> <property name="required" value="true"/> </bean> <bean id="CustomerInvoiceDocument-billingDate" parent="CustomerInvoiceDocument-billingDate-parentBean"/> <bean id="CustomerInvoiceDocument-billingDate-parentBean" abstract="true" parent="GenericAttributes-genericDate"> <property name="name" value="billingDate"/> <property name="label" value="Billing Date"/> <property name="shortLabel" value="Billing Date"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-printDate" parent="CustomerInvoiceDocument-printDate-parentBean"/> <bean id="CustomerInvoiceDocument-printDate-parentBean" abstract="true" parent="GenericAttributes-genericDate"> <property name="name" value="printDate"/> <property name="label" value="Print Date"/> <property name="shortLabel" value="Print Date"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-invoiceTermsText" parent="CustomerInvoiceDocument-invoiceTermsText-parentBean"/> <bean id="CustomerInvoiceDocument-invoiceTermsText-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="invoiceTermsText"/> <property name="forceUppercase" value="false"/> <property name="label" value="Terms"/> <property name="shortLabel" value="Terms"/> <property name="maxLength" value="40"/> <property name="required" value="false"/> <property name="control"> <ref bean="StandardNameTextControl" /> </property> </bean> <bean id="CustomerInvoiceDocument-organizationInvoiceNumber" parent="CustomerInvoiceDocument-organizationInvoiceNumber-parentBean"/> <bean id="CustomerInvoiceDocument-organizationInvoiceNumber-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="organizationInvoiceNumber"/> <property name="forceUppercase" value="false"/> <property name="label" value="Organization Invoice Number"/> <property name="shortLabel" value="Invoice Number"/> <property name="maxLength" value="9"/> <property name="required" value="false"/> <property name="control"> <bean parent="TextControlDefinition" p:size="9"/> </property> </bean> <bean id="CustomerInvoiceDocument-parentInvoiceNumber" parent="CustomerInvoiceDocument-parentInvoiceNumber-parentBean"/> <bean id="CustomerInvoiceDocument-parentInvoiceNumber-parentBean" abstract="true" parent="DocumentHeader-documentTemplateNumber"> <property name="name" value="parentInvoiceNumber"/> <property name="label" value="Parent Invoice Number"/> <property name="shortLabel" value="Parent Invoice Number"/> <property name="control"> <bean parent="TextControlDefinition" p:size="14"/> </property> </bean> <bean id="CustomerInvoiceDocument-customerPurchaseOrderNumber" parent="CustomerInvoiceDocument-customerPurchaseOrderNumber-parentBean"/> <bean id="CustomerInvoiceDocument-customerPurchaseOrderNumber-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="customerPurchaseOrderNumber"/> <property name="forceUppercase" value="false"/> <property name="label" value="Customer Purchase Order Number"/> <property name="shortLabel" value="P.O. Number"/> <property name="maxLength" value="25"/> <property name="required" value="false"/> <property name="control"> <bean parent="TextControlDefinition" p:size="25"/> </property> </bean> <bean id="CustomerInvoiceDocument-printInvoiceIndicator" parent="CustomerInvoiceDocument-printInvoiceIndicator-parentBean"/> <bean id="CustomerInvoiceDocument-printInvoiceIndicator-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="printInvoiceIndicator"/> <property name="forceUppercase" value="false"/> <property name="label" value="Print Invoice Indicator"/> <property name="shortLabel" value="Print Inv Ind"/> <property name="maxLength" value="1"/> <property name="required" value="false"/> <property name="control"> <bean parent="SelectControlDefinition" p:valuesFinderClass="org.kuali.kfs.module.ar.businessobject.options.PrintInvoiceOptionsValuesFinder" p:includeKeyInLabel="false"/> </property> </bean> <bean id="CustomerInvoiceDocument-customerPurchaseOrderDate" parent="CustomerInvoiceDocument-customerPurchaseOrderDate-parentBean"/> <bean id="CustomerInvoiceDocument-customerPurchaseOrderDate-parentBean" abstract="true" parent="GenericAttributes-genericDate"> <property name="name" value="customerPurchaseOrderDate"/> <property name="label" value="Customer Purchase Order Date"/> <property name="shortLabel" value="P.O. Date"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-billByChartOfAccountCode" parent="CustomerInvoiceDocument-billByChartOfAccountCode-parentBean"/> <bean id="CustomerInvoiceDocument-billByChartOfAccountCode-parentBean" abstract="true" parent="Chart-chartOfAccountsCode"> <property name="name" value="billByChartOfAccountCode"/> <property name="forceUppercase" value="true"/> <property name="label" value="Billing Chart Code"/> <property name="shortLabel" value="Billing Chart"/> <property name="control"> <ref bean="ChartSelectControl" /> </property> </bean> <bean id="CustomerInvoiceDocument-billedByOrganizationCode" parent="CustomerInvoiceDocument-billedByOrganizationCode-parentBean"/> <bean id="CustomerInvoiceDocument-billedByOrganizationCode-parentBean" abstract="true" parent="Organization-organizationCode"> <property name="name" value="billedByOrganizationCode"/> <property name="forceUppercase" value="true"/> <property name="label" value="Billing Organization Code"/> <property name="shortLabel" value="Billing Org Code"/> </bean> <bean id="CustomerInvoiceDocument-customerShipToAddressIdentifier" parent="CustomerInvoiceDocument-customerShipToAddressIdentifier-parentBean"/> <bean id="CustomerInvoiceDocument-customerShipToAddressIdentifier-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="customerShipToAddressIdentifier"/> <property name="forceUppercase" value="false"/> <property name="label" value="Ship To Address Identifier"/> <property name="shortLabel" value="Ship To Add Id"/> <property name="maxLength" value="5"/> <property name="required" value="false"/> <property name="control"> <bean parent="TextControlDefinition" p:size="7"/> </property> </bean> <bean id="CustomerInvoiceDocument-customerBillToAddressIdentifier" parent="CustomerInvoiceDocument-customerBillToAddressIdentifier-parentBean"/> <bean id="CustomerInvoiceDocument-customerBillToAddressIdentifier-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="customerBillToAddressIdentifier"/> <property name="forceUppercase" value="false"/> <property name="label" value="Bill To Address Identifier"/> <property name="shortLabel" value="Bill To Add Id"/> <property name="maxLength" value="5"/> <property name="required" value="true"/> <property name="control"> <bean parent="TextControlDefinition" p:size="7"/> </property> </bean> <bean id="CustomerInvoiceDocument-customerSpecialProcessingCode" parent="CustomerInvoiceDocument-customerSpecialProcessingCode-parentBean"/> <bean id="CustomerInvoiceDocument-customerSpecialProcessingCode-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="customerSpecialProcessingCode"/> <property name="forceUppercase" value="false"/> <property name="label" value="Special Processing Code"/> <property name="shortLabel" value="Special Processing"/> <property name="maxLength" value="2"/> <property name="required" value="false"/> <property name="control"> <ref bean="TwoCharacterTextControl" /> </property> </bean> <bean id="CustomerInvoiceDocument-customerRecordAttachmentIndicator" parent="CustomerInvoiceDocument-customerRecordAttachmentIndicator-parentBean"/> <bean id="CustomerInvoiceDocument-customerRecordAttachmentIndicator-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="customerRecordAttachmentIndicator"/> <property name="forceUppercase" value="false"/> <property name="label" value="Record Attachment Indicator"/> <property name="shortLabel" value="Attachment"/> <property name="maxLength" value="1"/> <property name="required" value="false"/> <property name="control"> <bean parent="CheckboxControlDefinition"/> </property> </bean> <bean id="CustomerInvoiceDocument-openInvoiceIndicator" parent="CustomerInvoiceDocument-openInvoiceIndicator-parentBean"/> <bean id="CustomerInvoiceDocument-openInvoiceIndicator-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="openInvoiceIndicator"/> <property name="forceUppercase" value="false"/> <property name="label" value="Open Invoice Indicator"/> <property name="shortLabel" value="Open Invoice"/> <property name="maxLength" value="1"/> <property name="required" value="false"/> <property name="control"> <bean parent="CheckboxControlDefinition"/> </property> </bean> <bean id="CustomerInvoiceDocument-sourceTotal" parent="CustomerInvoiceDocument-sourceTotal-parentBean"/> <bean id="CustomerInvoiceDocument-sourceTotal-parentBean" abstract="true" parent="GenericAttributes-genericAmount"> <property name="name" value="sourceTotal"/> <property name="label" value="Invoice Total Amount"/> <property name="shortLabel" value="Invoice Total Amount"/> </bean> <bean id="CustomerInvoiceDocument-paymentChartOfAccountsCode" parent="CustomerInvoiceDocument-paymentChartOfAccountsCode-parentBean"/> <bean id="CustomerInvoiceDocument-paymentChartOfAccountsCode-parentBean" abstract="true" parent="Chart-chartOfAccountsCode"> <property name="name" value="paymentChartOfAccountsCode"/> <property name="required" value="false"/> <property name="control"> <ref bean="ChartSimpleSelectControl" /> </property> </bean> <bean id="CustomerInvoiceDocument-paymentFinancialObjectCode" parent="CustomerInvoiceDocument-paymentFinancialObjectCode-parentBean"/> <bean id="CustomerInvoiceDocument-paymentFinancialObjectCode-parentBean" abstract="true" parent="ObjectCode-financialObjectCode"> <property name="name" value="paymentFinancialObjectCode"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-paymentAccountNumber" parent="CustomerInvoiceDocument-paymentAccountNumber-parentBean"/> <bean id="CustomerInvoiceDocument-paymentAccountNumber-parentBean" abstract="true" parent="Account-accountNumber"> <property name="name" value="paymentAccountNumber"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-paymentOrganizationReferenceIdentifier" parent="CustomerInvoiceDocument-paymentOrganizationReferenceIdentifier-parentBean"/> <bean id="CustomerInvoiceDocument-paymentOrganizationReferenceIdentifier-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="paymentOrganizationReferenceIdentifier"/> <property name="forceUppercase" value="true"/> <property name="label" value="Organization Reference Id"/> <property name="shortLabel" value="Org Ref Id"/> <property name="maxLength" value="8"/> <property name="validationPattern"> <ref bean="AnyCharacterWithWhitespaceValidation" /> </property> <property name="required" value="false"/> <property name="control"> <ref bean="TenCharacterTextControl" /> </property> </bean> <bean id="CustomerInvoiceDocument-paymentSubAccountNumber" parent="CustomerInvoiceDocument-paymentSubAccountNumber-parentBean"/> <bean id="CustomerInvoiceDocument-paymentSubAccountNumber-parentBean" abstract="true" parent="SubAccount-subAccountNumber"> <property name="name" value="paymentSubAccountNumber"/> <property name="label" value="Sub-Account Code"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-paymentProjectCode" parent="CustomerInvoiceDocument-paymentProjectCode-parentBean"/> <bean id="CustomerInvoiceDocument-paymentProjectCode-parentBean" abstract="true" parent="ProjectCode-code"> <property name="name" value="paymentProjectCode"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-paymentFinancialSubObjectCode" parent="CustomerInvoiceDocument-paymentFinancialSubObjectCode-parentBean"/> <bean id="CustomerInvoiceDocument-paymentFinancialSubObjectCode-parentBean" abstract="true" parent="SubObjectCode-financialSubObjectCode"> <property name="name" value="paymentFinancialSubObjectCode"/> <property name="label" value="Sub Object Code"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-billingDateForDisplay" parent="CustomerInvoiceDocument-billingDateForDisplay-parentBean"/> <bean id="CustomerInvoiceDocument-billingDateForDisplay-parentBean" abstract="true" parent="GenericAttributes-genericDate"> <property name="name" value="billingDateForDisplay"/> <property name="label" value="Billing Date"/> <property name="shortLabel" value="Billing Date"/> <property name="required" value="false"/> </bean> <bean id="CustomerInvoiceDocument-versionNumber" parent="CustomerInvoiceDocument-versionNumber-parentBean"/> <bean id="CustomerInvoiceDocument-versionNumber-parentBean" abstract="true" parent="GenericAttributes-versionNumber"> </bean> <bean id="CustomerInvoiceDocument-openAmount" parent="CustomerInvoiceDocument-openAmount-parentBean"/> <bean id="CustomerInvoiceDocument-openAmount-parentBean" abstract="true" parent="GenericAttributes-genericAmount"> <property name="name" value="openAmount"/> <property name="label" value="Open Amount"/> <property name="shortLabel" value="Open Amount"/> </bean> <bean id="CustomerInvoiceDocument-customerName" parent="CustomerInvoiceDocument-customerName-parentBean"/> <bean id="CustomerInvoiceDocument-customerName-parentBean" abstract="true" parent="Customer-customerName"/> <bean id="CustomerInvoiceDocument-billingAddressName" parent="CustomerInvoiceDocument-billingAddressName-parentBean"/> <bean id="CustomerInvoiceDocument-billingAddressName-parentBean" abstract="true" parent="CustomerAddress-customerAddressName"> <property name="name" value="billingAddressName"/> </bean> <bean id="CustomerInvoiceDocument-billingCityName" parent="CustomerInvoiceDocument-billingCityName-parentBean"/> <bean id="CustomerInvoiceDocument-billingCityName-parentBean" abstract="true" parent="CustomerAddress-customerCityName"> <property name="name" value="billingCityName"/> </bean> <bean id="CustomerInvoiceDocument-billingStateCode" parent="CustomerInvoiceDocument-billingStateCode-parentBean"/> <bean id="CustomerInvoiceDocument-billingStateCode-parentBean" abstract="true" parent="CustomerAddress-customerStateCode"> <property name="name" value="billingStateCode"/> </bean> <bean id="CustomerInvoiceDocument-billingZipCode" parent="CustomerInvoiceDocument-billingZipCode-parentBean"/> <bean id="CustomerInvoiceDocument-billingZipCode-parentBean" abstract="true" parent="CustomerAddress-customerZipCode"> <property name="name" value="billingZipCode"/> </bean> <bean id="CustomerInvoiceDocument-billingCountryCode" parent="CustomerInvoiceDocument-billingCountryCode-parentBean"/> <bean id="CustomerInvoiceDocument-billingCountryCode-parentBean" abstract="true" parent="CustomerAddress-customerCountryCode"> <property name="name" value="billingCountryCode"/> </bean> <bean id="CustomerInvoiceDocument-billingAddressInternationalProvinceName" parent="CustomerInvoiceDocument-billingAddressInternationalProvinceName-parentBean"/> <bean id="CustomerInvoiceDocument-billingAddressInternationalProvinceName-parentBean" abstract="true" parent="CustomerAddress-customerAddressInternationalProvinceName"> <property name="name" value="billingAddressInternationalProvinceName"/> </bean> <bean id="CustomerInvoiceDocument-billingInternationalMailCode" parent="CustomerInvoiceDocument-billingInternationalMailCode-parentBean"/> <bean id="CustomerInvoiceDocument-billingInternationalMailCode-parentBean" abstract="true" parent="CustomerAddress-customerInternationalMailCode"> <property name="name" value="billingInternationalMailCode"/> </bean> <bean id="CustomerInvoiceDocument-billingEmailAddress" parent="CustomerInvoiceDocument-billingEmailAddress-parentBean"/> <bean id="CustomerInvoiceDocument-billingEmailAddress-parentBean" abstract="true" parent="CustomerAddress-customerEmailAddress"> <property name="name" value="billingEmailAddress"/> </bean> <bean id="CustomerInvoiceDocument-billingAddressTypeCode" parent="CustomerInvoiceDocument-billingAddressTypeCode-parentBean"/> <bean id="CustomerInvoiceDocument-billingAddressTypeCode-parentBean" abstract="true" parent="CustomerAddress-customerAddressTypeCode"> <property name="name" value="billingAddressTypeCode"/> </bean> <bean id="CustomerInvoiceDocument-shippingAddressName" parent="CustomerInvoiceDocument-shippingAddressName-parentBean"/> <bean id="CustomerInvoiceDocument-shippingAddressName-parentBean" abstract="true" parent="CustomerAddress-customerAddressName"> <property name="name" value="shippingAddressName"/> </bean> <bean id="CustomerInvoiceDocument-shippingCityName" parent="CustomerInvoiceDocument-shippingCityName-parentBean"/> <bean id="CustomerInvoiceDocument-shippingCityName-parentBean" abstract="true" parent="CustomerAddress-customerCityName"> <property name="name" value="shippingCityName"/> </bean> <bean id="CustomerInvoiceDocument-shippingStateCode" parent="CustomerInvoiceDocument-shippingStateCode-parentBean"/> <bean id="CustomerInvoiceDocument-shippingStateCode-parentBean" abstract="true" parent="CustomerAddress-customerStateCode"> <property name="name" value="shippingStateCode"/> </bean> <bean id="CustomerInvoiceDocument-shippingZipCode" parent="CustomerInvoiceDocument-shippingZipCode-parentBean"/> <bean id="CustomerInvoiceDocument-shippingZipCode-parentBean" abstract="true" parent="CustomerAddress-customerZipCode"> <property name="name" value="shippingZipCode"/> </bean> <bean id="CustomerInvoiceDocument-shippingCountryCode" parent="CustomerInvoiceDocument-shippingCountryCode-parentBean"/> <bean id="CustomerInvoiceDocument-shippingCountryCode-parentBean" abstract="true" parent="CustomerAddress-customerCountryCode"> <property name="name" value="shippingCountryCode"/> </bean> <bean id="CustomerInvoiceDocument-shippingAddressInternationalProvinceName" parent="CustomerInvoiceDocument-shippingAddressInternationalProvinceName-parentBean"/> <bean id="CustomerInvoiceDocument-shippingAddressInternationalProvinceName-parentBean" abstract="true" parent="CustomerAddress-customerAddressInternationalProvinceName"> <property name="name" value="shippingAddressInternationalProvinceName"/> </bean> <bean id="CustomerInvoiceDocument-shippingInternationalMailCode" parent="CustomerInvoiceDocument-shippingInternationalMailCode-parentBean"/> <bean id="CustomerInvoiceDocument-shippingInternationalMailCode-parentBean" abstract="true" parent="CustomerAddress-customerInternationalMailCode"> <property name="name" value="shippingInternationalMailCode"/> </bean> <bean id="CustomerInvoiceDocument-shippingEmailAddress" parent="CustomerInvoiceDocument-shippingEmailAddress-parentBean"/> <bean id="CustomerInvoiceDocument-shippingEmailAddress-parentBean" abstract="true" parent="CustomerAddress-customerEmailAddress"> <property name="name" value="shippingEmailAddress"/> </bean> <bean id="CustomerInvoiceDocument-shippingAddressTypeCode" parent="CustomerInvoiceDocument-shippingAddressTypeCode-parentBean"/> <bean id="CustomerInvoiceDocument-shippingAddressTypeCode-parentBean" abstract="true" parent="CustomerAddress-customerAddressTypeCode"> <property name="name" value="shippingAddressTypeCode"/> </bean> <bean id="CustomerInvoiceDocument-billingLine1StreetAddress" parent="CustomerInvoiceDocument-billingLine1StreetAddress-parentBean"/> <bean id="CustomerInvoiceDocument-billingLine1StreetAddress-parentBean" abstract="true" parent="CustomerAddress-customerLine1StreetAddress"> <property name="name" value="billingLine1StreetAddress"/> </bean> <bean id="CustomerInvoiceDocument-billingLine2StreetAddress" parent="CustomerInvoiceDocument-billingLine2StreetAddress-parentBean"/> <bean id="CustomerInvoiceDocument-billingLine2StreetAddress-parentBean" abstract="true" parent="CustomerAddress-customerLine2StreetAddress"> <property name="name" value="billingLine2StreetAddress"/> </bean> <bean id="CustomerInvoiceDocument-shippingLine1StreetAddress" parent="CustomerInvoiceDocument-shippingLine1StreetAddress-parentBean"/> <bean id="CustomerInvoiceDocument-shippingLine1StreetAddress-parentBean" abstract="true" parent="CustomerAddress-customerLine1StreetAddress"> <property name="name" value="shippingLine1StreetAddress"/> </bean> <bean id="CustomerInvoiceDocument-shippingLine2StreetAddress" parent="CustomerInvoiceDocument-shippingLine2StreetAddress-parentBean"/> <bean id="CustomerInvoiceDocument-shippingLine2StreetAddress-parentBean" abstract="true" parent="CustomerAddress-customerLine2StreetAddress"> <property name="name" value="shippingLine2StreetAddress"/> </bean> <bean id="CustomerInvoiceDocument-recurredInvoiceIndicator" parent="CustomerInvoiceDocument-recurredInvoiceIndicator-parentBean"/> <bean id="CustomerInvoiceDocument-recurredInvoiceIndicator-parentBean" abstract="true" parent="AttributeDefinition"> <property name="name" value="recurredInvoiceIndicator"/> <property name="forceUppercase" value="false"/> <property name="label" value="Recurred Invoice Indicator"/> <property name="shortLabel" value="Recurred Inv Ind"/> <property name="maxLength" value="1"/> <property name="required" value="false"/> <property name="control"> <bean parent="CheckboxControlDefinition"/> </property> </bean> <bean id="CustomerInvoiceDocument-validations" parent="CustomerInvoiceDocument-validations-parentBean"/> <bean id="CustomerInvoiceDocument-validations-parentBean" abstract="true" class="org.springframework.beans.factory.config.MapFactoryBean"> <property name="sourceMap"> <map key-type="java.lang.Class"> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.AttributedSaveDocumentEvent</value></key> <value>CustomerInvoice-saveDocumentValidation</value> </entry> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.AttributedRouteDocumentEvent</value></key> <value>CustomerInvoice-routeDocumentValidation</value> </entry> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.AttributedApproveDocumentEvent</value></key> <value>CustomerInvoice-approveDocumentValidation</value> </entry> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.AttributedBlanketApproveDocumentEvent</value></key> <value>CustomerInvoice-blanketApproveDocumentValidation</value> </entry> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.AddAccountingLineEvent</value></key> <value>CustomerInvoice-addAccountingLineValidation</value> </entry> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.DeleteAccountingLineEvent</value></key> <value>CustomerInvoice-deleteAccountingLineValidation</value> </entry> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.UpdateAccountingLineEvent</value></key> <value>CustomerInvoice-updateAccountingLineValidation</value> </entry> <entry> <key><value>org.kuali.kfs.sys.document.validation.event.ReviewAccountingLineEvent</value></key> <value>CustomerInvoice-reviewAccountingLineValidation</value> </entry> <entry> <key><value>org.kuali.kfs.module.ar.document.validation.event.DiscountCustomerInvoiceDetailEvent</value></key> <value>CustomerInvoice-discountCustomerInvoiceDetailValidation</value> </entry> <entry> <key><value>org.kuali.kfs.module.ar.document.validation.event.RecalculateCustomerInvoiceDetailEvent</value></key> <value>CustomerInvoice-recalculateCustomerInvoiceDetailValidation</value> </entry> </map> </property> </bean> <!-- Start - Workflow Attribute Beans --> <bean id="CustomerInvoiceDocument-DocumentValuePathGroup-billingChartOrg" parent="CustomerInvoiceDocument-DocumentValuePathGroup-billingChartOrg-parentBean"/> <bean id="CustomerInvoiceDocument-DocumentValuePathGroup-billingChartOrg-parentBean" abstract="true" class="org.kuali.rice.krad.datadictionary.DocumentValuePathGroup"> <property name="documentValues"> <list> <value>billByChartOfAccountCode</value> <value>billedByOrganizationCode</value> </list> </property> </bean> <bean id="CustomerInvoiceDocument-RoutingType-BillingChartOrg" class="org.kuali.rice.krad.datadictionary.RoutingTypeDefinition"> <property name="routingAttributes"> <list> <ref bean="RoutingAttribute-chartOfAccountsCode"/> <ref bean="RoutingAttribute-organizationCode"/> </list> </property> <property name="documentValuePathGroups"> <list> <ref bean="CustomerInvoiceDocument-DocumentValuePathGroup-billingChartOrg"/> </list> </property> </bean> <bean id="CustomerInvoiceDocument-workflowAttributes" parent="CustomerInvoiceDocument-workflowAttributes-parentBean"/> <bean id="CustomerInvoiceDocument-workflowAttributes-parentBean" abstract="true" parent="WorkflowAttributes"> <property name="searchingTypeDefinitions"> <list> <ref bean="SearchingType-AccountsReceivableDocument-createDate-resultsOnly"/> <ref bean="SearchingType-AccountsReceivableDocument-initiatorId-resultsOnly"/> <ref bean="SearchingType-AccountsReceivableDocument-customerNumber"/> <ref bean="SearchingType-AccountsReceivableDocument-customerName"/> <ref bean="SearchingType-AccountsReceivableDocument-processingChartOfAccountsCode-criteriaOnly"/> <ref bean="SearchingType-AccountsReceivableDocument-processingOrganizationCode-criteriaOnly"/> <ref bean="SearchingType-AccountsReceivableDocument-documentStatus-resultsOnly"/> <ref bean="SearchingType-CustomerInvoiceDocument-billingChartOfAccountsCode"/> <ref bean="SearchingType-CustomerInvoiceDocument-billingOrganizationCode"/> <ref bean="SearchingType-CustomerInvoiceDocument-invoiceItemCode-criteriaOnly"/> <ref bean="SearchingType-CustomerInvoiceDocument-parentInvoiceNumber-criteriaOnly"/> </list> </property> <property name="routingTypeDefinitions"> <map> <entry key="Account" value-ref="RoutingType-AccountingDocument-Account-sourceOnly"/> <entry key="Recurrence" value-ref="CustomerInvoiceDocument-RoutingType-BillingChartOrg"/> </map> </property> </bean> </beans>
{'content_hash': '314e43e3c01875e9815dd56fec1cf8df', 'timestamp': '', 'source': 'github', 'line_count': 706, 'max_line_length': 339, 'avg_line_length': 53.70821529745042, 'alnum_prop': 0.7698718286829475, 'repo_name': 'Ariah-Group/Finance', 'id': '059b233fef81486b41dde6da45fe94e299e10adf', 'size': '37918', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'af_webapp/src/main/resources/org/kuali/kfs/module/ar/document/datadictionary/CustomerInvoiceDocument.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
""" Cumulus Deployment Suite APACHE LICENSE 2.0 Copyright 2013-2014 Skymill Solutions 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. """ import logging from cumulus_ds import bundle_manager from cumulus_ds import deployment_manager from cumulus_ds.config import CONFIG as config LOGGING_CONFIG = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': '%(asctime)s - cumulus - %(levelname)s - %(message)s' }, 'boto': { 'format': '%(asctime)s - boto - %(levelname)s - %(message)s' } }, 'handlers': { 'default': { 'level': 'INFO', 'class': 'logging.StreamHandler', 'formatter': 'standard' }, 'boto': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'boto' } }, 'loggers': { '': { 'handlers': ['default'], 'level': 'INFO', 'propagate': True }, 'boto': { 'handlers': ['boto'], 'level': logging.CRITICAL, 'propagate': False }, 'cumulus_ds.bundle_manager': { 'handlers': ['default'], 'level': 'DEBUG', 'propagate': False }, 'cumulus_ds.config_handler': { 'handlers': ['default'], 'level': 'DEBUG', 'propagate': False }, 'cumulus_ds.connection_handler': { 'handlers': ['default'], 'level': 'DEBUG', 'propagate': False }, 'cumulus_ds.deployment_manager': { 'handlers': ['default'], 'level': 'DEBUG', 'propagate': False }, 'cumulus_ds.helpers.stack': { 'handlers': ['default'], 'level': 'DEBUG', 'propagate': False } } } # Set log level LOGGING_CONFIG['handlers']['default']['level'] = config.get_log_level() logging.config.dictConfig(LOGGING_CONFIG) LOGGER = logging.getLogger(__name__) def main(): """ Main function """ try: if config.args.bundle: bundle_manager.build_bundles() if config.args.undeploy: deployment_manager.undeploy(force=config.args.force) if config.args.deploy: bundle_manager.build_bundles() deployment_manager.deploy() if config.args.deploy_without_bundling: deployment_manager.deploy() if config.args.list: deployment_manager.list_stacks() if config.args.validate_templates: deployment_manager.validate_templates() if config.args.events: deployment_manager.list_events() if config.args.outputs: deployment_manager.list_outputs() if config.args.redeploy: deployment_manager.undeploy(force=True) bundle_manager.build_bundles() deployment_manager.deploy() except Exception as error: LOGGER.error(error) raise
{'content_hash': '308f5c6027465127921d06b474b551d1', 'timestamp': '', 'source': 'github', 'line_count': 130, 'max_line_length': 72, 'avg_line_length': 27.615384615384617, 'alnum_prop': 0.5551532033426184, 'repo_name': 'skymill/cumulus', 'id': '2fd5bc6e0022a66339c9f405c7a289ef76df12c2', 'size': '3590', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'cumulus/cumulus_ds/__init__.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Python', 'bytes': '87696'}]}
var app = new Rammy(); app.START(); app.use("modules/style.css"); app.setTitle("XCalc Services"); setTimeout(function(){}, 3000); function doMagic() { //evaluate + show answer to the calcs input var box = document.getElementById("calcScreen"); var expr = box.value; while(expr.indexOf('x') >= 0) { expr = expr.replace('x', '*'); } var answer = eval(expr); box.value = answer; } function calcAction(action) { var set1 = ".1234567890-+x/()"; //input actions var set2 = "C="; //actual actions var box = document.getElementById("calcScreen"); //redirect to settings if the equals button is pressed with no input entered already if(box.value == "" || box.value == undefined) { if(action == "=") { window.location = "settings.html"; } } if(set1.indexOf(action) >= 0) { box.value = box.value + action; } else if(set2.indexOf(action) >= 0) { if(action == "C") { box.value = ""; } else if(action == "=") { doMagic(); } else { alert("You have not hit a valid button"); } } else { alert("The action you have selected is not valid"); } } function calcButton(text) { var id; var button = new Structure(); button.compose(app.BUTTON()); button.setClass('calcButton'); switch(text) { case "=": id = "equals"; break; case "x": id = "mult"; break; case "/": id = "divide"; break; case "+": id = "plus"; break; case "-": id = "minus"; break; default: id = text; } button.setId("key" + id); button.setText("<b>" + text + "</b>"); return button; } function lineBreak() { var br = new Structure(); br.compose(app.LINEBREAK()); return br; } function calcScreen() { var box = new Structure(); box.compose(app.INPUT()); box.setType("text"); box.setValue(""); box.setDisabled(true); box.setId("calcScreen"); box.setClass("calcScreen"); box.add(); } function buttonPad() { var things = "C()+789-456x123/0.="; //a string with every button which im going to make var coll = 1; //the collumn we are placing the next button inside of for(pos in things) { calcButton(things[pos]).add(); coll = coll + 1; if(coll == 5) { coll = 1; lineBreak().add(); } } } function update() { var app_theme = localStorage.getItem("app-theme"); //the light theme is the default (style.css) if(app_theme == "dark") { app.use("modules/dark-style.css") } calcScreen(); lineBreak().add(); buttonPad(); } update(); $(".calcButton").click(function(event) { var id = this.id; switch (id) { case "keyminus": id = "-"; break; case "keyplus": id = "+"; break; case "keymult": id = "x"; break; case "keydivide": id = "/"; break; case "keyequals": id = "="; break; default: id = id.replace("key", ""); } //boost performance: event.preventDefault(); calcAction(id); });
{'content_hash': '9e722db43141c916b583f1c4ffb65ba2', 'timestamp': '', 'source': 'github', 'line_count': 144, 'max_line_length': 88, 'avg_line_length': 19.51388888888889, 'alnum_prop': 0.603914590747331, 'repo_name': 'ProgrammerKid/xcalc-chrome', 'id': 'a3a5794fa1a7a14418751974ccde561792d06c15', 'size': '2810', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'modules/index.js', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '1242'}, {'name': 'HTML', 'bytes': '279'}, {'name': 'JavaScript', 'bytes': '7079'}]}
$color-primary: #000; $color-bg: #fff; $color-text: #000; $sidebar-width: 300px; @import "basic/layout"; @import "basic/coverpage";
{'content_hash': 'c9d167a916fb520f8f04d1b69ae40023', 'timestamp': '', 'source': 'github', 'line_count': 6, 'max_line_length': 26, 'avg_line_length': 22.0, 'alnum_prop': 0.6893939393939394, 'repo_name': 'raqueleux/Reading-Row', 'id': '60350e86530c11ab7abc8673c10412a922476367', 'size': '132', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/themes/pure.css', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '23462'}, {'name': 'HTML', 'bytes': '1402'}, {'name': 'JavaScript', 'bytes': '226308'}, {'name': 'Shell', 'bytes': '783'}]}
#include "tensorflow/compiler/xla/service/gpu/amdgpu_compiler.h" #include "tensorflow/compiler/xla/service/algebraic_simplifier.h" #include "tensorflow/compiler/xla/service/gpu/gemm_rewriter.h" #include "tensorflow/compiler/xla/service/gpu/gpu_conv_algorithm_picker.h" #include "tensorflow/compiler/xla/service/gpu/gpu_conv_padding_legalization.h" #include "tensorflow/compiler/xla/service/gpu/gpu_conv_rewriter.h" #include "tensorflow/compiler/xla/service/gpu/gpu_layout_assignment.h" #include "tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.h" #include "tensorflow/compiler/xla/service/gpu/target_constants.h" #include "tensorflow/compiler/xla/service/hlo_constant_folding.h" #include "tensorflow/compiler/xla/service/hlo_cse.h" #include "tensorflow/compiler/xla/service/hlo_pass_fix.h" #include "tensorflow/compiler/xla/service/hlo_pass_pipeline.h" #include "tensorflow/compiler/xla/service/hlo_verifier.h" #include "tensorflow/compiler/xla/service/llvm_ir/llvm_util.h" #include "tensorflow/compiler/xla/service/tuple_simplifier.h" #include "tensorflow/core/platform/rocm_rocdl_path.h" namespace xla { namespace gpu { namespace { // Returns the directory containing ROCm-Device-Libs files. This function is // called in AMDGPUCompiler's constructor, so can't return an error. But // AMDGPUCompiler::Compile will return an error when the wanted rocdl file // doesn't exist in the folder this function returns. string GetROCDLDir(const HloModuleConfig& config) { std::vector<string> potential_rocdl_dirs; const string datadir = config.debug_options().xla_gpu_cuda_data_dir(); if (!datadir.empty()) { potential_rocdl_dirs.push_back(datadir); } potential_rocdl_dirs.push_back(tensorflow::RocdlRoot()); // Tries all potential ROCDL directories in the order they are inserted. // Returns the first directory that exists in the file system. for (const string& potential_rocdl_dir : potential_rocdl_dirs) { if (tensorflow::Env::Default()->IsDirectory(potential_rocdl_dir).ok()) { VLOG(2) << "Found ROCm-Device-Libs dir " << potential_rocdl_dir; return potential_rocdl_dir; } VLOG(2) << "Unable to find potential ROCm-Device-Libs dir " << potential_rocdl_dir; } // Last resort: maybe in the current folder. return "."; } } // namespace Status AMDGPUCompiler::OptimizeHloConvolutionCanonicalization( HloModule* hlo_module, se::StreamExecutor* stream_exec, se::DeviceMemoryAllocator* device_allocator) { // Convert convolutions into CustomCalls to MIOpen, then canonicalize them // (PadInsertion). HloPassPipeline pipeline("conv_canonicalization"); pipeline.AddInvariantChecker<HloVerifier>(/*layout_sensitive=*/false, /*allow_mixed_precision=*/false); pipeline.AddPass<GpuConvRewriter>(); pipeline.AddPass<GpuConvPaddingLegalization>(); pipeline.AddPass<HloConstantFolding>(); TF_RETURN_IF_ERROR(pipeline.Run(hlo_module).status()); return Status::OK(); } Status AMDGPUCompiler::OptimizeHloPostLayoutAssignment( HloModule* hlo_module, se::StreamExecutor* stream_exec, se::DeviceMemoryAllocator* device_allocator) { HloPassPipeline pipeline("post-layout_assignment"); pipeline.AddInvariantChecker<HloVerifier>( /*layout_sensitive=*/true, /*allow_mixed_precision=*/false, LayoutAssignment::InstructionCanChangeLayout); // The LayoutAssignment pass may leave behind kCopy instructions which are // duplicate or NOPs, so remove them with algebraic simplification and CSE. AlgebraicSimplifierOptions options; options.set_is_layout_sensitive(true); pipeline.AddPass<HloPassFix<AlgebraicSimplifier>>(options); // Rewrite GEMMs into custom calls. pipeline.AddPass<GemmRewriter>(); pipeline.AddPass<GpuConvAlgorithmPicker>(stream_exec, device_allocator); // Clean up new_tuple described above. pipeline.AddPass<TupleSimplifier>(); pipeline.AddPass<HloCSE>(/*is_layout_sensitive=*/true); TF_RETURN_IF_ERROR(pipeline.Run(hlo_module).status()); return Status::OK(); } AMDGPUCompiler::AMDGPUCompiler() : GpuCompiler(stream_executor::rocm::kROCmPlatformId, amdgpu::kTargetTriple, amdgpu::kDataLayout) {} GpuVersion AMDGPUCompiler::GetGpuVersion(se::StreamExecutor* stream_exec) { int isa_version = 0; if (!stream_exec->GetDeviceDescription().rocm_amdgpu_isa_version( &isa_version)) { LOG(WARNING) << "Couldn't get AMDGPU ISA version for device; assuming gfx803."; isa_version = 803; } return isa_version; } StatusOr<std::pair<std::string, std::vector<uint8>>> AMDGPUCompiler::CompileTargetBinary(const HloModule* module, llvm::Module* llvm_module, GpuVersion gpu_version, se::StreamExecutor* stream_exec) { if (rocdl_dir_.empty()) { // Compute rocdl_dir_ just once and cache it in this member. rocdl_dir_ = GetROCDLDir(module->config()); } std::vector<uint8> hsaco; { XLA_SCOPED_LOGGING_TIMER( "AMDGPUCompiler::CompileTargetBinary - CompileToHsaco"); TF_ASSIGN_OR_RETURN(hsaco, amdgpu::CompileToHsaco(llvm_module, gpu_version, module->config(), rocdl_dir_)); } llvm_ir::DumpIrIfEnabled(*module, *llvm_module, /*optimized=*/false); if (user_post_optimization_hook_) { user_post_optimization_hook_(*llvm_module); } return std::pair<std::string, std::vector<uint8>>("", std::move(hsaco)); } } // namespace gpu } // namespace xla
{'content_hash': 'f3b0b7987d825b57bd47f3d759a03d54', 'timestamp': '', 'source': 'github', 'line_count': 147, 'max_line_length': 81, 'avg_line_length': 38.27210884353742, 'alnum_prop': 0.7104514752932812, 'repo_name': 'jhseu/tensorflow', 'id': '2074ed66766102b6e2cfea7ffdf2585c7f631f32', 'size': '6294', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'tensorflow/compiler/xla/service/gpu/amdgpu_compiler.cc', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Assembly', 'bytes': '27480'}, {'name': 'Batchfile', 'bytes': '49527'}, {'name': 'C', 'bytes': '875455'}, {'name': 'C#', 'bytes': '8562'}, {'name': 'C++', 'bytes': '80051513'}, {'name': 'CMake', 'bytes': '6500'}, {'name': 'Dockerfile', 'bytes': '112748'}, {'name': 'Go', 'bytes': '1853641'}, {'name': 'HTML', 'bytes': '4686483'}, {'name': 'Java', 'bytes': '961600'}, {'name': 'Jupyter Notebook', 'bytes': '549457'}, {'name': 'LLVM', 'bytes': '6536'}, {'name': 'MLIR', 'bytes': '1729057'}, {'name': 'Makefile', 'bytes': '62498'}, {'name': 'Objective-C', 'bytes': '116558'}, {'name': 'Objective-C++', 'bytes': '304661'}, {'name': 'PHP', 'bytes': '4236'}, {'name': 'Pascal', 'bytes': '318'}, {'name': 'Pawn', 'bytes': '19515'}, {'name': 'Perl', 'bytes': '7536'}, {'name': 'Python', 'bytes': '36791185'}, {'name': 'RobotFramework', 'bytes': '891'}, {'name': 'Roff', 'bytes': '2705'}, {'name': 'Ruby', 'bytes': '7464'}, {'name': 'SWIG', 'bytes': '56741'}, {'name': 'Shell', 'bytes': '685877'}, {'name': 'Smarty', 'bytes': '35147'}, {'name': 'Starlark', 'bytes': '3504187'}, {'name': 'Swift', 'bytes': '62814'}, {'name': 'Vim Snippet', 'bytes': '58'}]}
package com.interface21.core; /** * InternalErrorException denotes an internal error in the framework. * Assertions are useful while debugging/testing the code, but a * different mechanism is needed to catch internal framework errors in * production. * @author Isabelle Muszynski * @since 5 April 2003 */ public class InternalErrorException extends NestedRuntimeException { /** * Default constructor **/ public InternalErrorException() { super("Internal error"); } /** * Constructor * @param msg the exception message **/ public InternalErrorException(String msg) { super(msg); } /** * Constructor * @param msg the exception message * @param ex the nested exception **/ public InternalErrorException(String msg, Throwable ex) { super(msg, ex); } }
{'content_hash': '14806af4c8933e2251865c15c7864fdb', 'timestamp': '', 'source': 'github', 'line_count': 37, 'max_line_length': 70, 'avg_line_length': 22.43243243243243, 'alnum_prop': 0.6867469879518072, 'repo_name': 'Will1229/LearnSpring', 'id': 'c8f69958368c9fabb30854636c4cd2193b13280a', 'size': '830', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'spring-framework-0.9.1/src/com/interface21/core/InternalErrorException.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '614'}, {'name': 'CSS', 'bytes': '11684'}, {'name': 'HTML', 'bytes': '12756484'}, {'name': 'Java', 'bytes': '1572315'}, {'name': 'Shell', 'bytes': '137'}]}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc (version 1.7.0_03) on Wed May 01 12:49:41 CEST 2013 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class net.sourceforge.pmd.util.CompoundListTest (PMD 5.0.4 Test API)</title> <meta name="date" content="2013-05-01"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class net.sourceforge.pmd.util.CompoundListTest (PMD 5.0.4 Test API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../net/sourceforge/pmd/util/CompoundListTest.html" title="class in net.sourceforge.pmd.util">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?net/sourceforge/pmd/util//class-useCompoundListTest.html" target="_top">Frames</a></li> <li><a href="CompoundListTest.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class net.sourceforge.pmd.util.CompoundListTest" class="title">Uses of Class<br>net.sourceforge.pmd.util.CompoundListTest</h2> </div> <div class="classUseContainer">No usage of net.sourceforge.pmd.util.CompoundListTest</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../net/sourceforge/pmd/util/CompoundListTest.html" title="class in net.sourceforge.pmd.util">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?net/sourceforge/pmd/util//class-useCompoundListTest.html" target="_top">Frames</a></li> <li><a href="CompoundListTest.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2002-2013 <a href="http://pmd.sourceforge.net/">InfoEther</a>. All Rights Reserved.</small></p> </body> </html>
{'content_hash': '18676be03641ddf9945b74b0ac3b794b', 'timestamp': '', 'source': 'github', 'line_count': 117, 'max_line_length': 145, 'avg_line_length': 37.85470085470085, 'alnum_prop': 0.6204560848950101, 'repo_name': 'jmagas/RedditDailyProgrammer', 'id': '7ade1204721066dc5a59830f7b95c2133d278c1c', 'size': '4429', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/pmd-bin-5.0.4/docs/testapidocs/net/sourceforge/pmd/util/class-use/CompoundListTest.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '49573'}, {'name': 'Java', 'bytes': '542603'}, {'name': 'JavaScript', 'bytes': '7987'}, {'name': 'Perl', 'bytes': '1836'}, {'name': 'XSLT', 'bytes': '114364'}]}
from __future__ import absolute_import import matplotlib #matplotlib.use('Agg') import sys #import yaml import os #import multiprocessing as mp from matplotlib import pyplot as plt import numpy as np import warnings from textwrap import wrap #warnings.filterwarnings("ignore") from metatlas.io import metatlas_get_data_helper_fun as ma_data def plot_chromatogram(d,file_name, ax=None): """ """ if ax is None: ax = plt.gca() rt_min = d['identification'].rt_references[0].rt_min rt_max = d['identification'].rt_references[0].rt_max rt_peak = d['identification'].rt_references[0].rt_peak if len(d['data']['eic']['rt']) > 1: x = np.asarray(d['data']['eic']['rt']) y = np.asarray(d['data']['eic']['intensity']) ax.plot(x,y,'k-',linewidth=2.0,alpha=1.0) myWhere = np.logical_and(x>=rt_min, x<=rt_max ) ax.fill_between(x,0,y,myWhere, facecolor='c', alpha=0.3) ax.axvline(rt_min, color='k',linewidth=2.0) ax.axvline(rt_max, color='k',linewidth=2.0) ax.axvline(rt_peak, color='r',linewidth=2.0) ax.set_title("\n".join(wrap(file_name,54)),fontsize=12,weight='bold') def plot_compounds_and_files_mp(kwargs): #print(mp.current_process()) my_data= kwargs['data'] # data for all compounds for one file file_name = kwargs['file_name'] # full path of output file name nRows, nCols = kwargs['rowscols'] names = kwargs['names'] share_y = kwargs['share_y'] # plt.ioff() f,ax = plt.subplots(nRows, nCols, sharey=share_y,figsize=(8*nCols,nRows*6)) ax = ax.flatten() plt.rcParams['pdf.fonttype']=42 plt.rcParams['pdf.use14corefonts'] = True # matplotlib.rc('font', family='sans-serif') # matplotlib.rc('font', serif='Helvetica') plt.rcParams['text.usetex'] = False plt.rcParams.update({'font.size': 12}) plt.rcParams.update({'font.weight': 'bold'}) plt.rcParams['axes.linewidth'] = 2 # set the value globally for i,name in enumerate(names): plot_chromatogram(my_data[i], name, ax=ax[i]) f.savefig(file_name) plt.close(f) def plot_compounds_and_files(output_dir, data, nCols = 8, share_y = False, pool=None, plot_types='both'): ''' Parameters ---------- output_dir location of saved pdf plots nCols number of columns per pdf file share_y subplots share/not share they y axis processes number of cores to use plot_types compounds per file or files per compound or both Returns ------- nothing ''' file_names = ma_data.get_file_names(data) compound_names = ma_data.get_compound_names(data)[0] # create directory if necessary if not os.path.exists(output_dir): os.makedirs(output_dir) # setup the parameters according to the request if 'files' in plot_types.lower(): nRows = int(np.ceil(len(compound_names)/float(nCols))) args_list = [] for file_idx, my_file in enumerate(file_names): kwargs = {'data': data[file_idx], 'file_name': os.path.join(output_dir, my_file +'.pdf'), 'rowscols': (nRows, nCols), 'share_y': share_y, 'names': compound_names} args_list.append(kwargs) if 'compounds' in plot_types.lower(): nRows = int(np.ceil(len(file_names)/float(nCols))) args_list = [] for compound_idx, my_compound in enumerate(compound_names): my_data = list() for file_idx, my_file in enumerate(file_names): my_data.append(data[file_idx][compound_idx]) kwargs = {'data': my_data, 'file_name': os.path.join(output_dir, my_compound+'.pdf'), 'rowscols': (nRows, nCols), 'share_y': share_y, 'names': file_names} args_list.append(kwargs) pool.map(plot_compounds_and_files_mp, args_list) #if __name__ == '__main__': # #sys.path.insert(0, '/global/homes/j/jtouma/metatlas') # import pickle # # # load pickled data # info = pickle.load(open(sys.argv[1], "rb")) # sys.path.insert(info['path_idx'], info['path']) # from metatlas.helpers import metatlas_get_data_helper_fun as ma_data # data = ma_data.get_dill_data(info['pkl_file']) # file_names = ma_data.get_file_names(data) # compound_names = ma_data.get_compound_names(data)[0] # # print("\n") # print(50*'-') # print("Number of file: " + str(len(file_names))) # print("Number of compounds: " + str(len(compound_names))) # if info['plot_types'].lower() == 'both': # print("Processing both files and compounds") # else: # print("processing " + info['plot_types'].lower() + " only") # print("Using " + str(info['processes']) + " out of " + str(mp.cpu_count()) + " available cores") # print(50*'-') # print("\n") # plot_compounds_and_files(output_dir=info['output_dir'], # data=data, # compound_names=compound_names, # file_names=file_names, # nCols=info['nCols'], # share_y=info['share_y'], # processes=info['processes'], # plot_types=info['plot_types']) #
{'content_hash': 'cfe0c3ba178f2f1e531ea05c1618db23', 'timestamp': '', 'source': 'github', 'line_count': 157, 'max_line_length': 101, 'avg_line_length': 35.07643312101911, 'alnum_prop': 0.5658253132376975, 'repo_name': 'biorack/metatlas', 'id': 'b1f4dc1c97120abd0a4fe41459369af8ebc14f50', 'size': '5507', 'binary': False, 'copies': '2', 'ref': 'refs/heads/main', 'path': 'metatlas/plots/chromatograms_mp_plots.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Dockerfile', 'bytes': '4850'}, {'name': 'Jupyter Notebook', 'bytes': '1233246'}, {'name': 'Python', 'bytes': '1501450'}, {'name': 'Shell', 'bytes': '66479'}, {'name': 'wdl', 'bytes': '18796'}]}
package org.spongepowered.api.entity; /** * Represents an experience orb. */ public interface ExperienceOrb extends Entity { }
{'content_hash': '32a9bc681c44514e637156a0d07e1730', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 47, 'avg_line_length': 14.666666666666666, 'alnum_prop': 0.7424242424242424, 'repo_name': 'gabizou/SpongeAPI', 'id': 'edf8ad588dd6da66f5c1ea6b5b12331e36eaf051', 'size': '1382', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'src/main/java/org/spongepowered/api/entity/ExperienceOrb.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '3241918'}, {'name': 'Shell', 'bytes': '77'}]}
// disable min/max macro defines on vc6: // #endif #if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 # if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # endif # define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_PRIVATE_IN_AGGREGATE # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_DEDUCED_TYPENAME # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE // VC++ 6/7 has member templates but they have numerous problems including // cases of silent failure, so for safety we define: # define BOOST_NO_MEMBER_TEMPLATES // For VC++ experts wishing to attempt workarounds, we define: # define BOOST_MSVC6_MEMBER_TEMPLATES # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_SWPRINTF # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_SFINAE # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif #endif #if _MSC_VER < 1400 // although a conforming signature for swprint exists in VC7.1 // it appears not to actually work: # define BOOST_NO_SWPRINTF #endif #if defined(UNDER_CE) // Windows CE does not have a conforming signature for swprintf # define BOOST_NO_SWPRINTF #endif #if _MSC_VER <= 1400 // 1400 == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif #if _MSC_VER <= 1600 // 1600 == VC++ 10.0 # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #if _MSC_VER == 1500 // 1500 == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif #if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 # define BOOST_NO_INITIALIZER_LISTS #endif #ifndef _NATIVE_WCHAR_T_DEFINED # define BOOST_NO_INTRINSIC_WCHAR_T #endif #if defined(_WIN32_WCE) || defined(UNDER_CE) # define BOOST_NO_THREADEX # define BOOST_NO_GETSYSTEMTIMEASFILETIME # define BOOST_NO_SWPRINTF #endif // // check for exception handling support: #ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif // // __int64 support: // #if (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 #endif #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) # define BOOST_HAS_LONG_LONG #else # define BOOST_NO_LONG_LONG #endif #if (_MSC_VER >= 1400) && !defined(_DEBUG) # define BOOST_HAS_NRVO #endif // // disable Win32 API's if compiler extentions are // turned off: // #ifndef _MSC_EXTENSIONS # define BOOST_DISABLE_WIN32 #endif #ifndef _CPPRTTI # define BOOST_NO_RTTI #endif // // all versions support __declspec: // #define BOOST_HAS_DECLSPEC // // C++0x features // // See above for BOOST_NO_LONG_LONG #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES // MSVC 2010 CTP has some support for C++0x, but we still disable it until the compiler release // #if _MSC_VER < 1600 #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // #endif // _MSC_VER < 1600 // // prefix and suffix headers: // #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE // these compilers have been shipped with, and even that is not all of it. Some // were shipped with freely downloadable SDKs, others as crosscompilers in eVC. // IOW, you can't use these 'versions' in any sensible way. Sorry. # if defined(UNDER_CE) # if _MSC_VER < 1200 // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION evc8 # elif _MSC_VER == 1500 # define BOOST_COMPILER_VERSION evc9 # elif _MSC_VER == 1600 # define BOOST_COMPILER_VERSION evc10 # else # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" # else # pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") # endif # endif # else # if _MSC_VER < 1200 // Note: these are so far off, they are not really supported # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 # elif _MSC_VER == 1300 # define BOOST_COMPILER_VERSION 7.0 # elif _MSC_VER == 1310 # define BOOST_COMPILER_VERSION 7.1 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION 8.0 # elif _MSC_VER == 1500 # define BOOST_COMPILER_VERSION 9.0 # elif _MSC_VER == 1600 # define BOOST_COMPILER_VERSION 10.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif #define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // versions check: // we don't support Visual C++ prior to version 6: #if _MSC_VER < 1200 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 1500 (VC9): #if (_MSC_VER > 1600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else # pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif
{'content_hash': '9dcd491c9848ecf728e249e88cda069c', 'timestamp': '', 'source': 'github', 'line_count': 212, 'max_line_length': 123, 'avg_line_length': 30.212264150943398, 'alnum_prop': 0.7110070257611241, 'repo_name': 'ruchiherself/MulRFRepo', 'id': '552e5bb160a70b74dbc90f50f2461d9e961822aa', 'size': '7466', 'binary': False, 'copies': '10', 'ref': 'refs/heads/master', 'path': 'MulRFScorer/include/boost/config/compiler/visualc.hpp', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '161390'}, {'name': 'C++', 'bytes': '128802326'}, {'name': 'CSS', 'bytes': '8263'}, {'name': 'D', 'bytes': '159646'}, {'name': 'Haskell', 'bytes': '1061'}, {'name': 'JavaScript', 'bytes': '2772'}, {'name': 'Perl', 'bytes': '88751'}, {'name': 'Scala', 'bytes': '73524'}, {'name': 'Shell', 'bytes': '28350'}]}
__pragma(code_seg(push)) \ //__pragma(code_seg(.text)) #define SDHC_NONPAGED_SEGMENT_END \ __pragma(code_seg(pop)) #define SDHC_PAGED_SEGMENT_BEGIN \ __pragma(code_seg(push)) \ __pragma(code_seg("PAGE")) #define SDHC_PAGED_SEGMENT_END \ __pragma(code_seg(pop)) #define SDHC_INIT_SEGMENT_BEGIN \ __pragma(code_seg(push)) \ __pragma(code_seg("INIT")) #define SDHC_INIT_SEGMENT_END \ __pragma(code_seg(pop)) // // Support placement semantics for object construction // __forceinline void* __cdecl operator new ( size_t, void* Ptr ) throw () { return Ptr; } // operator new ( size_t, void* ) __forceinline void __cdecl operator delete ( void* Ptr ) throw () { NT_ASSERT(!"Unexpected call!"); if (Ptr) ::ExFreePool(Ptr); } // operator delete ( void* ) __forceinline void __cdecl operator delete ( void* Ptr, size_t ) throw () { NT_ASSERT(!"Unexpected call!"); if (Ptr) ::ExFreePool(Ptr); } // operator delete ( void*, size_t ) // // Standard SD Commands Index // #define SDCMD_STOP_TRANSMISSION 12 #define SDCMD_SELECT_CARD 7 #if DBG // // When enabled, spawns a system thread that keeps updating a shadowed copy of // SDHC registers in a tight loop // Status sampling floods the IO bus and will degrade performance use only // for debugging purposes // #define ENABLE_STATUS_SAMPLING 0 #endif // // When enabled, logs on request completion of each data transfer request useful // measurements that aid in SDHC performance assessment // #define ENABLE_PERFORMANCE_LOGGING 1 extern "C" DRIVER_INITIALIZE DriverEntry; // // class SDHC // class SDHC { friend DRIVER_INITIALIZE DriverEntry; private: // non-paged // // Empirically chosen timeout numbers that seem to work with Sdport and SDHC // Numbers are chosen such that any waitFor* method will timeout after // a lower bound of 1 second of call blocking, either because of polling // timeout or due to HW Read/Write/Erase timeout on the SDHC // enum : ULONG { // // Number of register maximum polls // _POLL_RETRY_COUNT = 100000, // // Waits between each registry poll // _POLL_WAIT_US = 10, // // Threshold used to catch very long waits on SDHC FSM state transitions // This is very helpful in catching poorly behaving SDCards with high latency // of finishing block writes // _LONG_FSM_WAIT_TIME_THRESHOLD_US = 100000, // // Divider used to determine SDHC HW timeout for Read/Write/Erase // The time-out value set in TOUT register is SDCLK / _RWE_TIMEOUT_CLOCK_DIV // A value of 1 means 1s HW timeout, a value of 4 means 1/4 of a second timeout // _RWE_TIMEOUT_CLOCK_DIV = 1, }; // enum enum class _REGISTER : ULONG { CMD = 0x00, ARG = 0x04, TOUT = 0x08, CDIV = 0x0C, RSP0 = 0x10, RSP1 = 0x14, RSP2 = 0x18, RSP3 = 0x1C, HSTS = 0x20, VDD = 0x30, EDM = 0x34, HCFG = 0x38, HBCT = 0x3C, DATA = 0x40, HBLC = 0x50 }; // enum class _REGISTER union _CMD { enum : ULONG { OFFSET = ULONG(_REGISTER::CMD) }; UINT32 AsUint32; struct { unsigned Command : 6; // 0:5 unsigned ReadCmd : 1; // 6 unsigned WriteCmd : 2; // 7:8 unsigned ResponseCmd : 2; // 9:10 unsigned BusyCmd : 1; // 11 unsigned _reserved0 : 2; // 12:13 unsigned FailFlag : 1; // 14 unsigned NewFlag : 1; // 15 unsigned _reserved1 : 16; // 16:31 } Fields; }; // union _CMD union _ARG { enum : ULONG { OFFSET = ULONG(_REGISTER::ARG) }; UINT32 AsUint32; struct { unsigned Argument : 32; // 0:31 } Fields; }; // union _ARG union _TOUT { enum : ULONG { OFFSET = ULONG(_REGISTER::TOUT) }; UINT32 AsUint32; struct { unsigned Timeout : 32; // 0:31 } Fields; }; // union _TOUT union _CDIV { enum : ULONG { OFFSET = ULONG(_REGISTER::CDIV) }; UINT32 AsUint32; struct { unsigned Clockdiv : 11; // 0:10 unsigned _reserved0 : 21; // 11:31 } Fields; }; // union _CDIV union _RSP0 { enum : ULONG { OFFSET = ULONG(_REGISTER::RSP0) }; UINT32 AsUint32; struct { unsigned CardStatus : 32; // 0:31 } Fields; }; // union _RSP0 union _RSP1 { enum : ULONG { OFFSET = ULONG(_REGISTER::RSP1) }; UINT32 AsUint32; struct { unsigned CidCsd : 32; // 0:31 } Fields; }; // union _RSP1 union _RSP2 { enum : ULONG { OFFSET = ULONG(_REGISTER::RSP2) }; UINT32 AsUint32; struct { unsigned CidCsd : 32; // 0:31 } Fields; }; // union _RSP2 union _RSP3 { enum : ULONG { OFFSET = ULONG(_REGISTER::RSP3) }; UINT32 AsUint32; struct { unsigned CidCsd : 32; // 0:31 } Fields; }; // union _RSP3 union _HSTS { enum : ULONG { OFFSET = ULONG(_REGISTER::HSTS) }; enum : UINT32 { UINT32_DATA_MASK = 0x1, UINT32_ERROR_MASK = 0x00F8, UINT32_IRPT_MASK = 0x0700, UINT32_EVENTS_MASK = UINT32_IRPT_MASK | UINT32_DATA_MASK, UINT32_EVENTS_AND_ERRORS_MASK = UINT32_EVENTS_MASK | UINT32_ERROR_MASK }; UINT32 AsUint32; struct { unsigned DataFlag : 1; // 0 unsigned _reserved0 : 2; // 1:2 unsigned FifoError : 1; // 3 unsigned Crc7Error : 1; // 4 unsigned Crc16Error : 1; // 5 unsigned CmdTimeOut : 1; // 6 unsigned RewTimeOut : 1; // 7 unsigned SdioIrpt : 1; // 8 unsigned BlockIrpt : 1; // 9 unsigned BusyIrpt : 1; // 10 unsigned _reserved1 : 21; // 11:31 } Fields; }; // union _HSTS union _VDD { enum : ULONG { OFFSET = ULONG(_REGISTER::VDD) }; UINT32 AsUint32; struct { unsigned PowerOn : 1; // 0 unsigned ClockOff : 1; // 1 unsigned _reserved0 : 30; // 2:31 } Fields; }; // union _VDD union _EDM { enum : ULONG { OFFSET = ULONG(_REGISTER::EDM) }; enum : UINT32 { UINT32_FSM_IDENTMODE = 0x0, UINT32_FSM_DATAMODE = 0x1, UINT32_FSM_WRITESTART1 = 0xa }; UINT32 AsUint32; struct { unsigned StateMachine : 4; // 0:3 unsigned FifoCount : 5; // 4:8 unsigned WriteThreshold : 5; // 9:13 unsigned ReadThreshold : 5; // 14:18 unsigned Force : 1; // 19 unsigned Clock : 1; // 20 unsigned ClearFifo : 1; // 21 unsigned _reserved0 : 10; // 22:31 } Fields; }; // union _EDM union _HCFG { enum : ULONG { OFFSET = ULONG(_REGISTER::HCFG) }; enum : UINT32 { UINT32_IRPT_EN_MASK = 0x0530 }; UINT32 AsUint32; struct { unsigned RelCmdLine : 1; // 0 unsigned WideIntBus : 1; // 1 unsigned WideExtBus : 1; // 2 unsigned SlowCard : 1; // 3 unsigned DataIrptEn : 1; // 4 unsigned SdioIrptEn : 1; // 5 unsigned _reserved0 : 2; // 6:7 unsigned BlockIrptEn : 1; // 8 unsigned _reserved1 : 1; // 9 unsigned BusyIrptEn : 1; // 10 unsigned _reserved2 : 21; // 11:31 } Fields; }; // union _HCFG union _HBCT { enum : ULONG { OFFSET = ULONG(_REGISTER::HBCT) }; UINT32 AsUint32; struct { unsigned ByteCount : 32; // 0:31 } Fields; }; // union _HBCT union _DATA { enum : ULONG { OFFSET = ULONG(_REGISTER::DATA) }; UINT32 AsUint32; struct { unsigned Data : 32; // 0:31 } Fields; }; // union _DATA union _HBLC { enum : ULONG { OFFSET = ULONG(_REGISTER::HBLC) }; UINT32 AsUint32; struct { unsigned BlockCount : 9; // 0:8 unsigned _reserved0 : 23; // 9:31 } Fields; }; // union _HBLC union _SDPORT_EVENTS { UINT32 AsUint32; struct { unsigned CardResponse : 1; // 0 unsigned CardRwEnd : 1; // 1 unsigned BlockGap : 1; // 2 unsigned DmaComplete : 1; // 3 unsigned BufferEmpty : 1; // 4 unsigned BufferFull : 1; // 5 unsigned CardChange : 2; // 6:7 unsigned CardInterrupt : 1; // 8 unsigned _reserved0 : 3; // 9:11 unsigned Tuning : 1; // 12 unsigned _reserved1 : 2; // 13:14 unsigned Error : 1; // 15 unsigned _reserved2 : 16; // 16:31 } Fields; }; // _SDPORT_EVENTS union _SDPORT_ERRORS { UINT32 AsUint32; struct { unsigned CmdTimeout : 1; // 0 unsigned CmdCrcError : 1; // 1 unsigned CmdEndBitError : 1; // 2 unsigned CmdIndexError : 1; // 3 unsigned DataTimeout : 1; // 4 unsigned DataCrcError : 1; // 5 unsigned DataEndBitError : 1; // 6 unsigned BusPowerError : 1; // 7 unsigned _reserved0 : 21; // 8:29 unsigned GenericIoError : 1; // 30 unsigned _reserved1 : 1; // 31 } Fields; }; // _SDPORT_ERRORS template < typename _T_REG_UNION > __forceinline void readRegister ( _Out_ _T_REG_UNION* RegUnionPtr ) const throw () { C_ASSERT(sizeof(UINT32) == sizeof(ULONG)); ULONG* const regPtr = reinterpret_cast<ULONG*>( ULONG_PTR(this->basePtr) + ULONG(RegUnionPtr->OFFSET)); RegUnionPtr->AsUint32 = ::READ_REGISTER_ULONG(regPtr); } // readRegister<...> ( _T_REG_UNION* ) template < typename _T_REG_UNION > __forceinline void readRegisterNoFence ( _Out_ _T_REG_UNION* RegUnionPtr ) const throw () { C_ASSERT(sizeof(UINT32) == sizeof(ULONG)); ULONG* const regPtr = reinterpret_cast<ULONG*>( ULONG_PTR(this->basePtr) + ULONG(RegUnionPtr->OFFSET)); RegUnionPtr->AsUint32 = ::READ_REGISTER_NOFENCE_ULONG(regPtr); } // readRegisterNoFence<...> ( _T_REG_UNION* ) template < typename _T_REG_UNION > __forceinline _T_REG_UNION readRegister () const throw () { _T_REG_UNION regUnion; this->readRegister(&regUnion); return regUnion; } // readRegister<...> () template < typename _T_REG_UNION > __forceinline _T_REG_UNION readRegisterNoFence () const throw () { _T_REG_UNION regUnion; this->readRegisterNoFence(&regUnion); return regUnion; } // readRegisterNoFence<...> () template < typename _T_REG_UNION > __forceinline void writeRegister ( _T_REG_UNION RegUnion ) const throw () { C_ASSERT(sizeof(UINT32) == sizeof(ULONG)); ULONG* const regPtr = reinterpret_cast<ULONG*>( ULONG_PTR(this->basePtr) + ULONG(RegUnion.OFFSET)); ::WRITE_REGISTER_ULONG(regPtr, RegUnion.AsUint32); } // writeRegister<...> ( _T_REG_UNION ) template < typename _T_REG_UNION > __forceinline void writeRegisterNoFence ( _T_REG_UNION RegUnion ) const throw () { C_ASSERT(sizeof(UINT32) == sizeof(ULONG)); ULONG* const regPtr = reinterpret_cast<ULONG*>( ULONG_PTR(this->basePtr) + ULONG(RegUnion.OFFSET)); ::WRITE_REGISTER_NOFENCE_ULONG(regPtr, RegUnion.AsUint32); } // writeRegisterNoFence<...> ( _T_REG_UNION ) NTSTATUS readFromFifo ( _Out_writes_bytes_(Size) void* BufferPtr, ULONG Size ) throw (); NTSTATUS writeToFifo ( _In_reads_bytes_(Size) const void* BufferPtr, ULONG Size ) throw (); enum class _COMMAND_RESPONSE : UCHAR { SHORT_48BIT = 0, LONG_136BIT = 1, NO = 2 }; // enum class _COMMAND_RESPONSE static SDPORT_GET_SLOT_COUNT sdhcGetSlotCount; static SDPORT_GET_SLOT_CAPABILITIES sdhcGetSlotCapabilities; static SDPORT_INTERRUPT sdhcInterrupt; static SDPORT_ISSUE_REQUEST sdhcIssueRequest; static SDPORT_GET_RESPONSE sdhcGetResponse; static SDPORT_REQUEST_DPC sdhcRequestDpc; static SDPORT_TOGGLE_EVENTS sdhcToggleEvents; static SDPORT_CLEAR_EVENTS sdhcClearEvents; static SDPORT_SAVE_CONTEXT sdhcSaveContext; static SDPORT_RESTORE_CONTEXT sdhcRestoreContext; static SDPORT_INITIALIZE sdhcInitialize; static SDPORT_ISSUE_BUS_OPERATION sdhcIssueBusOperation; static SDPORT_GET_CARD_DETECT_STATE sdhcGetCardDetectState; static SDPORT_GET_WRITE_PROTECT_STATE sdhcGetWriteProtectState; static SDPORT_CLEANUP sdhcCleanup; _IRQL_requires_max_(APC_LEVEL) NTSTATUS resetHost ( SDPORT_RESET_TYPE ResetType ) throw (); _IRQL_requires_max_(APC_LEVEL) NTSTATUS setClock ( ULONG FrequencyKhz ) throw (); _IRQL_requires_min_(DISPATCH_LEVEL) _HCFG unmaskInterrupts ( _HCFG Unmask ) throw (); _IRQL_requires_min_(DISPATCH_LEVEL) _HCFG maskInterrupts ( _HCFG Mask ) throw (); _IRQL_requires_(DISPATCH_LEVEL) NTSTATUS sendRequestCommand ( _Inout_ SDPORT_REQUEST* RequestPtr ) throw (); _IRQL_requires_(DISPATCH_LEVEL) NTSTATUS sendCommandInternal ( _CMD Cmd, _ARG Arg, bool WaitCompletion ) throw (); _IRQL_requires_(DISPATCH_LEVEL) NTSTATUS startTransfer ( _Inout_ SDPORT_REQUEST* RequestPtr ) throw (); _IRQL_requires_(DISPATCH_LEVEL) NTSTATUS startTransferPio ( _Inout_ SDPORT_REQUEST* RequestPtr ) throw (); NTSTATUS transferSingleBlockPio ( _Inout_ SDPORT_REQUEST* RequestPtr ) throw (); NTSTATUS transferMultiBlockPio ( _Inout_ SDPORT_REQUEST* RequestPtr ) throw (); _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS sendNoTransferCommand ( UCHAR Cmd, ULONG Arg, SDPORT_TRANSFER_DIRECTION TransferDirection, SDPORT_RESPONSE_TYPE ResponseType, bool WaitCompletion ) throw (); _IRQL_requires_max_(DISPATCH_LEVEL) NTSTATUS stopTransmission ( bool WaitCompletion ) throw () { return this->sendNoTransferCommand( SDCMD_STOP_TRANSMISSION, 0, SdTransferDirectionUndefined, SdResponseTypeR1B, WaitCompletion); } _IRQL_requires_max_(DISPATCH_LEVEL) void completeRequest ( _Inout_ SDPORT_REQUEST* RequestPtr, NTSTATUS Status ) throw (); _COMMAND_RESPONSE getCommandResponseFromType ( SDPORT_RESPONSE_TYPE ResponseType ) throw (); _CMD buildCommand ( UCHAR Command, SDPORT_TRANSFER_DIRECTION TransferDirection, SDPORT_RESPONSE_TYPE ResponseType ) throw (); NTSTATUS prepareTransferPio ( _Inout_ SDPORT_REQUEST* RequestPtr) throw (); NTSTATUS waitForLastCommandCompletion () throw (); NTSTATUS waitForDataFlag ( _Out_opt_ ULONG* WaitTimeUsPtr ) throw (); NTSTATUS waitForFsmState( ULONG state ) throw (); NTSTATUS drainReadFifo() throw (); NTSTATUS getErrorStatus ( _HSTS Hsts ) throw (); NTSTATUS getLastCommandCompletionStatus () throw (); _HCFG getInterruptSourcesFromEvents ( _HSTS hsts ) throw () { _HCFG hcfg{ 0 }; hcfg.Fields.DataIrptEn = hsts.Fields.DataFlag; hcfg.Fields.SdioIrptEn = hsts.Fields.SdioIrpt; hcfg.Fields.BlockIrptEn = hsts.Fields.BlockIrpt; hcfg.Fields.BusyIrptEn = hsts.Fields.BusyIrpt; return hcfg; } _SDPORT_EVENTS getSdportEventsFromSdhcEvents ( _HSTS sdhcEvents ) throw () { _SDPORT_EVENTS sdportEvents{ 0 }; sdportEvents.Fields.CardRwEnd = sdhcEvents.Fields.BlockIrpt; sdportEvents.Fields.CardResponse = sdhcEvents.Fields.BusyIrpt; sdportEvents.Fields.BufferEmpty = sdhcEvents.Fields.DataFlag; sdportEvents.Fields.BufferFull = sdhcEvents.Fields.DataFlag; sdportEvents.Fields.Error = (sdhcEvents.AsUint32 & _HSTS::UINT32_ERROR_MASK); sdportEvents.Fields.CardInterrupt = sdhcEvents.Fields.SdioIrpt; return sdportEvents; } _SDPORT_ERRORS getSdportErrorsFromSdhcErrors ( _HSTS sdhcErrors ) throw () { _SDPORT_ERRORS sdportErrors{ 0 }; sdportErrors.Fields.CmdCrcError = (sdhcErrors.Fields.Crc7Error | sdhcErrors.Fields.Crc16Error); sdportErrors.Fields.CmdTimeout = sdhcErrors.Fields.CmdTimeOut; sdportErrors.Fields.DataCrcError = (sdhcErrors.Fields.Crc7Error | sdhcErrors.Fields.Crc16Error); sdportErrors.Fields.DataTimeout = sdhcErrors.Fields.RewTimeOut; sdportErrors.Fields.GenericIoError = sdhcErrors.Fields.FifoError; return sdportErrors; } _HSTS getSdhcEventsFromSdportEvents ( _SDPORT_EVENTS sdportEvents ) throw () { _HSTS sdhcEvents{ 0 }; sdhcEvents.Fields.BlockIrpt = sdportEvents.Fields.CardRwEnd; sdhcEvents.Fields.BusyIrpt = sdportEvents.Fields.CardResponse; sdhcEvents.Fields.DataFlag = (sdportEvents.Fields.BufferEmpty | sdportEvents.Fields.BufferFull); sdhcEvents.Fields.SdioIrpt = sdportEvents.Fields.CardInterrupt; return sdhcEvents; } _HSTS getSdhcErrorsFromSdportErrors ( _SDPORT_ERRORS sdportErrors ) throw () { _HSTS sdhcErrors{ 0 }; sdhcErrors.Fields.Crc7Error = (sdportErrors.Fields.CmdCrcError | sdportErrors.Fields.DataCrcError); sdhcErrors.Fields.Crc16Error = (sdportErrors.Fields.CmdCrcError | sdportErrors.Fields.DataCrcError); sdhcErrors.Fields.CmdTimeOut = sdportErrors.Fields.CmdTimeout; sdhcErrors.Fields.RewTimeOut = sdportErrors.Fields.DataTimeout; sdhcErrors.Fields.FifoError = sdportErrors.Fields.GenericIoError; return sdhcErrors; } _IRQL_requires_max_(APC_LEVEL) KAFFINITY restrictCurrentThreadToSecondaryCores() throw () { // // Set thread affinity mask to restrict scheduling of the current thread // on any processor but CPU0. // KAFFINITY callerAffinity; NT_ASSERTMSG("IRQL unexpected", KeGetCurrentIrql() < DISPATCH_LEVEL); ULONG numCpus = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); ULONG noCpu0AffinityMask = (~(ULONG(~0x0) << numCpus) & ULONG(~0x1)); callerAffinity = KeSetSystemAffinityThreadEx(KAFFINITY(noCpu0AffinityMask)); NT_ASSERTMSG("Thread affinity not set as requested", KeGetCurrentProcessorNumberEx(NULL) != 0); return callerAffinity; } // // SDHC Parameters // PHYSICAL_ADDRESS basePhysicalAddress; void* basePtr; ULONG baseSpaceSize; SDPORT_CAPABILITIES sdhcCapabilities; // // Crashdump mode has a hard requirement of running at CLOCK_LEVEL IRQL // No interrupts are allowed, no memory allocations or event signaling // const BOOLEAN crashdumpMode; #if ENABLE_PERFORMANCE_LOGGING // // Performance Logging // struct _REQUEST_STATISTICS { LARGE_INTEGER StartTimestamp; LONGLONG FifoIoTimeTicks; LONGLONG FifoWaitCount; LONGLONG FifoWaitTimeUs; LONGLONG FifoMaxWaitTimeUs; LONGLONG FsmStateWaitTimeUs; LONGLONG FsmStateWaitCount; LONGLONG FsmStateMinWaitTimeUs; LONGLONG FsmStateMaxWaitTimeUs; LONGLONG LongFsmStateWaitCount; LONGLONG LongFsmStateWaitTimeUs; USHORT BlockCount; } currRequestStats; struct _SDHC_STATISTICS { LONGLONG BlocksWrittenCount; LONGLONG PageSized4KWritesCount; LONGLONG TotalFsmStateWaitTimeUs; LONGLONG LongFsmStateWaitCount; LONGLONG TotalLongFsmStateWaitTimeUs; } sdhcStats; #endif // ENABLE_PERFORMANCE_LOGGING // // PIO Transfer Worker State Management // static KSTART_ROUTINE transferWorker; KEVENT transferWorkerStartedEvt; KEVENT transferWorkerShutdownEvt; KEVENT transferWorkerDoIoEvt; PKTHREAD transferThreadObjPtr; // // An outstanding transfer request that is either owned by the SDHC // miniport or the transfer worker thread // SDPORT_REQUEST* outstandingRequestPtr; // // Used to serialize the PASSIVE_LEVEL execution of resetHost and transfer // worker DoIo event // FAST_MUTEX outstandingRequestLock; struct _REGISTERS_DUMP { _REGISTERS_DUMP () throw (); void UpdateAll ( const SDHC* SdhcPtr ) throw (); void UpdateStatus ( const SDHC* SdhcPtr ) throw (); private: _CMD cmd; _ARG arg; _TOUT tout; _CDIV cdiv; _RSP0 rsp0; _RSP1 rsp1; _RSP2 rsp2; _RSP3 rsp3; _HSTS hsts; _VDD vdd; _EDM edm; _HCFG hcfg; _HBCT hbct; _HBLC hblc; } mutable registersDump; void updateAllRegistersDump () const throw () { this->registersDump.UpdateAll(this); } #if ENABLE_STATUS_SAMPLING // - dump registers for debugging static KSTART_ROUTINE sampleStatusWorker; KEVENT samplingStartedEvt; LONG shutdownSampling; PKTHREAD statusSamplingThreadObjPtr; void updateStatusRegistersDump () const throw () { this->registersDump.UpdateStatus(this); } #endif // ENABLE_STATUS_SAMPLING _IRQL_requires_max_(PASSIVE_LEVEL) SDHC ( PHYSICAL_ADDRESS BasePhysicalAddress, void* BasePtr, ULONG BaseSpaceSize, BOOLEAN CrashdumpMode ) throw (); _IRQL_requires_max_(PASSIVE_LEVEL) ~SDHC () throw (); } // class SDHC #endif // _SDHC_HPP_
{'content_hash': '139d56b68ba14d21c3e150a3bcd6d571', 'timestamp': '', 'source': 'github', 'line_count': 716, 'max_line_length': 103, 'avg_line_length': 31.011173184357542, 'alnum_prop': 0.5952531075481895, 'repo_name': 'ms-iot/bsp', 'id': '83e65b3f62e4678bfc8a11fae5ef564a96f64a22', 'size': '22955', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'drivers/sd/bcm2836/rpisdhc/rpisdhc.hpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '1675'}, {'name': 'C', 'bytes': '1648612'}, {'name': 'C++', 'bytes': '876297'}, {'name': 'Objective-C', 'bytes': '9664'}]}
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright and this notice and otherwise comply with the Use Terms. /** * @path ch15/15.2/15.2.3/15.2.3.9/15.2.3.9-2-a-10.js * @description Object.freeze - 'P' is own named property of an Array object that uses Object's [[GetOwnProperty]] */ function testcase() { var arrObj = []; arrObj.foo = 10; // default [[Configurable]] attribute value of foo: true Object.freeze(arrObj); var desc = Object.getOwnPropertyDescriptor(arrObj, "foo"); delete arrObj.foo; return arrObj.foo === 10 && desc.configurable === false && desc.writable === false; } runTestCase(testcase);
{'content_hash': 'c19916b18635488e2a0b2fb1ca29d586', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 114, 'avg_line_length': 39.875, 'alnum_prop': 0.658307210031348, 'repo_name': 'mbebenita/shumway.ts', 'id': 'efb9a18a1c8912844fea1264ecf70c822d5d0a15', 'size': '957', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'tests/Fidelity/test262/suite/ch15/15.2/15.2.3/15.2.3.9/15.2.3.9-2-a-10.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Elixir', 'bytes': '3294'}, {'name': 'JavaScript', 'bytes': '24658966'}, {'name': 'Shell', 'bytes': '386'}, {'name': 'TypeScript', 'bytes': '18287003'}]}
package org.apache.hadoop.yarn.api.records.impl.pb; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.protocolrecords.ApplicationsRequestScope; import org.apache.hadoop.yarn.api.protocolrecords.ResourceTypes; import org.apache.hadoop.yarn.api.records.AMCommand; import org.apache.hadoop.yarn.api.records.ApplicationAccessType; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType; import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerRetryPolicy; import org.apache.hadoop.yarn.api.records.ContainerState; import org.apache.hadoop.yarn.api.records.ContainerSubState; import org.apache.hadoop.yarn.api.records.ContainerUpdateType; import org.apache.hadoop.yarn.api.records.ExecutionTypeRequest; import org.apache.hadoop.yarn.api.records.ExecutionType; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.LocalResourceType; import org.apache.hadoop.yarn.api.records.LocalResourceVisibility; import org.apache.hadoop.yarn.api.records.LocalizationState; import org.apache.hadoop.yarn.api.records.LogAggregationStatus; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeState; import org.apache.hadoop.yarn.api.records.NodeUpdateType; import org.apache.hadoop.yarn.api.records.QueueACL; import org.apache.hadoop.yarn.api.records.QueueState; import org.apache.hadoop.yarn.api.records.RejectionReason; import org.apache.hadoop.yarn.api.records.ReservationRequestInterpreter; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceInformation; import org.apache.hadoop.yarn.api.records.UpdateContainerError; import org.apache.hadoop.yarn.api.records.UpdateContainerRequest; import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.api.resource.PlacementConstraint.TargetExpression; import org.apache.hadoop.yarn.api.resource.PlacementConstraint.TimedPlacementConstraint; import org.apache.hadoop.yarn.proto.YarnProtos; import org.apache.hadoop.yarn.proto.YarnProtos.AMCommandProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAccessTypeProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationResourceUsageReportProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationTimeoutTypeProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerSubStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto; import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceTypeProto; import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceVisibilityProto; import org.apache.hadoop.yarn.proto.YarnProtos.LogAggregationStatusProto; import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.NodeStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.PlacementConstraintTargetProto; import org.apache.hadoop.yarn.proto.YarnProtos.QueueACLProto; import org.apache.hadoop.yarn.proto.YarnProtos.QueueStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.ReservationRequestInterpreterProto; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; import org.apache.hadoop.yarn.proto.YarnProtos.StringStringMapProto; import org.apache.hadoop.yarn.proto.YarnProtos.TimedPlacementConstraintProto; import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationAttemptStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerRetryPolicyProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerTypeProto; import org.apache.hadoop.yarn.proto.YarnProtos.ExecutionTypeProto; import org.apache.hadoop.yarn.proto.YarnProtos.ExecutionTypeRequestProto; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceTypesProto; import org.apache.hadoop.yarn.proto.YarnProtos.NodeUpdateTypeProto; import org.apache.hadoop.yarn.proto.YarnServiceProtos; import org.apache.hadoop.yarn.proto.YarnServiceProtos.ContainerUpdateTypeProto; import org.apache.hadoop.yarn.proto.YarnServiceProtos.LocalizationStateProto; import org.apache.hadoop.yarn.server.api.ContainerType; import org.apache.hadoop.thirdparty.com.google.common.collect.Interner; import org.apache.hadoop.thirdparty.com.google.common.collect.Interners; import org.apache.hadoop.thirdparty.protobuf.ByteString; /** * Utils to convert enum protos to corresponding java enums and vice versa. */ @Private @Unstable public class ProtoUtils { public static final Interner<ByteString> BYTE_STRING_INTERNER = Interners.newWeakInterner(); /* * ContainerState */ public static ContainerStateProto convertToProtoFormat(ContainerState state) { switch (state) { case NEW: return ContainerStateProto.C_NEW; case RUNNING: return ContainerStateProto.C_RUNNING; case COMPLETE: return ContainerStateProto.C_COMPLETE; default: throw new IllegalArgumentException( "ContainerState conversion unsupported"); } } public static ContainerState convertFromProtoFormat( ContainerStateProto proto) { switch (proto) { case C_NEW: return ContainerState.NEW; case C_RUNNING: return ContainerState.RUNNING; case C_COMPLETE: return ContainerState.COMPLETE; default: throw new IllegalArgumentException( "ContainerStateProto conversion unsupported"); } } /* * Container SubState */ public static ContainerSubStateProto convertToProtoFormat( ContainerSubState state) { switch (state) { case SCHEDULED: return ContainerSubStateProto.CSS_SCHEDULED; case RUNNING: return ContainerSubStateProto.CSS_RUNNING; case PAUSED: return ContainerSubStateProto.CSS_PAUSED; case COMPLETING: return ContainerSubStateProto.CSS_COMPLETING; case DONE: return ContainerSubStateProto.CSS_DONE; default: throw new IllegalArgumentException( "ContainerSubState conversion unsupported"); } } public static ContainerSubState convertFromProtoFormat( ContainerSubStateProto proto) { switch (proto) { case CSS_SCHEDULED: return ContainerSubState.SCHEDULED; case CSS_RUNNING: return ContainerSubState.RUNNING; case CSS_PAUSED: return ContainerSubState.PAUSED; case CSS_COMPLETING: return ContainerSubState.COMPLETING; case CSS_DONE: return ContainerSubState.DONE; default: throw new IllegalArgumentException( "ContainerSubStateProto conversion unsupported"); } } /* * NodeState */ private final static String NODE_STATE_PREFIX = "NS_"; public static NodeStateProto convertToProtoFormat(NodeState e) { return NodeStateProto.valueOf(NODE_STATE_PREFIX + e.name()); } public static NodeState convertFromProtoFormat(NodeStateProto e) { return NodeState.valueOf(e.name().replace(NODE_STATE_PREFIX, "")); } /* * NodeId */ public static NodeIdProto convertToProtoFormat(NodeId e) { return ((NodeIdPBImpl)e).getProto(); } public static NodeId convertFromProtoFormat(NodeIdProto e) { return new NodeIdPBImpl(e); } /* * YarnApplicationState */ public static YarnApplicationStateProto convertToProtoFormat(YarnApplicationState e) { return YarnApplicationStateProto.valueOf(e.name()); } public static YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto e) { return YarnApplicationState.valueOf(e.name()); } /* * YarnApplicationAttemptState */ private static String YARN_APPLICATION_ATTEMPT_STATE_PREFIX = "APP_ATTEMPT_"; public static YarnApplicationAttemptStateProto convertToProtoFormat( YarnApplicationAttemptState e) { return YarnApplicationAttemptStateProto .valueOf(YARN_APPLICATION_ATTEMPT_STATE_PREFIX + e.name()); } public static YarnApplicationAttemptState convertFromProtoFormat( YarnApplicationAttemptStateProto e) { return YarnApplicationAttemptState.valueOf(e.name().replace( YARN_APPLICATION_ATTEMPT_STATE_PREFIX, "")); } /* * ApplicationsRequestScope */ public static YarnServiceProtos.ApplicationsRequestScopeProto convertToProtoFormat(ApplicationsRequestScope e) { return YarnServiceProtos.ApplicationsRequestScopeProto.valueOf(e.name()); } public static ApplicationsRequestScope convertFromProtoFormat (YarnServiceProtos.ApplicationsRequestScopeProto e) { return ApplicationsRequestScope.valueOf(e.name()); } /* * ApplicationResourceUsageReport */ public static ApplicationResourceUsageReportProto convertToProtoFormat(ApplicationResourceUsageReport e) { return ((ApplicationResourceUsageReportPBImpl)e).getProto(); } public static ApplicationResourceUsageReport convertFromProtoFormat(ApplicationResourceUsageReportProto e) { return new ApplicationResourceUsageReportPBImpl(e); } /* * FinalApplicationStatus */ private static String FINAL_APPLICATION_STATUS_PREFIX = "APP_"; public static FinalApplicationStatusProto convertToProtoFormat(FinalApplicationStatus e) { return FinalApplicationStatusProto.valueOf(FINAL_APPLICATION_STATUS_PREFIX + e.name()); } public static FinalApplicationStatus convertFromProtoFormat(FinalApplicationStatusProto e) { return FinalApplicationStatus.valueOf(e.name().replace(FINAL_APPLICATION_STATUS_PREFIX, "")); } /* * LocalResourceType */ public static LocalResourceTypeProto convertToProtoFormat(LocalResourceType e) { return LocalResourceTypeProto.valueOf(e.name()); } public static LocalResourceType convertFromProtoFormat(LocalResourceTypeProto e) { return LocalResourceType.valueOf(e.name()); } /* * LocalResourceVisibility */ public static LocalResourceVisibilityProto convertToProtoFormat(LocalResourceVisibility e) { return LocalResourceVisibilityProto.valueOf(e.name()); } public static LocalResourceVisibility convertFromProtoFormat(LocalResourceVisibilityProto e) { return LocalResourceVisibility.valueOf(e.name()); } /* * AMCommand */ public static AMCommandProto convertToProtoFormat(AMCommand e) { return AMCommandProto.valueOf(e.name()); } public static AMCommand convertFromProtoFormat(AMCommandProto e) { return AMCommand.valueOf(e.name()); } /* * RejectionReason */ private static final String REJECTION_REASON_PREFIX = "RRP_"; public static YarnProtos.RejectionReasonProto convertToProtoFormat( RejectionReason e) { return YarnProtos.RejectionReasonProto .valueOf(REJECTION_REASON_PREFIX + e.name()); } public static RejectionReason convertFromProtoFormat( YarnProtos.RejectionReasonProto e) { return RejectionReason.valueOf(e.name() .replace(REJECTION_REASON_PREFIX, "")); } /* * ByteBuffer */ public static ByteBuffer convertFromProtoFormat(ByteString byteString) { int capacity = byteString.asReadOnlyByteBuffer().rewind().remaining(); byte[] b = new byte[capacity]; byteString.asReadOnlyByteBuffer().get(b, 0, capacity); return ByteBuffer.wrap(b); } public static ByteString convertToProtoFormat(ByteBuffer byteBuffer) { // return ByteString.copyFrom((ByteBuffer)byteBuffer.duplicate().rewind()); int oldPos = byteBuffer.position(); byteBuffer.rewind(); ByteString bs = ByteString.copyFrom(byteBuffer); byteBuffer.position(oldPos); return bs; } /* * QueueState */ private static String QUEUE_STATE_PREFIX = "Q_"; public static QueueStateProto convertToProtoFormat(QueueState e) { return QueueStateProto.valueOf(QUEUE_STATE_PREFIX + e.name()); } public static QueueState convertFromProtoFormat(QueueStateProto e) { return QueueState.valueOf(e.name().replace(QUEUE_STATE_PREFIX, "")); } /* * QueueACL */ private static String QUEUE_ACL_PREFIX = "QACL_"; public static QueueACLProto convertToProtoFormat(QueueACL e) { return QueueACLProto.valueOf(QUEUE_ACL_PREFIX + e.name()); } public static QueueACL convertFromProtoFormat(QueueACLProto e) { return QueueACL.valueOf(e.name().replace(QUEUE_ACL_PREFIX, "")); } /* * ApplicationAccessType */ private static String APP_ACCESS_TYPE_PREFIX = "APPACCESS_"; public static ApplicationAccessTypeProto convertToProtoFormat( ApplicationAccessType e) { return ApplicationAccessTypeProto.valueOf(APP_ACCESS_TYPE_PREFIX + e.name()); } public static ApplicationAccessType convertFromProtoFormat( ApplicationAccessTypeProto e) { return ApplicationAccessType.valueOf(e.name().replace( APP_ACCESS_TYPE_PREFIX, "")); } /* * ApplicationTimeoutType */ private static String APP_TIMEOUT_TYPE_PREFIX = "APP_TIMEOUT_"; public static ApplicationTimeoutTypeProto convertToProtoFormat( ApplicationTimeoutType e) { return ApplicationTimeoutTypeProto .valueOf(APP_TIMEOUT_TYPE_PREFIX + e.name()); } public static ApplicationTimeoutType convertFromProtoFormat( ApplicationTimeoutTypeProto e) { return ApplicationTimeoutType .valueOf(e.name().replace(APP_TIMEOUT_TYPE_PREFIX, "")); } /* * Reservation Request interpreter type */ public static ReservationRequestInterpreterProto convertToProtoFormat( ReservationRequestInterpreter e) { return ReservationRequestInterpreterProto.valueOf(e.name()); } public static ReservationRequestInterpreter convertFromProtoFormat( ReservationRequestInterpreterProto e) { return ReservationRequestInterpreter.valueOf(e.name()); } /* * Log Aggregation Status */ private static final String LOG_AGGREGATION_STATUS_PREFIX = "LOG_"; private static final int LOG_AGGREGATION_STATUS_PREFIX_LEN = LOG_AGGREGATION_STATUS_PREFIX.length(); public static LogAggregationStatusProto convertToProtoFormat( LogAggregationStatus e) { return LogAggregationStatusProto.valueOf(LOG_AGGREGATION_STATUS_PREFIX + e.name()); } public static LogAggregationStatus convertFromProtoFormat( LogAggregationStatusProto e) { return LogAggregationStatus.valueOf(e.name().substring( LOG_AGGREGATION_STATUS_PREFIX_LEN)); } /* * ContainerType */ public static ContainerTypeProto convertToProtoFormat(ContainerType e) { return ContainerTypeProto.valueOf(e.name()); } public static ContainerType convertFromProtoFormat(ContainerTypeProto e) { return ContainerType.valueOf(e.name()); } /* * NodeUpdateType */ public static NodeUpdateTypeProto convertToProtoFormat(NodeUpdateType e) { return NodeUpdateTypeProto.valueOf(e.name()); } public static NodeUpdateType convertFromProtoFormat(NodeUpdateTypeProto e) { return NodeUpdateType.valueOf(e.name()); } /* * ExecutionType */ public static ExecutionTypeProto convertToProtoFormat(ExecutionType e) { return ExecutionTypeProto.valueOf(e.name()); } public static ExecutionType convertFromProtoFormat(ExecutionTypeProto e) { return ExecutionType.valueOf(e.name()); } /* * ContainerUpdateType */ public static ContainerUpdateTypeProto convertToProtoFormat( ContainerUpdateType e) { return ContainerUpdateTypeProto.valueOf(e.name()); } public static ContainerUpdateType convertFromProtoFormat( ContainerUpdateTypeProto e) { return ContainerUpdateType.valueOf(e.name()); } /* * Resource */ public static ResourceProto convertToProtoFormat(Resource r) { return ResourcePBImpl.getProto(r); } public static Resource convertFromProtoFormat(ResourceProto resource) { return new ResourcePBImpl(resource); } /* * ContainerRetryPolicy */ public static ContainerRetryPolicyProto convertToProtoFormat( ContainerRetryPolicy e) { return ContainerRetryPolicyProto.valueOf(e.name()); } public static ContainerRetryPolicy convertFromProtoFormat( ContainerRetryPolicyProto e) { return ContainerRetryPolicy.valueOf(e.name()); } /* * ExecutionTypeRequest */ public static ExecutionTypeRequestProto convertToProtoFormat( ExecutionTypeRequest e) { return ((ExecutionTypeRequestPBImpl)e).getProto(); } public static ExecutionTypeRequest convertFromProtoFormat( ExecutionTypeRequestProto e) { return new ExecutionTypeRequestPBImpl(e); } /* * Container */ public static YarnProtos.ContainerProto convertToProtoFormat( Container t) { return ((ContainerPBImpl)t).getProto(); } public static ContainerPBImpl convertFromProtoFormat( YarnProtos.ContainerProto t) { return new ContainerPBImpl(t); } public static ContainerStatusPBImpl convertFromProtoFormat( YarnProtos.ContainerStatusProto p) { return new ContainerStatusPBImpl(p); } /* * ContainerId */ public static ContainerIdPBImpl convertFromProtoFormat(ContainerIdProto p) { return new ContainerIdPBImpl(p); } public static ContainerIdProto convertToProtoFormat(ContainerId t) { return ((ContainerIdPBImpl) t).getProto(); } /* * UpdateContainerRequest */ public static UpdateContainerRequestPBImpl convertFromProtoFormat( YarnServiceProtos.UpdateContainerRequestProto p) { return new UpdateContainerRequestPBImpl(p); } public static YarnServiceProtos.UpdateContainerRequestProto convertToProtoFormat(UpdateContainerRequest t) { return ((UpdateContainerRequestPBImpl) t).getProto(); } /* * UpdateContainerError */ public static UpdateContainerErrorPBImpl convertFromProtoFormat( YarnServiceProtos.UpdateContainerErrorProto p) { return new UpdateContainerErrorPBImpl(p); } public static YarnServiceProtos.UpdateContainerErrorProto convertToProtoFormat(UpdateContainerError t) { return ((UpdateContainerErrorPBImpl) t).getProto(); } /* * ResourceTypes */ public static ResourceTypesProto converToProtoFormat(ResourceTypes e) { return ResourceTypesProto.valueOf(e.name()); } public static ResourceTypes convertFromProtoFormat(ResourceTypesProto e) { return ResourceTypes.valueOf(e.name()); } public static Map<String, Long> convertStringLongMapProtoListToMap( List<YarnProtos.StringLongMapProto> pList) { Resource tmp = Resource.newInstance(0, 0); Map<String, Long> ret = new HashMap<>(); for (ResourceInformation entry : tmp.getResources()) { ret.put(entry.getName(), 0L); } if (pList != null) { for (YarnProtos.StringLongMapProto p : pList) { ret.put(p.getKey(), p.getValue()); } } return ret; } public static List<YarnProtos.StringLongMapProto> convertMapToStringLongMapProtoList( Map<String, Long> map) { List<YarnProtos.StringLongMapProto> ret = new ArrayList<>(); for (Map.Entry<String, Long> entry : map.entrySet()) { YarnProtos.StringLongMapProto.Builder tmp = YarnProtos.StringLongMapProto.newBuilder(); tmp.setKey(entry.getKey()); tmp.setValue(entry.getValue()); ret.add(tmp.build()); } return ret; } public static List<YarnProtos.StringFloatMapProto> convertMapToStringFloatMapProtoList( Map<String, Float> map) { List<YarnProtos.StringFloatMapProto> ret = new ArrayList<>(); if (map != null) { for (Map.Entry<String, Float> entry : map.entrySet()) { YarnProtos.StringFloatMapProto.Builder tmp = YarnProtos.StringFloatMapProto.newBuilder(); tmp.setKey(entry.getKey()); tmp.setValue(entry.getValue()); ret.add(tmp.build()); } } return ret; } public static Map<String, String> convertStringStringMapProtoListToMap( List<StringStringMapProto> pList) { Map<String, String> ret = new HashMap<>(); if (pList != null) { for (StringStringMapProto p : pList) { if (p.hasKey()) { ret.put(p.getKey(), p.getValue()); } } } return ret; } public static Map<String, Float> convertStringFloatMapProtoListToMap( List<YarnProtos.StringFloatMapProto> pList) { Map<String, Float> ret = new HashMap<>(); if (pList != null) { for (YarnProtos.StringFloatMapProto p : pList) { if (p.hasKey()) { ret.put(p.getKey(), p.getValue()); } } } return ret; } public static List<YarnProtos.StringStringMapProto> convertToProtoFormat( Map<String, String> stringMap) { List<YarnProtos.StringStringMapProto> pList = new ArrayList<>(); if (stringMap != null && !stringMap.isEmpty()) { StringStringMapProto.Builder pBuilder = StringStringMapProto.newBuilder(); for (Map.Entry<String, String> entry : stringMap.entrySet()) { pBuilder.setKey(entry.getKey()); pBuilder.setValue(entry.getValue()); pList.add(pBuilder.build()); } } return pList; } public static PlacementConstraintTargetProto.TargetType convertToProtoFormat( TargetExpression.TargetType t) { return PlacementConstraintTargetProto.TargetType.valueOf(t.name()); } public static TargetExpression.TargetType convertFromProtoFormat( PlacementConstraintTargetProto.TargetType t) { return TargetExpression.TargetType.valueOf(t.name()); } /* * TimedPlacementConstraint.DelayUnit */ public static TimedPlacementConstraintProto.DelayUnit convertToProtoFormat( TimedPlacementConstraint.DelayUnit u) { return TimedPlacementConstraintProto.DelayUnit.valueOf(u.name()); } public static TimedPlacementConstraint.DelayUnit convertFromProtoFormat( TimedPlacementConstraintProto.DelayUnit u) { return TimedPlacementConstraint.DelayUnit.valueOf(u.name()); } /* * ApplicationId */ public static ApplicationIdPBImpl convertFromProtoFormat( ApplicationIdProto p) { return new ApplicationIdPBImpl(p); } public static ApplicationIdProto convertToProtoFormat(ApplicationId t) { return ((ApplicationIdPBImpl) t).getProto(); } //Localization State private final static String LOCALIZATION_STATE_PREFIX = "L_"; public static LocalizationStateProto convertToProtoFormat( LocalizationState e) { return LocalizationStateProto.valueOf(LOCALIZATION_STATE_PREFIX + e.name()); } public static LocalizationState convertFromProtoFormat( LocalizationStateProto e) { return LocalizationState.valueOf(e.name() .replace(LOCALIZATION_STATE_PREFIX, "")); } }
{'content_hash': '08c061018f7f74d23ba9701cfe7e46b8', 'timestamp': '', 'source': 'github', 'line_count': 681, 'max_line_length': 110, 'avg_line_length': 34.098384728340676, 'alnum_prop': 0.7537143103225529, 'repo_name': 'apurtell/hadoop', 'id': '64bf8cf5d387651ecc5efd10404f4a3a50c17d72', 'size': '24027', 'binary': False, 'copies': '7', 'ref': 'refs/heads/trunk', 'path': 'hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ProtoUtils.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '78445'}, {'name': 'C', 'bytes': '2023750'}, {'name': 'C++', 'bytes': '2873786'}, {'name': 'CMake', 'bytes': '120569'}, {'name': 'CSS', 'bytes': '94990'}, {'name': 'Dockerfile', 'bytes': '4613'}, {'name': 'HTML', 'bytes': '221057'}, {'name': 'Handlebars', 'bytes': '207062'}, {'name': 'Java', 'bytes': '97177756'}, {'name': 'JavaScript', 'bytes': '1273196'}, {'name': 'Python', 'bytes': '14938'}, {'name': 'SCSS', 'bytes': '23607'}, {'name': 'Shell', 'bytes': '517782'}, {'name': 'TLA', 'bytes': '14997'}, {'name': 'TSQL', 'bytes': '17801'}, {'name': 'TeX', 'bytes': '19322'}, {'name': 'XSLT', 'bytes': '18026'}]}
package org.apache.camel.component.iec60870.client; import java.util.Objects; import org.apache.camel.component.iec60870.BaseOptions; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; import org.eclipse.neoscada.protocol.iec60870.ProtocolOptions; import org.eclipse.neoscada.protocol.iec60870.client.data.DataModuleOptions; @UriParams public class ClientOptions extends BaseOptions<ClientOptions> { /** * Data module options */ @UriParam(javaType = "org.eclipse.neoscada.protocol.iec60870.client.data.DataModuleOptions") private DataModuleOptions.Builder dataModuleOptions; // dummy for doc generation /** * Whether background scan transmissions should be ignored. */ @UriParam(label = "data", defaultValue = "true") private boolean ignoreBackgroundScan = true; // dummy for doc generation /** * Whether to include the source address */ @UriParam(label = "data") private byte causeSourceAddress; /** * Timeout in millis to wait for client to establish a connected connection. */ @UriParam(label = "data", defaultValue = "10000") private int connectionTimeout = 10000; public ClientOptions() { this.dataModuleOptions = new DataModuleOptions.Builder(); } public ClientOptions(final ClientOptions other) { this(other.getProtocolOptions(), other.getDataModuleOptions()); } public ClientOptions(final ProtocolOptions protocolOptions, final DataModuleOptions dataOptions) { super(protocolOptions); Objects.requireNonNull(dataOptions); this.dataModuleOptions = new DataModuleOptions.Builder(dataOptions); } public void setDataModuleOptions(final DataModuleOptions dataModuleOptions) { Objects.requireNonNull(dataModuleOptions); this.dataModuleOptions = new DataModuleOptions.Builder(dataModuleOptions); } public DataModuleOptions getDataModuleOptions() { return this.dataModuleOptions.build(); } @Override public ClientOptions copy() { return new ClientOptions(this); } // wrapper methods - DataModuleOptions public byte getCauseSourceAddress() { return causeSourceAddress; } public void setCauseSourceAddress(final byte causeSourceAddress) { this.causeSourceAddress = causeSourceAddress; this.dataModuleOptions.setCauseSourceAddress(causeSourceAddress); } public void setIgnoreBackgroundScan(final boolean ignoreBackgroundScan) { this.dataModuleOptions.setIgnoreBackgroundScan(ignoreBackgroundScan); } public boolean isIgnoreBackgroundScan() { return this.dataModuleOptions.isIgnoreBackgroundScan(); } public int getConnectionTimeout() { return connectionTimeout; } public void setConnectionTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; } }
{'content_hash': '5335d3ef36cac17571cc6257f0b7dff2', 'timestamp': '', 'source': 'github', 'line_count': 98, 'max_line_length': 102, 'avg_line_length': 30.051020408163264, 'alnum_prop': 0.7235993208828523, 'repo_name': 'zregvart/camel', 'id': '593a3b425696bcad3028d69fb50a6fa3cf562a8c', 'size': '3747', 'binary': False, 'copies': '18', 'ref': 'refs/heads/master', 'path': 'components/camel-iec60870/src/main/java/org/apache/camel/component/iec60870/client/ClientOptions.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Apex', 'bytes': '6521'}, {'name': 'Batchfile', 'bytes': '2353'}, {'name': 'CSS', 'bytes': '5472'}, {'name': 'Elm', 'bytes': '10852'}, {'name': 'FreeMarker', 'bytes': '8015'}, {'name': 'Groovy', 'bytes': '20938'}, {'name': 'HTML', 'bytes': '914791'}, {'name': 'Java', 'bytes': '90321137'}, {'name': 'JavaScript', 'bytes': '101298'}, {'name': 'RobotFramework', 'bytes': '8461'}, {'name': 'Shell', 'bytes': '11165'}, {'name': 'TSQL', 'bytes': '28835'}, {'name': 'Tcl', 'bytes': '4974'}, {'name': 'Thrift', 'bytes': '6979'}, {'name': 'XQuery', 'bytes': '546'}, {'name': 'XSLT', 'bytes': '280849'}]}
module Azure::ContainerRegistry::Mgmt::V2019_05_01 module Models # # Defines values for SkuTier # module SkuTier Classic = "Classic" Basic = "Basic" Standard = "Standard" Premium = "Premium" end end end
{'content_hash': '23dd638bec44f5371747f49b79d6f22a', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 50, 'avg_line_length': 19.307692307692307, 'alnum_prop': 0.6055776892430279, 'repo_name': 'Azure/azure-sdk-for-ruby', 'id': '49fd64f1cec0e0a5a8ca38c673483ad5f80c88b1', 'size': '415', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'management/azure_mgmt_container_registry/lib/2019-05-01/generated/azure_mgmt_container_registry/models/sku_tier.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '345216400'}, {'name': 'Shell', 'bytes': '305'}]}