id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
4986680 |
import sys
import random
class PathFinder:
def __init__(self):
self.visited = []
pass
def pathFind(self, start, end, board):
if start[0] == end[0] and start[1] == end[1]:
#sys.stderr.write("Got to destination!\n")
return []
if self.visited.count(start) > 0:
#sys.stderr.write("Back track!!\n")
... | StarcoderdataPython |
8178937 | """Report configuration for the analysis"""
import os
import shutil
from pathlib import Path
from policy_sentry.shared.constants import AUDIT_DIRECTORY_PATH
def create_default_report_config_file():
"""
Copies over the default report config file to the config directory
Essentially:
cp $MODULE_DIR/poli... | StarcoderdataPython |
115683 | <gh_stars>1-10
"""
Autofit a Spectra
------------------
"""
import cana
import matplotlib.pyplot as plt
# First load an spectrum, we will just gonna use one from the available datasets.
# you can do: spec = cana.loadspec('path to your spectrum file')
# See spec.py Spectrum class for spec attributes
spec = cana.datas... | StarcoderdataPython |
311516 | """You're a wizard, Harry."""
def register(bot):
bot.listen(r'^magic ?(.*)$', magic, require_mention=True)
bot.listen(r'\bmystery\b|'
r"\bwhy (do(es)?n't .+ work|(is|are)n't .+ working)\b|"
r'\bhow do(es)? .+ work\b', mystery)
def _magic(thing):
return '(ノ゚ο゚)ノミ★゜・。。・゜゜・。{}... | StarcoderdataPython |
1674253 | # -*- coding: utf8 -*-
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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... | StarcoderdataPython |
1898063 | from app.auth.auth_bearer import JWTBearer
from app.models.lightning import (
Invoice,
LightningInfoLite,
LnInfo,
Payment,
PaymentRequest,
SendCoinsInput,
SendCoinsResponse,
WalletBalance,
)
from app.repositories.lightning import (
add_invoice,
decode_pay_request,
get_ln_info... | StarcoderdataPython |
8058342 | from __future__ import absolute_import
from __future__ import division
import random
import numpy as np
from blt_net.cascademv2.core.utils import data_augment
from blt_net.cascademv2.core.utils.cython_bbox import bbox_overlaps
from blt_net.cascademv2.core.utils.bbox_process import compute_targets
from blt_net.cascade... | StarcoderdataPython |
3329099 | <filename>cloud_browser/cloud/config.py<gh_stars>10-100
"""Cloud configuration."""
class Config(object):
"""General class helper to construct connection objects."""
__connection_obj = None
__connection_cls = None
__connection_fn = None
@classmethod
def from_settings(cls):
"""Create c... | StarcoderdataPython |
4924454 | import collections
import datetime
import functools
import os
import urllib.parse
from urllib.parse import parse_qsl, urlparse, urlencode
from flask import (
Flask,
make_response,
render_template,
request,
send_file,
send_from_directory,
)
import hyperlink
import smartypants
from werkzeug.middl... | StarcoderdataPython |
4856743 | <filename>wagtail_headlessing/apps.py
from django.apps import AppConfig
class SourcecraftingWagtailConfig(AppConfig):
name = 'wagtail_headlessing'
| StarcoderdataPython |
6412574 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 <EMAIL>
# Licensed under the MIT license (http://opensource.org/licenses/MIT)
from setuptools import setup
import os
# Load the version number
try: # python3
fields = {}
with open(os.path.join("xusbboot", "version.py")) as f:
exec(f.read()... | StarcoderdataPython |
104182 | import struct
from suitcase.fields import BaseField
from suitcase.fields import BaseStructField
from suitcase.fields import BaseFixedByteSequence
class SLFloat32(BaseStructField):
"""Signed Little Endian 32-bit float field."""
PACK_FORMAT = UNPACK_FORMAT = b"<f"
def unpack(self, data, **kwargs):
... | StarcoderdataPython |
6640618 | from algorithmx import *
| StarcoderdataPython |
8172400 | #
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... | StarcoderdataPython |
1786068 | class KeyNotFound(Exception):
def __init__(self, message):
self.message = message
class NoMethodsGiven(Exception):
def __init__(self, message):
self.message = message
class FileNotFound(Exception):
def __init__(self, message):
self.message = message
class StrategyNotSupported(Exception):
def __init__(sel... | StarcoderdataPython |
1612257 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-18 09:30
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('practiceapp', '0003_auto_20160714_1653'),
]
operations = [
migrations.RenameField(
... | StarcoderdataPython |
5133222 | <reponame>altryne/django-unslashed
from django.http import HttpResponse, HttpResponsePermanentRedirect
from django.test import TestCase, Client
from django.middleware.common import CommonMiddleware
from unslashed.middleware import RemoveSlashMiddleware
class RemoveSlashMiddlewareTest(TestCase):
def setUp(self):
... | StarcoderdataPython |
11308684 | <gh_stars>1-10
from google_images_download import google_images_download
import sys
# first install https://github.com/hardikvasa/google-images-download
# usage python get_my_images.py "bear, smelly cat" 200
response = google_images_download.googleimagesdownload()
keywords = (sys.argv[1:2])
limit = sys.argv[2:] or 100... | StarcoderdataPython |
167634 | <filename>model/simplebase_model.py
import tensorflow as tf # noqa
import numpy as np # noqa
from ..utils import nn # noqa
import transforms as trans
import conditionals as conds # noqa
import likelihoods as likes
from ..model import model as mod
class SimpleBaseModel(mod.Model):
# TODO: docstring.
def _... | StarcoderdataPython |
11210019 | #!/usr/bin/env python
"""
B.5 Macros for text
"""
from plasTeX import Command, Environment, sourceChildren
class frenchspacing(Command):
unicode = u''
class nonfrenchspacing(Command):
unicode = u''
class normalbaselines(Command):
unicode = u''
class lq(Command):
unicode = unichr(8216)
class rq(C... | StarcoderdataPython |
8007789 | import matplotlib
import matplotlib.pyplot as plt
from calculate import *
a=np.arange(0,1,1/100)
test0=[]
test1=[]
testm1=[]
for i in range(100):
test0=np.append(test0,nn(a[i],0))
test1=np.append(test1,nn(a[i],1))
testm1=np.append(testm1,nn(a[i],-1))
matplotlib.rcParams['xtick.direction'] = 'in'
matpl... | StarcoderdataPython |
11226312 | from Src.graph_algos import nd2vec
from Src.n2v_parser import nd2vec_parser
from Src.utilities import read_graph,tab_printer
#main function where all intialization and triggering happens
def nd2vec_main(args):
'''
Pipeline for representational learning for all nodes in a graph.
'''
tab_printer(args)
par... | StarcoderdataPython |
1856402 | from django.contrib import admin
from .models import Item
# Register your models here.
admin.site.register(Item)
class ItemAdmin(admin.ModelAdmin):
readonly_fields=('added','modified',)
| StarcoderdataPython |
8124550 | <reponame>Danieltry/calculadora1
print "cualquiercosa"
raw_input("mensaje")
| StarcoderdataPython |
11331438 | <reponame>Semicheche/foa_frappe_docker<gh_stars>1-10
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
reference_date = guess_reference_date()
for name in frappe.db.sql_l... | StarcoderdataPython |
213719 | <reponame>sciris/openpyexcel<gh_stars>1-10
from __future__ import absolute_import
# Copyright (c) 2010-2019 openpyexcel
from openpyexcel.descriptors.serialisable import Serialisable
from openpyexcel.descriptors import (
Sequence
)
from openpyexcel.descriptors.excel import (
Relation,
)
class ExternalReference... | StarcoderdataPython |
11304825 | <reponame>concurrentlabs/laguna
#!/usr/bin/env python
#
import os
import yaml
# This import statment MUST come after the lock
BASE_DIR = os.path.join(os.path.dirname(__file__), '..')
def read():
import config
config_stream = file('%s/config.yaml' % BASE_DIR, 'r')
server_conf_stream = file('%s/servers.... | StarcoderdataPython |
9754544 | import os
import collections
import json
import torch
import torchvision
import numpy as np
import scipy.misc as m
import scipy.io as io
import matplotlib.pyplot as plt
import cv2
import torchvision.transforms as transforms
from PIL import Image
from tqdm import tqdm
from torch.utils import data
def get_data_path(nam... | StarcoderdataPython |
73494 | from ..ops import *
class Translator(object):
"""
A translator wraps a physical operator and provides the compilation logic.
It follows the producer/consumer model.
It also contains information about the lineage it needs to capture.
"""
_id = 0
def __init__(self, op):
self.id = Translator._id
T... | StarcoderdataPython |
3469501 | <gh_stars>0
#!/usr/bin/env python3
f = open('inventory.json', 'r')
print(f.read(), end="")
f.close()
| StarcoderdataPython |
3249502 | <filename>codility/caterpillar_method_count_distinct_slices.py<gh_stars>1-10
# https://app.codility.com/demo/results/training2AX89J-FPF/
def solution(M, A):
"""
3 steps -
1. count the value of distinct in current window
2. check for duplicates
3. count distinct
method-
0,0
tail ------ he... | StarcoderdataPython |
383040 | <filename>main.py<gh_stars>0
import pandas as pd
import re
with open('input.html', 'r') as f:
html_content = f.read()
result = pd.read_html(html_content)[2]
places = result.Weiterbildungsstätten
trimmed_places_list = []
for p in places:
# regex remove tilde distance
address = re.search(r'(.*)\s~.*', p)[... | StarcoderdataPython |
11332999 | from pathlib import Path
from typing import Dict, List
from tqdm import trange
from bs4 import BeautifulSoup
import requests
from rich import print
import gpxpy
import gpxpy.gpx
import yaml
import re
# Settings ---------------------------------------------------------------------
pages = [
("bergrebell", "https:/... | StarcoderdataPython |
1706388 | <reponame>maxuewei2/word2vec<filename>src/test_lr_ovr.py
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
from sklearn.multiclass import OneVsRestClassifier
X=[]
ids=[]
with open('../data/gw.emb')as f:
f.readline()
for line in f:
line=line.strip().split(' ')... | StarcoderdataPython |
11393260 | <reponame>HelkeBaeyens/read
# English tenses will be determined
from nltk import word_tokenize, pos_tag
import unittest
import re
def determine_tense_input(sentence):
tense = []
text = word_tokenize(sentence.lower())
tagged_tup = pos_tag(text)
#print (tagged_tup)
tags = [tuple[1] for tuple in tag... | StarcoderdataPython |
73971 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, absolute_import,
unicode_literals)
__all__ = []
import json
import sqlite3
if __name__ == "__main__":
with open("aas/abstracts.json") as f:
data = json.load(f)
with sqlite3.conne... | StarcoderdataPython |
1754614 | <reponame>c-goldschmidt/AoC_2018
from collections import defaultdict
from day import Day
class Pots:
def __init__(self, initial_state, state_map):
self.state = defaultdict(lambda: '.')
for i in range(len(initial_state)):
self.state[i] = initial_state[i]
self.state_map = state_... | StarcoderdataPython |
1811248 | <reponame>Arbupa/DAS_Sistemas
import abc
class archivoComponent(metaclass=abc.ABCMeta):
@abc.abstractmethod
def path(self):
pass
def get_Name(self):
return self.name # Nombre del archivo
def get_Type(self):
return self.type # Directorio o archivo
class directory(archivoCo... | StarcoderdataPython |
4860268 | import pytest
import os
import os.path as osp
import shutil as sh
import dataset_split.dir_utils as dir_utils
THIS_PATH = osp.join(os.getcwd(), 'dataset_split', 'test')
SAFE_PATH = osp.join(THIS_PATH, 'test-utils')
TEST_PATH = osp.join(THIS_PATH, 'test-utils-exec')
TEST_DIRS = ['OMG', 'ROFL', 'XOXO', '.SNEAKY']
ORIGIN... | StarcoderdataPython |
8169680 | <gh_stars>1-10
import os
from spaceone.inventory.libs.common_parser import *
from spaceone.inventory.libs.schema.dynamic_widget import ChartWidget, CardWidget
from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, EnumDyField, SearchField, SizeField
from spaceone.inventory.libs.schema.resour... | StarcoderdataPython |
9753562 | from global_data import db
from sqlalchemy.orm import relationship
class SessionModel(db.Model):
__tablename__ = 'sessions'
id = db.Column(db.Integer, primary_key = True, nullable=True)
instructor_id = db.Column(db.Integer, db.ForeignKey('users.id'))
course_id = db.Column(db.Integer, db.ForeignKey('co... | StarcoderdataPython |
6688157 | from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from django.core.urlresolvers import reverse
from django.test import LiveServerTestCase, Tes... | StarcoderdataPython |
8137836 | <reponame>calmisential/SkeNetch
import torch
import torch.nn as nn
from utils.auto_padding import same_padding
class DeformableConv2d(nn.Module):
"""
可变性卷积,Ref: https://github.com/dontLoveBugs/Deformable_ConvNet_pytorch/blob/master/network/deform_conv/deform_conv_v2.py
"""
def __init__(self, in_chan... | StarcoderdataPython |
8024192 | <filename>tests/test_game.py
import time
import unittest
from tests import initialize_screenshot, initialize_video
from tft import game, tracker, main, handler, debugger, utils
Test1080PDefaultScreenshot = "/Users/henry/Downloads/TFT Screenshots/board_1080_1.png"
Test1440PDefaultScreenshot = "/Users/henry/Downloads/T... | StarcoderdataPython |
8020720 | # %%
import os
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from transformers import (
AutoTokenizer,
AutoModelForQuestionAnswering,
)
from captum.attr import visualization as viz
from captum.attr import (
IntegratedGrad... | StarcoderdataPython |
1974336 | """The Pygame backend of the renderer.
Defines a pygame surface that implements the
FramebufferSurface interface.
"""
import math
import typing
try:
import pygame # type: ignore
except ImportError:
SUPPORTED = False
else:
SUPPORTED = True
class PygameSurface:
"""A pygame surface, used whe... | StarcoderdataPython |
1805945 | <reponame>Thib17/tailon<filename>tasks.py
# -*- coding: utf-8; -*-
import json
import subprocess as sub
from glob import glob
from pathlib import Path
from time import time
import re
from invoke import run, task
from webassets.filter import register_filter, Filter
from webassets.loaders import YAMLLoader
#---------... | StarcoderdataPython |
6558650 | <filename>tests/days/Day10Test.py
import unittest
from ac2020.days.Day10 import Day10
class Day10Test(unittest.TestCase):
def test_empty_input(self):
day = Day10()
day._set_input('')
self.assertEqual('No result', day.part1())
self.assertEqual('No result', day.part2())
def te... | StarcoderdataPython |
6497390 | <reponame>status-im/eth2.0-specs<filename>test_libs/pyspec/eth2spec/test/helpers/bitfields.py
def set_bitfield_bit(bitfield, i):
"""
Set the bit in ``bitfield`` at position ``i`` to ``1``.
"""
byte_index = i // 8
bit_index = i % 8
return (
bitfield[:byte_index] +
bytes([b... | StarcoderdataPython |
6677327 |
import smart_imports
smart_imports.all()
class Config(django_apps.AppConfig):
name = 'the_tale.game.chronicle'
label = 'chronicle'
verbose_name = 'chronicle'
def ready(self):
from . import signal_processors
pass
| StarcoderdataPython |
1752017 | # ==============================================================================
# This file is part of the SPNC project under the Apache License v2.0 by the
# Embedded Systems and Applications Group, TU Darmstadt.
# For the full copyright and license information, please view the LICENSE
# file that was distributed... | StarcoderdataPython |
3383742 | import numpy
import math
from scipy.optimize import root
from math import *
print('')
print('LIQUIDS PIPE SIZING CALCULATIONS')
print('')
print('INPUT DATA')
print('')
q = float(input('Please introduce liquid flow rate (US gpm): '))
ro = float(input('Please introduce liquid density (lb/ft3): '))
vi = float... | StarcoderdataPython |
1833043 | from functools import wraps
from unittest.mock import patch
from ninja.signature import is_async
def mock_signal_call(signal: str, called: bool = True):
def _wrap(func):
if is_async(func):
async def _wrapper(*args, **kwargs):
with patch(f"ninja_extra.signals.{signal}.send") a... | StarcoderdataPython |
3543415 | """Plots."""
import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
from computations import lamb_vdp1, lamb_vpp1, lamb_p1cond1, lamb_p1cond2,\
lamb_vdp2, lamb_vpp2, lamb_p2cond1, lamb_p2cond2
def plot_optimal_policies(δ, ρ, γ, rh, rl, xaxis="δ", yaxis="γ", prec=100,
... | StarcoderdataPython |
1935688 | """modify sites and tags array fields
Revision ID: <KEY>
Revises: 844fbeba4059
Create Date: 2020-12-07 21:12:51.918148
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '844fbeba4059'
branch_labels... | StarcoderdataPython |
314495 | from beet import Context
def beet_default(ctx: Context):
ctx.generate.objective()
ctx.generate.objective("{hash}", "something")
ctx.generate.objective("hello", criterion="playerKillCount")
ctx.generate.objective("world", display="Something")
generate = ctx.generate["foo"]["bar"]
generate.obje... | StarcoderdataPython |
4909252 | from .version import version_info as VERSION
from .version import version_str as __version__
__all__ = ['VERSION', '__version__']
| StarcoderdataPython |
314373 | sys_word = {}
for x in range(0,325):
sys_word[x] = 0
file = open("UAD-0015.txt", "r+")
words = file.read().split()
file.close()
for word in words:
sys_word[int(word)] += 1
for x in range(0,325):
sys_word[x] = sys_word[x]/int(325)
file_ = open("a_1.txt", "w")
for x in range(0,325):
if x is 324:
... | StarcoderdataPython |
4838457 | # Generated by Django 3.0.7 on 2020-06-29 02:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Clinic_information',
... | StarcoderdataPython |
3360239 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : utils.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 10/06/2018
#
# This file is part of NSCL-PyTorch.
# Distributed under terms of the MIT license.
import torch
__all__ = ['canonize_monitors', 'update_from_loss_module']
def canonize_monitors(monitors):... | StarcoderdataPython |
9708193 | import json
import os
import time
import mock
from pecan import set_config
from pecan.testing import load_test_app
from bm_instance_agent.common import utils as bm_utils
from bm_instance_agent.systems import base as driver_base
from bm_instance_agent.tests import base
from bm_instance_agent.tests.unit import fake
d... | StarcoderdataPython |
8123893 | <reponame>p-montero/py-ans<filename>class2/ex1_c.py
#!/usr/bin/env python
'''
Simple Python script calling (module name = my_func.py)
'''
from my_func import phello as p
p()
| StarcoderdataPython |
3524797 | <reponame>etdv-thevoid/pokemon-rgb-enhanced
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Use this tool to dump an asm file for a new source code or disassembly project.
usage:
from dump_sections import dump_sections
output = dump_sections("../../butt.gbc")
file_handler = open("main.asm", "w")
file_... | StarcoderdataPython |
8151643 | from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from app import app
layout = [dcc.Markdown("""
### Evaluate
The distribution of predictions closely matches the true distribution of incomes, with slight overpredictions around the median and underpredi... | StarcoderdataPython |
8136330 | # --------------------------------------------------------
# Tensorflow TIN
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_pa... | StarcoderdataPython |
6516090 | <reponame>Louquinze/auto-sklearn
import os
import sys
import unittest
from autosklearn.pipeline.components.base import find_components, \
AutoSklearnClassificationAlgorithm
this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(this_dir)
class TestBase(unittest.TestCase):
def test_find_compo... | StarcoderdataPython |
303700 | import matplotlib.pyplot as plt
import cv2
lr = cv2.imread('../datasets/DIV2K/DIV2K_test_lr_unknown/11.png')
edsr = cv2.imread('../experiment/x3_Dila_ensemble/results-Demo/11_x3_SR.png')
lh, lw, _ = lr.shape
h, w, _ = edsr.shape
# fig, axs = plt.subplots(2, 3, num='Result X3', figsize=(10, 9))
# fig.suptitle('X3, {}x... | StarcoderdataPython |
6486168 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.BaseWebResponse import BaseWebResponse
class AntfortuneYebEntityequityVerifyResponse(AlipayResponse):
def __init__(self):
super(AntfortuneYebEntityequity... | StarcoderdataPython |
5174355 |
import re
from depccg.combinator import ja_default_binary_rules, unary_rule
from depccg.cat import Category
from depccg.tree import Tree
from depccg.token import Token
combinators = {sign: rule for rule, sign in zip(
ja_default_binary_rules,
['SSEQ', '>', '<', '>B', '<B1', '<B2', '<B3', '<B4', '>Bx1', '>Bx2... | StarcoderdataPython |
1845332 | # Generated by Django 3.1.6 on 2021-03-14 18:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("wkz", "0004_settings_path_to_activities_on_device"),
]
operations = [
migrations.RemoveField(
model_name="settings",
name="p... | StarcoderdataPython |
8094562 | <reponame>hangg7/deformable-kernels
#!/usr/bin/env python3
#
# File : cond_conv.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 12/25/2019
#
# Distributed under terms of the MIT license.
import torch
from apex import amp
from torch import nn
class CondConv2d(nn.Module):
def __init__(self, num_experts, in_... | StarcoderdataPython |
5195191 | <reponame>dharjani/flask-restapi-aws
import os
from dotenv import load_dotenv
load_dotenv()
S3_BUCKET = os.getenv("S3_BUCKET")
S3_KEY = os.getenv("S3_KEY")
S3_SECRET = os.getenv("S3_SECRET_ACCESS_KEY")
S3_URL_PREFIX = os.getenv("S3_URL_PREFIX") | StarcoderdataPython |
4994367 | <gh_stars>0
# -*- coding:utf-8 -*-
#
# Copyright (C) 2019 The Android Open Source Project
#
# 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 |
6510530 | <filename>peleenet/components/train/src/peleenet.py
import argparse
import datetime
import json
import math
import os
import pickle
import shutil
from collections import OrderedDict
from random import randrange
from typing import List, Tuple
import numpy as np # type: ignore
import tensorflow as tf # type: ignore
fr... | StarcoderdataPython |
194367 | <reponame>gimait/pycozmo<filename>examples/procedural_face_show.py<gh_stars>1-10
#!/usr/bin/env python
import pycozmo
def main():
# Render a 128x64 procedural face with default parameters.
f = pycozmo.procedural_face.ProceduralFace()
im = f.render()
im.show()
if __name__ == '__main__':
main()
| StarcoderdataPython |
6639583 | <filename>PYTHON/skyscrapper.py
class Solution:
def getSkyline(self, buildings: 'List[List[int]]') -> 'List[List[int]]':
"""
Divide-and-conquer algorithm to solve skyline problem,
which is similar with the merge sort algorithm.
"""
n = len(buildings)
# The base cases
... | StarcoderdataPython |
319496 | from p10_requests import *
print(FOO)
print(math.pi)
| StarcoderdataPython |
4972866 | import unittest
from src.gilded_rose import GildedRose, Item
class BackstagePassTest(unittest.TestCase):
def setUp(self):
self.backstage_pass_name = "Backstage passes to a TAFKAL80ETC concert"
def test_should_increase_quality_by_1_when_sell_in_date_is_more_than_10(self):
items = [Item... | StarcoderdataPython |
1686955 | <filename>mk_outFoV_rates_resps.py
import numpy as np
from scipy import optimize, stats, interpolate
from astropy.io import fits
from astropy.table import Table
import os
import argparse
import logging, traceback
import healpy as hp
from config import rt_dir
from ray_trace_funcs import RayTraces
from event2dpi_funcs i... | StarcoderdataPython |
9759159 | TESTS_BUNDLE_MODEL = 'ExampleBundle'
TESTS_BUNDLE_APP = 'example_bundle'
TESTS_DYNAMIC_APP = 'example_dynamic_models'
| StarcoderdataPython |
3453092 | import tensorflow as tf
from base import hyperparams as base_hp
class Hyperparams(base_hp.Hyperparams):
dtype = tf.float32
batch_size = 64
logit_batch_size = 32
input_size = 2
z_size = 2
lr_autoencoder = 0.0001
lr_decoder = 0.0001
lr_disc = 0.0001
z_dist_type = 'uniform' # ['... | StarcoderdataPython |
8100986 | from screenplay_pdf_to_json.utils import isCharacter
import pytest
def createMockContent(text):
return {
"x": 225,
"y": 4,
"text": text
}
def setupMultiplecharacters(characters):
characters = [createMockContent(heading) for heading in characters]
characters = [isCharacter(co... | StarcoderdataPython |
6586200 | <gh_stars>0
from django.shortcuts import render, redirect
from django.http import HttpResponse
#from .models import ToDoList, Item
from good_things_that_happened.models import GoodThingThatHappened
from .models import ProfileAccess
from django.contrib.auth.models import User
def profile_for_self(request):
if not r... | StarcoderdataPython |
11233623 | import pytest
from vcx.error import ErrorCode, VcxError
from vcx.common import error_message
def test_error():
assert ErrorCode.InvalidJson == 1016
def test_c_error_msg():
assert error_message(0) == 'Success'
def test_all_error_codes():
max = 0
assert(VcxError(1079).error_msg == "Wallet Not Found")... | StarcoderdataPython |
11392337 | def decryptBacon(cipher):
bacon = ['AAAAA','AAAAB','AAABA','AAABB','AABAA','AABAB','AABBA','AABBB','ABAAA','ABAAB','ABABA','ABABB','ABBAA','ABBAB','ABBBA','ABBBB','BAAAA','BAAAB','BAABA','BAABB','BABAA','BABAB','BABBA','BABBB']
alphabet = ['a','b','c','d','e','f','g','h','i','k','l','m','n','o','p','q','r','s','t',... | StarcoderdataPython |
9678134 | _base_ = [
'../_base_/models/vit-base-p16_ft.py',
'../_base_/datasets/imagenet.py',
'../_base_/schedules/adamw_coslr-100e_in1k.py',
'../_base_/default_runtime.py',
]
# dataset
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
train_pipeline = [
dict(
type='RandomAug... | StarcoderdataPython |
1681206 | <gh_stars>1-10
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Genera... | StarcoderdataPython |
12847193 | import os
import asyncio
import concurrent.futures
import requests
import aiohttp
from mlimages.util.file_api import FileAPI
import mlimages.util.log_api as LogAPI
class API():
def __init__(self, data_root, proxy="", proxy_user="", proxy_password="", parallel=-1, limit=-1, timeout=10, debug=False):
self.... | StarcoderdataPython |
5102197 | <reponame>CAST-projects/Extension-SDK
import unittest
from cast.analysers.test import MainframeTestAnalysis
class Test(unittest.TestCase):
def test_ok1(self):
analysis = MainframeTestAnalysis()
analysis.add_dependency(r'C:\ProgramData\CAST\CAST\Extensions\com.castsoftware.mainframe.... | StarcoderdataPython |
5145065 | <filename>ship/fmp/datunits/isisunit.py<gh_stars>1-10
"""
Summary:
Contains the AUnit, CommentUnit, HeaderUnit and UnknownSection
classes.
The AUnit is an abstract base class for all types of Isis unit read
in through the ISIS data file. All section types that are built should
inherit from ... | StarcoderdataPython |
1685129 | #! /usr/bin/env python3
import math
REPEAT = 4
PACKET_LEN = 4
fin = open('input.txt', 'w') # 入力ファイル
fphase = open('ref_phase.txt', 'w') # 位相の比較ファイル
fres = open('ref_result.txt', 'w') # cellの結果の比較ファイル
feedback = 0
count = 0
d = 1
for r in range(REPEAT):
for i in range(PACKET_LEN):
d2 = d * 2**8 #フォーマットは ... | StarcoderdataPython |
5095216 | from __future__ import absolute_import
from __future__ import unicode_literals
from flask.views import MethodView
from flask import request
from .util import camel_to_underscore
from werkzeug.exceptions import NotImplemented
from logging import getLogger
import six
class WebHook(MethodView):
def __init__(self, ... | StarcoderdataPython |
9626188 | from flask_app import app, db, Classroom, Teacher, Student, Activity, Question, HelpingHand, HelpingHandLog
from flask_login import current_user, login_required
from flask import redirect, render_template, url_for, request, flash
from functools import wraps
from datetime import datetime
##############################... | StarcoderdataPython |
5113204 | <gh_stars>1-10
import cv2
import numpy as np
circle = np.zeros((512, 512, 3), dtype = np.uint8) + 255
cv2.circle(circle, (256, 256), 50, color = (0, 0, 255), thickness = -1)
rectangle = np.zeros((512, 512, 3), dtype = np.uint8) + 255
cv2.rectangle(rectangle, (200, 200), (300, 300), color=(0,255,0), thickness=-... | StarcoderdataPython |
4828324 | from graphql.core.type import (
GraphQLArgument,
GraphQLBoolean,
GraphQLInt,
GraphQLNonNull,
GraphQLList,
GraphQLObjectType,
GraphQLString,
GraphQLField
)
class ConnectionConfig(object):
'''
Returns a GraphQLFieldConfigArgumentMap appropriate to include
on a field whose ret... | StarcoderdataPython |
9728634 | <filename>tvdordrecht/swimtest/apps.py<gh_stars>0
from django.apps import AppConfig
class SwimTestConfig(AppConfig):
name = 'swimtest'
verbose_name = "Zwemtest"
| StarcoderdataPython |
1753147 | <filename>Lesson4/line_plot_with_ggplot.py
from pandas import *
from ggplot import *
import pandas
def lineplot(hr_year_csv):
# A csv file will be passed in as an argument which
# contains two columns -- 'HR' (the number of homerun hits)
# and 'yearID' (the year in which the homeruns were hit).
... | StarcoderdataPython |
4926961 | <reponame>olavosamp/kaggle_isic_2020
metadata_anatom_categories = ("torso", "lower extremity", "upper extremity",
"head/neck", "palms/soles", "oral/genital")
# ImageNet stats
IMAGENET_MEAN = [0.485, 0.456, 0.406]
IMAGENET_STD = [0.229, 0.224, 0.225]
# Matplotlib
MPL_FIG_SIZE = (18, 9)
... | StarcoderdataPython |
9620865 | <filename>exchangepair.py
#!/usr/bin/env python3
class ExchangePair:
def __init__(self, cutoff, exchange0, exchange1):
self.exchange0 = exchange0
self.exchange1 = exchange1
self.runningAverages = {} # keep track of the running average over the past ~2 hours
for key in exchange0.w... | StarcoderdataPython |
4863232 |
# ! Desafio 61
# ! Refaça o desafio 051, lendo o primeiro termo e a razão de uma PA, mostrando os 10 primeiros termos da progressão usando a estrutura while. | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.