id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1686556 | """
This script will import and render a sequence of .ply triangle meshes and a
sequence of diffuse particle meshes generated by the PIC/FLIP Fluid Simulation
program (https://github.com/rlguy/GridFluidSim3D) in Blender using the Blender
Python API.
The triangle mesh sequence and diffuse mesh seq... | StarcoderdataPython |
4816106 | <filename>advent-of-code-2017/day4.py
from sets import ImmutableSet
with open('input-day4.txt') as fh:
part1_count = 0
part2_count = 0
for line in fh:
words = line.split()
if len(words) == len(set(words)):
part1_count += 1
uniquified = ImmutableSet([ImmutableSet(word) ... | StarcoderdataPython |
105784 | from tkinter import *
from tkinter.ttk import Combobox
import tkinter.messagebox
import threading
import socket
import time
class Dos:
def __init__(self,root):
self.root=root
self.root.title("DOS ATTACK")
self.root.geometry("450x400")
self.root.iconbitmap("logo980.ico")
s... | StarcoderdataPython |
1601820 | #
# Copyright 2013, Couchbase, 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | StarcoderdataPython |
1746334 | from django.db import models
# Create your models here.
class Message(models.Model):
full_name = models.CharField(max_length=256, null=True, blank=True)
email = models.EmailField(null=True, blank=True)
phone = models.CharField(max_length=12, null=True, blank=True)
message = models.TextField(null=True, blank=True)
... | StarcoderdataPython |
109158 | <filename>CACT/code.py
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
print(data)
print(data.shape)
#Code sta... | StarcoderdataPython |
1794536 | <filename>backend/cncWeb/plot/models.py
from uuid import uuid4
from django.db import models
from rpi.models import RpiBoard
class Gcode(models.Model):
id = models.UUIDField(default=uuid4, primary_key=True, editable=False)
gcode_file = models.FileField(upload_to="media")
create_date = models.DateTimeField(... | StarcoderdataPython |
1698848 | <reponame>Zuehlke/ConfZ
import pytest
from confz import ConfZ, ConfZDataSource, depends_on
class Config1(ConfZ):
attr: int
CONFIG_SOURCES = ConfZDataSource(data={"attr": 1})
class Config2(ConfZ):
attr: int
CONFIG_SOURCES = ConfZDataSource(data={"attr": 2})
def test_change_sources():
# singl... | StarcoderdataPython |
1693837 | <filename>src/common/trainer.py
# coding: utf-8
import sys
sys.path.append('..')
import numpy
import time
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from common.np import * # import numpy as np
from common.util import clip_grads
class Trainer:
def __init__(self, model, optimizer):
... | StarcoderdataPython |
1636231 | <filename>tests/bot/cogs/sync/test_alias.py
import asyncio
import unittest
import warnings
from bot.cogs import bot
from tests.helpers import MockBot, MockContext
from bot.cogs.alias import Alias
from bot.cogs.watchchannels.bigbrother import BigBrother
class BotAliasTests(unittest.IsolatedAsyncioTestCase):
def s... | StarcoderdataPython |
71980 | # i.e.: set to False only when debugging.
import os
import sys
from typing import Optional
USE_TIMEOUTS = True
if "GITHUB_WORKFLOW" not in os.environ:
if "pydevd" in sys.modules:
USE_TIMEOUTS = False
# If USE_TIMEOUTS is None, this timeout should be used.
NO_TIMEOUT = None
DEFAULT_TIMEOUT = 10
def is_t... | StarcoderdataPython |
3244226 | import os
import time
import tensorflow as tf
import tensorflow_datasets as tfds
import transformers as xfmers
def return_naive_tfds(dataset_name="imagenette/160px", data_dir="~/tensorflow_datasets", buffer=8192, num_shards=1, index=0):
st = time.time()
dataset, info = tfds.load(dataset_name,
... | StarcoderdataPython |
58799 | <reponame>browncoat-ninjas/nimoy
from unittest.mock import Mock
from nimoy.runner.spec_executor import SpecExecutor
from nimoy.specification import Specification
class SpecificationExecutorSpec(Specification):
def execution(self):
with given:
execution_framework_mock = Mock()
spe... | StarcoderdataPython |
93015 | <filename>dyplot/pie.py
from dyplot.c3 import C3 as c3Core
class Pie(c3Core):
def __init__(self, frac, labels):
"""
To plot a pie chart.
:param frac: The list to plot.
:type frac: array_like. A list of float or int.
:param labels: The list of the slic... | StarcoderdataPython |
1629058 | <reponame>qutang/tang_pervhealth_14
#! /usr/bin/python
"""
Script to get dataset statistics:
1. left/right/total/prototypical puffs for each cigarette and each subject
2. puff durations for each cigarette and each subject
3. interpuff intervals for each cigarette and each subject
4. smoking duration ... | StarcoderdataPython |
3291444 | import mock
from django import test
from model_mommy import mommy
from devilry.devilry_student.cradminextensions import devilry_crmenu_student
class TestMenu(test.TestCase):
def test_get_group_label(self):
testgroup = mommy.make('core.AssignmentGroup',
parentnode__short_nam... | StarcoderdataPython |
1726915 | """implementation of PythonLogger class
"""
import logging
from ._log_level_convertion import to_python_log_level
from .._mprpc_cpp import PythonLoggerHelper, LogLevel
class PythonLogger(PythonLoggerHelper): # pylint: disable=too-few-public-methods
"""class to write logs using Python's logging module
Para... | StarcoderdataPython |
3221568 | <filename>navigator/auth/__init__.py
"""Navigator Auth.
Navigator Authentication/Authorization system.
AuthHandler is the Authentication/Authorization system for NAV,
Supporting:
* multiple authentication backends
* authorization exceptions via middlewares
* Session Support (in the top of aiohttp-session)
"""
from... | StarcoderdataPython |
1655301 | import json
json_string_absence_alan = """
{
"success": true,
"metadata":{
"current_page":1,
"total_pages":1
},
"data": [{
"type": "TimeOffPeriod",
"attributes": {
"id": 17205942,
"status": "approved",
"comment": "marathon starts at noon",
"start_... | StarcoderdataPython |
3222831 | <filename>crowdsourcing/viewsets/task.py
from crowdsourcing.serializers.task import *
from rest_framework import status, viewsets
from rest_framework.response import Response
from rest_framework.decorators import detail_route, list_route
from django.shortcuts import get_object_or_404
from crowdsourcing.permissions.proj... | StarcoderdataPython |
3348578 | <filename>tests/test_query.py<gh_stars>0
from unittest import TestCase
from unittest.mock import MagicMock
from graphqlengine.query import QueryEngine
class QueryEngineTest(TestCase):
def testQuery(self):
engine = QueryEngine()
User = MagicMock()
engine.addModel('user', User)
engi... | StarcoderdataPython |
187070 | <gh_stars>0
from system.forms import Forms
from system.logger import *
from dialogs.edit_dialogs import *
from dialogs.select_dialog import *
#
# TODO: A customer cannot be deleted if a committed sale exists. If a customer is
# deleted, then all uncommitted sales are also deleted.
#
# Show total committed... | StarcoderdataPython |
101442 | from __future__ import absolute_import, division, unicode_literals
import param
from .widgets import Widget
ipywidget_classes = {}
def param_value_if_widget(arg):
if isinstance(arg, Widget):
return arg.param.value
from .pane.ipywidget import IPyWidget
if IPyWidget.applies(arg) and hasattr(arg,... | StarcoderdataPython |
1753630 | # ============================================================================
# FILE: colorscheme.py
# AUTHOR: <NAME> <mail at prabir.me>
# License: MIT license
# ============================================================================
from os import path
from denite.base.source import Base
from denite.kind.comm... | StarcoderdataPython |
7114 | <filename>webapp/apps/Base Quiz/baseui_gen.py
from htmlman import HTMLMan
from styleman import Template
page=HTMLMan()
page.make_responsive()
page.add_title("Base Quiz")
style=Template('antartica')
page.add_body_class(style['page'])
page.add_js("baseui.js")
page.create_section('main',append=True)
page['main'].add_sty... | StarcoderdataPython |
188260 | <gh_stars>0
from unittest import TestCase
from unittest.mock import patch
from feeder_utilities import health
from amqp.exceptions import NotFound
class TestFeederHealth(TestCase):
@patch('feeder_utilities.health.rabbitmq')
def test_no_error_queue(self, mock_rabbit):
feeder_health = health.FeederHeal... | StarcoderdataPython |
3343701 | <filename>tests/test_parse.py
# pyflyby/test_parse.py
# License for THIS FILE ONLY: CC0 Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import (absolute_import, division, print_function,
with_statement)
import pytest
import sys
from textwrap ... | StarcoderdataPython |
1720913 | <gh_stars>1-10
import argparse
import os
parser = argparse.ArgumentParser(description='Cnn models on SCAN dataset')
parser.add_argument('--train', type=str, required=True)
parser.add_argument('--test', type=str, required=True)
parser.add_argument('--output', type=str, required=True)
args = vars(parser.parse_args())
... | StarcoderdataPython |
4810643 | <filename>src/2.8/sample/chapter_03/sample_3-1.py<gh_stars>1-10
import bpy
bl_info = {
"name": "サンプル 3-1: オブジェクトを回転するアドオン",
"author": "ぬっち(Nutti)",
"version": (3, 0),
"blender": (2, 80, 0),
"location": "3Dビューポート > Sidebar > サンプル 3-1",
"description": "マウスの右ドラッグでオブジェクトを回転するサンプルアドオン",
"warnin... | StarcoderdataPython |
163911 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
from jubakit.loader.twitter import TwitterStreamLoader, TwitterOAuthHandler
class TwitterStreamLoaderTest(TestCase):
oauth = TwitterOAuthHandler(consumer_key='x', consumer_secre... | StarcoderdataPython |
163767 | # __BEGIN_LICENSE__
#Copyright (c) 2015, United States Government, as represented by the
#Administrator of the National Aeronautics and Space Administration.
#All rights reserved.
# __END_LICENSE__
import os
import sys
import django
from optparse import make_option
from django.core.management.base import BaseComma... | StarcoderdataPython |
136256 | import binascii
import struct
import os
import gevent
import ipaddress
import time
from gevent.lock import RLock
from gevent.event import AsyncResult
from gevent import socket
import collections
import traceback
try:
import color_logging
import logging
logger = logging
except:
import logging
logger... | StarcoderdataPython |
32689 | <filename>tests/gdb/execute_nacl_manifest_twice.py
# -*- python2 -*-
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from gdb_test import AssertEquals
import gdb_test
def test(gdb):
# The seco... | StarcoderdataPython |
69500 | #!/usr/bin/python3
#
# Copyright 2018 Google LLC
#
# 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 |
59364 | <reponame>ankitshah009/dcase_util
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import numpy
from dcase_util.containers import BinaryMatrix2DContainer
from dcase_util.ui import FancyStringifier
class BinaryMatrixEncoder(BinaryMatrix2DContainer):
"""Binary m... | StarcoderdataPython |
1637646 | # Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 |
1651131 | <filename>autofan/objetivo.py
#!/usr/bin/python
import sys
def get_obj():
objfile = open("/storage/autofan/obj")
obj_temp = objfile.read()
objfile.close()
return float(obj_temp)
def set_obj():
objfile = open("/storage/autofan/obj", "w")
objfile.write(newobj)
objfile.close()
... | StarcoderdataPython |
3304393 | <reponame>jonasspinner/weighted-f-free-edge-editing
import urllib.request
import yaml
from tempfile import NamedTemporaryFile, TemporaryDirectory
from pathlib import Path
import zipfile
import re
from shutil import rmtree
import argparse
from typing import Optional
def output(text: str):
print(text)
def transf... | StarcoderdataPython |
49381 | <gh_stars>1-10
import numpy as np
import time
import datetime
import sys
import math
from chroma.transform import normalize
def count_nonzero(array):
'''Return the number of nonzero elements in this array'''
return int((array != 0).sum())
def filled_array(value, shape, dtype):
'''Create a numpy array of g... | StarcoderdataPython |
1747206 | <filename>output/models/ms_data/errata10/err_e006_xsd/err_e006.py
from dataclasses import dataclass, field
from typing import List, Optional
from xsdata.models.datatype import XmlDate, XmlPeriod
__NAMESPACE__ = "http://www.tempuri.org"
@dataclass
class Root:
class Meta:
name = "root"
namespace = ... | StarcoderdataPython |
1786146 | <gh_stars>1-10
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from goflow.graphics2.models import ProcessImage, ActivityPosition
from goflow.workflow.models import Activity
from django.contrib import messages
def pos_... | StarcoderdataPython |
3360798 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/profiler/profiler_service_monitor_result.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.protobuf im... | StarcoderdataPython |
3381818 | # models.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from app import db
from app import app
### SQLAlchemy Data Type
### Integer: an integer
### String (size): a string with a maximum length
### Text: some longer unicode text
### DateTime: date and time expressed as Python datetime obj... | StarcoderdataPython |
3383216 | #from genes import genomes_crossing, rabbit_genome
from math import floor
from memories import Memories
from config import * # Dicen que hacer esto es feo, pero me parece necesario
#import genetic_tree as gt
class Animal(object):
def __init__(self, carbohydrates, proteins, fats, vitamins, minerals, energy, age, up... | StarcoderdataPython |
3365037 | from checks import NaptanCheck
from report import reporting as rep
# %%
class HailRideValidity(NaptanCheck):
"""[summary] Hail and Ride Bus Stops that do not have a valid entry,
centroid or exit records.
Args:
NaptanCheck ([type]): [description]
"""
check_name = "hail and ride is inval... | StarcoderdataPython |
1706760 | <reponame>angry-tony/kubeflow
# Script to build bootstrapper image
import argparse
import os
import shutil
import yaml
FILE_PATH = os.path.dirname(os.path.abspath(__file__))
REG_FOLDER = "reg_tmp"
# Clone repos to tmp folder and build docker images
def main(unparsed_args=None):
parser = argparse.ArgumentParser(
... | StarcoderdataPython |
3291617 | <filename>frontend/assets/backup/AutoHotPy-master/recorded_macro-fast.py
from AutoHotPy import AutoHotPy
from InterceptionWrapper import *
import time
def exitAutoHotKey(autohotpy,event):
autohotpy.stop()
def recorded_macro(autohotpy, event):
start = time.time()
autohotpy.moveMouseToPosition(1680,807)
a... | StarcoderdataPython |
64629 | import threading
from flask import Flask, jsonify
from src import consts
from src.cv_recogniser import run_cv_recogniser
app = Flask(__name__)
@app.route('/get', methods=['GET'])
def get_counter():
return jsonify({
'total': consts.total,
'out': consts.ppl_out,
'in': consts.ppl_in
})
... | StarcoderdataPython |
1785335 | import sys
import docx
import os
from dotenv import load_dotenv, find_dotenv
from functools import reduce
from pymongo import MongoClient
from pathlib import Path
PATH_ROOT = Path().absolute().parent.parent
sys.path.append(str(PATH_ROOT))
from scdf.src.scripts.remove_accents import remove_accents
load_dotenv(find_... | StarcoderdataPython |
1629657 | <reponame>wangjinyu124419/xinjing<gh_stars>0
import logging
from logging.handlers import RotatingFileHandler
# from info.utils.comment import do_rank
from flask import Flask
from flask import g
from flask import render_template
from redis import StrictRedis
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import... | StarcoderdataPython |
3292586 | import json
import os
import pytest
from ucloud.testing.driver import spec
from ucloud.client import Client
@pytest.fixture(scope="session", autouse=True, name="client")
def client_factory() -> Client:
return Client(
{
"region": "cn-bj2",
"project_id": os.getenv("UCLOUD_PROJECT_ID... | StarcoderdataPython |
3390917 | """Generate new images based on trained GAN."""
import logging
import os
import imageio
import tensorflow as tf
from tensorflow import keras
logger = logging.getLogger(__name__)
physical_devices = tf.config.experimental.list_physical_devices("GPU")
try:
# Assert we have GPU
assert len(physical_devices) > 0
... | StarcoderdataPython |
4802119 | <reponame>diogommartins/cinder
def foo():
ann = None
def bar(a: ann) -> ann:
pass
| StarcoderdataPython |
83898 | <filename>Data_processing/post_load_mentee_behavior.py
#/usr/bin/env python3
# Program to create table mentee_behavior and load from csv
import psycopg2
conn = psycopg2.connect(database="awesome", user = "awesome_admin",
password="<PASSWORD>", host = "172.16.17.32", port="5432")
cur = conn.cursor()
... | StarcoderdataPython |
1632667 | """
Skyskraper game
repo on github: https://github.com/Ostap2003/skyscrapers
"""
def read_input(path: str) -> list:
"""
Read game board file from path.
Return list of str.
"""
board = []
with open(path, 'r', encoding='utf-8') as board_fl:
for line in board_fl:
if '\n' in li... | StarcoderdataPython |
28599 | from contextlib import closing
import h5py
import numpy as np
def save_h5(outfile, dictionary):
""" Saves passed dictionary to an h5 file
Parameters
----------
outfile : string
Name of output h5 file
dictionary : dictionary
Dictionary that will be saved
"""
def save_layer(... | StarcoderdataPython |
85502 | # Generated by Django 2.2.2 on 2019-09-28 14:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('schools', '0003_auto_20190928_1320'),
]
operations = [
migrations.CreateModel(
name='Perspectiv... | StarcoderdataPython |
59304 | <reponame>chhzh123/heterocl<gh_stars>0
import os
import re
import subprocess
from sys import platform
import time
from hcl_mlir import ir
from hcl_mlir import runtime as rt
import numpy as np
import ctypes
from ..report import parse_xml
def run_process(cmd, pattern=None, env=None):
p = subprocess.Popen(cmd, stdout... | StarcoderdataPython |
1601900 | import streamlit as st
import pandas as pd
import subprocess
import os
import base64
import pickle
# Molecular descriptor calculator
def desc_calc():
# Performs the descriptor calculation
bashCommand = "java -Xms2G -Xmx2G -Djava.awt.headless=true -jar ./PaDEL-Descriptor/PaDEL-Descriptor.jar -removesalt -standa... | StarcoderdataPython |
3274878 | <reponame>swang92711/Hand_Writing_Recognition<filename>Svm/main.py
import scipy.io
import sys
import svm as svm_module
import scipy as s
def evaluate(svm, datapoints, classes):
size = len(datapoints)
output_classes = svm.classify_2d(datapoints)
diff_classes = classes - output_classes
errors = s.count_n... | StarcoderdataPython |
3399954 | <gh_stars>1-10
# =========================================================================================
# Copyright 2015 Community Information Online Consortium (CIOC) and KCL Software Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wi... | StarcoderdataPython |
4800745 | <filename>prepareInfo.py<gh_stars>0
import config
import os,time
from slack import WebClient
def log(func):
def wrapper(*args, **kw):
start = time.time()
run_func= func(*args, **kw)
end = time.time()
print('%s executed in %s ms' % (func.__name__, (end - start) * 1000))
ret... | StarcoderdataPython |
20126 | import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY = 'you-will-never-guess'
SQLITE = 'db.sqlite3'
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, SQLITE) + '?check_same_thread=False'
| StarcoderdataPython |
66980 | <gh_stars>0
# Generated by Django 3.2.8 on 2021-10-24 17:47
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Caption',
fields=[
('id', model... | StarcoderdataPython |
3275764 | from pymongo import MongoClient
from datetime import date, datetime, timedelta
# time right now
now_int = datetime.now()
now_str = str(now_int)
print('daily crawler - Right now it is ' + now_str)
#today's date
date_today = date.today()
print("test_app - Today's date:", date_today)
today_str = str(date_today)
# mongo... | StarcoderdataPython |
80329 | from django.db import connection
from usaspending_api.common.etl import ETLQuery, ETLTable
from usaspending_api.common.etl.operations import delete_obsolete_rows, insert_missing_rows, update_changed_rows
# This is basically the desired final state of the federal_account table. We can diff this against the
# actual f... | StarcoderdataPython |
3256964 | # Copyright (C) 2018 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | StarcoderdataPython |
724 | # Copyright 2014 <NAME>, <EMAIL>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | StarcoderdataPython |
1649398 | <gh_stars>0
from os import getenv
from flask import Flask, render_template, request
from .db_model import DB, User
from .twitter import add_user_tweepy, update_all_users
from .predict import predict_user
def create_app():
'''Create and configure an instance of our Flask aplication'''
app = Flask(__name__)
... | StarcoderdataPython |
25839 | import math
import numpy as np
import cv2
import json
import argparse
def augment_homogeneous(V, augment):
""" Augment a 3xN array of vectors into a 4xN array of homogeneous coordinates
Args:
v (np.array 3xN): Array of vectors
augment (float): The value to fill in for the W coordinate
Retu... | StarcoderdataPython |
3316662 | import cv2 as cv
import numpy as np
from PIL import Image
from . import imgops
from . import resources
from . import util
LOGFILE = 'common.html'
def check_get_item_popup(img):
vw, vh = util.get_vwvh(img.size)
icon1 = img.crop((50 * vw - 6.389 * vh, 5.556 * vh, 50 * vw + 8.426 * vh, 18.981 * vh)).convert('R... | StarcoderdataPython |
172152 | <filename>build/c4che/_cache.py<gh_stars>1-10
BINDIR = '/usr/local/bin'
BLOCK_MESSAGE_KEYS = []
BUILD_TYPE = 'app'
BUNDLE_NAME = 'pebble-World-Cup.pbw'
DEFINES = ['RELEASE']
LIBDIR = '/usr/local/lib'
LIB_DIR = 'node_modules'
MESSAGE_KEYS = {}
MESSAGE_KEYS_HEADER = '/root/hello-pebblejs/pebble-World-Cup/build/include/me... | StarcoderdataPython |
101882 | # Generated by Django 2.2.6 on 2019-10-10 08:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('block_producer', '0007_add_status_description_field'),
]
operations = [
migrations.AlterField(
model_name='blockproducer',
... | StarcoderdataPython |
3350504 | <filename>generate/generate_all_data.py<gh_stars>0
# main imports
import sys, os, argparse
import numpy as np
import random
import time
import json
# image processing imports
from PIL import Image
from skimage import color
from ipfml.processing.segmentation import divide_in_blocks
from ipfml import utils
# modules a... | StarcoderdataPython |
3286032 | #!/usr/bin/env python3
import asyncio
from mavsdk import System
from mavsdk.offboard import (PositionNedYaw, VelocityNedYaw, OffboardError)
async def run():
drone = System()
await drone.connect(system_address="udp://:14540")
print("Waiting for drone to connect...")
async for state in drone.core.conn... | StarcoderdataPython |
4826243 | <filename>helper.py
def greeting(msg):
print(msg)
def reverse_print(msg):
gsm = ""
for c in msg:
gsm = c + gsm
print(gsm)
def print_this_please(msg):
print('no')
| StarcoderdataPython |
3310582 | import asyncio
import pytest
from mock import MagicMock, patch
from appscale.hermes.producers import cassandra_stats
def future(value=None):
future_obj = asyncio.Future()
future_obj.set_result(value)
return future_obj
MULTINODE_STATUS = b"""Datacenter: datacenter1
=======================
Status=Up/Down
|/ S... | StarcoderdataPython |
39113 | <reponame>aws-samples/aws-centeralized-logging-with-datadog
# Copyright 2008-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
# http://aws.a... | StarcoderdataPython |
1748311 | <reponame>brightcoder01/elasticdl
import threading
import numpy as np
import tensorflow as tf
from google.protobuf import empty_pb2
from elasticdl.proto import elasticdl_pb2, elasticdl_pb2_grpc
from elasticdl.python.common.file_helper import copy_if_not_exists
from elasticdl.python.common.log_util import default_logg... | StarcoderdataPython |
184866 | import os
def parent_directory():
# Create a relative path to the parent
# of the current working directory
relative_parent = os.path.join("..", os.path.getcwd())
# Return the absolute path of the parent directory
return ___
print(parent_directory()) | StarcoderdataPython |
1760996 | <reponame>canerkaraguler/EasyS7
import struct
import snap7
import random
class DTdint:
def __init__(self, readBuffer):
self.readBuffer=readBuffer
def db_readDint(self,byteArray,index):
data=byteArray[index:(index+4)]
value=struct.unpack('>l' ,struct.pack('4B',*data))[0]
return value
def db_readUDint(self... | StarcoderdataPython |
58930 | from zeus.config import db
from zeus.db.mixins import ApiTokenMixin, RepositoryMixin, StandardAttributes
from zeus.db.utils import model_repr
class RepositoryApiToken(StandardAttributes, RepositoryMixin, ApiTokenMixin, db.Model):
"""
An API token associated to a repository.
"""
__tablename__ = "repos... | StarcoderdataPython |
176234 | import os
import re
import urllib
import urlparse
import hashlib
import logging
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from google.appengine.runtime import apiproxy_errors
import webapp2
# URLs that have absolute addresses
ABSOLUTE_URL_REGEX = r"(http(s?):)?//(?P<url>[^\... | StarcoderdataPython |
174820 | # encoding: utf-8
# module PySide.QtCore
# from C:\Python27\lib\site-packages\PySide\QtCore.pyd
# by generator 1.147
# no doc
# imports
import Shiboken as __Shiboken
from QState import QState
class QStateMachine(QState):
# no doc
def addDefaultAnimation(self, *args, **kwargs): # real signature unknown
... | StarcoderdataPython |
3338715 | class Solution:
def __init__(self):
self.root = {}
def insert(self, word: str) -> None:
node = self.root
for c in word:
if c not in node:
node[c] = {}
node = node[c]
node['word'] = word
def search(self, word: str) -> str:
node = self.root
for c in word:
if 'word... | StarcoderdataPython |
1670227 | #!/usr/bin/env python
# this script builds a dataframe in pandas containing multiple stocks
# SPY is a good control because it should be open on all market open days
import pandas as pd
def test_run():
start_date = '2010-01-22'
end_date = '2010-01-26'
#print '\nCreating a list with dates as indices'
... | StarcoderdataPython |
193587 | <gh_stars>1-10
from __future__ import division
import os
import cv2
import dlib
from .eye import Eye
from .calibration import Calibration
class GazeTracking(object):
"""
This class tracks the user's gaze.
It provides useful information like the position of the eyes
and pupils and allows to know if the... | StarcoderdataPython |
1659480 | <gh_stars>10-100
# pylint: disable = too-many-instance-attributes, W0212,W0236,E1133
import asyncio
import copy
import random
import traceback
from typing import Union
import socketio
from socketio.exceptions import ConnectionError as SioConnectionError
from botoy.client import Botoy
from botoy.log import logger
from... | StarcoderdataPython |
4831749 | import input_matrix
import minhash
import lsh
import jaccard_sim
from ttictoc import TicToc
import os
from sys import argv
# Time counters for the preprocessing and the LSH procedure.
pre = TicToc()
aft = TicToc()
# Here starts the preprocessing.
pre.tic()
# create an input matrix and a signature matrix... | StarcoderdataPython |
54496 | <gh_stars>0
import os
from io import BytesIO
import pytest
from werkzeug.datastructures import FileStorage
from rfidsecuritysvc.model.sound import Sound
@pytest.fixture(scope='session')
def wav_content():
test_wav = os.path.join(os.path.dirname(__file__), 'test.wav')
with open(test_wav, 'rb') as f:
... | StarcoderdataPython |
3330040 | <gh_stars>0
with open('input.txt', 'r') as f:
lines = f.read().splitlines()
nums = list(map(int, lines[0].split(',')))
lines = lines[2:]
boards = [
[list(map(int, filter(None, row.split()))) for row in lines[i:i + 5]]
for i in range(0, len(lines), 6)
]
found = False
for i in range(1, len(nums)):
n =... | StarcoderdataPython |
1716947 | # Generated by Django 3.1.5 on 2021-01-16 21:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | StarcoderdataPython |
44422 | <reponame>ogajduse/plbmng
import logging
import sys
from loguru import logger as base_logger
logger = base_logger
def init_logger() -> None:
"""Initialize logger, set log format and the base logging level."""
global logger
logger.remove()
logger.add(
sink=sys.stdout,
level=logging.IN... | StarcoderdataPython |
1736817 | # -*- coding: utf-8 -*-
"""Developer convenience functions for ibs (detections).
TODO: need to split up into sub modules:
consistency_checks
feasibility_fixes
move the export stuff to dbio
then there are also convineience functions that need to be ordered at least
within this file
"""
from __futur... | StarcoderdataPython |
3371523 |
"""
Feature Extraction
"""
import librosa, librosa.display,librosa.feature
import pandas as pd
import numpy as np
import scipy
from tqdm import tqdm
import os
WAV_DIR = 'genres/'
# Column names of all the features that will be extracted
col_names = ['class','signal_mean','signal_std','signal_skew','signal_kurtosi... | StarcoderdataPython |
123511 | <filename>src/hapPyTango/CosNotifyComm_skel/__init__.py
""" Module: IDL:omg.org/CosNotifyComm:1.0
Automagically generated by:-
The ORB called Fnorb v1.1.Return.of.Fnorb
"""
_FNORB_ID = "IDL:omg.org/CosNotifyComm:1.0"
# Fnorb modules.
import Fnorb.orb.CORBA
import Fnorb.orb.TypeManager
import Fnorb.orb.Util
class ... | StarcoderdataPython |
3301635 | """Configuration of the tool."""
import os
class ConfigException(Exception):
pass
class Config:
def __init__(self, snapshot_first, snapshot_second, show_diff,
output_llvm_ir, control_flow_only, print_asm_diffs,
verbosity, use_ffi, semdiff_tool):
"""
Store co... | StarcoderdataPython |
1743956 | <filename>001-Jupyter/002-JupyterExtensions/test.py
def add(a, b):
return a+b
print(add(2,3)) | StarcoderdataPython |
68358 | <reponame>bdunford/ripper
class Mime(object):
def __init__(self,content_type, category, extension, stream=False, use_file_name=False):
self.content_type = content_type
self.category = category
self.extension = extension
self.stream = stream
self.use_file_name = use_file_name... | StarcoderdataPython |
3353004 | import pymysql
import random
print("Connect to mysql...")
mysql_db = "mytest"
m_conn = pymysql.connect(host='192.168.70.40', port=3306, user='root', passwd='<PASSWORD>', db=mysql_db, charset='utf8')
m_cursor = m_conn.cursor()
try:
for i in range(10000):
print(i)
key1 = str(random.randint(1, 100)... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.