id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3351377 | from setuptools import setup
with open('README.md', 'r') as f:
long_description = f.read()
with open('LICENSE', 'r') as f:
license = f.read()
setup(
name='tensorsim',
version='0.0.1',
description='Simulate predictions by a simulated accuracy',
long_description=long_description,
license=li... | StarcoderdataPython |
1691213 | <filename>huskar_api/service/admin/user.py
from __future__ import absolute_import
import uuid
import datetime
from flask import abort
from werkzeug.security import safe_str_cmp
from huskar_api.models import DBSession, cache_manager
from huskar_api.models.auth import User
from huskar_api.extras.email import deliver_e... | StarcoderdataPython |
1675528 | from unittest import TestCase
from conductr_cli.test.cli_test_case import CliTestCase, strip_margin
from conductr_cli import conduct_info
try:
from unittest.mock import patch, MagicMock # 3.3 and beyond
except ImportError:
from mock import patch, MagicMock
class TestConductInfoCommand(TestCase, CliTestCase)... | StarcoderdataPython |
141370 | import cgi
import logging
from normality import slugify
from followthemoney import model
from followthemoney.types import registry
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm.attributes import flag_modified
from aleph.core import db, cache
from aleph.model.metadata import Metadata
from aleph.m... | StarcoderdataPython |
3306782 | <gh_stars>0
from collections import Counter, OrderedDict
import argparse
import pickle
import csv
import sys
from plotly import graph_objects as go
import torch as th
from vocab import WordVocab
#
def parse_args(for_train=True) -> dict:
parser = argparse.ArgumentParser()
parser.add_argument("-ds", help="pat... | StarcoderdataPython |
135323 | import operator
import numpy as np
import bitpacking.packing as pk
from boolnet.utils import PackedMatrix
FUNCTIONS = {
'add': operator.add,
'sub': operator.sub,
'mul': operator.mul,
'div': operator.floordiv,
'mod': operator.mod,
}
def to_binary(value, num_bits):
# little-endian
ret... | StarcoderdataPython |
4828355 | import os
import unittest
import yaml
from io import StringIO
from unittest import mock
from .. import *
from mike import mkdocs_utils
class Stream(StringIO):
def __init__(self, name, data=''):
super().__init__(data)
self.name = name
def close(self):
pass
def mock_open_files(files)... | StarcoderdataPython |
3224289 | #!/usr/bin/evn python
# -*- coding:utf-8 -*-
#python version 2.7.10
from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get("http://mail.126.com")
#设置隐士等待10s
driver.implicitly_wait(10)
def login():
driver.switch_to.frame("x-URS-iframe")
driver.find_element_by_name("email").clear()
driv... | StarcoderdataPython |
1633298 | import logging
import tensorflow as tf
from data_all import get_dataset, get_train_pipeline
from training_all import train
from model_small import BIGBIGAN_G, BIGBIGAN_D_F, BIGBIGAN_D_H, BIGBIGAN_D_J, BIGBIGAN_E
import numpy as np
import os
from PIL import Image
def save_image(img, fname):
img = img*255.0
img ... | StarcoderdataPython |
4805066 | <reponame>carolineyuchen/MMRIV
import torch, add_path
import numpy as np
import os,sys
from methods.mnist_x_model_selection_method import MNISTXModelSelectionMethod
from methods.mnist_xz_model_selection_method import MNISTXZModelSelectionMethod
from methods.mnist_z_model_selection_method import MNISTZModelSelectionMeth... | StarcoderdataPython |
1666259 | <filename>agent_reactor.py
'''
'''
import threading
import time
from protocol import State, Direction
from facing import Facing
from atoms import Position, Velocity, Face
from observer import Emitter, Listener, Event
from packet_event import PacketEvent
class TickEvent(Event):
pass
class StopEvent(Event):
... | StarcoderdataPython |
14123 | <gh_stars>0
import time
import pytest
# preparing selenium and chrome web driver manager
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
# importing os for environmental variable, and docker-compose up
import os
@pytest.fi... | StarcoderdataPython |
1617382 | """Test helpers for Freebox."""
from unittest.mock import patch
import pytest
@pytest.fixture(autouse=True)
def mock_path():
"""Mock path lib."""
with patch("homeassistant.components.freebox.router.Path"):
yield
| StarcoderdataPython |
3249259 | <reponame>kaushnian/TradingView_Machine_Learning<filename>OptimizeLongTakeprofit.py
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
import time
import numpy as np
from TradeViewGUI import Main
from my... | StarcoderdataPython |
4817457 | <filename>src/indor/command_register.py
from .indor_exceptions import ClassPropertyNotFound
from .command import Command
from .command_factory import CommandFactory
class CommandRegister(type(Command)):
def __init__(cls, name, bases, dic):
cls.property_name_for_printer = 'pretty_name'
if cls.prop... | StarcoderdataPython |
1758355 | from .conf import MODULES
from zcrmsdk.Handler import APIHandler
from zcrmsdk.CLException import ZCRMException
from zcrmsdk.Utility import APIConstants
from zcrmsdk.Request import APIRequest
class BlueprintAPI():
def __init__(self):
self._MAIN_URL = '{module_api_name}/{record_id}/actions/blueprint'
... | StarcoderdataPython |
3264188 | import pytest
from practice_atcoder.typical_ninety.no08code import question
class Test(object):
@pytest.mark.parametrize("s,expect", [
("attcoderer", "6"),
("aattccooddeerr", "128"),
("atcoderatcoderatcoderatcoderatcoderatcoderatcoderatcoderatcoder", "6435"),
("<KEY>", "99337"),
... | StarcoderdataPython |
3205139 | <gh_stars>1-10
from django import template
from templatetag_sugar.register import tag
from templatetag_sugar.parser import *
register = template.Library()
from pws.models import Entry
from pws.forms import EntryForm
from django.urls import reverse
from django.db.models import Q
@tag(register, [Variable(), Constant("... | StarcoderdataPython |
1757183 | from typing import Union, Sized
from dataclasses import dataclass
from torch.utils.data import Dataset, DataLoader
from torch.utils.data import TensorDataset as _TensorDataset
from hearth.containers import TensorDict
from hearth._collate import default_collate
class BatchesMixin:
"""mixin for supporting batches... | StarcoderdataPython |
89931 |
import os
import sys
#import json
#import datetime
#import numpy as np
#import skimage.draw
# Root directory of the project
ROOT_DIR = os.path.abspath("../../")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn.config import Config
from mrcnn import model as modellib, ut... | StarcoderdataPython |
3319484 | import media
import json
def read_movies_file(file):
movie_file = open(file)
# reference to read json file http://stackoverflow.com/a/2835672
with movie_file as data_file:
data = json.load(data_file)
movies_list = data["movies"]
movies = []
for movie in movies_list:
movies.append(media.Movie(movie["name"],... | StarcoderdataPython |
107387 | <gh_stars>1-10
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License")... | StarcoderdataPython |
3270903 | <reponame>aliyyousuff/MOOC
# - ProblemSet4.py *- coding: utf-8 -*-
"""
Problem 4_1:
Write a function that will sort an alphabetic list (or list of words) into
alphabetical order. Make it sort independently of whether the letters are
capital or lowercase. First print out the wordlist, then sort and print out
the... | StarcoderdataPython |
105353 | import os
import subprocess
import uno
import unohelper
from com.sun.star.connection import NoConnectException
from com.sun.star.lang import IllegalArgumentException
class SpreadScript(object):
def __init__(self, file_name=None):
"""Initialise the class.
:arg str file_name: File name.
""... | StarcoderdataPython |
1667129 | <filename>api/__init__.py
from flask_restplus import Api, Resource
from .taskController import *
api = Api(
version='1.0',
title='API',
description='api',
)
ns = api.namespace('api', description='task api namespace')
@ns.route('/tasks')
class TaskList(Resource):
@api.doc('get all tasks')
def get... | StarcoderdataPython |
116309 | # -*- coding: utf-8 -*-
# Copyright 2015 www.suishouguan.com
#
# Licensed under the Private License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://github.com/samuelbaizg/ssguan/blob/master/LICENSE
#
# Unless ... | StarcoderdataPython |
3318689 | #!/usr/bin/python3
# Author: GMFTBY
# Time: 2019.9.19
from metric.metric import *
import argparse
import random
from utils import load_word_embedding
import pickle
from tqdm import tqdm
from bert_score import score
import ipdb
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Evaluate the... | StarcoderdataPython |
131655 | from .generate_tests import *
from .create_cfg import *
from .mutation_analysis import *
| StarcoderdataPython |
1738223 | # Created by zhouwang on 2018/5/5.
from .base import BaseRequestHandler, permission
import datetime
import pymysql
import logging
logger = logging.getLogger()
def argements_valid(handler, pk=None):
error = dict()
name = handler.get_argument('name', '')
path = handler.get_argument('path', '')
comment... | StarcoderdataPython |
4832147 | from dataclasses import dataclass
import re
enum_count = 0
def iota(reset = False):
global enum_count
if reset:
enum_count = 0
value = enum_count
enum_count += 1
return value
# Token types
PAPER_KW = iota()
EXPERIMENT_KW= iota()
LET_KW = iota()
FOR_KW= iota()
PARFOR_KW = iota()
LEFT_PAR... | StarcoderdataPython |
51832 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'CharakterInfo.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# 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 QtCore... | StarcoderdataPython |
3308688 | <filename>ts3/filetransfer.py
#!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2013-2018 <see AUTHORS.txt>
#
# 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 restricti... | StarcoderdataPython |
1760222 | import os
import sys
from collections import OrderedDict
from matplotlib import pyplot as plt
from PIL import Image
import numpy as np
class History():
def __init__(self):
self.epoch_log = []
self.batch_log = {}
def update_epoch_log(self, log):
if type(log) not in [OrderedDict]:
... | StarcoderdataPython |
1605293 | <filename>Download/exercicio028.py
#jogo da adivinhação
from random import randint
from time import sleep
computador = randint(0,5) #faz o computador pensar
print('\033[;34m-=\033[m' *30)
print('\033[;33mVou pensar em um número entre 0 e 5, tente adivinhar...\033[m' )
print('\033[;34m-=\033[m'*30)
jogador = int(input('... | StarcoderdataPython |
3352727 | <reponame>NoMigraine/migraine-diary-server
"""isort:skip_file"""
import logging
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE_DIR)
from app.db.init_db import init_db # noqa isort:skip
from app.db.session import SessionLocal # noqa isort:skip
log... | StarcoderdataPython |
3278907 | import cv2
from os.path import basename, isfile, join
from loguru import logger
from filetype import guess
from skimage import exposure
from skimage.feature import hog
class Image:
"""
Custom Image class to store more information about the Image
wrapper around the openCV image object
"""
def __... | StarcoderdataPython |
1718105 | __author__ = "<NAME>"
__version__ = "1.0"
from detectron2.data import MetadataCatalog, DatasetCatalog
from detectron2.structures import BoxMode
import os
import json
def get_dataset_dict(json_dir, json_name, destination_image_source_dir=None):
'to convert the output json file into a dictionary digestable by dete... | StarcoderdataPython |
1692109 | <reponame>QTIM-Lab/qtim_gbmSegmenter
import argparse
import sys
from qtim_gbmSegmenter.Config_Library.docker_workflow import full_pipeline, dicom_convert
from qtim_gbmSegmenter.Config_Library.docker_wrapper import docker_segmentation
class segmenter_commands(object):
def __init__(self):
parser = argpars... | StarcoderdataPython |
62112 | <filename>119.pascals-triangle-ii.py
#
# @lc app=leetcode id=119 lang=python3
#
# [119] Pascal's Triangle II
#
# https://leetcode.com/problems/pascals-triangle-ii/description/
#
# algorithms
# Easy (45.89%)
# Likes: 582
# Dislikes: 182
# Total Accepted: 237.3K
# Total Submissions: 515.4K
# Testcase Example: '3'
... | StarcoderdataPython |
1796029 | ## Use BFS with Queue
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
word_set = set(wordList)
queue = deque([[beginWord, 1]])
while queue:
word, seq_len = queue.popleft()
if word ==... | StarcoderdataPython |
3348709 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.6.0-bd605d07 (http://hl7.org/fhir/StructureDefinition/MedicationKnowledge) on 2018-12-20.
# 2018, SMART Health IT.
from . import domainresource
class MedicationKnowledge(domainresource.DomainResource):
""" Definition of Medication Knowledg... | StarcoderdataPython |
100485 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from workflow.notify import notify
from workflow import Workflow
GITHUB_SLUG = 'cocobear/alfred-quick-run'
def main(wf):
import subprocess
import yaml
import os
from subprocess import Popen,... | StarcoderdataPython |
1750199 | <filename>tests/test_students_delete_parametrized.py
import unittest
from src.students import Students
from parameterized import parameterized, parameterized_class
from src.exampleData import Data
class StudentsParameterizedPackage(unittest.TestCase):
def setUp(self):
self.tmp = Students(Data().example)
... | StarcoderdataPython |
3376967 | # -*- coding: utf-8 -*-
# Реализация вывода текста на окна
from curses import color_pair
from .wincontent import WinContent
class WinText(WinContent):
def __init__(self, targeted_window, name, description=''):
WinContent.__init__(self, targeted_window, name, description)
self.text = ''
def new_text(self, text)... | StarcoderdataPython |
3204734 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-09-21 21:04:59
# @Author : <NAME> (<EMAIL>)
# @Link : https://github.com/1160300911
# @Version : 1.0s
from itertools import accumulate
from bisect import bisect_right
import random
def basic_selection(population):
"""
... | StarcoderdataPython |
60250 | import os
import sys
import json
cfg = xmlsettings.XMLSettings(os.path.join(sys.path[0],'settings.xml'))
with open(os.path.join(sys.path[0],'config.json')) as data_file:
data = json.load(data_file)
| StarcoderdataPython |
1605068 | # coding: utf-8
"""
Copyright 2015 SmartBear Software
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 applica... | StarcoderdataPython |
1746356 | <filename>solver/nmfsvd.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
import numpy
def from_positive_part(may_negative):
"""
>>> from_positive_part(numpy.array([1, -2, 3]))
array([ 1., 0., 3.])
"""
return (may_negative + abs(may_negative))/2.0
def from_negative_par... | StarcoderdataPython |
1791836 | <filename>LeetCode/Minimum Path Sum.py
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
numberOfRows = len(grid)
numberOfColumns = len(grid[0])
for row in range(numberOfRows):
for col in range(numberOfColumns):
if row == 0 and col == 0:
... | StarcoderdataPython |
3220622 | import genprog.core as gp
import genprog.evolution as gpevo
from typing import Dict, List, Any, Set, Optional, Union, Tuple
import numpy as np
import vision_genprog.utilities
import cv2
import logging
possible_types = ['grayscale_image', 'color_image', 'binary_image',
'float', 'int', 'bool', 'vector2... | StarcoderdataPython |
1734260 | #!/usr/bin/env python
from . import BaseItem
from . import FolderPainter
from . import FolderEditor
class Delegate (BaseItem.Delegate):
def __init__ (self, parent, theme):
super(Delegate, self).__init__(parent, theme)
self.Item = FolderPainter.Item(theme)
def createEditor (self, ... | StarcoderdataPython |
4842781 | import os
import sys
import math
target = 'tagged'
pathstump = "/Users/Torri/Documents/Grad stuff/Thesis stuff/Data - Novels/Analysis/"
d = {}
tokens = 0
types = 0
proportion = 0
shannon = 0
evenness = 0
evenness2 = 0
effective = 0
for dirname, dirs, files in os.walk('.'):
if target in dirname:
... | StarcoderdataPython |
1623871 | import pytest
from mitmproxy.net.udp import MAX_DATAGRAM_SIZE, DatagramReader
@pytest.mark.asyncio
async def test_reader():
reader = DatagramReader()
addr = ('8.8.8.8', 53)
reader.feed_data(b'First message', addr)
with pytest.raises(AssertionError):
reader.feed_data(bytearray(MAX_DATAGRAM_SIZ... | StarcoderdataPython |
4806520 | <reponame>neuroailab/ffcv
from abc import ABCMeta, abstractmethod
from contextlib import AbstractContextManager
class Benchmark(AbstractContextManager, metaclass=ABCMeta):
def __init__(self, **kwargs):
pass
@abstractmethod
def run(self):
raise NotImplemented() | StarcoderdataPython |
3243819 | <reponame>nubot-nudt/BCI_Multi_Robot<gh_stars>10-100
# $Id: PlaybackSourceModule.py 2898 2010-07-08 19:09:30Z jhill $
#
# This file is part of the BCPy2000 framework, a Python framework for
# implementing modules that run on top of the BCI2000 <http://bci2000.org/>
# platform, for the purpose of realtime bio... | StarcoderdataPython |
1612407 | <filename>napari_covid_if_annotations/layers.py
import h5py
import numpy as np
import skimage.color as skc
from vispy.color import Colormap
from .image_utils import (get_centroids, get_edge_segmentation, map_labels_to_edges,
quantile_normalize)
from .io_utils import has_table, read_image, rea... | StarcoderdataPython |
20925 | valor = input("Digite algo: ")
print("É do tipo", type(valor))
print("Valor numérico:", valor.isnumeric())
print("Valor Alfa:", valor.isalpha())
print("Valor Alfanumérico:", valor.isalnum())
print("Valor ASCII:", valor.isascii())
print("Valor Decimal", valor.isdecimal())
print("Valor Printavel", valor.isprintable()) | StarcoderdataPython |
50348 | import typing
from fiepipedesktoplib.locallymanagedtypes.shells.AbstractLocalManagedTypeCommand import LocalManagedTypeCommand
from fiepipedesktoplib.shells.AbstractShell import AbstractShell
from fiepipehoudini.data.installs import HoudiniInstall
from fiepipehoudini.routines.installs import HoudiniInstallsInteractive... | StarcoderdataPython |
98387 | <gh_stars>0
import pytest
import pendulum
from elasticsearch.exceptions import NotFoundError
from share import models
from share.util import IDObfuscator
from bots.elasticsearch import tasks
from tests import factories
def index_helpers(*helpers):
tasks.index_model('creativework', [h.work.id for h in helpers]... | StarcoderdataPython |
3361392 | from py_models_parser import parse
from simple_ddl_generator import DDLGenerator
def test_ddl_from_pydantic_model():
model_from = """class Material(BaseModel):
id: int
title: str
description: Optional[str]
link: str = 'http://'
type: Optional[MaterialType]
additional_properties: Optional[... | StarcoderdataPython |
1717536 | from unittest import TestCase
from SumarySearch import utils, bad_chars, stop_words
from SumarySearch.models import Book
class TestUtils(TestCase):
def setUp(self):
self.list_of_books = [Book(1, utils.clean_string('The Book in Three Sentences:\u00a0What if we measured our lives based on ',
... | StarcoderdataPython |
175468 | """
Setting for project
"""
logfile = "demo_project.log"
| StarcoderdataPython |
1627943 | from pathlib import Path
from tempfile import TemporaryDirectory
from snakemake.shell import shell
with TemporaryDirectory(dir=Path.cwd()) as tmpdir:
shell("cmscan --rfam --cut_ga --nohmmonly"
"--tblout {output[0]} "
"{input.rfam_database} "
"{input.fasta} "
"> {output[1]}"... | StarcoderdataPython |
3266702 | <filename>SlackESPN.py
from slackclient import SlackClient
from espnff import League
import argparse, os, time
def handle_command(ARGS, CLIENT, command, channel):
"""
Receives commands directed at the bot and determines if they
are valid commands. If so, then acts on the commands. If not,
... | StarcoderdataPython |
1710556 | # coding=utf-8
# Copyright 2021 The Google Research 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.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
4838716 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
#
#
"""
模块用途描述
Authors: zhangzhenhu
Date: 2019/4/8 14:39
"""
import pandas as pd
import numpy as np
import random
import argparse
from sklearn import preprocessing
from sklearn.svm import SVC
from sklearn.svm import SVR
from sklearn.model_selection import GridSearchC... | StarcoderdataPython |
1701239 | import os
import random
import torch.utils.data
from PIL import Image
import albumentations as A
import albumentations.pytorch as AT
import cv2
class ImgTransformer:
def __init__(self, img_size, color_aug=False):
self.img_size = img_size
self.color_aug = color_aug
def transform(self, image,... | StarcoderdataPython |
1661741 | from django.contrib import admin
from JobTrak.admin import JobTrakAdmin
#from mmg.jobtrak.links.models import *
#from mmg.jobtrak.core.models import *
| StarcoderdataPython |
1732857 | <filename>legged_gym/envs/pat/pat_IK_config.py<gh_stars>0
# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... | StarcoderdataPython |
1643123 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | StarcoderdataPython |
3236403 | # Copyright (c) 2020, <NAME>.
# Distributed under the MIT License. See LICENSE for more info.
"""
Explained variance
==================
This example will show the explained variance from a
`principal component analysis
<https://en.wikipedia.org/wiki/Principal_component_analysis>`_
as a function of the number of princi... | StarcoderdataPython |
161844 | <gh_stars>1-10
import csv
import inspect
import os
import pathlib
import string
from collections import defaultdict
from pathlib import Path
from typing import Any
import pytest
import rich
import typer
from hypothesis import given
from hypothesis import strategies
from hypothesis import strategies as st
from hypothes... | StarcoderdataPython |
182114 | <reponame>juanaugusto/Serializer-Training-GloboNetworkAPI
# -*- coding: utf-8 -*-
class CookieHandler(object):
"""This class intends to Handle the cookie field described by the
OpenFlow Specification and present in OpenVSwitch.
Cookie field has 64 bits. The first 32-bits are assigned to the id
... | StarcoderdataPython |
108625 | import six
import graphene
from graphene_django.filter.filterset import setup_filterset, GrapheneFilterSetMixin
from graphene_django.registry import get_global_registry
from graphql_relay.connection.connectiontypes import Connection, PageInfo, Edge
from graphql_relay.connection.arrayconnection import get_offset_... | StarcoderdataPython |
3333497 | <filename>ternary_operator.py<gh_stars>0
a = 7
b = 1 if a >= 5 else 42
print(b)
| StarcoderdataPython |
1764149 | # built-in
from argparse import REMAINDER, ArgumentParser
# app
from ..actions import get_python_env, get_resolver
from ..config import builders
from ..controllers import analyze_conflict
from ..models import Requirement
from ..package_manager import PackageManager
from .base import BaseCommand
class PackageInstallC... | StarcoderdataPython |
83972 | import json
from multiprocessing import Pool
from random import randint
from typing import List, Dict, Callable, Any
import numpy as np
import os
from tqdm import tqdm
from pietoolbelt.datasets.common import BasicDataset
from pietoolbelt.pipeline.abstract_step import AbstractStep, DatasetInPipeline, AbstractStepDirR... | StarcoderdataPython |
3237286 | <filename>test_all.py<gh_stars>0
import copy
import random
import unittest
from unittest.mock import MagicMock
import enemy
import tower
from extras import Shot
from main import towerDefense
class GameTest(unittest.TestCase):
def tearDown(self):
towerDefense._instance = None
def test_... | StarcoderdataPython |
1799077 | """
Convert plain text to format accepted by model (token idxs + special tokens).
"""
import warnings
import functools
from collections import namedtuple, Counter, OrderedDict
import spacy
import numpy as np
NLP = None
def get_spacy():
global NLP
if NLP is None:
NLP = spacy.load("en_core_web_sm", di... | StarcoderdataPython |
56089 | <filename>lightning_pass/gui/mouse_randomness.py
"""Module containing classes used for operations with mouse randomness generation."""
import random
import string
from typing import Generator, NamedTuple, Optional
from PyQt5 import QtCore, QtWidgets
class MouseTracker(QtCore.QObject):
"""This class contains func... | StarcoderdataPython |
3280557 | from BiModNeuroCNN.version import __version__
| StarcoderdataPython |
11923 | # Generated by Django 2.1.5 on 2019-05-04 07:55
import blog.formatChecker
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0040_auto_20190504_0840'),
]
operations = [
migrations.AlterField(
model_name='videos',
... | StarcoderdataPython |
78436 | <reponame>hkhpub/dstc6-track1<filename>scripts/score.py
import json
### The current dialog format
### [{dialog_id : " ", lst_candidate_id: [{candidate_id: " ", rank: " "}, ...]}]
def do_parse_cmdline():
from optparse import OptionParser
parser = OptionParser()
parser.add_option("--input-result-file-te... | StarcoderdataPython |
93163 | <filename>p3_collab-compet/test_maddpg_agent.py
import unittest
from model import Actor, Critic
from maddpg_agent import MultiAgent
import numpy as np
from replay_buffer import ReplayBuffer
from noise import OUNoise
import torch
from maddpg_agent_other import MADDPG_Agent
from collections import namedtuple
class Test... | StarcoderdataPython |
1716728 | <filename>aula07/ex06.py
tabuada = int(input("insira um número pra ver sua tabuada: "))
um = tabuada*1
dois = tabuada*2
tres = tabuada*3
quatro = tabuada*4
cinco = tabuada*5
seis = tabuada*6
sete = tabuada*7
oito = tabuada*8
nove = tabuada*9
dez = tabuada*10
print('-' * 12)
print('{} x 1 = {}'.format(tabuada, um))
pri... | StarcoderdataPython |
26789 | <gh_stars>10-100
#!/usr/bin/env python
f = open("repair.log", "r");
lines = f.readlines();
cnt = 0;
for line in lines:
tokens = line.strip().split();
if (len(tokens) > 3):
if (tokens[0] == "Total") and (tokens[1] == "return"):
cnt += int(tokens[3]);
if (tokens[0] == "Total") and (tok... | StarcoderdataPython |
3322970 | # Copyright 2016, 2019 <NAME>. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
1717488 | import pandas as pd
import re
import math
import os
calc_pricing = pd.read_csv("calc_pricing_results.csv")
schedule_contracts = pd.read_csv("schedule_contracts_summary.csv")
def is_nan(x):
try:
return math.isnan(x)
except:
return False
def parse_shortened_sin(SIN):
if SIN.count(",") > 1:
... | StarcoderdataPython |
133332 | #!/usr/bin/env python
# Copyright: (c) 2020, <NAME>
# Apache 2.0 License, http://www.apache.org/licenses/
from __future__ import absolute_import, division, print_function
import sys
import os
import os.path
__metaclass__ = type
DOCUMENTATION = r"""
---
module: python_script
short_description: Evaluate python code
... | StarcoderdataPython |
133745 | import opentracing
import logging
import time
from opentracing import tags
from haystack import HaystackTracer
from haystack import LoggerRecorder
def setup_tracer():
global recorder
recorder = LoggerRecorder()
# instantiate a haystack tracer for this service and set a common tag which applies to all tra... | StarcoderdataPython |
3290733 | <reponame>jscholes/accessify-prototype
from datetime import datetime
import logging
import os
import os.path
import platform
import sys
from appdirs import user_config_dir
import tolk
import ujson as json
import wx
from accessify import constants
try:
from accessify import credentials
has_credentials = True
... | StarcoderdataPython |
96910 | from werkzeug.utils import find_modules, import_string
from config import Config
from flower_bed_designer import helpers
from flower_bed_designer.blueprints.plant import views
def register_blueprints(app):
for name in find_modules('flower_bed_designer.blueprints', recursive=True):
mod = import_string(nam... | StarcoderdataPython |
4824419 | <gh_stars>1-10
"""
Proteomics Datatypes
"""
import logging
import re
from galaxy.datatypes import data
from galaxy.datatypes.binary import Binary
from galaxy.datatypes.data import Text
from galaxy.datatypes.sequence import Sequence
from galaxy.datatypes.sniff import build_sniff_from_prefix
from galaxy.datatypes.tabula... | StarcoderdataPython |
144870 | from flask import Flask, render_template, request
from werkzeug.utils import secure_filename
from fitparse import FitFile
import os
import subprocess
import json
app = Flask(__name__)
app.config["UPLOAD_FOLDER"] = "temp/"
app.config["MAX_CONTENT_PATH"] = 5000000
@app.route('/')
def upload():
return render_templat... | StarcoderdataPython |
1743145 | # -*- coding: utf-8 -*-
"""
pybitcoin
~~~~~
:copyright: (c) 2014-2016 by Halfmoon Labs, Inc.
:license: MIT, see LICENSE for more details.
"""
import opcodes
from .network import broadcast_transaction, send_to_address, get_unspents, \
embed_data_in_blockchain, make_send_to_address_tx, make_op_retu... | StarcoderdataPython |
4825918 | class plural:
def __init__(self, value):
self.value = value
def __format__(self, format_spec):
v = self.value
singular, sep, plural = format_spec.partition('|')
plural = plural or f'{singular}s'
if abs(v) != 1:
return f'{v} {plural}'
return f'{v} {sing... | StarcoderdataPython |
30385 | <filename>curso em video/python/mundo 1/ex033.py
c = int(input('digite o primeiro numero: '))
b = int(input('digite o segundo numero: '))
a = int(input('digite o terceiro numero: '))
cores= {'vermelho': '\033[0;31m',
'azul' : '\033[1;34m',
'zero': '\033[m' }
# qual o maior
maior = a
if b > c and b > a:
... | StarcoderdataPython |
1733450 | from .utils.codeparsers import code_tree
from .utils.objecthashers import complex_hasher
def determine_metadata(func, args, kwargs,
exclusion_list, globals_list,
old_version=False):
metadata = dict()
metadata['func'] = func
metadata['args'] = args
metadata... | StarcoderdataPython |
167620 | <reponame>Rohitpandit021/jina
import sys
import pytest
from jina import Document
from jina.clients.request import request_generator
from jina.proto import jina_pb2
from jina.types.message import Message
from jina.types.request import _trigger_fields, Request
from jina.enums import CompressAlgo
from tests import rando... | StarcoderdataPython |
167874 | __author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.0.1' | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.