id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3241124 | from model_bakery import baker
from munch import Munch
from rest_framework import status
from rest_framework.test import APITestCase
from posts.models import Post
class PostTestCase(APITestCase):
def setUp(self):
# given
self.user = baker.make('users.User')
self.test_post_1 = Post.objects... | StarcoderdataPython |
121519 | import calendar
from collections import defaultdict
from datetime import date, timedelta
from flask import url_for
from slugify import slugify
from sqlalchemy import func
from trello.exceptions import TokenError
from application.cms.classification_service import classification_service
from application.cms.models impo... | StarcoderdataPython |
1626381 | <reponame>keelya/datastructures<filename>ds2/mapping/__init__.py
from ds2.mapping.mapping import Mapping, Entry
from ds2.mapping.listmappingsimple import ListMappingSimple
from ds2.mapping.listmapping import ListMapping
from ds2.mapping.listmapping_notDRY import ListMapping as ListMapping_notDRY
from ds2.mapping.hashma... | StarcoderdataPython |
1686363 | <filename>pysimgame/plotting/base.py
"""Provide an Abstract manager for plots."""
from __future__ import annotations
from abc import abstractmethod
from importlib.machinery import SourceFileLoader
import logging
from pathlib import Path
from typing import TYPE_CHECKING
import pygame
import pygame_gui
from pysimgame.m... | StarcoderdataPython |
1759735 | <reponame>dirtyFox27/iexfinance
import pandas as pd
import pytest
from iexfinance.stocks import Stock
from iexfinance.utils.exceptions import IEXQueryError
class TestStockFundamentals(object):
def setup_class(self):
self.a = Stock("AAPL")
self.b = Stock(["AAPL", "TSLA"])
self.c = Stock("S... | StarcoderdataPython |
3381370 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) University of St Andrews 2020-2021
# (c) University of Strathclyde 2020-2021
# (c) James Hutton Institute 2020-2021
#
# Author:
# <NAME>
#
# Contact
# <EMAIL>
#
# <NAME>,
# Biomolecular Sciences Building,
# University of St Andrews,
# <NAME>,
# St And... | StarcoderdataPython |
1652744 | <gh_stars>0
""" Game fix for Resident Evil 5
"""
#pylint: disable=C0103
import os
import shutil
import subprocess
from protonfixes import util
def main():
""" Installs wmp11
"""
util.protontricks('wmp11')
util.protontricks('gfw')
installpath = os.path.abspath(os.getcwd())
videopath = os.path... | StarcoderdataPython |
1664116 | # Copyright (c) 2022 PaddlePaddle 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 appli... | StarcoderdataPython |
3350083 | <reponame>bhavinjawade/project-euler-solutions
# -*- coding: utf-8 -*-
'''
File name: code\the_race\sol_232.py
Author: <NAME>
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #232 :: The Race
#
# For more information see:
# https://projecteuler.net/problem=232
#... | StarcoderdataPython |
1665488 | #!/usr/bin/env python3
"""Easy installation and configuration of Linux/Mac/Windows apps.
"""
import os
import logging
import shutil
from pathlib import Path
from argparse import Namespace
from .utils import (
HOME,
USER,
BASE_DIR,
run_cmd,
add_subparser,
update_apt_source,
brew_install_safe,... | StarcoderdataPython |
1758680 | <gh_stars>1-10
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-04-09 07:45
import glob
import os
from iwpt2020 import cdroot
def load_conll(path):
with open(path) as src:
text = src.read()
sents = text.split('\n\n')
sents = [x for x in sents if x.strip()]
return sents
def ... | StarcoderdataPython |
1637695 | '''
Implementation of Classifier Training, partly described inside Fanello et al.
'''
import sys
import signal
import errno
import glob
import numpy as np
import class_objects as co
import action_recognition_alg as ara
import cv2
import os.path
import cPickle as pickle
import logging
import yaml
import time
from OptGri... | StarcoderdataPython |
3202124 | from sns_boomerang.common.items import sns_client, Job, Topic, JOB_TABLE
from contextlib import contextmanager
import pytest
from unittest.mock import MagicMock
from datetime import datetime
def test_new_job():
job = Job('topic', 'payload', 123)
assert job.id
assert job.topic == 'topic'
assert job.pay... | StarcoderdataPython |
3326048 | """Test the owntracks_http platform."""
import asyncio
from unittest.mock import patch
import os
import pytest
from homeassistant.components import device_tracker
from homeassistant.setup import async_setup_component
from tests.common import mock_component, mock_coro
MINIMAL_LOCATION_MESSAGE = {
'_type': 'locat... | StarcoderdataPython |
4820907 | import tensorflow as tf
import tensorflow_addons as tfa
from tensorflow.keras import layers
def tfa_sampler(image, coords, mask=False):
''' Value sampler using tfa.image.resampler
Args:
image: tensor with shape (bs*h*w, h/i**2, w/i**2, 1)
coords: coordinates tensor with shape (bs*h*w,, 2r+1, 2r+1,... | StarcoderdataPython |
1734707 | <gh_stars>1-10
from django.apps import apps
from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
class FSMPreprocessor(Preprocessor):
def __init__(self, *args, **kwargs):
self.indicator = "!!!bridger-fsm"
super().__init__(*args, **kwargs)
def run(self, lin... | StarcoderdataPython |
1776560 | <gh_stars>1-10
from setuptools import setup
# Import __version__ from code base.
exec(open("sif/version.py").read())
setup(
name="sif",
version=__version__,
description="A Library for inference with Gaussian processes.",
author="<NAME>",
author_email="<EMAIL>",
url="http://brofos.org",
ke... | StarcoderdataPython |
3225401 | """
Tests for crypto module.
"""
import tempfile
import pytest
import test_common.fs.crypto as crypto
@pytest.mark.crypto
def test_hash_file():
EXPECTED_HASH = "c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2"
with tempfile.NamedTemporaryFile() as file:
file.write(b"foobar")
... | StarcoderdataPython |
3281153 | from sdk import *
addr_list = addresses()
_pid_pass = "<PASSWORD>"
_pid_fail = "id_30011"
_proposer = addr_list[0]
_initial_funding = (int("2") * 10 ** 9)
_each_funding = (int("5") * 10 ** 9)
_funding_goal_general = (int("10") * 10 ** 9)
def test_pass_proposal_cli():
_prop = Proposal(_pid_pass, "general", "propo... | StarcoderdataPython |
1602709 | <filename>medicalAid2/urls.py
"""medicalAid2 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', vi... | StarcoderdataPython |
136602 | from pathlib import Path
from mock import patch, PropertyMock, MagicMock
import pytest
import asyncio
from decoy import matchers
from opentrons.hardware_control import ExecutionManager
from opentrons.hardware_control.modules import (
MagDeck,
Thermocycler,
TempDeck,
HeaterShaker,
)
from opentrons.hardw... | StarcoderdataPython |
20853 | from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
# The only required parameter for the ChatBot is a name. This can be anything you want.
chatbot = ChatBot("My First Chatbot")
# Training your ChatBot
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.... | StarcoderdataPython |
1642545 | import sys
if sys.version_info < (3, 5):
print("Python 3.5 or greater required")
sys.exit(1)
import logging
import urllib.request
from zipfile import ZipFile
import os
import os.path
import sys
import platform
import struct
TEMP_DIR = 'tmp'
BINARIES_32_URL = "https://github.com/sk89q/Plumeria/releases/downlo... | StarcoderdataPython |
180607 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-03 19:57
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('quiz', '0001_initial'),
... | StarcoderdataPython |
3314632 | from unittest import TestCase
from xdufacool.dupcheck import fast_hash_file, load_list
from xdufacool.dupcheck import dupdict_to_yaml, simplify_dupdict
from xdufacool.dupcheck import FileList
# class Test(TestCase):
# def setUp(self):
# self.filename = "/home/fred/Downloads/isos/gparted-live-1.1.0-1-amd64... | StarcoderdataPython |
1638467 | import json
import shutil
from sepal_ui import sepalwidgets as sw
from sepal_ui.scripts import utils as su
import ipyvuetify as v
from component.message import cm
from component import parameter as cp
from component import widget as cw
from component import scripts as cs
from .gwb_tile import GwbTile
class MspaTil... | StarcoderdataPython |
156906 | <reponame>donlelef/see-you-outside
import data_io
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.optim as optim
class HMM(torch.nn.Module):
"""HMM model
"""
def __init__(self):
super(HMM, self).__init__()
# a priori of the distribution
self.prior = to... | StarcoderdataPython |
1605040 | <gh_stars>0
import os
from . import posted
from django.shortcuts import render, redirect
from .models import company, Post
from users.models import Profile
from placement.models import application
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions i... | StarcoderdataPython |
3347364 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | StarcoderdataPython |
60263 | <reponame>HienDT27/annotation_utils
from .measure_dataset import Measure_COCO_Dataset | StarcoderdataPython |
1786605 | <reponame>pection/InternshipProject
#
# ColorHandPose3DNetwork - Network for estimating 3D Hand Pose from a single RGB Image
# Copyright (C) 2017 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwa... | StarcoderdataPython |
3269463 | <filename>cleff/messaging/migrations/0002_auto_20150801_1852.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0008_auto_20150801_1847'),
('messaging', '0001_initial'),... | StarcoderdataPython |
84847 | # -*- coding: utf-8 -*-
"""Simple test for the full schema."""
from graphene.test import Client
from aiida_restapi.graphql.main import SCHEMA
def test_full(create_node, orm_regression):
"""Test loading the full schema."""
node = create_node(label="node 1")
client = Client(SCHEMA)
executed = client.ex... | StarcoderdataPython |
4828843 | <reponame>l-vo/photos-picker
from photospicker.filter.abstract_filter import AbstractFilter # noqa
class EndFilterEvent(object):
"""Event dispatched after a filter execution"""
def __init__(self, photo_filter, filepath):
"""
Constructor
:param AbstractFilter photo_filter: filter
... | StarcoderdataPython |
3360304 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mr.S'
from bottle import request
from PIL import Image
import os
def is_ajax():
return True if request.headers.get('X-Requested-With') == 'XMLHttpRequest' else False
def image_thumbnail(image, width, height, position=('center', 'center')):
try:
... | StarcoderdataPython |
147698 | from sqlalchemy import Column, Integer, String, ForeignKeyConstraint
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from .general import pop_periode
class MxTunjanganKinerja:
__tablename__ = 'tunjangan_kinerja'
@declared_attr
def job_level_id(cls):
re... | StarcoderdataPython |
98425 | <filename>melee/dolphin_ORIGINAL.py
import os, pwd, shutil, subprocess, sys
import configparser
from melee import enums
"""Class for making confuguration and interfacing with the Dolphin emulator easy"""
class Dolphin:
"""Do a some setup of some important dolphin paths"""
def __init__(self, ai_port, opponent_... | StarcoderdataPython |
3286077 | <reponame>Vancheung/QTAF<filename>testbase/testcase.py
# -*- coding: utf-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this... | StarcoderdataPython |
124774 | class airQuality:
def __init__(self, bus):
self.iaq = 0
self.bus = bus
self.address = 0x5A
self.datablock = 9
self.data = 0
def read(self):
data = self.bus.read_i2c_block_data(self.address, 0x00, self.datablock)
#WIP
# Convert the data
#if... | StarcoderdataPython |
3295625 | import os
import testresources
from testscenarios import generate_scenarios
def load_tests(loader, tests, pattern):
this_dir = os.path.dirname(__file__)
mytests = loader.discover(start_dir=this_dir, pattern=pattern)
result = testresources.OptimisingTestSuite()
result.addTests(generate_scenarios(mytes... | StarcoderdataPython |
191280 | """
Python escritura en disco
Puede leer y escribir archivo con la funcion (open)
Los archivos pueden ser de texto o binarios
Manejadores :
* r = read
* w = write
* a = append
* r+ = lee y escribe
Se deben cerrar los archivos con el método (close)
"""
archivo = '/Users/javier/fi... | StarcoderdataPython |
1713065 | import mysql.connector
from local_config import db_config
from emojipedia.emojipedia import Emojipedia,EMOJI_CATEGORIES
from emoji_data import Unicode_Emoji_Data
# Connect to the database
cnx = mysql.connector.connect(user=db_config['user'],
host=db_config['host'],
... | StarcoderdataPython |
70001 | <reponame>gjo/mypy-zope<filename>tests/samples/unknown_interface.py<gh_stars>0
"""When importing an interface from unknown module, we just ignore it
"""
import zope.interface
from unknown import IUnknownInterface
@zope.interface.implementer(IUnknownInterface)
class Bookmark(object):
flag = True
def main() -> Non... | StarcoderdataPython |
87004 | <gh_stars>0
import onfido
import os
onfido.configuration.api_key['Authorization'] = 'token=' + os.environ['onfido_token']
onfido.configuration.api_key_prefix['Authorization'] = 'Token'
api = onfido.DefaultApi()
test_applicant_id = '6<PASSWORD>'
live_videos = api.list_live_videos(test_applicant_id).live_videos
print... | StarcoderdataPython |
79406 | import argparse
import base64
import binascii
import json
import msgpack
import sys
__version__ = "0.0.1"
ACTION_VALIDATE = "validate"
ACTION_DECODE = "decode"
actions = (ACTION_DECODE, ACTION_VALIDATE)
parser = argparse.ArgumentParser(description='python msgpack native formatter %s' % __version__)
parser.add_argum... | StarcoderdataPython |
3230677 | import logging
from .managers import DeviceManager
__all__ = ["Dispatcher"]
logger = logging.getLogger(__name__)
class Dispatcher(object):
"""
Dispatch device confiugrations and formulate the sequence to execute on a sequencer.
"""
def __init__(self, script):
self._script = script
... | StarcoderdataPython |
3300353 | #!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
"""Common tools."""
from collections import defaultdict
from functools import wraps
from threading import Lock
from typing import Any, Callable, DefaultDict, Sequence, Type, TypeVar, Union
import numpy as np
_T = TypeVar("_T")
_Callab... | StarcoderdataPython |
1603978 | import asyncio
import functools
import signal
import tornado.autoreload
import tornado.web
import tornado.wsgi
from django.core.management.base import BaseCommand
from tornado.platform.asyncio import AsyncIOMainLoop
from hurricane.server import logger, make_http_server, make_probe_server
class Command(BaseCommand):... | StarcoderdataPython |
3398726 | <reponame>IhabMohamed/deep_motion_planning
"""
This file contains methods that describe a Tensorflow model.
It can be used as template for a completely new model and is imported
in the training script
"""
import logging
import tensorflow as tf
from tensorflow.contrib.layers import batch_norm, fully_connected, conv2d, ... | StarcoderdataPython |
25607 | import scipy.special as sc
from tests.src.utils import split_list, __print
# .11 Serial Test
def serial_test(key, n, m=3, b_print=True):
def compute(s,m):
if m == 0:
return 0
if m == 1: head = ''
else : head = s[0:(m-1)]
s = s + head
v = [0]*2**m
... | StarcoderdataPython |
74863 | # (c) 2019 <NAME>
# This file is part of nuskybgd released under MIT License.
# See LICENSE file for full details.
import os
from . import env
_PASSCHECK = False
_AUX_ENV = 'NUSKYBGD_AUXIL'
_AUX_DIR = ''
_AUX_FILES = [
'be.arf',
'diag.rmf',
'fcxbA.arf',
'fcxbB.arf',
'nomapbgdparams.dat',
'detA... | StarcoderdataPython |
1750280 | import socket
import logging
from tasks import celery, sock
logger = logging.getLogger()
@celery.task()
def block_ip(ip, port):
cmd = "BLK tcp {} {}".format(ip, port).encode("utf-8")
logger.debug("Sending {!r}".format(cmd))
try:
sock.sendall(cmd)
amount_received = 0
amount_expe... | StarcoderdataPython |
1688459 | <reponame>haikejishu/selenium_login<filename>baidu/login.py
from time import sleep
from selenium import webdriver
def login(name, passwd):
driver = webdriver.Chrome()
# 智能等待
driver.implicitly_wait(10)
url = 'https://pan.baidu.com/'
driver.get(url)
driver.find_element_by_id('TANGRAM__PSP_4__... | StarcoderdataPython |
3296072 | import os
class Directory:
def __init__(self, absPath):
"""
Creates a Directory object.
Parameters
absPath: An absolute path to the directory this object operates over.
"""
self.absPath = absPath
def getDirList(self, extWhiteList=[]):
"""
Retu... | StarcoderdataPython |
4809139 | <filename>magick.py
from binascii import crc32
from errno import ESRCH
from fcntl import fcntl, F_GETFL, F_SETFL
import logging
import os.path
from os import O_NONBLOCK
from subprocess import Popen, PIPE
from tornado.ioloop import IOLoop
from urlparse import urlparse
# Text 'stylesheets'
__all__ = ["ImageMagick", "is_... | StarcoderdataPython |
754 | from hestia.manager_interface import ManagerInterface
from event_manager import event_actions
class EventManager(ManagerInterface):
def _get_state_data(self, event): # pylint:disable=arguments-differ
return event.event_type, event
def subscribe(self, event): # pylint:disable=arguments-differ
... | StarcoderdataPython |
173439 | # firm panel analysis
import sqlite3
# constants
fname_db = 'store/patents_new.db'
min_year = 1985
max_year = 2005
year_bins = [1985, 1990, 1995, 2000]
id_cols = ['firm_num', 'year']
sql_cols = ['assets', 'capx', 'cash', 'cogs', 'deprec', 'intan', 'debt', 'employ', 'income', 'revenue', 'sales', 'rnd', 'fcost', 'mkt... | StarcoderdataPython |
53190 | from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pyspawn._graph.relationship import Relationship
from dataclasses import dataclass
from typing import Set
@dataclass(frozen=False)
class Table:
"""Table class"""
schema: str
table_name: str
def __post_init__(self):
self.relationship... | StarcoderdataPython |
1682163 | import pytest
from iscram.domain.model import SystemGraph, Edge
from iscram.domain.optimization import SupplierChoiceProblem, OptimizationError
from iscram.domain.metrics.risk import risk_by_bdd
from iscram.domain.metrics.probability_providers import provide_p_direct_from_data
def test_init_supplier_choice_problem(f... | StarcoderdataPython |
3200478 | <gh_stars>1-10
# USAGE
# python social_distance_detector.py --input pedestrians.mp4
# python social_distance_detector.py --input pedestrians.mp4 --output output.avi
from pyimagesearch import social_distancing_config as config
from pyimagesearch.detection import detect_people
from scipy.spatial import distance as dist
... | StarcoderdataPython |
3269610 | # coding=utf-8
from django.http import HttpResponse
| StarcoderdataPython |
3254242 | <gh_stars>0
import numpy as np
import torch
from torchvision import transforms
import torch.nn as nn
import torch.nn.functional as F
import math
from CALAE.utils.color import preprocess_lab, lab_to_rgb, deprocess_lab, rgb_to_lab
def abs(x):
return torch.sqrt(x[:,:,:,:,0]**2+x[:,:,:,:,1]**2+1e-12)
def real(x):
... | StarcoderdataPython |
195634 | <filename>src/sage/topology/simplicial_complex_examples.py
# -*- coding: utf-8 -*-
"""
Examples of simplicial complexes
There are two main types: manifolds and examples related to graph
theory.
For manifolds, there are functions defining the `n`-sphere for any
`n`, the torus, `n`-dimensional real projective space for... | StarcoderdataPython |
1644755 | <gh_stars>0
"""
Finding the Minimum Window in S which Contains All Elements from T
Given a set T of characters and a string S, find the minimum window in S which will contain all the characters in T in complexity O(n).
eg,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
"""
# from collections import defaultdi... | StarcoderdataPython |
126787 | <reponame>plcrodrigues/RiemannianProcrustesAnalysis<gh_stars>10-100
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 4 15:25:54 2017
@author: coelhorp
"""
from scipy.linalg import eigh
import autograd.numpy as np
from pymanopt.manifolds import Rotations
from pymanopt import Problem
from pymanopt... | StarcoderdataPython |
28913 | #!/usr/bin/env python
import rospy
import math
from sensor_msgs.msg import LaserScan #import des donnes laser du lidar
import time
from rplidar_ros.srv import *
class Client():
vel=None
angle_est=None
#Init
def __init__(self):
rospy.init_node('client_lidar')
def listen_angle(self):
... | StarcoderdataPython |
1743724 | from datetime import datetime
from time import time
from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
from config import Onik
from helpers.decorators import sudo_users_only
from helpers.filters import command
START_TIME = datetime.utcnow()
START_TIME_... | StarcoderdataPython |
4818942 | <filename>files/parametergenerate/parametergenerate/find_reg_value.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
from jinja2 import Template
from parametergenerate import utility
def find_value(target_file, search_params, encoding=None, trap_undefined_error=False):
# auto encoding... | StarcoderdataPython |
3328100 | <filename>great_expectations/rule_based_profiler/rule/rule_output.py<gh_stars>0
from typing import Dict, List, Optional
from great_expectations.core import ExpectationConfiguration
from great_expectations.rule_based_profiler.expectation_configuration_builder import (
ExpectationConfigurationBuilder,
)
from great_e... | StarcoderdataPython |
135034 | <reponame>caelanhadley/NNFSIP<gh_stars>0
from model_1_m import *
from matplotlib import pyplot as plt
Loss_over_itt = []
X, y = cs.create_data(100, 3)
dense1 = Layer_Dense(2,3)
activation1 = Activation_ReLU()
dense2 = Layer_Dense(3, 3)
activation2 = Activation_Softmax()
loss_function = Loss_CatagoricalCrossEntropy(... | StarcoderdataPython |
74019 | <filename>adcs_sim.py
# -*- coding: utf-8 -*-
# Python Space Simulator v 0.0.1
# Test ADCS control
# notes
# - variables with _data are the collection of all data for that variable,
# before I used bucket
# - scalars are lower cap, vector and matrices are all CAPS
# system modules
#import os
#import sys
from time i... | StarcoderdataPython |
1714148 | #!/usr/bin/python3
import CMIP
def main():
gr = CMIP.Grid()
gr.setreadGrid(2)
gr.int = [0.5,0.5,0.5]
gr0 = CMIP.Grid(1)
gr0.setreadGrid(2)
gr0.int = [1.5,1.5,1.5]
inp = CMIP.InputParams("CMIP test",gr,gr0)
inp.addKeyword({'CUBEOUTPUT':1,'MINOUT':1})
run = CMIP.Run(inp)
run.addF... | StarcoderdataPython |
184217 | <gh_stars>0
import turtle
import time
'''
turtle.goto(100,100)
turtle.goto(100,0)
turtle.goto(0,0)
turtle.rt(90)
turtle.fd(100)
turtle.goto(0,0)
time.sleep(3)
turtle.clear()
turtle.left(45)
turtle.fd(150)
turtle.right(135)
turtle.fd(150)
turtle.left(135)
turtle.fd(150)
time.sleep(3)
turtle.clear()
'''
turtle.pensi... | StarcoderdataPython |
97515 | <reponame>anze3db/starlite
from starlette.middleware.trustedhost import TrustedHostMiddleware
from starlite import create_test_client, get
@get(path="/")
def handler() -> None:
...
def test_trusted_hosts_middleware():
client = create_test_client(route_handlers=[handler], allowed_hosts=["*"])
unpacked_m... | StarcoderdataPython |
1642984 | <filename>python/smap/ops/test/test_meter.py<gh_stars>10-100
"""
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of ... | StarcoderdataPython |
1672409 | #!/usr/bin/env python
from random import Random
import pytest
import networkx as nx
from networkx import convert_node_labels_to_integers as cnlti
class TestDistance:
def setup_method(self):
G = cnlti(nx.grid_2d_graph(4, 4), first_label=1, ordering="sorted")
self.G = G
def test_eccentricity... | StarcoderdataPython |
1607390 | <reponame>ManeAkshay/drone<gh_stars>0
import requests
r = requests.request('GET','http://192.168.1.2/AutomatedDrone/sample.php').json()
print(r)
print(r['A'])
| StarcoderdataPython |
4809263 | <filename>generate_diploma.py
import os
from datetime import datetime
from reportlab.pdfgen import canvas
from reportlab.lib import utils
from reportlab.lib.units import cm
from reportlab.lib.colors import HexColor
from reportlab.lib.pagesizes import A4
from reportlab.platypus import Frame, Image
# Globale konstanter
... | StarcoderdataPython |
1701801 | from six.moves import StringIO
from numpy import zeros, unique, searchsorted, array
from pyNastran.bdf.field_writer_8 import set_blank_if_default
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.bdf_interface.assign_type import (integer,
string_or_blank)
from pyNastran.dev.bdf_vectorized.c... | StarcoderdataPython |
1778793 | <reponame>ommnice/django-map<gh_stars>0
from django.db import models
# Create your models here.
class Cell(models.Model):
import_csv_name = models.CharField(max_length=256, default='default')
tech = models.CharField(max_length=256)
key = models.CharField(max_length=256)
parent_id = models.CharField(max... | StarcoderdataPython |
1793358 | <reponame>how2how/ToyHome
import sqlite3 as db
from lib.logger import logger as log
class SQLite:
def __init__(self, dbf):
self.conn = db.connect(dbf)
self.cursor = self.conn.cursor()
def fetchall(self, sql, data=[]):
result = None
if self.cursor.execute(sql, list(data)):
... | StarcoderdataPython |
3214299 | #!/usr/bin/env python
# Copyright (c) 2014, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of con... | StarcoderdataPython |
103980 |
urlChatAdd = '/chat/add'
urlUserAdd = '/chat/adduser'
urlGetUsers = '/chat/getusers/'
urlGetChats = '/chat/chats'
urlPost = '/chat/post'
urlHist = '/chat/hist'
urlAuth = '/chat/auth'
| StarcoderdataPython |
4838803 | # Copyright (c) 2007-2009 <NAME> <<EMAIL>>
#
# 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, publ... | StarcoderdataPython |
61754 | from __future__ import division
import cPickle as pickle
from libtbx import smart_open
import os,sys
import datetime
def run():
data_file_path = '/net/cci/youval/Work/work/Clashes/Data'
file_to_year_dict = {}
# find the file in LBL pdb mirror folder
#pdb_dir = os.environ["PDB_MIRROR_PDB"]
#pdb_files = ope... | StarcoderdataPython |
1701880 | """Worker views."""
from django.http.response import JsonResponse
from django.http import HttpRequest
from rest_framework import viewsets
from rest_framework.permissions import SAFE_METHODS, BasePermission
from rest_framework.decorators import api_view, permission_classes
from .models import Employee, Day, WorkDay
fr... | StarcoderdataPython |
3304872 | #! python3
# stopwatchPretty.py - A simple stopwatch program, with slightly styled print output. Each print statement is copied to clipboard.
import time, pyperclip
# Display the program's instructions.
print('Press ENTER to begin. Afterwards, press ENTER to "click" the stopwatch. Press CTRL-C to quit.')
input() # Pr... | StarcoderdataPython |
3296229 | <filename>setup.py
from setuptools import setup, find_packages
with open('requirements.txt') as f:
requirements = f.readlines()
long_description = 'Python script to quickly look up questions on StackOverflow from the command line'
setup(
name ='SearchOverflow',
version ='1.0.1',
... | StarcoderdataPython |
3201474 | <filename>src/simulate_row.py
import random
import globals
# Create two concurrent lists representing a split row
# - row is the front end of the row with sec_estimate faredecode_dict
# - row1 is the back end of the row
def simulate_row(epsilon, taxi_id, spd, cp, fr):
row = {}
row1 = {}
# Create row... | StarcoderdataPython |
1705236 | <reponame>wanaylor/ModelicaPy<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import division
"""
Created on Thu Jun 09 14:13:04 2016
@author: wn9
"""
print """
****************Unit Testing for ModelicaPy v1.1****************
---- This is a unit test for any Modelica Library that
---- utilizes a modified version... | StarcoderdataPython |
1642465 | import os
# auxiliary library to unpack operation parameters
from . import unpack_params as unpack
# project configuration wrapper: yaml formatted file
from misc.config import settings as conf
# cassandra managing helper functions
import admix
# pyspark modules
from pyspark import SparkConf
from pyspark.sql import ... | StarcoderdataPython |
1712458 | import pandas as pd
import seaborn as sns
from unittest import TestCase
from IOP_AOPs import spectral_response_functions as SRF
from SRF.response_function_analysis import central_wavelength_function
del SRF
def get_OLI_response_data():
"""
Basic function for acquisition of the OLI data
to be a... | StarcoderdataPython |
1687421 | from telethon import events
import asyncio
from userbot.utils import admin_cmd
@borg.on(admin_cmd(pattern="ttf ?(.*)"))
async def get(event):
name = event.text[5:]
m = await event.get_reply_message()
with open(name, "w") as f:
f.write(m.message)
await event.delete()
await borg.send_file(ev... | StarcoderdataPython |
190121 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
__credits__ = ["<NAME>"]
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2021"
__status__ = "Working on deploy Analyzer Design pattern"
__version__ = "2021.06.14"
LogPackageInstanceTemplate = "#!/usr/bin/env python\n\
# -*... | StarcoderdataPython |
4832943 | import numpy as np
from gym import utils
from trajopt.envs import mujoco_env
import fileinput
import scipy
from pose_model_estimator import hollow_dense_pointcloud
from genre.voxelization import voxel
def prep_XML(xml_path, replacement_path):
"""
Prepares MJCF XML code. Replaces mesh and textures directory for... | StarcoderdataPython |
3352517 | import numpy as np
import pandas as pd
from TACT.computation.adjustments import Adjustments, empirical_stdAdjustment
from TACT.computation.ml import machine_learning_TI
def perform_SS_NN_adjustment(inputdata):
inputdata_test_result = pd.DataFrame()
results = pd.DataFrame(
columns=[
"senso... | StarcoderdataPython |
1637785 | <reponame>Laohakunakorn-Group/nllab-cython
# Simulate the Cython model
# using ODEs for the repressilator as an example
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
#here = "/app" # Docker image mount point.
here = os.getcwd() # Use this if runni... | StarcoderdataPython |
1643576 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-09-20 12:49
from __future__ import unicode_literals
from django.db import migrations
def fill_location_group(apps, schema_editor):
Location = apps.get_model("geo", "Location")
LocationGroup = apps.get_model("geo", "LocationGroup")
for location ... | StarcoderdataPython |
111270 | <gh_stars>0
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def CreatePlotGrid(title, xlabel, ylabel, zlabel, aspectmode):
# plot
fig, ((axXZ, axYZ), (axXY, ax3D)) = plt.subplots(2, 2)
fig.suptitle(title, fontsi... | StarcoderdataPython |
188261 | <reponame>forafekt/djangular-serve
from .serve import main
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.