id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
159954 | <reponame>cyph3r-exe/python-practice-files
"""
Using nested loops to iterate over
all the items in a matrix list
"""
#Defining a matrix list
matrix = [
[1,2,3],
[4,5,6],
[7,8,9]
]
#This loop will iterate over all the items inside the matrix list
for row in matrix:
for index in row:
print(ind... | StarcoderdataPython |
3243967 | import numpy as np
from homog.util import jit, guvec, float32, float64
def is_valid_quat_rot(quat):
assert quat.shape[-1] == 4
return np.isclose(1, np.linalg.norm(quat, axis=-1))
def quat_to_upper_half(quat):
ineg0 = (quat[..., 0] < 0)
ineg1 = (quat[..., 0] == 0) * (quat[..., 1] < 0)
ineg2 = (qu... | StarcoderdataPython |
3223441 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-04-09 08:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("georegion", "0001_initial_squashed_0004_... | StarcoderdataPython |
1764984 | <filename>python/read_data.py<gh_stars>0
import os, sys
sys.path.append('../application')
import math
import matplotlib.pyplot as plt
import random
import time
import serial
from Point import *
import re
HOST = 'nb-arnault4'
PORT = 5000
# speed = 9600
speed = 115200
def func():
# return random.random()
... | StarcoderdataPython |
3368258 | <filename>tools/os.bzl
"""A collection of OS-related utilities intended for use in repository rules,
i.e., rules used by WORKSPACE files, not BUILD files.
"""
load("@slime//tools:execute.bzl", "which")
def exec_using_which(repository_ctx, command):
"""Run the given command (a list), using the which() function in
... | StarcoderdataPython |
188245 | <gh_stars>0
"""
Find Largest Value in Each Tree Row
You need to find the largest value in each row of a binary tree.
Example:
Input:
1
/ \
3 2
/ \ \
5 3 9
Output: [1, 3, 9]
"""
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
... | StarcoderdataPython |
1613598 | """Adapted from:
@longcw faster_rcnn_pytorch: https://github.com/longcw/faster_rcnn_pytorch
@rbgirshick py-faster-rcnn https://github.com/rbgirshick/py-faster-rcnn
Licensed under The MIT License [see LICENSE for details]
"""
from __future__ import print_function
import torch
import torch.nn as nn
import to... | StarcoderdataPython |
1730745 | <gh_stars>0
import os
import json
import yaml
def load_config_file(file_name):
filename, file_extension = os.path.splitext(file_name)
file_extension = file_extension.lower()[1:]
if file_extension == 'json':
return json.load(file_name)
elif file_extension in ['yaml', 'yml']:
return yaml... | StarcoderdataPython |
3240416 | <reponame>benoitc/pypy<filename>pypy/jit/tl/tla/add_10.tla.py
from pypy.jit.tl.tla import tla
code = [
tla.CONST_INT, 10,
tla.ADD,
tla.RETURN
]
| StarcoderdataPython |
3397413 | <reponame>eRuaro/Dog-Breed-Classifier
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
import pandas as pd
class Model:
def load_model(self, model_path):
"""
Loads a saved model from specified path
"""
print(f"Loading saved model from: {model_path}...")
... | StarcoderdataPython |
3293558 | from conans import ConanFile, CMake, tools
class CinderConan(ConanFile):
name = "cinder"
version = "0.9.2"
license = """
Copyright (c) 2010, The Cinder Project
This code is intended to be used with the Cinder C++ library, http://libcinder.org
Redistribution and use in source and binary forms, with or wi... | StarcoderdataPython |
1676962 | <gh_stars>10-100
# Copyright 2018-2020 Xanadu Quantum Technologies 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 ... | StarcoderdataPython |
65940 | # For backwards compatibility, importing the PIL drawers here.
from .pil import CircleModuleDrawer # noqa: F401
from .pil import GappedSquareModuleDrawer # noqa: F401
from .pil import HorizontalBarsDrawer # noqa: F401
from .pil import RoundedModuleDrawer # noqa: F401
from .pil import SquareModuleDrawer # noqa: F40... | StarcoderdataPython |
1658733 | <reponame>fhowar/benchexec
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.tools.template
import benchexec.result as result
... | StarcoderdataPython |
1727262 |
import random
from typing_extensions import Required
#from sqlalchemy.sql.sqltypes import Boolean
from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int
from models.AcreditationRelated.StudyPlan import StudyPlanModel
from models.AcreditationRelated.StudyPlanItem import StudyPlanI... | StarcoderdataPython |
3218395 | <gh_stars>0
#!/usr/bin/env python3
import os
import unittest
import sys
doxyqml_path = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)
sys.path.insert(0, doxyqml_path)
from qmlclasstestcase import *
from qmlparsertestcase import *
from lexertestcase import *
def main():
unittest.main()
if __name_... | StarcoderdataPython |
1623097 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from sqlalchemy.orm import joinedload
from tahiti.models import *
from flask import current_app
def test_list_operations_simple_data_success(client):
headers = {'X-Auth-Token': str(client.secret)}
params = {'simple': 'true'}
rv = client.get('/operations', headers=hea... | StarcoderdataPython |
4826870 | from onegov.ballot import PartyResult
from onegov.election_day import _
from sqlalchemy.orm import object_session
def has_party_results(item):
""" Returns True, if the item has party results. """
if getattr(item, 'type', 'proporz') == 'proporz':
if item.party_results.first():
return True
... | StarcoderdataPython |
1745484 | <gh_stars>0
#!/usr/bin/env python
import socket
import json
import sys
import rospy
from geometry_msgs.msg import Vector3Stamped
if len(sys.argv)<3:
print("usage cmd ip_address topic_name")
exit()
ip = sys.argv[1]
port = 7005
# Create a UDP socket at client side
UDPClientSocket = socket.socket(family=socket... | StarcoderdataPython |
3287460 | <gh_stars>0
import unittest
from wizard_game import WizardPlayer
class TestWizardPlayer(unittest.TestCase):
def test1(self):
p1 = WizardPlayer()
table = []
hand = ['B3', 'Y9', 'R10', 'G2']
p1.receive_hand(hand)
self.assertTrue(len(p1.get_valid_indices(table)) == len(hand))... | StarcoderdataPython |
105400 | <reponame>h3kker/hinkskalle<gh_stars>1-10
"""remove tag image_id not null
Revision ID: 5961c96f6a2e
Revises: <PASSWORD>
Create Date: 2021-06-11 19:42:36.870527
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = ... | StarcoderdataPython |
3257169 | <reponame>bjorn/Paste-It<filename>api/urls.py<gh_stars>1-10
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^$', 'api.views.index'),
url(r'^v01/add/?', 'api.v01.views.add'),
url(r'^v02/add/?', 'api.v02.views.add'),
url(r'^v02/list/?', 'api.v02.views.list'),
)
| StarcoderdataPython |
3360540 | <filename>ch03tests/solutions/diffusionmodel/diffusion_model.py
""" Simplistic 1-dimensional diffusion model """
def energy(density, coefficient=1):
""" Energy associated with the diffusion model
:Parameters:
density: array of positive integers
Number of particles at each position i in the ... | StarcoderdataPython |
1672898 | import contextlib
import io
from dataclasses import dataclass, field
from io import StringIO
from typing import Dict, List, Optional, Union
import alembic
import alembic.config
from alembic.runtime.environment import EnvironmentContext
from alembic.script.base import ScriptDirectory
from sqlalchemy import MetaData, Ta... | StarcoderdataPython |
3341441 | import threading
import time
from datetime import datetime, timezone
import anyio
import pytest
from anyio import fail_after
from apscheduler.enums import JobOutcome
from apscheduler.events import (
Event, JobAdded, ScheduleAdded, ScheduleRemoved, SchedulerStarted, SchedulerStopped, TaskAdded)
from apscheduler.ex... | StarcoderdataPython |
1602889 | #! /usr/bin/env python3
import os
import sys
import math
from itertools import product
from mule_local.JobGeneration import *
from mule.JobParallelizationDimOptions import *
from mule.JobParallelization import *
p = JobGeneration()
verbose = False
#verbose = True
################################################... | StarcoderdataPython |
1650907 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# ~/python/03_petle_01.py
print "Alfabet w porządku naturalnym:"
for i in range(65, 91):
litera = chr(i)
tmp = litera + " => " + litera.lower()
print tmp,
print "\nAlfabet w porządku odwróconym:"
for i in range(122, 96, -1):
litera = chr(i)
print li... | StarcoderdataPython |
1746672 | """This module contains the general information for AdaptorRssProfile ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class AdaptorRssProfileConsts:
RECEIVE_SIDE_SCALING_DISABLED = "disabled"
RECEIVE_SIDE_SCALING_ENABLE... | StarcoderdataPython |
3254768 | # coding: utf-8
from nose.tools import eq_
import acmd
def test_default_values():
s = acmd.Server('foobar')
assert s.name == 'foobar'
assert s.host == 'http://localhost:4502'
assert s.username == 'admin'
assert s.password == '<PASSWORD>'
def test_constructor():
s = acmd.Server('foobar', hos... | StarcoderdataPython |
139126 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_asyncio_utils
----------------------------------
Tests for ``asyncio_utils`` module.
"""
import pytest
import collections
from asyncio_utils import *
pytestmark = pytest.mark.asyncio
async def test_aiter():
async def gen():
yield 1
... | StarcoderdataPython |
3222574 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
def test_extension():
from .test_ext import get_the_answer
assert get_the_answer() == 42
def test_eager_resources():
from .test_ext import read_the_answer
assert read_the_answer() == 42
| StarcoderdataPython |
1755078 | class Stack(object):
def __init__(self):
self.stack = []
self.mx = []
self.n = 0
def push(self, x):
self.stack.append(x)
mx = self.mx[-1] if self.n > 0 else float('-inf')
self.mx.append(max(mx, x))
self.n += 1
def pop(self):
if self.n == 0:
... | StarcoderdataPython |
195864 | <reponame>openprocurement/openprocurement.auctions.dgf
# -*- coding: utf-8 -*-
from openprocurement.auctions.core.utils import opresource
from openprocurement.auctions.core.endpoints import ENDPOINTS
from openprocurement.auctions.dgf.views.other.item import AuctionItemResource
@opresource(
name='dgfFinancialAsset... | StarcoderdataPython |
72021 | <filename>bin/scientificLaws.py
from functools import reduce
try:
import binutil # required to import from dreamcoder modules
except ModuleNotFoundError:
import bin.binutil # alt import if called as module
from bin.rational import RandomParameterization
from dreamcoder.domains.arithmetic.arithmeticPrimitive... | StarcoderdataPython |
4809538 | import unittest
from meraki_cli.__main__ import _translate_input
INPUT = [
{
'changeme': '100',
'leavemealone': '101'
},
{
'changeme': '200',
'leavemealone': '201'
},
]
OUTPUT = [
{
'changed': '100',
'leavemealone': '101'
},
{
'chang... | StarcoderdataPython |
3203147 | <reponame>tayyipcanbay/solidity-uzerine-denemeler
from brownie import FundMe, MockV3Aggregator, network, config
from scripts.helpful_scripts import (
deploy_mocks,
get_account,
deploy_mocks,
LOCAL_BLOCKCHAIN_ENVIROMENTS,
)
from web3 import Web3
def deploy_fund_me():
account = get_accoun... | StarcoderdataPython |
72870 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 02 16:32:18 2017
@author: <NAME> <EMAIL>
"""
import json
#import cPickle as pickle
import twit_token
import unicodedata as uniD
import os
import nltk
import re
from pymongo import MongoClient
#MongoDB credentials and collections
#DBname = 'test-tree'
#DBname = 'test_r... | StarcoderdataPython |
126714 | <gh_stars>0
def minion_game(string):
# your code goes here
Kevin = 0
Stuart = 0
word = list(string)
x = len(word)
vowels = ['A','E','I','O','U']
for inx, w in enumerate(word):
if w in vowels:
Kevin = Kevin + x
else:
Stuart = Stuart + x
x = x... | StarcoderdataPython |
21596 | <filename>todoapi/apps.py<gh_stars>10-100
from django.apps import AppConfig
class TodoapiConfig(AppConfig):
name = 'todoapi'
| StarcoderdataPython |
3272263 | import torch
# https://discuss.pytorch.org/t/covariance-and-gradient-support/16217
def cov(x, rowvar=False):
if x.dim() > 2:
raise ValueError('x has more than 2 dimensions')
if x.dim() < 2:
x = x.view(1, -1)
if not rowvar and x.size(0) != 1:
x = x.t()
x_ctr = x - torch.mean(x,... | StarcoderdataPython |
1603701 | #!/usr/bin/env python3
#
# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import argparse
import os
import subprocess
import sys
import logging
import tempfile
import yaml
def case_infra_error(case):
try:
if case["metadata"]["error_type"] == "Infrast... | StarcoderdataPython |
1604124 | import torch
from . import factories
def test_base_agent_initialize():
agent = factories.PSOAgentFactory.create()
swarm = factories.SwarmFactory.create()
data = torch.tensor([
[3.0, 3.0, 3.0],
[1.0, 1.0, 1.0],
[2.0, 2.0, 2.0],
])
agent.initialize(data=data, swarm=swarm)
... | StarcoderdataPython |
170845 | <filename>commerce/commerce/auctions/migrations/0010_remove_auction_seller.py
# Generated by Django 3.1.7 on 2021-03-30 13:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('auctions', '0009_auto_20210330_1826'),
]
operations = [
migrations.Rem... | StarcoderdataPython |
3259978 | <filename>oldathena_read.py
"""
Read Athena4 output data files.
"""
# Python modules
import numpy as np
#=======================================================================================
def vtk(filename):
"""Read .vtk files and return dict of arrays of data."""
# Python module
import struct
# Read r... | StarcoderdataPython |
1744416 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='frasco-bootstrap',
version='0.1.3',
url='http://github.com/frascoweb/frasco-bootstrap',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description="Bootstrap (frontend framework) integration for Frasco",
... | StarcoderdataPython |
1799027 | <filename>tests/test_boxes.py
from unittest import TestCase
from omnicanvas.graphics import ShapeGraphic, BoxGraphic
class BoxGraphicCreationTests(TestCase):
def test_can_create_box_graphic(self):
box = BoxGraphic(10, 20, 100, 200)
self.assertIsInstance(box, ShapeGraphic)
self.assertEqual(... | StarcoderdataPython |
1735078 | <filename>schimpy/cencoos_download.py<gh_stars>1-10
from netCDF4 import *
import pyproj
import ogr, osr
import numpy as np
import time
import datetime as dtm
def time_block_report(message,told):
""" This routine is for reporting incremental timing of parts of the script"""
tnew=time.time()
diff = tnew - ... | StarcoderdataPython |
62364 | # time_count.py
from webpie import WPApp, WPHandler
import time
class Handler(WPHandler):
def time(self, request, relpath):
return "[%d]: %s\n" % (self.App.bump_counter(), time.ctime()), "text/plain"
class App(WPApp):
def __init__(self, h... | StarcoderdataPython |
172394 | <reponame>kashifpk/PyCK
from pyck.forms import Form
import os
def test_pyck_lib_get_models_1():
pass
| StarcoderdataPython |
134410 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2019-08-03 15:25:12
# Project: news_qq
from pyspider.libs.base_handler import *
import re
import pymysql
import pymongo
# 文章正则
pattern_finance = re.compile('^(http|https)://finance.*')
pattern_artical = re.compile('^(http|https)://(.*?)-\d{8}.html(.*)')
pat... | StarcoderdataPython |
94623 | #!python3
from flask import Flask, render_template, request
from simpleeval import simple_eval
import logging
logging.basicConfig(level=logging.DEBUG)
# Declare the App
app = Flask(__name__)
@app.route('/') # Start the app route ('/')
def main():
print('-----------------started-----------------')
return re... | StarcoderdataPython |
3291721 | """Platform for sensor integration."""
from __future__ import annotations
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ID, POWER_WATT
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coor... | StarcoderdataPython |
3382269 | from __future__ import print_function
import sys
import argparse
import cv2
from event_camera_emulation.emulator import EventCameraEmulator
camera_device_ = None
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--video_device', '-v', type=str,
defau... | StarcoderdataPython |
37031 | <reponame>JFF-Bohdan/reqlog<filename>reqlog/__main__.py
import os
import sys
import bottle
base_module_dir = os.path.dirname(sys.modules[__name__].__file__)
try:
import reqlog # noqa: F401 # need to check import possibility
except ImportError:
path = base_module_dir
path = os.path.join(path, ... | StarcoderdataPython |
3941 | import os
import df2img
import disnake
import pandas as pd
from PIL import Image
import discordbot.config_discordbot as cfg
from discordbot.config_discordbot import logger
from discordbot.helpers import autocrop_image
from gamestonk_terminal.economy import wsj_model
async def currencies_command(ctx):
"""Currenc... | StarcoderdataPython |
3286815 | import traceback
import struct
def printsafe(data):
result = ""
for i in data:
if 0x20 <= i <= 0x7E:
result = result + chr(i)
else:
result = result + "."
return result
def hexdump(data):
info = ""
l = len(data)
for i in range(0, l, 0x10):
hexdump... | StarcoderdataPython |
161418 | <reponame>BirkbeckCTP/jisc-doab
import logging
from operator import itemgetter
import os
import zipfile
from doab import const
from ebooklib import epub
logger = logging.getLogger(__name__)
class FileManager():
def __init__(self, base_path):
if not base_path.startswith("/"):
base_path = os.... | StarcoderdataPython |
116644 | <reponame>RomuloSouza/corong
import pyxel
class Sprite:
def __init__(self, x, y, i, u, v, w, h):
self.pos_x = x
self.pos_y = y
self.img_idx = i
# start (u, v) of the image bank (img_idx)
self.start_x = u
self.start_y = v
self.width = w
self.height ... | StarcoderdataPython |
16911 |
import __init__
import os
#os.environ['LD_LIBRARY_PATH'] += ':/usr/local/cuda-11.1/bin64:/usr/local/cuda-11.2/bin64'
import numpy as np
import torch
import torch.multiprocessing as mp
import torch_geometric.datasets as GeoData
from torch_geometric.loader import DenseDataLoader
import torch_geometric.transforms as T... | StarcoderdataPython |
86794 | import argparse
import time
import numpy as np
import networkx as nx
import json
from sklearn.utils import check_random_state
import zmq
from . import agglo, agglo2, features, classify, evaluate as ev
# constants
# labels for machine learning libs
MERGE_LABEL = 0
SEPAR_LABEL = 1
class Solver:
"""ZMQ-based inter... | StarcoderdataPython |
4834562 | # Copyright 2019 Xilinx 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 writing, ... | StarcoderdataPython |
61114 | import numpy as np
import scipy
import cv2
def get_pixel_neighbors(height, width):
"""
Estimate the 4 neighbors of every pixel in an image
:param height: image height
:param width: image width
:return: pixel index - neighbor index lists
"""
pix_id = []
neighbor_id = []
for i in ra... | StarcoderdataPython |
3323285 | #!/usr/bin/python3
# pylint: disable=C0103
# pylint: disable=C0114
import json
import os
import sys
from github import Github
CHANGELOG_LABELS = ['changelog - added', 'changelog - changed', 'changelog - fixed']
ENDC = '\033[0m'
ERROR = '\033[31m'
INFO = '\033[34m'
NOTICE = '\033[33m'
if 'API_CREDENTIALS' not in os.... | StarcoderdataPython |
1793898 | # Protocol plotting zoom-ins set up
set_ylim = [-200, 2300]
set_xlim_ins = [[1850, 2200], [14350, 14600]]
set_ylim_ins = [[-4000, 0], [-2500, 500]]
inset_setup = [(1, 1.25, 'upper center'), (0.7, 1.25, 'upper right')]
mark_setup = [(2, 2), (2, 2)]
| StarcoderdataPython |
157271 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from numpy.testing import assert_allclose
try:
import matplotlib.pyplot as plt
HAS_PLT = True
except ImportError:
HAS_PLT = False
t... | StarcoderdataPython |
1640626 | <reponame>NCRAR/psiaudio
import pytest
from collections import Counter, deque
import numpy as np
from psiaudio.calibration import FlatCalibration
from psiaudio.pipeline import extract_epochs
from psiaudio.queue import FIFOSignalQueue, InterleavedFIFOSignalQueue
from psiaudio.stim import Cos2EnvelopeFactory, ToneFact... | StarcoderdataPython |
4806129 | # /*
# Copyright 2020 Hitachi Ltd.
# 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 |
1613286 | <reponame>bhaskernitt/chargebee-cli
from chargebeecli.client.actionsImpl import ActionsImpl
from chargebeecli.constants.constants import Formats
from chargebeecli.export.Exporter import Exporter
from chargebeecli.formater.response_formatter import ResponseFormatter
from chargebeecli.printer.printer import Printer
from ... | StarcoderdataPython |
3358583 | <reponame>5laps2go/xbrr<filename>xbrr/edinet/reader/aspects/finance.py
import warnings
import re
import collections
import importlib
if importlib.util.find_spec("pandas") is not None:
import pandas as pd
from xbrr.base.reader.base_parser import BaseParser
from xbrr.edinet.reader.element_value import ElementValue
... | StarcoderdataPython |
3210062 | <gh_stars>1-10
__version__="0.0.1"
dcolor="1"
def indeterminate():
print("\x1b]9;4;3\x1b\\",end="",flush=True)
def show(value:int,color:str=None):
global dcolor
if(color!=None):
color={"green":1,"g":1,"red":2,"r":2,"yellow":4,"y":4}[color]
dcolor=color
else:
color... | StarcoderdataPython |
1659934 | <reponame>DominikSauter/Skeletonization<gh_stars>1-10
import os
import shutil
from skimage import io
from skimage import img_as_ubyte
from skimage import filters
from skimage.util import invert
from matplotlib import pyplot as plt
from fuzzyTransform import fuzzyTransform
from skeleton2Graph import *
import skeletoniza... | StarcoderdataPython |
176108 | <gh_stars>0
from xicam.core.execution.workflow import Workflow
from xicam.core.execution.daskexecutor import DaskExecutor
from xicam.plugins import Input, Output, ProcessingPlugin
from pyFAI.detectors import Pilatus2M
import numpy as np
from pyFAI import AzimuthalIntegrator, units
from scipy.ndimage import morphology... | StarcoderdataPython |
3345656 | <reponame>Fenmaz/connect4
from keras.callbacks import Callback
import tensorflow as tf
class TensorBoardStepCallback(Callback):
"""Tensorboard basic visualizations by step.
"""
def __init__(self, log_dir, logging_per_steps=100, step=0):
super().__init__()
self.step = step
self.log... | StarcoderdataPython |
3375186 | <reponame>Starfunx/Robot_Simulation<filename>main.py
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
from Terrain import Terrain as Terrain
from DiffDriveRobot import Robot as Robot
from DiffDriveControl import Robot as RobotControl
from Lidar import Lidar
class PickConsign:
def __init__(self, ... | StarcoderdataPython |
103983 | """
This module contains the definitions for Bike and its subclasses Bicycle and
Motorbike.
"""
class Bike:
"""
Class defining a bike that can be ridden and have its gear changed.
Attributes:
seats: number of seats the bike has
gears: number of gears the bike has
"""
def __init__... | StarcoderdataPython |
94383 | """Example, how write generator agent for tesla car"""
from random import sample
from string import ascii_lowercase, digits
from magic_agent.core.base import BaseAgent, RuleItem, RuleDevice, RuleItemGenerator
# import constants Rules
from magic_agent.core.rules import MozillaDefault, AppleWebKit, LikeGecko, Safari, ch... | StarcoderdataPython |
1718522 | # coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | StarcoderdataPython |
4814958 | # -*- coding: utf-8 -*
import os
from os import listdir, makedirs
from os.path import join, basename, splitext, isfile, exists
import glob
import arcpy
import xlrd
# ArcPy工作路径,之后所有的路径都是这个路径的相对路径
WORKSPACE = r'D:\Document\ArcMapDemo\data00_416after'
# arcpy.env.workspace = WORKSPACE
# 行政区划目录
DISTRICT_FOLDER = 'China'
... | StarcoderdataPython |
1712156 | class iceage():
def show(self):
print("Welcome to the iceage",end=" ")
class mammoth(iceage):
def show(self):
super().show()
print("Hi this is manny")
obj = mammoth()
obj.show()
class genere():
def display(self):
print("There are many genre of books",end=" ")
class fiction... | StarcoderdataPython |
3331920 | <filename>output/models/nist_data/atomic/unsigned_int/schema_instance/nistschema_sv_iv_atomic_unsigned_int_max_inclusive_1_xsd/__init__.py
from output.models.nist_data.atomic.unsigned_int.schema_instance.nistschema_sv_iv_atomic_unsigned_int_max_inclusive_1_xsd.nistschema_sv_iv_atomic_unsigned_int_max_inclusive_1 import... | StarcoderdataPython |
1606821 | #!/usr/bin/env python
##
## Copyright 2009 <NAME> & <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 applic... | StarcoderdataPython |
3369668 | import pytest
from unittest.mock import MagicMock, patch
import base64
import os
import requests
import time
import gen3.auth
from gen3.auth import Gen3Auth
test_endpoint = "https://localhost"
test_key = {
"api_key": "whatever."
+ base64.urlsafe_b64encode(
('{"iss": "%s", "exp": %d }' % (test_endpoint... | StarcoderdataPython |
3392291 | <gh_stars>0
import datetime
import os
from emiproc.hourly_emissions import speciation as spec
model = 'cosmo-art'
path_emi = os.path.join('oae-art-example', '{online}', 'emis_2015_d1.nc')
output_path = os.path.join('oae-art-example', '{online}', 'hourly')
output_name = "d1_"
prof_path = os.path.join('oae-art-examp... | StarcoderdataPython |
1722769 | <gh_stars>0
from flask import Blueprint
from ..models import Permission
main = Blueprint('main', __name__)
from . import views, errors
#lastest edit on page 101, add some value that available to global, these value should stay in DIC.
@main.app_context_processor
def inject_permissions():
return dict(Permission=... | StarcoderdataPython |
3261190 | from distutils.core import setup
import os
from setuptools import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='Lundy',
version='0.1dev',
packages=['lundy',],
license='Creative Commons Attribution-Noncommercial-Share Alike license',
long_description="... | StarcoderdataPython |
59051 | <reponame>RohanDukare/OnlineVoting
from django import template
import calendar
register = template.Library()
@register.filter
def index(List, i):
return List[int(i)]
def monthName(List,i):
return List[int(i)]
| StarcoderdataPython |
71439 | <gh_stars>1-10
from bbox import *
from detector import ComputerVisionDetector | StarcoderdataPython |
3227755 | __project__ = 'MeCabOnigiri'
__version__ = '0.0.0'
VERSION = "{0} v{1}".format(__project__, __version__)
| StarcoderdataPython |
144543 | #!/usr/bin/env python
#
# Cloudlet Infrastructure for Mobile Computing
#
# Author: <NAME> <<EMAIL>>
#
# Copyright (C) 2011-2013 Carnegie Mellon University
# 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 co... | StarcoderdataPython |
3296268 | <filename>ArticleSpider/ArticleSpider/items.py
# -*- coding: utf-8 -*-
import re
import scrapy
from datetime import datetime
from scrapy.loader import ItemLoader
from scrapy.loader.processors import MapCompose, TakeFirst, Join
def datetime_type(value):
try:
time_create = datetime.strptime(value, "%Y/%m/%... | StarcoderdataPython |
4824870 | def f1():
return f2
def f2():
return f3
def f3():
return 42
assert f1()()() == 42
| StarcoderdataPython |
1602413 | """
"""
import json
import requests
import os
def calc_precip(minutely):
"""
Calculate the percentage of precipitation over the next 15 minutes
"""
return max(datum["precipProbability"] for datum in minutely["data"])
def get_weather():
"""
Get the weather for Amida using DarkSky
:return:... | StarcoderdataPython |
3328156 | <reponame>BoogalooLi/python_spiders<filename>Xpath/Xpath_basics.py
from lxml import etree
text = '''
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>
学习猿地 - IT培训|Java培训|Python培训|ui设计培训|web前端培训|GO培训|PHP培训|成就自己的只需一套精品
</title>
</head>
<body>
<ul>
<li><a href="/a/b... | StarcoderdataPython |
3399091 | from flask import render_template
from flask import request
from app.settings import config
from .blueprint import blueprint
from .models import MainCategoryProduct, Product, CategoryProduct
from .logger import logger
# TODO: Возможно имеет смысл вынести хелперы в отдельный файл
def get_categorys():
main_categor... | StarcoderdataPython |
1002 | <reponame>davidtahim/Glyphs-Scripts<filename>Components/Align All Components.py
#MenuTitle: Align All Components
# -*- coding: utf-8 -*-
__doc__="""
Fakes auto-alignment in glyphs that cannot be auto-aligned.
"""
import GlyphsApp
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # a... | StarcoderdataPython |
3232268 | <filename>gopigo_interface.py
import sys
import time
import gopigo
import robot_util
def handleCommand(command, keyPosition):
# only uses pressing down of keys
if keyPosition != "down":
return
print("handle command", command, keyPosition)
if command == 'L':
gopigo.left_rot()
... | StarcoderdataPython |
3208308 | <gh_stars>0
def tabulate_course_details(driver):
'''
driver: Webdriver element
returns: Course and Semester details in a tabular format
'''
courses = driver.find_element_by_xpath("/html/body/center/center/table[1]/tbody").text
course_list = courses.split('\n')
#print(course_list)
cour... | StarcoderdataPython |
1749438 | <gh_stars>0
# -*- coding: utf-8 -*-
class TemplateNotExistsException(Exception):
pass
class QiniuTokenInvalidException(Exception):
pass | StarcoderdataPython |
1668300 | from .library import Library
__all__ = [Library]
| StarcoderdataPython |
3354237 | import unittest
from unittest import mock
from .txn import Transaction
from .metricstore import Metricstore
from pythonapm.agent import Agent
class Resp:
def __init__(self,status_code):
self.status_code = status_code
class Err:
pass
class TxnTest(unittest.TestCase):
def setUp(self):
self.... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.