id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5111083 | from ament_index_python import get_package_share_directory
import opengen as og
import casadi.casadi as cs
import os
from parameters import *
b = cs.SX.sym('b', ni)
x = cs.SX.sym('x', nt)
# Bound control outputs
umax = [force] * nt
umin = [0] * nt
bounds = og.constraints.Rectangle(umin, umax)
problem = cs.transpos... | StarcoderdataPython |
9767433 | # 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, software
# distributed under t... | StarcoderdataPython |
6457535 | <filename>opus/import/populate_obs_instrument_COVIMS.py<gh_stars>1-10
################################################################################
# populate_obs_instrument_COVIMS.py
#
# Routines to populate fields specific to COVIMS.
################################################################################
... | StarcoderdataPython |
3229463 | import hashlib
import re
from collections import Counter
from typing import Dict, List, Optional, Union
import pandas as pd
from joblib import Parallel, delayed
from ..utils import BaseProcessor
class PreDeduplicationProcessor(BaseProcessor):
"""This class is used to process data to format expected by code clon... | StarcoderdataPython |
1900683 | <filename>Bolivian_Lowlands/Specific_loads_lowlands/HI_Household.py
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 13 10:32:11 2021
@author: Clau
"""
'''
Paper: Energy sufficiency, lowlands.
User: High Income Household
'''
from core import User, np
User_list = []
#Defining users
H2 = User("high inco... | StarcoderdataPython |
8191824 | # ------------------------------------------------------------------------------
# CMSC 291 Lecture 10: Default Application configuration for Jupyter Lab
# ------------------------------------------------------------------------------
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = "no... | StarcoderdataPython |
1670882 | <gh_stars>1000+
from .tensor import *
from .sparse import *
| StarcoderdataPython |
3588848 | <reponame>Davidxswang/leetcode<filename>medium/230-Kth Smallest Element in a BST.py
"""
https://leetcode.com/problems/kth-smallest-element-in-a-bst/
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.
Example 1:
Input: root = [3,1,4,null,2], k = 1
3
/ \
1 4
\
... | StarcoderdataPython |
1657118 | <reponame>OctavianLee/Cytisas
"""
Registry for task queue.
"""
import cPickle as pickle
from cytisas.tqueue.task import Task
class Registry(object):
"""A registry for task queue."""
def __init__(self):
self._registry = {}
def get_task_string(self, task):
"""Generate a string of a tas... | StarcoderdataPython |
4881522 | """This module implements simple, dynamic argument parsing for Python scripts.
Use this when argparse is too verbose.
"""
from collections import OrderedDict
import sys
from typing import Text, Optional, Dict, List
def _parse(args: List[Text]) -> Dict:
"""Simple key value arg parser which doesn't need to know ah... | StarcoderdataPython |
9790268 | <filename>oschown/chown_neutron.py
# 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... | StarcoderdataPython |
6622019 | """This script will run the agent in a 1 D environment and plot its learning
progress
Author: <NAME>, 22.12.2021
"""
import numpy as np
import matplotlib.pyplot as plt
from environment import DiscreteEnvironment
from agent import AgentBase
from analysis import AnalyzerEpisode, AnalyzerRun, animate_episodes
import ... | StarcoderdataPython |
273663 | import os
import sqlite3
import pandas as pd
class DBLoader(object):
def __init__(self, db_path = None, raw_path = None):
"""
Initialize common parameters used for the database and inputs.
If none given, they are defaulted to their expected locations within the repository.
Default D... | StarcoderdataPython |
12847064 | <reponame>marasiali/Django-bog
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
is_author = models.BooleanField(default=False, verbose_name='نویسنده', help_text='نشان میدهد که آیا این کاربر میتواند مطلب ارسال کند یا خیر.')... | StarcoderdataPython |
1896917 | <filename>database.py
class Database:
def __init__(self, filename):
if isinstance(filename, str):
self.filename = filename
else:
raise TypeError('Filename should be a string!')
def get_connection(self):
import sqlite3
# Return a connection to the database
return sqlite3.connect(self.filenam... | StarcoderdataPython |
3547040 | <filename>setup.py<gh_stars>1-10
from setuptools import setup, find_packages
from Cython.Build import cythonize
with open("README.md") as f:
readme = f.read()
with open("LICENSE") as f:
license = f.read()
extras = {
'dev': ['bump2version'],
'docs': open('docs/requirements.txt').read().splitlines(),
... | StarcoderdataPython |
6581761 | <reponame>eKMap/ekmap-publisher-for-qgis<filename>ekmap_core/qgslayer_parser/fill_symbol/simple_fill_parser.py
from .fill_layer_parser import FillLayerParser
from ...ekmap_common import *
from ...ekmap_converter import eKConverter
CURRENT_PATH = str(os.path.dirname(__file__))
class SimpleFillParser(FillLayerParser):
... | StarcoderdataPython |
9615603 | <reponame>DPNT-Sourcecode/CHK-uimw01<gh_stars>10-100
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Bytecode manipulation for coverage.py"""
import types
class CodeObjects(object):
"""Iterate over all ... | StarcoderdataPython |
1672672 | <gh_stars>1-10
import sys
import urllib2
import csv
import json
from datetime import datetime, timedelta, date
if len(sys.argv) == 3 and sys.argv[1] and sys.argv[2]:
try:
start_date=datetime.strptime(sys.argv[1], '%Y-%m-%d')
end_date=datetime.strptime(sys.argv[2], '%Y-%m-%d')
except:
ra... | StarcoderdataPython |
6520167 | import os
os.system('rapydscript -p --screw-ie8 rapyd/Observable.pyj tests/test_Observable.pyj -o tests/js/test_Observable.js' )
os.system('node tests/js/test_Observable.js')
"""
script_list = list()
for root, dirs, files in os.walk("rapyd"):
path = root.split(os.sep)
path.pop(0)
for file in files:
... | StarcoderdataPython |
9652776 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################################
##
## This file is part of Tango Control System
##
## http://www.tango-controls.org/
##
## Author: <NAME>
##
## This is free software; you can redistribute it and/or modify
## it under the terms ... | StarcoderdataPython |
1828630 | <filename>notebooks/exp_decay.py<gh_stars>0
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
from IPython import get_ipython
# %%
import os
# os.environ['MKL_NUM_THREADS'] = '1'
# os.environ['OPENBLAS_NUM_THREADS'] = '1'
# %%
get_ipython().run_line_magic('matplotlib', 'inli... | StarcoderdataPython |
9626934 | def histogram(s):
d = dict()
for c in s:
d[c] = d.get(c,0) + 1
return d
if __name__ == '__main__':
print histogram('supercalifrigilisticexpialidocious')
| StarcoderdataPython |
195923 | <gh_stars>1000+
# Owner(s): ["oncall: fx"]
import torch
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
from caffe2.torch.fb.fx2trt.tests.test_utils import AccTestCase, InputTensorSpec
class TestBatchNormConverter(AccTestCase):
def test_batchnorm(self):
class TestModule(torch.nn.Module):
... | StarcoderdataPython |
8165367 | <reponame>thebigmunch/google-music-scripts<filename>src/google_music_scripts/cli.py
import argparse
import math
import re
import warnings
from pathlib import Path
from attr import attrib, attrs
from audio_metadata import AudioMetadataWarning
from loguru import logger
from tbm_utils import (
Namespace,
SubcommandHelp... | StarcoderdataPython |
1615217 | import warnings
import pytest
from django.test import TestCase
TestCase.pytestmark = pytest.mark.django_db(transaction=True, reset_sequences=True)
@pytest.fixture(autouse=True)
def suppress_warnings():
warnings.simplefilter("error", Warning)
warnings.filterwarnings(
"ignore",
"name used for... | StarcoderdataPython |
6493546 | <gh_stars>0
from django.contrib.syndication.views import Feed
from academicPhylogeny.models import PhD
class PhDFeed(Feed):
title = "PhD feed"
link = "/feed/"
description = "RSS listing of bioanth PhDs"
def items(self):
return PhD.objects.all()
def item_title(self, item):
return i... | StarcoderdataPython |
3245209 | from pyspark.sql import SparkSession
spark=SparkSession.builder.master("local").appName("SparkandOracledbTest").getOrCreate()
from datetime import datetime
from pyspark.sql.functions import lit
print("Start Reading Data from CSV")
df = spark.read.csv("test.csv", header=True, inferSchema=True)
print("Printing ... | StarcoderdataPython |
1833784 | <filename>integ_identification_deep/train.py
import importlib
try:
importlib.reload(pre_processing)
except:
pass
from pre_processing import pre_process
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neural_network import MLPRegressor
from sklearn.model_selection import train_test_split
import time
#... | StarcoderdataPython |
4829217 | <gh_stars>1-10
import unittest
import solution
class TestQ(unittest.TestCase):
def test_case_0(self):
self.assertEqual(solution.nimbleGame([0, 2, 3, 0, 6]), 'First')
self.assertEqual(solution.nimbleGame([0, 0, 0, 0]), 'Second')
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
8103010 | <reponame>suprajasridhara/scion
# Copyright 2014 ETH Zurich
# Copyright 2018 ETH Zurich, Anapaya Systems
#
# 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/L... | StarcoderdataPython |
11330102 | <filename>work_division.py
#Copyright (C) 2013, <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, modify, merge, pu... | StarcoderdataPython |
1790 | <filename>qstklearn/1knn.py<gh_stars>100-1000
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Feb 20, 2011
@author: <NAME>
@organization: Georgia I... | StarcoderdataPython |
6455626 | import logging.config
import os
import platform
import pip
from subprocess import call
logging.config.fileConfig('logging.conf')
logr = logging.getLogger('pylog')
def main():
logr.info('start')
try:
print_sys_info()
do_pip_update()
except Exception:
logr.exception('... | StarcoderdataPython |
8020784 | <reponame>datalad/datalad-registry
import re
import time
from unittest.mock import patch
import pytest
from datalad_registry.tests.utils import create_and_register_repos, register_dataset
def test_overview_pager(client, tmp_path):
create_and_register_repos(client, tmp_path, 5)
r_overview = client.get("/ove... | StarcoderdataPython |
1603 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | StarcoderdataPython |
4841941 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="python-bufflog",
version="0.1.3",
author="<NAME>",
author_email="<EMAIL>",
description="Python logger for Buffer services",
long_description=long_description,
long_description_cont... | StarcoderdataPython |
8039542 | <reponame>TomVethaak/qiskit-metal
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache... | StarcoderdataPython |
377101 | <gh_stars>0
bin1=input("what kind of fruit do you want?")
if bin1=="apples":
print("apples in bin 1")
elif bin1=="orenges":
print("orenges in bin 2")
elif bin1=="bananas":
print("bananas in bin 3")
else:
print("Error! I dont recognize this fruit!")
| StarcoderdataPython |
1895337 | import hashlib
import json
from itertools import chain
import logging
from typing import List, Optional, Dict, Any, Union
import time
from enum import Enum
import uuid
import boto3 # type: ignore
from bugout.data import BugoutSearchResults, BugoutSearchResult
from bugout.journal import SearchOrder
from ens.utils impo... | StarcoderdataPython |
5019051 | <reponame>bayeslabs/Deepcan
import numpy as np
import pandas as pd
import torch
from torch import distributions
def nan2zero(x):
return torch.where(torch.isnan(x), torch.zeros_like(x), x)
def nan2inf(x):
return torch.where(torch.isnan(x), torch.zeros_like(x)+np.inf, x)
def _nelem(x):
nelem = torch.sum... | StarcoderdataPython |
5096731 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 4 13:37:04 2019
@author: paskali
"""
import os, nrrd, json
import numpy as np
import tensorflow as tf
class DataManager():
def __init__(self, train_folder='data/train', val_folder='data/val',
test_folder='dat... | StarcoderdataPython |
1726558 | <reponame>UnDeR-The-mAsK/lab4<filename>PyCharm/individual2.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
if __name__ == "__main__":
print("Есть ли среди трёх заданных чисел нечётные?")
a1 = int(input("Первое число: "))
a2 = int(input("Второе число: "))
a3 = int(input("Третье число: "))... | StarcoderdataPython |
6558444 | <gh_stars>0
yesterday_seat_assignments = [
"Moses",
"Ashley",
]
today_seat_assignments = [
"Nick",
"Ashley",
]
for seat in range(0,len(yesterday_seat_assignments)):
if yesterday_seat_assignments[seat] == today_seat_assignments[seat]:
print(f"Hey, {yesterday_seat_assignments[seat]} can't sit ... | StarcoderdataPython |
8126318 | import pytest
from celery import current_app
from app import app, db
@pytest.fixture
def test_app():
"""Sets up a test app."""
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
app.config['TESTING'] = True
app.config['WTF_CSRF_ENABLED'] = False
app.config['NO_EMAIL'] = True
app.confi... | StarcoderdataPython |
11385094 | import argparse
import torch
import sys
import os
import json
from collections import defaultdict
import h5py
from sentence_transformers import SentenceTransformer, util
import numpy
import pandas
import tqdm
from itertools import zip_longest
from utils import grouper, load_sentences, load_bnids, load_visualsem_bnids
i... | StarcoderdataPython |
5120634 | # Generated by Django 2.1.1 on 2019-02-18 07:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adventure', '0052_auto_20190215_2228'),
]
operations = [
migrations.AlterField(
model_name='artifact',
name='armor_c... | StarcoderdataPython |
1612187 | from __future__ import annotations
from typing import List
from typing import Union
# TypeAnnotations
Number = Union[int, float]
Values = List[Number]
# Dtypes
uint8 = 'B'
int8 = 'b'
int16 = 'h'
uint16 = 'H'
int32 = 'l'
uint32 = 'L'
int64 = 'q'
uint64 = 'Q'
float32 = 'f'
float64 = 'd'
| StarcoderdataPython |
6576603 | """
Load up rudimentary XLSX file.
worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
Note that Excel files have a space-saving device to reuse formula that are identical from
one cell to another within a region. I saw this in the Fibonacci Example.
<c r="A3">
<f>(A2+1)</f>
<v>1</v>
</c>... | StarcoderdataPython |
105536 | import sys
from typing import Any, Optional, Iterable
from httpie.cookies import HTTPieCookiePolicy
from http import cookiejar # noqa
# Request does not carry the original policy attached to the
# cookie jar, so until it is resolved we change the global cookie
# policy. <https://github.com/psf/requests/issues/5449>
... | StarcoderdataPython |
165858 |
import torch
# tempo imports
from . import compute_cell_posterior
from . import utils
from . import cell_posterior
from . import objective_functions
class ClockGenePosterior(torch.nn.Module):
def __init__(self,gene_param_dict,gene_prior_dict,num_grid_points,clock_indices,use_nb=False,log_mean_log_disp_coef=No... | StarcoderdataPython |
9779816 | # Code to train T3D model
import os
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from keras.callbacks import ModelCheckpoint, EarlyStopping, CSVLogger, \
TensorBoard, LearningRateScheduler
from keras.optimizers import SGD
from keras import losse... | StarcoderdataPython |
3579633 | from datetime import datetime, timezone
instances = {
"Reservations": [
{
"Groups": [{"GroupName": "priv", "GroupId": "sg-0fea0dac"}],
"Instances": [
{
"AmiLaunchIndex": 0,
"ImageId": "ami-b0d57010",
"Instan... | StarcoderdataPython |
1965689 | <filename>src/testers/unittests/test_ast_simplification.py
#!/usr/bin/env python2
# coding: utf-8
"""Testing AST simplification."""
import unittest
from triton import ARCH, TritonContext, CALLBACK, AST_NODE
class TestAstSimplification(unittest.TestCase):
"""Testing AST simplification."""
def setUp(self):
... | StarcoderdataPython |
5199570 | <reponame>Organ-xiangjikeji/---
from django.shortcuts import render, HttpResponse, redirect
from web import models
from django.views.decorators.cache import cache_page
from django.http import JsonResponse
from web.common import utils
from web.common.orm_op import Myquery
from web.common import vcode
from web.common.red... | StarcoderdataPython |
5096441 | <filename>roster/migrations/0007_auto_20170806_0044.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2017-08-06 00:44
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core'... | StarcoderdataPython |
197387 | # -*- coding: utf-8 -*-
from .main import Postie
from .cli import create_parser, main
| StarcoderdataPython |
3241185 | <reponame>MAKENTNU/web<filename>docs/models.py
from ckeditor_uploader.fields import RichTextUploadingField
from django.db import models
from django.utils.translation import gettext_lazy as _
from users.models import User
from .validators import page_title_validator
MAIN_PAGE_TITLE = "Documentation"
class Page(mode... | StarcoderdataPython |
8057872 | from .src import OpendtectColormaps | StarcoderdataPython |
1750453 | <gh_stars>1-10
import json
import os
from pathlib import Path
from eventz.event_store_json_file import EventStoreJsonFile
from eventz.marshall import Marshall, FqnResolver
from eventz.codecs.datetime import Datetime
from tests.conftest import parent_id1
marshall = Marshall(
fqn_resolver=FqnResolver(
fqn_m... | StarcoderdataPython |
4953643 | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import tempfile
from tensorflow.python.ipu.config import IPUConfig
import numpy as np
from functools import partial
import tensorflow.compat.v1 as tf
from tensorflow.python import ipu
from ipu_sparse_ops import sparse, optimizers
import os
os.sys.path.append("..... | StarcoderdataPython |
1756261 | import onnxruntime
import torch
import onnx
import onnxsim
class OnnxBackend:
"""
ONNX后端
"""
def __init__(self):
pass
@staticmethod
def convert(model, imgs, weights, dynamic, simplify):
"""
torch模型转为onnx模型
model: torch模型
imgs: [B,C,H,W]Tensor
... | StarcoderdataPython |
399668 |
# class Myclass:
# i = 1234
# def f(self):
# print(self.i)
# my = Myclass()
# my.f()
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://192.168.127.12:3000/signin')
class LoginPage:
username_id = "name"
passwd_id = "<PASSWORD>"
login_btn_className = "span-p... | StarcoderdataPython |
150136 | from expt import run_expt
expt_param = {'training_frac': 2.0/3.0, 'num_trials': 5, 'verbosity': True, 'num_ticks': 6}
solver_param = {'eta_list': [0.01,0.1,1,10,100,1000], 'num_inner_iter': 10, 'num_outer_iter': 100}
data = raw_input("dataset (abalone/adult/compas/crimes/default/page-blocks): ")
loss = raw_input("los... | StarcoderdataPython |
4872796 | <filename>src/Compiler.py<gh_stars>0
import os
import json
from pprint import pprint
arr = os.listdir('../lib')
combined = ""
for file in arr:
with open('../lib/' + file) as data_file:
data = json.load(data_file)
combined += json.dumps(data)
pprint(data)
writer = open('../chrome/frameworks.js', ... | StarcoderdataPython |
1999790 | <filename>icom_flow_ctrl.py
#!/usr/bin/python
# -*- coding= utf-8 -*-
from icom_ctrl_msg_id import *
class flow_ctrl():
SYNC_MSG_TIMER_ID = 1
DEFAULT_SYNC_MSG_TIMER_LEN = 1
in_flow_ctrl_state = False
current_timer_len = 1
pftimer_func = None
timer_running = False
pfflowctrl_func = None
GUI_STAT... | StarcoderdataPython |
6661432 | import random
import sys
import pkg_resources
import pytest
from req_compile.repos.repository import (
WheelVersionTags,
Candidate,
sort_candidates,
_wheel_candidate,
_impl_major_minor,
_py_version_score,
)
@pytest.mark.parametrize(
"sys_py_version, py_requires",
[
("3.5.0", ... | StarcoderdataPython |
5039002 | <reponame>dylanashley/catastrophic-forgetting
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sklearn.model_selection import StratifiedKFold
import argparse
import numpy as np
import os
import sys
import tensorflow as tf
# parse args
parser = argparse.ArgumentParser(
description='This constructs masks to creat... | StarcoderdataPython |
9713055 | <reponame>HoleCat/echarlosperros<gh_stars>0
# Copyright 2016 Google, 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 ... | StarcoderdataPython |
6510533 | <filename>pymatgen/analysis/structure_analyzer.py
#!/usr/bin/env python
"""
This module provides classes to perform topological analyses of structures.
"""
from __future__ import division
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "<NAME... | StarcoderdataPython |
3517216 | #!/usr/bin/env python
"""
Author: <NAME>
Purpose: A simple Flask app that manages vlan configuration on network device.
"""
from flask import abort, jsonify, make_response, request
from sqlalchemy.exc import IntegrityError
from database import db, app, Vlans, update_vlans_db
from configurator.provider import manage
... | StarcoderdataPython |
6562224 | import os
import time
def acquire_lock(db_path: str):
lock_path = db_path + '.lock'
while True:
if not os.path.exists(lock_path):
open(lock_path, 'a').close()
break
else:
time.sleep(0.0001)
def release_lock(db_path: str):
lock_path = db_path + '.lock'
... | StarcoderdataPython |
12800143 | import click
from terran.face import face_detection
from terran.io import open_video, write_video
from terran.vis import vis_faces
@click.command(name='find-video')
@click.argument('video-path')
@click.argument('output-path')
@click.option('--threshold', type=float, default=0.5)
@click.option('--batch-size', default... | StarcoderdataPython |
1806121 | from rest_framework import viewsets, permissions
from .models import Article, Tag
from .serializers import ArticleSerializer, TagSerializer
class ArticleViewSet(viewsets.ModelViewSet):
serializer_class = ArticleSerializer
permission_classes = [permissions.IsAuthenticated]
def get_queryset(self):
... | StarcoderdataPython |
41593 | from usefull import read_db
def test_read_csv_db_simple():
'''
page msg parent choice end
1 1. Mi sembra che 0 False False
2 ...se ti trovassi 1 True False
'''
assert read_db('db_simple.csv')[0]['page'] == 1
assert read_db('db_simple.csv')[0]['msg'][-3:] == ... | StarcoderdataPython |
3365001 | <reponame>HugoYZ/panel.residentes.proyectos
# Generated by Django 3.0.2 on 2020-02-06 22:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('banco_proyectos', '0005_datosresidente_usuario'),
]
operations = [
migrations.RemoveField(
m... | StarcoderdataPython |
3468838 | """
lab7
"""
#3.1
i = 0
while i <=5:
if i != 3:
print(i)
i += 1
#3.2
i = 5
result = 1
while 0 < i <= 5:
result *= i
i -= 1
print(result)
#3.3
i = 1
result = 0
while 1 <= i <= 5:
result += i
i += 1
print(result)
#3.4
i = 3
result = 1
while 3 <= i <= 8:
resu... | StarcoderdataPython |
6550222 | # MIT License
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP.
#
# customApplianceTags : Custom Appliance Tags
def get_custom_appliance_tags(
self,
ne_id: str,
cached: bool,
) -> dict:
"""Get user-defined appliance tags
.. list-table::
:header-rows: 1
* - Swagger S... | StarcoderdataPython |
3489736 | from .analytics import cluster, cluster_spatial, ModelResults, predict_labels
from .dynamics import sequence, transition
from .incs import linc
__all__ = ['linc', 'sequence', 'transition', 'cluster', 'cluster_spatial']
| StarcoderdataPython |
3497548 | <reponame>patrickhart/jaxdl
"""Temperature functions"""
from typing import Tuple, Any
import functools
import jax
import numpy as np
from jaxdl.utils.commons import InfoDict, TrainState
@functools.partial(jax.jit)
def update_temperature(temperature_net: TrainState, entropy: float,
target_entropy: float) -> Tuple... | StarcoderdataPython |
8005631 | #%%
import tensorflow as tf
import tensorflow_hub as hub
import umap
from tqdm import tqdm
#%%
class Embedding:
def __init__(self, model) -> None:
self.model = model
@classmethod
def create_from_hub(cls,
model_path="https://tfhub.dev/google/imagenet/efficientnet_v2_imagenet1k_m/feature_v... | StarcoderdataPython |
9679209 | #!/usr/bin/python
import Skype4Py
import sys
import json
import os
def on_message(message, status):
if status == Skype4Py.cmsReceived:
json_string = json.dumps({
'user': message.Sender.Handle,
'message': message.Body,
'room': message.Chat.Name,
})
sys.std... | StarcoderdataPython |
3530694 | #!/usr/bin/env python3
"""
Merges several csv files (the first file serves as base)
Assumes that they have the same set of columns,
but the columns do not have to be in the same order
"""
import csv
import sys
def main():
if len(sys.argv) < 3:
print("Wrong number of arguments: specify at least two files ... | StarcoderdataPython |
306941 | from .constants import COLOR, ANNOTATIONS, TYPE
from .struct.hetnet import HetNet
from .struct.multihetnet import MultiHetNet
__all__ = ['HetNet', 'MultiHetNet', 'hgnc', 'mi', 'up']
__version__ = '0.1.0'
__title__ = 'hetnetana'
__description__ = 'A Python package for integrating data and performing topological footp... | StarcoderdataPython |
12823077 | import struct
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from fido2.attestation import Attestation
from fido2.ctap2 import CTAP2, CredentialManagement
from fido2.hid import CTAPHID
from fido2.utils import hmac_sha256
from fido2.webauthn import PublicKeyCredentialCreationOpti... | StarcoderdataPython |
1728533 | from typing import List
from pydantic import BaseModel
from aos_sw_api.globel_models import CollectionResult, MacAddress
class MacTableEntry(BaseModel):
mac_address: str
vlan_id: int
port_id: str
class MacTableEntryList(BaseModel):
collection_result: CollectionResult
mac_table_entry_element: L... | StarcoderdataPython |
4894664 | from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_element_located
class Wait:
def __init__(self, driver, time=20):
self.__wait = WebDriverWait(driver, time)
self.__driver = driv... | StarcoderdataPython |
4851703 | <reponame>Enkya/ims_beta
from flask import request, jsonify, g, url_for
from flask_restplus import abort, Resource, fields, Namespace, marshal_with
from flask_restplus import marshal
from sqlalchemy import desc
from app.models.company import Company
from app.models.employee import Employee
from app.models.uniqueId impo... | StarcoderdataPython |
1846489 | from django.contrib import admin
from django import forms
from django.forms.models import BaseInlineFormSet
from .models import Doctor, Patient, Order, OrderType, OrderStatus, OrderColor, OrderTypeEntry
# Register your models here.
"""
class OrderTypeEntryInline(admin.StackedInline):
model = OrderTypeEnt... | StarcoderdataPython |
8076463 | from enum import Enum, auto
class Types(Enum):
UNIT = auto()
BOOL = auto()
INT = auto()
SYMB = auto()
VOID = auto()
FUNC = auto()
class Sym:
def __init__(self, val):
self.val = val
def __str__(self):
return self.val
class Helper:
def type_from_value(self, value... | StarcoderdataPython |
4849284 | <reponame>CharaD7/azure-sdk-for-python<filename>unreleased/azure-mgmt-machinelearning/azure/mgmt/machinelearning/models/module_asset_parameter.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the M... | StarcoderdataPython |
3584167 |
'''
Dual output E3648A 0-8V / 0-20V 2.5A
http://cp.literature.agilent.com/litweb/pdf/E3646-90001.pdf
'''
import time
import sys
import datetime
import serial
class Timeout(Exception):
pass
def now():
return datetime.datetime.utcnow().isoformat()
def dbg(s):
if 0:
print 'GPIO %s: %s' % (now(), s... | StarcoderdataPython |
4887375 | <reponame>antonsuba/ids-test-environment-sdn<filename>test_cases/__init__.py
#!/usr/bin/python
from os.path import dirname, basename, isfile
import glob
EXCLUDE = ['__init__.py', 'test_case.py']
MODULES = glob.glob(dirname(__file__) + '/*.py')
__all__ = [basename(f)[:-3] for f in MODULES if isfile(f) and basename(f)... | StarcoderdataPython |
1911844 | # <NAME>
# CSC 110
# Fall 2015
def getChoice():
# Displays all of the possible functions to the user
# and asks the user for their choice. This is done until the
# correct input is entered in by the user (i.e. an integer
# beteen 1 - 8)
print("")
print(" Please specify your search criteria so ... | StarcoderdataPython |
20942 | <reponame>willogy-team/insights--tensorflow<gh_stars>0
import os
import argparse
import numpy as np
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.models import Model
from tensorflow.keras.preprocessing.image import load_img, img_to_array
import matplotlib.pyplot as plt
fro... | StarcoderdataPython |
6646064 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Functions for dealing with the Stagger model photospheres. """
from __future__ import division, absolute_import, print_function
__author__ = "<NAME> <<EMAIL>>"
import logging
import numpy as np
from .interpolator import BaseInterpolator
logger = log... | StarcoderdataPython |
5139748 | <filename>tutorial.py<gh_stars>0
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
import pandas as pd
import random
import time
bucket = "WattTest"
client = InfluxDBClient(url="http://localhost:8086", token="<KEY> , org="4d4e5bd125ac30b2")
write_api = client.... | StarcoderdataPython |
9772473 | <reponame>subramp-prep/leetcode
import heapq
class Solution(object):
def kthSmallest(self, matrix, k):
return list(heapq.merge(*matrix))[k-1] | StarcoderdataPython |
6644241 | <reponame>pi-top/pi-top-Python-SDK
from pitop import Camera, DriveController, Pitop
from pitop.labs import WebController
robot = Pitop()
robot.add_component(DriveController())
robot.add_component(Camera())
speed = 0.2
def key_down(data, send):
global speed
key = data.get("key")
if key == "w":
r... | StarcoderdataPython |
155107 | # -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved
"""Tests using pytest_resilient_circuits"""
from __future__ import print_function
from fn_aws_utilities.util.aws_sns_api import AwsSns
class TestSendSmsViaSns:
""" Tests for th... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.