id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11306609 | <reponame>bchopson/blazeutils<gh_stars>0
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
import six
from blazeutils.spreadsheets import workbook_to_reader, XlwtHelper, http_headers, xlsx_to_reader
from blazeutils.testing import emits_deprecation
class TestWorkbookToReade... | StarcoderdataPython |
1627437 | <reponame>wyf2017/WSMCnet<filename>main.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import torch
import logging
logging.basicConfig(level=logging.INFO, format=' %(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def get_setting():
import argparse
parser = argpar... | StarcoderdataPython |
8183716 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-13 06:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Summon... | StarcoderdataPython |
4828831 | <reponame>ericmbernier/ericbernier-blog-posts<filename>flask_rest_api/tests/integration/test_teams_resource.py
from football_api.resources.teams_resource import TEAMS_ENDPOINT
def test_teams_post(client):
new_team_json = {"name": "<NAME>", "abbreviation": "HOU"}
response = client.post(TEAMS_ENDPOINT, json=new... | StarcoderdataPython |
8108030 | import requests
def boxscoretraditionalv2(GameID,StartPeriod,EndPeriod,StartRange,EndRange,RangeType):
url = "https://stats.nba.com/stats/boxscoretraditionalv2/"
querystring = {"GameID":GameID,
"StartPeriod":StartPeriod,
"EndPeriod":EndPeriod,
"StartRang... | StarcoderdataPython |
4818904 | <reponame>aws-samples/medical-text-sentence-relevance-bert
#download data needed for the sentence embeddings
import nltk
from sentence_transformers import models
nltk.download('punkt')
nltk.download('stopwords')
from sentence_transformers import SentenceTransformer
#SentenceTransformer('emilyalsentzer/Bio_ClinicalBERT... | StarcoderdataPython |
8161012 | <reponame>netvigator/auctions
# Generated by Django 2.2.10 on 2020-05-03 23:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('keepers', '0032_auto_20200322_0505'),
]
operations = [
migrations.AlterField(
model_name='keeper'... | StarcoderdataPython |
4985858 | <reponame>mikiereed/fantaSheets
"""
Django settings for fantaSheets project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3... | StarcoderdataPython |
216553 | from .imprint_view import ImprintView
from .imprint_revision_view import ImprintRevisionView
from .imprint_sbs_view import ImprintSideBySideView
from .imprint_actions import (
archive_imprint,
restore_imprint,
delete_imprint,
expand_imprint_translation_id,
)
| StarcoderdataPython |
5136272 | <reponame>liminspace/dju-image<gh_stars>1-10
import os
import cStringIO
from PIL import Image
from django.conf import settings
from django.core.files.uploadedfile import UploadedFile
from django.test import TestCase
from dju_image import settings as dju_settings
from dju_image.image import (adjust_image, image_get_form... | StarcoderdataPython |
5162822 | import unittest
from datetime import datetime
from parameterized import parameterized
import pytz
import lusid
import lusid.models as models
from utilities import InstrumentLoader
from utilities import TestDataUtilities
class Valuation(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Create a... | StarcoderdataPython |
11322164 | <filename>combat_tracker.py
class Tracker:
def __init__(self, hp, ar, sk):
self.max_health = int(hp)
self.max_armor = int(ar)
self.max_soak = int(sk)
self.current_health = self.max_health
self.current_armor = self.max_armor
self.current_soak = self.max_soak
... | StarcoderdataPython |
377666 | <filename>pdblib/artist.py
from construct import Struct, Int8ul, Int16ul, Int32ul, Const, Tell, this
from .piostring import OffsetPioString
ARTIST_ENTRY_MAGIC = 0x60
Artist = Struct(
"entry_start" / Tell,
"magic" / Const(ARTIST_ENTRY_MAGIC, Int16ul),
"index_shift" / Int16ul,
"id" / Int32ul,
"unknown" / Int8... | StarcoderdataPython |
11360700 | <filename>scripts/hoi4/hoi4/__init__.py
import sys
sys.path.append("../..")
import hoi4.load
import hoi4.unitstats | StarcoderdataPython |
5049881 | <reponame>GrowingData/hyper-model<gh_stars>10-100
import logging
import click
import pandas as pd
from typing import Dict, List
from xgboost import XGBClassifier
from hypermodel import hml
from hypermodel.features import one_hot_encode
from hypermodel.hml.model_container import ModelContainer
#from titanic.tragic_titan... | StarcoderdataPython |
11337816 | <reponame>denova-com/blockchain-backup<gh_stars>0
'''
Special settings for blockchain_backup project.
If you have installed from source, then
create a secret key and enter it between
the single quote marks in place of
THE SECRET KEY
Copyright 2018-2020 DeNova
Last modified: 2020-10-24
'''
... | StarcoderdataPython |
1813156 | import string
import logging
NORTH = 0
EAST = 1
WEST = 2
SOUTH = 3
def parse(data):
ret = ''
steps = 0
data = data.splitlines()
x = data[0].index('|')
y = 0
direction = SOUTH
while True:
steps += 1
assert direction in (NORTH, EAST, WEST, SOUTH)
if direction == ... | StarcoderdataPython |
1944277 | <filename>src/gluonts/nursery/torch_arsgls_rbpf/utils/local_seed.py
import contextlib
import hashlib
import numpy as np
import torch
@contextlib.contextmanager
def local_seed(seed):
state_np = np.random.get_state()
state_torch = torch.random.get_rng_state()
np.random.seed(seed)
torch.random.manual_see... | StarcoderdataPython |
12859697 | <filename>my_ner.py
import os
from torch.utils.data import Dataset,DataLoader
import torch
import torch.nn as nn
from sklearn.metrics import f1_score
def build_corpus(split, make_vocab=True, data_dir="data"):
"""读取数据"""
assert split in ['train', 'dev', 'test']
word_lists = []
tag_lists = []
with o... | StarcoderdataPython |
6612922 | #!/usr/bin/env python
"""reducer.py"""
from operator import itemgetter
import sys
batch_current = 0
metric_value_min = 0
metric_value_max = 0
# input comes from STDIN (standard input)
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
line = line.rstrip()
# parse the i... | StarcoderdataPython |
8171723 | <filename>functions/cut.py
import pygame
def CortarImagen (image, x, y, eX, eY):
info=image.get_rect()
an_image = info[2]
al_image = info[3]
an_corte = int(an_image/eX)
al_corte = int(al_image/eY)
cuadro = image.subsurface(x*an_corte,y*al_corte, an_corte, al_corte)
return cuadro
| StarcoderdataPython |
8179638 | #!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
# pylint: disable=wrong-import-position
# pylint: disable=pointless-string-statement
# pylint: disable=pointless-statement
# pylint: disable=invalid-name
# type: ignore[attr-defined]
# https://github.com/python/mypy/issues/5858
"""This f... | StarcoderdataPython |
5015710 | from lexer.Word import *
class Type(Word):
def __init__(self, s, tag):
super(Type, self).__init__(s, tag)
def numeric(self, p):
if p == CHAR or p == NUM or p == REAL:
return True
return False
def max(self, p1, p2):
if not self.numeric(p1) or not self.numeric(... | StarcoderdataPython |
3466652 | alien_color = "green"
if(alien_color == "green"):
print("Hey, you just got 5 points")
elif(alien_color == "yellow"):
print("Hey, you just got 10 points")
elif(alien_color == "red"):
print("Hey, you just got 15 points")
alien_color = "yellow"
if(alien_color == "green"):
print("Hey, you jus... | StarcoderdataPython |
9643475 | <reponame>richardGaoPy/NetSpider
# -*- coding:utf-8 -*-
"""
base.py
~~~~~~~
"""
import re
import datetime
import json
import requests
from torndb import Connection
from tornado.gen import coroutine
from tornado.concurrent import run_on_executor
from tornado.escape import to_unicode, url_escape
from concurrent.f... | StarcoderdataPython |
4949626 | #!/usr/bin/python3
import logging
from jujuna.helper import connect_juju, log_traceback, ApperrorTimeout, wait_until
from juju.errors import JujuError
from websockets import ConnectionClosed
# create logger
log = logging.getLogger('jujuna.deploy')
async def deploy(
bundle_file,
ctrl_name='',
model_name... | StarcoderdataPython |
11299839 | # Demonstração de método lower
nome_cidade = 'rIo DE jaNeirO'
print(nome_cidade.lower()) | StarcoderdataPython |
4828569 | <reponame>dizcology/python-aiplatform<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licen... | StarcoderdataPython |
58587 | <reponame>matslindh/codingchallenges<filename>adventofcode2017/19.py
def explore(lines):
y = 0
x = lines[0].index('|')
dx = 0
dy = 1
answer = ''
steps = 0
while True:
x += dx
y += dy
if lines[y][x] == '+':
if x < (len(lines[y]) - 1) and lines[y][x+1].str... | StarcoderdataPython |
9705314 |
# The MIT License (MIT)
#
# Copyright (c) 2016 Oracle
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | StarcoderdataPython |
9681656 | <gh_stars>0
from django.db import models
import datetime
import feedparser
from dateutil import parser
from time import mktime
from django.db import transaction
from dateutil.tz import *
from math import *
from topia.termextract import extract
from constants.app_constants import *
from common.stemming import *
# Creat... | StarcoderdataPython |
6685038 | <filename>chromepass/chrome_passwords.py
import os
import sqlite3
import platform
from chromepass import ChromeLinux, ChromeWindows, ChromeMac
class Chromepass:
""" class Chromepass to get the passwords from the database file
Usage:
chpass = Chromepass()
chpass.get_pa... | StarcoderdataPython |
6037 |
""" Unit tests for ``wheezy.templates.utils``.
"""
import unittest
class FindAllBalancedTestCase(unittest.TestCase):
""" Test the ``find_all_balanced``.
"""
def test_start_out(self):
""" The start index is out of range.
"""
from wheezy.template.utils import find_all_balanced
... | StarcoderdataPython |
91418 | from abc import ABC, abstractmethod
from contextlib import contextmanager
from queue import Empty, Full, LifoQueue, Queue
from typing import Callable, Generic, List, Optional, TypeVar
from .errors import Invalid, UnableToCreateValidObject, Unmanaged
from .factory import Factory
T = TypeVar("T")
class Pool(Generic[T... | StarcoderdataPython |
8198221 | <filename>TIPE/dessiner_avion.py
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 12 10:22:39 2018
@author: <NAME>
"""
k=50
import tkinter
dico = {-1 : "red", 2 : "yellow",1 :"blue", 0: "white"}
couleur = [[0 for x in range(n)] for y in range(n)]
fenetre = tkinter.Tk()
canvas = tkinter.Canvas(fenetre, width=k*n, h... | StarcoderdataPython |
1640008 | <reponame>masaharu-kato-lab/firefly_algorithm
import copy
from itertools import chain, product
import functools
import numpy as np #type:ignore
import nd_equation
from typing import Any, Callable, Dict, Iterable, List, Tuple, Union, Optional
Node = Tuple[int, int]
class PatternedPermutation:
def __init__(self,... | StarcoderdataPython |
159125 | from Utils.Data.DatasetUtils import is_test_or_val_set, get_train_set_id_from_test_or_val_set
from Utils.Data.Dictionary.MappingDictionary import *
from Utils.Data.Features.Generated.GeneratedFeature import GeneratedFeaturePickle, GeneratedFeatureOnlyPickle
from Utils.Data.Features.MappedFeatures import MappedFeatureTw... | StarcoderdataPython |
3550297 | """ Effects Modules"""
__all__ = [
'brighbreathing',
'generic',
'rainbow',
'runner',
'static'
]
| StarcoderdataPython |
8116787 | <reponame>zjZSTU/LightWeightCNN<filename>py/lib/test/test_fire.py
# -*- coding: utf-8 -*-
"""
@date: 2020/4/26 下午3:49
@file: test_fire.py
@author: zj
@description:
"""
import torch
from models.squeezenet.fire import Fire
def test():
x = torch.randn((1, 3, 28, 28))
model = Fire(3, 10, 5, 5)
outputs = mo... | StarcoderdataPython |
3577058 | <gh_stars>1-10
# Copyright 2011 Gilt Groupe, INC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | StarcoderdataPython |
11310265 | [
{
'date': '2012-01-01',
'description': 'Nytårsdag',
'locale': 'da-DK',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2012-04-05',
'description': 'Skærtorsdag',
'locale': 'da-DK',
'notes': '',
'region': '',
... | StarcoderdataPython |
1751979 | import os
from parlai.utils.misc import warn_once
from parlai.utils.io import PathManager
from pytorch_pretrained_bert import BertTokenizer
from parlai.agents.bert_ranker.bert_dictionary import BertDictionaryAgent
from .helpers import VOCAB_PATH, MODEL_FOLDER, download
class IndoBertDictionaryAgent(BertDictionaryA... | StarcoderdataPython |
6683291 | '''annotate_rnp - add information to the output from RNPxl
=======================================================
:Author: <NAME>
:Release: $Id$
:Date: |today|
:Tags: Python RNP Proteomics
Purpose
-------
This script takes the xlsx output from RNPxl and annotates the table with useful information for downstream ana... | StarcoderdataPython |
5000938 | import tensorflow as tf
import time
from easytransfer.utils.hooks import avgloss_logger_hook
import whale as wh
import os
class WhaleEstimator(object):
def __init__(self, model_fn, model_dir, num_model_replica,
num_accumulated_batches, keep_checkpoint_max, save_checkpoints_steps,
... | StarcoderdataPython |
4983563 | <reponame>WafflePersonThing/rust-bindings
import asyncio
import atexit
import logging
import os
import os.path as op
import sys
import time
import __main__ as main
from IPython import get_ipython
from IPython.terminal.pt_inputhooks import register
try:
from .pydatoviz import App, colormap, demo
except ImportError... | StarcoderdataPython |
12814414 | # coding=utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
import json
from typing import Text
from unittest import TestCase
import requests
from cornode import BadApiResponse, InvalidUri, TryteString
from cornode.adapter import HttpAdapter, MockAdapter, resolve_adapter
from... | StarcoderdataPython |
1721307 | class Solution:
def frequencySort(self, s):
freqs = {}
for c in s:
if c not in freqs:
freqs[c] = 1
else:
freqs[c] += 1
ans = ""
for k, v in sorted(freqs.items(), key=lambda x: x[1]):
ans += k * v
return ans[... | StarcoderdataPython |
6457709 | <reponame>lebrice/RoBO
import unittest
import numpy as np
from robo import initial_design
class TestInitialDesign(unittest.TestCase):
def setUp(self):
self.n_dim = 4
self.lower = np.zeros([self.n_dim])
self.upper = np.ones([self.n_dim])
self.n_points = 10
def test_init_rando... | StarcoderdataPython |
6611934 | # This is a scriptified version of the example here:
# https://github.com/kkaris/Network_Evaluation_Tools/blob/master/Network%20Evaluation%20Examples/Network%20Evaluation%20Example.ipynb
import argparse as ap
try:
from network_evaluation_tools import data_import_tools as dit
except ImportError: # Importing two ti... | StarcoderdataPython |
11368053 | <gh_stars>0
"""Test of envloader"""
import unittest
import test_initialize
import envloader
class TestEnvloader(unittest.TestCase):
def setUp(self):
test_initialize.init()
def test_load(self):
env = envloader.load(PREFIX='HOME')
self.assertIsNotNone(env.HOME)
if __name__ == '__mai... | StarcoderdataPython |
4854748 | from urllib.parse import urljoin
from http import HTTPStatus
import requests
import pytest
from pyembeddedfhir.fhir_runner import FHIRFlavor, FHIRRunner
@pytest.fixture(
scope="session",
params=[FHIRFlavor.HAPI, FHIRFlavor.MICROSOFT],
)
def running_fhir_url(request):
flavor = request.param
with FHIR... | StarcoderdataPython |
9671753 | <gh_stars>1-10
"""
Build cutadapt.
Cython is run when
* no pre-generated C sources are found,
* or the pre-generated C sources are out of date,
* or when --cython is given on the command line.
"""
import sys
import os.path
from distutils.core import setup, Extension
from distutils.version import LooseVersion
from cut... | StarcoderdataPython |
9692055 | <filename>TopQuarkAnalysis/TopEventProducers/python/tqafEventContent_cff.py
import FWCore.ParameterSet.Config as cms
tqafEventContent = [
## genEvt
'keep *_decaySubset_*_*',
'keep *_initSubset_*_*',
'keep *_genEvt_*_*',
## extras for event selection
'keep *_kinFitTtSemiLepEventSelection_*_*',
'keep *_fi... | StarcoderdataPython |
63304 | <gh_stars>1-10
from configparser import ConfigParser
config = ConfigParser()
config.add_section('system')
config.add_section('linkedin')
config.add_section('profiles_data')
config.add_section('profiles_data_by_name')
print("Welcome to the configuration process.")
linkedin_username = ""
while linkedin_username == ""... | StarcoderdataPython |
1915621 | from multiprocessing import Process
def say_hello(name='world'):
print("Hello, %s" % name)
p = Process(target=say_hello)
p.start()
p.join() | StarcoderdataPython |
3264620 | import time
from typing import Any, Dict, List, Union
from enum import Enum
from pydantic import parse_obj_as
import six
import prefect
from prefect import Task
from prefect.exceptions import PrefectException
from prefect.tasks.databricks.databricks_hook import DatabricksHook
from prefect.tasks.databricks.models impo... | StarcoderdataPython |
9614206 | <filename>tools/eqget/AUG.py<gh_stars>10-100
import h5py
import numpy as np
import sys
try:
sys.path.append('/afs/ipp/aug/ads-diags/common/python/lib')
from sf2equ_20200525 import EQU
import mapeq_20200507 as meq
AVAILABLE = True
except:
AVAILABLE = False
def isAvailable():
"""
Returns ... | StarcoderdataPython |
3352746 | """
bbofuser: apps.v1api.views
FILE: patients
Created: 8/16/15 11:21 PM
"""
from django.contrib import messages
__author__ = '<NAME>:@ekivemark'
import json
import requests
from collections import OrderedDict
from oauth2_provider.decorators import protected_resource
from xml.dom import minidom
from xml.etree impo... | StarcoderdataPython |
6510783 | import numpy as np
import pytest
import aesara
import aesara.tensor as tt
from aesara.tensor import fft
from tests import unittest_tools as utt
N = 16
class TestFFT:
def test_rfft_float(self):
# Test that numpy's default float64 output is cast to aesara input type
eps = 1e-1
def f_rfft... | StarcoderdataPython |
9738940 | class A196:
pass
| StarcoderdataPython |
158495 | <filename>lib/tagnews/crimetype/tag.py<gh_stars>10-100
import os
import pickle
import glob
import time
import pandas as pd
# not used explicitly, but this needs to be imported like this
# for unpickling to work.
from ..utils.model_helpers import LemmaTokenizer # noqa
"""
Contains the CrimeTags class that allows taggi... | StarcoderdataPython |
5163051 | from ..remote import RemoteModel
class DevicePhysicalNetworkExplorerInventorySummaryGridRemote(RemoteModel):
"""
| ``DevicePhysicalID:`` none
| ``attribute type:`` string
| ``DeviceID:`` none
| ``attribute type:`` string
| ``DeviceIPDotted:`` none
| ``attribute type:`` string
... | StarcoderdataPython |
9718850 | ##-----------------------------------------------------------
## Copyright 2020 Science and Technologies Facilities Council
## Licensed under the MIT License
## Author <NAME>, STFC Hartree Centre
import h5py
import numpy as np
import matplotlib.pyplot as plt
import argparse
#f = h5py.File('still_water.hdf5', 'r')
... | StarcoderdataPython |
1818072 | import atexit
def _encode_string(s):
encoded = s.encode('utf-8')
return encoded
def _decode_string(b):
return b.decode('utf-8')
_encode_string.__doc__ = """Encode a string for use by LLVM."""
_decode_string.__doc__ = """Decode a LLVM character (byte)string."""
_shutting_down = [False]
def _at_shut... | StarcoderdataPython |
5120579 | #!/usr/bin/env python
import argparse
import binascii
import errno
import fuse
import getpass
import os
import paramiko
import socket
import stat
import sys
import time
import uuid
fuse.fuse_python_api = (0, 2)
class BlitzClient(object):
def __init__(self, host, port):
self.host = host
self.port =... | StarcoderdataPython |
12854030 | <reponame>maxgerhardt/gd32-bootloader-dfu-dapboot
Import("env")
# original Makefile builds into dapboot.bin/elf, let's do the same
env.Replace(PROGNAME="dapboot")
| StarcoderdataPython |
12849995 | <reponame>pedrohenriquegomes/openwsn-sw<gh_stars>10-100
# Copyright (c) 2010-2013, Regents of the University of California.
# All rights reserved.
#
# Released under the BSD 3-Clause license as published at the link below.
# https://openwsn.atlassian.net/wiki/display/OW/License
import logging
log = logging.getLogge... | StarcoderdataPython |
11294368 | <gh_stars>0
# """
# This script can be used to evaluate a trained model on 3D pose/shape and masks/part segmentation. You first need to download the datasets and preprocess them.
# Example usage:
# ```
# python3 eval.py --checkpoint=data/model_checkpoint.pt --dataset=h36m-p1 --log_freq=20
# ```
# Running the above comm... | StarcoderdataPython |
3323098 | #!python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Th... | StarcoderdataPython |
6569969 | import pytz
from office365.runtime.client_value import ClientValue
class DateTimeTimeZone(ClientValue):
"""Describes the date, time, and time zone of a point in time."""
def __init__(self, datetime=None, timezone=None):
"""
:param str timezone: Represents a time zone, for example, "Pacific S... | StarcoderdataPython |
11357676 | <reponame>Forward83/staff_info
import copy
import getpass
import subprocess
from db.connectors import connection_factory
from settings import DB_CREDENTIALS, DB_TYPE
admin_credential = copy.deepcopy(DB_CREDENTIALS)
del admin_credential['db']
cnx, connector = None, None
# Create connection to mysql with admin credent... | StarcoderdataPython |
11259849 | import _plotly_utils.basevalidators
class GeoValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(self, plotly_name="geo", parent_name="choropleth", **kwargs):
super(GeoValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dflt... | StarcoderdataPython |
6640222 | from collections import OrderedDict
import numpy as np
def area_of_polygon(x, y):
"""Calculates the signed area of an arbitrary polygon given its vertices
http://stackoverflow.com/a/4682656/190597 (<NAME>)
http://softsurfer.com/Archive/algorithm_0101/algorithm_0101.htm#2D%20Polygons
"""
area = 0.0... | StarcoderdataPython |
3260034 | """获取python执行版本,用于兼容"""
import sys
PY2 = False
PY3 = False
def python_version():
version = sys.version[0]
# sys.version 返回版本信息字符串 3.7.0......
if version == '2':
global PY2
PY2 = True
else:
global PY3
PY3 = True
return
# 导包时直接执行获取到版本信息
python_version()
| StarcoderdataPython |
9654466 | # imports
import json
import time
import pickle
import scipy.misc
import skimage.io
import cv2
import caffe
import numpy as np
import os.path as osp
from random import shuffle
from PIL import Image
import random
class ImageSegDataLayer(caffe.Layer):
"""
This is a simple syncronous datalayer for training a D... | StarcoderdataPython |
12810988 | from .basic_transform import BasicTransform
from typing import List
import numpy as np
class Translation (BasicTransform):
"""
Translates the image along the y-axis and colors the remaining part of the image with the chosen color.
Parameters
----------
shift_along_x : int
Distance of... | StarcoderdataPython |
3425668 | # Copyright 2020-2022 OpenDR European Project
#
# 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 law or agree... | StarcoderdataPython |
345160 | <filename>txros/src/txros/test/test_nodehandle.py
from __future__ import division
from twisted.internet import defer
from twisted.trial import unittest
from txros import util
from txros.test import util as test_util
class Test(unittest.TestCase):
@defer.inlineCallbacks
def test_creation(self):
yiel... | StarcoderdataPython |
95975 | <reponame>rafi16jan/rapyd-framework<gh_stars>10-100
from javascript import Object, asynchronous
from .. import get_db, tools, data
@asynchronous
def init(promise, app):
get_db()
promise.wait()
data.run().wait()
Object.get('Module', 'mount_component').call(app.toRef())
return
def init_compile():
... | StarcoderdataPython |
3282337 | from .utils import check_interact, check_close, check_record
from core import Env
from core.env import env_dict
def test_nes(MockAgent):
for name in [key for key, val in env_dict.items() if "procgen" in str(val)]:
env = Env(name)
agent = MockAgent(env.state_size, env.action_size, env.action_type)... | StarcoderdataPython |
6569510 | from setuptools import setup, find_packages
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
# get version from __version__ variable in tinymce_editor/__init__.py
from tinymce_editor import __version__ as version
setup(
name='tinymce_editor',
version=version,
description='tinyM... | StarcoderdataPython |
18220 | <gh_stars>0
import requests
from lxml import html
from bs4 import BeautifulSoup
import json
import codecs
import re
#In this variable I will store the information as a dictionary with this structure:
# {number : "Name"}
ms_dict = {}
links_dict = {"links" : []}
for index in range(1,27000):
print(index)
page = requ... | StarcoderdataPython |
6423059 | import matplotlib.pyplot as plt
sports = ['Biathlon', 'Bobsleigh', 'Curling', 'Ice Hockey', 'Luge', 'Skating', 'Skiing']
medals = [27, 26, 30, 214, 8, 121, 153]
width = 0.35
x_labels = [0, 50, 100, 150, 200]
y_labels = ['Biathlon', 'Bobsleigh', 'Curling', 'Ice Hockey', 'Luge', 'Skating', 'Skiing']
plt.xlabel("Sp... | StarcoderdataPython |
317744 | import re
class VE(object):
""" Create a VE object """
def __init__(self, lines):
self.id = 0
self.name = ""
self.ospf = dict()
self.ipaddress = []
self.helper = []
self.pim = 0
self.mtu = 0
self.p2p = 0
self.p2p6 = 0
self.ip6addre... | StarcoderdataPython |
12837583 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-04 00:00
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('intake', '0030_add_visitor_model'),
]
operations = [
migrations.AlterModelOptions(
... | StarcoderdataPython |
5100345 | <reponame>vkpro-forks/python-zhmcclient
# Copyright 2017 IBM Corp. 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
#
# U... | StarcoderdataPython |
147894 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-09 21:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import multiselectfield.db.fields
class Migration(migrations.Migration):
dependencies = [
('filer',... | StarcoderdataPython |
9646827 | import traceback
import gevent
import structlog
from gevent.event import AsyncResult
log = structlog.get_logger(__name__)
def raise_on_failure(raiden_apps, test_function, **kwargs):
"""Wait on the result for the test function and any of the apps.
This utility should be used for happy path testing with more... | StarcoderdataPython |
6602556 | <gh_stars>100-1000
from rx import config
from rx.core import Observer, ObservableBase, Disposable
from rx.internal import DisposedException
from .anonymoussubject import AnonymousSubject
from .innersubscription import InnerSubscription
class Subject(ObservableBase, Observer):
"""Represents an object that is both... | StarcoderdataPython |
6456501 | <gh_stars>1-10
import destructify
import enum
from binascii import crc32
class ChunkType(destructify.PseudoMemberEnumMixin, enum.Enum):
IHDR = "IHDR"
IEND = "IEND"
TEXT = "tEXt"
PHYS = "pHYs"
PLTE = "PLTE"
class ColorType(enum.IntEnum):
GrayScale = 0
RGB = 2
Palette = 3
GrayScale... | StarcoderdataPython |
12860709 | # Import the required 'libraries' for pin definitions and PWM
from machine import Pin, PWM
# Also import a subset for sleep and millisecond sleep. If you just import
# the utime you will have to prefix each call with "utime."
from utime import sleep, sleep_ms
# Define what the buzzer object is - a PWM output o... | StarcoderdataPython |
3439683 | _base_ = [
'../../_base_/datasets/cifar100/metrics_umap.py',
'vit_small_dec6_dim512_8xb64_accu8_cos_ep1000.py',
]
| StarcoderdataPython |
11291655 | <reponame>SilasPDJ/autoesk<filename>default/settings/set_paths.py<gh_stars>0
from .now import Now
class SetPaths(Now):
# the class Now IS NOT large
def __get_atual_competencia_file(self):
import os
f = '\\get_atual_competencia.txt'
dir_only = os.path.dirname(__file__)
project... | StarcoderdataPython |
12810781 | from django.db import connection
def auto_dolt_commit_migration(sender, **kwargs):
msg = "completed database migration"
author = "nautobot <<EMAIL>>"
with connection.cursor() as cursor:
cursor.execute("SELECT dolt_add('-A') FROM dual;")
cursor.execute(
f"""
SELECT d... | StarcoderdataPython |
5014619 | <gh_stars>1-10
from spytest import st, tgapi, tgapi
import utilities.common as utils
import apis.system.port as portapi
def log_info(fmt, *args):
st.log(fmt % args)
def warn(fmt, *args):
st.warn(fmt % args)
def trace(dut, local, partner, remote, status):
#print(dut, local, partner, remote, status)
p... | StarcoderdataPython |
8170913 | <gh_stars>0
#######################################################
# Main APP definition.
#
# Dash Bootstrap Components used for main theme and better
# organization.
#######################################################
import dash
import dash_bootstrap_components as dbc
app = dash.Dash(__name__, external_styleshe... | StarcoderdataPython |
4963573 |
from django.conf import settings
from attributes import defaults
ATTRIBUTES_CATEGORY_MODEL = getattr(
settings, 'ATTRIBUTES_CATEGORY_MODEL', defaults.ATTRIBUTES_CATEGORY_MODEL)
ATTRIBUTES_ENTRY_MODEL = getattr(
settings, 'ATTRIBUTES_ENTRY_MODEL', defaults.ATTRIBUTES_ENTRY_MODEL)
| StarcoderdataPython |
3220596 | <gh_stars>1-10
#! /usr/bin/env python
## Hey, Python: encoding=utf-8
#
# Copyright (c) 2007-2010 <NAME> (<EMAIL>)
# Licensed under the terms of the MIT license.
from __future__ import with_statement
import justrok
from justrok import util
from justrok.enumerations import EngineState, ScrobbleServer
import appdirs
im... | StarcoderdataPython |
8013537 | <filename>tests/test_smoke.py
import pytest
@pytest.mark.smoke
def test_import():
import dovpanda | StarcoderdataPython |
1690270 | <filename>output/models/ms_data/complex_type/ct_z006_xsd/__init__.py<gh_stars>1-10
from output.models.ms_data.complex_type.ct_z006_xsd.ct_z006 import Root
__all__ = [
"Root",
]
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.