id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
5130957
JUMPS = ['JALR', 'JAL'] BRANCHES = ['BEQ', 'BNE', 'BLT', 'BGE', 'BLTU', 'BGEU'] LOADS = ['LD', 'LW', 'LH', 'LB', 'LWU', 'LHU', 'LBU'] STORES = ['SD', 'SW', 'SH', 'SB'] def register_mask(wbits): return { 64: (2 ** 64) - 1, 32: (2 ** 32) - 1, 16: (2 ** 16) - 1, 8: (2 ** 8) - 1, }...
StarcoderdataPython
3486213
<gh_stars>0 import math from datetime import datetime, timedelta import numpy as np import logging import pandas as pd from scipy import stats as sps from scipy import signal from matplotlib import pyplot as plt import us import structlog from pyseir import load_data from pyseir.utils import AggregationLevel, Timeserie...
StarcoderdataPython
3436776
<gh_stars>1-10 import copy from typing import Union import json from urllib.parse import urlencode from youtubesearchpython.core.requests import RequestCore from youtubesearchpython.handlers.componenthandler import ComponentHandler from youtubesearchpython.core.constants import * class ChannelSearchCore(RequestCore,...
StarcoderdataPython
31728
<reponame>pasin30055/planning-evaluation-framework<filename>src/data_generators/pricing_generator.py # Copyright 2021 The Private Cardinality Estimation Framework Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obta...
StarcoderdataPython
267077
<filename>cinder/tests/unit/volume/drivers/ibm/fake_pyxcli.py<gh_stars>1-10 # Copyright (c) 2016 IBM Corporation # All Rights Reserved. # # 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...
StarcoderdataPython
6516888
<reponame>clumio-code/clumio-python-sdk # # Copyright 2021. Clumio, Inc. # from clumioapi import api_helper from clumioapi import configuration from clumioapi.controllers import base_controller from clumioapi.exceptions import clumio_exception from clumioapi.models import create_backup_vmware_vm_v1_request from clumio...
StarcoderdataPython
5037262
import numpy as np x = np.array([[1],[2],[-3],[4]]) y = np.array([[-2],[4],[1],[0]]) z = np.array([[5],[-2],[3],[-7]]) print("2*x-3*y+z=\n", 2*x-3*y+z)
StarcoderdataPython
6541509
<gh_stars>1-10 #! /usr/bin/python # -*- coding: utf-8 -*- __author__ = "<NAME>" """ This module provides some functionality related to S-CODE vectors such as reading, vector concetanation and so on. """ from nlp_utils import fopen from collections import defaultdict as dd from collections import Counter, namedtuple i...
StarcoderdataPython
11223263
<filename>django_email_foundation/management/commands/create_basic_structure.py from django.core.management import BaseCommand from django_email_foundation.api import DjangoEmailFoundation, Checks class Command(BaseCommand): help = 'Create the necessary folders inside the template path and it add a basic layout....
StarcoderdataPython
1968422
""" Define here anything what is needed for the package framework.classes. """
StarcoderdataPython
6597002
<reponame>michalinadengusiak/Learning-Python # coding: utf-8 # In[17]: # Here importing library time and setting variables import time word = "<PASSWORD>" guesses = '' turns = 13 # In[18]: # Asking input and welcoming user Name = input("What is your name ? ",) print("Hello", Name , "! It is time for a hangma...
StarcoderdataPython
12825668
<reponame>nebiutadele/2022-02-28-Alta3-Python #!/usr/bin/python3 import requests import json # define the URL we want to use GETURL = "http://validate.jsontest.com/" def main(): # test data to validate as legal json mydata = {"fruit": ["apple", "pear"], "vegetable": ["carrot"]} ## the next two lines do ...
StarcoderdataPython
15224
<filename>my_spotless_app/migrations/0002_alter_service_picture_url.py # Generated by Django 3.2 on 2022-02-27 11:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('my_spotless_app', '0001_initial'), ] operations = [ migrations.AlterFie...
StarcoderdataPython
6629475
# Definition for a binary tree node. """ timecomplexity = O(n) spacecomplexity = O(n) Using a dict to store prefix sum occurs so far let sum = from root to cur node val's sum check how many prefix sums equal to sum - target then there are same number of subpath that subpathsum = target remember that when return from s...
StarcoderdataPython
5187399
<reponame>saksham1115/mediagoblin<filename>mediagoblin/db/extratypes.py # GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Publ...
StarcoderdataPython
9617300
<gh_stars>10-100 from precise.skaters.covarianceutil.covrandom import random_band_cov from precise.skaters.portfoliostatic.rpportfactory import rp_portfolio_factory import numpy as np from precise.skaters.locationutil.vectorfunctions import scatter def test_rp(): cov = random_band_cov(n_dim=5) print(np.shape...
StarcoderdataPython
6441739
from UnitTest import UnitTest from write import write, writebr #from __pyjamas__ import debugger class GeneratorTest(UnitTest): def testSimpleStatement(self): def fn(): yield 1 yield 2 g = fn() self.assertEqual(g.next(), 1) self.assertEqual(g.next(), 2) ...
StarcoderdataPython
5142824
import graphene from cookbook.ingredients.schema import ( Queries as IngredientQueries, Mutations as IngredientMutations, ) from cookbook.recipes.schema import ( Queries as RecipeQueries, Mutations as RecipeMutations, ) from graphene_django.debug import DjangoDebug class Query( IngredientQueries,...
StarcoderdataPython
3300226
from context_free_grammar import Grammar def top_down_parser(grammar, input_string): output_queue = [grammar.start_symbol] input_queue = input_string.split() return parse(grammar, input_queue, output_queue) def parse(grammar, input_queue, output_queue): print 'Input', input_queue print 'Output', output_queu...
StarcoderdataPython
3267510
<gh_stars>0 """Construct a maximum matching on a graph using the blossom algorithm. Usage: ------ $ blossalg infile.csv [outfile.txt] Description of infile: The infile contains information on the number of nodes and the neighbours of each node. This information is stored using a series of comma-delimite...
StarcoderdataPython
6557888
from dataclasses import dataclass, field @dataclass(eq=False) class Node : idnum : int @dataclass class Graph : source : int adjlist : dict def PrimsMST(self): priority_queue = { Node(self.source) : 0 } added = [False] * len(self.adjlist) min_span_tree_cost = 0 while pri...
StarcoderdataPython
3218647
# Instructions # Use the Airflow context in the pythonoperator to complete the TODOs below. Once you are done, run your DAG and check the logs to see the context in use. import datetime import logging from airflow import DAG from airflow.models import Variable from airflow.operators.python_operator import PythonOpera...
StarcoderdataPython
3412415
<gh_stars>10-100 import mitmproxy.http import json from api.baidu import FaceDetect from lib.shortid import Short_ID face = FaceDetect() spider_id = Short_ID() class Fans(): def response(self, flow: mitmproxy.http.flow): if "aweme/v1/user/?user_id" in flow.request.url: user = json...
StarcoderdataPython
1822726
#!/usr/bin/env python # -*- coding: utf-8 -*- import tornado.web import tornado.gen import tornado.ioloop import time class IndexHandler(tornado.web.RequestHandler): def get(self): self.render("index.html", user="tttt") def post(self): username = self.get_argument("username") print use...
StarcoderdataPython
9696449
<reponame>wangyum/anaconda # -*- coding: utf-8 -*- ''' py-translate ============ A Translation Tool for Humans ''' from .translator import * from .languages import * from .coroutines import * from .tests import TestTranslator, TestLanguages from .__version__ import __version__ from .__version__ import __build__ __ti...
StarcoderdataPython
3296952
from dingtalker import DingTalker if __name__ == "__main__": client = "test" d = DingTalker() d.sendText(client, "Hi", atAll=True) d.sendText(client, "大家都打了吗?", "18079637336") d.sendMarkdown(client, "标题", "## 大家都打了吗?", "18079637336") d.sendLink(client, "好消息!好消息!", "本群与百度成功达成合作关系,今后大家有什么不懂的可以直接百...
StarcoderdataPython
304240
<filename>Python3/1385-Find-the-Distance-Value-Between-Two-Arrays/soln.py class Solution: def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int: return sum(all(abs(val1 - val2) > d for val2 in arr2) for val1 in arr1)
StarcoderdataPython
217649
import json import cli (options, args) = cli.getOptions() cowtan = open(options.source, "r") output = {} output['name'] = options.name cowtanData = [] output['data'] = cowtanData for line in cowtan.readlines(): currentMonth = {} data = line.split() yearMonth = data[0].split('/') year = int(yearMonth[0...
StarcoderdataPython
3407809
<gh_stars>10-100 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import time import unittest import numpy ...
StarcoderdataPython
6482586
from copy import copy from pandas import concat, Index, MultiIndex, Series from typing import Optional, Union, List, Dict from survey.mixins.data_types.single_category_mixin import SingleCategoryMixin class SingleCategoryStackMixin(object): items: List[SingleCategoryMixin] _item_dict: Dict[str, SingleCatego...
StarcoderdataPython
73909
<filename>qlib/backtest/signal.py # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import abc from typing import Dict, List, Text, Tuple, Union import pandas as pd from qlib.utils import init_instance_by_config from ..data.dataset import Dataset from ..data.dataset.utils import convert_index_...
StarcoderdataPython
21338
<reponame>vaedit/-<gh_stars>1-10 #!/usr/bin/env python # -*- coding:utf-8 -*- import smtplib from email.mime.text import MIMEText from email.header import Header #发送邮件函数 def smail(sub,body): tolist = ["<EMAIL>", "<EMAIL>"] cc = ["<EMAIL>", "<EMAIL>"] sender = '管理员 <<EMAIL>>' subject = sub smtpserve...
StarcoderdataPython
5102730
<reponame>napjon/moocs_solution<gh_stars>10-100 def hand_rank(hand): "Return a value indicating how high the hand ranks." #counts is the count of each ranks; ranks lists corresponding ranks #E.g. '7 T 7 9 7' => counts = (3, 1, 1); ranks = (7,10,9)# if it same count, ordered highest groups = group(['--23...
StarcoderdataPython
3280648
"""Coinbase helpers model""" __docformat__ = "numpy" import argparse import binascii from typing import Optional, Any, Union import hmac import hashlib import time import base64 import requests from requests.auth import AuthBase import gamestonk_terminal.config_terminal as cfg class CoinbaseProAuth(AuthBase): "...
StarcoderdataPython
179911
import asyncio from zeroservices.backend.mongodb import MongoDBCollection from . import _BaseCollectionTestCase from ..utils import TestCase, _create_test_resource_service, _async_test try: from unittest.mock import Mock except ImportError: from mock import Mock class MongoDBCollectionTestCase(_BaseCollect...
StarcoderdataPython
3248807
# Copyright (C) 2021-present notudope <https://github.com/notudope> from time import sleep from pyrogram import Client from telethon.sessions import StringSession from telethon.sync import TelegramClient select = " " help = """ Please go-to "my.telegram.org" (to get API_ID and API_HASH): ~ Login using your Telegram ...
StarcoderdataPython
206736
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
StarcoderdataPython
6502594
<filename>code/default/launcher/bubble.py # -*- encoding:utf-8 -*- ############################## # # 程序名:python桌面托盘气泡 # 文件名:bubble.py # 功能 :实现桌面托盘气泡提示功能 # modify:by heyongman 2018.7.18 # program:python2.7 # 适用 :windowsXP -windows10 # ############################## import sys import os import struct impo...
StarcoderdataPython
6672210
from .SentenceEvaluator import SentenceEvaluator from .SimilarityFunction import SimilarityFunction from .BinaryEmbeddingSimilarityEvaluator import BinaryEmbeddingSimilarityEvaluator from .EmbeddingSimilarityEvaluator import EmbeddingSimilarityEvaluator from .LabelAccuracyEvaluator import LabelAccuracyEvaluator from ....
StarcoderdataPython
11215663
<gh_stars>1-10 # -*- coding: utf-8 -*- import os import sys import pathlib def path_to_model_save_path(path): #从module所在的路径计算出模型保存的危指 mutation = os.path.basename(path).split('.')[0] model_save_path=os.path.join(path, '../../..', 'newest_model_saved', mutation) return model_save_path def path_t...
StarcoderdataPython
5072691
from typing import Any, Dict, List, Set, Tuple, TypedDict from permifrost.core.logger import GLOBAL_LOGGER as logger from permifrost.core.permissions.types import PermifrostSpecSchema from permifrost.core.permissions.utils.error import SpecLoadingError class EntitySchema(TypedDict): databases: Set[str] datab...
StarcoderdataPython
1750158
"""Version information.""" __version__ = "1.30.0"
StarcoderdataPython
6504444
<gh_stars>10-100 """Sphinx configuration.""" import re project = "grpc-interceptor" author = "<NAME>" copyright = f"2020, {author}" extensions = [ "sphinx.ext.autodoc", "sphinx.ext.napoleon", ] def setup(app): """Sphinx setup.""" app.connect("autodoc-skip-member", skip_member) def skip_member(app...
StarcoderdataPython
9645920
# Copyright (c) 2012, Calxeda Inc. # # 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, this list of conditions and th...
StarcoderdataPython
390530
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
StarcoderdataPython
6464953
<filename>AnuOyeboade/phase1/BASIC/DAY3/Q22.py """ Write a Python program to count the number 4 in a given list. """ nums = str(input("Enter a list of comma seperated numbers")) numbs = nums.split(",") def list_4(numbs): count = 0 for num in numbs: if num==4: count = count + 1 return cou...
StarcoderdataPython
54811
<reponame>nel215/lightgbm-mean-teacher from chainer import reporter as reporter_module from chainer.dataset import convert from chainer.training.extensions import Evaluator from chainer.backends import cuda from sklearn.metrics import roc_auc_score class AUCEvaluator(Evaluator): def evaluate(self): itera...
StarcoderdataPython
3566437
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import (division, print_function, absolute_import, unicode_literals) __all__ = ["autocorr_function", "autocorr_integrated_time", "thermodynamic_integration_log_evidence"] import numpy as np def autocorr_function(x, axis=0, fast=Fa...
StarcoderdataPython
3275419
""" Notes in the following: - `self` is an object - Words beginning with uppercase are classes except True and False which are booleans - WORDS that are all uppercase are constants - `a,b` = local variables - `sd` = standard deviation - `r()` is a random number 0 1 - `x,y` = decision, objective - `xs,ys` = de...
StarcoderdataPython
11283717
<filename>cutout/util.py #!/usr/bin/python #-*- coding:utf8 -*- import sys,re import urllib.parse as urlparse ## 补全不足 # @side 填充位置 left def fillside(stuff,width=None,fill=' ',side='left'): if not width or not isinstance(width,int): return stuff stuff = str(stuff) w = len(stuff) if w > width: return num ...
StarcoderdataPython
231910
<filename>translation/test_service.py import sys import grpc # import the generated classes import services.service_spec.translate_pb2_grpc as grpc_bt_grpc import services.service_spec.translate_pb2 as grpc_bt_pb2 from services import registry with open("example_de_article.txt", "r") as f: TEST_TEXT = f.read() ...
StarcoderdataPython
1669125
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2007-2013 <NAME> ( <EMAIL> ) # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. ''' For input list of sequence compute distance between ...
StarcoderdataPython
3384822
<reponame>softester-git/pytraining_v001<filename>model/group.py<gh_stars>0 from sys import maxsize class Group: def __init__(self, group_name=None, group_header=None, group_footer=None, group_id=None, contacts=None): self.group_name = group_name self.group_header = group_header self.group_...
StarcoderdataPython
8132847
<filename>run/predist.py<gh_stars>1-10 #! /usr/bin/python # -*- coding: utf-8 -*- __author__ = "<NAME>" """ Module creates input for dist to use it. It also creates instances file that contains the mapping for dists results and the instances. """ import sys from itertools import chain import gzip instance_f = gzip....
StarcoderdataPython
6572255
<reponame>crazy-zxx/3d-lmnet-update import os os.system('cd .. \n bash ./scripts/train_lm.sh')
StarcoderdataPython
1749490
from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:postgres@localhost:5432/python1_ass4' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) class Tablecoin(db.Model): __tablename__...
StarcoderdataPython
5151455
<gh_stars>100-1000 # 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...
StarcoderdataPython
3563530
from typing import Union, NamedTuple, Dict, Set, Iterable, Optional from collections import OrderedDict from conllu import TokenList # Constants MWE_FIELD = "parseme:mwe" MWE_NONE = "*" MWE_UNKOWN = "_" # Token ID is normally a single number (1, 2, ...), but it can be also # a three-element tuple in special situat...
StarcoderdataPython
1783719
import dgl import dgl.function as Fn from dgl.ops import edge_softmax import torch import torch.nn as nn import torch.nn.functional as F class SimpleHGNConv(nn.Module): def __init__(self, edge_feats, in_features, out_features, num_heads, ...
StarcoderdataPython
8140440
<reponame>jdschleicher/CumulusCI import responses import pytest from cumulusci.core.exceptions import CumulusCIException from cumulusci.tasks.salesforce.users.permsets import ( AssignPermissionSets, AssignPermissionSetLicenses, AssignPermissionSetGroups, ) from cumulusci.tasks.salesforce.tests.util import ...
StarcoderdataPython
1625799
class CursorAutoMover: def __init__(self, target, xrange=(0,5000), yrange=(0,3000), xvel=100, yvel=100): self.target = target self.xvel = xvel self.yvel = yvel self.xrange = xrange self.yrange = yrange self.visible = False def draw(self): pass def ...
StarcoderdataPython
11223542
# Check list number can divide to 13 and store in list my_list = [12, 65, 54, 39, 102, 339, 221] result = list(filter(lambda x: (x % 13 == 0), my_list)) print("Numbers divided to 13 are ", result)
StarcoderdataPython
9698025
<filename>kokemomo/plugins/engine/utils/km_logging.py #!/usr/bin/env python # -*- coding:utf-8 -*- import logging from logging.handlers import RotatingFileHandler, HTTPHandler from kokemomo.settings import SETTINGS __author__ = 'hiroki' class KMLoggingHandlerList(object): __instance = None handlers = {} ...
StarcoderdataPython
11266393
#============================================================================== # # This code was developed as part of the Astronomy Data and Computing Services # (ADACS; https:#adacs.org.au) 2017B Software Support program. # # Written by: <NAME>, <NAME>, <NAME> # Date: December 2017 # # It is distributed under t...
StarcoderdataPython
45153
<reponame>alex/django-old from django.test import TestCase from models import Simple class InitialSQLTests(TestCase): def test_initial_sql(self): self.assertEqual(Simple.objects.count(), 7)
StarcoderdataPython
3485640
#!/usr/bin/env python # coding=utf8 """ Created on 2014年2月15日 @author: liaoqiqi """ myfile = open("url_resources.txt") lines = myfile.readlines() print "use disconf;" print 'delete from role_resource;' for line in lines: line = line.strip('\n') if not line: continue if line[0] == '#': ...
StarcoderdataPython
1878505
from typing import Type from datatype import YLObject class RawModule(YLObject): pass class Module(RawModule): pass def yl(cls: Type[YLObject]): # name binding for k, v in filter(lambda pair: isinstance(pair[1], YLObject), cls.__dict__.items()): v.bindname = "{}_{}".format(cls.__name__, k...
StarcoderdataPython
1717103
<filename>src/simmate/toolkit/transformations/coordinate_perturation_ordered.py # -*- coding: utf-8 -*- from simmate.toolkit.transformations.base import Transformation class CoordinateOrderedPerturbation(Transformation): # known as "coordinate mutation" in USPEX # site locations are mutated where sites with...
StarcoderdataPython
4830042
from django.db import models class ActivityRateIssue(models.Model): owner = models.CharField(max_length=150) repo = models.CharField(max_length=150) activity_max_rate = models.DecimalField(max_digits=5, decimal_places=2, default=0.00) activity_rate = models....
StarcoderdataPython
9794178
<reponame>xiaomaiAI/pyansys from sys import platform import os import pytest import numpy as np from vtk import (VTK_TETRA, VTK_QUADRATIC_TETRA, VTK_PYRAMID, VTK_QUADRATIC_PYRAMID, VTK_WEDGE, VTK_QUADRATIC_WEDGE, VTK_HEXAHEDRON, VTK_QUADRATIC_HEXAHEDRON) from pyvista ...
StarcoderdataPython
8061107
<reponame>LinjianMa/neuralODE-282<filename>multi-output-glucose-forecasting/lib/gru.py import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as dsets from torch.autograd import Variable from torch.nn import Paramet...
StarcoderdataPython
149148
<filename>utils.py<gh_stars>0 from hashlib import pbkdf2_hmac from string import punctuation from secrets import token_bytes HASH_ROUNDS = 2**16 def create_header(algo: str) -> str: return "======== " + algo + " ========\n" def get_header(cipher: bytes) -> bytes: header = cipher.split(b"\n")[0] return ...
StarcoderdataPython
268660
# -*- coding: utf-8 -*- """ test_db.py testing our database code Copyright 2017 CodeRatchet 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/licen...
StarcoderdataPython
1602982
<reponame>thezakman/CTF-Toolz # This file is part of PyBing (http://pybing.googlecode.com). # # Copyright (C) 2009 <NAME> http://geewax.org/ # All rights reserved. # # This software is licensed as described in the file COPYING.txt, # which you should have received as part of this distribution. """ This module holds ...
StarcoderdataPython
3441090
<reponame>vipermu/dgl # -*- coding: utf-8 -*- # pylint: disable=C0103, E1101, C0111 """ The implementation of neural network layers used in SchNet and MGCN. """ import torch import torch.nn as nn from torch.nn import Softplus import numpy as np from ... import function as fn class AtomEmbedding(nn.Module): """ ...
StarcoderdataPython
4896789
from typing import Any, Dict, Optional from ConfigSpace.configuration_space import ConfigurationSpace from ConfigSpace.hyperparameters import UniformFloatHyperparameter, UniformIntegerHyperparameter import numpy as np import torch.optim.lr_scheduler from torch.optim.lr_scheduler import _LRScheduler from autoPyTorch...
StarcoderdataPython
12854707
mass = eval(input("Enter the amount of water in kilograms: ")) initial_temp = eval(input("Enter the initial temperature: ")) final_temp = eval(input("Enter the final temperature: ")) energy = mass * (final_temp - initial_temp) * 4184 print("The energy needed is {}".format(energy))
StarcoderdataPython
5169012
<filename>pydmd/dmdc.py """ Derived module from dmdbase.py for dmd with control. Reference: - <NAME>., <NAME>. and <NAME>., 2016. Dynamic mode decomposition with control. SIAM Journal on Applied Dynamical Systems, 15(1), pp.142-161. """ from past.utils import old_div import numpy as np from .dmdbase import DMDBase fr...
StarcoderdataPython
9613346
<gh_stars>1-10 # Copyright 2020 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license" file accompanying this file. T...
StarcoderdataPython
1718957
<reponame>kneasle/belltower<filename>examples/rounds.py # Import the tower class, and 'time.sleep' import time from belltower import * # Number of seconds between each bell stroke BELL_GAP = 0.3 # Number of strokes that would fit into the handstroke gap HANDSTROKE_GAP = 1 # Create a new tower, and tell it to join tow...
StarcoderdataPython
9631827
import os, sys import bpy from mathutils import Matrix, Vector # Create directory if not existed def create_dir(dir): if not os.path.isdir(dir): os.makedirs(dir) # Compute the calibration matrix K of camera def get_calibration_matrix_K_from_blender(camd): f_in_mm = camd.lens scene = bpy.context....
StarcoderdataPython
4884140
<reponame>matthewdgroves/Practice # Name: # Date: # proj01: A Simple Program # This program asks the user for his/her name and age. # Then, it prints a sentence that says when the user will turn 100. # If you complete extensions, describe your extensions here!
StarcoderdataPython
5141541
<gh_stars>0 import rubin_sim.maf.metrics as metrics import rubin_sim.maf.slicers as slicers import rubin_sim.maf.metricBundles as mb import rubin_sim.maf.plots as plots from .colMapDict import ColMapDict from .common import filterList __all__ = ['altazHealpix', 'altazLambert'] def basicSetup(metricName, colmap=None,...
StarcoderdataPython
5100731
<filename>pypage/_jinja2.py from pypage._html import Tag, State def _val_(name): return '{{ %s }}' % name def _stmt_(stmt): return '{% ' + stmt + ' %}' class pystmt(Tag): def __init__(self, stmt): super().__init__(stmt, html=False) class _if_(pystmt): def __init__(self, cond): su...
StarcoderdataPython
114163
from datetime import date ano = int(input('Ano de nascimento: ')) atual = date.today().year idade = atual - ano print('Atletas nascidos em {} tem {} anos em {}.'.format(ano, idade, atual)) if idade <= 9: print('Sua categoria é a MIRIM.') elif idade <= 14: print('Sua categoria é a INFANTIL.') elif idade...
StarcoderdataPython
4965498
from stable_baselines3.ppo_single_level.policies import CnnPolicy, MlpPolicy, MultiInputPolicy from stable_baselines3.ppo_single_level.ppo_single_level import PPO_SL
StarcoderdataPython
11235682
<reponame>ferrerinicolas/python_samples<filename>6. Functions/6.5 Try - Except/6.5.4 Name and Age.py """ This program asks the user for their name and age. It handles the case where the user fails to enter a valid integer for their age. """ # Ask user for name and age. # Enter default value for age in case they do not...
StarcoderdataPython
1669124
<reponame>rs-ds/cookiecutter-sanic from sanic import Sanic from sanic.response import json from sanic_openapi import swagger_blueprint, doc from {{cookiecutter.app_name}}.blueprint.health import health {% if cookiecutter.enable_orm == 'true' -%} from {{cookiecutter.app_name}}.model import DATABASE from {{cookiecutter.a...
StarcoderdataPython
5118761
<gh_stars>0 import numpy as np import math def euclidiana(vetor): # norma-2 vetorial n, x = len(vetor), 0 for i in range(n): x += math.fabs(vetor[i]) ** 2 return x ** (1/2) def manhattan(vetor): # norma-1 vetorial n, x = len(vetor), 0 for i in range(n): x += math.fabs(vetor[i]) ...
StarcoderdataPython
11304423
source=[{'date':'2017-2-1','name':"a",'value':1},\ {'date':'2017-2-1','name':"c",'value':3},\ {'date':'2017-2-1','name':"b",'value':2},\ {'date':'2017-2-2','name':"b",'value':1}] data = dict() for i in source: if i['date'] not in data.keys(): data[i['date']]=dict() data[i['d...
StarcoderdataPython
3302008
"""put lrf table back Revision ID: d10c6bfdd9aa Revises: 65c5753b57e0 Create Date: 2021-01-11 10:31:39.441091 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mssql # revision identifiers, used by Alembic. revision = "<KEY>" down_revision = "65c5753b57e0" branch_labels = None depend...
StarcoderdataPython
5008322
import numpy as np import pytest from bayesian_testing.metrics.posteriors import ( beta_posteriors_all, lognormal_posteriors, dirichlet_posteriors, ) BETA_POSTERIORS_ALL_INPUTS = [ { "totals": [10, 20, 30], "successes": [8, 16, 24], "sim_count": 10, "a_priors_beta": [0....
StarcoderdataPython
12817417
<reponame>MaxOnNet/scopuli-core-web #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright [2017] <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 # # http://www.apach...
StarcoderdataPython
1793062
version = '0.19.0.1'
StarcoderdataPython
3310430
from datetime import datetime, timedelta import pytz from django.conf import settings from django.db.models.query import QuerySet from django.shortcuts import get_object_or_404 from rest_framework import viewsets from rest_framework.permissions import IsAuthenticated from rest_framework.response import Respons...
StarcoderdataPython
1985384
import numpy as np from random import shuffle from sklearn.utils.class_weight import compute_class_weight as ccw from GrapHiC.models.GATE_modules import GATE_promoter_module from GrapHiC.models.lightning_nets import LitClassifierNet from GrapHiC.Dataset import HiC_Dataset import torch from torch import Tensor from to...
StarcoderdataPython
3524391
# Django core from django.contrib import admin # Our apps from .models import UserSocialAuth admin.site.register(UserSocialAuth)
StarcoderdataPython
17032
<filename>featureflow/feature_registration.py class FeatureRegistration: def __init__(self, key, failoverVariant, variants=[]): """docstring for __init__""" self.key = key self.failoverVariant = failoverVariant self.variants = [v.toJSON() for v in variants] def toJSON(self): ...
StarcoderdataPython
9722013
from dataclasses import dataclass from paper_trader.utils.dataclasses import primary_key, to_pandas from paper_trader.utils.pandas import rows_count from paper_trader.utils.price import Price @dataclass class DataclassNoPk: a: str b: int @primary_key("c") @dataclass class DataclassWithPk: ...
StarcoderdataPython
8081359
import open3d as o3d import numpy as np def voxel_grid_to_pcd(voxel_grid, n_points=50): box_structure = [] pcd_structure = [] point_cloud_np = np.asarray([voxel_grid.origin + pt.grid_index*voxel_grid.voxel_size for pt in voxel_grid.get_voxels()]) for voxel in voxel_grid.get_voxels(): mesh_...
StarcoderdataPython