text:
import { BatchState, DataBatch, DataFile, Dataset, DatasetType, FileState } from 'typings/dataset';

const sharedTimes = {
  created_at: 1611205103,
  updated_at: 1611305103,
};

const dataFile: DataFile = {
  state: FileState.COMPLETED,
  size: 1024,
  source_path: '/path/to/file.data',
  destination_path: '/path/to/dest/file.data',
  error_message: 'Failed due to disk space is full',
};

const dataBatchImporting: DataBatch = {
  id: 1,
  move: false,
  event_time: 1611305203,
  dataset_id: 1,
  state: BatchState.IMPORTING,
  file_size: 10000,
  details: { files: [dataFile] },
  num_imported_file: 2,
  num_file: 10,
  ...sharedTimes,
};
const dataBatchImported: DataBatch = {
  id: 2,
  event_time: 1611305203,
  dataset_id: 1,
  state: BatchState.SUCCESS,
  file_size: 12345,
  details: { files: [dataFile] },
  move: false,
  num_imported_file: 5,
  num_file: 5,
  ...sharedTimes,
};
const dataBatchFailed: DataBatch = {
  event_time: 1611305203,
  id: 3,
  dataset_id: 1,
  state: BatchState.FAILED,
  details: { files: [dataFile] },
  move: false,
  file_size: 54321,
  num_imported_file: 1,
  num_file: 19,
  ...sharedTimes,
};

export const unfinishedImporting: Dataset = {
  id: 1,
  project_id: 1,
  name: 'Mocked Dataset with a looooooooooog name',
  dataset_type: DatasetType.STREAMING,
  comment: 'comment here',
  ...sharedTimes,
  path: '/path/to/dataset',
  data_batches: [dataBatchImporting, dataBatchImported],
};

export const importFailed: Dataset = {
  id: 2,
  project_id: 2,
  name: 'Failed one',
  dataset_type: DatasetType.PSI,
  ...sharedTimes,
  path: '/path/to/dataset',
  data_batches: [dataBatchImported, dataBatchFailed],
};

export const successfullyImport: Dataset = {
  id: 3,
  project_id: 1,
  name: 'Import succeeded',
  dataset_type: DatasetType.PSI,
  ...sharedTimes,
  path: '/path/to/dataset',
  data_batches: [dataBatchImported],
};


text:
import { Component, OnInit } from '@angular/core';
import { PomodoroService } from './pomodoro.service';
import { TimePipe } from './time.pipe';

@Component({
    moduleId: module.id,
    templateUrl: './pomodoro.component.html',
    providers: [PomodoroService],
    styleUrls: ['./pomodoro.component.css'],
    pipes: [TimePipe]
})
export class PomodoroComponent implements OnInit {

    public breakLength: number = 5;
    public sessionLength: number = 25;
    public timeRemaining: number = 25 * 60;
    public startTime: number;
    public started: boolean;
    public displayTime: number = 25 * 60;
    public intervalId: number;
    public mode: string = 'session';

    public editable: boolean = true;

    constructor(private pomodoroService: PomodoroService) {

    }

    ngOnInit() {

    }

    adjust(timerName, value: number) {
        if (this.editable) {
              timerName === 'session' ? this.sessionLength += value : this.breakLength += value;
              if (this.mode === timerName) {
                  this.timeRemaining += value * 60;
              }
        }
    }

    changeMode() {
        if (this.mode === 'session') {
            this.mode = 'break';
            this.timeRemaining = this.breakLength * 60;
        } else if (this.mode === 'break') {
            this.mode = 'session';
            this.timeRemaining = this.sessionLength * 60;
        }
    }

    handleTimer() {
        !this.started ? this.startTimer() : this.stopTimer();
    }

    startTimer() {
        this.editable = false;
        this.startTime = new Date().getTime() / 1000;
        this.started = true;
        this.intervalId = setInterval(() => {
            let currTime = new Date().getTime() / 1000;
            this.timeRemaining = this.timeRemaining - (currTime - this.startTime);
            this.startTime = currTime;
            if (this.timeRemaining <= 0) {
                this.changeMode()
            }
        }, 100);
    }

    stopTimer() {
        this.editable = true;
        this.started = false;
        clearInterval(this.intervalId);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="140dp">

    <FrameLayout
        android:layout_width="match_parent"
        android:padding="3dp"
        android:layout_height="110dp">

        <ImageView
            android:id="@+id/stu_game_activity_item_iv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="fitXY"
            android:src="@mipmap/bg_live_default2"/>

        <TextView
            android:id="@+id/stu_game_activity_item_showtime"
            android:layout_width="match_parent"
            android:layout_height="20dp"
            android:text="直播间"
            android:background="#66151515"
            android:textColor="#f2f0f0"
            android:textSize="10sp"
            android:paddingLeft="4dp"
            android:layout_gravity="bottom"/>
    </FrameLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:padding="3dp"
        android:layout_height="30dp">

        <TextView
            android:id="@+id/stu_game_activity_item_name"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="name"
            android:textColor="#1a1919"
            android:textSize="12sp"
            android:gravity="center_vertical"/>

        <TextView
            android:id="@+id/stu_game_activity_item_showcount"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="right"
            android:gravity="center_vertical"
            android:drawableLeft="@mipmap/gray_eye"
            android:textSize="10sp"
            android:text="播放量"/>

    </FrameLayout>

</LinearLayout>


text:
import dragAndDrop        from './drag_and_drop';
import genusTypes         from '../../../../constants/genus_types';
import { languages }      from '../../../../constants/language_types';

describe('drag_and_drop serializer', () => {
  let item;
  let newItem;
  let result;

  beforeEach(() => {
    item = {
      id: 'item01',
      type: 'dragAndDrop',
      assessmentId: 'assessment01',
      bankId: 'bank01',
      language: 'english',
      name: 'ItemName',
      question: {
        id: 'question01',
        text: 'Answer this question',
        type: 'dragAndDrop',
        choices: null,
        correctFeedback: {
          answerId: 'answer01',
          text: 'Good Job',
          fileIds: {},
        },
        incorrectFeedback: {
          answerId: 'answer02',
          text: 'Bad Job',
          fileIds: {},
        },
        target: {
          id: 'target01',
          image: 'oldTargetImage.png',
        },
        dropObjects: {
          drop01: {
            id: 'drop01',
            correctZone: 'zone01',
            type: 'snap',
            image: 'oldImage.png',
            images: {
              [languages.languageTypeId.english]: {
                text: 'oldImage.png'
              }
            },
            label: 'I am the first thing',
          },
          drop02: {
            id: 'drop02',
            correctZone: 'zone02',
            type: 'drop',
            image: 'oldImage.png',
            images: {
              [languages.languageTypeId.english]: {
                text: 'oldImage.png'
              }
            },
            label: 'I am the second thing',
          },
          drop03: {
            id: 'drop03',
            correctZone: 'zone03',
            type: 'snap',
            image: 'oldImage.png',
            images: {
              [languages.languageTypeId.english]: {
                text: 'oldImage.png'
              }
            },
            label: 'I am another thing',
          },
        },
        zones: {
          zone01: {
            id: 'zone01',
            index: 0,
            label: '',
            type: 'snap',
            height: 146,
            width: 187.5,
            xPos: 505,
            yPos: 76,
          },
          zone02: {
            id: 'zone02',
            index: 1,
            label: '',
            type: 'snap',
            height: 100,
            width: 100,
            xPos: 20,
            yPos: 20,
          },
          zone03: {
            id: 'zone03',
            index: 2,
            label: '',
            type: 'snap',
            height: 30,
            width: 60,
            xPos: 300,
            yPos: 100,
          },
        },
        fileIds: {},
        texts: [],
        visibleZones: true,
      },
      originalItem: {},
    };

    newItem = {
      id: 'item01',
      question: {
        language: languages.languageTypeId.english,
      },
      language: languages.languageTypeId.english,
    };

    result = dragAndDrop(item, newItem);
  });

  it('accepts original item and newItemAttr', () => {
    expect(result.name).toBe('ItemName');
  });

  it('question attributes correct', () => {
    expect(result.question.id).toBe('question01');
    expect(result.question.genusTypeId).toBe(genusTypes.question.dragAndDrop);
  });

  it('choices shouldnt be sent up', () => {
    expect(result.question.choices).toBe(undefined);
  });

  it('fields undefined if not sent up', () => {
    expect(result.question.targets).toBe(undefined);
    expect(result.question.droppables).toBe(undefined);
    expect(result.question.zones).toBe(undefined);
    //
  });

  it('targets', () => {
    newItem = {
      id: 'item01',
      question: {
        target: {
          id: 'target01',
          text: 'newTargetImage.png',
        }
      },
    };

    result = dragAndDrop(item, newItem);
    expect(result.question.targets[0].text.text).toContain(' {
    newItem = {
      id: 'item01',
      question: {
        dropObjects: {
          drop01: {
            id: 'drop01',
            image: 'newImage.png',
            images: {
              [languages.languageTypeId.english]: { text: 'newImage.png' }
            }
          }
        }
      },
      language: languages.languageTypeId.english
    };

    result = dragAndDrop(item, newItem);
    expect(result.question.droppables[0].text.text).toContain(' {
    newItem = {
      id: 'item01',
      question: {
        dropObjects: {
          new: {
            text: 'newImage.png',
            altText: 'I am the Image',
          }
        }
      },
    };

    result = dragAndDrop(item, newItem);
    expect(result.question.droppables[3].text.text).toContain(' {
    newItem = {
      id: 'item01',
      question: {
        zones: {
          zone01: {
            height: 111,
            width: 117,
            xPos: 208,
            yPos: 83,
          }
        }
      },
    };

    result = dragAndDrop(item, newItem);
    expect(result.question.zones[0].spatialUnit.height).toBe(111);
    expect(result.question.zones[0].spatialUnit.width).toBe(117);
    expect(result.question.zones[0].spatialUnit.coordinateValues[0]).toBe(208);
    expect(result.question.zones[0].spatialUnit.coordinateValues[1]).toBe(83);
    expect(result.question.zones[0].spatialUnit.recordType).toBe(genusTypes.zone.rectangle);
    expect(result.question.zones[0].dropBehaviorType).toBe(genusTypes.zone.snap);
  });

  it('answers', () => {
    newItem = {
      id: 'item01',
      question: {
        zones: {
          zone01: {
            height: 111,
            width: 117,
            xPos: 208,
            yPos: 83,
          }
        }
      },
    };

    result = dragAndDrop(item, newItem);
    expect(result.answers.length).toBe(2);
    expect(result.answers[0].genusTypeId).toBe(genusTypes.answer.rightAnswer);
    expect(result.answers[0].zoneConditions.length).toBe(3);
    expect(result.answers[0].zoneConditions[0].droppableId).toBe('drop01');
    expect(result.answers[0].zoneConditions[0].zoneId).toBe('zone01');
  });
});


text:
from calculadora_extendida import CalculadoraHP
from calculadora_tests import Adicao

calculadora = CalculadoraHP()
calculadora.obter_entradas()
calculadora.adicionar_operacao('+', Adicao())

class Multiplicacao():
    def calcular(self, e, e2):
        return e * e2

calculadora.adicionar_operacao('*', Multiplicacao())
print(calculadora.calcular())


text:
package com.microservices.zones.controller;

import com.microservices.zones.model.Coordinate;
import com.microservices.zones.model.TriangularZone;
import com.microservices.zones.service.TriangularZoneService;
import com.microservices.zones.service.impl.TriangularZoneGeneratorServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import org.springframework.http.ResponseEntity;

/**
 * Created by jlcardosa on 07/05/2017.
 */
@Api(description = "Operations about zones")
@RestController
@RequestMapping("/v1")
public class ZonesController {

    @Autowired
    private TriangularZoneService triangularZoneService;

    @Autowired
    private TriangularZoneGeneratorServiceImpl zonesGenerator;

    @RequestMapping(
            value = "/zones",
            method = RequestMethod.GET)
    public List<TriangularZone> zones() {
        return this.triangularZoneService.getAllZones();
    }

    @ApiOperation(value = "Generate a number of zones randomly",
                  notes = "Generate a number of zones randomly",
                  response = List.class,
                  responseContainer = "List")
    @ApiResponses(value = {
                  @ApiResponse(code = 200, message = "Set of zones")
                  })
    @RequestMapping(
            value = "/zones/random/{amount}",
            method = RequestMethod.GET)
    public List<TriangularZone> zonesRandomGenerated(
            @ApiParam(value = "Number of zones generated randomly", required = true) @PathVariable int amount) {
        return this.zonesGenerator.generate(amount);
    }

    @ApiOperation(value = "Determinate a zone by a given coordinate",
                  notes = "Determinate a zone by a given coordinate",
                  response = TriangularZone.class
                 )
    @ApiResponses(value = {
                    @ApiResponse(code = 200, message = "Zone that has been found"),
                    @ApiResponse(code = 204, message = "No zone found")
                 })
    @RequestMapping(
            value = "/zones/search",
            method = RequestMethod.GET)
    public TriangularZone zoneByCoordinate(@RequestParam("lat") double latitude, @RequestParam("long") double longitude) {
        Coordinate coordinate = new Coordinate(latitude, longitude);

        return this.triangularZoneService.getZoneByCoordinate(coordinate);
    }
}


text:
package com.example.andrewhanks.myapplication.behavioral.strategy;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

interface Service {
    void doService(Socket client) throws IOException;
}

class Server {
    private ServerSocket server;
    private Service service;

    Server(int port, Service service) throws IOException {
        this.server = new ServerSocket(port);
        this.service = service;
    }

    void start() throws IOException {
        while (true) {
            Socket client = server.accept();
            service.doService(client);
        }
    }
}


text:
Thanks for reporting an issue with HaskForce.  Depending on your issue, it may be a good
idea to provide your OS flavor and versions of IntelliJ and any Haskell tools which
may be involved (e.g. if you are having autocompletion issues, providing your ghc-mod
version is usually necessary).

Unfortunately, HaskForce lacks full-time developers dedicated to resolving bugs and
implementing new features.  If a bug is holding you back or you'd really like a new feature,
opening an issue is a great start, but contributing the code yourself will get it done
significantly faster.  If you don't know where to start, simply ask in your issue,
and someone should respond promptly with some guidance.

## Submitting pull requests

### Bug fix or new feature

You've done the hard work of making HaskForce better.  Thank you!

Pull requests should be reviewed and merged within a month.  To help
make the reviewer's life easier and get your awesome addition merged sooner,
please follow these guidelines -

1. Send patches via GitHub pull requests.
1. Each pull request should achieve a specific goal and have a descriptive title.
   Don't put multiple unrelated changes in a single pull request.
   (An exception can be made for multiple very simple self-contained commits,
   or for changes with a hard dependency on each other.)
1. Typically, a pull request should consist of just a few commits.
   Rewrite the history (see `git rebase`) to make commits logical, not historical.
1. Write descriptive commit messages.
1. If you want to amend a pull request, rewrite your branch and leave a comment as opposed
   to adding commits to the branch or opening a new pull request.
1. Make sure the tests pass.  You can track them via
   [travis](https://travis-ci.org/carymrobbins/intellij-haskforce).
1. Unless the change is trivial, it should be accompanied by the tests that
   show the effects of the change.

   New tests should be added in a commit separate
   from the code changes. On the other hand, if your change breaks some tests,
   the tests should be preferably updated in the same commit.

### Refactoring or architectural changes

Please contact [Cary Robbins](https://github.com/carymrobbins) to discuss before
you start refactoring to possibly save some time and effort.  There are plenty of
potential gotchas involved here.

## Other ways to contribute

### Review pull requests

You can help by reviewing pull requests submitted by others.
If you've found any issues, raise them in the comments.
If you've done a review and think that everything is fine, please say so, too - it does help!

### Fix tests

Some tests simply document the existing (but wrong) behavior.

Make sure that there is an existing issue in the tracker about such a wrong behavior.
Link to the issue in the test.

------------------

Special thanks to [haskell-src-exts](https://github.com/haskell-suite/haskell-src-exts)
as the source of this document's
[plagiarism](https://github.com/haskell-suite/haskell-src-exts/blob/master/CONTRIBUTING.md).


text:
declare function snakeCase(value: string): string;

export = snakeCase;


text:
package org.sisioh.aws4s.s3.model

import com.amazonaws.services.s3.model.{ BucketTaggingConfiguration, SetBucketTaggingConfigurationRequest }
import org.sisioh.aws4s.PimpedType

object SetBucketTaggingConfigurationRequestFactory {

  def create(bucketName: String,
             taggingConfiguration: BucketTaggingConfiguration): SetBucketTaggingConfigurationRequest =
    new SetBucketTaggingConfigurationRequest(bucketName, taggingConfiguration)

}

class RichSetBucketTaggingConfigurationRequest(val underlying: SetBucketTaggingConfigurationRequest)
    extends AnyVal
    with PimpedType[SetBucketTaggingConfigurationRequest] {

  def bucketName: String = underlying.getBucketName

  def bucketName_=(value: String): Unit =
    underlying.setBucketName(value)

  // ---

  def taggingConfiguration: BucketTaggingConfiguration =
    underlying.getTaggingConfiguration

  def taggingConfiguration_=(value: BucketTaggingConfiguration): Unit =
    underlying.setTaggingConfiguration(value)

}


text:
define(function(require, exports, module) {
	// module:
	//		base/_WidgetsInTemplateMixin
	// summary:
	//		Mixin to supplement _TemplatedMixin when template contains widgets

	var KS = require("./kernel");
	var lang = require("./lang");
	var declare = require("./declare");
	var parser = require("./parser");

	return declare("base._WidgetsInTemplateMixin", null, {
		// Should we parse the template to find widgets that might be
		// declared in markup inside it?
		widgetsInTemplate: false,

		// Used to provide a context require to the dojo/parser in order to be
		// able to use relative MIDs (e.g. `./Widget`) in the widget's template.
		contextRequire: null,

		__prefill: function() {
			if (this.widgetsInTemplate) {
				// Before copying over content, instantiate widgets in template
				var node = this.domNode;

				parser.parse(node, {
					noStart: true,
					template: true,
					context: this,
					contextRequire: this.contextRequire,
					scope: KS.config.scopeName
				}).then(lang.hitch(this, function(widgets) {
					this.__startupWidgets = widgets;

					// Hook up attached nodes and events for nodes that were converted to widgets
					for (var i = 0, l = widgets.length; i < l; ++i) {
						this.__process(widgets[i], function(n, p) {
							return n[p]
						}, function(widget, type, callback) {
							return widget.on(type, callback, true)
						})
					}
				}));

				if (!this.__startupWidgets) {
					throw new Error(this.declaredClass + ": parser returned unfilled promise (probably waiting for module auto-load), " + "unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before instantiation.")
				}
			}
		},

		__process: function(baseNode, getter, listen) {
			return getter(baseNode, "ks-type") ? true : this.inherited(arguments)
		},

		startup: function() {
			lang.forEach(this.__startupWidgets, function(widget) {
				if (widget && !widget._started && widget.startup) {
					widget.startup()
				}
			});
			delete this.__startupWidgets;
			this.inherited(arguments)
		}
	})
});


text:
<?xml version='1.0' encoding='UTF-8'?>
<hopsanobjectappearance version="0.3">
    <modelobject sourcecode="HydraulicPressureSourceC.hpp" typename="HydraulicPressureSourceC" displayname="C-type Pressure Source">
        <icons>
            <icon scale="1" path="pressuresource_user.svg" iconrotation="ON" type="user"/>
            <icon scale="1" path="pressuresource_iso.svg" iconrotation="ON" type="iso"/>
        </icons>
        <help>
            <md>HydraulicPressureSourceC.md</md>
        </help>
        <ports>
            <port x="0.5" y="1" a="90" name="p"/>
            <port x="0.5" y="0" a="90" name="P1"/>
        </ports>
    </modelobject>
</hopsanobjectappearance>