id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1778370
#!/usr/local/bin/python3 help = ''' HOP Hearth OS Package manager Version 1.0 Install a package: hop install <package_name> Check for an update of a package: hop update ''' # Import modules that are needed import json, requests, sys, os, rich from rich.console import Console from rich.prompt import Confirm from ri...
StarcoderdataPython
98596
<gh_stars>1-10 class Node: starting = True ending = False name = "" weight = [1, 20] active = True edge_length = 0 nodes = [] def __init__(self, name, grid, posX, posY, active): self.name = name # Name of the node self.grid = grid # Which grid the node will be placed self.posX = posX # Position X ...
StarcoderdataPython
185331
from __future__ import absolute_import from logging import getLogger logger = getLogger("gui_builder.fields") import traceback from .widgets import wx_widgets as widgets try: unicode except NameError: unicode = str class UnboundField(object): creation_counter = 0 _GUI_FIELD = Tr...
StarcoderdataPython
1794555
<filename>source/ImageComprehension/Writing/tess_test.py from PIL import Image import sys import os import cv2 import CustomImage as CI import ShapeDetection as SD import pytesseract def main(args): # directory = os.fsencode(args[1]) for fil in os.listdir(args[1]): # print(fil) filename = args...
StarcoderdataPython
1749981
<filename>train_condflowpp.py<gh_stars>0 import argparse import os from data import CIFAR10Dataset, Imagenet32DatasetDiscrete from models.embedders import BERTEncoder, OneHotClassEmbedding, UnconditionalClassEmbedding import torch from utils.utils import sample_image, load_model, sample_images_full from torch.optim imp...
StarcoderdataPython
3320207
from lib.action import St2BaseAction from lib.formatters import format_rule_result __all__ = [ 'St2RulesDisableAction' ] class St2RulesDisableAction(St2BaseAction): def run(self, pack=None, name=None, exclude=None): rule = self._manipulate_rule(pack=pack, name=name, enabled=False) return for...
StarcoderdataPython
1658528
# Copyright 2015 The Switch Authors. All rights reserved. # Licensed under the Apache License, Version 2, which is in the LICENSE file. """ This package adds project-level build and dispatch decisions. The core modules in the package are build and dispatch. The discrete_build module is optional and enforces discrete...
StarcoderdataPython
4808723
<filename>telethon/tl/types/wallet.py """File generated by TLObjects' generator. All changes will be ERASED""" from ...tl.tlobject import TLObject from typing import Optional, List, Union, TYPE_CHECKING import os import struct from datetime import datetime class LiteResponse(TLObject): CONSTRUCTOR_ID = 0x764386d7...
StarcoderdataPython
75595
############################################################################# # Auxililary functions for mBLA_UF code # # # # Used in the paper: # # [1] ...
StarcoderdataPython
99772
<reponame>kakaba2009/MachineLearning<filename>python/src/algorithm/coding/itertools/combinations.py import itertools S, r = input().split(" ") S = list(S) S.sort() R = int(r) for r in range(1, R+1): C = list(itertools.combinations(S, r)) for i in C: print(*i, sep='')
StarcoderdataPython
45765
<gh_stars>1-10 from django.db import models class Recipe(models.Model): TITLE_MAX_LEN=30 INGREDIENTS_MAX_LEN=250 title=models.CharField( max_length=TITLE_MAX_LEN, ) image_url=models.URLField() description=models.TextField() ingredients=models.CharField( max_length=INGREDI...
StarcoderdataPython
3239998
from discord.ext import flags from discord.ext.flags import * # noqa F401 class FlagCommand(flags.FlagCommand): def __init__(self, *args, **kwargs): self._help = kwargs.pop("help", None) super().__init__(*args, **kwargs) @property def help(self): return str(self._help) @help...
StarcoderdataPython
3397427
<gh_stars>1-10 #! /usr/bin/env python import pandas as pd from scipy.optimize import fmin, fsolve from scipy.stats import beta import warnings # These parameters give a mode at the national overdose death rate of 14.3 per # 100k per year. They offer a reasonably broad distribution with a 95% highest # density interv...
StarcoderdataPython
1652519
import fileinput import string import sys import os #project_name = '-A 2008LeapToPetaScaleWS' project_name = '' def perm(l): sz = len(l) if sz <= 1: return [l] return [p[:i]+[l[0]]+p[i:] for i in xrange(sz) for p in perm(l[1:])] indices = ['1','2','3','4'] #indices = ['3','4','1','2'] sort_list...
StarcoderdataPython
53483
<reponame>teagles/teagles-pc #!/usr/bin/env python # http://huge:<EMAIL>@www.<EMAIL>.com/pc/return/disproportional.html import sys import xmlrpclib URL = 'http://www.pythonchallenge.com/pc/phonebook.php' # 13/13.py Bert def main(args=None): if args is None: args = sys.argv[1:] s = xmlrpclib.ServerPro...
StarcoderdataPython
3290644
# This file is part of Maildispatcher. # # Maildispatcher 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, either version 3 of the License, or # (at your option) any later version. # # Maildis...
StarcoderdataPython
3210417
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: <NAME> <<EMAIL>> import os from tempfile import NamedTemporaryFile import pytest import discoursegraphs as dg from discoursegraphs.readwrite.rst.stagedp import StageDPRSTTree from discoursegraphs.readwrite.rst.rs3 import RS3FileWriter, RSTTree """ Basic tests ...
StarcoderdataPython
4839724
from typing import Type, Dict, List from pathlib import Path from .abc import DataContainer, DataContainerHolder from .enums import Resource from .miscmodels import TimeDelta SPELLS_FILE_PATH = Path(__file__).parent.joinpath(Path("static/spells.json")) class Spell(DataContainer): """Represents a Spell object a...
StarcoderdataPython
76099
<reponame>marcelm/dnaio import os import shutil import subprocess import sys from io import BytesIO from tempfile import mkdtemp from textwrap import dedent from pytest import raises, mark import dnaio from dnaio import ( FileFormatError, FastaFormatError, FastqFormatError, FastaReader, FastqReader, Interleav...
StarcoderdataPython
3268120
# Generated by Django 3.0.8 on 2020-08-11 03:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('get_bank_csv', '0004_auto_20200811_0921'), ] operations = [ migrations.AddField( model_name='transaction', name='mod...
StarcoderdataPython
1789716
<reponame>jeroendoggen/blackboard-analysis-tools<gh_stars>1-10 """ Blackboard Analysis Tools Copyright 2013, <NAME>, <EMAIL> """ from __future__ import print_function, division # We require Python 2.6+ import logging import sys class Logger(): """ Logging class """ logger = 0 def __init__(sel...
StarcoderdataPython
1781992
<reponame>shellywhen/LQ2<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- class ModelArg(): """A class to mimic the command line parser. ----------------EXPERIMENT------------------ :name: an alias to the experiment :model_save_to: path of the saved file, including log and parameters ----...
StarcoderdataPython
3285723
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2014-2018 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
StarcoderdataPython
25243
<reponame>labs12-music-stream-selector/DS from rest_framework import serializers from songs.models import ( Song, Tag, NewVideo, NewComment, NewVideoTag, NewVideoStats, NewVideoCorrectMood, ) class NewVideoStatsSerializer(serializers.ModelSerializer): new_video = serializers.StringRelatedField() class Meta: ...
StarcoderdataPython
1738664
import os import time from multiprocessing import Pool, Queue def error_callback(msg): print(msg) def pro_test1(q): print("[子进程1]PPID=%d,PID=%d,GID=%d" % (os.getppid(), os.getpid(), os.getgid())) q.put("[子进程1]小明,今晚撸串不?") # 设置一个简版的重试机制(三次重试) for i in ra...
StarcoderdataPython
1613164
<reponame>xrnl/rebel_explorer from sqlalchemy.orm.exc import NoResultFound from rebel_explorer.models import db, Member, LocalGroup from rebel_explorer.utils.parsing import extract_member_data from more_itertools import one import re def store_members(members): for m in members: m = extract_member_data(m...
StarcoderdataPython
3211809
<gh_stars>0 """ This page is entirely to show the possibilites of Streamlit while making it fun """ import streamlit as st import webbrowser from PIL import Image def write(): st.title("Chamber of Secerets :door:") st.write("\n") st.write("\n") st.markdown( """### Welcome to the chamber of ...
StarcoderdataPython
3359303
# Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy.testing import assert_allclose from gammacat.info import gammacat_info from gammacat.sed import SED def test_sed_input(): filename = gammacat_info.in_path / 'data/2008/2008A%26A...481..401A/tev-000112-sed.ecsv' sed = SED.read(filename)...
StarcoderdataPython
4825844
<reponame>mnpappo/neural_network __author__ = "<NAME>" __github__ = "http://github.com/mnpappo" """ This script use keras & minist dataset to test random Dropout effects on result. """ import numpy as np from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Acti...
StarcoderdataPython
3339983
""" This file provides a Parser class, used to parse a string into an expression tree, defined in 'logic_simplifier.expr'. """ from logic_simplifier.expr import Operator, Negation, FalseVal, TrueVal, Variable class ParseException(Exception): pass class Parser(object): _ops = [ { '=' }, # lowest pr...
StarcoderdataPython
3207526
<filename>flybirds/core/plugin/plugins/default/screen.py # -*- coding: utf-8 -*- """ Device screenshot method. """ import os import time import traceback from base64 import b64decode import flybirds.core.global_resource as gr import flybirds.utils.file_helper as file_helper import flybirds.utils.flybirds_log as log im...
StarcoderdataPython
3399975
<gh_stars>0 # -*- coding=utf-8 -*- from .file_io import * from .time_it import TimeIt from .util_doc import pkuseg_postag_loader from .zip_file import zip_file, unzip_file from .help_search import HelpSearch help = HelpSearch()
StarcoderdataPython
144833
<reponame>dumpmemory/google-research<gh_stars>0 # coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
StarcoderdataPython
3360911
<filename>PBO_18190/latihan 4.3 PBO_18190.py.py tuple_string= ("HTML", "CSS", "python") tuple_int= (1,2,3,4,5) tuple_pub= "a","b","c" print("tuple string: ", tuple_string) print("tuple int: ", tuple_int) print("tuple pub: ", tuple_pub)
StarcoderdataPython
62667
""" -- For Development Purposes -- Serves all all api challenges and training materials Look out for auth clashes and multiple cookies """ import uvicorn from fastapi import FastAPI from rest_introduction_app.api.api import api_router app = FastAPI( title='Testing HTTP responses', description="Application to ...
StarcoderdataPython
4805660
import math angle = 0.01 sin(angle) # NameError: name 'sin' is not defined (function imported from 'math') math.sin(angle) # 'sin' function now correctly defined math.tan(angel) # NameError: name 'angel' not defined (typographic error) math.tan(angle) # Global variable now correctly defined
StarcoderdataPython
96092
from views import db from _config import DATABASE_PATH import sqlite3 # from datetime import datetime # migration of tasks table # with sqlite3.connect(DATABASE_PATH) as conn: # c = conn.cursor() # c.execute('ALTER TABLE tasks RENAME TO old_tasks') # db.create_all() # c.execute("""SELECT name, due...
StarcoderdataPython
64542
""" Module contains tools for processing files into DataFrames or other objects """ from __future__ import annotations from collections import abc import csv import sys from textwrap import fill from typing import Any import warnings import numpy as np import pandas._libs.lib as lib from pandas._libs.parsers import ...
StarcoderdataPython
3343848
<reponame>rolker/noaadata #!/usr/bin/env python # Parses format from <NAME> on the R/V Revelle # Hackish conversion code by <NAME>. 05-May-2011. Consider this public domain code # Reduce VDO to 1 every 60 VDO messages import sys vdo_count = 0 for filename in sys.argv[1:]: for line in open(filename): ...
StarcoderdataPython
19780
from __future__ import absolute_import # import apis into api package from .contact_api import ContactApi
StarcoderdataPython
3357639
<filename>isic/ingest/models/zip_upload.py import logging import zipfile from django.conf import settings from django.contrib.auth.models import User from django.core.mail import send_mail from django.core.validators import FileExtensionValidator from django.db import models, transaction from django.template.loader im...
StarcoderdataPython
3259675
"""Framework for writing output in different formats Description: ------------ Each output format / output destination should be defined in a separate .py-file. The function inside the .py-file that should be called need to be decorated with the :func:`~midgard.dev.plugins.register` decorator as follows:: from m...
StarcoderdataPython
76003
# Unit tests related to 'Shipments' (https://www.easypost.com/docs/api#shipments). import time import easypost import pytest @pytest.mark.vcr() def test_shipment_creation(): # We create a shipment and assert on values saved. # create a to address and a from address to_address = easypost.Address.create(...
StarcoderdataPython
1698250
import geopandas as gpd import networkx as nx import pandas as pd import shapely from shapely.ops import cascaded_union from syspy.spatial import polygons, spatial from syspy.syspy_utils import neighbors, pandas_utils, syscolors from tqdm import tqdm def compute_coverage_layer(layer, buffer, extensive_cols=[]): "...
StarcoderdataPython
21622
<gh_stars>1-10 """Specifies the supported Bazel versions.""" CURRENT_BAZEL_VERSION = "5.0.0" OTHER_BAZEL_VERSIONS = [ "6.0.0-pre.20220223.1", ] SUPPORTED_BAZEL_VERSIONS = [ CURRENT_BAZEL_VERSION, ] + OTHER_BAZEL_VERSIONS
StarcoderdataPython
1662413
from django.shortcuts import render, HttpResponse from django.shortcuts import HttpResponseRedirect from django.template import Context, Template from models import UploadFileForm from models import extGenOptimizer1 OPTIONS = """ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek', }, defau...
StarcoderdataPython
132640
CLIENT_ID = "9f9c1dd9992f4c1aa1b51059f3ec9805" CLIENT_SECRET = "34e88d7df570483d9df03f27c62a80ff"
StarcoderdataPython
178705
from paddle import callbacks from paddle.optimizer.lr import LRScheduler class LRSchedulerC(callbacks.LRScheduler): """Lr scheduler callback function Args: by_step(bool, optional): whether to update learning rate scheduler by step. Default: True. by_epoch(bool, optional): whether ...
StarcoderdataPython
143337
<filename>riboraptor/coherence.py import pickle import numpy as np import pandas as pd import six from scipy import signal from .helpers import identify_peaks from .statistics import coherence_pvalue def _shift_bit_length(x): """Shift bit""" return 1 << (x - 1).bit_length() def _padwithzeros(vector, pad_wid...
StarcoderdataPython
6658
<reponame>calvinfeng/openvino """ Copyright (C) 2018-2021 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by...
StarcoderdataPython
163482
<gh_stars>1-10 import pandas as pd import numpy as np import re import string #load dataset data = pd.read_csv('dataset.csv', encoding='utf-8') #clean dataset def clean_data(data): #drop null values data = data.dropna() #drop duplicates data = data.drop_duplicates(subset='english_sentence') data = data.drop_du...
StarcoderdataPython
3219141
from django.contrib import admin from .models import * admin.site.register(Turma); admin.site.register(Aluno); admin.site.register(Conselho); admin.site.register(UsuarioConselho); admin.site.register(AvaliacaoAluno); admin.site.register(AvaliacaoTurma); admin.site.register(Votacao); admin.site.register(Voto); admin.s...
StarcoderdataPython
12586
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
StarcoderdataPython
29099
<gh_stars>0 cidade = str(input('Qual é o Nome da sua Cidade ?: ')).strip() print('Sua cidade possui o nome Santo?',cidade[:5].upper() == 'SANTO')
StarcoderdataPython
187567
<reponame>chenqianhe/Bank_System<filename>bank1_system.py from customer_account import CustomerAccount from admin import Admin accounts_list = [] admins_list = [] class BankSystem(object): def __init__(self): self.accounts_list = [] self.admins_list = [] self.load_bank_data() ...
StarcoderdataPython
1793347
import unittest from setup.settings import * from numpy.testing import * import numpy as np import dolphindb_numpy as dnp import pandas as pd import orca class FunctionMedianTest(unittest.TestCase): @classmethod def setUpClass(cls): # connect to a DolphinDB server orca.connect(HOST, PORT, "ad...
StarcoderdataPython
3263786
<filename>tests/logistic_regression.py # -*- coding: utf-8 -*- # Author: <NAME> <<EMAIL>> # # License: BSD 3 clause from machlearn import logistic_regression as LogisticReg LogisticReg.demo(dataset="Social_Network_Ads")
StarcoderdataPython
1694331
<gh_stars>1-10 #import libraries import numpy as np import pandas as pd from pathlib import Path from sklearn.model_selection import train_test_split import os import torch import torch.optim as optim import random # fastai from fastai import * from fastai.text import * from fastai.callbacks import * # transform...
StarcoderdataPython
121627
<gh_stars>0 from turtle import left from typing import List, Optional # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def traverse(self, binary_tree: List[int], node...
StarcoderdataPython
1717527
#!/usr/bin/env python import os import glob import numpy as np from astropy.io import fits from astropy.time import Time from astropy.table import Column, MaskedColumn import matplotlib.pyplot as plt from iminuit import Minuit from probfit import Chi2Regression, linear TessTimeBin_sec = 120.0 # sec TessTimeBin_da...
StarcoderdataPython
3288724
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import AdaBoostClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import train_test_split from sklearn.model_selection import cross_val_score from sklearn.metrics import classifica...
StarcoderdataPython
3361603
<reponame>hritik5102/Awesome-Computer-Vision-Guide import cv2 import matplotlib.pyplot as plt img = cv2.imread('../Images and videos/image8.jpg') ## Let's try converting it to grayscale ## If you want you can try without converting to grayscale img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret1, thresh1 = cv2.thresh...
StarcoderdataPython
137448
<gh_stars>10-100 import scipy.io as sio from auxilliary import Aux from neuron_object import Neuron import numpy as np def load_creat_aux_3_mat(fname): return sio.loadmat(fname) def load_make_tree_mat(fname): return sio.loadmat(fname) def clean_make_tree_mat(mat): ret = {} ret['j'] = mat['j'][0][0] ret['SegStar...
StarcoderdataPython
190723
#Read external data import csv data = [] with open('exampleData.csv', newline='') as csvfile: reader = csv.DictReader(csvfile, delimiter=';', quotechar='|') for row in reader: data.append(row) #Create preconfigured data array and initialize it with open('declaration.st', 'w') as f: f.write('VAR\n')...
StarcoderdataPython
3236743
<reponame>zhoulh0322/zfused_outsource_old # Copyright 2017 by <NAME>. All Rights Reserved. # # This library is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation, either # version 3 of the License, or (at your...
StarcoderdataPython
1666394
""" Python Package for Dingtalk Robot Author: SF-Zhou Date: 2018-03-15 """ from setuptools import setup setup( name='dingtalk_robot', version='0.0.5', description='Python Package for Dingtalk Robot', url='https://github.com/SF-Zhou/DingtalkRobot', author='SF-Zhou', author_email='<EMAIL>', ...
StarcoderdataPython
1677899
# # Copyright (c) 2016-2021 Deephaven Data Labs and Patent Pending # ############################################################################## # NOTE: the jvm should have been initialized, or this test will certainly fail ############################################################################## import sys ...
StarcoderdataPython
1713395
<reponame>KristerSJakobsson/cpp-solnp """ To test this algorithm, then: 1) Install this package, for example through pip or by running "pip install ." from the root folder. 2) Run this file with Python """ import pysolnp simple_quadratic = lambda x: x[0] * x[0] starting_points = [1] def solve_simple_quadratic(): ...
StarcoderdataPython
1652521
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # 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 ...
StarcoderdataPython
3261138
import numpy as np from pypylon import pylon class PylonCamera: def __init__(self, **kwargs): self.active = False self.array = np.array([]) self.connect() def connect(self): try: # Create an instant active object with the camera device found first. self...
StarcoderdataPython
3247612
"""PD Hate Crimes _dags file.""" from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator from trident.operators.s3_file_transfer_operator import S3FileTransferOperator from airflow.operators.latest_only_operator import LatestOnlyOperator from airflow.models ...
StarcoderdataPython
4809800
#!/usr/bin/env python """ Test driver Runs off plain text files, similar to how PHP's test harness works """ import os import glob from libinjection import * from words import * print version() def print_token_string(tok): """ returns the value of token, handling opening and closing quote characters """ ...
StarcoderdataPython
174446
<reponame>kayinli/bk-bcs # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not u...
StarcoderdataPython
171264
<filename>napari/layers/_labels_layer/view/__init__.py from .properties import QtLabelsLayer
StarcoderdataPython
182441
# <NAME> # 1001966047 import os import os.path import time import socket import json import subprocess import diff_match_patch as dmp_module dmp = dmp_module.diff_match_patch() absPathToDirectoryA = "\\".join(os.getcwd().split('\\')[:-1]+["Server_A", "parentDirectoryServer_A"]) absPathToDirectoryB = "\\".join(os.getc...
StarcoderdataPython
50122
import re from alr.input_streams import InputStream from alr.instances import Terminal, Token, END_TERMINAL_NAME class LexerException(Exception): pass class Lexer: def next(self) -> Token: pass def findMatchInfo(terminals: [Terminal], data: str): for terminal in terminals: match = re....
StarcoderdataPython
1642149
<reponame>terencelee-uni/multitag-heroku import models import torch import numpy as np import pandas as pd import matplotlib.pyplot as plt from dataset2 import ImageDataset from torch.utils.data import DataLoader import requests, json, os from elasticsearch import Elasticsearch with torch.no_grad(): # initial...
StarcoderdataPython
3362156
# -*- coding: utf-8 -*- """ tipfyext.wtforms.form ~~~~~~~~~~~~~~~~~~~~~~ Form object. :copyright: 2011 tipfy.org. :copyright: 2011 WTForms authors. :license: BSD, see LICENSE.txt for more details. """ import uuid from wtforms import Form as BaseForm from tipfy import Request, current_handler...
StarcoderdataPython
3307112
from subprocess import call with open("version.txt", "r") as f: version = f.read().strip('\n') print(f"Version: {version}") print("Updating __init__.py...") with open("qlibs/__init__.py", "w") as file: print("#Note: autogenerated", file=file) print(f"__version__ = '{version}'", file=file) print("Updatin...
StarcoderdataPython
3269569
<filename>pyts/transformation/tests/test_bag_of_patterns.py<gh_stars>1000+ """Testing for Bag-of-Patterns.""" # Author: <NAME> <<EMAIL>> # License: BSD-3-Clause import numpy as np import pytest from pyts.transformation import BagOfPatterns X = [[0, 2, 1, 3, 4, 2, 1, 0, 3, 1, 2, 0], [2, 0, 1, 3, 2, 4, 1, 2, 0, ...
StarcoderdataPython
91751
class TestBase(object): def test_base(self): assert True
StarcoderdataPython
1624035
#!/usr/bin/env python # coding=utf-8 """ Trees for generating. """ from __future__ import unicode_literals from collections import namedtuple, deque from pytreex.core.node import T __author__ = "<NAME>" __date__ = "2014" class NodeData(namedtuple('NodeData', ['t_lemma', 'formeme'])): """This stores the actual...
StarcoderdataPython
140763
#!/usr/bin/python from threading import Thread import cmd, time, os, sys import ConfigParser import subprocess config = ConfigParser.ConfigParser() config.read("config.ini") VOLATILITY_LOCATION = config.get('volatility', 'volatility_location') VOLATILITY_PROFILE = config.get('volatility', 'volatility_profile') SAVE_L...
StarcoderdataPython
3307172
<gh_stars>1-10 import csv import os import platform import queue import subprocess import threading from os import mkdir, unlink from os.path import abspath, isdir, join, normpath from tempfile import NamedTemporaryFile from tkinter import * from tkinter import messagebox, ttk from base_window import BaseWindow from d...
StarcoderdataPython
3367823
import shutil import subprocess import pytest from pdm.pep517 import utils from tests import FIXTURES @pytest.fixture def project_with_scm(tmp_path): project = FIXTURES / "projects/demo-using-scm" shutil.copytree(project, tmp_path / project.name) with utils.cd(tmp_path / project.name): subproces...
StarcoderdataPython
98293
<reponame>SreenathMopuri/LeetcodeProblemSolutionsInPython # Search in rotated sorted array """ at most two sorted halfs, mid will be apart of left sorted or right sorted, if target is in range of sorted portion then search it, otherwise search other half leetcode link: https://leetcode.com/problems/search-in-rotated-so...
StarcoderdataPython
1630869
from website import db class Nursing(db.Model): id = db.Column(db.Integer, primary_key=True) breast_feeding_ml = db.Column(db.Integer()) milk_feeding_ml = db.Column(db.Integer()) feeding_time = db.Column(db.DateTime())
StarcoderdataPython
122274
<gh_stars>0 import sqlite3 from typing import Any import logging from .db_connector import DbConnector logger = logging.getLogger(__name__) class QuotesStatusDbConnector(DbConnector): """Provides methods to access the 'quotes_status' table of the database. Status code: 0: No quotes downloaded yet 1...
StarcoderdataPython
1798997
<reponame>datavillage-me/datavillage-sdk-python import requests class Behaviour: """ This class offers methods to manage a behaviours ``from datavillage_sdk.user.behaviour import Behaviour`` ``behaviour = Behaviour()`` """ def __init__(self): super().__init__() def create_beha...
StarcoderdataPython
67955
<reponame>achennu/microbenthos import pytest from fipy import PhysicalField from microbenthos import Entity, SedimentDBLDomain, DomainEntity PF = PhysicalField class TestEntity: def test_init(self): e = Entity() assert e def test_update_time(self): # update to clock time e =...
StarcoderdataPython
1704812
<filename>seesaw/vector_index.py<gh_stars>1-10 import ray import annoy import numpy as np from .definitions import FS_CACHE import pickle import time def build_annoy_idx(*, vecs, output_path, n_trees): start = time.time() t = annoy.AnnoyIndex(512, "dot") # Length of item vector that will be indexed for i...
StarcoderdataPython
1662232
# -*- coding: utf-8 -*- """ Written by <NAME> and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license. """ import popupcad class LayerDef(object): def __init__(self, *args): self.layers = list(args) def copy(self): layers = [layer.copy() for layer in self.laye...
StarcoderdataPython
3377229
# -*- coding: utf-8 -*- """PAiP Web Build System - Config Manager NAME - PAiP Web Build System AUTHOR - <NAME> <<EMAIL>> LICENSE - MIT """ # Imports from __future__ import print_function from os import getcwd from os.path import isfile from pwbs.lib.pwm.pwm_json import JSON_IO from pwbs.lib.pwm.pwm_system import Syst...
StarcoderdataPython
6947
from Roteiro7.Roteiro7__funcoes import GrafoComPesos # .:: Arquivo de Testes do Algoritmo de Dijkstra ::. # # --------------------------------------------------------------------------- # grafo_aula = GrafoComPesos( ['E', 'A', 'B', 'C', 'D'], { 'E-A': 1, 'E-C': 10, 'A-B': 2, 'B...
StarcoderdataPython
1783208
from tkinter import * from PIL import ImageTk, Image root = Tk() root.title("Check Validity") canvas1 = Canvas(root, width = 400, height = 300) canvas1.pack() # The Canvas is your display where you can place items, such as entry boxes, buttons, charts and more. # You can control the dimensions of your Canvas by chang...
StarcoderdataPython
4817225
import argparse import os import pathlib import sys from types import SimpleNamespace from typing import Union from configargparse import Namespace from dotenv import load_dotenv, dotenv_values from alembic.config import CommandLine, Config # path to migration scripts BASE_DIR_ALEMBIC = pathlib.Path(__file__).parent....
StarcoderdataPython
4823389
from nose.tools import assert_equal from routes import url_for import ckan.plugins as plugins import ckan.new_tests.helpers as helpers import ckan.model as model from ckan.new_tests import factories assert_in = helpers.assert_in webtest_submit = helpers.webtest_submit submit_and_follow = helpers.submit_and_follow gr...
StarcoderdataPython
140559
<gh_stars>1-10 from __future__ import print_function from __future__ import absolute_import from past.builtins import basestring import numpy as np shared_depot = "act_depot" pointing_fields = [ {'name': 'az', # some 2007 tods don't have Enc_Az_Deg_Astro 'field': 'Enc_Az_Deg', 'dtype': np.float64, ...
StarcoderdataPython
96708
<reponame>smadardan/HMM<gh_stars>0 """ src.HMM ~~~~~~~~~ in this file you can find the utilities for viterbi and backward forward. this will help to take real example and convert to hidden markov model input """ import random class Hmm(object): def __init__(self, a, b, pi, obs_names, hidden_names, logger): ...
StarcoderdataPython
3370402
<reponame>katrina799/jsonclasses<gh_stars>0 """This module defineds the JSON Class object mapping graph.""" from __future__ import annotations from typing import Iterator, NamedTuple, Union, TYPE_CHECKING from .isjsonclass import isjsonobject from .exceptions import (UnlinkableJSONClassException, ...
StarcoderdataPython