id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1686934 | """[HTTP AGENT SERVER]
"""
# Copyright 2019 BlueCat Networks (USA) Inc. and its affiliates
#
# 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
#
# ... | StarcoderdataPython |
1798212 | <gh_stars>0
#!/usr/bin/python
# -*- coding:utf-8 -*-
# author:joel 18-6-5
import re
from random import choice
import requests
class Wiwj(object):
def __init__(self):
"""
75163套 按每页30个 共有2506页
"""
self.start_url = 'https://sh.5i5j.com/ershoufang/'
# self.prox... | StarcoderdataPython |
3321158 | <reponame>Worteks/OrangeAssassin
"""Tests for pad.plugins.image_info."""
import unittest
from tests.util.image_utils import new_email, new_image, new_image_string
try:
from unittest.mock import patch, Mock, MagicMock, call
except ImportError:
from mock import patch, Mock, MagicMock, call
import oa.plugins
fro... | StarcoderdataPython |
1681477 | <filename>ppci/arch/xtensa/arch.py
""" Xtensa architecture """
from ... import ir
from ...binutils.assembler import BaseAssembler
from ..arch import Architecture
from ..arch_info import ArchInfo, TypeInfo
from ..generic_instructions import Label, Alignment, RegisterUseDef
from ..data_instructions import Db, Dd, Dcd2, ... | StarcoderdataPython |
4841973 | #-*- coding:utf-8 _*-
"""
@author:charlesXu
@file: util.py
@desc: 百度地图调用工具类
@time: 2018/08/08
"""
import csv
import time
import urllib.request
from concurrent.futures import ThreadPoolExecutor
class Utils:
@staticmethod
def http_url(url):
req = urllib.request.urlopen(url)
res = req.read()
... | StarcoderdataPython |
1710423 | <filename>addressgen.py
#!/usr/bin/python
import sys
from lib.brainwallet import private_key, public_key
from lib.secp256k1 import secp256k1
if __name__ == "__main__":
phrase = str(sys.argv[1])
print "pass phrase: " + phrase
print "private key: " + private_key(phrase)
print "BTC address: " + ... | StarcoderdataPython |
3366514 | """
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Aug 3, 2017
@author: jrm
"""
from atom.api import Typed, set_default
from enamlnative.widgets.flexbox import ProxyFlexbox
from .uikit_view import UIVi... | StarcoderdataPython |
3315542 | import numpy as np
import torch
from torch.utils.data import DataLoader,Dataset
from matplotlib import pyplot as plt
import os
import pandas as pd
import re
import get_data
class MovieScoringDataSets(Dataset):
def __init__(self, ):
def __len__(self):
def __getitem__(self):
| StarcoderdataPython |
3362903 | import os
import json
import time
import math
import pandas as pd
import matplotlib.pyplot as plt
from src.data_processor import DataLoader
# from src.model import Model
from sklearn.metrics import roc_curve, roc_auc_score
from sklearn.preprocessing import StandardScaler
import matplotlib as mpl
import numpy as np
imp... | StarcoderdataPython |
4836441 | <filename>release/stubs.min/Autodesk/Revit/DB/__init___parts/FamilySizeTableManager.py
class FamilySizeTableManager(object, IDisposable):
""" Manages importing,exporting,and querying size data through the FamilySizeTable class. """
@staticmethod
def CreateFamilySizeTableManager(document, familyId):
... | StarcoderdataPython |
106871 | <gh_stars>1-10
"""Test the interaction with the microphone."""
# Copyright (c) 2022, ABB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with
# or without modification, are permitted provided that
# the following conditions are met:
#
# * Redistributions of source code must retain the
#... | StarcoderdataPython |
3343498 | <gh_stars>0
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | StarcoderdataPython |
170377 | class Translation(object):
START_TEXT = """Hello Stranger,
Welcome To Valhalla.
"""
######################
HELP_USER = """**TF Does This Bot Do?**
**⁘ ¯\_(ツ)_/¯ Nothing. Ha Ha Ha**
**⁘ No,Seriously Tho (•_•)**
"""
DOWNLOAD_MSG = " **Downloading....**"
DOWNLOAD_FAIL_MSG = "**Failed T... | StarcoderdataPython |
81651 | # -*- coding: utf-8 -*-
# Based on https://gist.github.com/voldmar/1264102
# and https://gist.github.com/runekaagaard/2eecf0a8367959dc634b7866694daf2c
import gc
import inspect
import weakref
from collections import defaultdict
from django.apps import apps
from django.core.management.base import BaseCommand
from djang... | StarcoderdataPython |
20671 | <reponame>jonclothcat/OpenPype<filename>openpype/hosts/blender/plugins/publish/extract_blend_animation.py
import os
import bpy
import openpype.api
class ExtractBlendAnimation(openpype.api.Extractor):
"""Extract a blend file."""
label = "Extract Blend"
hosts = ["blender"]
families = ["animation"]
... | StarcoderdataPython |
3216634 | from __future__ import absolute_import
import os
import sys
import errno
import shutil
import json
import os.path as osp
from PIL import Image
import matplotlib.pyplot as plt
# import cv2
import numpy as np
from numpy import array,argmin
import torch
def mkdir_if_missing(directory):
if not osp.exists(directory):
... | StarcoderdataPython |
1613525 | <filename>Section 3/hash.py<gh_stars>10-100
#!/usr/bin/python3
import os
import argparse
from termcolor import cprint
import hashlib
class HashFile:
def __init__(self):
self.path = None
@staticmethod
def get_args():
parser = argparse.ArgumentParser(description="Scan all magic files")
... | StarcoderdataPython |
3285133 | <reponame>NatashaSenah/awards
"""Views for the ``django-user-media`` app."""
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType
from django.db.models import ObjectDoesNotExist
from django.http import Http404, HttpResponse... | StarcoderdataPython |
111526 | <gh_stars>0
__author__ = 'wanderknight'
__time__ = '2019/8/9 20:31'
from django.conf.urls import url
from ..views.oj import ClassgroupAPI
urlpatterns = [
url(r"^classgroups/?$", ClassgroupAPI.as_view(), name="classgroup_api"),
]
| StarcoderdataPython |
3241407 | <reponame>juztin/pytezos-1
from unittest import TestCase
from tests import get_data
from pytezos.michelson.micheline import michelson_to_micheline
from pytezos.michelson.formatter import micheline_to_michelson
class MichelsonCodingTestKT1G2D(TestCase):
def setUp(self):
self.maxDiff = None
def t... | StarcoderdataPython |
40250 | <filename>isic_grabber/src/web_helper.py
import requests
import os
from tqdm import tqdm
import sys
def get_json(url):
"""
Gets a json response from the given url.
:param url: URL.
:return: the received Json data.
"""
resp = requests.get(url=url)
return resp.json()
def get_file(url, out... | StarcoderdataPython |
3320223 | import tempfile
import platform
import subprocess
from sys import version_info
from pathlib import Path
from pkgutil import iter_modules
from skbuild import setup
# To be replaced by: from setuptools_scm import get_version
def get_version():
return "2.3.0"
def _zivid_sdk_version():
return "2.5.0"
def _zivi... | StarcoderdataPython |
1708105 | """
This module contains some test cases you can try for the
broken code in debug_examples.py
Can you think of additional edge cases and test cases to add?
Note that some of these tests are going to fail until you
fix the logic in the functions. That's the unit tests
hard at work!
"""
# 2. basic logic - missed a... | StarcoderdataPython |
3207664 | # members.migrations
# The migrations for model changes to the Members app.
#
# Author: <NAME> <<EMAIL>>
# Created: Sat Aug 22 09:22:08 2015 -0500
#
# Copyright (C) 2015 District Data Labs
# For license information, see LICENSE.txt
#
# ID: __init__.py [] <EMAIL> $
"""
The migrations for model changes to the Members... | StarcoderdataPython |
1606044 | """A pooled converter that behaves in very similar ways to convert_sub_dirs.py. Lower logging and stat print outs than
convert_sub_dirs.py. Useful for batch converting lower resolution video files that can't fully use all cores. """
import os
import sys
import time
from os import path
from .. import makeMedia... | StarcoderdataPython |
4815125 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from nerium.commit import get_commit_for_version
from nerium.__version__ import __version__ # noqa F401
commit = get_commit_for_version(__version__)
| StarcoderdataPython |
3372093 | <gh_stars>1-10
import xmlrpclib, multiprocessing
def _doacross_action(module_name, module_source, node_uri, file_uris, \
results, fixed_args=()):
"""Intended to be invoked inside a single thread with 'results' as
multiprocessing.Queue() instance."""
proxy = xmlrpclib.ServerProxy(node_uri)
for ... | StarcoderdataPython |
3257624 | print(list(map((lambda x,y: x * y), [1, 2, 3, 4, 5], [1, 2, 3, 4, 5])))
| StarcoderdataPython |
17859 | <gh_stars>0
import torch
from torch import nn
import torch.nn.functional as F
import math
from functools import partial
class MLP(torch.nn.Module):
def __init__(self, input_dim, layer_widths, activate_final = False, activation_fn=F.relu):
super(MLP, self).__init__()
layers = []
prev_width ... | StarcoderdataPython |
4826084 | <reponame>Ayplow/bot
import datetime
import logging
import re
import textwrap
from signal import Signals
from typing import Optional, Tuple
from discord.ext.commands import Bot, Cog, Context, command, guild_only
from bot.constants import Channels, Roles, URLs
from bot.decorators import in_channel
from bot.utils.messa... | StarcoderdataPython |
3264387 | <reponame>terror/golf<gh_stars>0
# https://open.kattis.com/problems/tolower
(lambda P, T, check = lambda x: sum(list(map(lambda x: x.islower() or (x[0].isupper() and x[1:].islower()), x))) == len(x): print(sum(list(map(check, [[input() for _ in range(T)] for _ in range(P)])))))(*map(int, input().split()))
| StarcoderdataPython |
1735287 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import numpy as np
from pyorbital import tlefile, orbital
from pyorbital.tlefile import Tle
#def read_all_tles_from_file(platform, tles_file):
# platform = platform.strip().upper()
# tles = []
# fp = open(tles_file)
# for l0 in fp:
# l1, l2 = fp.next(),... | StarcoderdataPython |
136332 | <filename>Tests/modules/misc/test_system_namespaces.py
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
'''
Ensures we can import from .NET 2.0 namespaces and ty... | StarcoderdataPython |
78511 | import bsdiff4
import yaml
import os
import lzma
import hashlib
import threading
import concurrent.futures
import zipfile
import sys
from typing import Tuple, Optional
import Utils
from Rom import JAP10HASH, read_rom
def get_base_rom_path(file_name: str = "") -> str:
options = Utils.get_options()
if not file... | StarcoderdataPython |
4814873 | <gh_stars>0
'''
This module implements a class "Worker" that is used to encapsulate the
process of realising individual tasks. The target function receives two
parameters: 'tasks' and 'workerID'.
<NAME> 2018.
'''
from logger import *
import numpy
import multiprocessing as mp
class Worker:
def ... | StarcoderdataPython |
4802151 | <reponame>rabeehrz/DropTune
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('player', views.player, name='player'),
path('dj', views.dj, name='dj'),
path('loading', views.loading, name='loading'),
] | StarcoderdataPython |
79779 | <filename>problems/algoexpert/list/shift_linked_list.py<gh_stars>0
from typing import Optional
class ListNode:
def __init__(self, value: int, _next=None):
self.value: int = value
self.next: Optional[ListNode] = _next
def shift_linked_list(
head: Optional[ListNode],
k: int) -> Opt... | StarcoderdataPython |
156912 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import numpy as np
import timeit
from collections import defaultdict, Counter
from typing import List, Set
from maro.data_lib import BinaryReader
from maro.simulator.scenarios.vm_scheduling import PostponeAction, AllocateAction
from maro.simulat... | StarcoderdataPython |
149792 | """
Common maths functions and datatypes for solving Advent of Code problems
"""
import functools
import operator
def saturate(value):
"""
Saturates a value, so it is only ever between 0 and 1
:param float value: the value to saturate
:return float: the value, but clamped between 0 and 1
"""
... | StarcoderdataPython |
1748681 | # Expression -> Op Expression Expression
# Expression -> [0,9]
import random
class Expression:
def __init__(self, value, left=None, right=None):
self.left = left
self.right = right
if left is None and right is None:
self.value = value
elif left is not None and rig... | StarcoderdataPython |
124139 | <filename>models/tuple_extractor.py
import pandas as pd
import os
import math
class Tuple_Extractor:
'''
Script responsável pela extração de tuplas de conhecimento a partir do DptOIE;
O DptOIE foi desenvolvido por <NAME> (2020);
Como o projeto de Sena e Claro foi desenvolvido na linguage... | StarcoderdataPython |
4821661 | # -*- coding:utf-8 -*-
from django.core.paginator import Paginator
class ServersClassify(object):
def __init__(self):
self.phy = {'phy_num': 0, 'kvm': 0, 'docker': 0, 'esxi': 0, 'other': 0}
self.vir = {'vir_num': 0, 'kvm': 0, 'docker': 0, 'vmware': 0}
def phy_classify(self, phy_servers):
... | StarcoderdataPython |
3241050 | <gh_stars>1-10
# Functions for adding argparse arguments to different scripts
# (Several arguments are shared among the scripts.)
import argparse
from hyperparams import CLASSIFIER_CONFIGS, ADVERSARY_CONFIGS
def add_emnist_datasets(parser):
"""
Adds the required parser arguments representing the training and ... | StarcoderdataPython |
3221770 | <reponame>JoaoGF21/apache-spark-programming-with-databricks
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" sty... | StarcoderdataPython |
197888 | import os
from flask import Blueprint
from flask import request
from http import HTTPStatus
import json
from api.operations import health_check
from config import BASE_DIR
from config import logger
# Define blueprint
_api = Blueprint('_api', __name__)
# Health check
@_api.route('/{{ cookiecutter.service_name }}/hea... | StarcoderdataPython |
3357176 | <filename>trajopt/utilities/robotOperations.py
import trajopt.utilities.adInterface as AD
import numpy as N
import math
sin = AD.MATH.sin
cos = AD.MATH.cos
#####
# straightforward way to deal with the linear algebra
# not necessarily efficient
def rotMatrix(axis, s, c):
if axis == "Z" or axis == "z":
ret... | StarcoderdataPython |
179025 | message = """
List datatypes store data in order and sequence.
Just as Lists, There is a smaller and faster alternative: Tuples
There are two ways to make a Tuple.
tup1 = (1,) # Adding a trailing comma is necessesary if the tuple contains a single element.
... | StarcoderdataPython |
170639 | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... | StarcoderdataPython |
1737369 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2021, <NAME> <EMAIL>
# pylint: disable=too-many-lines
"""
Test the project functionality
"""
i... | StarcoderdataPython |
1753224 | <gh_stars>0
# -*- coding: utf-8 -*-
"""This file contains the MacOS securityd log plaintext parser.
Also see:
http://opensource.apple.com/source/Security/Security-55471/sec/securityd/
"""
from __future__ import unicode_literals
import pyparsing
from dfdatetime import time_elements as dfdatetime_time_elements
fro... | StarcoderdataPython |
3262724 | <filename>solutions/python3/513.py
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findBottomLeftValue(self, root: TreeNode) -> int:
bfs = [root]
while bfs:
... | StarcoderdataPython |
3383532 | #! /usr/bin/env python3
import pickle
import argparse
from itertools import chain
from collections import Counter
import h5py
import nltk
import torch
from tqdm import tqdm
from torchtext.legacy.vocab import Vocab
from pytorch_lightning import seed_everything
def main():
ap = argparse.ArgumentParser(formatter_... | StarcoderdataPython |
1681917 | from BaseComponents.Buttons import Button
from SettingComponents.Layouts.ScrollArea import ScrollArea
def get_arearect(settings):
area_width = settings.default_width
area_height = settings.default_height
middle_x = settings.default_x + settings.default_width/2
middle_y = settings.default_y + settings.default_hei... | StarcoderdataPython |
1622911 | <filename>loaders/data_loader.py<gh_stars>10-100
# Copyright 2020 Petuum, 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/LIC... | StarcoderdataPython |
4800469 | try:
from socketio import AsyncClient
from socketio.exceptions import ConnectionError
except (ImportError, ModuleNotFoundError):
raise ImportError(
"To use telemetry you must install the `telemetry` option. (run `pip install -U dogehouse[telemetry]`)")
from json import dumps
socket = AsyncClient()... | StarcoderdataPython |
1764425 |
from tools.linear_algebra.linear_system.main import LinearSystem
from objects.CSCG._2d.master import MeshGenerator, SpaceInvoker, FormCaller, ExactSolutionSelector
from tools.linear_algebra.elementwise_cache.objects.column_vector.main import EWC_ColumnVector
from tools.linear_algebra.elementwise_cache.operators.bmat.... | StarcoderdataPython |
1674671 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astropy is a package intended to contain core functionality and some
common tools needed for performing astronomy and astrophysics research with
Python. It also provides an index for other astronomy packages and tools for
managing them.
"""
import sy... | StarcoderdataPython |
133370 | """This file provides MovesMouse"""
# pylint: disable=invalid-name
# pylint: disable=protected-access
from random import randint
from xcffib.xproto import Atom
from wotw_x11_comparison.common import UsesXcbWindowProperties
class MovesMouse(UsesXcbWindowProperties):
"""This class uses XCB bindings to move the mo... | StarcoderdataPython |
86306 | <reponame>jonathanfrawley/PyAutoGalaxy_copy
import autofit as af
from autogalaxy.pipeline.phase.abstract import analysis as abstract_analysis
from autogalaxy.galaxy import galaxy as g
from autogalaxy.plane import plane as pl
import numpy as np
import pickle
import dill
def last_result_with_use_as_hyper_dat... | StarcoderdataPython |
161582 | #!/usr/bin/env python
# coding=utf-8
import os,datetime,time
import asyncio
from concurrent.futures import ThreadPoolExecutor, as_completed
import aiohttp
from urllib import error
from urllib.request import ProxyHandler, build_opener
from .config import VALIDATOR_BASE_URL, VALIDATOR_BATCH_COUNT, REQUEST_TIMEOUT, TE... | StarcoderdataPython |
174620 | <gh_stars>0
from django.contrib import admin
from User.models import *
# Register your models here.
admin.site.register(Separator)
admin.site.register(StringCharacter)
admin.site.register(SchemaColumn)
admin.site.register(Schema)
admin.site.register(InputType)
admin.site.register(Generated_csv) | StarcoderdataPython |
1618780 |
import os
import sys
def printInline(msg):
print(msg, end=" ", flush=True)
def list_toString(listToDisplay):
listToDisplay = list(listToDisplay) # In case listToDisplay is e.g. a set
msg = ""
for atom in listToDisplay:
msg += f"\"{atom}\""
isLastAtom = (atom == listToDisplay[-1])
... | StarcoderdataPython |
3265729 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Futu, 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 requi... | StarcoderdataPython |
1698918 | <gh_stars>0
"""Setup script for Pympler.
To build, install and test Pympler and to try Pympler
before building and installing it.
The HTML documentation is in the doc/ directory. Point
your browser to the ./doc/html/index.html file.
"""
import sys
import pympler.metadata as metadata
def _not_supported(why):
p... | StarcoderdataPython |
194658 | from collections import namedtuple
import torch
import pyro
import pyro.distributions as dist
from pyro.distributions.util import scalar_like
from pyro.infer.mcmc.hmc import HMC
from pyro.ops.integrator import velocity_verlet
from pyro.util import optional, torch_isnan
def _logaddexp(x, y):
minval, maxval = (x,... | StarcoderdataPython |
28980 | import typing
import re
from .CD_relations import cardinal_relation, inverse_directions
from .regions import Region, region_union
from .expression_walker import PatternWalker
from .expressions import Constant
REFINE_OVERLAPPING = True
class RegionSolver(PatternWalker[Region]):
type_name = 'Region'
def __n... | StarcoderdataPython |
49997 | # Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... | StarcoderdataPython |
3378741 | from flask import Blueprint
project = Blueprint('project', __name__, url_prefix='/project')
from . import views
| StarcoderdataPython |
193184 | # import pyserial and adafruit-io
import serial, time, os
from Adafruit_IO import Client
# read the env
pySerial = os.getenv('PY_SERIAL', '')
pyClient = os.getenv('PY_CLIENT', '')
pyKey = os.getenv('PY_KEY', '')
print("SERIAL-PORT: " + pySerial)
print("ADAFRUIT-CLIENT: " + pyClient)
print("ADAFRUIT-KEY: " + pyKey)
... | StarcoderdataPython |
4817670 | '''
This module provides all the methods needed to build a deep neural network using the Keras deep learning library.
Keras was build by <NAME> (fchollet) and is essentially an abstraction library that is universal in the sense
that it can run on top of both theano and tensorflow which makes it especially powerful and ... | StarcoderdataPython |
83836 | # -*- coding: utf-8 -*-
# Created on Thu Dec 5 16:49:20 2019
# @author: arthurd
"""
FoRoute Module.
Visualize Map Matching routes on HTML maps.
"""
from matplotlib import collections as mc
import matplotlib.pyplot as plt
import osmnx as ox
import webbrowser
import folium
import numpy as np
import noiseplanet.matc... | StarcoderdataPython |
1705407 | <reponame>Chenfeng1271/Adaptive-deformable-convolution
from torchvision.models import resnet50
from thop import profile
import torch
from modeling.sync_batchnorm.replicate import patch_replication_callback
from modeling.deeplab import *
from modeling.DenseDSPP import build_dspp
from modeling.decoder_gau import build_... | StarcoderdataPython |
3328627 | from omrdatasettools.image_generators.MeasureVisualizer import MeasureVisualizer
visualizer = MeasureVisualizer(False, False, True)
visualizer.draw_bounding_boxes_for_all_images_in_directory(r"E:\Stave Detection\deep_scores_temp",
r"E:\Stave Detection\deep_scores_temp\annotati... | StarcoderdataPython |
3378502 | from flask import Blueprint, request
from flask.json import jsonify
from models import *
query_handler = Blueprint('Query Handler', __name__)
@query_handler.route('/books/q', methods=['GET'])
def get_books():
query = Book.query
if 'title' in request.args:
query = query.filter(Book.title.ilike("%" + request.args['... | StarcoderdataPython |
3211623 | <reponame>Jerrynicki/jrery-bot
import discord
import discord.ext.commands as commands
import random
import sys
import os
import requests
import asyncio
import logging
import threading
sys.path.insert(0, "../")
import util
class Streets(commands.Cog):
def __init__(self, bot, timeouts, generic_responses):
... | StarcoderdataPython |
3281943 | from django.test import TestCase
from django.core.urlresolvers import reverse
import Cookie
'''
All tests can be run by executing from terminal:
python manage.py test questionnaire
'''
# patient id's for testing in MiHIN server 4/2016
PATIENT_ID_CLARK = '11034584' #age 5
PATIENT_ID_DIANA = '18791962' #age 8
PATIENT_... | StarcoderdataPython |
1904 | class TurkishText():
"""Class for handling lowercase/uppercase conversions of Turkish characters..
Attributes:
text -- Turkish text to be handled
"""
text = ""
l = ['ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç']
u = ['I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç']
def __init__(self, text):
self.te... | StarcoderdataPython |
1676078 | # coding: utf-8
# Copyright 2018 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 a... | StarcoderdataPython |
1739963 | <gh_stars>1-10
from webob.exc import HTTPClientError
class HTTPClose(HTTPClientError):
"""Indicate to the front-end load balancer (FELB) that it should hang up on the client."""
code = 499
title = "Client Closed Request"
explanation = "The server did not accept your request."
| StarcoderdataPython |
1685442 | <reponame>keys4words/oop<gh_stars>0
import sqlite3
def upper_word(raw):
return raw.upper()
conn = sqlite3.connect(':memory:')
conn.create_function('upper', 1, upper_word)
cur = conn.cursor()
cur.execute('CREATE TABLE users (first_name char(20))')
cur.execute('INSERT INTO users(first_name) VALUES ("Ivan"), ("Pet... | StarcoderdataPython |
3247803 | import argparse
import sys
from pathlib import Path
from briefcase import __version__
from briefcase.commands import DevCommand, NewCommand, UpgradeCommand
from briefcase.platforms import get_output_formats, get_platforms
from .exceptions import (
InvalidFormatError,
NoCommandError,
ShowOutputFormats,
... | StarcoderdataPython |
4825324 | # Copyright (c) MONAI Consortium
# 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, so... | StarcoderdataPython |
3380690 | <reponame>moliushang/wireframe_
from utils.libs import *
import itertools
import json
import os
import random
import sys
from os.path import isdir, isfile, join, basename, expanduser
from os import listdir
import time
from math import cos, pi, sin, tan
import plotly.plotly as py # for sending things to ... | StarcoderdataPython |
1756471 | # -*- coding: utf-8 -*-
import os
import h5py
import numpy as np
from PIL import Image
def make_positive_index_market1501(train_or_test = 'train',user_name = 'ubuntu'):
f = h5py.File('market1501_positive_index.h5')
path_list = get_image_path_list(train_or_test = train_or_test, system_user_name = user_n... | StarcoderdataPython |
53698 | <filename>tests/test_sagemaker/test_sagemaker_models.py
import boto3
from botocore.exceptions import ClientError
import pytest
from moto import mock_sagemaker
import sure # noqa # pylint: disable=unused-import
from moto.sagemaker.models import VpcConfig
TEST_REGION_NAME = "us-east-1"
TEST_ARN = "arn:aws:sagemaker:e... | StarcoderdataPython |
87482 | <filename>StockAnalytics-master/StockAnalytics-master/SP500Prediction/ETLPipelines/IngestSP500ShareOutstanding_forerrors.py
import pandas as pd
import psycopg2
from InsertData import *
# Obtain data
rawdata = pd.read_csv('ShareOutstanding_ForErrors.csv', engine='python')
# Connect to database
conn = psycopg2.connect... | StarcoderdataPython |
3247287 | import os
import sys
def mad_libs():
os.system('cls' if os.name=='nt' else 'clear')
print('┌───────────────────────────────────┐')
print('│ 1. Mad Libs game! │')
print('└───────────────────────────────────┘')
print()
print('Complete these data to build your own story')
name = input("→ Protagonis... | StarcoderdataPython |
44563 | <reponame>mattkantor/basic-flask-app<filename>app/routes.py
from app.api.feed import FeedController
from app.api.follows import FollowController
from .api import apiv1, app_routes
from .api.news import *
from .api.user import *
from .api.group import *
from .api.auth import get_auth_token, register
class Route():
... | StarcoderdataPython |
3254637 | <reponame>i2mint/flaskstream2py<filename>flaskstream2py/flask_request_reader.py
"""
FlaskRequest Source
"""
from stream2py import SourceReader
class FlaskRequestReader(SourceReader):
"""A source reader that reads from an incoming HTTP request using Flask.
Must be instantiated from a Flask request handler fun... | StarcoderdataPython |
3207906 | #!/usr/bin/env python
"""
Various helpers with configuring BGP related Policies
"""
from enum import Enum
from collections import Iterable
from ipaddress import IPv4Network
from ipaddress import IPv6Network
from past.builtins import basestring
from tekton.utils import is_empty
from tekton.utils import is_symbolic
fro... | StarcoderdataPython |
3299539 | from django.http import JsonResponse
from rest_framework.views import APIView
import json
from common.utils import create_json_response, userSerialize, decode_body
from users.models import Role
from users.service import UserService
def index(request):
role1 = Role(role_name="O")
role2 = Role(role_name="C")
... | StarcoderdataPython |
1680867 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import tarfile
import pandas as pd
from libs.mppandas import mp_apply
# =============================================================================
# CLASSES
# =============================================================================
class Filter2Bands... | StarcoderdataPython |
145247 | """
When determining demands - depending on project specifics, the maturity of the
project, etc - it is often useful to have simple demand calculations.
In general, more sophisticated models are required.
::
from structuralglass import Q_
import structuralglass.layers as lay
import structuralglass.equiv_t... | StarcoderdataPython |
3289846 | <filename>tests/finance/test_slippage.py
#
# Copyright 2013 Quantopian, 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 requ... | StarcoderdataPython |
3370601 | from pyspark import SparkContext
from pyspark.streaming import StreamingContext
import time
def slit_by_space(line):
return line.split(" ")
# Creando el contexto, AppName y master establecidos en spark submit
sc = SparkContext(appName=f'word-count-{round(time.time() * 1000)}')
ssc = StreamingContext(sc, 1)
# Ch... | StarcoderdataPython |
1731934 | from google.cloud.firestore_v1.base_query import BaseQuery
from google.cloud.firestore_bundle.types import BundledQuery
def limit_type_of_query(query: BaseQuery) -> int:
"""BundledQuery.LimitType equivalent of this query.
"""
return (
BundledQuery.LimitType.LAST
if query._limit_to_last
... | StarcoderdataPython |
1787799 | <reponame>salazarpardo/redinnovacion
# django_cron
from django_cron import CronJobBase, Schedule
# django
from django.utils import timezone
# models
from notifications.models import Notification
from events.models import Event
class NotifyIncomingEventCronJob(CronJobBase):
RUN_AT_TIMES = ['11:30', ]
schedu... | StarcoderdataPython |
3208140 | <gh_stars>1-10
# Generated by Django 2.2.4 on 2019-08-21 14:10
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('chat_room', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name=... | StarcoderdataPython |
1784430 | from UniqueConfiguration import UniqueConfiguration
from command_args import get_args, get_optional_arg, get_mandatory_arg, get_mandatory_arg_no_print, is_true, get_mandatory_arg_validated, get_optional_arg_validated
class AwsUniqueConfiguration(UniqueConfiguration):
def __init__(self, args, suffix):
super... | StarcoderdataPython |
3395116 | # simple one-to-one RNN experiment that takes in a word and learns to predict the next word but
# without a continuing state
# quick tutorial: https://pytorch.org/tutorials/beginner/nlp/sequence_models_tutorial.html
# difference between LSTM and LSTMCell: https://stackoverflow.com/questions/57048120/pytorch-lstm-vs-lst... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.