id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6682260 | <gh_stars>0
from django.test import TestCase
from stocks.models import StockTable
class ModelTests(TestCase):
def test_check_stocktable(self):
scrip = 'RELIANCE'
stock = StockTable.objects.get(scrip=scrip)
self.assertEquals(stock.scrip, scrip)
| StarcoderdataPython |
8169587 | import rp2pio
import adafruit_pioasm
import array
from digitalio import DigitalInOut
from micropython import const
from . import HX711
hx711_read_code = """
set x, {0} ; number of cycles for post-readout gain setting
mov osr, x ; put the gain into osr for safe keeping
set x, 7 ; number of pad bits, 0-... | StarcoderdataPython |
307493 | import pygame, random
from pygame.locals import *
def on_grid_random():
x = random.randint(0,59)
y = random.randint(0,59)
return(x//10*10,y//10*10)
def collision(c1,c2):
return (c1[0] == c2[0] and (c1[1]) == c2[1])
UP = 0
RIGHT = 1
DOWN = 2
LEFT = 3
pygame.init()
screen = pygame.display.set_mo... | StarcoderdataPython |
4891642 | <reponame>ExpressApp/pybotx
import uuid
import pytest
pytestmark = pytest.mark.asyncio
async def test_internal_bot_notification(client, message):
await client.bot.internal_bot_notification(
credentials=message.credentials,
group_chat_id=uuid.uuid4(),
text="ping",
sender=None,
... | StarcoderdataPython |
3385134 | #!/usr/bin/env python
# vim: et ts=4 sw=4
from django import template
register = template.Library()
from ..column import WrappedColumn
@register.inclusion_tag("djtables/cols.html")
def table_cols(table):
return {
"columns": [
WrappedColumn(table, column)
for column in table.colu... | StarcoderdataPython |
1865267 | <filename>main/config.py
import os
class BaseConfig(object):
# directory above configure
basedir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
# configuration
DEBUG = False
TESTING = False
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
#SQLALCHEMY_DA... | StarcoderdataPython |
4936991 | <reponame>Pyromanser/django-staging<gh_stars>0
import random
from django.db import models
from django import forms
from staging.generators import BaseGenerator
class Generator(BaseGenerator):
name = 'Random address'
slug = 'random-address'
for_fields = [models.CharField]
options_form = None
def _... | StarcoderdataPython |
1759651 | <gh_stars>1-10
from graphviz import Digraph
# 目标系统OTA - accept
def makeOTA(data, filePath, fileName):
dot = Digraph()
for state in data.states:
if state in data.acceptStates:
dot.node(name=str(state), label=str(state), shape='doublecircle')
else:
dot.node(name=str(state... | StarcoderdataPython |
8037987 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: <NAME>, <NAME>
# *****************************************************************************/
"""
Brief:
intelTelemetryParser.py - Generic parser definitions for parsing ... | StarcoderdataPython |
100915 | class UndefinedMockBehaviorError(Exception):
pass
class MethodWasNotCalledError(Exception):
pass
| StarcoderdataPython |
8112790 | <reponame>RachidStat/PyCX<filename>ds-exponential-growth.py
from pylab import *
a = 1.1
def initialize():
global x, result
x = 1.
result = [x]
def observe():
global x, result
result.append(x)
def update():
global x, result
x = a * x
initialize()
for t in range(30):
update()
obse... | StarcoderdataPython |
313806 | <gh_stars>100-1000
__________________________________________________________________________________________________
sample 104 ms submission
class Solution:
def flipgame(self, fronts: List[int], backs: List[int]) -> int:
#print(fronts + backs)
same = {x for i,x in enumerate(fronts) if x == backs[i... | StarcoderdataPython |
6639555 | #Django Imports
from django.conf import settings
#Python Imports
import requests, os
#Local Imports
from .at_utils import AfricasTalkingException
#Import Afica's Talking Settings
AFRICAS_TALKING_SETTINGS = getattr(settings,'AFRICAS_TALKING',{})
API_KEY = AFRICAS_TALKING_SETTINGS.get('API_KEY',None)
USERNAME = AFRI... | StarcoderdataPython |
343019 | <filename>sps/api/v1/socket/processor.py
from format import Format
from message import MessageType
from random import randint
class Processor(object):
def __init__(self):
pass
def process_message(self, data):
m = Format.format(data)
m_type = m.get_type()
body = m.get_body()... | StarcoderdataPython |
9772159 | <reponame>scottgigante/molecular-cross-validation
#!/usr/bin/env python
import argparse
import logging
import pathlib
import pickle
import numpy as np
import scipy.sparse
import scanpy as sc
from molecular_cross_validation.util import poisson_fit
def main():
parser = argparse.ArgumentParser()
parser.add_... | StarcoderdataPython |
3506420 | """Test for QueueGetConfigReply message."""
import unittest
from pyof.v0x01.common import queue
from pyof.v0x01.controller2switch import queue_get_config_reply
class TestQueueGetConfigReply(unittest.TestCase):
"""Test for QueueGetConfigReply message."""
def setUp(self):
"""Basic test setup."""
... | StarcoderdataPython |
1851443 | from rest_framework import serializers
from django.contrib.auth.models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
extra_kwargs = {
'password': {'write_only': True}
}
model = User
fields = ['id', 'username', 'password']
def validat... | StarcoderdataPython |
1972755 | """Tensor Class."""
import functools
import operator
import numpy as np
# PyCUDA initialization
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
from .gpu_kernels import add, arithmetic
from .states import TensorState
ops = {"+": operator.add, "-": operator.sub, "*":... | StarcoderdataPython |
1739222 | <gh_stars>0
from pytest import raises
from astropy.tests.helper import assert_quantity_allclose
from astropy import units as u
from astropy.wcs import WCS
from astropy.wcs.wcsapi.utils import deserialize_class, wcs_info_str
def test_construct():
result = deserialize_class(('astropy.units.Quantity', (10,), {'un... | StarcoderdataPython |
6529753 | # coding=utf-8
# Copyright (c) 2015 EMC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | StarcoderdataPython |
6522890 | from __future__ import absolute_import, print_function
from sage.all import factorial
from moment_polytopes import *
import pytest
def test_hrepr_irred():
# unit square as an irredundant set of inequalities
unit_square = HRepr(ieqs=[((1, 0), 0), ((0, 1), 0), ((-1, 0), -1), ((0, -1), -1),])
assert unit_squ... | StarcoderdataPython |
6401142 | <gh_stars>0
import git_config
import os
import pager
import platform
import re
import shutil
import socket
import stat
import sys
import subprocess
import threading
from trace import Trace
def isUnix():
return platform.system() != "Windows"
if isUnix():
import fcntl
def to_windows_path(path):
return path.repla... | StarcoderdataPython |
6431172 | <filename>lib/hachoir/parser/program/python.py
"""
Python compiled source code parser.
Informations:
- Python 2.4.2 source code:
files Python/marshal.c and Python/import.c
Author: <NAME>
Creation: 25 march 2005
"""
from hachoir.parser import Parser
from hachoir.field import (FieldSet, UInt8,
... | StarcoderdataPython |
259113 | from os import path
path_src = path.dirname(path.abspath(__file__))
path_base = path.dirname(path_src)
path_data = path.join(path_base, 'data')
html_lib = 'html5lib'
OSHA_base_url = 'https://www.osha.gov/pls/imis/'
OSHA_columns = (
'SIC4_cd', 'SIC4_desc', 'ind_cd', 'ind_desc',
'maj_cd', 'maj_desc', 'div_cd', ... | StarcoderdataPython |
1794958 | <filename>checklist/context_processors.py
# https://stackoverflow.com/a/34903331/6543250 - to pass data to "base.html"
from checklist.models import Category, Notification
def add_variable_to_context(request):
context = {}
context["category_list"] = Category.objects.all()
# if user logged in
if reque... | StarcoderdataPython |
5101076 | <filename>vistautils/range.py
# really needs to be totally-ordered
from abc import ABCMeta, abstractmethod
from datetime import date
from typing import (
Any,
Container,
Generic,
Hashable,
Iterable,
Mapping,
Optional,
Sequence,
Sized,
Tuple,
TypeVar,
Union,
)
from attr i... | StarcoderdataPython |
11245572 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 11 20:47:26 2018
@author: misskeisha
"""
import math
class Polygon(object):
def __init__(self,n,s):
self.n = n
self.s = s
def parameter(self):
return self.n*self.s
def area(self):
area = ((self.s**2)*sel... | StarcoderdataPython |
11362624 | <reponame>tqtifnypmb/ML<filename>tensorflow_tutorial/MLP_keras.py<gh_stars>0
import tensorflow as tf
import numpy as np
from tensorflow import keras
from math import floor
from sklearn import datasets
from sklearn import preprocessing
class MLP:
def __init__(self, learning_rate = 1e-3):
self.learning_rate... | StarcoderdataPython |
6653221 | <reponame>stanwood/traidoo-api<gh_stars>1-10
import pytest
from model_bakery import baker
from products.models import Product
pytestmark = pytest.mark.django_db
def test_fallback_to_image_url(client_admin, traidoo_region):
product = baker.make("products.product", image_url="foo.png", region=traidoo_region)
... | StarcoderdataPython |
104449 | <reponame>kuraakhilesh8230/aries-cloudagent-python
from asynctest import TestCase as AsyncTestCase
from ..indy import V20CredExRecordIndy
class TestV20CredExRecordIndy(AsyncTestCase):
async def test_record(self):
same = [
V20CredExRecordIndy(
cred_ex_indy_id="dummy-0",
... | StarcoderdataPython |
5194779 | """
The base classes for the styling.
"""
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
from collections import namedtuple
from six import with_metaclass
__all__ = (
'Attrs',
'DEFAULT_ATTRS',
'ANSI_COLOR_NAMES',
'Style',
'DynamicStyle',
)
#: Styl... | StarcoderdataPython |
3555804 | <reponame>nitramsivart/provenance<gh_stars>10-100
"""initial schema
Revision ID: e0317ab07ba4
Revises:
Create Date: 2017-03-13 13:33:59.644604
"""
import sqlalchemy as sa
import sqlalchemy.dialects.postgresql as pg
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e0317ab07ba4'
down_revisio... | StarcoderdataPython |
4959882 | # This framework folder is the Discord Framework my bot use.
# You can use the code in this directory for your bot.
# I am not really planning on uploading it to PyPI though...
from inspect import getmembers, getsource, signature
from discord.ext import commands as _commands
from requests import post as _post_message
... | StarcoderdataPython |
8199047 | <gh_stars>10-100
import tensorflow as tf
import os
import sys
import data_generation
import networks
import scipy.io as sio
import param
import util
import cv2
import truncated_vgg
from keras.backend.tensorflow_backend import set_session
from keras.optimizers import Adam
from PIL import Image
import numpy as np
from ht... | StarcoderdataPython |
1993615 | # -*- coding: utf-8 -*-
# author: itimor
from __future__ import print_function, unicode_literals
import json
from rest_framework.response import Response
from collections import OrderedDict
from rest_framework import viewsets
from django.utils import timezone
from rest_framework.decorators import action
from common i... | StarcoderdataPython |
4800551 | <reponame>luosolo/SuPyPlex<gh_stars>0
from supyplex.level import LevelLoader
from supyplex.commons import *
ZONK = 1
INFOTRON = 4
MURPHY = 3
EMPTY = 0
slicks = [ZONK, INFOTRON, 5, 26, 27, 38, 39]
class GameLogic(object):
"""
This is the controller of the game.
here is implemented a sort of physics of th... | StarcoderdataPython |
3416015 | <reponame>inamori/DeepLearningImplementations<gh_stars>1000+
import os
import sys
from tqdm import tqdm
import tensorflow as tf
import models
sys.path.append("../utils")
import losses
import data_utils as du
import training_utils as tu
import visualization_utils as vu
FLAGS = tf.app.flags.FLAGS
def train_model():
... | StarcoderdataPython |
1913363 | from flask import send_from_directory, abort, Flask, jsonify, abort, request, render_template
import os,sys,inspect
from sklearn.externals import joblib
import numpy as np
from sklearn.preprocessing import LabelEncoder
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = o... | StarcoderdataPython |
11232546 | <gh_stars>1-10
import lab as B
from matrix import Dense, Kronecker
# noinspection PyUnresolvedReferences
from ..util import (
ConditionalContext,
AssertDenseWarning,
approx,
dense1_pd,
diag1_pd,
kron_pd,
)
def test_cholesky_solve_diag(diag1_pd):
chol = B.cholesky(diag1_pd)
approx(B.c... | StarcoderdataPython |
3341107 | from museolib.backend import Backend, BackendItem
import json
class BackendJSON(Backend):
def load_items(self):
filename = self.options.get('filename', None)
with open(filename, 'r') as fd:
data = json.loads(fd.read())
self.keywords = data['keywords']
assert(f... | StarcoderdataPython |
8188312 | <filename>src/tests/scripts/CompareMafAndCheckMafCoverage.py
#!python3
import sys
def readMaf(benchMark_file, test_file):
benchMarkalignedPosition = dict()
with open(benchMark_file) as f:
for line in f:
elements = line.split()
if len(elements) == 7:
(s, refchr, r... | StarcoderdataPython |
8042169 | """ Setup file. """
import os
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(HERE, 'README.rst')).read()
CHANGES = open(os.path.join(HERE, 'CHANGES.rst')).read()
REQUIREMENTS = [
'dropbox',
'psycopg2',
'pycrypto',
'pyramid>=1.... | StarcoderdataPython |
383819 | <filename>segmentation-of-nuclei/watershed/__init__.py
__all__ = ['seg_with_watershed'];
| StarcoderdataPython |
4982442 | # Copyright Contributors to the Pyro-Cov project.
# SPDX-License-Identifier: Apache-2.0
import heapq
import logging
import shutil
import warnings
from collections import defaultdict, namedtuple
from typing import Dict, FrozenSet, Optional, Set, Tuple
import tqdm
from Bio.Phylo.NewickIO import Parser, Writer
from . i... | StarcoderdataPython |
6557793 | <gh_stars>0
import pandas as pd
import extract
newsList = []
url = "http://feeds.bbci.co.uk/news/rss.xml"
extract.bbc_extract(url, newsList)
url = "http://rss.cnn.com/rss/cnn_topstories.rss"
extract.cnn_extract(url, newsList)
df = pd.DataFrame(newsList)
df.to_csv("../data/feed.csv", encoding='utf-8-sig')
| StarcoderdataPython |
1612330 | <gh_stars>1-10
"""
This is a template for creating custom ColumnMapExpectations.
For detailed instructions on how to use it, please see:
https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations
"""
import json
from typing import Any
impor... | StarcoderdataPython |
4973793 | import sys
import unittest
from os.path import dirname
from HtmlTestRunner import HTMLTestRunner
print('-- Starting Fairdata tests --')
loader = unittest.TestLoader()
start_dir = dirname(__file__)
# tests are only automatically searched from files whose filenames end with *_tests.py
suite = loader.discover(start_d... | StarcoderdataPython |
8047887 | from .Link import *
from .GenericSingleLink import *
from .GenericDoubleLink import * | StarcoderdataPython |
5181405 | <gh_stars>1-10
"""
lambda_function.py
"""
# postリクエストをline notify APIに送るためにrequestsのimport
import os
import time
from datetime import datetime, timezone
import pytz
import re
import requests
from bs4 import BeautifulSoup
import json
from linebot import LineBotApi
from linebot.models import TextSendMessage
url = os.get... | StarcoderdataPython |
276616 | # -*- coding:utf-8 -*-
"""
@author:SiriYang
@file:SettingWidget.py
@time:2020/4/16 11:53
"""
import configparser
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QFileDialog, \
QPushButton, QScrollArea, QGridLayout, QSpinBox,QColorDialog
BTN_STYLE = ""... | StarcoderdataPython |
1896628 | <reponame>douglasPinheiro/nirvaris-menu<filename>menu/urls.py
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth.decorators import login_required
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
] | StarcoderdataPython |
3455294 | """Package with functionality used to analyze MALDI-TOF data."""
| StarcoderdataPython |
5141201 | #!/usr/bin/env python
# coding: utf-8
# ### Explore processed pan-cancer data
# In[1]:
import os
import sys
import numpy as np; np.random.seed(42)
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import StandardScaler
import mpmp.config as cfg
import mpmp.utilit... | StarcoderdataPython |
8038618 | training_percentage = 0.8
import random
stop_words_dict = {'during': 0, 'has': 0, "it's": 0, 'very': 0, 'itself': 0, "why's": 0, "we'll": 0, 'hers': 0,
"isn't": 0, 'off': 0, 'we': 0, 'it': 0, 'the': 0, 'doing': 0, 'over': 0, 'its': 0, 'with': 0,
'so': 0, 'but': 0, 'they': 0, 'am':... | StarcoderdataPython |
1758251 | # encoding: utf-8
# =========================================================================
# ©2017-2018 北京国美云服科技有限公司
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the ... | StarcoderdataPython |
4894644 | <filename>tests/bugs/core_0063_test.py<gh_stars>0
#coding:utf-8
#
# id: bugs.core_0063
# title: Sequence of commands crash FB server
# decription:
# tracker_id: CORE-0063
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act,... | StarcoderdataPython |
131003 | a = int(input("Enter: "))
reserve = a
temp = 0
rev=0
while a>0:
temp = a%10
a = a//10
rev = rev*10 + temp
if reserve == rev:
print("Palindrome")
else:
print("not") | StarcoderdataPython |
1901847 | """
Pascal VOC database
This class loads ground truth notations from standard Pascal VOC XML data formats
and transform them into IMDB format. Selective search is used for proposals, see roidb
function. Results are written as the Pascal VOC format. Evaluation is based on mAP
criterion.
"""
from __future__ import print... | StarcoderdataPython |
5141293 | from __future__ import print_function
from __future__ import absolute_import
from past.builtins import basestring
import numpy as np
import os
from .ascii import read_columns
from . import moby_fits
class StructDB(np.ndarray):
"""
Mini-database for storage of simple records. For example,
detector propert... | StarcoderdataPython |
8095940 | <gh_stars>0
arr.sort()
print(arr[-1])
print(len(arr)-1)
| StarcoderdataPython |
12835901 | """
# ****************************************************************************
#
# GOVERNMENT PURPOSE RIGHTS
#
# Contract Number: FA8750-15-2-0270 (Prime: William Marsh Rice University)
# Contractor Name: GrammaTech, Inc. (Right Holder - subaward R18683)
# Contractor Address: 531 Esty Street, Ithaca, NY 14850
# Ex... | StarcoderdataPython |
98453 | <gh_stars>1-10
class TrieNode:
def __init__(self):
self.children = {}
self.is_word = False
self.word = str
class Trie:
def __init__(self):
self.root = TrieNode()
def add_word(self, word):
node = self.root
for c in word:
if c not in node.chil... | StarcoderdataPython |
1622323 | from tests.system.action.base import BaseActionTestCase
class PersonalNoteDeleteActionTest(BaseActionTestCase):
def test_delete_correct(self) -> None:
self.set_models(
{
"meeting/111": {"personal_note_ids": [1]},
"user/1": {
"personal_note_$1... | StarcoderdataPython |
9724387 | <filename>scidb/core/low/__init__.py
from .metadata import MetadataFileType, ObservableDict, NodeDict, Metadata, Properties
from .node import Root, Node
| StarcoderdataPython |
12815044 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Fixtures for tests"""
# Import modules
import pytest
import numpy as np
# Import from package
from pyswarms.backend.swarms import Swarm
@pytest.fixture
def swarm():
"""A contrived instance of the Swarm class at a certain timestep"""
attrs_at_t = {
'po... | StarcoderdataPython |
1929190 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | StarcoderdataPython |
9620729 | """
A suite of test to make sure the converted ResNet model is correct.
Annoying fact: GPU outputs pretty non-deterministic values everytime (due to
parallel implementation and floating point precision issue.)
"""
import sys
# sys.path.insert(0, '/pkgs/tensorflow-gpu-0.9.0')
sys.path.insert(0, '..')
import tensorflow ... | StarcoderdataPython |
8116309 | from .foregroundHandler import EstimateZodi, EstimateForeground, EstimateForegrounds
from .instrumentHandler import BuildChannels, BuildInstrument, LoadPayload, PreparePayload, MergeChannelsOutput, \
GetChannelList
from .loadOptions import LoadOptions
from .loadSource import LoadSource
from .noiseHandler import Est... | StarcoderdataPython |
3332191 | <gh_stars>10-100
from pipeline import * | StarcoderdataPython |
8013107 | <reponame>CalebUAz/Stock-Trader-App
def create_user_table(c):
c.execute('CREATE TABLE IF NOT EXISTS usertable(fullname TEXT, email TEXT, username TEXT,password TEXT, cash INTEGER)')
| StarcoderdataPython |
1740464 | <gh_stars>1-10
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
def test():
array = ak.from_numpy(np.zeros((3, 0), dtype=np.int32))
buffs = ak.to_buffers(array)
new_array... | StarcoderdataPython |
9651659 | <filename>VectorMessenger/server.py<gh_stars>0
from os import system as cmd, chdir, path
from sys import platform as sysplatform
from argparse import ArgumentParser
from VectorMessenger.MessengerCore.Helpers.Global import APPDICT
from VectorMessenger.MessengerCore.CoreServer import MessengerServer
args = None
def ... | StarcoderdataPython |
3466019 | import logging
from pygame.locals import *
from src.const import *
from src.level.main_menu import MainMenu
class Menu:
x = DISPLAY_WIDTH / 4
y = DISPLAY_HEIGHT / 2 - 150
width = 180
height = 200
controls_text = ("WASD - move\n"
"Space - warp\n"
... | StarcoderdataPython |
11360142 | import numpy as np
import sys
sys.path.append(".")
from src.alpha_rank import alpha_rank
def rock_paper_scissors(graphing=False):
payoffs = np.array([[ 0, -1, 1],
[ 1, 0, -1],
[-1, 1, 0]])
alphas = []
strat_probs = []
for alpha in np.logspace(-4, 2,... | StarcoderdataPython |
4830208 | """
Test Composite Map
"""
import numpy as np
import pytest
import astropy.units as u
from astropy.tests.helper import assert_quantity_allclose
import sunpy.data.test
import sunpy.map
from sunpy.tests.helpers import figure_test
testpath = sunpy.data.test.rootdir
# Ignore missing metadata warnings
pytestmark = [pyte... | StarcoderdataPython |
3498852 | """ Large number handling
"""
from .FLOAT import FLOAT
class DOUBLE(FLOAT):
"""double width float"""
_v_mysql_type = "double"
class HUGEDECIMAL(FLOAT):
"""Numbers large enough for CR. Maximum is 65 digits. A Trillion is 13 digits 33 digits . 32 digits is enough"""
_v_mysql_type = "DECIMAL(33,32)"
... | StarcoderdataPython |
5166249 | from array import array
if __name__ == '__main__':
a = array('I', [5, 8, 17, 54, 63, 95, 7, 14, 9])
a[3] = 75
a[0] += 1
print(a) | StarcoderdataPython |
4896310 | import readBoard
#Move the tile at (i1,j1) into the position of (i2,j2) and combine the tiles
def combine(board,i1,j1,i2,j2):
testBoard[i2][j2] = testBoard[i2][j2] * 2
testBoard[i1][j1] = ' '
#Takes the board and the position of a tile as inputs and move the tile up by 1
def moveUp(board, i,j):
board[i-1... | StarcoderdataPython |
1957024 | <reponame>chews0n/super-duper-octo-fiesta
import urllib.request
from datetime import date
import os
class DownloadWeatherData:
def __init__(self, station_number=27211, start_year=2010, end_year=date.today().year):
"""
Initialize the class in order to download the weather data from the Weather Ca... | StarcoderdataPython |
6587172 | <gh_stars>100-1000
import os
import time
import datetime
import tempfile
import urllib2
import gzip
import pandas as pd
from gym import logger
from gym_cryptotrading.strings import *
class Generator:
dataset_path = None
temp_dir = None
def __init__(self, history_length, horizon):
Generator.lo... | StarcoderdataPython |
331921 | <gh_stars>0
from swagger_diff.errors import update_errors, _errors
def test_errors():
update_errors('hello/world/foo/bar', 'Some error message')
update_errors('hello/world/foo/baz', 'Another error message')
assert {'hello': {'world': {'foo': {'bar': 'Some error message', 'baz': 'Another error message'}}}}... | StarcoderdataPython |
1983680 | #!/usr/bin/env python
"""
Script that starts the SSH agent for a connection based on the domain.
If the agent is already running, it won't start another.
Put something like this in your ~/.ssh/config file:
Match exec ~/bin/start_ssh_agent_by_domain.py --domain=mydomain.com \\
--control=~/.ssh/agent-my... | StarcoderdataPython |
12812139 | <gh_stars>0
"""
Problem 22
-----------
Using names.txt (right click and 'Save Link/Target As...'),
a 46K text file containing over five-thousand first names,
begin by sorting it into alphabetical order.
Then working out the alphabetical value for each name,
multiply this value by its alphabetical position in the list
t... | StarcoderdataPython |
6586313 | import luigi
import time
import os
import subprocess
from tasks.readCleaning.cleanedReadQC import *
class GlobalParameter(luigi.Config):
pe_read_dir=luigi.Parameter()
mp_read_dir=luigi.Parameter()
pac_read_dir=luigi.Parameter()
ont_read_dir=luigi.Parameter()
pe_read_suffix=luigi.Parameter()
mp_read_suffix=lui... | StarcoderdataPython |
40483 | import OpenURL
import Rest
__all__ = [OpenURL.__name__, Rest.__name__]
| StarcoderdataPython |
1611066 | from airflow import DAG
from datetime import datetime, timedelta
from airflow.providers.amazon.aws.operators.ecs import ECSOperator
default_args = {
'owner': 'ubuntu',
'start_date': datetime(2019, 8, 14),
'retry_delay': timedelta(seconds=60*60)
}
with DAG('hybrid_airflow_ec2_dag', catchup=False, default_... | StarcoderdataPython |
4832600 | <filename>PythonTutor/session-2/variable.py
"""
Session: 2
Topic: Variable
"""
var = 'Hello World!'
print (var)
print ('My variable value is {} '.format(var)) | StarcoderdataPython |
3245026 | <filename>gym_goal/envs/goal_env.py
"""
Robot Soccer Goal domain by <NAME> et al. [2016], Reinforcement Learning with Parameterized Actions
Based on code from https://github.com/WarwickMasson/aaai-goal
Author: <NAME>
June 2018
"""
import numpy as np
import math
import gym
import pygame
from gym import spaces, error
fr... | StarcoderdataPython |
6532944 | <gh_stars>0
# test electronvolt.py in terminal
# update README.md
# update version number in setuptools.setup
# rm -r __pycache__
# python setup.py sdist bdist_wheel
# twine upload dist/*
# rm -r build dist *.egg-info
# pip install electronvolt -U
# git commit and push
# pypi.org/project/electronvolt
# github.com/dw61/... | StarcoderdataPython |
9769778 | <gh_stars>1-10
# -*- coding:utf-8 -*-
"""
tcase app 相关的标签
"""
from django import template
from django.db.models import F
from tproject.models import Project
from ..models import Case, Shiwu
register = template.Library()
@register.inclusion_tag('case/project_shiwu.html')
def get_project_shiwu(pk=0, user=None):
"... | StarcoderdataPython |
1964424 | <filename>utils/__init__.py
from .trainer_utils import *
from .buffer import * | StarcoderdataPython |
3436377 | <filename>examples/keras/keras_sequential_classification_model.py<gh_stars>0
"""
Keras sequential classification example
==================
An example of a sequential network used as an OpenML flow.
"""
import keras
import openml.extensions.keras
#####################################################################... | StarcoderdataPython |
3341217 | <gh_stars>1-10
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
#url(r'^$', 'main.views.home', name='home'),
url(r'^login/$', 'django.contrib.auth.views.login', name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', nam... | StarcoderdataPython |
6427750 | from checkov.common.graph.checks_infra.enums import Operators
from checkov.terraform.checks_infra.solvers.complex_solvers.base_complex_solver import BaseComplexSolver
from functools import reduce
from operator import or_
class OrSolver(BaseComplexSolver):
operator = Operators.OR
def __init__(self, solvers, r... | StarcoderdataPython |
1937494 | <gh_stars>1-10
import numpy as np
from numpy.linalg import norm
import scipy.interpolate
class Sphere(object):
def __init__(self, _dim=2, _seg_type='linear'):
self.dim = _dim
self.seg_type = _seg_type
if self.seg_type == 'linear':
self.pts = []
# self.pts += [np.ar... | StarcoderdataPython |
3216347 | <gh_stars>0
from contextlib import contextmanager
from typing import Dict, Optional, Iterator
from opentelemetry import trace
from opentelemetry.trace import Span
from hedwig.instrumentation.compat import Getter, extract, inject
from hedwig.models import Message
getter = Getter()
@contextmanager
def on_receive(sns... | StarcoderdataPython |
221131 | from random import choice
from typing import Any, List, Tuple
from hamcrest import assert_that
from .pacing import aside, TRIVIAL
from .resolutions import Resolution
# Typehint Aliases
Question = Any
Action = Any
Ability = Any
ENTRANCE_DIRECTIONS = [
"{} arrives on stage!",
"{} enters, from the vomitorium... | StarcoderdataPython |
11239569 | from .models import Tag
from django.shortcuts import render
from django.views.generic import CreateView, UpdateView, DetailView, ListView
class TagListView(ListView):
model = Tag
class TagDetailView(DetailView):
model = Tag
def get_context_data(self, **kwargs):
context = super().get_context_d... | StarcoderdataPython |
4854914 | import struct
import sys
import time
import cv2
import numpy as np
import libipmq
def producer():
capture = cv2.VideoCapture(0, cv2.CAP_V4L2)
capture.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc('M', 'J', 'P', 'G'))
capture.set(cv2.CAP_PROP_FPS, 30.0)
capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1280.0)
... | StarcoderdataPython |
11361350 | <gh_stars>1-10
#Imports the tkinter module
import tkinter
#Imports the tkinter.messagebox module
import tkinter.messagebox
#Main Function
def main() :
#Creates the window
test_window = tkinter.Tk()
#Sets the window's title
test_window.wm_title("My Window")
#Creates two frames that belong to test_window
upper_fr... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.