id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9636533 | # (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest
from ansible_collections.netapp.on... | StarcoderdataPython |
5002816 | <gh_stars>1000+
"""
.. deprecated:: 1.20
*This module is deprecated. Instead of importing functions from*
``numpy.dual``, *the functions should be imported directly from NumPy
or SciPy*.
Aliases for functions which may be accelerated by SciPy.
SciPy_ can be built to use accelerated or otherwise improved libraries
f... | StarcoderdataPython |
3509115 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
def load_data(rootdir='./'):
print('load data \n')
x_train = np.loadtxt(rootdir + 'x_train.txt', dtype=str).astype(float)
y_train = np.loadtxt(rootdir + 'y_train.txt', dtype=str).astype(int)
pr... | StarcoderdataPython |
3483078 | #!/usr/bin/python
import json, math, sys, time, uuid
from random import randint, sample
def output_file(file):
fo = open(file, 'w')
return fo
def create_node(node, in_dict, out_dict, in_dict_attrs, out_dict_attrs, k, num_nodes, node_attrs_min, node_attrs_max, edge_attrs_min, edge_attrs_max, num_node_attrs, n... | StarcoderdataPython |
6612310 | import pubchempy as pcp
import logging
from src import setting
# Setting up log file
formatter = logging.Formatter(fmt='%(asctime)s %(levelname)s %(name)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S')
fh = logging.FileHandler(setting.run_specific_log, mode='a')
fh.setFormatter(fmt=formatter)
logger = logging.getLogger("P... | StarcoderdataPython |
1764637 | # import the necessary packages
from imutils.video import VideoStream
import argparse
import numpy as np, cv2
import imutils, time
# import the necessary packages
from scipy.spatial import distance as dist
from collections import OrderedDict
import numpy as np
class CentroidTracker():
def __init__(self, maxDisap... | StarcoderdataPython |
3291319 | <filename>tests/test_api.py
import asyncio
import functools
import pytest
import http3
def threadpool(func):
"""
Our sync tests should run in seperate thread to the uvicorn server.
"""
@functools.wraps(func)
async def wrapped(*args, **kwargs):
nonlocal func
loop = asyncio.get_e... | StarcoderdataPython |
3268619 | <reponame>MrLingo/fast-food-chatbot
from __future__ import print_function
from flask import Flask, json, jsonify, render_template, request
from difflib import SequenceMatcher
app = Flask(__name__)
main_page_info = ["Viki", "Viki's response accuracy: ", "Total price:"]
@app.route('/')
def hello_world():
return re... | StarcoderdataPython |
331312 | import logging
from typing import Any, Optional
from hdfs.client import InsecureClient
from determined.common import util
from determined.tensorboard import base
class HDFSTensorboardManager(base.TensorboardManager):
"""
Store and tfevents files to HDFS.
"""
@util.preserve_random_state
def __in... | StarcoderdataPython |
11257696 | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# TODO: resample 5 minutes data into another time interval
| StarcoderdataPython |
1688626 | import numpy as np
class PointSourceParam(object):
"""
"""
def __init__(self, model_list, kwargs_fixed, num_point_source_list=None, linear_solver=True,
fixed_magnification_list=None, kwargs_lower=None, kwargs_upper=None):
"""
:param model_list: list of point source mode... | StarcoderdataPython |
234541 | #--------------------------
# lexer.py
#
# Verilog-AMS Lexical Analyzer
#
# Copyright (C) 2015, <NAME>
# License: Apache 2.0
#--------------------------
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import re
sys.path.insert(0, os.path.dirname(os.path.dirname(os.dirn... | StarcoderdataPython |
11228610 | from datetime import datetime, timedelta
import sys
from flight_tables.flight_tables import FlightTables
if __name__=="__main__":
"""
Save Arrivals and Departures to CSV
Inputs (Optional):
date_str (str): Date the data is for. Defaults to yesterday. Should be in the past & still available in Heat... | StarcoderdataPython |
5015164 | <reponame>yufernando/strspy
#!/usr/bin/env python3
# This file is part of STRspy project.
# MIT License
# Copyright (c) 2021 unique379r
# 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 wit... | StarcoderdataPython |
3242972 | <filename>lib/model/utils/factory_utils.py
from importlib import import_module
def get_class_from_package(package_full_path, class_rel_path, abstract_class):
module_name, class_name = class_rel_path.rsplit('.', 1)
try:
class_module = import_module(package_full_path + '.' + module_name)
return... | StarcoderdataPython |
6414222 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# In[3]:
data = pd.read_csv('C:/Users/admin/Desktop/houseprices-1.csv')
# In[4]:
data
# In[5]:
price = data.Price
age = data.Age
size = data.LotSize
area = data.LivingArea
# In[7]:
pl... | StarcoderdataPython |
104976 | from domain.entities.value_objects.cashback import Cashback
| StarcoderdataPython |
1800470 | '''
A SPACESHIP ORBITAL SIMULATION - WITH REAL PHYSICS
CHALLENGES (ordered by difficulty)
Question: If ISS was orbiting around Mars, would it stay in orbit?
Mars Gravity : -3.71 m/s^2
Mars Mass : 6.39 * 1e23 kg
Mars Radius : 3389 km
Question: If a spaceship... | StarcoderdataPython |
8196733 | from tkinter import *
import random, dropletClass, personClass, buttonFunctions
def onClosing():
root.destroy()
def mainLoop(stats, socdis, peopleArray, vents, ac, germs, rein):
##########SETTINGS##########
deathChance = 10000 #chance of death, default 1/10000, number is denominator
bigDropCh... | StarcoderdataPython |
5172343 | # !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: <NAME>
# @Date: 2018-07-17 23:33:27
# @Last modified by: <NAME>
# @Last Modified time: 2018-07-18 23:09:17
from __future__ import print_function, division, absolute_import
from marvin.utils.datamodel.vacs.base im... | StarcoderdataPython |
5151390 | # -*- python -*-
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gdb_test
class KillTest(gdb_test.GdbTest):
def test_kill(self):
# Test that you can stop on a breakpoint, then kill... | StarcoderdataPython |
210883 | from __future__ import absolute_import, division, print_function
import sys,os
import iotbx.phil
from scitbx.array_family import flex
'''
Utilities to generate models and maps from standard or user-selected PDB files
Use map_model_manager to access these utilities
'''
def get_map_manager(map_data,wrapping,
... | StarcoderdataPython |
3411599 | <filename>schema_validation/schemas/tests/test_schemas.py
import os
import json
import pytest
from ... import JSONSchema
from .. import iter_schemas_with_names, load_schema
num_schemas = {'jsonschema-draft04.json': 29,
'vega-v3.0.7.json': 631,
'vega-lite-v1.2.json': 309,
... | StarcoderdataPython |
11260028 | import inspect
import pprint
from numbers import Number
from typing import Any, Dict, Sequence
import torch
from meddlr.transforms.mixins import DeviceMixin, TransformCacheMixin
from meddlr.transforms.param_kind import ParamKind
from meddlr.transforms.tf_scheduler import SchedulableMixin
__all__ = ["TransformGen"]
... | StarcoderdataPython |
3214585 | import os
from collections import OrderedDict, deque
from datetime import datetime, date
from enum import Enum, IntEnum
from scripts import SmartJson
class Test:
def __init__(self):
self.name = "test"
self.date = datetime.now()
self.list = ["is list item", 1, datetime.now()]
self.... | StarcoderdataPython |
3344701 | <reponame>creikey/DeepSpace2019
from wpilib.command import CommandGroup
from commands import updateodemetry, checkdiagnostics
class GlobalCommandGroup(CommandGroup):
"""Run at the start of all modes."""
def __init__(self):
super().__init__('Global Program')
self.addParallel(updateodemetry.Upd... | StarcoderdataPython |
5192831 | <gh_stars>1-10
import copy
import logging
import numpy as np
import torch
import torch.utils.data as td
from sklearn.utils import shuffle
from PIL import Image
from torch.autograd import Variable
import torchvision.transforms.functional as trnF
class ResultLoader(td.Dataset):
def __init__(self, data, labels, tra... | StarcoderdataPython |
3290167 | # ----------------------------------------------------------------------------
# - Open3D: www.open3d.org -
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission i... | StarcoderdataPython |
8188739 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'export_params.ui'
#
# Created: Fri Jun 17 13:29:29 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_ExportParams(object):
def s... | StarcoderdataPython |
1617912 |
#if else statement
gender = input("Gender? ")
#Taking input from user
gender = gender.lower()
#input taken from user is lowercased
if gender == "male":
#if statement condition here is that entered string should be "male"
print("Your cat is male")
elif gender == "female":
#elif is same as if I have added elif i... | StarcoderdataPython |
3580563 | from collections import OrderedDict
from djoser.compat import get_user_email, get_user_email_field_name
from django.conf import settings
from django.db import connection
from rest_framework import serializers
from rest_framework_gis import serializers as geo_serializers
from djoser.serializers import UserCreateSeriali... | StarcoderdataPython |
5079090 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
class Token(object):
def __init__(self, linenu, colnu, value):
super(Token, self).__init__()
self.__linenu = linenu
self.__colnu = colnu
self.__value = value
@property
def linenu(self):
return self.__linenu
... | StarcoderdataPython |
4810367 | <gh_stars>0
import logging
from datetime import datetime
from airflow import DAG
from airflow.hooks import S3Hook
from airflow.operators import BaseOperator
from utils.airflow import datetime_to_quarter
from datasets import job_postings
from algorithms.corpus_creators.basic import JobCategoryCorpusCreator
# some DAG... | StarcoderdataPython |
6613564 | <filename>1_beginner/chapter2/solutions/print_data_types.py
# Print Data Types
# Come up with 3 examples each of
# floating numbers, integers, and strings and print them.
# floats
print(1.56)
print(32.0)
print(-35.25)
# integers
print(25)
print(0)
print(-1)
# strings
print("Tahiti, it's a magical place")
print("May ... | StarcoderdataPython |
759 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 21:56:15 2020
@author: Ray
@email: <EMAIL>
@wechat: RayTing0305
"""
'''
Question 1
Write a function called proportion_of_education which returns the proportion of children in the dataset who had a mother with the education levels equal to les... | StarcoderdataPython |
1922401 | <gh_stars>0
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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 require... | StarcoderdataPython |
6463222 | from Utils.Array import input_array
"""
In this question statement : The nearly sorted array thing, is very similar to one of the questions we did in heap
Problem Name : Sort nearly sorted array or Sort a K Sorted Array check in notion as well
One thing to remember is the difference bw [nearl... | StarcoderdataPython |
3469059 | from django.db import models
class PlaceType(models.Model):
name = models.CharField(
max_length=100,
unique=True,
)
class Place(models.Model):
type = models.ForeignField(
PlaceType,
related_name='places',
)
name = models.CharField(
max_length=100,
)
... | StarcoderdataPython |
5184641 | import torch
from torch import nn
print (torch.hub.list("msk-mind/luna-ml:main"))
model = torch.hub.load("msk-mind/luna-ml:main", "logistic_regression_model", weight_tag="main:logistic_regression_ones.pth")
print (model.lin1.weight)
model = torch.hub.load("msk-mind/luna-ml:main", "logistic_regression_model", weigh... | StarcoderdataPython |
192496 | from app import database
from app.database import Database
import datetime
from configparser import ConfigParser
config = ConfigParser()
def rep():
#Get delivery time from config
config.read("app/config.ini")
del_time = datetime.timedelta(days=int(config.get("Settings", "del_time")))
today = datetime.... | StarcoderdataPython |
1709105 | import collections
from unittest.mock import MagicMock
import bson
import pytest
from ihashmap.cache import Cache
from ihashmap.index import Index, IndexContainer
@pytest.fixture
def fake_cache():
return {Index.INDEX_CACHE_NAME: {}}
@pytest.fixture
def fake_get(fake_cache):
def _get(self, name, key, defau... | StarcoderdataPython |
8109629 | #!/usr/bin/python
from jinja2 import FileSystemLoader, StrictUndefined
from jinja2.environment import Environment
env = Environment(undefined=StrictUndefined)
env.loader = FileSystemLoader(['./templates'])
vrfs = {'vrf_name': 'blue',
'rd_number': '100:1',
'ipv4_enabled': True,
'ipv6_enabled'... | StarcoderdataPython |
6576248 | <filename>mseg/dataset_apis/SunrgbdImageLevelDataset.py<gh_stars>1-10
#!/usr/bin/env python3
import argparse
import glob
import imageio
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
import pdb
from typing import List, Optional
from mseg.utils.names_utils import (
get_dataloader_id_to_cl... | StarcoderdataPython |
11228023 | __author__ = 'brandonkelly'
import numpy as np
from sklearn import cross_validation, metrics
from sklearn.decomposition import PCA
import multiprocessing
import copy
import matplotlib.pyplot as plt
class SupervisedPCABase(object):
def __init__(self, regressor, max_components=None, n_components=1, whiten=True):
... | StarcoderdataPython |
5059441 | '''
实验名称:温度传感器DS18B20
版本:v1.0
日期:2020.3
作者:01Studio
说明:通过编程采集温度数据,并在oled显示。
'''
#Sensor lib
from w1thermsensor import W1ThermSensor
#导入luma相关库,oled lib
from luma.core.render import canvas
from luma.oled.device import ssd1306
from time import sleep
#初始化oled,I2C接口1,oled地址是0x3c
device = ssd1306(port=1, address=0x3C)
#... | StarcoderdataPython |
11216978 | <reponame>docusign/eg-03-python-auth-code-grant
from docusign_rooms import RoomsApi
from datetime import datetime
from flask import session, request
from ..utils import create_rooms_api_client
class Eg005GetRoomsWithFiltersController:
@staticmethod
def get_args():
"""Get required session and request ... | StarcoderdataPython |
182449 | <reponame>prathimacode-hub/WIE-WoC
n = int(input())
space = n-1
for i in range(n):
for k in range(space):
print(" ",end="")
for j in range(i+1):
print("* ",end="")
print()
space -= 1
| StarcoderdataPython |
4932295 | <filename>authserver/mailauth/migrations/0005_auto_20170709_1844.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-09 16:44
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mailauth', '0004_auto_20170626_1... | StarcoderdataPython |
9725606 | <gh_stars>1-10
import sim
import plot_gen
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
import multiprocessing
import json
import os
import functools
def generate_star_data():
"""Returns a set of """
q_c_range = [-9, 19]
q_c_set = np.around(np.exp(np.linspa... | StarcoderdataPython |
269462 | <reponame>pashas2k3/find-relative
import json
import boto3
from src.relation import DynamoRelation
from src.search import findPath
class SearchAction:
def __init__(self, start: str, end: str, ):
self.start = start
self.end = end
resource = boto3.resource('dynamodb')
dynamoRelation = DynamoRela... | StarcoderdataPython |
11376444 | <reponame>pyvain/niaki_solver<filename>rand_init.py
HEIGHT = 9
WIDTH = 6
NB_COLORS = 6
def test_ready(g):
for i in range(HEIGHT):
for j in range(WIDTH):
for vi, vj in [(i-1,j), (i+1,j), (i,j-1), (i,j+1)]:
if vi >= 0 and vj >= 0 and vi < HEIGHT and vj < WIDTH and g[vi][vj] == g[i... | StarcoderdataPython |
6694045 | import subprocess
import random
import threading
def worker():
subprocess.call(["Build_Client/Client", "-p", "2000", "-a", "127.0.0.1", "-n", "test" + `random.randint(0, 1000000)`])
random.seed()
threads = [threading.Thread(target = worker) for _i in range(100)]
for thread in threads:
thread.start()
| StarcoderdataPython |
1708861 | <gh_stars>1-10
#!/usr/bin/env python3
import rospy
import pygame
from std_msgs.msg import Int32
def handle_input():
left_pub = rospy.Publisher('left_motor', Int32, queue_size = 10)
right_pub = rospy.Publisher('right_motor', Int32, queue_size = 10)
left = Int32()
right = Int32()
while not(rospy.is_... | StarcoderdataPython |
3399750 | class Node:
def __init__(self, val):
self.val = val
self.left = self.right = None
class Solution:
def pathSum(self, nums: List[int]) -> int:
self.totalSum = 0
root = Node(nums[0] % 10)
for num in nums[1:]:
depth, position, val = num // 100, (num // 1... | StarcoderdataPython |
6506988 | <gh_stars>100-1000
# Sets global variable notebook when line magic is called with "%torchbearer notebook"global notebook
notebook = {'nb': False}
def set_notebook(is_notebook):
notebook['nb'] = is_notebook
def torchbearer(line):
if line == 'notebook':
set_notebook(True)
elif line == 'normal':
... | StarcoderdataPython |
345496 | <reponame>pengfei-chen/algorithm_qa
"""
问题描述:一棵二叉树原本是搜索二叉树,但是其中有两个节点调换了位置,使得这棵二叉树不再是搜索二叉树,
请找到这两个节点并返回。已知二叉树所有节点的值都不一样,给定二叉树的头结点head,返回一个长度为2的
二叉树节点类型的数组errs。errs[0]表示一个错误节点,errs[1]表示一个错误节点。
进阶:如果在原问题中得到了这两个错误节点,我们当然可以通过交换两个节点值的方式让整棵二叉树重新成为
搜索二叉树,但现在要求不能这么做,而是在结构上完全交换两个节点的位置,请实现调整的函数。
"""
from binarytree.toolcls impor... | StarcoderdataPython |
6441473 | from .facade_v1 import *
| StarcoderdataPython |
11338339 | """ Backend client handling data functions
"""
import json
import numpy as np
import pandas as pd
import plotly.graph_objs as go
scl = [[0.0, 'rgb(242,240,247)'],[0.2, 'rgb(218,218,235)'],[0.4, 'rgb(188,189,220)'],\
[0.6, 'rgb(158,154,200)'],[0.8, 'rgb(117,107,177)'],[1.0, 'rgb(84,39,143)']]
class Cli... | StarcoderdataPython |
6585805 | # -*- coding: utf-8 -*-
__author__ = 'bernardo'
import sys
import re
from server.handlers import errorHandler
from xml.sax.saxutils import escape, unescape
import codecs
from server.utils.httpMessages import messages
import config
from server.utils.bcolors import bcolors
from server.utils import info
from subprocess i... | StarcoderdataPython |
6451138 | <reponame>roskenet/kopf
"""
All the functions to keep track of the last seen state.
The "state" is a snapshot of meaningful fields, which must be tracked
to identify the actual changes on the object (or absence of such).
Used in the handling routines to check if there were significant changes at all
(i.e. not the int... | StarcoderdataPython |
1773904 | <reponame>parkerwray/smuthi-1
import sys
from smuthi.version import __version__
try:
from mpi4py import MPI
mpi_comm = MPI.COMM_WORLD
mpi_rank = mpi_comm.Get_rank()
except:
mpi_rank = 0
def print_smuthi_header():
welcome_msg = ("\n" + "*" * 32 + "\n SMUTHI version " + __version__ + "\n" + "*"... | StarcoderdataPython |
5087654 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Formatting functions for printing pipes
"""
from __future__ import annotations
from meerschaum.utils.typing import PipesDict, Dict
def pprint_pipes(pipes : PipesDict) -> None:
"""
Print a stylized tree of a Pipes dictionary.
Supports ANS... | StarcoderdataPython |
6516841 | <reponame>mehak-mann/mehak-mann.github.io<gh_stars>1-10
import os
from flask import Flask
from flask import render_template
from flask import request
from instance.scripts.analysis import main
app = Flask(__name__)
uploads_dir = os.path.join(app.instance_path, 'scripts')
app.config['FLASK_APP'] = 'app'
app.config['E... | StarcoderdataPython |
60265 | <filename>SimCalorimetry/EcalSimProducers/python/esEcalLiteDTUPedestalsProducer_cfi.py
import FWCore.ParameterSet.Config as cms
EcalLiteDTUPedestalsRcd = cms.ESSource("EmptyESSource",
recordName = cms.string("EcalLiteDTUPedestalsRcd"),
firstValid = cms.v... | StarcoderdataPython |
1713949 | import requests_mock
from openregister.client import RegisterClient
def test_client_url():
client = RegisterClient()
assert client is not None
with requests_mock.Mocker() as mock:
mock.get("https://example.com", text="data")
assert "data" == client.get("https://example.com").text
| StarcoderdataPython |
11219547 | <reponame>BenOsborn/Cerci
class AddElementwise:
@staticmethod
def forward(matrix_left, matrix_right, backwards=False):
assert(matrix_left.shape == matrix_right.shape)
new_tensor = [a+b for a, b in zip(matrix_left.tensor, matrix_right.tensor)]
if (not backwards):
return Tens... | StarcoderdataPython |
6410309 | <gh_stars>1-10
# 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"); y... | StarcoderdataPython |
3426922 | <gh_stars>1-10
import cv2
import glob
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def get_video_unique_count(path):
vidcap = cv2.VideoCapture(path)
count = 0
old_frame = None
full_frame_stable = None
STATIONARY_FLAG = False
unique_elements = []
... | StarcoderdataPython |
5000093 | <gh_stars>0
import sys, pdb, os
import time
import numpy as np
import tensorflow as tf
class CB_VEC:
def __init__(self,v_window_size=3,c_window_size=3,num_dx=200,num_rx=20000,dx_emb_size=64,rx_emb_size=64,
max_visit_per_person=34,max_rx_per_dx=1000,visit_emb_size=16
,l2=0.001,batc... | StarcoderdataPython |
12834200 | #-----------------------------------------------------
# Mimas: conference submission and review system
# (c) <NAME> 2016-2020 http://www.allankelly.net
# Licensed under MIT License, see LICENSE file
# -----------------------------------------------------
# schedule_lib/schedexport.py
#
# system imports
import datetim... | StarcoderdataPython |
3567840 | import os
import shutil
import sys
sys.stdout = open("deletion_result.txt", "a")
for name in range(1500):
directory_list = next(os.walk('simulation_data/' + str(name)))[1]
directory_no = len(directory_list)
if (directory_no != 47) and (directory_no != 44):
print(name)
shutil.rmtree('simula... | StarcoderdataPython |
8062781 | from typing import Any
class ExtraError(Exception):
"""Base exception for all extra-related erorrs."""
def __init__(self, extra_name: str, *args: Any) -> None:
super().__init__(*args)
self._extra_name = extra_name
class ExtraImportError(ExtraError, ImportError):
"""The extra depends on ... | StarcoderdataPython |
3281073 | import requests
'''
responce = requests.get('http://127.0.0.1:5000/status')
print(responce.status_code)
print(responce.text)
print(responce.json())
message = { 'username': 'Ju', 'text': 'Hello'}
responce = requests.post('http://127.0.0.1:5000/send', json = message)
print(responce.status_code)
print(responce.text)
pr... | StarcoderdataPython |
3350288 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-19 17:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('armery', '0003_armor_others'),
('heroquest', '0002_a... | StarcoderdataPython |
4988815 | """
fujitsu
Supports Fujitsu compiler function.
This compiler is developed by Fujitsu and is used in A64FX on Fugaku.
"""
from numpy.distutils.fcompiler import FCompiler
compilers = ['FujitsuFCompiler']
class FujitsuFCompiler(FCompiler):
compiler_type = 'fujitsu'
description = 'Fujitsu Fortran Co... | StarcoderdataPython |
1923676 | <reponame>mehrdad-shokri/retdec-regression-tests-framework
"""
Tests for the
:module`regression_tests.parsers.c_parser.exprs.unary_ops.pre_increment_op`
module.
"""
from tests.parsers.c_parser import WithModuleTests
class PreIncrementOpExprTests(WithModuleTests):
"""Tests for `PreIncrementOpExpr`."""... | StarcoderdataPython |
1902544 | <reponame>Danielhiversen/aiotractive
class DataObject:
def __init__(self, api, data):
self._api = api
self.id = data["_id"]
self.type = data["_type"]
self.version = data["_version"]
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} type={self.type} ver... | StarcoderdataPython |
6633798 | <gh_stars>0
# Alternate scraping of https://getmyvaccine.org/zips/99301
import requests
import json
from ScraperBase import ScraperBase
from Common import Status, SaveHtmlToTable
import logging
from typing import List
class RiteAidAlternate(ScraperBase):
def __init__(self):
self.URL = "https://www.riteai... | StarcoderdataPython |
3384015 | <gh_stars>1-10
import random
from tqdm import tqdm
import gym
import gym_numberworld
env = gym.make('numberworld-v0',
grid_size=10, # pass environment arguments to gym.make
n_objects=10,
removed_objects=[('red', '3')]) # red 3 will not appear in environment
env.seed(1) ... | StarcoderdataPython |
6645425 | #!/usr/bin/env python
# Python 2/3 compatibility
from __future__ import print_function
import cv2 as cv
import numpy as np
from tests_common import NewOpenCVTests
class TestGoodFeaturesToTrack_test(NewOpenCVTests):
def test_goodFeaturesToTrack(self):
arr = self.get_sample('samples/data/lena.jpg', 0)
... | StarcoderdataPython |
1828198 | <filename>src/Translations.py
from constants import FONT_BIG, FONT_SMALL
TRANSLATION_ID = {'en': 0, 'zh': 1}
TR_FONTS = (
( # en
FONT_BIG, FONT_SMALL),
( # cht
('Microsoft JhengHei', '12'), ('Segoe UI', '9')))
TRANSLATIONS = (
( # en
'Kitava-Touched', 'Innocence-Tou... | StarcoderdataPython |
9632962 | <filename>moar/_compat.py
# coding=utf-8
"""
Utilities for writing code that runs on Python 2 and 3.
"""
import sys
try:
from urllib.parse import urlparse
from urllib.parse import quote as url_quote
from urllib.request import urlopen
except ImportError:
import urlparse
from urllib import quote as ur... | StarcoderdataPython |
3555297 | <gh_stars>1-10
"""
footing.ls
~~~~~~~~~~
Lists all footing templates and projects spun up with those templates
"""
import footing.forge
@footing.utils.set_cmd_env_var('ls')
def ls(forge, template=None):
"""Lists all templates under a root path or list all projects spun up under
a root path and a template pat... | StarcoderdataPython |
9602041 | from ssr.surface_rec.tasks.task import Task
class ReductionTask(Task):
def __init__(self, colmap_idp, mesh_odp):
self.__dict__.update(locals())
# delete self, since it is redundant and a circular reference
del self.self
| StarcoderdataPython |
9797414 | from __future__ import absolute_import
import unittest
from main.maincontroller import MainController
from tests.xroad_parse_users_inputs import xroad_parse_user_inputs
class XroadDisableWsdlInputs(unittest.TestCase):
"""
UC SERVICE_11 (UC SERVICE 13/4) Parse User Input (WSDL URL)
RIA URL: https://jira.... | StarcoderdataPython |
1754929 | <gh_stars>0
import typing
from mixin import mixin
from .codegen import Codegen
from .expression import ExpressionMixin
class Let(Codegen):
def __init__(self, name: str, value: ExpressionMixin):
self._name: str = name
self._expr: ExpressionMixin = value
| StarcoderdataPython |
3456106 | class UserError(Exception):
def __init__(self,message):
self.message = message
class UserNotExistError(UserError):
pass
class UserAreadyRegisteredError(UserError):
pass
class InvalideEmailError(UserError):
pass
class IncorrectPasswordError(UserError):
pass
class IncorrectDatabaseStatment(UserError):
... | StarcoderdataPython |
4922839 | <gh_stars>0
# long_repeat
# Created by JKChang
# 18/04/2018, 10:53
# Tag:
# Description: This mission is the first one of the series. Here you should find the length of the longest substring
# that consists of the same letter. For example, line "aaabbcaaaa" contains four substrings with the same letters "aaa",
# "bb","... | StarcoderdataPython |
6513387 | <reponame>jacobmas/btrdb-python<gh_stars>0
import btrdb
from btrdb.conn import BTrDB
from functools import partial
def register_serializer(conn_str=None, apikey=None, profile=None):
"""
Register serializer for BTrDB Object
Parameters
----------
conn_str: str, default=None
The address and po... | StarcoderdataPython |
1753312 | <filename>lib/surface/storage/ls.py
# -*- coding: utf-8 -*- #
# Copyright 2020 Google LLC. 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 License at
#
# http://www.apache.org/li... | StarcoderdataPython |
4891470 | <filename>src/LianjiaSpider/spiders/LianjiaSpider.py
# -*- coding=utf-8 -*-
import scrapy
from ..items import LianjiaspiderItem
class LianjiaSpider(scrapy.spiders.Spider):
name = 'LianjiaSpider' # 爬虫名称
start_urls = [] # 存储爬虫URL
for i in range(1,101):
start_urls.append('https://bj.lianjia.com/zufang... | StarcoderdataPython |
9624918 | <reponame>maw41/FRIBs_Voting
import struct
import socket
import ssl
import sys
import thread
import random
import copy #TEMP
import time
from Queue import Queue
from time import sleep
class Server:
def loadResultLut(path):
return 0
class RemoteServer(Server):
def __init__(self, ip=None, seed=None, rport=None, lpo... | StarcoderdataPython |
335536 | #!/router/bin/python-2.7.4
import trex_root_path
from client.trex_client import *
from common.trex_exceptions import *
import cmd
import termstyle
import os
from argparse import ArgumentParser
from pprint import pprint
import json
import time
import socket
import errno
class InteractiveTRexClient(cmd.Cmd):
intro... | StarcoderdataPython |
3226089 | #!/usr/bin/env python
"""Tests for grr.server.grr_response_server.hunts.results."""
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib.rdfvalues import flows as rdf_flows
from grr.server.grr_response_server import data_store
from grr.server.grr_response_server.hunts import results as hunts_results
fr... | StarcoderdataPython |
6429961 | import logging
import openpathsampling as paths
logger = logging.getLogger(__name__)
from .shoot_snapshots import ShootFromSnapshotsSimulation
class SShootingSimulation(ShootFromSnapshotsSimulation):
""" S-Shooting simulations.
Parameters
----------
storage : :class:`.Storage`
the file to sto... | StarcoderdataPython |
1673456 | """Distance util functions."""
from __future__ import annotations
from numbers import Number
from typing import Callable
from homeassistant.const import (
LENGTH,
LENGTH_CENTIMETERS,
LENGTH_FEET,
LENGTH_INCHES,
LENGTH_KILOMETERS,
LENGTH_METERS,
LENGTH_MILES,
LENGTH_MILLIMETERS,
LEN... | StarcoderdataPython |
4937061 | <reponame>lectorvin/rpg
# ! - do in right now; P - programming; L - logic
#P TODO: module solid object, monsters, hero etc
#P TODO: like tkinter.Tk() but without interruption
#! TODO: hero's name
#! TODO: basic attributes (strength, fallout system?) and make them better (strength-ups)
#! TODO: quests!!!!11!1
#! TODO: d... | StarcoderdataPython |
1724937 | <reponame>chembl/chembl_new_webservices
__author__ = 'mnowotka'
import StringIO
from chembl_beaker.beaker.draw import cairoCanvas
from chembl_beaker.beaker import draw
from collections import defaultdict
try:
from rdkit import Chem
from rdkit.Chem import AllChem
except ImportError:
Chem = None
Draw = ... | StarcoderdataPython |
227449 | ####################################################################################################
from stomasimulator.geom.point import Point
import stomasimulator.mesh.elements as elem
####################################################################################################
class TestElements(object)... | StarcoderdataPython |
1948879 |
import aiomisc
import os
import zipfile
import tempfile
from errors_module.errors import APIBadRequest
from loguru import logger
import shutil
import hashlib as hash
from typing import Any, Dict, Tuple, Callable
import datetime
# from memory_profiler import profile
# @profile
@aiomisc.threaded_separate
def extract(s... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.