id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
72285 | """
test multi vs single thread data loading
"""
import os
import random
import numpy as np
from sklearn.model_selection import KFold
import time
import utils.settings as settings
from evaluation.metrics import accuracy
from evaluation.conf_matrix import create_conf_matrix
from loader.Preprocessor import Preprocesso... | StarcoderdataPython |
1628610 | # -*- encoding: utf-8 -*-
"""
License: MIT
Copyright (c) 2019 - present AppSeed.us
"""
import io
import tempfile
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.views.generic.list import L... | StarcoderdataPython |
3350048 | from django.db import models
from django.contrib.auth.models import User
from taggit.managers import TaggableManager
class Funeral(models.Model):
name = models.CharField(max_length=250)
body = models.TextField()
house_position = models.CharField(max_length=200, null=True, blank=True)
mosque_position =... | StarcoderdataPython |
152727 | <reponame>Benz-Solutions/MyWebsite<gh_stars>0
from django.db import models
from ckeditor.fields import RichTextField
from django.urls import reverse
import readtime
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=50, verbose_name='Categoría')
slug = models.SlugFiel... | StarcoderdataPython |
1656529 | import json
import os
from flask import Blueprint
from flask_testing import TestCase
from app import manager
manager.app.tests_blueprint = Blueprint("tests", __name__)
manager.load_views(manager.app.tests_blueprint, "pysite/views/tests")
manager.app.register_blueprint(manager.app.tests_blueprint)
app = manager.app
... | StarcoderdataPython |
111564 | <reponame>bagheria/cardio-icd-assignment<filename>Evaluation/mlabels_eval_measures.py<gh_stars>1-10
import numpy as np
import pandas as pd
data = pd.read_csv("Data/icd_selected_data_multilabel.csv", encoding="ISO-8859-1")
df_multi_label = pd.DataFrame(data)
def eval_measures_multi_label(prob_predicted, labels, pati... | StarcoderdataPython |
1731781 | <reponame>ned2/tator
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-05 13:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('annotate', '0003_auto_20170525_1456'),
]
operations = [
... | StarcoderdataPython |
1625480 | <filename>echobot/plugins/botman/cli/__init__.py
"""Bot 管理 (CLI)"""
from . import feedback, reboot
| StarcoderdataPython |
77071 | # Generated by Django 2.2 on 2020-06-12 03:17
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('API', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='rating',
name... | StarcoderdataPython |
1680435 | import os
import time
from PIL import Image
from discord.ext import commands
class Longcat:
def __init__(self, bot):
self.bot = bot
self.path = "data/longcat/"
# 42 is the answer to everything
nreow = ["c"+"a"*i+"t" for i in range(2, 42)]
mya = ["ny"+"a"*i+"n" for i in range(1, 42)]
... | StarcoderdataPython |
1791996 | #!/usr/bin/env python3
from ctfpwn import run_api
if __name__ == '__main__':
run_api()
| StarcoderdataPython |
3209269 | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""General utils and AMR specific utils"""
import os
import json
import logging
logger = logging.getLogger('amr_postprocessing')
def get_default_amr():
default = '(w / want-01 :ARG0 (b / boy) :ARG1 (g / go-01 :ARG0 b))'
return default
def write_to_file(lst, f... | StarcoderdataPython |
1659230 | <reponame>aneeldamaraju/prdepth
import tensorflow as tf
import tensorflow_probability as tfp
Gaussian = tfp.distributions.MultivariateNormalDiag
from prdepth.net import VAE
from prdepth.net import DORN
from prdepth.net import ResNet101
import prdepth.utils as ut
# We use half of the training stride, for a denser patc... | StarcoderdataPython |
1743090 | <reponame>graydenshand/flask_boot<filename>tests/installers/test_flask_migrate.py
from ..conf_tests import app, cli
from flask_batteries.commands import install, uninstall
from flask_batteries.installers import FlaskMigrateInstaller
import os
from flask_batteries.config import TAB
import traceback
def test_flask_migr... | StarcoderdataPython |
1747102 |
import requests
import bs4
#from princeton_scraper_seas_faculty import __version__
SOME_LOW_TENS_NUMBER = 14
# def test_version():
# assert __version__ == '0.1.0'
def test_faculty_format_dom():
r = requests.get("https://www.cs.princeton.edu/people/faculty")
assert r.ok
s = bs4.BeautifulSoup(r.... | StarcoderdataPython |
1657542 | <reponame>priyalbhatewara123/Python-programs
class IOString():
def __init__(self):
self.str1 = ""
def get_String(self):
self.str1 = input()
def print_String(self):
print(self.str1.upper())
str1 = IOString()
str1.get_String()
str1.print_String()
| StarcoderdataPython |
3285539 | """
Utility functions for the backends
"""
from datetime import datetime, timedelta
import logging
import pytz
from django.core.exceptions import ObjectDoesNotExist
from requests.exceptions import HTTPError
from social_django.utils import load_strategy
from backends.exceptions import InvalidCredentialStored
from back... | StarcoderdataPython |
4839064 | # -*- coding: utf-8 -*-
#
# Copyright 2019 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... | StarcoderdataPython |
80419 | <gh_stars>0
from themachine.core import consumer, publish
from themachine import log
from themachine import util
from themachine.db.github import Repository
import git
@consumer(topic='github.fetch_repo', name='fetch_repo')
def fetch_repo(data):
"""
Fetches a repository from github into a temporary directory... | StarcoderdataPython |
3236766 | <reponame>dc74089/the-blue-alliance
import datetime
from google.appengine.api import memcache
from google.appengine.ext import ndb
import logging
from models.cached_query_result import CachedQueryResult
import random
from stackdriver.profiler import TraceContext
import tba_config
MEMCACHE_CLIENT = memcache.Client()
... | StarcoderdataPython |
1757979 | <filename>setup.py
#!/usr/bin/env python
from __future__ import absolute_import
from distutils.core import setup
setup(
name='lexicalbinary',
version='1.0',
description='A lexicographic binary encoding. Encode strings, bytearrays, integers, floats, and lists in a compact binary form preserving lexicographic sor... | StarcoderdataPython |
4810044 | import sys
import autograd.numpy as np
from autograd import grad
from scipy.stats import invgamma
sys.path.append('./../../')
from src.HMC.hmcparameter import HMCParameter
class XiParam(HMCParameter):
"""
This class implements the xi parameter and the methods needed for its inference by the HMC sampler.
... | StarcoderdataPython |
4811201 | import argparse
def parse_arguments(parser: argparse.ArgumentParser):
main_parser = parser.add_subparsers(title="Train and load the neural network", description="Valid commands:",
help="Sub command to train and load", dest="command")
# Train the neural network
trai... | StarcoderdataPython |
3262585 | <filename>setup.py<gh_stars>0
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='my first deep dive project',
author='omar_hisham',
license='',
)
| StarcoderdataPython |
3335160 | <filename>BlockParser.py
import FrequencyFunctions
from pythonosc import udp_client
def osc_setup(ip_address="127.0.0.1", port_number=57120):
return udp_client.SimpleUDPClient(ip_address, port_number)
def block_parser(a, client):
melody = a[0]
chords = a[1]
bass = a[2]
client.send_message("/melody... | StarcoderdataPython |
1787852 | # Generated by Django 3.1 on 2020-08-26 14:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data', '0005_auto_20200826_1339'),
]
operations = [
migrations.AddField(
model_name='game',
name='modified_at',
... | StarcoderdataPython |
104869 | import yaml
import logging
import requests
import os
REL_PATH = os.path.realpath(__file__).rsplit('/', 1)[0]
class MirrorConfig:
"""Class that contains config for crypto-mirror UI and stuff"""
def __init__(self, *args, **kwargs):
self.__dict__.update(kwargs)
self.validate_token()
def valid... | StarcoderdataPython |
7819 | <filename>tests/extractors/test_etrade.py
from datetime import datetime
from statement_renamer.extractors.etrade import ETradeDateExtractor as EXTRACTOR_UNDER_TEST
from statement_renamer.extractors.factory import ExtractorFactory
TESTDATA = (
"""
PAGE 1 OF 6 February 1, 2019 - March 31, 2019AccountNumber:###... | StarcoderdataPython |
37058 | import os
import sys
sys.path.insert(0, os.environ["QUEX_PATH"])
from quex.engine.state_machine.core import DFA
from quex.engine.state_machine.algebra.TESTS.helper import test2, test1, test3, union, \
intersection, \
... | StarcoderdataPython |
4836413 | from .inventory_service import InventoryService, ReservationState, ReservationException | StarcoderdataPython |
3365843 | <filename>age/data/load/generator.py
"""Generate age and sex disaggregatred data for multiple countries."""
import pandas as pd
from age.data.load.countries import austria, belgium, brazil, canada, chile, czechia, denmark, finland, france, germany, hongkong, india, italy, korea, mexico, netherlands, portugal, uk, usa
... | StarcoderdataPython |
3378096 | <reponame>srinivas32/knitpy<filename>knitpy/engines.py<gh_stars>100-1000
from __future__ import absolute_import, unicode_literals
__all__ = ["PythonKnitpyEngine"]
LANGUAGE_ENGINES = []
from traitlets.config.configurable import LoggingConfigurable
from traitlets import Bool, Unicode, CaselessStrEnum, Instance
class... | StarcoderdataPython |
4800113 | import subprocess
import signal
import time
while True:
try:
print("Launching bot...")
process = subprocess.Popen(["python3.7", "run.py"], universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
while True:
line = process.stdout.readline()
if not line:
break
print(line... | StarcoderdataPython |
1797964 | import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
from libs import model_common
def placeholder(Batch_Size, P, Q, N, F_in, F_out):
labels = tf.compat.v1.placeholder(shape = (Batch_Size, Q, N, F_out), dtype = tf.float32,name="lables")
samples = tf.compat.v1.placeholder(shape = (Batch_Size, P, N, F_in),... | StarcoderdataPython |
4826935 | #!/usr/bin/python3
import subprocess
from http import cookies
import datetime
import base64
import os
import cgi
from pathlib import Path
import codecs
def encode_function(cookie):
return codecs.getencoder('rot-13')(cookie)[0]
def sxor(s1,s2="sixteencharacter"):
return ''.join(chr(ord(a) ^ ord(b)) for a,b... | StarcoderdataPython |
1715637 | import os
import requests
import string
import sys
# pip install beautifulsoup4
from bs4 import BeautifulSoup, NavigableString
# pip install lxml
from lxml import etree
def format(str):
return ' '.join(str.split()).replace('( ', '(').replace(' )', ')').replace(' .', '.').replace(' ,', ',').replace(' ;', ';').replace... | StarcoderdataPython |
3223237 | from typing import List
from projecteuler.util.permutations import permutation
def problem_0024(number: int, elements: List[int]) -> int:
return int(''.join(str(i) for i in permutation(number, elements)))
if __name__ == '__main__':
PERMUTATION = 1000000
ELEMENTS = [i for i in range(10)]
print(prob... | StarcoderdataPython |
3279773 | <filename>of13/parser.py
"""
Parser of the OpenFlow 1.3 message
"""
import netaddr
from tcpiplib.parser import *
from tcpiplib.prints import *
from struct import unpack
import of13.packet
import of13.dissector
import of13.prints
# ################## OFPT_HELLO ############################
def parse_hello(msg, ... | StarcoderdataPython |
4829674 | <filename>nkssg/structure/plugins.py
import pkg_resources
from nkssg.utils import get_config_by_list
class Plugins():
def __init__(self, config):
if get_config_by_list(config, ['plugin_is_ready']) is not None:
config['plugins'] = config['active_plugins']
self.plugins = config['ac... | StarcoderdataPython |
3292515 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
from telemetry import benchmark
from telemetry.core import browser_finder
sys.path.append(os.path.join(os.path.dirname(__file__), os.p... | StarcoderdataPython |
1676778 | <filename>tests/tests.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import Popen, PIPE
import os
import re
import sys
import unittest
class Base(unittest.TestCase):
commands = ['../bin/vcprompt']
def data(self, field):
"""
Returns the value for the given ``field`` from the... | StarcoderdataPython |
3385946 | # ----------------------------------------------------------------------
# ETL-specific types
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python mo... | StarcoderdataPython |
166878 | <reponame>ScriptHound/vk_schema_codegen
import json
import re
from keyword import kwlist
def get_type_from_reference(str_ref, convert_to_calmel_case=True) -> str:
pattern = r".*/(.*)"
ref_type = re.search(pattern, str_ref).group(1)
if convert_to_calmel_case:
return snake_case_to_camel_case(ref_typ... | StarcoderdataPython |
3200217 | a=10
b=2
t=a+b
çıkarma=a-b
bölme =a/b
ç = a*b
mod_alma = a//b
i=a**b
print("1.sayı" , a)
print("2.sayı" , b)
print("toplama işlemi sonuu" , t)
print("çıkarma işlemi sonuu" , çıkarma)
print("bölme işlemi sonuu" , bölme)
print("çarpma işlemi sonuu" , ç)
print("mod alma işlemi sonuu" , mod_alma)
print("üstü... | StarcoderdataPython |
1600063 | # -*- coding: UTF-8 -*-
import random
ques_answer = '1_with_answer.txt'
ques_no_answer = '2_no_answer.txt'
f1 = open(ques_answer, 'w') # write 方式第一次写一行
f2 = open(ques_no_answer, 'w')
for row in range(20):
for col in range(5):
a = random.randint(1,99)
b = random.randint(1,99)
op = (random... | StarcoderdataPython |
3317695 | <gh_stars>0
from django.contrib.auth.hashers import (is_password_usable,
check_password, make_password, get_hasher)
from django.test.utils import override_settings
from django.test import TestCase
from django_fastpbkdf2.hashers import (FastPBKDF2PasswordHasher,
FastPBKDF2SHA1PasswordHasher)
PASSWORD_HASHERS ... | StarcoderdataPython |
3244108 | import os
import vtk
import ctk
import qt
import slicer
from EditOptions import HelpButton
import LabelEffect
__all__ = [
'WandEffectOptions',
'WandEffectTool',
'WandEffectLogic',
'WandEffect'
]
#
# This defines the hooks to be come an editor effect.
#
#
# WandEffectOptions - see LabelEffect, EditOptions a... | StarcoderdataPython |
87528 | # python3
"""Example: Quantum Teleportation."""
import math
from absl import app
import numpy as np
from src.lib import bell
from src.lib import ops
from src.lib import state
def alice_measures(alice: state.State,
expect0: np.complexfloating, expect1: np.complexfloating,
qubit... | StarcoderdataPython |
1745624 | <reponame>Gestas/PinVidderer
"""NFO file utilities."""
import logging
import re
# Thanks to JGoutin @ https://github.com/JGoutin/movie_nfo_generator/blob/master/movie_nfo_generator/nfo.py
from pathlib import Path
from lxml.etree import Element, ElementTree, ParseError, SubElement
from .utils import PathDetails
logg... | StarcoderdataPython |
3359779 | class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
#INT_MAX = (1<<31)-1
#INT_MIN = -1<<31
sign = 1
if x < 0:
sign = -1
x *= -1
y = 0
while x > 10:
if y > 0:
... | StarcoderdataPython |
178381 | """A class that models a STAC Catalog."""
from examples._utils import Utils
from examples.relation import RelationType
from examples.traversable import Traversable
class Catalog(Traversable):
"""A class that models a STAC Catalog."""
def __init__(self, data=None):
"""Initialize the Catalog instance ... | StarcoderdataPython |
76605 | <reponame>murthyn/composer<filename>tests/test_precision.py
# Copyright 2021 MosaicML. All Rights Reserved.
import os
import pytest
import torch
import torch.distributed
from packaging import version
import composer
from composer.core import Precision
from composer.datasets.hparams import SyntheticHparamsMixin
from ... | StarcoderdataPython |
3265050 | # -----------------------------------------------------------
# Copyright (c) 2021. <NAME> Write a program that
# reads the pocket number and indicates whether the pocket is green,
# red, or black. The program should display an
# error message if the user enters a number that is outside
# the range from ... | StarcoderdataPython |
55494 | <reponame>metegenez/WAVEPAL<gh_stars>10-100
import numpy as np
def blocknum(x):
"""BLOCKNUM Numbers the contiguous blocks of an array.
Suppose X is a column vector which contains blocks of identical
values, e.g. X=[0 0 0 1 1 3 2 2 2]
N, A, B=BLOCKNUM(X) gives each contiguous block of identical values a
... | StarcoderdataPython |
118503 | <reponame>wangxiaoli-wxl/Homework<gh_stars>0
#1.解一元二次方程
import math
a = float(input("请输入a的值:"))
b = float(input("请输入b的值:"))
c = float(input("请输入c的值:"))
if a != 0:
delta = b**2-4*a*c
if delta < 0:
print("无根")
elif delta == 0:
s = -b/(2*a)
print("唯一根x=",s)
else :
... | StarcoderdataPython |
3274995 | from ibeacon.services import *
if __name__ == "__main__":
print("Starting to run iBeacon Broadcaster")
settings = ibeacon_get_settings()
ibeacon_print_settings(**settings)
ibeacon_start_broadcaster(**settings) | StarcoderdataPython |
1717173 | import math
def strong(num: int) -> bool:
num = str(num)
s = [math.factorial(int(num[i])) for i in range(len(num))]
if(sum(s)==int(num)): return True
return False
n = int(input("enter the number - "))
print(strong(n))
| StarcoderdataPython |
3298051 | # Generated by Django 3.1.4 on 2020-12-24 21:19
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Resource',
fields=[
('id', models.AutoField... | StarcoderdataPython |
11068 | #!/usr/bin/env python3.5
from time import sleep, time
from datetime import datetime, timedelta
from pid.decorator import pidfile
#from subprocess import call
from RPi import GPIO
import requests
import json
#import config
import logging
import signal
import sys
#13: grün
#16: braun
#19: orange
#20: grün
#21: braun
#2... | StarcoderdataPython |
16058 | <reponame>aas-core-works/aas-core3-meta<gh_stars>0
"""Provide meta-models for Asset Administration Shell information model."""
__version__ = "2021.11.20a2"
__author__ = (
"<NAME>, <NAME>, <NAME>, <NAME>, <NAME>"
)
__license__ = "License :: OSI Approved :: MIT License"
__status__ = "Alpha"
| StarcoderdataPython |
3307053 | """
Q200 Number of Islands
Medium
08/27/2019
20210615
Given a 2d grid map of '1's (land) and '0's (water),
count the number of islands.
An island is surrounded by water and is formed by connecting
adjacent lands horizontally or vertically. You may assume
all four edges of the grid are all surrounded by water.
Exampl... | StarcoderdataPython |
111002 | """
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
Find the minimum element.
You may assume no duplicate exists in the array.
Example 1:
Input: [3,4,5,1,2]
Output: 1
Example 2:
Input: [4,5,6,7,0,1,2]
Output: 0
... | StarcoderdataPython |
32664 | #!/usr/bin/env python
# pylint: disable=invalid-name
""" Web-based proxy to a Kerberos KDC for Webathena. """
import base64
import json
import os
import select
import socket
import dns.resolver
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder
from pyasn1.error im... | StarcoderdataPython |
3370987 | from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.db import connections, models
from . import conf
def get_history_user_id(request):
user = getattr(request, conf.REQUEST_USER_FIELD)
return getattr(user, conf.REQUEST_USER_ATTRIBUTE) if conf.REQUEST_USER_ATTRIBUT... | StarcoderdataPython |
109318 | <gh_stars>0
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from .forms import CustomUserCreationForm, CustomUserChangeForm
from .models import CustomUser
class CustomUserAdmin(UserAdmin):
add_form = CustomUserCreationForm
form = Custom... | StarcoderdataPython |
3215681 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..model import FitGLM
def test_FitGLM_inputs():
input_map = dict(
TR=dict(mandatory=True, ),
drift_model=dict(usedefault=True, ),
hrf_model=dict(usedefault=True, ),
ignore_exception=d... | StarcoderdataPython |
3371404 | <reponame>xiaoping-yang/ms2pip_c
import pandas as pd
# from deeplc import DeepLC
class RetentionTime:
def __init__(self, predictor="deeplc", config=None):
"""
Initialize peptide retention time predictor
Parameters
----------
predictor: str, optional
Retention ... | StarcoderdataPython |
3376338 | # -*- coding: utf-8 -*-
# @Time : 2021/8/8 6:32
# @Author : pixb
# @Email : <EMAIL>
# @File : test_battling.py
# @Software: PyCharm
# @Description: game battling test case
from strategy.base_strategy import *
from strategy.general_strategy import general_strategy
from test_game_state import *
from view import... | StarcoderdataPython |
20708 | from src import (
RunMode,
setup
)
__run_mode__ = RunMode.PARALLEL
@setup
def my_setup(logger):
assert False, "FAILING SETUP ON PURPOSE"
def test_skipped(logger):
assert False, "THIS TEST SHOULD NOT RUN BECAUSE SETUP FAILED"
| StarcoderdataPython |
1764596 | <reponame>kwedel/RWJigsaw
import numpy as np
import matplotlib.pyplot as plt
import svgwrite
class Dot:
'''Class containing data for a single dot in the puzzle.
Initiate with coordinates i,j'''
def __init__(self,i,j):
self.color = None
self.active = True
self.empty = True
se... | StarcoderdataPython |
1781023 | <filename>StochasticModels/ClosedFormModels/CGenericOptionBlackScholesModel.py<gh_stars>1-10
""""
This is the most generic implementation of the BS model: its usage are 3:
- Black-Scholes for Equity: r_f == 0, annuity == 1
- Black-76 for Swaption: r_f == 0
- Black-Scholes for FX: annuity == 1
"""
def calc... | StarcoderdataPython |
98279 | import os
import numpy as np
import SharedArray as SA
from torch.utils.data import Dataset
from util.data_util import sa_create
from util.data_util import data_prepare
class S3DIS(Dataset):
def __init__(self, split='train', data_root='trainval', test_area=5, voxel_size=0.04, voxel_max=None, transform=None, shuf... | StarcoderdataPython |
3219122 | __all__ = ['getch']
class _Getch:
"""
Gets a single character from standard input. Does not echo to the screen.
"""
def __init__(self, is_blocking=True):
try:
self.impl = _GetchWindows(is_blocking)
except ImportError:
self.impl = _GetchUnix(is_blocking)
d... | StarcoderdataPython |
3216166 | <reponame>BMC-SDNU/Cross-Modal-Hashing-Retrieval<gh_stars>1-10
import os
import argparse
import tensorflow.compat.v1 as tf
from SSAH import SSAH
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--dataname', type=str, default='flickr', help='Dataset name: flickr/coco/nuswide')
... | StarcoderdataPython |
1793188 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from skimage.io import imread
import keras
from keras import Sequential
from tensorflow.keras.applications.mobilenet import MobileNet
from keras.layers import Dense
from keras.preprocessing import image
impo... | StarcoderdataPython |
147909 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import pytest
import numpy as np
from inferbeddings.evaluation import metrics, ranking_summary
import logging
def scoring_function(args):
Xr, Xe = args[0], args[1]
d = {
(1, 1, 1): 1.0,
(1, 1, 2): 2.0,
(1, 1, 3): 3.0,
(2, 1, 1): 0.7,
... | StarcoderdataPython |
132404 | from django.urls import include
from django.urls import path
from secure_app.views import (
SecureUserCreateView,
SecureFileUploadView,
SecureFileView,
secure_doc_download
)
urlpatterns = [
path('create-user/', SecureUserCreateView.as_view(), name='secure_user_creation'),
path('upload/', Secur... | StarcoderdataPython |
3373557 | import os
import glob
import re
import sys # access system routines
import math
import scipy
import numpy as np
import matplotlib.pyplot as plt
import Common
labs = ['r*-', 'g^-', 'b+-', 'md-', 'cp-', 'yh-', 'ks-', 'ro-' ] # plot labels
labs_lins = ['r-', 'g-', 'b-', 'm-', 'c-', 'y-', 'k-', 'r-' ] # plot labels
lab... | StarcoderdataPython |
16752 | <filename>test/office_schema.py
from test.office_model import Headquarters, Office
from marshmallow import fields
from pynamodb.attributes import DiscriminatorAttribute
from marshmallow_pynamodb import ModelSchema
class OfficeSchema(ModelSchema):
"""Office Schema for PynamoDB Office Model.
We are overridin... | StarcoderdataPython |
102524 | import base64
import datetime
import os
from collections import defaultdict, namedtuple
import jinja2
from model import Book, Cover, book_to_cover, load_books
BookWithCover = namedtuple(
'Book',
list(Book._fields) + ['cover']
)
def render_from_template(template_filename, books_with_cover_by_year, pages_... | StarcoderdataPython |
64526 | <reponame>1mackenziekyle/cover-letters
from RPA.Browser.Selenium import Selenium
import time
import pandas as pd
from bs4 import BeautifulSoup
import json
lib = Selenium()
# Global vars
fullStackJson = {}
frontendJson = {}
backendJson = {}
import json
with open('input/userinfo.json', 'r') as f:
userJsonInfo = js... | StarcoderdataPython |
3211831 | <gh_stars>0
#!/usr/bin/python
# -*- coding:utf-8 -*-
import time
import ADS1256
import RPi.GPIO as GPIO
try:
ADC = ADS1256.ADS1256()
if (ADC.ADS1256_init() == -1):
exit()
while(1):
# t=time.time()
ADC_Value = ADC.ADS1256_GetAll()
# print " rint " + str((time.time()-... | StarcoderdataPython |
194125 | <reponame>CrowdcoinSA/crowdcoin-platform
import feedparser
from bs4 import BeautifulSoup
import logging
logger = logging.getLogger(__name__)
def blog_posts(request):
try:
print 'called'
url='http://blog.crowdcoin.co.za/feed'
feed = feedparser.parse(url)
items = feed['items'][:5]
... | StarcoderdataPython |
67209 | <gh_stars>100-1000
import pytest
from enum import Enum
from toloka.client._converter import converter
from toloka.util._extendable_enum import extend_enum, ExtendableStrEnum
from toloka.client.primitives.base import BaseTolokaObject
@pytest.fixture
def test_enum():
class TestEnum(Enum):
A = 'a'
B... | StarcoderdataPython |
1730055 | def solve(A, n):
ans = [A[0], A[0]]
max_current = A[0]
for i in range(1, n):
# Subarray - Kadane
max_current = max(A[i], max_current + A[i])
if max_current > ans[0]:
ans[0] = max_current
# Subsequence
A.sort(reverse = True)
ans[1] = A[0]
for i i... | StarcoderdataPython |
1789396 | """Model for an access log."""
import functools
import logging
import numpy as np
from django.conf import settings
from django.db import models
from django.utils import timezone
logger = logging.getLogger(__name__)
class AccessLogMixin(models.Model):
"""Base class which logs access of information."""
# The ... | StarcoderdataPython |
1696683 | #!/usr/bin/env python
# _*_ coding:utf-8 _*_
#
# @Version : 1.0
# @Time : 2019/7/8
# @Author : 圈圈烃
# @File : AnalysisData
# @Description:汽车之家数据分析
#
#
from pyecharts import options as opts
from pyecharts.charts import Map
from pyecharts.charts import Bar
import csv
provinceList = [
'北京', '广东', '山东', ... | StarcoderdataPython |
3226516 | # -*- coding: utf-8 -*-
from odoo import models, fields, api, tools, _
from odoo.http import request, content_disposition
from odoo.addons.hs_query.libs.query_libs import query_and_count_data, get_query_statement_by_code
import json
import traceback
ERROR_NO_STATEMENT_CODE = u"数据库查询代码[ %s ]不存在, 请联系管理员!!"
ERROR_SQL_QU... | StarcoderdataPython |
3255839 | import qctests.EN_increasing_depth_check
import util.testingProfile
import numpy as np
import util.main as main
#### EN_increasing_depth_check -------------------------------------------
class TestClass:
parameters = {
'db': 'iquod.db',
"table": 'unit'
}
def setUp(self):
# this q... | StarcoderdataPython |
156084 | <reponame>albert-jin/Rec-KGQA<gh_stars>10-100
import time
from dataloader import MetaQADataLoader, DEV_MetaQADataLoader
from model import Answer_filtering_module
import torch
import logging
from tqdm import tqdm
import os
from collections import OrderedDict
import numpy as np
if not torch.cuda.is_available:
print(... | StarcoderdataPython |
61919 | <gh_stars>0
import json
import re
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from utils.color... | StarcoderdataPython |
4825141 | <filename>xam/cli/release.py
'''
xam.release
-----------
Contains the release script to automate the release process for an XBMC
addon.
:copyright: (c) 2012 <NAME>
:license: BSD, see LICENSE for more details.
'''
import re
import os
import sys
from subprocess import check_call, check_output
im... | StarcoderdataPython |
3311384 | # Confidential, Copyright 2020, Sony Corporation of America, All rights reserved.
from typing import Sequence, Optional, cast, Type, Tuple
from .base import BasePerson
from ..interfaces import PersonRoutineWithStatus, NoOP, NOOP, LocationID, SpecialEndLoc, globals, PersonRoutine, \
SimTimeTuple, SimTimeRoutineTrig... | StarcoderdataPython |
1794910 | <filename>gradient_free_optimizers/sequence_model/bayesian_optimization.py
# Author: <NAME>
# Email: <EMAIL>
# License: MIT License
import numpy as np
from scipy.stats import norm
from scipy.spatial.distance import cdist
from .sbom import SBOM
class BayesianOptimizer(SBOM):
def __init__(self, init_positions, ... | StarcoderdataPython |
1799315 | <gh_stars>0
from tests.pages.home_page import HomePage
from tests.test_base import TestBase
class TestDynamicTablePage(TestBase):
def test_dynamic_table(self):
home_page = HomePage(self.driver)
assert home_page.is_page_rendered() is True
dynamic_table_page = home_page.go_to_dynamic_table_p... | StarcoderdataPython |
4835386 | import unittest, os, tempfile
from pygromos.files.topology.disres import Disres
from pygromos.utils import bash
from pygromos.tests.test_files.general_file_functions import general_file_tests
from pygromos.tests.in_testfiles import in_test_file_path
root_in =in_test_file_path+"/disres"
in_path = root_in+"/in_disres.d... | StarcoderdataPython |
42329 | <reponame>PluginCafe/cinema4d_py_sdk_extended
"""
Copyright: MAXON Computer GmbH
Author: <NAME>
Description:
- Creates a new PolygonReduction object.
Class/method highlighted:
- c4d.utils.PolygonReduction
"""
import c4d
polyReduction = c4d.utils.PolygonReduction()
| StarcoderdataPython |
3205988 | """
1284. 집 주소
작성자: xCrypt0r
언어: Python 3
사용 메모리: 29,380 KB
소요 시간: 76 ms
해결 날짜: 2020년 9월 21일
"""
def main():
width = { '0': 4, '1': 2 }
while True:
N = input()
if N == '0':
break
w = 0
for n in N:
w += width.get(n, 3)
print(w + 1 + len(N))
... | StarcoderdataPython |
94077 | import arcpy
import pandas as pd
import os
fc = r"C:\\temp\\GasPipelineEnterpriseDataManagement\\Databases\\UPDM_UtilityNetwork.gdb\\UtilityNetwork\\PipelineLine"
field_group_name = 'Limit Material By Asset Type'
def view_cav(table, subtype_field):
index = ['fieldGroupName', 'subtype', 'isRetired', 'id']
dat... | StarcoderdataPython |
162615 | <filename>greent/graph.py
import json
import logging
import sys
import traceback
from collections import defaultdict
from greent.concept import Concept
from greent.concept import ConceptModel
from greent.node_types import ROOT_ENTITY
from greent.service import Service
from greent.util import LoggingUtil
from neo4j imp... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.