id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
180376 | <filename>music.py
from itertools import cycle, repeat, chain, islice
from instruments import default_tone, kick, silence
def play_sequence(sequence, instrument=default_tone):
for freq, duration in sequence:
yield instrument(freq, duration)
def play_drumbase(beats, duration, drum=kick):
for x in be... | StarcoderdataPython |
3245291 | """
For the ``future`` package.
Turns any print statements into functions and adds this import line:
from __future__ import print_function
at the top to retain compatibility with Python 2.6+.
"""
from libfuturize.fixes.fix_print import FixPrint
from libfuturize.fixer_util import future_import
class FixPrintWit... | StarcoderdataPython |
120440 | from typing import List
from inspect import signature as create_inspect_signature
from injecta.dtype.DType import DType
from injecta.service.class_.InspectedArgument import InspectedArgument
from injecta.service.class_.InspectedArgumentResolver import InspectedArgumentResolver
from injecta.module import attribute_loade... | StarcoderdataPython |
4801903 | #!/usr/bin/env python3
tests = [
# RMW Hz, runs
('f', 80, 10),
('c', 80, 10),
('f', 100, 10),
('c', 100, 10),
('f', 120, 10),
('c', 120, 10),
]
rmw_names = {'f': 'FastRTPS', 'c': 'CycloneDDS'}
rmw_colors = {
'f': [
'#0000ff',
'#0000ef',
'#0000df',
'#0000c... | StarcoderdataPython |
3219745 | <gh_stars>1-10
import cv2
import mediapipe as mp
import math
from imutils.video import VideoStream
from imutils.video import FileVideoStream
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import savgol_filter
import collections
class PoseEstimator:
def __init__(self, window_size=8, smoot... | StarcoderdataPython |
1685076 | <filename>helheim-tseries_decomp.py
## Time series decomposition on Helheim velocity
## 6 May 2020 EHU
import numpy as np
import matplotlib.pyplot as plt
import iceutils as ice
import sys
## Set up combined hdf5 stack
#fpath='/Users/lizz/Documents/Research/Gld-timeseries/Stack/'
hel_stack = ice.MagStack(files=['vx.h5... | StarcoderdataPython |
1775676 | <filename>code/method/settings.py<gh_stars>0
from enum import Enum
class DistanceMetric(Enum):
EUCLIDEAN = 'euclidean'
COSINE = 'cosine'
MANHATTAN = 'manhattan'
class CommunityMethod(Enum):
LOUVAIN = 'LOUVAIN'
GREEDY = 'GREEDY'
GIRVAN = 'GIRVAN'
LABEL_PROPAGATION = 'LABEL_PROPAGATION'
cla... | StarcoderdataPython |
3300188 | <filename>src/Application/PythonScriptModule/pymodules_old/circuits/core/events.py
# Package: events
# Date: 11th April 2010
# Author: <NAME>, prologic at shortcircuit dot net dot au
"""Events
This module define the basic Event object and commmon events.
"""
class Event(object):
"""Create a new Event Obje... | StarcoderdataPython |
3231873 | <reponame>sem6-nu/CAPSTONE-I
import requests
import matplotlib.pyplot as plt
from PIL import Image
from matplotlib import patches
from io import BytesIO
import os
import ObjectAPIConfig as cnfg
image_path = os.path.join('images.jpg')
image_data = open(image_path, "rb").read()
subscription_key, object_api_url = cnfg.c... | StarcoderdataPython |
1798664 | <reponame>zayne-siew/AutoGFormBot
#!/usr/bin/env python3
"""
Abstract base classes (ABCs) for Google Form questions.
This script serves as an interface for documenting function implementation.
Usage:
This script should not be used directly, other than its ABC functionalities.
"""
from abc import ABC, abstractmet... | StarcoderdataPython |
3216994 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Interactive Windows Registry analysis tool.
preg is an interactive Windows Registry analysis tool that utilizes
plaso Windows Registry parser plugins, dfwinreg Windows Registry and
dfvfs storage media image capabilities.
"""
from __future__ import print_func... | StarcoderdataPython |
14866 | from assets.lambdas.transform_findings.index import TransformFindings
import boto3
from moto import mock_s3
def __make_bucket(bucket_name: str):
bucket = boto3.resource('s3').Bucket(bucket_name)
bucket.create()
return bucket
@mock_s3
def test_fix_dictionary():
bucket = __make_bucket('tester')
tr... | StarcoderdataPython |
1702635 | <gh_stars>0
# python imports
import datetime
import os
# django imports
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.utils.translation import ugettext_lazy as _
# resources imports
from resources.config import CSS
from resources.config import RESOURCE_C... | StarcoderdataPython |
38406 | # BIP39
from bip_utils.bip.bip39_ex import Bip39InvalidFileError, Bip39ChecksumError
from bip_utils.bip.bip39 import (
Bip39WordsNum, Bip39EntropyBitLen,
Bip39EntropyGenerator, Bip39MnemonicGenerator, Bip39MnemonicValidator, Bip39SeedGenerator
)
# BIP32
from bip_utils.bip.bip32_ex import Bip32KeyError, Bip32Pat... | StarcoderdataPython |
64205 | import urllib.request
import json
import pytest
# import uuid
# import decimal
#from server.models.partner import Partner
base_url = "http://localhost:5000/v1/users/11<PASSWORD>/cart"
headers = {'Content-Type': 'application/json;charset=UTF-8'}
class TestCart(object):
def test_get_list_200(self):
res =... | StarcoderdataPython |
1674424 | <reponame>Matej-Chmel/KVContest-data-test-suite
from random import randint
from src.common import storage
from src.dataset_generator import data
class Implementation:
cyc_cmd = None
I = Implementation
def add_line() -> str:
key, val = None, None
while True:
cmd_tuple = next(I.cyc_cmd)
if ... | StarcoderdataPython |
1653176 | <reponame>CyberFlameGO/peeringdb
# Generated by Django 2.2.12 on 2020-05-13 10:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("peeringdb_server", "0035_traffic_levels"),
]
operations = [
migrations.AlterModelOptions(
name... | StarcoderdataPython |
1779325 | <reponame>paregorios/tfc-campa-epigraphy
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Parse Campā Inventory row into places
"""
from campa.geography.place import CampaPlace
from campa.geography.logger import SelfLogger
from campa.geography.norm import norm
from colorama import Fore, Style
from copy import deepco... | StarcoderdataPython |
3266524 | <reponame>pashakondratyev/ParseBook<filename>parse.py<gh_stars>1-10
import sys
from threads.threads import Threads, Thread, Message
import json, html
THREAD_TAG = '<div class="thread">'
MESSAGE_TAG = '<div class="message">'
def main(messages_path, out_path):
with open(messages_path) as fp:
messages_html = fp.r... | StarcoderdataPython |
1765867 | from __future__ import (absolute_import, division, print_function)
import cProfile
import os
import time
from existing_code import myinterface
from mycode import validator
from mycode.cpp_equal_share import *
import traceback
from mycode.utilf import println
import util
def test_ga(cn):
ces = CppEqualShare(cn)
ces.r... | StarcoderdataPython |
1662156 | <filename>dokx-search/dokx-build-search-index.py
"""
Create and populate a minimal PostgreSQL schema for full text search
"""
import sqlite3
import glob
import os
import re
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--output", type=str, help="Path to write SQLite3 search index")
parser.ad... | StarcoderdataPython |
3377243 | <reponame>fsmosca/python-ataxx
import ataxx
import ataxx.players
import ataxx.pgn
import random
import string
import copy
import unittest
class TestMethods(unittest.TestCase):
def test_fen(self):
fens = [
"x5o/7/7/7/7/7/o5x x 0 1",
"x5o/7/2-1-2/7/2-1-2/7/o5x o 0 1",
"x5o... | StarcoderdataPython |
3292533 | import argparse
import os
import sys
import pandas as pd
from keras import backend as K
from keras_radam import RAdam
from augmentations import *
from losses import *
from model import *
from siim_data_loader import *
from utils import *
from segmentation_models import Unet
parser = argparse.ArgumentParser()
parser.a... | StarcoderdataPython |
80066 | import coreapi
import json
import requests
from rest_framework import status, renderers
from rest_framework.response import Response
from rest_framework.views import APIView
from config.settings.base import FAIRSHAKE_TOKEN
from presqt.api_v1.utilities import (
fairshake_request_validator, fairshake_assessment_val... | StarcoderdataPython |
71084 | <reponame>jason-zl190/sisr
import tensorflow as tf
import subprocess
import atexit
class StartTensorBoard(tf.keras.callbacks.Callback):
def __init__(self, log_dir):
super()
self.log_dir = log_dir
def start_tensorboard(self, log_dir):
try:
p = subprocess.Popen(['tens... | StarcoderdataPython |
40719 | <reponame>rafaelcorazzi/game-scraper<filename>src/infrastructure/services/scraper_services.py
import bs4
import requests
from bs4 import BeautifulSoup
import base64
import hashlib
from typing import List
import re
from src.helpers.utils import Utils
from src.domain.console_domain import ConsolePlataform
from src.domain... | StarcoderdataPython |
3278144 | <reponame>martinfleis/seashore-streets<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# # Measure contextual morphometric characters
#
# Computational notebook 03 for Climate adaptation plans in the context of coastal settlements: the case of Portugal.
#
# Date: 27/06/2020
#
# ---
#
# This notebook measure conte... | StarcoderdataPython |
3394810 | import argparse
import json
import datetime
from convert_json_line_to_point import convert_json_line_to_point
from influxdb.line_protocol import make_lines
def main(k6json_location, output_location):
with open(k6json_location, 'r') as f:
lines = f.readlines()
output_file = open(output_location, 'w+'... | StarcoderdataPython |
198112 | <filename>setup.py
#!/usr/bin/env python
from setuptools import setup
ver_dic = {}
version_file = open("logpyle/version.py")
try:
version_file_contents = version_file.read()
finally:
version_file.close()
exec(compile(version_file_contents, "logpyle/version.py", 'exec'), ver_dic)
with open("README.md", "r") ... | StarcoderdataPython |
1685019 | <gh_stars>0
"""
get words which are both semantically and phonetically associated with the given word
"""
from .candidate.datamuse import meanslike
from .candidate.wordnet import senselike
from .measurement.measure import measure
def get_candidate(word):
"""get candidate word set
@word -- the given word
... | StarcoderdataPython |
1678569 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by <NAME> <<EMAIL>>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Takes care of adapting pyDAL to web2py's needs
-----------------------------------------------
"""
from pydal import DAL as DAL... | StarcoderdataPython |
3396558 | n = int(input('Insira o numero que quer saber da tabuada: '))
if n > 0:
for i in range(1, n + 1):
for j in range(i, i * n + 1, i):
print(j,end=' ')
print()
else:
print('ERRO. Insira um número maior que zero.')
| StarcoderdataPython |
3350191 | """Execute all known QJs, run the query portion of a QJ, remediate a QJ and prune results according to Job config
settings"""
import os.path
from typing import Any, Dict
from altimeter.qj.config import QJHandlerConfig
from altimeter.qj.lambdas.executor import executor
from altimeter.qj.lambdas.pruner import pruner
fr... | StarcoderdataPython |
3376861 | <filename>code/robotling/main.py
# ----------------------------------------------------------------------------
# main.py
# Main program; is automatically executed after reboot.
#
# For decription, see `hexbug.py`
#
# The MIT License (MIT)
# Copyright (c) 2019 <NAME>
# 2018-12-22, reorganised into a module with the cla... | StarcoderdataPython |
184004 | from bs4 import BeautifulSoup
import requests
import json
# instagram URL
URL = "https://www.instagram.com/{}/"
# parse function
def parse_data(s):
# creating a dictionary
data = {}
# splitting the content
# then taking the first part
s = s.split("-")[0]
# again splitting the content
s = s.... | StarcoderdataPython |
1728865 | <reponame>y2kconnect/utilities
# -*- encoding: utf-8 -*-
# python apps
import chardet
import magic
import os
def analysis_filename(f_name):
'解析文件名'
s_dir = s_name = base_name = ext_name = None
s_dir, s_name = os.path.split(f_name)
if s_name:
base_name, ext_name = os.path.splitext(s_name)
... | StarcoderdataPython |
3213881 | <filename>chrome/test/data/android/manage_render_test_goldens.py
#!/usr/bin/env python
#
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Simple script to automatically download all current golden images ... | StarcoderdataPython |
1636251 | <reponame>am1tyadava/amityadav_blog
from __future__ import unicode_literals
from django.contrib import admin
from django.core.urlresolvers import NoReverseMatch
from django.core.urlresolvers import reverse
from django.utils.html import conditional_escape
from django.utils.html import format_html_join
from django.utils... | StarcoderdataPython |
76746 | from tensorflow.keras.models import load_model
from time import sleep
from keras.preprocessing.image import img_to_array
from keras.preprocessing import image
import cv2
import numpy as np
import os
from mtcnn import MTCNN
# Importing the MTCNN detector to detect faces
detector = MTCNN()
# Path to the emotion detecti... | StarcoderdataPython |
53557 | import enum
import sys
import os.path
TokenType = enum.Enum("TokenType", "form lemma parse morph_lemma all")
ChunkType = enum.Enum("ChunkType", "book chapter verse paragraph pericope")
chunk_data_filename = {
ChunkType.book: "books.txt",
ChunkType.chapter: "chapters.txt",
ChunkType.verse: "verses.txt",
... | StarcoderdataPython |
1657939 | from apps.common.func.CommonFunc import *
from apps.common.func.LanguageFunc import *
from django.shortcuts import render, HttpResponse
from urllib import parse
from apps.common.config import commonWebConfig
from apps.common.func.WebFunc import *
from apps.ui_globals.services.global_textService import global_textServic... | StarcoderdataPython |
1673869 | <gh_stars>0
#!/usr/bin/env python3
import logging
from .device import *
class Site(object):
def __init__(self, unifi, data):
self.unifi = unifi
self.id = data['_id']
self.desc = data['desc']
self.name = data['name']
self.role = data['role']
def api_endpoint(self, endpo... | StarcoderdataPython |
1602371 | import numpy as np
from collections.abc import Sequence
from typing import BinaryIO
from ..gmxflow import GmxFlow, GmxFlowVersion
# Fields expected to be read in the files.
__FIELDS = ['X', 'Y', 'N', 'T', 'M', 'U', 'V']
# Fields which represent data in the flow field, excluding positions.
__DATA_FIELDS = ['N', 'T',... | StarcoderdataPython |
4841783 | <gh_stars>0
from .anon import anonymize_url
from .log_util import quiet_loggers, setup
| StarcoderdataPython |
1776371 | from unittest import TestCase
from orcid2vivo_app.utility import clean_orcid, is_valid_orcid
class TestUtility(TestCase):
def test_clean_orcid(self):
orcid = '0000-0003-1527-0030'
# Test with orcid.org prefix.
self.assertEqual(clean_orcid('orcid.org/' + orcid), orcid)
# Test with... | StarcoderdataPython |
118788 | <gh_stars>0
from string import Template
"""Insert Query template"""
db_insert = Template("INSERT INTO ${voms_tbl} (subject, issuer, vo_id)"
" SELECT curr.subject, curr.issuer, curr.vo_id"
" FROM ${voms_tbl}_temp curr LEFT JOIN ${voms_tbl} prev"
" ON curr.s... | StarcoderdataPython |
3273034 | <reponame>dvalentina/2019-2-Track-Backend-V-Danilova
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
def index(request):
return render(request, 'index.html')
def login(request):
return render(request, 'login.html')
@login_required
def home(request):
return re... | StarcoderdataPython |
3327996 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by <NAME>
import unittest
from skbio import Sequence
import pandas.testing as pdtest
from allfreqs.classes import MultiAlignment, Reference
from allfreqs.tests.constants import (
SAMPLE_SEQUENCES_DICT, SAMPLE_SEQUENCES_TABMSA,
SAMPLE_REF_FASTA, SAMPLE_RE... | StarcoderdataPython |
80132 | # -*- coding: utf-8 -*-
"""
Created on Sun May 14 13:54:22 2017
@author: <NAME> @ Gilmour group @ EMBL Heidelberg
@descript: Functions for converting fluorescence intensity distributions
into a point cloud representation and then register them to
the image frame.
"""
#-------------------... | StarcoderdataPython |
94373 | #Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s)
# abs can be substitued for another built-in functions
print(abs.__doc__) | StarcoderdataPython |
1735393 | <reponame>voxity/vox-ui-api<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
def config_loader(config, environment):
"""
Charge la configuration de l'application.
:param flask.Config config: généralement app.config
:param st... | StarcoderdataPython |
1763349 | # -*- coding: utf-8 -*-
from datetime import datetime, tzinfo
import email
from email.header import decode_header
from email.utils import parsedate_tz, mktime_tz
import re
from tempfile import TemporaryFile
import unicodedata
from trac.attachment import Attachment
from trac.db import Table, Column, Index
from trac.mi... | StarcoderdataPython |
140120 | import datetime
import json
import os
import discord
from discord.errors import HTTPException
from discord.ext import commands
class Logging(commands.Cog, description="Keep a track of what members do in your server with this category."):
def __init__(self, bot):
self.bot = bot
with open("storage/... | StarcoderdataPython |
1767198 | from microbit import *
import radio
radio.config(group=0)
radio.on()
display.show("-")
while True:
if button_a.was_pressed():
radio.send("A")
if button_b.was_pressed():
radio.send("B")
try:
msg = radio.receive()
if msg is not None:
if len(msg) > 0:
... | StarcoderdataPython |
187388 | <filename>utils/generate_det_roidb.py
import argparse
import os
import pickle as pkl
import numpy as np
from detection.utils.list_util import load_img_list
# from pycocotools.coco import COCO
#
#
# dataset_split_mapping = {
# "train2014": "train2014",
# "val2014": "val2014",
# "valminusminival2014": "val201... | StarcoderdataPython |
111516 | <gh_stars>10-100
#!/usr/bin/env python3
#
# vsim_defines.py
# <NAME> <<EMAIL>>
#
# Copyright (C) 2015-2017 ETH Zurich, University of Bologna
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
#
# templates for vcompile.csh s... | StarcoderdataPython |
3209151 | import json
def main():
with open("./_data/componentes-curriculares.json", "r") as file:
componentes = json.load(file)
for componente in componentes:
codigo = componente['codigo']
print('Gerando Componente', componente['codigo'], ' - ', componente['nome'])
text = f"---\ncodigo:... | StarcoderdataPython |
1678685 | """
Bing (Videos)
@website https://www.bing.com/videos
@provide-api yes (http://datamarket.azure.com/dataset/bing/search)
@using-api no
@results HTML
@stable no
@parse url, title, content, thumbnail
"""
from json import loads
from lxml import html
from searx.engines.xpath import extract_t... | StarcoderdataPython |
79619 | import copy
import logging
from abc import ABC
from typing import Dict, Optional, Type, Union
import torch
from pytorch_lightning import LightningModule
from torch.nn.modules import Module
from torch.utils.data import DataLoader
from .generic_model import GenericModel
from .lightning_model import LightningModel
logg... | StarcoderdataPython |
4836492 | import numpy as np
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from sklearn.cluster import MiniBatchKMeans, KMeans
from tqdm import tqdm
import joblib
import seaborn as sns
import matplotlib.pyplot as plt
import os
import pickle
from argparse import ArgumentParser
def learn_f0_kmeans(f0_pat... | StarcoderdataPython |
3260425 | <gh_stars>1-10
from .haze_net import AODNet
| StarcoderdataPython |
1763108 | <reponame>serpis/pynik
# coding: utf-8
from commands import Command
import random
import datetime
import utility
import standard
import re
class Game:
def __init__(self, name):
self.name = name
self.players = {}
self.timeout = None
self.time = None
self.current_question = None
self.timeout_streak = 0
s... | StarcoderdataPython |
169228 | # coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# 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 applicab... | StarcoderdataPython |
60845 | <reponame>oushu1zhangxiangxuan1/learn_leveldb<gh_stars>0
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: core/contract/proposal_contract.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.pro... | StarcoderdataPython |
1698937 | """
@brief test log(time=4s)
@author <NAME>
"""
import sys
import os
import unittest
import warnings
from docutils.parsers.rst import directives
from sphinx.errors import ExtensionError
from pyquickhelper.pycode import get_temp_folder
from pyquickhelper.helpgen import rst2html, rst2rst_folder
from pyquickhelp... | StarcoderdataPython |
1665079 | <reponame>armandok/pySLAM-D<gh_stars>1-10
import habitat_sim
from Config import Config
class Simulator:
def __init__(self):
test_scene = Config().scene
sim_settings = {
"width": 640, # Spatial resolution of the observations
"height": 480,
"scene": test_scene, ... | StarcoderdataPython |
1781079 | from __future__ import annotations
from typing import Optional, TYPE_CHECKING, Union
from pyspark.sql.types import StructType, DataType
from spark_auto_mapper_fhir.fhir_types.list import FhirList
from spark_auto_mapper_fhir.fhir_types.string import FhirString
from spark_auto_mapper_fhir.extensions.extension_base impo... | StarcoderdataPython |
3242538 | <filename>mediaProject/account/views.py
from django.core.exceptions import ValidationError
from django.utils import timezone
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.shortcuts import render, redirect
from django.contrib.auth imp... | StarcoderdataPython |
48515 | """add root_cause table
Revision ID: 7ddd008bcaaa
Revises: <PASSWORD>
Create Date: 2021-11-06 19:20:07.167512
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7ddd008bcaaa'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | StarcoderdataPython |
4802913 | <reponame>zhoulh0322/zfused_outsource_old
# Copyright 2017 by <NAME>. All Rights Reserved.
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your... | StarcoderdataPython |
1638886 | <reponame>Terence-Guan/Python.HackerRank
def mean(values: list) -> int:
length = len(values)
result = 0
for value in values:
result += value
result /= length
return result
def median(values: list) -> float:
length = len(values)
values = sorted(values)
if length % 2 != 0:
return values[length // 2]
else:
... | StarcoderdataPython |
1656044 | <reponame>YuriiShuginin/ITMO-ICT-Frontend-2021
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import SignupAPIView, NoteViewSet,\
Public, Logout, ProfileView,ConfidentProfileView,\
NoteViewDetail,NoteDetailCreate,PublicViewDetail
from rest_framework_simplejwt... | StarcoderdataPython |
3267524 | from tinkerforge.bricklet_joystick import BrickletJoystick
from tinkerforge.bricklet_multi_touch import BrickletMultiTouch
from modules.navigation import StateModule
class InputModule(StateModule):
inputs = {}
def try_bricklet(self, uid, device_identifier, position):
if device_identifier == ... | StarcoderdataPython |
3253024 | <reponame>gary-stu/FL
#!/usr/bin/env python3
import platform
from datetime import datetime
import os
from random import choice, randint, seed
from subprocess import Popen
from time import sleep
from signal import SIGTERM
class FL:
def __init__(self):
# Set parameters here
# both path must start with a r: r'', r'... | StarcoderdataPython |
186169 | from src.config import ExperimentConfig
from tensorflow.python.keras.layers.core import Dropout, Masking
from src.features.sequences.transformer import SequenceMetadata
import tensorflow as tf
from typing import Any, List, Dict
from .metrics import (
MulticlassAccuracy,
MulticlassTrueNegativeRate,
Multiclas... | StarcoderdataPython |
151518 | <reponame>mewbak/hypertools<gh_stars>1000+
# -*- coding: utf-8 -*-
"""
=============================
Normalizing your features
=============================
Often times its useful to normalize (z-score) you features before plotting, so
that they are on the same scale. Otherwise, some features will be weighted more
he... | StarcoderdataPython |
110949 | <filename>watcherclient/tests/unit/v1/test_scoring_engine_shell.py
# Copyright (c) 2016 Intel
#
# 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
#
... | StarcoderdataPython |
1657120 | from lib_user.execmd import ExeCmd
from time import sleep
ERROR_CODE_ONE = 1
ERROR_CODE_ZERO = 0
class Groups:
def __init__(self, token, url):
self._token = token
self._url = url
self._exe_cmd = ExeCmd()
def create_group(self, group_name, description):
"""
Create a use... | StarcoderdataPython |
1609598 |
import os
import numpy as np
import networkx as nx
from tqdm import tqdm
from utils import load_networks
# Get File Names
data_path = os.path.join(os.path.dirname(__file__), '..', '..', 'Data')
networks_dir = load_networks(os.path.join(data_path, 'Generated', 'Barabasi'))
for net_dir in networks_dir:
print('Ca... | StarcoderdataPython |
3341148 | <reponame>cacjorge/lcs_adm-pci-ku3
import os
from itertools import chain
from glob import glob
directory = '.'
for filename in os.listdir(directory):
if filename.endswith(".txt"):
f = open(filename, 'r')
text = f.read()
lines = [text.lower() for line in filename]
with open... | StarcoderdataPython |
4827057 | <reponame>Izoniks-prog/Dreams-Island
import pygame
from src.entities.vegetations.vegetation import Vegetation
SIZE_X = 17
SIZE_Y = 16
class Three(Vegetation):
def __init__(self, x: int, y: int, path: str):
super().__init__(x, y, path)
self.image = pygame.image.load(path)
self.rect = se... | StarcoderdataPython |
48247 | <filename>functions/time.py
import time, pytz
from datetime import datetime, timedelta
from logger.main import *
def get_day_hh(event, resource):
"""
Get current day + hour (using gmt by default if time parameter not set)
"""
time_zone = os.getenv('TIME', 'gmt')
if time_zone == 'local':
hh... | StarcoderdataPython |
1747153 | 'p4a example service using oscpy to communicate with main application.'
from random import sample, randint
from string import ascii_letters
from time import localtime, asctime, sleep
from oscpy.server import OSCThreadServer
from oscpy.client import OSCClient
CLIENT = OSCClient('localhost', 3002)
stopFlag = False
d... | StarcoderdataPython |
122774 | <gh_stars>0
import ast
import json
from datetime import datetime
from tweepy import Status
from twitterproducer.tweets.itweets_provider import ITweetsProvider
status_json = "{'created_at': 'Wed Aug 26 03:22:48 +0000 2020', 'id': 1298460861900652545, 'id_str': " \
"'1298460861900652545', 'full_text': 'h... | StarcoderdataPython |
3347421 | <gh_stars>1-10
#!python
from .more_page_builder import MorePageBuilder
from .page_builder import StopOutput
import queue
import threading
# Signal to send to the input queue when there is no more input
END_OF_INPUT = None
# Return code if output was interrupted by the user (e.g. the user pressed ctrl+c)
OUTPUT_STOPPE... | StarcoderdataPython |
1626358 | from datetime import datetime
import nonebot
import pytz
from aiocqhttp.exceptions import Error as CQHttpError
from json import loads
from requests import get
from bot.plugins.pluginsConfig import *
@nonebot.scheduler.scheduled_job('cron', hour=NotificationTime['hour'], minute=NotificationTime['minute'])
async def _... | StarcoderdataPython |
1622350 | '''
Give a sorted matrix, search for an element.
EXAMPLE:
Input : mat[4][4] = { {10, 20, 30, 40},
{15, 25, 35, 45},
{27, 29, 37, 48},
{32, 33, 39, 50}};
x = 29
Output : Found at (2, 1)
SOLUTION:
We can do a binary search in every row on... | StarcoderdataPython |
1792233 | <filename>app/tests/sample_data/item_samples.py<gh_stars>1-10
import json
from django.contrib.gis.geos import GEOSGeometry
from stac_api.models import BBOX_CH
from stac_api.utils import fromisoformat
geometries = {
'switzerland': GEOSGeometry(BBOX_CH),
'switzerland-west':
GEOSGeometry(
'S... | StarcoderdataPython |
36048 | import os
from .abstract_command import AbstractCommand
from ..services.state_utils import StateUtils
from ..services.state import StateHolder
from ..services.command_handler import CommandHandler
from ..services.console_logger import ColorPrint
class Start(AbstractCommand):
command = ["start", "up"]
args = ... | StarcoderdataPython |
3227373 | <filename>traffic/data/eurocontrol/ddr/freeroute.py
import re
from functools import lru_cache
from io import StringIO
from pathlib import Path
from typing import Any, Set, Tuple
import geopandas as gpd
import pandas as pd
from shapely.geometry import MultiPoint
from shapely.ops import unary_union
from ....data impor... | StarcoderdataPython |
3316767 | from locust import HttpUser, task, between
class BookInfoUser(HttpUser):
wait_time = between(5, 15)
@task(1)
def productpage(self):
self.client.get("/productpage")
| StarcoderdataPython |
154836 | # ~*~ utf-8 ~*~
import sys
sys.stdin = open("sum.in") # Закомментируйте эту строку для ввода с клавиатуры
sys.stdout = open("sum.out", "w") # Закомментрируйте эту строку для вывода на экран
A, B = int(input()), int(input()) # Вводим 2 целых A и B (они в разных строках)
print (A + B) | StarcoderdataPython |
3300406 | """
chop_map.py
A collection of methods which allow to chop a map around an atomic model.
The map can be chopped in three different ways:
- using a cub around the atomic residue with hard edges
- using certain radius around atomic residue with hard edges
- using certain radius around atomic residue with soft edges
Co... | StarcoderdataPython |
181704 | <filename>challenge22.py
numbers = [9, 8, 72, 22, 21, 81, 2, 1, 11, 76, 32, 54]
def highest_num(numbers_in):
highest = numbers_in[0]
for count in range(len(numbers_in)):
if highest < numbers_in[count]:
highest = numbers_in[count]
return highest
highest_out = highest_num(numbers)
... | StarcoderdataPython |
66838 | #!/usr/bin/env pytest
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: gdalinfo.py testing
# Author: <NAME> <<EMAIL>>
#
###############################################################################
# Copyright (c) 2010, <NAME> <even... | StarcoderdataPython |
3382524 | <filename>bin/genwrap.py
#!/usr/bin/env python
"""Generic wrapper.
"""
import sys
import argparse
import intgutils.basic_wrapper as basic_wrapper
def main():
"""Entry point.
"""
parser = argparse.ArgumentParser(description='Generic wrapper')
parser.add_argument('inputwcl', nargs=1, action='store')
... | StarcoderdataPython |
1726165 | <filename>gpucsl/pc/helpers.py
from math import sqrt
from scipy.stats import norm
from cupyx.scipy.special import ndtr
import numpy as np
from typing import Any, Callable, Generic, NamedTuple, TypeVar, Dict, Tuple, Set
from functools import wraps
from timeit import default_timer as timer
import logging
import networkx ... | StarcoderdataPython |
3285104 | '''
1 put flags on the field, bots have to each collect
all flags.
2 start with one flag
3 Add in some quality-of-life sensing function
Might want to be able to ask if a tile is any sort of
conveyor and then be able to ask where you would move to
next if conveyed by it.
4 write a basic AI
5 add 3 more flags. flags then... | StarcoderdataPython |
4826788 | # -*- coding: utf-8 -*-
"""
pyrseas.dbobject.eventtrig
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module defines two classes: EventTrigger derived from
DbObject, and EventTriggerDict derived from DbObjectDict.
"""
from . import DbObjectDict, DbObject
from . import quote_id, commentable
from .function import split... | StarcoderdataPython |
188635 | import math
import logging
import json
from model.resources import *
_driver = None
def set_driver(new_driver):
global _driver
_driver = new_driver
def get_driver():
global _driver
return _driver
def get_module_logger(mod_name):
logger = logging.getLogger(mod_name)
formatter = logging.Formatter(... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.