id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
8135968 | class Pilha :
# construtor
def __init__(self, lista):
self.lista = lista
# metodo de insercao
def push(self, elem):
self.lista.append(elem)
# metodo de remocao do
def pop(self):
self.lista.pop()
# metodo de listagem
def listar(self):
a = 0
for item... | StarcoderdataPython |
11342008 | from __future__ import annotations
import typing
import jinja2
import weakref
import traceback
import re
import os
import sys
import inspect
import json
import queue
import importlib
import gevent
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pyhtmlgui.pyhtmlgui import PyHtmlGui
from pyhtmlgui.view.py... | StarcoderdataPython |
4894472 | # -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------\
fr... | StarcoderdataPython |
1678638 | <reponame>Acuf5928/check-
from fbs import SETTINGS
from fbs_runtime import FbsError
from subprocess import run, DEVNULL, check_call, check_output, PIPE, \
CalledProcessError
import re
def preset_gpg_passphrase():
# Ensure gpg-agent is running:
run(
['gpg-agent', '--daemon', '--use-standard-socket'... | StarcoderdataPython |
9635287 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
def norm_histogram(hist):
"""
takes a histogram of counts and creates a histogram of probabilities
:param hist: list
:return: list
"""
j = 0;
hist_sum = 0;
hist_new = [];
while j < len(hist):
hist_sum = ... | StarcoderdataPython |
1754792 | # Copyright (c) 2019 - The Procedural Generation for Gazebo authors
# For information on the respective copyright owner see the NOTICE file
#
# 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 |
3490916 | <reponame>omar115/dvizio-test
from os import name
import task
import traceback
import pandas as pd
import numpy as np
# driver code
def main():
radius, zipcode = task.user_input()
driver = task.init_driver()
print("---Process Started---")
task.login(driver)
df = task.scrape_data(dr... | StarcoderdataPython |
1607314 | <gh_stars>10-100
import Tkinter as tk
from common.styles import BUTTON_X_MARGIN, LG_BODY_COLOR, LG_BODY_FONT
from common.tools import create_buttons, is_within
class ReversedCheckbutton(tk.Frame):
def __init__(self, parent, text, variable, command):
tk.Frame.__init__(self, parent)
self.checkbutto... | StarcoderdataPython |
9603196 | from django.apps import AppConfig
class SourceConfig(AppConfig):
name = 'source'
verbose_name = "水印服务"
main_menu_index = 2
| StarcoderdataPython |
301932 | <reponame>pmaigutyak/mp-config
# Generated by Django 2.0.6 on 2018-08-10 16:16
from django.db import migrations, models
import site_config.models
class Migration(migrations.Migration):
dependencies = [
('site_config', '0003_auto_20171023_1207'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
3447494 | <reponame>rrlyman/PythonMachineLearingExamples
"""
Example employing Lasagne for digit recognition using the MNIST dataset.
This example is deliberately structured as a long flat file, focusing on how
to use Lasagne, instead of focusing on writing maximally modular and reusable
code. It is used as the foundation for th... | StarcoderdataPython |
9774162 | """Test main ARgorithmToolkit classes
"""
import ARgorithmToolkit
def test_base():
"""Test Stateset add_state
"""
a = ARgorithmToolkit.StateSet()
a.states.append('test state')
assert len(a.states) == 1
def test_state():
"""Test State exception handling
"""
try:
ARgorithmToolkit... | StarcoderdataPython |
5036810 | # See LICENSE for licensing information.
#
# Copyright (c) 2021 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
from amaranth import Instance
from amaranth import tr... | StarcoderdataPython |
9658826 | <filename>core/arxiv/submission/services/compiler/__init__.py
"""Integration with the compiler service API."""
from .compiler import Compiler, get_task_id, split_task_id, CompilationFailed
| StarcoderdataPython |
196651 | <reponame>locationlabs/ansible-action-plugins
from ansible.runner.return_data import ReturnData
class ActionModule(object):
def __init__(self, runner):
self.runner = runner
self.runner.run_once = True
def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **kwargs):
... | StarcoderdataPython |
11264786 | <gh_stars>10-100
from ray.rllib.env.remote_base_env import RemoteBaseEnv
from ray.rllib.utils.deprecation import deprecation_warning
deprecation_warning(
old="rllib.env.remote_base_env.RemoteVectorEnv",
new="ray.rllib.env.remote_base_env.RemoteBaseEnv",
error=False)
RemoteVectorEnv = RemoteBaseEnv
| StarcoderdataPython |
6434640 | <reponame>nijatrajab/fileshare<filename>fileshare/fileup/urls.py
from django.urls import path
from . import views
app_name = 'fileup'
urlpatterns = [
# path('', views.FileListView.as_view(), name='list'),
path('file/<user_id>/', views.user_file, name='filelist'),
path('upload/', views.FileUploadView.as_vi... | StarcoderdataPython |
4828034 | <gh_stars>0
from __future__ import print_function
from pyspark.sql import SparkSession
from pyspark.sql.types import DoubleType
from pyspark.sql.types import StructField
from pyspark.sql.types import Struct... | StarcoderdataPython |
9772063 | from django.core.wsgi import get_wsgi_application
import wsgiserver
def start_server( address="0.0.0.0", port=8080):
"""
server = wsgiserver.WSGIServer(
(address, port), # Use '127.0.0.1' to only bind to the localhost
get_wsgi_application()
)
"""
server = wsgiserver.WSGIServe... | StarcoderdataPython |
9645300 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# title : templates.py
# description : Contains templates for different export types.
# author : <NAME>
# date : 2017.08.17
# version : 0.1
# ==================================================================
CSS = ""
HTML = u"<!DOCTYPE html>... | StarcoderdataPython |
35407 | from ..fuzzable import Fuzzable
class Simple(Fuzzable):
"""Simple bytes value with manually specified fuzz values only.
:type name: str, optional
:param name: Name, for referencing later. Names should always be provided, but if not, a default name will be given,
defaults to None
:type default... | StarcoderdataPython |
1687334 | from dbArtistsBase import dbArtistsBase
from dbBase import dbBase
from artistMB import artistMB
from discogsUtils import musicbrainzUtils
import urllib
from urllib.parse import quote
from webUtils import getHTML
from fsUtils import isFile, setFile
from multiArtist import multiartist
from ioUtils import getFile
from tim... | StarcoderdataPython |
4829994 | <gh_stars>0
from coup import app
from coup.socketio_handlers import run_socketio
from coup.utils.argument_parsing import parse_args
if __name__ == "__main__":
parsed_args = parse_args()
keep_client_order = parsed_args["keep_client_order"]
run_socketio(app, '0.0.0.0', keep_client_order, parsed_args) | StarcoderdataPython |
5075741 | <gh_stars>100-1000
class FrameBuffer:
pass
| StarcoderdataPython |
1832033 | from indra.java_vm import autoclass
from indra.biopax import biopax_api
from indra.pysb_assembler import PysbAssembler
def test_hyphenated_agent_names():
"""This query should contain reactions with agent names RAF1-BRAF,
which need to be canonicalized to Python-compatible names before
model assembly."""
... | StarcoderdataPython |
1784700 | <reponame>Rmond/OperMge
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-19 17:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hd_ansible', '0003_software'),
]
operations = [
... | StarcoderdataPython |
6700238 | from datetime import date
anoNascimento = int(input('Digite o ano que vc nasceu...'))
atual = date.today().year
idade = atual - anoNascimento
print('==='*25)
if idade >= 18:
print('pode alistar')
elif idade < 18:
print('nao precisa alistar')
print('==='*25)
| StarcoderdataPython |
1763165 | <reponame>Nael-Nathanael/holocn-graduation<gh_stars>10-100
"""
E2E test for whether API messages from Backend and DOM messages displayed
on Frontend matches.
Checks native messages, JP messages, flag emojis, and username.
Exercises the following UI elements:
- Full site translate botan on NavBar
- Loading and display... | StarcoderdataPython |
9614723 | <filename>python-pipelines/setup.py
import setuptools
setuptools.setup(
author="pabs",
author_email="<EMAIL>",
name="pipeline-xlang",
url="https://github.com/prodriguezdefino/dataflow-xlang-pipelines",
packages=setuptools.find_packages()) | StarcoderdataPython |
1700875 | <gh_stars>1000+
from .engine import Event, EventEngine, EVENT_TIMER
| StarcoderdataPython |
1681915 | <filename>tests/gsl/pdf_dirichlet.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME>
# orthologue
# (c) 1998-2019 all rights reserved
#
"""
Exercise the gaussian pdf
"""
def test():
# math
from math import pi, sqrt, exp
# access the package
import gsl
# build a random number generator... | StarcoderdataPython |
247114 | # ПРИМЕР ЧТЕНИЯ ТЕКУЩЕЙ ПОЗИЦИИ ВАЛА ЭНКОДЕРА:
# Зная точную позицию Вала энкодера, работа
# с модулем похожа на работу с потенциометром.
from time import sleep
# Подключаем библиотеку для работы с энкодером I2C-flash.
from pyiArduinoI2Cencoder import *
# Инстанцируем объект, указывая адрес модуля на шине... | StarcoderdataPython |
1693307 | <reponame>gregaw/mapel
import numpy as np
from mapel.main.embedding.kamada_kawai.energy_functions import get_energy_dx, get_energy_dy, get_energy_dx_dx, \
get_energy_dx_dy, get_energy_dy_dx, get_energy_dy_dy
def optimize_bb(func, grad_func, args, x0, max_iter, init_step_size, stop_energy_val=None,
... | StarcoderdataPython |
4969480 | # --------------------------------------------------------
# Model from official source: https://github.com/ShoufaChen/CycleMLP
# --------------------------------------------------------
import math
import torch
import torch.nn as nn
from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from timm.models.fe... | StarcoderdataPython |
5178603 | from invoke import task
@task
def deploy(ctx):
ctx.run(
"gcloud functions deploy process_crash_reports --runtime python37 --project decoded-cove-239422 --trigger-http --allow-unauthenticated"
)
| StarcoderdataPython |
11345446 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 9 13:01:20 2021
@author: <NAME>
"""
class SpiceHandler:
import os
import subprocess
import time
import re
from Components import Component, Component2Pin, Capacitor, Resistor, BJT
measVRMS = ".meas %s+VRMS RMS V"
measVMAX = ".meas %s+VMA... | StarcoderdataPython |
6614761 | <filename>strategies/bayes.py
import os
import math
import dbh_util as util
from sklearn.naive_bayes import GaussianNB
def predict(classifier, test, args, sargs_str, threshold=None):
preds = classifier.predict(test[0])
if threshold is not None:
preds = [1 if x >= threshold else 0 for x in preds]
r... | StarcoderdataPython |
5056519 | <filename>libs/coda/io/codec.py
'''Base classes for CODA codecs.'''
from abc import ABCMeta, abstractmethod
class EncodingError(Exception):
'''Base class for exceptions encountered during encoding or decoding.'''
def __init__(self, msg):
self.__msg = msg
def msg(self):
return self.__msg
class Encoder(... | StarcoderdataPython |
228051 | import numpy as np
import mytorch.simple_core
from mytorch.simple_core import Variable
A = mytorch.simple_core.Square()
B = mytorch.simple_core.Exp()
C = mytorch.simple_core.Square()
# y = (e^{x^2})^2
# 계산 그래프의 연결 x -> A -> a -> B -> b -> C -> y
x = Variable(np.array(0.5))
a = A(x)
b = B(a)
y = C(b)
assert y.creat... | StarcoderdataPython |
6699663 | #!/usr/bin/env python3
import platform
import subprocess
print ("WARNING! This is a work in progress script. It has been tested to work for Fedora and debian-based systems. \
There are individual operating system dependent scripts being called from this one. \
You can find them in setup directory. The script for w... | StarcoderdataPython |
6700255 | <filename>middleware/auth.py
from flask import request, redirect
from core.middleware import Middleware
from redis_model import Session
class AuthMiddleware(Middleware):
def pre_check(self, *args, **kwargs):
access_token = request.headers.get("Authorization")
session = Session(access_token)
... | StarcoderdataPython |
6495400 | <filename>app.py
import dash
import dash_bootstrap_components as dbc
#external_stylesheets=[dbc.themes.SUPERHERO]
external_stylesheets=[dbc.themes.GRID]
app = dash.Dash(__name__,external_stylesheets = external_stylesheets, suppress_callback_exceptions=True)
| StarcoderdataPython |
5189299 | <reponame>hiway/python-zentropi
# coding=utf-8
"""
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mzentropi`... | StarcoderdataPython |
258379 | class Logger:
# Logger channel.
channel: str
def __init__(self, channel: str):
self.channel = channel
def log(self, message):
print(f'\033[92m[{self.channel}] {message}\033[0m')
def info(self, message):
print(f'\033[94m[{self.channel}] {message}\033[0m')
def warning(s... | StarcoderdataPython |
3587610 | import random
import tensorflow
import pandas
from tqdm import tqdm
import matplotlib.pyplot as plt
import os
import numpy
from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten, BatchNormalization
from mnist_format_images import imageprepare
'''read file'''
digit_0 = 'trainingSet/0... | StarcoderdataPython |
5103157 | <gh_stars>0
# -- coding: utf-8 --
from django.shortcuts import render
from django.views.decorators import csrf
def search_post(request):
ctx = {}
if request.POST:
ctx['rlt'] = request.POST['q']
return render(request, "post.html", ctx)
| StarcoderdataPython |
5017832 | <reponame>obestwalter/pybuilder_pytest_plugin
# pybuilder_header_plugin
# Copyright 2014 <NAME>
#
# 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 |
3435363 | <filename>src/dsmil/train.py
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.autograd import Variable
import torchvision.transforms.functional as VF
from torchvision import transforms
import sys, argparse, os, copy, itertools, glob, datetime
import pandas as pd
import numpy as np
... | StarcoderdataPython |
393829 | from torch.utils.data import Dataset, DataLoader
import numpy as np
def noramlization(data):
minVals = data.min(0)
maxVals = data.max(0)
ranges = maxVals - minVals
normData = (data - minVals) / ranges
return normData
def z_score(data):
data -= np.mean(data, axis=0)
data /= np.std(data, a... | StarcoderdataPython |
6445677 | <filename>dev/archery/archery/crossbow/tests/test_reports.py
# 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... | StarcoderdataPython |
11393760 | <reponame>mike-lischke/mysql-shell-plugins
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also dist... | StarcoderdataPython |
4909049 | """
importguests command
Parse a guest list csv file to store them in the guest list
Created by lmarvaud on 03/11/2019
"""
import csv
import itertools
import logging
import operator
from argparse import RawDescriptionHelpFormatter
from django.conf import settings
from django.core.management import BaseCommand, Comma... | StarcoderdataPython |
4927000 | <filename>tests/fixtures/data.py
# -*- coding: utf8 -*-
from skosprovider.providers import (
DictionaryProvider
)
from skosprovider.skos import (
ConceptScheme,
Label
)
larch = {
'id': 1,
'uri': 'http://python.com/trees/larch',
'labels': [
{'type': 'prefLabel', 'language': 'en', 'labe... | StarcoderdataPython |
9726948 | <reponame>TheCarvalho/atividades-wikipython
'''
45. Desenvolver um programa para verificar a nota do aluno em uma prova com 10 questões, o programa deve perguntar ao
aluno a resposta de cada questão e ao final comparar com o gabarito da prova e assim calcular o total de acertos e a nota
(atribuir 1 ponto por resposta c... | StarcoderdataPython |
388316 | # Copyright 2016 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
9791334 | <gh_stars>10-100
'''
Race_Statistics_Functions.py
This module contains the race stats function generate_race_stats().
It is called in Race_Detection_and_Statistics.py to compute race stats.
'''
from collections import OrderedDict
import numpy as np
import pandas as pd
from .Race_Msg_Outcome imp... | StarcoderdataPython |
4858453 | <gh_stars>0
import re
from Lexical.Token import Token, Definition
from Enum.TokenType import TokenType
class Lexer:
def __init__(self):
self.token_definitions = [];
self.term_pattern = re.compile('\r\n|\r|\n')
def add_definition(self, type, pattern, ignored = False):
definition = Defi... | StarcoderdataPython |
6434432 | <reponame>willem-vanheemstrasystems/django-frontend<gh_stars>0
from django.conf.urls import url
from . import views
urlpatterns = [
# ex: /client/
url(r'^$', 'mysite.client.views.index', name='index'),
]
| StarcoderdataPython |
3589463 | <reponame>mblackgeo/lambdarado_py
from lambdarado import start
def get_app():
from .app_creator import app
return app
start(get_app)
| StarcoderdataPython |
3387668 | <reponame>vscg/spotify-client<gh_stars>0
import copy
import logging
import random
from base64 import b64encode
from datetime import datetime, timedelta
from typing import List, Union
from urllib.parse import urlencode
import requests
from .config import Config
from .exceptions import ClientException, ImproperlyConfig... | StarcoderdataPython |
11371036 | # Copyright (C) 2022 <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 use, copy, modify, merge, publish, distribute, ... | StarcoderdataPython |
3569693 | <filename>spax/linalg/lobpcg/ortho.py
import typing as tp
from functools import partial
import jax
import jax.numpy as jnp
from spax.linalg.lobpcg import utils
from spax.linalg.utils import as_array_fun, standardize_signs
from spax.types import ArrayFun, ArrayOrFun
class OrthoState(tp.NamedTuple):
iterations: i... | StarcoderdataPython |
8139756 | <filename>packages/watchmen-pipeline-kernel/src/watchmen_pipeline_kernel/pipeline_schema/compiled_stage.py
from logging import getLogger
from traceback import format_exc
from typing import List
from watchmen_auth import PrincipalService
from watchmen_data_kernel.storage_bridge import now, parse_prerequisite_defined_as... | StarcoderdataPython |
4822955 | import paramiko
class server:
def __init__(self, host, port, username, password=<PASSWORD>):
self.ssh = paramiko.SSHClient()
# Since we're just going to be executing some simple commands,
# there's no reason to enforce host key checks.
self.ssh.set_missing_host_key_policy(
paramiko.AutoAddPolic... | StarcoderdataPython |
6705532 | <filename>recipe/run_test.py
import os
import sys
# Force OpenBLAS to use a single thread to prevent image-rotation
# test failures on macOS. See https://github.com/sunpy/sunpy/issues/4290
# for more information.
os.environ['OMP_NUM_THREADS'] = '1'
import sunpy
sys.exit(sunpy.self_test()) | StarcoderdataPython |
8012506 | <gh_stars>1-10
from .data_set import DataSet
from .admin import AdminAPI
from .collector import CollectorAPI
__import__('pkg_resources').declare_namespace(__name__)
| StarcoderdataPython |
4804868 | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
def model(X, hidden_weights, hidden_bias, ow):
hidden_layer = tf.nn.sigmoid(tf.matmul(X, hidden_weights) + b)
return tf.matmul(hidden_layer, ow)
train_samples = 200
test_samples = 60
ds_X = np.lins... | StarcoderdataPython |
5104220 | <reponame>Monstrofil/locale_exporter_wows
#!/usr/bin/python3
# coding=utf-8
import argparse
import shutil
from pathlib import Path
import py7zr
import os
import tempfile
import requests
from lxml import etree
from subprocess import Popen
__author__ = "<NAME>"
class LocalizationHelper(object):
LOCALE_TO_REGION... | StarcoderdataPython |
3554345 | <filename>venv/lib/python3.8/site-packages/stem/util/system.py
# Copyright 2011-2019, <NAME> and The Tor Project
# See LICENSE for licensing information
"""
Helper functions for working with the underlying system. These are mostly os
dependent, only working on linux, osx, and bsd. In almost all cases they're
best-effo... | StarcoderdataPython |
1946168 | <filename>examples/simple.py
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 <NAME>
# Made available under the MIT license.
import time
import freshroastsr700
# Create a roaster object.
roaster = freshroastsr700.freshroastsr700()
# Conenct to the roaster.
roaster.connect()
# Set variables.
roaster.heat_setting =... | StarcoderdataPython |
4908208 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 24 15:09:49 2019
@author: epyir
"""
import torch
import torch.nn as nn
class Loss(nn.Module):
def __init__(self):
super(Loss, self).__init__()
def forward(self, input, target):
pass
class baseline(nn.Module):
"""
... | StarcoderdataPython |
3369964 | """Run unit tests.
Use this to run tests and understand how tasks.py works.
Setup::
mkdir -p test-data/input
mkdir -p test-data/output
mysql -u root -p
CREATE DATABASE testdb;
CREATE USER 'testusr'@'localhost' IDENTIFIED BY 'test<PASSWORD>';
GRANT ALL PRIVILEGES ON testdb.* TO 'te... | StarcoderdataPython |
8165357 | import torch
import unittest
from cnns.nnlib.pytorch_layers.pytorch_utils import flip
from cnns.nnlib.pytorch_layers.pytorch_utils import preserve_energy2D
from cnns.nnlib.pytorch_layers.pytorch_utils import complex_mul
from cnns.nnlib.pytorch_layers.conv2D_fft import Conv2dfft
from cnns.nnlib.utils.arguments import Ar... | StarcoderdataPython |
1802600 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 18 20:25:42 2020
"""
from PIL import Image
import os
import random
def main():
#imgarray = [f for f in os.listdir('../imagesv2') if os.path.isfile(os.path.join('../imagesv2', f))]
SAVE_DIR='path'
IMG_DIR='path'
BG_DIR='path'
NUMBEROFIMG=50... | StarcoderdataPython |
11342671 | # Modified from SUTD and https://github.com/bentrevett/pytorch-sentiment-analysis
# LeNet Implementation, run on FashionMNIST
# https://ieeexplore.ieee.org/abstract/document/726791
# PDF: http://www.cs.virginia.edu/~vicente/deeplearning/readings/lecun1998.pdf
import torch
import torch.nn as nn
import torch.nn.functio... | StarcoderdataPython |
8122571 | import pandas as pd
from collections import Counter
from wordcloud import WordCloud
import emoji
import altair as alt
from urlextract import URLExtract
import plotly.graph_objects as go
urlextractor = URLExtract()
def fetch_messages(df, user):
"""
Returns messages of selected user
"""
if user.lower() ... | StarcoderdataPython |
1984797 | <reponame>CTSRD-CHERI/cheritest
#-
# Copyright (c) 2012 <NAME>
# Copyright (c) 2019 <NAME>
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research program... | StarcoderdataPython |
6592682 | from guillotina import app_settings
from guillotina import configure
from guillotina.profile import profilable
from guillotina_rediscache import cache
from guillotina_rediscache import serialize
from guillotina_rediscache.interfaces import IRedisChannelUtility
import aioredis
import asyncio
import logging
import pickl... | StarcoderdataPython |
122053 | #! /usr/bin/python
import logging
import os.path
import argparse
from twisted.internet import reactor
from twisted.internet.protocol import Protocol
from flock.roster import Roster
from flock.controller_factory import ControllerFactory
from flock.controller.rfxcom.protocol import RfxcomProtocol
from flock.controlle... | StarcoderdataPython |
9612496 | from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# Importing the Kratos Library
import KratosMultiphysics
# Import applications and dependencies
import KratosMultiphysics.ParticleMechanicsApplication as KratosParticle
# Importing... | StarcoderdataPython |
3478034 | import numpy as np
class Cache(object):
def __init__(self, dim):
self.dim = dim
self.init()
def add(self, i, j, delta_cc, subset):
self.cc_list[i, j] = delta_cc
self.subsets[i, j] = subset
def remove(self, idx):
self.cc_list = np.delete(self.cc_list, idx, 0)
... | StarcoderdataPython |
129623 | import ast
import sqlite3
import sys
import traceback
import unittest
from io import StringIO
from time import sleep
from unittest import mock
from littleutils import SimpleNamespace, only
import sorcery as spells
from sorcery import unpack_keys, unpack_attrs, print_args, magic_kwargs, maybe, args_with_source, spell
... | StarcoderdataPython |
9666812 | <filename>AnalysisCurlDemo/interface/i451c4p2.py
# coding: utf-8
from util import fileutil
from module import dataprocess
from module import dataplot
from module import polyprocess
import _thread
def getcurveresult(filledDateValArr):
step = 5
((dateArr, dataArr), (mergedDateArr, mergedDataArr)) = \
d... | StarcoderdataPython |
300948 | <filename>demos/samplemax_solution.py
import random
import sys
from mpyc.seclists import seclist
from mpyc.runtime import mpc
"""
Run it with one party:
python3 samplemax.py
Run it at once with 3 parties, of which 1 corrupted:
python3 samplemax.py -M3 -T1
Run it in separate shells with 3 parties, of which 1 corr... | StarcoderdataPython |
5026738 | #! /usr/bin/python3
# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
#
# Code Modified from Rethink Robotics:
import os
import sys
import argparse
import rospy
import cv2
import cv_bridge
from sensor_msgs.msg import Image
from can_sort.srv import DisplayImage, DisplayImageResponse
class Display_Im... | StarcoderdataPython |
6704196 | <gh_stars>0
'''
Влад любит кататься на общественном транспорте и собирать счастливые билеты. Влад живет в маленьком городе, в котором билеты имеют двузначные номера формата ХХ. Счастливым называется билет, номер которого состоит из одинаковых цифр.
Формат входных данных
Натуральное двузначное число - номер билета, ко... | StarcoderdataPython |
5061149 | <gh_stars>1-10
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 damian <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
Python notepad
"""
from __future__ import print_function
import bisect
from itertools import *
from operator import *
values = [3,6,2,1,7,6,3,5]
p... | StarcoderdataPython |
9787936 | #!/usr/bin/env python3
# -*- coding: utf-8 -*
'''
项目名称: JD-Script / jd_zjd
Author: Curtin
功能:微信小程序-赚京豆-瓜分10亿京豆自动助力,默认给账号1助力,多账号才能玩~
Date: 2021/6/25 下午9:16
TG交流 https://t.me/topstyle996
TG频道 https://t.me/TopStyle2021
updateTime: 2021.7.24 14:22
'''
print("赚京豆-瓜分10亿京豆自动助力--活动已结束\nTG交流 https://t.me/topstyle996\nTG频道 http... | StarcoderdataPython |
6466924 | # Copyright (C) 2019 <NAME>.L.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2... | StarcoderdataPython |
1982098 | import numpy as np
from bioscrape.lineage import LineageModel
from bioscrape.lineage import LineageVolumeSplitter
from bioscrape.lineage import py_SimulateInteractingCellLineage
from bioscrape.lineage import py_SimulateCellLineage
from bioscrape.lineage import py_SimulateSingleCell
from bioscrape.lineage import Lineage... | StarcoderdataPython |
4856311 | from __future__ import print_function
from typing import List
import logging
import sys
import requests
import time
import swagger_client as cris_client
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format="%(message)s")
SUBSCRIPTION_KEY = "<your subscription key>"
HOST_NAME = "<your region>.cris.ai"... | StarcoderdataPython |
20125 | <filename>migrations/versions/66d4be40bced_add_attribute_to_handle_multiline_.py
"""Add attribute to handle multiline information
Revision ID: 66d4be40bced
Revises: <PASSWORD>
Create Date: 2018-05-16 12:13:32.023450
"""
import sqlalchemy as sa
from alembic import op
from limonero.migration_utils import is_sqlite
# r... | StarcoderdataPython |
11376136 | from moto.ec2 import models as ec2_models
from moto.ec2.exceptions import InvalidPermissionNotFoundError
from localstack import config
from localstack.services.infra import start_moto_server
def patch_ec2():
def patch_revoke_security_group_egress(backend):
revoke_security_group_egress_orig = backend.revok... | StarcoderdataPython |
3486545 | """
Даны два целых числа A и В. Выведите все числа от A до B
включительно, в порядке возрастания,если A < B, или
в порядке убывания в противном случае.
Формат ввода
Вводятся два целых числа.
Формат вывода
Выведите ответ на задачу.
"""
a, b = int(input()), int(input())
if a < b:
for i in range(a, b + 1):
... | StarcoderdataPython |
3278410 | <reponame>qGentry/Lematus
import torch
import torch.nn as nn
class EncoderNetwork(nn.Module):
def __init__(self,
enc_hid_dim: int,
emb_dim: int,
dec_hid_dim: int,
emb_count: int,
dropout: float,
num_layers: int,... | StarcoderdataPython |
5103443 | import unittest
from test.support import import_module
# Skip tests if _ctypes module was not built.
import_module('_ctypes')
import ctypes.test
def load_tests(*args):
skipped, testcases = ctypes.test.get_tests(ctypes.test, "test_*.py", verbosity=0)
suites = [unittest.makeSuite(t) for t in testcases]
re... | StarcoderdataPython |
8130584 | <reponame>jared-hardy/django-permafrost
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.contrib.auth.backends import ModelBackend, AllowAllUsersModelBackend, RemoteUserBackend, AllowAllUsersRemoteUserBackend
from django.contrib.sites.models import Site
class... | StarcoderdataPython |
1873662 | <reponame>wbhuber/local_swift_branch
#!/usr/bin/python -u
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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/... | StarcoderdataPython |
66212 | <gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UserSubscribeWindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from P... | StarcoderdataPython |
1891367 | <gh_stars>0
#
# Plasma
# Copyright (c) 2020 Homedeck, LLC.
#
from torch import cat, clamp, tensor, Tensor
from ..conversion import rgb_to_yuv, yuv_to_rgb
def contrast (input: Tensor, weight: Tensor) -> Tensor:
"""
Apply contrast adjustment to an image.
Parameters:
input (Tensor): Input RGB ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.