id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3285274 | """
Support for Xiaomi Mi WiFi Repeater 2.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/device_tracker.xiaomi_miio/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tra... | StarcoderdataPython |
1603045 | #!/usr/bin/env python3
import subprocess
import tempfile
import os
import os.path
import collections
import json
import sys
ProcessedTrack = collections.namedtuple("ProcessedTrack", ["dfpwm_file", "artist", "track"])
def convert_wav_dfpwm(infile, outfile):
subprocess.run(["java", "-jar", "LionRay.jar", infile, ou... | StarcoderdataPython |
159939 | #! /usr/bin/env python
import sys
if sys.version_info[0] == 2:
from .avro_py2 import schema
from .avro_py2 import io
from .avro_py2 import protocol
from .avro_py2 import ipc
from .avro_py2 import datafile
from .avro_py2 import tool
#from .avro_py2 import txipc
else:
from .avro_py3 impo... | StarcoderdataPython |
3209503 | #Problem:https://www.hackerrank.com/challenges/tree-huffman-decoding/problem
import queue
def decodeHuff(root, s):
current = root
result = []
for char in s:
#traverse the tree
if char is '1':
current = current.right
else:
current = current.left
#if we... | StarcoderdataPython |
106541 | import distutils.util
class Config:
def __init__(self, auto_off, max_seats, station_id, frequency_wait, history_path, jwt_token, api_endpoint,
max_charge, debug):
self.auto_off = bool(distutils.util.strtobool(auto_off))
self.max_seats = int(max_seats)
self.station_id = int... | StarcoderdataPython |
3387406 | <reponame>AaronFriel/pulumi-google-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Unio... | StarcoderdataPython |
3246649 | #import dependencies
import pandas as pd
from bs4 import BeautifulSoup as bs
import requests
import json
from config import api_key
#datasource url
url = "https://inciweb.nwcg.gov/feeds/rss/incidents/"
state_fetch_url = "https://maps.googleapis.com/maps/api/geocode/json?latlng="
key_string = "&key=" + api_key
def st... | StarcoderdataPython |
1739041 | <reponame>praekeltfoundation/mote
import logging
from django.conf import settings
from django.template.loaders.cached import Loader as CachedLoader
from mote import _thread_locals
logger = logging.getLogger(__name__)
class Loader(CachedLoader):
def get_template(self, *args, **kwargs):
if settings.DEB... | StarcoderdataPython |
1643996 | """
G2P testing on the test data
"""
import unittest
import ga4gh.server.datamodel as datamodel
import ga4gh.server.frontend as frontend
import tests.paths as paths
import ga4gh.schemas.protocol as protocol
class TestG2P(unittest.TestCase):
exampleUrl = 'www.example.com'
phenotypeAssociationSetId = ""
... | StarcoderdataPython |
3282400 | <gh_stars>10-100
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.natural_ventilation_and_duct_leakage import AirflowNetworkDistributionComponentHeatExchanger
log = logging.getLogger(__name__)
class TestAirflowNetworkDistribut... | StarcoderdataPython |
1608952 | <filename>deepxde/utils/pytorch.py
"""Utilities of pytorch."""
| StarcoderdataPython |
1657155 | <filename>Instagram/data.py
data = [
{
"name":"<NAME>",
"caption":"You can't like a full life on an empty stomach",
"profile_pic":"assets/img/badoo1.jfif",
"likes":"1.5M",
"comments":"18.9K",
"post_pics":["assets/img/badoo2.jfif", "assets/img/badoo3.jfif"],
... | StarcoderdataPython |
3281412 | import os, sys
root_path = os.path.realpath(__file__).split('/evaluate/multipose_coco_eval.py')[0]
os.chdir(root_path)
sys.path.append(root_path)
from network.posenet import poseNet
from evaluate.tester import Tester
backbone = 'resnet101'
# Set Training parameters
params = Tester.TestParams()
params.subnet_name = '... | StarcoderdataPython |
3202932 | from gym import spaces
import pybullet as p
from diy_gym.addons.addon import Addon
class StuckJointCost(Addon):
def __init__(self, parent, config):
super(StuckJointCost, self).__init__(parent, config)
self.uid = parent.uid
self.joint_ids = [i for i in range(p.getNumJoints(self.uid)) if p... | StarcoderdataPython |
3305444 | <reponame>cpieloth/PackBacker
__author__ = '<NAME>'
class Parameter(object):
"""Parameter for a consistent use in commands, tasks and job file."""
# Paths and files
CONFIG_FILE = 'cfg_file'
DEST_DIR = 'dest_dir'
VERSION = 'version' | StarcoderdataPython |
4800414 | # -*- coding: utf-8 -*-
"""Standardize methods for logfile handling.
Using Loguru establish basic console and filesystem outputs.
"""
import os
import tqdm
import datetime as dt
from loguru import logger
@logger.catch
def defineLoggers(filename, CONSOLE='INFO', FILELOG='DEBUG'):
"""Setup standardized basic l... | StarcoderdataPython |
1665937 | <reponame>Phid13/IP2<filename>main.py<gh_stars>0
import matplotlib.pyplot as plt
from model import *
from data import *
from labels import *
from skimage import measure
#os.environ["CUDA_VISIBLE_DEVICES"] = "0"
path = "data/RednBlue/Axial/Label"
gen_labels(path)
# change
data_gen_args = dict(rotation_range=0.2,
... | StarcoderdataPython |
132100 | from numpy import sum
from gwlfe.Memoization import memoize
def TotLAEU(NumAnimals, AvgAnimalWt):
result = 0
aeu3 = (NumAnimals[5] * AvgAnimalWt[5]) / 1000
aeu4 = (NumAnimals[4] * AvgAnimalWt[4]) / 1000
aeu5 = (NumAnimals[6] * AvgAnimalWt[6]) / 1000
aeu6 = (NumAnimals[0] * AvgAnimalWt[0]) / 1000
... | StarcoderdataPython |
1695046 | <reponame>mexxexx/ionsrcopt
import pandas as pd
import numpy as np
import seaborn as sns
import sys, os
import matplotlib.pyplot as plt
import argparse
sys.path.insert(1, os.path.abspath("../ionsrcopt"))
import load_data as ld
from source_features import SourceFeatures
from processing_features import ProcessingFeatur... | StarcoderdataPython |
3276248 | <filename>dev/python/2018-10-03 protocol benchmark.py
"""
See how fast just the protocol can be read from ABF files
"""
import os
import sys
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/")
PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/")
sys.path... | StarcoderdataPython |
4831263 | from __future__ import print_function
import os
import sys
import subprocess
r_dependencies = ["RSQLite", "plyr", "gplots", "devtools", "ggplot2"]
r_github_dependencies = ["ucd-cws/wq-heatplot"]
def set_up_r_dependencies():
import launchR # imported here because it will be installed before this is called, but won... | StarcoderdataPython |
171525 | import warnings
from pymysql.tests import base
import pymysql.cursors
class CursorTest(base.PyMySQLTestCase):
def setUp(self):
super(CursorTest, self).setUp()
conn = self.connections[0]
self.safe_create_table(
conn,
"test", "create table test (data varchar(10))",
... | StarcoderdataPython |
75596 | from mongoengine import *
from flask_login import UserMixin
class User(Document, UserMixin, object):
username = StringField(required=True, unique=True)
email = StringField()
def get_id(self):
return str(self.id)
def __repr__(self):
return self.username
def __str__(self):
... | StarcoderdataPython |
1770930 | <reponame>nparkstar/nauta
#
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | StarcoderdataPython |
3368536 | import sublime
import sublime_plugin
def clamp(value, low, high):
if value < low:
return low
if value > high:
return high
return value
# This is to keep the original anchor as long as we keep making vscode style
# column selections - otherwise clear it.
last_selection = None
# Use an Even... | StarcoderdataPython |
3397341 | import connexion
#app = connexion.FlaskApp(__name__)
app = connexion.AioHttpApp(__name__)
app.add_api("swagger/openapi.yaml")
application = app.app | StarcoderdataPython |
176035 | import numpy as np
import pandas as pd
from vimms.old_unused_experimental.PythonMzmine import get_base_scoring_df
from vimms.Roi import make_roi
QCB_MZML2CHEMS_DICT = {'min_ms1_intensity': 1.75E5,
'mz_tol': 2,
'mz_units': 'ppm',
'min_length': 1,
... | StarcoderdataPython |
4801359 | <filename>nano/nano/report/sales_partner_commission_summary_report/sales_partner_commission_summary_report.py<gh_stars>0
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import msgpri... | StarcoderdataPython |
1700954 | from .dtypes import *
# Python frontend
from .frontend.python.decorators import *
from .frontend.python.wrappers import *
from .frontend.python.ndloop import ndrange
from .frontend.python.simulator import simulate
from .config import Config
from .frontend.operations import *
from .sdfg import compile, SDFG, SDFGState... | StarcoderdataPython |
3361446 | <reponame>mecheng/mechcite
from mechcite import Bibliography
from functools import wraps
class cite(object):
def __init__(self, key):
self.key = key
self.used = False
self.bib = Bibliography()
def __call__(self, f):
if hasattr(f, '__call__'):
@wraps(f)
... | StarcoderdataPython |
3271140 | from sensei import *
from vtk import VTK_MULTIBLOCK_DATA_SET, vtkDataObject, VTK_IMAGE_DATA, VTK_DOUBLE, VTK_FLOAT
# test setting and getting the members
md = MeshMetadata.New()
md.GlobalView = True
md.MeshName = "foo"
md.MeshType = VTK_MULTIBLOCK_DATA_SET
md.BlockType = VTK_IMAGE_DATA
md.NumBlocks = 2
md.NumBlocksLoc... | StarcoderdataPython |
4489 | <filename>ts_eval/utils/nans.py<gh_stars>1-10
import warnings
import numpy as np
def nans_in_same_positions(*arrays):
"""
Compares all provided arrays to see if they have NaNs in the same positions.
"""
if len(arrays) == 0:
return True
for arr in arrays[1:]:
if not (np.isnan(array... | StarcoderdataPython |
192927 | """The machinery of importlib: finders, loaders, hooks, etc."""
from ._bootstrap import ModuleSpec
from ._bootstrap import BuiltinImporter
from ._bootstrap import FrozenImporter
from ._bootstrap_external import (SOURCE_SUFFIXES, DEBUG_BYTECODE_SUFFIXES,
OPTIMIZED_BYTECODE_SUFFIXES, BYTECODE_SUFFIX... | StarcoderdataPython |
4823603 | <reponame>ussaema/CT_Image_Reconstruction<filename>main.py
import tensorflow as tf
import numpy as np
from math import cos, sin, pi
import argparse
from tensorflow.python.framework import ops
import lme_custom_ops
import pyconrad as pyc
pyc.setup_pyconrad()
import os
import time
from PIL import Image
class... | StarcoderdataPython |
1640780 | <gh_stars>10-100
class Solution:
def isScramble(self, s1: str, s2: str) -> bool:
@lru_cache(None)
def solve(l1, r1, l2, r2):
if r1 - l1 == 1: return s1[l1] == s2[l2]
if sorted(s1[l1:r1]) != sorted(s2[l2:r2]): return False
for k in range(1, r1 - l1):
... | StarcoderdataPython |
190360 | # -*- coding: utf-8 -*-
# @author: yangyang
# @date 4/2/21 16:53
| StarcoderdataPython |
3385349 | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpectralGraphConv(nn.Module):
def __init__(self, in_features, out_features, bias=True):
"""
(<NAME>, 2017)'s graph convolution layer from (https://arxiv.org/abs/1609.02907).
Args:
in_features (int): Numbe... | StarcoderdataPython |
93873 | from src.commit import * | StarcoderdataPython |
150374 | <filename>tests/functional/intfunc/avg/test_06.py<gh_stars>0
#coding:utf-8
#
# id: functional.intfunc.avg.06
# title: AVG - Integer OverFlow
# decription:
# Refactored 14.10.2019: adjusted expected_stdout/stderr
# 25.06.2020, 4.0.0.2076: changed types in SQLDA fro... | StarcoderdataPython |
4830282 | <reponame>mshulman/response<filename>response/templatetags/unslackify.py<gh_stars>1-10
import logging
import emoji_data_python
from django import template
from response.slack.cache import get_user_profile
from response.slack.client import slack_to_human_readable
register = template.Library()
logger = logging.getLog... | StarcoderdataPython |
1797652 | <gh_stars>1-10
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# 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
#
# ht... | StarcoderdataPython |
3371815 | import pygame
from tools.colours import WHITE
from tools.globals import SCREEN_HEIGHT, SCREEN_WIDTH
class Enemy(pygame.sprite.Sprite):
def __init__(self, health, image, spawn_pos_x, spawn_pos_y):
super().__init__()
# temp
self.image = image
self.health = health
self.rect = self.image.get_rect(... | StarcoderdataPython |
3321891 | <reponame>etienne-monier/inpystem
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This small module only contain sec2str, which is a function to display
time in human-readable format.
"""
def sec2str(t):
"""Returns a human-readable time str from a duration in s.
Arguments
---------
t: float
... | StarcoderdataPython |
3327203 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2022 The HuggingFace Team. 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/LI... | StarcoderdataPython |
147423 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 14:50:14 2018
@author: Kaushik
"""
'''
# Known symmatric distances
locations = ["New York", "Los Angeles", "Chicago", "Minneapolis", "Denver", "Dallas", "Seattle",
"Boston", "San Francisco", "St. Louis", "Houston", "Phoenix", "Salt Lake City"]
dist_ma... | StarcoderdataPython |
1753538 | <gh_stars>1-10
from sympy.abc import x
from sympy.core.numbers import (I, Rational)
from sympy.core.singleton import S
from sympy.functions.elementary.miscellaneous import sqrt
from sympy.polys import Poly, cyclotomic_poly
from sympy.polys.domains import FF, QQ
from sympy.polys.matrices import DomainMatrix, DM
from sym... | StarcoderdataPython |
37446 | from mongoengine import connect
from config import Config
from db.models.subscriptions import Subscriptions
class Db:
Subscriptions = None
def __init__(self, createClient=True):
config = Config()
self.db = {}
self.Subscriptions = Subscriptions
self.createClient = createClient
... | StarcoderdataPython |
3206049 | from typing import Optional, Tuple, List
import networkx as nx
from pydantic import Field
from .graph import CapGraph
from .molecule import Unit
class Cap(Unit):
graph: CapGraph = Field(default_factory=CapGraph)
compatible_rs: Optional[Tuple[int, ...]] = tuple()
compatible_smiles: Optional[Tuple[str, .... | StarcoderdataPython |
3244874 | import requests
import json
import time
#from configs import *
def get_organ_id(stockId):
# 巨潮资讯网站
_req = requests.post(
'http://www.cninfo.com.cn/new/information/topSearch/query?keyWord=' + str(stockId) + '&maxNum=10')
if not _req.status_code == 200:
raise _req
# response.json()的作用就是将... | StarcoderdataPython |
3396248 | import numpy as np
import networkx as nx
import random
import sys
from tqdm import *
import os
import pickle
from recommenders.models.deeprec.deeprec_utils import cal_metric
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neural_network import MLPClas... | StarcoderdataPython |
62214 | from __future__ import print_function
import os
import time
import torch
import torchvision.transforms as transforms
from Dataset import DeblurDataset
from torch.utils.data import DataLoader
from utils import *
from network import *
from Dataset import DeblurDataset, RealImage
def test(args):
device = torch.devi... | StarcoderdataPython |
1692903 | # Generated by Django 2.2 on 2022-01-08 22:17
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('profiles_api', '0004_auto_20220108_2213'),
]
operations = [
migrations.RemoveField(
model_name='image... | StarcoderdataPython |
1630628 | import glob
import os
import subprocess
from typing import Any
TEST_CONFIG_DIR = os.path.dirname(__file__)
TEST_CONFIG_PATH = TEST_CONFIG_DIR + "/fixtures/config/test-simulation-config.json"
def test_help_command() -> None:
command = ["python", "-m", "tokesim"]
command.extend(["--help"])
output = subpro... | StarcoderdataPython |
3297234 | <filename>tests/r/test_barley.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.barley import barley
def test_barley():
"""Test module barley.py by downloading
barley.csv and testing shape... | StarcoderdataPython |
18912 | # 分析黑魔法防御课界面
import cv2
import sys
sys.path.append(r"C:\\Users\\SAT") # 添加自定义包的路径
from UniversalAutomaticAnswer.conf.confImp import get_yaml_file
from UniversalAutomaticAnswer.screen.screenImp import ScreenImp # 加入自定义包
from UniversalAutomaticAnswer.ocr.ocrImp import OCRImp
from UniversalAutomaticAnswer.util.filter imp... | StarcoderdataPython |
108250 | <reponame>Jihunn-Kim/khu_capstone_1
import tensorrt as trt
import pycuda.driver as cuda
import numpy as np
import torch
import pycuda.autoinit
import dataset
import model
import time
# print(dir(trt))
tensorrt_file_name = 'bert.plan'
TRT_LOGGER = trt.Logger(trt.Logger.WARNING)
trt_runtime = trt.Runtime(TRT_LOGGER)
... | StarcoderdataPython |
3368407 | <filename>day3/main.py
import math
def get_increased_modulo_row(start, inc, limit):
row = start
while True:
yield row
row = (row + inc) % limit
def get_hit_trees_for_slope(field, row_inc, col_inc):
trees_hit_count = 0
col_generator = get_increased_modulo_row(0, col_inc, 31)
for r... | StarcoderdataPython |
1613259 | <reponame>benchsci/pazel<gh_stars>0
"""Entrypoint for generating Bazel BUILD files for a Python project."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import json
from pazel.generate_rule import parse_script_and_generate_rule... | StarcoderdataPython |
10696 | import logging
import time
from qupy.framing.slip import Slip
from qupy.interface.serial import SerialPort
from qupy.interface.errors import InterfaceTimeoutError, InterfaceIOError, InterfaceError
from qupy.comm.client import CommClient
logging.basicConfig(level=logging.DEBUG)
if __name__ == '__main__':
s = Se... | StarcoderdataPython |
1656363 | <filename>skfore/preprocessing/Transformer.py
"""
Transformer: time series' transformation module
===============================================================================
Overview
-------------------------------------------------------------------------------
This module contains time series' transformation m... | StarcoderdataPython |
3239155 | <reponame>IronHeart7334/Maelstrom
"""
This module replaces the old distinction between player and AI teams
"""
from maelstrom.dataClasses.characterManager import manageCharacter
from maelstrom.inputOutput.teamDisplay import getDetailedTeamData
from maelstrom.inputOutput.screens import Screen
from maelstrom.util.seri... | StarcoderdataPython |
3382110 | <gh_stars>0
import configparser
def get_configuration():
config = configparser.ConfigParser()
config.read("RHardstyleSpotifyAccess.ini")
access = config["RHARDSTYLESPOTIFY_ACCESS"]
return access | StarcoderdataPython |
1637722 | <reponame>yc19890920/DBlog
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import json
from django import forms
from app.blog.models import Tag, Category, Article, Suggest, BlogComment, CKeditorPictureFile
from django.utils.translation import ugettext_lazy as _
from libs.tools impor... | StarcoderdataPython |
4836736 | """
all the routes and structure of app defined here.
"""
import os
import ast
import datetime
import bleach
from functools import wraps
from persiantools.jdatetime import JalaliDateTime
from flask import render_template, flash, redirect, url_for, request, abort
from flask_login import current_user, login_required
fro... | StarcoderdataPython |
3286043 | import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
if len(physical_devices) > 0:
tf.config.experimental.set_memory_growth(physical_devices[0], True)
import core.utils as utils
from core.config import cfg
from core.yolov4 import filter_boxes
from tensorflow.python.saved_mo... | StarcoderdataPython |
1629996 | import re
import requests
from django.conf import settings
from django.core.exceptions import ValidationError
from .backends import BaseBackend
class SMSBackend(BaseBackend):
def __init__(self, host=None, port=None, sms_route=None, auth_key=None, headers=None,
fail_silently=False, **kwargs):
... | StarcoderdataPython |
1730642 | # -*- coding: utf-8 -*-
from configparser import ConfigParser
from flask import Flask, jsonify, request
import logging.handlers
import logging
from bin.ram import RAM
from bin.cpu import CPU
from bin.network import Network
from bin.load_avg import LoadAvg
from bin.boot_time import BootTime
from bin.disk import Disk
... | StarcoderdataPython |
170508 | <reponame>ioyy900205/vit-pytorch<gh_stars>1-10
import math
from functools import reduce
import torch
from torch import nn
import torch.nn.functional as F
from einops import rearrange, repeat
# helpers
def prob_mask_like(t, prob):
batch, seq_length, _ = t.shape
return torch.zeros((batch, seq_length)).float(... | StarcoderdataPython |
3350453 | # Generated by Django 2.2 on 2021-05-25 08:36
import agenda.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='agenda',
name='noti... | StarcoderdataPython |
103217 | <reponame>ckxz105/rltk
import sys
#: Accept all default values without asking user
SLIENTLY_ACCEPT_ALL_DEFAULT_VALUES = False
def prompt(text: str, *args, new_line: bool = True, **kwargs):
"""
Prompt in terminal (stdout).
Args:
text (str): Text.
*args: More text.
new_line (bool,... | StarcoderdataPython |
3273718 | <gh_stars>0
####!/usr/bin/env python
"""
Author: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
Purpose: Implementation of the interaction between the Gambler's problem environment
and the Monte Carlon agent using RL_glue.
For use in the Reinforcement Learning course, Fall 2017, University of Alberta
"""
fr... | StarcoderdataPython |
90740 | from django import forms
class RecipeModel(forms.ModelForm):
class Meta:
exclude = ["userTableForeignKey"]
fields = ["picture", "name", "description", "date", "creator", "edit"] | StarcoderdataPython |
3368694 | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | StarcoderdataPython |
3332493 | import psycopg2
con = psycopg2.connect(
host = "localhost",
database = "GymAutomationDB",
user = "postgres",
password = "<PASSWORD>"
) | StarcoderdataPython |
1675215 | <filename>demos/demo_ondisk_ivf.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import numpy as np
import faiss
from faiss_contrib.ondisk import merge_o... | StarcoderdataPython |
3329952 | import sys
import xml.etree.ElementTree as ET
import json
import os
import re
def get_parent_folder():
dir_path = os.path.dirname(os.path.realpath(__file__))
paths = dir_path.split('/')
paths.pop()
parent_path = '/'.join(paths)
print parent_path
return parent_path
parent_path = get_parent_fold... | StarcoderdataPython |
158149 | # Copyright 2017 Telstra Open Source
#
# 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 agre... | StarcoderdataPython |
157398 | <filename>SDWLE/cards_copy/spells/rogue.py
import copy
from SDWLE.cards.base import SpellCard
from SDWLE.tags.action import AddCard
from SDWLE.tags.base import Effect, BuffUntil, Buff, AuraUntil, ActionTag
from SDWLE.tags.condition import IsSpell
from SDWLE.tags.event import TurnStarted, TurnEnded, SpellCast
from SDWLE... | StarcoderdataPython |
3329908 | <filename>sign.py
#!/usr/bin/env python3
import ecc_ed25519
import sys, getopt
msg = ""
secret_key_path = "/etc/casper/validator_keys/secret_key.pem"
try:
opts, args = getopt.getopt(sys.argv[1:],"hm:k:",["message=","secretkey="])
except getopt.GetoptError:
print('sign.py -m YOURMESSAGE -k PATH-TO-YOUR-SECRET... | StarcoderdataPython |
3212543 | <filename>sde_module/mbar.py<gh_stars>0
# -----------------------------------------------------------------------------
# mbar.py --- widget class for SDE Tool
# -----------------------------------------------------------------------------
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from ... | StarcoderdataPython |
137275 | <gh_stars>0
# This code is all CDS code
# Author: <NAME> (<EMAIL>)
import collections
import pandas as pd
import pickle
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import KFold
from scipy.stats import pearsonr
from tqdm import *
K_FOLD_NUMBER = 5
# Function to evaluate the perfor... | StarcoderdataPython |
1767670 | <gh_stars>0
import smtplib
server = smtplib.SMTP_SSL("smtp.gmail.com", 465)
server.login("sender", "pass")
server.sendmail("reseiver",
"sender",
"Test Envyard")
server.quit() | StarcoderdataPython |
1617208 | <reponame>bioidiap/bob.bio.base<gh_stars>10-100
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# <NAME> <<EMAIL>>
import numpy
import scipy.spatial
from .Algorithm import Algorithm
from .. import utils
import logging
logger = logging.getLogger("bob.bio.base")
class Distance (Algorithm):
"""This class defin... | StarcoderdataPython |
1600900 | import atexit
import os
import pickle
import shutil
import tempfile
from contextlib import contextmanager
from datetime import timedelta, datetime
from distutils.errors import DistutilsFileError
from pathlib import Path
from types import FunctionType
from typing import Callable, Any
from lztools import lzglobal
from lz... | StarcoderdataPython |
1730167 | import numpy as np
from py_diff_stokes_flow.env.env_base import EnvBase
from py_diff_stokes_flow.common.common import ndarray
class FlowAveragerEnv3d(EnvBase):
def __init__(self, seed, folder):
np.random.seed(seed)
cell_nums = (64, 64, 4)
E = 100
nu = 0.499
vol_tol = 1e-2
... | StarcoderdataPython |
1742014 | from twitter import *
import pyttsx
import APIKEYS
''' MYCREDS.txt has the following format:
oauthtokenvalue
oauthsecretvalue
'''
def getTwitterByConfig():
oauth_token, oauth_secret = read_token_file("MYCREDS.txt")
twitter = Twitter(auth=OAuth(oauth_token, oauth_secret, APIKEYS.SP... | StarcoderdataPython |
198390 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import pickle
import unittest
import torch
import torch.multiprocessing as mp
import torch.nn as nn
import torch.optim as opt... | StarcoderdataPython |
1651281 | <filename>Packages/Dead/demo/Script/tutorials/compare_datasets.py<gh_stars>10-100
# Import modules
import cdms2, cdutil, vcs, cdtime
import string, time, MV2, sys, os
from regrid2 import Regridder
from genutil import statistics
file1 = os.path.join(vcs.sample_data, 'era40_tas_sample.nc')
f1 = cdms2.open( file1 )
f1.... | StarcoderdataPython |
3318524 | <filename>fdk_client/platform/models/AnnouncementSchema.py
"""Platform Models."""
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
from .ScheduleStartSchema import ScheduleStartSchema
class AnnouncementSchema(BaseSchema)... | StarcoderdataPython |
1668710 | <filename>sanity/os_sdk.py
# -*- coding: utf-8 -*-
# Copyright 2015-2016 Cisco Systems, 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:/... | StarcoderdataPython |
1635394 | <reponame>fylux/pyre-check<filename>client/tests/source_database_buck_builder_test.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import shutil
import unittest
from pathlib i... | StarcoderdataPython |
1608612 | <gh_stars>1-10
# general libraries
import warnings
import numpy as np
# image processing libraries
from scipy import ndimage, interpolate, fft, signal
from scipy.optimize import fsolve
from skimage.feature import match_template
from skimage.transform import radon
from skimage.measure import ransac
from sklearn.cluster... | StarcoderdataPython |
3303157 | <gh_stars>1-10
"""Class with response details."""
from dataclasses import dataclass
from typing import Optional
@dataclass
class RequestResponse:
"""Class with response details. Independent of web library implementation."""
status_code: Optional[int]
text: Optional[str]
def is_token_expired(self) -... | StarcoderdataPython |
26994 | <gh_stars>1-10
from mock import patch
@patch('topatch.afunction')
class TestToPatch():
def test_afunction(self, mock_afunction):
mock_afunction('foo', 'bar')
mock_afunction.assert_any_call('foo', 'bar')
| StarcoderdataPython |
57407 | <reponame>yhswjtuILMARE/Machine-Learning-Study-Notes
'''
Created on 2017年5月4日
@author: <NAME>
'''
from selenium import webdriver
import time
from bs4 import BeautifulSoup
from urllib.request import urlretrieve
import re
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import e... | StarcoderdataPython |
3341732 | <reponame>sanyaade-teachings/cep
# Python code generated by CAIT's Visual Programming Interface
import cait.essentials
intention = None
entities = None
first_entity = None
def setup():
cait.essentials.initialize_component('nlp', 'english_default')
def main():
global intention, entities, first_entity
... | StarcoderdataPython |
4808135 | from unittest import TestCase
from unittest.mock import create_autospec
from uuid import uuid4
import time
import calendar
from cadence.errors import WorkflowExecutionAlreadyStartedError, DomainAlreadyExistsError, EntityNotExistsError
from cadence.tchannel import TChannelException
from cadence.cadence_types import Sta... | StarcoderdataPython |
1778132 | import json
from logging import error, exception, warning, info
from requests import post as request_post
from uuid import UUID
from django.db.models import (
CharField,
DecimalField,
ForeignKey,
JSONField,
PositiveIntegerField,
PROTECT,
)
from django.db.utils import IntegrityError
from eth_uti... | StarcoderdataPython |
1758053 | <filename>sppas/sppas/src/annotations/Intsint/intsint.py
# -*- coding: UTF-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ anno... | StarcoderdataPython |
1658997 | # Copyright 2020 QuantStack
# Distributed under the terms of the Modified BSD License.
import uuid
from typing import Optional
from fastapi import HTTPException, status
from sqlalchemy.orm import Session
from .db_models import ApiKey, ChannelMember, PackageMember
OWNER = 'owner'
MAINTAINER = 'maintainer'
MEMBER = '... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.