id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4924330 | <gh_stars>10-100
from .subscriptions import Subscriptions
from .settings import Settings
| StarcoderdataPython |
5177374 | <filename>limix_legacy/test/lmm_lasso/test_lmmlasso.py
"""Variance Decomposition testing code"""
import unittest
import scipy as SP
import numpy as np
import scipy.stats
import pdb
import os
import sys
import limix_legacy.deprecated as dlimix_legacy
import limix_legacy.deprecated.modules.lmmlasso as lmmlasso
from limix... | StarcoderdataPython |
8027978 | <filename>cf/267c.py
#!/usr/bin/env python
from sys import stdin
def arg(n, cap):
d = [n]*n
d[0] = 0
p = [i for i in range(n)]
q = [0]
while len(q) > 0:
i = q[0]
del q[0]
for j in range(n):
if cap[i][j] > 0 and d[i] + 1 < d[j]:
d[j] = d[i] + 1
p[j] = i
q.append(j)
... | StarcoderdataPython |
8100405 | <gh_stars>10-100
__all__ = ["dataset", "utils"]
| StarcoderdataPython |
3425963 | <filename>RL/src/bundle_entropy.py
import numpy as np
def logistic(x):
return 1. / (1. + np.exp(-x))
def logexp1p(x):
""" Numerically stable log(1+exp(x))"""
y = np.zeros_like(x)
I = x>1
y[I] = np.log1p(np.exp(-x[I]))+x[I]
y[~I] = np.log1p(np.exp(x[~I]))
return y
def proj_newton_logistic(... | StarcoderdataPython |
5111524 | from extruder_turtle import ExtruderTurtle
import math
## Parameters for the spiral
N = 40 ## Number of subdivisions of one round-trip
radius = 20 ## Outer radius of the spiral
dtheta = 2*math.pi/N ## Change in heading after each step
dx = radius * dtheta ## Forward movement during ea... | StarcoderdataPython |
1686985 | <reponame>hugorodgerbrown/django-visitor
from __future__ import annotations
import functools
import logging
from typing import Any, Callable
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.http.response import HttpResponseRedirect
from django.urls import reverse
from dja... | StarcoderdataPython |
4926174 | """
Save and plot the final MGRIT approximation of the solution
Note: This example assumes a sequential run of the simulation.
"""
import pathlib
import numpy as np
import matplotlib.pyplot as plt
from pymgrit.dahlquist.dahlquist import Dahlquist
from pymgrit.core.simple_setup_problem import simple_setup_problem
fro... | StarcoderdataPython |
235109 | <reponame>vladshablinsky/algo<gh_stars>1-10
import random
import string
N = 8
ALPH = 'abc'
ans = ''
print(N)
for i in range(N):
ans += random.choice(ALPH)
print(ans)
| StarcoderdataPython |
12812014 | from flask import Blueprint
bp = Blueprint("download", __name__)
from app.download import routes
| StarcoderdataPython |
11256313 | import argparse
import re
import numpy as np
import pandas as pd
from sklearn.datasets import fetch_20newsgroups
from sklearn.model_selection import train_test_split
from amep import const
from amep.commands.make_dataset.util import cleaner, make_count_vectorizer_based_vocab
from amep.common.util import filter_by_len... | StarcoderdataPython |
4882553 | <reponame>TaprisSugarbell/Bo.py-Test
from modles.gen import *
from modles.pytb import *
from telegram import InlineKeyboardMarkup, InlineKeyboardButton
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler,ConversationHandler, MessageHandler, Filters
def start(update, context):
update.message.re... | StarcoderdataPython |
1707283 | <reponame>DimaDK02/tripman
from django.db import models
class Client(models.Model):
name = models.CharField(max_length=50, unique=True, verbose_name='Имя')
discount = models.IntegerField(default=0, verbose_name='Скидка (%)')
total_saved = models.IntegerField(default=0,
... | StarcoderdataPython |
1645247 | <gh_stars>1-10
import os
from ament_index_python.packages import get_package_share_directory
from ament_index_python.packages import get_package_prefix
import launch
import launch_ros.actions
def generate_launch_description():
if not "tesseract_collision" in os.environ["AMENT_PREFIX_PATH"]:
head, tail = o... | StarcoderdataPython |
3515128 | # -*- coding: utf-8 -*-
import sys
import os
import torch
import numpy as np
import random
import csv
import os
import random
from random import shuffle
from os import listdir
from os.path import join
from torch.utils.data import Dataset,DataLoader
from torchvision import transforms,utils
import torch
import torch.nn ... | StarcoderdataPython |
5160851 | <filename>src/KAOSBank_simple_triggers.py
# Banking (2.0) by Lazeras
# Released 1 December 2011
from header_common import *
from header_operations import *
from header_parties import *
from header_items import *
from header_skills import *
from header_triggers import *
from header_troops import *
from header_m... | StarcoderdataPython |
6566216 | import base64
import getpass
import re
import socket
import sys
import quopri
from conf import *
import logging
import email
CRLF = '\r\n'
TERMINATOR = CRLF + '.' + CRLF
# Searches for a particular Tag in raw message
def decode(input_str):
result = ''
search_result = re.search('=\?([^\?]*)\?([^\?]*)\?([^\?]*)\?=', ... | StarcoderdataPython |
8098609 | import sys
from spider.exam_lib.offcn_exam_lib import OffcnExamLib
from spider.exam_lib.huatu_exam_lib import HuatuExamLib
import os
def parse_arg(arg, kv):
args = arg.split('=')
if len(args) != 2:
print(arg+'参数错误')
kv[args[0]] = args[1]
def main():
argv = sys.argv
lib = argv[1]
... | StarcoderdataPython |
1780765 | def test_run_shell_command(get_v):
res = get_v.run_shell_command('uname -a')
assert res.returncode == 0
def test_get_version_list(get_v):
v_list = get_v.get_versions_list()
assert isinstance(v_list, list)
def test_get_last_version(get_v):
version_list = ['0.0.1', '0.0.2', '0.0.3']
last_v = g... | StarcoderdataPython |
5141697 | """
QuPathBinMaskImporter class
Import binary masks form QuPath - via export script
!highly experimental - pre-alpha state
@author: <NAME> / MR Cancer / MH / ISB / NTNU Trondheim Norway
<EMAIL>
"""
from typing import List
import cv2
import numpy as np
import os
from dataclasses import dataclass
# local imports
from ... | StarcoderdataPython |
8095693 | import os
from netmiko import ConnectHandler
from getpass import getpass
from pprint import pprint
# Code so automated tests will run properly
# Check for environment variable, if that fails, use getpass().
password = os.getenv("NETMIKO_PASSWORD") if os.getenv("NETMIKO_PASSWORD") else getpass()
my_device = {
"dev... | StarcoderdataPython |
9761751 | import click
import cowait.cli
@click.command(help='create a new context')
@click.argument('name', type=str, required=False)
@click.option('--image', type=str, required=False, help='image name')
@click.option('--base', type=str, required=False, help='base image name')
@click.pass_context
def new(ctx, name: str, image... | StarcoderdataPython |
11236323 | from anduin import Data
r = Data.find('user',[('id','=',1)])
# r = Data.find('user',[('ip','=',1)]) | StarcoderdataPython |
1934826 | <reponame>arccode/factory
#!/usr/bin/env python3
#
# Copyright 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for e5071c_scpi module.
Currently, the test list covered some complicated logic on auxil... | StarcoderdataPython |
4860437 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.education.doctype.student.test_student import create_student
from erpnext.education.doctype.student.test_stu... | StarcoderdataPython |
9649631 | <filename>venv/lib/python3.6/site-packages/examples/sqla/app2.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import flask_admin as admin
from flask_admin.contrib import sqla
# Create application
app = Flask(__name__)
# Create dummy secrey key so we can use sessions
app.config["SECRET_KEY"] = "1... | StarcoderdataPython |
9740256 | from app import app
from flask import render_template,request,jsonify
from flask_pymongo import PyMongo
from bson import ObjectId
mongo = PyMongo(app)
@app.route('/')
def index_page():
output = []
result = mongo.db.train_sample.aggregate([{"$sample":{"size":10 }}])
for item in result:
tweet = {
... | StarcoderdataPython |
1737928 | <gh_stars>0
#
# coding=utf-8
import os
import setuptools
#
# get the long description from the README file
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name='cmd2-ext-test',
version='0.2... | StarcoderdataPython |
3278814 | from aws_cdk import (
aws_ec2,
core
)
class Vpc(core.Construct):
def __init__(self, scope: core.Construct, id: str, **props):
super().__init__(scope, id)
#
# PARAMETERS
#
self.id_param = core.CfnParameter(
self,
"Id",
default=""... | StarcoderdataPython |
11315212 | import serial
from struct import pack
from random import randint, uniform
from secrets import token_bytes
import math
ser = serial.Serial('COM3')
while True:
strg = bytes(f'Hello, World! {randint(0, 100)} \0', 'ascii')
data = pack(f'<2h10p{len(strg)}sQd', randint(0, 10), 0, token_bytes(10), strg, ... | StarcoderdataPython |
11275865 | <filename>leads/models.py<gh_stars>1-10
from django.db import models
# Create your models here.
class Lead(models.Model):
name = models.CharField(max_length=100,verbose_name="lead名字", help_text="lead名字")
email = models.EmailField(verbose_name="邮箱", help_text="邮箱")
message = models.CharField(max_length=300,... | StarcoderdataPython |
1672391 | <filename>app/database.py<gh_stars>0
'''
Created on May 13, 2019
@author: <NAME>
'''
from flask import request
from flask_restful import Resource
from flask import current_app as app
from app import utils_common
from app import utils_db
# delete server from database
class DatabaseHandler(Resource):
def delete(s... | StarcoderdataPython |
11256641 | <reponame>dkBrazz/zserio
import unittest
import zserio
from testutils import getZserioApi
class OptionalMemberAlignmentTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.api = getZserioApi(__file__, "alignment.zs").optional_member_alignment
def testBitSizeOfWithOptional(self):
... | StarcoderdataPython |
11361650 | import logging
import os
import subprocess
from enum import Enum, auto
from typing import List
def find_files(path: str, prefix: str, extension: str = ''):
return [filename for filename in next(os.walk(path))[2]
if filename.startswith(prefix) and filename.endswith(extension)]
def find_youngest_file... | StarcoderdataPython |
8147358 | <filename>tests/version_parsing.py
import re
find_version = re.compile(r"^(?P<namever>(?P<name>.+?)-(?P<version>(\d*)(\.(a|b|rc)?\d+)?(\.(post|dev)?\d+)?))$").match
# find_version = re.compile(r"^(?P<namever>(?P<name>.+?)-(?P<version>\d.*?))$").match
print(find_version('ddvla-14.rc2.dev0').groupdict())
try:
# Th... | StarcoderdataPython |
239168 | """
Examples for error propagation
------------------------------
Hear we use the same config in `particle_amplitude.py`
"""
config_str = """
decay:
A:
- [R1, B]
- [R2, C]
- [R3, D]
R1: [C, D]
R2: [B, D]
R3: [B, C]
particle:
$top:
A: { mass: 1.86, J: 0, P: -1}
$fi... | StarcoderdataPython |
8132538 | <filename>leetcode.com/python/130_Surrounded_Regions.py
from collections import deque
# Source: https://tinyurl.com/yx859xh6
# TODO: Solve using Union-Find
class Solution(object):
def solve(self, board):
"""
:type board: List[List[str]]
:rtype: None Do not return anything, modify board in-... | StarcoderdataPython |
4986685 | <reponame>DanilooSilva/Cursos_de_Python
from dataclasses import dataclass
@dataclass
class Pessoa:
nome: str
sobrenome: str
def __post_init__(self):
self.nome_completo = f'{self.nome} {self.sobrenome}'
p1 = Pessoa('Danilo', 'Gomes')
print(p1.nome_completo) | StarcoderdataPython |
200121 | #!/usr/bin/env python3
r"""
Overview
________
This scripts converts bibliographies from RIS to BibTeX format, preserving only
relevant information. The RIS input file can be generated, for example, using
Zotero's "Quick Copy" feature (Edit > Preferences > Export). It may contain
certain Unicode characters, e.g., subs... | StarcoderdataPython |
1776853 | translate = {
'English': {
'main_title': 'Sahm',
'sub_title': 'Intelligent financial system',
'Insert_Data': 'Insert Data',
'Symbol': 'Symbol',
'Prediction_days': 'Prediction days',
'Date_Range': 'Date Range',
'Select_a_range_of_Date': 'Select a range of Date'... | StarcoderdataPython |
12858087 | <reponame>kingspp/epyodbc<gh_stars>0
# -*- coding: utf-8 -*-
"""
| **@created on:** 9/4/20,
| **@author:** prathyushsp,
| **@version:** v0.0.1
|
| **Description:**
|
|
| **Sphinx Documentation Status:**
"""
from abc import ABCMeta, abstractmethod
import json
class BaseClass(metaclass=ABCMeta):
@abstractmethod
... | StarcoderdataPython |
330715 | # -*- coding: utf-8 -*-
# @Time : 2019/5/30 14:49
# @Author : <EMAIL>
# @简介 :
# @File : orcl2Mongo.py
from fetchData import get_gps_data
from pymongo import MongoClient
from datetime import datetime, timedelta
from time import clock
def debug_time(func):
def wrapper(*args, **kwargs):
bt = clo... | StarcoderdataPython |
3365038 | tx1 = 139
tx2 = 187
ty1 = -148
ty2 = -89
min_dx = 17
max_dx = 188
min_dy = -148
max_dy = 147
max_y = 0
solutions = []
for dx in range(min_dx, max_dx + 1):
for dy in range(min_dy, max_dy + 1):
x = 0
y = 0
ndx = dx
ndy = dy
while x <= tx2 and y >= ty1:
x = x + ndx... | StarcoderdataPython |
1663289 | import random #Imported random Library
print("------------------------------------------INSTRUCTIONS------------------------------------------ \n1. Choose ODD or EVEN \n2. Enter your input for Toss between 1 to 10 \n3. If you win the toss, Opt Bat or Ball \n4. If Number matches then it's OUT \n-------------------------... | StarcoderdataPython |
9735094 | <reponame>in-rolls/indian-politician-bios
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import traceback
import argparse
import logging
import time
import re
from collections import defaultdict
import requests
from bs4 import BeautifulSoup
from csv import DictWriter
logging.getLogger("requests").setLevel(logging.WARN... | StarcoderdataPython |
366878 | import argparse
import json
import os
from glob import glob
from tqdm import tqdm
def convert_annotations_to_one_json_file_per_image(dataset_directory: str):
if len(glob(f'{dataset_directory}/**/dataset.json', recursive=True)) == 0:
print(f"Could not find json files in {dataset_directory} directory.")
... | StarcoderdataPython |
3438139 | <filename>guillotina_volto/directives.py
from guillotina.directives import Directive
class MetadataDictMergeDirective(Directive):
"""Store a dict value in the tagged value under the key.
"""
key: str
def store(self, tags, value):
tags.setdefault(self.key, {})
for key in value.keys():... | StarcoderdataPython |
1680568 | <gh_stars>0
#!/usr/bin/env python3
import http
import database
import os
import re
database = database.Database()
err = ""
redirect = ""
sql = ""
show_form = ""
nameList = []
varList = []
varLength = []
print("Content-Type: text/html\r\n\r\n");
redirect = database.check_cookie(os.environ)
if os.environ['REQUEST_M... | StarcoderdataPython |
8155735 | <filename>pipeline/main.py
from __future__ import print_function
from importlib import import_module
class StopProcessing(Exception):
pass
class Pipeline(object):
""" processes nodes passing the results of one to the next """
def __init__(self, nodes=None):
self._nodes = []
if nodes:
... | StarcoderdataPython |
12853994 | <reponame>Robinson04/inoft_vocal_framework<filename>platforms_handlers/dialogflow/request.py
from typing import Optional, List
from pydantic import Field
from pydantic.main import BaseModel
from inoft_vocal_framework.utils.formatters import normalize_intent_name
class Intent(BaseModel):
name: str
displayName... | StarcoderdataPython |
3223224 | <reponame>eriktews/canvasapi
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import requests_mock
from canvasapi import Canvas
from tests import settings
from tests.util import register_uris
@requests_mock.Mocker()
class TestContentExport(unittest.TestCase):
de... | StarcoderdataPython |
6582357 | <reponame>dehort/insights-core
import os
import tempfile
import uuid
import insights.client.utilities as util
from insights.client.constants import InsightsConstants as constants
import re
from mock.mock import patch
machine_id = str(uuid.uuid4())
remove_file_content = """
[remove]
foo = bar
potato = pancake
""".stri... | StarcoderdataPython |
3244405 | """Tests for backend module."""
import pytest
from unittest import mock
from ghmonitor.backend import (
get_backend_by_name, LoggerBackend, SelinonBackend, InvalidBackendClass
)
@mock.patch('ghmonitor.backend.init_celery')
@mock.patch('ghmonitor.backend.init_selinon')
def test_get_backend_by_name(init_celery_moc... | StarcoderdataPython |
9670164 | <filename>ratracer/simple.py
#%%
import numpy as np
from ratracer import radio
isotropic_rp = lambda a: 1.0
dipole_rp = lambda a: np.abs(np.cos(np.pi/2 * np.sin(a)) / np.cos(a))
constant_r = lambda a: -1.0
w2db = lambda w: 10.0 * np.log10(w)
class Node:
def __init__(self, height, angle=None, rp=None):
self.heig... | StarcoderdataPython |
11327272 | <reponame>iammhk/AI_Poet
from lxml import html
import requests
import json
from bs4 import BeautifulSoup
import sys
global json_content
import sqlite3
conn = sqlite3.connect("khusrau.db")
cur = conn.cursor()
top100=["/ghazals/koii-din-gar-zindagaanii-aur-hai-mirza-ghalib-ghazals"]
url="https://rekhta.org"... | StarcoderdataPython |
338666 | <gh_stars>0
# Translation API - https://azure.microsoft.com/en-gb/services/cognitive-services/translator-text-api/
# Example Request - http://localhost:3001/?lang=fr&text=hello
import http.server
import socketserver
import urllib.parse
import urllib.request
import ssl
from xml.etree import ElementTree
import http.clie... | StarcoderdataPython |
9757741 | <reponame>panoptes-organization/panoptes
from flask import jsonify, request, Response
from panoptes.server_utilities.db_queries import get_db_workflows_by_id, get_db_workflows, get_db_jobs, get_db_job_by_id, delete_db_wf, get_db_workflows_by_status, delete_whole_db, get_db_table_is_empty, rename_db_wf, rename_db_job
fr... | StarcoderdataPython |
12810752 | from main import normaliseAndScale, readData, binariseLabels, getTrueLabels, buildDataMatrix, removePacketsAfterChange, printMetrics
from voting import Voting
import pickle
from sklearn import metrics
from matplotlib import pyplot as plt
import matplotlib2tikz
# models = {
# "boost": dict(),
# "logistic": dict... | StarcoderdataPython |
5064317 | <gh_stars>0
import datetime
import requests
class Skywalking(object):
def __init__(self, base_url):
self.base_url = base_url
self.summary_result = {}
"""
{
"service_name": {
"count": 1,
"endpoint_name":{
"count": 1,
... | StarcoderdataPython |
8128522 | import inspect
import numpy as np
import statistics
from autogoal.ml.utils import LabelEncoder, check_number_of_labels
METRICS = []
def register_metric(func):
METRICS.append(func)
return func
def find_metric(*types):
for metric_func in METRICS:
signature = inspect.signature(metric_func)
... | StarcoderdataPython |
4811331 | <gh_stars>0
# Generated by Django 3.2.5 on 2021-07-18 03:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0002_auto_20210717_2308'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
... | StarcoderdataPython |
1793733 | import os
import numpy as np
from pynwb import register_class, docval, get_class
from pynwb.core import VectorIndex, VectorData, DynamicTable, ElementIdentifiers
from hdmf.utils import call_docval_func
from pynwb import load_namespaces
name = 'ndx-simulation-output'
here = os.path.abspath(os.path.dirname(__file__))
... | StarcoderdataPython |
11215521 | <reponame>codacy-badger/pycayennelpp
import pytest
from cayennelpp.lpp_data import LppData
def test_temperature_from_bytes():
# 01 67 FF D7 = -4.1C
temp_buf = bytearray([0x01, 0x67, 0xFF, 0xD7])
temp_dat = LppData.from_bytes(temp_buf)
assert temp_buf == temp_dat.bytes()
def test_accelerometer_from_... | StarcoderdataPython |
3220693 | import matplotlib.pyplot as plt
from sklearn import cluster
from sklearn import datasets
# 加载iris数据
iris = datasets.load_iris()
data = iris['data']
# 学习 → 生成簇
model = cluster.KMeans(n_clusters=3)
model.fit(data)
# 取得学习结果的标签
labels = model.labels_
# 图表的绘制
ldata = data[labels == 0]
plt.scatter(ldata[... | StarcoderdataPython |
8033627 | <filename>test/network/test_latencies.py<gh_stars>0
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Unit-e developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from network.latencies import (
ExponentiallyDistribu... | StarcoderdataPython |
1914125 | #!/bin/env/python3
# -*- encoding: utf-8 -*-
from detector.config import Config
from detector.evaluation import plot_keras_history
from detector.features import ImageProcess
from detector.loader import ImagesLoader
from detector.model import SiameseNetworkModel
if __name__ == "__main__":
loader = ImagesLoader(fil... | StarcoderdataPython |
282273 | """Interface class implementation for the x path data.
"""
from typing import Dict
from apysc._type.attr_linking_interface import AttrLinkingInterface
from apysc._type.int import Int
from apysc._type.revert_interface import RevertInterface
class PathXInterface(RevertInterface, AttrLinkingInterface):
... | StarcoderdataPython |
346482 | import sys
from enerctl import *
def usage():
print("""COMMAND [OPTION]...
Send COMMAND to a legacy Energenie 433 MHz radio controlled wall socket.
Commands:
cmd SEQUENCE Send a custom 4-bit binary code to the socket
off [SOCKET] Turn SOCKET off
on [SOCKET] Turn SOCKET on
Miscellaneous:
h, help ... | StarcoderdataPython |
1758071 | <reponame>migueldvb/ads-python
""" Beers for citations. The new underground currency. """
__author__ = "<NAME> <<EMAIL>>"
# Standard library
import httplib
import json
import os
import urllib
from collections import Counter
# Module specific
import ads
# Couple of mutable variables for the reader
author_query = "^C... | StarcoderdataPython |
3303538 | <reponame>DarkShadow4/python<filename>wxPython/wxGlade-0.9.1/examples/matplotlib2/matplotlib_GUI.py
# -*- coding: UTF-8 -*-
#
# generated by wxGlade
#
import wx
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
import matplotlib_canvas
# end wxGlade
class MyFrame(wx.Frame):
def __init__(se... | StarcoderdataPython |
4802120 | from django.conf.global_settings import DATETIME_INPUT_FORMATS, DATE_INPUT_FORMATS
# Suppress warnings about star import
from locales.default.formats import * # noqa: F401,F403 pylint: disable=wildcard-import
FIRST_DAY_OF_WEEK = 1 # Monday
MONTH_DAY_FORMAT = 'D, j F' # Mon, 25 October
DATE_FORMAT = 'j F Y' # '25... | StarcoderdataPython |
11364649 | # Copyright 2017-2020 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from .db_connector import *
from .pg_db_connector import *
__all__ = (db_connector.__all__ +
pg_db_connector.__all__)
| StarcoderdataPython |
4825159 | from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='A discriminative generative network to generate art images. Trained with the BAM dataset',
author='jiwidi',
license='MIT',
)
| StarcoderdataPython |
4989424 | <reponame>huaweicloud/trace_generation_rnn<gh_stars>10-100
"""Run the forward pass to evaluate the flavor LSTM.
License:
MIT License
Copyright (c) 2021 HUAWEI CLOUD
"""
import argparse
import logging
import torch
from torch.utils.data import DataLoader
from tracegen_rnn.constants import ExampleKeys
from trac... | StarcoderdataPython |
345002 | import unittest
from pyalink.alink import *
import numpy as np
import pandas as pd
class TestVectorAssemblerBatchOp(unittest.TestCase):
def test_vectorassemblerbatchop(self):
df = pd.DataFrame([
[2, 1, 1],
[3, 2, 1],
[4, 3, 2],
[2, 4, 1],
[2, 2, 1... | StarcoderdataPython |
9717144 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | StarcoderdataPython |
6593941 | <filename>experiments/run_randomized_experiment.py
import json
import os
import numpy as np
import run_experiment
if __name__ == '__main__':
#
# Loop
run_per_architecture = 10
for i in range(run_per_architecture):
experiment_dir = "./random_jsons/random_architectures_with_loss"
print(... | StarcoderdataPython |
9645709 | <gh_stars>1-10
#!/usr/bin/env python
from .model import LPWriter, LPSVariableType, LPSWriter, MPSWriter, ModelWriter
from .solution import CBCSolutionReader, CplexSolutionReader, GLPKSolutionReader, LPSolveSolutionReader, SolutionReader
| StarcoderdataPython |
12810656 | <gh_stars>10-100
from java.io import File
from java.io import FileInputStream
from java.util import Properties
#Load properties file in java.util.Properties
def loadPropsFil(propsFil):
properties={}
propFil = Properties()
propFil.load(FileInputStream(propsFil))
properties.update(propFil)
return properties
prope... | StarcoderdataPython |
9662821 | <filename>ogcore/utils.py
'''
------------------------------------------------------------------------
Miscellaneous functions used in the OG-Core model.
------------------------------------------------------------------------
'''
# Packages
import os
import sys
import requests
from zipfile import ZipFile
import urllib... | StarcoderdataPython |
9689344 | """
Copyright (c) 2018 NSF Center for Space, High-performance, and Resilient Computing (SHREC)
University of Pittsburgh. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code ... | StarcoderdataPython |
6422291 | import pytest
import os
from bai_kafka_utils.kafka_service import KafkaServiceConfig
BOOTSTRAP_SERVERS = [os.environ["KAFKA_BOOTSTRAP_SERVERS"]]
@pytest.fixture
def kafka_service_config():
return KafkaServiceConfig(
consumer_group_id="CONSUMER_GROUP_ID",
producer_topic="BAI_APP_FETCHER",
... | StarcoderdataPython |
9743358 | import pytest
def test_str_ok(deserialized_document):
try:
str(deserialized_document)
except:
pytest.fail()
def test_repr_ok(deserialized_document):
try:
repr(deserialized_document)
except:
pytest.fail()
| StarcoderdataPython |
9652136 | from contextlib import redirect_stderr
import requests
import re
from io import StringIO
import csv
BASE_URL = "https://dnsadm.nepustil.net/index.cgi"
user = ""
password = ""
"""Get PTR Records"""
def getRecords():
action = "readzone"
data = {
'domain': user,
'password': password,
'a... | StarcoderdataPython |
122718 | <reponame>RobotCodeLab/atlas_ros
#!/usr/bin/python3
import smbus
import serial
import sys
import time
class I2Cbus:
def __init__(self, timeout=1, **kwargs):
self.__timeout = timeout
self.bus = smbus.SMBus(1)
def read_line(self, address):
try:
response = self.bus.read_i2c_block_data(address, 0x00)
except... | StarcoderdataPython |
225537 | """
Q701
Insert into a Binary Search Tree
Medium
Given the root node of a binary search tree (BST) and a value
to be inserted into the tree, insert the value into the BST.
Return the root node of the BST after the insertion. It is
guaranteed that the new value does not exist in the original
BST.
Note that there may e... | StarcoderdataPython |
1937999 | import pickle
import os
import shutil
class File_Operation:
"""This class shall be used to save the model after training and load the saved model for prediction."""
def __init__(self,file_object,logger_object):
self.file_object = file_object
self.logger_object = logger_object
... | StarcoderdataPython |
6558227 | <reponame>LuukHenk/motif_database<gh_stars>0
from django.apps import AppConfig
class DatabaseConfig(AppConfig):
""" Motig database """
name = "motif_database"
| StarcoderdataPython |
174411 | <reponame>bdharang/AWS_SHELL<gh_stars>0
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apa... | StarcoderdataPython |
8000178 | #!/usr/bin/env python
import re
import sys
# pgstrip strips the Project Gutenberg header & footer from text.
def pgstrip(text):
m = re.search("\*\*\* *START OF.*?\*\*\*", text)
if m:
text = text[m.end():]
m = re.search("\*\*\* *END OF", text)
if m:
text = text[:m.start()]
return... | StarcoderdataPython |
1933786 | from django.test.testcases import SimpleTestCase
from ..models import ClaUser
class ClaUserTestCase(SimpleTestCase):
def setUp(self):
self.token = "<PASSWORD>"
def test_pk_as_token(self):
user = ClaUser(token=self.token, zone_name="zone_name")
self.assertEqual(user.pk, self.token)
... | StarcoderdataPython |
124505 | import numpy as np
a1 = np.ones((2, 3), int)
print(a1)
# [[1 1 1]
# [1 1 1]]
a2 = np.full((2, 3), 2)
print(a2)
# [[2 2 2]
# [2 2 2]]
print(np.block([a1, a2]))
# [[1 1 1 2 2 2]
# [1 1 1 2 2 2]]
print(np.block([[a1], [a2]]))
# [[1 1 1]
# [1 1 1]
# [2 2 2]
# [2 2 2]]
print(np.block([[a1, a2], [a2, a1]]))
# [[1 ... | StarcoderdataPython |
6682558 | <reponame>vyshakTs/STORE_MANAGEMENT_SYSTEM
import uuid
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.db.models import F
from phonenumber_field.modelfields import PhoneNumberField
from helpers import current_datetime
from sms.apps.storemaster.models import WebStore
# Cr... | StarcoderdataPython |
187381 | <reponame>ExLeonem/master-thesis-code
import functools
import numpy as np
class Pipeline:
"""
Execute a transformation pipeline to prepare a dataset
for benchmarking.
Transformers need to be of form "def fn(data, **kwargs)".
Parameters:
*args (fn): Transformers to exe... | StarcoderdataPython |
1881862 | # -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2015 lambda
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 ... | StarcoderdataPython |
4964316 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import math
import datetime
import pickle
## from node000:
## mpiexec -machinefile ~/hostfile -n <numavgs*numodors+1> ~/Python-2.6.4/bin/python2.6 odor_morphs.py
## nohup mpiexec -machinefile ~/hostfile -n 57 ~/Python-2.6.4/bin/python2.6 odor_morphs.p... | StarcoderdataPython |
11229908 | # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
from typing import Any, Optional
from astroid import nodes
from pylint.interfaces import UNDEFINED, Confidence
from pylint.testutils.global_test_linter import linter
from ... | StarcoderdataPython |
1884058 | #!/usr/bin/python
#-*- coding: utf-8 -*-
#===========================================================
# File Name: BenchmarkTemplate.py
# Author: <NAME>, Columbia University
# Creation Date: 01-26-2019
# Last Modified: Tue Mar 5 21:45:20 2019
#
# Description: Standard benchmark template
#
# Copyright (C) 2018 <... | StarcoderdataPython |
4968495 | <reponame>cmltaWt0/edx-load-tests<filename>loadtests/teams_discussion/__init__.py
from locustfile import TeamsDiscussionLocust
| StarcoderdataPython |
5034964 | <filename>pdmreader/unicode_formatter.py
import string
import unicodedata
import math
import itertools
# https://stackoverflow.com/a/44237289/3128576
class UnicodeFormatter(string.Formatter):
def format_field(self, value, format_spec):
if not isinstance(value, str) or not value or not format_spec:
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.