id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3267643 | c = 0
def fun(l,r,i):
if(l[i]==-1):
l[i] = r[i]
return
fun(l,r,l[i])
fun(l,r,r[i])
if(l[l[i]]==-1 or r[r[i]]==-1):
l[i],r[i] = -1,-1
return
if(l[l[i]]>r[r[i]]):
global c
c+=1
l[i],r[i] = l[r[i]],r[l[i]]
elif(r[l[i]]<l[r[i]]):
l[i],r... | StarcoderdataPython |
4816543 | # Generated by Django 2.2.14 on 2020-07-01 22:19
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import dojo.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('dojo... | StarcoderdataPython |
1620277 |
from __future__ import absolute_import
__all__ = ["test_primordial"]
from ....._globals import _RECOGNIZED_ELEMENTS_
from .....testing import unittest
from ..primordial import primordial
import numbers
@unittest
def test_primordial():
"""
Primordial_z built-in dataframe unit test
"""
def test():
"""
Test the... | StarcoderdataPython |
119484 | from flask import request, escape, render_template, redirect, flash, url_for, jsonify, current_app, g
from app.contact import bp
from flask_login import current_user, login_required
from app.contact.forms import ContactForm
from app.contact.email import send_contact_email
from app.auth.forms import LoginForm, Register... | StarcoderdataPython |
1643920 | <reponame>aakriti0fnu/cheapBuy
from bs4 import BeautifulSoup
def get_url_walmart(search_term):
"""
:param search_term:
:return:
"""
template = "https://www.walmart.com/search?q={}"
search_term = search_term.replace(" ", "+")
url = template.format(search_term)
print(f"Constructed Walma... | StarcoderdataPython |
5040 | <reponame>JohnStarich/dotfiles
import time
class Interval(object):
def __init__(self, delay_time: int):
self.delay_time = delay_time
self.current_time = 0
@staticmethod
def now():
return time.gmtime().tm_sec
def should_run(self) -> bool:
if self.current_time == 0:
... | StarcoderdataPython |
1709264 | <filename>api/esprr_api/tests/test_compute.py
import pandas as pd
import numpy as np
import pytest
from esprr_api import compute, models, settings
from esprr_api.data import nsrdb
@pytest.mark.parametrize(
"args,kwargs",
(
((), {}),
((0,), {}),
((9,), {"a": "b"}),
((), {"pres... | StarcoderdataPython |
1775251 | """Test for nx_itertools.recipes.random_permutation"""
from itertools import islice
from unittest import mock
import pytest
from nx_itertools.recipes import random_permutation
def test_normal():
"""Test random_permutation."""
with mock.patch('random.sample', lambda x, r: list(islice(x, r))):
# permuta... | StarcoderdataPython |
1619162 | <gh_stars>1-10
from django.db import models
# Create your models here.
class LostItem(models.Model):
ITEMSTATUS = [
(0, 'Not verified'),
(1, 'Verified'),
(2, 'Reached owner'),
]
DEFAULT = 'default.png'
title = models.CharField(max_length=50)
description = models.CharFiel... | StarcoderdataPython |
3281456 | from typing import Dict
from pydantic import BaseModel
class AlbRequestContextData(BaseModel):
targetGroupArn: str
class AlbRequestContext(BaseModel):
elb: AlbRequestContextData
class AlbModel(BaseModel):
httpMethod: str
path: str
body: str
isBase64Encoded: bool
headers: Dict[str, str... | StarcoderdataPython |
196106 | <gh_stars>0
from .fields import YADTImageField
| StarcoderdataPython |
3294332 | import sys
from bs4 import BeautifulSoup
def getHTML(filename):
html = open(filename, 'r')
return BeautifulSoup(html.read(), 'html.parser')
def getMusicNames(html):
musics_div = html.select('.tracklist-name')
return [music.string for music in musics_div]
def getMusicDuration(html):
musics_time ... | StarcoderdataPython |
3391448 | # Generated by Django 2.2.4 on 2019-09-10 06:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0012_auto_20190823_1536'),
]
operations = [
migrations.AddField(
model_name='userprofil... | StarcoderdataPython |
4823388 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_is_vcs_installed
---------------------
"""
from cookiecutter import vcs
def test_existing_repo_type():
assert vcs.is_vcs_installed("git")
def test_non_existing_repo_type():
assert not vcs.is_vcs_installed("stringthatisntashellcommand")
| StarcoderdataPython |
3280547 | <reponame>sistm/CytOpt<filename>CytOpT/minmaxSwapping.py
# Copyright (C) 2022, <NAME>, <NAME> <<EMAIL>>=
#
# License: MIT (see COPYING file)
from time import time
import numpy as np
import pandas as pd
from scipy.special import logsumexp
from sklearn.preprocessing import MinMaxScaler
from CytOpT.labelPropSto import c... | StarcoderdataPython |
3380952 | from pathlib import Path
import sys
import time
import requests
import csv
class ReadSensorsData:
def __init__(self, heartbeatfilename):
self.path = str(Path("../").resolve()) + "\\SensorsData\\"
self.heartb_end_point = "http://127.0.0.1:5000/activity/heartrate?"
self.user = "admin"
... | StarcoderdataPython |
3212807 | # pip install fpdf
from fpdf import FPDF
from Update_Body import *
from generategraphs import *
import os
def export(name="<NAME>", medications=[]):
pdf = FPDF(orientation="P", unit="mm", format="letter")
pdf.add_page()
pdf.set_font("Arial", "B", size=20)
pdf.cell(w=0, h=5, txt="Report for %s" % name... | StarcoderdataPython |
3352155 | from django.db import models
'''
Merge model.
'''
class Merge(models.Model):
created = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=100, blank=True, default='')
result = models.TextField(blank=True)
owner = models.ForeignKey('auth.User', related_name='merges', on_delete=models.C... | StarcoderdataPython |
1662809 | <reponame>RajeshKumar1490/iB_hubs_mini_project
from typing import List
from django.db.models import Prefetch
from essentials_kit_management.models \
import OrderItem, Form, Item, Section, Brand, User
from essentials_kit_management.interactors.storages.\
order_item_storage_interface import OrderItemStorageInterf... | StarcoderdataPython |
1673276 | <filename>test/exploratory/etypes/estring/test_analysis.py
import unittest
class TestStringAnalysis(unittest.TestCase):
def setUp(self):
self.test_data = "I am a fun test data . also something !@$#%$#$^!"
def test_find_method(self):
self.assertEqual(21, self.test_data.find("."))
self.assertEqual(-1, s... | StarcoderdataPython |
4802977 | ############################################################################################
#
# Project: <NAME> Acute Myeloid & Lymphoblastic Leukemia AI Research Project
# Repository: ALL Detection System 2019
# Project: Chatbot
#
# Author: <NAME> (<EMAIL>)
# Contributors:
# Title: Conte... | StarcoderdataPython |
1783899 | <reponame>dmonroy/schema-migrations<filename>schema_migrations/__init__.py
import os
import psycopg2
import yaml
from psycopg2._psycopg import ProgrammingError
try:
from urllib.parse import urlsplit
except ImportError: # pragma: no cover
from urlparse import urlsplit
DEFAULT_GROUP = {'default': './migration... | StarcoderdataPython |
4840876 | from functions.scrape import scrape_terraswap_dashboard
for pair in scrape_terraswap_dashboard():
print ("{}".format(pair)) | StarcoderdataPython |
1661929 | <filename>fido2_u2f/hid.py
from micropython import const
from time import sleep, monotonic
import usb_hid
from os import urandom
from up_check import up_check
SUCCESS = 0
ERR_INVALID_CMD = const(0x01) # The command in the request is invalid
ERR_INVALID_PAR = const(0x02) # The parameter(s) in the request is i... | StarcoderdataPython |
18230 | import sys, os
import nltk
import numpy as np
class Patch():
def __init__(self):
self.id = -1
self.parent_code = ''
self.child_code = ''
self.patches = []
self.verdict = False
self.distance = 0
self.verdict_token = False
pass
def __repr__(self):
... | StarcoderdataPython |
123213 | <gh_stars>0
import discord
from discord.ext import commands
import os
import sys
from dotenv import load_dotenv
import asyncio
import json
import random
import datetime
from locallib import directorysearch
import re
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
# scoredict = {}... | StarcoderdataPython |
1754072 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 16:44:08 2015
@author: victor
"""
#module de fonctions concercenants l'utilisation de droites et des coordonées cartésiennes
import matplotlib.pyplot as plt
import numpy as np
from global_variables import rp
def traceDroite(p1,p2,couleur="noir"):
x1,x2,y1,y2=p1[... | StarcoderdataPython |
74717 | <gh_stars>0
#!/usr/bin/env python
import pydot
import sys
from typing import Dict, List
def usage():
usage_text = """Usage: {0} "$(cat graph1)" "$(cat graph2)"
This tool takes two graphs and finds all the nodes in the second graph that
don't exist in the first graph. All these nodes are then colored in grey and
... | StarcoderdataPython |
1756039 | <gh_stars>1-10
from inspect import signature, Signature
# Note: A better version of this lives now on lined, an otosense repo and pip installable package
class Compose:
def __init__(self, *funcs):
"""Performs function composition.
That is, get a callable that is equivalent to a chain of callables.
... | StarcoderdataPython |
1607417 | <gh_stars>0
import numpy as np
def set_ones(width, ones_start=0, ones_stop=0):
"""
set_ones creates row vectors of the form
v=[0,...,0,1,..........,1,0,...,0]
ones_start ones_stop
If ones_start is larger than or equal to width, return vector of
zeros.
>>> set_ones(6, 7, 10... | StarcoderdataPython |
3352548 | from ocp_resources.resource import NamespacedResource
class NetworkPolicy(NamespacedResource):
"""
NetworkPolicy object.
"""
api_group = NamespacedResource.ApiGroup.NETWORKING_K8S_IO
| StarcoderdataPython |
171920 | <filename>tests/test17.py
function mapToIDs($array, $id_field_name = 'id')
{
$result = [];
array_walk($array,
function(&$value, $key) use (&$result, $id_field_name)
{
$result[$value[$id_field_name]] = $value;
}
);
return $result;
}
$arr = [0 => ['id' => 'one', 'frui... | StarcoderdataPython |
3378120 | import os
from wash_lang_prototype.core.options import WashOptions
from wash_lang_prototype.wash import Wash
try:
import click
except ImportError:
raise Exception('Missing CLI dependencies. To use WASH from CLI, please run following command:/n'
'pip install wash-lang-prototype[cli]')
def... | StarcoderdataPython |
3376012 | # coding: utf-8
"""
IBM Application Gateway Configuration Specification (OpenAPI)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 21.12
Generated by: https://openapi-generator.tech
"""
impo... | StarcoderdataPython |
3305904 | <reponame>huachao2017/goodsdl
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-06-25 14:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goods2', '0023_auto_20180625_1429'),
]
operations = [... | StarcoderdataPython |
3372326 | <gh_stars>1-10
"""
Tests for Homebrew and Linuxbrew.
"""
import logging
import shutil
import subprocess
from pathlib import Path
import docker
from docker.types import Mount
from admin.homebrew import get_homebrew_formula
LOGGER = logging.getLogger(__name__)
def _create_archive(directory: Path) -> Path:
# Hom... | StarcoderdataPython |
4838602 | <reponame>keydepth/facedetect<gh_stars>0
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
import requests
import json
import cv2
import create_csv
# import create_graph
# XLSX_MIMETYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
# image = cv2.imread('./test_data/0.jpg')
# image = cv2.resiz... | StarcoderdataPython |
1619195 | <gh_stars>0
class res_conv(nn.Module):
def __init__(self, input_channels, output_channels, down=True):
super(res_conv, self).__init__()
self.conv1 = nn.Sequential(nn.Conv2d(input_channels, output_channels, kernel_size=3, padding=1),
nn.BatchNorm2d(output_channels),... | StarcoderdataPython |
1743568 | <filename>main.py
# -*- coding: utf-8 -*-
from config import mode
import scraper
if __name__ == '__main__':
if mode == "NewBills":
scraper.main() | StarcoderdataPython |
3356814 | # Copyright 2016 The TensorFlow 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 applicable ... | StarcoderdataPython |
3215274 | from typing import List, Literal, Optional, Sequence, Union
from pydantic import Field
from weaverbird.pipeline.steps.utils.base import BaseStep
from weaverbird.pipeline.steps.utils.render_variables import StepWithVariablesMixin
from weaverbird.pipeline.types import ColumnName, TemplatedVariable
from .aggregate impo... | StarcoderdataPython |
1799653 | <reponame>Sukriva/open-city-profile<gh_stars>1-10
# Generated by Django 2.2.13 on 2021-02-03 07:03
import encrypted_fields.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("profiles", "0033_auto_20201113_1515"),
]
operations = [
migrations... | StarcoderdataPython |
3322282 | import os
from django.http import HttpResponse
from rfsite.settings import BASE_DIR
def dev_static_files(request):
# for dev local server only
build_path = os.path.dirname(BASE_DIR) + "/frontend/build/"
_path = request.path
if _path.startswith("/static_files/"):
_path = _path[14:]
_file... | StarcoderdataPython |
1723440 | <reponame>DoctorChocolat/Python-Exercises<filename>01-Arquimedes.py
#Eureka! - Archimedes and King Hiero's Crown - www.101computing.net/eureka-and-king-hieros-crown/
mass = float(input("Intro the mass of the crown in kg: "))
volume = float(input("Intro the volume of the crown in cubic meter, m3: "))
#Code here to cal... | StarcoderdataPython |
4843203 | <gh_stars>0
"""Utilities to support iteration."""
# Copyright 2019 CSIRO (Data61)
#
# 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... | StarcoderdataPython |
1719448 | <reponame>Energy-Transistion/etg
"""
A module for testing to make sure that the Handler collects the correct information.
"""
from twisted.trial import unittest
from etg.server.handler import Handler, Attribute
from etg.util.proxylock import ProxyLock
class Foo:
"""
A class to test the Handler correctly updati... | StarcoderdataPython |
3356093 | from SuperGLU.Util.Serialization import (SuperGlu_Serializable, untokenizeObject, tokenizeObject)
from SuperGLU.Core.BlackWhiteListEntry import BlackWhiteListEntry
class ServiceConfiguration(SuperGlu_Serializable):
TYPE_KEY = "type";
PARAMS_KEY = "params";
NODES_KEY = "nodes";
WHITE_LIST_KEY ="whiteLi... | StarcoderdataPython |
1673777 | <filename>orange3/Orange/widgets/utils/classdensity.py
import ctypes
import numpy as np
from AnyQt.QtCore import QRectF
from pyqtgraph.graphicsItems.ImageItem import ImageItem
# load the C++ library; The _grid_density is build and distributed as a
# python extension but does not export any python objects (apart from... | StarcoderdataPython |
133241 | <reponame>brew/ckan<filename>ckan/tests/legacy/functional/api/model/test_vocabulary.py
import ckan
import pylons.test
import paste.fixture
import ckan.lib.helpers as helpers
import ckan.lib.dictization.model_dictize as model_dictize
class TestVocabulary(object):
@classmethod
def setup_class(self):
se... | StarcoderdataPython |
199869 | <reponame>signalfx/python-flask<gh_stars>1-10
import opentracing
from opentracing.ext import tags
from flask import _request_ctx_stack as stack
from .scope_manager import FlaskScopeManager
class FlaskTracing(opentracing.Tracer):
"""
Tracer that can trace certain requests to a Flask app.
@param tracer th... | StarcoderdataPython |
174989 | <reponame>CheyenneNS/metrics<gh_stars>0
import time
import methods_upload_user_stats
import datetime
print("############################################")
print("User Stats Upload (UTC): " + str(datetime.datetime.utcnow()))
start_time = time.time()
user_stats_dict = methods_upload_user_stats.get_user_info_from_auth2()
... | StarcoderdataPython |
3309029 | <reponame>chaosk/djangocms-admin-style
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
def noop_gettext(s):
return s
gettext = noop_gettext
HELPER_SETTINGS = dict(
LANGUAGES=(
('en', u'English'),
('de', u'Deutsch'),
('it', u'I... | StarcoderdataPython |
3364044 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
from decimal import Decimal
class Migration(migrations.Migration):
dependencies = [
('shop', '0004_order_status_change'),
]
... | StarcoderdataPython |
1690657 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.contrib.postgres.fields
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('editorial', '0027_auto_20171012_2329'... | StarcoderdataPython |
1714093 | <filename>pythonproject/urls.py
"""pythonproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path(''... | StarcoderdataPython |
3373406 | <filename>lib/PEG_GrammarExplorer/PEG_GrammarExplorer/PegSamples/python_2_5_2/input/string_concat.py
re.compile("[A-Za-z_]" # letter or underscore
"[A-Za-z0-9_]*" # letter, digit or underscore
)
| StarcoderdataPython |
1759753 | <reponame>Jbarata98/remote-sensing-image-captioning
import os
from torchvision import transforms
#
# import sys
#
# sys.path.append('/content/gdrive/MyDrive/Tese/code')
from src.configs.utils.datasets import CaptionDataset
from src.configs.setters.set_initializers import *
# training details on file configs/setters... | StarcoderdataPython |
56572 | <reponame>bogdanovdya/Clients_Lifetime
from app import app, db
from flask import render_template, request
from installApplication import InstallApplication
from indexApplication import IndexApplication
from botApplication import BotApplication
from model.data_parser import DataParser
from model.predictor import Predict... | StarcoderdataPython |
3384892 | <gh_stars>1-10
import argparse
import csv
import numpy as np
import utils
from genetic import GeneticAlgorithm
from models.model import create_model, huber_loss_mean
class Trainer(object):
def __init__(self, path: str, log_path: str):
data = np.genfromtxt(path, delimiter=',', skip_header=1)
self... | StarcoderdataPython |
194051 | <reponame>swryan/OpenMDAO-Framework<filename>openmdao.util/src/openmdao/util/publickey.py
"""
Support for generation, use, and storage of public/private key pairs.
The :func:`pk_encrypt`, :func:`pk_decrypt`, :func:`pk_sign`, and
:func:`pk_verify` functions provide a thin interface over
:class:`Crypto.PublicKey.RSA` met... | StarcoderdataPython |
3252328 | import os
#import sys; print(sys.executable)
from setuptools import find_packages, setup
#from numpy.distutils.core import setup, Extension
#import numpy
#from numpy.distutils.core import setup
# src = os.path.join("multi_mesh", 'src')
# lib = Extension('multi_mesh',
# sources=[
# os... | StarcoderdataPython |
3228035 | <reponame>fungaegis/pytest-custom-concurrency
from threading import Thread, Lock
def pytest_addoption(parser):
group = parser.getgroup("custom", "Custom grouping concurrence for pytest")
group.addoption(
"--concurrent",
action="store",
default="off",
choices=['on', 'off'],
... | StarcoderdataPython |
1610882 | <reponame>daniel-falk/nnabla<filename>python/benchmark/function/test_activation.py
# Copyright 2017,2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | StarcoderdataPython |
4827974 | <gh_stars>0
from typing import Optional
from pydantic import BaseModel, constr, Field
class Users(BaseModel):
id: int
name: str
email: str
is_active: bool
ip_info: Optional[str] = None
class UsersIn(BaseModel):
name: str
email: str
password: str
class UsersUpdateIn(BaseModel):
... | StarcoderdataPython |
3342697 | from __future__ import absolute_import
import subprocess
import unittest
from os import path, devnull
from tests.test_pil_engine import PILEngineTests
class PerceptualdiffEngineTests(PILEngineTests):
engine_class = 'needle.engines.perceptualdiff_engine.Engine'
@classmethod
def setUpClass(cls):
t... | StarcoderdataPython |
160311 | from project.mammal import Mammal
class Gorilla(Mammal):
pass | StarcoderdataPython |
1794073 | import pandas as pd
import matplotlib.pyplot as plt
# Read data from csv into pandas dataframe
data = pd.read_csv('data.csv')[
['userid', 'From', 'To']]
# Display the first 10 rows of dataframe
print(data.head(10))
# Checking if there are NAN values
print("Presence of NAN values : \n", data.isnull().any())
# Fu... | StarcoderdataPython |
3299743 | <gh_stars>0
from __future__ import absolute_import, division, print_function, unicode_literals
from rsfriction.rsensemble import Rs2BeamMagnus
import rsmath.const
import scipy
def test_twobeam_magnus():
# specify physical properties of the beam
mass_ev = scipy.constants.m_e * rsmath.const.C_SQ / scipy.consta... | StarcoderdataPython |
124794 | <gh_stars>0
import numpy as np
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
import functions
#################################################
# Database Setup
########################... | StarcoderdataPython |
1781300 | <gh_stars>1000+
import scrabble
# Print all the words containing uu
for word in scrabble.wordlist:
if "uu" in word:
print(word) | StarcoderdataPython |
1637807 | from pyjordan.files import find_file, find_file_recursive
from pyjordan.strings import str_replace_all
from pyjordan.tools import print_time, round_by, unnest, as_list
| StarcoderdataPython |
1625584 | """
Module: 'ucollections' on micropython-rp2-1.15
"""
# MCU: {'family': 'micropython', 'sysname': 'rp2', 'version': '1.15.0', 'build': '', 'mpy': 5637, 'port': 'rp2', 'platform': 'rp2', 'name': 'micropython', 'arch': 'armv7m', 'machine': 'Raspberry Pi Pico with RP2040', 'nodename': 'rp2', 'ver': '1.15', 'release': '1.... | StarcoderdataPython |
3350127 | <filename>beautifulsoup/demo9.py
html = """
<html>
<body>
<p class="story">
Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" class="sister" id="link1">Bob</a><a href="http://example.com/lacie" class="sister" id="link2">Lacie</a... | StarcoderdataPython |
3326608 | import graphene # type: ignore
from graphql import GraphQLError # type: ignore
import inject # type: ignore
from books.schemas.types import BookType
from books.use_cases import *
from books.use_cases.exceptions import *
from books.use_cases.repositories import BaseBookRepository
class AllBooks(object):
books = ... | StarcoderdataPython |
1602677 | <reponame>dormuhlg/lang2program
from strongsup.path_checker import PathChecker
from strongsup.utils import EOU
class TablesPathChecker(PathChecker):
def __init__(self, config):
PathChecker.__init__(self, config)
self._max_stack_size = config.get('max_stack_size')
self._prune_idempotent = ... | StarcoderdataPython |
1669585 | import os
import pprint
import pytest
from hamcrest import *
from youtrack.connection import Connection
class TestGetIssues:
connection = None
@pytest.fixture(scope='class', autouse=True)
def init(self):
server = os.getenv('TEST_SERVER', '')
user = os.getenv('TEST_USER', '')
pass... | StarcoderdataPython |
3253162 | # coding=utf-8
from . import settings
from . import utils
from . import models
from . import repos
from . import services
from . import jobs
from . import http
| StarcoderdataPython |
3333303 | # *****************************************************************************
#
# Copyright (c) 2020, the pyEX authors.
#
# This file is part of the pyEX library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from functools import wraps
import pandas a... | StarcoderdataPython |
3280386 | <gh_stars>1-10
#! python3
print("Task 11.1")
class Employee():
def __init__(self, first, last, salary):
self.first = first.title()
self.last = last.title()
self.salary = salary
def give_raise(self, amount=5000):
self.salary += amount
import unittest
from employee import Empl... | StarcoderdataPython |
159688 | import numpy as np
import tensorflow as tf
def upsample_nearest(inputs, scale):
shape = tf.shape(input=inputs)
n, h, w, c = shape[0], shape[1], shape[2], shape[3]
return tf.image.resize(inputs, tf.stack([h*scale, w*scale]), method=tf.image.ResizeMethod.NEAREST_NEIGHBOR) | StarcoderdataPython |
16201 | from ...data_connector import Connector
from os import environ
def test_data_connector() -> None:
token = environ["DATAPREP_DATA_CONNECTOR_YELP_TOKEN"]
dc = Connector("yelp", _auth={"access_token": token})
df = dc.query("businesses", term="ramen", location="vancouver")
assert len(df) > 0
dc.info... | StarcoderdataPython |
3385735 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'PathFinderDialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtC... | StarcoderdataPython |
1662710 | <gh_stars>0
text = input()
new_word = ""
for index, letter in enumerate(text):
if index % 2 == 1:
new_word += letter
print(new_word)
| StarcoderdataPython |
1741695 | # -*- coding=utf-8
import random
import sys
import os
from cos_client import CosS3Client
from cos_client import CosConfig
from cos_exception import CosServiceError
ACCESS_ID = os.environ["ACCESS_ID"]
ACCESS_KEY = os.environ["ACCESS_KEY"]
def gen_file(path, size):
_file = open(path, 'w')
_file.seek(1024*1024*... | StarcoderdataPython |
4808800 | import tensorflow as tf
from meta_policy_search.utils.utils import get_original_tf_name, get_last_scope
import tensorflow_probability as tfp
tfd = tfp.distributions
import os
def output_weights(model_out,fast_weights):
j=0
#print('len_fast_weights=',len(fast_weights))
for i, layer in enumerate(model_out.l... | StarcoderdataPython |
4835173 | __author__ = 'breddels'
import pathlib
import logging
from glob import glob as local_glob
import os
import re
import sys
from urllib.parse import parse_qs
import vaex.file.cache
normal_open = open
logger = logging.getLogger("vaex.file")
class FileProxy:
'''Wraps a file object, giving it a name a dup() method
... | StarcoderdataPython |
1769657 | <filename>ex006.py
n = float(input('Digite um número para saber seu dobro, triplo e sua raiz quadrada '))
print('Seu dobro é {}'.format(2 * n))
print('Seu triplo é {}'.format(3 * n))
print('Sua raiz quadrada é {:.2f}'.format(pow(n, (1 / 2))))
| StarcoderdataPython |
23543 | #------------------------------------------
# this script combine result of different
# nets and report final result
#------------------------------------------
import sys
import numpy as np
from util import pickle, unpickle
def evaluate_result( result, text ):
# pre-condition check
num_batches = len( result[... | StarcoderdataPython |
164038 | <reponame>JedCainglet/py-behave-example<gh_stars>0
from behave import *
# Feature: showing off behave
# Scenario: run a simple test
@given('we have behave installed')
def step_impl(context):
pass
@when('we implement a test')
def step_impl(context):
assert True is not False
@then('behave will test it for u... | StarcoderdataPython |
1740450 | <gh_stars>1-10
def test_html_macro(script):
"""
Test that we can use raw HTML enclosed in div elements.
"""
script.set_content(
"<div>"
'<ac:structured-macro ac:name="jiraissues">'
'<ac:parameter ac:name="jqlQuery">filter=666 ORDER BY updated DESC</ac:parameter>'
'<ac:par... | StarcoderdataPython |
52906 | <reponame>ResearchHub/ResearchHub-Backend-Open
'''
Clean HTML tags in abstract
'''
import utils.sentry as sentry
from bs4 import BeautifulSoup
from django.core.management.base import BaseCommand
from paper.models import Paper
class Command(BaseCommand):
def handle(self, *args, **options):
papers = Pa... | StarcoderdataPython |
3384241 | <filename>UtilsDR/log.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Script Permettant de logguer.
Ce Module Permet de mettre dans un fichier de log :
Notes:
------
Inspiré de :
https://realnitinworks.netlify.app/decorator-saves-logging.html#decorator-saves-logging
"""
import logging
import inspect
# Choisir l... | StarcoderdataPython |
3290548 | <reponame>priyaravichander/ganspace
# Copyright 2020 <NAME>. All rights reserved.
# This file is licensed to you 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 |
3310135 | <gh_stars>0
import os
import torch
from torch import nn, optim
import numpy as np
import params
from utils import make_variable
from itertools import count
def train_target(source_encoder, target_encoder, critic,
source_dataloader, target_dataloader):
target_encoder.train()
critic.trai... | StarcoderdataPython |
3308211 | <filename>exponential/e.py
import math
import time
from decimal import *
import sys
sys.setrecursionlimit(10000)
startTime = time.time()
e = Decimal(2.0)
n = 1
limit = 10000
while n <= limit:
fact = math.factorial(n+1)
e += 1 / Decimal(fact)
n += 1
print("Exponential_function (math_lib) = " + str(e))
endTime = ti... | StarcoderdataPython |
22901 | <filename>systest/tests/test_rm.py<gh_stars>0
def test_rm_long_opt_help(pycred):
pycred('rm --help')
def test_rm_short_opt_help(pycred):
pycred('rm -h')
def test_rm_none_existing_store_gives_exit_code_2(pycred, workspace):
with workspace():
pycred('rm non-existing-store user', expected_exit_code... | StarcoderdataPython |
77351 | <filename>parsing_scripts/download_pages.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import time
import sys, getopt
#import csv
#import requests
import re
#import hashlib
import json
import datetime
import hashlib
import threading
from datetime import timedelta, date
#import threading
##... | StarcoderdataPython |
1608358 | <reponame>houssemeddinegherabi/Hondana<filename>hondana/types/relationship.py
"""
The MIT License (MIT)
Copyright (c) 2021-Present AbstractUmbra
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 wi... | StarcoderdataPython |
72547 | <gh_stars>0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------... | StarcoderdataPython |
3354535 | <gh_stars>1-10
# Author
# <NAME>
#Function that returns the result of adding all the elements of an array
def summing(array):
total=0
for x in range(len(array)):
total+=array[x]
return total
#Function that returns a string made of all the elements of an array
def stringarray(array):
try:
string... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.