id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
164680 | import numpy as np
import pandas as pd
import simpy
from sim_utils.audit import Audit
from sim_utils.data import Data
from sim_utils.patient import Patient
import warnings
warnings.filterwarnings("ignore")
class Model(object):
def __init__(self, scenario):
"""
"""
self.env = simpy.En... | StarcoderdataPython |
1797594 | <reponame>Asuka-Liu/zzujksb-esp32
# micropython 校时程序 (注意,必须先联网成功后,才能校时成功!!!)
import utime
import ntptime
import zzu
def OnedayTimer():
from machine import Timer
#开启定时器前先校准一下
print("同步前本地时间:%s" %str(utime.localtime()))
ntptime.NTP_DELTA = 3155644800 # 设置 UTC+8偏移时间(秒),不设置就是UTC0
ntpti... | StarcoderdataPython |
3209500 | from .get_imformation import GI
import math
import numpy as np
class SP():
def __init__(self, adj_matrix, ins_matrix):
self.Adjacency_Matrix = adj_matrix
self.N = len(self.Adjacency_Matrix)
self.Insidence_Matrix = ins_matrix
def dijkstra_algo(self, start):
"""
Returns:... | StarcoderdataPython |
14037 | from interrogatio.shortcuts.dialogs import * # noqa | StarcoderdataPython |
3223570 | <reponame>tucan9389/KLUE-baseline
import argparse
import logging
from dataclasses import dataclass
from typing import Any, Dict, List, Union
import torch
from overrides import overrides
from transformers import AutoModelForQuestionAnswering
from transformers.data.metrics.squad_metrics import compute_predictions_logits... | StarcoderdataPython |
1705100 | import re
"""Collection of utils."""
def dump_datetime(value):
"""Deserialize datetime object into string form for JSON processing."""
if value is None:
return None
return value.strftime("%Y-%m-%dT%H:%M:%S.000Z")
community_name_regex = re.compile('^[0-9a-zA-Z_-]+$')
def is_not_valid_entity_na... | StarcoderdataPython |
3231663 | <gh_stars>0
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation
# {"feature": "Coupon", "instances": 127, "metric_value": 0.9899, "depth": 1}
if obj[0]>1:
# {"feature": "Occupation", "instances": 95, "metric_value": 0.971, "depth": 2}
if obj[2]<=20:
# {"feature": "Education", "instanc... | StarcoderdataPython |
1745066 | import tensorflow as tf
import numpy as np
try:
from models.read_util.read_train_data import get_all_bearings
except:
from ..read_util.read_train_data import get_all_bearings
# from read_train_data import get_all_bearings
VIB_SIZE = 2000
step = 20
IMAGE_SIZE = VIB_SIZE//step
# Global constants describing ... | StarcoderdataPython |
3378928 | <gh_stars>1-10
# third party
import numpy as np
import pytest
import torch
from sympc.tensor.grads.grad_functions import GradAdd
from sympc.tensor.grads.grad_functions import GradFunc
from sympc.tensor.grads.grad_functions import GradMul
from sympc.tensor.grads.grad_functions import GradSigmoid
from sympc.tensor.grads... | StarcoderdataPython |
144695 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 5 08:14:54 2020
@author: Tom
"""
import ecm
import numpy as np
import matplotlib.pyplot as plt
import os
from sklearn.preprocessing import StandardScaler
import scipy
import pandas as pd
from matplotlib import cm
import configparser
# Turn off code warnings (this is not... | StarcoderdataPython |
169548 | import smtplib
import datetime
import os
import time
import random
from random import randint
import string
import codecs
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
from email.utils import formataddr
from rich import print
from rich.console import... | StarcoderdataPython |
71444 | <filename>projects/flow.hello-world/project.py
from flow import FlowProject
# import flow.environments # uncomment to use default environments
class Project(FlowProject):
pass
@Project.label
def greeted(job):
return job.isfile('hello.txt')
# Add hello world operation
@Project.operation
@Project.post(gree... | StarcoderdataPython |
94369 | <filename>SoftCut.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 13 13:09:37 2019
@author: DavidFelipe
"""
import cv2
import slidingwindow as sw
import numpy as np
class SoftCut:
def __init__(self, image, verbose=0):
self.image_class = image
self.shape =... | StarcoderdataPython |
1641219 | import pytest
from shotbot.utils import base36_decode, base36_encode, seq_encode
BASE36_SAMPLES = {
0: '0',
9: '9',
10: 'a',
35: 'z',
36: '10',
999999999: 'gjdgxr'
}
@pytest.mark.parametrize('number,encoded', BASE36_SAMPLES.items())
def test_base36_decode(encoded, number):
assert base36_... | StarcoderdataPython |
3293684 | <filename>bipartite/graph.py
"""
Created by <NAME> and <NAME>. This module is intended to define
structure describing graphs in this package.
https://github.com/severmore/pygraphs
"""
class Graph:
"""
A graph representation used in the algorithms of this package. It is intended
to use in these algos. The vertice... | StarcoderdataPython |
3385795 | <gh_stars>0
import sys
import traceback
from core.docker import *
class Command(object) :
'''
Simple command executor.
'''
def __init__(self, config) :
self.config = config
self.cmds = []
def execute(self) :
for (node, cmd, options) in self.cmds :
try :
... | StarcoderdataPython |
3329792 | <filename>server/DjangoApp/dashboard/dashboard/urls.py<gh_stars>0
"""dashboard URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add... | StarcoderdataPython |
177306 | <filename>tools/wcloud/wcloud/test/test_wcloud_tasks.py
######################################
#
# UNIT TESTS BELOW
#
######################################
import json
import os
import shutil
import unittest
import time
import subprocess
import requests
from wcloud.tasks.wcloud_tasks import flask_app, prepare_system, ... | StarcoderdataPython |
1757054 | <reponame>showa-yojyo/notebook<filename>source/_sample/ptt/lists-subscribers.py
#!/usr/bin/env python
# Demonstration GET lists/subscribers
# https://dev.twitter.com/rest/reference/get/lists/subscribers
from secret import twitter_instance
tw = twitter_instance()
next_cursor = -1
while next_cursor:
response = tw... | StarcoderdataPython |
118313 | <reponame>PacktPublishing/Learning-Python-v-
def sum(a, b):
c = a+b
return c
x = 10
y = 50
print "Result of addition ", sum(x,y) | StarcoderdataPython |
30576 | <gh_stars>0
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from context import braingraphgeo as bgg
def test_geomsurr(sample_W_1, sample_D):
W = sample_W_1.values
d = sample_D.values
Wgeo = bgg.surrogates.geomsurr(W, d, rs=2021)
result = np.array([[0., 0.00... | StarcoderdataPython |
4834893 | """User url routes"""
from django.conf.urls import include
from django.urls import path
from rest_framework import routers
from users.views import (
UserRetrieveViewSet,
CurrentUserRetrieveUpdateViewSet,
CountriesStatesViewSet,
ChangeEmailRequestViewSet,
)
router = routers.DefaultRouter()
router.regis... | StarcoderdataPython |
3307205 | <reponame>kumar1202/sling_pytorch<filename>model/batch_generator.py
from __future__ import print_function
import os
import numpy as np
import random
import string
import tensorflow as tf
import zipfile
from six.moves import range
from six.moves.urllib.request import urlretrieve
batch_size=64
num_unrollings=14
class B... | StarcoderdataPython |
197166 | <reponame>hmaschke/pandapower-1
# -*- coding: utf-8 -*-
# Copyright 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy S... | StarcoderdataPython |
1735817 | import random
import re
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from yahooquery.ut... | StarcoderdataPython |
56177 | <gh_stars>0
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, FormRequest
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import ProductLoader, Product
import logging
login = 'cmonito... | StarcoderdataPython |
3244548 | from __future__ import absolute_import, division, print_function
import os
from mmtbx.validation.clashscore import clashscore
from libtbx.program_template import ProgramTemplate
try:
from phenix.program_template import ProgramTemplate
except ImportError:
pass
#from libtbx.utils import Sorry
class Program(ProgramT... | StarcoderdataPython |
3228909 | <gh_stars>0
from django.contrib import messages
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.db import transaction
from django.db.models import Count, Sum
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse_lazy
... | StarcoderdataPython |
1695688 | from discord.ext import commands
import discord
import time
import requests
import math
def Travel_overwrites(p_key,channel_permissions, roles_dict):
keys = list(p_key)
for key in keys: # keysをforで回す
try:
# まずpermissionオブジェクトを取り出す
permission = channel_permissions[key]
... | StarcoderdataPython |
3338545 | from app.models import Registrant
from app.services import SessionManager
from app.services.steps import Step_0, Step_VR_1
from datetime import datetime
def create_registrant(db_session):
registrant = Registrant(
registration_value={
"name_first": "foo",
},
)
db_session.add(regi... | StarcoderdataPython |
1712285 | <filename>project3/code/self.py
import random as rand
import math as m
import copy
#-----------------------------------------------Basic matrix operations---------------------
def mul(x,y):
r=[[0 for i in range(len(y[0]))] for j in range(len(x))]
for i in range(len(x)):
for j in range(len(y[0])):
... | StarcoderdataPython |
1620903 | # Resolve a cyclic import
import sage.rings.convert.mpfi
| StarcoderdataPython |
1667463 | <reponame>alecstein/mataroa-personal
# Generated by Django 3.0.8 on 2020-08-12 21:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("main", "0036_auto_20200812_2102"),
]
operations = [
migrations.AlterField(
model_name="comm... | StarcoderdataPython |
4805128 | <filename>src/credo_cf/classification/preprocess/xor.py
from typing import List
import numpy as np
from credo_cf.commons.filters import base_xor_filter
def xor_preprocess(detections: List[dict], mode: str = 'pair', var: int = 30) -> List[dict]:
"""
The function runs a discrete XOR filter what enables to remo... | StarcoderdataPython |
4804274 | <reponame>nalimhahs/pwnit<filename>stream_server/paralleltransfer.py<gh_stars>0
# tgfilestream - A Telegram bot that can stream Telegram files to users over HTTP.
# Copyright (C) 2019 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Li... | StarcoderdataPython |
108878 | <reponame>Exelscior/logging-azure-rest
import datetime
from copy import deepcopy
from logging import StreamHandler, LogRecord
from .service_provider import provide
from .log_service import AzureLogService
from .utils import setlocale
class AzureLogServiceHandler(StreamHandler):
_RFC1123DATE_WITH_MICRO = "%a, %d %... | StarcoderdataPython |
1702426 | <filename>applications/elearning/tests/test_models.py
# -*- coding: utf-8 -*-
from datetime import datetime
#Fixture package
from mixer.backend.django import mixer
#Test package & Utils
from django.test import TestCase
import pytest
pytestmark = pytest.mark.django_db
#models
from applications.elearning.models import... | StarcoderdataPython |
1667092 | import numpy as np
from numpy import random
from compound_poisson import time_series
class TimeSeriesGd(time_series.TimeSeries):
"""Compound Poisson Time Series with ARMA behaviour
Attributes:
ln_l_array: the joint log likelihood after calling the method fit()
step_size: the step size for... | StarcoderdataPython |
3261920 | <filename>lj_mmcmd/mclj.py
#!/usr/bin/env python
"""
This module is used for carrying out a simple Metropolis Monte Carlo simulation of Lennard Jones particles
"""
import numpy as np
import pint
ureg = pint.UnitRegistry()
Q_ = ureg.Quantity
class MCLJ:
"""
This module is used for carrying out a simple Metropo... | StarcoderdataPython |
1735207 | #!/usr/bin/env python
import json
import os
import yaml
from .yaml_tags import *
class JsonConfigFileParser:
FILE_EXTENSIONS = [".json"]
@staticmethod
def parse(filename, _):
with open(filename) as json_file:
return json.load(json_file)
class YamlConfigFileParser:
FILE_EXTENSIO... | StarcoderdataPython |
1645516 | <reponame>ebadkamil/nicos<gh_stars>0
# -*- coding: utf-8 -*-
description = 'Shutter setup'
group = 'lowlevel'
display_order = 5
tango_base = 'tango://phys.kws3.frm2:10000/kws3/'
tango_base_mlz = 'tango://ictrlfs.ictrl.frm2:10000/mlz/'
devices = dict(
# currently not enabled:
# shutter = device('nicos_mlz.jcn... | StarcoderdataPython |
3268599 | <filename>Attempts/piClient-Alexander Baran-Harper.py<gh_stars>0
#<NAME>: https://www.youtube.com/watch?v=PYBZtV2-sLQ
import socket
host = '#YOUR SERVER IP HERE'
port = 5560 #CHANGE PORT IF THIS ONES USED
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
while True:
command = input("E... | StarcoderdataPython |
3259687 | <reponame>encorehu/django-xheditor
# -*- coding: utf-8 -*-
# python.
#import datetime
#import urllib
# ------------------------------------------------------------
# django.
from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
from django.core.urlresolvers... | StarcoderdataPython |
174129 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 2 18:47:31 2019
@author: m
for musical dimensions
listen bach
time 32.56
podcast
BBC all in the mind 28.05.19 21:30
http://open.live.bbc.co.uk/mediaselector/6/redir/version/2.0/mediaset/audio-nondrm-download/proto/http/vpid/p07bkkr0.mp3
"""
imp... | StarcoderdataPython |
3326861 | <filename>run.py
#!/usr/bin/env python
from subdown2 import main
main()
| StarcoderdataPython |
3322382 | #!/usr/bin/python
""" This script checks if an email address exists on a mailserver. """
__author__ = "<NAME> | https://www.scriptinglibrary.com"
import logging
import argparse
from smtplib import SMTP
MAILSERVER = "your.mailserver.com"
PORT = 25
DEBUG_MODE = False
RFC_LINK = r"https://goo.gl/9hYJQg"
if __name__ ==... | StarcoderdataPython |
1794618 | <gh_stars>0
"""
debloat script
author: binpang
"""
import logging
import optparse
import os
import string
import random
def randomString(stringLength = 10):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength))
logging.basicConfig(level=logging.INFO)
def debloat(... | StarcoderdataPython |
3361861 | import torch
import torch.nn.functional as F
def miso_multi_head_attention_forward(query, # type: Tensor
key, # type: Tensor
value, # type: Tensor
... | StarcoderdataPython |
1697629 | <reponame>naitik2314/E-Health-Care<filename>api/views.py
from django.shortcuts import render
from rest_framework import viewsets
from . models import Disease
from api.serializers import DiseaseSerializer
from . import diseaseml
from rest_framework.response import Response
from django.contrib.auth.models import User
#... | StarcoderdataPython |
1751428 | import torch
import torch.nn as nn
from torch.nn import init
from torch.autograd import Variable
import numpy as np
import time
import random
from sklearn.metrics import f1_score
from collections import defaultdict
import torch.nn.functional as F
import new_sampling_function
# from graphsage.encoders import Encoder
#... | StarcoderdataPython |
9278 | from collections import MutableMapping, Container
from datetime import datetime, timedelta
from pyvalid import accepts
class LimitedTimeTable(MutableMapping, Container):
def __init__(self, time_span):
self.__storage = dict()
self.__time_span = None
self.time_span = time_span
@propert... | StarcoderdataPython |
1796043 | import os
import imageio
import glob
## Make movie
writer = imageio.get_writer('fire_sa_10.mp4', fps=12)
path = '/Users/jordanwalker/Downloads/lance-modis-sa-name/'
filelist = glob.glob(os.path.join(path, '*.jpg'))
filenames = sorted(x for x in filelist)
for im in filenames:
writer.append_data(imageio.imread(im... | StarcoderdataPython |
4813691 | from fbpca import pca
import numpy as np
import os
import pandas as pd
from scanorama import *
from scipy.sparse import vstack
import seaborn as sns
from sklearn.preprocessing import LabelEncoder, scale
from experiments import *
from process import load_names
from utils import *
NAMESPACE = 'artificial_density'
METHO... | StarcoderdataPython |
181542 | <gh_stars>1-10
# coding: utf-8
__author__ = '<NAME> (ZFTurbo), IPPM RAS'
from a00_common_functions import *
from a02_generate_random_non_number import generate_random_non_number
from a01_model_low_weights_digit_detector import keras_model_low_weights_digit_detector
import glob
import os
import random
gpu_use = 0
os... | StarcoderdataPython |
3293617 | from django.db import models
# Create your models here.
class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField(blank=True)
photo = models.URLField(blank=True)
location = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self)... | StarcoderdataPython |
187499 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
obfuscate.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
遍历工程目录,并对目录里的*.py文件进行混淆
:author: leo
:copyright: (c) 2020, Tungee
:date created: 2020-04-27 11:14
"""
import os
import shutil
import click
APP_NAME = '{{cookiecutter.app_name}}'
@clic... | StarcoderdataPython |
4809784 | from kivy.config import Config
#Config.set('graphics', 'borderless', '0')
Config.set('kivy', 'keyboard_mode', 'systemandmulti')
#Config.set('graphics', 'width', '1920')
#Config.set('graphics', 'height', '1080')
#onfig.set('graphics', 'fullscreen', 'auto')
from kivy.app import App
from kivy.uix.widget import Widget
from... | StarcoderdataPython |
178485 | <filename>extraction/lp.py
import layoutparser as lp
import cv2
model = lp.AutoLayoutModel('lp://EfficientDete/PubLayNet')
image = cv2.imread("/home/devesh/Code/ReproMultiModal/test1images/fullimgs/image0.png")
layout = model.detect(image)
# layout = model.detect(image
# image = | StarcoderdataPython |
1694156 | import cv2
import os
import sys
import numpy as np
import pandas as pd
from glob import glob
import itertools
from visionfuncs.io import sorted_glob
from visionfuncs import cbcalib
from visionfuncs import geometry
from epypes.compgraph import CompGraphRunner
from .io import open_images_all
from .graph import CGCalibr... | StarcoderdataPython |
1719239 | import numpy as np
import matplotlib.pyplot as plt
from draw import *
feyn = diagram(-5,-5,5,5) #picture object, will contain all lines, arrows, text ...
n = feyn.N # detail of each line (points per line)
line1 = squiggle(0,0,2,2,feyn,'k',0.7,'-')
line1.make_arrow(0.5)
feyn.framed = False
feyn.draw_and_save('fey... | StarcoderdataPython |
1798781 | import tensorflow as tf
import numpy as np
import json
def get_network(input_size, output_size):
opt = tf.keras.optimizers.Adam(learning_rate=0.1)
graph = tf.keras.Sequential([
tf.keras.layers.Conv2D(16, (3, 3), activation='relu', input_shape=(input_size, input_size, 3)),
tf.keras.layers.MaxPoo... | StarcoderdataPython |
3201988 | import pytest
import pyeventdispatcher
from pyeventdispatcher import (
EventDispatcher,
Event,
EventDispatcherException,
EventSubscriber,
listen,
)
from pyeventdispatcher.event_dispatcher import (
MemoryRegistry,
register_global_listener,
register_event_subscribers,
)
class TestRegist... | StarcoderdataPython |
3365394 | from modelexp.models.sas import SAXSModel
from fortSAS import sphere_css_coupled
import numpy as np
class SphereCSSCoupledHSStructure(SAXSModel):
def initParameters(self):
self.params.add('particleSize', 100)
self.params.add('dShell', 30)
self.params.add('dSurfactant', 20)
self.params.add('sldCore', 4... | StarcoderdataPython |
88889 | <filename>my_code.py
# Collaborators (including web sites where you got help: (enter none if you didn't need help)
#
# Decide on a name for your text file. Then open it and write at least 2 lines.
# Next, reopen the file and append at least 2 more lines to it.
| StarcoderdataPython |
1677940 | # -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""
Unitary gate.
"""
from ._instruction import Instruction
from ._quantumregister import QuantumRegister
from ._qiskiterror ... | StarcoderdataPython |
3338219 | <gh_stars>0
#!/usr/bin/env python
"""
Emulate a spinning drum containing numbers from 1-47 and pick six numbers from it
"""
import os
import sys
import random
from collections import deque
import time
def pre_spool():
"""
Generate a 'pipe' (array) of numbers to put into a circular drum
Accepts no argumen... | StarcoderdataPython |
110502 | """
Launch lifoid server
Author: <NAME> <<EMAIL>>
Copyright (C) 2017-2018 <NAME>
"""
import traceback
from commis import Command, color
class RunCommand(Command):
name = 'run'
help = 'launch a lifoid server application'
args = {
'--host': {
'metavar': 'ADDR',
'default': ... | StarcoderdataPython |
3329318 | import math
import time
def fac(x):
y = 1
for ii in range(x):
y *= x
return y
def memoize(f):
def g(x):
sx = str(x)
if not(sx in g.inputs.keys()):
y = f(x)
g.inputs.update({sx: y})
return y
else:
return g.inputs[sx]
g.... | StarcoderdataPython |
1606879 | import unittest
import torch
from models import decoders
from templates import ModelTestsMixin, FrozenLayerCheckMixin
class TestDenseEncoder(ModelTestsMixin, unittest.TestCase):
def setUp(self):
self.test_inputs = torch.randn(16, 32)
self.output_shape = torch.Size((16, 1, 32, 32))
self.n... | StarcoderdataPython |
4819873 | <reponame>nghiattran/python-parse
# @name <%= app_name %>
# @description
# Tests for UserController
from test import BaseTestCase
from src.utils import\
get_config
class UserTestCase(BaseTestCase):
# Test signup
def test_signup(self):
string = self.random_string(length=20)
payload = {
... | StarcoderdataPython |
4828162 | <reponame>felixpelaez/python-sdk<filename>tests/common/chain_dict.py
import unittest
from devo.common import ChainDict
class TestChainDict(unittest.TestCase):
def setUp(self):
self.test_dict = {'film': "Kung Fury", 'disc': {'type': 'dvd'}}
self.test_values = [['film', 'Kung Fury'], [['disc', 'type... | StarcoderdataPython |
1710978 | <reponame>oslumbers/pipeline-psro<gh_stars>10-100
from mprl.utility_services.real_time_payoff_tracker.protobuf.real_time_payoff_tracker_pb2 import PayoffTableKey, PolicyInfo, LivePolicyInfo, Confirmation, EvalMatchupResult
from mprl.utility_services.real_time_payoff_tracker.protobuf.real_time_payoff_tracker_pb2_grpc im... | StarcoderdataPython |
134132 | # Copyright 2021, Yahoo
# Licensed under the terms of the Apache 2.0 license. See the LICENSE file in the project root for terms
from .index import AgentType
__all__ = ["AgentType"]
| StarcoderdataPython |
1607110 | from typing import List, Union
import attr
from grafanalib.core import GridPos, Panel, RowPanel # type: ignore
PanelList = List[Panel]
PanelRow = PanelList
PanelColumn = List[Union[Panel, PanelRow]]
ROW_HEIGHT = 1 # height of a 'row' panel
GRID_WIDTH = 24 # Width of the Grafana layout grid
def get_height(panel: ... | StarcoderdataPython |
1600632 | #
# timeline.py
#
# This code will create a timeline plot for a university year of all
# assignment deadlines for all courses against key dates such as holidays
#
#
# Things that need to be set:
#
# year - the university year the timeline is plotted for
year = 2016
import uob_utils
import ... | StarcoderdataPython |
3277180 | <gh_stars>0
# import subtitle_extra
# from subtitle import Item
# import unittest
# class NotTest():
# def add(self, val):
# return val + 1
# class TestExtra(unittest.TestCase):
# def test_add_one(self):
# # Arrange
# start_val = 0
# expected_result = 1
# # Act
# ... | StarcoderdataPython |
4812754 | <gh_stars>0
from .ContainersDevice import ContainersDevice
from .ContainersManager import ContainersManager, EventlessContainersManager, NullContainersManager
from .ContainersManagerFactory import ContainersManagerFactory
from .ContainersFactory import ContainersFactory
| StarcoderdataPython |
3259390 | # Copyright (c) 2021, GreyCube Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
def after_install():
"""Add custom field in Company"""
custom_... | StarcoderdataPython |
3359571 | <filename>streamlit_server/server.py
import time
import random
import pandas as pd
from pathlib import Path
import plotly
from PIL import Image
import streamlit as st
import sys
sys.path.append('..')
from monitoring_system.utils import *
PATH_TO_DATA_FOLDER = '../data'
def empty():
st.header('No data found!')
... | StarcoderdataPython |
1631511 | from __future__ import with_statement
import itertools
import functools
import logging
import os, sys, traceback
import threading
import time
log = logging.getLogger('util.primitives.synch')
def lock(f):
@functools.wraps(f)
def wrapper1(instance, *args, **kw):
if not hasattr(instance, '_l... | StarcoderdataPython |
1589 | def main(expr):
openingParams = '({['
closingParams = ')}]'
stack = []
for c in expr:
if c in openingParams:
stack.append(c)
elif c in closingParams:
topOfStack = stack.pop()
openingIndex = openingParams.find(topOfStack)
closingIndex = clos... | StarcoderdataPython |
1703658 | <filename>curriculo/migrations/0002_auto_20190219_0938.py
# Generated by Django 2.1.3 on 2019-02-19 12:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('curriculo', '0001_initial'),
]
operations = [
migrations.AlterField(
m... | StarcoderdataPython |
96020 | """
Based on django's caching template loader.
"""
import hashlib
import shpaml
from django.template.base import TemplateDoesNotExist
from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_origin
class Loader(BaseLoader):
is_usable = True
def __init__(self, loader... | StarcoderdataPython |
3296436 | <reponame>wyim-pgl/jcvi<filename>annotation/depth.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
From genomeCovergeBed results, initialize the count array, set cutoffs
and optimize against the truth, to determine the cutoff for incorporating
RNA-seq into annotation pipelines.
"""
import sys
import os.path as op... | StarcoderdataPython |
1665440 | class Node:
def __init__(self, name):
self.name = name
self.visited = False
self.predecessor = None
self.min_distance = float('inf')
self.adjacencie_list = list()
class Edge:
def __init__(self,weight, start_vertex, end_vertex):
self.start_vertex = start_vertex
... | StarcoderdataPython |
4803540 | '''
base.py
ancilla
Created by <NAME> (<EMAIL>) on 10/08/19
Copyright 2019 <NAME>
'''
import json
from tornado.web import RequestHandler
from tornado.escape import json_decode
class BaseHandler(RequestHandler):
def set_default_headers(self):
self.set_header('Access-Control-Allow-Origin', '*')
self.... | StarcoderdataPython |
1613746 | # Copyright (c) 2021 by Cisco Systems, Inc.
# All rights reserved.
expected_output = {
'evi': {
1: {
'bd_id': {
11: {
'eth_tag': {
0: {
'remote_count': 4,
'local_count': 6,
... | StarcoderdataPython |
1753659 | import os
import signal
import subprocess
import sys
import time
import requests
def test_waitress_get():
waitress_path = os.path.join(os.path.dirname(sys.executable), 'waitress-serve')
_test_service([waitress_path, 'some_code.falcon_service:app'])
def test_gunicorn_get():
gunicorn_path = os.path.join(... | StarcoderdataPython |
3351086 | from typing import List
from ..common import catch_errors_as_message, open_database_read_only
from ..formatting import get_machine_info_name, plot_in_progress_pb2_as_markdown
from ..notifications.run_notifiers import get_current_computer_and_machine_infos_from_db
@catch_errors_as_message
async def plotters_cmd(db_fi... | StarcoderdataPython |
96355 | import pysolr
import requests
import logging
import ctypes
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def doc_key(dataset_id, file_name):
return ctypes.c_size_t(hash(f'{dataset_id}{file_name}')).value
class DatasetIngestionHistorySolr:
_solr = None
_collection_name =... | StarcoderdataPython |
3288650 | from sklearn import datasets
from sklearn.model_selection import train_test_split
import xgboost as xgb
import numpy as np
from sklearn.metrics import precision_score
from sklearn.externals import joblib
# Load data
iris = datasets.load_iris()
X = iris.data
y = iris.target
# Split into train - test sets
X_train, X_te... | StarcoderdataPython |
62797 | """
test_question.py
サンプルテストケース
"""
import pytest
import run as myApp
from datetime import datetime, timedelta
from models import Question
@pytest.fixture
def api():
return myApp.api
class TestQuestionModel:
def test_was_published_recently_with_future_question(self, api):
"""
未来の質問に対してwas_... | StarcoderdataPython |
3236747 | # coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | StarcoderdataPython |
3298385 | # Copyright (c) 2013 Mirantis 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 to in writ... | StarcoderdataPython |
3374625 | # -*- coding=utf-8 -*-
from scrapy import Spider
from scrapy import Request
from scrapy.selector import Selector
class Fang(Spider):
name = 'fang'
def __init__(self, *a, **kw):
super(Fang, self).__init__(*a, **kw)
self.city_url = kw.get('url')
'https://lijiang.anjuke.co... | StarcoderdataPython |
176587 | <gh_stars>1-10
#!/usr/local/python/bin/python
# gb2tab - comprehensive GenBank format parser/extractor
#
# Copyright (C) 2004 - 2008 <NAME>, <EMAIL>
#
# gb2tab 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;... | StarcoderdataPython |
3364309 | from utils import encryptor
from utils import decryptor
from cryptography.fernet import Fernet
from cryptography.fernet import InvalidToken
from stdiomask import getpass
import os
import sys
import json
def confirm(input_):
if input_.lower() in ['y', 'yes']:
return True
elif input_.lower() in ['n', 'n... | StarcoderdataPython |
3325423 | from time import time
from utils import txt2words, w2v_load_model
import numpy as np
import gensim
import json
import sys
class DeepTextAnalyzer(object):
def __init__(self, word2vec_model):
"""
Construct a DeepTextAnalyzer using the input Word2Vec model
:param word2vec_model: a trained Word... | StarcoderdataPython |
3339013 |
expected_output = {
'isis': {
'TEST1': {
'vrf': {
'default': {
'level': {
2: {
'system_id': {
'5286.44ff.91b9': {
'dynamic_hostname': 'hos... | StarcoderdataPython |
3348253 | from __future__ import unicode_literals
import functools
import itertools
import re
from .common import InfoExtractor
from ..compat import (
compat_b64decode,
compat_chr,
compat_ord,
compat_str,
compat_urllib_parse_unquote,
compat_urlparse,
compat_zip
)
from ..utils import (
clean_html... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.