id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
115603 | <reponame>saji-ryu/pyxel-study<filename>src/lesson2/exercises/b_5_2.py
import pyxel
import math
pyxel.init(200, 200)
pyxel.cls(7)
for i in range(0, 360, 1):
iRadian = math.radians(i)
if(i <= 90):
pyxel.line(120, 80, 100 + 100 * math.cos(iRadian),
100 - 100 * math.sin(iRadian), 0)
... | StarcoderdataPython |
3247729 | import os
from pathlib import Path
import logging
import click
import numpy as np
import pandas as pd
import SimpleITK as sitk
from src.resampling.utils import (get_np_volume_from_sitk,
get_sitk_volume_from_np)
# Default paths
path_in = 'data/hecktor_nii/'
path_out = 'data/bbox_nii/... | StarcoderdataPython |
1604264 | <reponame>BiznetGIO/nvc-lite<filename>nvc-api/app/controllers/api/vm.py
from app.helpers.rest import *
from neo.libs import vm
from neo.libs import orchestration as orch
from app.middlewares import auth
from app.helpers.session import *
from app.libs import neo, utils
from flask_restful import Resource, request
class... | StarcoderdataPython |
83193 | # File: main.py
#
# Author: <NAME>
# Date: 2018-11-30
import argparse
import sys
import os
import xlsxwriter
import time
from DoodleParser import DoodleParser
from Solver import Solver
CONFIG_FILE = "config.in"
CONF = dict()
def error(string):
""" Print error message.
Parameters:
-----------
... | StarcoderdataPython |
3244116 | def how_many_different_numbers(
numbers: list
) -> int:
return len(set(numbers))
def main():
numbers = [1, 2, 3, 1, 2, 3, 4, 1]
result = how_many_different_numbers(numbers)
print(result)
if __name__ == '__main__':
main()
| StarcoderdataPython |
1651240 | <filename>experiments/parse_args.py<gh_stars>0
import argparse
def parse_args():
parser = argparse.ArgumentParser("Reinforcement Learning experiments for multiagent environments")
# Environment
parser.add_argument("--scenario", type=str, default="simple_tag", help="name of the scenario script")
parser.... | StarcoderdataPython |
4811416 | import sys
import math
import random
class leds:
def __init__(self, call):
self.call = call
def show_next1(self, color, index):
data = [0x22, 0x01]
self.call.blewrite(data)
self.call.blewait()
def show_single(self, leftright, r, g, b):
data = [0x17, 0x01, 0x00, 0x... | StarcoderdataPython |
1757140 | import pygame
def Write(fnt="Comic sans MS", fontsize=24, text="Namastey!", color=(255, 255, 255), background=None, screen=None, x=0, y=0, center=False):
"""
This funtion will write the text on the screen.
It takes as arguments:
font
fontsize
text
color
background
... | StarcoderdataPython |
32359 | from abc import ABCMeta, abstractmethod
from functools import partial
from typing import Tuple, Union
import numexpr
import numpy as np
from scipy import sparse, special
from tabmat import MatrixBase, StandardizedMatrix
from ._functions import (
binomial_logit_eta_mu_deviance,
binomial_logit_rowwise_gradient_... | StarcoderdataPython |
1684019 | <filename>src/compas_wood/datastructures/assembly.py
from typing import NewType
from compas.datastructures import Network
class Assembly(Network):
pass
| StarcoderdataPython |
73391 | <gh_stars>0
from django.test import SimpleTestCase
from django.urls import reverse, resolve
from users.views import signupuser, moncompte, loginuser, logoutuser, myproducts, myproducts_delete
class UsersTestUrls(SimpleTestCase):
def test_signup_url_is_resolved(self):
url = reverse('signupuser')
... | StarcoderdataPython |
3275927 | import hashlib
from typing import Dict, List, Optional, Tuple
import uuid
import boto3
from botocore.exceptions import ClientError
from meadowrun.aws_integration.aws_core import _get_default_region_name
BUCKET_PREFIX = "meadowrun"
def ensure_bucket(
region_name: str,
expire_days: int = 14,
) -> str:
""... | StarcoderdataPython |
1769632 | """View takes in a csv from client with full name, company and domain
This will put their full name and domain into ten different variations to
see if an email exists. Slow but mimicks human behavior. Each check utilizes
a proxy to reduce risk of limit on RealEmail API. Proxy Scraper scrapes 100 fresh
IP addresses an... | StarcoderdataPython |
166354 | <filename>abyssal_modules/metrics.py
from prometheus_client import Counter
COUNTER_MODULES_CREATED = Counter(
'mutaplasmid_modules_created',
'Number of modules created',
['type']
)
| StarcoderdataPython |
1758780 | <gh_stars>0
# -*- coding: UTF-8 -*-
from main import create_app, db
app = create_app()
with app.app_context():
db.drop_all()
db.create_all()
| StarcoderdataPython |
137962 | <reponame>vicarmar/audio2score<filename>src/audio2score/test.py
import argparse
import csv
import os
from datetime import datetime
from pathlib import Path
import torch
from tqdm import tqdm
from audio2score.data.data_loader import (AudioDataLoader, BucketingSampler,
Spectrog... | StarcoderdataPython |
1630083 | # Copyright 2017 Autodesk 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 |
1665150 | import bisect
N, Q = map(int, input().split())
A = list(map(int, input().split()))
X = [int(input()) for i in range(Q)]
A.reverse()
cums = [0]
cums_e = [0]
for i, a in enumerate(A):
cums.append(cums[-1] + a)
cums_e.append(cums_e[-1] + (0 if i % 2 else a))
borders = []
scores = []
for i in range(1, N // 2 + N... | StarcoderdataPython |
3318364 | <reponame>ZeldaZach/AdventOfCode2020
import pathlib
from typing import List
def get_input_data(file: str) -> List[str]:
with pathlib.Path(file).open() as f:
content = f.readlines()
return content
def day3_part1(data: List[str], right: int = 3, down: int = 1):
total = 0
check_index = 0
f... | StarcoderdataPython |
1607769 | <filename>kanpai/array.py
from .validator import Validator, RequiredMixin
class Array(RequiredMixin):
def __init__(self, error="Expecting an array.", convert_none_to_empty=False):
self.processors = []
self.processors.append({
'action': self.__assert_array,
'attribs': {
... | StarcoderdataPython |
174983 | """The flake8 command execution script. This is used by the deploying
job mainly.
Command example:
$ python ./scripts/run_flake8.py
"""
import sys
from logging import Logger
sys.path.append('./')
import scripts.command_util as command_util
from apysc._console import loggers
from scripts.apply_lints_an... | StarcoderdataPython |
3330405 | <reponame>godzilla-but-nicer/boolmininfo<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
import seaborn as sns
from itertools import chain, combinations
from copy import copy, deepcopy
# modified from itertools documentation
def powerset(iterable):
"powerset([1,2,3]) --> (1,) (... | StarcoderdataPython |
1723242 | import sys, os
from pathlib import Path # Python 3.6
from dotenv import load_dotenv
from .tools.wrapper import bcolors
env_path = Path(".") / ".pytic"
load_dotenv(dotenv_path=env_path)
def _check_file_coverage(f, lines):
def_count = 0
wrapper_count = 0
for i, line in enumerate(lines):
if "def" i... | StarcoderdataPython |
131278 | <gh_stars>1-10
import collections
import random
import math
import statistics
class Utils():
def log(message):
print(message)
class Simulator():
def do_quest(self, player_state):
heart = FriarLoc()
neck = FriarLoc()
elbow = FriarLoc()
while heart.progress < 4: #1 pro... | StarcoderdataPython |
116885 | # -*- coding: utf-8 -*-
"""Amazon SQS boto3 interface."""
from __future__ import absolute_import, unicode_literals
try:
import boto3
except ImportError:
boto3 = None
| StarcoderdataPython |
148806 | from bfxhfindicators.indicator import Indicator
from bfxhfindicators.ema import EMA
from bfxhfindicators.accumulation_distribution import AccumulationDistribution
from math import isfinite
class ChaikinOsc(Indicator):
def __init__(self, short, long, cache_size=None):
self._shortEMA = EMA(short, cache_size... | StarcoderdataPython |
24962 | from django import template
register = template.Library()
@register.inclusion_tag('quiz/correct_answer.html', takes_context=True)
def correct_answer_for_all(context, question):
"""
processes the correct answer based on a given question object
if the answer is incorrect, informs the user
"""
answe... | StarcoderdataPython |
181864 | <reponame>eskilop/TgThemer-py<gh_stars>1-10
from tgthemer import Color
colorgroup = {
"base": '#FF18181F',
"result": '#FF30303E',
"alpha": '#8018181F',
"s_int": -15198177,
"argb": (255, 24, 24, 31)
}
colorgroup24 = {
"base": '#18181F',
"result": '#30303E',
"s_int": 1579039,
"argb":... | StarcoderdataPython |
82694 | <filename>example/convertCaffe/layers3.py
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
from tensorflow.keras.layers import Layer as KLayer
import numpy as np
import time
import helper
import pickle
params_dict = {}
def init_caffe_input(x):
global caffe_string, layer_counter
if not... | StarcoderdataPython |
1631261 | import json
import logging
import redis
from mercury.common.exceptions import MercuryClientException
from mercury.common.transport import SimpleRouterReqService
from mercury.backend.queue_service.options import parse_options
log = logging.getLogger(__name__)
class QueueService(SimpleRouterReqService):
""" Simp... | StarcoderdataPython |
3347055 | <reponame>d9e7381f/onlinejudge-2.0<gh_stars>0
from django.apps import AppConfig
class DelegationConfig(AppConfig):
name = 'delegation'
| StarcoderdataPython |
92335 | import typing as typ
import httpx
from chaban.config import global_settings, settings
from chaban.core.exceptions import HttpMethodNotAllowed, TelegramAPIError
from chaban.handlers.base import mh_registry
from chaban.utils import MetaSingleton
from .telegram_methods import TelegramMethodsMixin
class TelegramBot(Te... | StarcoderdataPython |
1753208 | <reponame>doubleukay/bxgateway
class GatewayMessageType:
HELLO = b"gw_hello"
BLOCK_RECEIVED = b"blockrecv"
BLOCK_PROPAGATION_REQUEST = b"blockprop"
# Sync messages types are currently unused. See `blockchain_sync_service.py`.
SYNC_REQUEST = b"syncreq"
SYNC_RESPONSE = b"syncres"
REQUEST_TX_... | StarcoderdataPython |
118366 | <gh_stars>1-10
from typing import Tuple, List
from dataclasses import dataclass
from .. import inference_errors as ierr
from .. import type_system as ts
from .. import context
from ..code_blocks import Primitive
from ..type_engine import TypingContext
from . import func_methods, concrete_methods, add_method_to_list
... | StarcoderdataPython |
194016 | <filename>evalai/utils/challenges.py<gh_stars>10-100
import json
import requests
import sys
from bs4 import BeautifulSoup
from beautifultable import BeautifulTable
from click import echo, style
from datetime import datetime
from termcolor import colored
from evalai.utils.auth import get_request_header, get_host_url
f... | StarcoderdataPython |
1632663 | <filename>main.py<gh_stars>0
import binascii
import glob,os
import numpy as np
from keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array
from keras.models import Sequential, load_model
import time
import matplotlib.pyplot as plt
model_path = './models/weights-improvement-10-0.92.hdf5'
model = loa... | StarcoderdataPython |
139663 | <reponame>aagnone3/python-skeleton
import sys
from argparse import ArgumentParser
from python_skeleton_project import greet_world
def get_clargs():
parser = ArgumentParser()
parser.add_argument("-d", "--descriptor", help="Descriptor of world to greet.")
return parser.parse_args()
def main():
args =... | StarcoderdataPython |
1666149 | CUSTOM_GROUP = 'custom-group' | StarcoderdataPython |
81158 | from abc import abstractmethod
from contextlib import contextmanager
from typing import List
import arcade
from arcade.gui.events import UIEvent
class InteractionMixin:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.event_history: List[UIEvent] = []
def move_mous... | StarcoderdataPython |
3292633 | <gh_stars>1-10
import sys
from time import sleep
import pygame
from settings import Settings
from game_stats import GameStats
from scoreboard import Scoreboard
from button import Button
from archer import Archer
from arrow import Arrow
from monster import Monster
class MonsterInvasion:
# Class for game assets/be... | StarcoderdataPython |
53054 | #!/usr/bin/python3
import json
import sys
from pprint import pprint
import requests
from config import database
import MySQLdb
try:
db = MySQLdb.connect(database["host"],
database["user"],
database["passwd"],
database["db"])
cur = ... | StarcoderdataPython |
1660523 | import os
import pysftp
import sys
import subprocess
import glob
sys.path.append("C:\Users\jinkersont\.gnupg")
sys.path.append("C:\Users\jinkersont")
sys.path.append("C:\Program Files (x86)\gnupg\\bin")
print(sys.path)
UPLOAD = {
"SERVER": "192.168.80.33",
"PORT": 22,
"USERNAME": "sftpu... | StarcoderdataPython |
3269587 | from backpack.core.derivatives.conv_transpose3d import ConvTranspose3DDerivatives
from backpack.extensions.firstorder.sum_grad_squared.sgs_base import SGSBase
class SGSConvTranspose3d(SGSBase):
def __init__(self):
super().__init__(
derivatives=ConvTranspose3DDerivatives(), params=["bias", "wei... | StarcoderdataPython |
3223837 | <filename>scripts/oecd/regional_demography/deaths/preprocess_csv.py<gh_stars>0
# Copyright 2020 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://www.apache.org/licen... | StarcoderdataPython |
4821446 | # Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
3387252 | <reponame>bjodah/chemreac
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Two coupled decays
------------------
:download:`examples/decay.py` demonstrates accuracy
by comparison with analytic solution for a simple system
of two coupled decays
::
$ python decay.py --help
.. exec::
echo "::\\n\\n"
python ex... | StarcoderdataPython |
4832478 | <gh_stars>0
"""
Helper functions that can display leaflet maps inline in an ipython notebook
"""
import IPython.display as idisp
import html as hgen
def inline_map(map):
"""
Embeds the HTML source of the map directly into the IPython notebook.
This method will not work if the map depends on any files... | StarcoderdataPython |
131040 | <gh_stars>1-10
#!/usr/bin/env python
"""
Module test_interactive_prompt
"""
import os
import sys
sys.path.append(os.path.realpath('.'))
from creoconfig import Config
from creoconfig.exceptions import *
def interactive_prompt():
c = Config()
c.add_option('strkey',
prefix='Please enter string',
... | StarcoderdataPython |
4824889 | <reponame>danielshahaf/svnmailer-debian<filename>src/lib/svnmailer/notifier/mail.py
# -*- coding: utf-8 -*-
#
# Copyright 2004-2006 <NAME> or his licensors, as applicable
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... | StarcoderdataPython |
3301448 | <reponame>mbari-org/vars-gridview
# -*- coding: utf-8 -*-
"""
widgets.py -- A set of classes to extend widgets from pyqtgraph and pyqt for annotation purposes
Copyright 2020 Monterey Bay Aquarium Research Institute
Distributed under MIT license. See license.txt for more information.
"""
from typing import List
impo... | StarcoderdataPython |
3394441 | <gh_stars>1-10
def find_column(input, lexpos):
line_start = input.rfind('\n', 0, lexpos) + 1
return (lexpos - line_start) + 1
| StarcoderdataPython |
3224186 | import json
import logging
from datetime import datetime
from pathlib import Path
from typing import Union
from game import Position
from game.client.controller.menu import Menu
from game.client.model.action import Action, ActionType, MoveAction, InventoryAction, ItemAction
from game.client.model.model import Model
fr... | StarcoderdataPython |
177482 | <reponame>OnroerendErfgoed/static_map_generator
def merge_dicts(*dict_args):
"""
Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
"""
result = {}
for dictionary in dict_args:
result.update(dictionary)
return result... | StarcoderdataPython |
1781960 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# BSD 3-Clause License
# Copyright (c) 2021, Tokyo Robotics Inc.
# 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... | StarcoderdataPython |
1766506 | from __future__ import absolute_import
from sentry.testutils import TestCase
class StaticMediaTest(TestCase):
def test_basic(self):
url = '/_static/sentry/app/index.js'
response = self.client.get(url)
assert response.status_code == 200, response
assert 'Cache-Control' not in respo... | StarcoderdataPython |
21009 | <reponame>PaulWichser/adventofcode
import fileimp
# divide rows 0-127
# F = lower half
# B = upper half
# divide columns 0-7
# R = upper half
# L = lower half
# seat ID = row * 8 + col
# list of IDs
# max list
def idcalc(list):
seats = []
for i in list:
row = ''
col = ''
for j ... | StarcoderdataPython |
1680495 | <gh_stars>1-10
# encoding: UTF-8
# api: streamtuner2
# title: Compound★
# description: combines station lists from multiple channels
# version: 0.2
# type: channel
# category: virtual
# url: http://fossil.include-once.org/streamtuner2/
# config: -
# { name: compound_channels, type: text, value: "shoutcast, internet_... | StarcoderdataPython |
1609125 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 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/LICENSE-2.0.
#
# Any... | StarcoderdataPython |
102260 | from atcodertools.fmtprediction.models.calculator import CalcNode
class Index:
"""
The model to store index information of a variable, which has a likely the minimal / maximal value and for each dimension.
Up to 2 indices are now supported.
In most cases, the minimal value is 1 and the m... | StarcoderdataPython |
40676 | #!/usr/bin/env python3
import glob
import json
import xml.dom.minidom as minidom
import json
install = minidom.parse('build/install.rdf')
ta = install.getElementsByTagNameNS('*', 'targetApplication')[0]
with open('schema/supported.json') as f:
min_version = json.load(f)
for client, version in min_version.items():... | StarcoderdataPython |
157535 | <reponame>chsong513/TransferLearning
from .jda import * | StarcoderdataPython |
41430 | <filename>custom-actions/actions/sql_query.py
import sqlite3
from datetime import datetime
database = "../rasa.db"
# Parameter: Database pointer, sql command, and the data used for the command
# Function: Run the sql command
def run_sql_command(cursor, sql_command, data):
try:
if data is not None:
... | StarcoderdataPython |
193013 | <filename>lib/third_party/ml_sdk/cloud/ml/prediction/frameworks/tf_prediction_lib.py
# Copyright 2018 Google 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
#
# h... | StarcoderdataPython |
3203087 | <gh_stars>0
"""Generate overview figures of all added colormaps.
This script is taken from the matplotlib documentation
https://matplotlib.org/tutorials/colors/colormaps.html
"""
import matplotlib.pyplot as plt
import numpy as np
import prettypyplot as pplt
# run setuo
pplt.use_style()
plt.rcParams['figure.dpi'] = ... | StarcoderdataPython |
3281556 | <reponame>loopinf/vertex-ai-samples
# -*- coding: utf-8 -*-
import sys
import os
from pandas.io import pickle
# import pandas as pd
PROJECT_ID = "dots-stock" # @param {type:"string"}
REGION = "us-central1" # @param {type:"string"}
USER = "shkim01" # <---CHANGE THIS
BUCKET_NAME = "gs://pipeline-dots-stock" # @para... | StarcoderdataPython |
3265846 | <reponame>qizhenkang/myLeetCode
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 31 11:08:34 2021
@author: qizhe
"""
# import string
class Solution:
def possiblyEquals(self, s1: str, s2: str) -> bool:
"""
感觉不难:
1、对比的是数字长度
2、简单的正则表达
3、回溯即可
"""
def __dfs(s1,s2,p... | StarcoderdataPython |
3309047 | from django.forms import ModelForm
from core.models import Post, Comment
class PostForm(ModelForm):
class Meta:
model = Post
fields = ('message',)
class CommentForm(ModelForm):
class Meta:
model = Comment
fields = ('new_comment',)
| StarcoderdataPython |
20598 | #INVASION COMMANDS:
# !invasions // !atinvasions <reward> // !rminvasions
import discord
from discord.ext import commands
import asyncio
from src import sess
class Invasions(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.alert_dict = {} # user: reward, list of prev invasions with ... | StarcoderdataPython |
3245103 | import sys
from typing import List, Tuple
import re
import numpy as np
from abnumber.exceptions import ChainParseError
try:
from anarci.anarci import anarci
except ImportError:
# Only print the error without failing - required to import
print('ANARCI module not available. Please install it separately or ins... | StarcoderdataPython |
89638 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from mo.front.extractor import FrontExtractorOp
from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs
from mo.ops.squeeze import Squeeze
class SqueezeExtractor(FrontExtractorOp):
op = 'squeeze'
enabled = True
@... | StarcoderdataPython |
36591 | from flask import Flask, render_template, request, redirect, url_for, Markup, \
flash # Imports Flask and all required modules
import databasemanager # Provides the functionality to load stuff from the database
app = Flask(__name__)
import errormanager # Enum for types of errors
# DECLARE datamanager as... | StarcoderdataPython |
3203652 | def register(app):
from . import new_channel_command, incoming_channel
new_channel_command.register(app)
incoming_channel.register(app) | StarcoderdataPython |
3230860 | # coding=utf-8
import base64
import os
import lib.settings
modulname = "Core"
import socket
import sys
import subprocess
sys.path.insert(0, "lib/")
sys.path.insert(1, "lib/settings/")
import RPi.GPIO as GPIO
from flask import Flask
from flask import render_template
from flask_fontawesome import FontAwesome
from lib... | StarcoderdataPython |
3237581 | import smtplib
import random
from pytube import YouTube
import playsound
def email_bot(send_addr, password, recv_addr, body, server, port, sub='No Subject'):
with smtplib.SMTP(server, port) as smtp:
smtp.ehlo()
smtp.starttls()
smtp.ehlo()
smtp.login(send_addr, password)
s... | StarcoderdataPython |
3385135 | <gh_stars>1-10
from STL_control import *
from rci_family import *
import math as m
pi=3.1415
s=STL_system(4,2,16)
s.matrix_installation()
s.A[1,1]=1
s.A[1,2]=1
s.A[2,2]=1
s.A[3,3]=1
s.A[3,4]=1
s.A[4,4]=1
s.B[2,1]=1
s.B[4,2]=1
s.T=25
s.add_variables()
s.add_secondary_signal_state(1,[0,0,-1,0],4) # -y+4>0 -... | StarcoderdataPython |
1628671 | <filename>topCoder/srms/100s/srm146/div2/rectangular_grid.py
class RectangularGrid:
def countRectangles(self, width, height):
return sum(
(width - i + 1) * (height - j + 1)
for i in xrange(1, width+1)
for j in xrange(1, height+1)
if i != j
)
| StarcoderdataPython |
151559 | <filename>One/script.py
file = open("input.txt", "r")
input = file.next()
sequence = input.split(", ")
class walker:
def __init__(self):
self.east = 0
self.south = 0
self.facing = 0
self.tiles = {}
def turnL(self):
if self.facing == 0:
self.facing = 3
else:
self.facing -= 1
... | StarcoderdataPython |
3248577 | <filename>pyoneer/metrics/metrics_test.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from pyoneer import metrics
class MetricsTest(tf.test.TestCase):
def test_mape_fn(self):
y_true = tf.constant([[0.2, 0.1], [0.3, ... | StarcoderdataPython |
3273620 | <filename>flask_app/dash/orange/functions.py
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from wordcloud import WordCloud
from io import BytesIO
import base64
from flask_app.helpers.graphs import multi_color_func
from flask_app.helper... | StarcoderdataPython |
118914 | <gh_stars>0
import unittest
from alfred_client.message import PushData
from alfred_client.packet.struct import alfred_packet
expected_mac = '5e:5c:ce:ca:93:58'
expected_message = 'raspberrypi\n'
expected_length = len(expected_message)
expected_bytes = b'\x00\x00\x00\x1a\x00\x00\x00\x00^\\\xce\xca\x93Xc\x00\x00\x0cras... | StarcoderdataPython |
91064 | <gh_stars>0
from . import *
class AWS_KinesisAnalytics_ApplicationOutput_KinesisFirehoseOutput(CloudFormationProperty):
def write(self, w):
with w.block("kinesis_firehose_output"):
self.property(w, "ResourceARN", "resource_arn", StringValueConverter())
self.property(w, "RoleARN", "role_arn", StringVa... | StarcoderdataPython |
1727990 | import numpy as np
import theano
import theano.tensor as T
import math
import keras
import tensorflow as tf
from keras.models import Sequential, load_model
from keras.layers import Dense, Dropout, Activation
import h5py
from keras.optimizers import Adamax, Nadam
import sys
from writeNNet import saveNNet
from matplotlib... | StarcoderdataPython |
4814846 | <gh_stars>0
from django.db import models
from users.models import User
class Empresa(models.Model):
AGUA = 'AG'
FUEGO = 'FG'
TIERRA = 'TR'
AIRE = 'AR'
TIPO = (
(AGUA, 'agua'),
(FUEGO, 'fuego'),
(TIERRA, 'tierra'),
(AIRE, 'aire'),
)
nombre = models.CharField... | StarcoderdataPython |
26954 | import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()
x = 0
y = 0
# use a (r, g, b) tuple for color
yellow = (255, 255, 0)
# create the basic window/screen and a title/caption
# default is a black background
screen = pygame.display.set_mode((640, 280))
pygame.... | StarcoderdataPython |
3332349 | from .diffusion import diffusion_gaussian, advection_diffusion_gaussian_2d
| StarcoderdataPython |
1711422 | from flask_restful import Resource, reqparse, request
from lib.objects.namespace import Namespace
from lib.objects.lock import Lock
class LockController(Resource):
# TODO Check access as separate method or decorator
# https://flask-restful.readthedocs.io/en/latest/extending.html#resource-method-decorators
... | StarcoderdataPython |
187187 | # Object Detector
# Developed by <NAME> : November 2018
#
# Developped on : Python 3.6.5.final.0 (Conda 4.5.11), OpenCV 3.4.1, Numpy 1.14.3
# The programs first extracts the circles (Hough Transform) on each frame,
# then compares each circle with the object using the SIFT detector.
# Execute as follows : detect.... | StarcoderdataPython |
167893 | <reponame>HenryKenlay/grapht
from grapht.graphtools import has_isolated_nodes
from grapht.perturb import *
from grapht.sampling import sample_edges
import networkx as nx
def test_khop_remove():
G = nx.barabasi_albert_graph(500, 2)
r = 5
for k in range(1, 5):
Gp, edge_info, node = khop_remove(G, k, ... | StarcoderdataPython |
3295301 | # Plotting module for neural analysis package
# Plot speed profile
def speed_profile(df):
import numpy as np
import plottools as pt
import matplotlib as mpl
mpl.use('PDF')
import matplotlib.pyplot as plt
import copy
# Create figure
ax_hndl = pt.create_subplot(1, 1)
# Iterate over ... | StarcoderdataPython |
34630 | <reponame>HK3-Lab-Team/pytrousse<filename>scripts/use_dataframe_with_info.py
import os
import time
from trousse.dataset import Dataset
df_sani_dir = os.path.join(
"/home/lorenzo-hk3lab/WorkspaceHK3Lab/",
"smvet",
"data",
"Sani_15300_anonym.csv",
)
metadata_cols = (
"GROUPS TAG DATA_SCHEDA NOME ID... | StarcoderdataPython |
178471 | <gh_stars>1-10
#!/usr/bin/python
# encoding: utf-8
"""
@author: xuk1
@license: (C) Copyright 2013-2017
@contact: <EMAIL>
@file: test.py
@time: 8/15/2017 10:38
@desc:
"""
| StarcoderdataPython |
148485 | <filename>src/elastic/azext_elastic/tests/latest/test_elastic_scenario.py
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code gen... | StarcoderdataPython |
1648216 | import heapq
from abc import ABC, abstractmethod
class Queue(ABC):
"""
Abstract class for queues.
"""
def __init__(self):
self.list_elements = []
def empty(self) -> bool:
"""
Returns true if the queue is empty.
"""
return len(self.list_elements) == 0
d... | StarcoderdataPython |
121056 | ######################################################
# A watch (as in a small clock for your wrist or pocket)
#
# Button A sets the mode: Clock or Setting time
# Button B
# in clock mode: shows the time as a scrolling display
# in setting mode: increments the time
#
# The LED array displays the clock time... | StarcoderdataPython |
3221489 | <gh_stars>10-100
# Copyright (c) 2017-2019 <NAME>
#
# SPDX-License-Identifier: BSD-3-Clause
# The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution
# or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText
from struct import pack, unpack_from
from hashlib import ... | StarcoderdataPython |
3232709 | from enums.configuration import Configuration
from enums.word_evaluation_type import WordEvaluationType
from enums.overlap_type import OverlapType
from services.experiments.process.neighbourhood_similarity_process_service import NeighbourhoodSimilarityProcessService
from enums.font_weight import FontWeight
from entitie... | StarcoderdataPython |
1753048 | <reponame>tehkillerbee/mmdetection-to-tensorrt
from .bbox_head import BBoxHeadWraper
from .double_bbox_head import DoubleConvFCBBoxHeadWraper
from .sabl_head import SABLHeadWraper
__all__ = ['BBoxHeadWraper', 'DoubleConvFCBBoxHeadWraper', 'SABLHeadWraper']
| StarcoderdataPython |
74489 | <gh_stars>0
import calendar
import threading
import keras
from .webap_login import WebAp
from time import ctime, sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
import schedule
from random import randint
from datetime import datetime, timedelta, time... | StarcoderdataPython |
26156 | <reponame>valhallasw/phabricator-tools
"""Start a local webserver to report the status of an arcyd instance."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdcmd_instaweb
#
# Public Function... | StarcoderdataPython |
40220 | from datetime import datetime, timedelta
from random import sample, choice, randrange
from unittest import TestCase
import tests.test_timeinterval as ti
from tests.factories import make_sets, make_moments
from timeset import TimeSet
t0 = datetime(2019, 7, 19)
t6 = datetime(2019, 7, 25)
t = make_moments(20, t0, t6)
se... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.