id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1645162
''' . . . . . . . . . . . . . . . . . . . . . . . . << >< >< >< << . . < >< ><< ><<< >< ><< . . << >< > >< >< >< >< . . << >< >< ><<<<<>< >< . . << >< ><< ><< >< ><< . . << ><><< ...
StarcoderdataPython
101807
<gh_stars>1-10 from operator import itemgetter from django.shortcuts import render from django.contrib.postgres.search import SearchVector from activities.models import Activity, MetadataOption,ActivityTranslation from .forms import SearchForm def _pimp_facets(facets): # create a cache of MetadataOption op...
StarcoderdataPython
4806320
<gh_stars>10-100 import re import nltk import collections import numpy as np from weighted_retraining.expr import eq_grammar, expr_model def tokenize(s): funcs = ['sin', 'exp'] for fn in funcs: s = s.replace(fn+'(', fn+' ') s = re.sub(r'([^a-z ])', r' \1 ', s) for fn in funcs: s = s.r...
StarcoderdataPython
3263828
import jsonrpcclient import sys import os import argparse import base64 from services import registry from .snet import snet_setup def main(): script_name = sys.argv[0] parser = argparse.ArgumentParser(prog=script_name) server_name = "_".join(os.path.splitext(os.path.basename(script_name))[0].split('_')[...
StarcoderdataPython
129084
# -*- coding: utf-8 -*- """ @author: 2series """ class Node(object): def __init__(self, name): """Assumes name is a string""" self.name = name def getName(self): return self.name def __str__(self): return self.name class Edge(object): def __init__(self, src, dest): ...
StarcoderdataPython
4415
""" Copyright (c) 2020 COTOBA DESIGN, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
StarcoderdataPython
3372280
import mrl import gym from mrl.replays.core.shared_buffer import SharedMemoryTrajectoryBuffer as Buffer import numpy as np import pickle import os from mrl.utils.misc import batch_block_diag class OnlineHERBuffer(mrl.Module): def __init__( self, module_name='replay_buffer' ): """ Buffer that...
StarcoderdataPython
154912
<reponame>aniloutdo/Fitness-Gadgets<filename>test_plotter.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- from ..plotting import Plotter, InvalidArgumentsException from datetime import datetime from numpy import array import pytest def test_lineplot_construction(): """Test that instances for linepl...
StarcoderdataPython
190017
<gh_stars>0 import requests LoginUrl=r'http://stu.ityxb.com/back/bxg_anon/login' InfoUrl=r'http://stu.ityxb.com/back/bxg_anon/user/loginInfo' PointsUrl=r'http://stu.ityxb.com/back/bxg/user/getThreeRedPoints' UnfinshedUrl=r'http://stu.ityxb.com/back/bxg/user/unfinished' PreViewUrl=r'http://stu.ityxb.com/back/bxg/...
StarcoderdataPython
1645158
import unittest from unittest.case import TestCase from appClasses import Credentials, User import pyperclip class TestUser(unittest.TestCase): """ Test class defines test cases for the User Class behaviors """ def setUp(self): """ Set up method to run before each test cases ...
StarcoderdataPython
3380221
from PIL import Image import numpy as np import math import os path = 'D:/Eye/train_jpg/try/labelme/' newpath = 'D:/Eye/train_jpg/try/labelme/' def toeight(): filelist = os.listdir(path) # ่ฏฅๆ–‡ไปถๅคนไธ‹ๆ‰€ๆœ‰็š„ๆ–‡ไปถ๏ผˆๅŒ…ๆ‹ฌๆ–‡ไปถๅคน๏ผ‰ for file in filelist: if os.path.isdir(file): whole_path = os.path.j...
StarcoderdataPython
1693075
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time import re import multiprocessing as mp from os import path, makedirs, listdir, remove from shutil import copyfile from threading import Event from psyclab.utilities.osc import OSCResponder, route from psyclab.apparatus.osc_controller import OSCController f...
StarcoderdataPython
3214548
<gh_stars>0 # Good morning! Here's your coding interview problem for today. # This problem was asked by Jane Street. # cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns # the first and last element of that pair. For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4. # Given this impleme...
StarcoderdataPython
24124
import configparser from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker config = configparser.ConfigParser() config.read('alembic.ini') connection_url = config['alembic']['sqlalchemy.url'] Engine = create_engine(connection_url, connect_args={'check_same_thread': False}) Session = sessionmaker...
StarcoderdataPython
1613567
from scapy.all import * import time from functools import partial from notifier import notify def print_summary(whatsapp_detected, pkt): if (pkt["IP"].src == "172.16.58.3") or (pkt["IP"].dst == "172.16.58.3"): whatsapp_detected[0] = True def packet_sniff(out_q): while True: time.sleep(0.4) ...
StarcoderdataPython
1708114
<reponame>plscks/CharacterPlanner class SkillAttrib: def __init__(self, skill_name, base_skill, has_child, parent_skill, CP_cost, skill_class, turned_off): self.skill_name = skill_name self.base_skill = base_skill self.parent_skill = parent_skill self.has_child = has_child se...
StarcoderdataPython
3372177
import itertools import random S = " " def main(): # init gophers_count = 100 windmills_count = 18 factors = [17, 13, 11, 7, 5, 3, 2] seed = 1951 a, b, c = [], [], [] random.seed(seed) # generate input data for each night for f in factors: windmills = [f] * windmills_cou...
StarcoderdataPython
17090
<reponame>rithvikp1998/ctci ''' If the child is currently on the nth step, then there are three possibilites as to how it reached there: 1. Reached (n-3)th step and hopped 3 steps in one time 2. Reached (n-2)th step and hopped 2 steps in one time 3. Reached (n-1)th step and hopped 2 steps in one time The total number...
StarcoderdataPython
1756917
<filename>web/timeline/fields.py import re import datetime class ValidationException(Exception): pass class BaseField(object): def __init__(self, *args, **kwargs): for (k, v) in kwargs.iteritems(): setattr(self, k, v) self.value = getattr(self, 'value', None) self.required...
StarcoderdataPython
1650850
# -*- coding: utf-8 -*- import json from random import shuffle DIRECTIONS = { "rg": {"dr": +1, "dg": -1, "db": 0}, "rb": {"dr": +1, "dg": 0, "db": -1}, "gb": {"dr": 0, "dg": +1, "db": -1}, "gr": {"dr": -1, "dg": +1, "db": 0}, "br": {"dr": -1, "dg": 0, "db": +1}, "bg": {"dr": 0, "dg": -1, "db":...
StarcoderdataPython
3217414
from selfdrive.kegman_conf import kegman_conf class AtomConf(): def __init__(self, CP=None): self.kegman = kegman_conf() self.tun_type = 'lqr' self.sR_KPH = [0] # Speed kph self.sR_BPV = [[0,]] self.sR_steerRatioV = [[13.85,]] self.sR_ActuatorDelayV = [[0.1,]] sel...
StarcoderdataPython
1773666
<filename>misc_utils/inference_utils.py import cv2 from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing import image from imageio import imread import numpy as np from matplotlib import pyplot as plt from keras_layers.keras_layer_AnchorBoxes import AnchorBoxes from keras_layers.keras_layer...
StarcoderdataPython
29254
<reponame>duanzhiihao/mycv import os from tqdm import tqdm from pathlib import Path import random from mycv.paths import IMAGENET_DIR from mycv.datasets.imagenet import WNIDS, WNID_TO_IDX def main(): sample(200, 600, 50) def sample(num_cls=200, num_train=600, num_val=50): assert IMAGENET_DIR.is_dir() ...
StarcoderdataPython
147701
<filename>opsdroid_homeassistant/tests/conftest.py from asyncio import sleep import os import pytest import requests from requests.exceptions import ConnectionError from opsdroid.core import OpsDroid from opsdroid.cli.start import configure_lang @pytest.fixture(scope="session") def docker_compose_file(pytestconfig)...
StarcoderdataPython
3291141
<filename>src/AngleMeasurement/PCASmallestEig.py import numpy as np from .PowerMethod import power_method #PCA SMALLEST EIG WITHOUT PMETH ############################################ def pca_smallest_eig(X, center=True): if center: m = np.mean(X, axis=0) cov = np.transpose(X-m)@(X-m) else: ...
StarcoderdataPython
40392
<gh_stars>0 import os from subprocess import CompletedProcess import docker from .sdpb import Sdpb class SdpbDocker(Sdpb): """Interface for running ``SDPB`` and related software in docker container Warning: To use this interface docker must be installed and has to be able to pull the specifi...
StarcoderdataPython
1634780
from .render_yaml import template
StarcoderdataPython
127078
<filename>exploit/socialbrute/__mainig__.py # coding=utf-8 # !/usr/bin/python from __future__ import print_function from instabrute import * import argparse import logging import random import socket import sys import threading r="\x1b[91m" w="\x1b[00m" c ="\x1b[36;1m" y="\x1b[33m" try: import urllib.request as ...
StarcoderdataPython
3242980
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
StarcoderdataPython
1605119
""" Module Name: Preprocessing Module Source Path: modules/preprocessing.py Description: This python module contains a concrete class which manages the creation of the project's data system. It is made to support the initialization of many different regions' covid/income data, but only has the city of Toronto impleme...
StarcoderdataPython
4807162
from functools import partial from django.contrib.auth.models import AbstractUser from django.db import models from django.utils.crypto import get_random_string import uuid make_stream_key = partial(get_random_string, 20) class CustomUser(AbstractUser): pass # add additional fields in here uid = models....
StarcoderdataPython
1741295
<gh_stars>10-100 from rltf.schedules.schedule import Schedule from rltf.schedules.const_schedule import ConstSchedule from rltf.schedules.exponential_decay import ExponentialDecay from rltf.schedules.linear_schedule import LinearSchedule from rltf.schedules.piecewise_schedule import PiecewiseSche...
StarcoderdataPython
1681758
<gh_stars>10-100 import asyncio from time import sleep import evdev import pyinotify from ev_core.config import Config from utils.evdevutils import EvDevUtils from utils.langutils import * class EventHandler(pyinotify.ProcessEvent): """ This is the central core ouf our hotplugging we basically use the l...
StarcoderdataPython
1754971
# -*- coding: utf-8 -*- """ Created on Mon May 18 20:14:16 2020 @author: dilayerc """ # Practice # Return the number of times that the string "hi" appears anywhere in the given string. # Examples: ## count_hi('abc hi ho') โ†’ 1 ## count_hi('ABChi hi') โ†’ 2 ## count_hi('hihi') โ†’ 2 # Answer def cou...
StarcoderdataPython
35621
<gh_stars>1-10 class BaseNode: pass class Node(BaseNode): def __init__(self, offset, name=None, **opts): self.offset = offset self.end_offset = None self.name = name self.nodes = [] self.opts = opts def __as_dict__(self): return {"name": self.name, "nodes": ...
StarcoderdataPython
1604018
import sys from functools import partial from blaze.data import CSV, JSON from blaze.utils import tmpfile, raises from blaze.data.utils import tuplify from blaze.compatibility import xfail import gzip is_py2_win = sys.platform == 'win32' and sys.version_info[:2] < (3, 0) @xfail(is_py2_win, reason='Win32 py2.7 unic...
StarcoderdataPython
3319376
<gh_stars>100-1000 #!/usr/bin/env python3 """ Simple example of using cherry to solve cartpole. The code is an adaptation of the PyTorch reinforcement learning example. TODO: This is not reinforce, this is policy gradient. """ import random import gym import numpy as np from itertools import count import torch as...
StarcoderdataPython
1624427
# -*- coding: utf-8 -*- """ github4.api =========== :copyright: (c) 2012-2014 by <NAME> :license: Modified BSD, see LICENSE for more details """ from .github import GitHub from .github import GitHubEnterprise gh = GitHub() def login(username=None, password=None, token=None, two_factor_callback=None): """Constr...
StarcoderdataPython
1510
#!/usr/bin/env python from distutils.core import setup setup(name='Mimik', version='1.0', description='Python framework for markov models', author='<NAME>', author_email='<EMAIL>', url='https://www.python.org/sigs/distutils-sig/', packages=['distutils', 'distutils.command'], ...
StarcoderdataPython
3384199
<reponame>anamileva/gridpath<filename>tests/project/capacity/capacity_types/test_gen_new_lin.py # Copyright 2016-2020 Blue Marble Analytics LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License a...
StarcoderdataPython
3234041
<reponame>nmorse/pounce<gh_stars>1-10 #import board #import pulseio # from analogio import AnalogIn #from digitalio import DigitalInOut, Direction, Pull #import time # import random import joyish_tests as testing import joyish_parser as jp # Digital input with pullup #red = DigitalInOut(board.D13) red = {} red['...
StarcoderdataPython
1729198
from ..graph import get_default_graph from ..tensors import * from ..ops.array_ops import * from ..ops.ctrl_ops import * from ..ops.constant import * from ..ops.math_ops import * from ..ops.placeholder import * from ..ops.variable import * def constant(name, out_shape, value=None, graph=None): if graph is None: ...
StarcoderdataPython
198832
<reponame>belovachap/pyvsystems_rewards<gh_stars>1-10 def format_as_vsys(amount): abs_amount = abs(amount) whole = int(abs_amount / 100000000) fraction = abs_amount % 100000000 if amount < 0: whole *= -1 return f'{whole}.{str(fraction).rjust(8, "0")}'
StarcoderdataPython
3354314
from .connections import get_current_connection from .connections import use_connection, push_connection, pop_connection from .connections import Connection from .queue import Queue, get_failed_queue from .job import cancel_job, requeue_job from .worker import Worker from .version import VERSION __all__ = [ 'use_...
StarcoderdataPython
3365236
#!/usr/bin/env python3 #coding=utf-8 # seq include tuple and list t1 = (2, 1.2, 'love', False) # ไธๅฏๅ˜ l1 = [1, True, 'smile'] print(t1, type(t1)) print(l1, type(l1)) print(t1[:]) print(t1[:1]) print(t1[1:]) print(t1[-1]) print(l1[:]) print(l1[:1]) print(l1[1:]) print(l1[-1]) # string is spec tup...
StarcoderdataPython
1651385
<reponame>nicoladimauro/TiSeLaC-ECMLPKDD17 import numpy as np np.random.seed(1379) from keras.utils import plot_model from sklearn.neighbors import BallTree from sklearn import preprocessing from sklearn import svm from sklearn.metrics import confusion_matrix, f1_score, classification_report from sklearn.model_select...
StarcoderdataPython
32562
<reponame>underworlds-robot/uwds3_core<gh_stars>1-10 import cv2 class DenseOpticalFlowEstimator(object): def __init__(self): self.previous_frame = None def estimate(self, frame): if first_frame is None: return None gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) flo...
StarcoderdataPython
3309746
import unittest from reuse_func import GetData class InfraTransformer(unittest.TestCase): def test_infra_transformer_runningcount(self): cal = GetData() runningcount = cal.get_runningCount("infra_transformer") if runningcount == 0: print("infra data transformer running count ...
StarcoderdataPython
3393400
# All content Copyright (C) 2018 Genomics plc from io import StringIO import unittest import datetime from wecall.vcfutils.schema import Schema from wecall.vcfutils.writer import encode_VCF_string, VCFWriter class TestVCFWriter(unittest.TestCase): def test_should_write_empty_file_containing_expected_version_numb...
StarcoderdataPython
1750554
<reponame>vincenttran-msft/azure-sdk-for-python # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Micro...
StarcoderdataPython
1644208
#!/usr/bin/env python # JN 2016-05-17 """ This script runs css-prepare, css-cluster, and css-combine in a row. It does not use multi-processing, and it accepts a single file name only. It is generally better to call the css-* scripts one after the other! """ from __future__ import print_function, absolute_import imp...
StarcoderdataPython
13475
# Copyright (c) 2019 <NAME> and <NAME> # # This file is part of the LipidFinder software tool and governed by the # 'MIT License'. Please see the LICENSE file that should have been # included as part of this software. """Represent a DataFrame to be processed with LipidFinder's workflow.""" import glob import logging i...
StarcoderdataPython
3356252
<reponame>BaiYuhaoSpiceeYJ/SEGAN_denoise import argparse import torch import torch.nn as nn from torch.utils.data import DataLoader from segan.models import * from segan.datasets import * import soundfile as sf from scipy.io import wavfile from torch.autograd import Variable import numpy as np import random import libr...
StarcoderdataPython
135974
# Generated by Django 3.1.4 on 2021-04-22 11:31 from django.db import migrations import modelcluster.fields class Migration(migrations.Migration): dependencies = [ ('menus', '0009_wagtaillanguage'), ('flex', '0017_auto_20210328_2141'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
91387
<reponame>idarlenearaujo/URI_Python<filename>1006.py # entrada 3 float A = float(input()) B = float(input()) C = float(input()) # variaveis (pesos) P1 = 2 P2 = 3 P3 = 5 # calculo da media MEDIA = ((A * P1) + (B*P2) + (C*P3)) / (P1+P2+P3) print('MEDIA = {:.1f}'.format(MEDIA))
StarcoderdataPython
39828
<gh_stars>1-10 #!/usr/bin/env python3 # # Search metadata in the EDAN API # v0.1 # import urllib.parse import urllib.request import datetime import email.utils import uuid import hashlib import json from base64 import b64encode #for testing from urllib.request import Request, urlopen from urllib.error import URLErro...
StarcoderdataPython
111541
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'areaDialog.ui' # # Created by: PyQt5 UI code generator 5.13.0 from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import QIcon class Ui_areaDialog(object): def setupUi(self, areaDialog): areaDialog.setObjectName("area...
StarcoderdataPython
41909
<reponame>rochester-rcl/islandora-import-scripts #work in prgress - This creates a skelatal mods file for the givne set of files templateFile = "C:\\python-scripts\\xml-file-output\\aids_skeletalmods.xml" def createXmlFiles(idList): print("create xml file list") for id in idList: #print("processing i...
StarcoderdataPython
1778367
<filename>assignments/api/admin/serializers.py # restframework imports from rest_framework import serializers # djnago imports from django.contrib.auth import get_user_model # Local Imports from assignments.models import ( Assignment, AssignmentFile, ) from courses.models import ( Course, CourseSec...
StarcoderdataPython
4808972
<filename>1-100/5/5.py i = 1 for k in (range(1, 21)): if i % k > 0: for j in range(1, 21): if (i*j) % k == 0: i *= j break print i
StarcoderdataPython
1734987
import pymongo from sqls.config import * def findUsers(): import mysql.connector cxn = mysql.connector.connect( host=databaseConfig.get('hostname'), user=databaseConfig.get('username'), passwd=databaseConfig.get('password'), db=databaseConfig.get('database') ) cursor = c...
StarcoderdataPython
3214908
<reponame>COVID-IWG/epimargin-studies<gh_stars>0 #!python3 from pathlib import Path from io import StringIO import numpy as np import pandas as pd import requests def import_and_clean_cases(save_path: Path) -> pd.DataFrame: ''' Import and clean case data from covidtracking.com. ''' # Parameters for f...
StarcoderdataPython
131982
<reponame>jfcoz/azure-cli # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # ------------------------------------------...
StarcoderdataPython
132188
from subprocess import check_output import sys,os,argparse from StaticPath import StaticPath, Separators from time import ctime from SequencingFormats import BAM parser = argparse.ArgumentParser(description=''' ************************************************************************************************ B...
StarcoderdataPython
1649264
from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import input from builtins import str from .BaseService import BaseService import json import sys #required from urllib.parse import urljoin from urllib.parse import quote import requests clas...
StarcoderdataPython
1798581
''' Created on Oct 11, 2011 @author: jklo ''' from contextlib import closing from functools import wraps from ijson.parse import items from lr.lib.signing import reloadGPGConfig from pylons import config from uuid import uuid1 from LRSignature.sign.Sign import Sign_0_21 import base64 import copy import couchdb import...
StarcoderdataPython
1667766
# Advent of Code 2021 - Day 2 Part 2 # Author: <NAME> # Created: 12/02/2021 # Last Modified: 12/02/2021 # Purpose: # Read in submarine instructions from a file # Commands: # Forward -> Increase horizontal position, # Change vertical position by product of aim and Forward command # Up -...
StarcoderdataPython
74926
# Copyright (c) 2020 <NAME> # # This software is released under the MIT License. # https://opensource.org/licenses/MIT from __future__ import annotations import argparse import csv import gzip import json import os import re import sqlite3 as sqlite from .app import database, APP_DIRECTORY from .models.assertions im...
StarcoderdataPython
27779
from typing import List, Tuple import mlflow import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from interpret.glassbox import ExplainableBoostingClassifier, ExplainableBoostingRegressor from ..OEA_model import OEAModelInterface, ModelType, ExplanationType from ..modeling_ut...
StarcoderdataPython
169038
""" Copyright 2019 <NAME>. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distribut...
StarcoderdataPython
4805410
<gh_stars>1-10 from collections import Counter class Solution: def frequencySort(self, s: str) -> str: counter = Counter(s) return "".join( k * v for k, v in sorted( counter.items(), key=lambda x: x[1], reverse=True ) ) def frequency...
StarcoderdataPython
4840916
"""Form fields for using django-gm2m with QuerySetSequence.""" from dal_gm2m.fields import GM2MFieldMixin from dal_queryset_sequence.fields import QuerySetSequenceModelMultipleField class GM2MQuerySetSequenceField(GM2MFieldMixin, QuerySetSequenceModelMultipleField): """Form field...
StarcoderdataPython
3260786
"""Module containing class `Preset`.""" from vesper.util.named import Named class Preset(Named): """ Preset parent class. A *preset* is a collection of logically related configuration data, for example for user interface or algorithm configuration. A preset is of a particular *preset t...
StarcoderdataPython
162129
# -*- coding: UTF-8 -*- # ------------------------(max to 80 columns)----------------------------------- # author by : ๏ผˆๅญฆๅ‘˜ID) # created: 2019.11 # Description: # ๅˆๆญฅๅญฆไน  WinForm ็ผ–็จ‹ ( Listbox ) # ------------------------(max to 80 columns)----------------------------------- import tkinter as tk from tkinter import tt...
StarcoderdataPython
1696743
""" Copyright: MAXON Computer GmbH Author: <NAME> Description: - Hides the objects of the active LOD object 'op' current level. Class/method highlighted: - LodObject.GetCurrentLevel() - LodObject.GetShowControlDescID() Compatible: - Win / Mac - R19, R20, R21, S22 """ import c4d def main(): ...
StarcoderdataPython
1683472
<reponame>dhzzy88/Bike2Car<gh_stars>1-10 # -*- coding: UTF-8 -*- # File: summary.py import six import tensorflow as tf import re import io from six.moves import range from contextlib import contextmanager from tensorflow.python.training import moving_averages from ..utils import logger from ..utils.develop import l...
StarcoderdataPython
120290
import os import glob import csv import pandas as pd import numpy as np from collections import deque from itertools import chain from utils import rotate_quat, rotate_cross_product class Sensor(object): def __init__(self, name, fieldnames, data): self.name = name self.fieldnames = fieldnames ...
StarcoderdataPython
140115
<filename>scripts/args.py<gh_stars>0 """ Module for argument parcer. Many of the arguments are from Huggingface's run_squad example: https://github.com/huggingface/transformers/blob/7972a4019f4bc9f85fd358f42249b90f9cd27c68/examples/run_squad.py """ import argparse import os args = argparse.ArgumentParser(description=...
StarcoderdataPython
3359533
<filename>pybench/Lists.py # Ignore flake8 E741 warning in the whole file: # flake8: noqa import pyperf from six.moves import xrange from pybench import Test class SimpleListManipulation(Test): version = 2.0 operations = 5 * (6 + 6 + 6) inner_loops = 5 def test(self, loops): l = [] ...
StarcoderdataPython
19747
from flask.ext.wtf import Form from wtforms import ( TextField, IntegerField, HiddenField, SubmitField, validators ) class MonkeyForm(Form): id = HiddenField() name = TextField('Name', validators=[validators.InputRequired()]) age = IntegerField( 'Age', validators=[ validators.Input...
StarcoderdataPython
72476
<gh_stars>1-10 from django.apps import AppConfig class OficinaConfig(AppConfig): name = 'oficina'
StarcoderdataPython
3349471
# -*- coding: utf-8 -*- """Transforming arrays of Mantarray data throughout the analysis pipeline.""" from typing import Any from typing import Dict from typing import List from typing import Union import uuid from nptyping import NDArray import numpy as np from scipy import signal from .constants import ADC_GAIN fro...
StarcoderdataPython
3366734
<filename>ruddock/modules/hassle/helpers.py import flask import sqlalchemy alleys = [1, 2, 3, 4, 5, 6] def get_all_members(): """Gets all current members (potential hassle participants).""" query = sqlalchemy.text(""" SELECT user_id, name, graduation_year, member_type, membership_desc, user_id IN ( ...
StarcoderdataPython
1706883
<gh_stars>0 """ code : ํšŒ์‚ฌ์ฝ”๋“œ name : ํšŒ์‚ฌ์ด๋ฆ„ liabilities_risk_ratio : ์œ ๋™๋ถ€์ฑ„์˜ ์œ„ํ—˜ ๋ฐฐ์ˆ˜ totalStockCount : ํ˜„์žฌ ์ด ์ฃผ์‹์ˆ˜ df : ๋งค๋…„ ํšŒ์‚ฌ ๊ฐ€์น˜๊ฐ€ ๊ธฐ๋ก๋˜๋Š” DataFrame goal_rate_of_return : ?? ๋‹ค์‹œ๋ด์•ผํ• ๋“ฏ!! """ import FilePathManager as fm import pandas as pd from decimal import * import os import pickle class Model(object): de...
StarcoderdataPython
1724525
# # ------------------------------------------------------------------------ # Copyright (c) 2018 Intel Corporation Intellectual Property # # 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 ...
StarcoderdataPython
3274160
<reponame>ujwal475/Data-Structures-And-Algorithms from random import randint def quicksort(array): if len(array) < 2: return array low, same, high = [], [], [] pivot = array[randint(0, len(array) - 1)] for item in array: if item < pivot: low.append(item) elif item ...
StarcoderdataPython
12327
"""Role testing files using testinfra""" def test_config_directory(host): """Check config directory""" f = host.file("/etc/influxdb") assert f.is_directory assert f.user == "influxdb" assert f.group == "root" assert f.mode == 0o775 def test_data_directory(host): """Check data directory""...
StarcoderdataPython
11208
#!/usr/bin/env python # -*- coding: utf-8 -*- import io import os import re from setuptools import setup, find_packages # classifiers = """\ # Development Status :: 4 - Beta # Programming Language :: Python # Programming Language :: Python :: 3 # Programming Language :: Python :: 3.4 # Programming...
StarcoderdataPython
3310559
from app.tests.v1 import utils test_utils = utils.Utils() def test_user_register(client): ''' Test user registration ''' response = client.post('api/v1/auth/user/register', json=test_utils.USER) json_data = response.get_json() assert response.status_code == 201 assert json_data['status'] == 201 ...
StarcoderdataPython
3308618
<filename>components/gcp/container/component_sdk/python/tests/google/ml_engine/test__create_model.py # 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
4819768
import pytest from brownie import exceptions from brownie.network.transaction import TransactionReceipt from scripts.deploy import deploy_lottery from scripts.useful.tools import get_account, wait_for_tx_confs from tests.tools import only_local, LotteryState def test_owner_can_start_lottery(): only_local() ...
StarcoderdataPython
1608287
<gh_stars>1-10 # coding: utf-8 # /*########################################################################## # # Copyright (c) 2004-2019 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "S...
StarcoderdataPython
1655338
from tests.fixtures import * # noqa: F401
StarcoderdataPython
45296
# coding: utf-8 import logging import re from itertools import chain from textwrap import TextWrapper from django.core import mail from django.test import TestCase as DjangoTestCase from django.views import debug from six import string_types from six.moves.urllib.parse import urlparse, urlunparse from threadlocals.th...
StarcoderdataPython
1760788
<reponame>granular-oss/geostream<filename>geostream/v3.py<gh_stars>1-10 import gzip import typing as typ import simplejson as json from geostream.base import Feature, GeoStreamReader, GeoStreamReverseReader, GeoStreamWriter, Properties class GeoStreamReaderV3(GeoStreamReader): """ Stream header accessors and it...
StarcoderdataPython
3347400
from __future__ import division import numpy as np import pycuda.driver as drv from pycuda.compiler import SourceModule import pycuda.autoinit kernel_code_div_eigenenergy_cuda = """ #include<stdio.h> #include<stdlib.h> __global__ void calc_XXVV_gpu(float *nm2v_re, float *nm2v_im, int nm2v_dim1, int nm2v_dim2, fl...
StarcoderdataPython
3359561
""" Routes and views for the bottle application. """ import os import json from bottle import route, view, static_file from datetime import datetime config = { "secret_key" : "my developer secret value" } if os.getenv("MY_CONFIG"): # you can define the setting in your Azure Web App # by s...
StarcoderdataPython
3329523
import numpy as np import manifolds from manifolds import Scene as CppScene from manifolds import Ray2f, Shape from misc import * from path import Path from draw import * class Scene: def __init__(self, shapes): self.shapes = shapes self.offset = [0, 0] self.zoom = 1.0 self.scale ...
StarcoderdataPython
47128
<reponame>stevenbennett96/stk<filename>src/stk/molecular/topology_graphs/topology_graph/topology_graph/topology_graph.py """ Topology Graph ============== """ from __future__ import annotations import typing from collections import abc from functools import partial import numpy as np from stk.utilities import flat...
StarcoderdataPython
1662725
import numpy as np x = np.array([1, 2]) print(x.shape) y = np.expand_dims(x, axis=0) print(y.shape)
StarcoderdataPython