id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
342688 | <filename>hydra/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging.config
import os
from pathlib import Path
from typing import Any, Callable
import hydra._internal.instantiate._instantiate2
import hydra.types
from hydra._internal.utils import _locate
from hydra.core.hydra_... | StarcoderdataPython |
1654023 | from flask import Flask
from flask_restx import Api, Resource, fields
from src.deploy.market import get_prediction
app = Flask(__name__)
api = Api(app, version='1.0', title='Delay API',
description='A RITA Delay API',
)
ns = api.namespace('predicts', description='FLIGHTS operations')
predict = api.model('Delay',... | StarcoderdataPython |
8130193 | <filename>challenger_bot/base_agent_handler.py<gh_stars>0
from typing import Callable
from rlbot.agents.base_agent import SimpleControllerState
from rlbot.utils.rendering.rendering_manager import RenderingManager
from rlbot.utils.structures.game_data_struct import GameTickPacket
from rlbot.utils.structures.rigid_body_... | StarcoderdataPython |
11348667 | <filename>setup.py<gh_stars>10-100
import os
import setuptools
setuptools.setup(
name='dagbldr',
version='0.0.1',
packages=setuptools.find_packages(),
author='<NAME>',
author_email='<EMAIL>',
description='Deep DAG in Theano',
long_description=open(os.path.join(os.path.dirname(
os.pa... | StarcoderdataPython |
3403419 | import serial
class BaseComm:
def __init__(self, port: str, bps: int, timeout=5):
self.serial = serial.Serial(port, bps, timeout=timeout)
self.default_code = 'M'.encode()
# 规定开始的时候先写入一个字节
def start_read(self):
self.serial.write(self.default_code)
def readline(self):
s... | StarcoderdataPython |
11246103 | <filename>set2/challenge6.py
import math
import random
from typing import List, Tuple
from Crypto.Random import get_random_bytes
from ..conversions import base64_to_bytes
from ..set1.challenge8 import get_blocks
from .challenge1 import pkcs7_pad, pkcs7_unpad
from .challenge3 import encrypt_AES_ECB, find_AES_mode
fro... | StarcoderdataPython |
3276259 | <reponame>njoroge33/py_learn
# User enters a string in mixed case(uppercase +lowercase),
# code so that uppercase is changed to lowercase and vice-versa
# for more info on this quiz, go to this url: http://www.programmr.com/change-case-2
import string
def change_case(x_str):
a = {char: char for char in list(str... | StarcoderdataPython |
223891 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
69667 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import tensorflow as tf
from tensorflow.keras.preprocessing.sequence import pad_sequences
from data_lit import Data_Augmentation
import numpy as np
#physical_devices = tf.config.list_physical_devices('GPU')
#tf.config... | StarcoderdataPython |
3286286 | <reponame>BDALab/GENEActiv-sleep-analyses-system
from django.contrib import admin
from nested_inline.admin import NestedTabularInline, NestedModelAdmin
from .models import Subject, CsvData, PsData, SleepDiaryDay, WakeInterval, RBDSQ
# Register your models here.
class PsDataInline(admin.TabularInline):
inlines ... | StarcoderdataPython |
1890700 | """
These coefficients are imported from Table 8.1 in Vanthoor's thesis and from GreenLight code
NOTE: In the GreenLight model, there are no whitewash and shadow screen
"""
# TODO: import coefficients through a configuration file
class Coefficients(object):
class Construction:
ratio_GlobAir = 0.1 # The r... | StarcoderdataPython |
1953261 | <reponame>laurirasanen/goliath
TICK_SKIP = 6
PHYSICS_TICKRATE = 120
HALF_LIFE_SECONDS = 5
TRAIN_DEVICE = "cpu"
def seconds_to_steps(seconds):
return int(round(seconds * PHYSICS_TICKRATE / TICK_SKIP))
def seconds_to_frames(seconds):
return int(round(seconds * PHYSICS_TICKRATE))
def frames_to_seconds(frames... | StarcoderdataPython |
8164629 | # © 2019 University of Illinois Board of Trustees. All rights reserved
# First mixture-of-experts config
configDict = {
'readConv': 'MoEReadConvolver250FeatureMap',
'alleleConvSingle': 'ExpertAlleleConvolver250FeatureMap',
'graphConvSingle': 'ExpertGraphConvolver250FeatureMap',
'graphConvHybrid': 'Expe... | StarcoderdataPython |
12852290 | import numpy as np
from pydrake.all import *
class BasicTrunkPlanner(LeafSystem):
"""
Implements the simplest possible trunk-model planner, which generates
desired positions, velocities, and accelerations for the feet, center-of-mass,
and body frame orientation.
"""
def __init__(self, frame_id... | StarcoderdataPython |
375933 | <gh_stars>100-1000
import torch
import torch.nn as nn
from torch.functional import Tensor
from torch.nn.modules.activation import Tanhshrink
from timm.models.layers import trunc_normal_
from functools import partial
class Ffn(nn.Module):
# feed forward network layer after attention
def __init__(self... | StarcoderdataPython |
11298868 | <filename>Assignment1.py
def add(x, y):
print(a,"+",b,"=", x+y);
def subtract(x, y):
print(a,"-",b,"=", x-y);
def multiply(x, y):
print(a,"+",b,"=", x*y);
def divide(x, y):
print(a,"+",b,"=", x/y);
m = 'y'
while m == 'y' or m == 'Y':
print("Calculator")
print("1.Addition")
pri... | StarcoderdataPython |
5116581 | <filename>lib/warrant.py
from lib.transaction import Transaction
validOptions = ['call', 'put']
class Warrant(Transaction):
def __init__(self, pdf):
super().__init__(pdf)
if 'fremdkostenzuschlag' in pdf:
self.brokerageFee = 1
else:
self.brokerageFee = 0
... | StarcoderdataPython |
4989116 | <filename>tests/test_cipher.py
import unittest
from app.utils.cipher import salted_hash, encrypt, decrypt, encrypt_and_authenticate, decrypt_and_verify
class TestCipher(unittest.TestCase):
def setUp(self):
self.encrypted = b'\xa2\xcf\xcf.i\xbe\xdd?\x07oL\xd9\x00@G\xec'
self.iv = b'*\xfe\xce\xa09\... | StarcoderdataPython |
395066 | <gh_stars>0
# Copyright 2016 Metaswitch Networks
#
# 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 ag... | StarcoderdataPython |
1677264 | <reponame>aledelmo/3DSlicer_Plugins
import os
import string
import time
import unittest
from builtins import range
try:
from itertools import izip as zip
except ImportError:
pass
import RegistrationLib
from __main__ import vtk, qt, ctk, slicer
import MyRegistrationLib
class BonesSegmentation:
def __ini... | StarcoderdataPython |
11313769 | from setuptools import setup
setup(
name='bunk_py',
version='2.3.1',
description='An API wrapper for BunkServices API.',
author='DaWinnerIsHere',
author_email='<EMAIL>',
url = 'https://github.com/DaWinnerIsHere/bunk_py',
download_url = 'https://github.com/DaWinnerIsHere/bunk_py/archive/re... | StarcoderdataPython |
1956910 | <reponame>amywieliczka/harvester<filename>test/test_copy_couchdb_fields.py<gh_stars>1-10
# test copying from one couchdb to another
# specify list of field names in "/" path style
# specify doc id
# specify source & dest couchdb
| StarcoderdataPython |
11278693 | <reponame>mikiec84/speaking_detection<filename>tools/nn/voice.py
import torchaudio
def voice_train():
sound, sample_rate = torchaudio.load('foo.mp3')
torchaudio.save('foo.mp3.pt', sound, sample_rate) # saves tensor to filepass
if __name__ == '__main__':
voice_train() | StarcoderdataPython |
6543219 | <gh_stars>0
import requests
import json
def check_if_index_is_present(url):
response = requests.request("GET", url, data="")
json_data = json.loads(response.text)
return json_data
if __name__ == "__main__":
url = "http://localhost:9200/_template/search_engine_template/"
response = requests.reques... | StarcoderdataPython |
6555509 | <reponame>nglrt/virtual_energy_sensor<gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/SettingsDialog.ui'
#
# Created: Tue Jul 29 07:54:08 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
... | StarcoderdataPython |
6535088 | """
Represents the routes and controllers for authenthication
By: <NAME>
"""
from app.auth.model import User
from app.auth.form import AuthForm
from app.setup import conn
from flask import Blueprint, render_template, request, current_app, redirect, url_for, flash
from flask_login import login_user, logout_user
import ... | StarcoderdataPython |
3462911 | <gh_stars>10-100
import os
import tensorflow as tf
from dataset.dataset_generator import parse_tfrecord
def flip(image, label):
image = tf.image.random_flip_left_right(image)
return image, label
def pad_and_crop(image, label, shape, pad_size=2):
image = tf.image.pad_to_bounding_box(image, pad_siz... | StarcoderdataPython |
3362819 | from __future__ import annotations
import typing
from solana.publickey import PublicKey
from solana.transaction import TransactionInstruction, AccountMeta
import borsh_construct as borsh
from .. import types
from ..program_id import PROGRAM_ID
class PlayArgs(typing.TypedDict):
tile: types.tile.Tile
layout = bor... | StarcoderdataPython |
9611949 | import datetime
import traceback
import typing
from typing import Any, Optional, Dict, List
from urllib.parse import quote as quote_url
from HABApp.core.const.json import load_json
from HABApp.core.items import BaseValueItem
from HABApp.homeassistant.errors import HomeassistantDisconnectedError, HomeassistantNotReadyY... | StarcoderdataPython |
12826992 | import requests
import time
endpoint = "https://api.github.com/graphql"
interval_retry = 5
max_retries = 5
def create_query(params, query_template):
q = query_template
for k in params.keys():
value = params[k]
if type(value) == int:
q = add_param_number(k, value, q)
else:
q =... | StarcoderdataPython |
1725796 | <filename>doors/inout.py
import json
import os
import pickle
import pandas as pd
def append_csv(data, path):
""" append to a csv """
assert path.endswith(".csv")
to_log = data if isinstance(data, pd.DataFrame) else pd.DataFrame(data)
if "~" in path:
print("Dont include the user path as ~!, us... | StarcoderdataPython |
5124301 | <filename>render/domrender.py
"""
Simple Rendering System
CJH
enhanced by IHM April 2007 to allow for base/xml and app/code/xml overrides
WOULD BE NICE (per IHM):
- make wrapper reload when it has changed, regardless of whether parent has changed (and thus make parent reload also)
- don't reload wrapper when it d... | StarcoderdataPython |
194677 | <filename>pychron/hardware/fusions/fusions_logic_board.py
# ===============================================================================
# Copyright 2011 <NAME>
#
# 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 co... | StarcoderdataPython |
3560496 | <reponame>BattlesnakeOfficial/coding-badly-tron
import os
import cherrypy
from snake import Battlesnake
"""
This is a simple Battlesnake server written in Python.
For instructions see https://github.com/BattlesnakeOfficial/starter-snake-python/README.md
"""
class Server(object):
@cherrypy.expose
@cherrypy.... | StarcoderdataPython |
5005689 | <filename>opm.py<gh_stars>0
#!/usr/bin/env python3
import argparse
import json
import logging
import os
import re
import subprocess
import sys
import xml.etree.ElementTree as ElementTree
from opm.app import App
def main():
try:
parser = argparse.ArgumentParser(description="one-pf-manage")
parser.... | StarcoderdataPython |
3560225 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2018-06-10 21:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournament', '0180_leaguesetting_contact_period'),
]
operations = [
migratio... | StarcoderdataPython |
1825381 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import logging
from secrets import BOT_AUTH_TOKEN, BOT_MYSELF_CHAT_ID
from telegram import Update
from telegram.ext import (CallbackContext, CommandHandler, Filters,
MessageHandler, Updater)
from scraper import OredScraper
log = lo... | StarcoderdataPython |
11216503 | <reponame>jdk5115/Flask
import sqlite3
def show_color(username):
connection = sqlite3.connect('flask_tut.db', check_same_thread=False)
cursor = connection.cursor()
cursor.execute(""" SELECT favorite_color FROM users WHERE Username='{username}' ORDER BY pk DESC;""".format(username = username))
color = ... | StarcoderdataPython |
285056 | from enum import IntEnum, unique
from pathlib import Path
from os.path import (
abspath,
dirname,
)
from typing import (
Dict,
NamedTuple,
Optional,
)
class PathSet(NamedTuple):
input: Path
output: Path
@unique
class Mode(IntEnum):
m1mln = 1 # 100 mln most popular passwords
korel... | StarcoderdataPython |
380445 | import pytest
from resources.models import Reservation
from resources.tests.conftest import *
list_url = '/reports/reservation_details/'
@pytest.fixture
def reservation(resource_in_unit, user):
return Reservation.objects.create(
resource=resource_in_unit,
begin='2015-04-04T09:00:00+02:00',
... | StarcoderdataPython |
4908131 | from components.setups import SDL_Pi_HDC1080
import sys
# Setting main path to HDC1080
sys.path.append('./SDL_Pi_HDC1080_Python3')
hdc1080 = SDL_Pi_HDC1080.SDL_Pi_HDC1080()
# Getting temperature
def HDCtemp(roundto):
temperature = round(hdc1080.readTemperature(), roundto)
return temperature
# Getting humidity
def ... | StarcoderdataPython |
6516265 | <gh_stars>1-10
import matplotlib.pyplot as plt
import numpy as np
temper=100
N=3000
def get_exp_list(temper :int)->list:
return [temper ** (i / 3000) for i in range(3000)]
if __name__ == '__main__':
# x=[i for i in range(3000)]
exp=[100 ** (i / 3000) for i in range(3000)]
sigmoid=[(temper - 1) * 1 / (1... | StarcoderdataPython |
1828810 | <filename>corona_data_collector/tests/test_gender_other.py<gh_stars>0
import logging
from corona_data_collector.tests.common import get_db_test_row, run_full_db_data_test
logging.basicConfig(level=logging.INFO)
# get_db_test_row("3.0.0", "sex", "male") # 734797
# get_db_test_row("3.0.0", "sex", "female") # 734800... | StarcoderdataPython |
1882280 | <reponame>Negrutiu/nsis<filename>Scripts/release.py<gh_stars>10-100
"""
requires Python Image Library - http://www.pythonware.com/products/pil/
requires grep and diff - http://www.mingw.org/msys.shtml
requires command line svn - http://subversion.tigris.org/
requires pysvn - http://pysvn.tigris.org/
requires win32com -... | StarcoderdataPython |
5121619 | <filename>exec/7-5.py<gh_stars>10-100
# 交絡(confounding)
import numpy as np
import seaborn as sns
import pandas
import matplotlib.pyplot as plt
import mcmc_tools
from scipy.stats import norm
# 回帰分析の各種テクニックを学んでいく
# ここでは交絡、モデルの外側に応答変数と説明変数の両方に影響を与える変数が存在する場合。
# data-50m
# Y: 50m走の平均秒速(m/秒)
# Weight: 体重
# Age: 年齢
data_50... | StarcoderdataPython |
3219259 | # This file contains functions and classes which have been used in old
# videos, but which have since been supplanted in manim. For example,
# there were previously various specifically named classes for version
# of fading which are now covered by arguments passed into FadeIn and
# FadeOut
from manim_imports_ext imp... | StarcoderdataPython |
4834791 | <filename>fhirclient/models/paymentreconciliation.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2019-01-22.
# 2019, SMART Health IT.
from . import domainresource
class PaymentReconciliation(domainresource... | StarcoderdataPython |
3446636 | from itertools import chain
from typing import Iterable
from utils import collect_mapping
def passcode_derivation(logs: Iterable[str]) -> Iterable[str]:
binary_relations = set(chain.from_iterable((log[:2], log[1:])
for log in logs))
descendants = []
hierarch... | StarcoderdataPython |
1657102 | <gh_stars>0
from typing import Dict, Union, List
from db.db import db, convert_timestamp
from models.item import ItemJSON
StoreJSON = Dict[int, Union[str, float, float, List[ItemJSON]]]
class StoreModel(db.Model):
__tablename__ = 'stores'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
na... | StarcoderdataPython |
6639021 |
# Baseline Python3 processing script for text version of CALL shared task
#
# The script reads the XML prompt/response grammar supplied with the download
# and uses it to process the text task training data spreadsheet.
#
# A prompt/recognition_result pair is
# accepted if the recognition_result is in the l... | StarcoderdataPython |
9706216 | """Implementation of Bayesian Quadrature."""
class BayesianQuadrature:
"""Bayesian quadrature.
Bayesian quadrature methods build a model for the integrand via function
evaluations and return a belief over the value of the integral on a given
domain with respect to the specified measure.
Paramete... | StarcoderdataPython |
1694857 | <gh_stars>0
from flask import Flask
import os
app = Flask(__name__, static_url_path='')
app.config.from_object('config')
# __file__ refers to the file settings.py
APP_ROOT = os.path.dirname(os.path.abspath(__file__)) # refers to application_top
APP_STATIC = os.path.join(APP_ROOT, 'static')
from app.routes import... | StarcoderdataPython |
3414896 | from hand_gesture_detection import HandGesture
def analyze_hand(frame):
hand_analyzer = HandGesture(frame)
hand_result = hand_analyzer.recognize_hand()
result_dict = {
"hand_result": hand_result,
}
return result_dict
| StarcoderdataPython |
1784503 | <reponame>zahidul-alam/sftp_py<gh_stars>1-10
"""Top-level package for sftp_py."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.2.1'
| StarcoderdataPython |
4991937 | from bs4 import BeautifulSoup
from black_list.items import BLUSForeignTerroristOrgItem
from scrapy import Spider
import os
class BlUsForeignTerroristOrgSpider(Spider):
name = 'BL_US_Foreign_Terrorist_Org'
allowed_domains = ['www.state.gov']
start_urls = ['http://www.state.gov/j/ct/rls/other/des/123085.htm... | StarcoderdataPython |
3307332 | <filename>python/qisys/qixml.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2019 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
"""
This is just a set of convenience functions to be used with The ElemtTree XML API
<http... | StarcoderdataPython |
3285028 | #创建一个游戏设置的类
class Settings:
def __init__(self):
#储存游戏初始化数据
#初始化游戏的静态设置
self.screen_width = 1400
self.screen_height = 750
self.bg_color = (200,200,200)
#设置飞船数量
self.ship_limit = 3
#创建关于子弹的属性
self.bullet_width = 15
self.bullet_height = 30... | StarcoderdataPython |
5088860 | <gh_stars>1-10
# Copyright 2019 The Meson development team
# 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 la... | StarcoderdataPython |
3599303 | <gh_stars>0
import random
from parameters import *
def exponential_latency (avg_latency):
"""
Represents the latency to transfer messages
INPUT: avg_latency (int)
adj_list (networkx dict of dict of dict)
src (node.id)
OUTPUT: list delay values for all nodes/ validators
"""... | StarcoderdataPython |
3532020 |
class Solution:
@staticmethod
def naive(text):
L,wordL,words,word = 0,0,[],""
for c in text:
if c!=" ":
word+=c
wordL+=1
else:
if word!="":
words.append(word)
word=""
L+=1
... | StarcoderdataPython |
1985215 | from setuptools import setup,find_packages
setup(name='pysed',
version='1.0',
description='SED fitting or stellar photometry',
author="<NAME>",
author_email='<EMAIL>',
url='',
packages=find_packages(),
classifiers=[
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Astronomy',... | StarcoderdataPython |
6520944 | # Copyright 2020 Xanadu Quantum Technologies 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 agre... | StarcoderdataPython |
1601739 | import random
def guessing_game():
answer = random.randint(0, 100)
while True:
user_guess = int(input('What is your guess?'))
if user_guess == answer:
print(f'Right! The answer is {user_guess}')
break
if user_guess < answer:
print(f'You guess of {u... | StarcoderdataPython |
1901362 | <reponame>ayulockin/happywhale_kaggle<gh_stars>0
import os
import re
import wandb
import random
import string
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import StratifiedKFold
import tensorflow as tf
def get_stratified_k_fold(df, target, num_folds):
"""
Add fold numbers to... | StarcoderdataPython |
6702102 | <gh_stars>0
# Generated by Django 3.1 on 2020-08-21 14:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main_page', '0002_auto_20200821_0451'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='location... | StarcoderdataPython |
238220 | import csv
import os
from math import nan
from random import sample
from time import perf_counter
from typing import Tuple, List
from .splitter import get_method, list_methods
COMPOUND_SPLIT_CHAR = "_"
COMPOUND_INFIX_TOLERANCE = 4
MAX_TEST_SET_SIZE = 100
class MisalignedError(Exception):
pass
def compare_meth... | StarcoderdataPython |
397861 | """ envs/ folder is for openAIgym-like simulation environments
To use,
>>> import envs
>>> env = envs.make("NAME_OF_ENV")
"""
import gym
def make(env_name, render=False, figID=0, record=False,
ros=False, dirname='', map_name="empty", is_training=True,
num_targets=1, T_steps=... | StarcoderdataPython |
8182011 | <reponame>TonikX/ITMO_ICT_-WebProgramming_2020
from rest_framework import serializers
from lib_app.models import Hall, Book, Reader, Attachment
class HallSerializer(serializers.ModelSerializer):
class Meta:
model = Hall
fields = ("name", "capacity")
class BookSerializer(serializers.ModelSeriali... | StarcoderdataPython |
8009653 | # -*- coding:utf-8 -*-
import subprocess
import sys
from multiprocessing import Process, Value as PValue
from ...utils import logging
logger = logging.get_logger(__name__)
class LocalProcess(Process):
def __init__(self, cmd, in_file, out_file, err_file, environment=None):
super(LocalProcess, self).__in... | StarcoderdataPython |
83996 | import time
import numpy as np
import random
import sys
import os
import argparse
import cv2
import zipfile
import itertools
import pybullet
import json
import time
import numpy as np
import imageio
import pybullet as p
from collect_pose_data import PoseDataCollector
sys.path.insert(1, '../utils/')
from coord_helper i... | StarcoderdataPython |
1829319 | <gh_stars>1-10
from __future__ import absolute_import, division, unicode_literals
import sys
import io
import numpy as np
import logging
import argparse
parser = argparse.ArgumentParser(description='Run SentEval on word embeddings')
parser.add_argument('--path', type=str, help='path to word embeddings (numpy format)... | StarcoderdataPython |
3561513 | <gh_stars>1-10
import discord
from discord.ext import commands
class Test:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def test(self, ctx):
await self.bot.say("!balance")
def setup(bot):
bot.add_cog(Test(bot))
| StarcoderdataPython |
6449697 | from flask import Blueprint, render_template, request
from randomchat.settings import settings
# import socketio
from flask_socketio import SocketIO
import random
import logging
# Configuration
# Event table
# Default built-in SocketIO events are not in the table
EVENTS = {
'PAIRFOUND' : 'pairfound',
'PAIRLOST' :... | StarcoderdataPython |
4964067 | import tkinter as tk
from tkinter.ttk import Progressbar
from tkinter import filedialog, messagebox
import os
import errno
from threading import Thread
import program_logic
def get_paths_in_dir(directory):
filenames = os.listdir(directory)
return [os.path.abspath(os.path.join(directory, name)) for name in fil... | StarcoderdataPython |
3239630 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyBcrypt(PythonPackage):
"""Modern password hashing for your software and your servers"""
... | StarcoderdataPython |
1669295 | from django.conf.urls import url
from django.contrib.auth.views import login,logout
from appPortas.views import *
urlpatterns = [
url(r'^porta/list$', porta_list, name='porta_list'),
url(r'^porta/detail/(?P<pk>\d+)$',porta_detail, name='porta_detail'),
url(r'^porta/new/$', porta_new, name='porta_new'),
... | StarcoderdataPython |
1916540 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ObjectContainer.ui'
#
# Created: Tue Aug 27 19:18:25 2013
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... | StarcoderdataPython |
1975607 | <filename>tests/__init__.py
"""Check runtime errors."""
| StarcoderdataPython |
1997278 | <reponame>Aierhaimian/VT-ADL<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Mon May 24 17:19:16 2021
@author: pankaj.mishra
"""
from scipy.ndimage import gaussian_filter, median_filter
import torch
import numpy as np
import matplotlib.pyplot as plt
import cv2
from skimage.measure import label
def Normalise(s... | StarcoderdataPython |
5041444 | <reponame>hamadichihaoui/simple-faster-rcnn-pytorch<gh_stars>0
from model.faster_rcnn_vgg16 import FasterRCNNVGG16
from model.faster_rcnn_vit import FasterRCNNVIT
| StarcoderdataPython |
3305144 | <reponame>V-Sekai/V-Sekai-Blender-tools
import bpy
from bpy.utils import register_class, unregister_class
from bpy.types import NodeSocket
from . node_object import NODE_OBJECT
class SOCKET_OBJECT(NodeSocket):
'''Custom node socket type'''
bl_idname = 'SOCKET_RENIM_OBJECT'
bl_label = "Custom Node Socket"
... | StarcoderdataPython |
8045045 | <filename>niyopolymers/niyopolymers/doctype/interview/interview.py
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Atriina and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Interview(Document):
def g... | StarcoderdataPython |
270946 | from __future__ import annotations
from typing import Iterable, Union
from jigu.core.auth.transaction import TxInfo
from jigu.query.msginfo import MsgInfosQuery
from jigu.util.pretty import PrettyPrintable, pretty_repr
__all__ = ["TxInfosQuery"]
class TxInfosQuery(PrettyPrintable):
def __init__(self, txinfos: ... | StarcoderdataPython |
202216 | import os
import pymongo
import tushare as ts
import datetime
import time
import math
import traceback
class CrawlStockData(object):
def __init__(self,**kwarg):
self.IP = kwarg['IP']
self.PORT = kwarg['PORT']
self.ConnDB()
self.stockDailyPath = 'D:\\stock_daliy'
def ConnDB(self):
self._C... | StarcoderdataPython |
3545045 | <reponame>gusmasaakisuga/enviroplus-python
#!/usr/bin/env python3
import time
from bme280 import BME280
try:
from smbus2 import SMBus
except ImportError:
from smbus import SMBus
try:
# Transitional fix for breaking change in LTR559
from ltr559 import LTR559
ltr559 = LTR559()
except ImportError:
... | StarcoderdataPython |
8103017 | # -*- Mode: Python; py-indent-offset: 4 -*-
# pygobject - Python bindings for the GObject library
# Copyright (C) 2012 <NAME>
#
# gi/_signalhelper.py: GObject signal binding decorator object
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
... | StarcoderdataPython |
3459127 | <reponame>NoopDog/azul
from collections import (
defaultdict,
)
from itertools import (
chain,
product,
)
from typing import (
Mapping,
Sequence,
)
from azul.collections import (
NestedDict,
)
from azul.types import (
JSON,
)
def make_stratification_tree(files: Sequence[Mapping[str, str]]... | StarcoderdataPython |
1748986 | import pkg_resources
__version__ = pkg_resources.require('bionet.ted')[0].version
| StarcoderdataPython |
1845439 | <gh_stars>0
import logging
from nameko.dependency_providers import Config
from nameko.rpc import rpc
from nameko.testing.services import worker_factory
from . import utilities
from .languages import get_languages
from .parsers import get_parser
from .schemas import CommentSchema, FunctionSchema
logger = logging.getL... | StarcoderdataPython |
12840523 |
from django.test import TestCase
from django.db import models
from hutils.managers import QuerySetManager
class TestModel(models.Model):
i = models.IntegerField()
objects = QuerySetManager()
class QuerySet(models.query.QuerySet):
def less_than(self, c):
return self.filter(id__lt=c)
class QuerySetM... | StarcoderdataPython |
6685209 | <reponame>101arrowz/higlass-server
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-05-31 16:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tilesets', '0002_auto_20170223_1629'),
]
operati... | StarcoderdataPython |
1694468 | <filename>2019/day10_2.py
import fileimp
import math
def bestaster(asters):
maxloc = [0,0,0]
for y0 in range(len(asters)):
for x0 in range(len(asters[y0])):
slopes = {}
if asters[y0][x0] == 1:
for y1 in range(len(asters)):
for x1 in range(len(... | StarcoderdataPython |
3441104 | """An AppProvider Service Provider."""
from ..autoload import Autoload
from ..commands import (
AuthCommand,
CommandCommand,
ControllerCommand,
DownCommand,
InfoCommand,
JobCommand,
KeyCommand,
MailableCommand,
MiddlewareCommand,
ModelCommand,
ModelDocstringCommand,
Prov... | StarcoderdataPython |
9729062 | import base64
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.fernet import Fernet
class KeyGenerator:
"""The Key Generator class does what the name suggests. It gen... | StarcoderdataPython |
242151 | import wx
import base
import dialogs
from collections import OrderedDict
import wx.dataview #for TreeListCtrl
from instructions import *
from wx.lib.pubsub import setuparg1
from wx.lib.pubsub import pub
class SequencesPanel(wx.Panel):
def __init__(self, parent, path, name):
wx.Panel.__init__(sel... | StarcoderdataPython |
1778791 | <reponame>idc9/yaglm
from time import time
from warnings import warn
from yaglm.solver.base import GlmSolverWithPath
from yaglm.autoassign import autoassign
from yaglm.utils import is_multi_response, get_shapes_from, clip_zero
from yaglm.config.penalty_utils import get_flavor_kind
from yaglm.config.penalty import NoPe... | StarcoderdataPython |
90684 | <gh_stars>0
# coding=utf-8
import unicodedata
class Config(object):
# 定义构造方法
def __init__(self): #__init__() 是类的初始化方法;它在类的实例化操作后 会自动调用,不需要手动调用;
# 设置属性
self.stopwords = [" ", " ", " ", ",", ",", ".", "。", "、", "!", "!", "?", "?", ";", ";", "~", "~", "·", "·", ".", "…", "-",
"#_", "—... | StarcoderdataPython |
1873900 | # Copyright (c) 2021 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, s... | StarcoderdataPython |
3226627 | <reponame>thgazis/django-oscar-stores<gh_stars>0
from django.apps import apps
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.i18n ... | StarcoderdataPython |
11290162 | self.button = Button(frame, text='A', command=curry(transcript.append, 'A'))
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.