id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8091196
"""render sample comand line tool. This is invoked interally by ``two4two.blender.render``. """ import json import os from pathlib import Path import sys import bpy # the two4two package is not visible for the blender python. # we therfore add the package directory to the path. blend_dir = os.path.dirname(bpy.data...
StarcoderdataPython
6635275
<reponame>hldh214/libcloud # 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 "...
StarcoderdataPython
3323754
<reponame>yoonjieun/blender import bpy class RemoveDuplicateMaterial(bpy.types.Operator): ''' replace material with 3 characters at the end to material without number ex) 'material.001' --> 'material' 'material.099' --> 'material' ''' bl_idname = "lazypic.remove_duplicate_material" b...
StarcoderdataPython
9678262
# Copyright 2021 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-2.0 # # Unless required by applicable law or agreed to...
StarcoderdataPython
1687502
import sys import pathlib from .Group import Group from .Zn import Zn from .Zn_coprime import Zn_coprime from .Klein4 import Klein4 from .Sn import Sn from .Element import Element from .order import O # Import helpers module sys.path.insert(1, pathlib.Path(__file__).parent.absolute().__str__() + '/helpers') from di...
StarcoderdataPython
1676165
<filename>server/the_water_project/tags/models.py from django.db import models class Tag(models.Model): name = models.CharField(max_length=25) # FIXME: Should I made the "name" field unique? def __str__(self): return self.name
StarcoderdataPython
3224680
# # Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. # import re import socket from cfgm_common import PERMS_RX from vnc_api.gen.resource_common import VirtualDns from vnc_cfg_api_server.resources._resource_base import ResourceMixin class VirtualDnsServer(ResourceMixin, VirtualDns): @classmethod ...
StarcoderdataPython
5172056
""" Methods used to convert/handle raw input data """ import os import json import h5py import numpy as np import csv import execnet def init_obj_catalogue(path_to_data): obj_dict = {} subfols = sorted(os.listdir(os.path.join(path_to_data, 'test-item-data'))) known_classes = sorted(os.listdir(os.path.joi...
StarcoderdataPython
8122606
from __future__ import unicode_literals from pepper.framework import AbstractComponent, AbstractBackend from pepper.framework.component import ContextComponent, TextToSpeechComponent, SpeechRecognitionComponent from pepper.language import Utterance from pepper import config import urllib import re from threading imp...
StarcoderdataPython
6462999
import os.path as osp from setuptools import find_packages, setup requirements = ["h5py==2.10.0", "matplotlib==3.3.4", "munch==2.5.0", "open3d==0.9.0", "PyYAML==5.3.1"] setup( name="vrcnet", version="1.0.0", author="paul007pl", packages=find_packages(), install_requires=requirements, )
StarcoderdataPython
358734
<filename>pyplus/autotest/__init__.py from .manager import Manager def add(*args, **kwargs): return Manager().add(*args, **kwargs)
StarcoderdataPython
6665107
<reponame>arthurdarcet/motor<filename>motor/core.py<gh_stars>1-10 # Copyright 2011-present MongoDB, 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/LIC...
StarcoderdataPython
87919
<filename>inference/run_inference.py import gc import os from typing import List import numpy as np import tifffile import torch from torch import nn from torch.utils.data import Dataset, DataLoader from tqdm import tqdm from inference.tiling import Tiler, TileSlice from training.val_dataset import normalize_band c...
StarcoderdataPython
1841048
<filename>waitlist/blueprints/xup/submission.py import logging from datetime import datetime from flask import request, flash, redirect, url_for, render_template, abort from flask_login import current_user, login_required import re from waitlist.blueprints.api.fittings.self import self_remove_fit from waitlist.data.n...
StarcoderdataPython
6675224
<gh_stars>0 # -*- coding: utf-8 -*- # Coded by <NAME> # 2020-12-13 # IDE: Jupyter Notebook def F(a, b): if a == 1: return 1 elif a > 10: while a > 10: aStr = str(a) aLen = len(aStr) a = a - pow(10, aLen - 1) if a == 0 and b != 0: return 10 ...
StarcoderdataPython
11361416
<filename>modules/2.79/bpy/types/NodeSocketVectorAcceleration.py<gh_stars>0 NodeSocketVectorAcceleration.links = None
StarcoderdataPython
11283852
<reponame>hide-dog/kaggle_titanic # ------------------------------------------------ # import # ------------------------------------------------ import re # ------------------------------------------------ # read file # ------------------------------------------------ def rewrite_train_file(inf, of): # read file ...
StarcoderdataPython
3588203
raise ImportError("AWS Cognito can be configured via GenericOAuthenticator")
StarcoderdataPython
1678891
import os import re import shutil import datetime import jinja2 _template_pattern = re.compile(r"^.*(\.t)\.[^\.]+$") def default_template_arguments(): return {"now":datetime.datetime.now()} def apply_template_dir(src_dir, dest_dir, template_params, filter_name=None): # print(f"D {src_dir} -> {dest_dir}") ...
StarcoderdataPython
9788340
<reponame>HumbleRetreat/meru from unittest.mock import create_autospec import pytest from meru.handlers import handle_action, register_action_handler @pytest.mark.asyncio async def test_dont_handle_unknown_action(dummy_action): with pytest.raises(StopAsyncIteration): await handle_action(dummy_action())._...
StarcoderdataPython
12824304
import inspect import pytest from sqlalchemy.exc import ArgumentError from sqlalchemy.ext.declarative import declared_attr def test_name(db): class FOOBar(db.Model): id = db.Column(db.Integer, primary_key=True) class BazBar(db.Model): id = db.Column(db.Integer, primary_key=True) class H...
StarcoderdataPython
296527
from actstream.models import Follow from rest_framework import serializers from grandchallenge.notifications.models import Notification class NotificationSerializer(serializers.ModelSerializer): class Meta: model = Notification fields = ("read",) class FollowSerializer(serializers.M...
StarcoderdataPython
6528899
<reponame>darwinbeing/deepdriving-tensorflow<filename>python/modules/deep_learning/trainer/__init__.py from .CFactory import CFactory from .CTrainer import CTrainer
StarcoderdataPython
9611644
from Clusters.models import ClusterDetails from Clusters.serializers import ClusterDetailsSerializer from django.http import JsonResponse from django.shortcuts import render from rest_framework import viewsets from rest_framework.generics import GenericAPIView def index(request): return render(request, 'index.htm...
StarcoderdataPython
6571513
<filename>apps/utils/management/commands/introspect.py<gh_stars>0 from django.core.management.base import AppCommand from django.db.models import get_models from django.db.models.fields.related import OneToOneField, ForeignKey class Command(AppCommand): help = "Generate search template with all fields for each mo...
StarcoderdataPython
6588241
#integer right triangles """" If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. {20,48,52}, {24,45,51}, {30,40,50} For which value of p ≤ 1000, is the number of solutions maximised? """"" import math, time def gcd(a, b): while ...
StarcoderdataPython
1972555
"""Ampio data models.""" from __future__ import annotations import base64 from collections import defaultdict import datetime as dt from enum import Enum, IntEnum import logging from typing import Any, Callable, Dict, List, Optional, Union import attr from homeassistant.const import ( CONF_DEVICE, CONF_DEVIC...
StarcoderdataPython
3486389
import bs4 from urllib.request import urlopen #import datetime as dt import pandas as pd import re import json import sqlite3 con = sqlite3.connect('db/fsdb01.db3') class Price2DB: def get_daily_price_naver(self, cd, count): url = 'https://fchart.stock.naver.com/sise.nhn?symbol='+cd+'&timeframe=day...
StarcoderdataPython
9715647
from django.db import models from django.urls import reverse # Create your models here. class Funcionario(models.Model): nome = models.CharField(max_length=25) sobrenome = models.CharField(max_length=25) cargo = models.CharField(max_length=25) email = models.CharField(max_length=30) mostrar = model...
StarcoderdataPython
9745456
import collections import itertools import jinja2 import json import nbformat import pathlib import shutil import sys import tempfile import tqdm from nbconvert import HTMLExporter, PDFExporter ROOT = "cfm" TITLE = "Computing for mathematics" DESCRIPTION = "An undergraduate course introducing programming, through Pyt...
StarcoderdataPython
11326595
<filename>book2vec/core.py import numpy as np import json from typing import List, Union from sklearn.metrics.pairwise import cosine_similarity import pandas as pd import logging logger = logging.getLogger(__name__) class Book2VecAnalysis: def __init__(self, file_obj=None): self.loaded = False se...
StarcoderdataPython
4958293
import hashlib h = hashlib.new('ripemd160') h.update(input().encode('utf-8')) print(h.hexdigest())
StarcoderdataPython
1911898
# Copyright (C) 2009 The MITRE Corporation. See the toplevel # file LICENSE for license terms. # XML reader/writer. from MAT.DocumentIO import declareDocumentIO, DocumentFileIO, SaveError from MAT.Document import LoadError from MAT.Annotation import AnnotationAttributeType, StringAttributeType, FloatAttributeType, \ ...
StarcoderdataPython
220328
#!/usr/bin/env python __author__ = '<NAME>' import argparse from RouToolPa.Routines import DrawingRoutines parser = argparse.ArgumentParser() parser.add_argument("-i", "--input_file", action="store", dest="input_file", help="Input file with data") parser.add_argument("-o", "--output_prefix", act...
StarcoderdataPython
6640196
import re import pandas as pd from bs4 import BeautifulSoup import mechanize data = pd.read_csv('goodreads_bestsellers.csv') for rownum, row in data.iterrows(): print row['url'] br = mechanize.Browser() r = br.open(row['url']) soup = BeautifulSoup(r.read(), 'html.parser') pages = soup.find(itemprop="numberOfPage...
StarcoderdataPython
3523852
# coding: utf-8 # app: mesa de atención # module: forms # date: jueves, 14 de junio de 2018 - 08:56 # description: Formulario para la bitácora de ciudadanos rechazados en mac # pylint: disable=W0613,R0201,R0903 from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Submi...
StarcoderdataPython
8068255
# python3 construct.py 0 8 & # python3 construct.py 1 8 & # python3 construct.py 2 8 & # python3 construct.py 3 8 & # python3 construct.py 4 8 & # python3 construct.py 5 8 & # python3 construct.py 6 8 & # python3 construct.py 7 8 & import os import sys import numpy as np import pandas as pd import matplotlib.pyplot a...
StarcoderdataPython
8141609
import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt from sklearn import preprocessing matplotlib.use("Agg") import datetime import torch from finrl.config import config from finrl.marketdata.yahoodownloader import YahooDownloader from finrl.preprocessing.preprocessors import Featu...
StarcoderdataPython
6524467
<filename>eduFaucet_config-EXAMPLE.py # Common config for EduFaucet VERSION = '1.0' GITHUB = 'https://github.com/bitcoinedu-io/EduFaucet' DBFILE = 'eduFaucet-db.sqlite3' rpc_user = 'BTE' rpc_pass = '<PASSWORD>' URL = 'http://%s:%s@localhost:8908' % (rpc_user, rpc_pass) chaininfo = { 'name': 'EduFaucet', 'un...
StarcoderdataPython
12828774
# Github : https://github.com/adarsh2104 # HR-Profile: https://www.hackerrank.com/adarsh_2104 # Challenge : https://www.hackerrank.com/challenges/s10-quartiles # Max Score : 30 def find_median(array): if len(array) % 2 == 1: return array[len(array) // 2] else: return (array[len(array)...
StarcoderdataPython
1608778
<reponame>renjunxiang/enjoy_myself import pandas as pd import os import numpy as np # DIR = os.path.dirname(__file__) DIR = 'D:\\github\\enjoy_myself\\crawler\\crawler_story' data = np.load(DIR + '/data/' + '女频言情.npy') data = pd.DataFrame(data, columns=['title', 'url', 'author', 'size', ...
StarcoderdataPython
295137
<gh_stars>1-10 import os cur_dir = os.path.dirname(__file__) eosio_token_abi = None with open(os.path.join(cur_dir, 'data/eosio.token.abi'), 'r') as f: eosio_token_abi = f.read() with open(os.path.join(cur_dir, 'data/eosio.system_eosio.abi'), 'r') as f: eosio_system_abi_eosio = f.read() with open(os.path.jo...
StarcoderdataPython
1713307
from mxnet import nd from mxnet.gluon import nn from models.pointnet_globalfeat import PointNetfeat_vanilla class PointNetDenseCls(nn.Block): def __init__(self, num_points=2500, k=2, routing=None): super(PointNetDenseCls, self).__init__() self.num_points = num_points self.k = k sel...
StarcoderdataPython
1880392
from flask import render_template, jsonify from werkzeug.exceptions import HTTPException from backend.restplus import api from backend.ws.devices import ns as devices_namespace def ndb_wsgi_middleware(wsgi_app, client): def middleware(environ, start_response): with client.context(): return wsg...
StarcoderdataPython
79075
<filename>mavenn/__init__.py """MAVE-NN software package.""" # The functions imported here are the ONLY "maven.xxx()" functions that # users are expected to interact with # To regularize log calculations import numpy as np TINY = np.sqrt(np.finfo(np.float32).tiny) # Primary model class from mavenn.src.model import Mo...
StarcoderdataPython
9695869
""" This file is part of pybacnet. pybacnet is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. pybacnet is distributed in the hope that it wil...
StarcoderdataPython
9752742
# Write a program that reads a string and returns a table of the letters of the alphabet in alphabetical order # which occur in the string together with the number of times each letter occurs. # Case should be ignored. def lettercount(s): tally = {} s = s.lower() for letter in s: if not letter.isa...
StarcoderdataPython
5151944
<gh_stars>0 from copy import deepcopy from typing import List, Union, Optional, Tuple, Dict from fedot.core.dag.graph import Graph from fedot.core.dag.graph_operator import GraphOperator from fedot.core.pipelines.node import Node, PrimaryNode, SecondaryNode from fedot.core.pipelines.pipeline import Pipeline class Pi...
StarcoderdataPython
12819916
<gh_stars>10-100 import json import os import time import sys import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F from dataset import prepare_dataset from experiments.utils import construct_passport_kwargs_from_dict from models.alexnet_passport_private import AlexN...
StarcoderdataPython
5010111
# -*- coding: utf-8 -*- # Импорт библиотек import logging import os.path import sys import time import click import pandas as pd from datetime import datetime, timedelta from terminaltables import AsciiTable sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from cointrader import db, STRATEGIES from coint...
StarcoderdataPython
110388
<gh_stars>100-1000 """An implementation of the Python Database API Specification v2.0 using Teradata ODBC.""" # The MIT License (MIT) # # Copyright (c) 2015 by Teradata # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software...
StarcoderdataPython
1727044
from pathlib import Path import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import ScriptedLoadableModule, ScriptedLoadableModuleWidget from slicer.util import VTKObservationMixin from EPISURGBase import EPISURGBaseLogic # pylint: disable=import-error EPISURG_URL = 'https://s3-eu-west-1.amazonaws.com/ps...
StarcoderdataPython
11280173
<filename>app_sme12/forms.py from django import forms from django.forms import ModelForm from app_backend.models import Province, Amphur, Tumbol, BusinessModel, BusinessGroup, BusinessType from app_sme12.models import Employment, Revenue, AuthorizeCapital, ProfitPrevious, Promote, FormSiteVisit, FormInterview class R...
StarcoderdataPython
172541
"""Initialize cms app""" default_app_config = "cms.apps.CMSConfig"
StarcoderdataPython
143662
<filename>PSCP/analysis-scripts/tossconfigurationsFunc.py # -*- coding: utf-8 -*- """ Created on Tue Jul 7 10:17:49 2015 @author: nps5kd """ from __future__ import print_function import sys import optparse import numpy as np import math import matplotlib # for making plots, version 'matplotlib-1.1.0-1'; errors may p...
StarcoderdataPython
8110247
<filename>directives.py # Define a new directive `code-block` (aliased as `sourcecode`) that uses the # `pygments` source highlighter to render code in color. # # Incorporates code from the `Pygments`_ documentation for `Using Pygments in # ReST documents`_ and `Octopress`_. # # .. _Pygments: http://pygments.org/ # .. ...
StarcoderdataPython
4895142
<gh_stars>0 import re import numpy as np import networkx as nx from shapely.geometry.polygon import LinearRing import drawSvg as draw #some helper functions def normal_length1(vector, side): """Normal vector which points usually outside of the molecule""" unit_vector = vector/np.linalg.norm(...
StarcoderdataPython
3313574
# -*- coding: utf-8 -*- """ lantz.drivers.newport.fsm300 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Implementation of FSM300 using NI DAQ controller Author: <NAME> Date: 9/27/2016 """ from lantz import Driver from lantz.driver import Feat, DictFeat, Action from lantz.drivers.ni.daqmx import AnalogOutputTask, V...
StarcoderdataPython
11290418
<filename>CurationEngine/src/createNewEventRule.py import traceback import os import json import logging import boto3 import botocore from boto3.dynamodb.types import TypeDeserializer logger = logging.getLogger() class CreateNewEventRuleException(Exception): pass # Subclass of boto's TypeDeserializer for DynamoDB ...
StarcoderdataPython
6562089
print("Hello World") print("My name is <NAME>.") print("Testing") print(" /|") print(" / |") print(" / |") print("/___|") age = ("14") print("My name is <NAME> and I'm " + age + "-years-old.") name = ("<NAME>") print("I'm " + name + " and I live in California") location = ("California") year = ("2005") print("I...
StarcoderdataPython
348517
<filename>gcal_notifier/main.py #!/usr/bin/env python from datetime import datetime from typing import Any, Dict, Tuple from gcal_notifier.cli import cli from gcal_notifier.config_reader import init_config from gcal_notifier.event_getter import SimpleGCalendarGetter from gcal_notifier.event_loader import load_saved_ev...
StarcoderdataPython
11324685
<reponame>danielsnider/ecosystem-project-website-template import logging import socket from skyline.io.connection import Connection, ConnectionState from skyline.exceptions import NoConnectionError logger = logging.getLogger(__name__) class ConnectionManager: def __init__(self, message_handler, closed_handler):...
StarcoderdataPython
391840
<reponame>logic-and-learning-lab/Popper-experiments import json import inspect class ExperimentResult: def __init__(self, problem_name, system_name, trial, solution, total_exec_time, conf_matrix, extra_stats): self.problem_name = problem_name self.system_name = system_name self.trial = trial...
StarcoderdataPython
170399
import json import logging import os from unittest import mock from elastic.cobalt_strike_extractor.extractor import CSBeaconExtractor logger = logging.getLogger() def test_transform_beacon(shared_datadir): with mock.patch.dict( os.environ, { "INPUT_ELASTICSEARCH_ENABLED": "False", ...
StarcoderdataPython
6542315
<reponame>Mithzyl/Master-college-selecting-api<gh_stars>0 # Generated by Django 3.1.5 on 2021-02-05 12:14 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Colleges', ...
StarcoderdataPython
4942850
<reponame>hughpyle/GW-BASIC<filename>conv/z80conv/conv.py<gh_stars>10-100 #!/usr/bin/python # Copyright (c) 2020 <NAME> <<EMAIL>> # Licensed under GPLv2. import sys import traceback from .lexer import Lexer from .parser import Parser from .transformer import Transformer from .writer import PasmoWriter def main(): ...
StarcoderdataPython
8120412
from django.db import models from django.db.models import DO_NOTHING from django.urls import reverse from apps.courses.models import Course, LessonScript from apps.users.models import Student, Teacher # Archwizacja grupy? # from django.core.exceptions import ValidationError class Group(models.Model): teacher = ...
StarcoderdataPython
8054278
n1 = int(input('Digite um número para calcular o fatorial dele:\n')) c = n1 mult = 1 while c > 0: print('{}'.format(c), end='') mult = mult * c c -= 1 print('x' if c >= 1 else '=', end='') print(mult)
StarcoderdataPython
6406549
from flask import render_template, request import os import nltk import re import pandas as pd import numpy as np import csv from sentipt.sentipt import SentimentIntensityAnalyzer import plotly.express as px def init_app(app): @app.route("/process") def result(): training_set = [] with op...
StarcoderdataPython
8033752
<filename>chatette/modifiers/__init__.py """ Module `chatette.modifiers` Contains everything that is related to modifiers (at the moment only their representation and not generation behavior). """
StarcoderdataPython
8124454
<filename>mundo-1/usando-modulos/ex018.py from math import sin, cos, tan, radians ang = int(input('Insira um ângulo aqui: ')) print('Funções trigonométricas resultantes', end=' --> ') print('Seno: {:.2f}, cosseno: {:.2f} e tangente {:.2f}'.format(sin(radians(ang)), cos(radians(ang)), tan(radians(ang))))
StarcoderdataPython
9675052
def foo(a, b): return a - b + 2 * 42
StarcoderdataPython
9694986
#! /usr/bin/env python3 # Copyright (C) 2017 <NAME>. All Rights Reserved. import unittest from pyparsing import * def get_grammar(debug=False): grammar = Forward() identifier = Word( alphas ) bools = Word("false").setParseAction(lambda s,l,t: False) \ | Word("true").setParseAction(lambda s,l,t: True)...
StarcoderdataPython
1966810
<filename>ccut/tests/dimension_test.py from ..main.dimension import DimensionVector def test(): assert DimensionVector().set_dimensions("M1.1").raise_to_power(2).get_abbr() == 'M2.2' assert DimensionVector().set_dimensions("M1.1 L-1.2").raise_to_power(2).get_abbr() == 'M2.2 L-2.4' assert DimensionVector()....
StarcoderdataPython
1912517
"""Sample script to demonstrate usage of the DataAcquisitionClient.""" def main(): """Creates a sample client that reads data from a TCP server (see demo/server.py). Data is written to a rawdata.csv file, as well as a buffer.db sqlite3 database. These files are written in whichever directory the scrip...
StarcoderdataPython
6564178
<gh_stars>0 from django.conf import settings from django_pgpy.defaults import get_default_restorers DJANGO_PGPY_DEFAULT_RESTORERS = getattr(settings, 'DJANGO_PGPY_DEFAULT_RESTORERS', get_default_restorers) DJANGO_PGPY_AES_KEY_LENGTH = 32 DJANGO_PGPY_RSA_KEY_LENGTH = 2048
StarcoderdataPython
93679
<reponame>elwoodxblues/saleor<gh_stars>1000+ # -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-06 10:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("account", "0008_auto_20161115_1011")] replaces = [(...
StarcoderdataPython
9758319
x = [int(i) for i in input().split()] if x[0] % x[1] == 0 or x[1] % x[0] == 0: print("Sao Multiplos") else: print("Nao sao Multiplos")
StarcoderdataPython
11288887
<reponame>carlio/pep8 #: E401 import os, sys #: Okay import os import sys from subprocess import Popen, PIPE from myclass import MyClass from foo.bar.yourclass import YourClass import myclass import foo.bar.yourclass #: E402 __all__ = ['abc'] import foo #: Okay try: import foo except: pass else: print('...
StarcoderdataPython
3491014
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
StarcoderdataPython
281550
<reponame>Nova-Noir/novabot_v2 from nonebot import get_driver global_config = get_driver().config # nickname: str = list(global_config.nickname)[-1] # Yet this will return a randomly one. nickname: str = "伊蕾娜"
StarcoderdataPython
1972267
from datek_jaipur.domain.compound_types.goods import GoodsType from datek_jaipur.errors import EventValidationError class GoodsBoughtValidationError(EventValidationError): pass class TooMuchCardsInHandError(GoodsBoughtValidationError): pass class CardNotOnDeckError(GoodsBoughtValidationError): def __i...
StarcoderdataPython
3285979
<gh_stars>1-10 """Rest API for Demo.""" from chalice import Chalice from chalice import Response from demo_dao import DemoDao from util.logger_utility import LoggerUtility APP = Chalice(app_name='ramit-test') APP.debug = True @APP.route('/info', methods=['POST']) def info(): """Info on user.""" # Set log le...
StarcoderdataPython
4928948
import logging from multiprocessing import Manager import pytest from tx.readable_log import getLogger, format_message from tx.parallex.objectstore import PlasmaStore, SimpleStore logger = getLogger(__name__, logging.INFO) @pytest.fixture def manager(): with Manager() as manager: yield manager @p...
StarcoderdataPython
3332082
from github import Github import argparse import os import requests import json import re from difflib import get_close_matches from urllib.parse import urlparse def setup_args(): parser = argparse.ArgumentParser() parser.add_argument("--token", help="A GitHub token for the repo") return parser.parse_arg...
StarcoderdataPython
9658639
<gh_stars>10-100 # Copyright (c) 2012-2015 Netforce Co. Ltd. # # 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, mo...
StarcoderdataPython
5194504
import numpy as np from scipy.signal import stft SOUND_SPEED = 340 # [m/s] # Steering vectors def compute_steering_vectors_single_frequency(array_geometry, frequency, theta_grid, phi_grid): # wave number k = 2*np.pi*frequency/SOUND_SPEED n_mics = len(array_geometry[0]) theta_grid = theta_grid * np.pi/1...
StarcoderdataPython
5189612
<reponame>kloper/pato # -*- python -*- """@file @brief I2C-serial transport for pato Copyright (c) 2014-2015 <NAME> <<EMAIL>>. All rights reserved. @page License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistr...
StarcoderdataPython
11245112
<filename>chapter2/2_1_2.py # Calculating the classification result using sample dataset import kNN if __name__ == "__main__": group, labels = kNN.createDataSet() print(group) print(labels) result = kNN.classify0([0, 0], group, labels, 3) print(result)
StarcoderdataPython
3264786
<reponame>kiteco/intellij-plugin from definition import myFunction <caret>myFunction()
StarcoderdataPython
8063079
#!/bin/python3 # Our first python module from gpiozero import Robot import time robby = Robot(left=(7,8), right=(9,10)) robby.backward() time.sleep(20) robby.stop()
StarcoderdataPython
109704
# A simple simulator for SHA+XRAM from mmio import mmiodev, NOP, RD, WR import sha as SHAFunc def as_chars(s, n): b = [] for i in xrange(n): byte = s & 0xff s >>= 8 b.append(byte) return [chr(i) for i in b] def to_num(s, n): num = 0 for i in xrange(n): num |= (ord(s...
StarcoderdataPython
4979343
# Copyright 2021 Seek Thermal Inc. # # Original author: <NAME> <<EMAIL>> # # 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 requir...
StarcoderdataPython
205661
<gh_stars>1-10 import cv2 import depthai import numpy as np _conf_threshold = 0.5 def get_cv_rotated_rect(bbox, angle): x0, y0, x1, y1 = bbox width = abs(x0 - x1) height = abs(y0 - y1) x = x0 + width * 0.5 y = y0 + height * 0.5 return ((x, y), (width, height), np.rad2deg(angle)) def rotated_R...
StarcoderdataPython
3213723
#!/usr/bin/env python # -*- coding: utf-8 -*- # filename = __init__ # author=KGerring # date = 4/15/21 # project poetryproj # docs root """ poetryproj """ from __future__ import annotations import os import sys __all__ = [] __all__ = sorted( [ getattr(v, "__name__", k) for k, v in list(globa...
StarcoderdataPython
5023143
#!/usr/bin/env python """ Unit test suite for the betr regression test manager """ from __future__ import print_function import logging import os import sys import unittest if sys.version_info[0] == 2: # pragma: no coverage from ConfigParser import SafeConfigParser as config_parser else: from configparser i...
StarcoderdataPython
6598196
<filename>devilry/apps/core/devilry_core_mommy_factories.py<gh_stars>0 from django.conf import settings from model_mommy import mommy def examiner(group=None, shortname=None, fullname=None, automatic_anonymous_id=None): """ Creates an Examiner using ``mommy.make('core.Examiner', ...)``. Args: gro...
StarcoderdataPython
246874
def convert2meter(s, input_unit="in"): ''' Function to convert inches, feet and cubic feet to meters and cubic meters ''' if input_unit == "in": return s*0.0254 elif input_unit == "ft": return s*0.3048 elif input_unit == "cft": return s*0.0283168 else: print(...
StarcoderdataPython
9717025
# This file is part of QuTiP: Quantum Toolbox in Python. # # Copyright (c) 2011 and later, <NAME> and <NAME>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistribut...
StarcoderdataPython
11348996
## # File: testGitUtils.py # Author: jdw # Date: 18-Jul-2021 # # Updates: # ## """ Test utilities """ __docformat__ = "google en" __author__ = "<NAME>" __email__ = "<EMAIL>" __license__ = "Apache 2.0" import os.path import time import random import string import unittest import logging # from rcsb.utils.io im...
StarcoderdataPython