id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
35099
<filename>src/predictor.py<gh_stars>1-10 # -*- coding: utf-8 -*- # ©Prem Prakash # Predictor module import os import sys import pdb from copy import deepcopy import argparse import onnx import onnxruntime as ort import math from matplotlib.pyplot import imshow import numpy as np import pandas as pd import torch i...
StarcoderdataPython
4811155
<filename>gdal/swig/python/osgeo/gdalnumeric.py from numpy import * from osgeo.gdal_array import *
StarcoderdataPython
3278836
import sys f = open(sys.argv[1]) content = f.read().splitlines() print("val") mean = str(round(float(content[1]), 2)) var = str(round(float(content[2]), 2)) print(mean + " $\\pm$ " + var) print("train") mean = str(round(float(content[4]), 2)) var = str(round(float(content[5]), 2)) print(mean + " $\\pm$ " + var) f.close...
StarcoderdataPython
158358
import cmath class Complex(complex): def __repr__(self): rp = '%7.5f'%self.real if not self.pureImag() else '' ip = '%7.5fj'%self.imag if not self.pureReal() else '' conj = '' if (self.pureImag() or self.pureReal() or self.imag<0.0) else '+' return '0.0' if (self.pureImag() and self.pureReal(...
StarcoderdataPython
145650
# Given a year, determine whether it is a leap year. If it is a leap year, # return the Boolean True, otherwise return False. # Note that the code stub provided reads from STDIN and # passes arguments to the is_leap function. It is only necessary to complete the is_leap function. def is_leap(year): leap = False ...
StarcoderdataPython
3278215
<reponame>zacharyCormack/Assortment<filename>calc_methods.py import math ROUND = 2 def fib(n): if n: if n == 1: print("1", end=", ") return 1, 1 prev = fib(n-1) print(prev[0], end=", ") return sum(prev), prev[0] return 1, 0 def A_hide(m, n): if m == 0: return n+1 elif m == 1: return n+2 elif...
StarcoderdataPython
1601235
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ File name: load_data.py Author: locke Date created: 2020/3/25 下午7:00 """ import time import numpy as np class AlignmentData: def __init__(self, data_dir="data/DBP15K/ja_en", rate=0.3, share=False, swap=False, val=0.0, with_r=False): t_ =...
StarcoderdataPython
1640058
<filename>forge/core/nodes/__init__.py import abstract import maya import serializer __all__ = ['serializer', 'base', 'maya']
StarcoderdataPython
111775
<gh_stars>10-100 """Compiler for Warren Abstract Machine. We don't implement all WAM instructions, specially those related to unsafe/local divide of memory. All memory cells are Python objects, so we don't need to worry about a stack cell pointing to a heap cell. We use Debray's algorithm to allocate registers, expla...
StarcoderdataPython
180712
<filename>unetsocket/python/txdata.py<gh_stars>10-100 #/////////////////////////////////////////////////////////////////////////////// #// #// Script to transmit data. #// #// In terminal window (an example): #// #// $ txdata.py <ip_address> <rx_node_address> [port] #// #////////////////////////////////////////////////...
StarcoderdataPython
1752054
import itertools from .material import Material, MAT_WATER # Counter for objects, every new object will have n+1 surface number cell_counter = itertools.count(100) created_cells = [] # All objects after initialisation go here class Cell: # superclass with common properties/methods for all surfaces def __init__(...
StarcoderdataPython
1600324
<reponame>deadbits/Intersect-2.5<filename>Scripts/Samples/Shells.py #!/usr/bin/python # intersect 2.0 | created by ohdae # copyright 2012 # payload_template to be used with Create.py import sys, os, re, signal from subprocess import Popen,PIPE,STDOUT,call import platform import shutil import getopt import tarfile impo...
StarcoderdataPython
4825234
from tkinter import * import tkinter.messagebox as tmsg root=Tk() root.geometry("444x222") root.title("Radiobutton Tutorial") def order(): tmsg.showinfo("Order received!", f"We have received your order for {var.get()}, thanks for ordering") var = StringVar() var.set("Radio") Label(root, text= "Wh...
StarcoderdataPython
4742
''' All the reserved, individual words used in MAlice. ''' A = "a" ALICE = "Alice" AND = "and" ATE = "ate" BECAME = "became" BECAUSE = "because" BUT = "but" CLOSED = "closed" COMMA = "," CONTAINED = "contained" DOT = "." DRANK = "drank" EITHER = "either" ENOUGH = "enough" EVENTUALLY = "eventually" FOUND = "found" H...
StarcoderdataPython
62940
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # This file is part of Simple Wallpaper Randomizer # # Copyright (c) 2019 <NAME> <<EMAIL>> # # 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 w...
StarcoderdataPython
108708
<reponame>federico123579/BigBrother __all__ = ['base', 'bbro', 'clint', 'sentry']
StarcoderdataPython
4819334
#!/usr/bin/env python #coding:utf-8 # 엑셀의 어셋들을 자동으로 csi에 등록하는 툴 # 입력 정보: 타입,에셋명,설명 import sys, os import json import urllib2 sys.path.append("/lustre/INHouse/Tool/pmutil") import xlrd def checkProjectNameFromFileName(path): """ 엑셀 파일의 영문프로젝트명이 존재하는지 확인한다. """...
StarcoderdataPython
3355318
<filename>scripts/generate_instrumentation_bootstrap.py #!/usr/bin/env python3 # Copyright The OpenTelemetry Authors # # 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...
StarcoderdataPython
58132
<reponame>mengjian0502/UKF_Implementation ''' UKF example Reference: Examples from PyKalman Documents <NAME> Dependencies: PyKalman ''' # Required Libraries import numpy as np import matplotlib.pyplot as plt from pykalman import UnscentedKalmanFilter def transition_funciton(state, noise): ''' -------- ...
StarcoderdataPython
151908
def Duplicate_Charaters(Test_String): Duplicates = [] for char in Test_String: if Test_String.count(char) > 1 and char not in Duplicates: Duplicates.append(char) return Duplicates Test_String = input("Enter a String: ") print(*(Duplicate_Charaters(Test_String)))
StarcoderdataPython
1745777
<gh_stars>10-100 import time import who_calls import neo_cgi PROFILER_DATA = [] PROFILER_START = 0 PROFILER_ENABLED = 0 PROFILER_DEPTH = 0 def enable(): global PROFILER_START global PROFILER_ENABLED global PROFILER_DATA PROFILER_START = time.time() PROFILER_ENABLED = 1 PROFILER_DATA = [] def...
StarcoderdataPython
1758145
""" Examples of Coxeter groups """ # temporary until someone implements an appropriate example from . import finite_weyl_groups Example = finite_weyl_groups.Example
StarcoderdataPython
193830
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
StarcoderdataPython
1696933
from sqlalchemy import * # noqa: F403,401
StarcoderdataPython
1726871
<reponame>openamundsen/openamundsen from numba import njit, prange import numpy as np from openamundsen import ( constants as c, heatconduction, ) def soil_properties(model): """ Wrapper function for _soil_properties(). """ s = model.state _soil_properties( model.grid.roi_idxs, ...
StarcoderdataPython
3388721
<reponame>ThomasB15/254-space-log #!/usr/bin/env python3 # # Use like `./space_log.py elite.log -s|-p|-t|-d|-f from sys import argv import fuel import LightYears import starsystems import planets import terraformable # Opens the log file and grabs the contents. try: fh = open(argv[1], 'r') content = fh.read() fh...
StarcoderdataPython
4829107
# Copyright 2014 Cloudbase Solutions Srl # # 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
79526
import statistics from typing import List, Tuple import pendulum from smart_queue.analysis import CONDITION_TABLE, CONFIGURATION_PATH from smart_queue.analysis.classes.Patient import Patient class Queue: def __init__(self, open_time, close_time, iter_data=None, naive=True): self.open_time = pendulum.par...
StarcoderdataPython
73500
<filename>lib/codegen/meta-python/build.py # Second-level build script. # # This script is run from lib/codegen/build.rs to generate Rust files. from __future__ import absolute_import import argparse import isa import gen_instr import gen_settings import gen_build_deps import gen_encoding import gen_legalizer import g...
StarcoderdataPython
3339669
from os import path from random import sample from string import ascii_letters, digits COUNT_XML_IN_ZIP = 100 ROOT_DIR = path.dirname(path.abspath(__file__)) STORE_DIR = path.join(ROOT_DIR, 'store') RESULT_DIR = path.join(ROOT_DIR, 'result') XML_EXTENSION = 'xml' FIRST_RESULT = '01_id_lvl.csv' SECOND_RESULT = '02_id_...
StarcoderdataPython
1717331
<reponame>TheEin/swagger-maven-plugin '''tzinfo timezone information for Pacific/Port_Moresby.''' from pytz.tzinfo import StaticTzInfo from pytz.tzinfo import memorized_timedelta as timedelta class Port_Moresby(StaticTzInfo): '''Pacific/Port_Moresby timezone definition. See datetime.tzinfo for details''' zone ...
StarcoderdataPython
28883
<reponame>mitul3737/My-Python-Programming-journey-from-Beginning-to-Data-Sciene-Machine-Learning-AI-Deep-Learning<gh_stars>1-10 li=["a","b","d"] print(li) str="".join(li)#adding the lists value together print(str) str=" ".join(li)#adding the lists value together along with a space print(str) str=",".join(li)#adding ...
StarcoderdataPython
1722321
<reponame>PUNITKUMARGAUTAM/mydjango from django.db import models # Create your models here. class Student(models.Model): studentrollno = models.CharField(max_length= 300) studentname = models.CharField(max_length= 50) studentbranch = models.CharField(max_length= 50) studentdpt = models.CharField(max_le...
StarcoderdataPython
3200344
<reponame>ximury/Blog import math from flask import Blueprint, abort, render_template, request, session from common.utility import parse_image_url, generate_thumb from module.article import Article from module.comment import Comment from module.credit import Credit from module.favorite import Favorite from module.use...
StarcoderdataPython
4822735
<filename>_token.py class Token: def __init__(self, type_, value=None, pos_start=None, pos_end=None): self.type = type_ self.value = value if pos_start: self.pos_start = pos_start.copy() self.pos_end = pos_start.copy() self.pos_end.advance() if p...
StarcoderdataPython
41596
# MIT License # # Copyright (c) 2019 <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,...
StarcoderdataPython
65213
<filename>Python/00_little_helper/configured_logger/configured_logger.py ######################################### # author: <NAME> # created: 25.02.2021 ####################################### import logging import os def printit(): print("import geht endlich1!!!") class MyLogger: """ Usage: Import C...
StarcoderdataPython
140669
<gh_stars>0 import os if not ("DISPLAY" in os.environ): import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from PIL import Image import numpy as np import cv2 cmap = plt.cm.jet def depth_colorize(depth): depth = (depth - np.min(depth)) / (np.max(depth) - np.min(depth)) depth = 25...
StarcoderdataPython
1662035
<reponame>WebPowerLabs/django-trainings from django.core.management.base import BaseCommand try: from django.contrib.auth import get_user_model User = get_user_model() except ImportError: from django.contrib.auth.models import User from djnfusion import sync_user class Command(BaseCommand): help = ...
StarcoderdataPython
4842186
import sys from pandas import read_csv input_file = sys.argv[1] col_name = sys.argv[2] data = read_csv(input_file) dataFrame = data.iloc[:,:] l = list(dataFrame) print(l.index(col_name))
StarcoderdataPython
101268
from math import * import numpy as np def f(x, a=1): return sin(exp(a * x)) def generate(fileName, start=0, end=2, n=20): X = np.linspace(start, end, n) Y = list() for a in range(1, n+1): Y.append([f(x, a) for x in X]) with open('test/X.csv', 'w') as fs: line = X.join(',') ...
StarcoderdataPython
1701399
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for the error callback""" import unittest try: from unittest import mock except ImportError: import mock import rtmidi class TestErrorCallback(unittest.TestCase): INVALID_PORT_NUMBER = 9999 MIDI_OUT_ERROR_USER_DATA = 'midiOutError' MIDI_IN_...
StarcoderdataPython
1775161
#!/usr/bin/env python """ Compose a Textsheet structured by sections, subsections, paragraphs images, questions and answers. """ __all__ = ['patch', __doc__] def patch(target): """ These methods are appended to DBStages with type TEXTSHEET""" target.DEFAULT_ICON = 'mdi-newspaper-variant-outline' # targe...
StarcoderdataPython
1716132
<filename>app/__init__.py """ config.py: Application initialization __author__ = "<NAME>" __email__ = "<EMAIL>" """ from flask import Flask from flask.ext.babel import Babel from flask.json import JSONEncoder as BaseEncoder from speaklater import _LazyString import logging import logging.handlers from flask.ext.sqlal...
StarcoderdataPython
144408
# -*- coding: utf-8 -*- # Copyright (2017-2018) Hewlett Packard Enterprise Development LP # # 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 # # U...
StarcoderdataPython
1649016
<reponame>sondh0127/doclabel from django.conf import settings from django.urls import include, path, re_path from rest_framework.routers import DefaultRouter, SimpleRouter # Extend this router with your own routes # E.g.: router.registry.extend(your_router.registry) if settings.DEBUG: router = DefaultRouter() else...
StarcoderdataPython
3244815
#!/usr/bin/env python # -*- coding: utf-8 -*- __license__ = """ GoLismero 2.0 - The web knife - Copyright (C) 2011-2014 Golismero project site: http://golismero-project.com Golismero project mail: <EMAIL> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Publi...
StarcoderdataPython
3260402
#!/usr/bin/env python3 # whiteout.py # Author: <NAME> # Last Updated Jan 1, 2021 ''' A script to remove patterns in a file. Designed with PDFs in mind. It reads in a document as a byte string and then tries identifying the text in various encodings. ''' import os import re import argparse import pdftotext from ...
StarcoderdataPython
1709484
x = int(input()) while x != 0: for i in range(1, x + 1): print(f"{i}", end="") if i != x: print(" ", end="") print() x = int(input())
StarcoderdataPython
1751560
<filename>uavsar_rtc_mlc/Docker_Install/share/stripmapStack/prepRawALOS.py<gh_stars>1-10 #!/usr/bin/env python3 # <NAME> import os import glob import argparse from uncompressFile import uncompressfile import shutil def createParser(): ''' Create command line parser. ''' parser = argparse.ArgumentParse...
StarcoderdataPython
194279
from modules import problem def find_best_chromossome(population): best_chromossome = None for chromossome in population: score = problem.g(chromossome) if best_chromossome is None or score > problem.g(best_chromossome): best_chromossome = chromossome return best_chromossome ...
StarcoderdataPython
124028
<filename>vindauga/widgets/static_prompt.py # -*- coding: utf-8 -*- from vindauga.types.palette import Palette from .static_text import StaticText class StaticPrompt(StaticText): cpStaticPrompt = "\x09" def getPalette(self): return Palette(self.cpStaticPrompt)
StarcoderdataPython
3343966
<gh_stars>0 #!/usr/bin/env python import io from os.path import exists try: from setuptools import setup except ImportError: from distutils.core import setup __version__ = "2.0.0" setup( name='django-tenants', version=__version__, author='<NAME>', author_email='<EMAIL>', packages=[ ...
StarcoderdataPython
4805168
from unittest import TestCase import copy from suds.sudsobject import Object as SudsObject import mock from postnl.locations.client import Locations from postnl.locations.settings import POSTNL_SETTINGS mock_result = [{ 'partnername': u'Postnl', 'distance': u'409', 'name': u'Primera', 'retailnetworkid': u'Pn...
StarcoderdataPython
1672904
<filename>scoring/dictionary/MOCI93.py<gh_stars>0 f1 = 'total' f2 = 'control' f3 = 'washing' f4 = 'slowing_repeat' f5 = 'doubt' factors_names = (f1,f2,f3,f4,f5) factors = { 1:{ 1 :(f1,f3) , 2 :(f1,f2,) , 3 :(f1,f5) , 4 :(f1,f3,f4) , 6 :(f1,f2,) , 7:(f1,f5...
StarcoderdataPython
1769296
<filename>src/tasks/dydpp/experiment.py<gh_stars>100-1000 # (C) Copyright IBM Corp. 2019 # # 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 # ...
StarcoderdataPython
4438
"""\ Code generator functions for wxDatePickerCtrl objects @copyright: 2002-2007 <NAME> @copyright: 2014-2016 <NAME> @copyright: 2016-2021 <NAME> @license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY """ import common, compat import wcodegen class PythonDatePickerCtrlGenerator(wcodegen.PythonWidgetC...
StarcoderdataPython
1683462
<filename>Defs/ex109b/dinheiro/__init__.py ''' def aumentar(n=0, taxa=0): soma = n + (n*taxa)/100 return soma def diminuir(n=0, taxa=0): dim = n - (n*taxa)/100 return dim def real(n=0, simbolo='R$'): return f'\033[31m{simbolo}{n:0.2f}\033[m'.replace('.',',') ''' def aumento(n=0, taxa=0, formato=...
StarcoderdataPython
1768591
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "\n", "class NeuralNetwork(object):\n", " def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):\n", " # Set numb...
StarcoderdataPython
76069
import os from unittest import TestCase # most of the features of this script are already tested indirectly when # running vensim and xmile integration tests _root = os.path.dirname(__file__) class TestErrors(TestCase): def test_canonical_file_not_found(self): from pysd.tools.benchmarking import runner...
StarcoderdataPython
51665
# We often don't use all members of all the pyuv callbacks # pylint: disable=unused-argument import sys, hashlib import logging import os import pickle import signal import argparse import re import pyuv from ..__main__ import getObjectFileHash class HashCache: def __init__(self, loop, excludePatterns, disableWat...
StarcoderdataPython
130554
<reponame>baruchiro/botbuilder-python<filename>libraries/botbuilder-core/botbuilder/core/private_conversation_state.py from .bot_state import BotState from .turn_context import TurnContext from .storage import Storage class PrivateConversationState(BotState): def __init__(self, storage: Storage, namespace: str = ...
StarcoderdataPython
3365498
# Translate the following pseudocode for finding the minimum value from a set of # inputs into a Python program. # Set a Boolean variable "first" to true. # While another value has been read successfully # If first is true # Set the minimum to the value. # Set first to false. # ...
StarcoderdataPython
3330865
<reponame>liqinshan/pyhocon import argparse import logging import sys from pyhocon import ConfigFactory from pyhocon.config_tree import ConfigTree try: basestring except NameError: basestring = str LOG_FORMAT = '%(asctime)s %(levelname)s: %(message)s' class HOCONConverter(object): @staticmethod de...
StarcoderdataPython
1764466
<reponame>reven86/dava.engine import sys import glob, os import re import argparse import subprocess from contextlib import closing def GetDavaVersion( pathToFramework ): os.chdir(pathToFramework) file = open("Sources/Internal/DAVAVersion.h"); p = re.compile('DAVAENGINE_VERSION "([\w\.]+)"'); ...
StarcoderdataPython
1726917
# This file is part of pex_config. # # Developed for the LSST Data Management System. # This product includes software developed by the LSST Project # (http://www.lsst.org). # See the COPYRIGHT file at the top-level directory of this distribution # for details of code ownership. # # This software is dual licensed under...
StarcoderdataPython
158817
<filename>accounts/schema/mutations.py import graphene from .types import UserType from ..serializers import UserEditSerializer class UserEditMutation(graphene.Mutation): """ Edit User Information Mutation This class is used to edit information that a user has provided in the application ...
StarcoderdataPython
3329454
<reponame>TinaMenke/Deep-Reinforcement-Learning class MaxAndSkipEnv(gym.Wrapper): def __init__(self, env, skip=4): """ Return only every `skip`-th frame (frameskipping) :param env: (Gym Environment) the environment :param skip: (int) number of `skip`-th frame """ gym....
StarcoderdataPython
1611721
import time import shutil import argparse import yaml import traceback import torch from trainers import * device = 'cuda' if torch.cuda.is_available() else 'cpu' def parse_args(): """Parse command line arguments.""" parser = argparse.ArgumentParser() parser.add_argument('--config', nargs='?', default='r...
StarcoderdataPython
126800
import pytest import pandas as pd import pickle from hashlib import sha256 from tempfile import NamedTemporaryFile from ketl.loader.Loader import ( BaseLoader, DatabaseLoader, HashLoader, DelimitedFileLoader, ParquetLoader, LocalFileLoader, PickleLoader ) from ketl.db.settings import get_engine @pytest.fixt...
StarcoderdataPython
1689799
<reponame>bikeshedder/shark from os.path import basename, splitext from tempfile import TemporaryFile from django.core.files.storage import get_storage_class from django.db import models from django.db.models import signals from django.dispatch import receiver from django.utils import timezone from django.utils.transl...
StarcoderdataPython
1781178
<gh_stars>10-100 import uuid import pytest from citrine.informatics.workflows import PredictorEvaluationWorkflow from citrine.resources.predictor_evaluation_workflow import PredictorEvaluationWorkflowCollection from tests.utils.session import FakeSession, FakeCall @pytest.fixture def session() -> FakeSession: r...
StarcoderdataPython
1656155
<reponame>LiuXiang199x/DRL_Navigation import os import time import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import subprocess from collections import deque from test_env_exploration4 import GazeboEnv # Set the parameters for the implementation env_name = "HalfCheetahBulletEnv-v0" ...
StarcoderdataPython
1663928
<reponame>c-yan/atcoder<gh_stars>1-10 X, Y, A, B, C = map(int, input().split()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) s = p[:X] + q[:Y] + r s.sort(reverse=True) print(sum(s[:X+Y]))
StarcoderdataPython
3354190
from datetime import date, datetime from decimal import Decimal from unittest.mock import patch from responses import mock from sqlalchemy import Column, func from clickhouse_sqlalchemy import types, Table from clickhouse_sqlalchemy.drivers.http.base import ClickHouseDialect_http from tests.testcase import HttpSessio...
StarcoderdataPython
177817
#%% from sklearn.ensemble import RandomForestRegressor regressors = [ RandomForestRegressor(n_estimators=10, criterion="mae"), RandomForestRegressor(n_estimators=50, min_samples_leaf=2), RandomForestRegressor(), ] # Above we have a single classification machine learning method called Random Fo...
StarcoderdataPython
105909
<filename>app/api/composer/models.py from dataclasses import dataclass @dataclass class ComposingHistoryGraph: uid: str dataset_name: str task_name: str is_finished: bool nodes: list edges: list
StarcoderdataPython
1713411
<gh_stars>0 # Copyright 2022 Quantapix Authors. All Rights Reserved. # # 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 ...
StarcoderdataPython
123993
<reponame>Alviner/aiohttp-s3-client import pytest from aiohttp_s3_client import S3Client async def test_multipart_file_upload(s3_client: S3Client, s3_read, tmp_path): data = b"hello, world" * 1024 with (tmp_path / "hello.txt").open("wb") as f: f.write(data) f.flush() await s3_client...
StarcoderdataPython
131569
""" Code for the EKF Refactored """ import sympy from sympy import atan, pi, tan from sympy import symbols, Matrix from math import sqrt, tan, cos, sin, atan2 import matplotlib.pyplot as plt import numpy as np from numpy.random import randn from filterpy.kalman import ExtendedKalmanFilter as EKF from numpy import arra...
StarcoderdataPython
163894
# -*- coding: utf-8 -*- ''' Models of category ''' from __future__ import unicode_literals from django.db import models # Create your models here. class Category(models.Model): ''' Model category ''' category = models.CharField(max_length=50) description = models.CharField(max_length=100) ...
StarcoderdataPython
145784
<reponame>ygorelik/pydk # ---------------------------------------------------------------- # Copyright 2016 Cisco Systems # # 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.ap...
StarcoderdataPython
3231534
# Copyright © 2021 <NAME> # Apache 2.0 License """Tests for the `convert_numpy` module """ import pytest numpy = pytest.importorskip("numpy") from relational_datasets.convert import from_numpy def test_convert_numpy_classification(): """Test converting a classification problem.""" X = numpy.array([[0, 1, ...
StarcoderdataPython
3272125
# coding: utf-8 import os import re import sys import json import copy import random import tempfile import contextlib import subprocess from datetime import datetime from tqdm import tqdm from .cmd import parse_args from .bilibili_tool import submit_subtitle, get_bvdata, get_oid, oid_to_sub, get_duration from .sub_...
StarcoderdataPython
3338980
<reponame>Khanatoshs/MET_BAP from datetime import date import cartopy.crs as ccrs import matplotlib.pyplot as plt import pandas as pd from bokeh.plotting import show,output_file from bokeh.tile_providers import CARTODBPOSITRON, get_provider from bokeh.models import ColumnDataSource,Circle,DateRangeSlider,IndexFilter,C...
StarcoderdataPython
10499
<reponame>mikelkl/TF2-QA<gh_stars>10-100 import torch import argparse from roberta_modeling import RobertaJointForLong from transformers.modeling_roberta import RobertaConfig, RobertaModel from torch.utils.data import TensorDataset, SequentialSampler, DataLoader import utils from tqdm import tqdm import os import json ...
StarcoderdataPython
16185
# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.11 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path impo...
StarcoderdataPython
31127
"""DNS Authenticator for deSEC.""" import json import logging import time import requests import zope.interface from certbot import errors from certbot import interfaces from certbot.plugins import dns_common logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) @zope.interface.implementer(interfaces....
StarcoderdataPython
1631099
''' Print the supplementary part of Barron 800 wordlists with respect to Magoosh GRE flashcards and New GRE Upgrade ''' import json from util.common import load_wordlist magoosh_path = 'wordlists/magoosh-gre' upgrade_path = 'wordlists/gre-upgrade' old_words = set(load_wordlist(magoosh_path)) | set(load_wordlist(u...
StarcoderdataPython
106594
"""Rotary Encoder communication protocol""" import logging from typing import Optional, Tuple import attr # from ventserver.protocols import exceptions from ventserver.protocols import events from ventserver.protocols.protobuf import frontend_pb from ventserver.sansio import channels, protocols @attr.s class Recei...
StarcoderdataPython
3262081
<gh_stars>1-10 from google.cloud.bigquery import SchemaField from bq_schema.bigquery_table import BigqueryTable class SecondTable(BigqueryTable): name = "second_table" schema = [SchemaField("b_column", "FLOAT")]
StarcoderdataPython
123378
<gh_stars>0 import pygame import math import os import random import sys class Bird: def __init__(self, x, y): # Images setup self.color = ['blue', 'red', 'yellow'][random.randint(0, 2)] self.imgs = [pygame.image.load(os.path.join('..', 'assets', 'sprites', f'{self.color}bird-upflap.png'...
StarcoderdataPython
3219877
# Copyright (c) 2015 Rackspace Hosting # All Rights Reserved. # # 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 req...
StarcoderdataPython
191670
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
StarcoderdataPython
3312567
import matplotlib.pyplot as plt import seaborn as sns from sklearn.decomposition import PCA sns.set_context('poster') def view_emb(emb, dir): ''' Visualize a embedding matrix. Args: emb (torch.tensor): Embedding matrix with shape (N, D). D is the feature dimension. dir (str): Out...
StarcoderdataPython
3211450
<filename>Deep-Learning/ConvLSTM/Conv2LSTM/Conv2LSTM.py<gh_stars>10-100 # -------------------------------------------------------- # ScaleConvLSTM # Copyright (c) 2018 Fudan-VTS # Licensed under The MIT License [see LICENSE for details] # Written by liwenxi # -------------------------------------------------------- imp...
StarcoderdataPython
188557
import cv2 import numpy as np import os import sys import time #from uploadToGDrive import main_upload #import uploadToGDrive def readimage(filename): print filename image = cv2.imread(filename, cv2.IMREAD_GRAYSCALE) # reading image if image is None: print 'Can not find the image!' ...
StarcoderdataPython
5685
<gh_stars>10-100 from __future__ import absolute_import __author__ = 'kaizhuang' """ Package implementing features for simulating bioreactor operation. """ from .base import Organism, Bioreactor from .bioreactors import ANAEROBIC, AEROBIC, MICROAEROBIC from .bioreactors import Bioreactor_ox, IdealBatch, IdealFedbatch ...
StarcoderdataPython
60569
<filename>config/production.py DEBUG = False PORT = 8080 PROPAGATE_EXCEPTIONS = True SQLALCHEMY_ECHO = False SQLALCHEMY_DATABASE_URI = "" SQLALCHEMY_POOL_SIZE = 15
StarcoderdataPython
4806666
import logging import random import torch import torch.nn as nn from torch.autograd import Variable import util logging.basicConfig(level=logging.INFO) log = logging.getLogger() def random_training_set(chunks, revmap, volatile=False, start=0, batch_size=util.BATCH_SIZE): """Generate a training set from the ran...
StarcoderdataPython