id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6575821
import time import os import glob import re from json.decoder import JSONDecodeError from rotkehlchen.exchange import data_up_todate from rotkehlchen.kraken import kraken_to_world_pair from rotkehlchen.bittrex import trade_from_bittrex from rotkehlchen.bitmex import trade_from_bitmex from rotkehlchen.binance import tr...
StarcoderdataPython
3265610
<reponame>osthafen/spruned from typing import Dict from spruned.daemon.bitcoin_p2p import utils from spruned.daemon.bitcoin_p2p.p2p_connection import P2PConnectionPool from spruned.daemon.bitcoin_p2p.p2p_interface import P2PInterface def build(network: Dict): assert isinstance(network, dict), network pool = ...
StarcoderdataPython
3487563
<filename>old/dronekit-python/dronekit/util.py<gh_stars>0 from __future__ import print_function import sys def errprinter(*args): logger(*args) def logger(*args): print(*args, file=sys.stderr) sys.stderr.flush()
StarcoderdataPython
3371168
import json from requests import post,get import time from PIL import Image, ImageChops import io state = [] data = [] url = 'https://data.mongodb-api.com/app/xmastree-lpeci/endpoint/lights' def brightest_point(image): # Find the brightest pixel max_brightness = 0 x, y = 0, 0 for i in range(image.si...
StarcoderdataPython
1702291
import matplotlib.pyplot as plt import numpy as np import pathlib import f16 import casadi as ca import pytest from casadi.tools.graph import graph import os TRIM_TOL = 1e-5 def plot_table2D(title, path, x_grid, y_grid, x_label, y_label, f_table): X, Y = np.meshgrid(x_grid, y_grid) Z = np.zeros((len(x_grid)...
StarcoderdataPython
1643171
<reponame>eshatro/warehouse from typing import List from .article import Article class Product: def __init__( self, name: str, articles: List[Article], price: float = None, possible_quantity: int = None, ): self.name = name self.price = price se...
StarcoderdataPython
3399620
<reponame>doitintl/elastic-event-store<gh_stars>10-100 import pytest import uuid from unittest import TestCase from tests.integration.api_test_client import ApiTestClient @pytest.mark.slow class TestFetchingEvents(TestCase): api = None def setUp(self) -> None: self.api = self.api or ApiTestClient() ...
StarcoderdataPython
5062048
import logging import unittest from riboplot import ribocore, riboplot, ribocount # use testing configuration CFG = ribocount.CONFIG = riboplot.config.TestingConfig() logging.disable(logging.CRITICAL) class RiboCountTestCase(unittest.TestCase): def test_unrelated_fasta_file(self): """If an unrelated fa...
StarcoderdataPython
3595367
<reponame>enricobacis/bigstack import sys as _sys import types as _types import functools as _functools import threading as _threading import multiprocessing.pool as _mpool _k = (2 ** 10) _M = (2 ** 10) * _k _G = (2 ** 10) * _M _lock = _threading.Lock() def bigstack(*args, **kwargs): '''Decorator that increases ...
StarcoderdataPython
6700307
<filename>pooling/settings/__init__.py import os from .base import * # you need to set "DJANGO_SETTINGS_MODULE = 'prod'" as an environment variable # in your OS (on which your website is hosted) if os.environ['DJANGO_SETTINGS_MODULE'] == 'prod': from .prod import * elif os.environ['DJANGO_SETTINGS_MODULE'] == 'stag...
StarcoderdataPython
182189
<reponame>IASA-SA-2020/normalize # -*- coding: utf-8 -*- from __future__ import absolute_import from konlpy import utils import os class CorpusLoader(): """Loader for corpora. For a complete list of corpora available in KoNLPy, refer to :ref:`corpora`. .. code-block:: python >>> from konlpy...
StarcoderdataPython
11325250
<reponame>tina300399/torchgeometry<gh_stars>0 from typing import Tuple, Optional import torch import torch.nn.functional as F from torchgeometry.core.conversions import deg2rad from torchgeometry.core.homography_warper import homography_warp __all__ = [ "warp_perspective", "warp_affine", "get_perspectiv...
StarcoderdataPython
5050065
from django.urls import reverse from seahub.test_utils import BaseTestCase class ConvertCmmtDescLinkTest(BaseTestCase): def setUp(self): self.login_as(self.user) def test_can_render(self): pass # resp = self.client.get(reverse('convert_cmmt_desc_link') + '?repo_id=' + self.repo.id + '...
StarcoderdataPython
49924
from .client import SocketClient from .server import ( SocketServer, SocketServerHandler, )
StarcoderdataPython
197669
<filename>cvv/methods/grades.py<gh_stars>0 """grades""" from datetime import datetime import numpy as np from requests import get from lxml import html from ..data_types import Grade class Grades: """grades parsing class""" def __init__(self, cvv): self.cvv = cvv if not self.cvv.grades: ...
StarcoderdataPython
6505783
<reponame>ecdavis/pants<gh_stars>10-100 ############################################################################### # # Copyright 2011-2012 Pants Developers (see AUTHORS.txt) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
StarcoderdataPython
1834119
# Copyright (c) 2017 <NAME> """ from https://github.com/keithito/tacotron """ from . import cleaners def _clean_text(text, cleaner_names, *args): for name in cleaner_names: cleaner = getattr(cleaners, name) if not cleaner: raise Exception('Unknown cleaner: %s' % name) text = cl...
StarcoderdataPython
6544342
<filename>parse.py # <NAME>, Rutgers University # Created on 30 June 2019 # Modified on 2 July 2019 # This simple scripts reads all emoji counts from emojitracker and saves # them into a csv file. Simply save emojitracker.com as a html file and # pass the file name to this parser. # # How to run: python parse.py # # Re...
StarcoderdataPython
3548288
# Blueprint for admin page with PR management from tv import login_manager, db, config, app import os import uuid from datetime import datetime, timedelta from flask_login import LoginManager, current_user, login_user, logout_user, login_required from flask import Blueprint, flash, redirect, render_template, request f...
StarcoderdataPython
3265690
<gh_stars>1000+ # -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """Plugin registry configuration page.""" # Third party imports from qtpy.QtWidgets import (QGroupBox, QVBoxLayout, QCheckBox, ...
StarcoderdataPython
6479342
<filename>app/apps/order_item/migrations/0004_auto_20201206_1747.py<gh_stars>1-10 # Generated by Django 3.1.3 on 2020-12-06 14:47 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('order_item', '0003_auto_20201206_1707'), ] operations = [ m...
StarcoderdataPython
3498624
from flask import Flask from .api.v1 import version1 as v1 from .api.v2 import version2 as v2 from .api.db_config import create_tables def create_app(): app = Flask(__name__) app.url_map.strict_slashes = False create_tables() app.register_blueprint(v1) app.register_blueprint(v2) @app.errorhan...
StarcoderdataPython
12812417
<reponame>minkione/mat from mat.utils.utils import Utils, Issue class Issue(Issue): TITLE = 'Fragment Injection Check' DESCRIPTION = 'Checks if the application is vulnerable to fragment injection' ID = 'fragment-injection' ISSUE_TITLE = 'Application Vulnerable To Fragment Injection' ...
StarcoderdataPython
5177429
<reponame>personalrobotics/herbpy #!/usr/bin/env python PKG = 'herbpy' import roslib; roslib.load_manifest(PKG) import numpy, unittest import herbpy env, robot = herbpy.initialize(sim=True) class WamTest(unittest.TestCase): def setUp(self): self._env, self._robot = env, robot self._wam = robot.rig...
StarcoderdataPython
361872
# # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Copyright (C) 2018-2021 UAVCAN Development Team <uavcan.org> # This software is distributed under the terms of the MIT License. # """ jinja-based :class:`~nunavut.generators.AbstractGenerator` implementation. """ import datetime import...
StarcoderdataPython
6624037
<filename>extensions/games.py ''' MIT License Copyright (c) 2020 <NAME> & <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 us...
StarcoderdataPython
6533169
<reponame>XROBOTICS/web<gh_stars>0 from django.db import models class Post(models.Model): post = models.CharField(max_length=500) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True)
StarcoderdataPython
11396503
import numpy as np import pandas as pd # for size in [100,1000,10000,100000,1000000]: time_loops = [["M.EGG", "M.Sensor", "M.Concentration"]] import matplotlib.pyplot as plt from yafs.stats import Stats #### ANALYSE FILES YAFS police = "cloud" police = "edge" # print depth for idx1, depth in enumerate([16]): #...
StarcoderdataPython
6461028
<filename>sanity/cast.py #!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import date, datetime import json def to_ascii(s, replace=''): """ >>> to_ascii(None) '' >>> to_ascii('hi there') 'hi there' >>> to_ascii('hi €there') 'hi there' Watch what happens here -- a reminde...
StarcoderdataPython
3313933
<filename>d3t/watcher.py from contextlib import contextmanager from django.template.base import Node, Template from .rendering import Rendering from .signals import node_rendered, template_rendered __all__ = [ 'watch_templates', ] def wrap_template_render(render_function): def wrapper(template, context): ...
StarcoderdataPython
1705556
#!/usr/bin/env python ''' web The Web application. You know, templates and stuff. ''' from flask import Blueprint api = Blueprint('web', __name__, template_folder='templates', static_folder='static', static_url_path='/summary/static') # Exposed Endpoints from web.controller import index
StarcoderdataPython
6409175
import json import logging import os from model import script_configs from utils import os_utils, file_utils LOGGER = logging.getLogger('config_service') def _load_script_config(path, content_or_json_dict): if isinstance(content_or_json_dict, str): json_object = json.loads(content_or_json_dict) else...
StarcoderdataPython
1950757
<gh_stars>1-10 """ This file will hold a tracker class, which itself will call some other trackers, such as the OpenCV or special trackers. It is essentially a wrapper class to make the main file have consistent API """ import cv2 import numpy as np from collections import defaultdict from driver_risk_utils import gen...
StarcoderdataPython
1848401
#!/usr/bin/env python # GIMP Plug-in for the Sega Dreamcast MR file format # Copyright (C) 2019 by BBHoodsta # # Encoding based on logotools(pngtomr.c) source code by <NAME> (ADK) # http://napalm-x.thegypsy.com/andrewk/dc/ # # Decoding based on Selfboot Inducer (mrimage.pas) source code by SiZiOUS # http://sizious.co...
StarcoderdataPython
111479
<filename>fluent/cldr/__init__.py """ CLDR/ICU pluralization support. ICU/ARB plurals support ======================= Out `Translation` objects have a JSON `plural_texts` field which holds the plural forms. There are six case keywords which hold message versions depending on the number: zero, one, two, few, many, oth...
StarcoderdataPython
12818092
<reponame>zorache/ServiceX_App<gh_stars>0 # Copyright (c) 2019, IRIS-HEP # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice...
StarcoderdataPython
5177054
from mopy.impl.dvonn.state import Cell from mopy.impl.dvonn.game import DvonnGame import pytest @pytest.fixture def game(scope="module"): return DvonnGame() @pytest.fixture def new_state(game): return game.new_game() @pytest.fixture def full_state(new_state): full_state = new_state ...
StarcoderdataPython
6692850
<reponame>Unknoob/buck # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, print_function import itertools import os import site import sys import uuid from pkg_resources import ( DistributionNo...
StarcoderdataPython
9700886
<filename>server/database.py import os from datetime import datetime from flask import Flask from flask_sqlalchemy import SQLAlchemy from dotenv import load_dotenv dotenv_path = os.path.join(os.path.dirname(__file__), '.env') load_dotenv(dotenv_path) DB_USER = os.getenv('DB_USER') DB_PW = os.getenv('DB_PW') app = F...
StarcoderdataPython
8069333
from __future__ import absolute_import from __future__ import print_function import argparse from collections import defaultdict import json import requests from memoized import memoized_property from .utils import humansize, get_arg_parser, get_config_from_args, check_connection, \ get_db_list, get_db_metadata, ...
StarcoderdataPython
6585996
import math import docplex.cp.model as cp def simultaneousGroups(model, AAdict1, AAdict2): numberOfDivisions1 = len(AAdict1["divisions"]) numberOfDivisions2 = len(AAdict2["divisions"]) if AAdict1["weekBounds"] == AAdict2["weekBounds"] and numberOfDivisions1 == numberOfDivisions2 and set( AAdict...
StarcoderdataPython
6531387
from django.db import migrations def operation_move_content_from_documents_to_ocr_app(apps, schema_editor): DocumentPage = apps.get_model( app_label='documents', model_name='DocumentPage' ) DocumentPageContent = apps.get_model( app_label='ocr', model_name='DocumentPageContent' ) f...
StarcoderdataPython
3516647
from setuptools import setup, find_packages from os import path __version__ = '0.0.3' here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name = "cvas", version = _...
StarcoderdataPython
8144638
<gh_stars>0 import pytest from graphql_relay import to_global_id from rest_framework.utils import json @pytest.mark.django_db() def test_relay_mutation_create_resolver_throttle_classes( graphql_throttle_resolver_four_client, user_factory ): user = user_factory() graphql_throttle_resolver_four_client.forc...
StarcoderdataPython
6497234
# -*- coding: utf-8 -*- __copyright__ = "Copyright (c) 2014-2017 Agora.io, Inc." import os import sys import time sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from src.RtmTokenBuilder import * def main(): appID = "970CA35de60c44645bbae8a215061b33" appCertificate = "5C...
StarcoderdataPython
4882876
<reponame>TomLXXVI/pyhc<gh_stars>1-10 """Calculation of heat loss by transmission""" import cmath import numpy as np from nummath import linearsystem class BuildingElement: def __init__(self, **kwargs): """ Configuration of building element. Possible values for 'kwargs': - A ...
StarcoderdataPython
1936737
# -*- coding: utf-8 -*- import unittest import time import threading import logging from click.testing import CliRunner from nseta.cli.livecli import live_quote, scan, news, top_picks from nseta.common import urls from nseta.scanner.stockscanner import * from baseUnitTest import baseUnitTest from nseta.scanner.scanne...
StarcoderdataPython
9793168
from transformer.helpers import zip_kv_pairs from transformer.plugins import plugin, Contract from transformer.task import Task2 @plugin(Contract.OnTask) def plugin(task: Task2) -> Task2: """ Removes Chrome-specific, RFC-non-compliant headers starting with `:`. Converts header names to lowercase to simpli...
StarcoderdataPython
292026
<gh_stars>1-10 # coding: utf-8 import requests import datetime import time import pandas as pd import plotly.graph_objects as go import plotly.express as px import os def plot_candlestick(df, df2): fig = go.Figure(data = [go.Candlestick(x = df['Time'], open = df['Open'], high = df['High'], ...
StarcoderdataPython
3426092
<filename>atm90e26_SPI.py import machine import time import ustruct as struct SoftReset = 0x00 # Software Reset SysStatus = 0x01 # System Status FuncEn = 0x02 # Function Enable SagTh = 0x03 # Voltage Sag Threshold SmallPMod = 0x04 # Small-Power Mode LastData = 0x06 # Last Read/Write SPI/UART Value LSB = 0x08 # ...
StarcoderdataPython
293545
<gh_stars>0 from collections import defaultdict import math import time import random import torch class WordEmbSkip(torch.nn.Module): def __init__(self, nwords, emb_size): super(WordEmbSkip, self).__init__() """ word embeddings """ self.word_embedding = torch.nn.Embedding(nwo...
StarcoderdataPython
3261045
from datetime import date, datetime from flask import Blueprint, render_template, abort from flask_babel import _ from flask_login import current_user from sqlalchemy import desc from app import db, cache from app.models.activity import Activity from app.models.news import News from app.models.page import Page, PageR...
StarcoderdataPython
11286108
<reponame>nasqueron/merge-dictionaries<filename>src/mergedictionaries/app/__init__.py from .app import run
StarcoderdataPython
11333756
import unittest import rasterio import numpy as np from treeseg import * from pyproj import Proj import pyfor from affine import Affine rasterio_object = rasterio.open('data/test.tif') array = rasterio_object.read(1) class HeightModelTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.t...
StarcoderdataPython
1745626
from __future__ import annotations from dataclasses import make_dataclass from warnings import warn import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.regression.rolling import RollingOLS from pqr.utils import align def extract_annualizer(df_or_series: pd.DataFrame | pd.Series) ->...
StarcoderdataPython
6678572
<filename>src/lhtmlLib/insert_in_text.py import re def insert_element_from_index(text, regex_to_insert, index_store): new_text = '' index_previous = 0 match = re.finditer(regex_to_insert, text) for it in match: index = int(it.group(1)) content = index_store[index] new_text += text[inde...
StarcoderdataPython
3453727
import os, re, sys, shutil import subprocess as sp import random, string import numpy as np from .utils import * #DEBUG=False # load package locations from yaml file, watch! global dict package_locs = load_package_locations() def pfunc(seq, package='vienna_2', T=37, constraint=None, motif=None, linear=False, ...
StarcoderdataPython
3413745
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import copy import os import sys from contextlib import suppress from typing import Any, List, Type, cast import numpy a...
StarcoderdataPython
11375146
<reponame>LDiek-/ai #! /usr/bin/python # -*- coding: utf-8 -*- import json # Neuronales Netz zum erlernen von Nomen-Regelung __autor__ = "<NAME>" __version__ = 1.0 class Connection(): def __init__(self, name, connector, connected, weight): self.name = name self.mode = "off" self.weig...
StarcoderdataPython
1875605
<reponame>iamnapo/tesla-web-mining<gh_stars>1-10 # <NAME>, AEM: 16 # <NAME>, AEM: 9 # Script that iterates through tweets, calculates their polarity using the textblob library, saves the 'overall_sentiment' # base on polarity's value and the calculates and creates a plot of the daily count of each sentiment (positive, ...
StarcoderdataPython
1818938
# Generated by Django 3.0.2 on 2020-02-12 15:37 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('LibreBadge', '0001_initial'), ] operations = [ migrations.RenameModel( old_name='WelcomMessage', new_name='WelcomeMessage', ...
StarcoderdataPython
4957026
# -*- coding: utf-8 -*- import time class EnumBool: UNKNOWN = 'unknown' NO = 'no' YES = 'yes' def retry(max_attempts, sleep_time): def retry_decorator(function): def _wrapper(*args, **kwargs): attempt = 0 while True: attempt += 1 try:...
StarcoderdataPython
3530938
<gh_stars>0 from utils import get_mnist, sample_reconstructions, plot_samples from vae import SampleLayer, vae_log_likelihood import theano import theano.tensor as T import lasagne from lasagne.nonlinearities import rectify, identity import numpy as np from sklearn.cross_validation import train_test_split if __name...
StarcoderdataPython
4854971
<reponame>rackerlabs/bobby """Tests for bobby.worker.""" import json import mock from twisted.internet import defer from twisted.trial import unittest from silverberg.client import CQLClient from bobby import worker from bobby.ele import MaasClient class TestBobbyWorker(unittest.TestCase): """Test bobby.worker....
StarcoderdataPython
11246435
<reponame>joshiaj7/CodingChallenges """ Space : O(n) Time : O(n) """ class Solution: def climbStairs(self, n: int) -> int: dp = [0] * 3 dp[0] = 1 dp[1] = 1 dp[2] = 2 if n < 3: return dp[n] dp = dp + ([0] * (n-2)) fo...
StarcoderdataPython
4828594
# -*- coding: utf-8 -*- from enum import Enum class SquareType(Enum): WHITE = 0 BLACK = 1 EMPTY = 2 ERROR = 3 class GameStatus(Enum): WHITE_WINS = 0 BLACK_WINS = 1 DRAW = 2 PLAYING = 3 ERROR = 4
StarcoderdataPython
3552779
<gh_stars>1-10 value = 1 <caret>if (value >= 1 and value <= 100) or (value >= 200 and value <= 300): print("In range 1..100 or 200..300") else: print("Not in range 1..100 or 200..300")
StarcoderdataPython
3573780
import json from rest_framework import serializers from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ from .models import Author, FriendRequest, Post, Comment, Like from .converter import * class AuthorSerializer(serializers.ModelSerializer): type = serializers...
StarcoderdataPython
46422
from PySide6.QtCore import Qt, QThread, Signal, QPoint, QRect, QLocale, QTranslator, QCoreApplication, QThreadPool, \ QObject, QRunnable from PySide6.QtGui import QCursor, QPixmap, QIcon, QFont from PySide6.QtWidgets import QApplication, QMessageBox from gui_about import Ui_AboutWindow from gui_main import Ui_MainW...
StarcoderdataPython
9688572
import sys sys.path.append("..") from interactive.audio.recorder import AudioRecorder from interactive.audio.io import save_recording, load_recording import time import os def print_m(message): print(time.strftime('%X') + " " + str(message)); if __name__ == '__main__': print_m("Hi!") recording = AudioRec...
StarcoderdataPython
320852
import os import sys def create_dir(tournament_name,output_dir): #Replace spaces with underscores for file naming tournament_name=tournament_name.replace(" ","_") #Replace any & with nothing tournament_name=tournament_name.replace("&","") #See if output_dir directory exists, if not, exit if ...
StarcoderdataPython
51844
from sqlalchemy import DateTime, String, ForeignKey, Integer, Column, Float from sqlalchemy.orm import relationship from . import Base class AumHistory(Base): """ Map class for table AumHistory. - **aum_id**: Integer, primary_key. - **aum_datetime**: DateTime, not null. - **aum**: ...
StarcoderdataPython
6518402
<filename>deepy/layers/recurrent.py #!/usr/bin/env python # -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod import numpy as np import theano.tensor as T from deepy.core.tensor_conversion import neural_computation from deepy.utils import XavierGlorotInitializer, OrthogonalInitializer, Scanner from deepy...
StarcoderdataPython
9629948
<filename>pyark/rest_client.py import logging import requests import datetime import abc from furl import furl import pyark.backoff_retrier as backoff_retrier from pyark.errors import CvaServerError, CvaClientError class RestClient(object): _session = requests.Session() def __init__(self, url_base, endpoint...
StarcoderdataPython
6422780
<filename>app/database/models/blog_tag.py # coding: utf-8 from app.plugins import db class BlogTag(db.Model): __tablename__ = 'blog_tag' __table_args__ = {'schema': 'onekki_site'} id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255))
StarcoderdataPython
6675792
<filename>download_data.py from src.data_utils import get_data_types, get_data_file_name, save_data from src.download_utils import download_from_data_tracker def main(): for data_type in get_data_types(): data = download_from_data_tracker(data_type) if data is not None: fname = get_da...
StarcoderdataPython
79843
import sys import argparse import os import cv2 import yaml from PIL import Image from importlib.machinery import SourceFileLoader import torch from torch import nn from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt import pandas import numpy __filedir__ = os.path.dirname(os.path.realpath(__file_...
StarcoderdataPython
1908179
import numpy as np import cv2 import math import euler def getSmallestRotMatBetweenTwoDirections(w_directionBefore,w_directionAfter): #rotate frame (to keep the point constant) w_rotVec=getSmallestRotVecBetweenTwoDirections(w_directionBefore,w_directionAfter) return rotVecToRotMat(w_rotVec) #oldFrame_newFrame...
StarcoderdataPython
145239
from botocore.exceptions import ClientError import boto3 import json import sys POLICY_DOCUMENT = { "Statement":[ { "Action": ["dynamodb:Scan", "dynamodb:Query"], "Effect": "Allow", "Resource": "*" }, { "Action":[ "ec2:Describe*" ...
StarcoderdataPython
3336767
#DESAFIO 038: import time n1 = float(input("Digite o primeiro número: ")) n2 = float(input("Digite o segundo número: ")) print("Calculando.. .") time.sleep(2) if n1 > n2: print("O primeiro número é maior!") elif n2 > n1: print("O segundo número é maior!") else: print("Os números são iguais!")
StarcoderdataPython
6681373
''' Created on Apr 21, 2014 @author: Prateek ''' import unittest from mywork.task3 import * class Test(unittest.TestCase): def setUp(self): pass def testClassify(self): pass def testPopulate_datasets(self): pass def testCrossvalidate(self): pass ...
StarcoderdataPython
3346871
<reponame>QuDong/Algorithm4 # -*- coding: utf-8 -*- """ Created on Mon Nov 28 11:27:34 2016 @author: dong.qu """ class Node(): def __init__(self, data): self.data=data self.left=None self.right=None self.hd = float("inf") def btm_view_std(root): if not root: return ...
StarcoderdataPython
3470531
<reponame>maydewd/stoq-plugins-public<filename>connector/stdout/stdout/stdout.py # Copyright 2014-2015 PUNCH Cyber Analytics Group # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
StarcoderdataPython
1784884
<filename>orientacao_objetos/direcao.py """ A direção terá a responsabilidade de controlar a direção. Ela oferece os seguintes atributos: 1) Valor de direção com valores possíveis: Norte, Sul, Leste, Oeste. 2) Método girar_a_direita 3) Método girar_a_esquerda """ class Direcao: def __init__(self): self.va...
StarcoderdataPython
6414990
import pytest import os import sys BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if os.path.isdir(os.path.join(BASEDIR, 'depend_test_framework')): os.environ['PATH'] += ":" + os.path.join(BASEDIR, 'tests') sys.path.insert(0, BASEDIR) from depend_test_framework.env import Env def test...
StarcoderdataPython
6409998
<reponame>Oltanis/undergrad_MC_course """Read data associated with test Ising model in ising.py""" # To ignore pylint numpy "no-member" errors... # pylint: disable=E1101 import re import numpy import inputs.obs import inputs.util from inputs.util import Label from inputs.util import Observable from inputs.ensemble i...
StarcoderdataPython
6642390
# Copyright (C) 2018 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Unit tests for client module.""" # pylint: disable=protected-access import unittest import mock from ggrc.integrations.synchronization_jobs import assessment_sync_job from ggrc.integrations import inte...
StarcoderdataPython
5178284
from django.forms.widgets import URLInput from core.models import Resource class ResourceInput(URLInput): """ URLInput for Resource objects. """ def format_value(self, value): """ Return a value as it should appear when rendered in a template. Currently, value might be an int...
StarcoderdataPython
1984638
<reponame>IsaacJT/genologics<gh_stars>0 #!/usr/bin/env python from __future__ import print_function from os.path import isdir import os import sys from unittest import TestCase from genologics.epp import EppLogger file_path = os.path.realpath(__file__) test_dir_path = os.path.dirname(file_path) tmp_dir_path = test_di...
StarcoderdataPython
1906651
<gh_stars>1-10 import pytest from botus_receptus import config def test_load(tmp_path): c = tmp_path / 'config.toml' c.write_text( '''[bot] bot_name = "botty" discord_api_key = "API_KEY"''' ) bot_config = config.load(str(c)) assert bot_config['bot_name'] == 'botty' assert bot_config[...
StarcoderdataPython
97309
<reponame>akhiljalan/ctsp-open-data import numpy as np import os def load_embeddings(filename): ''' Function source: Berkeley CS 194-129, Homework 3. ''' vocab = [] embed = [] with open(filename, 'r', encoding="utf-8") as f: for line in f.readlines(): row = line.strip().split(' ') ...
StarcoderdataPython
182900
import logging_functions as lf import time import randomized_record import config CHECK_CONFIGURATION = False TARGET_ACTIVITIES = [ "com.google.android.gm/.ConversationListActivityGmail", "com.google.android.gm/.EmlViewerActivityGmail", "com.google.android.gm/.GmailActivity", "com.google.android.gm/c...
StarcoderdataPython
4910336
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2021 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA-Workflow-Engine-Snakemake utilities.""" from reana_commons.publisher import Workflow...
StarcoderdataPython
3460005
<reponame>AlexKouzy/ethnicity-facts-and-figures-publisher from tests.functional.pages import HomePage def test_site_search_form_action_updated_by_javascript(driver, live_server): home_page = HomePage(driver, live_server) home_page.get() assert home_page.is_current() expected_url = f"http://localhost:...
StarcoderdataPython
9640618
""" Suppose, you are a scientist at NASA. You were supposed to make a dictionary which was supposed to have the city as one of the keys. The city key is a string with a value of String stored against it. But your product manager understood his mistake, he thinks location would be a better word if used instead of city.I...
StarcoderdataPython
6627692
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # Feel free to rename the models, but don't rename db_table values or field names. # # Also note: You'll have to ...
StarcoderdataPython
5029851
<filename>cbuildbot/afdo.py # -*- coding: utf-8 -*- # Copyright 2014 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Module containing the various utilities to build Chrome with AFDO. For a description of AFDO see g...
StarcoderdataPython
12817445
# # Copyright (c) 2017. EPAM 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/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
StarcoderdataPython
6594659
from tkinter import * root=Tk() root.geometry("300x300") root.resizable(0,0) b1=Button(root,text="Click",font=("Arial",20),fg="blue",bg="red") b1.pack() root.mainloop()
StarcoderdataPython
214428
# 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 a...
StarcoderdataPython