id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
3289424 | from constants import (
TEMPLATES_TABLE,
ASSETS_TABLE,
BLOCKS_TABLE,
BOOKMARKS_TABLE,
COMMENTS_TABLE,
USERS_TABLE,
USERS_TOKENS_TABLE,
AUTHORS_TABLE,
EMAILS_TABLE,
UID_KEY,
UUID_KEY,
TOKEN_KEY,
USER_KEY,
FULL_NAME_KEY,
AVATAR_URL_KEY,
EMAIL_KEY,
TEMPLA... | StarcoderdataPython |
1683064 |
import smart_imports
smart_imports.all()
class Road(django_models.Model):
point_1 = django_models.ForeignKey('places.Place', related_name='+', on_delete=django_models.CASCADE)
point_2 = django_models.ForeignKey('places.Place', related_name='+', on_delete=django_models.CASCADE)
length = django_models.F... | StarcoderdataPython |
6628528 | from flask import Flask, flash, redirect, render_template, request, session, abort
app = Flask(__name__)
@app.route("/")
def hello():
stat = []
with open('./stations.csv', 'r') as f:
temp = f.readlines()
for i in temp:
stat.append(i.strip().split(","))
return render_template('results.... | StarcoderdataPython |
165662 | <filename>cogspaces/datasets/derivative.py
import os
import re
import warnings
from math import ceil
from os.path import join
import pandas as pd
from joblib import load
from sklearn.utils import Bunch
from cogspaces.datasets.utils import get_data_dir
warnings.filterwarnings('ignore', category=FutureWarning, module=... | StarcoderdataPython |
346529 | """
Copyright (c) 2020-2021 Moxin
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BAS... | StarcoderdataPython |
6422650 | from unittest import mock
import pytest
from jsonschema import RefResolver
from mypy.plugin import AnalyzeTypeContext
from jsonschema_typed import plugin
class MockInstance:
def __init__(self, name, *args, **kwargs):
self.name = name
self.args = args
self.kwargs = kwargs
def __eq__(... | StarcoderdataPython |
6597994 | <filename>hddm/tests/test_models.py<gh_stars>0
from __future__ import division
from copy import copy
import itertools
import glob
import os
import unittest
import pymc as pm
import numpy as np
import pandas as pd
import nose
pd.set_printoptions(precision=4)
from nose import SkipTest
import hddm
from hddm.diag import ... | StarcoderdataPython |
9629576 | <reponame>dw0rdptr/2019_IoT_GoToDouble
#Must be run after arduino starts sending
#delay-proof
import os
import sys
from pathlib import Path
import django
from bluetooth import *
currentPath = Path(os.getcwd())
sys.path.append(str(currentPath.parent.parent))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webview.sett... | StarcoderdataPython |
5032009 | <gh_stars>0
from machine import Pin, PWM
from neopixel import NeoPixel
from time import sleep, sleep_ms
class Lamp:
def __init__(self, n_pin, n_leds):
self.LEDS = n_leds
self.LED_MIDDLE = self.LEDS/2
# NEOPIXEL output pin
pin = Pin(n_pin, Pin.OUT, Pin.PULL_UP)
self.np = N... | StarcoderdataPython |
4841054 | b, c = map(int, input().split())
if b == 0:
ans = c
elif b > 0:
if c < 3:
ans = c + 1
elif 3 <= c <= 2 * b:
ans = 2 * c - 1
else:
ans = 2 * b + c - 1
else:
b = abs(b)
if c < 3:
ans = c + 1
elif 3 <= c <= 2 * b + 1:
ans = 2 * c - 1
else:
an... | StarcoderdataPython |
1934566 | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | StarcoderdataPython |
1600543 | <filename>sprinkles/commands.py<gh_stars>0
import click
import tomlkit
from ._secrets import get_values
from ._templating import render
@click.command()
@click.option('--template', default=None, help='Template file to use')
@click.option('--target', default=None, help='Target config file')
@click.option('--secret-arn... | StarcoderdataPython |
4950790 | <filename>browsers/opera.py
import multiprocessing
import time
import os
from selenium.webdriver import DesiredCapabilities
from misc.browser import Driver, open_browser
from selenium import webdriver
from selenium.webdriver.chrome import service
from selenium.webdriver.chrome.options import Options
from browsers.scre... | StarcoderdataPython |
9728167 | <gh_stars>0
#!/usr/bin/env python3
import fileinput
import re
import typing
def parse_records() -> list[dict[str, str]]:
ret = []
ret_single = {}
for line in fileinput.input():
if len(line.strip()) == 0:
if len(ret_single) > 0:
ret.append(ret_single)
ret_sing... | StarcoderdataPython |
11257076 | <filename>src/Model/Config/freeconf_config.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
class Config(object):
"""Config model object. Store information of Freeconf at all.
Information about all packages and lang preferences.
"""
def __init__(self):
self._config_file =... | StarcoderdataPython |
195056 | import time
from org.white5moke.blockchain.Block import Block
from org.white5moke.blockchain.Blockchain import Blockchain
from org.white5moke.blockchain.Wallet import Wallet
def load_test_blocks(blockchain):
b = Block(blockchain.last_block().index + 1, 'value is soul', int(time.time() * 1000), blockchain.last_bl... | StarcoderdataPython |
12807330 | #!/usr/bin/env python
from setuptools import setup, find_packages
from sftpcloudfs.constants import version, project_url
def readme():
try:
return open('README.md').read()
except:
return ""
setup(name='sftp-cloudfs',
version=version,
description='SFTP interface to OpenStack Object ... | StarcoderdataPython |
9630597 | <gh_stars>0
"""
Class - Object - Functions\n
1. Class\n
2. Functions\n
# Python Classes/Objects\n
`ds.chunk_5.python_class`\n
Python is an object oriented programming language.\n
Almost everything in Python is an object, with its properties and methods.\n
A Class is like an object constructor, or a "blueprint" for c... | StarcoderdataPython |
5020793 | import json
class Config:
"""
Reads a JSON file and stores its data. Specific values can be retreived via
value paths that are structured like absolute unix file system paths, e.g.:
/client/port
"""
def __init__(self):
self._values = {}
def _load_values(self, data: any, p... | StarcoderdataPython |
5093725 | <filename>app/streaming.py<gh_stars>1-10
import queue
import socket
import threading
from .broadcaster import Broadcaster
# try:
# from .SimpleWebSocketServer.SimpleWebSocketServer import WebSocket
# except ImportError as e:
# print(("Failed to import dependency: {}".format(e)))
# print("Please ensure the ... | StarcoderdataPython |
9679912 | <filename>layer_loader/flatten.py
from typing import Type
from .types import Layer, LayerElement, Path
class TypeMismatchError(ValueError):
def __init__(
self,
path: Path,
upper_type: Type[object],
lower_type: Type[object],
) -> None:
super().__init__(
"Ent... | StarcoderdataPython |
348726 | from typing import Dict
from typing import List
def prettify_news_links(links: List[Dict[str, str]]) -> str:
"""tries to convert the news links form the dict to a
single large text
"""
link_string = "" # the message to be send
for link_dict in links:
for title, link in link_dict.ite... | StarcoderdataPython |
1860169 | <gh_stars>0
from base64 import b64encode
import traceback
import sys
import boto3
import datetime
def write(*args, stream=sys.stdout):
for a in args:
if isinstance(a, Exception):
traceback.print_exception(type(a), a, a.__traceback__, file=stream)
stream.flush()
else:
... | StarcoderdataPython |
1604845 | <gh_stars>1-10
# pytest requires at least one test case to run
def test_placeholder():
pass
| StarcoderdataPython |
129710 | import os
from pydantic import BaseSettings
class Settings(BaseSettings):
class Config:
env_file = ".env"
app_name: str = "FastAPI Demo"
admin_email: str = "<EMAIL>"
secret_key: str = os.getenv("SECRET_KEY")
hash_algo: str = os.getenv("HASH_ALGO", "HS256")
access_token_expiration... | StarcoderdataPython |
8163745 | import copy
import os
from importlib.util import find_spec
def load_local_settings(settings, module_name):
"""
Load local settings from `module_name`.
Search for a `local_settings` module, load its code and execute it in the
`settings` dict. All of the settings declared in the sertings dict are thus... | StarcoderdataPython |
6652583 | <reponame>venkat-marina/git-branch-comparator<filename>compare-branches.py
#!/usr/bin/python -u
# This script checks, if 'development' branch has all changes from 'master' branch on Git
# 'master' can have some changes, which 'development' does not have in case of hot fixes on 'master'
# Usage: compare-branches.py <p... | StarcoderdataPython |
1847830 | import subprocess
from os.path import dirname, exists
import yaml
import logging
import argparse
from instances_connection import (logger,
ReplaceCertificatesConfig,
ReplaceCertificatesError)
def get_dict_from_yaml(yaml_path):
with open(yaml_pa... | StarcoderdataPython |
8016810 | from datetimewidget.widgets import DateWidget
from django import forms
class TritonLinkLoginForm(forms.Form):
username = forms.CharField(required=True, widget=forms.TextInput(attrs={
'class': 'form-control',
'placeholder': 'User ID / PID',
'id': 'user',
'name': 'Username'
}))
... | StarcoderdataPython |
4985617 | <filename>backend/app.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Flask."""
from flask import Flask, jsonify, request
from flask_cors import CORS
from models.daikin import Daikin
from models.gpio import Gpio
app = Flask(__name__)
CORS(app)
daikin = Daikin()
gpio = Gpio()
@app.route('/')
def hello():
"... | StarcoderdataPython |
146300 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import enum
import re
__all__ = (
"NodeType",
"NodeToken",
"NODE_PATTERN",
"JOIN_TOKENS",
)
class NodeType(str, enum.Enum):
"""An enumeration of the different types of nodes in a script."""
ACT = "act"
SCENE = "scene"
PROL = "prologue"
... | StarcoderdataPython |
217893 | <reponame>rendinam/crds
"""uses.py defines functions which will list the files which use a given
reference or mapping file.
>> from pprint import pprint as pp
>> pp(_findall_mappings_using_reference("v2e20129l_flat.fits"))
['hst.pmap',
'hst_0001.pmap',
'hst_0002.pmap',
'hst_0003.pmap',
'hst_0004.pmap',
'hst_0005.... | StarcoderdataPython |
11289386 | <filename>learning_DAN/RF/RF.py
import scipy.io as sio
import numpy as np
from sklearn.ensemble import RandomForestRegressor
data = []
data = sio.loadmat('RF_2.mat')
x_train = data['x_train']
y_train = data['y_train']
x_test = data['x_test']
y_test = data['y_test']
y_train = np.reshape(y_train, [np.shape(y_train)[0]... | StarcoderdataPython |
5035081 | import numpy as np
import pytest
import torch
from mmdet3d.core.evaluation.indoor_eval import average_precision, indoor_eval
def test_indoor_eval():
if not torch.cuda.is_available():
pytest.skip()
from mmdet3d.core.bbox.structures import Box3DMode, DepthInstance3DBoxes
det_infos = [{
'lab... | StarcoderdataPython |
6546695 | <gh_stars>1-10
from rest_framework import permissions
class IsOwnerOrAdmin(permissions.BasePermission):
'''
The purpose of this permission class is to limit
viewing or editing of resources to the owner OR to
someone with administrative privileges.
Assumes the instance `obj` has an `owner` attrib... | StarcoderdataPython |
6508671 | import xml.etree.ElementTree as ET
import os
import shutil
import matplotlib.pyplot as plt
import cv2
import numpy as np
from tqdm import tqdm
def data_analysis(image_size=1024):
"""
分析数据集中box宽高比,高度和宽度的分布
"""
# xml_path
xml_path = '../dataset/train/valid_box'
xml_files = os.listdir(xml_path)
... | StarcoderdataPython |
6412670 | <filename>tests/test_splitstack.py
import pglet
from pglet import SplitStack, Stack
from pglet.protocol import Command
def test_splitstack_add():
s = SplitStack(
horizontal=True,
gutter_size=10,
gutter_color="yellow",
gutter_hover_color="orange",
gutter_drag_color="blue",
... | StarcoderdataPython |
9711431 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from . import util
class Path:
def __init__(self, path_nodes=[], path_cost=0.0, offset=None):
self._nodes = path_nodes
self._cost = path_cost
self._offset = offset
def offset_grid_co... | StarcoderdataPython |
197034 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import ctypes
from ctypes import Structure, Union, c_ubyte, c_long, c_ulong, c_ushort, \
c_wchar, c_void_p, c_uint
from ctypes import byref, POINTER, sizeof
from ctypes.wintypes import ULONG, BOOLEAN, BYTE, WORD, DWORD... | StarcoderdataPython |
1731372 | # -*- 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:
from os import path as op
from uuid import uuid4
import numpy as np
import nibabel as nib
from matplotlib import pyplot as plt
from svgutils.transform import fromstring
from seabor... | StarcoderdataPython |
3562830 | import logging
import textwrap
import traceback
import json
import os
import discode
with open("env.json", "r") as env_file:
env = json.load(env_file)
token = env.get("BOT_TOKEN", os.environ.get("BOT_TOKEN"))
owner_ids = (
859996173943177226,
739443421202087966,
551257232143024139,
6850828469... | StarcoderdataPython |
11216315 | import json
import os
import torch
from transformers import RobertaTokenizer, RobertaForQuestionAnswering
AZUREML_MODEL_DIR = "AZUREML_MODEL_DIR"
ROBERTA_BASE = 'roberta-base'
def init():
global model, tokenizer
model_path = os.path.join(os.getenv(AZUREML_MODEL_DIR), ROBERTA_BASE)
model = RobertaForQues... | StarcoderdataPython |
8109395 | from phue import Bridge
import tkinter as tk
from tkinter import *
class HueApp:
def __init__(self, parent):
self.bridge = Bridge('192.168.0.4')
self.lights = self.bridge.get_light_objects('name')
self.root = parent
self.labels = {}
self.vars = {}
self.scaleValue... | StarcoderdataPython |
3211758 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/2/12 15:57
# @Author : Vodka0629
# @Email : <EMAIL>, <EMAIL>
# @FileName: player.py
# @Software: Mahjong II
# @Blog :
from random import randint, choice
from mahjong.error import *
from mahjong.expose import Expose
from mahjong.mj... | StarcoderdataPython |
4815978 | # This file should be located in the $HOME/.local/lib/python3.7/site-packages directory
import platform
def add1(n):
return n + 1
def os_version():
return platform.system() + " " + platform.release()
| StarcoderdataPython |
11336999 | # -*- coding: utf-8 -*-
import unittest
import os
# prepare for test
os.environ['ANIMA_TEST_SETUP'] = ""
from anima.env import mayaEnv # to setup maya extensions
import pymel.core
from anima.edit import Sequence, Media, Video, Track, Clip, File
class SequenceManagerTestCase(unittest.TestCase):
"""tests the Se... | StarcoderdataPython |
89428 | # This file is a part of DeerLab. License is MIT (see LICENSE.md).
# Copyright(c) 2019-2021: <NAME>, <NAME> and other contributors.
import numpy as np
from deerlab.utils import Jacobian, nearest_psd
from scipy.stats import norm
from scipy.signal import fftconvolve
from scipy.linalg import block_diag
from scipy... | StarcoderdataPython |
5011919 | import logging
import numpy as np
from sklearn.ensemble import IsolationForest
from typing import Dict, Union
from alibi_detect.base import BaseDetector, FitMixin, ThresholdMixin, outlier_prediction_dict
logger = logging.getLogger(__name__)
class IForest(BaseDetector, FitMixin, ThresholdMixin):
def __init__(sel... | StarcoderdataPython |
6639217 | <gh_stars>100-1000
#
# Copyright (c) 2021 Facebook, Inc. and its affiliates.
#
# This file is part of NeuralDB.
# See https://github.com/facebookresearch/NeuralDB for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Yo... | StarcoderdataPython |
3352993 | #!/usr/bin/python3
input_file = 'input.in'
data_file = list(map(lambda x: int(x),
open(input_file).read().split()))
class TNode(object):
def __init__(self, no, children_count=0, metadata_count=0):
self.no = no
self.children_count = children_count
self.metadata_count = metadat... | StarcoderdataPython |
6476764 | import time
from unittest import TestCase
import sys
from src.algorithms.math.Fibonacci import Fibonacci
sys.setrecursionlimit(6000)
class TestFibonacciTime(TestCase):
index = 36
number = 14930352
def test_fib_iterative_time(self):
print("Time of iterative calculating of Fibonacci number (O(n)): "),
start = ... | StarcoderdataPython |
1817137 | # This file is auto-generated, please don't modify it directly.
# Modify source xls file and use model_gen to regenerate again.
#
# Last generate time: 2018-05-23 13:11:16
from enum import Enum
class EnumGameType(Enum):
Drier = 0 # 吹风机
Laser = 1 # 激光笔
Feed = 2 # 喂食
PutUp = 3 # 托起
Stroke = 4 # 抚摸
Click = 5 # 点击
... | StarcoderdataPython |
72156 | <filename>lib/python/treadmill/cleanup.py
"""Listens to Treadmill cleanup events.
When a treadmill app needs to be cleaned up then there will exist a symlink
to the app in the cleanup directory. A cleanup app will be created to do
the cleanup work necessary:
<treadmillroot>/
cleanup/
<instance... | StarcoderdataPython |
8117932 | import subprocess
def test_CLI_coffee_call():
return_code = subprocess.call([
# path is or should be in a setting somewhere
'/home/pi/Programming/Automation/executables/rfoutlets_coffee.py',
'1000',
'-d',
'0',
'--test'
])
assert return_code == 0
| StarcoderdataPython |
8159579 | <reponame>jiashunwang/Long-term-Motion-in-3D-Scenes<filename>train_subgoal.py
import torch
import torch.optim as optim
import numpy as np
from sub_data import SUBDATA
import time
import torch.nn.functional as F
from human_body_prior.tools.model_loader import load_vposer
from utils import BodyParamParser, Contino... | StarcoderdataPython |
6632009 | import os
from pathlib import Path
import pytest
import yaml
from plumbum import local
from plumbum.cmd import git
with open("copier.yml") as copier_fd:
COPIER_SETTINGS = yaml.safe_load(copier_fd)
# Diferentes tests diferentes versiones de odoo
OLDEST_SUPPORTED_ODOO_VERSION = 8.0
ALL_ODOO_VERSIONS = tuple(COPIER... | StarcoderdataPython |
3321138 | # Generated by Django 3.2.6 on 2021-09-07 07:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0009_auto_20210907_0530'),
]
operations = [
migrations.AddField(
model_name='isolatedfilecollection',
name='n... | StarcoderdataPython |
236109 | from bokeh.charts import TimeSeries, show, output_file
def read_weather_data(url):
data = pd.read_csv(url, parse_dates=['CST'])
data.columns = data.columns.str.strip()
return data
vicksburg_data = read_weather_data(vicksburg_url)
austin_data = read_weather_data(austin_url)
data = dict(
VICKSBURG = v... | StarcoderdataPython |
6549474 | <reponame>harsh183/nerodia
from re import compile
import pytest
from nerodia.exception import UnknownObjectException
pytestmark = pytest.mark.page('non_control_elements.html')
class TestLiExist(object):
def test_returns_true_if_the_element_exists(self, browser):
assert browser.li(id='non_link_1').exist... | StarcoderdataPython |
95860 | <reponame>Mehdishishehbor/gpytorch<filename>test/kernels/test_rff_kernel.py
#!/usr/bin/env python3
import unittest
from unittest.mock import MagicMock, patch
import torch
import Lgpytorch
from Lgpytorch.kernels import RFFKernel
from Lgpytorch.test.base_kernel_test_case import BaseKernelTestCase
class TestModel(Lgp... | StarcoderdataPython |
5107884 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
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.utils import timezone
# Create your models here.
###########################
# US... | StarcoderdataPython |
6577423 | <reponame>netzwerkrecherche/auskunftsrecht
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('rulings', '0001_initial'),
]
operations = [
migrations.AddField(
mode... | StarcoderdataPython |
11213641 | <filename>tests/test_jax.py
import unittest
import time
import jax.numpy as np
from common import gpu_test
from jax import grad, jit
class TestJAX(unittest.TestCase):
def tanh(self, x):
y = np.exp(-2.0 * x)
return (1.0 - y) / (1.0 + y)
def test_grad(self):
grad_tanh = grad(self.tanh... | StarcoderdataPython |
3321390 | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
import pdb
torch.manual_seed(123)
class USCNNSep(nn.Module):
def __init__(self,h,nx,ny,nVarIn=1,nVarOut=1,initWay=None,k=5,s=1,p=2):
super(USCNNSep, self).__init__()
"""
Extract basic information
"""
self.initWay=... | StarcoderdataPython |
8123012 | <reponame>OscarXiberta/bclearer<gh_stars>0
class AttributeToScopePatternConfigurationObjects:
def __init__(
self,
attributed_type_name: str,
attributed_type_ea_guid: str,
attribute_name: str,
attribute_ea_guid: str,
scoping_type: str,
... | StarcoderdataPython |
240872 | # -*- coding: utf-8 -*-
import os
import json
from collections import defaultdict
from nltk.tokenize import punkt
from .sentence_tokenizer import SentenceTokenizer
class Parser(object):
def __init__(self, ideal=20.0, stop_words=None, tokenizer=None):
self.ideal = 20.0
if not stop_words:
... | StarcoderdataPython |
1645923 | from os import path
import unittest
from prudentia.utils import io
class TestIO(unittest.TestCase):
def test_xstr(self):
self.assertEqual(io.xstr(None), '')
def test_yes(self):
self.assertTrue(io.input_yes_no('test topic', prompt_fn=lambda m: 'y'))
self.assertTrue(io.input_yes_no('te... | StarcoderdataPython |
3302561 | import tornado.ioloop
import tornado.web
import socket
import bokeh.layouts
import tornado.web
import tornado.ioloop
import bokeh.plotting
import bokeh.core.properties
import weakref
import uuid
import sys
from . import serverutils
class MainHandler(tornado.web.RequestHandler):
def get(self):
download_id =... | StarcoderdataPython |
30163 | #!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_flcdrpf_ckl_mmp_cds
@file marine-integrations/mi/dataset/parser/test/test_flcdrpf_ckl_mmp_cds.py
@author <NAME>
@brief Test code for a flcdrpf_ckl_mmp_cds data parser
"""
import os
from nose.plugins.attrib import attr
from mi.core.exception... | StarcoderdataPython |
3281619 | <reponame>wqu-bom/pybufrkit
"""
pybufrkit.script
~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
from __future__ import print_function
import functools
import ast
from pybufrkit.dataquery import QueryResult
from pybufrkit.query import BufrMessageQuerent
__all__ = ['process_embedded_query_expr', 'ScriptRu... | StarcoderdataPython |
1792304 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ke... | StarcoderdataPython |
9709222 | <reponame>t0mmyt/cloud_computing
#!/usr/bin/env python2
import re
from sys import stdin, stdout
import json
def mapper():
"""
Stripes mapper function
Reads stdin, (emits {w1: {w2_1: n},{w2_2: n}) on stdout
"""
word_1 = None
# Dict to store counts before emitting
n = dict()
line = stdi... | StarcoderdataPython |
296821 | <gh_stars>0
import discord
from discord.ext import commands
import datetime
#the present date
present = datetime.date.today()
#the first day of school
first_day = datetime.date(2022, 2, 3)
#assign the first day to a value
day = 1
#list of dates that are weekdays that we do not have school
no_school = [datetime.date... | StarcoderdataPython |
5068126 | import pandas as pd
import numpy as np
import warnings
import io
import itertools
import yaml
import math
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import os
# read csv data
#df = pd.read_excel('./assessment/output/fig2.9_data_table.xlsx')
df = pd.read_csv('./assessment/output/Combine... | StarcoderdataPython |
3314397 | <reponame>LowerSilesians/ursa-rest-sqlserver<gh_stars>0
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the de... | StarcoderdataPython |
5007789 | <gh_stars>0
import numpy as np
import pandas as pd
import random
import math
import matplotlib.pyplot as plt
#Gaussian kernal function
def gaussian_kernal(u):
return (1/(math.sqrt(2*math.pi)))*math.e**(-0.5*(u[0,0]**2+u[0,1]**2+u[0,2]**2+u[0,3]**2))
#calculate conditional probability
def cal_pcb(cv,train,cal_pcb_... | StarcoderdataPython |
1726054 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Purpose: This script is to add a specific number to image names in order to increment their number.
Functionality: In order to merge Test set and Training set together, Test set image names should be added with the highest number in the Training set.
Input: Train_DIR=Tra... | StarcoderdataPython |
9684712 | <filename>fewshot/data/iterators/semisupervised_episode_iterator.py<gh_stars>10-100
"""Iterator for semi-supervised episodes.
Author: <NAME> (<EMAIL>)
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import tensorflow as tf
from fewsh... | StarcoderdataPython |
1728254 | <filename>tests/pyspark_testing/integration/__init__.py
from __future__ import print_function
from functools import partial
import atexit
import glob
import logging
import os
import sys
import subprocess
import time
import unittest
from pyspark_testing.version import __version__ as version
from ... import relative_fi... | StarcoderdataPython |
5674 | #!/usr/bin/env python
#
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import absolute_import, division, print_function
import argparse
import os
import glog as log
import numpy as np
import cv2
from lxml import etree
from tqdm import tqdm
def parse_args():
"""Parse argu... | StarcoderdataPython |
5174579 | <reponame>manazhao/tf_recsys
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import tensorflow as tf
import ml.common.flags as my_flags
import ml.module.proto.feature_column_schema_pb2 as fcs_pb2
import ml.m... | StarcoderdataPython |
6530270 | <gh_stars>0
# データベースの接続文字列など、アプリケーションの設定情報の指定
import os
class DevelopmentConfig:
# SQLAlchemy
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{user}:{password}@{host}/{database}?charset=utf8'.format(
**{
'user': os.getenv('DB_USER', 'root'),
'password': os.getenv('DB_PASSWORD', '<P... | StarcoderdataPython |
4987351 | import json
import os
from datetime import datetime
import cactus
import dotenv
import pandas
import pytz
import requests
import twitter
# Load the .env
dotenv.load_dotenv(dotenv.find_dotenv())
STATS_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), '../vaccine-stats.json'))
def current_timestamp():
... | StarcoderdataPython |
4905978 | <filename>watertap/edb/tests/test_commands.py
import contextlib
from dataclasses import dataclass, field, asdict
from functools import singledispatch
import json
import logging
import os
from pathlib import Path
import shutil
from typing import List, Optional, Tuple, Union, Any
import pytest
from click import Command
... | StarcoderdataPython |
9754514 | from jupydoc import DocPublisher
__docs__ = ['Simple']
class Simple(DocPublisher):
"""
title: Development
abstract: This ia a very basic class
sections:
section1 section2
subsections:
section1: sub1 sub2
"""
def __init__(self, **kwargs):
super().__ini... | StarcoderdataPython |
11319546 | from client.klaytn import Klaytn
from client.utils import *
import urllib.request
import json, requests, subprocess
import logging
logging.basicConfig(level=logging.DEBUG)
# check update
with open('./info.json', 'r') as f:
info = json.load(f)
res = check_update(info)
if not res: # not updated
exit(0)
# upda... | StarcoderdataPython |
6670701 | <gh_stars>1-10
import unittest
import hypothesis.strategies as st
from hypothesis import given
from {exercise_name} import Solution
class Test(unittest.TestCase):
def test_1(self):
solution = Solution()
self.assertEqual(solution.{method}(), True)
@given(st.lists(st.integers(), min_size=1), st... | StarcoderdataPython |
3244787 | <filename>eviction_tracker/app.py
import flask
from flask import Flask, request, redirect
from flask_security import hash_password, auth_token_required
from eviction_tracker.extensions import cors, db, marshmallow, migrate, api, login_manager, security
from eviction_tracker.admin.models import User, user_datastore
impo... | StarcoderdataPython |
3228454 | <filename>script.py<gh_stars>0
import os
import sys
import json
import requests
from bs4 import BeautifulSoup
DOMAIN= "<domain>"
BASE_URL= "https://{domain}.atlassian.net/wiki/rest/api/".format(domain=DOMAIN)
USERNAME= "<username>"
PASSWORD= "<password>"
AUTH= (USERNAME, PASSWORD)
def get_page_info(auth, title):
... | StarcoderdataPython |
8051067 | import tests.periodicities.period_test as per
per.buildModel((12 , 'B' , 25));
| StarcoderdataPython |
225043 | #!/usr/bin/env python
#pylint: skip-file
# This source code is licensed under the Apache license found in the
# LICENSE file in the root directory of this project.
class ScheduleInfoOutput(object):
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and t... | StarcoderdataPython |
3551073 | <filename>tests/parsing/test_loops.py
# pylint: disable=missing-docstring,unused-import,no-member
from .util import create_scripttest_func
test_until_do = create_scripttest_func('until_do')
test_restart = create_scripttest_func('restart')
test_for_every = create_scripttest_func('for_every')
| StarcoderdataPython |
3536930 | import pygame
import sys
import copy
import time
from settings import *
from player_class import *
from enemy_class import *
vec = pygame.math.Vector2
class App:
# Costruttore
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
self.c... | StarcoderdataPython |
5062037 | import eHive
import os
from VCFIntegration.SNPTools import SNPTools
class SNPTools_prob2vcf(eHive.BaseRunnable):
"""Run SNPTools prob2vcf on a VCF containing biallelic SNPs"""
def run(self):
self.warning("Analysing file {0}".format(self.param_required('vcf_file')))
vcf_i = SNPTools(vcf=self.p... | StarcoderdataPython |
4928313 | import plotly.graph_objects as go
from dataclasses import dataclass, field
from typing import List, Tuple
from configuration_parameters import *
@dataclass
class Parameter:
"""Parameter used for decision making
Args:
value (float): Value of the parameter
is_increasing_better ... | StarcoderdataPython |
1810707 | <gh_stars>10-100
from numba import njit, int64, float64
from numba.typed import List as L
from numba.types import Tuple, List, ListType as LT
import numpy as np
#edges, vtx2vtx, vtx2edge, vtx2poly, edge2vtx, edge2edge, edge2poly, poly2vtx, poly2edge, poly2poly , LT(LT(int64)),LT(LT(int64)), LT(LT(int64)), int64[:,::... | StarcoderdataPython |
6409843 | <reponame>konung-yaropolk/pyABF
"""
This file lists the size of every structure in the structures file.
sectionSizes = {'HeaderV1': 1678, 'HeaderV2': 76, 'SectionMap': 216,
'ProtocolSection': 208, 'ADCSection': 82, 'DACSection': 132,
'EpochPerDACSection': 30, 'EpochSection': 4, 'TagSe... | StarcoderdataPython |
11385580 | <gh_stars>0
# Generated by Django 2.2.24 on 2022-01-07 08:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hoodapp', '0023_auto_20220107_1111'),
]
operations = [
migrations.RenameField(
model_name='neighborhood',
old_n... | StarcoderdataPython |
8155854 | # script to make graph of connected components in a volume
import argparse
import logging
import pickle
from collections import defaultdict
from typing import Dict, Set, Tuple, Union
import cupy as cp
import cupyx.scipy.ndimage as cpnd
import h5py
import numpy as np
VolumeFile = Tuple[str, str]
ArrayTypes = Union[np.... | StarcoderdataPython |
1819953 | """
Max-p regions algorithm
Source: <NAME>, <NAME>, and <NAME> (2020) "Efficient
regionalization for spatially explicit neighborhood delineation." International
Journal of Geographical Information Science. Accepted 2020-04-12.
"""
from ..BaseClass import BaseSpOptHeuristicSolver
from .base import (w_to_g, mo... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.