id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1783442
<filename>tests/test_nipals.py import logging import matplotlib import numpy as np import pandas as pd import pytest from nipals import nipals testdata = [ [np.nan, 67, 90, 98, 120], [np.nan, 71, 93, 102, 129], [65, 76, 95, 105, 134], [50, 80, 102, 130, 138], [60, 82, 97, 135, 151], [65, 89, ...
StarcoderdataPython
198635
<reponame>po5/vs-parsedvd import shutil import subprocess import vapoursynth as vs from pathlib import Path from abc import ABC, abstractmethod from typing import Any, Callable, List, Union, Tuple from ..dataclasses import IndexFileType core = vs.core class DVDIndexer(ABC): """Abstract DVD indexer interface."...
StarcoderdataPython
1620000
<filename>fpakman/core/flatpak/constants.py from fpakman.core.constants import CACHE_PATH FLATHUB_URL = 'https://flathub.org' FLATHUB_API_URL = FLATHUB_URL + '/api/v1' FLATPAK_CACHE_PATH = '{}/flatpak/installed'.format(CACHE_PATH)
StarcoderdataPython
1646494
<filename>drf_tweaks/mixins.py from collections import deque from rest_framework.exceptions import NotFound, ValidationError class BulkEditAPIMixin(object): details_serializer_class = None # how many items can be edited at once, disabled if None BULK_EDIT_MAX_ITEMS = None BULK_EDIT_ALLOW_DELETE_ITEMS ...
StarcoderdataPython
21224
class Node: """ A node class used in A* Pathfinding. parent: it is parent of current node position: it is current position of node in the maze. g: cost from start to current Node h: heuristic based estimated cost for current Node to end Node f: total cost of present n...
StarcoderdataPython
3247872
<filename>3/3-9.py #-*- coding:utf-8 -*- welcome_person = ['<NAME>', '<NAME>', '<NAME>', '<NAME>', '<NAME>', '<NAME>'] for person in welcome_person: print('welcome to my home to eat dinner,' + person) print(welcome_person[4] + "don't have time!") welcome_person[4] = '<NAME>' for person in welcome_person: print...
StarcoderdataPython
1736864
"""Implementation of Rule L009.""" from ..base import BaseCrawler, LintResult, LintFix from ..doc_decorators import document_fix_compatible @document_fix_compatible class Rule_L009(BaseCrawler): """Files must end with a trailing newline.""" def _eval(self, segment, siblings_post, parent_stack, **kwargs): ...
StarcoderdataPython
95350
<filename>constants.py import numpy as np def get_constants(): return { 'background_cleaning': { 'lower_white': np.array([0, 0, 0], dtype=np.uint8), 'upper_white': np.array([180, 10, 255], dtype=np.uint8), 'angles': list(range(-15, 15)), 'left_book_start_thr...
StarcoderdataPython
1765198
from distutils.core import setup setup( name="needs", packages=["needs"], version="1.0.9", description="Boolean Contexts", author="<NAME>", author_email="<EMAIL>", url="https://github.com/astex/needs", keywords=["context", "permissions", "needs", "roles"], classifiers=[ "Pro...
StarcoderdataPython
1749818
<gh_stars>1-10 import dash_mantine_components as dmc from dash import Output, Input, callback component = dmc.MultiSelect( data=["USDINR", "EURUSD", "USDTWD", "USDJPY"], id="multi-select-error", value=["USDJPY"], style={"width": 400}, ) @callback(Output("multi-select-error", "error"), Input("multi-se...
StarcoderdataPython
106883
<gh_stars>100-1000 """ Mixins for nn.Modules for better textual visualization. """ from textwrap import indent class LayerReprMixin: """ Adds useful properties and methods for nn.Modules, mainly related to visualization and introspection. """ VERBOSITY_THRESHOLD = 10 @property def num_frozen_paramet...
StarcoderdataPython
1704079
import os import pytest from click.testing import CliRunner from paths_cli.commands.append import * import openpathsampling as paths def make_input_file(tps_network_and_traj): input_file = paths.Storage("setup.nc", mode='w') for obj in tps_network_and_traj: input_file.save(obj) input_file.tags[...
StarcoderdataPython
1754397
from PySide6.QtCore import QPoint, Qt, Signal from PySide6.QtGui import QIntValidator from PySide6.QtWidgets import QHBoxLayout, QLineEdit, QSizePolicy, QSlider, QToolTip, QWidget, QApplication class QRangeL(QLineEdit): newValue = Signal() def __init__(self, min=0, max=100, value = 0): super().__ini...
StarcoderdataPython
3323271
import websockets import asyncio import time from .kafka_consumers import async_kafka # {topic_id: KafkaConsumer} broadcaster_lock = asyncio.Lock() topic_broadcasters = {} # {topic_id: [ClientHandler, ClientHandler ...]} subscriptions_lock = asyncio.Lock() client_subscriptions = {} tasks_lock = asyncio.Lock() tasks...
StarcoderdataPython
1623951
<filename>osx/test/test_cfarray.py ## # Copyright (c) 2010-2017 Apple 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 ...
StarcoderdataPython
43023
def is_black(x): return x == '#' def is_square(box, N): size = None fbj1 = None fbj2 = None fbi1 = None fbi2 = None blank = "."*N for i in xrange(0, N): for j in xrange(0, N): if fbj1 is None or fbj2 is None: if is_black(box[i][j]): ...
StarcoderdataPython
4813762
<reponame>asymworks/fitbit2influx<gh_stars>0 # Fitbit2InfluxDB Influx Connection import influxdb class InfluxDB(object): '''InfluxDB Helper for Flask''' def __init__(self, app=None): self._client = None self.app = app if app: self.init_app(app) def init_app(self, app)...
StarcoderdataPython
185980
<reponame>stephlj/smFRETcode<filename>extras/pyhsmm_for_Traces/fret.py<gh_stars>1-10 from __future__ import division import numpy as np from scipy.io import loadmat, savemat from scipy.stats import scoreatpercentile import matplotlib.pyplot as plt import os from os.path import join, splitext, isfile, basename from pyh...
StarcoderdataPython
1794299
<reponame>amazingguni/flask-ddd from app.catalog.domain.category import Category from app.catalog.domain.product import Product from app.catalog.infra.repository.sql_product_repository import SqlProductRepository def test_save(db_session): # Given product = Product(name='꼬북칩', price=1000, detail='바삭하고 맛이 있지요'...
StarcoderdataPython
1677936
<filename>src/lightning_callbacks/rec_err_evaluator.py import torch from pytorch_lightning.callbacks import Callback from pytorch_lightning import Trainer from lightning_modules.base_generative_module import BaseGenerativeModule from metrics.rec_err import mean_per_image_se class RecErrEvaluator(Callback): ...
StarcoderdataPython
3203824
#1: Syntax Errors def helloworld(): return 'Hello World!' #2: Runtime Errors def math(b,c): return 10//b + 10//c+10 #3: Logic Errors def ticketbooth(age): return 'Free ticket!' if 5 < age < 10 else 'You gotta pay!'
StarcoderdataPython
199844
<reponame>Riteme/test<filename>oi/51nod/P1065/gen.py<gh_stars>1-10 #!/usr/bin/env pypy from sys import argv from random import * n, m = map(int, argv[1:]) print n print " ".join(map(str, [randint(-m, m) for i in xrange(n)]))
StarcoderdataPython
3277371
#!/usr/bin/python3 from common import ( constants, ) from common.searchtools import ( FileSearcher, ) from common.known_bugs_utils import ( add_known_bug, BugSearchDef, ) from juju_common import ( JUJU_LOG_PATH ) # NOTE: only LP bugs supported for now BUG_SEARCHES = [ BugSearchDef( (r'....
StarcoderdataPython
3340497
<reponame>asonnino/key-transparency<filename>scripts/benchmark/plot.py from collections import defaultdict from re import findall, search, split import matplotlib.pyplot as plt import matplotlib.ticker as tick from glob import glob from itertools import cycle from benchmark.utils import PathMaker from benchmark.config...
StarcoderdataPython
3253304
<reponame>spacesmap/2 from django.db import models from django.utils.translation import ugettext_lazy as _ CITY_LEVEL_TYPE = ( (0, _("China")), (1, _("Province")), (2, _("City")), (3, _("Country")), ) class City(models.Model): CHINA = 0 PROVINCE = 1 CITY = 2 COUNTRY = 3 name = mo...
StarcoderdataPython
1643924
<filename>note24/order_system (3)/src/order_system_pkg/Promotion.py ####################################################### # # Promotion.py # Python implementation of the Class Promotion # Generated by Enterprise Architect # Created on: 20-4��-2021 13:21:58 # Original author: 70748 # #############################...
StarcoderdataPython
81485
<reponame>mattkw/dl<filename>adv/linyou.py.z.py import adv_test import linyou import slot.d.wind def module(): return Linyou_best class Linyou_best(linyou.Linyou): name = 'Linyou' comment = '2in1 ; Zephyr' def pre(this): pass if __name__ == '__main__': c...
StarcoderdataPython
1785998
<reponame>vincenzodentamaro/music_genre_classification import json from glob import glob import numpy as np from sklearn.metrics import f1_score, average_precision_score from sklearn.model_selection import train_test_split from models import rnn_classifier, transformer_classifier from prepare_data import get_id_from_...
StarcoderdataPython
1758396
from kolibri.utils.cli import main if __name__ == "__main__": main(["start","--port=80","--foreground"])
StarcoderdataPython
3300729
<gh_stars>0 from django.contrib import admin from django.contrib import messages from .models import IncludeBootstrap from django.conf import settings class IncludeBootstrapAdmin(admin.ModelAdmin): fields = ('library', 'version', 'url_pattern', 'integrity', 'url', 'active') readonly_fields = ('integrity', 'ur...
StarcoderdataPython
117075
# Imports from django.contrib import admin from django.urls import path, include # BEGIN urlpatterns = [ path('admin/', admin.site.urls), path('watchdog/', include('watchdog.urls')), path('dashboard/', include('dashboard.urls')), path('smarttasks/', include('smarttasks.urls')), path('nursehouse/',...
StarcoderdataPython
130212
<gh_stars>0 from src import core if __name__ == "__main__": n = core.FrequencyDbName.DAILY assert n == "daily" print(n) print(repr(n)) x = core.FrequencyDbName("todo")
StarcoderdataPython
3345108
<gh_stars>0 sns.pairplot(df) corre=df.corr() plt.figure(figsize=(5,5)) sns.heatmap(corre,cmap='plasma') plt.title('correlations') plt.show() sns.violinplot(y='gender',x='height',data=df , color="0.8" ) sns.stripplot(y='gender',x='height',data=df , zorder=1 ) plt.show() sns.violinplot(y='smoker_nonsmoker',x='height',...
StarcoderdataPython
11349
<reponame>catcherwong-archive/2019<gh_stars>10-100 # -*- coding: UTF-8 -*- import psycopg2 #postgresql import time import datetime class PgDemo: def __init__(self, host, port, db, user, pwd): self.host = host self.port = port self.db = db self.user = user se...
StarcoderdataPython
3218878
<reponame>pthangaraj/Stroke-Phenotyping #By <NAME> (<EMAIL>), <NAME> Lab at Columbia University Irving Medical Center #Part of manuscript: "Comparative analysis, applications, and interpretation of electronic health record-based stroke phenotyping methods" #This script makes the training matrix with collapsed features...
StarcoderdataPython
1679111
#!/usr/bin/python # -*- coding: utf-8 -*- ## License: Apache 2.0. See LICENSE file in root directory. ## Copyright(c) 2019 Intel Corporation. All Rights Reserved. ##################################################### ## librealsense T265 rpy example ## ################################################...
StarcoderdataPython
113766
<reponame>Tongjilibo/bert4torch import math from typing import Callable, Iterable, Optional, Tuple, Union import torch from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1): """ 带war...
StarcoderdataPython
3278274
<gh_stars>0 # -*- coding: utf-8 -*- #from keras.applications.inception_v3 import InceptionV3 from keras.models import Model,load_model from keras.layers import Dense,GlobalAveragePooling2D,Flatten, Input from keras.applications.resnet50 import ResNet50 from keras.preprocessing import image from keras.applications.resne...
StarcoderdataPython
48268
import pandas as pd import utils as ut import constants as cs import matplotlib.pyplot as plt import numpy as np import datetime import calendar import time import math # Create list of files to analyze def createFileList(results_path, scenario_list, scenario_file): fileList = [] for i in scenario_list: ...
StarcoderdataPython
3368856
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # Author: <NAME> 2018 # http://blog.onlinux.fr # # # Import required Python libraries import os import logging import logging.config from thermostat import Thermostat from thermostat import Constants from hermes_python.hermes import Hermes from snipshelpers.config_pars...
StarcoderdataPython
3251020
import pandas as pd from pandasql import sqldf bill = pd.read_csv( filepath_or_buffer="/Users/jianxlin/Documents/PythonWorkspace/jnc-cmdb/cmdb-usage/tmp/309544246384-aws-billing-detailed-line-items-with-resources-and-tags-ACTS-Ningxia-2020-08.csv.zip") bill.columns = bill.columns.str.replace(':', '') bill.rename(c...
StarcoderdataPython
69445
<filename>2020/CVE-2020-16139/poc/pocsploit/CVE-2020-16139.py import requests # Vuln Base Info def info(): return { "author": "cckuailong", "name": '''Cisco 7937G Denial-of-Service Reboot Attack''', "description": '''A denial-of-service in Cisco Unified IP Conference Station 7937G 1-4-4-0 ...
StarcoderdataPython
1636944
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # --------------------------------------------------------------------------...
StarcoderdataPython
3381639
<reponame>jerrykcode/kkFileView # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # This file incorporates work cover...
StarcoderdataPython
16044
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """ web socket可用于实时聊天 """ import websocket if __name__ == '__main__': pass
StarcoderdataPython
3386883
from __future__ import annotations from Bio.Seq import MutableSeq, Seq, reverse_complement from collections import defaultdict from dataclasses import dataclass, field from typing import Optional, List, Dict, Mapping import uuid from kd_splicing.location.models import Location from kd_common import logutil _logger ...
StarcoderdataPython
3260185
<gh_stars>1-10 # MIT License # # Copyright (c) 2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation ...
StarcoderdataPython
56070
""" python app/app.py -> http://0.0.0.0:8080/ """ from app.models.database import db, ma from flask_session import Session from flask_api import FlaskAPI, status from flask_assets import Environment from flask_cors import CORS from flask import jsonify import logging import time from routes.main_db import main_db_bp f...
StarcoderdataPython
23819
import random from qlazy import QState def classical_strategy(trials=1000): win_cnt = 0 for _ in range(trials): # random bits by Charlie (x,y) x = random.randint(0,1) y = random.randint(0,1) # response by Alice (a) a = 0 # response by Bob (b) b = 0 ...
StarcoderdataPython
3204611
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. py:currentmodule:: create_map :synopsis: Create map from the mcxray simulation. .. moduleauthor:: <NAME> <<EMAIL>> Create map from the mcxray simulation. """ ############################################################################### # Copyright 2017 <NAME...
StarcoderdataPython
3392149
"""Get extra charge profile names API method.""" from ibsng.handler.handler import Handler class getExtraChargeProfileNames(Handler): """Get extra charge profile names method class.""" pass
StarcoderdataPython
4806816
<filename>python/word_break.py """ Word break problem Given an input string and a dictionary of words, segment the input string into a space-separated sequence of dictionary words if possible. For example, if the input string is "applepie" and dictionary contains a standard set of English words, then we would return t...
StarcoderdataPython
1700810
from django import forms from .models import Lesson, ClassType, Coach class DateInput(forms.DateInput): input_type = 'date' class TimeInput(forms.TimeInput): input_type = 'time' class LessonForm(forms.ModelForm): class Meta: model = Lesson fields = ('class_type', 'coach', ...
StarcoderdataPython
29456
<filename>src/pynwb/core.py from collections import Iterable from h5py import RegionReference from .form.utils import docval, getargs, ExtenderMeta, call_docval_func, popargs from .form import Container, Data, DataRegion, get_region_slicer from . import CORE_NAMESPACE, register_class from six import with_metaclass ...
StarcoderdataPython
1787218
<gh_stars>0 #!/usr/bin/env python # coding: utf-8 from SDOptimizer.constants import DATA_FILE, PLOT_TITLES, ALARM_THRESHOLD, PAPER_READY, INFEASIBLE_MULTIPLE, NEVER_ALARMED_MULTIPLE, SMOOTH_PLOTS, INTERPOLATION_METHOD from SDOptimizer.functions import make_location_objective, make_counting_objective, make_lookup, make_...
StarcoderdataPython
1766124
<gh_stars>1-10 # NS API key, get one at http://www.ns.nl/en/travel-information/ns-api USERNAME = '<EMAIL>' APIKEY = '<KEY>' DEPLOY_DIR = ''
StarcoderdataPython
3375268
<gh_stars>0 #!/usr/bin/env python import data import numpy if __name__ == "__main__": N = 100000 while True: points = [(r, x) for r, x in data.generate(N)] R = numpy.array([r for r, x in points]) X = numpy.array([x for r, x in points]) for i in range(100): points = ...
StarcoderdataPython
1776351
<gh_stars>0 # Copyright 2018 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
StarcoderdataPython
3250819
#!/usr/bin/env python # coding: utf-8 import h5py import numpy as np from functools import reduce from tqdm import tqdm import disk.funcs as dfn class binary_mbh(object): def __init__(self, filename): self.filename = filename with h5py.File(self.filename, 'r') as f: self.Subha...
StarcoderdataPython
24143
# -*- coding: utf-8 -*- r""" Information-set decoding for linear codes Information-set decoding is a probabilistic decoding strategy that essentially tries to guess `k` correct positions in the received word, where `k` is the dimension of the code. A codeword agreeing with the received word on the guessed position can...
StarcoderdataPython
3296400
# Generated by Django 2.2.1 on 2019-08-05 07:26 from django.db import migrations, models import stdimage.models class Migration(migrations.Migration): dependencies = [ ('authentication', '0012_auto_20190709_1304'), ] operations = [ migrations.AddField( model_name='team', ...
StarcoderdataPython
3270798
""" Copyright 2010 <NAME>, <NAME>, and <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
StarcoderdataPython
50966
<gh_stars>0 class Solution: def singleNumber(self, nums: List[int]) -> int: a = itertools.accumulate(nums,lambda t,x:t^x) return list(a)[-1]
StarcoderdataPython
3321245
from leapp.actors import Actor from leapp.exceptions import StopActorExecutionError from leapp.models import Report, KernelCmdline from leapp.tags import IPUWorkflowTag, ChecksPhaseTag from leapp import reporting class CheckFips(Actor): """ Inhibit upgrade if FIPS is detected as enabled. """ name = '...
StarcoderdataPython
157034
<filename>chesstab/gui/gamerow.py # gamerow.py # Copyright 2008 <NAME> # Licence: See LICENCE (BSD licence) """Create widgets that display tag roster details of games on database. """ import tkinter from solentware_grid.gui.datarow import ( GRID_COLUMNCONFIGURE, GRID_CONFIGURE, WIDGET_CONFIGURE, WIDG...
StarcoderdataPython
94631
from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ] operations = [ migrations.CreateModel( name='Bookmark', fields=[ ('id', models...
StarcoderdataPython
48026
<gh_stars>0 from Bio import SeqIO # sudo pip install biopython with open("Danaus.fas", "rU") as handle: # Example: retain COI for record in SeqIO.parse(handle, "fasta"): fields = record.description.split('|') if fields[2] == 'COI-5P': print '>' + record.description print r...
StarcoderdataPython
1687664
# Copyright (c) 2013 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to t...
StarcoderdataPython
3243206
<filename>freehp/commands.py<gh_stars>1-10 # coding=utf-8 import logging from os.path import isfile from freehp.errors import UsageError from freehp import utils from freehp.version import __version__ from freehp.manager import ProxyManager from freehp import config from freehp import squid log = logging.getLogger(_...
StarcoderdataPython
4820457
<reponame>ceciliaccwei/CMPUT291-proj1<filename>project.py import sqlite3 import getpass import time import os import sys if len(sys.argv) != 2: print("Please run with: python PROJECT.py DATABASE.db") quit() db_file_path = sys.argv[1] if not (os.path.exists(db_file_path)): print("File does not exist!") quit(...
StarcoderdataPython
8231
<reponame>davidhozic/Discord-Shiller """ ~ Tracing ~ This modules containes functions and classes related to the console debug long or trace. """ from enum import Enum, auto import time __all__ = ( "TraceLEVELS", "trace" ) m_use_debug = None class TraceLEVELS(Enum): """ Info: Level ...
StarcoderdataPython
149900
import pickle import sys import zlib from scrapy.crawler import Crawler from scrapy.utils.conf import build_component_list from scrapy.utils.project import get_project_settings from .utils import get_spider_class class Cassette: """ Helper class to store request, response and output data. """ FIXTUR...
StarcoderdataPython
4817896
<reponame>VKCOM/TopicsDataset from typing import Union, Tuple import math import numpy as np from sklearn.cluster import KMeans from modAL.utils import multi_argmax from modAL.models.base import BaseLearner, BaseCommittee from sklearn.exceptions import NotFittedError from modAL.utils.data import modALinput from skl...
StarcoderdataPython
10352
import json from flask import request from flask_restful import Resource, abort, reqparse from models.User import User """ POST Creates a new resource. GET Retrieves a resource. PUT Updates an existing resource. DELETE Deletes a resource. """ class UserEndpoint(Resource)...
StarcoderdataPython
1716244
from . import view from . import byte from . import files
StarcoderdataPython
33207
""" Creates files for end-to-end tests python util/build_tests.py """ # stdlib import json from dataclasses import asdict # module import avwx def make_metar_test(station: str) -> dict: """ Builds METAR test file for station """ m = avwx.Metar(station) m.update() # Clear timestamp due to pa...
StarcoderdataPython
1665072
<gh_stars>0 """ This file is used for fast operations on localization. It consists of a list of all the languages on its own language, language_codes and translation of all the text in the app into some language. """ langs = [ "afrikaans", "shqiptar", "አማርኛ", "عربى", "հայերեն", "Azərbaycan", "basque", "беларускі",...
StarcoderdataPython
3346766
<reponame>iraf-community/stsdas from __future__ import print_function import iraf import os no = iraf.no yes = iraf.yes from nictools import rnlincor # Point to default parameter file for task _parfile = 'nicmos$rnlincor.par' _taskname = 'rnlincor' ###### # Set up Python IRAF interface here ###### def rnlincor_ira...
StarcoderdataPython
1757781
# Generated by Django 3.2 on 2021-05-23 18:38 import autoslug.fields import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('accounts', '0001_initial'), ] operations = [ migrations.CreateMode...
StarcoderdataPython
44803
<gh_stars>0 import random from src import utils class PlayerClass: def __init__( self, st_checkboxes: dict, all_items: dict, class_name: str, class_data: dict ): self.all_items = all_items self.st_checkboxes = st_checkboxes self.class_name = class_name print("Class: " ...
StarcoderdataPython
3300323
import decimal import uuid import requests import json import functools from dateutil.relativedelta import relativedelta from datetime import datetime from flask import request, current_app from flask_restplus import Resource, reqparse from werkzeug.datastructures import FileStorage from werkzeug import exceptions fro...
StarcoderdataPython
1749679
<reponame>hirossan4049/Schreen<gh_stars>0 from flask import Flask, render_template, request, redirect, url_for, Response #from OpenSSL import SSL #context = SSL.Context(SSL.TLSv1_2_METHOD) #context.use_certificate("server.crt") #context.use_privatekey("server.key") api = Flask(__name__) @api.route("/") def index(): ...
StarcoderdataPython
1601084
from typing import List, Optional from datetime import datetime import time from plyer import notification import json import yaml from beepy import beep from cowinapi import CoWinAPI, VaccinationCenter, CoWinTooManyRequests CoWinAPIObj = CoWinAPI() # def get_available_centers_by_pin(pincode: str) -> List[Vaccinati...
StarcoderdataPython
1764693
<filename>api/app.py<gh_stars>0 import io import numpy as np from tensorflow.keras.applications import ResNet50, imagenet_utils from tensorflow.keras.preprocessing.image import img_to_array import flask from PIL import Image app = flask.Flask(__name__) MODEL = ResNet50(weights="imagenet") def prep_img(image, ta...
StarcoderdataPython
3377689
<filename>tests/test_plotting_toys.py import pytest import alldecays from alldecays.plotting.toys.toy_util import get_valid_toy_values def test_get_valid_toy_values(data_set1): fit = alldecays.Fit(data_set1) with pytest.raises(AttributeError) as excinfo: get_valid_toy_values(fit) expected_info = ...
StarcoderdataPython
34813
import datetime import re import sys import freezegun import pytest from loguru import logger if sys.version_info < (3, 6): UTC_NAME = "UTC+00:00" else: UTC_NAME = "UTC" @pytest.mark.parametrize( "time_format, date, timezone, expected", [ ( "%Y-%m-%d %H-%M-%S %f %Z %z", ...
StarcoderdataPython
3384037
import os import re from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() def find_version(fname): '''Attempts to find the version number in the file names fname. Raises RuntimeError if not found. ''' version = '' with open(fname, 'r...
StarcoderdataPython
158396
#!/usr/bin/env python3 # coding: utf-8 from setuptools import setup import subprocess import os def pipen(cmd): # It's a popen, but with pipes. return subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) def out_to_str(out): return out.decode('utf-8', 'replace').strip() def get_git_ta...
StarcoderdataPython
1744575
# -*- coding: utf-8 -*- from django.conf.urls import include, url from django.contrib import admin from django.views.generic import RedirectView from xisbn_app import views admin.autodiscover() urlpatterns = [ url( r'^admin/', admin.site.urls ), url( r'^info/$', views.info, name='info_url' ), url( r...
StarcoderdataPython
4829007
from entityextractor.aggregate import EntityAggregator from entityextractor.result import PersonResult class TestAggregate(object): def test_aggregator(self): agg = EntityAggregator() agg.add(PersonResult(agg, 'Banana', 0, 12)) assert len(agg) == 0, agg agg.add(PersonResult(agg, '...
StarcoderdataPython
3364856
from __future__ import absolute_import import os import unittest import redisext.backend.redis REDIS_HOST = os.getenv('REDIS_HOST', 'localhost') REDIS_PORT = os.getenv('REDIS_PORT', 6379) REDIS_DB = os.getenv('REDIS_DB', 0) class Connection(redisext.backend.redis.Connection): MASTER = {'host': REDIS_HOST, 'por...
StarcoderdataPython
1731253
import pandas as pd import results from phrasegeo import Matcher, MatcherPipeline from time import time # load up the db db_name = 'GNAF_VIC' DB = f"postgresql:///{db_name}" db = results.db(DB) # set up the matchers matcher1 = Matcher(db, how='standard') matcher2 = Matcher(db, how='slow') matcher3 = Matcher(db, how...
StarcoderdataPython
3280550
<reponame>ankitshah009/MMdnn<gh_stars>1000+ import sys as _sys import google.protobuf.text_format as text_format from six import text_type as _text_type def _convert(args): if args.inputShape != None: inputshape = [] for x in args.inputShape: shape = x.split(',') inputshape...
StarcoderdataPython
3278103
<gh_stars>0 import datetime import http.server import logging import socket import socketserver import time from multiprocessing import Process from pathlib import Path from caster import Caster from speech_synthesizer import SpeechSynthesizer from yahoo_train_info_scraper import YahooTrainInfoScraper logger = loggin...
StarcoderdataPython
1636755
def capacity(K, w): w.sort(reverse = True) return _capacity(K, w) def _capacity(K, w): cut = 0 while w[cut] > K: cut += 1 w = w[cut:] sub = _capacity(K-w[0], w[1:]) if sub is None: sub = _capacity(K, w{1:]) if sub is None: return None else: return sub else: sub.append(w[0]) return sub
StarcoderdataPython
3225222
# Generated by Django 2.0.5 on 2018-05-24 08:27 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sim_v1', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='document', name='description', ), ...
StarcoderdataPython
1728224
<gh_stars>1-10 # Copyright (c) 2021. <NAME>, Ghent University import math import warnings import numpy as np import pandas as pd from numpy.random import uniform from scipy import ndimage, integrate from sklearn.model_selection import GridSearchCV from sklearn.neighbors import KernelDensity from sklearn.utils import...
StarcoderdataPython
140806
<reponame>krasin/xArm-Python-SDK-ssh #!/usr/bin/env python3 # Software License Agreement (BSD License) # # Copyright (c) 2017, UFactory, Inc. # All rights reserved. # # Author: Vinman <<EMAIL>> import os from distutils.util import convert_path try: from setuptools import setup, find_packages except ImportError: ...
StarcoderdataPython
3203285
def check_alive(health):
StarcoderdataPython
195050
<reponame>rgerkin/brian2<filename>brian2/tests/features/__init__.py from __future__ import absolute_import __all__ = ['FeatureTest', 'SpeedTest', 'InaccuracyError', 'Configuration', 'run_feature_tests'] from .base import * from . import neurongroup from . import synapses fro...
StarcoderdataPython