id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1606462 | """
Module Arm
This module represent the two arms that links each blocks togethers.
Attributes
----------
low_anchor : Coordinates
Correspond to the coordinates on the lower left of the block. The coordinates of the lower
right are deducted during computation and drawing.
high_anchor : Coordinates
Corresp... | StarcoderdataPython |
11356841 | <reponame>taxio/Saffron<filename>calyx/src/courses/models.py
import unicodedata
from importlib import import_module
from typing import TYPE_CHECKING
from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import make_password, check_password
from django.contrib.auth.models import Group
from dja... | StarcoderdataPython |
399344 | # make sure the rest of the ABXpy package is accessible
import ABXpy.sideop.side_operations_manager as side_operations_manager
import ABXpy.dbfun.dbfun_compute as dbfun_compute
import ABXpy.dbfun.dbfun_lookuptable as dbfun_lookuptable
import ABXpy.dbfun.dbfun_column as dbfun_column
import numpy as np
class FilterMa... | StarcoderdataPython |
9697077 | from matplotlib import _api
import mpl_toolkits.axes_grid1.axes_grid as axes_grid_orig
from .axislines import Axes
@_api.deprecated("3.5")
class CbarAxes(axes_grid_orig.CbarAxesBase, Axes):
pass
class Grid(axes_grid_orig.Grid):
_defaultAxesClass = Axes
class ImageGrid(axes_grid_orig.ImageGrid):
_defau... | StarcoderdataPython |
3535724 | import logging
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Tuple, Optional
from antarest.core.interfaces.cache import ICache, CacheConstants
from antarest.matrixstore.service import MatrixService, ISimpleMatrixService
from antarest.study.common.uri_resolver_service import ... | StarcoderdataPython |
6417811 | import time
from decimal import Decimal
try:
import thread
except ImportError:
import _thread as thread
if __package__ is None:
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))
# import Bitfinex library
from hokonui.exchanges.... | StarcoderdataPython |
6522106 | from wikimedia_cli import __version__
project = "wikimedia-cli"
author = 'Sky "g3ner1c" H.'
copyright = '2022 Sky "g3ner1c" H.'
release = __version__
extensions = ["myst_parser"] #! this is so that you can write docs in markdown instead of rst
master_doc = "index"
templates_path = ["_templates"]
exclude_patterns = ... | StarcoderdataPython |
1818314 | <filename>setup.py
from setuptools import setup
with open('requirements.txt', 'r') as f:
requires=[line for line in f.read().split("\n")
if line and not line.startswith('#')]
setup(
name='WeatherAPI',
version='0.0.1',
packages=[
'weatherapi',
],
install_requires=requires,... | StarcoderdataPython |
4987177 | <reponame>SemanticBeeng/termolator-j<filename>find_terms.py<gh_stars>0
from inline_terms import *
from DataDef import File, TXT3, TERM, POS
#
# @semanticbeeng @done static typing
# @semanticbeeng @pported
#
def find_inline_terms_for_file_list(file_list: File, dict_prefix: str = None) -> None:
start = True
... | StarcoderdataPython |
4970940 | import mock
from imhotep.repositories import Repository, AuthenticatedRepository
repo_name = 'justinabrahms/imhotep'
def test_unauthed_download_location():
uar = Repository(repo_name, None, [None], None)
loc = uar.download_location
assert loc == "git://github.com/justinabrahms/imhotep.git"
def test_aut... | StarcoderdataPython |
4855710 | from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms
class CustomerCreationForm(UserCreationForm):
first_name = forms.CharField(max_length=30, required=True)
last_name = forms.CharField(max_le... | StarcoderdataPython |
9671887 | <reponame>pgajdos/pymacaroons
from __future__ import unicode_literals
from hypothesis import *
from hypothesis.specifiers import *
from pymacaroons import Macaroon, MACAROON_V1, MACAROON_V2
from pymacaroons.utils import convert_to_bytes
ascii_text_strategy = strategy(
[sampled_from(map(chr, range(0, 128)))]
).m... | StarcoderdataPython |
5153541 | """Test state getters for retrieving motion planning views of state."""
import pytest
from dataclasses import dataclass, field
from mock import MagicMock
from typing import Optional
from opentrons.types import Point, MountType
from opentrons.hardware_control.types import CriticalPoint
from opentrons.protocols.geometry... | StarcoderdataPython |
5191874 | <gh_stars>1-10
from graphviz import Digraph
import pickle
def plot(genotype, filename):
g = Digraph(
format='pdf',
edge_attr=dict(fontsize='20', fontname="times"),
node_attr=dict(style='filled', shape='rect', align='center', fontsize='20', height='0.5', width='0.5', penwidth='2', fontname=... | StarcoderdataPython |
1952089 | <reponame>jgordo04/housinginsights_temp
##########################################################################
## Summary
##########################################################################
'''
Loads our flat file data into the Postgres database
'''
import logging
import json
import pandas as pandas
import ... | StarcoderdataPython |
4874665 | <reponame>linxiaohui/yaproxy
# -*- coding: utf-8 -*-
def create_dns_proxy(port=53, *, ip='0.0.0.0'):
raise Exception("Not Implement")
return DNSServer(ip, port)
def create_http_proxy(port=65432, *, ip='0.0.0.0'):
raise Exception("Not Implement")
return HTTPProxyServer(ip, port)
def create_http_proxy... | StarcoderdataPython |
9770409 | <reponame>cclauss/hubspot-api-python
from hubspot import HubSpot
from hubspot.communication_preferences import DefinitionApi, StatusApi
def test_is_discoverable():
apis = HubSpot().communication_preferences
assert isinstance(apis.definition_api, DefinitionApi)
assert isinstance(apis.status_api, StatusApi)... | StarcoderdataPython |
6582515 | # Copyright (c) 2019 Alibaba 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
#
# Unless required by applicable law... | StarcoderdataPython |
138066 | import sys
from flask import Flask, render_template
from flask_flatpages import FlatPages
from flask_frozen import Freezer
app = Flask(__name__)
app.config.from_pyfile('mysettings.cfg')
pages = FlatPages(app)
freezer = Freezer(app)
@app.route("/")
def index():
return render_template('index.html', navigation=True... | StarcoderdataPython |
5102675 | import unittest
from chapter_01.src.answer_09 import string_rotation
class TestStringRotation(unittest.TestCase):
def test_empty_string(self):
self.assertIs(string_rotation("", ""), True)
def test_equal_string(self):
self.assertIs(string_rotation("abcdef", "abcdef"), True)
def test_spac... | StarcoderdataPython |
34567 | import numpy as np
import cv2
import math
import datetime
from datetime import timedelta as Delta
h=300
w=300
cap = cv2.VideoCapture(0)
SUN_LOC=(200,70)
SUN_RSIZE=20
ORBITAL_R=10
def Orbiral(frame,Centerloc,orbit_r,size_r,phi,color):
x_orbit=Centerloc[0]+int(orbit_r*np.cos(np.deg2rad(phi))... | StarcoderdataPython |
9700563 | <gh_stars>0
import tkinter as tk
import xicd
def main():
root = tk.Tk()
app = xicd.App(root)
app.loop()
if __name__ == "__main__":
main()
| StarcoderdataPython |
9752623 | from distutils.core import setup
setup(
name='Markov',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
packages=['markov'],
url='http://pypi.python.org/pypi/Markov/',
license='LICENSE.txt',
description='Markov',
long_description=open('README.rst').read(),
) | StarcoderdataPython |
3221406 | <filename>examples/sample_model/test_model.py
import os
import sys
import numpy as np
from keras.models import model_from_json
from constants import CHARS, MAX_TOKENS
WORKING_DIR = os.getcwd()
def clean_data_encoded(sentence, max_tokens=MAX_TOKENS, sup_chars=CHARS):
sentence = str(sentence).lower()
x = np.z... | StarcoderdataPython |
11275479 | <gh_stars>1-10
from dal import autocomplete
from django import forms
from dj_waff.choice_with_other import ChoiceWithOtherField
from .models import DocumentTemplate
SET_OF_CHOICES = [
('choice1', 'choice1111'),
('choice2', 'choice2222'),
# ('choice3', lambda b: DocumentTemplate.objects.get(pk=1)),
]
cla... | StarcoderdataPython |
1843757 | <reponame>joergsimon/gesture-analysis
from analysis.preparation import labelMatrixToArray
from analysis.preparation import normalizeZeroClassArray
from visualise.trace_features import trace_feature_origin
from visualise.confusion_matrix import plot_confusion_matrix
import numpy as np
import sklearn
import sklearn.line... | StarcoderdataPython |
3324913 | """Tests for the programming application."""
| StarcoderdataPython |
388104 | #!/usr/bin/env python
# coding=utf-8
'''
Author: <NAME> / Yulv
Email: <EMAIL>
Date: 2022-03-19 10:33:38
Motto: Entities should not be multiplied unnecessarily.
LastEditors: <NAME>
LastEditTime: 2022-03-23 01:00:36
FilePath: /Awesome-Ultrasound-Standard-Plane-Detection/src/ITN/srmg/core/ExponentialBarycenter.py
Descript... | StarcoderdataPython |
6580484 | #!/usr/bin/env python
import tifffile
from scipy import ndimage as ndi
from imctools import library as lib
import argparse
import warnings
import os
import numpy as np
def crop_objects(fn_stack, fn_label, outfolder, basename, extend, order=None):
"""
:param fn_stack:
:param fn_label:
:param outfolder:... | StarcoderdataPython |
5178784 | <gh_stars>0
from django.urls import path
from .views import (
# HomeList,
# HomeDetail,
NewPostView,
PostDelView,
PostUpdateView,
UserPostView,
# AddCommentView
)
from . import views
#from .views import video
urlpatterns = [
# path('', HomeList.as_view(), name='home'),
path(''... | StarcoderdataPython |
6430725 | <filename>luogu-paint/utils.py
import json
import logging as log
from time import sleep
from random import shuffle
from requests import get, post
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36'
PAINT_DATA_URL = 'https://www.luogu.org/paintBoard/bo... | StarcoderdataPython |
4897028 | '''
Title : Day 1: Data Types
Domain : Tutorials
Author : <NAME>
Created : 03 April 2019
'''
i = 4
d = 4.0
s = 'HackerRank '
# Declare second integer, double, and String variables.
# Read and save an integer, double, and String to your variables.
i2 = int(input())
d2 = float(input())
s2 = input()
#... | StarcoderdataPython |
8003071 | <reponame>tslazarova/WMCore<filename>src/python/WMQuality/Emulators/PyCondorAPI/MockPyCondorAPI.py
from __future__ import (division, print_function)
class MockPyCondorAPI(object):
"""
Version of Services/PyCondor intended to be used with mock or unittest.mock
"""
def __init__(self, *args, **kwargs):
... | StarcoderdataPython |
8128486 | <reponame>JadilsonJR/Python
import os
carros=[]
class Carro:
nome=""
potencia=0
velMax=0
ligado=False
def __init__(self,nome,potencia): #Metodo Construtor
self.nome=nome
self.potencia=potencia
self.velMax=int(potencia)*2
self.ligado=False
def ligar(self):... | StarcoderdataPython |
11359196 | <filename>python/nvtfcnn_benchmarks/postprocess.py<gh_stars>0
"""Extract from a log file speeds and compute average speed and batch time."""
from __future__ import print_function
import re
import sys
MODEL_TITLES = {
"alexnet_owt": "AlexNetOWT", "googlenet": "GoogleNet",
"inception_resnet_v2": "InceptionResNe... | StarcoderdataPython |
6550575 | import os
import re
import json
import requests
import fnmatch
from urllib import urlencode
from BeautifulSoup import BeautifulSoup
_ROOT = os.path.abspath(os.path.dirname(__file__))
invalid_url = {'error': 'Invalid URL'}
unreachable = {'error': 'Failed to reach the URL'}
empty_meta = {'error': 'Found no meta info f... | StarcoderdataPython |
3418589 | #!/usr/bin/env python
"""async10gather.py: Use gather
Usage:
async10gather.py
"""
import asyncio
async def factorial(name, number):
f = 1
for i in range(2, number + 1):
print(f"Task {name}: Compute factorial({i})...")
await asyncio.sleep(1)
f *= i
print(f"Task {name}: factorial({... | StarcoderdataPython |
11209763 | """Top-level package for zfit."""
# Copyright (c) 2021 zfit
import warnings
from pkg_resources import get_distribution
__version__ = get_distribution(__name__).version
__license__ = "BSD 3-Clause"
__copyright__ = "Copyright 2018, zfit"
__status__ = "Beta"
__author__ = ("<NAME> <<EMAIL>>,"
"<NAME> <<... | StarcoderdataPython |
1644763 | <reponame>chensjtu/AdelaiDepth
import torch
import torch.nn.functional
from . import network_auxi as network
from lib.configs.config import cfg
from lib.utils.net_tools import *
from lib.models.PWN_planes import PWNPlanesLoss
from lib.models.PWN_edges import EdgeguidedNormalRegressionLoss
from lib.models.ranki... | StarcoderdataPython |
3579798 | import re
from unidecode import unidecode
import nick_names
import utils
class MalformedAuthorName(Exception):
pass
class Mention():
def __init__(self):
pass
def load_author_alias(self, name_str):
self.original_name = name_str
self.merged_name = name_str #this gets overwritten
... | StarcoderdataPython |
150546 | # -*- coding: utf-8 -*-
#############################################################
# IMPORTS #
#############################################################
import os
import sys
import re
from time import sleep
from PIL import Image, ImageOps, ImageFile
##... | StarcoderdataPython |
1619255 | <reponame>coclar/pointlike<filename>python/pointlike_defaults.py
# default parameters for the various parameter files
#
# $Header: /nfs/slac/g/glast/ground/cvs/pointlike/python/pointlike_defaults.py,v 1.16 2009/02/24 20:50:52 burnett Exp $
#
# Include this to set defaults, then override
import sys
print ('running %s' ... | StarcoderdataPython |
3389335 | <reponame>yaqwsx/YBlade
#Author-<NAME>
#Description-
import adsk.core, adsk.fusion, adsk.cam, traceback
from adsk.core import Point3D, Point2D, Vector3D, Vector2D, Matrix3D
import math
import sys
from copy import deepcopy
handlers = []
sys.stderr = sys.stdout
sys.stdout.flush()
def readProfile(profileFile):
poi... | StarcoderdataPython |
3324004 | import os
import django
import json
import random
os.environ.setdefault('DJANGO_SETTINGS_MODULE','QuestionsBidding.settings')
# # settings.configure()
django.setup()
from bidding.models import Question
fields=['question', 'a', 'b', 'c', 'd', 'answer']
for row in json.load(open('questions.json'))['results']:
row['in... | StarcoderdataPython |
6484765 | <filename>vector_parse.py
## Kraken version 1 kraken parser to remove plasmids
import sys
import re
PLASMID_REGEXP = re.compile(r'plasmid')
def fasta_parse(infile):
with open(infile, 'r') as fastaFile:
# Skip whitespace
while True:
line = fastaFile.readline()
if ... | StarcoderdataPython |
3589896 | <gh_stars>0
#Class used for reading AutoLabel files
import msgpack
import numpy as np
import StandardBody
class AutoLabelReader():
def __init__(self, in_filename):
self.in_filename = in_filename
self.read_data()
def read_data(self):
with open(self.in_filename, 'rb') as labelFile:
... | StarcoderdataPython |
3501194 | <reponame>ekzemplaro/data_base_language
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# firebird_python_read.py
#
# Jun/18/2012
#
#
import sys
import json
import kinterbasdb
import string
#
sys.path.append ("/var/www/data_base/common/python_common")
#
from sql_manipulate import sql_update_proc
from cgi_manipulate i... | StarcoderdataPython |
5022697 | <reponame>bibliotechie/h
from zope.interface import Interface
class IAnnotationFormatter(Interface): # pylint:disable=inherit-non-class
"""
Interface for annotation formatters.
Annotation formatters are ways to add data to the annotation JSON payload
without putting everything in the annotation pres... | StarcoderdataPython |
3331631 | from django.db import models
from hello_django.storage_backends import PublicMediaStorage, PrivateMediaStorage
class Upload(models.Model):
uploaded_at = models.DateTimeField(auto_now_add=True)
file = models.FileField(storage=PublicMediaStorage())
class UploadPrivate(models.Model):
uploaded_at = models.... | StarcoderdataPython |
9791298 | import os
import dash_bootstrap_components as dbc
from dash import dash_table, dcc, html
from dash.dependencies import ALL, Input, Output, State
from rubicon_ml import publish
from rubicon_ml.viz.base import VizBase
from rubicon_ml.viz.common.colors import light_blue, plot_background_blue
class ExperimentsTable(Viz... | StarcoderdataPython |
3218129 | """Softmax multi-class logistic regression classifier in Python."""
# References
# MultiClass Logistic Classifier in Python
# https://www.codeproject.com/Articles/821347/MultiClass-Logistic-Classifier-in-Python
import numpy as np
class Softmax(object):
"""Softmax classfier layer"""
def __init__(self):
... | StarcoderdataPython |
6584616 | #Desemvolva um programa que leia NOME, IDADE, a SEO DA PESSOA. No Final do programa.
# faça um progama que leia o nome de 4 pessoas, idade e o sexo de cada pessoa. No final do programa mostre
# A media da idade do grupo
# qual é o nome do homem mais velho.
# quantidade mulhers tem menos de 20 anos
somaidade = 0
media... | StarcoderdataPython |
12856079 | from torchvision import datasets, transforms
from base import BaseDataLoader
from torch.utils.data import Dataset, DataLoader
import pandas as pd
import torch
from skimage import io#, transform
import numpy as np
class MnistDataLoader(BaseDataLoader):
"""
MNIST data loading demo using BaseDataLoader
"""
... | StarcoderdataPython |
1948012 | <reponame>Maistho/twitter-parser
from flask import Flask, render_template, request
from TweetParser import TweetParser
app = Flask(__name__)
app.debug = True
myparser = TweetParser('gamergate')
def precision(c, tweets):
"""Computes precision for class `c` on the specified test data."""
tp = 0
fp = 0
... | StarcoderdataPython |
3495346 | <reponame>tkishimoto/gridalert<filename>gridalert/template/sts_template.py
from logging import getLogger
logger = getLogger(__name__)
from ..util import date as util_date
from ..util import text as util_text
from ..util import hash as util_hash
class StsTemplate:
def __init__(self, cl_conf):
self.cl_co... | StarcoderdataPython |
5161560 | import pathlib
import pytest
from x2webrtc.signaling import CopyAndPasteSignaling, get_signaling_method
BASE_DIR = pathlib.Path(__file__).resolve().parent
@pytest.mark.asyncio
async def test_get_signaling_method() -> None:
default = get_signaling_method()
assert default is not None
assert isinstance(de... | StarcoderdataPython |
6471074 | from .anvilGoogleMap import *
| StarcoderdataPython |
6411703 | <reponame>FCC-hh-framework/FCCFitter
import json
import optparse
import sys
from matplotlib import pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
import os
import ROOT as r
from ROOT import *
from array import array
plotname=''
#__________________________________________________________
def get... | StarcoderdataPython |
3435604 | <gh_stars>1-10
from __future__ import print_function, division, absolute_import
import numpy as np
from numba import ocl
from numba.ocl.testing import unittest
from numba.ocl.testing import OCLTestCase
class TestCudaArrayArg(OCLTestCase):
def test_array_ary(self):
@ocl.jit('double(double[:],int64)', de... | StarcoderdataPython |
11213748 | <filename>Day5/day5.py
def run_program(inputs):
with open("input.txt", "r") as data:
# split string on commas, convert it to integers, store them in a list
intcode = list(map(lambda x: int(x), data.read().split(",")))
startIndex = 0
while intcode[startIndex] != 99:
# conv... | StarcoderdataPython |
6428712 | <gh_stars>1-10
name = "logmein_host"
| StarcoderdataPython |
1883632 | <filename>trello_utility.py
import random
import trello
def get_list(name: str, board: trello.Board) -> trello.List:
"""
Find an open Trello list of the specified name
:param name: The name of the list
:param board: The board
:return: The list
"""
for trello_list in board.get_lists('open... | StarcoderdataPython |
6503050 | from __future__ import absolute_import
from __future__ import print_function
import os
import subprocess
import itertools
import numpy as np
import psi4
from psi4.driver.qcdb import periodictable
from psi4.driver.qcdb import physconst
from psi4.driver.qcdb import cov_radii
from . import BFS_bonding
from . import help... | StarcoderdataPython |
9663638 | """Main file for clifold."""
import argparse
from clifold.commands.clifold_git import git_init
from clifold.commands.clifold_init import py_init
from clifold.commands.clifold_pkg import pip
from clifold.commands.clifold_project import create
def __version__():
"""return package version"""
return "0.2.10"
d... | StarcoderdataPython |
1833990 | from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import StaleElementReferenceException
import time
def fresh_find(root, EC, timeout=2, retries=10):
for i in range(retries):
try:
elem = WebDriverWait(root, timeout).until(EC)
elem.is_enabled()
... | StarcoderdataPython |
9175 | <filename>src/dataAccess/Connection.py
#Copyright 2009 Humanitarian International Services Group
#
#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 |
5102418 | <filename>form-romanos/main.py
from flask import Flask, render_template, request
app = Flask(__name__)
def converte_romanos(numero):
#coloque seu codigo aqui, exemplo
romanos="MCM"
return romanos
@app.route("/",methods=["GET","POST"])
def romano():
if request.method == "POST":
response = request.f... | StarcoderdataPython |
9758727 |
def add(x1, x2= 2):
return x1+ x2
def sub(x1, x2=2):
return x1 -x2
def mul(x1, x2=2):
return x1 * x2
def div (x1, x2=2):
return x1 / x2
class InsufficientFund(Exception):
def __init__(self, message) -> None:
self.message = message
class BankAccount():
def __init__(self, star... | StarcoderdataPython |
28691 | <gh_stars>0
from infra.controllers.contracts import HttpResponse
class NotFoundError(HttpResponse):
def __init__(self, message) -> None:
status_code = 404
self.message = message
body = {
'message': self.message
}
super().__init__(body, status_code)
| StarcoderdataPython |
355278 | from flask import Flask, render_template, url_for, flash, redirect
"""
Set variable "app" to an instance of the Flask class.
__name__ is a special variable in Python that just means
the name of the module. It can be equal to "__main__".
Basically, this is so Python knows where to look for your
templates, static files... | StarcoderdataPython |
396625 | <reponame>NicholasWon47/redis-py<gh_stars>0
import os
import mock
import pytest
import re
import redis
import time
from threading import Thread
from redis.connection import ssl_available, to_bool
from .conftest import skip_if_server_version_lt, _get_client
from .test_pubsub import wait_for_message
class DummyConnect... | StarcoderdataPython |
58828 | #!/usr/bin/env python
from chr import models
from chr import coverage
# from chr import black_boxes
#from chr import black_boxes_r
from chr import methods
from chr import others
# from chr import others_r
| StarcoderdataPython |
5025746 | <reponame>ibab/tensorprob
from itertools import product
import tensorflow as tf
from .. import config
from ..distribution import Distribution
from ..model import Model, Region
@Distribution
def Mix2(f, A, B, name=None):
# TODO(chrisburr) Check if f is bounded between 0 and 1?
X = tf.placeholder(config.dtype... | StarcoderdataPython |
3469980 | <filename>TooManyStalkers/bot.py
import sys
import sc2
from sc2.ids.ability_id import AbilityId
from sc2.ids.unit_typeid import UnitTypeId
from sc2.ids.upgrade_id import UpgradeId
from sc2.ids.buff_id import BuffId
from sc2.unit import Unit
from sc2.units import Units
from sc2.position import Point2, Point3
from log... | StarcoderdataPython |
6576389 | import numpy as np
def fire(time, temperature_initial):
time /= 1200.0 # convert time from seconds to hours
temperature_initial -= 273.15 # convert ambient temperature from kelvin to celsius
temperature = (
660 * (1 - 0.687 * np.exp(-0.32 * time) - 0.313 * np.exp(-3.8 * time))
+ temperat... | StarcoderdataPython |
9744807 | <gh_stars>0
import sys
import os
import string
from selenium import webdriver
def fetchContest(contestNum):
baseURL = "https://codeforces.com/problemset/problem/" + contestNum + "/"
if(not os.path.exists("./" + contestNum)):
os.mkdir("./" + contestNum)
driver = webdriver.Firefox(executable_path=... | StarcoderdataPython |
28297 | <reponame>kboone/dotfiles<gh_stars>0
from skimage import color
import numpy as np
colors = [
("base03", (10., +00., -05.)),
("base02", (15., +00., -05.)),
("base01", (45., -01., -05.)),
("base00", (50., -01., -05.)),
("base0", (60., -01., -02.)),
("base1", (65., -01., -02.)),
... | StarcoderdataPython |
1621516 | <reponame>DX-MON/OpenPICle
# SPDX-License-Identifier: BSD-3-Clause
from amaranth import Elaboratable, Module, Signal, unsigned
from .types import Opcodes, ArithOpcode, LogicOpcode, BitOpcode
from .busses import *
__all__ = ["PIC16"]
class PIC16(Elaboratable):
def __init__(self):
self.iBus = InstructionBus()
self... | StarcoderdataPython |
3452053 | from mongoengine import Document, fields
from mongodbforms import DocumentForm
import unittest
class MyDocument(Document):
mystring = fields.StringField()
myverbosestring = fields.StringField(verbose_name="Foobar")
myrequiredstring = fields.StringField(required=True)
class MyForm(DocumentForm):
clas... | StarcoderdataPython |
4831281 | import random, math
import time
from itertools import product
R = 32
N = 1000
#d = 13393249480990767973698914121061987209673507827659760595482620214891467806973397091277092174
d = 1233932494 #31 bits
#d = 23393249481
#d = 133932494809907679736989141210619872096735078276597605954826202148555332 #237 bits
q = 2**252 + 2... | StarcoderdataPython |
4932578 | <filename>tests/test_decorators/test_has.py
# external
import pytest
# project
import deal
# app
from .helpers import run_sync
@pytest.mark.parametrize('markers, expected', [
(['io'], True),
(['network'], True),
(['socket'], True),
(['network', 'stdout'], True),
(['import', 'network', 'stdout'],... | StarcoderdataPython |
3420431 | <reponame>taesko/fst
__version__ = "0.0.3a1"
| StarcoderdataPython |
5181066 | <reponame>snoopy369/FiveThirtyEight<filename>State Words.py
# coding: utf-8
# Import Word List
import urllib.request
#Read in the list of words. Fortunately, this list of words is just straight up text, so easy to parse!
url="https://norvig.com/ngrams/word.list"
file = urllib.request.urlopen(url)
#Initialize the... | StarcoderdataPython |
8073365 | import math
import os
import time
import numpy as np
from paddle import fluid
from paddle.fluid import layers
from pytracking.features import augmentation
from pytracking.libs import dcf, operation, fourier
from pytracking.libs.optimization import ConjugateGradient, GaussNewtonCG, GradientDescentL2
from pytracking.li... | StarcoderdataPython |
3501591 | <reponame>pratikadarsh/Algorithms
'''
* @file BinarySearch.py
* @author (original JAVA) <NAME>, <EMAIL>
* (conversion to Python) <NAME>, <EMAIL>
* @date 29 Jun 2020
* @version 0.1
* @brief BinarySearch implementation
'''
import math
class BinarySearch():
def __init__(self):
# Comparing doub... | StarcoderdataPython |
1851630 | <reponame>danzek/email-formality-detection
#!/usr/bin/env python
# -*- coding: utf_8 -*-
"""
<NAME>
<NAME>
<NAME>
<NAME>
<NAME>
Purdue University
CNIT499 Natural Language Technologies
Simple count features.
"""
__author__ = "<NAME>, <NAME>, <NAME>"
__copyright__ = "Copyright 2014, <NAME>, Purdue University"
__credi... | StarcoderdataPython |
3202673 | #!/usr/bin/env python
import os, signal, time, re
import unittest2 as unittest
import psi.process, subprocess
class GpsshTestCase(unittest.TestCase):
# return count of stranded ssh processes
def searchForProcessOrChildren(self):
euid = os.getuid()
count = 0
for p in psi.process.Pro... | StarcoderdataPython |
8049522 | # Generated by Django 3.1.2 on 2020-10-07 15:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sim', '0009_auto_20200717_0031'),
]
operations = [
migrations.AlterField(
model_name='sim',
name='daysEcmo_cat2',
... | StarcoderdataPython |
4995716 | #Puts objective vectors on top of video.
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
import os
import neat
import sys
import pickle
#TODO: meas history -> get size. make numpy array. send to ANN -> plot.
# Create a VideoCapture object and read from input file
# If the... | StarcoderdataPython |
3524715 | <reponame>DanielSBrown/osf.io
# -*- coding: utf-8 -*-
import os
from tabulate import tabulate
from framework.mongo import database
from website import settings
from .utils import mkdirp
user_collection = database['user']
TAB_PATH = os.path.join(settings.ANALYTICS_PATH, 'tables', 'features')
mkdirp(TAB_PATH)
def... | StarcoderdataPython |
6530902 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Items schema for marshmallow loader."""
from invenio_records_rest.schemas import RecordMetadataSch... | StarcoderdataPython |
8038279 | <filename>analysis/mf_grc_analysis/2share/2share_fuzz_201114.py
from collections import defaultdict
import sys
import random
import numpy as np
import compress_pickle
import importlib
import copy
sys.path.insert(0, '/n/groups/htem/Segmentation/shared-dev/cb2_segmentation/segway.graph.tmn7')
# from segway.graph.synapse... | StarcoderdataPython |
182120 | <reponame>2600box/harvest<gh_stars>1-10
# Generated by Django 2.1.7 on 2019-03-22 10:30
from django.db import migrations
import torrents.fields
class Migration(migrations.Migration):
dependencies = [
('redacted', '0006_auto_20190303_2008'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
12827906 | #-*- coding:utf-8 -*-
"""convert_grantha.py
"""
from __future__ import print_function
import sys,re,codecs
import transcoder
transcoder.transcoder_set_dir('transcoder')
transcode = transcoder.transcoder_processString # convenience
def parse_filename(filein):
tranin_known = ['slp1','roman','hk']
m = re.search(r'^(.... | StarcoderdataPython |
6485222 | import cantoseg
def test_cut():
result = cantoseg.cut('香港喺舊石器時代就有人住')
answer = ['香港', '喺', '舊石器時代', '就', '有人', '住']
assert result == answer
def test_lcut():
result = list(cantoseg.lcut('香港喺舊石器時代就有人住'))
answer = ['香港', '喺', '舊石器時代', '就', '有人', '住']
assert result == answer
| StarcoderdataPython |
4809557 | from django.test import TestCase
import json
import jwt
from rest_framework import status
from rest_framework.test import APIClient
class TestAPI(TestCase):
def test_signUp(self):
client = APIClient()
response = client.post(
'/user/',
{
"username": "esteban... | StarcoderdataPython |
11248507 | <gh_stars>0
"""The tests for the Modbus init."""
import pytest
import voluptuous as vol
from homeassistant.components.modbus import number
async def test_number_validator():
"""Test number validator."""
# positive tests
value = number(15)
assert isinstance(value, int)
value = number(15.1)
a... | StarcoderdataPython |
11356824 | <gh_stars>100-1000
"""Just print something to stdout."""
print("Hello, world.")
| StarcoderdataPython |
5146559 |
from StringIO import StringIO
from textwrap import dedent
from urlparse import urlparse
import email.utils
import httplib
import mimetypes
import os
import json
import traceback
from KASignature import KASignature
VERSION = '1.1.0'
# Configuration
UPLOAD_ENDPOINT = 'https://upload-api.kooaba.com/'
BUCKET_ID = '... | StarcoderdataPython |
9724490 | import tensorflow as tf
import tensorflow.contrib.slim as slim
from utils import box_utils
def batch_roi_pooling(features_batch, rois_normalized_batch, params):
"""
Args:
features_batch:
rois_batch:
img_shape:
Returns:
"""
with tf.variable_scope("ROIPooling"):
rois_normalized_batch = tf.st... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.