id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6654332
<filename>Experiments/SoftMaxRegression/main.py import torch from torch.autograd import Variable import matplotlib.pyplot as plt import torchvision.datasets as dsets import torchvision.transforms as transforms from Experiments.SoftMaxRegression.SoftMaxRegression import SoftMaxRegression from Code.TrustRegion impor...
StarcoderdataPython
1610786
# -*- coding: utf-8 -*- import click import logging import os from click.types import BOOL import numpy as np import rasterio import random from pathlib import Path from dotenv import find_dotenv, load_dotenv from tqdm import tqdm import shutil def split_maya_train(interim_data_dir = '../../data/interim', processed_da...
StarcoderdataPython
4814648
import unittest from pypika import ( Schema, Table, Tables ) __author__ = "<NAME>" __email__ = "<EMAIL>" class TableEqualityTests(unittest.TestCase): def test_tables_equal_by_name(self): t1 = Table("t") t2 = Table("t") self.assertEqual(t1, t2) def test_tables_equal_by_s...
StarcoderdataPython
123245
from django.shortcuts import render from upload_file.views import upload_file from pages.external_functions import create_user_folders, clear_documents_on_redirect # Create your views here. def home_view(request, *args, **kwargs): # file_uploader = upload_file(request=request) # clear_documents_on_redirect(re...
StarcoderdataPython
3229497
<reponame>omron-sinicx/ctrm """helper functions for field of view (FOV) Author: <NAME> Affiliation: TokyoTech & OSX """ from __future__ import annotations import math import cost_to_go_wrapper import numpy as np from skimage.draw import disk def get_map_coord_2d(pos: np.ndarray, map_size: int) -> tuple[int, int]: ...
StarcoderdataPython
3324720
<gh_stars>0 from bson.objectid import ObjectId import tests import datetime import pymongo class _DictLike(object): def __init__(self): super(_DictLike, self).__init__() self._data = {} def asdict(self): return self._data def __getitem__(self, key): return self._data[key]...
StarcoderdataPython
384504
from django.contrib.gis.db import models from stringfield import StringField class Dataset(models.Model): name = StringField() md5 = StringField() created = models.DateTimeField(auto_now_add=True) def __unicode__(self): return '%s (%s)' % (self.name, self.md5) class DatasetModel(models.Model)...
StarcoderdataPython
9734205
<reponame>wocsor-com/openpilot from cereal import car from common.numpy_fast import mean from opendbc.can.can_define import CANDefine from selfdrive.car.interfaces import CarStateBase from opendbc.can.parser import CANParser from selfdrive.config import Conversions as CV from selfdrive.car.old_cars.values import CAR, D...
StarcoderdataPython
5093822
import cv2 import os from math import * from tools import _const as const # crop frame image is_rotated = True user_name = 'yangxuefeng' command = 'turn_right' sub_imgage_width = 400 sub_image_height = 870 sub_image_center_x = 485 sub_image_center_y = 1290 proc_path_prefix = os.path.join(const.PROJECT_HOME, 'data...
StarcoderdataPython
9635789
<gh_stars>0 import os from database.database_classes import connection_to_db, Picture from database.create_objects_of_classes import create_picture, add_object_to_database from imgurpython import ImgurClient def get_current_path(): return os.path.dirname(os.path.abspath(__file__)) def send_file_to_imgur(file): ...
StarcoderdataPython
293268
# Generated by Django 3.1.3 on 2020-11-22 04:17 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='crime_category', fields=[ ...
StarcoderdataPython
1694256
<reponame>MihirBhave/File_Organiser import os,sys import json import shutil import time from organiser import Setup from tqdm import tqdm from colorama import Style,Fore,Back def create_dir(name): try: os.mkdir(name) except FileExistsError: pass def create_file(name): t...
StarcoderdataPython
8110661
import unittest from soja_any_scale import Scale class AnyScaleTest(unittest.TestCase): def setUp(self): print('setUp') self.scale = Scale() def tearDown(self): print('tearDown') self.scale = None def test_10_16_16(self): self.assertEqual('10', self.scale.any_scal...
StarcoderdataPython
3215757
<filename>tests/src/pat_LO_Table/check_subject_dropdown.py import os import time from selenium.webdriver.support.select import Select from Data.parameters import Data from filenames import file_extention from get_dir import pwd from reuse_func import GetData class subject_levels(): def __init__(self ,driver): ...
StarcoderdataPython
4890446
from random import shuffle n1= input("Digite o nome do primeiro aluno: ") n2= input("Digite o nome do segundo aluno: ") n3= input("Digite o nome do terceiro aluno: ") n4= input("Digite o nome do quarto aluno: ") lista = [n1,n2,n3,n4] shuffle(lista) print("A ordem de apresentação será: ") print(lista)
StarcoderdataPython
380003
import numbers from six import string_types from pypif.obj.common.pio import Pio class Scalar(Pio): """ Representation of a single scalar value that could represent an absolute point, an uncertain point, a range of values, a minimum, or a maximum. """ def __init__(self, value=None, minimum=None, ...
StarcoderdataPython
3530418
<reponame>bdpcampos/public def menu(texto): print('-' * 40) print(f'{texto:^40}') print('-' * 40) def linha(): print('-' * 40) def txt_amarelo_bold(texto): return f'\033[1:33m{texto}\033[m' def txt_vermelho_bold(texto): return f'\033[1:31m{texto}\033[m' def txt_azul(texto): return ...
StarcoderdataPython
12820674
from demo_plugin.views.demo_view import DemoView VIEWS = [ DemoView(category='Plugins', name='Demo'), ]
StarcoderdataPython
8003718
import requests import sqlite3 from logger import Logger class Servant(): def __init__(self, db_file=r"D:\\OMG\\OMG.db"): self.db=db_file self.logger = Logger() self.keys = [] self.get_keys() def get_match(self, match_id): url = f"https://api.steampowered.com/IDOTA2Matc...
StarcoderdataPython
11396793
from __future__ import print_function, division, absolute_import, unicode_literals from ce_expansion._version import __version__
StarcoderdataPython
1935322
# -*- coding: utf-8 -*- """Pretictors for handwritten digits recognition.""" import os from sys import platform from typing import Tuple import numpy as np import torch import tritonclient.http as httpclient from tritonclient import utils from tritonclient.utils import InferenceServerException if "linux" in platform...
StarcoderdataPython
5028211
/home/runner/.cache/pip/pool/b6/34/b0/10d20d795f7544e67179ce734d23118368c478a7387a7c821c3ccdbc41
StarcoderdataPython
1921960
from . import TestCase from .models import TestUser class DjangoInteractionTests(TestCase): def test_update_or_create_works(self): """ update_or_create uses Django's atomic() """ user, created = TestUser.objects.update_or_create( username="test", defau...
StarcoderdataPython
4989612
<gh_stars>100-1000 # Copyright The PyTorch Lightning team. # # 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...
StarcoderdataPython
11304891
# Create your models here. from django.db import models from django.forms import ModelForm from django.utils import timezone import datetime, time ### prayer and response models class Prayer(models.Model): subject = models.CharField(max_length=200) prayer = models.TextField(max_length=4096) author = mod...
StarcoderdataPython
39669
<filename>Practice/buttons.py line = input().split() n = int(line[0]) m = int(line[1]) print(str(abs(n-m)))
StarcoderdataPython
117374
<reponame>cjolowicz/cutty """Common fixtures."""
StarcoderdataPython
1961228
<gh_stars>1-10 #!/usr/bin/env python3 from http.server import BaseHTTPRequestHandler, HTTPServer import cgi import sys, os scriptdir = os.path.dirname(__file__) sys.path.insert(0, scriptdir + "/..") import screen_data_reader hostName = "localhost" serverPort = 8080 class MyServer(BaseHTTPRequestHandler): def do_G...
StarcoderdataPython
8053074
""" Pytest也贴心的提供了类似setup、teardown的方法,并且还超过四个,一共有十种 模块级别:setup_module、teardown_module 函数级别:setup_function、teardown_function,不在类中的方法 类级别:setup_class、teardown_class 方法级别:setup_method、teardown_method 方法细化级别:setup、teardown """ import pytest def setup_module(): print("=====整个.py模块开始前只执行一次:打开浏览器=====") def teardown...
StarcoderdataPython
6503126
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from PyQt5.Qt import QWebEngineView, QApplication, QUrl, QWidget, QLineEdit, QVBoxLayout, QPushButton, QHBoxLayout class MainWindow(QWidget): def __init__(self): super().__init__() self.setWindowTitle('...') self.u...
StarcoderdataPython
4894810
from django.db import models class Supplier(models.Model): name = models.TextField(blank=True) phone = models.TextField(blank=True) def __str__(self): return self.name
StarcoderdataPython
169304
<reponame>sampierson/upload-service #!/usr/bin/env python3.6 import json from tests.unit import UploadTestCaseUsingMockAWS, EnvironmentSetup from tests.unit.lambdas.api_server import client_for_test_api_server from upload.common.upload_config import UploadVersion, UploadConfig class TestVersionEndpoint(UploadTestCa...
StarcoderdataPython
6526633
"""TestCases for checking that it does not segfault when a DBEnv object is closed before its DB objects. """ import os import sys import tempfile import glob import unittest try: # For Python 2.3 from bsddb import db except ImportError: # For earlier Pythons w/distutils pybsddb from bsddb3 import db ...
StarcoderdataPython
190121
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = '<NAME>' __credits__ = ["<NAME>"] __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __copyright__ = "Copyright 2021" __status__ = "Working on deploy Analyzer Design pattern" __version__ = "2021.06.14" LogPackageInstanceTemplate = "#!/usr/bin/env python\n\ # -*...
StarcoderdataPython
5060277
import torchvision.transforms as transforms import os import numpy as np import random import torch from PIL import Image readed_TRimages = [] readed_TEimages = [] labels = [] test_labels = [] TR_index = [] TE_index = [] index1 = 0 index = 0 cifar_transform_train = transforms.Compose([ transforms.RandomCrop(32...
StarcoderdataPython
3583904
# -*- coding: utf-8 -*- ########################################################################### ## Python code generated with wxFormBuilder (version 3.10.1) ## http://www.wxformbuilder.org/ ## ## PLEASE DO *NOT* EDIT THIS FILE! ########################################################################### import wx ...
StarcoderdataPython
6431492
<reponame>cipher-ops/backend-kts<gh_stars>1-10 # Generated by Django 3.0.5 on 2020-11-02 14:01 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('log', '0009_auto_20201030_1500'), ] operations = [ migrations.RenameField( model_name='lo...
StarcoderdataPython
8186619
<reponame>jamespeace/cs61a-1 test = { 'name': 'Question 1', 'points': 2, 'suites': [ { 'cases': [ { 'code': r""" >>> roll_dice(2, make_test_dice(4, 6, 1)) 10 """, 'hidden': False, 'locked': False }, { 'code': r...
StarcoderdataPython
4987925
<filename>framework/Optimizers/gradients/GradientApproximater.py<gh_stars>100-1000 # Copyright 2017 Battelle Energy Alliance, 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://ww...
StarcoderdataPython
3433596
# (roughly) parses a callgrind file and returns the cost for a given function def get_inclusive_cost(file_name, function_name): alias = '' collecting = False data = [] with open(file_name) as f: for line in f: line = line.replace('\n', '') # basic settings if...
StarcoderdataPython
3372658
def solution(A): head = A[0] tail = sum(A[1:]) min_dif = abs(head - tail) for index in range(1, len(A)-1): head += A[index] tail -= A[index] if abs(head-tail) < min_dif: min_dif = abs(head-tail) return min_dif assert solution([3,1,2, 4 ,3])==1 assert solution([3...
StarcoderdataPython
3250499
<gh_stars>1-10 from django import forms from main.models import Post class PostCreationForm(forms.ModelForm): text = forms.CharField(widget=forms.Textarea) class Meta: model = Post fields = ['title', 'text']
StarcoderdataPython
6487209
<gh_stars>0 # _*_ encoding:utf-8 _*_ from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator __author__ = 'YZF' __date__ = '2018/3/28,12:32' class LoginRequiredMixin(object): @method_decorator(login_required(login_url='/login/')) def dispatch(self, reque...
StarcoderdataPython
386714
<reponame>khalid151/AnsiFmt<gh_stars>1-10 """ ansifmt ANSI escape sequence formatting for printed strings. """ from .fmt import * __version__ = "0.1.0" __author__ = "<NAME>"
StarcoderdataPython
8122057
<reponame>arcziwal/e-school-register<filename>register_app/migrations/0005_remove_student_father_first_name_and_more.py # Generated by Django 4.0.3 on 2022-03-20 21:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('register_app', '0004_alter_student_fa...
StarcoderdataPython
1984315
<gh_stars>0 from sklearn.datasets import load_digits import numpy as np from sklearn.svm import SVC import matplotlib.pyplot as plt #loading digit images digit=load_digits() #only feature data training_data=digit.data #only target data training_target=digit.target #training data extract from original data td_original=n...
StarcoderdataPython
3531945
from rubygems_utils import RubyGemsTestUtils class RubyGemsTestrubygems_aws_sdk_securityhub(RubyGemsTestUtils): def test_gem_list_rubygems_aws_sdk_securityhub(self): self.gem_is_installed("aws-sdk-securityhub") def test_load_aws_sdk_securityhub(self): self.gem_is_loadable("aws-sdk-securityhub...
StarcoderdataPython
8172574
from unittest.mock import patch from django.test import TestCase from django.contrib.auth import get_user_model from core.models import recipe_image_file_path from core.factories import IngredientFactory, TagFactory, RecipeFactory, UserFactory class ModelTests(TestCase): def setUp(self) -> None: TagFact...
StarcoderdataPython
6523639
<reponame>BuildJet/ebl-api import falcon def test_get_statistics(guest_client): result = guest_client.simulate_get("/statistics") assert result.json == {"transliteratedFragments": 0, "lines": 0} assert result.status == falcon.HTTP_OK assert result.headers["Access-Control-Allow-Origin"] == "*" ass...
StarcoderdataPython
173634
<gh_stars>0 input1="""14 Circle,4 Circle,5 Circle,6 Bamboo,1 Bamboo,2 Bamboo,3 Character,2 Character,2 Character,2 Circle,1 Circle,1 Bamboo,7 Bamboo,8 Bamboo,9""" input2="""14 Circle,4 Bamboo,1 Circle,5 Bamboo,2 Character,2 Bamboo,3 Character,2 Circle,6 Character,2 Circle,1 Bamboo,8 Circle,1 Bamboo,7 Bamboo,9""" inpu...
StarcoderdataPython
38670
<filename>models/edhoc/draftedhoc-20200301/oracle.py<gh_stars>0 #!/usr/bin/python3 import sys, re from functools import reduce DEBUG = False #DEBUG = True # Put prios between 0 and 100. Above 100 is for default strategy MAXNPRIO = 200 # max number of prios, 0 is lowest prio FALLBACKPRIO = MAXNPRIO # max number ...
StarcoderdataPython
9606371
import json from textwrap import dedent class TestAddStoragePartition: def test_no_device(self, host): result = host.run('stack add storage partition size=1024') assert result.rc == 255 assert result.stderr == dedent('''\ error - "device" parameter is required {device=string} {size=integer} [mountpoint=s...
StarcoderdataPython
1645892
<filename>tombola.py """ >>> t = Tombola() >>> t.carregada() False >>> bolas = 'ABC' >>> t.carregar(bolas) >>> t.carregada() True >>> t.misturar() >>> t.sortear() in bolas True >>> t.sortear() in bolas True >>> t.sortear() in bolas True >>> t.carregada() ...
StarcoderdataPython
6556518
<filename>__init__.py<gh_stars>0 from flask_restful import Api from .Task import Task from .TaskById import TaskById from app import app restData = Api(app) restData.add_resource(Task,"/App-api/task") restData.add_resource(TaskById,"/api/task/id/<string:taskId>/")
StarcoderdataPython
733
"""Sensor for data from Austrian Zentralanstalt für Meteorologie.""" from __future__ import annotations import logging import voluptuous as vol from homeassistant.components.weather import ( ATTR_WEATHER_HUMIDITY, ATTR_WEATHER_PRESSURE, ATTR_WEATHER_TEMPERATURE, ATTR_WEATHER_WIND_BEARING, ATTR_WE...
StarcoderdataPython
1620836
<reponame>DevotedHealth/dbt-snowflake<filename>dbt/adapters/snowflake/__version__.py<gh_stars>0 version = "1.0.0dvtd"
StarcoderdataPython
3240268
<reponame>AlessandroRestagno/First-sketch-last-project-SDC<filename>ros/src/twist_controller/twist_controller.py import math import rospy from yaw_controller import YawController from pid import PID from lowpass import LowPassFilter GAS_DENSITY = 2.858 ONE_MPH = 0.44704 class Controller(object): def __init__(sel...
StarcoderdataPython
3313353
<reponame>mrtnbrst/pythontalk_gatebot from datetime import timedelta class BaseConfig: # # Required params # # Bot token generated by the Bot Father. BOT_TOKEN = None # ID of the group, bot will be gate-keeping, as `int`. GROUP_ID = None # Database URL for SQLAlchemy SQLALCHEMY_...
StarcoderdataPython
1617260
<filename>cftool/misc.py<gh_stars>1-10 import io import os import sys import dill import json import math import time import errno import random import shutil import decimal import inspect import logging import hashlib import zipfile import datetime import operator import threading import unicodedata import numpy as n...
StarcoderdataPython
9717555
import logging import multiprocessing from multiprocessing import Lock, Pool multiprocessing.set_start_method("spawn", True) # ! must be at top for VScode debugging import argparse import glob import json import math import multiprocessing as mp import os import pathlib import pickle import re import sys import warni...
StarcoderdataPython
3254204
<gh_stars>1-10 from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns from .provider import BitlyProvider urlpatterns = default_urlpatterns(BitlyProvider)
StarcoderdataPython
6672863
<gh_stars>10-100 from collections import namedtuple import pytest import ikabot.config import ikabot.function.distributeResources from ikabot.config import materials_names_tec from ikabot.function.distributeResources import distribute_evenly def test_distribute_evenly(monkeypatch, session, cities): monkeypatch.s...
StarcoderdataPython
8046935
<gh_stars>0 import numpy as np from GPy.util import choleskies import GPy from ..util.config import config import unittest try: from ..util import linalg_cython from ...configs_that_do_not_run.GPy_0_8_8.util import choleskies_cython config.set('cython', 'working', 'True') except ImportError: config.se...
StarcoderdataPython
4974071
<filename>test/test_type_constructor.py import itertools import tvm from tvm import relay from type_constructor import TypeConstructor, params_met from type_constructor import TypeConstructs as TC from shared_test_generators import TestTypeGenerator ALL_ATTEMPTS = 100 CATEGORY_ATTEMPTS = 50 def create_constructor(...
StarcoderdataPython
9640926
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 15 14:01:24 2021 @author: liang """ ''' AWS personalize model ''' import boto3 import json import os class PersonalizePredictHandler(): """ """ def __init__(self, config_path): if os.path.exists(config_path): self....
StarcoderdataPython
12811915
import os import numpy as np from yass.templates.util import get_templates, main_channels # from yass.templates.util import align as _align from yass.geometry import order_channels_by_distance # TODO: remove config class TemplatesProcessor: """Provides functions for manipulating templates """ def __ini...
StarcoderdataPython
6481515
<reponame>Balaji-P/ansible-networking #!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals from scripttest import TestFileEnvironment import subprocess env = TestFileEnvironment('./_test') debug = False # DEFINE ANSIBLE VERSION ANSIBLE_2_3 = "/home/kbyers/VENV/py27_venv...
StarcoderdataPython
5133425
<reponame>jkgoodrich/hail<filename>ci/ci/globals.py from .environment import DEFAULT_NAMESPACE is_test_deployment = DEFAULT_NAMESPACE != 'default'
StarcoderdataPython
181630
""" Theory > Instance vs Class > Attributes, methods, inheritance, polymorphism """ class Scout(): pass ratarca = Scout()
StarcoderdataPython
172364
import unittest from os.path import join from FadeMaxSize.findMax import find_max_file class MaxTest(unittest.TestCase): def test_v1(self): self.assertEqual(find_max_file(join('tests', 'test_folder')), { 'file': join('tests', 'test_folder', 'Firefox_Installer.test'), 'size': ...
StarcoderdataPython
4908412
# -*- coding: utf-8 -*- # Define here the models for your scraped items
StarcoderdataPython
210758
class Solution: def XXX(self, intervals: List[List[int]]) -> List[List[int]]: intervals.sort() tmp_start = intervals[0][0] tmp_end = intervals[0][1] ans = [intervals[0]] for i in range(1,len(intervals)): if intervals[i][0]>=tmp_start and intervals[i][1]<=tmp_end:...
StarcoderdataPython
4905370
import json import model import test_data from utils import Error import base64 def test_add_new_item(client, nonexistent_item, db): ''' Tests adding a new item. ''' new_item = nonexistent_item name = str(new_item.name) upc = str(new_item.upc) store = new_item.stores[0] store_name = s...
StarcoderdataPython
138143
from __future__ import absolute_import, division, print_function, unicode_literals import os import unittest from mock import patch from nose.tools import assert_equals, assert_raises assert_equals.__self__.maxDiff = None import pygenie def mock_to_attachment(att): if isinstance(att, dict): return {...
StarcoderdataPython
11212932
<filename>tests/app/authentication/test_jwt.py import base64 import os import unittest from app import settings from app.authentication.invalid_token_exception import InvalidTokenException from app.authentication.jwt_decoder import JWTDecryptor from tests.app.authentication import TEST_DO_NOT_USE_SR_PRIVATE_PEM # pub...
StarcoderdataPython
6584487
<filename>run_experiments.py from time import time import shutil import json import os from sklearn.model_selection import KFold from numpy.random import seed import pandas as pd from parameters import * from utils import * validate_pesq() seed(RANDOM_SEED) for folder in EXPERIMENT_FOLDER_CLEANED_EXP, EXPERIMENT_F...
StarcoderdataPython
8126026
# -*- coding: utf-8 -*- def derivative(g, dx=1e-8): return lambda x: (g(x + dx) - g(x)) / dx def cube(x): return x ** 3 def parabola(a, b, c): return lambda x: a * x ** 2 + b * x + c print('((derivative cube) 5) = {0}'.format(derivative(cube)(5))) squarex = parabola(1, 0, 0) print('((derivative sq...
StarcoderdataPython
11394474
import operator from functools import reduce from django.utils import six from rest_framework.filters import SearchFilter from mongoengine.queryset.visitor import Q class MongoEngineSearchFilter(SearchFilter): def filter_queryset(self, request, queryset, view): search_fields = getattr(view, 'search_fiel...
StarcoderdataPython
254075
import cv2 import numpy as np img = cv2.imread('C:\\Users\\mmjaz\\Desktop\\OneDrive_3_7-3-2017\\Button\\images_190.jpeg') img = cv2.imread('C:\\Users\\mmjaz\\Desktop\\OneDrive_3_7-3-2017\\OneDrive_4_7-3-2017\\pop up.jpg') gray= cv2.imread('C:\\Users\\mmjaz\\Desktop\\OneDrive_3_7-3-2017\\OneDrive_4_7-3-2017\\p...
StarcoderdataPython
1902734
import json import platform import os def saveTimeLine(pressTime, charTime, person,location): filename = location + person + "A.txt"#GREEN computer filename2 = location + person + "B.txt"#GREEN computer outfile = open(filename, 'w') outfile2 = open(filename2, 'w') Dict1 = {} i = 0 for num in pressTime: Di...
StarcoderdataPython
11260987
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- # # tesseract_positional/positional_ocr.py # v.0.1.1 # Developed in 2019 by <NAME> <<EMAIL>> # # Contains function for generating a positional text file from an image # # Stdlib includes import re # 3rd party imports import pytesseract try: from PIL import...
StarcoderdataPython
9625311
<gh_stars>0 # -*- coding: utf-8 -*- """ @author: <NAME> """ """IMPORT PACKAGES""" import argparse import gym import numpy as np '''Model selection ''' from stable_baselines import logger from stable_baselines.ppo2 import PPO2 from stable_baselines.common.policies import CnnPolicy, MlpPolicy '''Vectorized Env'...
StarcoderdataPython
8178161
<filename>neuroscout/tests/api/test_predictor.py from ..request_utils import decode_json from ...resources.predictor import prepare_upload from ...tasks.upload import upload_collection from ...core import app from werkzeug.datastructures import FileStorage def test_get_predictor(auth_client, extract_features): # ...
StarcoderdataPython
1647123
<reponame>E-RROR/django-file-upload-handler """ # @2019 # # Write Test For Djfiler # # <NAME> # """ import unittest import json import os from djfiler import djfiler from djfiler.core import namegen, founder tests_dir = os.getcwd()+'/djfiler/tests' # Test Name Generation def test_namegen(): """ Test Nam...
StarcoderdataPython
3333161
<reponame>Dee-Why/lite-bo # License: MIT import numpy as np import time from openbox.apps.multi_fidelity.mq_base_facade import mqBaseFacade from openbox.apps.multi_fidelity.utils import sample_configurations from openbox.utils.config_space import ConfigurationSpace class mqRandomSearch(mqBaseFacade): def __init...
StarcoderdataPython
3424049
<filename>pymarshaler/marshal.py import datetime import inspect import typing from enum import Enum import orjson from pymarshaler.arg_delegates import enum_delegate, \ user_defined_delegate, datetime_delegate, builtin_delegate, list_delegate, tuple_delegate, dict_delegate from pymarshaler.errors import MissingFi...
StarcoderdataPython
11289326
# ================================================================= # # Author: <NAME> <<EMAIL>> # # Copyright (c) 2021 <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 # rest...
StarcoderdataPython
213276
import torch import torch.optim as optim from torch.utils.tensorboard import SummaryWriter import numpy as np import os import argparse import time from im2mesh import config, data from im2mesh.checkpoints import CheckpointIO import logging if __name__ == '__main__': logger_py = logging.getLogger(__name__) #...
StarcoderdataPython
374936
<reponame>h-mayorquin/capacity_code import numpy as np import IPython class PatternsRepresentation: def __init__(self, activity_representation, minicolumns): self.activity_representation = activity_representation self.minicolumns = minicolumns self.n_patterns, self.hypercolumns = activity_...
StarcoderdataPython
8009688
<reponame>quantmind/lux from ..oauth import OAuth2 class Facebook(OAuth2): namespace = 'fb' auth_uri = 'https://www.facebook.com/dialog/oauth' token_uri = 'https://graph.facebook.com/oauth/access_token' default_scope = ['public_profile', 'email'] fa = 'facebook-square' def ogp_add_tags(self, ...
StarcoderdataPython
12844389
<filename>module.py from math import * print(ceil(4.2)) print(sum([0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1])) print(fsum([0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1]))
StarcoderdataPython
1701814
<filename>python/lib/packet/ext/path_probe.py<gh_stars>1-10 # Copyright 2016 ETH Zurich # # 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 # # Un...
StarcoderdataPython
1653343
# Generated by Django 2.2.4 on 2019-09-18 12:49 from django.db import migrations from django.contrib.auth.models import User def forwards(apps, schema_editor): for user in User.objects.filter(username__contains='-'): new_username = user.username.replace('-', '.') print('\nrenaming', user.username...
StarcoderdataPython
3375062
<gh_stars>0 import pytest from shibboleth_discovery.template_tags.shibboleth_discovery import shib_ds_context from shibboleth_discovery.utils import b64encode_idp from django.conf import settings from django.template import RequestContext from django.urls import reverse from tests.conftest import RECENT_IDP_SCENARIO...
StarcoderdataPython
1739332
<filename>src/rics/mapping/exceptions.py """Mapping errors.""" class MappingError(ValueError): """Something failed to map."""
StarcoderdataPython
1698028
<gh_stars>0 from django.contrib.auth.forms import UserCreationForm from django.urls import reverse_lazy from django.views.generic import CreateView, ListView, UpdateView, DeleteView from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.models import User from django.contrib.admin.views.deco...
StarcoderdataPython
275693
import numpy as np import pytest from sklearn.utils.testing import assert_array_equal from scipy import sparse from anndata.tests.helpers import gen_adata, subset_func, asarray @pytest.fixture( params=[np.array, sparse.csr_matrix, sparse.csc_matrix], ids=["np_array", "scipy_csr", "scipy_csc"], ) def matrix_t...
StarcoderdataPython
3512744
#!/usr/bin/python fo=file("beautifulsoup4-4.2.1.tar.gz", 'r') magic_code = fo.read(2) if(magic_code == '\037\213'): print 'this is a gzip file' else: print 'this is not a gzip file'
StarcoderdataPython
6683147
import functools from typing import List from binary_tree_node import BinaryTreeNode from test_framework import generic_test from test_framework.test_failure import TestFailure from test_framework.test_utils import enable_executor_hook def create_list_of_leaves(tree: BinaryTreeNode) -> List[BinaryTreeNode]: # TO...
StarcoderdataPython
3510468
import pytest @pytest.fixture(scope="module", autouse=True) def skip_test_module_over_backend_topologies(request, tbinfo): """Skip testcases in the test module if the topo is storage backend.""" if "backend" in tbinfo["topo"]["name"]: module_filename = request.module.__name__.split(".")[-1] py...
StarcoderdataPython