id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
4855916
<reponame>thomasjpfan/ansible-docker-role import os import json ssl_path = "/etc/docker/ssl" cert_path = os.path.join(ssl_path, "server-cert.pem") key_path = os.path.join(ssl_path, "server-key.pem") ca_path = os.path.join(ssl_path, "ca.pem") client_cert_path = os.path.join(ssl_path, "client-cert.pem") client_key_path ...
StarcoderdataPython
4875594
""" This module has functions for liquid layer detection. """ import numpy as np import numpy.ma as ma import scipy.signal from cloudnetpy import utils from cloudnetpy.constants import T0 def ind_base(dprof, p, dist, lim): """Finds base index of a peak in profile. Return the lowermost index of profile where ...
StarcoderdataPython
1814537
#!/usr/bin/env python import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix from os import path _README=""" A script to generate confusion matrix and evaluate accuracy of rfmix. -<NAME> (magu[at]stanford[dot]edu) """ _TODO=""" 1. modify output directory (currently the output text file...
StarcoderdataPython
1686698
import sys import datetime def capitalize(string): return string[0].upper() + string[1:] action = sys.argv[1] file_path = sys.argv[2] project_name = sys.argv[3] namespace = sys.argv[4] now = datetime.datetime.now() date = now.strftime("%m-%d-%Y %H:%M:%S") args = sys.argv[6:] username = "Logan Rickert" def new_c...
StarcoderdataPython
8020404
<gh_stars>1-10 from typing import AsyncGenerator import pygame import random from car_simulation import Car from dqn import Agent import numpy as np WIDTH = 1920 HEIGHT = 1080 CAR_SIZE_X = 60 CAR_SIZE_Y = 60 BORDER_COLOR = (255, 255, 255, 255) # Color To Crash on Hit current_generation = 0 # Generation counter...
StarcoderdataPython
3256175
<reponame>chuta2323/Pythonista import appex from urllib.parse import quote from webbrowser import open TWITTER_ID = 'Input your ID' if __name__ == '__main__': if appex.is_running_extension(): # No argument info = appex.get_web_page_info() title = info['title'] url = info['url'] # Create sch...
StarcoderdataPython
4951690
import numpy as np import matplotlib.animation import matplotlib.pyplot as plt import mpl_toolkits.axes_grid1 import scipy.interpolate pi = np.pi def rebin_1D(a, shape): sh = shape[0],a.shape[0]//shape[0] return a.reshape(sh).mean(-1) def rebin_2D(a, shape): sh = shape[0],a.shape[0]//shape[0],shape[1],a...
StarcoderdataPython
11370591
<gh_stars>1-10 # 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 http://mozilla.org/MPL/2.0/. class GaiaImageCompareArguments(object): name = 'Gaia Image Compare' args = [ [['--stor...
StarcoderdataPython
3428886
from django.contrib import admin from .models import Exam, Room, ExamVenue, InvigilatorResponse from .forms import RestrictedResponseForm # register without modification admin.site.register(Exam) admin.site.register(Room) admin.site.register(ExamVenue) # custom admin classes # restrict venue options class ResponseAd...
StarcoderdataPython
388713
from django.contrib import admin from .models import Node, Author, Post, Comment, Likes, FriendRequest, Inbox admin.site.register(Node) admin.site.register(Author) admin.site.register(Post) admin.site.register(Comment) admin.site.register(Likes) admin.site.register(FriendRequest) admin.site.register(Inbox)
StarcoderdataPython
4963932
from flask_login import login_required from flasky.decorators import admin_required from flasky.decorators import permission_required from flasky.main import main from flasky.models import Permission @main.route('/secret') @login_required def secret(): return 'Only authenticated users are allowed!' ...
StarcoderdataPython
8191314
import numpy as np UNOCCUPIED = 1 OCCUPIED = -1 FOOD = 1 HEAD = -2 def update_board(state): height = state["board"]["height"] Matrix = [[UNOCCUPIED for x in range(height)] for y in range(height)] board_state = state['board'] food_coords = board_state['food'] snakes = board_state['s...
StarcoderdataPython
5003800
<reponame>EthanCarragher/anesthetic """Tools for reading from polychord chains files.""" import numpy as np from anesthetic.read.getdistreader import GetDistReader class PolyChordReader(GetDistReader): """Read polychord files.""" def samples(self): """Read ``<root>_dead-birth.txt`` in polychord forma...
StarcoderdataPython
4876077
import csv import numpy as np from sklearn import metrics import sed_eval import inference import utils def evaluate_audio_tagging(y_true, y_pred, threshold=0.5): """Evaluate audio tagging performance. Three types of results are returned: * Class-wise * Macro-averaged * Micro-averaged ...
StarcoderdataPython
150069
<reponame>passiopeia/passiopeia-hub<gh_stars>0 """ Clean up burned OTPs from database You should use a cron job to trigger this regularly. """ import datetime from django.core.management import BaseCommand from django.utils.timezone import now from django.utils.translation import gettext_lazy as _ from hub_app.mode...
StarcoderdataPython
8171733
<filename>huaweicloud-sdk-meeting/huaweicloudsdkmeeting/v1/model/user_dto.py # coding: utf-8 import pprint import re import six class UserDTO: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): T...
StarcoderdataPython
11325258
from sympy import (legendre, Symbol, hermite, chebyshevu, chebyshevt, chebyshevt_root, chebyshevu_root, assoc_legendre, Rational, roots, sympify, S, laguerre_l, laguerre_poly) x = Symbol('x') def test_legendre(): assert legendre(0, x) == 1 assert legendre(1, x) == x assert legendre(2, x) =...
StarcoderdataPython
6558988
<filename>tests/tests.py from pygibson import PyGibsonError from nose.tools import eq_, ok_ from django.conf import settings settings.configure() def set_connection(): try: settings.SESSION_GIBSON_TIMEOUT = 100 try: # set IPC connection settings settings.SESSION_GIBSON_UN...
StarcoderdataPython
6521736
<reponame>zztkm/cvoverlayimg #!/usr/bin/env python # -*- coding: utf-8 -*- import cv2 as cv from cvoverlayimg import CvOverlayImage def main(): cv_background_image = cv.imread("image/bg_takeyabu.jpg") cv_overlay_image = cv.imread( "image/ninja_hashiru.png", cv.IMREAD_UNCHANGED) # IMREAD_UNC...
StarcoderdataPython
8112619
<filename>{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/apps/main/actions.py # Actions are mainly ajax requests/responses to feed into views. from django.core.files.base import ContentFile from notifications.signals import notify from {{cookiecutter.project_slug}}.apps.main.models import * from {{cookie...
StarcoderdataPython
1974420
<filename>cmdb-backend/resources/idc.py<gh_stars>10-100 from flask import Flask, request, render_template, redirect, url_for, session, g, abort, flash, make_response, jsonify, Response from datetime import timedelta from models import IDC, User, db from common.utility import auth_login_required, hashpass, login_requ...
StarcoderdataPython
4955501
from stg.api import PulseFile, STG4000 # we initialize the STG and print information about it stg = STG4000() print(stg, stg.version) # create a pulsefile with default parameters p = PulseFile() # compile the pulsefile and expand the tuple to positional arguments # and download it into channel 1 # As you can see, ind...
StarcoderdataPython
9631598
<gh_stars>0 import tensorflow as tf import __main__ import numpy as np from matplotlib import pyplot as plt from spsql import spsql import os from dotenv import load_dotenv from termcolor import colored load_dotenv() import inspect s = spsql() SCHEMA = os.getenv("SCHEMA", "gw") try: from gwtools import mismatc...
StarcoderdataPython
11334563
<filename>gyp/resources.gyp<gh_stars>0 # Copyright 2014 Google Inc. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'resources', 'type': 'static_library', 'sources': [ '../tools/Resources.cpp', ...
StarcoderdataPython
6647799
<filename>pygamelearning/line.py # Write your code here :-) import pygame, time import sys pygame.init() screen = pygame.display.set_mode([500,500]) WHITE = [255,255,255] BLACK = [0,0,0] screen.fill(WHITE) pygame.draw.lines(screen, BLACK, False, [[50,50],[250,100]], 5) pygame.display.update() while True: for ev...
StarcoderdataPython
1959515
#!/usr/bin/env python # -*- coding: utf-8 -*- """ IRC import handler... """ import imp import pkgutil import importlib class ImportHandler(object): """Manage module imports and updates.""" def __init__(self, cmdHandler): super(ImportHandler, self).__init__() self.reply = cmdHandler.repl...
StarcoderdataPython
5103450
<reponame>andrey-zotov/ib_console<gh_stars>10-100 """Module to generate ascii charts. This module provides a single function `plot` that can be used to generate an ascii chart from a series of numbers. The chart can be configured via several options to tune the output. """ from math import ceil, floor, isnan black =...
StarcoderdataPython
4804276
<filename>ctapipe/core/component.py """ Class to handle configuration for algorithms """ from traitlets.config import Configurable from abc import ABCMeta from logging import getLogger class AbstractConfigurableMeta(type(Configurable), ABCMeta): ''' Metaclass to be able to make Component abstract see: ht...
StarcoderdataPython
1838041
<reponame>TS-at-WS/cloudify-manager import os import sys import shutil import tempfile import subprocess from manager_rest.utils import mkdirs S3_URI = 's3://cloudify-tests-logs/' LINK_PREFIX = 'http://cloudify-tests-logs.s3.amazonaws.com/' SKIP_FILES = ['journalctl.log'] def _make_links_file(edition, build, root...
StarcoderdataPython
8057539
from collections import namedtuple from pathlib import Path import pytest IdlFixtures = namedtuple('IdlFixtures', 'idl baseline') SYNTAX_FIXTURES = (Path(__file__).parent / 'syntax').resolve() SYNTAX_IDL_FIXTURES = SYNTAX_FIXTURES / 'idl' SYNTAX_BASELINE_FIXTURES = SYNTAX_FIXTURES / 'baseline' @pytest.fixture(pa...
StarcoderdataPython
6569700
from typing import Any, Dict, List, Optional from aws_lambda_powertools.utilities.data_classes.common import BaseProxyEvent, DictWrapper class APIGatewayEventIdentity(DictWrapper): @property def access_key(self) -> Optional[str]: return self["requestContext"]["identity"].get("accessKey") @proper...
StarcoderdataPython
38565
#coding: utf-8 ''' @Time: 2019/4/25 11:15 @Author: fangyoucai '''
StarcoderdataPython
9786136
<filename>iavm/management/commands/create_iavmcpe.py from django.core.management.base import BaseCommand, CommandError from iavm.libs.IAVM import * class Command(BaseCommand): help = 'Create IAVM-to-CPE Document' def handle(self, *args, **options): try: iavm_to_cpe_doc() except: raise CommandError('...
StarcoderdataPython
6585330
<filename>test/test_datamodel.py #!/usr/bin/env python # $Id$ #------------------------------------------------------------------------ # NAME: test_datamodel.py - # HISTORY: - # 2016-08-18 <EMAIL> - #------------------------------------------------------------------------ import os, sys, traceback, unitt...
StarcoderdataPython
9686417
import unittest from fn.immutable import Deque class FingerTreeDequeTestCase(unittest.TestCase): def test_deque_basic_operations(self): d1 = Deque() d2 = d1.push_back(1) d3 = d2.push_back(2) d4 = d3.push_back(3) d5 = d4.push_front(10) d6 = d5.push_front(20) ...
StarcoderdataPython
1772997
import unittest import sys import random import os dirname, filename = os.path.split(os.path.abspath(__file__)) sys.path.append(dirname + '/..') from src import populations class TestPopulationGA(unittest.TestCase): @classmethod def setUpClass(cls): def of1(*vars): return vars[0] + vars...
StarcoderdataPython
5182632
import sys,re, os from collections import defaultdict from urllib2 import Request, urlopen, URLError import urllib2 from random import randint from time import sleep '''' This class: takes the files (uploads) and store them for next processing. store the files in lists and dictionary: ...
StarcoderdataPython
4835243
<filename>backend/users/migrations/0001_initial.py # Generated by Django 3.2.8 on 2022-01-08 10:45 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0012_alter_user_...
StarcoderdataPython
1891884
<reponame>Gabydelgado/Invest-Simulator from rest_framework import status from rest_framework.test import APITestCase class AccountTests(APITestCase): def test_asset_list(self): response = self.client.post('/api/v1/rest-auth/registration/', { 'username': 'francisco213422', 'passwor...
StarcoderdataPython
8181784
<reponame>Scottx86-64/dotfiles-1 $NetBSD: patch-electrum-ecc_fast.py,v 1.1 2020/11/04 20:45:46 js Exp $ Don't assume libsecp256k1 is in site-packages/electrum. --- electrum/ecc_fast.py.orig 2000-11-11 11:11:11.000000000 +0000 +++ electrum/ecc_fast.py @@ -9,6 +9,7 @@ from ctypes import ( byref, c_byte, c_int, c_u...
StarcoderdataPython
11232823
import numpy as np from imutils import face_utils import cv2 import dlib from scipy.spatial import distance as dist import time from firebase import firebase FBconn = firebase.FirebaseApplication('https://ed-workshop.firebaseio.com/', None) def MAR(mouth): return (dist.euclidean(mouth[0],mouth[1]) + dist.euclid...
StarcoderdataPython
3528027
''' Please move this file to src/ before running the tests ''' import unittest from inverse_text_normalization.run_predict import inverse_normalize_text class TamilInverseTextNormalization(unittest.TestCase): def test_single_digit_numbers_are_converted_to_numerals(self): data = ['நான்கு', 'எட்டு', 'என்ன...
StarcoderdataPython
354663
<gh_stars>1-10 """ Run this example to check if cvxpy is working properly with external solvers such as CVXOPT and Gurobi""" import cvxpy as cp import numpy as np # Problem data. m = 30 n = 20 np.random.seed(1) A = np.random.randn(m, n) b = np.random.randn(m) # Construct the problem. x = cp.Variable(n) objective = ...
StarcoderdataPython
5125695
itm_no_item = 0 itm_french_cav_pistol = 1 itm_french_officer_pistol = 2 itm_french_pistol_1766 = 3 itm_french_pistol_1777 = 4 itm_russian_pistol = 5 itm_british_pistol = 6 itm_french_mousquiton = 7 itm_french_mousquiton_melee = 8 itm_french_mousquiton_light = 9 itm_french_mousquiton_light_melee = 10 itm_french_dragoon_...
StarcoderdataPython
1673696
<filename>src/bxcommon/rpc/requests/subscribe_rpc_request.py import fnmatch from typing import TYPE_CHECKING, Callable, Any, List, Optional from bxcommon import constants from bxcommon.feed.feed import FeedKey from bxcommon.feed.feed_manager import FeedManager from bxcommon.feed.subscriber import Subscriber from bxcom...
StarcoderdataPython
4939485
<filename>full_pipe_line.py import numpy as np import pandas as pd import cv2 import math import os import argparse import pytesseract import operator from PIL import Image from darknet import * from tqdm import tqdm net = load_net(b"/home/sasuke/Downloads/All_detection/yolov3-table.cfg", b"/home/sa...
StarcoderdataPython
6520697
<gh_stars>0 import tensorflow as tf from models.base_go_model import GoModel from models import rnn_cells class GoModelRNN(GoModel): """Base RNN Go Model.""" def bottom(self, features): self.max_game_length = tf.reduce_max(features["game_length"]) return features def top(self, body_outpu...
StarcoderdataPython
6436600
<reponame>Xrenya/algorithms rub = int(input()) kop = int(input()) num = int(input()) def price(rub, kop, num): rubles = rub * num kops = kop * num if kops >= 100: rubles += kops // 100 kops = kops - kops // 100 * 100 return f"{rubles} {kops}" print(price(rub, kop, num))
StarcoderdataPython
256455
import os from djangobench.base_settings import * # NOQA USE_I18N = False USE_L10N = True TEMPLATE_DIRS = ( os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')), ) INSTALLED_APPS = ['l10n_render', 'django.contrib.auth', 'django.contrib.contenttypes'] TEMPLATES = [ { 'BACKEND': 'djan...
StarcoderdataPython
8169183
# Approach 1 - Ordered Dictionary # Time: O(1) # Space: O(capacity) from collections import OrderedDict class LRUCache(OrderedDict): def __init__(self, capacity: int): self.capacity = capacity def get(self, key: int) -> int: if key not in self: return -1 self.mo...
StarcoderdataPython
6650577
#!/usr/bin/env python3 """ Author : <NAME> <<EMAIL>> Date : 2019-04-08 Purpose: Graph through sequences """ import argparse import logging import os import sys from collections import defaultdict from Bio import SeqIO # -------------------------------------------------- def get_args(): """get command-line argu...
StarcoderdataPython
11303236
<reponame>yut23/Microphysics<filename>python_library/StarKiller/setup.py<gh_stars>10-100 from setuptools import setup, find_packages setup(name='StarKiller', version='0.1', description='Python interfaces to StarKiller Microphysics', url='https://github.com/starkiller-astro/Microphysics', author...
StarcoderdataPython
9794827
import re from urllib.parse import urlparse from flask import Blueprint, request from bs4 import BeautifulSoup from utils.http import Req, parse_request_parameter from novels.models import NovelModel from episodes.models import EpisodeModel, EpisodeTextModel from sites.narou.parser import NarouNovelIndexParser, Naro...
StarcoderdataPython
9714976
from tests.graph_case import GraphTestCase class TestOutlookContacts(GraphTestCase): def test0_ensure_user_context(self): whoami = self.client.me.get().execute_query() self.assertIsNotNone(whoami.id) def test1_create_contacts(self): contact_info = { "givenName": "Pavel", ...
StarcoderdataPython
1812844
<reponame>konstantinKim/vd-backend<gh_stars>0 from flask import Flask, Response from flask_restful import Resource, Api from flask_cors import CORS, cross_origin from flask.ext.sqlalchemy import SQLAlchemy class MyResponse(Response): default_mimetype = 'application/json' # http://flask.pocoo....
StarcoderdataPython
3329884
import random from audiomate.corpus.subset import utils def run_split_identifiers(): identifiers = list(range(10000)) proportions = {'a': 0.2, 'b': 0.2, 'c': 0.6} utils.split_identifiers(identifiers, proportions) def test_split_identifiers(benchmark): benchmark(run_split_identifiers) def run_get_...
StarcoderdataPython
5142602
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
1866969
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Implement CBC mode # # CBC mode is a block cipher mode that allows us to encrypt irregularly-sized # messages, despite the fact that a block cipher natively only transforms # individual blocks. # # In CBC mode, each ciphertext block is added to the next ...
StarcoderdataPython
9759903
# pyright: reportMissingModuleSource=false """ Simple Truss Calculator Version: 1.5 Source: https://github.com/lorcan2440/Simple-Truss-Calculator By: <NAME> Contact: <EMAIL> Tests: test_TrussCalc.py Calculator and interactive program for finding internal/reaction forces, stresses and strains o...
StarcoderdataPython
281014
import csv """ File: generator_category.py Author: <NAME> Email: <EMAIL> Github: https://github.com/pceuropa/generator-category-id-and-parent-id Description: Get list of categories and return name, id, parent_id """ class CsvRead(object): filename_csv = '' def __init__(self, filename=None): self.fi...
StarcoderdataPython
4901941
<filename>mmfashion/models/__init__.py<gh_stars>0 from .attr_predictor import * from .backbones import * from .builder import (build_attr_predictor, build_backbone, build_concat, build_embed_extractor, build_global_pool, build_landmark_detector, build_la...
StarcoderdataPython
1604936
<gh_stars>1-10 import cv2 import numpy as np from copy_paste import CopyPaste from coco import CocoDetectionCP from visualize import display_instances import albumentations as A import random from matplotlib import pyplot as plt #%% def xywh2xyxy(x): # Convert nx4 boxes from [x, y, w, h] to [x1, y1, x2, y2] where ...
StarcoderdataPython
11341477
import logging import platform def createLogger(name, debug: bool = False): logger = logging.getLogger(name) level = logging.DEBUG if debug else logging.INFO logger.setLevel(level) # remove all handlers logger.handlers = [] # file logpath = "/tmp/" + name + ".log" if platform.system...
StarcoderdataPython
11230504
<filename>tests/unit/test_world_manager.py<gh_stars>10-100 # # coding: utf-8 # import pytest # import typing # from rolling.game.world import WorldManager # from rolling.kernel import Kernel # # NOTE: test are based on tile_clutter_capacity config # class TestWorldManager: # def _find_available_place_where_drop(...
StarcoderdataPython
6651386
<filename>obsolete/reports/pipeline_chipseq/trackers/PeakCalling.py from ChipseqReport import * class MacsSummary(DefaultTracker): pattern = "(macs_summary)" def getTracks(self, subset=None): return self.getValues("SELECT track FROM macs_summary ORDER BY track") def __call__(self, track, slice=N...
StarcoderdataPython
8108418
<reponame>ORC-RIS/beiwe-backend<gh_stars>10-100 # Generated by Django 2.2.14 on 2020-10-08 21:02 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('database', '0040_fileastext'), ] operations = [ migrations.Al...
StarcoderdataPython
23934
<filename>yocto/poky/bitbake/lib/bb/ui/crumbs/hobcolor.py # # BitBake Graphical GTK User Interface # # Copyright (C) 2012 Intel Corporation # # Authored by <NAME> <<EMAIL>> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as...
StarcoderdataPython
9729923
import os import signal import subprocess from contextlib import contextmanager from dagster import execute_pipeline, seven from dagster.core.definitions.reconstructable import ReconstructablePipeline from dagster.core.instance import DagsterInstance from dagster.core.test_utils import instance_for_test BUILDKITE = o...
StarcoderdataPython
336464
<filename>src/frameworks_and_drivers/healthchecks/healthchecks.py from healthcheck import HealthCheck, EnvironmentDump from src.frameworks_and_drivers.healthchecks.postgres import postgres_healthcheck from src.frameworks_and_drivers.healthchecks.redis import redis_healthcheck from src.frameworks_and_drivers.healthcheck...
StarcoderdataPython
3331513
import logging from queue import Queue import concurrent.futures """ Post processing decorater logic for FtpDownloader """ class FtpDownloaderPostProcess: def __init__(self, ftp_downloader, post_processor, num_workers=None, config_dict=None): self.post_processor = post_processor self.ftp_downlo...
StarcoderdataPython
6538505
from bittrex_api import Bittrex bittrex = Bittrex( api_key='', # YOUR API KEY secret_key='', # YOUR API SECRET max_request_try_count=3, # Max tries for a request to succeed sleep_time=2, # sleep seconds between failed requests debug_level=3 ) v3 = bittrex.v3 # or...
StarcoderdataPython
9786544
<gh_stars>1000+ # Copyright (c) 2015-2018 Cisco Systems, Inc. # # 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, cop...
StarcoderdataPython
8120468
<filename>utils.py import re,pprint from nltk.corpus import stopwords import nltk import json import os import numpy as np import copy import xlwt from collections import defaultdict def meaningless_words(): ''' bag-of-words feature can be reinforced by deleting stopwords in SVM and LR ''' stopwords_...
StarcoderdataPython
11211891
<gh_stars>1-10 """ View logic used in catalog app """ import traceback from django.http import HttpRequest, HttpResponse from django.db import transaction from django.shortcuts import render, redirect, reverse from seev.apps.utils.country import UnoCountry from seev.apps.utils.generators import * from seev.apps.util...
StarcoderdataPython
9708598
# -*- coding: utf-8 -*- # 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”) # # 除非遵守当前许可,否则不得使用本软件。 # # * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件): # 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。 # 除非法律有要求或以书面形式达成协议,否则本软件分发时需保持当前许可“原样”...
StarcoderdataPython
1755122
import csv import json import random input_file = "/home/justin/Eloquent/Datasets/idk/idkdatasettest_small.tsv" output_file = "/home/justin/Eloquent/Datasets/idk/idk_dataset_fluency_turk_in.jsonl" #task = "sentiment" #taskVerb = "understood what emotional sentiment was conveyed by" #task = "Respond" #taskVerb = "unde...
StarcoderdataPython
1734808
#!/usr/bin/env python3 from os import listdir from os.path import isfile, join import argparse import re import string from PIL import Image, ImageFont, ImageDraw import pystache def print_hex(val): return "{0:#0{1}x}".format(val,4) def process_char(font, char): # Calculate char info char_size = font.getsize(ch...
StarcoderdataPython
5133096
"""Producer base-class providing common utilites and functionality""" import logging import time from confluent_kafka import avro from confluent_kafka.admin import AdminClient, NewTopic from confluent_kafka.avro import AvroProducer logger = logging.getLogger(__name__) BROKER_URL = "PLAINTEXT://localhost:9092" SCHEM...
StarcoderdataPython
104105
"""This is the Solution for Year 2021 Day 05""" import itertools from collections import Counter from dataclasses import dataclass from aoc.abstracts.solver import Answers, StrLines @dataclass(frozen=True) class Point: """Immutable point that will define x and y on 2D plane""" x: int y: int @dataclas...
StarcoderdataPython
6407897
<reponame>newtonkiragu/asset-manager from django.apps import AppConfig class AssetManagerConfig(AppConfig): name = 'asset_manager'
StarcoderdataPython
254572
from pymel.core import * import maya.cmds as cmds import webbrowser def standardWindow(windowName, title, buttons): if len(buttons) == 0: error('This window should have at least one button!') if windowName == '': windowName = window(w=300, h=150, title=title) elif window(windowName, e...
StarcoderdataPython
201567
<filename>cognitive/urls.py # Copyright 2015 Cisco 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 l...
StarcoderdataPython
1971997
#!/usr/bin/env python3 from tkinter import * import time __author__ = '<NAME>' __version__ = '0.1.0' def guiInput(tkObj, promptText): c = Canvas(tkObj) c.pack() confirmButton = Button(c, text='Confirm') confirmButton.pack() l = Label(c, text=promptText) l.pack() time.sleep(10) prin...
StarcoderdataPython
8167775
<reponame>rpratap-bot/ceph-qe-scripts """ Boot a VM, attach volume to the VM, detach from the VM. Cleanup the VM, volume instances """ from lib.nova import NovaAuth, NovaActions from lib.glance import GlanceAuth, GlanceActions from lib.cinder import CinderAuth, CinderVolumes import lib.log as log from lib.test_desc i...
StarcoderdataPython
4814800
<filename>drafts/models.py import uuid from random import shuffle from typing import Optional, List from django.contrib.auth.models import User from django.db import models from cubes.models import Cube class Draft(models.Model): uuid = models.UUIDField(unique=True, default=uuid.uuid4) name = models.CharFie...
StarcoderdataPython
6431910
"""Module grouping tests for the pydov.util.caching module.""" import datetime import gzip import os import tempfile from io import open import time import pytest import pydov from pydov.util.caching import ( PlainTextFileCache, GzipTextFileCache, ) from pydov.util.dovutil import build_dov_url @pytest.fixt...
StarcoderdataPython
5101618
<filename>pipeline/reach-es-extractor/refparse/utils/file_manager.py import pandas as pd import gzip import logging import os import pickle import tempfile import json from .s3 import S3 from refparse.settings import settings class FileManager(): def __init__(self, mode='LOCAL', bucket=settings.BUCKET): ...
StarcoderdataPython
1764081
from jumping_number import jumping_number from jumping_number import jumping_number2 def test(benchmark): assert benchmark(jumping_number, 1) == "Jumping!!" def test2(benchmark): assert benchmark(jumping_number2, 1) == "Jumping!!" '''''''''' -----------------------------------------------------------------...
StarcoderdataPython
3229957
from guizero import App, ButtonGroup def selected(): print(choice.value + " " + choice2.value) app = App() choice = ButtonGroup(app, options=["cheese", "ham", "salad"], command=selected) # You can use specific values for the button group by passing them as a 2d list. # choice = ButtonGroup(app, options=[["cheese"...
StarcoderdataPython
9787973
<filename>stimuli/Python/one_file_per_item/en/56_# str_seq 2.py filename = "alphabet.java" modified = filename.split(".") print(modified[-1])
StarcoderdataPython
1997266
# Copyright 2021 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 from unittest.mock import MagicMock import pytest from vdk.api.plugin.connection_hook_spec import ( ConnectionHookSpec, ) from vdk.internal.builtin_plugins.connection.impl.router import ManagedConnectionRouter from vdk.internal.builtin_plugins.con...
StarcoderdataPython
4818940
import os import argparse import warnings import numpy as np import tensorflow as tf import scipy.stats as sps import tensorflow_probability as tfp import seaborn as sns from matplotlib import pyplot as plt from callbacks import RegressionCallback from regression_data import generate_toy_data # workaround: https://g...
StarcoderdataPython
1872847
<reponame>ToonKBC/mlflow class ViewType(object): """Enum to qualify `ListExperiments` API query for requested experiment types.""" ACTIVE_ONLY, DELETED_ONLY, ALL = range(1, 4)
StarcoderdataPython
3498412
import torch from .stiefel import Stiefel from .positive_definite import PositiveDefinite from .euclidean import Euclidean from .hyperbolic import Hyperbolic from .doublystochastic import DoublyStochastic from ..parameter import Parameter class ManifoldShapeFactory(object): """ Base class for manifold shape f...
StarcoderdataPython
302895
<reponame>titos-carrasco/MindWave-BB8-Python #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import threading import serial import time class MindWaveData: def __init__( self ): self.poorSignalQuality = 200 # byte (0 <=> 200) 0=OK; 200=sensor sin contacto c...
StarcoderdataPython
158695
class Expansion(object): __expansion_table = [ 31, 0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 7, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 16, 15, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 24, 23, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 0 ] __p = [ 1, 2, 3, 4, 5, 8, 9, 10, 11, 14, 15, 16, 17, 20,...
StarcoderdataPython
5102310
<reponame>aming/Paper-Board import csv import pyowm import yfinance import urllib from datetime import datetime from . import config from . import gsheet DATA_FILE_PATH = config.config_dir + '/data' DELIMITER = ',' def write_csv_data(data = [], index = 0): with open(DATA_FILE_PATH + "-" + str(index), 'w+') as fil...
StarcoderdataPython
210546
from collections import defaultdict func_stack = {} func_ranges = defaultdict(list)
StarcoderdataPython
8192551
import copy import numpy as np import logging from bnpy.allocmodel.hmm import HMMUtil from bnpy.allocmodel.hmm.HDPHMMUtil import ELBOTermDimMap, calcELBO from bnpy.allocmodel.hmm.HDPHMMUtil import calcELBO_LinearTerms, calcELBO_NonlinearTerms from bnpy.allocmodel import AllocModel from bnpy.suffstats import SuffStatB...
StarcoderdataPython
3571024
from enum import Enum class MessageType(Enum): BLOCK_HEADER = 1 BLOCK_INV = 2 UNCONFIRMED_TRANSACTION = 3 UNCONFIRMED_TRANSACTION_INV = 4 BLOCK_TRANSACTION_INV = 5 SYNCHRONIZE = 6 class TransactionType(Enum): GENESIS = 1 COINBASE = 2 STANDARD = 3 ASSET_CREATION = 4 ASSE...
StarcoderdataPython