id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
4834385
import unittest from caffe2.proto import caffe2_pb2 from caffe2.python import core, dyndep, workspace dyndep.InitOpsLibrary("@/caffe2/caffe2/contrib/prof:cuda_profile_ops") class CudaProfileOpsTest(unittest.TestCase): @unittest.skipIf(workspace.NumCudaDevices() < 1, "Need at least 1 GPU") def test_run(s...
StarcoderdataPython
3221372
def get_divisors_count(number: int): c = 2 for i in range(2, c): if not (number % i): c += 1 return c def get_max_divisions_number(n: int, m: int) -> int: maximum = n for i in range(n, m + 1): temp = get_divisors_count(i) if maximum < temp: temp = ma...
StarcoderdataPython
3271200
from collections import namedtuple import math import sys from morton import Morton try: from shapely import geometry as shapely_geometry except ImportError: shapely_geometry = None Point = namedtuple('Point', ['x', 'y']) def is_point_on_line(point, start, end): if start.x <= point.x and point.x <= end....
StarcoderdataPython
1705482
# -*- coding: utf-8 -*- c = 0 t = 0 p = input("enter a string to see if it is a palindrome ") Pa = list(p) count= len(Pa) - 1 and while c <= count: if Pa[c] == Pa[count - c]: t = t + 1 c = c + 1 else: print(p, "is not a palindrome") c = count + 12 if t == co...
StarcoderdataPython
3334928
<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-30 14:57 from __future__ import unicode_literals import cms.models.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ (...
StarcoderdataPython
46778
<filename>02-Coding-skills-swagger/swagger_server/test/test_default_controller.py # coding: utf-8 from __future__ import absolute_import from flask import json from six import BytesIO from swagger_server.models.aws_info import AwsInfo # noqa: E501 from swagger_server.test import BaseTestCase class TestDefaultCont...
StarcoderdataPython
77871
from peewee import * from .base import BaseModel from . import climate from . import hru as hru_db from . import routing_unit from . import aquifer from . import channel from . import reservoir from . import exco from . import dr from . import simulation from . import recall class Con(BaseModel): """Inheritable base...
StarcoderdataPython
4831712
<reponame>eragasa/pypospack<gh_stars>1-10 import numpy as np from pypospack.potential import func_generalized_lj_w_cutoff b1 = b2 r1 V0 delta
StarcoderdataPython
1644230
<gh_stars>0 # Copyright 2011 OpenStack Foundation # 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 # # ...
StarcoderdataPython
1618227
<filename>scripts/relax_to_json.py #!/usr/bin/env python import os import sys import json import pychemia filename = None if len(sys.argv) == 2: filename = sys.argv[1] else: print('Enter the JSON filename to store the data') exit(1) dirs = [x for x in os.listdir('.') if os.path.isdir(x)] ret = [] for id...
StarcoderdataPython
1783246
<reponame>benburk/shifty<filename>run_examples.py """run examples from the examples folder""" from examples import calculator def main(): """run calculator""" calculator.main() if __name__ == "__main__": main()
StarcoderdataPython
4836029
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from measurements import page_cycler import page_sets from telemetry import test class PageCyclerBloat(test.Test): test = page_cycler.PageCycler page_s...
StarcoderdataPython
1696920
import numpy as np import tools import warnings class Alpha(): """ Docstring for ALPHA. Alpha is the an influence coefficient matrix Influence coefficient matrix is a representation of the change of vibration vector in a measuring point when putting a unit weight on a balancing plane. """ ...
StarcoderdataPython
4818370
<reponame>sdpython/pymyinstall """ @brief test log(time=140s) skip this test for regular run """ import sys import os import unittest from pyquickhelper.loghelper import fLOG from pymyinstall.installcustom import install_pandoc class TestLONGPandoc (unittest.TestCase): def test_install_pandoc(self): ...
StarcoderdataPython
161325
<gh_stars>0 import operator def sortIncreasing(results): print(operator.itemgetter(1)) results.sort(key = operator.itemgetter(1)) return results def sortDecreasing(results): results.sort(key = operator.itemgetter(1), reverse = True) return results def sortIncreasingDiscoount(results): r...
StarcoderdataPython
3254883
#!/usr/bin/env python # * coding: utf8 * ''' config.py A module that contains the static names and places of feature classes ''' feature_classes = { #: Input dataset names, set these (must all exist in the workspace gdb) #: Current Broadband Service layer 'bb_service': 'Utilities_BroadbandService_20201105...
StarcoderdataPython
4815667
<reponame>mechkro/TestGrounds<filename>test3.py import tkinter as tk class newwin3(object): """ """ def __init__(self, master): self.master = master self.emptycurrent() self.addnew() #-------------------------------------- def emptycurrent(self): """ """ ...
StarcoderdataPython
3298164
<reponame>fernandolguevara/crosswalk-app-tools #!/usr/bin/env python import os import sys import commands import shutil from optparse import OptionParser import urllib2 import re from bs4 import BeautifulSoup import platform os.system("node -v") SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) crosswalk_test_...
StarcoderdataPython
4832872
""" This file implements a general simulation interface. The SimulationWindow has a space for thedisplay of a specific task, a display area showing the counts of steps and episodes so far, and buttons for controlling the simulation. It also adds two menus - a File menu and a Simulation menu. It is easy to make a GUI si...
StarcoderdataPython
3280473
"""Unit test package for cellartracker."""
StarcoderdataPython
107777
<reponame>MandelaK/SendITAPI-V2 import psycopg2 from db_config import init_db from flask_jwt_extended import jwt_required, get_jwt_identity class Parcels(): """The methods defined in this class represent methods that users will use to manipulate parcels in the database""" def __init__(self): self...
StarcoderdataPython
4803162
<gh_stars>0 #!C:\Python27\python.exe import sys, os from PyQt4 import QtCore, QtGui from docx import Document from docx.shared import Cm, Inches, Pt from docx.enum.text import WD_ALIGN_PARAGRAPH from PIL import Image from StringIO import StringIO import dokumentasi_ui Ui_Main = dokumentasi_ui.Ui_MainWindow def ma...
StarcoderdataPython
1687833
import pytest from app.api.services.game_services.service import create_new_game from app.models.game import Game from app.schemas.game_schema import Team @pytest.fixture def game_creator(): def _game_creator(size, game_id="x"): players = list(map(str, range(size))) return create_new_game(game_id...
StarcoderdataPython
36813
<filename>examples/02-hello_kml.py import os import simplekml from polycircles.polycircles import Polycircle polycircle = Polycircle(latitude=31.611878, longitude=34.505351, radius=100) kml = simplekml.Kml() pol = kml.newpolygon(name=f"Polycircle", outerboundaryis=polycircle.to_kml()) kml.save('02.kml')
StarcoderdataPython
185803
from zschema.leaves import * from zschema.compounds import * import zschema.registry from ztag.annotation import Annotation import zcrypto_schemas.zcrypto as zcrypto import zgrab2_schemas.zgrab2 as zgrab2 import zgrab2_schemas.zgrab2.mssql as zgrab2_mssql import zgrab2_schemas.zgrab2.oracle as zgrab2_oracle import z...
StarcoderdataPython
1604112
<gh_stars>1-10 import importlib import os import sys def to_list(): root = os.path.dirname((os.path.dirname(__file__))) temp_dir = os.path.join(root, "templates") return os.listdir(temp_dir) def create(temp_name, dst): # 检查templates目录下有没有对应的目录 if temp_name not in to_list(): print(f"无该{te...
StarcoderdataPython
3379706
import argparse import random import os import random import torch import numpy as np from torch import nn from torch import optim from torch.autograd import Variable from torchvision import datasets, transforms, models from collections import OrderedDict from PIL import Image parser = argparse.ArgumentParser(descri...
StarcoderdataPython
156392
<gh_stars>1-10 from django.views.generic import (TemplateView) class VisualiseTemplateView(TemplateView): """ Class-based view to show the visualise template """ template_name = 'researchdata/visualise.html'
StarcoderdataPython
27131
import ply.lex as lex import ply.yacc as yacc import lexer import sys import ast tokens = lexer.tokens precedence = ( ('right', 'ELSE'), ) def p_start (t): '''start : program''' t[0] = t[1] def p_program_01 (t): '''program : program_part''' t[0] = ast.Program(t[1]) def p_program_02 (t): ...
StarcoderdataPython
167184
""" Scikit-Optimize, or `skopt`, is a simple and efficient library to minimize (very) expensive and noisy black-box functions. It implements several methods for sequential model-based optimization. `skopt` is reusable in many contexts and accessible. [![Build Status](https://travis-ci.org/scikit-optimize/scikit-optimi...
StarcoderdataPython
1773549
<filename>daydayup_submit/daydayup_model.py<gh_stars>1-10 from daydayup_layer import GCN, My_APPNP, Cheb_Net, ARMA_Net, GAT_Net, SGC_Net, TAG_Net, DNA_Net import torch import torch.nn.functional as F import lightgbm as lgb from torch_geometric.nn import GCNConv, Node2Vec from torch.nn import PReLU from sklearn.l...
StarcoderdataPython
1784896
""" a delay line using pre-parsed sax events """ from xml.sax import ContentHandler class OneEventDelay(ContentHandler): "pre-parse sax document then feed events to handler" def __init__(self): "" self.events = [] self.index = 0 def set_handler(self, handler): self.handler = handler self.han...
StarcoderdataPython
3316813
<filename>qcengine/config.py """ Creates globals for the qcengine module """ import fnmatch import getpass import logging import os import socket from typing import Any, Dict, Optional, Union import pydantic from .extras import get_information __all__ = ["get_config", "get_provenance_augments", "global_repr", "Node...
StarcoderdataPython
3244995
<gh_stars>0 from __future__ import annotations from dataclasses import dataclass from pymonkey import token TOKENMAPS = { ";": token.Token(token.SEMICOLON, ";"), "(": token.Token(token.LPAREN, "("), ")": token.Token(token.RPAREN, ")"), ",": token.Token(token.COMMA, ","), "{": token.Token(token.LB...
StarcoderdataPython
1614793
#----------------------------------------------------------------------------- # training script #----------------------------------------------------------------------------- import torch, torchvision, torch.nn.functional as F import argparse from tqdm import tqdm from pathlib import Path from Model import DeepInfoM...
StarcoderdataPython
3398468
<filename>src/study/fashion_mnist/mnist_fashion_classifier.py from src import network import numpy as np from src.study.utils import downloader from src.study.mnist_common import mnist_reader items = ["T-shirt/top","Trouser","Pullover","Dress","Coat","Sandal","Shirt","Sneaker","Bag","Ankle","boot"] def download_mni...
StarcoderdataPython
1637494
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info >= (2, 7, 0): def swig_im...
StarcoderdataPython
1685284
from invoke import task @task def start(ctx, docs=False): ctx.run('FLASK_APP=toes_app.py FLASK_DEBUG=1 venv/bin/flask run --host=0.0.0.0') @task def update_dev(ctx, docs=False): ctx.run('zappa update dev') @task def update_prod(ctx, docs=False): ctx.run('zappa update prod') @task def tail(ctx, docs=...
StarcoderdataPython
60834
<gh_stars>1-10 # full assembly of the sub-parts to form the complete net import torch.nn.functional as F from .unet_parts import * # from .mobilenet2 import * def debug(str): if False: print(str) class UNet(nn.Module): def __init__(self, n_channels, n_classes): super(UNet, self).__init__() ...
StarcoderdataPython
3300114
#!/usr/bin/env python3 import sys import os import pprint import matplotlib.pyplot as plt import bloat_test def rounded_kb(bytes): x = round(bytes / 1024, 1) if x >= 100: return int(x) return x def get_test_prettyname(test): names = { 'bloat-control': 'empty', 'bloat-scanf'...
StarcoderdataPython
4832930
<reponame>pagotti/dasladen """ Driver Module Oracle Driver External Dependencies: - cx_oracle: (c) 2016, 2017, Oracle and/or its affiliates. Portions Copyright 2007-2015, <NAME>. Portions Copyright 2001-2007, Computronix (Canada) Ltd., Edmonton, Alberta, Canada. BSD License (http...
StarcoderdataPython
4823445
<reponame>tankishev/Python # Until the "Sail" command is given, you will be receiving: # • You and your crew have targeted cities, with their population and gold, separated by "||". # • If you receive a city that has already been received, you have to increase the population and gold with the given values. # After the ...
StarcoderdataPython
1643667
import GPy import scipy.optimize import scipy.stats as stats from scipy.spatial.kdtree import KDTree from general.utils import * class Sensor: """ Sensor model is designed to compute the possibility of getting a certain observation at a certain position. In this implementation, gaussian process with path l...
StarcoderdataPython
3233390
<reponame>aaren/pharminv from io import BytesIO import numpy as np import numpy.testing as nt import harminv class ReferenceData(object): # output generated from command line use of harminv # cat tests/input.dat | harminv -t 0.01 0.001-1 cli_output = """frequency, decay constant, Q, amplitude, phase, er...
StarcoderdataPython
1753037
<filename>nlp100/chapter-01/04.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- s ="" s = s.replace(".","") words = s.split(" ") word_count = [] count = 0 for word in words: count+=1 if count in [1,5,6,7,9,16,19]: word_count.append(word[:1]) else: word_count.append(word[:2]) print(word_count) #リスト内包表記を上手く使え...
StarcoderdataPython
51091
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Make sure each ForeignKey has `on_delete` set to the desired behavior. # * Remove `managed = False` lines if ...
StarcoderdataPython
1794805
<gh_stars>1-10 import json buildings = ["HEADQUARTER", "BARRACKS", "STABLE", "WORKSHOP", "ACADEMY", "SMITHY", "RALLY_POINT", "STATUE", "MARKET", "TIMBER_CAMP", "CLAY_PIT", "IRON_MINE", "FARM", "WAREHOUSE", "HIDING_PLACE", "WALL"] requirements = [ {}, {"HEADQUARTER": 3}, {"HEADQUARTER": 10, "B...
StarcoderdataPython
154598
import discord from discord.ext import commands from discord.utils import get import asyncio from gtoken import * comando = ["turma entrar", "turma sair", "turma add", "info", "alterar prefix"] client = discord.Client() prefixo = Prefixo() msg_id = None msg_user = None @client.event async def on_ready(): pri...
StarcoderdataPython
1650511
<gh_stars>0 def btc_total(cheese=0, pie=0, tea=0, sandwich=0, chips=0, end="\n\n"): return cheese * 4 + pie * 3 + sandwich * 8 + tea + chips
StarcoderdataPython
156473
<reponame>eriknyquist/chatbot_utils import re import random from unittest import TestCase from chatbot_utils.redict import ReDict class TestReDict(TestCase): def fill_redict(self, dictobj=None, numitems=1000): if not dictobj: dictobj = ReDict() testitems = {"((foo+|bar*) )?%d" % i : i...
StarcoderdataPython
1774697
<reponame>nonlinearxwaves/MultiLevelQuantumGates<gh_stars>0 # -*- coding: utf-8 -*- # Library of classes for varius quantum gates # # By Claudio # Initial version september 2018 # Current version 3 february 2019 import numpy as np import tensorflow as tf #class for defining various operators class quantumgates: ...
StarcoderdataPython
3342232
<reponame>abhigyan709/dsalgo<gh_stars>1-10 # list is a type of an array/or simply array # its same like any other languages having arrays # it stores a series of items in a particular order. # allows to store sets of information in one place, # whether you have just a few items or millions of items. # one of the mos...
StarcoderdataPython
3328919
import re from ..base import Base class Regex(Base): _description = 'matching {}' def _check(self, value): return bool(re.search(self.value, value))
StarcoderdataPython
81667
x=[2,25,34,56,72,34,54] val=int(input("Enter the value you want to get searched : ")) for i in x: if i==val: print(x.index(i)) break elif x.index(i)==(len(x)-1) and i!=val: print("The Val u want to search is not there in the list")
StarcoderdataPython
93523
<filename>lecciones/05/funciones.py def mensaje(): # Declaración de la función print("Estamos aprendiendo Python.") print("Estamos aprendiendo instrucciones básicas.") print("Poco a poco iremos avanzando.") mensaje() # Llamada a la función print("Ejecutando código fuera de función") mensaje()
StarcoderdataPython
3280721
<filename>django/contrib/flatpages/tests/views.py<gh_stars>1-10 import os from django.conf import settings from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.test import TestCase class FlatpageViewTests(TestCase): fixtures = ['sample_flatpages'] ...
StarcoderdataPython
1649238
transformers = [] def register_transformer(transformer): transformers.append(transformer) def find_transformer(extension=None, mime_type=None): if not extension and not mime_type: raise ValueError("Either extension or mime type should be specified") info = None for trans in transformers: ...
StarcoderdataPython
1648452
<gh_stars>0 import math import numpy as np import itk from pathlib import Path from typing import List, Optional, Sequence, Union, Callable # frequently used types from itk.itkImagePython import itkImageBase2 as Image2 from itk.itkImagePython import itkImageBase3 as Image3 from itk.support.types import ImageLike as An...
StarcoderdataPython
3258709
<filename>Juego del TaTeTi/script.py # Diseñado por <NAME> - https://www.github.com/facundopadilla # Éste contenido es de uso libre y contiene licencia MIT, por lo tanto, no me responsabilizo de daños y prejuicios en el caso de su uso y/o modificación. # @author: facundopadilla # @linkedin: https://www.linkedin.com/...
StarcoderdataPython
4830477
<filename>story-pointr-backend/storypointr/apps/pointing/consumers.py from channels.exceptions import DenyConnection from apps.pointing.pointingroom import PointingRoom from protocol.consumers.jsonrpcconsumer import AsyncJsonRpcWebsocketConsumer, JsonRpcException, rpc_method, rpc_notification from protocol.events.event...
StarcoderdataPython
3388001
<reponame>Peilonrayz/typing_inspect_lib<gh_stars>1-10 import typing from .helpers import PY_OLD, typing_ # TODO: reduce complexity if PY_OLD: # noqa: MC0001 def get_base_type(type_): # pylint: disable=too-many-return-statements """Get the generic type and if it is unwrapped.""" ret_type = None ...
StarcoderdataPython
3288265
<filename>src/clusto/test/drivers/resourcemanagers/ipmanagertest.py import clusto from clusto.test import testbase from clusto.drivers import IPManager, BasicServer, ResourceTypeException, ResourceException import IPy class IPManagerTest(testbase.ClustoTestBase): def data(self): ip1 = IPManager('a1', ...
StarcoderdataPython
1741756
<filename>reactivex/internal/exceptions.py # Rx Exceptions from typing import Optional class SequenceContainsNoElementsError(Exception): def __init__(self, msg: Optional[str] = None): super().__init__(msg or "Sequence contains no elements") class ArgumentOutOfRangeException(ValueError): def __init...
StarcoderdataPython
3393063
<filename>featherembed.py<gh_stars>1-10 #!/usr/bin/env python """ Usage: python featherembed.py --listcolumns /fh/fast/gilbert_p/grp/compass_hvtn602_aw/tmpdata/flow-data-2of9-responses.feather python featherembed.py --columns CCR6,CCR7,CD154,CD45RA,CXCR3,GzA,HLA-DR,IFNg,IL13/4,IL17a,IL2,IL22,KLRG1,Perforin,TNFa /fh/f...
StarcoderdataPython
1659716
#!/usr/bin/env python import argparse import anydbm import sys import BaseHTTPServer import SocketServer class MetricRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): db_filename = None def do_GET(self): database = anydbm.open(self.db_filename) output = ['%s %s' % (k, database[k]) for k...
StarcoderdataPython
3309404
from gameai.core import Algorithm class Minimax(Algorithm): ''' Implementation of the minimax algorithm. Attributes: horizon (int): The max depth of the search. Defaults to infinity. Note that if this is set then the game's hueristic is used ''' def __init__(self, horizon=flo...
StarcoderdataPython
1716562
<reponame>AngelinNjakasoa/Range-analysis-experiments<filename>main.py #!/usr/bin/python2.7 # coding: utf8 """ Test the Range Analysis on a python source code """ import sys import ast import visitor_iteration def main(): """ Takes a python source code file as arguments and performs a range analysis ...
StarcoderdataPython
4830312
<reponame>tim-fiola/nautobot-plugin-version-control """ This is the main module that contains the code for the Dolt backed Version Control plugin. """ try: from importlib import metadata except ImportError: # Python version < 3.8 import importlib_metadata as metadata from django.db.models.signals import pr...
StarcoderdataPython
3398443
<gh_stars>1-10 #! /usr/bin/python3.5 # -*- coding: utf-8 import numpy as np import re def read_data(file): """ Give a .dat file, we read the: - n - W - D """ opened_file = open(file) n = int(opened_file.readline().strip('\n')) W = np.zeros((n, n)) D = np.zeros((n, ...
StarcoderdataPython
2846
<reponame>GuilhermeEsdras/Grafos<gh_stars>0 from Roteiro4.Roteiro4__funcoes import Grafo class Grafos: # Grafo da Paraíba paraiba = Grafo(['J', 'C', 'E', 'P', 'M', 'T', 'Z']) for aresta in ['J-C', 'C-E', 'C-E', 'C-P', 'C-P', 'C-M', 'C-T', 'M-T', 'T-Z']: paraiba.adicionaAresta(aresta) ...
StarcoderdataPython
1796156
# -*- coding: utf-8 -*- """ Created on Wed Nov 17 12:38:15 2021 @author: Oscar """ # Golden Search, mimics the secant method, but for finding the Global Max and min (optimization of a function) # Strategy in selecting the bounds of the interval: # l0 = distance between estimate, # l0 = l1+l2 ; l1/l0...
StarcoderdataPython
3368373
<reponame>mdomarsaleem/Facial_Plan<filename>Database creation/database_cv.py import cv2 import numpy as np from picamera.array import PiRGBArray from picamera import PiCamera import scipy.misc import cPickle import os import time os.chdir("//home//pi/Desktop//Image_db/") import warnings warnings.filterwarnings('error...
StarcoderdataPython
1665426
# import the necessary packages from Automation.Web import wikipedia, movie_review, play_song, recommendation, open_website from Automation.OS.Windows import open_installed_apps, create_and_write_file from Senses import listen, speak import os import platform import subprocess def assist(command): """if statement...
StarcoderdataPython
3367195
<filename>layers.py import tensorflow as tf def conv(x, filter_height, filter_width, num_filters, stride_y, stride_x, name, padding='SAME', groups=1, weights=None, biases=None): """Create a convolution layer. Adapted from: https://github.com/ethereon/caffe-tensorflow """ # Get number of input channe...
StarcoderdataPython
1701345
"""Provides multi-point element-wise operations such as ``contains``.""" from shapely import speedups from ._vectorized import (contains, touches)
StarcoderdataPython
3238774
<filename>fastsc/coloring/color_opt.py from fastsc.util import get_map_circuit, get_layer_circuits import networkx as nx import numpy as np from fastsc.models import IR, Qbit, Inst from .util import relabel_coloring, get_qubits, decompose_layer, decompose_layer_flexible, reschedule_layer, limit_colors, get_max_time fr...
StarcoderdataPython
137897
<reponame>djevans071/Reba<gh_stars>0 #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Jun 15 22:15:40 2017 @author: psamtik071 """ #functions for feature-engineering import pandas as pd # make sure tot_docks > 0 (especially when calculating bikes available) def bulk_query(year): # query all bik...
StarcoderdataPython
1614906
<filename>tests/regression/lib/constants.py TEST_COTROL_FILE = "test.cntl"
StarcoderdataPython
3346739
<filename>alesisvsysex/ui/window.py<gh_stars>1-10 from PyQt5.QtWidgets import * from alesisvsysex.protocol.model import AlesisV from alesisvsysex.device.alesis import AlesisV25Device from alesisvsysex.device.file import FileDevice from alesisvsysex.ui.components import * from alesisvsysex.ui.filedialog import * __all_...
StarcoderdataPython
22170
from math import log2 import torch from torch import nn, einsum import torch.nn.functional as F from einops import rearrange from x_transformers import Encoder, Decoder # helpers def exists(val): return val is not None def masked_mean(t, mask, dim = 1): t = t.masked_fill(~mask[:, :, None], 0.) return t....
StarcoderdataPython
1604941
<reponame>kingsznhone/Project-Ragnarok<gh_stars>1-10 import asyncio import pathlib import ssl import websockets import json import threading from threading import Thread async def rx (websocket): while True: greeting = await websocket.recv() print (greeting) async def startclient(): uri = "wss...
StarcoderdataPython
3406
<gh_stars>1-10 #!/usr/bin/python import yaml import os import ast import sys from collections import OrderedDict curr_dir = os.getcwd() work_dir = sys.argv[1] network_type = sys.argv[2] testplan_dict = {} testplan_dict["name"] = "System performance test" testplan_dict["description"] = "This test is to create as muc...
StarcoderdataPython
17804
<reponame>euranova/estimating_eces # -*- coding: utf-8 -*- """ @author: nicolas.posocco """ from abc import ABC import numpy as np class MulticlassDistribution(ABC): def __init__(self): """ Initializes the distribution, allowing later sampling and posterior probabilities calculations. ""...
StarcoderdataPython
1708519
# Wifi Configuration # import machine import network import time import uiot._cfg as _cfg import unetrepl as nr # activate wifi network _ap = network.WLAN(network.AP_IF) _ap.active(False) _wlan = network.WLAN(network.STA_IF) _wlan.active(True) _wlan_laststate = False # connect to wifi and really try to connect def ...
StarcoderdataPython
19808
# -*- coding: utf-8 -*- from tinyq.app import Application # noqa __version__ = '0.3.0' __author__ = 'mozillazg' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2017 mozillazg'
StarcoderdataPython
1750468
<gh_stars>1-10 """Highly divisible triangular number The sequence of triangle numbers is generated by adding the natural numbers. The 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Let us list the factors of the first seven triang...
StarcoderdataPython
3248148
<reponame>derekray311511/permatrack from __future__ import absolute_import from __future__ import division from __future__ import print_function import pycocotools.coco as coco import numpy as np import torch import json import cv2 import os import math from ..video_dataset import VideoDataset class PDTracking(Video...
StarcoderdataPython
1654504
<filename>campbell_diaz/crop.py # -*- coding: utf-8 -*- # Copyright (c) 2020 Wageningen-UR # <NAME>, June 2020 from pcse.base import SimulationObject, ParamTemplate, RatesTemplate, StatesTemplate, VariableKiosk from pcse.decorators import prepare_rates, prepare_states from pcse.traitlets import Float,Int, Instan...
StarcoderdataPython
3388466
import platform import casual.make.entity.target as target import casual.make.tools.environment as environment import os import subprocess def add_item_to_list(items, item): new_list = [] if not items: return new_list for i in items: if isinstance(i, target.Target): new_list...
StarcoderdataPython
3394726
from django.conf.urls import url from rest_framework import permissions from rest_framework.authentication import SessionAuthentication, TokenAuthentication from rest_framework.generics import ListAPIView, RetrieveAPIView from medical_peek_core.service.url import UrlProperty from medical_peek_core.model.dmo.medical_it...
StarcoderdataPython
1732154
import matplotlib.pyplot as plt import jieba import xlrd from wordcloud import WordCloud, STOPWORDS from PIL import Image import numpy as np class wcd: # workBook = xlrd.open_workbook('../data/TagSupplement2.xlsx') def beTXT(self): global file_handle allSheetNames = self.workBook.sheet_names() ...
StarcoderdataPython
1668617
# # ex03.py # Python the Hard Way Exercise #3B # # Created by <NAME> on 12/23/14. # Copyright (c) 2014 ddApps. All rights reserved. # ------------------------------------------------ # Study Drill Question 3: # Find something you need to calculate and write a new .py fi le that does it. # import the Python mat...
StarcoderdataPython
3226699
#Automatically created by SCRAM import os __path__.append(os.path.dirname(os.path.abspath(__file__).rsplit('/Treemaker/Splitter/',1)[0])+'/cfipython/slc6_amd64_gcc493/Treemaker/Splitter')
StarcoderdataPython
1623988
<reponame>LeeBeral/python x = 'abc' y = 'def' z = ['d','e','f'] print(x.join(y)) print(x.join(z))
StarcoderdataPython
3320489
default_app_config = 'oscar.apps.voucher.config.VoucherConfig'
StarcoderdataPython
3206071
#This is the flitesensor init file
StarcoderdataPython
108831
# -*- coding: utf-8 -*- """ Created on 2021/4/25 10:22 上午 --------- @summary: 将浏览器的cookie转为request的cookie --------- @author: Boris @email: <EMAIL> """ import json import pyperclip from feapder.utils.tools import get_cookies_from_str, print_pretty class CreateCookies: def get_data(self): """ @su...
StarcoderdataPython
171030
# Source: # https://www.kaggle.com/sachinsharma1123/otto-group-classification-acc-82from sklearn.pipeline import Pipeline dataset = "otto" metric = "neg_log_loss" def make_pipeline(): from sklearn.pipeline import Pipeline from sklearn.svm import SVC # focused on SVC pipeline # to provide some diversi...
StarcoderdataPython
1694435
from .models.db_init import db from .app import application from .routes import api from .logger import Logger __all__ = [ 'db', 'application', 'api', 'Logger' ]
StarcoderdataPython
59460
<reponame>PacktPublishing/-Data-Wrangling-with-Python-3.x<filename>Section 2/2.1/code1.py import xlrd book = xlrd.open_workbook('SampleSuperstore.xls') print("The number of sheets in the above excel file are {}".format(book.nsheets)) print("The names of sheets in the above excel file are {}".format(book.sheet_names())...
StarcoderdataPython