id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1830714 | from flask import request
from flask import Blueprint
from .models.task import Task
from .responses import response
from .responses import not_found
from .responses import bad_request
from .schemas import task_schema
from .schemas import tasks_schema
from .schemas import params_task_schema
# endpoint handling
api_v1... | StarcoderdataPython |
1996678 | # Create a vocabulary wrapper
import numpy as np
import nltk
import pickle
from collections import Counter
from cocoapi.pycoco.pycocotools.coco import COCO
import json
import argparse
import os
import codecs
annotations = {
'coco': ['annotations/captions_train2014.json'
'annotations/captions_val2014.j... | StarcoderdataPython |
6665064 | <reponame>u8sand/FAIRshake<filename>app/entities/FAIRshakeWeb/view.py
import re
import json
from injector import singleton
from flask import Flask, render_template, request, redirect
from flask_oidc import OpenIDConnect
from ...interfaces.Repository import RepositoryAPI, DigitalObjectModel
from ...interfaces.Assessment... | StarcoderdataPython |
1813082 | from .type_check import TypeCheckError, type_check
from .types import Function
from typing import Type
from functools import wraps
from inspect import isfunction
def inherit(*args,errors=(NotImplementedError)):
"""A decorator which automatically wraps the underlying function and instead calls a parent class
Th... | StarcoderdataPython |
4844936 | <filename>other/unterm-generator.py<gh_stars>1000+
"""Demonstrated an error garbage collecting an h5py object at Python shutdown
https://github.com/h5py/h5py/issues/1495
"""
import h5py
def yield_groups(filename):
with h5py.File(filename, 'r') as fh:
for group in fh:
yield group
filename = "... | StarcoderdataPython |
8000179 | <filename>lookahead.py
import itertools as it
from torch.optim import Optimizer
"""
# https://github.com/lonePatient/lookahead_pytorch
from optimizer import Lookahead
base_optimizer = optim.Adam(model.parameters(), lr=0.001)
optimizer = Lookahead(base_optimizer=base_optimizer, k=5, alpha=0.5)
"""
class Lookahead(Opti... | StarcoderdataPython |
1604768 | <reponame>thomasaarholt/plato
import numpy as np
from ... import draw, geometry, mesh
from .internal import PolygonRenderer
class Spheropolygons(draw.Spheropolygons, PolygonRenderer):
__doc__ = draw.Spheropolygons.__doc__
def _get_path(self):
corner_vertices = geometry.insetPolygon(self.vertices, -se... | StarcoderdataPython |
3451033 | # Generated by Django 2.2.9 on 2019-12-28 19:25
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('showcase', '0024_item_title'),
]
operations = [
migrations.AlterField(
model_name='item',
... | StarcoderdataPython |
50994 | """Compiler
This module exports a single function
complile(source_code_string, output_type)
The second argument tells the compiler what to produce. It must be one of:
tokens the token sequence
ast the abstract syntax tree
analyzed the semantically analyzed representation
optimized ... | StarcoderdataPython |
8076690 | <filename>python/examples/strandfill.py
#!/usr/bin/env python3
# NeoPixel library strandtest example
# Author: <NAME> (<EMAIL>)
# Forked: <NAME> (<EMAIL>)
#
# Direct port of the Arduino NeoPixel library strandtest example. Showcases
# various animations on a strip of NeoPixels.
import time
from neopixel import *
impo... | StarcoderdataPython |
5088707 | <reponame>jwang45/biosuite
#!/usr/bin/env python3
'''
This version of KmerFinder only allows for 1 or 2 input files, though the options for more exist.
If two files are given as input, it will check the filenames to see if they are the same to infer
if these are paired end/mate paired. If filenames differ, it exits wi... | StarcoderdataPython |
3279718 | """
Genetic algorithm to identify good location for services.
Score_matrix:
0: Number of hospitals
1: Average distance
2: Maximum distance
3: Maximum admissions to any one hospital
4: Minimum admissions to any one hospital
5: Proportion patients within target time/distance
6: Proportion pat... | StarcoderdataPython |
223481 | <reponame>michaelwalkerfl/littlefish
"""
Contains field validation functions
"""
import logging
import re
__author__ = '<NAME> (Little Fish Solutions LTD)'
log = logging.getLogger(__name__)
email_regex = re.compile('^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z.]+$', flags=re.IGNORECASE)
telephone_regex = re.compile('^\+?\d+(\... | StarcoderdataPython |
91504 | <gh_stars>1-10
from pathlib import Path
import subprocess
import sys
import platform
import os
WIN = platform.system() == "Windows"
# this is patched in by setup_cmake_args.patch
PATCH_ENV_VAR = "DLIB_CMAKE_ARGS"
def install():
""" populate the environment variable added by the patch and actually
instal... | StarcoderdataPython |
4814242 | from unittest import TestCase
import toil.crypto.symmetric
class TestSymmetricEncryptor(TestCase):
def test_generate_key(self):
encryptor = toil.crypto.symmetric.SymmetricEncryptor({})
encryptor.generate_key("/Users/aclove/testkey.dat")
# encryptor.generate_iv()
# ... | StarcoderdataPython |
3595750 | def get_total_count(metric_list):
from FileParsers.Parser import Parser
import re
parser = Parser(" ")
drc_tot_numb = 0
metric_name = 0
metric_value = 1
for metric_pair in metric_list:
if metric_pair is not None:
drc_error_found = re.search(r'^(drc_drcd \(NB\)|drc_trclvs... | StarcoderdataPython |
3371219 |
import sys
import tensorflow as tf
from tqdm import tqdm
from tfnlu.utils.logger import logger
from tfnlu.utils.tfnlu_model import TFNLUModel
from tfnlu.utils.config import MAX_LENGTH, DEFAULT_BATCH_SIZE
from .get_tags import get_tags
from .tagger_model import TaggerModel
from .tagger_pointer_model import TaggerPoin... | StarcoderdataPython |
5183400 | # encoding: utf-8
# nocoding: interpy "string interpolation #{like ruby}"
# encoding=utf8
import io
import math
import sys
import inspect
import re
import os
import numpy as np
from random import randint
from random import random as _random
import shutil
py2 = sys.version < '3'
py3 = sys.version >= '3'
true = True
fa... | StarcoderdataPython |
34929 | <reponame>HarshCasper/mars
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | StarcoderdataPython |
8128949 | # pylint:disable=line-too-long
"""
The tool to check the availability or syntax of domains, IPv4, IPv6 or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ ████... | StarcoderdataPython |
8018824 | import ciscoconfparse
from ciscoconfparse import CiscoConfParse
cisco_input = CiscoConfParse('cisco_ipsec.txt')
cisco_crypto2 = cisco_input.find_objects_w_child(parentspec = r"^crypto map CRYPTO", childspec = r"pfs group2")
#print type (cisco_crypto2)
for i in cisco_crypto2:
print i.text
for child in i.childr... | StarcoderdataPython |
109306 | #
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
# 6. Trademarks. T... | StarcoderdataPython |
6519666 | <filename>athena/federation/models.py
from uuid import uuid4
from athena.federation.utils import AthenaSDKUtils
import pyarrow as pa
# https://github.com/awslabs/aws-athena-query-federation/blob/master/athena-federation-sdk/src/main/java/com/amazonaws/athena/connector/lambda/handlers/FederationCapabilities.java#L33
... | StarcoderdataPython |
1665142 | from argparse import ArgumentParser
parser = ArgumentParser(description='디피-헬만 키 생성 프로그램')
parser.add_argument('--nbytes', required=True, type=int)
from key import SecretKey, generate_private_key, generate_public_key, generate_secret_key
import key
from Crypto.Cipher import DES
def encrypt_DES(text: str, key: SecretK... | StarcoderdataPython |
1782254 | from django.db import models
class User(models.Model):
""" User data model description for Django internal object-relational maper.
NB:
- an id field is automatically added to the data model.
- all fields but address are mandatory.
- email should be unique: only one user with... | StarcoderdataPython |
8158027 | <filename>spec/test_cbw_api.py
"""Test file for cbw_api.py"""
from cbw_api_toolbox.cbw_api import CBWApi
from cbw_api_toolbox.cbw_objects.cbw_server import CBWServer
from cbw_api_toolbox.cbw_objects.cbw_remote_access import CBWRemoteAccess
import vcr # pylint: disable=import-error
import pytest # pylint: disable=im... | StarcoderdataPython |
9744067 | <reponame>tusikalanse/acm-icpc
from math import *
n = int(input())
k = int(input())
lst = []
for i in range(n):
l = float(input())
lst.append(l)
l, r = 0, max(lst)
for _ in range(1000):
mid = (l + r) / 2
cnt = 0
for i in lst:
cnt += floor(i / mid)
if cnt >= k:
l = mid
else:
r = mid
print("%.2f" % (int(l * ... | StarcoderdataPython |
4836805 | from __future__ import division
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.decomposition import PCA
from sklearn.metrics import roc_auc_score, roc_curve
from keras.models import Sequential, model_from_json, lo... | StarcoderdataPython |
9724532 | <reponame>sharkbig/StrainTool
#! /usr/bin/python
#-*- coding: utf-8 -*-
from __future__ import print_function
from math import floor, degrees, radians, pi, sin, cos, tan
from pystrain.geodesy.ellipsoid import Ellipsoid
def dd2dms(dd):
''' Decimal degrees to hexicondal degrees.
Args:
d... | StarcoderdataPython |
3470665 | <filename>dxfmaps/names.py<gh_stars>0
spanish_comunities = [
"Castilla y leon, Spain",
"Andalucia, Spain",
"Castilla la mancha, Spain",
"Aragon, Spain",
"Extremadura, Spain",
"Cataluna, Spain",
"Galicia, Spain",
"Comunidad valenciana, Spain",
"Region de murcia, Spain",
"Principad... | StarcoderdataPython |
1716748 | from aper import app
from flask_login import login_required, current_user
from flask import jsonify, request
from .models import User
from .db import db_session
import datetime
@app.route('/')
@login_required
def index():
return 'Hello {}!'.format(current_user.name)
@app.route('/users', methods=['GET'])
@login_... | StarcoderdataPython |
1786345 | import Tree
t1=Tree.Tree()
t1.insereRaiz('A')
t1.insereRaiz('Z')
t1.insereDireita('B')
t1.insereEsquerda('C')
t1.insereNaEsquerdaDaDireita('C')
t1.insereNaDireitaDaEsquerda('E')
print("\n_______Busca_____")
| StarcoderdataPython |
11386051 | # -*- coding: utf-8 -*-
import os
import fuel
from fuel.streams import DataStream
from fuel.schemes import SequentialScheme, ShuffledScheme
from fuel.downloaders.base import default_downloader
########## UTILS
# cache this incase we load multiple datasets
initial_fuel_config_path = fuel.config.data_path
# helper cl... | StarcoderdataPython |
5110197 | #! /usr/bin env python
# coding:utf-8
import json
import sys, getopt
import threading
import requests
import espider.Config as Config
import time
import espider.Utils as Utils
from espider.app.huawei.HuaweiException import HuaweiException
from espider.app.huawei.HuaweiLogic import HuaweiLogic
from espider.Spider import... | StarcoderdataPython |
5069623 | import os.path
from enum import Enum
import sys
__all__ = ['get_tokens']
with open("../documentation/tokenize-doc.txt", "r") as DOC_FILE:
__doc__ = DOC_FILE.read()
class TOKEN(Enum):
ID = 0
STRING = 1 # "" or ''
UNDERSCORE = 3 # _
LPAREN = 100 # (
RPAREN = 101 # )
LBRACKET = 102 ... | StarcoderdataPython |
1891602 | from attrdict import AttrDict
from . import dbkey, status
def new_slot(username, value=None):
rec = {'name': dbkey.new_keyname(username),
'value': {'body': value,
'status': status.CREATED}}
return AttrDict(rec)
| StarcoderdataPython |
5088100 | <reponame>jgagneastro/banyan_sigma
"""
View the README.md file for a full description of this code and how to use it.
"""
#Import the necessary packages
import numpy as np #Numpy maths
from scipy.special import erfc
import os #Access to environment variables
import pandas as pd #Pandas dataframes will be used to store... | StarcoderdataPython |
1741839 | <reponame>pinjutien/gan
import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow_gan.examples.cyclegan import data_provider as cyclegan_dp
import numpy as np
AUTOTUNE = tf.data.experimental.AUTOTUNE
def load_data(input_file_pattern):
list_ds = tf.data.Dataset.list_files(input_file_pattern)
re... | StarcoderdataPython |
3509414 | <gh_stars>0
import dash
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output
import joblib
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.LUX])
app.layout = dbc.Container([
dbc.Row(
... | StarcoderdataPython |
3341318 | """Add missing constraints
Revision ID: 39a96e67e990
Revises: <PASSWORD>
Create Date: 2016-01-26 13:18:06.113621
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
# Add missing projects table keystone_id u... | StarcoderdataPython |
6625626 | from __future__ import print_function
from __future__ import absolute_import
from builtins import input
from past.builtins import basestring
from builtins import object
import os
import cv2
import numpy as np
from RRtoolbox.lib.arrayops import contours2mask, findContours
from RRtoolbox.lib.cache import MemoizedDict... | StarcoderdataPython |
1629932 | <gh_stars>1-10
#!/usr/bin/env python3
# coding: utf-8
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | StarcoderdataPython |
11243862 | <filename>Python Basics using Libraries/regexp.py
import re
data="""Anshu is 19 years old, Deepak is 40 years old, Sheeran is 20 years old,
Georgia is 33 years old"""
ages=re.findall(r'\d{1,3}',data)
names=re.findall(r'[A-Z][a-z]*',data)
print(ages)
print(names)
| StarcoderdataPython |
1936580 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-09-24 11:49
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import taiga.projects.settings.choices
class Migration(migrations.Mi... | StarcoderdataPython |
6635523 | <filename>filecompare/utils/__init__.py
# This is empty on purpose
| StarcoderdataPython |
53628 | """Class to dynamically create the different forms in the config file
"""
import os
from wtforms import (
BooleanField, SelectField, StringField, FloatField, IntegerField,
FormField, TextAreaField, FieldList, DecimalField
)
from wtforms.validators import InputRequired, Optional, NumberRange, \
ValidationEr... | StarcoderdataPython |
298340 | <reponame>yzbxTools/you-get
#!/usr/bin/env python
import unittest
import os, sys
_srcdir = '%s/src/' % os.path.dirname(os.path.realpath(__file__))
_filepath = os.path.dirname(sys.argv[0])
sys.path.insert(1, os.path.join(_filepath, _srcdir))
sys.path.insert(1, os.path.abspath('src/'))
from you_get.extractors import (... | StarcoderdataPython |
1977020 | class UnigramLabeler(object):
"""
Labeler that operates on each token separately
"""
def __init__(self, dict_vect, label_encoder, model):
self._dict_vect = dict_vect
self._label_encoder = label_encoder
self._model = model
def predict(self, list_of_token_features):
... | StarcoderdataPython |
4929586 | from pyramid.exceptions import NotFound
from pyramid.renderers import get_renderer
from pyramid.view import view_config
from aamm import Manager
import config
class AAMMViews(object):
def __init__(self, request):
self.request = request
renderer = get_renderer("templates/layout.pt")
self.la... | StarcoderdataPython |
6668425 | # -*- coding: utf-8 -*-
"""
Classical and waste-free SMC samplers.
Overview
========
This module implements SMC samplers, that is, SMC algorithms that may sample
from a sequence of arbitrary probability distributions (and approximate their
normalising constants). Applications include sequential and non-sequential
B... | StarcoderdataPython |
6659008 | # Copyright 2019 TerraPower, 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 or agreed to in writi... | StarcoderdataPython |
3507609 | """
# balances of wallets within single block
ctc eth balances <wallets> [--block <block>]
# balance of single wallet across multiple blocks
ctc eth balances <wallet> [--blocks <block>]
"""
from __future__ import annotations
import typing
import toolcli
from ctc import evm
from ctc import spec
from ctc.cli import ... | StarcoderdataPython |
8086310 | <filename>tarea2/Tarea2-09.py
import math
c0=1
c1=0
c2=-0.5
c3=0
c4=0.0416666
n0=0
n1=0.00001
n2=0.0001
n3=0.0001
n4=0.001
n5=0.01
n6=0.1
n7=1
n8=10
ap1=c0
ap2=c0+c1*n0
ap3=c0+c1*n0+c2*(n0**2)
ap4=c0+c1*n0+c2*(n0**2)+c3*(n0**2)
ap5=c0+c1*n0+c2*(n0**2)+c3*(n0**2)+c4*(n0**2)
apr1=c0
apr2=c0+c1*n1
apr3=c0+c1*n1+c2*(n1... | StarcoderdataPython |
12826318 | #!/usr/bin/python
import json
import os
import re
import shutil
import sys
import time
__author__ = '<NAME>'
ALFRESCO_PATH = '/opt/alfresco'
ALFRESCO_GLOBAL_BAK = ALFRESCO_PATH + '/alf_data/alfresco-global.properties.bak'
ALFRESCO_LDAP_BAK = ALFRESCO_PATH + '/alf_data/ldap-authentication.properties.bak'
class Servic... | StarcoderdataPython |
11220130 | import pytest
from conftest import prostate_data
from autorad.data.dataset import ImageDataset
from autorad.feature_extraction.extractor import FeatureExtractor
@pytest.fixture
def image_dataset(small_paths_df):
image_dataset = ImageDataset(
df=small_paths_df,
image_colname="img",
mask_co... | StarcoderdataPython |
11222920 | # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import sys
import os
from util import run, root_path
from third_party import tp, google_env
def download_prebuilt(sha1_file):
run([
"python",
tp('depot_tools/download_from_google_storage.py'),
'--platform=' + sys.pla... | StarcoderdataPython |
8120221 | """Perform re-evaluation on one or more datasets."""
import argparse
import cv2
import os
import pprint
import sys
import time
from six.moves import cPickle as pickle
import torch
import _init_paths # pylint: disable=unused-import
from core.config import cfg, merge_cfg_from_file, merge_cfg_from_list, assert_and_inf... | StarcoderdataPython |
1719106 | import json
from common.api.spreadsheet import Spreadsheet, Worksheet, Cell
from common.databases.spreadsheets.players_spreadsheet import PlayersSpreadsheet
from common.databases.spreadsheets.schedules_spreadsheet import SchedulesSpreadsheet
SPREADSHEET_RESOURCES_DIR = "test/resources/spreadsheets/"
class Sp... | StarcoderdataPython |
5040071 | #!/usr/bin/env python
# file: merge_cmake_install.py
import sys, math
import fnmatch
import os
import shutil
if len(sys.argv) != 2:
# stop the program and print an error message
sys.exit("Must provide a cmake binary folder")
base_folder = sys.argv[1]
string_to_remove_debug = "IF(\"${CMAKE_INSTALL_CONFIG_NAME}\"... | StarcoderdataPython |
207479 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet._sigchld}, an alternate, superior SIGCHLD
monitoring API.
"""
import errno
import os
import signal
from twisted.python.log import msg
from twisted.python.runtime import platformType
from twisted.trial.unittest i... | StarcoderdataPython |
83546 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from .generator import token_to_vec, token_to_file
__all__ = [
"token_to_vec",
"token_to_file",
]
| StarcoderdataPython |
11380630 | # Generated by Django 1.9.5 on 2017-09-25 20:43
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0008_auto_20160802_1511'),
]
operations = [
migrations.AddField(
model_name='site'... | StarcoderdataPython |
6665376 | <reponame>TekhneVision/tekv_Analyzer
'''
Created on Jan 16, 2018
@author: jerime.cortes.dev
'''
import dataFileUtil
import trainingAnalyzer as trainingA
def createNonCompliantMissingDatesReport(dataSetId):
dataSet = dataFileUtil.getFileData(dataSetId, 'file')
result = trainingA.identifyMissingDate... | StarcoderdataPython |
3394673 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from numpy import pi
class Angle(object):
"""
TODO
"""
def __init__(self, degrees):
self._degrees = degrees
@staticmethod
def radian_to_degree(radian):
return radian * (180.0 / pi)
@staticmethod
def radian_to_arcmin(radi... | StarcoderdataPython |
8007115 | <reponame>tdb-alcorn/q2
from .objective import Objective
from typing import Union
import tensorflow as tf
class Passthrough(Objective):
def step(self, sess:tf.Session, state, action, reward:Union[float, None]=None) -> float:
return reward
def reset(self):
pass | StarcoderdataPython |
5147119 | <reponame>o2e/Triton<filename>src/examples/python/ctf-writeups/securityfest-2016-fairlight/solve.py
#!/usr/bin/env python3
## -*- coding: utf-8 -*-
##
## <NAME> - 2020-04-26
##
##
## Output:
##
## $ time python3 ./solve.py
## [+] Loading 0x400040 - 0x400238
## [+] Loading 0x400238 - 0x400254
## [+] Loading 0x4000... | StarcoderdataPython |
6522075 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from hwt.interfaces.utils import addClkRstn
from hwt.simulator.simTestCase import SingleUnitSimTestCase
from hwtLib.logic.oneHotToBin import OneHotToBin
from hwtSimApi.constants import CLK_PERIOD
class OneHotToBinSimWrap(OneHotToBin):
d... | StarcoderdataPython |
5022677 | '''
@author: l4zyc0d3r
People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt
'''
class Solution:
def fourSum(self, N: List[int], t: int) -> List[List[int]]:
N.sort()
st= []
for i,x in enumerate(N):
if i != 0 and N[i-1]==N[i]: #Similar value Move... | StarcoderdataPython |
1843925 | from math import pow
peso = float(input('Qual é o seu peso? (kg): '))
altura = float(input('Qual é a sua altura? (m): '))
#A elevação por 2 pode ser feita assim também (altura ** 2)
imc = peso / pow(altura, 2)
print('O seu IMC é de {:.2f}'.format(imc))
if imc < 18.5:
print('Você está abaixo do peso')
elif imc <... | StarcoderdataPython |
20630 | import os
import re
import sys
from setuptools import setup, find_packages
from typing import Optional, Tuple
SETUP_DIR = os.path.dirname(os.path.realpath(__file__))
POLYTRACKER_HEADER = os.path.join(SETUP_DIR, 'polytracker', 'include', 'polytracker', 'polytracker.h')
if not os.path.exists(POLYTRACKER_HEADER):
sy... | StarcoderdataPython |
6487557 | import numpy as np
from time import sleep
def spherical_inclusion(outfile, r_inner=100, r_outer=10000, length_factor=0.05):
"""
Creates a spherical bulk mesh with a centered spherical inclusion.
Args:
outfile(str): File path to save mesh file (add .msh ending)
r_inner(float): Radius o... | StarcoderdataPython |
1899880 | <filename>prplatform/exercises/tests/test_models.py
from django.test import TestCase
from django.utils import timezone
from django.contrib.auth.models import AnonymousUser
from prplatform.exercises.models import SubmissionExercise, ReviewExercise
from prplatform.exercises.deviation_models import SubmissionExerciseDevi... | StarcoderdataPython |
11248351 | # code that should run on RPi
DEBUG = True
def RPi_code ():
from gpiozero import LED, Button
from time import sleep
led = LED(17)
def testpins():
if DEBUG:
print ('value LED', led.value)
def button_pressed():
print("button pressed!")
led2.toggle()... | StarcoderdataPython |
5166674 | import socket
import os
from nmeaserver import formatter
import time
import threading
from datetime import datetime, date
import logging
import signal
logger = logging.getLogger(__name__)
signal.signal(signal.SIGINT, signal.SIG_DFL)
# global pinger object 'ping' holds pinger state
class Pinger(threading.Thread):
... | StarcoderdataPython |
6514135 | <reponame>reevespaul/firebird-qa
#coding:utf-8
#
# id: functional.gtcs.dsql_domain_01
# title: GTCS/tests/DSQL_DOMAIN_01. Test the level 0 syntax for SQL create domain defining only the datatype.
# decription:
# Original test see in:
# https://github.com/Firebird... | StarcoderdataPython |
9696486 | <gh_stars>0
from pathlib import Path
PACKAGE_PATH = Path(__file__).resolve().parent
DATASET_PATH = PACKAGE_PATH.parent / 'datasets' | StarcoderdataPython |
12802994 | #!/usr/bin/env python
# Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Script for checking impact of a change by comparing the sizes of generated
# classes ... | StarcoderdataPython |
6491200 | <gh_stars>1-10
# coding: utf-8
# python
from HTMLParser import HTMLParser
# django
from django.conf import settings
from django.utils.translation import ugettext as _
# Import settings and logging
import logging.config
logging.config.dictConfig(settings.LOGGING)
logger = logging.getLogger(__name__)
... | StarcoderdataPython |
8080816 | from pathlib import Path
import shutil
from qcpump.pumps.base import BOOLEAN, DIRECTORY, MULTCHOICE, STRING, BasePump
class SimpleFileMover(BasePump):
DISPLAY_NAME = "FileMover: Simple"
HELP_URL = "https://qcpump.readthedocs.io/en/stable/pumps/filemover.html"
CONFIG = [
{
'name': '... | StarcoderdataPython |
11201880 | # pyGestalt Mechanics Module
"""A set of objects and methods for defining, analyzing, and utilizing mechanisms."""
#---- INCLUDES ----
import math
from pygestalt import errors, units, utilities, geometry
class transformer(object):
"""Base class for all types that transform from one state to another.
M... | StarcoderdataPython |
6652239 | <gh_stars>1-10
'''
Curso de creación de GUIs con Qt5 y Python
Author: <NAME>
Website: pybonacci.org
Licencia: MIT
'''
import os
os.environ['QT_API'] = 'pyside2'
import sys
from pathlib import Path
from qtpy.QtWidgets import QApplication, QWidget
from qtpy.QtGui import QIcon
if __name__ == '__main__':
ruta... | StarcoderdataPython |
5002413 | from pathlib import Path
from dataclasses import dataclass, field
from statistics import median
T1_ANS = 26397
T2_ANS = 288957
@dataclass
class Navigation:
raw: str
incomplete: bool = field(default=None, repr=False)
invalid: str = field(default=None, repr=False)
def __post_init__(self):
sel... | StarcoderdataPython |
6483494 | import pyaf.Bench.TS_datasets as tsds
import pyaf.Bench.Artificial as art
import warnings
H = 2;
with warnings.catch_warnings():
warnings.simplefilter("error")
tester1 = art.cArtificial_Tester(tsds.load_artificial_datsets("S") , "ARTIFICIAL_S");
# lSignal = list(tester1.mTSSpecPerSignal.keys())[0];
... | StarcoderdataPython |
5125565 | class UserStatus:
USERSTATUSTYPE_UNKNOWN = 0
USERSTATUSTYPE_UNSET = 1
USERSTATUSTYPE_AWAY = 2
USERSTATUSTYPE_DONOTDISTURB = 3
USERSTATUSTYPE_INVISIBLE = 4
USERSTATUSTYPE_BUSY = 5 | StarcoderdataPython |
3432937 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Simple Neural Network example with Keras on top of Tensor Flow.
Python 2.7 was necessary because of an issue with Tensor Flow and Python 3.6.
"""
from __future__ import print_function
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import matplotlib.pypl... | StarcoderdataPython |
6149 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2019 Open End AB
#
# 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 appl... | StarcoderdataPython |
4952405 | <filename>compmech/stiffener/__init__.py
r"""
==============================================================================
Semi-analytical models for Stiffeners (:mod:`compmech.stiffener`)
==============================================================================
.. currentmodule:: compmech.stiffener
This modul... | StarcoderdataPython |
8170912 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | StarcoderdataPython |
1996366 | <gh_stars>1-10
import re
class Particle:
def __init__(self, number, position, velocity, acceleration):
self.number = number
self.position = position
self.velocity = velocity
self.acceleration = acceleration
self.destroyed = False
def move(self):
for i in range(... | StarcoderdataPython |
6667757 | from nanome._internal._util._serializers import _ArraySerializer
from nanome._internal._ui._serialization import _LayoutNodeSerializer, _UIBaseSerializer, _MenuSerializer
from nanome._internal._util._serializers import _TypeSerializer
class _UpdateMenu(_TypeSerializer):
def __init__(self):
self.menu = _Me... | StarcoderdataPython |
12842264 | import ferramentas_usuarios as fe
class Produto:
codigo = fe.gera_codigo()
def __init__(self, data_ger, prazo_ent, inicio_pro, final_proc, inicio_cont, final_cont):
"""Cria um banco de dados baseado em um arquivo TXT"""
self.data_geracao = data_ger
self.prazo_entrega = prazo_ent
... | StarcoderdataPython |
9692808 | from time import time
import numpy as np
from constants import *
from math import atan2, degrees, hypot, inf
from utils import rotate
import loglib
############################################### Log Config ###########################################################
size2=loglib.size2()
a_m_p2=loglib.a_m_p2()... | StarcoderdataPython |
104242 | """ String representation for various data objects
"""
from collections import OrderedDict as odict
import numpy as np
import json
import dimarray as da
from dimarray.config import get_option
def str_attrs(meta, indent=4):
return "\n".join([" "*indent+"{}: {}".format(key, repr(meta[key])) for key in meta.keys()])... | StarcoderdataPython |
5091157 | <gh_stars>0
# api.py
import flask
from flask_cors import CORS, cross_origin
from app.database import getRecords, newRecord
app = flask.Flask(__name__)
app.config["DEBUG"] = True
app.config['CORS_HEADERS'] = 'Content-Type'
CORS(app)
@app.route('/records', methods=['get'])
@cross_origin()
def GetRecords():
return... | StarcoderdataPython |
1749757 | from django.apps import AppConfig
class AiChatConfig(AppConfig):
name = 'ai_chat'
| StarcoderdataPython |
5172938 | import unittest
import urllib.request
import numpy as np
import xarray as xr
from xcube.core.dsio import open_cube
SKIP_HELP = ('Skipped, because server is not running:'
' $ xcube serve --verbose -c examples/serve/demo/config.yml')
SERVER_URL = 'http://localhost:8080'
ENDPOINT_URL = SERVER_URL + '/s3buc... | StarcoderdataPython |
1823474 | nodes['nc.v22016124049440903'] = {
'hostname': 'v22016124049440903.goodsrv.de',
'groups': {
'ubuntu-bionic',
},
'metadata': {
'golang': {
'enabled': True,
'arch': 'amd64',
'version': '1.15.6',
'os': 'linux',
},
'iptables': {... | StarcoderdataPython |
1713295 | <gh_stars>1-10
# Copyright 2019-2021 Canaan Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
12828186 | import argparse
import csv
import logging
import math
import time
from datetime import datetime
from pathlib import Path
from statistics import mean, stdev
import numpy as np
import fem
from feat import mesh
def main():
# argument parser creation and setup
desc = (
"Complete an RVE analysis for the ... | StarcoderdataPython |
225862 | <filename>app/utils.py
# encoding: utf-8
import json
from app import redis
import elasticsearch
from elasticsearch import helpers
import requests
from flask import current_app
# 从redis获取所有的ansible资产硬件数据
def get_device_data_from_redis():
prefix = current_app.config.get("ES_KEY_PREFIX", "zeus_cmdb_device_info:")
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.