id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11390823 | #!/usr/bin/env python3
import rich
import rich.console
import user
import conf
import lock
import args
import clean
import common
import signal
from run import run
from tests import tests
class MFCState:
def __init__(self) -> None:
from build import MFCBuild
rich.print(common.MFC_HEADER)
... | StarcoderdataPython |
89463 |
import pybullet as p
import time
useMaximalCoordinates=False
p.connect(p.GUI)
pole = p.loadURDF("cartpole.urdf", useMaximalCoordinates=useMaximalCoordinates)
for i in range (p.getNumJoints(pole)):
#disable default constraint-based motors
p.setJointMotorControl2(pole,i,p.POSITION_CONTROL,targetPosition=0,force=0)
p... | StarcoderdataPython |
3342278 | import pytest
from pytest_bdd import given, then, when
@given('passed step1')
def given_passed_step1():
pass
@given('passed step')
def given_passed_step():
pass
@when('passed step')
def when_passed_step():
pass
@then('passed step')
def then_passed_step():
pass
@given('skipped step')
def given_... | StarcoderdataPython |
1728928 | input = open('input.txt');
length = int(input.readline());
tokens = input.readline().split(' ');
tokens = [float(element) for element in tokens]
input.close();
output = open('output.txt' , 'w');
sort = sorted(tokens);
output.write(str(tokens.index(sort[0]) + 1) + ' ' + str(tokens.index(sort[(length - 1) // 2]) + 1) + '... | StarcoderdataPython |
3201237 | # Copyright (c) 2018 Dolphin Emulator Website Contributors
# SPDX-License-Identifier: MIT
from django.conf import settings
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.translation import ugettext as _
from dolweb.blog.models import Blo... | StarcoderdataPython |
11394757 | <reponame>Data-to-Insight-Center/CKN<filename>komadu_client/processors/codar_event_processor.py<gh_stars>0
from datetime import datetime
from komadu_client.models.model_creator import create_workflow_activity, create_file_entity, get_activity_entity, \
add_attributes_activity, get_attributes
from komadu_client.util... | StarcoderdataPython |
67194 | # This extension is quite simple:
# 1. It accepts a script name
# 2. This script is added to the document in a literalinclude
# 3. Any _static images found will be added
import glob
import os
import shutil
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
# Some of this magic co... | StarcoderdataPython |
6423991 | <gh_stars>1-10
# Generated by Django 2.2.4 on 2020-12-04 06:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Dashboard', '0017_auto_20201204_1142'),
]
operations = [
migrations.RenameField(
model_name='history',
old_na... | StarcoderdataPython |
12804312 | # IMPORTATION STANDARD
import os
from datetime import datetime
# IMPORTATION THIRDPARTY
import pandas as pd
import pytest
# IMPORTATION INTERNAL
pred_controller = pytest.importorskip(
modname="openbb_terminal.etf.prediction_techniques.pred_controller",
reason="Requires prediction dependencies, like tensorflow... | StarcoderdataPython |
1683869 | """Test parsers for various things gallica returns.
Wouldn't it be nice if apis returned machine-readable data?!
"""
from pathlib import Path
import pytest
test_tocs = ["toc-no-cells.xml", "toc-with-cells.xml", "mix.xml"]
@pytest.mark.parametrize("xml", test_tocs)
def test_parse_toc(data_regression, gallica_resour... | StarcoderdataPython |
6678470 | import pandas as pd
questions = pd.DataFrame.from_csv('question_simple.csv', index_col=None)
a_questions = pd.DataFrame.from_csv('question_votes.csv', index_col=None)
get_votes_qv = lambda df: pd.Series((df.VoteType==2).cumsum() + (df.VoteType==3).cumsum(),name='QVotes')
get_score_qv = lambda df: pd.Series((df.VoteType... | StarcoderdataPython |
1862060 | <filename>openlabcmd/openlabcmd/plugins/__init__.py
from openlabcmd.plugins import jobs
from openlabcmd.plugins import nodepool
| StarcoderdataPython |
9685986 | <gh_stars>0
import random
import numpy as np
from codit.population.person import Person
class PersonCovid(Person):
def __init__(self, name, config=None, home=None):
Person.__init__(self, name, config=config, home=home)
self._symptomatic = False
self.has_tested_positive = False
@prope... | StarcoderdataPython |
5013030 | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 9 15:55:30 2019
@author: Shiru
"""
# resize to 224 X 224 then 3 channel RGB
import os
import cv2
import numpy as np
work_folder = '/home/shirui/Fall_Dataset'
avi_folder = work_folder + '/dataset_avi'
image_folder = work_folder + '/images'
numpy_folder = work_folder +... | StarcoderdataPython |
11245435 | from rest_framework import serializers
from .models import *
class TestSerializer(serializers.ModelSerializer):
class Meta:
model = ClientModel
fields = '__all__'
| StarcoderdataPython |
1919865 | <reponame>PitPietro/pascal-triangle
import numpy as np
from numpy import doc
if __name__ == '__main__':
help(np.arange)
help(doc)
# print(np.lookfor('binary representation'))
| StarcoderdataPython |
8792 | from authors.apps.utils.renderers import AppJSONRenderer
import json
from rest_framework.renderers import JSONRenderer
class UserProfileJSONRenderer(AppJSONRenderer):
name = 'profile'
class UserProfileListRenderer(JSONRenderer):
"""
Returns profiles of existing users
"""
charset = 'utf-8'
... | StarcoderdataPython |
3466112 | <gh_stars>0
"""
File name : Buffet altitude constraint
Author : <NAME>
Email : <EMAIL>
Date : November/2020
Last edit : November/2020
Language : Python 3.8 or >
Aeronautical Institute of Technology - Airbus Brazil
Description:
- This module obtain the cruise altutude considering buffeting constraints
... | StarcoderdataPython |
9724858 | <filename>inqbus.lidar.scc_gui/src/inqbus/lidar/scc_gui/viewbox.py
import os
import weakref
import sys
import traceback as tb
import numpy as np
import pyqtgraph as pg
from PyQt5 import uic
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.graphicsItems.ViewBox import ViewBox
from pyqtgraph.graphicsItems.ViewBox.V... | StarcoderdataPython |
3425180 | # -*- coding: utf-8 -*-
# 招聘市场服务
class RecruitmentService:
__client = None
def __init__(self, client):
self.__client = client
def upload_resume(self, resume):
"""
简历回传
:param resume:简历信息
"""
return self.__client.call("eleme.recruitment.uploadResume", {"re... | StarcoderdataPython |
11396616 | <gh_stars>0
import chess_nn
from data_config import DataConfig
if __name__ == '__main__':
sub_set = 100
print('Reading data samples...')
data = DataConfig('data.config')
train_data, train_labels = data.get_train()
test_data, test_labels = data.get_test()
data.h5data.close()
#test_labels = ... | StarcoderdataPython |
3580630 | from .validation import (check_random_state)
from ._testing import run_tests_if_main | StarcoderdataPython |
1687481 | # Use .com to toggle a different message handler on or off.
# Handy if you want to control the usage of a specific command.
from pyrogram import Client, filters
app = Client("my_account")
def commute(self):
"""Switch states between `True` and `False`"""
self.flag = not self.flag
return self.flag
f = f... | StarcoderdataPython |
338226 | # Listing_23-1.py
# Copyright Warren & <NAME>, 2013
# Released under MIT license http://www.opensource.org/licenses/mit-license.php
# Version $version ----------------------------
# Rolling a single 11-sided die 1,000 times
import random
totals = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # List has 13 items, with... | StarcoderdataPython |
281088 | <reponame>hyperledger/indy-post-install-automation<gh_stars>1-10
"""
Created on Dec 12, 2017
@author: nhan.nguyen
Verify that user can store 'their_did' with only did (without verkey).
"""
import pytest
import json
from indy import did
from utilities import common, utils
from test_scripts.functional_tests.did.signu... | StarcoderdataPython |
12821252 | from pathlib import Path
from geometrout.transform import SE3, SO3
from ikfast_franka_panda import get_fk, get_ik
import numpy as np
class FrankaRobot:
# TODO remove this after making this more general
JOINT_LIMITS = np.array(
[
(-2.8973, 2.8973),
(-1.7628, 1.7628),
... | StarcoderdataPython |
5133847 | from typing import Union
from .validator import Validator, ValidationError, StopValidation
class NotIn(Validator):
def __init__(self, no_accepted_values = Union[list, tuple], message: Union[str, None] = None, parse: bool = True) -> None:
self.parse = parse
self.message = message or 'This field is ... | StarcoderdataPython |
6538843 | <reponame>absheik/forthic<gh_stars>1-10
import os
import re
from requests_oauthlib import OAuth2Session
from flask import Flask, render_template, request, redirect, url_for, session
import markdown
from forthic.interpreter import Interpreter
import forthic.modules.jira_module as jira_module
import forthic.modules.gshe... | StarcoderdataPython |
5198066 | <filename>pretix_banktransferfi/__init__.py<gh_stars>0
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from pretix import __version__ as version
class BankTransferFiApp(AppConfig):
name = 'pretix_banktransferfi'
verbose_name = _("Bank transfer FI")
class PretixP... | StarcoderdataPython |
8136840 | # -*- coding: utf-8 -*-
"""DevDoc URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home,... | StarcoderdataPython |
9756871 | # -*- coding: utf-8 -*-
import json
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class CarrefourFrSpider(scrapy.Spider):
name = "carrefour_fr"
item_attributes = {"brand": "Carrefour"}
allowed_domains = ["carrefour.com"]
def start_requ... | StarcoderdataPython |
6492242 | import subprocess
def open_file_in_os(path: str):
subprocess.run(['explorer', path], check=False)
def get_ex_msg(e: BaseException, default='Error'):
return e.strerror if hasattr(e, 'strerror') else e.message if hasattr(e, 'message') else default
| StarcoderdataPython |
5093918 | _base_ = ['../cityscapes_grid/faster_rcnn_r50_fpn_1x_cityscapes.py',]
n_freq = 3
model = dict(
backbone=dict(
type='PositionalEncodingResNet',
num_frequencies=n_freq,
),
)
load_from = '/data/vision/polina/users/clintonw/code/mmdet/checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
| StarcoderdataPython |
5040678 | <gh_stars>1-10
# coding:utf-8
'''
poker game server
python 2.7
winxos 2016-07-12
'''
import socket
from threading import Thread
from time import sleep
import os
import random
class game_state:
def show_info(self): print("no show")
def run(self): print("no run.")
class Idle(game_state):
def show_info(se... | StarcoderdataPython |
5069490 | <reponame>proteanblank/building_tool
import bpy
from bpy.props import (
BoolProperty,
FloatProperty,
FloatVectorProperty,
)
from ..utils import (
clamp,
restricted_size,
restricted_offset,
)
from mathutils import Vector
class SizeOffsetProperty(bpy.types.PropertyGroup):
""" Convinience P... | StarcoderdataPython |
1758653 | # Variables generales
jugador_x = 0
# Gameloop
while True:
if termina_juego():
break
# Revisamos teclas
if tecla_derecha:
# Actualizamos datos
jugador_x += 1
# Pintamos de acuerdo los nuevos datos
pintar_jugador(jugador_x)
| StarcoderdataPython |
165691 | # -*- coding: utf-8 -*-
import pandas as pd
from zvt.api import get_kdata_schema
from zvt.contract import IntervalLevel
from zvt.contract.api import df_to_db
from zvt.contract.recorder import FixedCycleDataRecorder
from zvt.utils import to_time_str, to_pd_timestamp
from zvt.utils.time_utils import TIME_FORMAT_DAY, TI... | StarcoderdataPython |
3219085 | <reponame>GREENADOUTDOORSHQ/Lean
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | StarcoderdataPython |
3528124 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .schema import Schema
# Module API
def validate(descriptor):
"""https://github.com/frictionlessdata/tableschema-py#schema
"""
... | StarcoderdataPython |
4964923 | # from domains.gym_craft.simulator.craft_world import Terrain
# import numpy as np
# terrain = Terrain(None,8,None,None)
# print(terrain.get_blocking_terrain())
# a = 3
# TILES(np.argmax(terrain.terrain[4,6]))
# terrain[4,6]
# from domains.gym_craft.simulator.game_data import GameData
# gamedata = GameData()
# gam... | StarcoderdataPython |
5122038 | <filename>setup.py
from setuptools import setup
with open('README.rst') as f:
long_description = f.read()
setup(
name='flask-lambda-python36-lb',
version='0.6.0',
description=('Python3.6+ module to make Flask compatible with AWS Gateway and AWS Load Balancer'),
long_description=long_description,
... | StarcoderdataPython |
265708 | <reponame>craig-shenton/open-health-statistics<gh_stars>0
import yaml
import pandas as pd
from datetime import datetime
import plotly
import plotly.graph_objects as go
import plotly.express as px
import github as github
import gitlab as gitlab
# Load in the config parameters
with open("config.yaml", "r") as f:
co... | StarcoderdataPython |
285697 | <gh_stars>0
from PySide2.QtUiTools import QUiLoader
from PySide2.QtWidgets import *
from logic.csvConverter import load_csv
from view.uiHelpers import translate, load_ui_file
class IOWidget(QWidget):
def __init__(self, dialog):
super().__init__(parent=dialog)
ui_file_name = "ui_files/io_widget.... | StarcoderdataPython |
3478781 | from django.urls import path
from django.contrib.auth.views import LogoutView
from . import views
urlpatterns = [
path('settings', views.settings, name="settings"),
path('login', views.CustomLoginView.as_view(), name="login"),
# path('register/', views.registerView, name="register_url"),
path('logout',... | StarcoderdataPython |
1678072 | <filename>project/apps/cmanager/filtersets.py<gh_stars>0
from django_filters.rest_framework import FilterSet
# Local
from .models import Assignment
from .models import Convention
class AssignmentFilterset(FilterSet):
class Meta:
model = Assignment
fields = {
'person__user': [
... | StarcoderdataPython |
8184031 | """
File name: renderer
Author: <NAME>
Date created: 03.03.2019
Date last modified: 18:25 03.03.2019
Python Version: "3.6"
Copyright = "Copyright (C) 2018-2019 of Packt"
Credits = ["<NAME>, <NAME>"] # people who reported bug fixes, made suggestions, etc. but did not actually write the code
License = "MIT"
Version = "1... | StarcoderdataPython |
4866693 | # taxes.apps
# Tax app configuration
#
# Author: <NAME> <<EMAIL>>
# Created: Sat Apr 14 16:36:54 2018 -0400
#
# ID: apps.py [20315d2] <EMAIL> $
"""
Tax app configuration
"""
##########################################################################
## Imports
#########################################################... | StarcoderdataPython |
6419671 | <gh_stars>0
from time import time
from random import randint
def comp():
for m in range(5, 25):
debut = time()
print(sum([n ** 2 for n in range(2 ** m)]))
print(m, ":", time() - debut)
# le code est de plus en plus long à s'éxecuter à mesure que
# m augmente.
def tri_bulle(liste... | StarcoderdataPython |
8040437 | <reponame>endritber/digitalization-of-university-administration<filename>server-side/app/core/migrations/0007_auto_20220126_0735.py<gh_stars>0
# Generated by Django 2.1.15 on 2022-01-26 07:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_... | StarcoderdataPython |
8161702 | <filename>qrcp/qrcp.py<gh_stars>0
import socket
import sys
from http.server import HTTPServer, SimpleHTTPRequestHandler
from os import chdir, path
from socketserver import ThreadingMixIn
from shutil import copyfile
from tempfile import TemporaryDirectory
import pyqrcode
START_PORT = 8000
class ThreadedHTTPServer(T... | StarcoderdataPython |
8055807 | import random
import csv
import math
numbersheets = 40
gridsize = 5
stepping = 16
save_path = './cards.html'
input_file = './input.csv'
center_figure = '<img src="https://raw.githubusercontent.com/rsukumar75/music-bingo/master/center-img.png"/>'
input_words = []
input_ids = []
with open(input_file, 'r') as f:
r =... | StarcoderdataPython |
1648763 | # -*- coding: utf-8 -*-
from flask import Flask, render_template, session
from flask import request, redirect, url_for, jsonify
import shelve
from lxml import etree
import xml.etree.cElementTree as ET
from pymongo import MongoClient
app = Flask(__name__)
app.secret_key = '<KEY>'
@app.route('/')
def index():
us... | StarcoderdataPython |
6575752 | <filename>src/cogs/calculus.py
import discord
from discord.ext import commands
import sympy
from utility.math_parser import parse_eq, parse_var
class Calculus(commands.Cog):
"""
Contains various calculus tools
"""
def __init__(self, bot):
self.bot = bot
self.file_location = 'temp/outp... | StarcoderdataPython |
6571900 | import asyncio
from datetime import datetime
from aiohttp import request
from aiohttp.client import ClientSession
from typing import List
from .peer_manager import PeerManager
async def load_peers(init_peer: str, peer_manager: PeerManager) -> List[str]:
connections = []
async with ClientSession(trust_env=True... | StarcoderdataPython |
3345849 | # Copyright 2019 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
5056249 | <reponame>dakk/tezpie
import unittest
from crypto import *
from proto import *
if __name__ == '__main__':
unittest.main() | StarcoderdataPython |
3400969 | <filename>pre_commit_hooks/check_jsonschema.py
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import json
import sys
import jsonschema
def main(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument("filenames", nargs="*", help="Filenames to check.")
args = par... | StarcoderdataPython |
4880536 | # Splay Tree Implementation
from __future__ import annotations
import warnings
from typing import Any, Optional
from datastax.errors import (
DuplicateNodeWarning,
DeletionFromEmptyTreeWarning,
NodeNotFoundWarning
)
from datastax.trees.binary_search_tree import BinarySearchTree, TreeNode
class SplayNode... | StarcoderdataPython |
5129664 | <reponame>exiahuang/xy-cli<gh_stars>0
import os
from os import walk
class FileUtil():
def save(self, filepath, content):
dirname = os.path.dirname(filepath)
if not os.path.exists(dirname):
os.makedirs(dirname)
with open(filepath, 'w', encoding="utf-8") as f:
... | StarcoderdataPython |
3204270 | <reponame>mfindeisen/crudlfap<gh_stars>0
from crudlfap.settings import * # noqa
INSTALLED_APPS += [ # noqa
# CRUDLFA+ examples
'crudlfap_example.artist',
'crudlfap_example.song',
'crudlfap_example.nondb',
'crudlfap_example.blog',
]
install_optional(OPTIONAL_APPS, INSTALLED_APPS) # noqa
install_... | StarcoderdataPython |
3241822 | <gh_stars>1-10
'''
This program utilizes merge sort and binary serach
Fundamentals of Programming
<NAME>
ACC FALL 2018
Lab7.py
<NAME>
'''
# Going by the instruction of the assignment, I wrote it; not implemented
def insertionSort(data, slot=-1):
slot = len(data) - 1 if slot == -1 else slot #if slot is ... | StarcoderdataPython |
3225013 | def pattern(n):
if n <= 0:
return ""
string = "".join([str(i % 10) for i in range(1, n)])
res = ""
for i in range(n-1):
res += " "*(n-1)+str((i+1) % 10)*n+" "*(n-1)+"\n"
for i in range(n):
res += string+str(n % 10)*n+string[::-1]+"\n"
for i in range(n-1, 0, -1):
r... | StarcoderdataPython |
8060997 | # coding: utf-8
import time
import math
from ChartBars import Chart
from Util import TimeUtil
from Algorithm_PriceDecider_CloseFixedRateAndTime_base import PriceDecider_CloseFixedRateAndTime_base
class PriceDeciderByHighestOrLowest(PriceDecider_CloseFixedRateAndTime_base):
def __init__(self,
use_... | StarcoderdataPython |
11351470 | """Test suite for Pandas DataFrame serializers."""
| StarcoderdataPython |
1874895 | """Type casting.
@see: https://www.w3schools.com/python/python_casting.asp
There may be times when you want to specify a type on to a variable. This can be done with casting.
Python is an object-orientated language, and as such it uses classes to define data types,
including its primitive types.
Casting in python is... | StarcoderdataPython |
8144852 | <filename>ML/website-scraping-w-python-master/Chapter 6/scrapinghub/scrapinghub/sainsburys/sainsburys/settings.py
# -*- coding: utf-8 -*-
BOT_NAME = 'sainsburys'
SPIDER_MODULES = ['sainsburys.spiders']
NEWSPIDER_MODULE = 'sainsburys.spiders'
USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'... | StarcoderdataPython |
365051 | from nibabel import four_to_three
from nibabel.processing import resample_to_output, resample_from_to
from skimage.measure import regionprops, label
from skimage.transform import resize
from tensorflow.python.keras.models import load_model
from scipy.ndimage import zoom
import os
import nibabel as nib
from os.path impo... | StarcoderdataPython |
11325413 | <reponame>hilbertspace05/Tkinter-CRUD
import tkinter as tk
import mysql.connector
from mysql.connector import Error
import paginainicial
LARGE_FONT = ("Verdana", 12)
try:
cnx = mysql.connector.connect(user='root', password='',
host='127.0.0.1',
d... | StarcoderdataPython |
11389897 | """Aiohue errors.
https://developers.meethue.com/documentation/error-messages
"""
class AiohueException(Exception):
"""Base exception for aiohue."""
class Unauthorized(AiohueException):
"""Username is not authorized."""
class LinkButtonNotPressed(AiohueException):
"""Raised when trying to create a us... | StarcoderdataPython |
3397187 | <gh_stars>1-10
#!/usr/bin/python3
# SPDX-License-Identifier: MIT
from datetime import datetime
import feedparser
import re
import sqlite3
import sys
import time
MAX_ENTRIES_PER_FEED = 8
force = False
if len(sys.argv) > 1 and sys.argv[1] == '--force':
force = True
conn = sqlite3.connect('feeds.db')
conn.row_f... | StarcoderdataPython |
5071752 | import os
import dpath.util
ARRAY_IDENTIFIER = "[]/"
MULTI_FIELDS_IDENTIFIER = ","
MAPPING_FROM_TO_SEPARATOR = "->"
RESULT_TYPE_SEPARATOR = ":"
ARRAY_RESULT_TYPE = "array"
STRING_RESULT_TYPE = "string"
SINGLE_STRING_RESULT_TYPE = "single_string"
def map_ticket_fields(ticket, mappings):
result = {}
for mapp... | StarcoderdataPython |
11282388 | #!/usr/bin/env python2.7
try:
activate_this = './bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
except:
pass
import click
import sys
from sqlalchemy import *
from dbwipes.summary import Summary
@click.command()
@click.option('--reset', is_flag=True)
@click.argument('dbname')
@clic... | StarcoderdataPython |
3495768 | # -*- coding: utf-8 -*-
import tensorflow as tf
from tfsnippet.utils import DocInherit, get_default_scope_name
__all__ = ['Distribution']
@DocInherit
class Distribution(object):
"""
Base class for probability distributions.
A :class:`Distribution` object receives inputs as distribution parameters,
... | StarcoderdataPython |
5116713 | <filename>tests/test_coffee.py
import logging
from unittest.mock import patch
import pytest
from sanic.application.logo import COFFEE_LOGO, get_logo
from sanic.exceptions import SanicException
def has_sugar(value):
if value:
raise SanicException("I said no sugar please")
return False
@pytest.mar... | StarcoderdataPython |
5090123 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | StarcoderdataPython |
4914627 | <reponame>JailsonLiberato/ForceClustering
from algorithm.force_clustering import ForceClustering
class Main:
"""Main Class"""
def __init__(self):
self.__force_clustering = ForceClustering()
def execute(self):
self.__force_clustering.execute()
main = Main()
main.execute()
| StarcoderdataPython |
5006901 | import time
from pysine import sine
unit = 100
frequency = 1000
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
alphabetValue = [
[1,0,3,0,0,0],
[3,0,1,0,1,0,1,0,0,0],
[3,0,1,0,3,0,1,0,0,0],
[3,0,1,0,1,0,0,0],
[1,0,0,0],
[1,0,1,0,3,0,1,0,0,0],
[3,0... | StarcoderdataPython |
392013 | <reponame>nunenuh/modelzoo.pytorch
import random
import PIL
from PIL import Image
import torchvision.transforms.functional as F
import torchvision.transforms as transforms
__all__ = ['PairCompose', 'PairResize', 'PairCenterCrop', 'PairColorJitter', 'PairPad',
'PairRandomAffine', 'PairRandomApply', 'PairRand... | StarcoderdataPython |
9673007 | """
Dveloper: vujadeyoon
Email: <EMAIL>
Github: https://github.com/vujadeyoon/vujade
Title: vujade_download.py
Description: A module for download
"""
import requests
import shutil
class Download(object):
def __init__(self):
pass
@staticmethod
def run(_url: str, _spath_filename: str) -> bool:
... | StarcoderdataPython |
5158133 | import unittest
import aiohttp
from agent import a
from agent.device import TimePeriod
import asyncio
async def Test (url):
tc = a.Agent(url)
sess = aiohttp.ClientSession()
tc2 = a.Agent(url,sess)
await tc.update()
print(tc.is_available)
print(await tc.get_profiles())
print(await tc.get_act... | StarcoderdataPython |
6534306 | """Module provides CruxConfig object to manage API configuration settings."""
import os
import platform
import re
from typing import Dict, MutableMapping, Optional, Text, Union # noqa: F401
import requests
from requests.packages.urllib3.util.retry import ( # Dynamic load pylint: disable=import-error
Retry,
)
f... | StarcoderdataPython |
3571916 | <gh_stars>10-100
#get helix segments
import os
import os.path
from dscode import readssp
def helixl(m,pdb,pdbh,dssplocation,hfile,hha,resi):
if m==1:
# hlx=hpdb(pdb)
hlx=pdbh
elif m==2:
hlx=hdssp(pdb,dssplocation)
elif m==3:
hlx=hcustm(hfile,resi)
# if hlx=='':
# print 'no ',hfile,' found... | StarcoderdataPython |
6497119 | # Generated by Django 3.2.12 on 2022-03-20 14:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import house_of_refuge.main.models
import markdownx.models
class Migration(migrations.Migration):
dependencies = [
migr... | StarcoderdataPython |
5190778 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# C++ version Copyright (c) 2006-2007 <NAME> http://www.box2d.org
# Python version Copyright (c) 2010 kne / sirkne at gmail dot com
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damag... | StarcoderdataPython |
12814504 | from django.core.management.base import BaseCommand
from api.user.models import SavedSearch
class Command(BaseCommand):
"""
Marks all saved searches as notified
To be removed after deploy of saved search notifications.
"""
help = "Marks all saved searches as notified"
def handle(self, *arg... | StarcoderdataPython |
6554397 | import os
import sys
import traceback
from ApplicationContext import ApplicationContext
from jtalks import __version__
from jtalks.ScriptSettings import ScriptSettings
from jtalks.util.Logger import Logger
from util.LibVersion import LibVersion
class Main:
def __init__(self):
self.logger = Logger('Main')... | StarcoderdataPython |
4813151 | <gh_stars>0
import turtle
import random
#변수선언(전역변수)
num=0
swidth, sheight = 1000,300
curX,curY = 0,0
#메인코드
turtle.shape('turtle')
turtle.setup(width=swidth + 30, height=sheight + 30)
turtle.screensize(swidth, sheight)
turtle.penup()
turtle.left(90)
# num = int(input('숫자-->'))
# binary = bin(num)
#
# curX = swidth/2
... | StarcoderdataPython |
283277 | <filename>Packs/Lokpath_Keylight/Integrations/Lockpath_KeyLight_v2/Lockpath_KeyLight_v2.py
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
from datetime import datetime, timedelta
from typing import Union
import traceback
# Disable insecure warnings
requests.package... | StarcoderdataPython |
1751377 | <filename>giftcard/webservers/nginx.py<gh_stars>1-10
import fabric.api
import tempfile
import os
from django.conf import settings
def _ban_msie(protocol, local_project_root, remote_project_root, web_server_config):
if not web_server_config.get('ban_msie_redirect', None):
return ''
return '\n'.join([
... | StarcoderdataPython |
9709860 | <filename>utils/event-scan.py
from clang.cindex import *
from multiprocessing import Process, Queue, cpu_count
import sys, subprocess, json, time
import re, os
from tqdm import tqdm
from colorama import init, deinit, Fore, Back, Style
from pathlib import Path
init()
project_root = '/'
exclude_files = ['/projects/ECS/... | StarcoderdataPython |
1916717 | import torch
from torch import nn
class TLU(nn.Module):
def __init__(self, num_features):
"""max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau"""
super(TLU, self).__init__()
self.num_features = num_features
self.tau = nn.parameter.Parameter(
torch.Tensor(1, num_... | StarcoderdataPython |
179671 | <reponame>Joevaen/Scikit-image_On_CT
# DAISY局部图像描述符基于梯度方向直方图
# http://cvlab.epfl.ch/software/daisy
# 没怎么看懂这个算法干什么的
from skimage.feature import daisy
from skimage import data, img_as_float, io
import matplotlib.pyplot as plt
img = img_as_float(io.imread('/home/qiao/PythonProjects/Scikit-image_On_CT/Test_Img/10.jpg'))... | StarcoderdataPython |
8191265 | """
* Assignment: DataFrame NaN
* Complexity: easy
* Lines of code: 10 lines
* Time: 8 min
English:
TODO: English Translation
X. Run doctests - all must succeed
Polish:
1. Wczytaj dane z `DATA` jako `df: pd.DataFrame`
2. Pomiń pierwszą linię z metadanymi
3. Zmień nazwy kolumn na:
a. Sepal ... | StarcoderdataPython |
1702830 | from __future__ import unicode_literals
from datetime import datetime
import platform
class Global(object):
def get(self):
raise NotImplementedError
class OsGlobal(object):
def get(self):
system = platform.system()
if system == 'Linux':
return 'linux'
if system =... | StarcoderdataPython |
363026 | <gh_stars>1-10
# 1401 - Warriors of Perion
sm.setSpeakerID(1022000) # <NAME>
response = sm.sendAskYesNo("So you want to become a Warrior?")
if response:
sm.completeQuestNoRewards(parentID)
sm.jobAdvance(100)
sm.resetAP(False, 100)
sm.giveItem(1302182)
sm.sendSayOkay("You are now a #bWarrior#k.")
| StarcoderdataPython |
202135 | # flake8: noqa
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
# Sets the environment variable for default config path if it does not
# exist yet
from os import environ, path
... | StarcoderdataPython |
1638132 | <filename>condoor/drivers/eXR.py
"""This is IOS XR 64 bit driver implementation."""
from functools import partial
import re
import logging
import pexpect
from condoor.exceptions import CommandSyntaxError, CommandTimeoutError, ConnectionError
from condoor.actions import a_connection_closed, a_expected_prompt, a_stays_... | StarcoderdataPython |
12834735 | #! /home/admin/venvs/hcr-2016/bin/python
import sys
print '\n'.join(sys.path)
import naoqi
if __name__ == '__main__':
print "Naoqi Test"
| StarcoderdataPython |
3301689 | <gh_stars>1-10
# Copyright 2014 The Oppia Authors. 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... | StarcoderdataPython |
8060557 | <gh_stars>1-10
import unittest
from whenareyou import whenareyou, whenareyou_IATA
class TestWhenareyou(unittest.TestCase):
@classmethod
def setUpClass(cls):
# to run before all tests
pass
@classmethod
def tearDownClass(cls):
# to run after all tests
pass
def se... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.