id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1770182 | import abc
import numpy as np
class HamiltonianDynamicsContext(metaclass=abc.ABCMeta):
@classmethod
@abc.abstractmethod
def configuration_space_dimension (cls):
pass
@classmethod
@abc.abstractmethod
def H (cls, qp):
"""Evaluates the Hamiltonian on the (2,N)-shaped (q,p) coordin... | StarcoderdataPython |
6692779 | <reponame>hushaohan/aqua
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/L... | StarcoderdataPython |
8049398 | <filename>src/main.py
from PyQt5.QtWidgets import QFileDialog
import numpy as np
import cv2 as cv
from PyQt5 import QtGui
from PyQt5.QtWidgets import (
QApplication,
QLabel,
QVBoxLayout,
QHBoxLayout,
QWidget,
QPushButton,
)
from Algorithms import RGB2BGR, RGB2GRAY
class ImageTemp:
"""
... | StarcoderdataPython |
1690697 | <reponame>GuilloteauQ/nbpreview
"""Render execution results from Jupyter Notebooks."""
from pathlib import Path
from typing import Dict, Iterator, Union
from nbformat import NotebookNode
from nbpreview.component.content.output.result import display_data, link
from nbpreview.component.content.output.result.display_dat... | StarcoderdataPython |
6609853 | """Module containing the logic for our debugging logic."""
import platform
from typing import Any
from typing import Dict
from flake8.plugins.finder import Plugins
def information(version: str, plugins: Plugins) -> Dict[str, Any]:
"""Generate the information to be printed for the bug report."""
versions = so... | StarcoderdataPython |
1779577 | import numpy as np
import time
import my_sgf
B = -1 # black
N = 0 # none
W = 1 # white
# B and W do not matter when call the function. Because this is onyl a test file.
# But make sure set the blank(empty) as 0.
if __name__ == "__main__":
"""
------------------------------------------
move(board, pos... | StarcoderdataPython |
1899245 | <reponame>rajeshmajumdar/TheFatCat<gh_stars>1-10
# License for freakymonk
# Copyright 2017-18 by <NAME> <@freakym0nk>
# Web : www.rajeshmajumdar.github.io
# Contact : @freakym0nk
# All Rights Reserved
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose... | StarcoderdataPython |
5022478 | # Copyright 2020 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distri... | StarcoderdataPython |
9626146 | """
Escriba un programa que imprima todos los enteros positivos impares menores que 100 omitiéndose aquellos que sean divisibles por 7.
"""
lista=[]
for i in range (1,101):
if(i%2!=0 and i%7!=0):
lista.append(i)
print(lista) | StarcoderdataPython |
5108927 | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin
from django.views.generic import TemplateView, FormView
from django.contrib.auth.mixins import PermissionRequiredMixin
from djan... | StarcoderdataPython |
8004927 | <gh_stars>0
import math
from .ffx import Feistel_cipher
from Crypto.Cipher import AES
class FF3(Feistel_cipher):
#Implements the NIST standarddised round function FF3
#Following the NIST example
#https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-38g.pdf
#https://csrc.nist.gov/CSRC/media... | StarcoderdataPython |
5176106 | <filename>blog/views.py
from django.shortcuts import render, get_object_or_404
from blog.models import Category, Article
from django.core.paginator import Paginator
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required(login_url="login")
def list(request):
# Sacar artíc... | StarcoderdataPython |
3327731 | <reponame>mmphego/misc-py-utils
import pathlib
from collections import OrderedDict,defaultdict, namedtuple
from functools import partial, wraps
from pprint import PrettyPrinter as pprint
pprint = PrettyPrinter(indent=4).pprint
def iterate_recursive_dict(dictionary, keys=()):
"""
Generator; walk through a re... | StarcoderdataPython |
6434936 | <reponame>MadManSC2/sharpy-sc2
import os
import shutil
import subprocess
import argparse
import zipfile
from typing import Tuple, List, Optional
from version import update_version_txt
root_dir = os.path.dirname(os.path.abspath(__file__))
# Files or folders common to all bots.
common = [
("jsonpickle", None),
... | StarcoderdataPython |
300843 | <filename>Variado_GeekUniversity/guppe/doctests.py
"""
Doctests
Doctests são testes que colocamos na docstring das funções/métodos Python.
def soma(a, b):
# soma os números a e b
#>>> soma(1, 2)
#3
#>>> soma(4, 6)
#10
#
return a + b
Para rodar um test do doctest:
python -m d... | StarcoderdataPython |
9716380 | #!/home/daniel/anaconda3/bin/python
# -*- coding: utf-8 -*-
"""
================================================
main_process_trt_data.py
================================================
This program processes TRT data obtaining plots of time series of
parameters over the TRT cell trajectory
"""
# Author: fvj
# Lic... | StarcoderdataPython |
1931968 | # -*- coding: utf-8 -*-
"""
Defines the typeset class and a number of builtin type sets.
"""
from __future__ import print_function, division, absolute_import
import collections
from functools import reduce
from itertools import starmap
from itertools import izip
from numba import typesystem
from numba.typesystem imp... | StarcoderdataPython |
11311703 | <filename>browseragents/core.py
import useragentdata as data
from random import choice
def random(browser=None, os=None):
agents = data.agents
if browser and os:
agents = [x for x in agents if browser.lower(
) in x['browserName'].lower() if os.lower() in x['osName'].lower()]
elif browser:... | StarcoderdataPython |
3464397 | <gh_stars>0
from logging import getLogger
import anndata
import numpy as np
import pandas as pd
logger = logging.getLogger(__name__) | StarcoderdataPython |
387002 | import os
import sys
from typing import List
from .model import ExecutedChecksResultList
from .runner import Runner
from .repository import Repository
from .config import ConfigLoader
from .scheduler import Scheduler
from .versioning import get_version
from rkd.api.inputoutput import IO
class Controller(object):
... | StarcoderdataPython |
3360202 | # Copyright 2016 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | StarcoderdataPython |
5145622 | import logging
from .base_plugin import BasePlugin
logger = logging.getLogger(__name__)
class VolumePlotter(BasePlugin, plugin_name='volume_plot'):
def process(self, df, meta, other):
logger.critical(other[self.config['input']])
return df
@staticmethod
def lint(plugin_dict):
pas... | StarcoderdataPython |
3426400 | chicken_soup = [
"爱迪生说,天才是百分之一的勤奋加百分之九十九的汗水。",
"查尔斯·史说,一个人几乎可以在任何他怀有无限热忱的事情上成功。",
"培根说过,深窥自己的心,而后发觉一切的奇迹在你自己。",
"歌德曾经说,流水在碰到底处时才会释放活力。",
"莎士比亚说,那脑袋里的智慧,就像打火石里的火花一样,不去打它是不肯出来的。",
"戴尔·卡耐基说,多数人都拥有自己不了解的能力和机会,都有可能做到未曾梦想的事情。",
"白哲特说,坚强的信念能赢得强者的心,并使他们变得更坚强。",
"伏尔泰说, 不经巨大的困难,不会有伟大的事业。",
"富勒曾经说, 苦难磨炼一些人,也毁灭另一些人。",
"文森特·皮尔说, 改变... | StarcoderdataPython |
370358 | <filename>startup/41-ESM_motion.py
import IPython
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import scipy.optimize as opt
import os
from bluesky.plans import scan, adaptive_scan, spiral_fermat, spiral,scan_nd
from bluesky.plan_stubs import abs_set, mv
... | StarcoderdataPython |
1715545 | # Valid Mountain Array
from typing import List
class Solution:
def validMountainArray(self, arr: List[int]) -> bool:
if len(arr) <= 2:
return False
n = len(arr)
index = 1
while index < n and arr[index - 1] < arr[index]:
index += 1
# if no decreasin... | StarcoderdataPython |
3475359 | <reponame>asthajn6/archive<gh_stars>1-10
def minimum_spanning_tree(edges):
'''Solves the minimum spanning tree (MST) problem using Prim's algorithm.
This algorithm "grows" the tree by starting with the smallest edge and then
iterativly adding the smallest edge that extends the tree without creating
a c... | StarcoderdataPython |
4908797 | <filename>startup/SST/RSoXS/Functions/acquisitions.py
import datetime
from .alignment import load_sample, load_configuration, avg_scan_time, move_to_location
from .configurations import all_out
from .sample_spreadsheets import save_samplesxls
from operator import itemgetter
from ..HW.slackbot import rsoxs_bot
from ...C... | StarcoderdataPython |
9732361 | <filename>DifferentialCalc/Laplacian.py
from manimlib.imports import *
class Opening_Quote(Scene):
def construct(self):
quote1 = TextMobject("Imagination is more important than knowledge")
quote1.set_color(RED)
quote1.to_edge(UP)
author = TextMobject("-<NAME>")
author.set_... | StarcoderdataPython |
4967254 | <reponame>boeddeker/sphinxcontrib-matlabdomain
# -*- coding: utf-8 -*-
"""
sphinxcontrib.adadomain
~~~~~~~~~~~~~~~~~~~~~~~~~~
Ada domain.
:copyright: Copyright 2010 by <NAME>
:license: BSD, see LICENSE for details.
Some parts of the code copied from erlangdomain by <NAME>.
"""
import re
impo... | StarcoderdataPython |
3246038 | # Auto generated by 'inv collect-airflow'
from airfly._vendor.airflow.models.baseoperator import BaseOperator
class OracleToOracleOperator(BaseOperator):
oracle_destination_conn_id: "str"
destination_table: "str"
oracle_source_conn_id: "str"
source_sql: "str"
source_sql_params: "typing.Union[dict,... | StarcoderdataPython |
11238149 | <reponame>Meso272/PyTorch-VAE<filename>do_cesm768_sz.py
import os
import numpy as np
import sys
fieldname=sys.argv[1]
datafolder="/home/jliu447/lossycompression/cesm-768"
ebs=[i*1e-4 for i in range(1,10)]+[i*1e-3 for i in range(1,10)]+[i*1e-2 for i in range(1,11)]
cr=np.zeros((29,17),dtype=np.float32)
psnr=np.zeros... | StarcoderdataPython |
6619851 | <filename>manager/views/employee.py
from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from manager import models as hmod
from account import models as amod
from . import templater
from base_app.user_util import user_check, my_account
from djang... | StarcoderdataPython |
9787314 |
urls = {}
def check_url(url):
if urls.get(url):
return f"{urls[url]} - cached"
else:
data = f"some data obtained from url {url}"
urls[url] = data
return data
def main():
pages = ["www.google.com", "www.elsitio.com", "www.twitter.com", "www.google.com", "www.elsitio.com"]
... | StarcoderdataPython |
265616 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
extraction of information using MIT-LL MITIE
"""
import re
import sys, os
import extractor
# import MITIE
if 'MITIE_HOME' not in os.environ:
raise ValueError('MITIE_HOME not set.')
MITIE_HOME = os.environ['MITIE_HOME']
sys.path.append(MITIE_HOME+'/mitielib')
from ... | StarcoderdataPython |
6690337 | <filename>froide/foirequest/tasks.py
import os
from django.conf import settings
from django.utils import translation
from django.db import transaction
from django.core.files import File
from froide.celery import app as celery_app
from froide.publicbody.models import PublicBody
from froide.helper.document import conve... | StarcoderdataPython |
1887227 | <filename>tika-example.py<gh_stars>1-10
import tika
from tika import parser
parsed = parser.from_file('temp.wav')
print(parsed["metadata"])
print(parsed["content"])
exit() | StarcoderdataPython |
5012993 | <reponame>duliodenis/mit-cs-courses
#
# MIT 6.01 (Week 1)
# Design Lab 1. Problem 1.3.1
#
# Created by <NAME> on 1/4/15.
# Copyright (c) 2015 ddApps. All rights reserved.
# ------------------------------------------------
# http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-01sc-introduction-t... | StarcoderdataPython |
6649896 | <reponame>pmorerio/deep-learning-tutorials<gh_stars>0
__author__ = 'm.bashari'
import numpy as np
from sklearn import datasets, linear_model
import matplotlib.pyplot as plt
class Config:
nn_input_dim = 2 # input layer dimensionality
nn_output_dim = 2 # output layer dimensionality
# Gradient descent para... | StarcoderdataPython |
397767 | import os
import time
from PySide2.QtWidgets import QMainWindow, QFileDialog, QMessageBox
from PySide2.QtGui import QDoubleValidator, QIntValidator
from PySide2 import QtCore
from genexpa.uis.uis.MainWindowUI import Ui_MainWindow
from genexpa.uis.WaitPopup import WaitPopup
from genexpa.uis.TableDisplayDialog import T... | StarcoderdataPython |
321786 | <filename>tests/testflows/rbac/tests/syntax/alter_user.py
import hashlib
from contextlib import contextmanager
from testflows.core import *
import rbac.helper.errors as errors
from rbac.requirements import *
@TestFeature
@Name("alter user")
@Args(format_description=False)
def feature(self, node="clickhouse1"):
"... | StarcoderdataPython |
3566763 | <gh_stars>100-1000
# python 2/3 interoperability
from __future__ import division
from __future__ import print_function
import os
import sys
import ctypes
# Getting memory info, based on
# http://stackoverflow.com/a/2017659/6621667 and
# https://doeidoei.wordpress.com/2009/03/22/python-tip-3-checking-available-ram-wi... | StarcoderdataPython |
1956977 | <reponame>dynalz/coredis
import pytest
import coredis
@pytest.fixture
def s(redis_cluster_server):
cluster = coredis.StrictRedisCluster(
startup_nodes=[{"host": "localhost", "port": 7000}]
)
assert cluster.connection_pool.nodes.slots == {}
assert cluster.connection_pool.nodes.nodes == {}
... | StarcoderdataPython |
2810 | <reponame>lapaniku/GAS<gh_stars>10-100
# This program was generated by "Generative Art Synthesizer"
# Generation date: 2021-11-28 09:21:40 UTC
# GAS change date: 2021-11-28 09:20:21 UTC
# GAS md5 hash: ad55481e87ca5a7e9a8e92cd336d1cad
# Python version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.19... | StarcoderdataPython |
1858448 | <filename>sandbox/old/train_quadrotor_12d.py
import torch
import numpy as np
import time
from constraint import Constraint
from quadrotor_12d import Quadrotor12D
from reinforce import Reinforce
from feedback_linearization import FeedbackLinearization
from logger import Logger
# Seed everything.
seed = np.random.choic... | StarcoderdataPython |
389840 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import numpy as np
import cv2 as cv
from boundingbox_art.cvdrawtext import CvDrawText
def bba_translucent_rectangle(
image,
p1,
p2,
color=(0, 64, 0),
thickness=5,
font=None, # ... | StarcoderdataPython |
83728 | # -*- coding: utf-8 -*-
"""common/tests/__init__.py
By <NAME>, thePortus.com, <EMAIL>
The init file for the common module tests
"""
| StarcoderdataPython |
1665065 | from .base_symbol_analyzer import SymbolAnalyzer
class Prices(SymbolAnalyzer):
@classmethod
def run(cls, df):
return dict(
open=df.Open.iloc[-1],
high=df.High.iloc[-1],
low=df.Low.iloc[-1],
close=df.Close.iloc[-1],
volume=df.Volume.iloc[-1],
... | StarcoderdataPython |
9790581 | <filename>jishaku/shim/paginator_base.py
# -*- coding: utf-8 -*-
"""
jishaku.paginators (non-shim dependencies)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paginator-related tools and interfaces for Jishaku.
:copyright: (c) 2021 Devon (Gorialis) R
:license: MIT, see LICENSE for more details.
"""
import collect... | StarcoderdataPython |
3505098 | <reponame>shammellee/pendulum
import pickle
import pendulum
from datetime import timedelta
def test_pickle():
dt1 = pendulum.datetime(2016, 11, 18)
dt2 = pendulum.datetime(2016, 11, 20)
p = pendulum.period(dt1, dt2)
s = pickle.dumps(p)
p2 = pickle.loads(s)
assert p.start == p2.start
ass... | StarcoderdataPython |
3515168 | from ._validate_data import check_query, check_response, check_query_response
from ._validate_size import check_size
from ._data_format import data_format, check_format
from ._data_format import QueryFormat, ResponseFormat, Format
from ._typing import Query, Response | StarcoderdataPython |
5184083 | <filename>rom/generate_reduced_basis_five_param.py
import time
import numpy as np
from mshr import Rectangle, generate_mesh
from dolfin import *
from forward_solve import Fin
from error_optimization import optimize_five_param
from model_constr_adaptive_sampling import sample
set_log_level(40)
# Create a fin geometry
... | StarcoderdataPython |
3457916 | """
Embedded Python Blocks:
Each time this file is saved, GRC will instantiate the first class it finds
to get ports and parameters of your block. The arguments to __init__ will
be the parameters. All of them are required to have default values!
"""
import numpy as np
from gnuradio import gr
from polarcodes import *... | StarcoderdataPython |
8155300 | <gh_stars>0
from urllib.request import urlopen, Request
import config
def get_html(source_url):
request = Request(
source_url,
headers={'User-Agent': config.crawl_user_agent})
return urlopen(request).read()
| StarcoderdataPython |
260413 | <reponame>marcelosalles/pyidf
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.economics import CurrencyType
log = logging.getLogger(__name__)
class TestCurrencyType(unittest.TestCase):
def setUp(self):
self.fd, s... | StarcoderdataPython |
1909053 | <reponame>recruit-communications/rcl-contest-2020
import argparse
import subprocess as sp
import sys
N = 500
M = 5000
class XorShift:
mask = (1 << 64) - 1
def __init__(self, seed=None):
self.x = seed or 88172645463325252
def next(self):
self.x ^= self.x << 13
self.x &= self.mask... | StarcoderdataPython |
6592695 | import csv
import cv2
import numpy as np
#import sklearn
from math import ceil
from sklearn.utils import shuffle
lines = []
with open('/home/workspace/CarND-Behavioral-Cloning-P3/run1/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
lines.append(line)
from skle... | StarcoderdataPython |
6438580 | <reponame>zxdavb/evohome_rf<filename>ramses_rf/protocol/packet.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""RAMSES RF - a RAMSES-II protocol decoder & analyser.
Decode/process a packet (packet that was received).
"""
import logging
from datetime import datetime as dt
from datetime import timedelta as td
fro... | StarcoderdataPython |
388677 | <reponame>ryfi/Chiron<gh_stars>0
#!/usr/bin/env python3
"""
Invoke a CWL Squeezemeta workflow
Code adapted from work originally done by <NAME> (<EMAIL>)
"""
import logging
import os
import subprocess
import sys
from argparse import ArgumentParser
import yaml
CWL_WORKFLOW = os.path.dirname(os.path.realpath(sys.path... | StarcoderdataPython |
86697 | from abc import ABC, abstractmethod
from PIL import Image, ImageTk
from riem.debug import Debug, DebugChannel
from riem.graphics import Align, Graphics, ImageLoader, Menu
from riem.input import Action, Controller, Keyboard
from riem.library import ArrayList, Dimensions, Point
from riem.version import __version__
from t... | StarcoderdataPython |
3236595 | <reponame>Meet088/Scrapping-images-from-instagram<filename>eval_captions_prex.py<gh_stars>0
from utils.coco.coco import COCO
from utils.coco.pycocoevalcap.eval import COCOEvalCap
eval_gt_coco = COCO('./val/captions_val2014.json')
eval_result_coco = eval_gt_coco.loadRes('./val/results.json')
scorer = COCOEvalCap(eval_... | StarcoderdataPython |
5174014 | #!/usr/bin/env python3
import argparse
import os
from xcanalyzer.argparse import parse_ignored_folders
from xcanalyzer.xcodeproject.parsers import XcProjectParser
from xcanalyzer.xcodeproject.generators import XcProjReporter
from xcanalyzer.xcodeproject.exceptions import XcodeProjectReadException
# --- Arguments --... | StarcoderdataPython |
11244820 | import logging
import warnings
from datetime import datetime, timedelta
from django.contrib.auth.backends import ModelBackend
from django.core.cache import cache
from .exceptions import RateLimitException
logger = logging.getLogger('ratelimitbackend')
class RateLimitMixin(object):
"""
A mixin to enable ra... | StarcoderdataPython |
1824872 | # -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, Inc.
#
# 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 requi... | StarcoderdataPython |
11339372 | <filename>rlberry/rendering/tests/test_rendering_interface.py
import os
import pytest
from pyvirtualdisplay import Display
from rlberry.envs.classic_control import MountainCar
from rlberry.envs.classic_control import Acrobot
from rlberry.envs.classic_control import Pendulum
from rlberry.envs.finite import Chain
from r... | StarcoderdataPython |
8155094 | from PyQt5 import QtWidgets, uic
import sys
import numpy as np
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
# Load the UI Page
self. ui = uic.loadUi('mainwindow.ui', self)
# Create a sin wave
x_time = np.arange(0, ... | StarcoderdataPython |
85498 | <filename>pirates/piratesgui/PirateButtonChain.py
# File: P (Python 2.4)
from direct.showbase.ShowBaseGlobal import *
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.fsm import StateData
from otp.otpbase import OTPGlobals
from pirates.piratesbase import PLocalizer
from pirates.piratesg... | StarcoderdataPython |
296288 | import boto3
from botocore.exceptions import ClientError
from boto3.dynamodb.conditions import Attr
import uuid
class DynamodbHandler:
def __init__(self, MESSAGE_TABLE, RATING_TABLE):
self.dynamodb = boto3.resource('dynamodb')
self.messages_table = self.dynamodb.Table(MESSAGE_TABLE)
self.r... | StarcoderdataPython |
4866774 | <gh_stars>0
# class Solution:
# def movesToStamp(self, stamp: str, target: str) -> List[int]:
# n = len(target)
# m = len(stamp)
# t = list(target)
# s = list(stamp)
# ans = []
# def check(ix):
# found = False
# for jx in range(m):
# ... | StarcoderdataPython |
235864 | <gh_stars>1-10
import numpy as np
import numpy.random as rng
from abc import ABC, abstractmethod
from copy import deepcopy
import os
import logging
import math
class GibbsChain(ABC):
"""
A chain that could sample from a gibbs distribution
"""
def __init__(self, beta = 0, startpoint = None):
"... | StarcoderdataPython |
3500335 | <reponame>rarguelloF/remote-testing
#!/usr/bin/python
from docx import Document
from docx.shared import Pt, RGBColor
from docx.enum.style import WD_STYLE_TYPE
COLOURS = {
'red': (255, 0, 0),
'green': (0, 255, 0),
'blue': (0, 0, 255)
}
DOC_NAME = 'DEFAULT_NAME'
def create(title):
global DOC_NAME
... | StarcoderdataPython |
9642913 | <reponame>ThomasKoscheck/Telegrambots
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from chatterbot import ChatBot
import telepot
from telepot.delegate import per_chat_id, create_open, pave_event_space
from telepot.namedtuple import ReplyKeyboardMarkup, KeyboardButton, ReplyKeyboardRemove, ForceReply
from telepot.na... | StarcoderdataPython |
8172527 | <filename>google/cloud/monitoring_metrics_scope_v1/types/metrics_scopes.py
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... | StarcoderdataPython |
9784739 | <reponame>schinmayee/nimbus
# This is a rewrite of setup_boostbook.sh in Python
# It will work on Posix and Windows systems
# The rewrite is not finished yet, so please don't use it
# right now it is used only be release scripts
# User configuration
DOCBOOK_XSL_VERSION = "1.67.2"
DOCBOOK_DTD_VERSION = "4.2"
FOP_VERSIO... | StarcoderdataPython |
8188901 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:pyy
# datetime:2018/12/28 15:17
import redis
from tornado.web import RequestHandler
class IndexHandler(RequestHandler):
def get(self, *args, **kwargs):
self.write("Hello Tornado!!!")
class BaseHandler(RequestHandler):
def set_default_headers(self... | StarcoderdataPython |
9701638 | import numpy as np
import cv2
from scipy import signal
import matplotlib.pyplot as plt
import os
from absl import app, flags, logging
from absl.flags import FLAGS
import shutil
from tqdm import tqdm
flags.DEFINE_string('annotation', "/mnt/data0/Garmin/datasets/aug_data/anno/03_scale_aware.txt",
... | StarcoderdataPython |
279521 | """
Lab 8
"""
#3.1
demo='hello world!'
def cal_words(input_str):
return len(input_str.split())
#3.2
demo_str='Hello world!'
print(cal_words(demo_str))
#3.3
def find_min(inpu_list):
min_item = inpu_list[0]
for num in inpu_list:
if type(num) is not str:
if min_item >= num:
... | StarcoderdataPython |
1953354 | <reponame>mpeven/Pytorch_Datasets
'''
Simulated "Around The World" needle passing videos using the da Vinci Surgical Systemself.
Dataset collected by Anand from 07/23/15 - 07/31/15 during his internship at Intuitive surgical.
Around the World
----------------
Person controls 2 needle drivers.
8 pairs of targets, star... | StarcoderdataPython |
3451375 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
import win32evtlog
from . import common
pytestmark = [pytest.mark.integration]
@pytest.mark.parametrize('server', ['localhost', '127.0.0.1'])
def test_expected(aggregator, dd_run_check, n... | StarcoderdataPython |
5064616 | <gh_stars>1-10
"""Imports."""
from django.contrib.auth.models import User
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views.generic import DetailView, UpdateView, TemplateView, ListView
from .... | StarcoderdataPython |
383007 | import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import torch
import torch.nn as nn
from config import batch_size_train, device
class ModelLSTMShakespeare(nn.Module):
def __init__(self):
super(ModelLSTMShakespeare, self).__init__()
self.embedding_le... | StarcoderdataPython |
1678037 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | StarcoderdataPython |
280545 | <reponame>iserko/lookml-tools<gh_stars>0
"""
a drill down rule
Authors:
<NAME> (<EMAIL>)
"""
from lkmltools.linter.field_rule import FieldRule
from lkmltools.lookml_field import LookMLField
class DrillDownRule(FieldRule):
"""
does this have drilldowns?
"""
def run(self, lookm... | StarcoderdataPython |
1753027 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | StarcoderdataPython |
12807895 | #
# Copyright (c) 2017, Massachusetts Institute of Technology 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 o... | StarcoderdataPython |
4981369 | from datetime import timedelta
import pendulum
import pytest
from ..conftest import assert_datetime
def test_sub_years_positive():
assert pendulum.datetime(1975, 1, 1).subtract(years=1).year == 1974
def test_sub_years_zero():
assert pendulum.datetime(1975, 1, 1).subtract(years=0).year == 1975
def test_s... | StarcoderdataPython |
174367 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#move this notebook to folder above syndef to run
from syndef import synfits #import synestia snapshot (impact database)
import numpy as np
import matplotlib.pyplot as plt
test_rxy=np.linspace(7e6,60e6,100) #m
test_z=np.linspace(0.001e6,30e6,50) #m
rxy=np.log10(test_rx... | StarcoderdataPython |
1950919 | # -*- coding: utf-8 -*-
"""
Catch-up TV & More
Copyright (C) 2018 SylvainCecchetto
This file is part of Catch-up TV & More.
Catch-up TV & More 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 Software Foundat... | StarcoderdataPython |
4864846 | <gh_stars>0
"""
Revision ID: 0365_add_nhs_branding
Revises: 0364_drop_old_column
Create Date: 2022-02-17 16:31:21.415065
"""
import os
from alembic import op
revision = '0365_add_nhs_branding'
down_revision = '0364_drop_old_column'
environment = os.environ['NOTIFY_ENVIRONMENT']
def upgrade():
if environment ... | StarcoderdataPython |
1845103 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from tesseract import evaluation, temporal, metrics, viz
import pickle
line_kwargs = {'linewidth': 1, 'markersize': 5}
# def plot_f1(ax, l, data, alpha=1.0, neg=False, label=None, color='dodgerblue',
# marker='o'... | StarcoderdataPython |
1600467 | import math
import sys
from PyQt5 import QtGui, QtWidgets
from code_wheel.resources import resources_rc
def wheel_radius(pixmap_item):
"""
Determine the radius of the given wheel part.
:param pixmap_item: The wheel part.
:type pixmap_item: QtWidgets.QPixmapGraphicsItem
:returns: The radius of... | StarcoderdataPython |
6537573 | <reponame>zjzh/vega
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... | StarcoderdataPython |
3370444 | astring = "Hello World!"
print(astring[::-1])
| StarcoderdataPython |
8135409 | <reponame>24TangC/gpa-calculator<filename>classes.py
class classes:
def __init__(self, name):
print('How many classes are you taking?')
self.num_classes = int(input())
self.grades = {}
self.credits = {}
self.level = {}
for x in range(self.num_classes):
... | StarcoderdataPython |
11308788 | # Generated by Django 2.1.3 on 2020-01-05 07:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('result', '0071_auto_20191229_0935'),
]
operations = [
migrations.AlterField(
model_name='btutor',
name='created',
... | StarcoderdataPython |
3399941 | #/usr/bin/env python
# Author: <NAME>
# Histroy:
# 2021-03-14 Define plot_fft function
#
import numpy as np
import matplotlib.pyplot as plt
def plot_fft(freq,amp,ylabel=None):
'''
Make three plots of amplitude:
1.Amplitude - Frequency
2.Amplitude - Log-frequency
3.Amplitude - Period.
No zero frequency allow... | StarcoderdataPython |
50885 | import Foundation
from PyObjCTest.testhelper import PyObjC_TestClass3
from PyObjCTools.TestSupport import TestCase
class TestNSHost(TestCase):
def testCreation(self):
#
# This gives an exception on GNUstep:
# Foundation.NSRecursiveLockException - unlock: failed to unlock mutex
#
... | StarcoderdataPython |
3388583 |
def read_sensor():
global temp, hum
temp = hum = 0
try:
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
if (isinstance(temp, float) and isinstance(hum, float)) or (isinstance(temp, int) and isinstance(hum, int)):
msg = (b'{0:3.1f},{1:3.1f}'.format(temp, hum))
# te... | StarcoderdataPython |
9656037 | <gh_stars>0
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.conf import settings
class User(AbstractUser):
pass
class Post(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)
content = models.TextField(max_length=255)
date_posted = mo... | StarcoderdataPython |
3365953 | import pytest
from unittest import mock
from aio_message_handler.consumer import Consumer
@pytest.fixture
def create_mock_coro(monkeypatch):
def _create_mock_patch_coro(to_patch=None):
m = mock.Mock()
async def _coro(*args, **kwargs):
return m(*args, **kwargs)
if to_patch:
... | StarcoderdataPython |
3455313 | <filename>models/SyncNetModelFBank.py
#! /usr/bin/python
# -*- encoding: utf-8 -*-
import torch
import torch.nn as nn
import torchaudio
class SyncNetModel(nn.Module):
def __init__(self, nOut = 1024, stride = 1):
super(SyncNetModel, self).__init__();
self.netcnnaud = nn.Sequential(
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.