id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3559574 | import voluptuous as vol
from esphomeyaml.automation import ACTION_REGISTRY
import esphomeyaml.config_validation as cv
from esphomeyaml.const import CONF_DATA, CONF_DATA_TEMPLATE, CONF_ID, CONF_PASSWORD, CONF_PORT, \
CONF_SERVICE, CONF_VARIABLES, CONF_REBOOT_TIMEOUT
from esphomeyaml.core import CORE
from esphomeya... | StarcoderdataPython |
3331643 | """Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from os import environ
from sys import path
# ######### PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the... | StarcoderdataPython |
4874561 | __author__ = 'RAEON'
from time import time
class Cell(object):
def __init__(self, id, x, y, size, color, virus, agitated, name):
self.id = id
self.x = x
self.y = y
self.interpolated_x = x
self.interpolated_y = y
self.last_update = time()
self.v... | StarcoderdataPython |
1781463 | # -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django import forms
class OTPControleForm(forms.Form):
""" Dit formulier wordt gebruikt om de OTP code te ontvangen van de gebruiker """
otp_code = for... | StarcoderdataPython |
3374694 | import matplotlib.pyplot as plt
import numpy as np
#x_length = [70, 90, 93.1, 115, 120, 125, 130, 135, 144] #black bars
#y_frequency = [1501, 936, 869, 587, 538, 488, 460, 429, 379] #measured frequency from black bars
#Fill in aquired lengths and frequency for your 13 bars.
x_length = [74.5, 79.2, 84.1, 86.8, 92.1... | StarcoderdataPython |
1979029 | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import gentools
try:
import wasp.settings as settings
import wasp.xmlobject as xmlobject
except ImportError:
import settings
import xmlobject
import optparse
import re
import os.path
import sys
class _Writer(object):
def __init__(self, generate... | StarcoderdataPython |
11202307 | import numpy as np
import pytest
import astropy.units as u
from ...constants import c, h
from ..quantum import (deBroglie_wavelength,
thermal_deBroglie_wavelength,
Fermi_energy,
Thomas_Fermi_length)
def test_deBroglie_wavelength():
dbwaveleng... | StarcoderdataPython |
8110323 | <reponame>drabusov/py-orbit
## \namespace orbit::utils::fitting
##
## Classes:
## - PolynomialFit - fitting a Function or SplineCH instances with the plynomial
from orbit.utils.fitting.PolynomialFit import PolynomialFit
from orbit.utils.fitting.general_minimization.SimplexSearch import SimplexSearchAlgorithm
from or... | StarcoderdataPython |
6704051 | import os
import torch
from ._trainer import Trainer
r"""
Base class for adversarial trainers.
Functions:
self.record_rob : function for recording standard accuracy and robust accuracy against FGSM, PGD, and GN.
"""
class AdvTrainer(Trainer):
def __init__(self, name, model):
super(AdvTrainer, self)... | StarcoderdataPython |
6582652 | print '***JUEGO DEL AHORCADO***'
from random import*
from turtle import*
setup(640,480,640,0)
title('EL JUEGO DEL AHORCADO')
def dibujar_ahorcado(errores):
pensize(4)
if errores==1:
goto(100,0)
elif errores==2:
penup()
goto(50,0)
pendown()
goto(50,150)
elif errores==3:
goto(120,150)
e... | StarcoderdataPython |
79080 | <reponame>Triple-Z/Python-Crash-Course
# 8-3
def make_shirt(size, string):
"""Make shirt"""
print('Size: ' + size + ', String: ' + string)
make_shirt('M', 'Hello, World')
make_shirt(size='M', string='Hello, World again')
# 8-4
def make_shirt(size='L', string='I love Python'):
"""Make python shirt"""
... | StarcoderdataPython |
3220777 | '''
'''
from common.base import Base
class Cancel(Base):
cancel_loc = ('link text','取消订单')
def cancel(self):
self.click(self.cancel_loc)
| StarcoderdataPython |
6476968 | #!/usr/bin/env python3
import functools
import sys
import qtutil
from PyQt5.QtGui import *
from .util.plugin import PluginDefault
from .util.plugin import WidgetDefault
from .util import project_functions as pfs
class Widget(QWidget, WidgetDefault):
class Labels(WidgetDefault.Labels):
example_sb_label = "Exa... | StarcoderdataPython |
8153496 | from models import (
familia,
denuncia,
caso,
crianca
) | StarcoderdataPython |
11212560 | <reponame>victorleal/Covid19-Twitter-Tracker
import os
import sys
sys.path.append("../..") # Adds higher directory to python modules path.
from functools import partial
from multiprocessing import cpu_count
from concurrent.futures import ProcessPoolExecutor
import time
from decouple import config
from ...database.... | StarcoderdataPython |
5020737 | import logging
import boto3
from contextlib import closing
from django.conf import settings
from django.core.files.temp import gettempdir, NamedTemporaryFile
client = boto3.client('polly')
logger = logging.getLogger(__name__)
def synthesize_speech_from_page(request, page):
"""
Synthesize speech from a spe... | StarcoderdataPython |
3571954 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
"""infer_attributes_gat - Infer attributes of an architecture graph using
a graph attention network"""
# =============================================================================
# Imports
... | StarcoderdataPython |
4838367 | import numpy as np
from ...core.utils import as_id_array
from ...graph.structured_quad.structured_quad import StructuredQuadGraphTopology
from . import _neighbors_at_link
def neighbors_at_link(shape, links):
"""Get neighbor links.
Examples
--------
>>> import numpy as np
>>> from landlab.compone... | StarcoderdataPython |
167605 | <gh_stars>10-100
# Copyright (c) 2012 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this lis... | StarcoderdataPython |
8037946 | <reponame>faro1219/wot
# -*- coding: utf-8 -*-
from matplotlib import patches
from matplotlib import pyplot
def __make_figure(y = 1, x = 1, projection=None):
pyplot.clf()
return pyplot.subplots(y, x, figsize=(8 * x, 6 * y), projection=None)
def plot_2d_dataset(figure, dataset, x = 0, y = 1, title=None):
... | StarcoderdataPython |
1745122 | <reponame>chrismurf/simulus<filename>examples/basics/twosims.py
import simulus
def handle(sim):
print("'%s' handles event at time %g" % (sim.name, sim.now))
sim1 = simulus.simulator(name="sim1", init_time=100)
sim2 = simulus.simulator(name="sim2", init_time=-100)
for i in range(5, 100, 20):
sim1.sched(handle... | StarcoderdataPython |
190825 | <gh_stars>100-1000
"""
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import Typed, Instance, Property, Dict, set_default, observe
from enamlnative.widgets.li... | StarcoderdataPython |
3409955 | """Ray-Horovod Job unit tests.
This is currently not run on the Ray CI.
"""
import os
import sys
import socket
import pytest
import ray
from ray import services
import torch
from horovod.common.util import gloo_built
from horovod.ray.runner import (BaseHorovodWorker, NodeColocator, Coordinator,
... | StarcoderdataPython |
3499686 | <reponame>Metnew/neural-finance
import json
from flask import request, jsonify, g
import flask_restful as restful
from server import mongo
from datetime import timedelta, datetime
import numpy as np
import csv
def to_float(a):
return float(a.replace(',', '.'))
class Finance_Data(restful.Resource):
def get(... | StarcoderdataPython |
3318672 | <reponame>avik-pal/social-driving<filename>sdriving/environments/highway.py<gh_stars>100-1000
import math
from collections import deque
from itertools import product
import numpy as np
import torch
from gym.spaces import Box, Discrete, Tuple
from sdriving.environments.base_env import BaseMultiAgentDrivingEnvironment
... | StarcoderdataPython |
5104661 | def bit(n, data=''):
if n <0:
print("Only Positive & Zero Number ! ! !")
return 0
if n == 0:
print(0)
return 0
if len(data) == n:
print(data)
else:
bit(n, data + '0')
bit(n, data + '1')
x = int(input("Enter Number : "))
bit(x) | StarcoderdataPython |
318792 | # This Python file uses the following encoding: utf-8
import unittest
from scripts.src.WordListCreator import WordListCreator
class TestWordListCreator(unittest.TestCase):
scenarios_get_words = [
([], []),
(["\n"], []),
(["# any line starting with hash"], []),
(["aaaa\n"], ["aaaa"... | StarcoderdataPython |
131540 | # This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py
# Django settings file for a project based on the playdoh template.
# import * into your settings_local.py
import logging
import os
import socket
from django.utils.functio... | StarcoderdataPython |
116904 | #!/usr/env python
from pybedtools import BedTool as Bed
from Cigar import Cigar
import numpy as np
def overlap(s1,e1,s2,e2):
s=sorted([s1,s2])
e=sorted([e1,e2])
ovr = e[0]-s[1]+1
o=sorted([float(ovr)/(e2-s2+1),float(ovr)/(e1-s1+1)])
return o[0]
def within(p,ci):
if ci[0]<=p<=ci[1]: return True
else: return False... | StarcoderdataPython |
9749334 | <reponame>ddebrunner/streamsx.topology
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017,2019
"""
SPL toolkit integration.
********
Overview
********
SPL operators are defined by an SPL toolkit. When a ``Topology``
contains invocations of SPL operators, their defining toolkit must
be ... | StarcoderdataPython |
12862158 | <filename>wildlifelicensing/apps/returns/models.py
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres.fields.jsonb import JSONField
from django.core.exceptions import ValidationError
import datapackage
import jsontableschema
from ledger.accounts.models import Revisioned... | StarcoderdataPython |
3495959 | <gh_stars>0
# This file is part of spot_motion_monitor.
#
# Developed for LSST System Integration, Test and Commissioning.
#
# See the LICENSE file at the top-level directory of this distribution
# for details of code ownership.
#
# Use of this source code is governed by a 3-clause BSD-style
# license that can be found... | StarcoderdataPython |
6493614 | <filename>tests/test_slice.py<gh_stars>1-10
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__date__ = "30 Jun 2021"
def parse_slice_str(slice_str):
parts = slice_str.split(':')
if len(parts) == 1:
try:
return int(slice_str)
except ValueError:
return slice(None)
intPa... | StarcoderdataPython |
9726813 | <gh_stars>0
from app.main.conf import conf_data
from app.main.server.hostgroup import HostGroupCmd
from app.utils.NetCache import NetCache
from app import work_log
class Nginx_Acl(object):
"""docstring for Nginx_Acl"""
def __init__(self):
super(Nginx_Acl, self).__init__()
self.user = conf_dat... | StarcoderdataPython |
1902360 | from .asteroid_bot import AsteroidBot # noqa: F401
from .checks import ( # noqa: F401
_cog_is_enabled,
bot_owner_or_permissions,
cog_is_enabled,
is_administrator_or_bot_owner,
is_enabled,
)
from .consts import DiscordColors, SystemChannels # noqa: F401
from .database import ( # noqa: F401
Gl... | StarcoderdataPython |
1939712 | <gh_stars>0
from factory import Faker, Sequence, make_factory
from lms import models
HGroup = make_factory( # pylint:disable=invalid-name
models.HGroup,
name=Sequence(lambda n: f"Test Group {n}"),
authority_provided_id=Faker("hexify", text="^" * 40),
)
| StarcoderdataPython |
3258990 | DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "app_test",
"USER": "go",
"PASSWORD": "go",
"HOST": "localhost",
}
}
CACHES = {
'default': {
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': 'localh... | StarcoderdataPython |
248442 | import torch.nn as nn
from pedrec.configs.pedrec_net_config import PedRecNetConfig
from pedrec.networks.net_pedrec.pedrec_conv_transpose_base import PedRecConvTransposeBase
from pedrec.networks.net_pedrec.pedrec_pose_head_2d import PedRecPose2DHead
from pedrec.networks.net_resnet.resnet_feature_extractor import ResNet... | StarcoderdataPython |
8146867 | import os
import numpy as np
from PIL import Image
import tensorflow as tf
from tensorflow.python.platform import gfile
from scipy.misc import imsave
## Convert BAIR robot pushing data to numpy to use with PyTorch
## Based on <NAME>'s script: https://github.com/edenton/svg/blob/master/data/convert_bair.py
def convert... | StarcoderdataPython |
8075699 | <gh_stars>100-1000
import unittest
from unittest import TestCase
from evcouplings.utils import *
import tempfile
class TestUtilsHelpers(TestCase):
def test_wrap(self):
"""
Test whether string is correctly wrap
"""
out = wrap("Test", width=2)
self.assertEqual("Te\nst", out)... | StarcoderdataPython |
1954344 | #!/usr/bin/env python3
from .metric import SourceAndReferencedMetric
from collections import Counter
import sacrebleu
import sacremoses
class SARI(SourceAndReferencedMetric):
"""SARI score for evaluating paraphrasing and other text generation models.
The score is introduced in the following paper:
Opt... | StarcoderdataPython |
103377 | <gh_stars>0
def convolve(pixel, kernel, i, j):
return pixel[i][j]
fin = open("image.ppm", "rb")
#reading the file from image.ppm
kernel_identity = [
[0, 0, 0],
[0, 1, 0],
[0, 0, 0]
]
#file headers getting stored at _raw
filetype_raw = next(fin)
width_raw = next(fin)
height_raw = next(fin)
maxval_raw = ... | StarcoderdataPython |
4894349 | from sklearn import cluster, datasets
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# import pylab
df = pd.read_excel('120_data.xlsx', header=None)
X = df.to_numpy()
# KMeans 演算法
kmeans_fit = cluster.KMeans(n_clusters = 3).fit(X)
# 印出分群結果
cluster_label... | StarcoderdataPython |
3437917 | <reponame>giyyanan/liota
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------#
# Copyright © 2015-2016 VMware, Inc. All Rights Reserved. #
# #
# Licensed under the BSD 2-Cla... | StarcoderdataPython |
1693813 | from django.db import models
from .ubicacion import Ubicacion
class Nodo(models.Model):
ubicacion = models.OneToOneField(Ubicacion, on_delete=models.CASCADE, verbose_name="Ubicacion")
nombre = models.CharField(max_length=100)
def __str__(self):
return self.nombre | StarcoderdataPython |
11318125 | <gh_stars>0
# one_step_forward_euler.py
import numpy as np
from ..model import *
def get_one_step_forward_euler_method(mu,lam,gamma):
compute_one_step_forward_euler_method=get_compute_one_step_forward_euler_method(mu,lam,gamma)
zero_mat = np.zeros((4,3))
@njit
def one_step_forward_euler_method(t, K_index, element_... | StarcoderdataPython |
1945888 | """
BUFR - Hodograph
"""
# (C) Copyright 2017- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its ... | StarcoderdataPython |
1806183 | <filename>examples/step_dm_control_env.py
#!/usr/bin/env python3
"""Example of how to load, step, and visualize an environment.
This example requires that garage[dm_control] be installed.
"""
import argparse
from garage.envs.dm_control import DmControlEnv
parser = argparse.ArgumentParser()
parser.add_argument('--n_s... | StarcoderdataPython |
3330053 | <reponame>coquid/pygcn
from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from pygcn.utils import load_my_data
from pygcn.models import GCN, MyGCN_v1, MyGCN_v2, MyGCN_v3, MyGCN_... | StarcoderdataPython |
3435302 | # Copyright 2020 Board of Trustees of the University of Illinois.
#
# 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 ... | StarcoderdataPython |
301643 | <filename>pipeline/__init__.py<gh_stars>1-10
from pipeline.pipeline import Pipeline as Pipeline
from pipeline.pipeline import Stream as Stream
| StarcoderdataPython |
5031269 | <filename>ChatBot/chatbot_search/chatbot_tfserving/TFServing_preprocess.py<gh_stars>1000+
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/4/15 21:59
# @author : Mo
# @function: encode of bert-whiteing
from __future__ import print_function, division, absolute_import, division, print_function
# 适配linux
i... | StarcoderdataPython |
9680465 | <reponame>QuatZo/swstats<filename>website/celery.py<gh_stars>1-10
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from celery.schedules import crontab
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'swsta... | StarcoderdataPython |
9647510 | __author__ = "<NAME> (<EMAIL>)"
__version__ = "0.0.1"
__date__ = "$Date: 2014/07/09 $"
from cell import Cell
class Playground(object):
"""
An abstract Cell playground.
"""
def __init__(self, n):
"""
This default initializer inits with n random cells.
In general, initializing a ... | StarcoderdataPython |
9600137 | # Load in a .x3d file, store to a .dgs file with a checkerboard pattern
import sys
import os
import numpy as np
import dataguzzler as dg
import dg_file as dgf
import dg_metadata as dgm
try:
from cStringIO import StringIO # python 2.x
pass
except ImportError:
from io import StringIO # python 3.x
pass
... | StarcoderdataPython |
175669 | """Módulo com os modelos da Avaliação."""
from datetime import date, datetime
from enum import Enum, auto
from project.configs.server import server
db = server.db
class TypeRate(Enum):
"""Enum com os tipos de Avaliações possíveis."""
ANIME = "Anime"
MOVIE = "Movie"
SERIES = "Series"
CARTOON = ... | StarcoderdataPython |
8064491 | from direct.showbase.ShowBase import ShowBase
from direct.interval.IntervalGlobal import LerpFunc
from direct.gui.DirectGui import DirectButton
from direct.gui.DirectGui import DGG
from panda3d_logos.splashes import Colors
from panda3d_logos.splashes import Pattern
from stageflow import Flow
from stageflow import Sta... | StarcoderdataPython |
1729780 | import cv2
import random
import numpy as np
class RandomAdjustHue(object):
"""Adjust the hue of the given image using a randomly chosen amount in the given range.
Args:
min_angle (int): Minimum of the amount added to the hue channel.
max_angle (int): Maximum of the amount added... | StarcoderdataPython |
1921860 | # import argparse
# import torch.nn as nn
# import torch.nn.functional as F
# import torch.optim as optim
# from torch.optim.lr_scheduler import StepLR
# import os
# from PIL import Image
# from copy import deepcopy
# from tqdm import tqdm
# import time
from data.domain import *
import torch
import numpy as np
np.set... | StarcoderdataPython |
214300 | __author__ = 'HaoBin'
from XGraph2 import *
import copy, cProfile
def check_graph(graph):
# this method checks the graph for Eulerian Trail validity
# which is: max 1 vertex with inD-outD=1 and max 1 vertex with outD-inD=1,
# and all other vertices must have equal inD and outD
# O(|V|^2) complexity
... | StarcoderdataPython |
362385 | <reponame>healem/sauri
class Type:
DS18B20 = 'ds18b20'
TEMPC = 'C'
TEMPF = 'F' | StarcoderdataPython |
336463 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
from useradmin.models import HuePermission
try:
perm = HuePermission.objects.get(app='metastore', act... | StarcoderdataPython |
6400706 | <reponame>palisadoes/pattoo
#!/usr/bin/env python3
"""Test pattoo configuration."""
import os
import unittest
import sys
from random import random
import time
# Try to create a working PYTHONPATH
EXEC_DIR = os.path.dirname(os.path.realpath(__file__))
ROOT_DIR = os.path.abspath(os.path.join(
os.path.abspath(os.pat... | StarcoderdataPython |
9357 | <gh_stars>10-100
from boa3.builtin import public
from boa3.builtin.interop.contract import destroy_contract
@public
def Main():
destroy_contract()
| StarcoderdataPython |
95019 | <reponame>opus49/py3odb
"""Used to share fixtures among tests."""
import pathlib
import pytest
from .context import py3odb
from .context import main
MOCK_CURSOR_DATA = {
"SELECT * FROM <odb>": {
"description": (
('lat@hdr', 2, None, None, None, None, None),
('lon@hdr', 2, None, Non... | StarcoderdataPython |
5093767 | <filename>run.py
from kaggle_environments import evaluate, make
from IPython.display import display_html
import time
ts = time.time()
env = make("halite", debug=True)
env.run(["submission.py", "random", "random", "random"])
print(str(time.time() - ts))
html = env.render(mode="html")
json = env.render(mode="json")
... | StarcoderdataPython |
9714452 | <filename>hashword-gui/hashword-long-gui.py
#!/usr/bin/python
######################################################################################
# hashword-gui written by:
# Joshua "MrSchism" Embrey [<EMAIL>]
# Joseph "Arcarna" Preston [<EMAIL>]
# Intial commit: December 2, 2013
# C... | StarcoderdataPython |
1831732 | #!/usr/bin/env python
#
interactive = False
import sys, os
here = os.path.dirname(__file__)
datadir = os.path.join(here, "../data")
sys.path.insert(0, datadir)
import unittest, warnings
import numpy as np, histogram.hdf as hh, histogram as H
from multiphonon.backward import sqe2dos
from dos import loadDOS
class T... | StarcoderdataPython |
1745338 | # https://www.kaggle.com/wolfram77/puzzlef-pagerank-cuda-static-vs-incremental
import os
from IPython.display import FileLink
src="pagerank-cuda-static-vs-incremental"
inp="/kaggle/input/temporal-graphs"
out="{}.txt".format(src)
!printf "" > "$out"
display(FileLink(out))
!ulimit -s unlimited && echo ""
!nvidia-smi && e... | StarcoderdataPython |
4940345 | import glob
import logging
import os
from contextlib import contextmanager
from cave.utils.exceptions import NotUniqueError
@contextmanager
def changedir(newdir):
olddir = os.getcwd()
os.chdir(os.path.expanduser(newdir))
try:
yield
finally:
os.chdir(olddir)
class BaseReader(object):... | StarcoderdataPython |
12816018 | <gh_stars>0
from . import db_api
from . import misc
from .notify_admins import on_startup_notify | StarcoderdataPython |
1897412 | import os
import tempfile
import ffmpeg
import pytest
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.files import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
from django.urls import reverse
from rest_framework.tes... | StarcoderdataPython |
8164325 | <reponame>ComputerScienceHouse/Jumpstart-Next<filename>components/calendar/__init__.py
from fastapi import APIRouter, Response
from starlette.status import *
import os, json
from pymongo import MongoClient
import logging
import time
import requests
import threading
from component_util import post_update
import datetime... | StarcoderdataPython |
5064933 | <filename>rl_helper/fps.py
import time
import numpy as np
from gym.vector.async_vector_env import AsyncVectorEnv
from gym.vector.sync_vector_env import SyncVectorEnv
from gym.vector.vector_env import VectorEnv, VectorEnvWrapper
def fps(env,steps_per_test=100,episode=10):
result_multiply=env.num_envs if isinsta... | StarcoderdataPython |
6565792 | <gh_stars>0
from cab.abm.agent import CabAgent
__author__ = '<NAME>'
__version__ = '1.0'
class UrbanAgent(CabAgent):
def __init__(self, x, y, gc):
super().__init__(x, y, gc)
self.id = "UrbanAgent"
def perceive_and_act(self, ca, abm):
pass
| StarcoderdataPython |
6642203 | import logging
import requests
import json
import os
from access.search.solrclient import SolrClient
from access.search.solrquery import SolrQuery
from access.search.solrserver import SolrServer
from config.configuration import verify_certificate, solr_protocol
logger = logging.getLogger(__name__)
def index_reposito... | StarcoderdataPython |
5019080 | """
Choose test runner class from --runner command line option
and execute test cases.
"""
import unittest
import optparse
import sys
def get_runner():
parser = optparse.OptionParser()
parser.add_option('--runner', default='unittest.TextTestRunner',
help='name of test runner... | StarcoderdataPython |
4889549 | #!/usr/bin/env python3
# stdlib
import sys
import datetime
from collections import defaultdict
from tabulate import tabulate
from tqdm import tqdm
# project
import tool.discovery as discovery
from tool.config import CONFIG
from tool.model import Result, Submission
from tool.utils import BColor
class DifferentAnswers... | StarcoderdataPython |
1725209 | import psycopg2
import os
import requests
import json
import time
import arrow
import logging
from typing import List, Tuple, Dict, Any
from collections import defaultdict
from apscheduler.schedulers.blocking import BlockingScheduler
from telegram_bot import Bot
logging.basicConfig(format='%(asctime)s %(levelname)s ... | StarcoderdataPython |
6681475 | # appsite/__init__
from appsite.application import app | StarcoderdataPython |
3357448 | <reponame>EuroPOND/deformetrica
class AbstractStatisticalModel:
"""
AbstractStatisticalModel object class.
A statistical model is a generative function, which tries to explain an observed stochastic process.
"""
######################################################################################... | StarcoderdataPython |
3519920 | <gh_stars>0
# Generated by Django 3.0.2 on 2020-02-07 12:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Question', '0009_merge_20200206_2300'),
]
operations = [
migrations.AddField(
model_name='choice',
name=... | StarcoderdataPython |
91599 | <filename>tools/build/get_header_directory.py
#!/usr/bin/env python3
import pathlib
import sys
import os
def main():
argv = sys.argv
if len(argv) != 3:
raise RuntimeError(
f"Usage: {argv[0]} <header install directory> <absolute path of current header directory>"
)
anchor = 'sou... | StarcoderdataPython |
3352436 | <gh_stars>1-10
from maya import mel
from ..abstract import afnfbx
import logging
logging.basicConfig()
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
class FnFbx(afnfbx.AFnFbx):
"""
Overload of AFnFbx that defines function set behaviours for fbx in Maya.
"""
__slots__ = ()
def set... | StarcoderdataPython |
3476052 | <reponame>sturmianseq/fparser
# Copyright (c) 2018-2019 Science and Technology Facilities Council
# All rights reserved.
# Modifications made as part of the fparser project are distributed
# under the following license:
# Redistribution and use in source and binary forms, with or without
# modification, are permitte... | StarcoderdataPython |
1752185 | import sys
from scrapy import cmdline
cmdline.execute(["scrapy"] + sys.argv[1:]) | StarcoderdataPython |
11353973 | import os
from ..logging import get_logger
import yaml
from ._exceptions import ProjectDirectoryNotSet, ProjectDirectoryNotExists
from typing import List
from ._environment import Environment
class Project:
# def __init__(self, **kwargs):
# for key, value in kwargs.items():
# setattr(self, key... | StarcoderdataPython |
6634113 | <reponame>dasepli/fastNLP
r"""undocumented"""
__all__ = [
"CoReferencePipe"
]
import collections
import numpy as np
from fastNLP.core.vocabulary import Vocabulary
from .pipe import Pipe
from ..data_bundle import DataBundle
from ..loader.coreference import CoReferenceLoader
from ...core.const import Const
clas... | StarcoderdataPython |
4810697 | <gh_stars>0
"Functions implementing widget editing"
import re, html, json
from ... import skilift
from ....skilift import fromjson, editsection, editpage, editwidget, versions
from .. import utils
from ... import FailPage, ValidateError, ServerError, GoTo
from ....ski.project_class_definition import SectionData
... | StarcoderdataPython |
1709290 | # -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2018 ZhicongYan
#
# 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... | StarcoderdataPython |
6565341 | <reponame>qstanczyk/kaggle-environments
# Copyright 2020 Kaggle 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 ... | StarcoderdataPython |
12827685 | <gh_stars>1-10
import statistics
import ast
import os
import matplotlib.pyplot as plt
import numpy as np
import urllib.request
from bs4 import BeautifulSoup
script_directory = str(os.path.dirname(os.path.realpath(__file__)))
file_name = "prelimsavefile.txt"
path_to_file = script_directory + '\\' + file_name
"""
READM... | StarcoderdataPython |
5082645 | <gh_stars>1-10
from django.db import models
from django.db.models.fields.related import ManyToManyField
app_label = "ict"
class PrintModel(models.Model):
def __repr__(self):
return str(self.to_dict())
def to_dict(self):
opts = self._meta
data = {}
for f in opts.concrete_field... | StarcoderdataPython |
6489476 | import os
import sys
where_am_i = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, where_am_i+"/python_modules")
try:
from tensorflow_core.keras.preprocessing.image import img_to_array
from tensorflow_core.keras.models import load_model
except:
from tensorflow.keras.preprocessing.image import img_to_a... | StarcoderdataPython |
380137 | <filename>gala-ragdoll/ragdoll/test/test_reverse_analy.py
import requests
import libyang
import os
import sys
import importlib
import argparse
import subprocess
from flask import json
from six import BytesIO
from ragdoll.test import BaseTestCase
from ragdoll.utils.yang_module import YangModule
from ragdoll.utils.objec... | StarcoderdataPython |
6409063 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.9.6)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x01\x57\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x18\x0... | StarcoderdataPython |
6579708 | <gh_stars>1000+
from __future__ import unicode_literals
from future.utils import iteritems, itervalues
from snips_nlu.constants import (
DATA, ENTITIES, ENTITY, INTENTS, TEXT, UTTERANCES)
from snips_nlu.entity_parser.builtin_entity_parser import is_gazetteer_entity
def extract_utterance_entities(dataset):
e... | StarcoderdataPython |
5048693 | from lccal import lccal
from unconex import unconex
ans = unconex(lccal(27.89021,36.39717,0.1,False),'sn')
print('UNCONEX')
for i in ans:
print(i[0],i[1],i[2])
| StarcoderdataPython |
3334940 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ScenicFaceInfo import ScenicFaceInfo
class AlipayCommerceEducateFacefeatureDeleteModel(object):
def __init__(self):
self._biz_... | StarcoderdataPython |
1907362 | # -*- coding: utf-8 -*-
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on Jul 9, 2014
████████████████████████████████████████... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.