id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3311087 | <reponame>sibange/padertorch<gh_stars>10-100
"""
Example call:
python -m padertorch.contrib.examples.sound_recognition.audio_tagging.evaluate with exp_dir=/path/to/exp_dir
"""
from pathlib import Path
import numpy as np
import torch
from padertorch import Model
from padertorch.contrib.examples.sound_recognition.audio_... | StarcoderdataPython |
34069 | """
Problem Statement
Numeros, The Artist, had two lists A and B, such that, B was a permutation of A. Numeros was very proud of these lists.
Unfortunately, while transporting them from one exhibition to another, some numbers from List A got left out. Can you
find out the numbers missing from A?
"""
__author__ = 'Dany... | StarcoderdataPython |
1755582 | <gh_stars>1-10
#!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
User module.
"""
__author__ = '<NAME>'
class User:
"""
User class.
"""
__slots__ = ['_username', '_password', '_designation']
def __init__(self, username: str, password: str, designation: str):
"""
Constructor with... | StarcoderdataPython |
1695188 |
from logging import Logger
from logging import getLogger
from metamenus.Singleton import Singleton
class Configuration(Singleton):
DEFAULT_INDENTATION: str = 2 * ' '
DEFAULT_MENU_BAR_PREFIX: str = 'OnMB_'
DEFAULT_MENU_PREFIX: str = 'OnM_'
DEFAULT_VERBOSE_WARNINGS: bool = True
def... | StarcoderdataPython |
1713284 | from django import forms
from onlineLibrary.books_app.models import Book
class CreateBookForm(forms.ModelForm):
class Meta:
model = Book
fields = '__all__'
| StarcoderdataPython |
130924 | <reponame>Team-RAVL/civic-qa<filename>services/textAnalytics/flask-cog-services/analytics/mockAnalytics.py
import string
# letters, numbers, and space
ALLOWED_CHARS = f"{string.ascii_letters} {string.digits}"
class MockAnalytics:
def __init__(self):
pass
def extract_key_phrases(self, document):
... | StarcoderdataPython |
1634636 | from typer import _click7 as click
import typer
@click.group()
def cli():
pass
@cli.command()
def initdb():
click.echo("Initialized the database")
@cli.command()
def dropdb():
click.echo("Dropped the database")
app = typer.Typer()
@app.command()
def sub():
"""
A single-command Typer sub ap... | StarcoderdataPython |
3352176 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | StarcoderdataPython |
77819 | <gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
from sklearn.neighbors import NearestNeighbors
from sklearn.utils.multiclass import unique_labels
from sklearn.metrics import accuracy_score,confusion_matrix
from irisreader.data.mg2k_centroids import get_mg2k_centroids
from irisreader.data.mg2k_centroids i... | StarcoderdataPython |
1641910 | #!/usr/bin/env python3
# -*- encoding=utf-8 -*-
# description:
# author:jack
# create_time: 2019-06-13
from dueros.directive.DPL.Commands.BaseCommand import BaseCommand
class SendEventCommand(BaseCommand):
"""
SendEventCommand 绑定端触发UserEvent指令
"""
def __init__(self):
super(SendEventCommand,... | StarcoderdataPython |
187555 | # Generated by Django 3.2.8 on 2021-10-24 02:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('amcm', '0003_auto_20211024_0256'),
]
operations = [
migrations.AlterField(
model_name='cuotaevento',
name='fechaVenc... | StarcoderdataPython |
3352545 | <filename>factories/tests/test_intenthandlermanagerfactory.py
from unittest import TestCase
from factories.intenthandlermanagerfactory import IntentHandlerManagerFactory
class TestIntentHandlerManagerFactory(TestCase):
pass
# def test_create_intent_handler_manager(self):
# intent_handler_manager = I... | StarcoderdataPython |
1791798 | <gh_stars>0
import re
import os
import matplotlib.pyplot as plt
import re
import numpy as np
from scipy import stats
fig = plt.figure()
ax = fig.add_subplot(111)
PATH="../../data/previous-work/replication-icsme-readability/icsme19/replicationpackage/snippets.csv"
MAX=0
sloc_no_rule = []
sloc_rule = []
def parse_da... | StarcoderdataPython |
128723 | from .grid import Grid
from .grid import union
| StarcoderdataPython |
1776583 | import inspect
import telegram
import db_connector
import settings, message_formatter
def process_album(func):
def wrapper(*args):
self = args[0]
update = args[1]
self.logger.info(f"User {update.message.chat_id} requested '/{inspect.stack()[1].function}'")
model = func(*args)
... | StarcoderdataPython |
184490 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018 Dubalu LLC. All rights reserved.
#
# 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 withou... | StarcoderdataPython |
172392 | <reponame>topteulen/timely-beliefs
import pytest
from pytest import approx
from datetime import datetime, timedelta
from pytz import utc
import pandas as pd
from timely_beliefs import BeliefsDataFrame, BeliefSource, Sensor, TimedBelief
from timely_beliefs.utils import replace_multi_index_level
from timely_beliefs.exa... | StarcoderdataPython |
1731479 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 9 12:02:55 2021
@author: Easin
"""
in1 = input()
in1 = int(in1)
in2 = input().split()
list1 = []
for elem in range(len(in2)):
x = in2[elem]
list1.append(int(x))
#print(list1)
list1.sort(reverse=True)
#print(list1)
m = list1[0]
p =0
for val... | StarcoderdataPython |
1659742 | import logging
from ccquery.error import ConfigError
from ccquery.utils import io_utils
from ccquery.data import text_controller
class VocMix:
"""
Combine an external .dic hunspell dictionary
with a .txt word-based personal dictionary
Two possible combinations
- union
- create a new .dic h... | StarcoderdataPython |
3371932 | default_app_config = 'user_profiles.apps.UserProfilesConfig'
| StarcoderdataPython |
34286 | <gh_stars>0
# -*- mode: python; coding: utf-8 -*-
"""
Torncache Connection
"""
from __future__ import absolute_import
import os
import stat
import socket
import time
import numbers
import logging
import functools
from tornado import iostream
from tornado import stack_context
from tornado.ioloop import IOLoop
from t... | StarcoderdataPython |
1768947 | <reponame>TUDelftAutoGraph/Congestion-Finder
import unittest
import congestionfinder.bpsdetector
import logging
logging.getLogger().level = logging.DEBUG
class TestBPSDetector(unittest.TestCase):
def test_getBPSCode(self):
logging.debug("Starting test_getSpaceToSpaceIndex()")
input = "0... | StarcoderdataPython |
187248 | <filename>app.py
"""
Main application for storage validation.
Ingest files to table storage:
python app.py -ingest -settings "./exampleinput.json"
Validate files in table storage:
python app.py -validate -industry INDUSTRY_OR_FILTER_IN_CONFIG_JSON
Rebase files in table storage
python app.py -rebase -industry INDUS... | StarcoderdataPython |
1767167 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import Group
class EqKind(models.Model):
name = models.CharField('装置类别', max_length=4)
group = models.ForeignKey(Group, related_name='eqkinds',
on_delete=models.PROTECT, verbose_name='科室')
class Meta:
... | StarcoderdataPython |
3203832 | import tensorflow as tf
from tensorflow.contrib import slim
from tensorflow import keras
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_integer('image_height', 28, 'the height of image')
tf.app.flags.DEFINE_integer('image_width', 28, 'the width of image')
tf.app.flags.DEFINE_integer('batch_size', 128, 'Number of image... | StarcoderdataPython |
1797632 | #!/usr/bin/env python3
#
# Common script to generate OSD operator bundles for publishing to OLM. Copies appropriate files
# into a directory, and composes the ClusterServiceVersion which needs bits and
# pieces of our rbac and deployment files.
#
# Usage ./common-generate-operator-bundle.py -o OPERATOR_NAME -d OUTPUT_D... | StarcoderdataPython |
1603509 | <reponame>banctilrobitaille/torch-fast-symEig<filename>torchvectorized/utils.py
import torch
EPSILON = 1e-15
def overload_diag(inputs: torch.Tensor):
"""
Add an EPSILON to the diagonal of every 3x3 matrix represented by the 9 channels of an input of shape **Bx9xDxHxW**
to improve numerical stabil... | StarcoderdataPython |
3367427 | <reponame>Pierre-Mont/toulbar2<filename>web/TUTORIALS/sudoku/MNIST_sudoku.py
import pytoulbar2
import math, numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pickle
import torch
from torchvision import datasets, transforms
import itertools
import pandas as pd
import hashlib
#################... | StarcoderdataPython |
3347907 | <filename>data_gen/nerf_real/make_dataset.py
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | StarcoderdataPython |
3226778 | import os
import secrets
from fastapi import Depends, HTTPException, status, Request
from fastapi.security import HTTPBasic, HTTPBasicCredentials
security = HTTPBasic()
try:
env_username = os.environ["CADET_USERNAME"]
except KeyError:
env_username = "cadet"
try:
env_password = os.environ["CADET_PASSWORD"]
... | StarcoderdataPython |
28550 | import string
from ..datasets import Dataset
uppercase_ascii_letters = Dataset("uppercase_letter", None, string.ascii_uppercase)
lowercase_ascii_letters = Dataset("lowercase_letter", None, string.ascii_lowercase)
ascii_letters = Dataset("letter", None, string.ascii_letters)
digits = Dataset("digit", None, string.dig... | StarcoderdataPython |
4809275 | # Import relevant libraries
import numpy as np
import pandas as pd # to deal with the dataset
import plotly.express as px #to plot with beauty
from download_file import download_file
import json
## Get around pandas freezing when opening the file
url_name = 'https://base-covid19.pt/export3.json'
output_file = 'e... | StarcoderdataPython |
3211109 | from typing import List, Optional, Union
import pyinflect # noqa: F401
import spacy
from nltk.tokenize.treebank import TreebankWordDetokenizer
from spacy.symbols import AUX, NOUN, PRON, PROPN, VERB, aux, cc, nsubj
from spacy.tokens import Span, Token
from spacy.tokens.doc import Doc
from initialize import spacy_nlp
... | StarcoderdataPython |
1736979 | <reponame>herodotus77/pyqtgraph<filename>pyqtgraph/graphicsItems/ViewBox/ViewBox.py
# -*- coding: utf-8 -*-
import weakref
import sys
import math
from copy import deepcopy
import numpy as np
from ...Qt import QtGui, QtCore
from ...Point import Point
from ... import functions as fn
from .. ItemGroup import ItemGroup
fro... | StarcoderdataPython |
172271 | <gh_stars>1-10
with open('file.txt'):
<caret> | StarcoderdataPython |
189874 | import logging
from .object import ObjectStore
from openpathsampling.netcdfplus.cache import LRUChunkLoadingCache
logger = logging.getLogger(__name__)
init_log = logging.getLogger('openpathsampling.initialization')
class ValueStore(ObjectStore):
"""
Store that stores a value by integer index
Usually us... | StarcoderdataPython |
1666460 | #!/usr/bin/env python
import argparse
import sys
from clan.auth import AuthCommand
from clan.diff import DiffCommand
from clan.report import ReportCommand
COMMANDS = [
AuthCommand,
ReportCommand,
DiffCommand
]
class Clan(object):
"""
Command-line interface to Google Analytics.
"""
def _... | StarcoderdataPython |
180181 |
# Define a Subtraction Function
def sub(num1, num2):
return num1 - num2
| StarcoderdataPython |
3316926 | <filename>extra/splitdex/base_config.py
import os,ConfigParser
root_dir = os.path.dirname(os.path.realpath(__file__))
android_sys = 'android_sys'
apk_spliter_result = root_dir + '/outfiles/apk_splitter_result.txt'
def init():
conf = ConfigParser.ConfigParser()
conf.read('config.ini')
global aapt_file_pat... | StarcoderdataPython |
198403 | <reponame>PJansson/Chexpert
# Credits: https://github.com/Alibaba-MIIL/ASL
from copy import deepcopy
import torch
from torch import nn
class ModelEMA(nn.Module):
def __init__(self, model, decay=0.9995, device=None):
super().__init__()
self.module = deepcopy(model)
self.module.eval()
... | StarcoderdataPython |
3226471 | <gh_stars>1-10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='OneModel',
fields=[
('id', models.AutoField(... | StarcoderdataPython |
3377118 | import decimal
def compute_pi(n):
decimal.getcontext().prec = n
m = 1.0
k = 13591409
x = 1
s = k
for i in range(1, n):
m = m * (6.0 ** 3 - 16 * 6.0) / ((i + 1) ** 3)
k += 545140134
x *= -262537412640768000
s += decimal.Decimal(m * k) / x
return (426880 * dec... | StarcoderdataPython |
2232 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
1609090 |
from kokki import Execute, File
env.include_recipe("java.jre")
apt_list_path = '/etc/apt/sources.list.d/cloudera.list'
apt = (
"deb http://archive.cloudera.com/debian {distro}-cdh3 contrib\n"
"deb-src http://archive.cloudera.com/debian {distro}-cdh3 contrib\n"
).format(distro=env.system.lsb['codename'])
Exe... | StarcoderdataPython |
3256735 | from os import listdir, walk, chdir
from os.path import join, basename, isdir
from shutil import copytree
from tempfile import TemporaryDirectory
from tkinter.filedialog import askopenfilenames, Tk, asksaveasfilename
from zipfile import ZipFile
import xml.etree.ElementTree as ET
import re
from more_itertools import co... | StarcoderdataPython |
4814095 | <filename>demos/robot/stk/__init__.py
"""
STK - A collection of libraries useful for making apps with NAOqi.
"""
| StarcoderdataPython |
4804520 | from flask import Flask, session, redirect, url_for, escape, request, render_template, jsonify
from client import Client
from threading import Thread
import time
NAME_KEY = "name"
client = None
messages = []
app = Flask(__name__)
app.secret_key = b"\<KEY>"
@app.route("/")
@app.route("/home")
def home... | StarcoderdataPython |
1600156 | #pragma repy
fro = open("junk_test.out","w")
fro.close()
removefile("junk_test.out")
| StarcoderdataPython |
3390970 | #
# Copyright (c) 2019-2020 Mike's Pub, see https://github.com/mikespub-org
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
import logging
import os.path
import pickle
import time
import flask.json
from flask import Flask, jsonify, request
from flask.views import MethodView
from ... | StarcoderdataPython |
161955 | # -*- coding: UTF-8 -*-
"""PyRamen Homework Starter."""
# @TODO: Import libraries
import csv
from pathlib import Path
# @TODO: Set file paths for menu_data.csv and sales_data.csv
menu_filepath = Path('./Resources/menu_data.csv')
sales_filepath = Path('./Resources/sales_data.csv')
print(menufilepath)
# @TODO: Initia... | StarcoderdataPython |
3368532 | <filename>src/probnum/quad/policies/sample_measure.py<gh_stars>1-10
"""Randomly draw nodes from the measure to use for integration."""
import numpy as np
from probnum.quad._integration_measures import IntegrationMeasure
def sample_from_measure(nevals: int, measure: IntegrationMeasure) -> np.ndarray:
r"""Acquisi... | StarcoderdataPython |
1625774 |
import ctypes
from ctypes import (byref, POINTER, pythonapi,
c_int, c_char, c_char_p, c_void_p, py_object, c_ssize_t)
from .info import PY2
c_ssize_p = POINTER(c_ssize_t)
PyObject_GetBuffer = pythonapi.PyObject_GetBuffer
PyBuffer_Release = pythonapi.PyBuffer_Release
PyBUF_SIMPLE = 0
PyBUF_WRITAB... | StarcoderdataPython |
3370553 | <reponame>lbarman/gaia<filename>server/tests/server_grpc_test.py
import sys
import os.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import gaia_server.server_grpc as server_grpc
from time import sleep
import unittest
import grpc
import os.path
from datetime import dateti... | StarcoderdataPython |
1612544 | from django.shortcuts import render
from twitter import forms
from .models import Twitter
# Create your views here.
def follower(request):
twitter_form = forms.TwitterForm()
twitter_dict = {'twitter_form':twitter_form}
if request.method == 'POST':
twitter_form = forms.TwitterForm(request.POST)
... | StarcoderdataPython |
93806 | <reponame>sanghviharshit/ha-mila<gh_stars>1-10
"""Milacares API"""
from .const import URL_ACCOUNT
class Resource(object):
def __init__(self, api, device, data):
self.api = api
self.device = device
self.data = data
@property
def id(self):
return self.device["id"] if self.is... | StarcoderdataPython |
117970 | from flask import Flask, jsonify
import tweepy, configparser
config = configparser.ConfigParser()
config.read("config.ini")
consumer_key = config['twitter']['twitter_key']
consumer_secret = config['twitter']['twitter_secret']
access_token = config['twitter']['access_token']
access_token_secret = config['twitter']['ac... | StarcoderdataPython |
1741606 | <reponame>pmoulon/PlanarReconstruction
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
def get_coordinate_map():
focal_length = 517.97
offset_x = 320
offset_y = 240
K = [[focal_length, 0, offset_x],
[0, focal_length, offset_y],
[0, 0, 1]]
K_... | StarcoderdataPython |
98415 | <gh_stars>0
import sys,json,random,librosa,msaf
from setup import *
from scenarios import *
from behaviour import *
from emotionRetrieval import *
# Set the starting dictionary for the performance on which we will be working
def initialise(totalIntervals):
performance={"intervals":[]}
for i in range(t... | StarcoderdataPython |
32437 | <filename>analogy/collision_detection/triangle_col_detect.py
#!/usr/bin/env python3
import ctypes
import os
CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
C_MOLLERS = ctypes.CDLL(os.path.join(CURRENT_PATH, 'build/mollers_tri_tri.so'))
C_DEVILLERS = ctypes.CDLL(
os.path.join(CURRENT_PATH, 'build/deviller... | StarcoderdataPython |
27683 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-26 12:31
from __future__ import unicode_literals
import json
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('annotations', '0005_auto_20170826_1424'),
... | StarcoderdataPython |
3272012 | # Here to make pytest happy :)
| StarcoderdataPython |
3323533 | <reponame>DestinyofYeet/antonstechbot<filename>cogs/ip.py
from discord.ext import commands
import discord
from botlibrary import constants
import requests
class Ip(commands.Cog):
def __init__(self, client):
self.client = client
self.ipdata = constants.ipdata_token
self.base_url = constants... | StarcoderdataPython |
3384044 | # coding: utf-8
import pyvista
from PIL import Image
def load_stl(path):
return pyvista.PolyData(path)
def project2D(mesh, elev, azim, **kwargs):
mesh = mesh.copy()
mesh.rotate_z(-90-azim)
mesh.rotate_x(-90+elev)
plotter = pyvista.Plotter(off_screen=True)
plotter.set_background('black')
plotter.add_mesh(mesh,... | StarcoderdataPython |
1719369 | <reponame>tobias-fyi/image_skimmer
"""Image Skimmer :: Package Initializer"""
import os
from setuptools import setup, find_packages
# The directory containing this file
HERE = os.path.abspath(os.path.dirname(__file__))
# The text of the README file
with open(os.path.join(HERE, "README.md")) as fid:
README = fid.... | StarcoderdataPython |
3221724 | <filename>species/data/spex.py
"""
Module for adding the SpeX Prism Spectral Libraries to the database.
"""
import os
import urllib.request
import numpy as np
import pandas as pd
from astropy.io.votable import parse_single_table
from species.analysis import photometry
from species.util import data_util, query_util
... | StarcoderdataPython |
1674288 | <reponame>kalkehcoisa/ppft<filename>ppft/transport.py
# Parallel Python Software: http://www.parallelpython.com
# Copyright (c) 2005-2012 <NAME>.
# Copyright (c) 2015-2016 California Institute of Technology.
# Copyright (c) 2016-2020 The Uncertainty Quantification Foundation.
# All rights reserved.
# Redistribution and... | StarcoderdataPython |
1628255 | # Copyright (c) 2021 - Jojo#7791
# Licensed under MIT
import asyncio
import logging
from typing import Dict, List, Optional, Union
import discord
from redbot.core import Config, commands
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import humanize_list, pagify
from redbot.core.utils.predicat... | StarcoderdataPython |
1790399 | <reponame>mvukic/advent-of-code
number_of_nice_strings=0
with open("input.txt") as input:
for line in input:
line=line.rstrip()
cond1=False
for index,char in enumerate(line):
if index+2 == len(line):
break
if char == line[index+2]:
cond1=True
break
cond2 = False
index = 0
while True:
... | StarcoderdataPython |
676 | #!/usr/bin/env python
from sinedon import dbupgrade, dbconfig
import updatelib
project_dbupgrade = dbupgrade.DBUpgradeTools('projectdata', drop=True)
if __name__ == "__main__":
updatelib_inst = updatelib.UpdateLib(project_dbupgrade)
checkout_version = raw_input('Revert to checkout version, for example, 2.1 -->')
i... | StarcoderdataPython |
1636769 | <filename>rs/localization_files/AR.py
# -*- coding: utf-8 -*-
################################################################################
# LexaLink Copyright information - do not remove this copyright notice
# Copyright (C) 2012
#
# Lexalink - a free social network and dating platform for the Google App Engine.... | StarcoderdataPython |
136467 | <filename>resolwe/flow/executors/prepare.py
""".. Ignore pydocstyle D400.
======================
Flow Executor Preparer
======================
Framework for the manager-resident executor preparation facilities.
.. autoclass:: resolwe.flow.executors.prepare.BaseFlowExecutorPreparer
:members:
"""
import logging
i... | StarcoderdataPython |
199392 | def pg_version(conn):
"""
Returns the PostgreSQL server version as numeric and full version.
"""
num_version = conn.get_pg_version()
conn.execute("SELECT version()")
full_version = list(conn.get_rows())[0]['version']
return dict(numeric=num_version, full=full_version)
| StarcoderdataPython |
5296 | import pytest
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
@pytest.fixture(scope="function")
def browser():
options = webdriver.ChromeOptions()
options.add_argument('ignore-certificate-errors')
options.add_argument("--headless")
options.add_argument('--no-san... | StarcoderdataPython |
1737679 | import logging
import torch
from torch.utils.data import DataLoader
from utils_glue import compute_metrics, convert_examples_to_features_docred, ENTITY_MARKER, output_modes, processors
logger = logging.getLogger(__name__)
def load_and_cache_examples(args, task, tokenizer, dataset_type, evaluate=False):
if arg... | StarcoderdataPython |
3315255 | # --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import pri... | StarcoderdataPython |
127361 | <reponame>jarvis-1805/DSAwithPYTHON<gh_stars>1-10
'''
Return subsets sum to K
Given an array A of size n and an integer K, return all subsets of A which sum to K.
Subsets are of length varying from 0 to n, that contain elements of the array. But the order of elements should remain same as in the input array.
Note : T... | StarcoderdataPython |
3316110 | import collections
N, M = map(int, input().split())
A = list(map(int, input().split()))
AC = collections.Counter(A)
AC_sort = sorted(AC.items(), key=lambda x: -x[1])
if AC_sort[0][1] > (N/2) and (len(AC_sort) == 1 or (len(AC_sort) >= 2 and AC_sort[0][1] > AC_sort[1][1])):
print(AC_sort[0][0])
else:
print('?'... | StarcoderdataPython |
128419 | from telegram.bot import Bot
from telegram.ext import CommandHandler, CallbackContext
from telegram import Update, Message
from typing import List
class Darter:
def __init__(self, bot: Bot):
self.bot = bot
def getCommands(self) -> List[CommandHandler]:
return [CommandHandler("dart", self.dart... | StarcoderdataPython |
3302015 | <filename>models/layers.py<gh_stars>10-100
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn.parameter import Parameter
import pdb
from pprint import pprint
DEFAULT_THRESHOLD = 5e-3
class Binarizer(torch.autograd.Function):
"""Binarizes {0, 1... | StarcoderdataPython |
4835720 | <reponame>hodgestar/overalls<filename>overalls/uploaders/coveralls.py
# -*- coding: utf-8 -*-
"""Uploader for coveralls.io."""
import os
import json
import StringIO
import logging
import requests
from overalls.core import Uploader
log = logging.getLogger(__name__)
class CoverallsIoUploader(Uploader):
DEFAU... | StarcoderdataPython |
3316290 | import tkinter as tk
def btn_press():
print("ボタンが押されました")
root = tk.Tk()
root.geometry("150x80")
bt = tk.Button(bitmap="question",command=btn_press)
bt.pack()
root.mainloop() | StarcoderdataPython |
3234247 | <reponame>Ju99ernaut/grapeflowAPI
# Generated by Django 3.0.3 on 2020-04-15 09:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0008_auto_20200414_1338'),
]
operations = [
migrations.RenameField(
model_name='page',
... | StarcoderdataPython |
3300136 | # SECUREAUTH LABS. Copyright 2019 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
import pkg_resources
from impacket import LOG, __path__
BANNER = "Impacket ... | StarcoderdataPython |
195791 | <filename>yellowbrick/text/umap_vis.py<gh_stars>1-10
# yellowbrick.text.umap_vis
# Implements UMAP visualizations of documents in 2D space.
#
# Author: <NAME> <<EMAIL>>
# Created: Mon Dec 03 14:00:00 2018 -0500
#
# Copyright (C) 2016 Bengfort.com
# For license information, see LICENSE.txt
#
"""
Implements UMAP vis... | StarcoderdataPython |
1622168 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | StarcoderdataPython |
1632940 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# @Time: 2021/4/1 14:20
import requests
from config import global_config
from logger import logger
class Proxy(object):
enable = None
proxy_pool_url = None
current_proxy_ip = None
def __init__(self):
self.enable = global_config.get_raw('pro... | StarcoderdataPython |
3267387 | import os
import telegram
from telegram.ext import ConversationHandler
from telegram import ChatAction
from item import Item
from tabulate import tabulate
import random
import string
import reviewHandler
import config
from Language import Lang
from productHandler import ProductHandler
ITEM_NAME = 'item_name'
ITEM_ID ... | StarcoderdataPython |
3214734 | <gh_stars>0
"""
MAP Client Plugin
"""
__version__ = '0.2.2'
__author__ = '<NAME>'
__stepname__ = 'Argon Scene Exporter'
__location__ = 'https://github.com/mapclient-plugins/mapclientplugins.argonsceneexporterstep.git'
# import class that derives itself from the step mountpoint.
from mapclientplugins.argonsceneexport... | StarcoderdataPython |
3361743 | import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import math
def region_of_interest_v1(img, vertices):
mask = np.zeros_like(img)
channel_count = img.shape[2]
match_mask_color = (255,) * channel_count
cv2.fillPoly(ma... | StarcoderdataPython |
17313 | <reponame>AlessandroChen/KindleHelper<gh_stars>10-100
import os, stat
def addPermission(Filename):
os.chmod(Filename, os.stat(Filename).st_mode | stat.S_IXUSR);
def transform(content):
name = '';
for i in range(0, len(content)):
if (content[i] == ' ' and content[i + 1] == ' '):
name +=... | StarcoderdataPython |
90460 | <reponame>xfbs/ProjectEulerRust<gh_stars>1-10
import solver
import sys
datafile = open(sys.argv[1])
numbers = []
for line in datafile:
numbers.append(line)
print(solver.solve(numbers))
| StarcoderdataPython |
77923 | <reponame>vakwetu/castellan
# Copyright (c) The Johns Hopkins University/Applied Physics Laboratory
# 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
#
# ... | StarcoderdataPython |
1624895 | # Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | StarcoderdataPython |
78713 | <reponame>nanjekyejoannah/pypy
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rtyper import rclass
Size2Type = [None] * 100
Type2Size = {}
def get_size(TYPE):
try:
return Type2Size[TYPE]
except KeyError:
size = len(Size2Type)
Size2Type.append(TYPE)
Type2Size... | StarcoderdataPython |
1620286 | # -*- coding: utf8 -*-
import requests, json
import random
__all__ = ["Graph"]
def test_unicode(text):
if type(text) == unicode:
text = str(text)
return text
class Graph:
def __init__(self):
self.url = 'http://localhost:8529'
self.graph_name = 'graph' + str(random.randint(1, 100... | StarcoderdataPython |
102213 | <reponame>Human-Lambdas/human-lambdas
from django.test import TestCase
from human_lambdas.user_handler.models import Organization, User
from human_lambdas.workflow_handler.models import Task, Workflow
class TestModelWorkflow(TestCase):
def setUp(self):
self.preset_task_name = "bajs_task"
self.pre... | StarcoderdataPython |
124238 | <reponame>Ryu0n/stock_prediction<filename>stock/interface/req_interface.py
import requests
# http://127.0.0.1:8000/rest_api/user/10/
from django.views.decorators.csrf import csrf_exempt
class BaseReq:
def __init__(self):
self.url = 'http://127.0.0.1:8000/rest_api/'
self.login_url = self.url + 'au... | StarcoderdataPython |
3302092 | from probability_tree import BranchNode, LeafNode, parse_dict
def test_it_parses_leaf_node():
tree = parse_dict({"name": "leaf", "probability": 1.0, "conclusion": 1.0})
assert tree == LeafNode(name="leaf", probability=1.0, conclusion=1.0)
def test_it_parses_simple_tree():
tree = parse_dict(
{
... | StarcoderdataPython |
1698190 | from flask import send_from_directory, jsonify, request
from app import app, benches, testStatusController, ledController
from app.controller.psController import PsRequest
from app.controller.ledController import LedRequest
from app.controller.testStatusController import TestStatusRequest, TYPE_GET, TYPE_SET
from app.... | StarcoderdataPython |
1665244 | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
"""Dependencies that linter rules depend on."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def lowrisc_misc_linters_dependencies():
"""Declare... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.