id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
35158 | <reponame>Li-fAngyU/Paddle
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2022 NVIDIA Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | StarcoderdataPython |
6543657 | <reponame>hwixley/SDP-DrPhil
import py_trees
import numpy as np
def dummy_nearest_obstacle(scan):
return(np.argmin(scan.ranges),0)
class ClosestObstacle(py_trees.behaviour.Behaviour):
""" a behaviour which analyses the "/scan" blackboard variable and sets "closest_obstacle/angle" and "closest_obstacle/distanc... | StarcoderdataPython |
117349 | <filename>app/tilt_resources/meta.py<gh_stars>1-10
import uuid
from datetime import datetime
import hashlib
import json
from typing import Dict
from database.models import MetaTask, Task
class Meta:
def __init__(self, _id=None, name=None, version=None, language=None, created=None,
modified=None... | StarcoderdataPython |
11217530 | # -*- coding: utf-8 -*-
import sys
import time
from os.path import dirname, join as join_path
from chibitest import TestCase, Benchmark, ok
class BenchmarkLibraries(Benchmark):
def setup(self):
fp = join_path(dirname(__file__), 'data', 'markdown-syntax.md')
with open(fp, 'r') as f:
s... | StarcoderdataPython |
3479400 | <reponame>hamiltonparker/Learning
from distutils.core import setup
setup(name = 'HNFGen',
version = '1.0',
py_modules=['HNFGen'],
)
| StarcoderdataPython |
11270898 | #!/usr/bin/env python
import asyncio
import logging
from typing import Optional, List
from hummingbot.core.data_type.user_stream_tracker_data_source import UserStreamTrackerDataSource
from hummingbot.logger import HummingbotLogger
from hummingbot.core.data_type.user_stream_tracker import UserStreamTracker
from humming... | StarcoderdataPython |
149750 | <gh_stars>1000+
# Copyright 2016 ClusterHQ Inc. See LICENSE file for details.
from benchmark.metrics_parser import (
mean, container_convergence, cpu_usage_for_process,
wallclock_for_operation, request_latency, handle_cputime_metric,
handle_wallclock_metric
)
from flocker.testtools import TestCase
class... | StarcoderdataPython |
5001856 | <filename>ms-refsnumber.py
#!/usr/bin/python
"""
This bot creates pages listing count of references to article from list:
Wikipedysta:Andrzei111/nazwiska z inicjałem
Call: python pwb.py masti/ms-refsnumber.py -page:'Wikipedysta:Andrzei111/nazwiska z inicjałem'
-summary:"Bot aktualizuje stronę" -outpage:'Wikipe... | StarcoderdataPython |
11315147 | import numpy as np
import pandas as pd
from scipy import stats
from rdkit.Chem import RDKFingerprint
from rdkit.Chem import AllChem
from rdkit.Chem import MACCSkeys
from rdkit.Chem import DataStructs
from mordred import Calculator, descriptors
from drug_learning.two_dimensions.Input import base_class as bc
from drug_le... | StarcoderdataPython |
1984113 | <filename>physicslib/unit.py
"""Unit class and unit constants."""
from typing import Final
from . import dimension
from .formating import superscripted
def convert_float(func):
"""
Decorator for Unit class.
Converts second argument (`other`) to Unit.
"""
def wrapper(self, other):
if not ... | StarcoderdataPython |
5041515 |
from collections import OrderedDict
from rlkit.core.timer import timer
from rlkit.core import logger
import torch
import ray
import os
class RayVAETrainer:
def __init__(self, trainer, train_dataset, test_dataset, variant, num_epochs):
self.t = trainer
self.train_dataset = train_dataset
s... | StarcoderdataPython |
12805189 | <reponame>egonrian/google-research<gh_stars>1-10
# coding=utf-8
# Copyright 2020 The Google Research 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/lic... | StarcoderdataPython |
1753795 | #!/usr/bin/env python3
import pandas as pd
import requests
import time
import json
import os
headers = {"Authorization": "Bearer {:}".format('')}
if __name__ == "__main__":
df = pd.read_csv("missing_twitter_with_handles2.csv", header=None)
df.insert(3, "twitter_id", ['' for k in df.index], True)
last_ti... | StarcoderdataPython |
4837420 | <gh_stars>1-10
#!/usr/bin/env python
import os
import sys
import jinja2
import opendbc
from common.dbc import dbc
if len(sys.argv) != 3:
print "usage: %s dbc_path struct_path" % (sys.argv[0],)
sys.exit(0)
dbc_fn = sys.argv[1]
out_fn = sys.argv[2]
template_fn = os.path.join(os.path.dirname(__file__), "dbc_templ... | StarcoderdataPython |
6580821 | <gh_stars>1-10
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import re
from aws_cdk import core
def format_aws_resource_name(feature_name: str, project_name... | StarcoderdataPython |
8103762 | <gh_stars>0
# -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import
import os
# Import Salt Testing libs
from tests.support.unit import skipIf, TestCase
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, patch
# Import salt libs
import salt.utils
@skipIf(NO_MOCK, NO_MOCK_REASON)
cl... | StarcoderdataPython |
9648874 | from JumpScale import j
import time
class RedisDB:
def __init__(self):
self.__jslocation__ = "j.data.redisdb"
def get(self, path, expiration=None):
"""
@param path in form of someting:something:...
TODO: *2 please describe and give example
"""
return RedisDB... | StarcoderdataPython |
35727 | # Get arxiv data
import json
import logging
import os
import pickle
from collections import Counter
from datetime import datetime
from io import BytesIO
from zipfile import ZipFile
import numpy as np
import pandas as pd
import requests
from kaggle.api.kaggle_api_extended import KaggleApi
from eurito_indicators impor... | StarcoderdataPython |
8117825 | <filename>back/test/models/test_social_helpers.py
import pytest
from back.models import helper
from back.models.social import Like, DisLike
from back.exceptions import _SchemaLoadError
def test_add_like(user_data, like_data, db_session):
assert db_session.query(Like).all() == []
user_id = helper.add_user(us... | StarcoderdataPython |
372629 | import unittest
class Employee:
def __init__(self, name, lab, age):
self.name = name
self.lab = lab
self.age = age
john = Employee('john', 'computer lab', 40)
class Test(unittest.TestCase):
def test(self):
self.assertEqual(john.name, 'john')
if __name__=='__main__':
unittest.main() | StarcoderdataPython |
302517 | <reponame>AndersenLab/liftover-utils<filename>liftover/liftover.py
"""
Usage:
liftover.py <file> <release1> <release2> (bcf|vcf|gff|bed|refflat)
liftover.py <file> <release1> <release2> <chrom_col> <start_pos_column> [<end_pos_column>] [options]
Options:
-h --help Show this screen.
--delim=<delim> File De... | StarcoderdataPython |
1835326 | <reponame>n0rel/self
import queue
from PyQt5 import QtCore, QtGui, QtWidgets
class tools(QtWidgets.QWidget):
def __init__(self, eventQueue: queue.Queue):
QtWidgets.QWidget.__init__(self, None)
self.setFixedHeight(50)
self.eventQueue = eventQueue
self.layout = QtWidgets.QHBoxLayout... | StarcoderdataPython |
189353 | <reponame>codervikash/online-courses
#!/usr/bin/python
"""
Majority Element: A majority element in an array A[] of size n is an element that appears more than n/2 times (and hence there is at most one such element).
Write a function which takes an array and emits the majority element (if it exists), otherwise prints ... | StarcoderdataPython |
4950438 | # This entrypoint file to be used in development. Start by reading README.md
import prob_calculator
from unittest import main
prob_calculator.random.seed(95)
hat = prob_calculator.Hat(blue=3,red=2,green=6)
probability = prob_calculator.experiment(
hat=hat, expected_balls={"blue":2,"green":1}, num_balls_dr... | StarcoderdataPython |
1740902 | <reponame>XinchaoGou/MyLeetCode
from typing import List
class Solution:
def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:
path = []
res = []
candidates.sort()
self.__dfs(0, candidates, path, res, target)
return res
def __dfs(self, begin,... | StarcoderdataPython |
6676905 | <reponame>jfathi/document-understanding-solution<gh_stars>100-1000
import boto3
import json
import datetime
def convert_datetime_to_string(obj):
if isinstance(obj, datetime.datetime):
return obj.__str__()
def on_create(event, context):
kendra_client = boto3.client('kendra')
# get status of index
... | StarcoderdataPython |
3457358 | def reverse():
word=input("Word: ")
index=len(word)-1;
reversedWord=[];
while index>0:
reversedWord.append(word[index]);
index-=1;
reversedWord.append(word[0]);
polished="".join(reversedWord);
print (polished);
| StarcoderdataPython |
4807924 | import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras import losses
def create_embeddings_matrix(vectorizer, embeddings_path, embedding_dim=100, mask_zero=True):
embeddings_index = {}
with open(embeddings_path) as f:
for line in f:
word, coefs... | StarcoderdataPython |
1823023 | def full_function():
# Note that this function is not called, it's there just to make the mapping explicit.
a = 1 # map to cEll1, line 2
b = 2 # map to cEll1, line 3
c = 3 # map to cEll2, line 2
d = 4 # map to cEll2, line 3
def create_code():
cell1_code = compile(''' # line 1
a = 1 # lin... | StarcoderdataPython |
12866364 | <filename>steel_segmentation/utils.py<gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_eda.ipynb (unless otherwise specified).
__all__ = ['palet', 'seed_everything', 'print_competition_data', 'get_train_pivot', 'get_train_df', 'count_pct',
'get_classification_df', 'rle2mask', 'make_mask', 'm... | StarcoderdataPython |
8094468 | <gh_stars>0
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import OneHotEncoder
from sklearn.impute import SimpleImputer
from sklearn.compose import ColumnTransformer
#Carregando a base de dados de treino e teste
trein... | StarcoderdataPython |
8075550 | <reponame>eeetem/GPT3-Discord-Bot
import discord
import asyncio
import random
import time
import openai
client = discord.Client()
with open('ApiKey.txt') as f:
openai.api_key = f.readline()
with open('BotKey.txt') as f:
BotKey = f.readline()
@client.event
async def on_ready():
print('We have logge... | StarcoderdataPython |
6557385 | <reponame>jantzen/eugene
# fragment_timeseries.py
from __future__ import division
import warnings
import numpy as np
import pdb
""" Methods for dividing a timeseries into multiple sub-series for anaylsis by
dynamical distance.
"""
def split_timeseries(data, num_frags, verbose=False):
""" data: a list of length ... | StarcoderdataPython |
12816858 | <reponame>ferren/pyXterm<filename>demo/Main.py
#!/bin/env python
#----------------------------------------------------------------------------
# Name: Main.py
# Purpose: Testing lots of stuff, controls, window types, etc.
#
# Author: <NAME>
#
# Created: A long time ago, in a galaxy far, far away... | StarcoderdataPython |
6557186 | <reponame>michalk8/NeuralEE<gh_stars>1-10
import torch
import math
@torch.no_grad()
def error_ee(X, Wp, Wn, lam):
"""Elastic embedding loss function.
It's quite straightforward, may unapplicable when size is large,
and the alternative error_ee_cpu and error_ee_cuda are designed to
release computation... | StarcoderdataPython |
3599811 | <gh_stars>10-100
__author__ = 'jatwood'
import sys
import numpy as np
from sklearn.metrics import f1_score, accuracy_score
from sklearn.linear_model import LogisticRegression
import data
import util
import kernel
import structured
def node_proportion_baseline_experiment(model_fn, data_fn, data_name, model_name, pro... | StarcoderdataPython |
81897 | # BSD Licence
# Copyright (c) 2009, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.
# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
# This software may be distributed un... | StarcoderdataPython |
1981328 | <gh_stars>1-10
import numpy as np
import imageio
import cv2
import sys, os
#Processing Original Image
def process_img(location_img):
image = imageio.imread(location_img)
image = image.astype(np.float32)/255
return image
#Load and construct Ground Truth
def read_gt(location_gt):
entries = os.list... | StarcoderdataPython |
3589588 | <reponame>tom-doerr/download_images_train_classifier<filename>download.py
#!/usr/bin/env python3
'''
Download images of certain class from the web.
The classes of images for which to download images are in the images_to_downloaded
list. Save the images to disk.
'''
images_to_downloaded = ['cat', 'dog']
import os
im... | StarcoderdataPython |
1734387 | from PySide2.QtWidgets import QWidget, QLabel, QGridLayout
from PySide2.QtCore import Qt
from PySide2.QtGui import QPixmap, QFont
class HomeWindow(QWidget):
def __init__(self, rboost):
super().__init__()
self.rboost = rboost
self.layout = QGridLayout()
self._display_welcome()
... | StarcoderdataPython |
3470144 | # Copyright (C) 2018 SCARV project <<EMAIL>>
#
# Use of this source code is restricted per the MIT license, a copy of which
# can be found at https://opensource.org/licenses/MIT (or should be included
# as LICENSE.txt within the associated archive or repository).
from sca3s import backend as sca3s_be
from sca3s i... | StarcoderdataPython |
3300093 | <filename>questions.py
#!/usr/bin/python
# TODO: make that external image alternative texts are shown in a different color, maybe with a link to the external image.
"""
Question 7511789 / 35823053 at 2016-09-10 02:54:33.993394 ETA: 2016-09-29 17:33:47.519406
Traceback (most recent call last):
File "./questions.py",... | StarcoderdataPython |
365349 | <filename>data_collection.py
colleges = [
'National Institute of Technology, Kurukshetra' ,
'National Institute of Technology Raipur' ,
'National Institute of Technology, Rourkela' ,
'National Institute of Technology Calicut' ,
'Indian Institute of Engineering Science and Technology, Shibpur' ,
'National Institute of ... | StarcoderdataPython |
3496303 | <gh_stars>0
# Generated by Django 3.1.5 on 2021-01-10 11:28
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import game.models
class Migration(migrations.Migration):
dependencies = [
('game', '0004_game_state'),
]
operations = [
mig... | StarcoderdataPython |
3392033 | #170401022 <NAME>
import socket
import os
import time
Target_IP= "192.168.2.8"
TCP_Port= 142
print("Forwardaing to targeted IP addresses..")
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
TCP_Link = (Target_IP,TCP_Port)
Message1 = "Time information "
try:
sock.connect(TCP_Link)
except:
print("Connecti... | StarcoderdataPython |
90551 | from ..dyck import Grammar
from ..grammar_utils import *
"""
ababaacbcbcc
W
- [W] null
- [BC] b -> c
- [AB] a -> b
BC(|ab|,|c|)
BC(ab |ab|, |c| c)
AB(abab |a|, |cb| cc)
W(ababa |acb|, cbcc)
# extra
W(abc, abc)
#
BC(|ab|, |c|)
AB(ab|a|, |cb|c)
BC(|ab|aba, cbc|c|)
AB(ababa|a|, |cb|cbcc)
"""
all_state... | StarcoderdataPython |
3546564 | # Copyright 2019 The Google Research 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 applicable law or agree... | StarcoderdataPython |
8148501 | import serial
import json
from pynput.keyboard import Key, Listener
ser = serial.Serial("COM26", 115200, timeout=1)
print("****** Gardening / Agricultural Robot *******")
print("Controls")
print("w => Froward")
print("s => Backward")
print("d => Right")
print("a => Left")
print("e => Face Forward")
print("q => Stop... | StarcoderdataPython |
9737270 | <filename>Face_Enhancement/data/base_dataset.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch.utils.data as data
from PIL import Image
import torchvision.transforms as transforms
import numpy as np
import random
class BaseDataset(data.Dataset):
def __init__(self):
... | StarcoderdataPython |
11229477 | import re
import setuptools
from os.path import join
with open("README.md", "r") as fh:
long_description = fh.read()
with open(join('pleroma_bot', '__init__.py')) as f:
line = next(l for l in f if l.startswith('__version__'))
version = re.match('__version__ = [\'"]([^\'"]+)[\'"]', line).group(1)
setupto... | StarcoderdataPython |
3523118 | from . import bzip2, gzip
| StarcoderdataPython |
6671010 | from __future__ import absolute_import, print_function
# checks
try:
import tensorflow
del tensorflow
except ModuleNotFoundError as e:
from six import raise_from
raise_from(RuntimeError('Please install TensorFlow: https://www.tensorflow.org/install/'), e)
import tensorflow, sys
from ..utils.tf import... | StarcoderdataPython |
3356596 | <gh_stars>0
from datetime import datetime
import json
import os
import sys
import uuid
SEPARATOR='###|'
HERE=os.path.dirname(os.path.realpath(__file__))
OUTPUT=os.path.join(HERE, "dist")
# Mask to parse:
# Friday, September 22, 2017 at 1:00:52 AM
DATETIME_IMPORT_MASK='%A, %B %d, %Y at %I:%M:%S %p'
DATETIME_SAVE_MAS... | StarcoderdataPython |
59935 | import subprocess
import PIL
from PIL import Image
import numpy as np
import os
import shutil
import re
script_path = os.path.dirname(os.path.realpath(__file__))
temp_img_dir_path = os.path.join(script_path, 'temp_imgs')
def arr_to_mp4(arr, output_path, framerate=30, resolution_str=None, temp_dir=temp_img_dir_path):
... | StarcoderdataPython |
3481928 | print("How old are you?", end = ' ')
age = input()
print("How tall are you?", end = ' ')
height = input()
print("How much do you weigh?", end = ' ')
weight = input()
print(f"So, you're {age} years old, {height} meters tall and {weight} kilograms heavy.")
| StarcoderdataPython |
1974856 | <reponame>DVS-Lab/dmn-parcellation
from neurosynth.analysis.meta import MetaAnalysis
import nibabel as nib
import numpy as np
from copy import deepcopy
def mask_level(img, level):
""" Mask a specific level in a nifti image """
img = deepcopy(img)
data = img.get_data()
data[:] = np.round(data)
data[... | StarcoderdataPython |
3282108 | <gh_stars>1-10
import codecs
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
REQUIREMENTS = [
'schematics',
'protobuf',
]
TEST_REQUIREMENTS = [
'flake8',
'mock',
'tox',
'pytest',
'pytest-cache',
'pytest-cover',
'pytest-suga... | StarcoderdataPython |
12824085 | def orbits(inp):
tree = []
index = {'COM': tree}
for a, b in inp:
if b not in index:
index[b] = []
if a not in index:
index[a] = []
index[a].append(index[b])
return tree, index
def inp():
with open('code/6.txt') as f:
raw = f.read()
retur... | StarcoderdataPython |
11209789 | <reponame>ponyatov/w
# Generated by Django 3.2 on 2021-04-19 06:48
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('map', '0008_auto_20210419_1016'),
]
operations = [
migrations.RemoveField(
... | StarcoderdataPython |
33171 | from django.shortcuts import render, redirect
from django.views.generic import UpdateView, DeleteView
from .models import Storage
from django_tables2 import RequestConfig
from .tables import StorageTable
from django.contrib.auth.decorators import login_required
from .forms import StorageForm, QuestionForm
def index(r... | StarcoderdataPython |
4891174 | <gh_stars>1-10
from fforma.fforma import *
| StarcoderdataPython |
11213405 | import pytest
from fastai import *
from fastai.vision import *
@pytest.fixture(scope="module")
def path(request):
path = untar_data(URLs.MNIST_TINY)
d = defaults.device
defaults.device = torch.device('cpu')
def _final(): defaults.device = d
request.addfinalizer(_final)
return path
def test_mul... | StarcoderdataPython |
73747 | <filename>miri/datamodels/operations.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Arithmetic and binary operator functions for the MIRI data model.
:Reference:
The STScI jwst.datamodels documentation.
https://jwst-pipeline.readthedocs.io/en/latest/jwst/datamodels/index.html
:History:
24 Jan 2011: Created
2... | StarcoderdataPython |
6567782 | <reponame>DeonBest/ACEPython<gh_stars>0
"""
Mic Recorder
This is a helper class for the Mic Reader.
It records microphone data and stores it in frames.
Author: <NAME>
Date: February 2021
"""
# class taken from the SciPy 2015 Vispy talk opening example
# see https://github.com/vispy/vispy/pull/928
i... | StarcoderdataPython |
6587183 | """Appication sub-layer for state synchronization."""
import collections
import enum
import logging
from typing import (
Any, Deque, Generic, Iterable, Iterator, Mapping, Optional, TypeVar
)
import attr
import betterproto
from ventserver.protocols import exceptions
from ventserver.sansio import protocols
_Ind... | StarcoderdataPython |
6534702 | <reponame>ropable/wastd<filename>conservation/migrations/0005_auto_20190122_1638.py<gh_stars>1-10
# Generated by Django 2.0.8 on 2019-01-22 08:38
import django.contrib.gis.db.models.fields
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependenci... | StarcoderdataPython |
6462898 | from Lemmatization.utility.helper import get_stop_word_path
from Lemmatization.utility.reader import read_file
def get_from_nltk():
from nltk.corpus import stopwords
return stopwords.words('nepali')
def get_from_collections():
# Downloaded from: https://github.com/kushalzone/NepaliStopWords/
stop_wo... | StarcoderdataPython |
3586122 | <filename>codigo/Live176/exemplos_dos_slides/exemplo_06.py
"""Exemplo de como obter dados da image."""
from PIL import Image
im = Image.open('2x2px.jpg')
im.size # (2, 2)
im.mode # 'RGB'
im.bits # 8
2**8 # 256
| StarcoderdataPython |
6629080 | """
awbots.py - American West Bots for automating American West MARC record loads
"""
__author__ = '<NAME>'
from marcbots import MARCImportBot
PROXY_LOCATION='0-www.americanwest.amdigital.co.uk.tiger.coloradocollege.edu'
class AmericanWestBot(MARCImportBot):
"""
The `AmericanWestBot` reads MARC records from... | StarcoderdataPython |
3404337 | #!/bin/python
#
#
#
#
#
#
# <NAME>
# created on: 2020-01-05 08:20:56
import argparse
import logging
import os
import sys
import time
from datetime import datetime
from functools import partial
from multiprocessing import Pool, cpu_count
import numpy as np
import pandas as pd
import pkg_resources
from scripts.check_... | StarcoderdataPython |
5096990 | # -*- coding: utf-8 -*-
"""
Resting state networks atlas container class
"""
from collections import OrderedDict
import nilearn.image as niimg
import nilearn.plotting as niplot
class RestingStateNetworks:
""" A container class to parse and return useful values/images
from RSN templates.
Parameters
-... | StarcoderdataPython |
3530778 | <filename>ensembler/commands/evaluate.py
from ensembler.Dataset import Dataset
from ensembler.datasets import Datasets
from argh import arg
import os
import numpy as np
from ensembler.utils import classwise
from ensembler.p_tqdm import p_uimap as mapper
from functools import partial
import pandas as pd
metrics = {
... | StarcoderdataPython |
5118578 | <gh_stars>0
import datetime
import importlib
import os
import random
import sys
from typing import Dict
import factory
import factory.random
import pandas as pd
from faker import Faker
from pydata_factory.classes import GenFactory, GenModel, Model
from pydata_factory.schema import Schema
Faker.seed(42)
factory.rando... | StarcoderdataPython |
5018083 | from equipmentloans.models import EquipmentLoan
from rest_framework import serializers
from equipmentloans.models import EquipmentLoan
class EquipmentLoanSerializer(serializers.ModelSerializer):
equipment = serializers.SerializerMethodField()
class Meta:
model = EquipmentLoan
fields = (
... | StarcoderdataPython |
11223663 | from math import floor
from typing import Callable
import numpy as np
import plotly.express as px
from dtw import stepPattern as sp
# yapf: disable
# DTW
#: a symmetric pattern for DTW
symmetric = sp.StepPattern(
sp._c(
# diagonal
1, 1, 1, -1,
1, 0, 0, 3,
# vertical
2, 1, ... | StarcoderdataPython |
1862100 | #!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
from __future__ import division, print_function
# viability imports
import pyviability as viab
from pyviability import helper
from pyviability import libviability as lv
from pyviability import tsm_style as topo
# model imports
import examples.AWModel as awm
import examp... | StarcoderdataPython |
1930319 | """
Process Management
==================
Ensure a process matching a given pattern is absent.
.. code-block:: yaml
httpd-absent:
process.absent:
- name: apache2
"""
def __virtual__():
if "ps.pkill" in __salt__:
return True
return (False, "ps module could not be loaded")
def abs... | StarcoderdataPython |
4920562 | <gh_stars>1-10
# linear regression in stanford university channel
import numpy as np
import tensorflow as tf
import matplotlib
matplotlib.use('TKAgg')
from matplotlib import pyplot as plt
'''
Good ole linear regression: find the best linear fit to our data
'''
def generate_dataset():
# data is generated by y = 2... | StarcoderdataPython |
8062890 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
from DQM.SiPixelPhase1Common.HistogramManager_cfi import *
SiPixelPhase1HitsTofR = DefaultHisto.clone(
name = "tof_r",
title = "Time of flight vs r",
range_min = 0, range_max = 60, range... | StarcoderdataPython |
6549235 | import crypto_trading_lib as cl
df = cl.load_data()
fees = cl.create_trade_fee_table(df)
cl.save_table(fees, "crypto_fees.csv")
buys = cl.create_crypto_buy_table(df)
cl.save_table(buys, "crypto_buy_table.csv")
sells = cl.create_crypto_sell_table(df)
cl.save_table(sells, "crypto_sell_table.csv") | StarcoderdataPython |
11267925 | <filename>python/wx/monitor_mq.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
import setproctitle
import time
import sys
import logging
from urllib import urlencode
reload(sys)
sys.setdefaultencoding('utf8')
mq_host="10.106.x.x"
mq_port=15672
mq_user="monitor"
mq_pass="<PASSWORD>"
queu... | StarcoderdataPython |
6447095 | import csv
from django.core.management import BaseCommand
from extlinks.links.models import URLPattern
from extlinks.organisations.models import Organisation, Collection
from extlinks.programs.models import Program
class Command(BaseCommand):
help = """
Imports Programs, Orgs, Collections, and URLPat... | StarcoderdataPython |
3410178 | import numpy as np
from scipy import sparse
from . import auxiliary_function as ax
from . import comdet_functions as cd
from . import cp_functions as cp
from . import solver
class DirectedGraph:
def __init__(
self,
adjacency=None,
edgelist=None,
):
self.n_nodes = N... | StarcoderdataPython |
5019325 | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# 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 ... | StarcoderdataPython |
1905464 | <filename>examples/ThunderRemoteBasic.py
from examples.RemoteControlTest import RemoteControlTest
from thunder_remote.RemoteControl import RemoteControl
if __name__ == "__main__":
remote = RemoteControl(profile='default', start_sleeping=True, in_proc=False)
rct = RemoteControlTest(remote)
if remote.is_ava... | StarcoderdataPython |
6407161 | <reponame>cambel/ur3<gh_stars>10-100
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2018-2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, i... | StarcoderdataPython |
8157867 | from flask_sqlalchemy import SQLAlchemy
# New database instance
db = SQLAlchemy() | StarcoderdataPython |
12841965 | from sklearn.datasets import load_svmlight_file
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn import metrics
param_grid = {'C':[0.001,0.01,0.1,1,10,100]}
X,y = load_svmlight_file('MachineLearning/disorder.libsvm.dat')
X_train, X_test, y_train, y_test = tra... | StarcoderdataPython |
8126368 | <filename>pygvisuals/widgets/entry.py
# --- imports
# pygame imports
import pygame
# local imports
from .selection_text_widget import *
from ..designs import getDefaultDesign
from ..util import inherit_docstrings_from_superclass
class Entry(SelectionTextWidget):
"""
Entry-fields that accept keyboard-input.
... | StarcoderdataPython |
3546364 | <gh_stars>10-100
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from twilio import TwilioRestException
from mock import MagicMock
from mock import ANY
import mongomock
import app as flask_app
from totp_auth import TotpAuth
class TestFlaskApp(unittest.TestCase):
... | StarcoderdataPython |
104661 | <filename>plugins/dns/client.py
"""
Client
Run by the evaluator, tries to make a GET request to a given server
"""
import argparse
import logging
import os
import random
import socket
import sys
import time
import traceback
import urllib.request
import dns.resolver
import requests
import actions.utils
from plugins.... | StarcoderdataPython |
8098105 | #cluster tica data into clusters
import pyemma.coordinates as coor
import numpy as np
sys = 'fdis'
tica_data = coor.load('tica_data_05/fdis_tica_data.h5')
n_clusters = 100
cl = coor.cluster_kmeans(tica_data, k=n_clusters, max_iter=50)
#cl.save(f'cluster_data/{sys}_{n_clusters}_mini_cluster_object.h5', overwrite=Tru... | StarcoderdataPython |
6414120 | from typing import Text
from .base import PackageManager
from .requirements import SimpleSubstitution
class PriorityPackageRequirement(SimpleSubstitution):
name = ("cython", "numpy", "setuptools", )
optional_package_names = tuple()
def __init__(self, *args, **kwargs):
super(PriorityPackageRequi... | StarcoderdataPython |
6564333 | <gh_stars>10-100
#!/usr/bin/env python
# Copyright 2017 <NAME> and <NAME>
'''Functions to run and interface with bwa'''
import subprocess
import os
import sys
from collections import namedtuple
BWA = namedtuple('BWA', ['mapped', 'positions'])
MAX_FASTMAP_HITS = 100
# Creates a bwa index, if it does not already exi... | StarcoderdataPython |
241419 | import dj_database_url
SECRET_KEY = 'django-pgpubsub'
# Install the tests as an app so that we can make test models
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'pgpubsub',
'pgpubsub.tests',
'pgtrigger',
]
# Database url comes from the DATABASE_URL env var
DATABASES = {'... | StarcoderdataPython |
3465059 | <gh_stars>10-100
# validated.py
from mongoframes import *
__all__ = [
'InvalidDocument',
'ValidatedFrame'
]
class FormData:
"""
A class that wraps a dictionary providing a request like object that can be
used as the `formdata` argument when initializing a `Form`.
"""
def __init__(se... | StarcoderdataPython |
9619720 | # This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
"""
This subpackage is used for reading and writing an :class:`AtomArray` or
:class:`AtomArrayStack` using the internal NPZ file format. This binary
format is used ... | StarcoderdataPython |
6425477 | <reponame>mjsiers/practice-data-cpcapaper
import logging
import numpy as np
from scipy.stats import norm
logging.basicConfig(level="INFO", format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
logger = logging.getLogger("data")
def baseline_generator(num, x, noise=0.00100):
# initialize the output array... | StarcoderdataPython |
6469941 | from django import forms
from django.utils.translation import ugettext as _
class WriteInForm(forms.Form):
write_in_form = forms.CharField(widget=forms.TextInput, required=False, max_length=200,label="Add a write in option")
class MultiVoteForm(forms.Form):
def __init__(self, *args, **kwargs):
... | StarcoderdataPython |
4831826 | from sanic.response import json
def invoke():
return json({"status": "online"}) | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.