id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11265677 | import time
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test import tag
from django.urls import reverse
from selenium import webdriver
from selenium.webdriver.common.action_chains import ... | StarcoderdataPython |
1734717 | # Copyright 2019 Jetperch 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | StarcoderdataPython |
1908745 | <gh_stars>0
#!/usr/bin/env python
#===========================================================================
#
# Produce plots for cov_to_mom output
#
#===========================================================================
from __future__ import print_function
import os
import sys
import subprocess
from optpa... | StarcoderdataPython |
102900 | <filename>prog.py
import sys
print 'what is your name?'
sys.stdout.flush()
name = raw_input()
print 'your name is ' + name
sys.stdout.flush()
| StarcoderdataPython |
9708774 | <reponame>marc-ortuno/Vocal-Percussion-Classification-for-Real-Time-Context
import numpy as np
from interfaces import pre_processing, activity_detection, feature_extraction, classificator
import pandas as pd
# noinspection INSPECTION_NAME
def init_pre_processing(by_pass=False, bands = 8):
global pre_processing_by_... | StarcoderdataPython |
4979617 | <reponame>martinmcbride/python-imaging-book-examples
# Author: <NAME>
# Created: 2021-05-14
# Copyright (C) 2021, <NAME>
# License: MIT
# Colorize a greyscale image
from PIL import Image, ImageOps
image = Image.open('boat-small-grayscale.jpg')
# Colorise blue to white
result_image = ImageOps.colorize(image, 'darkb... | StarcoderdataPython |
5120061 | <reponame>naotohori/cafysis<filename>dat_hb_cor_from_con.py<gh_stars>1-10
#!/usr/bin/env python
# IDX TYP CG1 NT1 CG2 NT2 DST REF
# 1 CAN 11 C03B 56 G18B 5.746 5.655
CLM_HB_IDX = 1 - 1
#CLM_HB_TYP = 2 - 1
CLM_HB_CG1 = 3 - 1
CLM_HB_NT1 = 4 - 1
CLM_HB_CG2 = 5 - 1
CLM_HB_NT2 = 6 - 1
#CLM_HB_DST = 7 ... | StarcoderdataPython |
8024209 | from django import forms
from .models import (
Book,
Category,
Shelf,
Author
)
class BookCreationAddForm(forms.ModelForm):
class Meta:
model = Book
fields = ('name', 'author', 'category',
'amount', 'price', 'image', 'shelf', )
class CategoryCreationForm(forms... | StarcoderdataPython |
3202742 | from collections import deque
import collections
import copy
def loadGraphFromFile(filename):
rddId2Info, src2dest, dest2src = {}, {}, {}
with open(filename) as f:
for line in f:
line = line.strip().split("\t")
rddId = int(line[0])
parentIDList = list(map(int, line[1]... | StarcoderdataPython |
12849188 | #!/usr/bin/env python
# coding: utf-8
# In[5]:
import pandas as pd
import numpy as np
import glob,os
from glob import iglob
#import scanpy as sc
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import RocCurveDisplay
from sklearn.datasets import load_wine
from skle... | StarcoderdataPython |
5121490 | <reponame>spacemanspiff2007/aerich<filename>aerich/models.py
from tortoise import Model, fields
MAX_VERSION_LENGTH = 255
class Aerich(Model):
version = fields.CharField(max_length=MAX_VERSION_LENGTH)
app = fields.CharField(max_length=20)
content = fields.JSONField()
class Meta:
ordering = ["... | StarcoderdataPython |
1641352 | """ The signals module provides classes to build buy/sell signals
Notes
------
All strategies should inherit from BaseSignal, and provide a request_historical
method. For details of this method see docstring of base/BaseSignal or the
request_historical method in ZeroCrossBuyUpSellDown in this module.
"""
#from abc imp... | StarcoderdataPython |
6623065 | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock, Mock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core.misc import logger
from qrl.core.AddressState import AddressState
from qrl.core.ChainManager import ChainManager
from qrl.core.TransactionInfo import TransactionInfo
... | StarcoderdataPython |
1909473 | for i in range(10):
print(i)
print('=====')
for i in range(0,10):
print(i)
print('=====')
for i in range(0,10,1):
print(i)
print('=====')
i=0
while i<10:
print(i)
i = i+1
print('=====')
| StarcoderdataPython |
3481680 | <reponame>claydodo/potty
class SessionStatus(object):
def __init__(self, session_id, is_alive=None, expire_dt=None, **kwargs):
self.session_id = session_id
self.is_alive = is_alive
self.expire_dt = expire_dt
| StarcoderdataPython |
11344326 | # -*- coding: utf-8 -*-
import random
class Tile:
def __init__(self, coordinates = (0, 0)):
self.location = coordinates
self.hive = False
#Is this tile a food source?
if random.random() > 0.99:
self.foodSource = True
self.availableFood = int(random.gauss(50... | StarcoderdataPython |
37199 | <filename>tools/check_encrypted_hash.py
import sys
sys.path.insert(0, './app/app')
from tools import decrypt, check_hash # noqa
# sys.argv[1] = plain text
# sys.argv[2] = hash to compare
print(check_hash(sys.argv[1], decrypt(sys.argv[2])))
| StarcoderdataPython |
3553113 | import xgboost as xgb
import time
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.metrics import precision_score, recall_score, roc_auc_score, accuracy_score
from sklearn.externals import joblib
def load_data(file_path):
... | StarcoderdataPython |
272569 | <filename>normflowpy/flows/helpers.py<gh_stars>0
import torch
def safe_log(x: torch.Tensor, eps=1e-22) -> torch.Tensor:
return torch.log(x.clamp(min=eps))
| StarcoderdataPython |
9735331 | # coding: utf8
def get_caps_filename(norm_t1w):
"""Generate output CAPS filename from input CAPS filename
Args:
norm_t1w: T1w in Ixi549Space space
(output from t1-volume-tissue-segmentation)
Returns:
Filename (skull-stripped T1w in Ixi549Space space) for t1-extensive pipeline... | StarcoderdataPython |
264956 | import os
import traceback
from flask_restful import Resource
from flask_uploads import UploadNotAllowed
from flask import request, send_file
from flask_jwt_extended import jwt_required, get_jwt_identity, get_jwt_claims, jwt_optional
from marshmallow import ValidationError
from helpers import image_helper
from helpers... | StarcoderdataPython |
3281959 | <filename>backend/file_service.py
import uuid
from pydub import AudioSegment
from google.cloud import storage, speech
from google.cloud.speech import enums
from google.cloud.speech import types
from google.protobuf.json_format import MessageToJson
from oauth2client.client import GoogleCredentials
from googleapiclient i... | StarcoderdataPython |
6507590 | <filename>app/grandchallenge/challenges/admin.py
from django.contrib import admin
from grandchallenge.challenges.models import (
BodyRegion,
BodyStructure,
Challenge,
ChallengeSeries,
ExternalChallenge,
ImagingModality,
TaskType,
)
admin.site.register(Challenge)
admin.site.register(Externa... | StarcoderdataPython |
11207062 | <filename>external_tools/src/main/python/images/ValidateFileIntegrity.py
"""
Validate the integrity of image files
In data-release 7 and 8 we had issues with image files that were corrupt.
This was causing problems when Omero tried to upload them.
This script checks the filetypes specified and reports... | StarcoderdataPython |
46152 | <gh_stars>0
from django.conf.urls import url
from . import views
from .views import HotDweetFeed, NewDweetFeed, RandomDweetFeed
from .views import TopWeekDweetFeed, TopMonthDweetFeed, TopYearDweetFeed, TopAllDweetFeed
from .views import NewHashtagFeed, TopHashtagFeed
urlpatterns = [
url(r'^test/', HotDweetFeed.as_... | StarcoderdataPython |
1846381 | <filename>dependencies/vaticle/repositories.bzl
#
# Copyright (C) 2021 Vaticle
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any... | StarcoderdataPython |
1829705 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name="textextractor",
version='0.1',
description="Extracts relevant body of text from HTML page content.",
keywords='textextractor',
author='<NAME>',
author_email="Use the github issues",
url="https://github.com/prashanth... | StarcoderdataPython |
3453049 | import logging
class Transformer():
def __init__(self):
self._tags = {}
def predict(self, X, feature_names, meta):
logging.warning(X)
logging.warning(feature_names)
logging.warning(meta)
self._tags["value_at_three"] = X.tolist()
self._tags["current"] = "three"
... | StarcoderdataPython |
1976600 | # __future__ imports
from __future__ import print_function, unicode_literals
# Stdlib
import os
import sys
# External Libraries
import configobj
if sys.version_info < (3, 0, 0):
input = raw_input # noqa pylint: disable=all
class ConfigGenerator:
"""class for config generation"""
def get_tools(self):
... | StarcoderdataPython |
11220270 | <reponame>HydAu/AzureSDKForPython<filename>azure-mgmt-logic/azure/mgmt/logic/models/workflow_version.py<gh_stars>0
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft and contributors. All rights reserved.
#
# Licensed under the Apache License, Version ... | StarcoderdataPython |
8053077 | <reponame>RanulfoSoares/adminfuneraria<gh_stars>0
from kivymd.uix.screen import MDScreen
from kivy.storage.jsonstore import JsonStore
class JazigoCriarScreen(MDScreen):
"""
Example Screen
"""
dados = JsonStore('hello.json')
def inserir_dados(self):
rua = self.ids.rua.text
quadra... | StarcoderdataPython |
11376966 | <reponame>hickford/warehouse
# Copyright 2014 <NAME>
#
# 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 ag... | StarcoderdataPython |
4944483 | lista = [int(input(f'Digite um valor: ')) for c in range(0, 5)] # ou então pode ser lista = list()
lista.append(4)
lista.append(45)
lista.append(56)
lista.append(41)
print(lista)
lista[2] = 2
print(lista)
num = [4, 12, 5, 9, 1]
num[3] = 3
print(num)
num.append(11)
print(num)
num.sort()
print(num)
num.sort(reverse=Tru... | StarcoderdataPython |
6564357 | import asyncio
from concurrent.futures import ThreadPoolExecutor
from typing import Optional
import pytest
from mock import MagicMock, PropertyMock, call
from serial import Serial # type: ignore[import]
from opentrons.drivers.asyncio.communication import AsyncSerial
@pytest.fixture
def mock_timeout_prop() -> Proper... | StarcoderdataPython |
5003215 | import grokcore.view as grok
class Mammoth(grok.Context):
pass
class Index(grok.View):
pass
index = grok.PageTemplate("""\
<html>
<body>
<a tal:attributes="href static/file.txt">Some text in a file</a>
</body>
</html>""")
| StarcoderdataPython |
4868363 | <reponame>atx/dellfan
#! /usr/bin/env python3
import argparse
import psutil
import subprocess
import sys
import time
def ipmi_raw(bytes_):
subprocess.check_call(
["ipmitool", "raw"] + ["0x{:02x}".format(b) for b in bytes_]
)
# Magic bytes from
# https://www.reddit.com/r/homelab/comments/7xqb11/dell... | StarcoderdataPython |
1712592 | from datetime import timedelta
from oauth2_provider.oauth2_validators import (
OAuth2Validator,
GRANT_TYPE_MAPPING,
)
from oauth2_provider.models import AbstractApplication, get_grant_model
from oauth2_provider.settings import oauth2_settings
from oauth2_provider.scopes import get_scopes_backend
from django.uti... | StarcoderdataPython |
3308133 | #
# ESG request manager Python interface
#
from Fnorb.orb import CORBA
RequestManagerUnavailable = 'Request manager is unavailable.'
InvalidRequestManager = 'Invalid request manager!'
class RequestManager:
"""
ESG request manager singleton class. The first instance initializes CORBA
and creates the server... | StarcoderdataPython |
42532 | def validate_positive_integer(param):
if isinstance(param,int) and (param > 0):
return(None)
else:
raise ValueError("Invalid value, expected positive integer, got {0}".format(param))
| StarcoderdataPython |
11344660 | from keras_cv_attention_models.model_surgery.model_surgery import (
SAMModel,
DropConnect,
add_l2_regularizer_2_model,
convert_to_mixed_float16,
convert_mixed_float16_to_float32,
convert_to_fused_conv_bn_model,
get_actual_survival_probabilities,
get_actual_drop_connect_rates,
replace... | StarcoderdataPython |
291523 | <filename>tests/models_builder_result/h_record.py
# generated by ModelBuilder
from scielo_migration.isisdb.base_h_record import BaseArticleRecord
# generated by ModelBuilder
class ArticleRecord(BaseArticleRecord):
def __init__(
self, record, multi_val_tags=None,
data_dictionary=None):
... | StarcoderdataPython |
290889 | #Documentation: https://sefiks.com/2019/02/13/apparent-age-and-gender-prediction-in-keras/
import numpy as np
import cv2
from keras.models import Model, Sequential
from keras.layers import Input, Convolution2D, ZeroPadding2D, MaxPooling2D, Flatten, Dense, Dropout, Activation
from PIL import Image
from keras.pre... | StarcoderdataPython |
1918662 | <filename>lib/xupdate/writers.py
########################################################################
# amara/xupdate/writers.py
"""
XUpdate output writers
"""
class text_writer(object):
__slots__ = ('_data', '_write')
def __init__(self):
self._data = []
self._write = self._data.append
... | StarcoderdataPython |
6671805 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.6
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [md]
# # Predic... | StarcoderdataPython |
11389986 | <filename>superannotate/input_converters/converters/sagemaker_converters/sagemaker_to_sa_vector.py
import os
import json
from glob import glob
import numpy as np
def _create_classes(classes_map):
classes_loader = []
for key, value in classes_map.items():
color = np.random.choice(range(256), size=3)
... | StarcoderdataPython |
8006317 | <filename>tests/DjangoTest/DjangoTest/view_401_settings.py
from .settings import *
APP_ERROR_VIEW_PERMISSION = None
| StarcoderdataPython |
8010112 | <filename>pyethapp/tests/test_app.py
from builtins import str
import os
import pytest
from pyethapp import app
from pyethapp import config
from click.testing import CliRunner
genesis_json = {
"nonce": "0x00000000000000ff",
"difficulty": "0xff0000000",
"mixhash": "0xff000000000000000000000000000000000000000... | StarcoderdataPython |
8042170 | import os
from django.apps import AppConfig
class UnitDataConfig(AppConfig):
name = 'unit_data'
def ready(self):
"""起動処理
- モデルのデータベースインデクスの作成
"""
# 開発時のオートリロード機能による二重起動を防ぐためのおまじない
if not os.environ.get('RUN_MAIN'): return
from . import models
models.en... | StarcoderdataPython |
6577128 | <reponame>ncsl/virtual_cortical_stim_epilepsy
import os
import warnings
import matplotlib as mp
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
from natsort import index_natsorted, order_by_index
try:
import brewer2mpl
e... | StarcoderdataPython |
6540693 | from numpy import nan
from .check_nd_array_for_bad import check_nd_array_for_bad
def apply_function_on_2_1d_arrays(
_1d_array_0,
_1d_array_1,
function,
n_required=None,
raise_for_n_less_than_required=True,
raise_for_bad=True,
use_only_good=True,
):
is_good_0 = ~check_nd_array_for_bad... | StarcoderdataPython |
1774861 | """
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
"""
import unittest
from gremlin_python.structure.graph import Path, Edge, Vertex
from gremlin_python.process.traversal import T
from graph_notebook.network.EventfulNetwork import EVENT_ADD_NODE
from graph_notebo... | StarcoderdataPython |
1663887 | <reponame>EkremBayar/bayar
import pandas as pd
from plotnine import ggplot, aes, geom_point, labs, theme
_theme = theme(subplots_adjust={'right': 0.80})
df = pd.DataFrame({
'x': [1, 2],
'y': [3, 4],
'cat': ['a', 'b']
})
def test_labelling_with_colour():
p = (ggplot(df, aes('x', 'y', color='cat'))
... | StarcoderdataPython |
3483458 | <filename>conanfile.py
# The MIT License (MIT)
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... | StarcoderdataPython |
3343547 | <reponame>happy-jihye/Cartoon-StyleGAN
import os
import torch
import argparse
from argparse import Namespace
def prepare_data(dataset_folder, zip_file=None, target_size=256):
# Unzip
if zip_file is not None:
os.system(f'unzip {zip_file} -d "/{zip_file}"')
os.system(f'rm {zip_file}')
#... | StarcoderdataPython |
3381720 | from __future__ import print_function
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing
from BristolAnalysis.NTupleTools.options import CMSSW_MAJOR_VERSION, registerOptions, is2015, is2016
import sys
# register options
options = registerOptions(VarParsing('python'))
isData ... | StarcoderdataPython |
9776981 | # Generated by Django 3.2.8 on 2021-11-06 11:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quizz', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='category',
old_name='category_title',
... | StarcoderdataPython |
4921703 | from directory import Directory
from courses import CourseCatalog | StarcoderdataPython |
3525444 | """
A collection of base classes to use to shortcut having to import things.
This is used to provide a base class which can be imported into two locations
to identify a type, so that either location doesn't have to import the other.
"""
class DatabaseEntryType:
"""
A base class for `sunpy.database.tables.Dat... | StarcoderdataPython |
16460 | <gh_stars>1-10
#! /usr/bin/env python
"""
usage: demoselsim.py outfilename popn h pct
"""
import numpy
import sys
def pnext(AC, N, Nout, h, s):
AC = float(AC); N = float(N); h = float(h); s = float(s)
p = AC/(2*N)
w11 = 1+s; w12 = 1+h*s; w22 = 1
wbar = ((p**2) * w11) + (2*p*(1-p)*w12) + (((1-p)**2) * w22)
pdet ... | StarcoderdataPython |
4875326 | <filename>app/types.py<gh_stars>0
from __future__ import annotations
import json
from typing import Optional, Dict, List, Union, TypeVar
from functools import cached_property # type: ignore
from datetime import datetime
from pathlib import Path
from pydantic import BaseModel, Field, HttpUrl
from fastapi.responses im... | StarcoderdataPython |
11369873 | #!/usr/bin/env python3
# Copyright Catch2 Authors
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
from ConfigureTestsCommon import configure_and_build, ru... | StarcoderdataPython |
5026278 | <gh_stars>1-10
def is_leap_year(year):
return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)
def get_year_status(year):
return 'Високосный' if is_leap_year(year) else 'Обычный'
print(get_year_status(int(input())))
| StarcoderdataPython |
1672540 | """Editor related to `Shapes`.
As you can easily assumes, `editor` is a high-level api, so
* This sub-module can call other more premitive api freely.
* On contrary, the more premitive sub-modules should not call this.
"""
import numpy as np
import _ctypes
from pywintypes import com_error
from fairypptx import c... | StarcoderdataPython |
5044182 | # Generated by Django 3.1.2 on 2021-11-10 10:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app_api', '0014_wxuser'),
]
operations = [
migrations.AddField(
model_name='wxuser',
name='edu',
... | StarcoderdataPython |
283450 | # flake8: noqa
# import apis into api package
from xero_python.payrollnz.api.payroll_nz_api import PayrollNzApi
| StarcoderdataPython |
249147 | from .worker import NB201Worker
| StarcoderdataPython |
3429008 | <reponame>paulzzh/mahjong
# -*- coding: utf-8 -*-
import unittest
from mahjong.constants import EAST, SOUTH, WEST, NORTH, FIVE_RED_SOU
from mahjong.hand_calculating.hand import HandCalculator
from mahjong.hand_calculating.hand_config import HandConfig, OptionalRules
from mahjong.hand_calculating.yaku_config import Yak... | StarcoderdataPython |
11221517 | <filename>saka/serializers.py
from rest_framework import serializers
from . import models
from django.utils import timezone
class Cash_serializers(serializers.ModelSerializer):
class Meta:
model = models.Cash
fields = '__all__'
#read_only_fields = ("laboratoryid", 'analyteid', 'department'... | StarcoderdataPython |
335976 | <gh_stars>0
# from emuBot import
from definintions import *
import time
class orderSet(list):
def __sub__(self, y):
x = self
for a in y:
if a in x:
x.remove(a)
return x
class Reader(object):
def __init__(self, filename):
# Initialises the file to be ... | StarcoderdataPython |
1913054 | <gh_stars>0
# coding: utf-8
import numpy as np
x = np.arange(0, 6, 0.1)
y1 = np.sin(x)
y2 = np.cos(x)
def print_array(data):
datas = []
for i in data:
if float("%.3f" % abs(i)) == 0:
datas.append(float("%.3f" % abs(i)))
else:
datas.append(float("%.3f" % i))
print(da... | StarcoderdataPython |
292967 | <filename>data/external/repositories_2to3/120243/tradeshift-text-classification-master/src/ensemble.py<gh_stars>0
import pandas as pd
import subprocess, sys, os, time
start = time.time()
sub_dir=sys.argv[1]
cmd = 'pypy src/ensemble/ave41.py '+sub_dir
subprocess.call(cmd, shell=True)
cmd = 'pypy src/ensemb... | StarcoderdataPython |
4975471 | #!/usr/bin/env python
import os
import pytest
import gitkup
def test_setup_logging():
""" test logging.json configuration """
assert gitkup.setup_logging() is True
def test_setup_logging_missing():
""" test missing logging.json configuration """
with pytest.raises(SystemExit) as err:
gitkup... | StarcoderdataPython |
9731128 | from abc import abstractmethod
from typing import TypeVar, Union, Tuple
from ..sheet import IRow, ISheet
from ... import ex
# import ex.relational
class IRelationalRow(IRow):
@property
@abstractmethod
def sheet(self) -> 'IRelationalSheet':
pass
@property
@abstractmethod
def default_v... | StarcoderdataPython |
128452 | """
Main entry point of zserio pip module.
"""
import sys
import zserio.compiler
def main() -> int:
"""
Main entry point of zserio pip module.
This method envokes zserio compilers. It is called if zserio pip module is called on the command line
(using 'python3 -m zserio').
:returns: Exit value ... | StarcoderdataPython |
4922225 | import unittest
from g1.asyncs import kernels
from g1.asyncs.bases import queues
class QueuesTest(unittest.TestCase):
def test_queue_without_kernel(self):
self.assertIsNone(kernels.get_kernel())
checks = [
(queues.Queue, [1, 2, 3], [1, 2, 3]),
(queues.PriorityQueue, [1, 3... | StarcoderdataPython |
8180608 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import uvicorn
from _bareasgi import Application
from bareasgi_static import add_static_file_provider
from engine import knowledge, message
here = os.path.abspath(os.path.dirname(__file__))
app = Application()
app.http_router.add({'GET'}, '/knowled... | StarcoderdataPython |
6524184 | # local modules
import numpy,dill
from . import operators
from . import basis
from . import tools
__version__ = "0.3.4"
__all__ = ["basis","operators","tools"]
| StarcoderdataPython |
4912205 | # (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this... | StarcoderdataPython |
318117 | <reponame>ParspooyeshFanavar/pyibsng<filename>ibsng/handler/util/run_debug_code.py
"""Run debug code API method."""
from ibsng.handler.handler import Handler
class runDebugCode(Handler):
"""Run debug code method class."""
def control(self):
"""Validate inputs after setup method.
:return: Non... | StarcoderdataPython |
11350494 | frase = str(input('Insira uma frase: ')).strip().lower()
print('A letra "A" aparece {} vezes.'.format(frase.count('a')))
print('A primeira letra "A" apareceu na posição {}.'.format(frase.find('a') + 1))
print('A ultima letra "A" aparece na posição {}'.format(frase.rfind('a') + 1))
| StarcoderdataPython |
9772579 | import gym
reward_sum = 0
total_episode = 20
episode_count = 1
env = gym.make('Lis-v2')
while episode_count <= total_episode:
observation = env.reset()
for t in range(100):
action = env.action_space.sample() #take a random action
observation, reward, end_episode, info =env.step(action)
... | StarcoderdataPython |
1733313 | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .utils import GTextToolbar
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QFrame, QComboBox, \
QCheckBox, QLineEdit, QPushButton, QLabel, QGridLayout, \
... | StarcoderdataPython |
3500782 | # Generated by Django 2.2.10 on 2020-04-10 16:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0019_game_max_word_length'),
]
operations = [
migrations.AlterField(
model_name='game'... | StarcoderdataPython |
6499956 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#- Author : (DEK) <NAME>
# program100:
# Write a program to solve a classic ancient Chinese puzzle:
# We count 35 heads and 94 legs among the chickens and rabbits
# in a farm. How many rabbits and how many chickens do we have?
# Hint:
# Use for loop to iterate all p... | StarcoderdataPython |
3511644 | #CODIGO PARA MULTIPLES ROUTES EN FLASK PERSONALIZADAS SEGUN RUTA INGRESADA
#Nota: flask NO viene en librerias por defecto, debemos instalarla adicionalmente (pip install flask)
from flask import Flask
#Creamos web application llamada "app" (basada en Flask), con nombre del archivo actual (__name__)
app = Flask(__name... | StarcoderdataPython |
5008483 | from ..commandparser import Time
from ..discordbot import mute_user
import time
from forumsweats import db
name = 'gulag'
args = '[time]'
async def run(message, length_time: Time = Time(60)):
'Puts you in gulag for one minute (or however much time you specified). You cannot be rocked during this time.'
mute_remai... | StarcoderdataPython |
7816 | <reponame>headlessme/yotta
#!/usr/bin/env python
# Copyright 2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import unittest
# internal modules:
from . import util
from . import cli
Test_Outdated = {
'module.json':'''{
"name": "tes... | StarcoderdataPython |
5070153 | <filename>results/fig_01/main_get_cfgs.py
import numpy as np
def main(f_in, f_out):
def fetch_cfg(f_name):
data = np.load(f_name)
N = data['N']
h = data['h']
m = data['m']
cfg = data['cfg_fin']
return N, h, m, cfg
N, h_, m_, psi = fetch_cfg(f_in)
np.savez_... | StarcoderdataPython |
5001284 | <reponame>nevooronni/collabstudio<filename>collabstudio/tests.py<gh_stars>0
from django.test import TestCase
from django.contrib.auth.models import User
from .models import Profile,Tags,Project,Follow,Comments
class ProfileTestClass(TestCase):
'''
test case for our profie class
'''
def setUp(self):
'''
setup m... | StarcoderdataPython |
3221719 | <reponame>BuildJet/distdl
import numpy as np
import torch
import torch.nn.functional as F
from distdl.nn.halo_exchange import HaloExchange
from distdl.nn.mixins.halo_mixin import HaloMixin
from distdl.nn.mixins.pooling_mixin import PoolingMixin
from distdl.nn.module import Module
from distdl.utilities.slicing import a... | StarcoderdataPython |
1729322 | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
import traceback
import sys
import json
from django.shortcuts import render
from django.template import RequestCont... | StarcoderdataPython |
388882 | # -*- coding: utf-8 -*-
"""
Copyright 2019 <NAME> S.r.l.
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 |
6624044 | """
https://www.practicepython.org
Exercise 6: String Lists
2 chilis
Ask the user for a string and print out whether this string is a
palindrome or not. (A palindrome is a string that reads the same
forwards and backwards.)
"""
def palindrome_checker(s1):
for i in range(int(len(s1)/2)):
if s1[i] != s1[le... | StarcoderdataPython |
8077231 | # Copyright 2018 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distri... | StarcoderdataPython |
8059496 | <reponame>TobiasLundby/UAS-route-plan-optimization<filename>data_sources/weather/ibm.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
2018-01-05 TL First version
"""
"""
Description:
None
see: http://2017.compciv.org/guide/topics/python-standard-library/csv.html
see: https://docs.scipy.org/doc/numpy-1.13.0/user/ba... | StarcoderdataPython |
12803604 | <reponame>Elzei/show-off
from struct import pack, unpack, calcsize
dane = open('dane.dat', 'w')
toWrite = pack('c5shhl', 'w', 'ala ',
2, 4, 12)
dane.write(toWrite)
dane.close()
dane = open('dane.dat', 'r')
toRead = unpack('c5shhl', dane.read())
print toRead
| StarcoderdataPython |
5179266 | # The following script contains classes with necessary Blender operators
# for the Neural material approach in material generation and editing.
#
# Code from Neural Material paper is stored in neuralmaterial directory
# and is available on the following repository: https://github.com/henzler/neuralmaterial
import os
i... | StarcoderdataPython |
4879906 | <filename>pythia/learned/bonds.py
import tensorflow.keras as keras
import tensorflow.keras.backend as K
import numpy as np
import tensorflow as tf
@tf.custom_gradient
def _custom_eigvecsh(x):
# increase the stability of the eigh calculation by removing nans
# and infs (nans occur when there are two identical ... | StarcoderdataPython |
5127441 | <filename>hyperion/bin_deprec/eval-elbo-ubm.py
#!/usr/bin/env python
"""
Copyright 2018 Johns Hopkins University (Author: <NAME>)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
"""
Evaluate the likelihood of the ubm on some data
"""
import sys
import os
import argparse
import time
import logging
impo... | StarcoderdataPython |
225853 | <gh_stars>0
import random
import mediapipe as mp
import cv2
import torch
mpDraw = mp.solutions.drawing_utils
mpPose = mp.solutions.pose
pose = mpPose.Pose()
mpHolistic = mp.solutions.holistic
holistic = mpHolistic.Holistic()
mp_drawing_styles = mp.solutions.drawing_styles
class Model:
def __i... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.