file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
test_msvc9compiler.py
"""Tests for distutils.msvc9compiler.""" import sys import unittest import os from distutils.errors import DistutilsPlatformError from distutils.tests import support from test.support import run_unittest _MANIFEST = """\ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-co...
else: SKIP_MESSAGE = "These tests are only for win32" @unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE) class msvc9compilerTestCase(support.TempdirManager, unittest.TestCase): def test_no_compiler(self): # makes sure query_vcvarsall throws # a DistutilsPlatf...
from distutils.msvccompiler import get_build_version if get_build_version()>=8.0: SKIP_MESSAGE = None else: SKIP_MESSAGE = "These tests are only for MSVC8.0 or above"
conditional_block
test_msvc9compiler.py
"""Tests for distutils.msvc9compiler.""" import sys import unittest import os from distutils.errors import DistutilsPlatformError from distutils.tests import support from test.support import run_unittest _MANIFEST = """\ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-co...
from distutils import msvc9compiler old_find_vcvarsall = msvc9compiler.find_vcvarsall msvc9compiler.find_vcvarsall = _find_vcvarsall try: self.assertRaises(DistutilsPlatformError, query_vcvarsall, 'wont find this version') finally: ...
return None
identifier_body
test_survey_integration.py
# coding=utf-8 from datetime import datetime from euphorie.client import model from euphorie.client.tests.utils import addAccount from euphorie.client.tests.utils import addSurvey from euphorie.content.tests.utils import BASIC_SURVEY from euphorie.testing import EuphorieIntegrationTestCase from lxml import html from pl...
(self): """We have some views to display and set the published column for a survey session """ with api.env.adopt_user("admin"): survey = addSurvey(self.portal, BASIC_SURVEY) account = addAccount(password="secret") survey_session = model.SurveySession( ...
test_survey_publication_date_views
identifier_name
test_survey_integration.py
# coding=utf-8 from datetime import datetime from euphorie.client import model from euphorie.client.tests.utils import addAccount from euphorie.client.tests.utils import addSurvey from euphorie.content.tests.utils import BASIC_SURVEY from euphorie.testing import EuphorieIntegrationTestCase from lxml import html from pl...
with api.env.adopt_user(user=survey_session.account): with self._get_view( "publication_date", traversed_survey_session, survey_session ) as view: # The view is not callable but # has traversable allowed attributes self.ass...
"""We have some views to display and set the published column for a survey session """ with api.env.adopt_user("admin"): survey = addSurvey(self.portal, BASIC_SURVEY) account = addAccount(password="secret") survey_session = model.SurveySession( id=123, ...
identifier_body
test_survey_integration.py
# coding=utf-8 from datetime import datetime from euphorie.client import model from euphorie.client.tests.utils import addAccount from euphorie.client.tests.utils import addSurvey from euphorie.content.tests.utils import BASIC_SURVEY from euphorie.testing import EuphorieIntegrationTestCase from lxml import html from pl...
self.assertEqual(survey_session.last_publisher, None) self.assertEqual(survey_session.published, None) self.assertEqual(survey_session.last_modifier, None) self.assertEqual(survey_session.review_state, "private") # Calling set_date will res...
# The view is not callable but # has traversable allowed attributes self.assertRaises(ViewNotCallableError, view) # We have some default values that will be changed # when publishing/unpublishing the session
random_line_split
cd_hit.py
Path=True), # sequence identity threshold, default 0.9 # this is the default cd-hit's "global sequence identity" calc'd as : # number of identical amino acids in alignment # divided by the full length of the shorter sequence '-c':ValuedParameter('-',Name='c',Delimiter=' '), ...
def _input_as_multiline_string(self, data): """Writes data to tempfile and sets -i parameter data -- list of lines """ if data: self.Parameters['-i']\ .on(super(CD_HIT,self)._input_as_multiline_string(data)) return '' def _input_as_line...
"""Method that points to documentation""" help_str =\ """ CD-HIT is hosted as an open source project at: http://www.bioinformatics.org/cd-hit/ The following papers should be cited if this resource is used: Clustering of highly homologous sequences to reduce thesize of l...
identifier_body
cd_hit.py
Path=True), # sequence identity threshold, default 0.9 # this is the default cd-hit's "global sequence identity" calc'd as : # number of identical amino acids in alignment # divided by the full length of the shorter sequence '-c':ValuedParameter('-',Name='c',Delimiter=' '), ...
# call the correct version of cd-hit base on moltype working_dir = get_tmp_filename() if moltype is PROTEIN: app = CD_HIT(WorkingDir=working_dir, params=params) elif
if params is None: params = {} if '-o' not in params: params['-o'] = get_tmp_filename()
random_line_split
cd_hit.py
Path=True), # sequence identity threshold, default 0.9 # this is the default cd-hit's "global sequence identity" calc'd as : # number of identical amino acids in alignment # divided by the full length of the shorter sequence '-c':ValuedParameter('-',Name='c',Delimiter=' '), ...
(self, data): """Makes data the value of a specific parameter""" if data: self.Parameters['-i'].on(str(data)) return '' def _get_seqs_outfile(self): """Returns the absolute path to the seqs outfile""" if self.Parameters['-o'].isOn(): return self.Param...
_input_as_string
identifier_name
cd_hit.py
=True), # sequence identity threshold, default 0.9 # this is the default cd-hit's "global sequence identity" calc'd as : # number of identical amino acids in alignment # divided by the full length of the shorter sequence '-c':ValuedParameter('-',Name='c',Delimiter=' '), ...
def _get_result_paths(self, data): """Return dict of {key: ResultPath}""" result = {} result['FASTA'] = ResultPath(Path=self._get_seqs_outfile()) result['CLSTR'] = ResultPath(Path=self._get_clstr_outfile()) return result class CD_HIT_EST(CD_HIT): """cd-hit Application ...
raise ValueError, "No output file specified"
conditional_block
multiple-identity-card-addition-model.service.ts
import {Injectable} from '@angular/core'; import {DatabaseColumn, MultipleAdditionModel} from '../multiple-addition.model'; import {SnotifyService} from 'ng-snotify'; import {IdentityCard} from '../../interfaces/server/identity-card.interface'; import {IdentityCardService} from '../../core/identity-card.service'; impor...
(private identityCardService: IdentityCardService, private hotRegisterer: HotTableRegisterer, private snotifyService: SnotifyService) { super(); } /** * Verifies the given identity cards with the server. * Afterwards the handsontable will be rerendered * * @param identit...
constructor
identifier_name
multiple-identity-card-addition-model.service.ts
import {Injectable} from '@angular/core'; import {DatabaseColumn, MultipleAdditionModel} from '../multiple-addition.model'; import {SnotifyService} from 'ng-snotify'; import {IdentityCard} from '../../interfaces/server/identity-card.interface'; import {IdentityCardService} from '../../core/identity-card.service'; impor...
if (result.valid) { this.snotifyService.success('Alle Einträge sind valide', {timeout: 0}); } } hot.render(); }); } /** * Inserts the given list of identity cards in the database * * @param items The identity cards to be inserted */ public insertItems(items:...
this.snotifyService.warning( `${result.duplicateBarcodes.length} Einträgen haben einen mehrfach existierenden Barcode`, {timeout: 0} ); this.verificationResult.duplicateBarcodes.push(...result.duplicateBarcodes); }
conditional_block
multiple-identity-card-addition-model.service.ts
import {Injectable} from '@angular/core'; import {DatabaseColumn, MultipleAdditionModel} from '../multiple-addition.model'; import {SnotifyService} from 'ng-snotify'; import {IdentityCard} from '../../interfaces/server/identity-card.interface'; import {IdentityCardService} from '../../core/identity-card.service'; impor...
duplicateBarcodes: [] }; if (result.alreadyExistingBarcodes && result.alreadyExistingBarcodes.length > 0) { this.snotifyService.warning( `Bei ${result.alreadyExistingBarcodes.length} Einträgen existiert der Barcode bereits`, {timeout: 0} ); ...
random_line_split
vertex_outside.rs
use crate::mock_graph::{ arbitrary::{GuidedArbGraph, Limit}, MockVertex, TestGraph, }; use graphene::{ core::{Ensure, Graph}, impl_ensurer, }; use quickcheck::{Arbitrary, Gen}; use std::collections::HashSet; /// An arbitrary graph and a vertex that is guaranteed to not be in it. #[derive(Clone, Debug)] pub struct ...
<G: Gen>(g: &mut G, v_count: usize, e_count: usize) -> Self { let graph = Gr::arbitrary_fixed(g, v_count, e_count); // Find a vertex that isn't in the graph let mut v = MockVertex::arbitrary(g); while graph.graph().contains_vertex(v) { v = MockVertex::arbitrary(g); } Self(graph, v) } fn shrink_gu...
arbitrary_fixed
identifier_name
vertex_outside.rs
use crate::mock_graph::{ arbitrary::{GuidedArbGraph, Limit}, MockVertex, TestGraph, }; use graphene::{ core::{Ensure, Graph}, impl_ensurer, }; use quickcheck::{Arbitrary, Gen}; use std::collections::HashSet; /// An arbitrary graph and a vertex that is guaranteed to not be in it. #[derive(Clone, Debug)] pub struct ...
{ fn ensure_unvalidated(_c: Self::Ensured, _: ()) -> Self { unimplemented!() } fn validate(_c: &Self::Ensured, _: &()) -> bool { unimplemented!() } } impl_ensurer! { use<G> VertexOutside<G>: Ensure as (self.0): G where G: GuidedArbGraph, G::Graph: TestGraph, } impl<Gr> GuidedArbGraph for VertexOutside...
G::Graph: TestGraph,
random_line_split
vertex_outside.rs
use crate::mock_graph::{ arbitrary::{GuidedArbGraph, Limit}, MockVertex, TestGraph, }; use graphene::{ core::{Ensure, Graph}, impl_ensurer, }; use quickcheck::{Arbitrary, Gen}; use std::collections::HashSet; /// An arbitrary graph and a vertex that is guaranteed to not be in it. #[derive(Clone, Debug)] pub struct ...
fn shrink_guided(&self, limits: HashSet<Limit>) -> Box<dyn Iterator<Item = Self>> { let mut result = Vec::new(); // First shrink the graph, keeping only the shrunk ones where the vertex // stays invalid result.extend( self.0 .shrink_guided(limits) .filter(|g| !g.graph().contains_vertex(self.1)) ...
{ let graph = Gr::arbitrary_fixed(g, v_count, e_count); // Find a vertex that isn't in the graph let mut v = MockVertex::arbitrary(g); while graph.graph().contains_vertex(v) { v = MockVertex::arbitrary(g); } Self(graph, v) }
identifier_body
glib_gobject.rs
// GObject Introspection Rust bindings. // Copyright (C) 2014 Luis Araujo <araujoc.luisf@gmail.com> // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the Licen...
{} pub enum GMappedFile {} /* TODO: Get higher level structs for lists using generics */ pub struct GSList { data: GPointer, next: *GSList } pub struct GList { data: GPointer, next: *GList, prev: *GList } pub struct GError { domain: GQuark, code: c_int, message: *c_char }
GOptionGroup
identifier_name
glib_gobject.rs
// GObject Introspection Rust bindings. // Copyright (C) 2014 Luis Araujo <araujoc.luisf@gmail.com> // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the Licen...
pub struct GValue { /*< private >*/ g_type: GType, /* public for GTypeValueTable methods */ data: [GValueData, ..2] } /* GLib */ pub enum GOptionGroup {} pub enum GMappedFile {} /* TODO: Get higher level structs for lists using generics */ pub struct GSList { data: GPointer, next: *GSList } ...
GValueDataVUInt64(u64), GValueDataVFloat(c_float), GValueDataVDouble(c_double), GValueDataVPointer(GPointer) }
random_line_split
animationFrame.d.ts
import { AnimationFrameScheduler } from './AnimationFrameScheduler'; /** * * Animation Frame Scheduler * * <span class="informal">Perform task when `window.requestAnimationFrame` would fire</span> * * When `animationFrame` scheduler is used with delay, it will fall back to {@link asyncScheduler} scheduler * beha...
* import { animationFrameScheduler } from 'rxjs'; * * const div = document.querySelector('div'); * * animationFrameScheduler.schedule(function(height) { * div.style.height = height + "px"; * * this.schedule(height + 1); // `this` references currently executing Action, * // wh...
* ## Example * Schedule div height animation * ```javascript * // html: <div style="background: #0ff;"></div>
random_line_split
labeled-break.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
break 'foobar; } } }
} } 'foobar: while 1 + 1 == 2 { loop {
random_line_split
labeled-break.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ 'foo: loop { loop { break 'foo; } } 'bar: for _ in 0..100 { loop { break 'bar; } } 'foobar: while 1 + 1 == 2 { loop { break 'foobar; } } }
identifier_body
labeled-break.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { 'foo: loop { loop { break 'foo; } } 'bar: for _ in 0..100 { loop { break 'bar; } } 'foobar: while 1 + 1 == 2 { loop { break 'foobar; } } }
main
identifier_name
reinigung-ff.spec.ts
import { browser, element, by, $ } from 'protractor'; import { NavBarPage } from './../page-objects/jhi-page-objects'; const path = require('path'); describe('Reinigung e2e test', () => { let navBarPage: NavBarPage; let reinigungDialogPage: ReinigungDialogPage; let reinigungComponentsPage: ReinigungCompon...
it('should create and save Reinigungs', () => { reinigungComponentsPage.clickOnCreateButton(); reinigungDialogPage.setDurchfuehrungInput('2000-12-31'); expect(reinigungDialogPage.getDurchfuehrungInput()).toMatch('2000-12-31'); reinigungDialogPage.save(); expect(reinigungDialo...
});
random_line_split
reinigung-ff.spec.ts
import { browser, element, by, $ } from 'protractor'; import { NavBarPage } from './../page-objects/jhi-page-objects'; const path = require('path'); describe('Reinigung e2e test', () => { let navBarPage: NavBarPage; let reinigungDialogPage: ReinigungDialogPage; let reinigungComponentsPage: ReinigungCompon...
close() { this.closeButton.click(); } getSaveButton() { return this.saveButton; } }
{ this.saveButton.click(); }
identifier_body
reinigung-ff.spec.ts
import { browser, element, by, $ } from 'protractor'; import { NavBarPage } from './../page-objects/jhi-page-objects'; const path = require('path'); describe('Reinigung e2e test', () => { let navBarPage: NavBarPage; let reinigungDialogPage: ReinigungDialogPage; let reinigungComponentsPage: ReinigungCompon...
() { this.closeButton.click(); } getSaveButton() { return this.saveButton; } }
close
identifier_name
Local_Select.spec.ts
import { createStore } from 'test/support/Helpers' import Model from '@/model/Model' describe('Feature – Hooks – Local Select', () => { it('can process beforeSelect hook', async () => { class User extends Model { static entity = 'users' // @Attribute id!: number // @Attribute('') ...
} } createStore([{ model: User }]) await User.create({ data: [ { id: 1, role: 'admin' }, { id: 2, role: 'admin' }, { id: 3, role: 'user' } ] }) const users = User.query().get() expect(users.length).toBe(2) expect(users[0].role).toBe('admin') ...
} } static beforeSelect(records: any) { return records.filter((record: User) => record.role === 'admin')
random_line_split
Local_Select.spec.ts
import { createStore } from 'test/support/Helpers' import Model from '@/model/Model' describe('Feature – Hooks – Local Select', () => { it('can process beforeSelect hook', async () => { class User extends Model { static entity = 'users' // @Attribute id!: number // @Attribute('') ...
return { id: this.attr(null), role: this.attr('') } } static beforeSelect(records: any) { return records.filter((record: User) => record.role === 'admin') } } createStore([{ model: User }]) await User.create({ data: [ { id: 1, r...
ds() {
identifier_name
setup.py
#!/usr/bin/env python2 # References: # https://fedoraproject.org/wiki/Koji/ServerHowTo # https://github.com/sbadakhc/kojak/blob/master/scripts/install/install import util.cfg as cfg import util.pkg as pkg import util.cred as cred
# log.info("General update") pkg.clean() pkg.update() log.info("Install EPEL") pkg.install("https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm") # # Kojid (Koji Builder) # log.info("Install Koji Builder") pkg.install("koji-builder") koji_url = dict() koji_url["web"] = "http://koji/koji" koj...
from util.log import log # # Setup
random_line_split
list.js
import { combineReducers } from 'redux'; export function error(state = null, action) { switch (action.type) { case 'PRODUCT_LIST_ERROR': return action.error; case 'PRODUCT_LIST_MERCURE_DELETED': return `${action.retrieved['@id']} has been deleted by another user.`; case 'PRODUCT_LIST_RESET'...
export default combineReducers({ error, loading, retrieved, eventSource });
{ switch (action.type) { case 'PRODUCT_LIST_MERCURE_OPEN': return action.eventSource; case 'PRODUCT_LIST_RESET': return null; default: return state; } }
identifier_body
list.js
import { combineReducers } from 'redux'; export function error(state = null, action) { switch (action.type) { case 'PRODUCT_LIST_ERROR': return action.error; case 'PRODUCT_LIST_MERCURE_DELETED': return `${action.retrieved['@id']} has been deleted by another user.`; case 'PRODUCT_LIST_RESET'...
(state = null, action) { switch (action.type) { case 'PRODUCT_LIST_MERCURE_OPEN': return action.eventSource; case 'PRODUCT_LIST_RESET': return null; default: return state; } } export default combineReducers({ error, loading, retrieved, eventSource });
eventSource
identifier_name
list.js
import { combineReducers } from 'redux'; export function error(state = null, action) { switch (action.type) { case 'PRODUCT_LIST_ERROR': return action.error; case 'PRODUCT_LIST_MERCURE_DELETED': return `${action.retrieved['@id']} has been deleted by another user.`; case 'PRODUCT_LIST_RESET'...
export function retrieved(state = null, action) { switch (action.type) { case 'PRODUCT_LIST_SUCCESS': return action.retrieved; case 'PRODUCT_LIST_RESET': return null; case 'PRODUCT_LIST_MERCURE_MESSAGE': return { ...state, 'hydra:member': state['hydra:member'].map(item...
default: return state; } }
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-27 19:05 from __future__ import unicode_literals import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration):
('last_name', models.CharField(max_length=50, verbose_name='Last Name')), ('phone', models.CharField(max_length=20, verbose_name='Phone')), ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to...
initial = True dependencies = [ ('auth', '0008_alter_user_username_max_length'), ] operations = [ migrations.CreateModel( name='User', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-27 19:05 from __future__ import unicode_literals import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): initial = True ...
), ]
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-27 19:05 from __future__ import unicode_literals import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.utils.timezone class
(migrations.Migration): initial = True dependencies = [ ('auth', '0008_alter_user_username_max_length'), ] operations = [ migrations.CreateModel( name='User', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,...
Migration
identifier_name
init.js
/* * Copyright 2015 Caleb Brose, Chris Fogerty, Rob Sheehy, Zach Taylor, Nick Miller *
* 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 * distri...
random_line_split
objdetect.rs
-> Vec<Rect> { self.detect_with_params(mat, 1.1, 3, Size2i::default(), Size2i::default()) } /// Detects the object using parameters specified. /// /// * `mat` - Matrix of the type CV_8U containing an image where objects are /// detected. /// * `scale_factor` - Parameter specifying ho...
/// Sets the SVM detector. pub fn set_svm_detector(&mut self, detector: SvmDetector) { unsafe { cv_hog_set_svm_detector(self.inner, detector.inner) } } }
random_line_split
objdetect.rs
c_int, min_size: Size2i, max_size: Size2i, ); } /// We can safely send the classifier (a mutable pointer) to a different thread unsafe impl Send for CascadeClassifier {} /// An object detect trait. pub trait ObjectDetect { /// Detects the object inside this image and returns a list of detecti...
{ inner: *mut CHogDescriptor,
HogDescriptor
identifier_name
objdetect.rs
c_int, min_size: Size2i, max_size: Size2i, ); } /// We can safely send the classifier (a mutable pointer) to a different thread unsafe impl Send for CascadeClassifier {} /// An object detect trait. pub trait ObjectDetect { /// Detects the object inside this image and returns a list of detecti...
/// The default detection uses scale factor 1.1, minNeighbors 3, no min size /// or max size. pub fn detect_multiscale(&self, mat: &Mat) -> Vec<Rect> { self.detect_with_params(mat, 1.1, 3, Size2i::default(), Size2i::default()) } /// Detects the object using parameters specified. /// ...
{ if let Some(p) = path.as_ref().to_str() { let s = CString::new(p)?; if unsafe { cv_cascade_classifier_load(self.inner, (&s).as_ptr()) } { return Ok(()); } } Err(CvError::InvalidPath(path.as_ref().to_path_buf()).into()) }
identifier_body
objdetect.rs
c_int, min_size: Size2i, max_size: Size2i, ); } /// We can safely send the classifier (a mutable pointer) to a different thread unsafe impl Send for CascadeClassifier {} /// An object detect trait. pub trait ObjectDetect { /// Detects the object inside this image and returns a list of detecti...
Err(CvError::InvalidPath(path.as_ref().to_path_buf()).into()) } /// The default detection uses scale factor 1.1, minNeighbors 3, no min size /// or max size. pub fn detect_multiscale(&self, mat: &Mat) -> Vec<Rect> { self.detect_with_params(mat, 1.1, 3, Size2i::default(), Size2i::defau...
{ let s = CString::new(p)?; if unsafe { cv_cascade_classifier_load(self.inner, (&s).as_ptr()) } { return Ok(()); } }
conditional_block
git.py
License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se...
def create_tag(git_dir, tagname, tagdescription, commit, fail=True): ''' Create a tag using commit @param git_dir: path of the git repository @type git_dir: str @param tagname: name of the tag to create @type tagname: str @param tagdescription: the tag description @type tagdescriptio...
''' List all tags @param git_dir: path of the git repository @type git_dir: str @param fail: raise an error if the command failed @type fail: false @return: list of tag names (str) @rtype: list ''' tags = shell.check_call('%s tag -l' % GIT, git_dir, fail=fail, env=CLEAN_ENV) tag...
identifier_body
git.py
# License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. S...
''' return shell.call('%s clean -dfx' % GIT, git_dir, env=CLEAN_ENV) def list_tags(git_dir, fail=True): ''' List all tags @param git_dir: path of the git repository @type git_dir: str @param fail: raise an error if the command failed @type fail: false @return: list of tag names (s...
@param git_dir: path of the git repository @type git_dir: str
random_line_split
git.py
License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se...
shell.call("%s submodule sync" % GIT, git_dir) def checkout(git_dir, commit): ''' Reset a git repository to a given commit @param git_dir: path of the git repository @type git_dir: str @param commit: the commit to checkout @type commit: str ''' return shell.call('%s reset --ha...
if c[0].startswith('submodule.') and c[0].endswith('.url'): shell.call("%s config --file=.gitmodules %s %s" % (GIT, c[0], c[1]), git_dir)
conditional_block
git.py
See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. import os import shutil from cerbe...
apply_patch
identifier_name
DialogTypes.ts
import { Optional } from '@ephox/katamari'; import { Dialog } from 'tinymce/core/api/ui/Ui'; export type ListValue = Dialog.ListBoxSingleItemSpec; export type ListGroup = Dialog.ListBoxNestedItemSpec; export type ListItem = Dialog.ListBoxItemSpec; export interface UserListItem { text?: string; title?: string; ...
}
random_line_split
MainController.js
/* * The MIT License (MIT) * * Copyright (c) 2014 Marcel Mika, marcelmika.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the ri...
// Group new Y.LIMS.Controller.GroupViewController({ container: rootNode.one('.buddy-list'), properties: properties, poller: poller }); // Presence new Y.LIMS.Controller.PresenceViewController({ ...
{ properties.set('offset', new Date().getTime() - serverTime.get('time')); }
conditional_block
MainController.js
/* * The MIT License (MIT) * * Copyright (c) 2014 Marcel Mika, marcelmika.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the ri...
}, /** * Called when any panel is hidden * * @param panel * @private */ _onPanelHidden: function (panel) { // If the hidden panel is currently active panel it means that no panel is currently active if (this.get('activePanelId') === panel.get('panelId')) { ...
// Store current active panel id this.set('activePanelId', panelId); // Update settings this.get('settingsModel').updateActivePanel(panelId);
random_line_split
utils.py
def load_config(default_values, user_values): if user_values is None: return default_values config = {} for k, v in user_values.items(): if k in default_values: if isinstance(v, dict): cloned = user_values[k].copy() for key, value in default_values...
klass = path_split[-1:] mod = __import__(path, fromlist=[klass]) return getattr(mod, klass[0])
random_line_split
utils.py
def load_config(default_values, user_values): if user_values is None: return default_values config = {} for k, v in user_values.items(): if k in default_values: if isinstance(v, dict): cloned = user_values[k].copy() for key, value in default_valu...
(full_path): path_split = full_path.split('.') path = ".".join(path_split[:-1]) klass = path_split[-1:] mod = __import__(path, fromlist=[klass]) return getattr(mod, klass[0])
import_class
identifier_name
utils.py
def load_config(default_values, user_values): if user_values is None: return default_values config = {} for k, v in user_values.items(): if k in default_values: if isinstance(v, dict): cloned = user_values[k].copy() for key, value in default_valu...
return config def import_class(full_path): path_split = full_path.split('.') path = ".".join(path_split[:-1]) klass = path_split[-1:] mod = __import__(path, fromlist=[klass]) return getattr(mod, klass[0])
config[k] = v
conditional_block
utils.py
def load_config(default_values, user_values):
def import_class(full_path): path_split = full_path.split('.') path = ".".join(path_split[:-1]) klass = path_split[-1:] mod = __import__(path, fromlist=[klass]) return getattr(mod, klass[0])
if user_values is None: return default_values config = {} for k, v in user_values.items(): if k in default_values: if isinstance(v, dict): cloned = user_values[k].copy() for key, value in default_values[k].items(): if key is not Non...
identifier_body
tangy-forms-player.component.ts
/environment'; import { FormInfo, FormTemplate } from 'src/app/tangy-forms/classes/form-info.class'; import { TangyFormResponseModel } from 'tangy-form/tangy-form-response-model.js'; import { Subject } from 'rxjs'; import { TangyFormsInfoService } from 'src/app/tangy-forms/tangy-forms-info-service'; import { Component,...
else { if (!stateDoc) { let r = await this.tangyFormService.saveResponse(state) stateDoc = await this.tangyFormService.getResponse(state._id) } await this.tangyFormService.saveResponse({ ...state, _rev: stateDoc['_rev'], location: this.location || state.locatio...
{ // Since what is in the database is complete, and it's still complete, and it doesn't have // a summary where they might add some input, don't save! They are probably reviewing data. }
conditional_block
tangy-forms-player.component.ts
/environment'; import { FormInfo, FormTemplate } from 'src/app/tangy-forms/classes/form-info.class'; import { TangyFormResponseModel } from 'tangy-form/tangy-form-response-model.js'; import { Subject } from 'rxjs'; import { TangyFormsInfoService } from 'src/app/tangy-forms/tangy-forms-info-service'; import { Component,...
isDirty() { if (this.formEl) { const state = this.formEl.store.getState() const isDirty = state.items.some((acc, item) => item.isDirty) return isDirty } else { return true } } isComplete() { if (this.formEl) { return this.formEl.store.getState().form.complete }...
{ if (this.formEl) { this.formEl.inject(name, value) } else { this._inject[name] = value } }
identifier_body
tangy-forms-player.component.ts
} from 'src/app/tangy-forms/classes/form-info.class'; import { TangyFormResponseModel } from 'tangy-form/tangy-form-response-model.js'; import { Subject } from 'rxjs'; import { TangyFormsInfoService } from 'src/app/tangy-forms/tangy-forms-info-service'; import { Component, ViewChild, ElementRef, Input } from '@angular...
print
identifier_name
tangy-forms-player.component.ts
/environment'; import { FormInfo, FormTemplate } from 'src/app/tangy-forms/classes/form-info.class'; import { TangyFormResponseModel } from 'tangy-form/tangy-form-response-model.js'; import { Subject } from 'rxjs'; import { TangyFormsInfoService } from 'src/app/tangy-forms/tangy-forms-info-service'; import { Component,...
@Component({ selector: 'app-tangy-forms-player', templateUrl: './tangy-forms-player.component.html', styleUrls: ['./tangy-forms-player.component.css'] }) export class TangyFormsPlayerComponent { // Use one of three to do different things. // 1. Use this to have the component load the response for you. @In...
random_line_split
index.tsx
import * as React from 'react'; import * as MomentTS from 'moment'; import MomentBabel from 'moment'; const moment = typeof MomentTS === 'function' ? MomentTS : MomentBabel; // moment import uses export = {} syntax - which works differently in typescript and babel, so we load both and pick the one that worked :'( impor...
export default Experience;
random_line_split
index.tsx
import * as React from 'react'; import * as MomentTS from 'moment'; import MomentBabel from 'moment'; const moment = typeof MomentTS === 'function' ? MomentTS : MomentBabel; // moment import uses export = {} syntax - which works differently in typescript and babel, so we load both and pick the one that worked :'( impor...
extends React.Component<{ experience: ExperienceType | ProjectType, level: number }, any> { render() { const { experience: { title, start, end, summaryMarkdown, projects, portfolio, icons }, level } = this.props; const renderDate = start || end; const renderProjects = projects && projects.length > 0; ...
Experience
identifier_name
sequenceOperator.tests.ts
import * as chai from 'chai'; import * as slimdom from 'slimdom'; import { evaluateXPathToBoolean, evaluateXPathToNumbers } from 'fontoxpath'; import evaluateXPathToAsyncSingleton from 'test-helpers/evaluateXPathToAsyncSingleton';
it('creates an empty sequence', () => chai.assert.deepEqual(evaluateXPathToNumbers('()'), [])); it('normalizes sequences', () => chai.assert.deepEqual(evaluateXPathToNumbers('(1,2,(3,4))'), [1, 2, 3, 4])); }); describe('range', () => { it('creates a sequence', () => chai.assert.deepEqual(evaluateXPathToNumbers...
describe('sequence', () => { it('creates a sequence', () => chai.assert.deepEqual(evaluateXPathToNumbers('(1,2,3)'), [1, 2, 3]));
random_line_split
users.rs
#![crate_name = "uu_users"] /* * This file is part of the uutils coreutils package. * * (c) KokaKiwi <kokakiwi@kokakiwi.net> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /* last synced with: whoami (GNU coreutils) 8.22 */ // ...
} } endutxent(); } if !users.is_empty() { users.sort(); println!("{}", users.join(" ")); } }
{ unsafe { utmpxname(CString::new(filename).unwrap().as_ptr()); } let mut users = vec!(); unsafe { setutxent(); loop { let line = getutxent(); if line == ptr::null() { break; } if (*line).ut_type == USER_PROCESS...
identifier_body
users.rs
#![crate_name = "uu_users"] /* * This file is part of the uutils coreutils package. * * (c) KokaKiwi <kokakiwi@kokakiwi.net> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /* last synced with: whoami (GNU coreutils) 8.22 */ // ...
users.sort(); println!("{}", users.join(" ")); } }
random_line_split
users.rs
#![crate_name = "uu_users"] /* * This file is part of the uutils coreutils package. * * (c) KokaKiwi <kokakiwi@kokakiwi.net> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /* last synced with: whoami (GNU coreutils) 8.22 */ // ...
(_file: *const libc::c_char) -> libc::c_int { 0 } static NAME: &'static str = "users"; static VERSION: &'static str = env!("CARGO_PKG_VERSION"); pub fn uumain(args: Vec<String>) -> i32 { let mut opts = Options::new(); opts.optflag("h", "help", "display this help and exit"); opts.optflag("V", "version...
utmpxname
identifier_name
mod.rs
pub mod message; use std::net::TcpStream; use std::io; use std::io::{BufReader, Write, BufRead, Error}; use irc::message::{Message, MessageError}; /// Contains methods that handle common IRC functionality. pub trait Irc { /// Sends login credentials to the server. fn login(&mut self, username: &str, oauth: &s...
} /// Represents an error caused by reading a [`Message`] from the server. /// [`Message`]: message/enum.Message.html #[derive(Debug)] pub enum ReadLineError { /// The error is related to the connection. Connection(Error), /// The error is related to the attempt to parse the message received from the serv...
{ writeln!(self, "{}", string)?; self.flush() }
identifier_body
mod.rs
pub mod message; use std::net::TcpStream; use std::io; use std::io::{BufReader, Write, BufRead, Error}; use irc::message::{Message, MessageError}; /// Contains methods that handle common IRC functionality. pub trait Irc { /// Sends login credentials to the server. fn login(&mut self, username: &str, oauth: &s...
{ /// The error is related to the connection. Connection(Error), /// The error is related to the attempt to parse the message received from the server. Message(MessageError), } pub trait ReaderUtil { /// Reads a line directly from the connected server. fn read_line_raw(&mut self) -> Result...
ReadLineError
identifier_name
mod.rs
pub mod message; use std::net::TcpStream; use std::io; use std::io::{BufReader, Write, BufRead, Error}; use irc::message::{Message, MessageError}; /// Contains methods that handle common IRC functionality. pub trait Irc { /// Sends login credentials to the server. fn login(&mut self, username: &str, oauth: &s...
/// Represents an error caused by reading a [`Message`] from the server. /// [`Message`]: message/enum.Message.html #[derive(Debug)] pub enum ReadLineError { /// The error is related to the connection. Connection(Error), /// The error is related to the attempt to parse the message received from the server....
fn send_line(&mut self, string: &str) -> Result<(), io::Error> { writeln!(self, "{}", string)?; self.flush() } }
random_line_split
plugin.py
# 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 t...
def get_plugin(self, auth_url=None, token=None, project_id=None, **kwargs): if not all((auth_url, token)): return None if utils.get_keystone_version() >= 3: return v3_auth.Token(auth_url=auth_url, token=token, ...
class FederatedTokenPlugin(base.BasePlugin): """Authenticate against keystone with an existing token."""
random_line_split
plugin.py
# 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 t...
def list_projects(self, session, auth_plugin, auth_ref=None): if utils.get_keystone_version() < 3: msg = _('Cannot list federated tokens from v2 API') raise exceptions.KeystoneAuthException(msg) client = v3_client.Client(session=session, auth=auth_plugin) return cl...
if not all((auth_url, token)): return None if utils.get_keystone_version() >= 3: return v3_auth.Token(auth_url=auth_url, token=token, project_id=project_id, reauthenticate=False) ...
identifier_body
plugin.py
# 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 t...
(self, auth_url=None, token=None, project_id=None, **kwargs): if not all((auth_url, token)): return None if utils.get_keystone_version() >= 3: return v3_auth.Token(auth_url=auth_url, token=token, ...
get_plugin
identifier_name
plugin.py
# 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 t...
if utils.get_keystone_version() >= 3: return v3_auth.Token(auth_url=auth_url, token=token, project_id=project_id, reauthenticate=False) else: return v2_auth.Token(auth_url=auth_u...
return None
conditional_block
get_key_digest.py
# -*- coding: utf-8 -*- ################################################################################ # Copyright 2013-2015 Aerospike, Inc. # # 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 ...
################################################################################ # Client Configuration ################################################################################ config = { 'hosts': [ (options.host, options.port) ], 'policies': { 'timeout': options.timeout } } ############...
optparser.print_help() print() sys.exit(1)
conditional_block
get_key_digest.py
# -*- coding: utf-8 -*- ################################################################################ # Copyright 2013-2015 Aerospike, Inc. # # 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 ...
optparser = OptionParser(usage=usage, add_help_option=False) optparser.add_option( "--help", dest="help", action="store_true", help="Displays this message.") optparser.add_option( "-U", "--username", dest="username", type="string", metavar="<USERNAME>", help="Username to connect to database.") optpa...
################################################################################ # Options Parsing ################################################################################ usage = "usage: %prog [options] key"
random_line_split
robotiq_gripper_sensor_test.py
# Copyright 2020 DeepMind Technologies Limited. # # 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 ag...
if __name__ == '__main__': absltest.main()
def test_sensor_has_all_observables(self): name = 'gripper' gripper = robotiq_2f85.Robotiq2F85(name=name) sensor = robotiq_gripper_sensor.RobotiqGripperSensor( gripper=gripper, name=name) sensor.initialize_for_task(0.1, 0.001, 100) expected_observable_names = set( sensor.get_obs_key(...
identifier_body
robotiq_gripper_sensor_test.py
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License");
# 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 p...
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at #
random_line_split
robotiq_gripper_sensor_test.py
# Copyright 2020 DeepMind Technologies Limited. # # 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 ag...
(self): name = 'gripper' gripper = robotiq_2f85.Robotiq2F85(name=name) sensor = robotiq_gripper_sensor.RobotiqGripperSensor( gripper=gripper, name=name) sensor.initialize_for_task(0.1, 0.001, 100) expected_observable_names = set( sensor.get_obs_key(obs) for obs in robotiq_gri...
test_sensor_has_all_observables
identifier_name
robotiq_gripper_sensor_test.py
# Copyright 2020 DeepMind Technologies Limited. # # 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 ag...
absltest.main()
conditional_block
TestWinapp.py
common if 'nt' == os.name: import _winreg else: def fake_detect_registry_key(f): return True import bleachbit.Windows bleachbit.Windows.detect_registry_key = fake_detect_registry_key def get_winapp2(): """Download and cache winapp2.ini. Return local filename.""" url = "http://www.wi...
def test_detect_file(self): """Test detect_file function""" tests = [('%windir%\\system32\\kernel32.dll', True), ('%windir%\\system32', True), ('%ProgramFiles%\\Internet Explorer', True), ('%ProgramFiles%\\Internet Explorer\\', True), ...
actual_return = detectos(s, mock) self.assertEqual(expected_return, actual_return, 'detectos(%s, %s)==%s instead of %s' % (s, mock, actual_return, expected_return))
conditional_block
TestWinapp.py
common if 'nt' == os.name: import _winreg else: def fake_detect_registry_key(f): return True import bleachbit.Windows bleachbit.Windows.detect_registry_key = fake_detect_registry_key def get_winapp2(): """Download and cache winapp2.ini. Return local filename.""" url = "http://www.wi...
self.assertTrue(detect_registry_key(keyfull)) self.assertTrue(detect_registry_key('HKCU\\%s' % subkey)) return (dirname, f1, f2, fbak) def ini2cleaner(filekey, do_next=True): ini = file(ini_fn, 'w') ini.write('[someapp]\n') ini.write('La...
"""Setup the test environment""" dirname = tempfile.mkdtemp(prefix='bleachbit-test-winapp') f1 = os.path.join(dirname, f1_filename or 'deleteme.log') file(f1, 'w').write('') dirname2 = os.path.join(dirname, 'sub') os.mkdir(dirname2) f2 = os.path.j...
identifier_body
TestWinapp.py
common if 'nt' == os.name: import _winreg else: def fake_detect_registry_key(f): return True import bleachbit.Windows bleachbit.Windows.detect_registry_key = fake_detect_registry_key def get_winapp2(): """Download and cache winapp2.ini. Return local filename.""" url = "http://www.wi...
(self, cleaner, really_delete): """Test all the cleaner options""" for (option_id, __name) in cleaner.get_options(): for cmd in cleaner.get_commands(option_id): for result in cmd.execute(really_delete): common.validate_result(self, result, really_delete) ...
run_all
identifier_name
TestWinapp.py
common if 'nt' == os.name: import _winreg else: def fake_detect_registry_key(f): return True import bleachbit.Windows bleachbit.Windows.detect_registry_key = fake_detect_registry_key def get_winapp2(): """Download and cache winapp2.ini. Return local filename.""" url = "http://www.wi...
"\nDetect1=HKCU\\Software\\does_not_exist\nDetect2=HKCU\\Software\\Microsoft"): new_ini = test[0] + detect new_test = [new_ini, ] + [x for x in test[1:]] new_tests.append(new_test) positive_tests = tests + new_tests # execute positive ...
"\nDetect=HKCU\\Software\\Microsoft", "\nDetect1=HKCU\\Software\\Microsoft\nDetect2=HKCU\\Software\\does_not_exist",
random_line_split
builder.py
import glob import fnmatch import itertools import logging import os import re import six import sys import yaml from .dockerfile import Dockerfile from .image import ImageBuilder from .config import Config class Builder(object) : def __init__(self, config=None, **kwds) : self.logger = logging.getLogger...
if __name__ == "__main__" : main()
""" Builds a list of images """ from . import commonSetUp if not args: import argparse parser = argparse.ArgumentParser() add_options(parser) args = parser.parse_args(argv[1:]) import sys, os import yaml from docker import Client from . import commonSetUp ...
identifier_body
builder.py
import glob import fnmatch import itertools import logging import os import re import six import sys import yaml from .dockerfile import Dockerfile from .image import ImageBuilder from .config import Config class Builder(object) : def __init__(self, config=None, **kwds) : self.logger = logging.getLogger...
pattern = { 'name': name, 'path': path, 'Dockerfile': dockerfile, } self.patterns.append(pattern) self.config = config def get_matching_pattern(self, pattern, name, path): pattern = pattern[name] if isinsta...
if '*' in name: start = re.sub('^([^*]*/|).*', r'^\1(?P<name>.*)', dockerfile) end = re.sub('^.*\*(?:|[^/]*)(/.*)$', r'\1$', dockerfile) name = re.compile(start + end)
random_line_split
builder.py
import glob import fnmatch import itertools import logging import os import re import six import sys import yaml from .dockerfile import Dockerfile from .image import ImageBuilder from .config import Config class Builder(object) : def __init__(self, config=None, **kwds) : self.logger = logging.getLogger...
(parser): from . import addCommonOptions, commonSetUp from .dockerfile import addDockerfileOptions from .image import addImageOptions try: add = parser.add_argument except AttributeError: add = parser.add_option add("image", nargs="*", help="images to build"...
add_options
identifier_name
builder.py
import glob import fnmatch import itertools import logging import os import re import six import sys import yaml from .dockerfile import Dockerfile from .image import ImageBuilder from .config import Config class Builder(object) : def __init__(self, config=None, **kwds) : self.logger = logging.getLogger...
if name is None: name = dockerfile if '*' in name: start = re.sub('^([^*]*/|).*', r'^\1(?P<name>.*)', dockerfile) end = re.sub('^.*\*(?:|[^/]*)(/.*)$', r'\1$', dockerfile) name = re.compile(start + end) pattern = { ...
if '*' in dockerfile: raise ValueError('Ambiguity in your configuration for %r, globbing can' 'be done either in "Dockerfile" or "path" key but not both at the' 'same time' % image) dockerfile = os.path.join(path, dockerfile) ...
conditional_block
cli.py
import datetime import logging import textwrap import time import click import hatarake import hatarake.net as requests from hatarake.config import Config logger = logging.getLogger(__name__) @click.group() @click.option('-v', '--verbosity', count=True) def main(verbosity):
@main.command() @click.option('--start', help='start time') @click.argument('duration', type=int) @click.argument('title') def submit(start, duration, title): '''Submit a pomodoro to the server''' config = Config(hatarake.CONFIG_PATH) api = config.get('server', 'api') token = config.get('server', 'to...
logging.basicConfig(level=logging.WARNING - verbosity * 10) logging.getLogger('gntp').setLevel(logging.ERROR - verbosity * 10)
identifier_body
cli.py
import datetime import logging import textwrap import time import click import hatarake import hatarake.net as requests from hatarake.config import Config logger = logging.getLogger(__name__) @click.group() @click.option('-v', '--verbosity', count=True) def main(verbosity): logging.basicConfig(level=logging.WA...
@main.command() @click.argument('name', default='heartbeat') def heartbeat(name): config = Config(hatarake.CONFIG_PATH) url = config.get('prometheus', 'pushgateway') payload = textwrap.dedent(''' # TYPE {name} gauge # HELP {name} Last heartbeat based on unixtimestamp {name} {time} ''').for...
click.echo(response.text)
random_line_split
cli.py
import datetime import logging import textwrap import time import click import hatarake import hatarake.net as requests from hatarake.config import Config logger = logging.getLogger(__name__) @click.group() @click.option('-v', '--verbosity', count=True) def main(verbosity): logging.basicConfig(level=logging.WA...
(start, duration, title): '''Submit a pomodoro to the server''' config = Config(hatarake.CONFIG_PATH) api = config.get('server', 'api') token = config.get('server', 'token') response = requests.post( api, headers={ 'Authorization': 'Token %s' % token, }, ...
submit
identifier_name
checkNameAvailabilityInput.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
() { } /** * Defines the metadata of CheckNameAvailabilityInput * * @returns {object} metadata of CheckNameAvailabilityInput * */ mapper() { return { required: false, serializedName: 'CheckNameAvailabilityInput', type: { name: 'Composite', className: 'CheckNam...
constructor
identifier_name
fa.js
OC.L10N.register( "templateeditor", { "Could not load template" : "امکان بارگذاری قالب وجود ندارد", "Saved" : "ذخیره شد",
"Sharing email - public link shares (plain text fallback)" : "ایمیل اشتراک گذاری-لینک عمومی اشتراک گذاری(plain text fallback)", "Sharing email (HTML)" : "اشتراک‎گذاری ایمیل (HTML)", "Sharing email (plain text fallback)" : "ایمیل اشتراک گذاری (plain text fallback)", "Lost password mail" : "ایمیل فراموش ک...
"Reset" : "تنظیم مجدد", "An error occurred" : "یک خطا رخ داده است", "Sharing email - public link shares (HTML)" : "ایمیل اشتراک گذاری-لینک عمومی اشتراک گذاری(HTML)",
random_line_split
import_panel_example.py
# This file is part of the pyqualtrics package. # For copyright and licensing information about this package, see the # NOTICE.txt and LICENSE.txt files in its top-level directory; they are # available at https://github.com/Baguage/pyqualtrics # # Licensed under the Apache License, Version 2.0 (the "License"); # you ma...
print "Panel created successfully, PanelID: " + panel_id
conditional_block
import_panel_example.py
# This file is part of the pyqualtrics package. # For copyright and licensing information about this package, see the # NOTICE.txt and LICENSE.txt files in its top-level directory; they are # available at https://github.com/Baguage/pyqualtrics # # Licensed under the Apache License, Version 2.0 (the "License"); # you ma...
AllED=1) if qualtrics.last_error_message: print "Error creating panel: " + qualtrics.last_error_message else: print "Panel created successfully, PanelID: " + panel_id
], headers=["Email", "FirstName", "LastName", "ExternalRef", "SubjectID"],
random_line_split
anyid.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::num::NonZeroU64; #[cfg(any(test, feature = "for-tests"))] use quickcheck_arbitrary_derive::Arbitrary; use serde_derive::Deseriali...
() -> Self { Self::AnyFileContentId(AnyFileContentId::default()) } } #[auto_wire] #[derive(Clone, Default, Debug, Serialize, Deserialize, Eq, PartialEq)] #[cfg_attr(any(test, feature = "for-tests"), derive(Arbitrary))] pub struct LookupRequest { #[id(1)] pub id: AnyId, #[id(2)] pub bubble_i...
default
identifier_name
anyid.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::num::NonZeroU64; #[cfg(any(test, feature = "for-tests"))] use quickcheck_arbitrary_derive::Arbitrary; use serde_derive::Deseriali...
blake2_hash!(BonsaiChangesetId); #[auto_wire] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Hash)] #[cfg_attr(any(test, feature = "for-tests"), derive(Arbitrary))] pub enum AnyId { #[id(1)] AnyFileContentId(AnyFileContentId), #[id(2)] HgFilenodeId(HgId), #[id(3)] HgTreeId(HgId),...
random_line_split
anyid.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::num::NonZeroU64; #[cfg(any(test, feature = "for-tests"))] use quickcheck_arbitrary_derive::Arbitrary; use serde_derive::Deseriali...
} #[auto_wire] #[derive(Clone, Default, Debug, Serialize, Deserialize, Eq, PartialEq)] #[cfg_attr(any(test, feature = "for-tests"), derive(Arbitrary))] pub struct LookupRequest { #[id(1)] pub id: AnyId, #[id(2)] pub bubble_id: Option<NonZeroU64>, /// If present and the original id is not, lookup w...
{ Self::AnyFileContentId(AnyFileContentId::default()) }
identifier_body
cargo_pkgid.rs
use ops; use core::{MultiShell, Source, PackageIdSpec}; use sources::{PathSource}; use util::{CargoResult, human}; pub fn pkgid(manifest_path: &Path, spec: Option<&str>, _shell: &mut MultiShell) -> CargoResult<PackageIdSpec> { let mut source = try!(PathSource::for_path(&manifest_path.dir_...
Ok(PackageIdSpec::from_package_id(pkgid)) }
random_line_split
cargo_pkgid.rs
use ops; use core::{MultiShell, Source, PackageIdSpec}; use sources::{PathSource}; use util::{CargoResult, human}; pub fn pkgid(manifest_path: &Path, spec: Option<&str>, _shell: &mut MultiShell) -> CargoResult<PackageIdSpec>
{ let mut source = try!(PathSource::for_path(&manifest_path.dir_path())); try!(source.update()); let package = try!(source.get_root_package()); let lockfile = package.get_root().join("Cargo.lock"); let source_id = package.get_package_id().get_source_id(); let resolve = match try!(ops::load_lock...
identifier_body
cargo_pkgid.rs
use ops; use core::{MultiShell, Source, PackageIdSpec}; use sources::{PathSource}; use util::{CargoResult, human}; pub fn
(manifest_path: &Path, spec: Option<&str>, _shell: &mut MultiShell) -> CargoResult<PackageIdSpec> { let mut source = try!(PathSource::for_path(&manifest_path.dir_path())); try!(source.update()); let package = try!(source.get_root_package()); let lockfile = package.get_root().j...
pkgid
identifier_name
webglbuffer.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use crate::dom::bindings::codegen::Bindings:...
} pub fn usage(&self) -> u32 { self.usage.get() } } impl Drop for WebGLBuffer { fn drop(&mut self) { self.mark_for_deletion(true); } }
{ self.delete(false); }
conditional_block
webglbuffer.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use crate::dom::bindings::codegen::Bindings:...
assert!(self.is_deleted()); let context = self.upcast::<WebGLObject>().context(); let cmd = WebGLCommand::DeleteBuffer(self.id); if fallible { context.send_command_ignored(cmd); } else { context.send_command(cmd); } } pub fn is_marked_for_...
fn delete(&self, fallible: bool) {
random_line_split
webglbuffer.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use crate::dom::bindings::codegen::Bindings:...
}
{ self.mark_for_deletion(true); }
identifier_body
webglbuffer.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use crate::dom::bindings::codegen::Bindings:...
(context: &WebGLRenderingContext) -> Option<DomRoot<Self>> { let (sender, receiver) = webgl_channel().unwrap(); context.send_command(WebGLCommand::CreateBuffer(sender)); receiver .recv() .unwrap() .map(|id| WebGLBuffer::new(context, id)) } pub fn new(...
maybe_new
identifier_name
service.js
const fs = require('fs'); const path = require('path'); class Service { constructor() { this.getFileRecursevly = this.getFileRecursevly.bind(this); this.getFiles = this.getFiles.bind(this); } getFileRecursevly(folderPath, shortPath = '')
getFiles(path) { return new Promise((resolve, reject) => { var files = this.getFileRecursevly(path) resolve(files) }) } } module.exports = Service;
{ var files = []; var folder = fs.readdirSync(path.resolve(__dirname, folderPath)); var x = folder.forEach(file => { var filePath = path.resolve(folderPath, file); if (fs.lstatSync(filePath).isDirectory()) { files.push({ folder: file, ...
identifier_body
service.js
const fs = require('fs'); const path = require('path'); class Service { constructor() { this.getFileRecursevly = this.getFileRecursevly.bind(this); this.getFiles = this.getFiles.bind(this); } getFileRecursevly(folderPath, shortPath = '') { var files = []; var folder = fs.read...
}) return files; } getFiles(path) { return new Promise((resolve, reject) => { var files = this.getFileRecursevly(path) resolve(files) }) } } module.exports = Service;
{ files.push({ file: file, folder: shortPath }); }
conditional_block
service.js
const fs = require('fs'); const path = require('path'); class Service {
() { this.getFileRecursevly = this.getFileRecursevly.bind(this); this.getFiles = this.getFiles.bind(this); } getFileRecursevly(folderPath, shortPath = '') { var files = []; var folder = fs.readdirSync(path.resolve(__dirname, folderPath)); var x = folder.forEach(file => { ...
constructor
identifier_name