id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3342861 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 17 16:27:58 2018
@author: <NAME>
"""
import numpy as np
from scipy.optimize import minimize
from QChemTool.General.units import conversion_facs_position as conv_pos
from QChemTool.QuantumChem.Classes.structure import Structure
from QChemTool.QuantumChem.Fluoro... | StarcoderdataPython |
3369915 | <filename>AMBER/examples/amber_ecg.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Example wrapper `Amber` use for searching PhysioNet challenge data
"""
from keras.utils.np_utils import to_categorical
from amber import Amber
from amber.architect import ModelSpace, Operation
from load_ecg import read_data_ph... | StarcoderdataPython |
3253836 | from .model_wrapper import ModelWrapper, KerasLoss, KerasOptimizer, KerasMetric | StarcoderdataPython |
37983 | from .eval_card import EvaluationCard
from .evaluator import Evaluator
from .lookup import LookupTable
| StarcoderdataPython |
41289 | <reponame>pkpdapp-team/pkpdapp<gh_stars>1-10
#
# This file is part of PKPDApp (https://github.com/pkpdapp-team/pkpdapp) which
# is released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
# Generated by Django 3.0.7 on 2021-01-12 17:55
# flake8: noqa
from... | StarcoderdataPython |
4822477 | <reponame>PacificBiosciences/smrtflow
#!/usr/bin/env python
"""Main Point of Entry for Creating versioned Bundles
sbt, nodejs, npm, java1.8, python2.7
This assumes that the Perforce Workspace has both the UI and services root dirs
Specifically,
//depot/software/smrtanalysis/services-ui/scala/
//ui/main/... //mkoch... | StarcoderdataPython |
1656321 | <gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
import cv2
from Utility import calc_weight_brief, calc_weight_obj
from Localizer import *
from DataProcessor import *
''' Collection of functions for assessing measurement models.'''
def calc_truth_weights_terrain(map_file, camera_path, weights_file, t... | StarcoderdataPython |
123477 | <filename>nfsops/operators/operator.py
'''
Base operator object.
'''
import logging
from abc import ABC
from .. import utils
from ..configurations.context import ContextConfiguration
class Operator(ABC):
'''
Base operator object.
'''
#: Context configuration.
context: ContextConfiguration
#... | StarcoderdataPython |
185868 | import pytest
import threading
from parsl import python_app
from parsl.tests.configs.htex_local import fresh_config
from parsl.executors.errors import SerializationError
local_config = fresh_config()
local_config.retries = 2
@python_app
def fail_pickling(x):
return True
@pytest.mark.local
def test_serializati... | StarcoderdataPython |
1779108 | <filename>mt_client/apps.py
from django.apps import AppConfig
class MtClientConfig(AppConfig):
name = 'mt_client'
| StarcoderdataPython |
75350 | <filename>onemoretest.py
print "one more test"
| StarcoderdataPython |
3361486 | <reponame>NaverCloudPlatform/ncloud-sdk-python<filename>lib/apikey/test/load_credentials_sample.py<gh_stars>10-100
# coding: utf-8
from __future__ import absolute_import
import time
import thread
import datetime
from ncloud_apikey.credentials import CredentialsResolver
def test_load_credentials(tid, time_to_sleep, ... | StarcoderdataPython |
1710150 | <gh_stars>1-10
"""
Created by @Jisan7509
modified by @mrconfused
Userbot plugin for Dragons-Userbot
"""
from dragons import drgub
from ..core.managers import edit_or_reply
from ..helpers import fonts as emojify
plugin_category = "fun"
@drgub.drg_cmd(
pattern="emoji(?:\s|$)([\s\S]*)",
command=("emoji", plu... | StarcoderdataPython |
95258 | <reponame>harshp8l/deep-learning-lang-detection<gh_stars>10-100
from django.core.management.base import BaseCommand
from scraper.models import Incident, IncidentType, \
Dispatch, Vehicle, VehicleType
import csv
import datetime
import re
from pytz import timezone
class Command(BaseCommand):
help = 'Imports dat... | StarcoderdataPython |
3376835 | <gh_stars>1-10
import datetime
import ex1_call_stt_tts
# what time is it?
def Clock_hour(): # 시간 [시]
time=["한","두","세","네","다섯","여섯","일곱","여덟","아홉","열","열한","열두"] # 만약 안해줄시 시간을 물을때 "한시"가 아니라 "일시"라고 대답한다
now=datetime.datetime.now()
return time[(now.hour -1)%12]
def Clock_minute(): # 시간 [분]
now=datetime.datetime.now... | StarcoderdataPython |
46539 | <reponame>arruda/amao
#coding: utf-8
import djcelery
djcelery.setup_loader()
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "admin"
BROKER_PASSWORD = "<PASSWORD>"
BROKER_VHOST = "/"
| StarcoderdataPython |
100951 | # -*- coding: utf-8 -*-
#
"""
https://github.com/RDFLib/pySHACL/issues/71
"""
import rdflib
from pyshacl import validate
shacl_file_text = """\
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix... | StarcoderdataPython |
1696044 | <filename>user/config/shortcodes.py
#ADD NEW SHORT CODE DEFENITIONS HERE
#EACH NEW SHORT CODE SHOULD CORRESPOND WITH A FILE IN THE short_codes DIRECTORY
defs = {}
defs.update({"header":"header.html"})
defs.update({"footer":"footer.html"})
defs.update({"title":"title-start.html"})
defs.update({"/title":"title-end.html"}... | StarcoderdataPython |
85311 | #!/usr/bin/env python3
"""
This executable builds takes RST files comprising the SE manual and outputs final PHP files for publication to the SE website.
"""
import os
import argparse
from html import escape
from pathlib import Path
import subprocess
import sys
import tempfile
from bs4 import BeautifulSoup, NavigableS... | StarcoderdataPython |
1653325 | <reponame>febuiles/two1-python
"""Utility for making conversions among various currencies."""
import click
from two1.commands.util import exceptions
from two1.commands.uninstall import uxstring
def create_default_rest_client():
"""Return a rest client using default parameters."""
import two1
from two1 imp... | StarcoderdataPython |
1711604 | '''
Chemical/Building_Blocks/sugars
_______________________________
Simple, monomeric sugar definitions.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
# DATA
# ----
SUGARS = {
'Galactosyl': 'H10 C6 O6',
... | StarcoderdataPython |
7442 | <reponame>hagino3000/apns-proxy-client-py
# -*- coding: utf-8 -*-
"""
APNS Proxy Serverのクライアント
"""
import time
import zmq
import simplejson as json
READ_TIMEOUT = 1500 # msec
FLUSH_TIMEOUT = 5000 # msec
COMMAND_ASK_ADDRESS = b'\1'
COMMAND_SEND = b'\2'
COMMAND_FEEDBACK = b'\3'
DEVICE_TOKEN_LENGTH = 64
JSON_ALERT... | StarcoderdataPython |
122611 | import numpy as np
import pandas as pd
import streamlit as st
import altair as alt
from matplotlib import pyplot as plt
import config, dataset, main, utils
# Matplotlib params
plt.style.use("seaborn")
plt.rcParams["figure.dpi"] = 300
def get_altair_hist_plot(series, name, bin_min, bin_max, bin_step):
"""
P... | StarcoderdataPython |
3226439 | <filename>simple_model/svm_model.py
#Import svm model
import pandas, numpy
from sklearn import svm, metrics
from sklearn.model_selection import train_test_split, KFold
from sklearn.preprocessing import MinMaxScaler, StandardScaler
def calculate(train_data, test_data):
data = train_data.drop(columns=["Unnamed: 0"]... | StarcoderdataPython |
3253429 | <filename>src/parser.py
from os import path
import numpy as np
import glob
from . import mathhelper as mh
import copy
class Atom:
def __init__(self, kind, x, y, z):
self.x = x
self.y = y
self.z = z
self.kind = kind
class Vector:
def __init__(self, x, y, z):
... | StarcoderdataPython |
8429 | <gh_stars>0
import requests
from bs4 import BeautifulSoup, element
class Indeed:
def __init__(self, words, location, offset):
self.url = "https://www.indeed.com/jobs?as_and={}&l={}&sort=date&start={}".format(
"+".join(set(d.strip().lower() for d in words.split(",") if d)),
"+".join... | StarcoderdataPython |
61984 | <reponame>joshswe/simpleArticleManagementSystem
from flask import Flask, render_template, flash, redirect, url_for, session, logging, request
#from data import Articles
from flask_mysqldb import MySQL
from passlib.hash import sha256_crypt
from functools import wraps
from formclass import RegisterForm, ArticleForm
#Cr... | StarcoderdataPython |
185452 | import logging
from django.core.management.base import BaseCommand
import stats.models
import openkamer.dossier
import openkamer.parliament
import openkamer.kamervraag
logger = logging.getLogger(__name__)
class Command(BaseCommand):
MAX_TRIES = 3
def add_arguments(self, parser):
# Named (optional... | StarcoderdataPython |
1636916 | <filename>utils/std_utils.py
from PyQt5 import QtGui, QtCore
class Stream(QtCore.QObject):
newText = QtCore.pyqtSignal(str)
def write(self, text):
if text != '\n':
self.newText.emit(str(text)) | StarcoderdataPython |
1677866 | <filename>rlcard/agents/dqn_agent_pytorch.py
''' DQN agent
The code is derived from https://github.com/dennybritz/reinforcement-learning/blob/master/DQN/dqn.py
Copyright (c) 2019 <NAME>
Copyright (c) 2019 DATA Lab at Texas A&M University
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any ... | StarcoderdataPython |
3325987 | # Array
# Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.
#
# Example 1:
#
# Input:
# [
# [1,1,1],
# [1,0,1],
# [1,1,1]
# ]
# Output:
# [
# [1,0,1],
# [0,0,0],
# [1,0,1]
# ]
# Example 2:
#
# Input:
# [
# [0,1,2,0],
# [3,4,5,2],
# [1,3,1,5]
# ]
# Output:
#... | StarcoderdataPython |
1785709 | import math
import numpy as np
# Note: please don't add any new package, you should solve this problem using only the packages above.
#-------------------------------------------------------------------------
'''
Problem 1: Linear Regression
In this problem, you will implement the linear regression method based... | StarcoderdataPython |
36022 | <reponame>yutian-zhao/STRIPS-HGN
import torch
# import time
# from torch_scatter import scatter
# Maybe see if this is good: https://github.com/rusty1s/pytorch_scatter
# My implementation is quite suboptimal
# def time_fun(f, iter, *args):
# start_time = time.perf_counter()
# start = time.time()
# for i i... | StarcoderdataPython |
3215677 | <reponame>liurenjie520/Shanghai_COVID-19_Push
#!/usr/bin/python3
#coding=utf-8
import wbmonitor
import requests
import urllib.parse
import time
spkey = '88806f3e51f72337714104837f800677'
def trans_format(time_string, from_format, to_format='%Y.%m.%d %H:%M:%S'):
"""
@note 时间格式转化
:param time_string:
:p... | StarcoderdataPython |
3392000 | <reponame>roctubre/data-structures-algorithms
# python3
def parent(i):
return (i - 1) // 2
def leftChild(i):
return i*2 + 1
def rightChild(i):
return i*2 + 2
def siftDown(data, i):
minIndex = i
l = leftChild(i)
r = rightChild(i)
swaps = []
if l < len(data) a... | StarcoderdataPython |
1657264 |
from cv import *
from selenium import webdriver
import os
from bs4 import BeautifulSoup
import time
chromedriver_location = "C:/Users/stark/Downloads/chromedriver"
driver = webdriver.Chrome(chromedriver_location)
driver.get('https://captcha.com/demos/features/captcha-demo.aspx')
captcha_img = '//*[@id="demoCaptcha_... | StarcoderdataPython |
3358090 | <gh_stars>1-10
## decomposition with ground truth
from py3plex.core import multinet
from py3plex.algorithms.network_classification.PPR import *
from py3plex.visualization.benchmark_visualizations import *
from sklearn.svm import SVC
from sklearn.ensemble import ExtraTreesClassifier
#from sklearn.model_selection import... | StarcoderdataPython |
4818868 | <filename>seed.py
seed = '2564f88b-ccd8-4575-9be5-7465fa455f41' | StarcoderdataPython |
1630779 | <filename>tests/em/tdem/test_TDEM_DerivAdjoint_galvanic.py
from __future__ import division, print_function
import unittest
import numpy as np
import discretize
from SimPEG import maps, SolverLU, tests
from SimPEG.electromagnetics import time_domain as tdem
from pymatsolver import Pardiso as Solver
plotIt = False
test... | StarcoderdataPython |
1624315 | import unittest
from katas.beta.multiples_2 import multiples
class MultiplesTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(multiples(49), 'Fizz')
def test_equals_2(self):
self.assertEqual(multiples(147), 'Fang')
def test_equals_3(self):
self.assertEqual(mul... | StarcoderdataPython |
4803341 | <gh_stars>1-10
import scipy.stats as spss
#import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import glob,os
import pandas as pd
import ipyparallel
import hddm
from kabuki.analyze import gelman_rubin
import sys
import time
from IPython.display import clear_output
print(os.getcwd())
def wait_watc... | StarcoderdataPython |
3395078 | """Classes and functions to manage site-specific configuration"""
from .cori import CoriBatchSite, CoriInteractiveSite
from .local import LocalSite, Site
from .ccin2p3 import CCParallel
import os
# Maps names from config files to classes.
site_classes = {
"local": LocalSite,
"cori-interactive": CoriInteracti... | StarcoderdataPython |
3282206 | """
Definition of all artifactory objects.
"""
import warnings
import json
import logging
import os
from os.path import isdir, join
from typing import List, Optional, Dict, Tuple, Union, Iterator
from pathlib import Path
import requests
from requests import Response
from pydantic import parse_obj_as
from pyartifactor... | StarcoderdataPython |
41301 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#import bibliotek
from keras.applications.resnet50 import ResNet50, decode_predictions,preprocess_input
from keras.preprocessing import image
import numpy as np
import requests
from io import BytesIO
from PIL import Image
# In[2]:
#podbranie modelu ResNet50
model... | StarcoderdataPython |
3327786 | <gh_stars>0
# -*- coding: utf-8 -*-
from typing import Any, Optional
from pip_services3_rpc.clients import RestClient
class TestRestClient(RestClient):
"""
REST client used for automated testing.
"""
def __init__(self, base_route: str):
super(TestRestClient, self).__init__()
self._ba... | StarcoderdataPython |
99321 | from flask import Flask
app = Flask(__name__)
app.config.from_object('settings')
import govhack2014.routes # noqa
| StarcoderdataPython |
3221380 | <gh_stars>1-10
from django.db import models, migrations
from django.core.files.storage import FileSystemStorage
import mayan.apps.document_signatures.models
class Migration(migrations.Migration):
dependencies = [
('document_signatures', '0001_initial'),
]
operations = [
migra... | StarcoderdataPython |
3326835 | import os.path as osp
from tqdm import tqdm
from copy import deepcopy
import torch
import dgl
from torch.utils.data import DataLoader, Dataset
from dgl import DGLGraph, NID
from dgl.dataloading.negative_sampler import Uniform
from dgl import add_self_loop
from utils import drnl_node_labeling
class GraphDataSet(Datase... | StarcoderdataPython |
172760 | from uuid import uuid4
from botocore.exceptions import EndpointConnectionError
from boto3.dynamodb.conditions import Key, Attr
from chalice import NotFoundError
from chalicelib.validates import Validates
from chalicelib.exceptions import DatabaseConnectionError
DEFAULT_USERNAME = 'default'
def except_endpoint_con... | StarcoderdataPython |
1684748 | <reponame>jeehan24/the-vikings
import datetime
import jwt
from .import bcrypt, db, app
class BaseModel(db.Model):
"""Base data model for all objects"""
__abstract__ = True
def __init__(self, *args):
super().__init__(*args)
def __repr__(self):
"""Define a base way to print models"""
... | StarcoderdataPython |
3380510 | <reponame>sanjaradylov/moleculegen-ml<gh_stars>1-10
"""
Common data type annotations used in the project.
"""
from typing import Callable, List, Literal, Union
from mxnet import context, gluon, init, nd, optimizer
Activations = Literal['sigmoid', 'tanh', 'relu', 'softrelu', 'softsign']
ActivationT = Union[
None... | StarcoderdataPython |
3302644 | <gh_stars>1-10
import zmq
import capnp
import test_capnp
context = zmq.Context()
print("Connecting to hello world server...")
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:5555")
for request in range(10):
print("Sending request %s ..." % request)
msg = test_capnp.Test.new_message()
msg.i... | StarcoderdataPython |
1611684 | import torch
from torch.nn import Parameter
import torch.nn.functional as F
from src.inits import glorot, zeros
class DenseGSDNEFConv(torch.nn.Module):
def __init__(self, in_channels, out_channels, alpha, K, improved=False, bias=True):
super(DenseGSDNEFConv, self).__init__()
self.in_channels = in... | StarcoderdataPython |
3343706 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_main.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGu... | StarcoderdataPython |
1745740 | <reponame>zhaoyc1990/perblog<filename>welcome/migrations/0028_ad.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('welcome', '0027_auto_20170622_1823'),
]
operations = [
m... | StarcoderdataPython |
3395848 | #!/usr/bin/env python3
#
# This script is run by a cron job as the DAEMON_USER
#
# Runs lichen plagiarism detector for saved configuration
#
import os
import sys
import pwd
import time
import subprocess
import json
from shutil import rmtree
# ------------------------------------------------------------------------
#... | StarcoderdataPython |
1759095 | import enum
class CyclePointOfInterestPayment(enum.Enum):
"""IPPNT :: Cycle Point Of Interest Payment.
Usually, interest is paid at the end of each IPCL which corresponds to a IPPNT value of E which is also the default. If interest payment occurs at the beginning of the cycle, the value is B.
"""
# ... | StarcoderdataPython |
4814187 | from django import apps
class AppConfig(apps.AppConfig):
name = 'galaxy_api.auth'
label = 'galaxy_auth'
| StarcoderdataPython |
1652655 | import os
import unittest
from aoc.day05.day05 import count_overlapping_coords, get_example_data, get_input_data
class TestDay05(unittest.TestCase):
def test_05a_example(self):
self.assertEqual(5, count_overlapping_coords(get_example_data()))
def test_05a(self):
self.assertEqual(7380, count_... | StarcoderdataPython |
3293045 | <reponame>erickeloi/ExerciciosTreino
# Exercício Python 107: Exercitando módulos em Python
# Crie um módulo chamado moeda.py que tenha as funções incorporadas:
# aumentar(), diminuir(), dobro() e metade().
# Faça também um programa que importe esse módulo e use algumas dessas funções.
from ex107 import moeda
fro... | StarcoderdataPython |
112670 | from sqlalchemy.orm import Session
from src.models import sql
from src.models.api import UserInDB
def get_user(db: Session, username: str) -> UserInDB:
return UserInDB.from_orm(db.query(sql.User).filter(sql.User.username == username).first())
| StarcoderdataPython |
3277154 | <gh_stars>10-100
import os
from subprocess import call
from gmusicapi import api
g = api.Api()
print "Loging..."
g.login("email", "password")
print "OK !"
for song in g.get_all_songs():
if not song["artist"]:
song["artist"] = "Undefined"
path = os.path.join("Musique", song["artist"])
if not os.pat... | StarcoderdataPython |
3229076 | <filename>flypy/compiler/typing/tests/test_overloading.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import unittest
from flypy import jit
@jit('int32 -> int32 -> int32')
def f(a, b):
return a + b
@jit('float64 -> float64 -> float64')
def f(a, b):
retu... | StarcoderdataPython |
189387 | <filename>pygrading/exception.py
"""
Name: exception.py
Author: <NAME> <<EMAIL>>
Propose: PyGrading exceptions
Coding: UTF-8
"""
class DataTypeError(Exception):
pass
class FunctionsTypeError(Exception):
pass
class FieldMissingError(Exception):
pass
class ExecError(Exception):
pas... | StarcoderdataPython |
195778 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the dynamic output module."""
from __future__ import unicode_literals
import unittest
from plaso.containers import events
from plaso.formatters import interface as formatters_interface
from plaso.formatters import manager as formatters_manager
from plaso.li... | StarcoderdataPython |
3329533 | <reponame>cityofships/tempest<filename>tempest/lib/services/identity/v3/identity_providers_client.py
# Copyright 2020 Samsung Electronics Co., Ltd
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain ... | StarcoderdataPython |
53666 | <gh_stars>10-100
DEFAULT_WINDOW_SIZE = 32
DEFAULT_THRESHOLD_MIN_BASIC = 45.39
DEFAULT_THRESHOLD_MAX_BASIC = 46.0
DEFAULT_THRESHOLD_MIN_ABS = 50.32
DEFAULT_THRESHOLD_MAX_ABS = 52.96
DEFAULT_THRESHOLD_MIN_WITHOUT_GC = 11.28
DEFAULT_THRESHOLD_MAX_WITHOUT_GC = 11.42
DEFAULT_MEAN_GC = 0.46354823199323626
DEFAULT_MAX_EVALUE ... | StarcoderdataPython |
91402 | from django.contrib import admin
from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('',views.home , name = "home"),
path('about&contact',views.about , name = "about"),
path('report',views.report_data , name = ... | StarcoderdataPython |
14468 | <gh_stars>0
'''for c in range(1, 10):
print(c)
print('FIM')'''
'''c = 1
while c < 10:
print(c)
c += 1
print('FIM')'''
'''n = 1
while n != 0: #flag ou condição de parada
n = int(input('Digite um valor: '))
print('FIM')'''
'''r = 'S'
while r == 'S':
n = int(input('Digite um valor: '))
r = str(i... | StarcoderdataPython |
167216 | <filename>InjectionLog/migrations/0030_cats_sharable.py<gh_stars>1-10
# Generated by Django 3.0.6 on 2020-05-31 23:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('InjectionLog', '0029_auto_20200531_2225'),
]
operations = [
migrations... | StarcoderdataPython |
3397213 | # Author: <NAME>, <EMAIL>
#Get all unique values corresponding to all keys in a dictionary(including any enclosed sub dictionaries)
def getAllValues(obj):
values=[]
if(isinstance(obj,dict)):
keys=obj.keys()
for key in keys:
val_list=getAllValues(obj[key])
for value in val_list:
if value not in values:
... | StarcoderdataPython |
3205577 | <gh_stars>1-10
from conans import ConanFile, CMake
class SummerFrameworkConan(ConanFile):
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
| StarcoderdataPython |
3377907 | from typing import Optional
def binary_search(
array: list[int],
value: int,
start: Optional[int] = None,
end: Optional[int] = None,
) -> int:
"""Returns if given number exists in an array"""
if start is None or end is None:
start, end = 0, len(array)-1
if start < ... | StarcoderdataPython |
3282401 | # Generated by Django 2.0.8 on 2018-09-24 23:13
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app_projects', '0007_auto_20180922_1308'),
('app_tasks', '0004_taskaction'),
... | StarcoderdataPython |
1680772 | # Adapted from https://github.com/anki/vector-python-sdk/blob/master/examples/apps/remote_control/remote_control.py
import argparse
import sys
import anki_vector
import pyglet
from pyglet.window import key
import vector_utils as utils
class RemoteControlVector:
def __init__(self, robot):
self.vector = r... | StarcoderdataPython |
95298 | <filename>src/utest/tools/g12.py
# _*_ coding:utf-8 _*_
import tkinter
from tkinter import filedialog
def openfiles2():
s2fname = filedialog.askopenfilename(title='打开S2文件', filetypes=[('S2out', '*.jpeg'), ('All Files', '*')])
print(s2fname)
print(type(s2fname))
print(dir(s2fname))
def openfilecgns():
... | StarcoderdataPython |
104061 | <reponame>ORC-RIS/beiwe-backend
import json
from django.http import FileResponse
from django.http.response import HttpResponse
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_POST
from authentication.data_access_authentication import (api_credential_check,
api_study... | StarcoderdataPython |
3236740 | <reponame>Rajmohanraj/profiles-rest-api
from django.db import router
from django.urls import path, include
from profile_api import views
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('hello_viewset',views.HelloViewSet,basename ='hello_viewset')
router.register('profile',vie... | StarcoderdataPython |
3210296 | <filename>choking_commonality.py
#help("modules") #
import urllib.request
import math
import statistics
import collections
import ast
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
"""
Hypothesis 2: A refutation of the more wins and/or better percentage i... | StarcoderdataPython |
3316069 | from skygear.settings import SettingsParser, add_parser
from .conversation_handlers import (register_conversation_hooks,
register_conversation_lambdas)
from .decorators import (after_conversation_created,
after_conversation_deleted,
... | StarcoderdataPython |
3271006 | <gh_stars>1-10
from hr import PayrollSystem
from employees import Manager, Secretary, SalesPerson, FactoryWorker
from productivity import ProductivitySystem
manager = Manager(id=1, name="<NAME>", weekly_salary=1500)
secretary = Secretary(id=2, name="<NAME>", weekly_salary=1200)
sales_guy = SalesPerson(id=3, name="<NAM... | StarcoderdataPython |
1661958 | <reponame>Jonnyblacklabel/gsc_sa_downloader<gh_stars>1-10
# _ __ __ __ __ __ __
# (_)___ ____ ____ __ __/ /_ / /___ ______/ /__/ /___ _/ /_ ___ / /
# / / __ \/ __ \/ __ \/ / / / __ \/ / __ `/ ___/ //_/ / __ `/ __ \/ _ \/ /
# / / /_/ / / / / / ... | StarcoderdataPython |
99252 | # Generated by Django 3.0.11 on 2020-12-12 22:52
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0005_remove_user_home_address'),
]
operations = [
migrations.Add... | StarcoderdataPython |
181170 | # ------------------------------------------------------------------------------
# BSD 2-Clause License
#
# Copyright (c) 2019, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions... | StarcoderdataPython |
3256602 | # -*- coding: utf-8 -*-
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Authors: <NAME> / Coopérative ARTEFACTS <<EMAIL>>
from rest_framework import viewsets
from django.contrib.auth.models import User as UserModel
... | StarcoderdataPython |
22443 | from datetime import datetime
import boto3
import json
from .stage import Stage
class SQS(object):
"""
class SQS is a collection of utils related to Foursight queues
"""
def __init__(self, foursight_prefix):
self.stage = Stage(foursight_prefix)
def invoke_check_runner(self, runner_input)... | StarcoderdataPython |
47606 | <gh_stars>0
import numpy as np
from itertools import chain, combinations
# this function definetely has bad normalization right now (maybe counting
# wrong in general)
def find_wildcards(bool_node, inputs=3, norm=True, ones=False):
# we can rely on cana to redescribe things for us
pis = list(bool_node.pi_cove... | StarcoderdataPython |
187873 | from Stephanie.configurer import config
# noinspection SpellCheckingInspection
class AudioRecognizer:
def __init__(self, recognizer, UnknownValueError, RequestError):
self.UnknownValueError = UnknownValueError
self.RequestError = RequestError
self.r = recognizer
self.c = config
... | StarcoderdataPython |
1627474 | <filename>reader.py
import json
class reader:
def __init__(self, want, num, quiz):
self.want = want
self.num = num
self.quiz = quiz
def read(self, want, num, quiz):
with open ("quizzes/"+quiz+".json", "r") as f: # Open file for reading
data = json.load(f)
re... | StarcoderdataPython |
1779261 | <gh_stars>1-10
import settings as sett
import numpy as np
import math
# ------------------------------------------------------------------------------------------------------------
#initialize global variables
sett.init()
# ST Kernel density estimation
#-------------------------------------------------------... | StarcoderdataPython |
1685483 | # Copyright (c) 2021, <NAME>, All rights reserved.
from data.based.based_dataset import BasedDataset
from data.preprocessing import Encoders, Scalers
from eda.based.based_analyzer import BasedAnalyzer
from eda.based.based_plots import BasedPlot
def do_analysis(dataset: BasedDataset, plots: BasedPlot, analyzer: Base... | StarcoderdataPython |
1642851 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 22 13:00:59 2021
@author: jackreid
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import csv
from screeninfo import get_monitors
import dateutil
from datetime import datetime
#Set filepath of data
filepaths = ['/home/... | StarcoderdataPython |
1612945 | """
Created on Thu Oct 12 11:57:28 2017
@author: tomas
"""
import torch
import torch.nn as nn
from . import utils
from . import box_utils
from . import boxIoU
class BoxSampler(nn.Module):
def __init__(self, opt, logger):
super(BoxSampler, self).__init__()
self.opt = {}
self.low_thresh = u... | StarcoderdataPython |
1602078 | <gh_stars>1-10
import sys
import numpy as np
from .baseclassifier import BaseClassifier
# Calculate gini impurity of vector {f}
def gini(f):
return 1.0 - np.sum(np.square(f))
# Score the split given by {splitval} on {dim} according to gini impurity
def score_split(splitval, dim, left, right):
N = len(left) +... | StarcoderdataPython |
1743886 | #!/usr/bin/env python3
# Copyright 2020 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
1743067 | <gh_stars>1-10
# -*- encoding: utf-8 -*-
'''
@Filename : db_context_holder.py
@Datetime : 2020/09/21 16:25:04
@Author : Joe-Bu
@version : 1.0
'''
import sys
sys.path.append('../../')
from sqlalchemy import create_engine
from sqlalchemy.schema import MetaData
from sqlalchemy.orm import sessionmaker
cl... | StarcoderdataPython |
3205171 | from functools import partial
import platform
from os import getenv
""" This module allows printing coloured output to the terminal when running a
Wget Test under certain conditions.
The output is coloured only on Linux systems. This is because coloured output
in the terminal on Windows requires too much effort for wh... | StarcoderdataPython |
3372809 | from gen_art.graphics.Vector import Vector as vec2
from noise import pnoise2
from random import randint, choices
from math import cos
from math import sin
from math import radians
# Noise loop generator
class NoiseLoop:
def __init__(self, diameter, _min, _max):
self.diameter = diameter
self.min = ... | StarcoderdataPython |
3221357 | <filename>nesi/devices/softbox/api/models/subrack_models.py
# This file is part of the NESi software.
#
# Copyright (c) 2020
# Original Software Design by <NAME> <https://github.com/etingof>.
#
# Software adapted by inexio <https://github.com/inexio>.
# - <NAME> <https://github.com/unkn0wn-user>
# - <NAME> <https://git... | StarcoderdataPython |
4827447 | <gh_stars>1-10
"""Copyright (c) 2018, <NAME>
2021, <NAME>"""
import warnings
import numpy as np
import pandas as pd
from bites.utils import ipcw
from bites.utils import utils, admin
from bites.utils.concordance import concordance_td
class EvalSurv:
"""Class for evaluating predictions.
Argu... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.