id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3311589
<gh_stars>1-10 """fobject Retrieves a random number between 0 and 1. Retrieves a random floating point between 0 and 1. in: None out: - Numeric: random number between 0 and 1 """ from numpy.random import rand class Random: def __init__(self, act, src, user): self.init_time = act.current_time ...
StarcoderdataPython
3205309
<reponame>MarcusJones/kaggle_petfinder_adoption import json import scipy as sp import pandas as pd import numpy as np from functools import partial from math import sqrt from sklearn.metrics import cohen_kappa_score, mean_squared_error,log_loss from sklearn.metrics import confusion_matrix as sk_cmatrix from sklearn....
StarcoderdataPython
161311
#!/usr/bin/env python """ Configuration file for pytest. """ __author__ = "<NAME>" __license__ = "MIT" import sys from os.path import abspath, dirname import pytest from click.testing import CliRunner PACKAGE_PATH = abspath(dirname(dirname(__file__))) sys.path.insert(0, PACKAGE_PATH) @pytest.fixture def runner(): ...
StarcoderdataPython
1749988
from flask import Flask, render_template, request, redirect from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.linear_model import LogisticRegression from sklearn.externals import joblib from bokeh.e...
StarcoderdataPython
3386535
<filename>exam_summer_2019/myproject/myapp/schema.py<gh_stars>1-10 import graphene from graphene import Node, Connection, ConnectionField from graphene_django.types import DjangoObjectType from graphene_django.filter import DjangoFilterConnectionField from myapp.models import Customer class CustomerType(DjangoObject...
StarcoderdataPython
1715232
<reponame>broadinstitute/millipede from functools import cached_property import numpy as np from .util import stack_namespaces class SimpleSampleContainer(object): """ Class used to store MCMC samples and compute summary statistics. All samples are kept in memory. """ def __init__(self): ...
StarcoderdataPython
3278313
from concurrent.futures import ThreadPoolExecutor from datetime import datetime import logging from typing import Dict, Any, cast from pathlib import Path import shutil from scrapli import Scrapli from scrapli.driver import NetworkDriver from constants import USERNAME, PASSWORD, DEVICES # logging.basicConfig(level="...
StarcoderdataPython
124750
import logging import json from exporters import ComponentExporter logger = logging.getLogger('py_modelica_exporter') logger.setLevel(logging.ERROR) # create console handler with a higher log level ch = logging.StreamHandler() ch.setLevel(logging.ERROR) logger.addHandler(ch) # # create formatter and add it to the ha...
StarcoderdataPython
175862
import os import sys import cv2 img_path = 'data1/images' #gt_path = 'didi3/images2' def read_path(file_pathname): #遍历该目录下的所有图片文件 for filename in os.listdir(file_pathname): #print(filename) img = cv2.imread(file_pathname+'/'+filename) new_image = cv2.resize(img, (1640,590), interpolat...
StarcoderdataPython
3333567
"""e Module with all tests for the slack integration implementations author(s): <NAME> (<EMAIL>) """ import unittest.mock as mock import pytest import logging from primrose.notification_utils import SlackClient, get_notification_client def test_post(): client_mock = mock.Mock(return_value=mock.Mock()) ...
StarcoderdataPython
8806
<reponame>jorges119/localstack # simple test function that uses python 3 features (e.g., f-strings) # see https://github.com/localstack/localstack/issues/264 def handler(event, context): # the following line is Python 3.6+ specific msg = f"Successfully processed {event}" # noqa This code is Python 3.6+ only ...
StarcoderdataPython
4813734
<reponame>MacHu-GWU/aws_text_insight-project # -*- coding: utf-8 -*- import io import json import tarfile import traceback from .event import S3PutEvent from .logger import logger from .response import Response, Error from ..config_init import config from ..boto_ses import lbd_boto_ses, lbd_s3_client, lbd_ch_client fr...
StarcoderdataPython
3202487
<gh_stars>0 tuplesaya=['red','green','blue','yellow','white','black'] print(tuplesaya[0]) print(tuplesaya[1]) print(tuplesaya[5])
StarcoderdataPython
157988
<reponame>FanJingithub/performer # -*- coding:utf-8 -*- # Created by Machine (<NAME> build the code-generator) import tornado, os, MySQLdb import tornado.gen import tornado.web import json class api_chemotherapyHandler(tornado.web.RequestHandler): def get(self): print('----------------------------Get api...
StarcoderdataPython
3299782
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Union from .. import utilities, tables class Rule(pulumi.Custo...
StarcoderdataPython
3392864
<gh_stars>0 # AUTO GENERATED FILE - DO NOT EDIT from dash.development.base_component import Component, _explicitize_args class GraduatedBar(Component): """A GraduatedBar component. A graduated bar component that displays a value within some range as a percentage. Keyword arguments: - id (string; optional): ...
StarcoderdataPython
1650625
#!/usr/bin/env python # coding=utf-8 import os VERSION = 'v1.0' START_STR = r''' _ _ _ __ | | | |(_) / _| __ __ ___ | |__ __| | _ _ __ | |_ _ _ ____ ____ \ \ /\ / // _ \| '_ \ / _` || || '__|| _|| | | ||_ /|_...
StarcoderdataPython
56945
<gh_stars>1-10 from typing import ClassVar, Dict, List, Optional, Sequence, Union, Tuple, Any, Type from dataclasses import dataclass, field import numpy as np from pygmsh.common import bspline from ..common import Pointer from pygmsh.geo import Geometry from math import ceil, floor, sqrt from geomdl import BSpline imp...
StarcoderdataPython
105904
numbe = 1125 strnumbe = str(numbe) sumOfDigit = 0 productOfDigit = 1 listdigits = list(map(int, strnumbe)) for elemen in listdigits: sumOfDigit = sumOfDigit+elemen productOfDigit = productOfDigit*elemen if(sumOfDigit == productOfDigit): print('The given number', strnumbe, 'is spy number') else: ...
StarcoderdataPython
134070
import sys if len(sys.argv) > 1 and sys.argv[1] == "--pre": from aiida import orm group, _ = orm.Group.objects.get_or_create("delete-nodes") group.remove_nodes(group.nodes[:]) for i in range(1000): node = orm.Data() node.store() group.add_nodes([node]) else: from aiida import...
StarcoderdataPython
3307527
<gh_stars>1-10 """Coil compression, pre-whitening and sensitivy map estimation utilities. Much of this code is modified from idmrmrd-python-tools https://github.com/ismrmrd/ismrmrd-python-tools Much code that was 2D only has been updated to work with 3D (or nD) data. The user can specify which axis of the array corre...
StarcoderdataPython
1644179
<filename>Lab1/CaeserLab1.py def caesar(s, k, decrypt=False): if decrypt: k = 26 - k r = "" for i in s: if (ord(i) >= 65 and ord(i) <= 90): r += chr((ord(i) - 65 + k) % 26 + 65) elif (ord(i) >= 97 and ord(i) <= 122): r += chr((ord(i) - 97 + k) % 26 + 97) ...
StarcoderdataPython
1713682
from behave import fixture @fixture def cycle(context): """ Define the structures and metadata to perform vault load cycles """ context.hashed_columns = { "STG_CUSTOMER": { "CUSTOMER_PK": "CUSTOMER_ID", "HASHDIFF": {"is_hashdiff": True, "column...
StarcoderdataPython
3333746
<reponame>developerlbas/relabs<gh_stars>1-10 from django.views.generic import DetailView from django.shortcuts import get_object_or_404 from .models import Plantilla class HomeView(DetailView): template_name='repemps_list.html' context_object_name='repemp_data' def get_object(self): rfcpk = self.kwargs.get('rfc...
StarcoderdataPython
3344241
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import print_function from __future__ import division from __future__ import absolute_import import unittest import validator class Valida...
StarcoderdataPython
3333489
# -*- coding:utf-8 -*- # author:huawei from python2sky import config from python2sky.proto.common.trace_common_pb2 import UpstreamSegment from python2sky.proto.language_agent_v2.trace_pb2 import SegmentObject from python2sky.util.common import build_unique_id from python2sky.util.date_util import current_milli_time fro...
StarcoderdataPython
1638925
<filename>smda/intel/FunctionAnalysisState.py import logging from .definitions import END_INS, CALL_INS LOGGER = logging.getLogger(__name__) class FunctionAnalysisState(object): def __init__(self, start_addr, disassembly): self.start_addr = start_addr self.disassembly = disassembly self...
StarcoderdataPython
3397525
# tb_server_defs.py # please put the thingsboard server URL (IP) here global tb_server_url tb_server_url = 'https://iot.sglux.com' # definition of authorization address # this should not need modifikation! global tb_server_api tb_server_api = tb_server_url + '/api' global tb_server_auth tb_server_auth = ...
StarcoderdataPython
1756352
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 13 13:03:04 2018 @author: chenxiaoxu """ import pandas as pd import matplotlib.pyplot as plt import datetime import os Sensor_number = 1 DirPath = '~/codeSummary/GHIprocessing/originalGHI/' filename = DirPath + '2018-09_bps_' + st...
StarcoderdataPython
3307575
# Copyright 2011-2014 MongoDB, 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
StarcoderdataPython
3291719
<reponame>pchero/Jade import common import ast import json import subprocess def check_system_data_types(j_data): if j_data["id"] == None or isinstance(j_data["id"], str) != True: print("Type error. id. type[%s]" % type(j_data["id"])) return False if j_data["ami_version"] ==...
StarcoderdataPython
187241
<reponame>NYULibraries/dlts-enm-tct-backend from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from django.core.cache import cache from otcore.settings import otcore_settings class StopWord(models.Model): """ Stop words will be discarded and will ...
StarcoderdataPython
3359869
DATE_FMT = '%Y-%m-%d %H:%M'
StarcoderdataPython
1706783
<reponame>Data-to-Knowledge/ConsentsReporting<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Tue Jun 25 11:07:27 2019 @author: michaelek """ import os import numpy as np import argparse import pandas as pd from pdsql import mssql import yaml import util pd.options.display.max_columns = 10 run_time_start = pd.Times...
StarcoderdataPython
3257873
<reponame>cfergeau/cluster-node-tuning-operator import fnmatch import re __all__ = ["DeviceMatcher"] class DeviceMatcher(object): """ Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of she...
StarcoderdataPython
1693038
<filename>lang/py/pylib/06/ospath/ospath_join.py #!/usr/bin/env python # -*- coding:UTF-8 -*- # 若某个参数以os.sep开头,前面所有的参数都会舍去 import os.path for parts in [ ('one','two','three'), ('/','one','two','three'), ('one','/two','three'), ]: print parts,' : ',os.path.join(*parts)
StarcoderdataPython
4822915
# UVA question 102 # import itertools permutations = itertools.permutations; import sys stdin = sys.stdin def retainBin( bin, retain ): if retain == 'B': return int(bin[1]) + int(bin[2]) elif retain == 'G': return int(bin[0]) + int(bin[2]) elif retain == 'C': return int(bin[0]) +...
StarcoderdataPython
1703444
<reponame>matthias-wright/cifar10-resnet<gh_stars>1-10 import torch import torchvision.transforms as transforms import torchvision.datasets as datasets import os import model import util class ResNet: def __init__(self): self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') s...
StarcoderdataPython
3216284
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import random random.seed(42) import numpy as np np.random.seed(42) import cvxpy as cp from numpy.random import multivariate_normal from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn.metrics import accuracy_score fro...
StarcoderdataPython
1630792
<reponame>e96031413/DRAGON import os from keras.models import Model from keras.layers import Dense, Input from keras import regularizers from DragonTrainer import DragonTrainer from arg_parser import UserArgs class VisualExpert(object): def __init__(self, input_dim, output_dim, input_layer=None): print("V...
StarcoderdataPython
1699511
<reponame>garrettc/django-ditto from django.urls import reverse from django.test import TestCase from freezegun import freeze_time from ditto.core.utils import datetime_from_str from ditto.lastfm.factories import ( AccountFactory, AlbumFactory, ArtistFactory, ScrobbleFactory, TrackFactory, ) # fr...
StarcoderdataPython
33094
<gh_stars>1-10 # fabfile # Fabric command definitions for running anti-entropy reinforcement learning. # # Author: <NAME> <<EMAIL>> # Created: Tue Jun 13 22:26:00 2017 -0400 # # Copyright (C) 2017 Bengfort.com # For license information, see LICENSE.txt # # ID: fabfile.py [] <EMAIL> $ """ Fabric command definitions ...
StarcoderdataPython
80869
''' leia varios numeros inteiros pelo teclado no final mostre a soma entre todos o maior e o menor o programa deve perguntar se el quer continuar ou nao a digitar válores ''' num = int(input("Diga um numero")) soma = num maior = menor = num continuar = str(input("Deseja continuar? [s] sim [n] não")) while (continuar ...
StarcoderdataPython
1756341
#! /usr/bin/python # -*- coding: utf-8 -*- """ Modul is used for skeleton binary 3D data analysis """ # import sys # import os.path # path_to_script = os.path.dirname(os.path.abspath(__file__)) # sys.path.append(os.path.join(path_to_script, "../extern/dicom2fem/src")) import logging logger = logging.getLogger(__name...
StarcoderdataPython
1690507
""" Collection of helpers for Kolekto. """ import os import gdbm import json def get_hash(input_string): """ Return the hash of the movie depending on the input string. If the input string looks like a symbolic link to a movie in a Kolekto tree, return its movies hash, else, return the input directly in ...
StarcoderdataPython
3297674
from runners.python import Submission class BadouralixSubmission(Submission): def run(self, s): # :param s: input in string format # :return: solution flag step_size = int(s) max_iter = 2017 buffer = [0] current_position = 0 for i in range(1, max_iter + 1): current_position += step_size current_...
StarcoderdataPython
1615702
from PySide.QtCore import * from PySide.QtGui import * from ui.main_window import Ui_Form from ui.mwindow import Ui_MainWindow from Packages import Packages class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self): super(MainWindow, self).__init__() self.setupUi(self) self.packages = Packages('./repo/P...
StarcoderdataPython
1772105
""" This is a script that does some time series analysis on a single voxel for subject 1. It relies heavily on the statsmodels module, and since there aren't really any built-in functions at this time, there is no corresponding file in the functions or tests directories. If writing additional functions becomes nece...
StarcoderdataPython
1665561
<reponame>xujing1994/open_spiel from absl import app from absl import flags import numpy as np from matplotlib.legend_handler import HandlerLine2D import matplotlib.pyplot as plt def read_wr(txt_name): text_file = open(txt_name, "r") lines = text_file.read().split("\n") list1 = [] list2 = [] list3 ...
StarcoderdataPython
3346111
<filename>backend/super_live/lives/migrations/0001_initial.py # Generated by Django 3.1.3 on 2020-11-06 09:40 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migr...
StarcoderdataPython
132419
<filename>prequ/sync.py import collections import os import sys import tempfile from subprocess import check_call import click from ._pip_compat import DEV_PKGS, stdlib_pkgs from .exceptions import IncompatibleRequirements, UnsupportedConstraint from .utils import ( flat_map, format_requirement, get_hashes_from_i...
StarcoderdataPython
92322
<reponame>AshkanTaghipour/ivadomed<filename>testing/test_rgb.py from ivadomed import visualize as imed_visualize import numpy as np import torch def test_save_rbg(): # Create image with shape HxWxDxC image = [[[[0 for i in range(10)] for i in range(10)] for i in range(4)] for i in range(3)] for i in range...
StarcoderdataPython
3303864
<filename>order/migrations/0005_alter_order_amount_alter_order_amount_for_payme.py # Generated by Django 4.0.2 on 2022-04-07 16:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('order', '0004_order_amount_for_payme_alter_order_place_id'), ] op...
StarcoderdataPython
3284073
<reponame>Xelia/mahjong-portal from datetime import datetime, timedelta from django.test import TestCase from django.utils import timezone from rating.calculation.rr import RatingRRCalculation from rating.mixins import RatingTestMixin from rating.models import Rating, RatingDelta, RatingResult, TournamentCoefficients ...
StarcoderdataPython
3374893
import pytest from flask import g, session, url_for, request from portal.db import get_db def test_sessions(client, auth): auth.teacher_login() # Teachers should see session from mock data on session page response = client.get('/teacher/sessions') assert b'180 A' in response.data # Teachers shoul...
StarcoderdataPython
1729264
<filename>chat_wars_database/app/business_exchange/migrations/0003_auto_20200103_2305.py # Generated by Django 3.0.1 on 2020-01-03 23:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('business_exchange', '0002_statsbyday'), ] operations = [ ...
StarcoderdataPython
1725577
import os import logging """ rampup Args: file: Filepath of temp folder Returns: nothing yet Raises: KeyError: Raises an exception. """ def rampup(filepath): commentTotal = 0 lineTotal = 0 commentScore = 0 readmeScore = 0 try: # We want to iterate over modules independently,...
StarcoderdataPython
3204947
from eth2spec.test.helpers.state import get_state_root from eth2spec.test.context import spec_state_test, with_all_phases @with_all_phases @spec_state_test def test_slots_1(spec, state): pre_slot = state.slot pre_root = state.hash_tree_root() yield 'pre', state slots = 1 yield 'slots', slots ...
StarcoderdataPython
1656041
import fastapi as _fastapi import blockchain as _blockchain blockchain = _blockchain.Blockchain() app = _fastapi.FastAPI() # endpoint to mine a block @app.post("/mine_block/") def mine_block(data: str): if not blockchain.is_chain_valid(): return _fastapi.HTTPException( status_code=400, detai...
StarcoderdataPython
81637
import numpy as np # Matrix for converting axial coordinates to pixel coordinates axial_to_pixel_mat = np.array([[np.sqrt(3), np.sqrt(3) / 2], [0, 3 / 2.]]) # Matrix for converting pixel coordinates to axial coordinates pixel_to_axial_mat = np.linalg.inv(axial_to_pixel_mat) # These are the vectors for moving from ...
StarcoderdataPython
1622905
<gh_stars>1-10 from typing import Union from netqasm.lang.ir import BranchLabel, ICmd T_Cmd = Union[ICmd, BranchLabel]
StarcoderdataPython
153754
#!/usr/bin/env python3 import os import glob for lang in ("sme", "est", "fin"): for gender in ("M", "F"): for order in [4,10,20]: with open("{}{}_b_v_{}g_m.sh".format(lang,gender,order), 'w') as f: print("export TEST_NAME='{}{}_b_v_{}g_m'".format(lang,gender,order), file=f) ...
StarcoderdataPython
1724106
import os import numpy as np import time from gym import utils from gym.envs.robotics import hand_env from gym.envs.robotics.utils import robot_get_obs from gym import spaces FINGERTIP_SITE_NAMES = [ 'robot0:S_fftip', 'robot0:S_mftip', 'robot0:S_rftip', 'robot0:S_lftip', 'robot0:S_thtip', ] DEF...
StarcoderdataPython
3352707
import torch from scripts.study_case.ID_4.torch_geometric.utils import scatter_ def test_scatter_(): index = torch.tensor([0, 0, 1, 1]) src = torch.Tensor([-4, -2, 2, 4]) assert scatter_('add', src, index).tolist() == [-6, 6] assert scatter_('mean', src, index).tolist() == [-3, 3] assert scatter_...
StarcoderdataPython
1614876
from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from pizzashopapp.forms import UserForm, PizzaShopForm, UserFormForEdit , PizzaForm from django.contrib.auth.models import User from django.contrib.auth import login,authenticate from pizzashopapp.models import Pi...
StarcoderdataPython
1647803
<filename>oci_api/graph/layer.py # Copyright 2020, <NAME> # # 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 ...
StarcoderdataPython
3360633
# -*- coding: utf-8 -*- """The setup script.""" import os from setuptools import setup, find_packages HERE = os.path.dirname(os.path.abspath(__file__)) # Get the long description from the README file with open(os.path.join(HERE, 'README.md'), encoding='utf-8') as f: long_description = f.read() # get the depende...
StarcoderdataPython
1674764
import random import numpy as np import torch def set_random_seed(seed): if seed < 0: return random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) # torch.cuda.manual_seed_all(seed) def worker_init_fn(worker_id): """The function is designed for pytorch multi-process dataload...
StarcoderdataPython
3303690
from typing import Callable, Optional, Type, cast from fastapi import APIRouter, HTTPException, Request, status from fastapi_users import FastAPIUsers, models from fastapi_users.router.common import ErrorCode, run_handler from fastapi_users.user import ( CreateUserProtocol, InvalidPasswordException, UserAlr...
StarcoderdataPython
104310
import os, time from slackclient import SlackClient from pyslack import SlackClient as slackclient client = slackclient(os.environ.get('SLACK_BOT_TOKEN')) BOT_NAME = 'aws_bot' slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN')) # starterbot's ID as an environment variable # BOT_ID = os.environ.get("BOT_ID") ...
StarcoderdataPython
1615005
from behave import given, then, when @given(u'the user access the homepage') def step_impl(context): context.me.go(path='/') @when(u'he seens "{word}"') def step_impl(context, word): title = context.me.get_title() assert title == word @then(u'be happy') def step_impl(context): pass
StarcoderdataPython
1683656
from django.db import models from django.contrib.auth.models import AbstractUser, Group from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db.models.signals import post_save from django.dispatch import receiver class Organization(mode...
StarcoderdataPython
4815294
import dataclasses import typing import stevedore from bgmi3.core import namespace if typing.TYPE_CHECKING: from bgmi3 import protocol @dataclasses.dataclass class Series: id: str name: str source: str first_episode: int = 1 latest_episode: int = 1 @property def driver(self) -> "pr...
StarcoderdataPython
4635
<filename>src/brisk.py import pybrisk class Brisk: def __init__(self, thresh=60, octaves=4): self.thresh = thresh self.octaves = octaves self.descriptor_extractor = pybrisk.create() def __del__(self): pybrisk.destroy(self.descriptor_extractor) def detect(self, img): ...
StarcoderdataPython
1711405
<gh_stars>1-10 #%% import numpy as np import matplotlib.pyplot as plt color = ('r', 'g', 'b', 'y') def plot_curve(data, title, labels, tofile): if tofile == 1: writeData = np.array(data) np.save("../data/{}.npy".format(title), writeData) print("Save {}.npy done".format(title)) else: ...
StarcoderdataPython
28695
import pandas as pd import numpy as np import yaml import os import argparse from sklearn.impute import KNNImputer from logger import App_Logger file_object=open("application_logging/Loggings.txt", 'a+') logger_object=App_Logger() def read_params(config_path): with open(config_path) as yaml_file: ...
StarcoderdataPython
3377205
<gh_stars>100-1000 """Collecting build artifacts from a Build Events JSON file. This script will collect test result artifacts from a provided Build Events JSON file and copy them to a destination directory. See https://docs.bazel.build/versions/master/build-event-protocol.html Both source BEP file and destination di...
StarcoderdataPython
3338609
# Copyright 2021 DAI Foundation # # 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,...
StarcoderdataPython
4819160
import os import logging from shutil import rmtree import schnetpack as spk from schnetpack.utils import to_json, read_from_json def setup_run(args): argparse_dict = vars(args) jsonpath = os.path.join(args.modelpath, "args.json") if args.mode == "train": if args.overwrite and os.path.exists(args.m...
StarcoderdataPython
1708197
<gh_stars>1-10 class Error(Exception): pass class VNDBOneResult(Error): """ This exception is raised when we search for an item but only get on result so VNDB passes us directly to that content. Attributes: expression - The input name that returned only one result vnid - The ID...
StarcoderdataPython
3224191
#!/usr/bin/python # Copyright: (c) 2020, <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = ''' --- module: tag short_descriptio...
StarcoderdataPython
55372
# Fix for #17 (and ulauncher's #703): explicitly defining Gdk version import gi gi.require_version('GLib', '2.0') gi.require_version('Gtk', '3.0') gi.require_version('Gdk', '3.0') gi.require_version('GObject', '2.0') gi.require_version('Gio', '2.0') gi.require_version('GdkX11', '3.0') gi.require_version('GdkPixbuf', '2...
StarcoderdataPython
1792096
<reponame>lukaszlaszuk/insightconnect-plugins<gh_stars>10-100 # GENERATED BY KOMAND SDK - DO NOT EDIT import komand import json class Component: DESCRIPTION = "Returns an object containing all of a user's factors for MFA" class Input: USER_ID = "user_id" class Output: FACTORS = "factors" cla...
StarcoderdataPython
1661081
<filename>activevision/defaults.py import os # PATHS if 'AVD_DATASET' in os.environ: AVD_DATASET = os.environ['AVD_DATASET'] else: AVD_DATASET = os.path.join(os.path.dirname(__file__), 'AVD_Dataset') IMG_FOLDER = 'jpg_rgb' DEPTH_FOLDER = 'high_res_depth' # FILENAMES SCENE_ANNOTATIONS_FNAME = 'annotations.json...
StarcoderdataPython
1678153
<gh_stars>0 #!/usr/bin/python3 -i # # Copyright (c) 2018-2020 Valve Corporation # Copyright (c) 2018-2020 LunarG, 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 # # http://www.apach...
StarcoderdataPython
191382
<filename>redux/rev_mdf.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 20 15:25:20 2020 @author: jlee """ import numpy as np import glob, os import copy import g0_init_cfg as ic from astropy.io import fits # ----- Importing IRAF from the root directory ----- # current_dir = os.getcwd() os...
StarcoderdataPython
152063
# Import modules from ctypes import windll """ Open cdrom """ def Open(): return windll.WINMM.mciSendStringW(u"set cdaudio door open", None, 0, None) """ Close cdrom """ def Close(): return windll.WINMM.mciSendStringW(u"set cdaudio door closed", None, 0, None)
StarcoderdataPython
32492
# crawl_drugbank.py import time import pickle import json import MySQLdb import httplib import urllib2 as urllib from collections import defaultdict import dbcrawler_util as util from datetime import datetime from bs4 import BeautifulSoup as bs outDir = '/home/tor/robotics/prj/csipb-jamu-prj/dataset/drugbank/drugbank...
StarcoderdataPython
1771253
<gh_stars>1000+ """Supporting definitions for the Python regression tests.""" if __name__ != 'test.test_support': raise ImportError('test_support must be imported from the test package') import unittest # def run_unittest(*classes): # """Run tests from unittest.TestCase-derived classes.""" # valid_types...
StarcoderdataPython
1745122
<reponame>chrismurf/simulus<filename>examples/basics/twosims.py import simulus def handle(sim): print("'%s' handles event at time %g" % (sim.name, sim.now)) sim1 = simulus.simulator(name="sim1", init_time=100) sim2 = simulus.simulator(name="sim2", init_time=-100) for i in range(5, 100, 20): sim1.sched(handle...
StarcoderdataPython
3334778
<gh_stars>0 from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, Filters from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, KeyboardButton import re LOGIN, ANONIMITY = range(2) def start(update, context): if not context.user_data.get('auth', False): context.bot.send_...
StarcoderdataPython
1751018
<reponame>TaoSunVoyage/renku-python<filename>renku/core/models/project.py<gh_stars>0 # -*- coding: utf-8 -*- # # Copyright 2017-2021 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the...
StarcoderdataPython
3315008
<filename>src/sample/checker.py from sample.env import Env class Checker(object): def __init__(self): self.env = Env() def remainder(self, file): time = self.env.getTime() if time > 17: self.env.playWavFile(file)
StarcoderdataPython
1751497
<reponame>mhalt/Burp-Plugin from java.awt.event import ActionListener, MouseAdapter from thread import start_new_thread from java.awt.event import MouseAdapter from burp import IContextMenuFactory from burp import IContextMenuInvocation from javax.swing import JMenuItem from javax.swing import JButton from java.awt imp...
StarcoderdataPython
1686204
<gh_stars>0 from pathlib import Path from modules.alarm import Alarm def main(): alarm = Alarm(sound_file_path=Path('data/alarm-clock-elapsed.wav').resolve()) try: alarm.play() except KeyboardInterrupt: print('Interrupted') finally: alarm.close() try: alarm.chang...
StarcoderdataPython
34563
<gh_stars>10-100 # Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAN...
StarcoderdataPython
3320506
<reponame>LucasLCarreira/Python # Exercício Python 047 # Mostre todos números pares no intervalo de 1 a 50 for c in range(1,51): if c % 2 == 0: print(c,end=' ') for c in range(2,51,2): # menos etapas de processamento, ocupa menos espaço print(c)
StarcoderdataPython
3394396
<reponame>luisriverag/sdk_python<gh_stars>10-100 from bunq.sdk.model.generated.endpoint import RequestInquiry from bunq.sdk.model.generated.endpoint import RequestResponse from bunq.sdk.model.generated.object_ import Amount from tests.bunq_test import BunqSdkTestCase class TestRequestEnquiry(BunqSdkTestCase): """...
StarcoderdataPython
1651523
NAME='symcall' CFLAGS = [] LDFLAGS = [] LIBS = [] GCC_LIST = ['symcall_plugin']
StarcoderdataPython
39778
""" Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed. 37 36 35 34 33 32 31 38 17 16 15 14 13 30 39 18 5 4 3 12 29 40 19 6 1 2 11 28 41 20 7 8 9 10 27 42 21 22 23 24 25 26 43 44 45 46 47 48 49 It is interesting to note that the odd squares lie al...
StarcoderdataPython