id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1636833 | <reponame>bqv/qwebirc
from zope.interface import implements
from twisted.python import usage
from twisted.internet import task
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
from twisted.application import internet, strports
from twisted.web import static, server
from qwebirc... | StarcoderdataPython |
3352170 | <reponame>PSFC-HEDP/Orion<gh_stars>100-1000
#!/usr/bin/env python
# coding: utf-8
import argparse
import getpass
import logging
import os
import sys
import warnings
from urllib.error import HTTPError
import tabulate
from orion import MLBLOCKS_PIPELINES
from orion.benchmark import benchmark
from orion.data import loa... | StarcoderdataPython |
1611752 | __version__ = '20190915.2'
from .base import DAL
from .objects import Field
from .helpers.classes import SQLCustomType
from .helpers.methods import geoPoint, geoLine, geoPolygon
| StarcoderdataPython |
171241 | <reponame>shinch1256/final-project<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import load_boston
import os
housingprice=load_boston()
print(housingprice.data)
# In[2]:
os.makedirs('p... | StarcoderdataPython |
33296 | # Copyright 2020 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 agreed to in writing, ... | StarcoderdataPython |
3243007 | <gh_stars>1-10
"""Checkout cell servers."""
import click
from treadmill.checkout import servers
def init():
"""Top level command handler."""
@click.command('servers')
def check_servers():
"""Checkout nodeinfo API."""
return servers.test
return check_servers
| StarcoderdataPython |
1668202 | <reponame>e1guapo/homeschool
"""
Generate arithmetic puzzles for solving a phrase (e.g. a limerick).
This is about at the typical second-grade level.
TODO:
- The presentation could definitely use some work.
"""
import re
import sys
import random
import argparse
from pprint import pformat
def gen_problems(digits, ... | StarcoderdataPython |
3224170 |
import json
import math
from google.appengine.api import search
"""
Limitations:
1. Providers can only enter a single territory whose set of points does not result in a radius larger than 250 m. So providers need to enter their territories in a piecemeal fashion.
2. When searching for a latitude and lon... | StarcoderdataPython |
3211500 | import os
import torch
import numpy as np
import cv2
from torch.utils import data
from ptsemseg.utils import recursive_glob
from ptsemseg.augmentations import *
class larynxLoader(data.Dataset):
def __init__(self, root, split="train", is_transform=False, img_size=(480, 640), augmentations=None, img_norm=True):... | StarcoderdataPython |
1650873 | <gh_stars>10-100
# coding=utf-8
# python
import get_key
import matrix
# Current delay is
# - 140 milliseconds for HID processing.
# -
# DEBOUNCE_MAX = 20
column1 = pyb.Pin('X9', pyb.Pin.IN, pyb.Pin.PULL_UP)
column2 = pyb.Pin('X10', pyb.Pin.IN, pyb.Pin.PULL_UP)
column3 = pyb.Pin('X11', pyb.Pin.IN, pyb.Pin.PULL_UP)
col... | StarcoderdataPython |
1689684 | <gh_stars>0
# -*- Encoding: utf-8 -*-
from variables import * #Se importa la informacion del archivo variables.py donde esta definido el valor de pasajeros minimos y el numero de paradas
import turtle
from tkinter import PhotoImage
import threading
import time
import random
from random import randint
# !/usr/bin/pytho... | StarcoderdataPython |
43058 | <gh_stars>1-10
# encoding: utf-8
#
# Copyright (c) 2017 <NAME>, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle.
# If the file is missing please request a copy by contacting
# <EMAIL>.
| StarcoderdataPython |
1771205 | import json
import re
# Define what characters are allowed in path
path_regex = re.compile(r"[^a-z0-9-.]")
def sub_handler(event, table):
path = event["path"].lstrip("/").lower()
if path == "":
return handle_not_found()
if bool(path_regex.search(path)):
return handle_forbidden("Path cont... | StarcoderdataPython |
1659303 | <filename>src/main.py
from hopfield import HopfieldNeuralNetwork
from utils import generate_image, add_noise
def main():
xs = generate_image(batchsize=3)
x = add_noise(xs, 0.2)
HNN = HopfieldNeuralNetwork()
HNN.train(xs)
ys = HNN.recall(x)
return ys
if __name__ == "__main__":
main()
| StarcoderdataPython |
4818328 | <filename>hypernode_monitoring/hn_monitor.py
"""
Script for monitoring hypernodes. Can be run from any directory and as cron job
Creates three files defined in hn_config.py:
* OUTFILE_1 (status.json) : ip address and current block_height
* OUTFILE_2 (hypernodes.json) : comprehensive data in 3 vars (heights, status ... | StarcoderdataPython |
96972 | from eyes import Eyes
def test_constructor():
es = Eyes()
assert es.left_eye.direction == es.right_eye.direction == (0, 0)
| StarcoderdataPython |
165375 | #!/usr/bin/python
'''
Cloud project:
- Software Defined Networking (SDN)
-- External interface between POX top controller and other apps such as Mininet
<NAME>
'''
import time
import os, sys
import logging
#import numpy as np
#import re
from pox.core import core
#import pox.openflow.libopenflow_01 a... | StarcoderdataPython |
3234795 | # coding : utf-8
'''
Copyright 2019 <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 copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | StarcoderdataPython |
3386014 | <gh_stars>0
from fpdf import FPDF
import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
img=cv2.imread('test.jpg')
img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
file=open('data.txt','w')
file.write(pytesseract.image_to_string(img))
file.close()
file = open('d... | StarcoderdataPython |
107393 | from aiogram import types
from bot.misc import dp
@dp.inline_handler()
async def example_echo(iq: types.InlineQuery):
await iq.answer(results=[],
switch_pm_text='To bot',
switch_pm_parameter='sp')
| StarcoderdataPython |
3350150 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | StarcoderdataPython |
72585 | from waterbutler.core import metadata
class BaseDataverseMetadata(metadata.BaseMetadata):
@property
def provider(self):
return 'dataverse'
class DataverseFileMetadata(BaseDataverseMetadata, metadata.BaseFileMetadata):
def __init__(self, raw, dataset_version):
super().__init__(raw)
... | StarcoderdataPython |
4816122 | from prestring.python import Module
m = Module()
m.import_("typing", as_="t")
m.import_("asyncio")
m.from_("functools").import_("partial")
with m.class_("AExecutor"):
with m.def_("__init__", "self"):
m.stmt("self.q = asyncio.Queue()")
with m.def_(
"__aenter__",
"self",
return_t... | StarcoderdataPython |
1688967 | from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_mail import Mail
db = SQLAlchemy()
migrate = Migrate()
login_inst = LoginManager()
mail = Mail()
| StarcoderdataPython |
3291112 | class Pessoa:
olhos = 2
def __init__(self, *filhos, nome = None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá {id(self)}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
... | StarcoderdataPython |
3291490 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
3
Created on Mon Mar 18 14:20:27 2019
@author: mjmacarty
"""
import pandas as pd
import pandas_datareader as pdr
from time import sleep
# get prices from default list
symbols = ['AMZN', 'GOOG', 'NFLX', 'FB', 'GLD', 'SPY']
# create list to store menu options for app... | StarcoderdataPython |
3261055 | <filename>client.py
"""Test client."""
from time import sleep
from leicacam.cam import CAM
def run():
"""Run client."""
cam = CAM()
print(cam.welcome_msg)
print(cam.send(b"/cmd:deletelist"))
sleep(0.1)
print(cam.receive())
print(cam.send(b"/cmd:deletelist"))
sleep(0.1)
print(cam.w... | StarcoderdataPython |
108246 | <filename>zcrmsdk/src/com/zoho/api/authenticator/store/__init__.py
from .db_store import DBStore
from .file_store import FileStore
from .token_store import TokenStore
| StarcoderdataPython |
4820776 | import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent.parent))
from dbkcore.core import Log
from dbkenv.core import ResourceClient
from dbkenv.core import Configuration
from dbkenv.core import DatabricksResourceManager
from dbkenv.local import DatabricksLocal
import json
import os
impor... | StarcoderdataPython |
1730287 | <gh_stars>0
from django.contrib import admin
from .models import Process, Memo, Image
@admin.register(Process)
class ProcessAdmin(admin.ModelAdmin):
pass
@admin.register(Memo)
class MemoAdmin(admin.ModelAdmin):
pass
@admin.register(Image)
class ImageAdmin(admin.ModelAdmin):
pass
| StarcoderdataPython |
153086 | import uuid
from firebase_admin import firestore
from lib.simple_logger import Logger
BATCH_SIZE = 500
_UUID_KEY_NAME = "uuid"
log = None
class FirestoreUuidTable(object):
"""
Mapping table between a string and a random UUID backed by Firestore
"""
def __init__(self, firebase_client, table_name, u... | StarcoderdataPython |
3217989 | # -*- coding: utf-8 -*-
import dataiku
from dataiku import pandasutils as pdu
import pandas as pd
import numpy as np
import os
import census_resources
import common
from dataiku.customrecipe import *
import feature_selection
import census_metadata
import random
process_date = common.get_date()
#----------------------... | StarcoderdataPython |
3399452 | <reponame>NickKaramoff/raspi_tgbot
import logging
import os
from telegram import Update
from telegram.ext import CallbackContext
def allowed_only(cmd):
allowed_ids = os.getenv("ALLOWED_IDS", "").split(",")
logger = logging.getLogger("raspibot")
def inner(update: Update, context: CallbackContext):
... | StarcoderdataPython |
4819254 | from typing import Mapping, Union
from src.analyzer import Analyzer
def main() -> None:
analyzer = Analyzer(["./data/example/testUser/StreamingHistory.json"])
payload: Mapping[str, Union[str, int]] = {}
print("Example 1: getPopularArtists()")
pa = analyzer.getPopularArtists()
print(pa)
prin... | StarcoderdataPython |
158369 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0002_auto_20151025_1127'),
]
operations = [
migrations.RenameField(
model_name='profile',
... | StarcoderdataPython |
3203991 | #!/usr/bin/python3
# -*- coding: utf8 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
"""Globals"""
import logging
from time import tzname
from subprocess import call
SYSTEM_SITE_ID = "system"
LOGGER = logging.getLogger("timevortex")
KEY_SITE_ID = "siteID"
KEY_VARIABLE_ID = "variableID"
KEY_VALUE = "value"
KEY_DATE ... | StarcoderdataPython |
3345613 | <gh_stars>1-10
"""Plotting methods for model predictions."""
import numpy
import matplotlib.colors
from gewittergefahr.gg_utils import error_checking
from generalexam.ge_utils import front_utils
from generalexam.plotting import narr_plotting
DEFAULT_GRID_OPACITY = 0.5
ANY_FRONT_STRING_ID = 'any'
VALID_STRING_IDS = [... | StarcoderdataPython |
4825471 | <filename>xlsxwriter/test/utility/test_xl_range.py
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2017, <NAME>, <EMAIL>
#
import unittest
from ...utility import xl_range
from ...utility import xl_range_abs
class TestUtility(unittest.T... | StarcoderdataPython |
1683367 | <reponame>JustTheEdge/Endless-Runer<filename>obstacle.py
import random
import pygame
from sys import exit
import pygame.image
from random import randint
from player import Player
class Obstacle(pygame.sprite.Sprite):
def __init__(self, type):
super().__init__()
if type == 'fly':
... | StarcoderdataPython |
4811787 | from machine import Pin
from utime import sleep_ms
sw = Pin(20, Pin.IN)
while(True):
print(sw.value())
sleep_ms(100)
| StarcoderdataPython |
176912 | from yfm.yfMongo import yfMongo as fetcher
| StarcoderdataPython |
58278 | #!/usr/bin/python
import unittest
import db
import system
import accessrules
import json
class TestAccessRules(unittest.TestCase):
def createMock(self):
mdb = db.MemoryDB()
obj = system.System()
obj.setDB(mdb)
return accessrules.AccessRules(obj)
def testAdminUser(self):
... | StarcoderdataPython |
1638230 | """
ViP Architecture in PyTorch
Copyright 2021 <NAME>
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from timm.models.layers import trunc_normal_
Norm = nn.LayerNorm
def apply_pos(tensor, pos, num_heads):
if pos is None:
return tensor
elif len(ten... | StarcoderdataPython |
1717404 | <reponame>ddening/private-keyboard-layouts
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
if len(sys.argv) < 2:
print 'You need to provide a path to the layout file.'
print 'on Windows: python adjust_layout.py US-Private.klc'
print 'on macOS: python adjust_layout.py US-Private.bundle/Contents/Resourc... | StarcoderdataPython |
3224311 | from django import forms
from .models import Post
class BlogPostForm(forms.ModelForm):
class Meta:
model = Post
# don't have created date or user edible views, as these are only form fields that user can edit.
fields = ('title', 'content', 'image', 'tag', 'published_date')
| StarcoderdataPython |
1671169 | <reponame>ZenPylon/professional-services<filename>tools/ml-auto-eda/ml_eda/reporting/recommendation.py
# Copyright 2019 Google 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 L... | StarcoderdataPython |
3389117 | from io import StringIO
from unittest import mock
import pytest
from django.core.management import call_command
from django.core.management.base import CommandError
from supply_chains.management.commands import ingestscenarioassessments
from accounts.models import GovDepartment
from supply_chains.models import (
... | StarcoderdataPython |
1795971 | <filename>paraview-sandbox.py
cone = Cone()
print(cone.Resolution)
cone.Resolution = 32
ShrinkFilter = Shrink(cone)
ShrinkFilter.Input
ShrinkFilter.UpdatePipeline()
noCells = ShrinkFilter.GetDataInformation().GetNumberOfCells()
noPoints = ShrinkFilter.GetDataInformation().GetNumberOfPoints()
Show(ShrinkFilter)
Re... | StarcoderdataPython |
47883 | <reponame>zsoltn/python-otcextensions<filename>otcextensions/tests/unit/sdk/waf/v1/test_domain.py<gh_stars>1-10
# 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/li... | StarcoderdataPython |
1728919 | # This program takes a positive floating point number as input and outputs an approximation of its square root
# <NAME> 2019-03-08
print("This program will calculate an approximate square root of any positive floating point number")
# I have printed this line to the screen to give the user some background to the progr... | StarcoderdataPython |
162144 | <reponame>bitlw/EGSfM<filename>scripts/feature_extract.py
#!/usr/bin/python
#! -*- encoding: utf-8 -*-
# Python implementation of the bash script written by <NAME>
# Created by @vins31
# Modified by YuChen
#
# this script is for easy use of I23dSFM
#
# usage : python i23dsfm.py image_dir output_dir
#
# image_dir is th... | StarcoderdataPython |
179437 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Plan'
db.create_table(u'membership_plan', (
(... | StarcoderdataPython |
3364224 | #!/usr/bin/env python
#
# <NAME> <<EMAIL>>
#
import os, sys
from .MPILauncherBase import MPILauncherBase as Launcher
class LauncherSlurm(Launcher):
def __init__(self, name='slurm'):
super(LauncherSlurm, self).__init__(name)
return
def _defaults(self):
self.inventory.command = "srun... | StarcoderdataPython |
1778415 | from nitorch import spatial, io
from nitorch.core import py, utils
import os
def pool(inp, window=3, stride=None, method='mean', dim=3, output=None,
device=None):
"""Pool a ND volume, while preserving the orientation matrices.
Parameters
----------
inp : str or (tensor, tensor)
Eithe... | StarcoderdataPython |
1763340 |
class NotEnoughData(ValueError):
pass
class UnknownTypeByte(ValueError):
pass
class UnknownTlsVersionByte(ValueError):
pass
| StarcoderdataPython |
3314564 | <gh_stars>0
import click
import subprocess
import logging
class Resource:
def __init__(self, *args, **kwargs):
self.logger = logging.getLogger(__name__)
def get_known_attributes(self):
return []
def get_awscli_command_line(self):
return ""
def print_known_attributes_and_retu... | StarcoderdataPython |
191185 | # -*- coding: utf-8 -*-
import appdaemon.plugins.hass.hassapi as hass
from notification import send_notification
import datetime
import sys, locale
import logging, codecs
import os
#import unicode
# from automation import Automation # type: ignore
"""
Monitor events and output changes to the verbose_log. Nice for deb... | StarcoderdataPython |
3357896 | <reponame>Timothyyung/bravado-core
# -*- coding: utf-8 -*-
import pytest
from bravado_core.param import COLLECTION_FORMATS
from bravado_core.param import marshal_collection_format
from bravado_core.spec import Spec
@pytest.fixture
def param_spec():
return {
'name': 'foo',
'in': 'query',
'... | StarcoderdataPython |
4839505 | # Chinese Remainder Theorem:
# If GCD(a,b) = 1, then for any remainder ra modulo a and any remainder rb modulo b there exists integer n,
# such that n = ra (mod a) and n = ra(mod b). If n1 and n2 are two such integers, then n1=n2(mod ab)
# Algorithm :
# 1. Use extended euclid algorithm to find such x,y that a*x + b... | StarcoderdataPython |
4803967 | <filename>sixtyfour/formatters.py
from bbcode import Parser
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from urllib.parse import urlparse, parse_qs
import random
import re
from markdown import markdown
from .utils import static_var
from pygments.formatters import HtmlFormatte... | StarcoderdataPython |
1789665 | <gh_stars>1-10
# Copyright (C) 2016-2018 Alibaba Group Holding Limited
#
# 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 require... | StarcoderdataPython |
1697319 | <reponame>Armanfard-Lab/DML
import numpy as np
import torch
from sklearn.metrics import normalized_mutual_info_score, adjusted_rand_score
nmi = normalized_mutual_info_score
def acc(y_true, y_pred):
"""
Calculate clustering accuracy. Require scikit-learn installed
# Arguments
y: true labe... | StarcoderdataPython |
134157 | <filename>13_ddp.py
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, transforms
from torch.nn.parallel import DistributedDataParallel as DDP
import time
import os
def print0(message):
if dist.is_initialized():
if dist.get_... | StarcoderdataPython |
1775335 | <reponame>isabella232/xmpmeta
{
'variables' : {
'xdmlib_dir': '<(DEPTH)/third_party/xmpmeta/internal/xdmlib',
'xmpmeta_dir': '<(DEPTH)/third_party/xmpmeta/internal/xmpmeta',
},
'target_defaults': {
'type': 'static_library',
'conditions': [
['OS=="win"', {
'msvs_disabled_warnings':... | StarcoderdataPython |
3250415 | <reponame>laetrid/learning<gh_stars>0
#!/usr/bin/env python
'''
Parse the below 'show version' data and obtain the following items (vendor,
model, os_version, uptime, and serial_number). Try to make your string parsing
generic i.e. it would work for other Cisco IOS devices.
The following are reasonable strings to ... | StarcoderdataPython |
1733972 | """ Test module. Auto pytest that can be started in IDE or with::
python -m pytest . --cov predictit --cov-report xml:.coverage.xml
in terminal in tests folder.
"""
from . import (
test_compare_models,
test_find_optimal_input,
test_misc,
test_predict,
test_predict_multiple,
test_visual,
)... | StarcoderdataPython |
88412 | from rest_framework import serializers
from Shipping.models import ShippingModel
class ShippingSerializer(serializers.ModelSerializer):
"""A serializer for Shipping view"""
class Meta:
model = ShippingModel
fields = "__all__"
| StarcoderdataPython |
1798231 | #
# (c) <NAME> 2007
# $Id: DeployApacheModule.py 102 2007-12-16 09:20:41Z andrei $
#
import clr
import sys
import os
import shutil
clr.AddReference("System.Data")
clr.AddReference("System.Xml")
import System.Collections.Generic
import System.Data
import System.Data.SqlClient
import System.Text
import System.Xml
fro... | StarcoderdataPython |
3388442 | SECRET_KEY = 'Not so secret.'
MIDDLEWARE_CLASSES = ()
INSTALLED_APPS = ('sitemask',)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
| StarcoderdataPython |
3327729 | <filename>master/hopper_training/src/realtime_matrix_animate.py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# 3D related Draw
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import warnings
... | StarcoderdataPython |
3388809 | <gh_stars>1-10
# Copyright 2020 <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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | StarcoderdataPython |
1782072 | <reponame>andressamagblr/vault
from django.forms.widgets import PasswordInput
class PasswordInputWithEye(PasswordInput):
def __init__(self, attrs=None, render_value=False):
super().__init__(attrs=attrs, render_value=render_value)
self.template_name = 'vault/forms/widgets/password.html'
| StarcoderdataPython |
3233537 | <filename>connect4/Connect4Openings.py
import random
from numba import jit
@jit
def opening_tree():
d2moves = [[3, 3, 3, 3, 3, 4, 4, 4, 4, 1, 1, 4, 3, 6, 4, 1, 1, 1, 1, 5, 5, 5, 5],
[3, 3, 3, 3, 3, 4, 4, 4, 4, 1, 4, 1, 1, 0, 0, 0, 0],
[3, 3, 3, 3, 3, 4, 1, 4, 0, 2, 2, 2, 2, 1, 2],
... | StarcoderdataPython |
1763360 | <reponame>eyataarit/butopeaTask
from peewee import *
class ProductDescription (Model):
product_id=TextField()
name=TextField()
description=TextField() | StarcoderdataPython |
3287426 | import hashlib
import math
from random import randint, random, seed, uniform
from . import engine
from . import audio
from . import entities
from . import net
from . import components
from . import net2
from . import particles
from . import ai
from . import constants
from panda3d.core import *
from direct.showbase.D... | StarcoderdataPython |
88483 | import os
import shutil
import tempfile
import traceback
from fusion.cli.utilities import RenderTemplate
__all__ = ['CreateExecutable', 'SetupExecutableCreator']
def SetupExecutableCreator(commands):
command = commands.add_parser('create-executable',
help='Generate a CMake executable project and add it t... | StarcoderdataPython |
161601 | <reponame>makistsantekidis/opendr<gh_stars>1-10
# Copyright 2020-2021 OpenDR European Project
#
# 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.... | StarcoderdataPython |
1663784 | <reponame>samhiner/memorybot
import cv2
import datetime
import identify
import numpy as np
import os
#TODO make this speak instead of print
def say(text):
print(text)
#TODO make this format it nicely and say files
#for that maybe just change this function to
#speak_info() and make it void
def get_info(person_id):
w... | StarcoderdataPython |
1635429 | """
Script for saving the info of your members in a json file
so that the identification process is carrying out smoothly
Format for running this script
there must be a folder - Database
Inside it
each identity photo must be there and the photo named as <that_person_name>.{any_format /png/jpeg/jpg}
For example ... | StarcoderdataPython |
199028 | <filename>SimpleHLTAnalyzer/python/__init__.py<gh_stars>0
#Automatically created by SCRAM
import os
__path__.append(os.path.dirname(os.path.abspath(__file__).rsplit('/bbtoDijet/SimpleHLTAnalyzer/',1)[0])+'/cfipython/slc6_amd64_gcc530/bbtoDijet/SimpleHLTAnalyzer')
| StarcoderdataPython |
3252376 | <filename>src/transformers/PotentialTransformer.py<gh_stars>1-10
from pdtransform import NoFitMixin
class PotentialTransformer(NoFitMixin):
def __init__(self, n, m):
self.n = n
self.m = m
def transform(self, vector):
res = vector * self.n
res = res ** self.m
return res | StarcoderdataPython |
114279 | <filename>PyBank/main.py
# Import module
import csv
import os
import numpy as np
# Select the csv file through directory
pybank_data = os.path.join(".", "PyBank_Resources_budget_data.csv")
column_1 = []
column_2 = []
total_amount = 0
# Read the csv file
with open (pybank_data, newline = "") as csvfile:
pyba... | StarcoderdataPython |
1695231 | <reponame>DeepLearnXMU/ATR
#! /usr/bin/python
import sys
plain_char = sys.argv[1]
pred_tag = sys.argv[2]
output = sys.argv[3]
def read(f):
d = []
for line in file(f, 'rU'):
d.append(line.strip().split())
return d
charsen = read(plain_char)
tagsen = read(pred_tag)
assert len(charsen) == len(tagse... | StarcoderdataPython |
3267148 | <filename>applications/lcd_printf.py
#!/usr/bin/python
# link it to /usr/local/bin so that it can be executed from command line
from raspberrypy.display.LCD1602 import LCD1602A
import sys
if __name__ == '__main__':
lcd = LCD1602A()
lcd.init()
lcd.function_set(DL=0, N=1, F=0) # 2-line
lcd.display(D=1, C=1, ... | StarcoderdataPython |
1707440 | import argparse
from log_parser import LogParser
def parse_arguments(argv=None):
"""
Parse the application argument, the log file to be processed
"""
parser = argparse.ArgumentParser(description='Parse a log file')
parser.add_argument('log_file', metavar='LogFile', type=str,
... | StarcoderdataPython |
178691 | <filename>tests/test_524_florence_nightingale_python_e.py
from 524_florence_nightingale_python_e import 524_florence_nightingale_python_e
| StarcoderdataPython |
3349397 | <filename>tracker/charts/cron_jobs.py
from .models import HttpSeries
from django_cron import CronJobBase, Schedule
class SeriesCronJob(CronJobBase):
RUN_EVERY_MINUTES = 1
schedule = Schedule(run_every_mins=RUN_EVERY_MINUTES)
code = "servers.cron.HttpSeriesCronJob"
def do(self):
for series in... | StarcoderdataPython |
3283664 | <gh_stars>1-10
def factorial(n):
if m == 1 :
return m
else:
return (m*factorial(m-1))
num=int(input("enter number:"))
print("Factorial:")
print(factorial(m)) | StarcoderdataPython |
161637 | import unittest
from aids.strings.is_anagram import *
class IsAnagramTestCase(unittest.TestCase):
'''
Unit tests for determine anagrams
'''
def setUp(self):
pass
def test_is_anagram_sort(self):
self.assertTrue(is_anagram_sort('listen', 'silent'))
def test_is_anagram(self):
... | StarcoderdataPython |
3315910 | from gi.repository import Gtk
from gaphas.tool.scroll import on_scroll, scroll_tool
def test_scroll_tool_returns_a_controller(view):
tool = scroll_tool(view)
assert isinstance(tool, Gtk.EventController)
def test_offset_changes(view, scrolled_window):
tool = scroll_tool(view)
view.add_controller(to... | StarcoderdataPython |
90319 | <gh_stars>0
input = """
dummy.
c(0,0).
d :- c(_,a_long__but_still_nice_constant), dummy.
"""
output = """
dummy.
c(0,0).
d :- c(_,a_long__but_still_nice_constant), dummy.
"""
| StarcoderdataPython |
1663993 | <filename>trie/trie.py<gh_stars>1-10
# Utility functions for Trie
#
# <NAME>
# University of Illinois
#
import numpy as np
import matplotlib.pyplot as plt
import os,sys
sys.path.append(os.path.expanduser('~')+'/randProbs/graphSearch')
sys.path.append('..//graphSearch')
from GraphNode import add_arrow
def allWords(roo... | StarcoderdataPython |
69165 | import os
import argparse
import cPickle
import numpy as np
import scipy.io as sio
import random
from Plotter import Plotter
from scipy.stats import spearmanr, kendalltau
from scipy.stats import mannwhitneyu
from IPython import embed
import pdb
class Mapper:
#: Paths
DATADIR = '../../Data'
SCOREDIR = None... | StarcoderdataPython |
3353436 | # Dragon Master [100] (29939)
medal = 1142157
if sm.canHold(medal):
sm.chatScript("You obtained the <Dragon Master> medal.")
sm.startQuest(parentID)
sm.completeQuest(parentID) | StarcoderdataPython |
66457 | <filename>src/exec/main_coco_inspect.py
from src.dataset.cocodataset import COCODataset
import cv2
# Training Data Inspect
coco17 = COCODataset()
coco17.loadTrain()
trainDataInstances = coco17.getTrainInstances()
index = 0
while True:
instance = trainDataInstances[index]
img = instance.getAnnotatedImage()
... | StarcoderdataPython |
3200158 | def application(environ, start_response):
status = "200 OK"
headers = {
"Content-type": "text/html",
}
payload = (
b"<!DOCTYPE html>"
b"<html>"
b"<head>"
b"<title>Z37</title>"
b'<meta charset="utf-8">'
b"</head>"
b"<body>"
b"<h1>Z37... | StarcoderdataPython |
1775631 | <filename>Demos/Module3/conditionals_start.py
#
# Example file conditional statements
#
def main():
x, y = 10, 100
# conditional flow uses if, elif, else
# conditional statements let you use "a if C else b"
# conditional logic with IN operator
if __name__ == "__main__":
main() | StarcoderdataPython |
1759367 | __copyright__ = """\
(c). Copyright 2008-2020, Vyper Logix Corp., All Rights Reserved.
Published under Creative Commons License
(http://creativecommons.org/licenses/by-nc/3.0/)
restricted to non-commercial educational use only.,
http://www.VyperLogix.com for details
THE AUTHOR VYPER LOGIX CORP DISCLAIMS ALL WARRA... | StarcoderdataPython |
3389771 | <gh_stars>10-100
#! /usr/bin/python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
import collections
import logging
import time
import urllib.parse
import ldap
import commonl
import ttbl
class authenticator_ldap_c(ttbl.authenticator_c):
"""Use LDAP to authenticate users
... | StarcoderdataPython |
178044 | <gh_stars>1-10
# naive bayes algorithm
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# determining number of feature values
def naive_bayes(feature, target):
# unique values of feature
unique_values = np.unique(feature)
# unique target values
classes = np.unique(tar... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.