id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
79372
# -*- coding: utf-8 -*- import os import sys myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath + '/../') import unittest import meterbus from meterbus.exceptions import * class TestSequenceFunctions(unittest.TestCase): def setUp(self): self.dib_empty = meterbus.DataInformati...
StarcoderdataPython
27654
<filename>fauxfactory/__init__.py # -*- coding: utf-8 -*- """Generate random data for your tests.""" __all__ = ( 'gen_alpha', 'gen_alphanumeric', 'gen_boolean', 'gen_choice', 'gen_cjk', 'gen_cyrillic', 'gen_date', 'gen_datetime', 'gen_email', 'gen_html', 'gen_integer', '...
StarcoderdataPython
141910
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-07-20 06:27 from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateMode...
StarcoderdataPython
119228
<reponame>cazBlue/test<filename>python/placeholder/demo.py import os import sys import nuclai.bootstrap # Demonstration specific setup. import scipy.misc # Image loading and manipulation. import vispy.scene # Canvas & visuals for rendering. class Application(object): def __init__...
StarcoderdataPython
75572
<gh_stars>0 from rest_framework import status from django.contrib.auth import get_user_model from rest_framework.response import Response from rest_framework.generics import RetrieveUpdateDestroyAPIView, ListCreateAPIView from .models import Saledata from .permissions import IsOwnerOrReadOnly, IsAuthenticated from .se...
StarcoderdataPython
1747979
''' first positions both controllers to ROOM_CENTER then waits for resume then draws a box starting at START_POS with STEP*STEP_MUL for NUM_ITER times for each element of APPLY_DIM needs aioconsole module installed ''' import asyncio import time import numpy as np import pyrr from virtualreality import template...
StarcoderdataPython
3248383
<reponame>nforesperance/Tensorflow-Keras<filename>cnn/conv_1d.py # example of calculation 1d convolutions from numpy import asarray from keras.models import Sequential from keras.layers import Conv1D # define input data data = asarray([0, 0, 0, 1, 1, 0, 0, 0]) data = data.reshape(1, 8, 1) # (samples,lenght,channels) #...
StarcoderdataPython
1769586
from empstore import teams import employee as emp from empstore import employees def manage_all_team_menu(): print("\t1.Create team") print("\t2.Display team") print("\t3.Manage team(Particular)") print("\t4.Delete team") print("\t5.Exit") def manage_all_teams(): while True: manage_all_team_menu() ch = int(i...
StarcoderdataPython
3204797
<gh_stars>0 from typing import TYPE_CHECKING, Dict, Tuple if TYPE_CHECKING: from core.cell import Cell class Distances: """Gives distances for all cells linked to a starting cell, called root. This datastructure starts at a `root` cell and gives the distance from all cells linked to the root to the ...
StarcoderdataPython
1743231
import json import uuid from typing import Dict, List, Optional, Tuple, Union import redis from .com import Message, decrement_msg_id class admin: def __init__(self, link: redis.Redis) -> None: self.link: redis.Redis = link def get_streams(self, match: None = None) -> List["Stream"]: match ...
StarcoderdataPython
3279031
__version__ = "0.910"
StarcoderdataPython
1736656
<gh_stars>0 # -*- coding: utf-8 -*- import datetime as dt from flask.ext.login import UserMixin from metapp2.extensions import bcrypt from metapp2.database import ( Column, db, Model, ReferenceCol, relationship, SurrogatePK ) class Meeting_Note(SurrogatePK, Model): __tablename__ = 'meetin...
StarcoderdataPython
3266564
<reponame>vencax/django-sql-nss-admin #!/usr/bin/env python import os from setuptools import setup, find_packages README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README') description = 'DJango module for SQL based Linux NSS authentication system' if os.path.exists...
StarcoderdataPython
3277846
import csv xx = open("months.txt", "w" ) xx.truncate(); with open('/Users/munish/Desktop/aaa.csv', 'rb') as csvfile: reader = csv.reader(csvfile,delimiter=' ', quotechar='|') i=0 y=[] for row in reader: '''if (row[2] == 2) or (row[3] == 2''' i=i+1 if(i>12): x=row[0][:...
StarcoderdataPython
112708
import numpy as np import pandas as pd from tensorflow import keras from tensorflow.keras.layers import Input, Dense, Dropout, Conv2D, MaxPool2D, Flatten, Reshape, BatchNormalization from tensorflow.keras.models import Sequential, load_model from tensorflow.keras.callbacks import TensorBoard, ModelCheckpoint, EarlySto...
StarcoderdataPython
3346196
#!/usr/bin/python #-*- coding: utf-8 -*- import cv2 from ler_imagem import ler_imagem from escreve_imagem import escreve #from configuracao import configuracao from boi.b_pre_processamento import b_pre_processamento from boi.b_regiao_interesse import regiao_interesse from boi.b_watershed import watershed from boi.b_mas...
StarcoderdataPython
1762151
#!/usr/bin/env python """ """ # Standard library modules. import os # Third party modules. import pytest # Local modules. from pymontecarlo_casino2.importer import Casino2Importer from pymontecarlo.results.photonintensity import EmittedPhotonIntensityResult from pymontecarlo.simulation import Simulation # Globals ...
StarcoderdataPython
3261415
import time import maze from tqdm import tqdm c = maze.Connect("admin", "velociraptor") field = c.get_all() jmpLen = 4 inp = [] jumps = [] # for every line in the playing array add the bottom row of actual places where you jump on for line in field: inp.append(line[-1]) print("Aiming to hit:", len(inp)) # m...
StarcoderdataPython
3359978
<reponame>crwsr124/GANsNRoses<gh_stars>0 import argparse import math import random import os from util import * import numpy as np import torch torch.backends.cudnn.benchmark = True from torch import nn, autograd from torch import optim from torch.nn import functional as F from torch.utils import data import torch.dis...
StarcoderdataPython
127701
from __future__ import division, print_function, absolute_import import os import numpy as np from dipy.direction.peaks import (PeaksAndMetrics, reshape_peaks_for_visualization) from dipy.core.sphere import Sphere from dipy.io.image import save_nifti import h5py def _safe_save(grou...
StarcoderdataPython
1689427
from .geometry import * from .obstacle_generation import * from .plotting import * from .transformations import *
StarcoderdataPython
1707520
#!/usr/bin/env python import logging from json import loads from time import sleep from threading import Thread from requests import get from requests.exceptions import ConnectionError, ChunkedEncodingError, ReadTimeout from artemisremotecontrol.config import Config from artemisremotecontrol import setleds try: c...
StarcoderdataPython
43330
<reponame>Sumityg/Image-Classifier import numpy as np import torch from torch import nn from torch import optim import matplotlib.pyplot as plt from torchvision import datasets,transforms,models import torch.nn.functional as F from collections import OrderedDict import json from torch.autograd import Variable import ar...
StarcoderdataPython
3396263
#!/usr/bin/python import sys, urllib2, json, tower_cli, os, datetime import splunk.entity as entity # Tower Connect # # This script is used as wrapper to connect to Ansible Tower API. __author__ = "<NAME>" __email__ = "<EMAIL>" __version__ = "1.0" #Securely retrieve Ansible Tower Credentials from Splunk REST API pas...
StarcoderdataPython
186837
<filename>tools_box/tools_box/report/computing_asset_inspection_checklist_report/computing_asset_inspection_checklist_report.py # Copyright (c) 2013, <EMAIL> and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe #Employee Computing Asst Type Status Rem...
StarcoderdataPython
3223547
<filename>chatbotenv/lib/python2.7/site-packages/chatterbot/conversation/statement.py # -*- coding: utf-8 -*- from .response import Response from datetime import datetime class Statement(object): """ A statement represents a single spoken entity, sentence or phrase that someone can say. """ ...
StarcoderdataPython
1755749
<filename>InvenTree/stock/test_views.py<gh_stars>0 """ Unit tests for Stock views (see views.py) """ from django.test import TestCase from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from common.models import InvenTreeSetting import json from...
StarcoderdataPython
177712
from setuptools import setup setup(name='pymongo_smart_auth', version='1.2.1', description='This package extends PyMongo to provide built-in smart authentication.', url='https://github.com/PLPeeters/PyMongo-Smart-Auth', author='<NAME>', author_email='<EMAIL>', license='MIT', p...
StarcoderdataPython
1653365
<reponame>dfiel/greenwavecontrol<gh_stars>1-10 import requests import xmltodict import urllib3 def grab_xml(host, token=None): """Grab XML data from Gateway, returned as a dict.""" urllib3.disable_warnings() if token: scheme = "https" if not token: scheme = "http" token = "<PAS...
StarcoderdataPython
12380
#!/usr/bin/python3 """ | --------------------- Py include <Mauro Baladés> --------------------- | ___ _ _ _ __ _ _ ___ ____ | | |_) \ \_/ | | | |\ | / /` | | | | | | | \ | |_ | |_| |_| |_| |_| \| \_\_, |_|__ \_\_/ |_|_/ |_|__ | -----------------------------------------...
StarcoderdataPython
4828142
<reponame>ldkrsi/GAE-py-framework import importlib, glob from os.path import dirname, basename, isfile __all__ = [] for f in glob.glob(dirname(__file__)+"/*.py"): if not isfile(f) or f.endswith('__init__.py'): continue name = basename(f)[:-3] tmp = importlib.import_module('controllers.' + name) ...
StarcoderdataPython
74501
#!/usr/bin/env python3 import argparse import itertools from sys import argv from vang.bitbucket.api import call from vang.core.core import pmap_unordered def get_repos_page(project, limit, start): response = call(f'/rest/api/1.0/projects/{project}' f'/repos?limit={limit}&start={start}') ...
StarcoderdataPython
1647149
from transformers import RobertaTokenizerFast from tokenizers.processors import BertProcessing class RoBERTaTokenizer(): def __init__(self, dataset, vocab_size=30000, min_frequency=2, special_tokens, max_len=512): self.tokenizer = RobertaTokenizerFast.
StarcoderdataPython
1735498
import os import json import numpy as np from ..default import API_SCHEMA_FILE from .. import ErsiliaBase class ApiSchema(ErsiliaBase): def __init__(self, model_id, config_json): ErsiliaBase.__init__(self, config_json=config_json) self.model_id = model_id self.schema_file = os.path.join( ...
StarcoderdataPython
1665910
<gh_stars>1-10 import datetime as dt import src.core.callbacks as cl import src.custom as custom import src.utils as utils from pathlib import Path from typing import List, Optional from src.core.state import State from src.core.callbacks import Callback class SubRunner: signature = "" group = "main" ...
StarcoderdataPython
1734571
<filename>ceilingfox.py<gh_stars>0 import psycopg2, psycopg2.extras import os import configparser import random def ceiling_fox_post(): data = [] with open((os.path.join(os.path.dirname(__file__), 'blobfox')), 'r', encoding='utf-8') as emojilist: data = emojilist.read().splitlines() random.seed() ...
StarcoderdataPython
3292018
<gh_stars>0 import os import openpyxl as xl import pandas as pd import xlrd import xlwt import xlsxwriter import pathlib rootpath = 'E:\\College\\Semester 6\\Files\\python\\files iterate\\Test Data' header = [] folders = [] files =[] for r, d, f in os.walk(rootpath): for folder in d: folders.append(os.path.join(...
StarcoderdataPython
128986
<gh_stars>1-10 import sys from config import Config from device.DeviceManager import DeviceManager from logger import initLogger class App: """ The application class. """ def __init__(self): """ Contructor. """ logger = initLogger() self.logger = logger.getLogg...
StarcoderdataPython
1667921
<gh_stars>1-10 # 读取一行 f = open('a.txt') content = f.readline() # 读取一行 # print(content) # 通过循环的方式读取一行 while len(content) > 0: print(content, end="") content = f.readline() # 接着读 f.close() # 读完关闭
StarcoderdataPython
1716031
#!/usr/bin/python3 # encoding: utf-8 import asyncio import threading import time import ArmController as controller #舵机转动 import random import websockets # 机械臂位置校准 def Arm_Pos_Corr(): controller.setServo(1, 1200, 500) controller.setServo(2, 500, 500) time.sleep(1) def get_arm_pos(): while True: ...
StarcoderdataPython
3220111
<reponame>tranquilitybase-io/tb-aws-dac # Supports all actions concerning applications import json from pprint import pformat from celery import states from celery.result import AsyncResult from flask import abort import config from gcpdac.application_ci import create_application, delete_application from gcpdac.celer...
StarcoderdataPython
3294481
<filename>var/spack/repos/builtin/packages/sicm/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Sicm(CMakePackage): """SICM: Si...
StarcoderdataPython
32819
<gh_stars>1-10 # Microsoft Azure Linux Agent # # Copyright 2018 Microsoft Corporation # Copyright 2018 Sonus Networks, Inc. (d.b.a. Ribbon Communications Operating Company) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ob...
StarcoderdataPython
1777886
<gh_stars>0 # Librerias Django from django.contrib.auth import views as auth_views from django.urls import path # Librerias en carpetas locales from .subviews.pos import ( DeletePos, PosCreateView, PosDetailView, PosListView, PosUpdateView) urlpatterns = [ path('pos', PosListView.as_view(), name='pos'), p...
StarcoderdataPython
3290914
<filename>intranet/org/management/commands/send_diary.py #!/usr/bin/env python # -*- coding: utf-8 -*- import datetime from django.core.management.base import BaseCommand from django.core.mail import EmailMultiAlternatives from django.conf import settings from django.template import Context from django.template.loade...
StarcoderdataPython
3293343
<reponame>soybean217/lora-python #! /usr/bin/env python #-*- coding:utf-8 -*- import os import sys import time import socket # import crc16 from binascii import unhexlify from binascii import hexlify import crcmod import codecs def doConnect(host, port): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
StarcoderdataPython
1612583
<reponame>sburden-group/pareto_leg_hardware from time import perf_counter from motor_control_process import MotorControl from leg_controllers.designs import Params import yaml import keyboard import argparse parser = argparse.ArgumentParser( prog = "Foo Bar Baz", description = "Foo Bar Baz", ) parser.add_argum...
StarcoderdataPython
3367397
<reponame>messiaen/csv2md import sys import argparse import csv def csv_to_table(file, delimiter=',', quotechar='"'): try: return list(csv.reader(file, delimiter=delimiter, quotechar=quotechar)) except csv.Error as e: print(e, file=sys.stderr) print('Something went wrong...') p...
StarcoderdataPython
1683975
<reponame>jiahuanluo/attention-is-all-you-need-pytorch ''' Translate input text with trained model. ''' import torch import argparse import dill as pickle from tqdm import tqdm import transformer.Constants as Constants from torchtext.data import Dataset from transformer.Models import Transformer from transformer.Tran...
StarcoderdataPython
29144
# -*- coding: utf-8 -*- # https://github.com/Kodi-vStream/venom-xbmc-addons import xbmcaddon, xbmcgui, xbmc """System d'importation from resources.lib.comaddon import addon, dialog, VSlog, xbmcgui, xbmc """ """ from resources.lib.comaddon import addon addons = addon() en haut de page. utiliser une fonction comad...
StarcoderdataPython
1656442
<filename>python/ex8_anomaly_recommender/ano_rec_funcs/cofi_cost_func.py import numpy def cofi_cost_func(params, Y, R, num_users, num_movies, num_features, reg_lambda=0.0): """ Collaborative filtering cost function. Parameters ---------- params : array_like The parameters which will be op...
StarcoderdataPython
3279839
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
StarcoderdataPython
5119
import sys sys.setrecursionlimit(10000) def dfs(r, c): global visit visit[r][c] = True mov = [(-1, 0), (0, -1), (1, 0), (0, 1)] for i in range(4): dr, dc = mov[i] nr, nc = r + dr, c + dc if 0 <= nr < N and 0 <= nc < M and visit[nr][nc] == False and board[nr][nc] == 1: ...
StarcoderdataPython
1648492
<reponame>kit-tm/seed from pox.core import core from pox.lib.packet.arp import arp from pox.lib.revent import EventMixin log = core.getLogger() class host(EventMixin): host_map = {} def __init__(self): core.listen_to_dependencies(self) def _handle_openflow_PacketIn(self, event): dpid = e...
StarcoderdataPython
3306459
<filename>src/dorime-bot.py # Discord Stuff import discord # Spotify Stuff # import spotipy # from spotipy.oauth2 import SpotifyClientCredentials # Utility Imports from distutils.util import strtobool from dotenv import dotenv_values import requests import json import re # See Sample.env for example of what the .env...
StarcoderdataPython
1620857
# Program to find Juggler Sequence in Python # Juggler Sequence: https://en.wikipedia.org/wiki/Juggler_sequence # The juggler_sequence function takes in a starting number and prints all juggler # numbers starting from that number until it reaches 1 # Keep in mind that the juggler sequence has been conjectured to reach...
StarcoderdataPython
3376468
<filename>src/lesson.py # -*- coding: utf-8 -*- import random import word import dictionary import lesson_words class Practice: def __init__(self, lesson, word, type_pr): self.lesson = lesson self.word = word self.type_pr = type_pr self.result = None self.is_answer = False...
StarcoderdataPython
3255982
<reponame>qihuilyu/P2T import main_ct as denoise import math from subprocess import run, CalledProcessError import numpy as np import numpy.random as nprand import tensorflow as tf from tensorflow.python.framework.errors_impl import ResourceExhaustedError, InvalidArgumentError import argparse parser = argparse.Argum...
StarcoderdataPython
3220910
<reponame>XiXL/stereo-py-cv # filename: camera_configs.py import cv2 import numpy as np left_camera_matrix = np.array([[427.794765373576, 0., 345.316879362880], [0., 427.523078909675,248.042320744550], [0., 0., 1.]]) left_distortion = np.array([[0.12...
StarcoderdataPython
58601
from dagster import check from dagster.core.host_representation.external_data import ExternalPartitionData from dagster.core.host_representation.handle import RepositoryHandle from .utils import execute_unary_api_cli_command def sync_get_external_partition(repository_handle, partition_set_name, partition_name): ...
StarcoderdataPython
1767131
<gh_stars>10-100 # Copyright 2021 Alibaba Group Holding Limited. 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 # # Un...
StarcoderdataPython
1669227
<gh_stars>100-1000 from sanic import Sanic from sanic import response from sanic.exceptions import NotFound from sanic_cors import CORS import segment,project app = Sanic(name=__name__) CORS(app) # camera = Camera() # @app.route('/') # def handle_request(request): # return response.html('<p>Hello world!</p><i...
StarcoderdataPython
126990
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import shorturl try: from setuptools import setup except ImportError: from distutils.core import setup if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') os.system('python setup.py bdist_wheel upload') sys.ex...
StarcoderdataPython
3345683
# <NAME> <<EMAIL>> import copy import logging import pytest try: import unittest.mock as mock except ImportError: import mock from alphatwirl.loop import EventsInDatasetReader, EventLoop ##__________________________________________________________________|| @pytest.fixture() def eventLoopRunner(): return...
StarcoderdataPython
66424
import os.path as osp from .builder import DATASETS from .custom import CustomDataset @DATASETS.register_module() class MaSTr1325(CustomDataset): """PascalContext dataset. In segmentation map annotation for PascalContext, 0 stands for background, which is included in 60 categories. ``reduce_zero_label``...
StarcoderdataPython
3349531
from __future__ import with_statement import py import sys from rpython.rlib.parsing.tree import Nonterminal, Symbol, RPythonVisitor from rpython.rlib.parsing.codebuilder import Codebuilder from rpython.rlib.objectmodel import we_are_translated class BacktrackException(Exception): def __init__(self, error=None): ...
StarcoderdataPython
3281468
import os import time import numpy as np import collections import scipy import scipy.sparse import scipy.sparse.linalg import scikits.sparse.cholmod import sklearn.preprocessing import hashlib import types import marshal import pyublas import cPickle as pickle from collections import OrderedDict from sigvisa.treegp....
StarcoderdataPython
1696422
<filename>reporting/hardware_management.py # -*- coding: utf-8 -*- import os import pickle import shutil import subprocess import sys import sensors #only needed for ubuntu root_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(root_path[0:root_path.find("/thirtybirds")]) from thirtybirds3.reporting....
StarcoderdataPython
110740
<gh_stars>10-100 # Copyright Contributors to the Pyro-Cov project. # SPDX-License-Identifier: Apache-2.0 import argparse import json import logging import pickle import re from collections import Counter, defaultdict from pyrocov.align import AlignDB from pyrocov.util import open_tqdm logger = logging.getLogger(__na...
StarcoderdataPython
3303617
# Copyright 2017 Google Inc. 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 applicable law or a...
StarcoderdataPython
52275
import re from django.urls import path from render_static.tests.views import TestView class Unrecognized: regex = re.compile('Im not normal') class NotAPattern: pass urlpatterns = [ path('test/simple/', TestView.as_view(), name='bad'), NotAPattern() ] urlpatterns[0].pattern = Unrecognized()
StarcoderdataPython
1702473
<filename>pipeline.py<gh_stars>1-10 from typing import Dict, Iterable, List, Tuple, Any, Union from PyMongoWrapper import MongoResultSet from concurrent.futures import ThreadPoolExecutor from models import Paragraph class PipelineStage: """ 流程各阶段。返回应同样为一个段落记录(可以不与数据库中的一致)。 注意,针对段落的处理可能是并发进行的。 ...
StarcoderdataPython
4811809
from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Implementing DL models for ranking, with evaluation benchmarks', author='ajea', license='MIT', )
StarcoderdataPython
137815
<reponame>tws0002/anima # -*- coding: utf-8 -*- # Copyright (c) 2012-2018, <NAME> # # This module is part of anima-tools and is released under the BSD 2 # License: http://www.opensource.org/licenses/BSD-2-Clause from anima import logger from anima.ui.lib import QtGui, QtCore def set_item_color(item, color): """...
StarcoderdataPython
1705453
<filename>swift/common/middleware/slo.py<gh_stars>0 # -*- coding: utf-8 -*- from urllib import quote from cStringIO import StringIO from datetime import datetime import mimetypes from webob import Request from urllib import unquote from webob.exc import HTTPBadRequest, HTTPServerError, \ HTTPMethodNotAllowed, HTT...
StarcoderdataPython
24315
# -*- coding: utf-8 -*- # Copyright (C) 2010-2014 <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
StarcoderdataPython
90120
<filename>obs_movieconverter.py<gh_stars>0 """ Converts obs movies to a format usable by imovie """ import os import sys from shutil import copyfile files = sorted([f for f in os.listdir('.') if '.mp4' in f and '2020' in f]) out_files = ['new_' + f + '.mov' for f in files] rtn_codes = [] for count, f in enumerate(fi...
StarcoderdataPython
3322633
<reponame>rcalfredson/objects_counting_dmap """Looper implementation.""" from os import error from typing import Optional, List import cv2 from dual_loss_helper import get_loss_weight_function import torch import numpy as np import matplotlib import matplotlib.axes import timeit class Looper: """Looper handles e...
StarcoderdataPython
3388844
<filename>Chapter05/TFIDFdemo/tfidf_scikitlearn.py # given saksperar data set to generate the tf-tdf model and thenfor new document it sugesset us keywords import numpy as np import nltk import string import os from nltk.stem.porter import * from sklearn.feature_extraction.text import TfidfVectorizer from collections...
StarcoderdataPython
1668562
<filename>account/views.py from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from .forms impor...
StarcoderdataPython
3251901
# -*- coding: utf-8 -*- from qcloudsdkcore.request import Request class ModifyScalingNotificationRequest(Request): def __init__(self): super(ModifyScalingNotificationRequest, self).__init__( 'scaling', 'qcloudcliV1', 'ModifyScalingNotification', 'scaling.api.qcloud.com') def get_notifica...
StarcoderdataPython
1717303
<gh_stars>1-10 # Python3 import functools # 有限制修改區域 from fractions import gcd def leastCommonDenominator(denominators): return functools.reduce(lambda a, b: a * b / gcd(a, b), denominators)
StarcoderdataPython
66659
<reponame>ecradock/wifihawk DEFAULT_CONFIG_NAME = ".wifihawk.ini"
StarcoderdataPython
3201349
<gh_stars>1-10 # CLUB ENTRY EDABIT SOLUTION: def club_entry(word): # creating a for-loop to iterate for the characters in the word. for i in range(len(word) - 1): # creating a nested if-statement to check for the same character being repeated twice. if word[i] == word[i + 1]: ...
StarcoderdataPython
3244752
# -*- coding: UTF-8 -*- # Copyright (c) 2019 PaddlePaddle 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 # ...
StarcoderdataPython
3352216
<filename>sim/simulation.py<gh_stars>1-10 import math import casadi as ca import numpy as np from models.geometry_utils import RectangleRegion from sim.logger import ( ControllerLogger, GlobalPlannerLogger, LocalPlannerLogger, SystemLogger, ) class System: def __init__(self, time=0.0, state=None...
StarcoderdataPython
1655561
<reponame>MiguelTeixeiraUFPB/PythonM3 def lecontatosdearquivo(nomearquivo): arquivo=open(nomearquivo,'r') linhas=[] for linha in arquivo: linhalida=linha.strip().split('#') linhas.append(linhalida) return(linhas) def listacontatos(contatos): for linha in contatos: print(f'no...
StarcoderdataPython
3200660
<reponame>adiitya-dey/datastructures import logging import numpy as np class BasicSort: def __init__(self, arr, sortfn): logging.debug("Sorting class is initialized.") self.__arr = arr print(sortfn) self.__sortfn = sortfn.lower() if self.__sortfn == "insertsor...
StarcoderdataPython
84687
#! /usr/bin/env python3 import numpy as np from sklearn.neighbors import NearestNeighbors from computeNeighborWeights import computeNeighborWeights from computeWeightedMRecons import computeWeightedMRecons from computeFeatures import computeFeatures def computeFullERD(MeasuredValues,MeasuredIdxs,UnMeasuredIdxs,Theta,S...
StarcoderdataPython
3396408
""" Module that contains simple in memory storage implementation """ class Storage(object): _tweets = [{ 'id': 1, 'name' : 'mladen', 'tweet' : 'baba'} ] @classmethod def get_tweets(cls): return cls._tweets @classmethod def ge...
StarcoderdataPython
41357
<gh_stars>10-100 # Copyright 2019 Cohesity Inc. # # Python example to list recent user_configurable unresolved alert unresolved Alerts. # # Usage: python list_unresolved_alerts.py --max_alerts 10 import argparse import datetime from cohesity_management_sdk.cohesity_client import CohesityClient from cohesity_managemen...
StarcoderdataPython
93268
<filename>EchoTest.py<gh_stars>0 # (c) Copyright 2014 Synapse Wireless, Inc. """ EchoTest.py - a simple benchmark used to determine how fast SNAP Connect can communicate with a directly connected bridge. We use this to evaluate different Python platforms, implementations, and serial drivers. This example demonstrates ...
StarcoderdataPython
35634
""" test_Payload.py Copyright 2012 <NAME> This file is part of w3af, http://w3af.org/ . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. w3af is distributed in the hope that it wil...
StarcoderdataPython
3208778
<reponame>Stevanus-Christian/tensorflow<filename>tensorflow/python/tpu/tests/tpu_embedding_v2_sequence_feature_test.py<gh_stars>1-10 # Copyright 2020 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...
StarcoderdataPython
58332
<reponame>ddelange/PyArmyKnife import inspect import logging import os from pickle import HIGHEST_PROTOCOL logger = logging.getLogger(__name__) try: stack = inspect.stack() # print([entry for entry in stack]) # current_file = [entry[1] for entry in stack if entry[-2][0].strip(' ').startswith('import %s' %...
StarcoderdataPython
3291511
<gh_stars>100-1000 # -*- coding: utf-8 -*- """Tests that linkers contain all possible types defined in constants.""" from moe.bandit.constant import BANDIT_ENDPOINTS, EPSILON_SUBTYPES, UCB_SUBTYPES from moe.bandit.linkers import BANDIT_ENDPOINTS_TO_SUBTYPES, EPSILON_SUBTYPES_TO_BANDIT_METHODS, UCB_SUBTYPES_TO_BANDIT_ME...
StarcoderdataPython
13990
<gh_stars>1-10 ''' Uses HPI [[https://github.com/karlicoss/HPI/blob/master/doc/MODULES.org#myreddit][reddit]] module ''' from itertools import chain from typing import Set, Optional from ..common import Visit, Loc, extract_urls, Results, logger def index(*, render_markdown: bool = False, renderer: Optional['RedditR...
StarcoderdataPython
3373319
## FIXME: Replace all dots ## 8 kyu ## https://www.codewars.com/kata/596c6eb85b0f515834000049 import re def replace_dots(str): return re.sub(r"\.", "-", str)
StarcoderdataPython
4803466
"""Authentication resource views""" from flask_jwt_extended import create_access_token from marshmallow import ValidationError from flask_restful import Resource from flask_api import status from flask import jsonify, request, session, make_response from serializers.user_schema import LoginSchema from app_config import...
StarcoderdataPython
3201825
<reponame>aws-samples/build-a-360-degree-customer-view-with-aws import boto3 import os import json from datetime import datetime,timedelta import time import random s3 = boto3.resource("s3") region = os.getenv('region') FilePath = 'card' BucketName = os.getenv('BucketName') csvDelimiter = os.getenv('csvDelimiter') ...
StarcoderdataPython