id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3315834 | <reponame>jzijin/mmsr<gh_stars>1-10
import cv2
import numpy as np
img1 = cv2.imread("0.png")
img2 = cv2.imread("1.png")
img3 = cv2.imread("3.png")
img4 = cv2.imread("2.png")
img5 = cv2.imread("4.png")
width = img1.shape[1]
height = img1.shape[0]
img6 = np.zeros((height*5, width, 3), np.uint8)
img6[0:height, 0:width] = ... | StarcoderdataPython |
4832831 | """This module implements standard game functions for Py-Climber, such as processing keypresses"""
import sys
import random
from src.blob_enemy import Blob
import pygame
import pygame.freetype
def check_events(settings, screen, tile_map):
"""Watch for keyboard and mouse events"""
for event in pygame.event.get... | StarcoderdataPython |
3370385 | <reponame>CajetanP/programming-exercises
def convert(number):
result = ""
if number%3 == 0:
result += "Pling"
if number%5 == 0:
result += "Plang"
if number%7 == 0:
result += "Plong"
if not len(result):
result += str(number)
return result
| StarcoderdataPython |
1733557 | <gh_stars>0
import sys, os
def fixpath():
path = os.environ.get('PATH', '').split(os.pathsep)
libdir = os.path.join(os.path.dirname(__file__), 'lib')
path.append(libdir)
os.environ['PATH'] = os.pathsep.join(path)
if hasattr(os, 'add_dll_directory'):
os.add_dll_directory(libdir)
if sys.pla... | StarcoderdataPython |
3386022 | <reponame>miiiingi/algorithmstudy<gh_stars>0
import sys
import collections
input = sys.stdin.readline
array = collections.deque()
N = int(input().strip())
for _ in range(N) :
number = input().strip()
if number == '0' :
array.pop()
else :
array.append(int(number))
print(sum(array)) | StarcoderdataPython |
41326 | from torch.utils.data import Dataset
from torchvision.transforms.functional import to_tensor
from utils.image.processor import ImagePreprocessor, colorFormats
from PIL import Image
import glob, random
class ImageData(Dataset):
def __init__(
self, srcPath, crop=True, cropSize=96, colorFromat="RGB", process... | StarcoderdataPython |
1780845 | <reponame>VulcanClimateModeling/fv3config<gh_stars>1-10
import unittest
import copy
import os
import shutil
from fv3config import ConfigError
from fv3config._tables import update_diag_table_for_config
from fv3config.config.derive import (
get_current_date,
_get_current_date_from_coupler_res,
_get_coupler_re... | StarcoderdataPython |
54878 | import os
import csv
import sys
from sklearn.model_selection import train_test_split
sys.path.append("..")
from training_config import RANDOM_SEED, ALLOWED_CLASSES, DATA_DIR
def stratified_split(X, y, test_size=0.2, validate_size=0.2, random_state=42):
X_train, X_test, y_train, y_test = train_test_split(X, y, str... | StarcoderdataPython |
3399666 | #!/usr/bin/env python
import os,sys
from mpi4py import MPI
import configparser
comm=MPI.COMM_WORLD
rank=comm.Get_rank()
from random import random
# cf=configparser.ConfigParser()
# cf.read(sys.argv[1])
# scan_method=cf.get('scan','Scan method')
# print 'scan_method=',scan_method
print 'rank',rank,' has random number',... | StarcoderdataPython |
160062 | <gh_stars>0
import pandas as pd
class FlowsResult():
def __init__(self, csv, clear=False,
columns=['flow', 'tid', 'cwnd', 'rate', 'loss', 'sacked', 'acked', 'rtt', 'inflight']):
self.csv = csv
self.columns = columns
self.res = pd.DataFrame(columns=columns)
if clear:
... | StarcoderdataPython |
98859 | <gh_stars>0
from .languagemodels import ngram
from .classification import naive_bayes | StarcoderdataPython |
84065 | from typing import List
class Node:
def __init__(self, index):
self.index = index
self._childes = {}
self._parent = None
@property
def parent(self):
return self._parent
@parent.setter
def parent(self, value):
self._parent = value
def get_n_parents(se... | StarcoderdataPython |
1778431 | import numpy as np
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from qlearnkit.algorithms import QKMeans
import pytest
from qiskit import Aer
from qiskit.utils import QuantumInstance, algorithm_globals
seed = 42
algorithm_globals.random_seed = seed
sv_quantum_instance ... | StarcoderdataPython |
42759 | <gh_stars>0
#!/usr/bin/env python2.7
import pika
import json, os
import magic
import time
import ast
from sys import argv
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
from cassandra import query
from sets import Set
def print_usage():
print("USAGE: %s KEYSPACE_FROM KEYSPACE_T... | StarcoderdataPython |
134809 | <filename>emailHelper.py
#!/usr/bin/env python3
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# me == my email address
# you == recipient's email address
me = "<EMAIL>"
you = "<EMAIL>"
# Create message container - the correct MIME type is multipart/alternative.
m... | StarcoderdataPython |
3273099 | #coding:utf-8
#!/bin/env python2.7
import sys
import os
import matplotlib
matplotlib.use('Agg')
import pylab
import itertools
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tkr
from matplotlib.backends.backend_pdf import PdfPages
args = sys.argv
inputdirs = args[1:-1] #dir... | StarcoderdataPython |
3260379 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Virtualchain
~~~~~
copyright: (c) 2014-15 by Halfmoon Labs, Inc.
copyright: (c) 2016 by Blockstack.org
This file is part of Virtualchain
Virtualchain is free software: you can redistribute it and/or modify
it under the terms of the G... | StarcoderdataPython |
139795 | '''
Unit tests for wind.py
'''
import unittest
import datetime
import pytz
import pandas as pd
import numpy as np
from envirodataqc import wind
class test_wind(unittest.TestCase):
def setUp(self):
'''
Create a pandas dataframe for tests
This dataset is somewhat arbitrary but meant to
... | StarcoderdataPython |
3355804 | from ozobotmapf.graphics.drawables import Line
from ozobotmapf.simulator.agents.agent import Agent
class AnimatedAgent(Agent):
"""
This agent is animating it's path in time.
"""
def __init__(self, agent_id, raw_plans, ozomap, config):
super().__init__(agent_id, raw_plans, ozomap, config)
... | StarcoderdataPython |
61949 | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import formats
from django.contrib.auth.models import User
from jsonfield import JSONField
from mbase.models import MetaBaseModel, MetaBaseStatusModel
from mcat.models import Product
from mcat... | StarcoderdataPython |
4835308 | class BaseOptions():
def initialize(self):
self.dataset = './dataset' # path to the dir of the dataset
self.name = 'experiment' # Name of the experiment
class TrainOptions(BaseOptions):
def __init__(self):
BaseOptions.initialize(self)
self.init_channels = 16
self.layers ... | StarcoderdataPython |
1771613 | <filename>europarl/jobs/crawler.py<gh_stars>0
import configparser
import datetime
import json
import logging
import multiprocessing
import os
import random
import socket
import sys
import time
from datetime import date
from queue import Full
import requests
from dotenv import load_dotenv
from europarl import configur... | StarcoderdataPython |
1694609 | <reponame>Ivanazzz/SoftUni-W3resource-Python
start = int(input("Enter the first number: "))
final = int(input("Enter the second number: "))
magic_number = int(input("Enter the magic number: "))
counter_of_combinations = 0
combination_is_found = False
for first_number in range(start, final + 1):
for second_number i... | StarcoderdataPython |
4830076 | # 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 Microsoft (R) AutoRest Code Generator.
# Changes ... | StarcoderdataPython |
1790625 | print("Kamran")
print("Hello Kamran")
print("I am Kamran") | StarcoderdataPython |
176610 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
from logger import setup_logger
from model import BiSeNet
from face_dataset import FaceMask
from loss import OhemCELoss
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import torch.nn.functional as F
import torch.distributed as dist
import os
imp... | StarcoderdataPython |
3397483 | <reponame>code42/py42
from py42.choices import Choices
from py42.sdk.queries.fileevents.file_event_query import FileEventFilterStringField
from py42.sdk.queries.query_filter import QueryFilterBooleanField
class Actor(FileEventFilterStringField):
"""Class that filters events by the cloud service username of the ev... | StarcoderdataPython |
4823227 | class RunService(object):
def __init__(self, raw):
self.raw = raw
def __getattr__(self, item):
if item == 'name':
return self.raw["metadata"]["name"]
if item == 'url':
return self.raw["status"]["address"]["url"]
raise AttributeError
| StarcoderdataPython |
135948 | <gh_stars>10-100
# Copyright 2022 Sony Semiconductors Israel, Inc. 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/licenses/LICENSE-2.0
#
# ... | StarcoderdataPython |
4818585 | def merge_the_tools(string, k):
x = 0
y = k
print_order = []
while y <= len(string):
st = string[x : y]
pr = ''
for ch in st:
if ch not in pr:
pr += ch
print_order.append(pr)
x += k
y += k
for a in print_order:
print... | StarcoderdataPython |
4829228 | import itertools
N=int(input())
D=list(map(int,input().split()))
print(sum(d*cumulate for d,cumulate in zip(D[1:],itertools.accumulate(D)))) | StarcoderdataPython |
3390903 | <filename>ocw/dataset.py<gh_stars>100-1000
# 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, V... | StarcoderdataPython |
3354404 | <gh_stars>0
print(True and True) # True in Python we use and (not &&)
a = 25
b = 10
print("a == 25 and b == 10",a == 25 and b == 10) # if one side is false then everything false
print(a > 5 and b > 20) # if one side is false then everything false
print(True and True and True and False) # one drop of False will ruin eve... | StarcoderdataPython |
12266 | <gh_stars>1-10
import unittest
from unittest.mock import patch
import os
from .ansible_test_framework import AnsibleTestFramework, RecordMaker
import keeper_secrets_manager_ansible.plugins
import tempfile
records = {
"TRd_567FkHy-CeGsAzs8aA": RecordMaker.make_record(
uid="TRd_567FkHy-CeGsAzs8aA",
... | StarcoderdataPython |
1775660 | from django.shortcuts import render,redirect
from django.http import HttpResponse,Http404,HttpResponseRedirect,JsonResponse
from .models import Profile,Neighbourhood,Business
from .forms import NewProfileForm,NewBusinessForm,NewHoodForm,UpdateProfileForm
from django.contrib.auth.models import User
from django.contrib.a... | StarcoderdataPython |
144397 | # Copyright (c) 2016-2017 Enproduktion GmbH & Laber's Lab e.U. (FN 394440i, Austria)
# 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 rig... | StarcoderdataPython |
100424 | import os
import sys
import tempfile
import shutil
import logging
import hashlib
import time
import tarfile
import json
import imp
from socket import gethostname
from .environments import Environment
from .exceptions import IpkgException
from .packages import META_FILE, make_filename
from .files import vopen
from .mix... | StarcoderdataPython |
1653782 | from pagination_bootstrap.version import __version__, __url__, version_info
| StarcoderdataPython |
1756975 | """ Utility functions. """
import numpy as np
import os
import random
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
from tensorflow.python.platform import flags
FLAGS = flags.FLAGS
## Network helpers
def conv_block(inp, cweight, bweight, reuse, scope, activation=tf.nn.relu, residual=False):
""" Perf... | StarcoderdataPython |
30548 | import os
from math import radians, sin, cos, asin, degrees, pi, sqrt, pow, fabs, atan2
from django import forms
from django.db import models
from django.conf import settings
from modelcluster.fields import ParentalKey
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailadmin.edit_handlers impo... | StarcoderdataPython |
167428 | <reponame>filfreire/questions-three
from datetime import datetime, timedelta
from functools import partial
from io import StringIO
import os
from subprocess import PIPE, Popen, STDOUT
import sys
from time import sleep
from unittest import TestCase, main
from expects import expect, be_empty, contain, equal, have_length... | StarcoderdataPython |
3384796 | <reponame>Pat-Lafon/auto-selfcontrol
import setuptools
setuptools.setup(
name='auto-selfcontrol',
version='1.0',
description='Small utility to schedule start and stop times of SelfControl',
url='github.com/andreasgrill/auto-selfcontrol',
long_description=open('README.md').read(),
packages=setup... | StarcoderdataPython |
3227557 | <gh_stars>0
import unittest
fib_num = lambda n: fib_num(n-1) + fib_num(n-2) if n > 2 else 1
class TestFibNum(unittest.TestCase):
def test_simple_1(self):
self.assertEqual(fib_num(3), 2)
def test_simple_2(self):
self.assertTrue(fib_num(5) > 3)
def test_simple_3(self):
self.assertFals... | StarcoderdataPython |
3355888 | <reponame>timtyree/bgmc
import numpy as np, pandas as pd
from ..utils.projection_func import get_subtract_pbc
#Programmer: <NAME>
#Date: 5.10.2021
#Group: Rappel
############
#Conventions
############
# $$
# \text{Let } \varphi_1\equiv\sin^{-1}\big(\widehat{\mathbf{x}_2-\mathbf{x}_1}\;\times\;\hat{\mathbf{a}}_1\big)... | StarcoderdataPython |
3237740 | <filename>mayiutils/datasets/feature_selector_wrapper.py
#!/usr/bin/python
# encoding: utf-8
"""
@author: Ian
@file: feature_selector_wrapper.py
@time: 2019-04-22 18:41
https://github.com/WillKoehrsen/feature-selector
从5个维度削减特征
There are five methods used to identify features to remove:
Missing Values
Single Unique... | StarcoderdataPython |
1647684 | class MusicBand:
def __init__(self, title, label, musician=None):
self.title = title
self.label = label
self.musician = musician
self.album = []
def write_album(self, album):
self.album.append(album)
class Musician:
def __init__(self, name... | StarcoderdataPython |
78585 | #!/usr/bin/env python3
#
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
import csv
import rst
import glossary
import os
perm_type = category = perm = ""
MATRIX_PATH = 'permissions/matrix.csv'
result = ['.. DON\'T MODIFY THE CONTENTS MANUALLY.',
' THIS IS AUT... | StarcoderdataPython |
1644511 |
#soma = 1/1 + 3/2 + 5/3 + 7/4 + ... + 99/50
e=d=1
soma=0.0
for d in range(d,51,1):
soma+=e/d
e+=2
print(f"{soma:.2f}" )
| StarcoderdataPython |
3300299 | from . import *
def create_session_from_user_id(user_id):
session = Session(user_id=user_id)
db.session.add(session)
try:
db.session.commit()
return session
except Exception:
db.session.rollback()
raise Exception('Failure creating session from user_id')
def get_or_create_session(user_id):
op... | StarcoderdataPython |
1767192 | <gh_stars>0
from lib import rpclib
import json
import time
import re
import sys
import pickle
import platform
import os
import subprocess
import signal
from slickrpc import Proxy
from binascii import hexlify
from binascii import unhexlify
from functools import partial
from shutil import copy
operating_system = platfo... | StarcoderdataPython |
61608 | from bento_meta.objects import Node
from bento_meta_shim.models.mdbproperty import MDBproperty
class MDBnode():
__node = None
"""give proper life"""
def __init__(self, node):
self.__node = node
self.kind = node.mapspec_['label']
self.name = node.handle
self.handle = node.ha... | StarcoderdataPython |
1656236 | import argparse
import serial
import serial.tools.list_ports
import requests
import re
import os
import signal
import esptool
TARGET_DIR = os.path.dirname(__file__) + "/firmwares"
read_file_one = os.path.dirname(__file__) + "/data/boot_app0.bin"
read_file_two = os.path.dirname(__file__) + "/data/bootloader_qio_80m.b... | StarcoderdataPython |
1742612 | #https://leetcode.com/problems/next-greater-element-i/submissions/
# Approach :
# We need to find the next greater element than the current element which is in the right side of the array
# Since Nums1 is a subset of Nums2 , we will be finding the next greater element in Nums2 and keep storing it in a Hashmap
# An... | StarcoderdataPython |
162061 | <filename>tests/test_dtypes.py
import os
import unittest
from datetime import datetime
from painlessdb import Schema, PainlessDB
class TestDatabaseDataTypes(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestDatabaseDataTypes, self).__init__(*args, **kwargs)
self.db_path = os.path... | StarcoderdataPython |
65426 | <gh_stars>10-100
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License-NC
# See LICENSE.txt for details
#
# Author: <NAME> (<EMAIL>)
from __future__ import absolute_import
from __future__ import division
import torch
import torch.nn as nn
class C... | StarcoderdataPython |
187236 | import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def sigmoid_der(x):
return x / (1 - x)
def relu(x):
if x > 0:
return x
else:
return 0
def relu_der(x):
if x > 0:
return 1
else:
return 0
def leaky_relu(x):
if x < 0:
return 0.01 * x
... | StarcoderdataPython |
3378504 | <gh_stars>0
"""
Copyright 2020 The OneFlow Authors. 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/licenses/LICENSE-2.0
Unless required by applicabl... | StarcoderdataPython |
121955 | <reponame>MalikJordan/pyPOM1D
"""
This file is included in all files
"""
# THIS FILE IS INCLUDED IN ALL FILES
RELEASE = 'Created by BFM v. 5.1'
PATH_MAX = 255
stderr = 0
stdout = 6
# HANDY FOR WRITING
def STDOUT(text):
print(text)
def STDERR(text):
print(text)
# STANDARD OUTPUT FOR PARALLEL COMPUTATION
de... | StarcoderdataPython |
170963 | <filename>case/case.py
# Copyright 2021 Ringgaard Research ApS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
1753142 | class DummyMapping:
"""
Dummy object used to provide a mapping interface for singular values.
"""
def __init__(self, value):
self._value = value
def __getitem__(self, key):
return self._value
| StarcoderdataPython |
1747732 | <filename>app/lib/message_bus.py
#! /usr/bin/env python
# _*_coding:utf-8 -*_
from queue import Queue, Empty
from threading import *
def singleton(cls):
_instance = {}
def _singleton(*args, **kargs):
if cls not in _instance:
_instance[cls] = cls(*args, **kargs)
return _instance[cl... | StarcoderdataPython |
3353751 | <filename>tests/test_fastapi/test_m2m_forwardref.py
from typing import List, Optional
import databases
import pytest
import sqlalchemy
from fastapi import FastAPI
from pydantic.schema import ForwardRef
from starlette import status
from starlette.testclient import TestClient
import ormar
app = FastAPI()
from tests.se... | StarcoderdataPython |
1600652 | """
Tasks Executor
==============
Responsible for executing tasks code, serialization, process separation, privileges management, passing the
already prepared context, processing the results, processing declarative code
Responsibilities are split into separate sub-layers.
"""
| StarcoderdataPython |
3325457 | <reponame>tatuanb/monai_V1<filename>tests/test_prepare_batch_extra_input.py
# Copyright 2020 - 2021 MONAI Consortium
# 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/... | StarcoderdataPython |
26091 | <reponame>Emrys-Merlin/monitor_airquality<filename>setup.py
from importlib.metadata import entry_points
from setuptools import find_packages, setup
setup(
name='monitor_airquality',
version='0.1',
url='',
author='<NAME>',
author_email='<EMAIL>',
description='Measure airquality using some senso... | StarcoderdataPython |
1721962 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import math
def equal(x, y, tol=0.000000001):
"""Compare if two real numbers are equal using a tolerance to avoid rounding errors."""
return math.fabs(x - y) < tol, '%(x)f != %(y)f' % locals()
def point_equal(p1, p2, msg=None):
are_equal = True
if p1.dim == p2.dim:
... | StarcoderdataPython |
1731026 | <gh_stars>1-10
A = 10
def kirim():
B = 15
global C
C = 25
print("1. Modul kirim : Nilai A,B,B :",A,B,C)
def terima():
print("2. Modul terima : Nilai A,B,C :",A,B,C)
B = 10
kirim()
terima() | StarcoderdataPython |
89145 | <filename>module_utils/oracle/oci_wait_utils.py
# Copyright (c) 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0... | StarcoderdataPython |
3271076 | import unittest
from logic.cidr_calculator import CIDRCalculator
from models.CustomExceptions import *
class TestIPRangeExceptions(unittest.TestCase):
def test_calculate_ip_range_when_ip_over_255_all(self):
ip = '256.256.256.256'
cidrRange = 32
cidr = CIDRCalculator()
self.assertR... | StarcoderdataPython |
1683067 | <reponame>Joshua-Barawa/My-Photos
from django.contrib.postgres.fields import ArrayField
from django.db.models import Subquery
from django.utils.functional import cached_property
class ArraySubquery(Subquery):
template = "ARRAY(%(subquery)s)"
def __init__(self, queryset, **kwargs):
super().__init__(qu... | StarcoderdataPython |
29283 |
print
print('This is Naveen')
:q
| StarcoderdataPython |
1682716 | import textwrap
import sys
from datetime import datetime
HEADER = """\
from zic.classes import *
from datetime import *
"""
RAW_FILES = [
'africa', 'antarctica', 'asia', 'australasia',
'europe', 'northamerica', 'southamerica'
]
def lines(input):
"""Remove comments and empty lines"""
for raw_line... | StarcoderdataPython |
3285166 | <reponame>allexvip/bot
import logging
from aiogram import executor
from create_bot import dp
from db import sqlite_db
logging.basicConfig(level=logging.INFO)
async def on_startup(_):
print('Bot online')
sqlite_db.sql_start()
from handlers import client, admin, other
client.register_handlers_client(dp)
adm... | StarcoderdataPython |
1691265 | <filename>TSIS_5/cc.py
import os
import os.path
import time
import shutil
from pathlib import Path
path = os.getcwd()
def Menu():
print("1. Files")
print("2. Directories")
print("3. Exit")
def DirMenuChoices():
print("0. Back")
print("1. Content")
print("2. Rename Directory")
print("3. N... | StarcoderdataPython |
1682382 | <gh_stars>0
import numpy as np
import pandas as pd
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def ABX(A, B, X, A_dictionary, B_dictionary, X_dictionary):
A_radii = A_dictionary.get(A[0])
B_radii = B_dictionary.get(B[0])
X_radii = X_dictionary.get(X[0])
t_effect... | StarcoderdataPython |
1610120 | <reponame>acdh-oeaw/exploreAT-questionnaireexplorer
from rest_framework import generics
from rest_framework.renderers import TemplateHTMLRenderer
from SPARQLWrapper import SPARQLWrapper, JSON
from django.views import generic
from rest_framework.response import Response
from rest_framework.views import APIView
import js... | StarcoderdataPython |
190421 | # from flask import Flask, render_template
# from flask_cors import CORS
# def create_app():
# app = Flask(__name__, static_folder='../client/build/static', template_folder='../client/build')
# CORS(app)
# @app.route("/", defaults = {'path': ''})
# @app.route("/<path:path>")
# def index(path):
# ... | StarcoderdataPython |
3282313 | <reponame>brown170/fudge<filename>numericalFunctions/ptwXY/Python/Test/UnitTesting/integrate/groupTestAll1.py
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
import os
from... | StarcoderdataPython |
174821 | from locators import *
from utilities import *
from browserSetUp import *
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class TestSetUp:
def __init__(self):
self.utilities = Utilities()
self.driver = DriverSetup(os.getenv('BROWSER'))
self.locator = Temperatu... | StarcoderdataPython |
129884 | <gh_stars>0
from django.apps import AppConfig
class MahTagsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'mah_tags'
| StarcoderdataPython |
3390173 | <gh_stars>0
from __future__ import annotations
import pytest
import numpy as np
from tools.numpy_numerology import (
repeated_indices,
make_outer_indices,
flattened_ranges,
)
# ELECTRONS TABLE
# event_idx electron_idx
# -----------------------
# 0 0
# 0 1
# ------------------------
# --... | StarcoderdataPython |
1726892 | #!/usr/bin/env python
import numpy as np
import rospy
import time
from sensor_msgs.msg import LaserScan
from nav_msgs.msg import OccupancyGrid
import tf
# p(x) = 1 - \frac{1}{1 + e^l(x)}
def l2p(l):
return 1 - (1/(1+np.exp(l)))
# l(x) = log(\frac{p(x)}{1 - p(x)})
def p2l(p):
return np.log(p/(1-p))
class Gr... | StarcoderdataPython |
4839268 | import re
import requests
from bs4 import BeautifulSoup
from botutils.constants import IS_URL_REGEX
def get_ffn_url_from_query(query):
ffn_list = []
href = []
url = 'https://www.google.com/search?q=' + \
query+"+fanfiction"
page = requests.get(url)
soup = BeautifulSoup(page.content, 'h... | StarcoderdataPython |
176441 | from datetime import datetime
from Myna import db
from werkzeug.security import generate_password_hash, check_password_hash, new_hash
from Myna import login
from flask_login import UserMixin
from .Hornbill import IMGresizer
from Myna.config import Config
import os
from Myna import photos
followers = db.Table('follower... | StarcoderdataPython |
161632 | #!/usr/bin/python
import os
from pynvml import *
def choose_gpu():
nvmlInit()
n_gpus = nvmlDeviceGetCount()
gpu_memusage = []
mostfree_index = 0
for gpu_index in range(n_gpus):
device_handle = nvmlDeviceGetHandleByIndex(gpu_index)
meminfo = nvmlDeviceGetMemoryInfo(device_handle)
... | StarcoderdataPython |
4807134 | <reponame>JiaqiYao/dynamic_multi_label<gh_stars>1-10
import tensorflow as tf
import numpy as np
from gensim.models.keyedvectors import KeyedVectors
import pickle
import json
import os
class DataProcessor(object):
"""Base class for data converters for sequence classification data sets."""
def __ini... | StarcoderdataPython |
3242594 | <reponame>robotcaresystems/roboticslanguage
#
# This is the Robotics Language compiler
#
# Parameters.py: Definition of the parameters for this package
#
# Created on: 17 August, 2018
# Author: <NAME>
# Author: <NAME>
# Licence: Apache 2.0
# Copyright: 2014-2017 Robot Care Systems BV, The Hagu... | StarcoderdataPython |
1757686 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME> (http://www.jdhp.org)
# 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, includ... | StarcoderdataPython |
1647526 | <reponame>commonism/acmetk<filename>acmetk/models/order.py<gh_stars>1-10
import enum
import typing
import uuid
from datetime import datetime, timezone, timedelta
import acme.messages
from cryptography import x509
from cryptography.hazmat.primitives import serialization
from sqlalchemy import (
Column,
Enum,
... | StarcoderdataPython |
1694198 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import hashlib
import io
import os
import shutil
import tarfile
import tempfile
from glob import glob
import requests
parser = argparse.ArgumentParser()
parser.add_argument('url')
parser.add_argument('--checksum', '-c', required=True)
parser.... | StarcoderdataPython |
3383119 | from django import forms
from .models import UserProfile,Neighborhood,Business,Update,Health
class UpdateForm(forms.ModelForm):
class Meta:
model = Update
exclude = ['writer']
class BusinessForm(forms.ModelForm):
class Meta:
model = Business
fields = '__all__'
class HealthForm... | StarcoderdataPython |
1624840 | import logging
from contextlib import contextmanager
from metadata_provider import MetadataProvider
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
DbBase = declarative_base()
class DbProvider(object):
def __init__(self, metada... | StarcoderdataPython |
3288140 | # This file is part of spot_motion_monitor.
#
# Developed for LSST System Integration, Test and Commissioning.
#
# See the LICENSE file at the top-level directory of this distribution
# for details of code ownership.
#
# Use of this source code is governed by a 3-clause BSD-style
# license that can be found in the LICE... | StarcoderdataPython |
1734733 | #!/usr/bin/python
"""
make some analysis on the contents of the DB
"""
import db
from config import *
# details?
PRINT_DETAILS=True
# simple: connect to the sqlite DB
get_db()
conn, model = conf['db'], conf['model']
# get models used
dbc = conn.cursor()
# 1. which is the last step
dbc.execute("select di... | StarcoderdataPython |
65838 | import math, time, os, argparse, logging, json
from wand.image import Image
parser = argparse.ArgumentParser(
prog='tile_cutter',
description='Cuts large images into tiles.')
parser.add_argument('--tile-size', metavar='SIZE', type=int, default=512,
help='Tile size (width and height)')
parse... | StarcoderdataPython |
1720785 | # Generated by Django 3.1 on 2020-08-16 05:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lesson_planner', '0018_auto_20200815_1745'),
]
operations = [
migrations.AddField(
model_name='lesson',
name='date_end... | StarcoderdataPython |
1721643 | from flask import Blueprint
from flask import request
from ..utils.responses import response_with
from ..utils import responses as resp
from ..models.books import Book, BookSchema
from ..utils.database import db
book_routes = Blueprint('book_routes', __name__)
@book_routes.route('/', methods=['POST'])
def create_boo... | StarcoderdataPython |
82070 | import dataclasses
import click
import datetime
import neuro_extras
from collections import defaultdict
from graphviz import Digraph
from neuro_cli import __version__ as cli_version
from neuro_sdk import Client, ResourceNotFound, __version__ as sdk_version
from operator import attrgetter
from rich import box
from rich... | StarcoderdataPython |
176913 | <gh_stars>1-10
#!/usr/bin/env python3
import tornado.ioloop
import tornado.options
import tornado.web
# Constants
PORT = 9999 # Set port to listen on
# Handlers
class HelloHandler(tornado.web.RequestHandler):
def get(self): # Handler for HTTP GET... | StarcoderdataPython |
1717698 | from TestAsynchSource import TestAsynchSource
from TestAsynchSink import TestAsynchSink
from TestMemory import TestMemory
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.