id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
4942067
import pyspark.sql.functions as fn from pyspark.sql import DataFrame from pyspark.ml import Transformer class RemoveDuplicates(Transformer): """Drops duplicate records""" def __init__(self, id_col: str = None): super(RemoveDuplicates, self).__init__() self._id_col = id_col def _transform...
StarcoderdataPython
3318548
#!/usr/bin/python from os import listdir from parameter import Parameter import logging log=logging.getLogger("RMDocker.Cgroup") class Cgroup: def __init__(self,name,id,configure): ## name of the subsystem self.name=name ## path to current subsystem self.path="/sys/fs/cgrou...
StarcoderdataPython
5170429
class SingletonMeta(type): def __new__(mcs, name, bases, dct): ist = type.__new__(mcs, name, bases, dct) ist.__instance__ = None return ist def __call__(cls, *args, **kwargs): if cls.__instance__ is None: cls.__instance__ = type.__call__(cls, *args, **kwargs) ...
StarcoderdataPython
5134906
<reponame>JetBrains-Research/ast-transformations a = True and False and not False
StarcoderdataPython
6687733
<filename>wagtail/wagtaildocs/urls.py from django.conf.urls import patterns, url urlpatterns = patterns( 'wagtail.wagtaildocs.views', url(r'^(\d+)/(.*)$', 'serve.serve', name='wagtaildocs_serve'), )
StarcoderdataPython
6649475
# This is a test file, please do not delete. # It is used by the test: # - `test_operation.py:test_invalid_operation_does_stop_application_to_setup` # - `test_api.py:test_invalid_operation_does_stop_application_to_setup` # - `test_api.py:test_invalid_operation_does_not_stop_application_in_debug_mode` raise ValueErro...
StarcoderdataPython
190197
#! /usr/bin/python import sys from objects import Map from utils import find_map fd = open("Loader", "r") fd.seek(0,2) loader_len = fd.tell() fd.close() print "Loader is {0} bytes long.".format(loader_len) if len(sys.argv) != 2: print("Usage: claim_frags <device>") exit(1) fd = open(sys.argv[1], "r+b") map...
StarcoderdataPython
1671255
from itertools import combinations a = int(input()) temp = [] M = 0 push = temp.append find = temp.index for _ in range(a): push([int(x) for x in input().split()]) for (x1, y1), (x2, y2) in combinations(temp, 2): t = pow(x1 - x2, 2) + pow(y1 - y2, 2) if t > M: M = t ans = (find([x1, y1]), fi...
StarcoderdataPython
1996649
<reponame>madani301/Cloud-Platform-Development-Workshop-1 #!/usr/local/bin/python3 """ This script was made by <NAME>. Please use this only as a reference while working on your Cloud Platform Development Coursework. Most of the material here are from AWS Documentations. Go to AWS Documentations for further inform...
StarcoderdataPython
6582170
<filename>libsaas/services/newrelic/resource.py from libsaas import http from libsaas.services import base class NewRelicResource(base.RESTResource): def create(self, *args, **kwargs): raise base.MethodNotSupported() class ApplicationResource(NewRelicResource): path = 'applications' class Applic...
StarcoderdataPython
1681836
<reponame>sttts/qtpyvcp<filename>qtpyvcp/widgets/display_widgets/vtk_backplot/vtk_backplot.py import os from math import cos, sin, radians from operator import add from collections import OrderedDict import linuxcnc from random import choice from qtpy.QtCore import Property, Signal, Slot, QTimer from qtpy.QtGui impo...
StarcoderdataPython
3398337
from __future__ import print_function from sys import exc_info, exit from os import path, remove from numpy import array, zeros, uint32, int, int32, float32 from logging import warning from struct import pack from h5py import File from libs.const import msol, parsec def save_particles(ids, pos, vel, mass, u, outfile...
StarcoderdataPython
174774
from .sim import Simulator, DpiConfig from .simlite import Simlite
StarcoderdataPython
4892500
<reponame>H4rliquinn/Algorithm-Solutions """ Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus or . She must avoid the thun...
StarcoderdataPython
8195027
<reponame>conquerhuang/ESiamFC import os import sys sys.path.append(os.getcwd()) import argparse from fire import Fire from siamfc import train_sep # 在命令行模式运行的时候不能开启一下命令 # import multiprocessing # multiprocessing.set_start_method('spawn',True) gpu_id = 0 # data_dir=r'./train_data/ILSVRC_VID_CURATION' ...
StarcoderdataPython
3240281
#!/bin/python3 """ This scripts simulates the Diffusion equation on a grid (N) until t=tEnd. The solution from the ast time-step is extracted and then taken as the initial condidtion for two more runs (i) in real space and ind (ii) fourier space with simulation length tEnd. """ # Discretization grid N = 1024 impor...
StarcoderdataPython
6458635
<filename>run_metric_dir.py import glob import os import numpy as np from metric import end_point_error_map from flo_utils import readFlow gt_dir = "/home/hd/Projects/Rsrch/ucu/flownet2-pytorch/MPI-Sintel/training/flow/alley_1/" pred_dir = "/home/hd/Projects/Rsrch/ucu/flownet2-pytorch/MPI-Sintel/training/final/alle...
StarcoderdataPython
5073341
from collections import defaultdict from enum import Enum, auto import json import re from kgextractiontoolbox import tools from kgextractiontoolbox.backend.models import Tag, Document from kgextractiontoolbox.document.regex import TAG_LINE_NORMAL, CONTENT_ID_TIT_ABS class DocFormat(Enum): COMPOSITE_JSON = auto...
StarcoderdataPython
5026750
''' ================================================================= @version 1.0 @author <NAME> @title Testing. Main module. ================================================================= ''' import pickle import subprocess import time import sys meganame=sys.argv[1] pname=str(str(subprocess.chec...
StarcoderdataPython
8096048
<gh_stars>1-10 import os import time from celery import Celery broker = os.environ.get('AMQP_HOST', 'amqp://guest:guest@localhost//') celery = Celery('tasks', broker=broker) celery.conf.update( CELERY_ACCEPT_CONTENT=["json"], CELERY_RESULT_BACKEND = "amqp", CELERY_RESULT_SERIALIZER='json', ...
StarcoderdataPython
283306
<filename>Account.py import operator from Transaction import Transaction class Account: """Account class. Performs functions related to accounts""" account_type = "debit" account_list = [] account_num_list = [1000] def __init__(self, pnr, balance = 0, acc_nbr = 1001) -> None: """Initi...
StarcoderdataPython
8030657
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 11 02:42:03 2021 @author: aliasger """ # Importing relevant libraries import pandas as pd from selenium import webdriver import os import time # Loading meta data from csv file meta_data = pd.read_csv("scrape_meta_data.csv") meta_data...
StarcoderdataPython
1609765
#!/usr/bin/env python2 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import import argparse import os from . import config_file from . import config_option from . import current_config from . import prompt def print_config(verbose=False): """ Prints out ...
StarcoderdataPython
8036295
from write_final_abundances_txt import write_final_abundances import sys import argparse parser = argparse.ArgumentParser(description="Takes final abuncances from a set of ts files and combines in one output file.") parser.add_argument('path', type=str, nargs=1, help="path to ts output files, e.g.: /results/ts* ") pa...
StarcoderdataPython
6646216
<reponame>demirdagemir/thesis #!/usr/bin/env python3 """ Controller for the Android Debug Bridge (adb) Logcat. If the module is used as a standalone program, the SIGTERMs are captured to close a bit more properly the thread and subprocess. """ __author__ = "jf (original), adrien (inclusion in BranchExplorer)" import...
StarcoderdataPython
1691055
<reponame>whoiszyc/andes """ Development related functions """ import logging logger = logging.getLogger(__name__) def warn_experimental(feature: str): return logger.warning(f"{feature} is experimental.")
StarcoderdataPython
1791463
from starkware.starknet.business_logic.state import BlockInfo from starkware.starknet.public.abi import get_selector_from_name import logging from ast import Constant import pytest from enum import Enum import asyncio from starkware.starknet.testing.starknet import Starknet from utils import ( Signer, uint, str_to_...
StarcoderdataPython
6411600
import sys import sqlite3 import subprocess import pytest import utils class SQLError(Exception): def __init__(self, err=""): self.err = err return def __str__(self): ans = "\t" ans+= str(self.err, "CP437").replace("\r\n", "\t\r\n") return ans def sqlCommandRunner(dbFile, command): cm...
StarcoderdataPython
8044527
<reponame>properGrammar/jina<gh_stars>0 import pytest from jina.importer import ImportExtensions, import_classes from jina.logging import default_logger def test_bad_import(): from jina.logging import default_logger with pytest.raises(ModuleNotFoundError): with ImportExtensions(required=True, logger...
StarcoderdataPython
9712475
<reponame>DayGitH/Python-Challenges """ The Fibonacci sequence is defined by the recurrence relation: F(n) = F(n−1) + F(n−2), where F(1) = 1 and F(2) = 1. Hence the first 12 terms will be: F(1) = 1 F(2) = 1 F(3) = 2 F(4) = 3 F(5) = 5 F(6) = 8 F(7) = 13 F(8) = 21 F(9) = 34 F(10) = 55 F(11) = 89 F(12) = 144 The 12th te...
StarcoderdataPython
1877262
<filename>tests/test-track.py<gh_stars>0 from snail import track from unittest.mock import MagicMock import io import logbook import re import struct import unittest class TestFileStructureTrackHeader(unittest.TestCase): def setUp(self): self.log_handler = logbook.TestHandler() self.log_handler.pu...
StarcoderdataPython
1970866
#!/usr/bin/env python # To upload a version to PyPI, run: # # python setup.py sdist upload # # If the package is not registered with PyPI yet, do so with: # # python setup.py register from setuptools import setup import os VERSION = '1.1.3' # Auto generate a __version__ package for the package to import with ope...
StarcoderdataPython
117275
import time from PIL import Image, ImageDraw import pyglet from genetic import Myimage, ImagePopulation from sprite import ImagePopulationSprite window = pyglet.window.Window() # 640x480 if __name__ == "__main__": current_generation = 0 current_evolve = 0 start_time = time.time() refer_image = Myimag...
StarcoderdataPython
8027409
import pytest from connector import facebook @pytest.fixture def vrequest(): class Req: def __init__(self): self.args = dict() self.args["hub.mode"] = "subscribe" self.args["hub.challenge"] = "challenge" return Req() @pytest.fixture def patch_verify_token(monkeyp...
StarcoderdataPython
8045515
<reponame>kkcookies99/UAST class Solution: def XXX(self, num: int) -> str: res = '' maps = {2:['M', 'D', 'C'], 1:['C', 'L', 'X'], 0:['X', 'V', 'I']} for i in range(2, -1, -1): digit = 10**i if num < 4*digit: continue ten, five = 10 * digi...
StarcoderdataPython
1879047
import sys import glob import os import json from Training.Client import ServiceClient import Training.Stanford import Training.OpenNLP import Training.GATE import TokenType """ This is the Feature Library which will take the input files and user selected features. It will determine the sequence of pipeline to be cal...
StarcoderdataPython
4948397
<filename>Proyecto/ai/moto.py from ai import moto moto()
StarcoderdataPython
3295576
<filename>test/pattern_for_tests.py<gh_stars>0 from pyembroidery import * import math def evaluate_lsystem(symbol, rules, depth): if depth <= 0 or symbol not in rules: symbol() else: for produced_symbol in rules[symbol]: evaluate_lsystem(produced_symbol, rules, depth - 1...
StarcoderdataPython
298751
<gh_stars>1-10 import gobject import gtk import appindicator if __name__ == "__main__": ind = appindicator.Indicator ("example-simple-client", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS) ind.set_status (appindicator.STATUS_...
StarcoderdataPython
53861
<filename>mail_to/tests/test_default.py<gh_stars>0 # Copyright 2018 <NAME> <https://it-projects.info/team/yelizariev> # Copyright 2018 <NAME> <https://it-projects.info/team/ArtyomLosev> # Copyright 2019 <NAME> <https://it-projects.info/team/KolushovAlexandr> # License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). ...
StarcoderdataPython
1935472
<reponame>DarkEnergySurvey/ugali<gh_stars>10-100 """ Object for isochrone storage and basic calculations. NOTE: only absolute magnitudes are used in the Isochrone class ADW: There are some complicated issues here. As we are generally using a forward-folding likelihood technique, what we would like to do is to convolv...
StarcoderdataPython
1992340
from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from servers.models import Compute from storages.forms import AddStgPool, AddImage, CloneImage from vrtManager.storage import ...
StarcoderdataPython
3493262
import os from parallelm.model import constants class ModelEnv(object): def __init__(self, model_filepath): self._model_filepath = model_filepath if not self._model_filepath.endswith(constants.PIPELINE_MODEL_EXT): self._model_filepath += constants.PIPELINE_MODEL_EXT self._mode...
StarcoderdataPython
1648251
<reponame>workready/pythonbasic<gh_stars>0 from multiprocessing import Pool from time import sleep def snooze(i): print("Proceso {} durmiendo 5 segundos".format(i)) sleep(5) print("Proceso {} despierto".format(i)) def main(): # numero de cpus. Si no le pasamos nada, coge os.cpu_count(), disponible a p...
StarcoderdataPython
217969
<gh_stars>0 from datetime import datetime, timedelta from flask import url_for from flask_restful import marshal from flask_restful.fields import ( Boolean, DateTime, Float, Integer, Nested, String, ) from pytest import mark from observatory.models.point import Point from observatory.rest.owne...
StarcoderdataPython
325350
import tensorflow as tf def forward_propagation(X, parameters): W1 = parameters['W1'] b1 = parameters['b1'] W2 = parameters['W2'] b2 = parameters['b2'] W3 = parameters['W3'] b3 = parameters['b3'] Z1 = tf.add(tf.matmul(W1, X), b1) A1 = tf.nn.relu(Z1) ...
StarcoderdataPython
6678570
<filename>pelutils/jsonl.py """ This module contains utility methods for the .jsonl file format .jsonl are files where each line is a json string """ import json from typing import Generator, Iterable, TextIO def load(f: TextIO) -> Generator: """ Returns a generator of parsed lines in a .jsonl file. Empty lines a...
StarcoderdataPython
3229561
<gh_stars>0 from unittest import TestCase from piccolo.table import Table from piccolo.columns.column_types import Boolean class MyTable(Table): boolean = Boolean(boolean=False, null=True) class TestBoolean(TestCase): def setUp(self): MyTable.create_table().run_sync() def tearDown(self): ...
StarcoderdataPython
4839068
import doctest import gong_xi_fa_cai if __name__ == "__main__": doctest.testmod(gong_xi_fa_cai)
StarcoderdataPython
3267253
<gh_stars>1-10 # Generated by Django 2.0.1 on 2018-05-17 03:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0006_policy_program'), ] operations = [ migrations.AlterField( model_name='policy', name='link...
StarcoderdataPython
239244
<filename>Day 22 - Pong Game/wall.py # coding=utf-8 # <NAME> # <EMAIL> # 2022-03-07 # 100 Days of Code: The Complete Python Pro Bootcamp for 2022 # Day 22 - Pong Game from turtle import Turtle class Wall: def create_wall(input_width, input_height): wall_draw = Turtle() wall_draw.color("black") ...
StarcoderdataPython
8144923
<filename>asapy/load/noun/Dict.py class Dict(): def __init__(self, nouns: dict) -> None: self.nouns = nouns def isFrame(self, noun: str) -> bool: bol = False if noun: for frame in self.nouns['dict']: head = frame['head'] if frame['head'] else '' ...
StarcoderdataPython
3588293
<filename>convert/rfConv_to_FilterSearch.py import re import sys #Pass an input file arg and an output file arg, originally wrote to take bestDataE.ttl open(sys.argv[2], 'a').close() #To create output file if hasn't been already f = open(sys.argv[1], 'r') fo = open(sys.argv[2], 'r+') ent_count = 0 #To double check pro...
StarcoderdataPython
11346231
<filename>addon.py import sys import os current_dir = os.path.dirname(__file__) sys.path.append(os.path.join(current_dir, 'resources', 'lib')) import plugin if __name__ == '__main__': plugin.start()
StarcoderdataPython
290528
<filename>model/blob.py from os import linesep import zlib from biicode.common.exception import BiiException from biicode.common.diffmerge.differ import similarity from biicode.common.utils.serializer import Serializer from biicode.common.model.sha import SHABuilder, SHA class Blob(object): """ Object to hold con...
StarcoderdataPython
8195032
<reponame>JulianoGianlupi/nh-cc3d-4x-base-tool from cc3d import CompuCellSetup from ConvergentExtensionSteppables import ConvergentExtensionSteppable CompuCellSetup.register_steppable(steppable=ConvergentExtensionSteppable(frequency=1)) CompuCellSetup.run()
StarcoderdataPython
12811152
<gh_stars>1-10 # coding: utf-8 """JupyterLab Server handlers""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import os from urllib.parse import urlparse from functools import lru_cache from tornado import template, web from jupyter_server.extension.handler impo...
StarcoderdataPython
1714888
<reponame>bogdandm/django_sphinxsearch<gh_stars>10-100 import datetime import json import time import pytz from sphinxsearch.lookups import sphinx_lookups from django.core import exceptions from django.db import models class SphinxField(models.TextField): """ Non-selectable indexed string field In sphinxse...
StarcoderdataPython
55521
<reponame>vsoch/wordfish ''' Copyright (c) 2017 <NAME> 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 rights to use, copy, modify, merge, pu...
StarcoderdataPython
4829565
# Generated by Django 2.2 on 2020-12-10 21:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('url_shortener', '0004_url_created_by'), ] operations = [ migrations.AddField( model_name='url', name='klin_url', ...
StarcoderdataPython
8128842
<filename>panda/tests/test_purge_orphaned_uploads.py #!/usr/bin/env python import os from django.conf import settings from django.test import TestCase from panda.models import DataUpload from panda.tasks import PurgeOrphanedUploadsTask from panda.tests import utils class TestPurgeOrphanedUploads(TestCase): fixt...
StarcoderdataPython
1634766
<filename>anima/ui/ui_compiled/repository_dialog_UI_pyside.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_files\repository_dialog.ui' # # Created: Tue May 09 09:41:16 2017 # by: pyside-uic 0.2.14 running on PySide 1.1.1 # # WARNING! All changes made in this file will be lost! ...
StarcoderdataPython
348936
import aiohttp import asyncio from .config import PRODUCTION_CONFIG, Config import logging import json import hashlib from dataclasses import dataclass, field import typing import datetime class Session: """ Session - класс, необходимый для организации асинхронного общения с RedForester от имени пользователя...
StarcoderdataPython
12822255
<reponame>Azzam-Radman/Miscellaneous class LOFO(object): def __init__(self, data, labels, model, n_splits, eval_metric): self._data = data self._labels = labels self.model = model self.n_splits = n_splits self.eval_metric = eval_metric def kfold(sel...
StarcoderdataPython
8135847
import os import cv2 from tqdm import tqdm from loguru import logger from argparse import ArgumentParser import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import ConfusionMatrixDisplay, confusion_matrix, classification_report from tools.custom_tools.utils import mkdir, save_json, load_json, save...
StarcoderdataPython
3378586
<gh_stars>100-1000 from .auto_image_param import BaseImageParam import cv2 import torch import numpy as np from .constants import Constants from .error_handlers import PytorchVersionError from .utils import ( lucid_colorspace_to_rgb, normalize, get_fft_scale_custom_img, denormalize, rgb_to_luci...
StarcoderdataPython
310233
from flask import Blueprint, request, jsonify from wafec_test_data_server.models import * __all__ = [ 'data_event_controller' ] data_event_controller = Blueprint('data_event_controller', __name__) @data_event_controller.route('/api/data_event/', methods=['POST']) def post(): session = Session() try: ...
StarcoderdataPython
1920187
<filename>Boot2Root/hackthebox/Minion/scripts/decrypt.py for char in '/2^c`.5_423a_.2-521/5-.26/5^.`c': print(chr(ord(char)+3),end="")
StarcoderdataPython
4977757
<filename>nicos_mlz/mira/devices/radmon.py<gh_stars>1-10 # -*- coding: utf-8 -*- # ***************************************************************************** # NICOS, the Networked Instrument Control System of the MLZ # Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS) # # This program is free softwar...
StarcoderdataPython
11289182
""" MIT License Copyright (c) 2021 martinpflaum 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 rights to use, copy, modify, merge, publish, ...
StarcoderdataPython
182003
# Copyright 2019, Google LLC. # # 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
8154906
import numpy as np import matplotlib.pyplot as plt import bead_util as bu import grav_util as gu reload_dat = False if reload_data: path = "/data/20180625/bead1/grav_data/no_shield/X60-80um_Z15-25um_17Hz" files = bu.find_all_fnames(path) dict = gu.get_data_at_harms(files[10:])
StarcoderdataPython
3566871
import sys sys.path.insert(0,'..') import inline_tools def multi_return(): return 1, '2nd' def c_multi_return(): code = """ py::tuple results(2); results[0] = 1; results[1] = "2nd"; return_val = results; """ return inline_too...
StarcoderdataPython
8123973
# 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> # COMMAND ---------- # M...
StarcoderdataPython
8004896
<gh_stars>10-100 # ccn-lite/src/py/ccnlite/util.py ''' CCN-lite module for Python: utility procedures Copyright (C) 2015, <NAME>, University of Basel Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and th...
StarcoderdataPython
4917010
#!/usr/bin/env python3 def steps(points): for step in points: yield(step) listofsteps = [100e3, 300e3, 1e6, 3e6, 10e6, 30e6, 50e6, 100e6, 300e6, 500e6, 1000e6, 1500e6, 2000e6, 2600e6, 3000e6, 4000e6, 4200e6] numberofsteps = len(listofsteps) print(numberofsteps) print("") stepper = steps(listofsteps) ...
StarcoderdataPython
11242271
<reponame>tonyroberts/project-tetra-display from abc import ABC, abstractmethod import random import warnings import time import math class I2CInterfaceBase(ABC): """Implements an I2C interface using adafruit_blinka. Parameters ---------- address: int The address of the I2C device you want to...
StarcoderdataPython
6505477
from pathlib import Path from fhir.resources.codesystem import CodeSystem from oops_fhir.utils import CodeSystemConcept __all__ = ["PlanDefinitionType"] _resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json")) class PlanDefinitionType: """ PlanDefinitionType The type of PlanDefinition....
StarcoderdataPython
1754545
import unittest import os from robot.errors import DataError from robot.tidy import TidyCommandLine from robot.utils.asserts import assert_raises_with_msg, assert_equals, assert_true class TestArgumentValidation(unittest.TestCase): def test_valid_explicit_format(self): opts, _ = self._validate(format='t...
StarcoderdataPython
8182383
from src.competitors.competitor_models import UMAP from src.competitors.config import ConfigGrid_Competitors from src.datasets.datasets import SwissRoll, MNIST_offline from src.evaluation.config import ConfigEval swissroll_test = ConfigGrid_Competitors( model_class = [UMAP], model_kwargs=[dict()], dataset=...
StarcoderdataPython
9631362
from setuptools import setup setup(name='air_gym', version = '0.0.1', install_requires=['gym','airsim'] )
StarcoderdataPython
12863743
<reponame>zztin/SingleCellMultiOmics from singlecellmultiomics.modularDemultiplexer.baseDemultiplexMethods import UmiBarcodeDemuxMethod, NonMultiplexable # ScarTrace class ScartraceR1(UmiBarcodeDemuxMethod): def __init__(self, barcodeFileParser, **kwargs): self.barcodeFileAlias = 'scartrace' ...
StarcoderdataPython
220401
<reponame>colaboradorDiego/asyncioForDummies from threading import Thread from time import sleep, time """ De aqui en mas a las tareas que hoy son los generadores los vamos a llamar coRutinas. Como programadores vamos chocar con librerias y codigo que son sync (SINCRONICAS). Por ejemplo si utilizo una lib para sql y ...
StarcoderdataPython
11222261
from data_structures import SinglyLinkedList from .parameters import * import pytest, random @pytest.fixture def base_ll(): ll = SinglyLinkedList() for i in range(ITERS): ll.insert_tail(i) return ll def test_repr(): ll = SinglyLinkedList() assert(repr(ll) == "Empty") for i in range(5):...
StarcoderdataPython
4921664
<filename>timeit_reverse.py # Time is not precise as there might be background process momentarily running which disrupts the code execution import operator from time import time # Precise from timeit import timeit # Here we want to invert digits number = ''.join([str(i) for i in range(100)]) # input("Input a ...
StarcoderdataPython
11298859
import dash from dash.dependencies import Input, Output import dash_core_components as dcc import dash_html_components as html import plotly.graph_objects as go app = dash.Dash() app.layout = html.Div([ html.H1('Hello Scipy'), dcc.Markdown(''' The first part of a Dash apps in the 'layout' of the app...
StarcoderdataPython
59965
<reponame>deepcoder42/mongo-lib #!/usr/bin/python # Classification (U) """Program: crt_coll_inst.py Description: Unit testing of crt_coll_inst in mongo_libs.py. Usage: test/unit/mongo_libs/crt_coll_inst.py Arguments: """ # Libraries and Global Variables # Standard import sys import os if s...
StarcoderdataPython
6402963
# -*- coding:utf-8 -*- # Created by Hans-Thomas on 2011-05-12. #============================================================================= # autorunner.py --- Run tests automatically #============================================================================= from __future__ import absolute_import, print_functio...
StarcoderdataPython
3544068
#=============================================================================== # Copyright 2014-2022 Intel Corporation # # 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.apa...
StarcoderdataPython
3353321
import math from typing import Tuple from grounding.constants import SupportabilityConstant def get_tolerable_body_current_limit( exposure_duration: float, use_50kgs_model: bool = False, ) -> float: if not 0.03 < exposure_duration < 3.0: raise ValueError("exposure_duration must be a value betwee...
StarcoderdataPython
11254813
<reponame>falwat/code_repo """ Copyright (C) 2021 <NAME>(<EMAIL>). All Rights Reserved. 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 right...
StarcoderdataPython
6500915
<filename>tests/0100_utils/01_init_directory.py import os import logging from optimus.utils import init_directory def test_success(caplog, temp_builds_dir): """Given directory does not exists, will be created""" basepath = temp_builds_dir.join("init_directory_success") destination = os.path.join(basepat...
StarcoderdataPython
200986
from app.api.event_handlers import BacklogHandler, on_agent_removed, on_connection_failure, on_hidden_service_start from app.messaging.messaging_commands import ImAliveCommand from app.messaging.authenticator import Authenticator from app.shared.logging import initialize_logging from app.networking.topology import Topo...
StarcoderdataPython
337718
#!/usr/bin/env python2.7 import sympy import z3 import numpy as np import scipy.optimize as op import argparse import sys, os import time import collections import subprocess import multiprocessing as mp import warnings import struct import cPickle as pickle sys.path.insert(0,os.path.join(os.getcwd(),"build/R_ulp")) i...
StarcoderdataPython
218333
<filename>tests/__init__.py # -*- coding: utf-8 -*- """Unit test package for rfc3339_validator."""
StarcoderdataPython
3493139
# -*- coding: utf-8 -*- from datetime import datetime from sqlalchemy import desc from flask import render_template, redirect, request, session, url_for, flash from flask.ext.login import (LoginManager, login_user, logout_user, current_user, login_required) from flask.ext.mail import Mail,...
StarcoderdataPython
208548
# SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries # # SPDX-License-Identifier: MIT """Pin definitions for the Orange Pi PC.""" from adafruit_blinka.microcontroller.allwinner.h3 import pin PA12 = pin.PA12 SDA = pin.PA12 PA11 = pin.PA11 SCL = pin.PA11 PA6 = pin.PA6 PA1 = pin.PA1 PA0 = pin.PA0 PA3 = pin.PA3 ...
StarcoderdataPython
9707533
from moto.core import BaseBackend class InstanceMetadataBackend(BaseBackend): pass instance_metadata_backend = InstanceMetadataBackend(region_name="global")
StarcoderdataPython
1805586
""" Code for twitter tipping bot """ import logging import time import os import requests import tweepy from dotenv import load_dotenv load_dotenv(verbose=True) logging.basicConfig(level=logging.INFO) LOGGER = logging.getLogger() API_KEY = os.getenv("API_KEY") API_SECRET = os.getenv("API_SECRET") ACCESS_TOKEN = os....
StarcoderdataPython
3263969
<reponame>janvanrijn/viz import argparse import logging import matplotlib.pyplot as plt import numpy as np import sklearn.datasets import typing # https://becominghuman.ai/paper-repro-learning-to-learn-by-gradient-descent-by-gradient-descent-6e504cc1c0de def parse_args(): parser = argparse.ArgumentParser() pa...
StarcoderdataPython