id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6545762 | <gh_stars>10-100
#
#
# import pytest
#
# from gpmap import GenotypePhenotypeMap
# from epistasis.models import EpistasisLinearRegression
# from ..bayesian import BayesianSampler
#
# @pytest.fixture
# def model():
# """Create a genotype-phenotype map"""
# wildtype = "000"
# genotypes = ["000", "001", "010",... | StarcoderdataPython |
9601551 | from output.models.ibm_data.valid.s3_16_2.s3_16_2v05_xsd.s3_16_2v05 import Root
__all__ = [
"Root",
]
| StarcoderdataPython |
1630292 | class Solution:
def checkStraightLine(self, coordinates: list) -> bool:
last_x, last_y = coordinates[-1]
first_x, first_y = coordinates[0]
vertical = False
slope = 0
if last_x == first_x:
vertical = True
else:
slope = (last_y - first_y) / (last... | StarcoderdataPython |
1783421 | from loader.redis import Redis
def running_jobs_count():
redis = Redis()
job_list_from_redis = redis.connect.lrange("running_jobs", 0, -1)
count = len(job_list_from_redis)
if count > 0:
return count
return None | StarcoderdataPython |
6667049 | <reponame>ImAlexisSaez/curso-python-desde-0<filename>lecciones/18/bucles_3.py
class mi_clase:
pass # A implementar más tarde
| StarcoderdataPython |
8159629 | #!/usr/bin/env python3
import gzip
import pysam
from Bio import SeqIO
from collections import Counter, defaultdict
import scipy.stats as stats
import operator
import pandas as pd
import argparse
import sys
def main ():
parser = argparse.ArgumentParser(description='somatic var caller')
required = parser.add_a... | StarcoderdataPython |
1811133 | <gh_stars>1-10
#!flask/bin/python
import os.path
from flask_ui import db
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_... | StarcoderdataPython |
1858035 | import StringIO
import sqlite3
def get_schema(db_path):
conn = sqlite3.connect(db_path)
c = conn.cursor()
c.execute('SELECT * from sqlite_master')
schema_file = StringIO.StringIO()
for row in c.fetchall():
schema_file.write('|'.join(row) + '\n')
return schema_file.read()
def compare(... | StarcoderdataPython |
3408268 | <reponame>ubersan/pylic
from unittest.mock import MagicMock
import pytest
from pytest_mock import MockerFixture
from pylic.cli import console_reader as console_reader_module
from pylic.cli.console_reader import ConsoleReader
@pytest.fixture
def console_writer(mocker: MockerFixture) -> MagicMock:
return mocker.p... | StarcoderdataPython |
1891836 | <reponame>helium/helium-python<gh_stars>10-100
from __future__ import unicode_literals
import os
import sys
import pytest
# from betamax import Betamax
# from betamax_serializers import pretty_json
# from betamax_matchers import json_body
from vcr import VCR
import helium
collect_ignore = []
if sys.version_info < (... | StarcoderdataPython |
11331661 | <reponame>NREL/K_Road<filename>scenario/road/__init__.py
from .road_baseline import RoadBaseline
from .road_goal_rewarder import RoadGoalRewarder
from .road_observer import RoadObserver
from .road_process import RoadProcess
from .road_rewarder import RoadRewarder
from .road_terminator import RoadTerminator
# from .car... | StarcoderdataPython |
3588114 | <filename>anubis/saver.py
"Base document saver context classes."
import copy
import os.path
import flask
import anubis.user
from anubis import constants
from anubis import utils
class BaseSaver:
"Base document saver context."
DOCTYPE = None
HIDDEN_FIELDS = []
def __init__(self, doc=None):
... | StarcoderdataPython |
3320340 | <gh_stars>0
from abc import ABC, abstractmethod
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.common.exceptions import WebDriverException
from typing import Union
from fdap.utils.loggeradapter import LoggerAdapter
from fdap.contracts.blog_client import BlogLoginInfo
class WebDriverHandler(AB... | StarcoderdataPython |
69799 | <filename>huaweicloud-sdk-iotda/huaweicloudsdkiotda/v5/model/task.py<gh_stars>0
# coding: utf-8
import pprint
import re
import six
class Task:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): T... | StarcoderdataPython |
1916454 | <gh_stars>1-10
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classe... | StarcoderdataPython |
9772202 | <reponame>minrk/distributed
from __future__ import print_function, division, absolute_import
import sys
if sys.version_info[0] == 2:
from Queue import Queue
reload = reload
if sys.version_info[0] == 3:
from queue import Queue
from importlib import reload
try:
from functools import singledispatc... | StarcoderdataPython |
6687152 | # https://leetcode.com/problems/finding-pairs-with-a-certain-sum
class FindSumPairs:
def __init__(self, nums1, nums2):
self.nums1 = nums1
self.nums2 = nums2
self.nums2_freq = Counter(nums2)
def add(self, index, val):
self.nums2_freq[self.nums2[index]] -= 1
self.nums2[in... | StarcoderdataPython |
5083432 | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import mock
import pytest
from datadog_checks.dev.errors import ManifestError
from datadog_checks.dev.tooling.release import get_agent_requirement_line, get_folder_name, get_package_name
def test_get_pa... | StarcoderdataPython |
5138948 | import struct
from . import commands as cmd
from . import Request, Response
from .exceptions import *
from .datalog import *
import logging
import ctypes
class Protocol:
class AddressFormat:
def __init__(self, nbits):
PACK_CHARS = {
8 : 'B',
16 : 'H',
... | StarcoderdataPython |
11316708 | <filename>environment/super_environment.py
# if you want to make new environment , you should inherit this class
import random
import math
import constant
class Environment:
def __init__(self, size_x, size_y):
self.screen_size_x = size_x
self.screen_size_y = size_y
@staticmethod
def envir... | StarcoderdataPython |
1614433 | #Responsáveis: <NAME> e Raphael
import os
import socket
import thread
votacao = [0]*8
pre = '<NAME> (13) / <NAME> (17) / Branco (B)'
gov = '<NAME> (25) / <NAME> (20) / Branco (B)'
HOST = '127.0.0.1'
PORT = 5000
def pegar_dados_conexao():
global HOST, PORT
print 'Informe o host do TRE'
HOST = raw_input()
... | StarcoderdataPython |
8096889 | <gh_stars>0
import logging
from ...orders.manual.clients import ManualOrderClient
from ...orders.manual.models import ManualOrderPosition, ManualOrder
from ...session.clients import SessionClient
from requests_tracker.session import IWebSession
logging.getLogger(__name__).addHandler(logging.NullHandler())
def get_c... | StarcoderdataPython |
1898969 | # Generated by Django 3.2.4 on 2021-07-06 14:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('spaces', '0012_alter_spaces_options'),
]
operations = [
migrations.CreateModel(
name='ContactUs',
fields=[
... | StarcoderdataPython |
207669 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
fMRIprep reports builder
^^^^^^^^^^^^^^^^^^^^^^^^
"""
import json
import re
import os
import jinja2
from niworkflows.nipype.utils.filemanip import loadc... | StarcoderdataPython |
1750460 | #!/usr/bin/env python
#
# Copyright (c) 2019 Opticks Team. All Rights Reserved.
#
# This file is part of Opticks
# (see https://bitbucket.org/simoncblyth/opticks).
#
# 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... | StarcoderdataPython |
3276747 | <filename>Tmunu_analysis/rewrite_Tmunu.py<gh_stars>0
import re
import h5py
import scipy.stats
# import from __init__.py
from . import *
########################################################################
print(f'\nsearch TmunuTAU.dat or job_# in this folder: {folder}')
B_final,files_final = search_Tmunu... | StarcoderdataPython |
8156003 | <gh_stars>10-100
"""Custom template tags for email"""
from dateutil.parser import parse
from django import template
register = template.Library()
@register.filter
def parse_iso(value):
"""
Parses an iso datetime string into a datetime object
Args:
value (str): datetime str
Returns:
... | StarcoderdataPython |
9688207 | #!/usr/bin/env python
from unicodedata import name
import sys
if len(sys.argv) > 1:
query = sys.argv[1:]
else:
query = input('search words: ').split()
query = [s.upper() for s in query]
count = 0
for i in range(20, sys.maxunicode):
car = chr(i)
descr = name(car, None)
if descr is None:
co... | StarcoderdataPython |
8007316 | <filename>PythonTests/Vectors/Generation/Generate.py
#pylint: disable=unused-import
#Merit.
import PythonTests.Vectors.Generation.Merit.BlankBlocks
import PythonTests.Vectors.Generation.Merit.StateBlocks
#Transactions.
import PythonTests.Vectors.Generation.Transactions.ClaimedMint
import PythonTests.Vectors.Generatio... | StarcoderdataPython |
6478275 | from datetime import datetime
from django.urls import reverse
from django.test import TestCase
from django.utils.crypto import get_random_string
from prometheus_client.parser import text_string_to_metric_families
from zentral.conf import settings
from zentral.core.incidents.models import Incident, MachineIncident, Seve... | StarcoderdataPython |
1637437 | <gh_stars>100-1000
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/gaogaotiantian/watchpoints/blob/master/NOTICE.txt
import atexit
from .watch import Watch
__version__ = "0.2.5"
all = [
"watch",
"unwatch"
]
watch = Watch()
unwatch = watch.... | StarcoderdataPython |
3546246 | import pymysql.cursors
class DBhelper:
# __cnx_kwargs = {
# 'host': "192.168.10.53",
# 'user': "mysql",
# 'password': "password",
# 'database': "ntest",
# 'port': 3306,
# 'charset': 'utf8',
# }
__database_config = {}
__conn = None
def __init__(self,... | StarcoderdataPython |
1002 | <reponame>davidtahim/Glyphs-Scripts<filename>Components/Align All Components.py
#MenuTitle: Align All Components
# -*- coding: utf-8 -*-
__doc__="""
Fakes auto-alignment in glyphs that cannot be auto-aligned.
"""
import GlyphsApp
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # a... | StarcoderdataPython |
8126029 | <gh_stars>10-100
import multiprocessing
import os
import codecs
import copy
import time
import tensorflow as tf
from nsm import agent_factory
from nsm import data_utils
from table.utils import init_experiment, FLAGS, get_train_shard_path, get_init_model_path, load_programs
from table.utils import get_experiment_dir,... | StarcoderdataPython |
8049061 | #!/usr/bin/env python
import anyjson
import atexit
import hashlib
import multiprocessing
import os
import urllib
import subprocess
import sys
def twitter_stream(username, password, handler, **kwargs):
qs = urllib.urlencode(kwargs)
pipe_path = '/tmp/twitter_stream_%s' % hashlib.md5(qs).hexdigest()
if not os... | StarcoderdataPython |
4821229 | from django.apps import AppConfig
class ApiCommentsConfig(AppConfig):
name = 'api_comments'
| StarcoderdataPython |
219703 | <gh_stars>0
from array import array
import unittest
import hypothesis.strategies as st
from hypothesis import given
from Reversort_Engineering import func, func_rev
class Test(unittest.TestCase):
def test_1(self):
array = func(0, 4, 6)
array = array[array.index(":") + 1 :]
array = [int(i) ... | StarcoderdataPython |
4849371 | import shutil
from ..error_state import HasErrorState
from ...lib.ci_exception import CiException
from ...lib.utils import make_block
from ..project_directory import ProjectDirectory
__all__ = [
"BaseDownloadVcs",
"BaseSubmitVcs",
"BasePollVcs"
]
class BaseVcs(ProjectDirectory):
"""
Base class f... | StarcoderdataPython |
1871582 | <filename>tests/test_PanOScomp.py
import pytest
from panos import PanOSVersion
@pytest.mark.parametrize(
"panos1, panos2",
[
("6.1.0", "6.1.0"),
("0.0.0", "0.0.0"),
("7.3.4-h1", "7.3.4-h1"),
("3.4.2-c5", "3.4.2-c5"),
("4.4.4-b8", "4.4.4-b8"),
],
)
def test_gen_eq(p... | StarcoderdataPython |
4984852 | <reponame>Tombmyst/Empire
from empire.core import *
from abc import ABC, abstractmethod
from empire.strings.casing import WordCasing
class AbstractStruct(ABC):
"""
Abstract class for struct. Used as a "forward declaration" in other classes, where if the actual Struct module would be imported, it woul... | StarcoderdataPython |
11274714 | import hydra
from src.train import train
from omegaconf import DictConfig
@hydra.main(config_path="configs", config_name="defaults")
def main(cfg : DictConfig) -> None:
train(cfg)
if __name__ == '__main__':
main() | StarcoderdataPython |
6519548 | <reponame>seluciano/instagram-scrapping-server
from celery import shared_task
from instanew2 import Insta
from dm import sendDM
from .models import Account
@shared_task
def add(x, y):
return x + y
@shared_task
def create_account(d, proxy):
a = Insta(d, proxy)
a.generate()
print('--------- task us... | StarcoderdataPython |
3384147 | # Generated by Django 2.0.2 on 2018-08-31 09:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
def forwards(apps, schema_editor):
FundingSource = apps.get_model('funding', 'FundingSource')
Publication = apps.get_model('funding', 'Publication')
... | StarcoderdataPython |
6559265 | <filename>test/test_control_utils.py
# coding=utf-8
"""
Tests for the control_utils module.
"""
import os
import unittest
import control
import matplotlib.pyplot as plt
import pyulog
import sympy
import ulog_tools as ut
TEST_LOG_URL = "https://logs.px4.io/download?log=0467b169-aec0-44d0-bbd0-a42cce863acf"
TEST_DIR ... | StarcoderdataPython |
8190541 | <gh_stars>0
#!/usr/bin/env python3
"""Less than or equal to zero.
Is the Number Less than or Equal to Zero?
Create a function that takes a number as its only argument and returns
True if it's less than or equal to zero, otherwise return False.
Source:
https://edabit.com/challenge/Rx2pkSA9dCmtwS8xt
"""
def less_th... | StarcoderdataPython |
11366065 | <reponame>HICAS-ChameLeon/Chameleon
from __future__ import print_function
import collectingData, util
# flink_home = util.getFlinkHome()
slaves = util.getSlaves()
if __name__ == '__main__':
for i in range(1):
confValue = collectingData.makeRandomConfig()
# collectingData.write2Configure(confValue)... | StarcoderdataPython |
3526460 | <filename>065.py
# Convergents of e
# Problem 65
# https://projecteuler.net/problem=65
import datetime
start_time = datetime.datetime.now()
numerator = 1
denominator = 1
iCount = 0
denominators = []
denominators.append(2)
start = 98
j = 0
for i in range (33):
j += 2
denominators.append(1)
denominators.... | StarcoderdataPython |
11254536 | from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework.permissions import AllowAny
@api_view(["GET", "HEAD"])
@permission_classes([AllowAny])
def index(request):
return Response(status=204)
| StarcoderdataPython |
6421174 | from kokoropy import load_view, base_url, request, publish_methods, load_template, \
application_path, file_get_contents
from sqlalchemy.ext.declarative import declared_attr
import math, random, os, json, sys
from model import DB_Model
from operator import and_, or_
from kokoropy import var_dump
class Multi_Langua... | StarcoderdataPython |
6520412 | from flask import Blueprint
postsBP = Blueprint('postsBlueprint', __name__)
postsAdminBP = Blueprint('postsAdminBlueprint', __name__)
postsApiBP = Blueprint('postsAPIBlueprint', __name__)
from . import views,admin,api
| StarcoderdataPython |
8007857 | <gh_stars>1-10
import sqlite3
class SQL:
'''Provides an easy-to-use library for dealing with the database within the project'''
def __init__(self, filename) -> None:
self._conn = sqlite3.connect(filename)
self._c = self._conn.cursor()
def add(self, id) -> bool:
"""
Add a ... | StarcoderdataPython |
6463011 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# File: __init__.py.py
# Author: Zhangzhijun
# Date: 2021/2/12 18:32
from flask import Blueprint
bp_admin = Blueprint('bp_admin', __name__, url_prefix='/admin', template_folder='../templates/admin/',
static_folder='../static')
from .category import *
from .... | StarcoderdataPython |
338676 | #!/usr/bin/env python
import os
import sys
from I3Tray import *
from os.path import expandvars
import argparse
parser = argparse.ArgumentParser(description = "Propagates photons with ppc.")
parser.add_argument('gpu', type = int)
parser.add_argument('nevents', type = int)
parser.add_argument('seed', type = int, def... | StarcoderdataPython |
3341716 | <filename>mck_init/setup.py
from setuptools import setup
setup(name='mck_init',
version='0.1',
description='Initialised mck secrets',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['mck_init'],
zip_safe=False)
| StarcoderdataPython |
38817 | <filename>gefen-hdsdi2dvi.py
#!/usr/bin/python
import fcntl
import struct
import sys
import termios
import time
import math
import os
class SerialPort(object):
def __init__(self, tty_name):
self.tty_name = tty_name
self.tty = None
self.old_termios = None
self.InitTTY()
def __del__(self):
if s... | StarcoderdataPython |
3226936 | <reponame>dlindem/ahotsak-wikibase<filename>herriak_ahotsak_parsehtml.py
import config
import awb
import csv
import json
import requests
import re
emapping = {
"ekialdeko-nafarra": "Q752",
"erronkarikoa": "Q753",
"zaraitzukoa": "Q754",
"erdialdekoa-gipuzkera": "Q755",
"erdigunekoa-g": "Q756",
"beterrikoa": "Q757",
"to... | StarcoderdataPython |
8031594 | <gh_stars>0
import math
import numpy as np
from logger import logger
def gaussian(x, mu, sigma):
coeff = 1/(2*math.pi*sigma**2)**0.5
power = (-(x - mu)**2)/(2*sigma**2)
return coeff * math.exp(power)
def get_normal_vector(points: np.ndarray):
"""
Note: Direction of normal vector depends on right h... | StarcoderdataPython |
1790654 | <gh_stars>0
# -*- coding: utf-8 -*-
# ====================================== #
# @Author : <NAME>
# @Email : <EMAIL>
# @File : calculation_state.py
# ALL RIGHTS ARE RESERVED UNLESS STATED.
# ====================================== #
import glob
import pathlib
import re
import shutil
from collections import Counter... | StarcoderdataPython |
9684475 | """Field accessors."""
from __future__ import annotations
from dataclasses import dataclass, Field as _Field
from typing import Any, NamedTuple
from dcorm.engine import Engine
from dcorm.expression import Expression
from dcorm.expression_base import ExpressionBase
from dcorm.literal import unary
from dcorm.ordering i... | StarcoderdataPython |
9685029 | '''
I can't write a function to save my life but this is my best work to date.. bascially I wanted to
make doc-term matrix(s) where we have terms used vs. documents or vocab banks to showcase term
frequency and attempt a tfidf weighted score across all terms(minus stopwords). I only did two for
protests and battle e... | StarcoderdataPython |
12855187 | <gh_stars>0
#!/usr/bin/env python
import argparse
import json
import jinja2
import webbrowser
import graph
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('groups', help='json file describing seed groups')
args = parser.parse_args()
# load group from file
with o... | StarcoderdataPython |
6533451 | <filename>config/common.py
# -*- coding: utf-8 -*-
DOMAIN_NAME = 'http://erp.spocoo.com' | StarcoderdataPython |
5013872 | ss=str(input())
print(ss.count("1"))
| StarcoderdataPython |
12839265 | <reponame>stared/wizualizacja-wolnych-lektur
import requests
from collections2 import Counter
import simplejson as json
import re
books = json.load(open("books2.json"))
color_stem = json.load(open("stemmizer_kolory.json"))
colors = json.load(open("kolory_nowe.json"))
def root_word(word, stem_dict):
if word in s... | StarcoderdataPython |
5118045 | <filename>bch.py
#!/usr/bin/env python3
# bch.py - A Bitcoin Cash utility library
# Author: <NAME> <<EMAIL>>
# This program is free software, released under the Apache License, Version 2.0. See the LICENSE file for more information
import urllib.request
import json
import random
import sys
import datetime
import loggi... | StarcoderdataPython |
8074361 | <reponame>Argeniss-Software/rolaguard_engine
from utils.AlertGenerator import emit_alert
from utils.Chronometer import Chronometer
from utils.PolicyManager import PolicyManager | StarcoderdataPython |
1857286 | from django.test import TestCase
from imager_profile.models import ImagerProfile, User
import factory
class UserFactory(factory.django.DjangoModelFactory):
"""Create a new user from factory boy."""
class Meta:
"""Meta class is used to change factory boy settings."""
model = User
username... | StarcoderdataPython |
1864271 | import os
import subprocess
import psycopg2
def import_shapefiles(files):
# create intermediate shape tables
for f in files:
cmd = f"shp2pgsql -s 25832 -g geom -e -S -t 2D -N skip {os.path.join(base_path, f)}.shp public.geom_tmp_{f} | psql -d dop10rgbi_nrw -q"
print(cmd)
subprocess.run... | StarcoderdataPython |
11396388 | """Tests for the Philips TV integration."""
MOCK_SERIAL_NO = "1234567890"
MOCK_NAME = "Philips TV"
MOCK_SYSTEM = {
"menulanguage": "English",
"name": MOCK_NAME,
"country": "Sweden",
"serialnumber": MOCK_SERIAL_NO,
"softwareversion": "abcd",
"model": "modelname",
}
MOCK_USERINPUT = {
"host... | StarcoderdataPython |
1875921 | batters = ['Alma', 'Connie', 'Sylvia']
for at_bat in batters:
print(at_bat + ' at bat')
| StarcoderdataPython |
8095865 | <reponame>interactions-py/voice<gh_stars>0
# -*- coding: utf-8 -*-
from setuptools import setup
packages = ["voice"]
package_data = {"": ["*"]}
install_requires = [
"PyNaCl>=1.5.0,<2.0.0",
"discord-py-interactions @ " "git+https://github.com/interactions-py/library.git@4.1.1-rc.1",
]
setup_kwargs = {
"n... | StarcoderdataPython |
1929685 | <filename>tests/test_problem22.py
import unittest
from problems.problem22 import solution
class Test(unittest.TestCase):
def test(self):
self.assertEqual(solution('ADOBECODEBANC', 'ABC'), 'BANC')
self.assertEqual(solution('a', 'a'), 'a')
| StarcoderdataPython |
8081660 | <reponame>byrobot-python/e_drone_examples
# 이륙, 호버링, 1미터 전진, 1미터 오른쪽 이동, 리턴 홈 테스트
from time import sleep
from e_drone.drone import *
from e_drone.protocol import *
def wait(message, time):
print("{0} / ".format(message), end="")
for i in range(time, 0, -1):
print("{0} ".format(i), end="")
... | StarcoderdataPython |
165778 | <gh_stars>0
import argparse
import os
from rama import constants, rama_config, runner
from run_modes import cluster_run, parallel_run, serial_run, single_run, utils
MAIN_FILE_PATH = os.path.dirname(os.path.realpath(__file__))
parser = argparse.ArgumentParser()
parser.add_argument("--mode", metavar="-M", required=Tr... | StarcoderdataPython |
19781 | from typing import Callable
import numpy as np
from constants.constants import IndicatorType
from strategy.base import BaseStrategy
class OverReactStrategy(BaseStrategy):
def trade_by_indicator(
self, indicator_type: IndicatorType) -> Callable[[], np.ndarray]:
""" Get trading strategy functi... | StarcoderdataPython |
9726798 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... | StarcoderdataPython |
3468595 | import argparse
import torch
from train_model import CNNModel
def loader():
parser = argparse.ArgumentParser(description="Evaluation arguments")
parser.add_argument("load_model_from", default="")
parser.add_argument("load_data_from", default="")
# add any additional argument that you want
args =... | StarcoderdataPython |
5146385 | import numpy as np
def produce_random_numbers(k, n, m):
matrix_a = np.random.randint(-1e3, 1e3, (k,n,m))
matrix_b = np.random.randint(-1e3, 1e3, (k,n,m))
np.savetxt("values_a.txt", matrix_a.reshape(k,-1), fmt='%1.1i', delimiter=' ')
np.savetxt("values_b.txt", matrix_b.reshape(k,-1), fmt='%1.1i', delim... | StarcoderdataPython |
284002 | import boto3
from .base import Key, is_none, Map, Optional, UUID
class DynamoMap(Map):
def open(self):
self._db = self._config.dynamodb
table_query = self._db.list_tables(
ExclusiveStartTableName=self._config.table[:-1],
Limit=1
)['TableNames']
table_exists... | StarcoderdataPython |
8050735 | #!/usr/bin/env python
#
# Copyright 2019 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Check the DEPS file for correctness."""
import os
import re
import subprocess
import sys
import utils
INFRA_BOTS_DIR = os.path.dirname(os.path.realpath(__... | StarcoderdataPython |
5034777 | # Copyright 2009-2012 Yelp and Contributors
#
# 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 i... | StarcoderdataPython |
4894332 | default_value_file_yaml = \
'name_app: My first app'
default_value_file_json = \
'{\n' + \
' "name_app": "My first app",\n' + \
'}'
default_template_yaml = \
'name: {{ Values.name_app}}\n' +\
'description: my first app\n' +\
'settings:\n' +\
' app: {}\n'
default_template_json = \
'{\n' +\
' "name": "{... | StarcoderdataPython |
9794956 | <gh_stars>0
import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.wrappers.scikit_learn import KerasClassifier
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping
#from keras import models
from sklearn.pipeline ... | StarcoderdataPython |
1998177 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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://w... | StarcoderdataPython |
6540030 | from lib import action
from jenkins import NotFoundException
class StopBuild(action.JenkinsBaseAction):
def run(self, project, number, config_override=None):
if config_override is not None:
self.config_override(config_override)
try:
return self.jenkins.stop_build(project, n... | StarcoderdataPython |
1918011 | <filename>snipar/gwas.py
import h5py
import numpy as np
from bgen_reader import open_bgen
from pysnptools.snpreader import Bed
from scipy.stats import chi2
from math import log10
import snipar.read as read
import snipar.lmm as lmm
from snipar.utilities import *
from numba import njit, prange
from snipar.preprocess impo... | StarcoderdataPython |
4838101 | # =============================================================================
# PROJECT CHRONO - http://projectchrono.org
#
# Copyright (c) 2014 projectchrono.org
# All rights reserved.
#
# Use of this source code is governed by a BSD-style license that can be found
# in the LICENSE file at the top level of the distr... | StarcoderdataPython |
128293 | <gh_stars>0
import os
try:
os.mkdir("data")
except FileExistsError:
print("Der Ordner data existiert bereits!")
try:
f = open("data/subdomains.txt", "r")
f.read()
f.close()
except FileNotFoundError:
print("Du must zuerst die Datei: subdomains.txt herunterladen! Kopiere sie nun in d... | StarcoderdataPython |
8197122 | """ Clean up NN regression outputs """
import os
import sys
from glob import glob
from sysnet.sources import tar_models
model_path = sys.argv[1]
models = glob('{}'.format(os.path.join(model_path, 'model_*_*')))
print(f'# models: {len(models)}')
if len(models) < 1:
exit('no file found!')
print(models[0], models[... | StarcoderdataPython |
5054410 | teams_list = [
{'name': 'Illinois', 'nickname': '<NAME>', 'id': '356', 'code': 'ILL'},
{'name': 'Indiana', 'nickname': 'Hoosiers', 'id': '84', 'code': 'IU'},
{'name': 'Iowa', 'nickname': 'Hawkeyes', 'id': '2294', 'code': 'IOWA'},
{'name': 'Maryland', 'nickname': 'Terrapins', 'id': '120', 'code': 'MD'},
... | StarcoderdataPython |
327310 | # -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-06-14 05:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dynamic_scraper', '0022_added_option_for_scraper_work_status'),
]
operations = [
... | StarcoderdataPython |
292336 | # Copyright 2017 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
1940028 | <filename>quotes/migrations/0002_auto_20200721_1233.py<gh_stars>0
# Generated by Django 3.0.8 on 2020-07-21 19:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quotes', '0001_initial'),
]
operations = [
migrations.DeleteModel(
... | StarcoderdataPython |
1844013 | import datetime
import json
import re
import requests
from django.conf import settings
from django.contrib.auth import get_user_model, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy, reverse
from django.http ... | StarcoderdataPython |
8144837 | #!/usr/bin/env python
'''Add a URL to (or just open) Google bookmarks.'''
from HTMLParser import HTMLParser
from urllib import urlopen, urlencode
import webbrowser
class TitleParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.title = ''
self.in_title = False
def i... | StarcoderdataPython |
9669665 | <gh_stars>1-10
# shotglass.urls
# from django.conf.urls import include, url
# from django.contrib import admin
# urlpatterns = [
# url(r'^$', views.index)
# # url(r'^/', include('app.urls')),
# # url(r'^/beer', include('app.urls')),
# # url(r'^admin/', include(admin.site.urls)),
# ]
| StarcoderdataPython |
4910023 | <reponame>frdedynamics/ik_solver_test
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# """
# This is the main node calculating robot's joint angles based on given Pose().
# """
import rospy
from Classes.ik_solver_class_ur5e import IKSolver
from geometry_msgs.msg import Vector3
if __name__ == "__main__":
iksolver = I... | StarcoderdataPython |
9654288 | #!/usr/bin/env python
import os, sys
sys.path.append(os.pardir)
import unittest
import filecmp
from satbang_rst import SatBangRst
#.......................................................................
class SatbangTest(unittest.TestCase):
def test_append_duplicate(self):
"Append_zero_record() should f... | StarcoderdataPython |
11302212 | from commands import Command
import doomrl
import os
class DeleteCommand(Command):
"""delete <game> -- delete a game in progress.
Delete the save file and recording associated with an in-progress game. Unlike
loading the game and then committing suicide, this doesn't result in a high
score entry -- the game i... | StarcoderdataPython |
3509757 | <reponame>jayvdb/triton
from triton.dns.message import Answer
from triton.dns.message.rdata import OPT
class Edns:
class _Binary:
def __init__(self, edns):
self.edns = edns
_version = 1
udp_size_limit = 4096
dnssec = False
def __init__(self, message):
self.message = m... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.