id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1640593 | <gh_stars>10-100
"""Add support Int8 Calibration in DevCloud
Revision ID: df69ffd99c51
Revises: <PASSWORD>
Create Date: 2020-09-15 09:57:21.084519
"""
"""
OpenVINO DL Workbench
Migration: Add support Int8 Calibration in DevCloud
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.... | StarcoderdataPython |
4843184 | <reponame>riverbed/steelscript-steelhead<filename>steelscript/steelhead/core/steelhead.py
# Copyright (c) 2019 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the Li... | StarcoderdataPython |
113806 | <filename>source/devices/EnergyDomoticzDevice.py<gh_stars>1-10
import Const
import DomoticzDevice
import DomoticzDeviceActions
import DomoticzHelpers
class EnergyDomoticzDevice(DomoticzDevice.DomoticzDevice):
def __init__(self, room, deviceInfo):
super(EnergyDomoticzDevice, self).__init__(room, deviceInfo)... | StarcoderdataPython |
41192 | <gh_stars>1-10
from . import config
from .util import make_request, image_request
class Overlay:
def __init__(self, token: str) -> None:
self.token = token
def overlay(self, type: str, image_url: str):
url = config.api_url + f"overlays/{type}?image={image_url}"
headers= {"Authorization... | StarcoderdataPython |
23289 | from django.views import View
from django.http import HttpResponseRedirect
from add2cal import Add2Cal
from pytz import timezone
import datetime
from django.http import (
JsonResponse,
HttpResponse
)
ADD2CAL_DATE_FORMAT = "%Y%m%dT%H%M%S"
CALENDAR_CONTENT_TYPE = 'text/calendar'
OUTLOOK_LINK_TYPE = 'outlook'
GOO... | StarcoderdataPython |
3245805 | <filename>yellowbrick/cluster/base.py
# yellowbrick.cluster.base
# Base class for cluster visualizers.
#
# Author: <NAME> <<EMAIL>>
# Created: Thu Mar 23 17:28:38 2017 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: base.py [241edca] <EMAIL> $
"""
Base class for cl... | StarcoderdataPython |
123858 | <gh_stars>10-100
def loss_layer(self, predicts, labels, scope='loss_layer'):
with tf.variable_scope(scope):
predict_classes = tf.reshape(predicts[:, :self.boundary1],
[self.batch_size, self.cell_size, self.cell_size, self.num_class])
predict_scales = tf.reshape(p... | StarcoderdataPython |
1799959 | # -*- coding: utf-8 -*-
'''
:copyright: (c) 2014 by <NAME>, see AUTHORS.txt for more details.
'''
from __future__ import absolute_import
import HLL
class Counter(object):
def __init__(self, op):
self.__op = op
self._value = None
@property
def op(self):
return self.__op
@pro... | StarcoderdataPython |
1685930 | #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a com... | StarcoderdataPython |
110492 | #-----------------------------------------------------------------------------
#
# Copyright (c) 2005, 2006 by Enthought, Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
#
#-----------------------------------------------------------------------------
""" A record of refactorings... | StarcoderdataPython |
175447 | def one(x):
print x
def two(x,y):
one(x)
one(y)
two(10,20)
| StarcoderdataPython |
55771 | <reponame>desitomato/flask-docker
from db import db
class CompanyModel(db.Model):
__tablename__ = 'company'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
employee = db.relationship('EmployeeModel', lazy='dynamic')
def __init__(self, name):
self.name = name
... | StarcoderdataPython |
3214277 | <filename>simframe/io/writers/namespacewriter.py
from simframe.frame.abstractgroup import AbstractGroup
from simframe.frame.field import Field
from simframe.frame.group import Group
from simframe.io.reader import Reader
from simframe.io.writer import Writer
from simframe.utils.color import colorize
from collections im... | StarcoderdataPython |
61865 | """
AUTOR: Juanjo
FECHA DE CREACIÓN: 24/05/2019
"""
from flask import render_template, redirect, url_for
from flask_login import login_required, current_user
from app.models import Post
from . import admin_bp
from .forms import PostForm
@admin_bp.route("/admin/post/", methods=['GET', 'POST'], defaults={'post_id'... | StarcoderdataPython |
1703338 | <gh_stars>1-10
import argparse
import os
import torch
import simple_transformer as T
from typing import List
from tqdm import tqdm
from torchtext.data.metrics import bleu_score
from simple_transformer.data import Vocab
def main() -> None:
# Parse arguments
parser = argparse.ArgumentParser(description='Transfo... | StarcoderdataPython |
1711802 | <gh_stars>0
import numpy as np
from .manager_base import ManagerBase, Panel
class DummyManager(ManagerBase):
def __init__(self, num_panels):
self.num_panels = num_panels
def get_num_panels(self):
return self.num_panels
def get_layout(self):
return [Panel(i, 75*i, 43 * (1 - i % 2... | StarcoderdataPython |
1718700 | <reponame>sriamazingram/table-linker
import pandas as pd
from tl.exceptions import RequiredInputParameterMissingException, UnsupportTypeError
from tl.file_formats_validator import FFV
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.preprocessing import MinMaxScaler
import pick... | StarcoderdataPython |
1746827 | """Deep Pictorial Gaze architecture."""
from typing import Dict
import numpy as np
import scipy
import tensorflow as tf
from core import BaseDataSource, BaseModel
from datasources import UnityEyes
import util.gaze
class DPG(BaseModel):
"""Deep Pictorial Gaze architecture as introduced in [Park et al. ECCV'18]."... | StarcoderdataPython |
3349896 | """
This file houses functions and classes that pertain to Roblox groups.
"""
import copy
from enum import Enum
import iso8601
import asyncio
from ro_py.wall import Wall
from ro_py.roles import Role
from ro_py.events import Event
from ro_py.users import BaseUser
from typing import Tuple, Callable
from ro_py.events... | StarcoderdataPython |
1715330 | from .Graphics import Graphics
from .MatplotlibCanvas import MatplotlibCanvas
from .MatplotlibWidget import MatplotlibWidget | StarcoderdataPython |
3298600 | <filename>eagerpy/types.py<gh_stars>100-1000
from typing import Union, Tuple, TYPE_CHECKING
if TYPE_CHECKING:
# for static analyzers
import torch # noqa: F401
import tensorflow # noqa: F401
import jax # noqa: F401
import numpy # noqa: F401
Axes = Tuple[int, ...]
AxisAxes = Union[int, Axes]
Sha... | StarcoderdataPython |
1754126 | from django.http import HttpResponseForbidden
from django.conf import settings
from django.contrib.auth import logout
from django.core.cache import cache
from django.utils.deprecation import MiddlewareMixin
from .models import BlockIP
def get_ip(request):
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR'... | StarcoderdataPython |
37445 | #
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
... | StarcoderdataPython |
4805509 | from .config import MainConfig
| StarcoderdataPython |
168129 | <filename>etcd3/members.py
class Member(object):
"""
A member of the etcd cluster.
:ivar id: ID of the member
:ivar name: human-readable name of the member
:ivar peer_urls: list of URLs the member exposes to the cluster for
communication
:ivar client_urls: list of URLs the ... | StarcoderdataPython |
1605785 | import torch.nn as nn
class PenetrationModel:
def __init__(self, hand_model, object_model):
self.hand_model = hand_model
self.object_model = object_model
self.relu = nn.ReLU()
def get_penetration(self, object_code, hand_code):
hand_vertices = self.hand_model.get_vertices(hand_code)
return self... | StarcoderdataPython |
1682428 | print("Hello world")
print("mahdi asadi") | StarcoderdataPython |
1730041 | # -*- coding:utf-8 -*-
"""
在pyctp2的父目录中, 执行
python red.py pyctp2.sbin.md2 md_exec
"""
import logging
from ..common.base import INFO_PATH,DATA_PATH
from ..md import ctp_md as cm
from ..common import controller as ctl
from ..common.contract_type import CM_ALL
from ..md import save_agent as save_agent
from ..... | StarcoderdataPython |
1684338 | <gh_stars>1-10
import argparse
import sys
import csv
import pandas
csv.field_size_limit(sys.maxsize)
def preparation_articles():
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--file", required=True, help="articles file")
args = parser.parse_args()
if len(sys.argv) >= 3:
data ... | StarcoderdataPython |
3231232 | <reponame>TariniHardikar/OpenFermion
# 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... | StarcoderdataPython |
3239266 | <gh_stars>0
from django.conf.urls import patterns, include, url
from store_landpage import views
urlpatterns = (
# Main Aggregate Store
url(r'^$', views.front_page, name='store_landpage'),
url(r'landpage$', views.front_page),
url(r'tos$', views.tos_page, name='store_tos'),
url(r'privacy$', views.p... | StarcoderdataPython |
1685285 | <reponame>pro-pedropaulo/estudo_python<filename>executaveis/25_else_juros_pagamento_diferentes.py
produto = input('Digite o nome do produto que queira comprar: ')
valor = float(input('Qual é o valor do produto {} escolhido '.format(produto)))
print('MÉTODOS DE PAGAMENTO')
print('[ 1 ] à vista dinheiro/cheque: 10% de de... | StarcoderdataPython |
3238210 | # carve.py
# Wed May 9 14:18:46 IST 2018
from __future__ import print_function
import sys
def main(source, start, end, dest):
# type: (str, int, int, str) -> None
with open(source, 'rb') as sf:
sf.seek(start)
byte_str = sf.read(end)
with open(dest, 'wb') as df:
df.write(byte_str... | StarcoderdataPython |
3376093 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
compute matrix elements of single particle operators such as
- the overlap (a|b)
- the kinetic energy (a|T|b)
- the nuclear attraction energy (a|sum_I -Z(I)/|r-R(I)| |b)
- the dipole operator (a|e*r|b)
using Becke's multicenter integration scheme
"""
import numpy as... | StarcoderdataPython |
3211311 | <reponame>david-liu/hiking
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from hiking.repository.console_repository import *
from hiking.repository.entity_mongo_repository import *
from hiking.repository.task_config_repository import * | StarcoderdataPython |
128662 | <reponame>LonamiWebs/Logicmind
from math import factorial, exp
def perm(n):
"""Permutations.
n = number of elements
Notation: P
n
All elements included: yes
Can elements repeat: no
Order matters: yes
See: Number of ways there are to rearrange n elements.
... | StarcoderdataPython |
59886 | <reponame>pranjalkumar153/algo_ds_101
# Binary Search Tree (BST) Implementation
class BSTNode:
def __init__(selfNode, nodeData): # Node Structure
selfNode.nodeData = nodeData
selfNode.left = None
selfNode.right = None
selfNode.parent = None
# Insertion Operation
def insert(se... | StarcoderdataPython |
131862 | <reponame>ap-kulkarni/dvc
import logging
import os
from contextlib import contextmanager
from typing import TYPE_CHECKING, Optional
from dvc.repo import locked
from dvc.repo.scm_context import scm_context
from dvc.utils.fs import remove
from .base import (
EXEC_APPLY,
ApplyConflictError,
BaselineMismatchE... | StarcoderdataPython |
4825446 | <filename>train.py
from __future__ import absolute_import, division, print_function
import argparse
from datetime import datetime
from os import environ
import keras
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.applications import MobileNet
from keras.callbacks import (EarlyStopping, Mode... | StarcoderdataPython |
3247283 | """
This little snippet of code illustrates break and continue. continue is to skip an iteration and break is to
get out of a loop (usually) when a condition has been met. The key here is that break fails when there are
multiple loops to break out of.
"""
list1 = [1, 2, 3]
list2 = ['a', 'b', 'c']
list3 = ['@', '#', '$... | StarcoderdataPython |
121250 | <reponame>sudeep9/alchemy
from alchemy.unit import UnitInstance
class Flow:
def __init__(self, name):
self.name = name
self.input = {}
self.output = {}
self.defaults = {}
self.ui_list = []
self.desc = ""
def get_args(self):
if self.input is None:
... | StarcoderdataPython |
3381241 | from .hit_rate import HR | StarcoderdataPython |
3234809 | <gh_stars>0
from test_base import check_pages, check_blueprints
@check_pages('/', '/home/index')
def test_pages(base_client):
# do something
base_client.post('/', data={})
# the pages are tested (GET request: 200) afterwards
@check_blueprints('/forms', '/ui')
def test_blueprints(base_client):
# do s... | StarcoderdataPython |
3376268 | import json
# make sure we can find the app code
import sys, os
my_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, my_path + '/../../code/')
import lambda_handlers as handlers
REQUIRED_PROPERTY_ERR = "'{}' is a required property"
INCORRECT_TYPE_ERR = "'{}' is not of type '{}'"
def test_fv_hand... | StarcoderdataPython |
1666266 | <reponame>nyancol/lol-bot<gh_stars>1-10
from __future__ import annotations
import asyncio
from pathlib import Path
from redbot.core.commands import Context
from typing import List, DefaultDict, Dict, Optional, Mapping
import random
import lavalink
import requests
from pcsd_cog.events import * # EventData, EventIdle, ... | StarcoderdataPython |
34853 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 a... | StarcoderdataPython |
3252215 | from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine_url = 'postgresql+psycopg2://peterboy:peterboy@localhost:5432/peterboy'
# engine_url = 'postgresql+psycopg2://jiho:dmsthfl@localhost:5432/jiho'
engine = create_en... | StarcoderdataPython |
64014 | class Solution:
def getFolderNames(self, names: List[str]) -> List[str]:
| StarcoderdataPython |
107824 | <filename>lavaplayer/routes.py
LOADTRACKS = "/loadtracks?identifier={query}"
DECODETRACK = "/decodetrack"
DECODETRACKS = "/decodetracks"
ROUTEPLANNER = "/routeplanner/status"
UNMARK_FAILED_ADDRESS = "/routeplanner/free/address"
UNMARK_ALL_FAILED_ADDRESS = "/routeplanner/free/all"
| StarcoderdataPython |
1657864 | <gh_stars>0
import unittest
from malcolm.core import call_with_params
from malcolm.modules.builtin.parts import ChoicePart
class TestChoicePart(unittest.TestCase):
def setUp(self):
self.o = call_with_params(
ChoicePart, name="cp", description="desc", choices=["a", "b"],
initialVa... | StarcoderdataPython |
25738 | import numpy as np
import cvxpy as cvx
import util
def set_contains_array(S, a):
"""
:param S: list of np.ndarray
:param a: np.ndarray
:return: contains, 0 or 1
"""
contains = 0
for b in S:
if not (a - b).any(): # if a contained in S
contains = 1
return contains
... | StarcoderdataPython |
3358904 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
class Problem(models.Model):
"""
Problem
"""
id = models.AutoField(
'서로게이트키',
db_column='ID',
null=False,
primary_key=True
)
editor = models.ForeignKey(
User,
v... | StarcoderdataPython |
160552 | <reponame>DrGFreeman/RasPiBot202
class Encoders:
def __init__(self, aStar):
self.aStar = aStar
self.countLeft = 0
self.countRight = 0
self.lastCountLeft = 0
self.lastCountRight = 0
self.countSignLeft = 1
self.countSignRight = -1
self.aStar.reset_encod... | StarcoderdataPython |
118756 | # © 2019 University of Illinois Board of Trustees. All rights reserved
"""
Script to produce VCF from training data
"""
import argparse
import vcfFromContigs
from PySamFastaWrapper import PySamFastaWrapper
import multiprocessing
# import MemmapData
import MemmapDataLite
import _pickle as pickle
import logging
import s... | StarcoderdataPython |
4829205 | # Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modif... | StarcoderdataPython |
1743242 | <reponame>Large-Scale-Tensor-Decomposition/TensorD
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/1/17 PM4:30
# @Author : <NAME>
# @Site :
# @File : ml_ncp.py
# @Software: PyCharm Community Edition
from tensorD.dataproc.reader import TensorReader
import tensorflow as tf
from tensorD.factoriza... | StarcoderdataPython |
1711836 | <gh_stars>100-1000
from multiprocessing import Condition, Queue, Semaphore, RLock, get_context
from multiprocessing.queues import JoinableQueue
from multiprocessing.sharedctypes import Value
from enum import IntEnum
from typing import Dict
from queue import Full
from time import monotonic
class State(IntEnum):
""... | StarcoderdataPython |
1684323 |
import random
def eightball():
# https://en.wikipedia.org/wiki/Magic_8-Ball#Possible_answers
return random.choice(("It is certain", "It is decidedly so", "Without a doubt", "Yes, definitely",
"You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes",
"Signs point to yes", "Reply... | StarcoderdataPython |
1730687 | <reponame>Xamaneone/SoftUni-Intro
import sys
number = int(input())
max_number = -sys.maxsize
min_number = sys.maxsize
for i in range(number):
current_number = int(input())
if current_number > max_number:
max_number = current_number
if current_number < min_number:
min_number = current_numb... | StarcoderdataPython |
1797760 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import resnet12
###### --- Conv4-64 --- ######
# This arch is the same as Spyros's works: https://github.com/gidariss/FewShotWithoutForgetting/blob/master/architectures/ConvNet.py
###### --- ResNet12 --- ######
# ResNet1... | StarcoderdataPython |
1622354 | from data_reader import OneWorldAllEntityinKBIterateLoader
from utils import oneworld_entiredataset_loader_for_encoding_entities, KBIndexerWithFaiss, BiEncoderTopXRetriever
from utils import parse_duidx2encoded_emb_2_dui2emb
from model import WrappedModel_for_entityencoding
from encoders import InKBAllEntitiesEncoder, ... | StarcoderdataPython |
3302396 | import subprocess
import os
import json
def run():
json_fn = os.path.join(os.path.dirname(__file__), 'mq_config.json')
with open(json_fn, 'r') as f:
params = json.load(f)
cmd = "docker stop producer-command"
subprocess.call(cmd, shell=True)
cmd = "docker rm producer-command"
... | StarcoderdataPython |
3248821 | from dataclasses import dataclass
from unittest import TestCase
from stupid import StupidMeta
from stupid import StupidData
class Test(metaclass=StupidMeta):
a: int
b: str
class TestNew(TestCase):
def test_slots(self):
self.assertEqual(Test.__slots__, ('a', 'b'))
def test_inherit(self):
... | StarcoderdataPython |
1634671 | <reponame>Victorinolavida/bioregistry
# -*- coding: utf-8 -*-
"""Align the OBO Foundry with the Bioregistry."""
from typing import Mapping, Sequence
from bioregistry.align.utils import Aligner
from bioregistry.external.obofoundry import get_obofoundry, get_obofoundry_example
__all__ = [
"OBOFoundryAligner",
]
... | StarcoderdataPython |
1782366 | <filename>domain_expiration_checker.py
#!/usr/bin/env python3
from datetime import datetime
from subprocess import check_output, CalledProcessError
import re
import json
import os.path
import logging
import configparser
try:
import boto3
from whois import whois
except ImportError as err:
if 'whois' in err.... | StarcoderdataPython |
1654045 | import sys
import time
#n = int(sys.argv[1])
n = int(input())
time1 = time.time()
is_Prime = [True]*(n+1)
for i in range(2, n):
if is_Prime[i]:
t = n//i + 1
for j in range(2, t):
is_Prime[j*i] = False
count = 0
for i in range(2, n+1):
if is_Prime[i]:
count += 1
time2 = time.time()
print(count)
print(time2... | StarcoderdataPython |
136221 | """
Affine Cipher
"""
from string import ascii_lowercase as low
from textwrap import wrap
from math import gcd
def encode(plain_text, a_value, b_value):
"""
Encode text
"""
if gcd(a_value, 26) != 1:
raise ValueError("a and m must be coprime.")
plain_text = list(filter(lambda x: x.is... | StarcoderdataPython |
3319368 | import logging
from pgdrive.constants import BodyName
def pg_collision_callback(contact):
"""
All collision callback should be here, and a notify() method can turn it on
It may lower the performance if overdone
"""
# now it only process BaseVehicle collision
node0 = contact.getNode0()
no... | StarcoderdataPython |
3359715 | <reponame>inspire-group/ml_defense
import numpy as np
import argparse
import subprocess
import os
from lib.utils.svm_utils import *
from lib.utils.data_utils import load_dataset, get_data_shape
from lib.utils.dr_utils import *
from lib.attacks.svm_attacks import *
#----------------------------------------------------... | StarcoderdataPython |
192625 | #!/usr/bin/env python
import name
name.Daemon().run()
| StarcoderdataPython |
3217906 | from view.modes import NormalMode, EditMode
import curses
import logging
log = logging.getLogger("wfcli")
class LateralCursor:
def __init__(self):
self._index = float("-Inf")
self.allowed_offset = 0
def align_cursor(self, current_node):
if self._index != self.in_line(current_node):
... | StarcoderdataPython |
167380 | from ..Animal import Animal
class Fox(Animal):
def __init__(self, strength, initiative, symbol, position, world, color):
super(Fox, self).__init__(strength, initiative, symbol, position, world, color)
def get_move_pos(self):
return self._world.get_map().get_pos_nearby(self._position... | StarcoderdataPython |
30992 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
import datetime
def func(x, a, b):
return a + b*x
def exp_regression(x, y):
p, _ = curve_fit(func, x, np.log(y))
p[0] = np.exp(p[0])
return p
def r2(coe... | StarcoderdataPython |
1714164 | <gh_stars>0
# AdventOfCode 2019 day 2 pt 1
# https://adventofcode.com/2019/day/2
# start 7:19am
# started over at 7:37am confused af
# solved pt 1 8:19am
#
# AdventOfCode 2019 day 2 pt 2
# start pt2 8:55 - paused 9:30
# unpaused 13:30
# solved pt2 13:50
def calcPt1(intcode):
i = 0
while i < len(intcode):
... | StarcoderdataPython |
3214898 | import pytest
from problems import valid_sudoku
from problems.sudoku_solver import Solution
@pytest.mark.parametrize("board", [
([
['5', '3', '.', '.', '7', '.', '.', '.', '.'],
['6', '.', '.', '1', '9', '5', '.', '.', '.'],
['.', '9', '8', '.', '.', '.', '.', '6', '.'],
['8',... | StarcoderdataPython |
4809740 | import sys
def layer_from_config(config):
"""
Construct a layer from a configuration.
Args:
A dictionary configuration of the layer metadata.
Returns:
An object which is a subclass of `Layer`.
"""
layer_config = dict(config)
layer_obj = getattr(sys.modules['paysage.layers... | StarcoderdataPython |
1703881 | import sys
class Node:
def __init__(self, father):
self.father = father
self.l = None
self.r = None
self.inOrderTag = None
self.postOrderTag = None
class Tree:
def __init__(self):
self.root = Node(None)
self.inCount = 1
self.postCount = 1
... | StarcoderdataPython |
3242482 | <filename>bookshelf/views/last_read.py
# -*- coding: utf-8 -*-
import collections
import json
from aiohttp import web
from bookshelf.svclib import run_view_service
# internal state
last_read_books = collections.deque(maxlen=5)
async def bookshelf_view(request):
"""
View to see the current list of books
... | StarcoderdataPython |
1781404 | #!/usr/bin/env python3
"""
python implement of red black tree
"""
import collections
class Node(object):
def __init__(self, key):
self.parent = None
self.left = None
self.right = None
self.color = None
self.key = key
class NIL(object):
def __init__(self):
#NIL c... | StarcoderdataPython |
1782108 | <filename>src/lib/prints.py
""" Functions related to print somthing to the user by the system """
import os
import random
from bokeh.plotting import figure, show
def print_table(x, y, parameter):
"""
This function prints a table and gives a format to it. This functions
is base to print f(x) functi... | StarcoderdataPython |
1799123 | <reponame>g2gcio/course-demo<gh_stars>100-1000
from passlib.handlers.sha2_crypt import sha512_crypt
from blue_yellow_app.data.account import Account
from blue_yellow_app.data.dbsession import DbSessionFactory
class AccountService:
@staticmethod
def create_account(email, plain_text_password):
session =... | StarcoderdataPython |
1794246 | <reponame>bioexcel/biobb_vs
#!/usr/bin/env python3
"""Module containing the BoxResidues class and the command line interface."""
import argparse
from biobb_common.generic.biobb_object import BiobbObject
from biobb_common.configuration import settings
from biobb_common.tools import file_utils as fu
from biobb_common.t... | StarcoderdataPython |
157073 | # -*- coding: utf-8 -*-
import re
import pandas as pd
# Identify the source text (F0)
src_file = '2701-0.txt'
# Import the text as list of lines
lines = open(src_file, 'r', encoding='utf-8').readlines()
# Trim the cruft we identified
lines = lines[340:21964]
# Convert the lines into one big line, pres... | StarcoderdataPython |
1648448 | """
Calculus functionality (differentiation and integration) for polynomials (objects implementing the
:class:`~polynomials_on_simplices.polynomial.polynomials_base.PolynomialBase` interface).
"""
import copy
import numpy as np
import polynomials_on_simplices.algebra.multiindex as multiindex
from polynomials_on_simp... | StarcoderdataPython |
3367407 | <gh_stars>0
import sys
workingdir = "/opt/drugcell/DrugCell/data/"
gene2idfile = workingdir + "gene2ind.txt"
drug2idfile = workingdir + "drug2ind.txt"
cell_name = "user_cell"
# load one column from a file
def load_1col(filename, ind):
data = set()
with open(filename, 'r') as fi:
for line in fi:
tokens = line.... | StarcoderdataPython |
1795739 | <reponame>andyh1203/npyi
import json
import warnings
import requests
from .exceptions import (
InvalidSearchParamException,
InvalidVersionException,
InvalidUseFirstNameAliasException,
InvalidAddressPurposeException,
NPyIException,
)
BASE_URI = "https://npiregistry.cms.hhs.gov/api/"
VALID_SEARCH_P... | StarcoderdataPython |
1678645 | <filename>scripts/copy_playlist_media.py
#!/usr/bin/env python
"""
#
# By: <NAME> [code at charlesbrandt dot com]
# On: *2013.06.05
# License: MIT
# Requires:
# medley, moments
# Description:
#
# be sure to edit source_root and destination_root before running, then run:
cd ~/public/repos/medley/scripts
python copy... | StarcoderdataPython |
3392669 | #!/usr/bin/env python3
def createPeg():
from Peg import Peg
return Peg()
| StarcoderdataPython |
3302112 | import pytest
import shutil
from pathlib import Path
import pypipegraph as ppg
import mbf_align
import pysam
from mbf_qualitycontrol.testing import assert_image_equal
from mbf_sampledata import get_sample_data, get_sample_path
from mbf_qualitycontrol import prune_qc, get_qc_jobs
class DummyGenome:
name = "Dummy_g... | StarcoderdataPython |
3387776 | <reponame>pre-srn/linux_patch_mngmt<gh_stars>0
import ast
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_celery_results.models import TaskResult
class SSHProfile(models.Model):
user = models.On... | StarcoderdataPython |
1765898 | import json
from unittest import mock
import pytest
from powerlibs.aws.sqs.dequeuer import SQSDequeuer
def make_a_message(payload):
return type(
'MockedMessage',
(object,),
{
'body': """{"Type" : "Notification",
"MessageId" : "5236f865-61b8-5882-ba1b-a91938a3b... | StarcoderdataPython |
119743 | <reponame>spring-2019-csc-226/a03-master
################################################################################
# Author:<NAME>
# Username:vankirkj
#
# Assignment:A03
# https://docs.google.com/document/d/1upvTP9Z7BehzY-HqRqI9Uh2F3cD19rZi_MtArv0Tn_M/edit?usp=sharing
############################################... | StarcoderdataPython |
4842108 | <filename>apps/post/migrations/0004_tpost_uuid.py
# Generated by Django 3.1.4 on 2021-01-14 21:10
import uuid
from django.db import migrations, models
def create_uuid(apps, schema_editor):
TPost = apps.get_model("post", "TPost")
for t_post in TPost.objects.all():
t_post.uuid = uuid.uuid4()
t... | StarcoderdataPython |
4838645 | import FWCore.ParameterSet.Config as cms
HITrackCorrections = cms.EDAnalyzer('HITrackCorrectionAnalyzer',
trackSrc = cms.InputTag("hiGeneralTracks"),
vertexSrc = cms.InputTag("hiSelectedVertex"),
pfCandSrc = cms.InputTag("particleFlowTmp"),
jetSrc = cms.InputTag("akPu4CaloJets"),
tpEffSrc = cms.In... | StarcoderdataPython |
3272682 | # coding: utf-8
l2i_dic = {"S":0, "B":1, "M":2, "E":3, "<pad>":4, "<start>":5, "<eos>":6}
i2l_dic = {0:"S", 1:"B", 2:"M", 3:"E", 4:"<pad>", 5:"<start>", 6:"<eos>"}
# 超参
max_length = 150
batch_size = 24
epochs = 10
tagset_size = len(l2i_dic)
use_cuda = False
# 路径
# train_file = './data/train.txt'
# dev_file = './dat... | StarcoderdataPython |
3331716 |
import torch
import torch.nn as nn
import numpy as np
import os
from geometric import geometricMeasures
from training import trainingProcedure
from dataloader import load_data
from utils import yield_sub_params, geometricDataLoader
import argparse
import time
if __name__ == '__main__':
parse... | StarcoderdataPython |
1671818 | <gh_stars>0
import json
from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
fr... | StarcoderdataPython |
1646147 | <reponame>floriangrabner/ComplexAlgebra<gh_stars>0
from scr.ComplexAlgebra import ComplexNumber
if __name__ == '__main__':
z = ComplexNumber(7, -2)
z = z.conjugate()
if z.real != 7:
raise TypeError('Real part is corrupt')
elif z.imaginary != 2:
raise TypeError('Imaginary part is corru... | StarcoderdataPython |
1612576 | <reponame>peterwetherall/waitfor
import subprocess
#Use a unique prefix here to enable two senders and listeners to operate over the same network
#The prefix must match that used by the listener script
prefix = "1100"
while True:
data = str(input("Enter a message to send: ")).lower()
datt = ""
pr... | StarcoderdataPython |
3236003 | <reponame>harshp8l/deep-learning-lang-detection<gh_stars>10-100
from repository.repoSt import repoSt
from repository.repoA import repoA
from repository.memory import inMemory
from repository.fileSt import fileRepoSt
from repository.fileA import fileRepoA
from domain.validators import validateStudent, validateAssignment... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.