id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5035263
<filename>entailment_preprocess.py # -*- coding: utf-8 -*- """ Created on Fri Jul 16 10:56:38 2021 preprocess entailment @author: Liz """ import nltk import pandas as pd from nltk.corpus import wordnet from nltk.stem import WordNetLemmatizer from nltk.corpus import stopwords from nltk.stem import PorterSt...
StarcoderdataPython
3265928
#!/usr/bin/env python """ A local stand-in for S3. For testing. """ from os.path import join, dirname, exists, isfile from os import errno from os import makedirs from logging import getLogger class LocalStorage(object): """ A local replacement for S3. """ def __init__(self, path): """ ...
StarcoderdataPython
5097907
# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.13.6 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name:...
StarcoderdataPython
1715364
<gh_stars>10-100 from unittest import skip from django.test import TestCase from discussion.tests.helpers import create_thread from paper.tests.helpers import create_paper from user.tests.helpers import create_random_authenticated_user from utils.test_helpers import ( TestData, get_authenticated_get_response )...
StarcoderdataPython
6699503
<filename>python/oneflow/test/graph/test_to_consistent.py """ Copyright 2020 The OneFlow Authors. 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 at http://www.apache.org/lice...
StarcoderdataPython
3421504
<gh_stars>1-10 from sqlalchemy import inspect from sqlalchemy.orm import attributes from .. import db from ..settings.models import Setting, Settings from ..user.models import Profile from ..settings import DEFAULT_SETTINGS from .slugging import slugify from .blog import make_summary def select_instances_of_type(model...
StarcoderdataPython
1807036
<filename>workers/data_refinery_workers/processors/test_janitor.py import os from unittest.mock import MagicMock, patch from django.test import TestCase, tag from data_refinery_common.models import ( ComputationalResult, ComputationalResultAnnotation, ComputedFile, Dataset, Experiment, Experim...
StarcoderdataPython
6522652
n0 = int(input()) n = n0 nmax = n0 i = 0 while n != 1: if n % 2 == 0: n = n // 2 else: n = 3 * n + 1 i += 1 nmax = max(nmax, n) print(i) print(nmax)
StarcoderdataPython
6500366
<filename>src/robotican_demos_upgrade/pygazebo/pygazebo/msg/images_stamped_pb2.py # Generated by the protocol buffer compiler. DO NOT EDIT! # source: images_stamped.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from go...
StarcoderdataPython
1707888
class QuickUnionUnionFind(object): def __init__(self, n): self.n = n self.parents = range(n) def __len__(self): return self.n def union(self, p, q): """ >>> uf = QuickUnionUnionFind(5) >>> uf.parents = [0, 1, 1, 2, 4] >>> uf.union(1, 3) >>> ...
StarcoderdataPython
5047607
<filename>docs/_build/html/_downloads/1d02506b92a2f8a3ba1d3b93325cc26f/jj_squid.py import spira from spira import param from spira.rdd import get_rule_deck from examples.junction import Junction RDD = get_rule_deck() class JunctionSquid(spira.Cell): width = param.FloatField() height = param.FloatField() ...
StarcoderdataPython
4962075
<gh_stars>1-10 import time import numpy as np import scipy.optimize as so from .benchmarks import Benchmarks class Optimize(Benchmarks): def __init__(self, name, params, num_threads, comm): super(Optimize, self).__init__(name=name, params=params, num_threads=num_threads, comm=comm) np.random.see...
StarcoderdataPython
9799244
from collections import Counter from warnings import warn from contextlib import suppress import numpy as np import matplotlib.collections as mcoll import matplotlib.lines as mlines import matplotlib.patches as mpatches import matplotlib.path as mpath from ..exceptions import PlotnineWarning from ..doctools import do...
StarcoderdataPython
11304587
import csv import yaml import sys import json from csv import DictReader def format(s): return '"{}"'.format(s) def is_selected(value): return value == 'x' or value == 'X' def check_empty(value): if not value or value == '': return '""' def append_interface(value, name, interfaces): if is_s...
StarcoderdataPython
5161283
import imagehash from PIL import Image def isnotebook(): try: shell = get_ipython().__class__.__name__ if shell == 'ZMQInteractiveShell': return True elif shell == 'TerminalInteractiveShell': return False else: return False except NameError: ...
StarcoderdataPython
8139677
<reponame>supercatex/RemoteMachine import serial from datetime import datetime now = datetime.today().strftime("%Y%m%d_%H%M%S") fname = "GPS_%s.txt" % now gps = serial.Serial( "/dev/ttyUSB0", timeout=None, baudrate=4800, xonxoff=False, rtscts=False, dsrdtr=False ) records = [] while True: ...
StarcoderdataPython
11378932
#!/usr/bin/env python3 # west->east increasing x # south->north increasing y import sys from collections import defaultdict, deque def move(dir, x, y): if dir == 'E': next_x, next_y = x + 1, y elif dir == 'W': next_x, next_y = x - 1, y elif dir == 'N': next_x, next_y = x, y + 1 ...
StarcoderdataPython
1996063
<reponame>qnano/photonpy # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from photonpy.cpp.image_proc import RollingMedianImageFilter from photonpy import Context import tqdm import time def view_movie(mov): import napari with napari.gui_qt(): napari.view_image(mo...
StarcoderdataPython
313467
from os import path SAVE_FORMAT = "h5" # SAVE_FORMAT.__doc__ = """ Either 'tf' or 'h5', indicating whether to save the model to Tensorflow SavedModel or HDF5. Meant to default to 'tf' in TF 2.X, and 'h5' in TF 1.X. ImportError: If save format is hdf5, and h5py is not available """ SAVE_FORMAT_WITH_SEP =...
StarcoderdataPython
3486503
<filename>EW_only.py<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 26 15:45:33 2021 @author: christian """ import gzip import math import numpy as np from scipy.optimize import curve_fit from EPIC_functions import dTemp_lin, dlogg_lin, dMetal def hypersurfacelstsq(data, x, y, z): ...
StarcoderdataPython
6579393
#!/usr/bin/env python from __future__ import print_function import argparse import textwrap import re import sys import traceback import logging from .prepare import SelectAlternatives, WeightsForHierarchy from .evaluate import Evaluate from .analyze import Analyze from .significance import Significance, Confidence f...
StarcoderdataPython
8097599
<filename>src/dns_spoofer/dns_spoofer.py<gh_stars>0 from scapy.all import IP, UDP, DNS, DNSRR, send, IFACES, get_if_addr, Ether, ARP, srp from dns.resolver import Resolver from threads.sniffer_thread import Sniffer class DNS_Spoofer: ''' Fake DNS to resolve records and setup proxy server ''' def __init...
StarcoderdataPython
3445245
<filename>cpre_noninterleaving.py """Noninterleaving controllable step operator and fixpoints.""" # Copyright 2017 by California Institute of Technology # All rights reserved. Licensed under BSD-3. # from omega.symbolic import bdd as scope import symbolic as sym import utils def group_as_env_sys(team, aut): """A...
StarcoderdataPython
5118392
<gh_stars>1-10 # 이진 탐색 def binary_search(arr, key): left, right = 0, len(arr) - 1 visited = '' while left <= right: mid = (left + right) // 2 if arr[mid] == key: return 1 elif arr[mid] > key: right = mid - 1 if visited == 'L': retu...
StarcoderdataPython
147531
# coding=utf-8 # Copyright 2019 The Tensor2Tensor 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
StarcoderdataPython
335011
<gh_stars>0 # t265 camera test node with rectify import rospy import cv2 import os from sensor_msgs.msg import CameraInfo, CompressedImage from cv_bridge import CvBridge from image_geometry import PinholeCameraModel cvBridge = CvBridge() class T265(): def __init__(self, topic_base='/t265/fisheye1'): self...
StarcoderdataPython
3207107
<gh_stars>1-10 from smsiran.sms_ir import SmsIR from smsiran.ghasedak import Ghasedak
StarcoderdataPython
4824997
<reponame>theseus-automl/gorgona import pytest from gorgona.stages.cleaners import EmailCleaner @pytest.fixture() def setup_email_cleaner(): ec = EmailCleaner( '', '', ) return ec @pytest.mark.parametrize('value', [ '<EMAIL>', '<EMAIL>', # 'email@[127.0.0.1]', TODO '<E...
StarcoderdataPython
8062167
<filename>tests/functional/order/test_emails.py<gh_stars>0 import os from django.core import mail from django.test import TestCase from oscar.core.loading import get_class from oscar.test.factories import ProductImageFactory, create_order from oscar.test.utils import EmailsMixin, remove_image_folders OrderD...
StarcoderdataPython
8009642
''' DISTANCE BETWEEN COORDINATES Suppose you are given n co-ordinate points in a 2D plane. The task is to find the total sum of distance between all those points. Basically it is computing the perimeter of the complete polygon formed by those n co-ordinate points. For calculating the distance between two points (x1...
StarcoderdataPython
6585455
from tap_liveperson.streams.base import BaseStream import singer LOGGER = singer.get_logger() # noqa class EngagementHistoryStream(BaseStream): API_METHOD = 'POST' SERVICE_NAME = 'engHistDomain' TABLE = 'engagement_history' @property def api_path(self): return ( '/interacti...
StarcoderdataPython
12824787
<filename>src/shortener/utils.py import random import string from django.conf import settings SHORTCODE_MIN = getattr(settings, "SHORTCODE_MIN", 8) def code_generator(size=SHORTCODE_MIN, chars=string.ascii_letters + string.digits): return ''.join(random.choice(chars) for _ in range(size)) def create_shortcode...
StarcoderdataPython
1992652
""" Copyright (c) Facebook, Inc. and its affiliates. """ # fmt: off """ Every template contains an ordered list of TemplateObjects. TemplateObject is defined in template_objects.py GetMemory templates are written for filters and have an answer_type They represent the action of fetching from the memory using the filte...
StarcoderdataPython
1683183
import cgi, cgitb import secret import time form = cgi.FieldStorage() username = form.getvalue('username') password = form.getvalue('password') def _wrapper(page): """ Wraps some text in common HTML. """ return (""" <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <sty...
StarcoderdataPython
4967226
import os import pandas as pd from torch.nn import MSELoss from easydict import EasyDict as edict from readability_transformers import ReadabilityTransformer from readability_transformers.readers import PairwiseDataReader, PredictionDataReader from readability_transformers.dataset import CommonLitDataset from readabili...
StarcoderdataPython
3347252
<gh_stars>0 from typing import Any, List import pytest from hypothesis import given, assume from hypothesis.strategies import integers from hypothesis.strategies import floats from hypothesis.strategies import lists from paitypes.common.sequence import moving_average def test_simple_case() -> None: assert movin...
StarcoderdataPython
9717423
<filename>code/feature_extraction/posting_time.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Feature that extracts the categorized daytime (morning, afternoon, evening, night) of a tweet as a one-hot encoding based on the posting time. Created on Thu Oct 7 18:28:51 2021 @author: jlinkemeyer """ import nump...
StarcoderdataPython
76984
<gh_stars>1-10 ############################################################################### # WaterTAP Copyright (c) 2021, The Regents of the University of California, # through Lawrence Berkeley National Laboratory, Oak Ridge National # Laboratory, National Renewable Energy Laboratory, and National Energy # Technol...
StarcoderdataPython
8065553
import subprocess def run(cmd_str): subp = subprocess.Popen(cmd_str, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) stdout, stderr = subp.communicate() result = subp.wait() del subp return (result, stdo...
StarcoderdataPython
11327722
import binascii import json from tests.helpers import add_test_transactions from luracoin.helpers import bits_to_target from luracoin.blocks import Block from luracoin.transactions import Transaction from tests.helpers import add_test_transactions from luracoin.config import Config from luracoin.pow import proof_of_wor...
StarcoderdataPython
6489894
<reponame>yongfang117/data_process<gh_stars>0 # coding:utf8 """ Description:不均衡的数据归一化处理方法 Author:伏草惟存 Prompt: code in Python3 env """ from numpy import * from lossval import replaceNanWithMean '''数值归一化:特征值转化为0-1之间:newValue = (oldValue-min)/(max-min)''' def norm_dataset(dataset): minVals = dataset.min(0) # 参数0是...
StarcoderdataPython
1911859
import logging from crownstone_core.packets.BasePacket import BasePacket from crownstone_core.util.BufferReader import BufferReader from crownstone_uart.core.uart.uartPackets.UartLogHeaderPacket import UartLogHeaderPacket _LOGGER = logging.getLogger(__name__) class UartLogPacket(BasePacket): """ UART log packet ...
StarcoderdataPython
6462427
<gh_stars>0 #!/usr/bin/env python import mcpi from mcpi.minecraft import Minecraft import pifacedigitalio from McTraps import * import sys,time class McControl: def __init__(self, ips): self.ips = [] self.ips += ips # Open connections with the Minecraft sessions self.connections={} for ip in sel...
StarcoderdataPython
6593078
import webbrowser class Movie(): """This is a media class which can be used to define movie properties""" VAR_RATINGS = ["G","PG","R"] def __init__(self,movie_title,movie_storyline,poster_image,trailer_youtube): self.title = movie_title self.storyline = movie_storyline self.po...
StarcoderdataPython
6451408
<reponame>PacktPublishing/Beaglebone-By-Example import Adafruit_BBIO.ADC as ADC import time import requests ADC.setup() while True: reading = ADC.read('P9_40') millivolts = reading * 1800 temp_c = millivolts / 10 print temp_c r = requests.post('https://api.thingspeak.com/update.json', data = {'a...
StarcoderdataPython
113325
<filename>sensor.py """ @ Author : <NAME> @ Date : 04/11/2020 @ Description : Plugwise stretch Sensor - Monitor plugwise circles """ VERSION = '0.0.1' DOMAIN = "plugwise-stretch" SENSOR_PREFIX = 'plugwise_' CONF_HOST = "host" CONF_PASSWORD = 'password' import json import logging import base64 import time ...
StarcoderdataPython
9707100
#!/usr/bin/python3 # https://practice.geeksforgeeks.org/problems/maximum-product-subarray/0 def sol(arr, n): mxth = 1 mnth = 1 res = 1 for i in range(n): if arr[i] > 0: mxth = mxth*arr[i] mnth = min(mnth*arr[i], 1) elif arr[i] < 0: tmp = mxth ...
StarcoderdataPython
3412155
<filename>examples/docs_snippets/docs_snippets/concepts/partitions_schedules_sensors/sensors/sensors.py """isort:skip_file""" from dagster import repository, SkipReason # start_sensor_pipeline_marker from dagster import solid, pipeline @solid(config_schema={"filename": str}) def process_file(context): filename...
StarcoderdataPython
3240118
#!/usr/bin/env python ''' DESCRIPTION ----------- Exporting dataset into pck format RETURN ------ {DATASET}.pck : pck file pck version of file EXPORTED FILE(s) LOCATION ------------------------- ./data/external/{EXPERIMENT}/{DATASET}.pck ''' # importing default libraries import os, argparse,...
StarcoderdataPython
6562492
#!/usr/bin/env python3 # Copyright 2021 by <NAME>, Robotic Systems Lab, ETH Zurich. # All rights reserved. # This file is released under the "BSD-3-Clause License". # Please see the LICENSE file that has been included as part of this package. import click import numpy as np import torch import yaml import deploy.teste...
StarcoderdataPython
12818471
<reponame>smashwidget/dl-1 import adv.adv_test from adv import * from slot.a import * from slot.d import * def module(): return Fjorm class Fjorm(Adv): # comment = 'do not calc damage counter' a3 = ('prep', 100) conf = {} #conf['slot.d'] = DJ() conf['acl'] = """ `s1 `s2 ...
StarcoderdataPython
335746
<reponame>alambert14/camera-duckie<gh_stars>0 #!/usr/bin/env python import cv2 from cv_bridge import CvBridge import numpy as np import rospy import message_filters from sensor_msgs.msg import Image, CompressedImage, CameraInfo class camera_sync_node(): def __init__(self): #initialize publisher and the ...
StarcoderdataPython
8034751
from ..scripts.ldap_query import LDAPQuery from .. import models import transaction from sqlalchemy import exc, func from sqlalchemy.schema import Sequence from ..scripts.pt_mailer import PTMailer from ..scripts.ldap_query import LDAPQuery from geoalchemy2 import Geometry import json class Utils(): @classmethod ...
StarcoderdataPython
3346230
<filename>aws_ec2_assign_elastic_ip/__init__.py """ Assign EC2 Elastic IP to the current instance """ import logging import logging.config import sys if sys.platform in ['win32', 'cygwin']: import ntpath as ospath else: import os.path as ospath from netaddr import IPNetwork, AddrFormatError, AddrConversionErr...
StarcoderdataPython
1905456
<reponame>steveayers124/PythonStandardLibraryEssentialTraining # Working with ZIP files in Python import zipfile # TODO: Create a new ZIP archive # TODO: Check validity of the file # TODO: Read the properties of a ZIP archive # TODO: Read the properties of ZIP contents # TODO: Extract ZIP file contents # zfil...
StarcoderdataPython
3282000
import serial import time from struct import unpack command = '010300480008C41A' def send_command(ser): ser.write('\x01') ser.write('\x03') ser.write('\x00') ser.write('\x48') ser.write('\x00') ser.write('\x08') ser.write('\xC4') ser.write('\x1A') with serial.Serial("/dev/tty.wchusbserial1420", 4800,...
StarcoderdataPython
3351966
from __future__ import print_function import sys import subprocess import unittest from gevent.thread import allocate_lock import gevent.testing as greentest script = """ from gevent import monkey monkey.patch_all() import sys, os, threading, time # A deadlock-killer, to prevent the # testsuite to hang forever def k...
StarcoderdataPython
1802677
import os import shutil from bincrafters_conventions.actions.update_gha import update_gha def update_migrate_travis_to_import_and_gha(main, travis_file) -> bool: def _contains(search_pattern: str) -> bool: return main.file_contains(travis_file, search_pattern) runs_macos = _contains("CONAN_APPLE_CLAN...
StarcoderdataPython
4886535
<gh_stars>0 from wrappers import SONATAClient from pytest import fixture from .sonata_fixture import * from .config import * import json import yaml import time from .helpers import Helpers def test_get_son_packages(get_son_packages_keys): """Tests API call to fetch multiple sonata packages""" son...
StarcoderdataPython
6558337
<reponame>lbechberger/LearningPsychologicalSpaces # -*- coding: utf-8 -*- """ Runs the specified regressions and stores the results in the given file. Created on Tue May 14 10:12:54 2019 @author: lbechberger """ import argparse, pickle, os, fcntl import numpy as np from sklearn.metrics import mean_squared_error, r2_...
StarcoderdataPython
3248121
<filename>exercises/fr/solution_03_06.py import spacy # Définis le composant personnalisé def length_component(doc): # Obtiens la longueur du doc doc_length = len(doc) print(f"Ce document comporte {doc_length} tokens.") # Retourne le doc return doc # Charge le petit modèle français nlp = spacy.lo...
StarcoderdataPython
4818727
<reponame>PapenfussLab/MHC-clogs #!/usr/bin/env python """ initialize_genome_extract.py """ import os import sys import glob import copy from argparse import ArgumentParser from srt.intervals import GenomeIntersector from mhc.data import * from mhc.hmmer import * def is_not_class_II(classI, classII_intersector): ...
StarcoderdataPython
4966407
# Copyright 2022 Red Hat Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
StarcoderdataPython
1633896
from gym.spaces import Space, Discrete, MultiBinary, MultiDiscrete, Box, Dict, Tuple def check_space(space, strict=False): """ Ensure that the space is a gym Space, including all nested spaces. strict (bool), default False: If strict is True, then the recursion rule is that every subspace must be...
StarcoderdataPython
6604996
<filename>eazieda/missing_detect.py<gh_stars>1-10 import pandas as pd def missing_detect(data): """ Return the number/percentage of missing values for each column in the dataframe Parameters ---------- data : pandas.core.frame.DataFrame A Pandas Dataframe for which the missing values ...
StarcoderdataPython
11360422
<reponame>abhinav-upadhyay/algo-1-sedgewick<filename>unionFind/QuickFind.py class QuickFind(): def __init__(self, n): self.nodes = [] for i in range(n): self.nodes.append(i) def connected(self, p, q): if self.nodes[p] == self.nodes[q]: return True else: ...
StarcoderdataPython
8039194
<reponame>DenseAI/VirusDB<filename>DenseAI/VirusDB/reformer/revnet/config.py # Copyright 2018 The TensorFlow Authors. 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 at # # ...
StarcoderdataPython
4894156
import pytest from fastapi.testclient import TestClient from typing import List @pytest.mark.parametrize("url", [ "https://stackoverflow.com/questions/tagged/python", "https://www.google.com/search?q=python+learn", ...
StarcoderdataPython
285843
# coding: utf-8 ### # @file byzWorker.py # @author <NAME> <<EMAIL>> # # @section LICENSE # # Copyright (c) 2020 <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 ...
StarcoderdataPython
8171719
# Copyright 2021 Dakewe Biotech 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 at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
StarcoderdataPython
1928201
from flask import abort from werkzeug.wrappers import Response from backend.common.decorators import cached_public from backend.common.models.event import Event from backend.common.models.keys import MatchKey from backend.common.models.match import Match from backend.web.profiled_render import render_template @cache...
StarcoderdataPython
5106225
""" Copyright (c) Microsoft Corporation. Licensed under the MIT license. UNITER finetuning for NLVR2 """ import argparse import os from os.path import exists, join from time import time import numpy as np import torch import cv2 as cv from torch.nn import functional as F from torch.nn.utils import clip_grad_norm_ fro...
StarcoderdataPython
104144
<filename>pynetest/lib/expectations/raise_expectation.py from pynetest.lib.expectation import Expectation from pynetest.lib.matcher import Matcher class RaiseExpectation(Expectation): def __init__(self, error_matcher, exception_format=None): if exception_format is None: exception_format = lamb...
StarcoderdataPython
164723
<reponame>takekoputa/project-euler # https://projecteuler.net/problem=91 # Fast enough """ Note that: OP^2 = X_P^2 + Y_P^2 OQ^2 = X_Q^2 + Y_Q^2 PQ^2 = (X_P - X_Q)^2 + (Y_P - Y_Q)^2 There are 3 cases: 1. OP^2 + OQ^2 = PQ^2 -> X_P * X_Q + Y_P * Y_Q = 0 2. OP^2 + PQ^2 = OQ^2 -> X_P^2 ...
StarcoderdataPython
3264310
<filename>mayan/apps/announcements/tests/test_copying.py from mayan.apps.common.tests.mixins import ObjectCopyTestMixin from mayan.apps.testing.tests.base import BaseTestCase from .mixins import AnnouncementTestMixin class AnnouncementCopyTestCase( AnnouncementTestMixin, ObjectCopyTestMixin, BaseTestCase ...
StarcoderdataPython
3264522
<filename>semana-02/lista-exercicio/lista-1/warm_up.py # 1) [X] Crie a classe Televisao com os atributos ligada (inicializado com valor False) e canal (inicializado com valor 2). # 2) [X] Adicione os atributos tamanho e marca à classe Televisao. Crie dois objetos Televisao e atribua tamanhos e marcas diferentes. # ...
StarcoderdataPython
9654965
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.model_selection import LeaveOneGroupOut from plot_with_PE_imputation import plot_with_PE_imputation import matplotlib.colors as colo...
StarcoderdataPython
232968
from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase class PBXSourcesBuildPhase(PBXGenericBuildPhase): def _get_comment(self): return 'Sources'
StarcoderdataPython
8198685
<reponame>wesleyr36/piano-unmix<filename>tests/test_datasets.py import pytest import numpy as np import torchaudio from openunmix import data @pytest.fixture(params=["soundfile", "sox_io"]) def torch_backend(request): return request.param def test_musdb(): musdb = data.MUSDBDataset(download=True, samples_p...
StarcoderdataPython
3476018
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2019, Battelle Memorial Institute. # # 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...
StarcoderdataPython
210071
<filename>PROGRAMS/IGCSEPhysicsSorting.py #IMPORTING NECESSARY LIBRARIES import tkinter as tk from tkinter import * from tkinter import filedialog from tkinter import Tk from array import * import os import time import PyPDF2 from tkinter import ttk from ttkthemes import themed_tk as theme #DEFINING IMPORT...
StarcoderdataPython
6449646
<filename>src/object_listener_test.py<gh_stars>0 #! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2016 kirmani <<EMAIL>> # # Distributed under terms of the MIT license. """ Test file for object listener. """ from action_process import ActionProcess from point_at_object import PointAtObj...
StarcoderdataPython
6693441
<filename>unixtimestamp/views.py """Unix Timestamp Flask application.""" import locale import math import os from datetime import datetime import flask from flask import request from dateutil.parser import parse from flask_accept import accept_fallback from pytz import utc import unixtimestamp # pylint:disable=cyc...
StarcoderdataPython
1692493
#coding utf-8 """ Faça um Programa que mostre a mensagem "Alo mundo" na tela. """ print("Ol<NAME>") input()
StarcoderdataPython
6687972
TWITTER_FILE_PATH = "/Users/tanmaymathur/Documents/personal_workspace/" BATCH_NUM_LINES = 100 RADIUS = 5 FIND_ROWS_IN_RADIUS = """SELECT a.latitude, a.longitude, report_type, city FROM repository_reporttable a WHERE ("acos(sin(a.latitude * 0.0175) * sin({source_latitude} * 0.0175)+ cos(a.latitude * 0.0175) * cos({sourc...
StarcoderdataPython
4999774
from html_img.render import img_to_html
StarcoderdataPython
6689290
#!/usr/bin/env python3 # 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. r""" Example TorchGeneratorAgent model. This demonstrates the minimal structure of a building a generative mod...
StarcoderdataPython
11200853
"""Make a control file which allows for deb file installers.""" import logging from fab_deploy import __version__ _LOGGER = logging.getLogger(__name__) dct = { "Package": "fab", "Version": __version__, "Section": "custom", "Priority": "optional", "Architecture": "amd64", "Essential": "no", ...
StarcoderdataPython
25416
<reponame>nschloe/maelstrom<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import print_function from dolfin import plot, dx, Constant, Measure, Function, project, XDMFFile import matplotlib.pyplot as plt import numpy import problems import maelstrom import parabolic def _paramete...
StarcoderdataPython
155634
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # CHNetworkSegment datasource # ---------------------------------------------------------------------- # Copyright (C) 2007-2017 The NOC Project # See LICENSE for details # --------------------------------------------------...
StarcoderdataPython
45053
<filename>{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/wsgi.py<gh_stars>1-10 from {{cookiecutter.project_name}}.main import create_app app = create_app()
StarcoderdataPython
6682359
from app import db __author__ = 'ThinkPad' class Citation(db.Model): pass
StarcoderdataPython
3367682
<reponame>braycarlson/viking from database.model import LoLChampions, LoLSpells from rapidfuzz import process from utilities.format import format_list from utilities.request import fetch BASE = 'https://na1.api.riotgames.com/lol' ASSET = 'https://ddragon.leagueoflegends.com' UGG = 'https://u.gg/lol/champions' class...
StarcoderdataPython
8092549
sigma=0.10895354 thres=0.103468491232405 import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import MultipleLocator import scipy.integrate as integrate import math def R(x): return (1+math.erf(x/(sigma*2)))/2 def F(x): return -math.log(x)/R(x-thres) plt.rcParams['figure.figsize'] = (8....
StarcoderdataPython
6458654
""" @author: Heerozh (<NAME>) @copyright: Copyright 2019, Heerozh. All rights reserved. @license: Apache 2.0 @email: <EMAIL> """ from typing import Optional, Sequence from .factor import BaseFactor, CustomFactor from .datafactor import ColumnDataFactor from ..parallel import Rolling import pandas as pd import numpy as ...
StarcoderdataPython
11306231
import pickle from os import rename, remove from os.path import join, dirname, realpath, isfile import keras.backend as K import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf from keras.callbacks import ModelCheckpoint from keras.layers import BatchNormalization, Dropout from ...
StarcoderdataPython
3397584
"""Examples for ThreadExecutor.""" # [ Import ] # [ -Python ] import time from concurrent import futures # [ -Project ] import a_sync EXECUTOR = a_sync.ThreadExecutor() def rest(seconds: int) -> int: """Rest function.""" # can't use f-strings with mypy checking: https://github.com/python/mypy/issues/2265 ...
StarcoderdataPython
9621638
<filename>samples/src/main/resources/datasets/python/131.py<gh_stars>10-100 def unaryOp5(a, b): return not +a
StarcoderdataPython
11343779
<filename>load-testers/locust-tasks/tasks.py from locust import HttpLocust, TaskSet token = '<KEY>' def get_analyze(l): l.client.get("random", headers={'Authorization': token}) class UserBehavior(TaskSet): tasks = {get_analyze: 1} def on_start(self): get_analyze(self) class WebsiteUser(HttpLocu...
StarcoderdataPython
5134190
<filename>django_application/products/urls.py from django.urls import path from . import views app_name = "products" urlpatterns = [ path("", views.IndexView.as_view(), name="index"), path("<uuid:pk>/", views.DetailView.as_view(), name="detail"), path("new/", views.ProductFormView.as_view(), name="new"), ...
StarcoderdataPython