id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
4978864 | """Platform Models."""
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
from .SearchKeywordResult import SearchKeywordResult
class CreateSearchKeyword(BaseSchema):
# Catalog swagger.json
app_id = fiel... | StarcoderdataPython |
9714295 | <filename>lab3/lab3.py
import argparse
import logging
import os
import random
import sys
import time
import json
#from typing_extensions import Required
import numpy as np
import copy
import torch
import torchvision
from torchvision import transforms
from torch.utils.data import SubsetRandomSampler
import wandb
from... | StarcoderdataPython |
1809325 | import sys
import matplotlib.pyplot as plt
def fetch_results(fresults):
results = fresults.readline().split(' ')
results.pop()
return [int(elem) for elem in results]
if __name__ == '__main__':
# Name and results of timing functions
names = []
values = []
# Fetch the results
... | StarcoderdataPython |
6669631 | <reponame>cjshearer/project-athena<filename>src/scripts/cody_scripts/train_ensemble_model.py
# based on ../zhymir_scripts/train_model.py
import os
import keras
import numpy as np
from utils.file import dump_to_json
import matplotlib.pyplot as plt
def train_model(data, labels, model_p, save, filename, save_history, h_... | StarcoderdataPython |
5167536 | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render, redirect
from django.utils.datastructures import MultiValueDictKeyError
from store.models import Ticket
@login_required
def create_ticket_view(request):
# Get actual user
... | StarcoderdataPython |
1628382 | <reponame>cjgreencorner/Python-Scripts
#!/usr/bin/env python
##########################################
# Age Calculator #
##########################################
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Finished"
import datetime
def birthyear(year, age): # Calculate birth... | StarcoderdataPython |
4890297 | # coding=utf-8
import re
from enum import Enum
import shutil
import numpy as np
from colorama import Fore
import torch
import os
#from Putil.base import logger as plog
#logger = plog.PutilLogConfig('util').logger()
#logger.setLevel(plog.DEBUG)
from Putil.demo.deep_learning.base import horovod
import Putil.base.save_fol... | StarcoderdataPython |
4957989 | import setuptools
def readme():
with open('README.md') as f:
README = f.read()
return README
setuptools.setup(
name="playment",
version="1.0.5",
description="A Python package to interact with Playment's APIs.",
long_description=readme(),
long_description_content_type="text/markdo... | StarcoderdataPython |
5129191 | from django.urls import path
# 导入需要配置路径路由的文件
from . import views
urlpatterns = [
# 函数视图路由语法
# path('网络地址枕着表达式',函数视图名)
# 用户注册的地址是http://127.0.0.1/users/register/
# path('users/register/',views.register)
# 这一个是类视图,但是方法里面,只能用函数视图,所以用as_view()
path('users/register/',views.RegisterView.as_view())
... | StarcoderdataPython |
310793 | <filename>api/test/test_cli/test_nivo_record_helper/test_misc.py<gh_stars>1-10
import os
from csv import DictReader
from datetime import date
from uuid import uuid4, UUID
import pytest
import responses
from requests import HTTPError
from sqlalchemy.engine import Engine
from sqlalchemy.exc import IntegrityError
from n... | StarcoderdataPython |
9722721 | from django.db import models
import datetime
from Accounts.models import Examinee, Examiner
# Create your models here.
# from AnswerManagement.models import ExamineeCustomAnswer
class Exam(models.Model):
examiner = models.ForeignKey(Examiner, on_delete=models.SET_NULL, null=True, default=1)
exam_code = mode... | StarcoderdataPython |
9685095 | #!/usr/bin/python3
# Python3 script to produce torrent files from existing files and folders
# This script currently only works for archive.org releases.
# It calls 3 helper scripts.
# Import everything we will need
import os
import shutil
import logging
from internetarchive import get_item
import rcc_hardlinks
impor... | StarcoderdataPython |
1762067 | <filename>runtime/build.py
#!/usr/bin/env python
import sys
try:
from RuntimeBuilder import *
from Sim import *
except ImportError, e:
print "Couldn't find project-utils modules."
sys.exit(1)
MAXFILES = ['PacketPusher.max']
sources = ['packetpusher.c']
target = 'packetpusher'
includes = []
b = MaxRuntimeBuilde... | StarcoderdataPython |
3204331 | import timeboard as tb
import datetime
import pytest
import pandas as pd
class TestVersion(object):
def test_version(self):
version = tb.read_from('VERSION.txt')
assert version == tb.__version__
class TestTBConstructor(object):
def test_tb_constructor_trivial(self):
clnd = tb.Timeboa... | StarcoderdataPython |
1726913 | import re
import time
from ceryle.util import StopWatch
def test_stopwatch():
sw = StopWatch()
sw.start()
str0 = sw.str_last_lap()
time.sleep(0.5)
total1, lap1 = sw.elapse()
str1 = sw.str_last_lap()
time.sleep(0.3)
total2, lap2 = sw.elapse()
str2 = sw.str_last_lap()
assert ... | StarcoderdataPython |
62574 | <filename>ch1/2.py
import random
secret = random.randint(1, 99)
guess = 0
tries = 0
print("嘿,我是海盗王,我有个秘密")
print("秘密是1到99间的一个数,给你6次机会猜哦")
while guess != secret and tries <6:
guess = int(input("输入你猜的数:"))
if guess < secret:
print("太小了,笨蛋")
elif guess > secret:
print("太大了,呆子")
tries = tri... | StarcoderdataPython |
160971 | from collections.abc import Collection
from inspect import getmembers
from itertools import starmap
from typing import Any
from graphql import print_schema
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import as_declarative
from apischema import Undefined, deserialize, serialize
from ... | StarcoderdataPython |
4818302 | name = 'adeline'
| StarcoderdataPython |
5011883 | <filename>compare_variant_file_to_reference.py
#
# Copyright (c) 2018 <NAME>
# This code is licensed under MIT license (see LICENSE for details).
#
import argparse
from Bio import SeqIO
import sys
import vcf
if __name__ == "__main__":
# Parse the command line arguments.
parser = argparse.ArgumentParser(description... | StarcoderdataPython |
270072 | from django.contrib import admin
from .models import *
admin.site.register(Doctor)
admin.site.register(Patient)
admin.site.register(Pharmacist)
admin.site.register(Pathologist)
admin.site.register(Appointment)
admin.site.register(Medecine)
# ----------------------------------------------------
# pharmacy registratio... | StarcoderdataPython |
8178495 | <gh_stars>1-10
ami_filters = {
'id': 'image-id',
'name': 'name',
'architecture': 'architecture',
'platform': 'platform',
'owner': 'owner-id',
'public': 'is-public',
'state': 'state',
}
ami_distributions = {
'ubuntu': 'ubuntu/images/hvm-ssd/ubuntu-*-*{version}*-amd64-server-*',
'wind... | StarcoderdataPython |
8079769 | <filename>services/consuming_services_apis/consuming_services_apis/views.py
from pyramid.view import view_config
@view_config(route_name='home', renderer='templates/index.pt')
def my_view(_):
return {}
| StarcoderdataPython |
6674364 | a = 1; b = 2 # a note about b
| StarcoderdataPython |
1984709 | <filename>auto_label.py
import sys
import argparse
from yolo_autolabel import YOLO, detect_video
from PIL import Image
import os
import glob
from xml.dom.minidom import Document
import numpy as np
def make_xml(boxes, classes, imagesize, name, class_name):
doc = Document() # 创建DOM文档对象
DOCUMENT = doc.createElem... | StarcoderdataPython |
7567 | from pydantic import BaseModel
from tracardi.domain.entity import Entity
from tracardi.domain.scheduler_config import SchedulerConfig
from tracardi.domain.resource import ResourceCredentials
from tracardi.service.storage.driver import storage
from tracardi.service.plugin.runner import ActionRunner
from tracardi.servic... | StarcoderdataPython |
313450 | <reponame>yeyeto2788/foldercompare
"""Test the foldercompare.py module."""
import filecmp
import os
import shutil
import unittest
import foldercompare
class TestRecursiveDircmpReport(unittest.TestCase):
"""Test the _recursive_dircmp function."""
def setUp(self):
"""Create two folders for testing."""... | StarcoderdataPython |
9750186 | <filename>QuickDraw.py
import random
import math
print("")
print("'WELCOME TO QUICKDRAW'")
print("")
Hand = []
DiscardPile = []
CardsDeck = [
"Ace of Spades",
"Ace of Hearts",
"Ace of Clubs",
"Ace of Diamonds",
"Deuce of Spades",
"Deuce of Hearts",
"Deuce of Clubs",
"Deuce of Diamonds",
"Three of Spad... | StarcoderdataPython |
351815 | <gh_stars>0
# Draw a square
import turtle as t
for i in range(4):
t.forward(100)
t.left(90)
| StarcoderdataPython |
1938122 | <filename>tests/test_marmiton.py
from recipe_scrapers.marmiton import Marmiton
from tests import ScraperTest
class TestMarmitonScraper(ScraperTest):
scraper_class = Marmiton
def test_host(self):
self.assertEqual("marmiton.org", self.harvester_class.host())
def test_canonical_url(self):
... | StarcoderdataPython |
3310559 | from app.tests.v1 import utils
test_utils = utils.Utils()
def test_user_register(client):
''' Test user registration '''
response = client.post('api/v1/auth/user/register', json=test_utils.USER)
json_data = response.get_json()
assert response.status_code == 201
assert json_data['status'] == 201
... | StarcoderdataPython |
3420218 | import pandas as pd
# 相对路径
df = pd.read_excel("result_data.xlsx")
print(df)
print(df.info())
# 显示所有行
# pd.set_option('display.max_rows', None)
print(df.isnull())
print(df.dropna())
print(df.dropna(how="any"))
print(df.fillna(0))
print(df.fillna({'read_num': 10}))
print(df)
print(df.drop_dup... | StarcoderdataPython |
8146742 | <filename>services/core-api/app/api/mines/reports/resources/mine_report_category.py
import uuid
from flask_restplus import Resource, reqparse, fields, inputs
from app.extensions import api, db
from app.api.utils.resources_mixins import UserMixin
from app.api.utils.access_decorators import requires_any_of, VIEW_ALL, MI... | StarcoderdataPython |
3233244 | # -*- coding: utf-8 -*-
import os
import xlsxwriter
def write_stats(filename, data, **kwargs):
"""
Write statistics to an Excel file.
This function writes to an Excel file FILENAME the statistics
provided in each of the dictionaries contained in DATA. The first
2 arguments must be the inputs as ... | StarcoderdataPython |
12845869 | <filename>bot.py
import urllib
from pyrogram import Client, filters
from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, InputTextMessageContent)
from config import Config
bot = Client(
'shareurl-generator',
bot_token = Config.BOT_TOKEN,
api_id = Config.API_ID,
... | StarcoderdataPython |
259193 | <filename>lib/gobbet/wordlist.py
from collections import Counter, defaultdict
def pairwise(a):
return zip(a, a[1::])
class Wordlist(Counter):
def bigrams(self):
bigrams = defaultdict(set)
for word in self.keys():
for a,b in pairwise(word):
bigrams[a+b].add(word)
return bigrams
def filter_popularit... | StarcoderdataPython |
6500326 | <gh_stars>0
# Copyright (c) 2021 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | StarcoderdataPython |
23486 | # encoding: utf-8
'''
@author: <NAME>
@contact: <EMAIL>
@software: basenef
@file: doc_generator.py
@date: 4/13/2019
@desc:
'''
import os
import sys
import time
from getpass import getuser
import matplotlib
import numpy as np
import json
from srfnef import Image, MlemFull
matplotlib.use('Agg')
author = getuser()
de... | StarcoderdataPython |
11222629 | <reponame>CDL-Project-Euler/Solutions
# We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once;
# for example, the 5-digit number, 15234, is 1 through 5 pandigital.
# The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing multiplicand, multiplier, and... | StarcoderdataPython |
8040542 | # -*- coding: utf-8 -*-
# Standard library imports
# Third party imports
# Local application / specific library imports
| StarcoderdataPython |
3364035 | <reponame>Unviray/pun<filename>pun/__init__.py
"""
pun
===
Pun mini task to build, deploy or anything you like in your project.
"""
__author__ = 'Unviray'
__email__ = '<EMAIL>'
__version__ = '0.1.0'
from .walker import cd
from .core import task, run, fixture, env
__all__ = ('cd', 'env', 'task', 'run', 'fixture')
| StarcoderdataPython |
6503429 | <filename>coder_directory_api/__init__.py
"""
Coders Directory Api
~~~~~~~~~~~~~~~~~~~~
A flask powered rest api for managing and displaying coder data.
:copyright: (c) 2017 by <NAME>.
:license: MIT, see LICENSE for details.
"""
__version__ = '1.0.0' | StarcoderdataPython |
327810 | # -*- coding: utf-8 -*-
"""Implementation of Linear Programming IRL methods by Ng and Russell, 2000
Copyright 2018 <NAME>
"""
import warnings
import numpy as np
from cvxopt import matrix, solvers
from pprint import pprint
from copy import copy
from irl_methods.utils import rollout
def linear_programming(
s... | StarcoderdataPython |
6551289 | <reponame>azaddeveloper/api-snippets
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioTaskRouterClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "<KEY>"
auth_token = "<PASSWORD>"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... | StarcoderdataPython |
8158546 | <reponame>rababerladuseladim/dudes<gh_stars>1-10
import numpy as np
from collections import Counter, defaultdict
from dudes.Ranks import Ranks
from dudes.Util import *
class Ident:
columns = ['Iter','TaxID','ParentTaxID','RankID','CumulativeMatches','MatchScoreSum','Abundance','CumulativeAbundance']
def __init__(sel... | StarcoderdataPython |
82018 | <filename>angr/engines/vex/statements/dirty.py
from . import SimIRStmt
from .. import dirty
from .... import sim_options as o
from ....errors import UnsupportedDirtyError
import logging
l = logging.getLogger(name=__name__)
class SimIRStmt_Dirty(SimIRStmt):
__slots__ = []
# Example:
# t1 = DIRTY 1:I1 :::... | StarcoderdataPython |
1749357 | import unittest
from testfixtures import LogCapture
from flexp.flow import Chain
from flexp.flow import inspector
from .utils import Add, DummyModule
class TestChain(unittest.TestCase):
def test_chain_inspect(self):
data = {"input": 20}
with LogCapture() as l:
c = Chain([
... | StarcoderdataPython |
295321 | <reponame>shreya-n-kumari/python<filename>class_import.py
from class_car import ElectricCar
Tesla = ElectricCar('tesla','model s',2016)
print(Tesla.get_name())
print(Tesla.describe_battery()) | StarcoderdataPython |
3413274 | <gh_stars>0
"""The WaveBlocks Project
Various small utility functions.
@author: <NAME>
@copyright: Copyright (C) 2011 <NAME>
@license: Modified BSD License
"""
from numpy.lib.arraysetops import in1d
#TODO: Consider merging this into the TimeManager
def common_timesteps(timegridA, timegridB):
r"""
Find the i... | StarcoderdataPython |
8126047 | <reponame>agustinhenze/mibs.snmplabs.com
#
# PySNMP MIB module HH3C-FC-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-FC-TC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:13:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usin... | StarcoderdataPython |
1670417 | <gh_stars>0
from django.shortcuts import render
from django.contrib.auth import get_user_model
from rest_framework import generics
from rest_framework import permissions
from . import serializers
CustomUser = get_user_model()
class UserRetrieveUpdateDestroyAPIView(generics.RetrieveUpdateDestroyAPIView):
queryse... | StarcoderdataPython |
245038 | <filename>historic_hebrew_dates/annotated_corpus.py
#!/usr/bin/env python3
import re
import os
import csv
import pandas as pd
from bidi.algorithm import get_display
from .grammars.annotation_grammar import get_patterns
from .pattern_factory import create_parsers
parsers = create_parsers('hebrew')
def DateTypePars... | StarcoderdataPython |
8043799 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 <NAME>, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not... | StarcoderdataPython |
4851069 | <filename>tests/test_integration.py
import sys
import unittest
import time
from flask import Flask
# remove mocks and import flask_mqtt
try:
sys.modules.pop('paho.mqtt.client')
sys.modules.pop('flask_mqtt')
except KeyError:
pass
from flask_mqtt import Mqtt, MQTT_ERR_SUCCESS
def wait(seconds=2):
time... | StarcoderdataPython |
4964789 | <reponame>oleglpts/easy_daemon
from setuptools import setup
setup(
name='easy_daemon',
version='0.0.3',
packages=['easy_daemon'],
requires=[],
url='https://github.com/oleglpts/easy_daemon',
license='MIT',
platforms='any',
author='<NAME>',
author_email='<EMAIL>',
description='Eas... | StarcoderdataPython |
125194 | <reponame>karthiksekaran/skip-tracking-selenium
import requests
import re
import json
import time
import logging
import pandas
from collections import OrderedDict
from bs4 import BeautifulSoup
def get_bs(session, url):
"""Makes a GET requests using the given Session object
and returns a BeautifulS... | StarcoderdataPython |
1827187 | <gh_stars>1-10
from torch.utils.data import Dataset
import torch
class SentDataset(Dataset):
def __init__(self, data, label, tokenizer, context_length) -> None:
self.tokenizer = tokenizer
self.data = data
self.label = label
self.inputs = []
for i, example in enumerate(self.d... | StarcoderdataPython |
1732211 | <reponame>uncommoncode/robopen
import numpy as np
# TODO(emmett):
# * Dynamic programming TSP
# * Explore algorithm that picks between reversed line order or forward line order
# * Remove pen tap (down/up/down) or (up/down/up)
class PenPath:
def __init__(self, start_pt, end_pt):
self.start_pt = start_... | StarcoderdataPython |
6527489 | <gh_stars>1-10
import copy
from operator import itemgetter
import numpy as np
import torch
def batch_generator(dataset, batch_size, shuffle=True, mask=False):
"""
Generates a batch iterator for a dataset.
"""
data = dataset['data']
data_original = dataset['original']
data_size = len(data)
... | StarcoderdataPython |
1840347 | <gh_stars>1-10
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
"""
from time import sleep
# pip install prototools
from prototools import Menu, ProtoDB, textbox, progressbar
from prototools.colorize import *
data = ProtoDB("songs")
ALBUM = data.get_data()
def play(song):
print()
textbox(
... | StarcoderdataPython |
244236 | <filename>metrics.py
"""
In this module we store functions to measuer the performance of our model.
"""
import numpy as np
from numpy.core.numeric import argwhere
from sklearn.metrics import mean_absolute_error, make_scorer, f1_score, precision_score
def get_metric_name_mapping():
return {_mae(): mean_absolute_e... | StarcoderdataPython |
3314175 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@Time:05/26/2021 15:39 PM
@Email: <EMAIL>
"""
import os
import math
import numpy as np
import random
from config.config import Config
class Reader(object):
def __init__(self):
self.config = Config()
self.root = self.config.root
... | StarcoderdataPython |
4884677 | <reponame>earth-emoji/infotechia
from django.shortcuts import render, redirect
from .forms import ThreadForm
from .models import Topic, Thread
# Create your views here.
def topic_list(request):
template_name = "topics/list.html"
topics = Topic.objects.all()
search_term = ''
if 'q' in request.GET:
... | StarcoderdataPython |
5086445 | <reponame>mghendi/Portfolio<gh_stars>0
from django.http import HttpResponse
from django.shortcuts import render
def home_page(request):
home_title = "Hi !"
context = {"title": home_title}
#doc = "<h1>{title}</h1>".format(title=title)
#django_rendered_doc = "<h1>{{title}}</h1>".format(title=title)
... | StarcoderdataPython |
4937081 | import logging
import os
import time
from concurrent import futures
from multiprocessing import cpu_count
from google.cloud import storage
from tools.local_utils import get_settings
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
def get_elapsed_seconds(start_time):
return round(time.time() -... | StarcoderdataPython |
3232894 | <filename>api/app/routers/users.py
from fastapi import APIRouter, Depends, Path, Response
from fastapi_pagination import Page
from .. import deps
from ..schemas import Note, User, UserIn, UserInDb
from ..services import AuthService, NoteService, UserService
router = APIRouter(prefix="/users", tags=["users"])
@rout... | StarcoderdataPython |
9704035 | <gh_stars>0
import logging
from pulsar.apps.http import HttpClient
from ..utils import get_auth
from .repo import GitRepo
class GithubApi:
def __init__(self, auth=None, http=None):
if not http:
http = HttpClient(headers=[('Content-Type', 'application/json')])
self.auth = auth or get... | StarcoderdataPython |
9625350 | <reponame>HendrikPN/scigym
VERSION = '0.0.3'
| StarcoderdataPython |
224088 | <gh_stars>1-10
import gzip
import itertools
import os
import shutil
import tempfile
import zipfile
from io import BytesIO
from struct import unpack_from
from subprocess import run
import djclick as click
import requests
from django.core.files.base import ContentFile
from PIL import Image, ImageDraw, ImageFilter
from ... | StarcoderdataPython |
9753475 | <gh_stars>10-100
from setuptools import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='django-wallet',
packages=['wallets'],
version='0.3',
license='MIT',
... | StarcoderdataPython |
6582726 | <filename>test/files/column_arguments2.py
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
Column("name", Integer, index=True)
# EXPECTED_MYPY: No overload variant of "Column" matches argument types "None", "str" # noqa E501
Column(None, name... | StarcoderdataPython |
5166103 | <gh_stars>0
"""
Random field classes
"""
import numpy as np
import pyrft as pr
class Field:
""" Field class
Parameters
----------
field: a numpy.ndarray of shape (Dim) or (Dim, fibersize)
Here Dim is the size of the field and fibersize is an index for the fields,
typicall... | StarcoderdataPython |
6533772 | """Common constants."""
INDENT = ' '
ADDED = '+'
REMOVED = '-'
NESTED = 'nested'
CHANGED = 'changed'
UNCHANGED = ' '
SIMPLE = 'simple'
COMPLEX = 'complex value'
| StarcoderdataPython |
8117145 | # coding=utf-8
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.task.task import Task
from pants.util.memo import memoized_property
from structured.subsystems.r_distribution import RDistribution
class R... | StarcoderdataPython |
121094 | """empty message
Revision ID: 137ed4905569
Revises: <PASSWORD>
Create Date: 2016-09-26 17:22:28.928084
"""
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = '<PASSWORD>'
import sqlalchemy as sa
from alembic import op
def upgrade():
### commands auto generated by Alembic - please... | StarcoderdataPython |
3573518 | <filename>horizon/openstack_dashboard/dashboards/settings/logger/panel.py
__author__ = 'gaga'
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.settings import dashboard
class Logger(horizon.Panel):
name = _("Action Log")
slug = 'logger'
dashboard.... | StarcoderdataPython |
11336562 | import os
import py
import numpy as np
import openpnm as op
from openpnm.models.misc import from_neighbor_pores
class SalomeTest:
def setup_class(self):
np.random.seed(10)
self.net = op.network.Cubic(shape=[2, 2, 2])
self.net["pore.diameter"] = 0.5 + np.random.rand(self.net.Np) * 0.5
... | StarcoderdataPython |
9665692 | print("Escriba las calificaciones de los 3 parciales:")
c1, c2, c3 = map(float, input().split())
ef=float(input("Escriba la calificacion del examen final: " ))* 0.30
tf=float(input("Digite la calificacion del trabajo final: "))* 0.15
promedio=(c1+c2+c3)/3*0.55
cf=promedio+ef+tf
print("La calificacion final de la clase ... | StarcoderdataPython |
5092698 | <gh_stars>0
import pkgutil
import unittest
from django.test import TestCase
from django.test.runner import DiscoverRunner
from OnToology import settings
from OnToology.models import *
from mongoengine import connection, connect
import pyclbr
def suite():
return unittest.TestLoader().discover("OnToology.tests",... | StarcoderdataPython |
8125994 | <reponame>rspitler/infra-buddy<filename>src/main/python/infra_buddy/deploy/s3_deploy.py
import os
import tempfile
from infra_buddy.aws import s3 as s3util
from infra_buddy.aws.cloudformation import CloudFormationBuddy
from infra_buddy.aws.s3 import S3Buddy
from infra_buddy.deploy.deploy import Deploy
from infra_buddy.... | StarcoderdataPython |
6432024 | <filename>RaspberryPI/Script.py
# **********************************Defintions: ****************************************
#Device Code
Device = "aaaa"
# URLS:
# Address of Sever, Local or domain
Address = 'http://SimpleStorage.local/
# Set Color R=Red G=Green B=Blue Recommend using bright Colors
# Finder Strip
R ="25... | StarcoderdataPython |
1790781 | <reponame>Xz-Alan/RS_Classification
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.optim.lr_scheduler import StepLR
import numpy as np
import sar_data as sd
import test_sar_data as tsd
import os
import math
import time
import argparse
import scipy as sp... | StarcoderdataPython |
39458 | <reponame>sqilz/LIMS-Backend
import io
import json
from django.core.exceptions import ObjectDoesNotExist
from pint import UnitRegistry
import django_filters
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import detail_route, list_route
from rest_frame... | StarcoderdataPython |
3309672 | <filename>pointnet2/emd.py<gh_stars>10-100
import torch
import emd_cuda
import torch.nn as nn
class EarthMoverDistanceFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, xyz1, xyz2, return_match=False):
xyz1 = xyz1.contiguous()
xyz2 = xyz2.contiguous()
assert xyz1.is_cuda... | StarcoderdataPython |
3455881 | # Copyright 2017 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
3597292 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa
__doc__ = """
This sample demonstrate the coupling of aqueous equilibrium equations generated from pyequion
with the simulation using the DAETOOLs framework.
This sample was based on the daetools's tutorial: `tutorial_adv_2.py`
"""
import sys
import os
fro... | StarcoderdataPython |
9768677 | <filename>ssc_lcd.py
import RPi.GPIO as GPIO
import time
def lcd_init(config):
# Initialise display
lcd_byte(config,0x33,config.getboolean('lcd', 'LCD_CMD')) # 110011 Initialise
lcd_byte(config,0x32,config.getboolean('lcd', 'LCD_CMD')) # 110010 Initialise
lcd_byte(config,0x06,config.getboolean('lcd', 'LCD... | StarcoderdataPython |
366495 | import torch
import numbers
import numpy as np
from typing import Optional
def get_Rbasis(
system: str,
modification: Optional[str],
a: Optional[float],
b: Optional[float],
c: Optional[float],
alpha: Optional[float],
beta: Optional[float],
gamma: Optional[float],
) -> torch.Tensor:
... | StarcoderdataPython |
120036 | <filename>bot.py
# initiating bot
import os
import discord
from dotenv import load_dotenv
from discord.ext import commands
from f.alive import keep_alive
import random
# get .env secrets
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
OWNERS = os.getenv('OWNERS').split(", ")
# import cogs
initial_extensions = [
"ji... | StarcoderdataPython |
5062635 | <reponame>aaroncgw/csci-e88-final-project
import os
import json
from dateutil import parser
from http.client import IncompleteRead
import tweepy
import pykafka
import pandas as pd
from elasticsearch import Elasticsearch
class TweetStreamListener(tweepy.StreamListener):
def __init__(self):
self.client = py... | StarcoderdataPython |
126719 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_photonic_media_frequency_constraint import TapiPhotonicMediaFrequencyConstraint # noqa: F... | StarcoderdataPython |
4939309 | <reponame>sslivkoff/regression_code
"""use storm api to call other functions
- these translations are less developed than use_other_api translations
"""
import functools
import numpy as np
from .... import huth
from .... import aone
def transform_kwargs(function, kwargs_transformers=None,
out... | StarcoderdataPython |
1703843 | <reponame>Virksaabnavjot/MapperReducer<filename>train/Mapper.py
#!/usr/bin/env python
import sys
# Mapper to return 10 passengers by age groups
# Data source: https://www.kaggle.com/c/titanic/data
# Data header: "PassengerId" "Survived" "Pclass" "Name" "Sex" "Age" "SibSp" "Parch" "Ticket" "Fare" "Cabin" "Embarke... | StarcoderdataPython |
3521636 | <reponame>phanak-sap/requre<filename>requre/postprocessing.py
import logging
from typing import Union, Any, Dict, Optional, List
from .constants import KEY_MINIMAL_MATCH, METATADA_KEY
from .storage import DataMiner, DataStructure, DataTypes
logger = logging.getLogger(__name__)
class DictProcessing:
def __init__(... | StarcoderdataPython |
1883605 | <filename>modules/ctcp_reply.py<gh_stars>1-10
#!/usr/bin/env python3
# Goshu IRC Bot
# written by <NAME> <<EMAIL>>
# licensed under the ISC license
from time import strftime, localtime
from gbot.modules import Module
class ctcp_reply(Module):
"""Provides basic CTCP replies."""
core = True
def ctcp_list... | StarcoderdataPython |
6698961 | import logging
import os
from typing import TYPE_CHECKING, List, Dict, Any
from abc import ABC, abstractmethod
from checkov.common.graph.graph_builder import Edge
from checkov.common.graph.graph_builder.utils import calculate_hash, run_function_multithreaded
if TYPE_CHECKING:
from checkov.common.graph.graph_build... | StarcoderdataPython |
4843930 |
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
from ffn.training.import_util import import_symbol
import time
from train import prepare_ffn, define_data_input, train_eval_size, get_batch, EvalTracker
import platform
if platform.system() == 'Windows':
... | StarcoderdataPython |
6501849 | #!/usr/bin/env python
"""
Fix errors in a dataset.
For now, only removing erroneous lines is supported.
usage: %prog input errorsfile output
-x, --ext: dataset extension (type)
-m, --methods=N: comma separated list of repair methods
"""
import pkg_resources; pkg_resources.require( "bx-python" )
from bx.cookb... | StarcoderdataPython |
3375978 | import asyncio
from .engine.fanhuaji import FanhuajiEngine
from .engine.opencc import OpenCC as OpenCCEngine
class Converter():
def __init__(self, engine, converter):
self.engine = engine
self.converter = converter
def convert(self, content: str) -> str:
"""轉換 epub 內文
Args:... | StarcoderdataPython |
8194094 | from injector import singleton, Module
from authserver.db.graph_database import AbstractGraphDatabase, Neo4jGraphDatabase
class GraphDatabaseModule(Module):
def configure(self, binder):
binder.bind(AbstractGraphDatabase, to=Neo4jGraphDatabase, scope=singleton)
| StarcoderdataPython |
5134309 | # -*- coding: utf-8 -*-
"""
Created on Tue May 26 15:32:05 2015 by Florin.Neacsu
Copyright Xcision LLC.
"""
from XcIOCommon import *
def ReadOCPparam(fname):
"""
Reads the file provided as input, assuming the
following format
|Radiation unit type: int
|Outer cup size: int
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.