id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
148234
#!/usr/bin/env python3 import unittest import learn2learn as l2l TOO_BIG_TO_TEST = [ 'tiered-imagenet', ] class UtilTests(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_tasksets(self): names = l2l.vision.benchmarks.list_tasksets() for n...
StarcoderdataPython
1726342
#!/usr/bin/python3 # -*- coding: utf-8 -*- from bin.comparing.task import Task from bin.comparing.satellite import Satellite from bin.comparing.bnb import BnB from operator import itemgetter from json import loads from json import load from bin.config import Config import os # find and remember the root path of the a...
StarcoderdataPython
1604761
<filename>pkg/matcher.py import math import typing from pathlib import Path import cv2 import numpy as np import unidecode from matplotlib import pyplot as plt from .image import Image from .misc import deduplicate_list, cosine_similarity, find_better_word # FLANN_INDEX_LSH = 6 class Matcher(): """ Ma...
StarcoderdataPython
3361165
# -*- coding: utf-8 -*- from pathlib import Path from example_app_01 import app from example_app_01.data_fixtures import add_data_fixtures, recreate_db PROJECT_BASE_FILEPATH = Path(__file__).resolve().parent APP_01_FILEPATH = Path(PROJECT_BASE_FILEPATH).joinpath('example_app_01') APP_01_DB_FILEPATH = Path(APP_01_F...
StarcoderdataPython
1614609
<filename>projects/data_generation/synthetic_multi_view_facial_image_generation/algorithm/Rotate_and_Render/models/networks/__init__.py import torch from algorithm.Rotate_and_Render.models.networks.base_network import BaseNetwork from algorithm.Rotate_and_Render.models.networks import loss from algorithm.Rotate_and_Ren...
StarcoderdataPython
3353162
from conans.assets.templates.new_v2_cmake import source_cpp, source_h, test_main conanfile_sources_v2 = """import os from conan import ConanFile from conan.tools.meson import MesonToolchain, Meson from conan.tools.layout import basic_layout from conan.tools.files import copy class {package_name}Conan(ConanFile): ...
StarcoderdataPython
3331423
import bot.bot_helpers as bot_helpers if __name__ == '__main__': updater = bot_helpers.get_configured_updater() bot_helpers.start_bot(updater)
StarcoderdataPython
3398955
#!/usr/bin/env python # # 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.0OA # # Authors: # - <NAME>, <<EMAIL>>, 2019 import traceback try: # pyth...
StarcoderdataPython
3251832
""" py_pkg ~~~~~~ The py_pkg package - a Python package template project that is intended to be used as a cookie-cutter for developing new Python packages. """ from .osapi import OsApi from .mampapi import MampApi
StarcoderdataPython
3354369
from itertools import product from math import sqrt import numpy as np def make_anchors(conv_h, conv_w, scale, input_shape=[550, 550], aspect_ratios=[1, 1 / 2, 2]): prior_data = [] for j, i in product(range(conv_h), range(conv_w)): x = (i + 0.5) / conv_w y = (j + 0.5) / conv_h for ar...
StarcoderdataPython
1682487
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Cisco Systems, Inc. # # 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...
StarcoderdataPython
1668864
<filename>GIMMECore/PlayerStructs.py import math import time import copy import json from .InteractionsProfile import InteractionsProfile class PlayerCharacteristics(object): def __init__(self, ability = None, engagement = None): self.ability = 0 if ability==None else ability self.engagement = 0 if engagement=...
StarcoderdataPython
1644402
from pyHalo.preset_models import WDMLovell2020, CDM, WDMGeneral, SIDM, ULDM import numpy.testing as npt import pytest class TestPresetModels(object): def test_CDM(self): realization_cdm = CDM(0.5, 1.5) npt.assert_equal(len(realization_cdm.rendering_classes), 3) def test_WDMLovell20(self): ...
StarcoderdataPython
40585
from django.core.management.base import BaseCommand import numpy as np import pandas as pd from django.conf import settings from baseball.models import Player, PlayerStats import sys import requests import datetime HITTING_BASE_URL = 'http://lookup-service-prod.mlb.com/json/named.sport_hitting_tm.bam' PITCHING_BASE_...
StarcoderdataPython
3249342
import cv2 as cv import mediapipe as mp import numpy as np import time import matplotlib.pyplot as plt import seaborn as sns import mapping import csv import imageio class poseDetector(): # def __init__(self, mode=False, upBody = False, smooth = True, detectionCon = 0.5, trackCon = 0.5): def __init...
StarcoderdataPython
1643288
<reponame>mserrano07/django-gdpr-assist # -*- coding: utf-8 -*- from django.db import migrations from gdpr_assist.upgrading import MigrateGdprAnonymised class Migration(migrations.Migration): dependencies = [ ("example", "0001_initial"), ("gdpr_assist", "0002_privacyanonymised"), ] operat...
StarcoderdataPython
140201
<gh_stars>0 import pdb import numpy as np import time genres = ['Western', 'Comedy', 'Children', 'Crime', 'Musical', 'Adventure', 'Drama', 'Horror', 'War', 'Documentary', 'Romance', 'Animation', 'Film-Noir', 'Sci-Fi', 'Mystery', 'Fantasy', 'IMAX', 'Action', 'Thriller'] # Data is a list of (i, j, r) triples ratings_sm...
StarcoderdataPython
3399362
from scaner.utils import add_metadata import json from flask import current_app @add_metadata('tasks') def search(*args, **kwargs): return {'tasks': current_app.tasks.get_task_list()}, 200 @add_metadata('status') def get(taskId, *args, **kwargs): return {'status': current_app.tasks.get_task_status(taskId)}...
StarcoderdataPython
4809948
from PIL import Image, ImageDraw, ImageFont from alive_progress import alive_bar def initImg(width, height, bg, font='fonts/FatBoyVeryRoundItalic.ttf', size = 41, verbose=False): #creating B/W image img = Image.new('L', (width, height), color=bg) fnt = ImageFont.truetype('fonts/FatBoyVeryRoundItalic.ttf', ...
StarcoderdataPython
3352464
<gh_stars>0 import sqlite3 DB_NAME = 'database.db' conn = sqlite3.connect(DB_NAME) conn.cursor().execute(''' CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, email TEXT, password TEXT ) ''') conn.cursor().execute(''' CREATE TABLE IF NOT ...
StarcoderdataPython
4813665
from flask import Flask, render_template, request, redirect, url_for, flash, abort, session, jsonify import json import os.path from werkzeug.utils import secure_filename # to check if the file uploaded is safe or nor app = Flask(__name__) # name of module that is running flask app.secret_key = '<KEY>' @app.route("/"...
StarcoderdataPython
1735790
# -*- coding: utf-8 -*- # Copyright (C) 2020 <NAME> <<EMAIL>> # Copyright (c) 2020 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' author: <NAME> ...
StarcoderdataPython
40383
<reponame>ulricheck/enaml_data<gh_stars>0 # -*- coding: utf-8 -*- """ Copyright (c) 2015, <NAME>. Distributed under the terms of the MIT License. The full license is in the file COPYING.txt, distributed with this software. Created on Aug 24, 2015 """ from atom.api import Instance, ForwardInstance, Bool from enaml.core....
StarcoderdataPython
3248133
# -*- coding: utf-8 -*- # @Author: <NAME> # @Date: 2017-09-21 11:33:48 # @Last Modified by: <NAME> # @Last Modified time: 2018-09-17 17:17:38 import os _colors = { "running_color": 'magenta', "conf_key_color": 'cyan', "conf_val_color": 'yellow', "error_color": 'red', "warning_color": 'yellow', ...
StarcoderdataPython
126974
<gh_stars>0 # -*- coding: utf-8 -*- # @Author: disheng import os PROJECT_PATH = os.path.abspath( os.path.join( os.path.abspath(os.path.dirname(__file__)), os.pardir)) class DefaultConfig(object): """ default config, 由git托管,一般情况下不用修改 可以在config目录下新建configs.py, 更新自己的本地配置,会覆盖此处的配置 未被覆...
StarcoderdataPython
3284273
# Copyright 2018 The Cirq Developers # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
StarcoderdataPython
68862
#!/home/francisco/Projects/Pycharm/py-binary-trees-draw/venv/bin/python # -*- coding: utf-8 -*- from node import Node class AVLTree: def __init__(self): self.root = None self.leaf = Node(None) self.leaf.height = -1 self.nodes_dict_aux = {} self.nodes_dict = {} def ins...
StarcoderdataPython
41422
# Generated by Django 2.2.12 on 2021-02-02 06:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0003_auto_20210202_0503'), ] operations = [ migrations.AddField( model_name='account', name='email', ...
StarcoderdataPython
1612927
#! /usr/bin/env python import sys import unittest def run_tests(): test_suite = unittest.TestLoader().discover('dcm_spec_tools') result = unittest.TextTestRunner(verbosity=2).run(test_suite) return result.wasSuccessful() if __name__ == '__main__': sys.exit(0 if run_tests() else 1)
StarcoderdataPython
3350395
from scipy.ndimage import zoom from scipy.io import loadmat import numpy as np import nibabel as nib import glob import os nii_list = glob.glob("../data/mat/*.nii.gz") nii_list.sort() for nii_path in nii_list: print("-----------------------------------------------") nii_file = nib.load(nii_path) tmpl_affin...
StarcoderdataPython
1696227
import tensorflow as tf import numpy as np from tfmonopoles.theories import GeorgiGlashowRadialTheory from tfmonopoles import FieldTools import argparse parser = argparse.ArgumentParser(description="Generate a monopole ring") parser.add_argument("--vev", "-v", default=1.0, type=float) parser.add_argument("--gaugeCoupl...
StarcoderdataPython
3210368
# -*- coding: utf-8 -*- """Package contains following modules assisting in construction of HTTP probes. * :mod:`selenium_probes.helpers.browser` allows to interact with Selenium WebDriver * :mod:`selenium_probes.helpers.vault` allows to interact with Azure Key Vault """
StarcoderdataPython
1612458
<filename>Hackkerank/Python Challenges/rangoli.py alph = 'abcdefghijklmnopqrstuvwxyz' def rangoli_V3(N): width = 4*(N - 1) + 1 A = list(alph[:N]) rA = list(reversed(A)) all_rows = [] for i in range(N): thisrow = rA[:i+1] + A[N-i:] all_rows.append("-".join(thisrow).center(width,"-")) ...
StarcoderdataPython
1724131
from copy import deepcopy class TwoTeamsGame: def __init__(self, team1, team2, player_selector): """ :param team1: array of easyAI-supported objects. See Player module :param team2: array of easyAI-supported objects. :param player_selector constructor for objects of type AbstractO...
StarcoderdataPython
1696125
<gh_stars>100-1000 from . import calculus # XXX: hack to set methods from . import approximation from . import differentiation from . import extrapolation from . import polynomials
StarcoderdataPython
3326619
import datetime import logging import os import pandas as pd import statsmodels.api as stats from pandas.tseries.offsets import BDay from stock_analyzer.data_fetcher import get_ranged_data, get_spx_prices logging.basicConfig(format='%(level_name)s: %(message)s', level=logging.DEBUG) class AnalyzerBase(object): ...
StarcoderdataPython
172735
<gh_stars>1-10 # test_procedure_10002.py # Connect P15..P8 to P7..P0, D/A0,1 to A/D0,1 A/D2 to 2.5 V # Load micro:bit from microbit import * while True: try:i2c.read(93,1) except OSError:pass else: pin8.set_pull(pin8.PULL_UP);sleep(10) i2c.write(93,b'\0c');sleep(10) while True: try:i2c.read(93,1) exce...
StarcoderdataPython
4820407
import threading import time from datetime import datetime import math import random class Car: def __init__(self, hz, id, name, request): self.id = id self.diff_seconds = 1.0 / hz self.hz = hz self.last_tick = datetime.now() self.request = request self.x = 0 ...
StarcoderdataPython
4816814
import logging _LINE_FORMATS = { 'classic': '%(asctime)s %(levelname)-8s [%(name)s] %(message)s', 'short': '%(asctime)s %(levelname) [%(name)s] %(message)s', 'no_time': '%(levelname)-8s [%(name)s] %(message)s', } _DT_FORMATS = { 'classic': '%Y-%m-%d %H:%M:%S', 'time_first': '%H:%M:%S %Y-%m-%d', ...
StarcoderdataPython
193062
<filename>tests/runtest.py<gh_stars>10-100 # eventpy library # Copyright (C) 2020 <NAME> (wqking) # Github: https://github.com/wqking/eventpy # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
StarcoderdataPython
1653709
"""Added line item table Revision ID: 20e5ee0480f6 Revises: 2<PASSWORD> Create Date: 2015-05-12 13:48:39.460366 """ # revision identifiers, used by Alembic. revision = '20e5ee0480f6' down_revision = '2<PASSWORD>' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alem...
StarcoderdataPython
24305
<gh_stars>0 {'application':{'type':'Application', 'name':'codeEditor', 'backgrounds': [ {'type':'Background', 'name':'bgCodeEditor', 'title':'Code Editor R PythonCard Application', 'size':(400, 300), 'statusBar':1, 'visible':0, 'style':['resi...
StarcoderdataPython
3233682
import discord from discord.ext import commands from util import config class Help(commands.Cog): prefix = config['PREFIX'] ops = config['BOT_OPS'] # help commands @commands.group(invoke_without_command=True) async def help(self, ctx): em = discord.Embed(title='Hugmaker Help', description...
StarcoderdataPython
4821921
<reponame>gonzalocasas/compas<gh_stars>0 from __future__ import print_function from __future__ import absolute_import from __future__ import division import os import ctypes import compas from compas.utilities import flatten dll = os.path.join(compas.LIBS, "ShapeOp/bindings/python/_ShapeOp.0.1.0.dll") shapeopPytho...
StarcoderdataPython
4805940
<filename>official/docker_to_bash/docker_to_bash.py<gh_stars>0 import os,traceback,sys class _Mode : def __init__(self,tag_open,tag_close): self._tag_open = tag_open self._tag_close = tag_close self._mode_on = False def update(self,line,line_nb,end=False): tag_open ...
StarcoderdataPython
3369213
<filename>current/deps/v8/tools/testrunner/testproc/util.py<gh_stars>1000+ #!/usr/bin/env python # Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import heapq import random class FixedSizeTopList(): "...
StarcoderdataPython
3358501
<gh_stars>0 # Copyright 1997 - 2018 by IXIA Keysight # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modi...
StarcoderdataPython
144924
<filename>projects/src/main/python/CodeJam/Y13R5P1/JongMan/generated_py_623d5a5ed9124daf833506d5b6c57318.py import sys sys.path.append('/home/george2/Raise/ProgramRepair/CodeSeer/projects/src/main/python') from CodeJam.Y13R5P1.JongMan.roulette2 import * def func_b3607c87abf94237a6dc3992ce5b3f09(lowest, placed, overrid...
StarcoderdataPython
1784181
<reponame>hahagan/study #!/usr/bin/python # -*- coding: UTF-8 -*- import argparse import socket import _thread import sys import threading import multiprocessing import os class Tcp(threading.Thread): def __init__(self, path, ip, port): threading.Thread.__init__(self) self._path = path sel...
StarcoderdataPython
44649
<filename>jupiter/use_cases/metrics/entry/create.py """The command for creating a metric entry.""" from dataclasses import dataclass from typing import Optional, Final from jupiter.domain.adate import ADate from jupiter.domain.metrics.infra.metric_notion_manager import MetricNotionManager from jupiter.domain.metrics.m...
StarcoderdataPython
4801193
<filename>data/external/repositories_2to3/168569/kaggle-Otto-master/utility.py import numpy as np import scipy as sp import pandas as pd def count_feature(X, tbl_lst = None, min_cnt = 1): X_lst = [pd.Series(X[:, i]) for i in range(X.shape[1])] if tbl_lst is None: tbl_lst = [x.value_counts() for ...
StarcoderdataPython
93146
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 6 09:44:54 2019 @author: thomas """ import numpy as np import matplotlib.pyplot as plt plt.close('all') def graycode(M): if (M==1): g=['0','1'] elif (M>1): gs=graycode(M-1) gsr=gs[::-1] gs0=['0'+x for x in...
StarcoderdataPython
3341069
name = [ 'sulfate ion', 'acetate ion', ] mmtf_translator = { 'SULFATE ION' : 'sulfate ion', 'ACETATE ION' : 'acetate ion', }
StarcoderdataPython
22738
<reponame>ssmbct-netops/CyberSaucier import requests, json, argparse, os from termcolor import colored parser = argparse.ArgumentParser(description="Verify the recipes by running them through CyberSaucier") parser.add_argument('--rulefolder', help='Folder containing the json recipes') parser.add_argument("--url", help...
StarcoderdataPython
145192
<gh_stars>0 # This is an input class. Do not edit. class LinkedList: def __init__(self, value): self.value = value self.next = None # O(n) time | O(n) space - where n is the number of nodes in the Linked List def nodeSwap(head): if head is None or head.next is None: return ...
StarcoderdataPython
155276
<reponame>forca-inf/forca widths = {'Alpha': 722, 'Beta': 667, 'Chi': 722, 'Delta': 612, 'Epsilon': 611, 'Eta': 722, 'Euro': 750, 'Gamma': 603, 'Ifraktur': 686, 'Iota': 333, 'Kappa': 722, 'Lambda': 686, 'Mu': 889, 'Nu': 722, 'Omega': 768, 'Omicron': 722, 'Phi': 763, 'Pi': 768, 'Psi':...
StarcoderdataPython
3236665
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 0.5.0.5149 (http://hl7.org/fhir/StructureDefinition/Contract) on 2015-07-06. # 2015, SMART Health IT. from . import attachment from . import codeableconcept from . import coding from . import domainresource from . import fhirdate from . import fh...
StarcoderdataPython
1732667
<filename>setup.py #!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import setup, find_packages def req_file(filename): """ We're using a requirements.txt file so that pyup.io can use this for security checks :param filename: :return str: """ with open(fi...
StarcoderdataPython
3271139
import json import os import sys from fontTools.pens.recordingPen import RecordingPen from fontTools.ttLib import TTFont def getGlyph(glyphSet, cmap, char): name = cmap[ord(char)] return glyphSet[name] def traceFont(font, char): glyphSet = font.getGlyphSet() cmap = font.getBestCmap() glyph = g...
StarcoderdataPython
1672955
<filename>src/pandas_profiling/report/presentation/flavours/widget/container.py from ipywidgets import widgets from pandas_profiling.report.presentation.core.container import Container from pandas_profiling.report.presentation.core.renderable import Renderable def get_name(item: Renderable): if hasattr(item, "na...
StarcoderdataPython
1602109
<filename>mirnamotif/parser.py<gh_stars>1-10 """parser parses pre-miRNA and mature miRNAs sequences from miRBase.""" from Bio import SeqIO from parser_loop_localization import create_loc import re import RNA def fold(sequence_to_fold): """ fold folds pre-miRNA molecules and returns terminal loop. input:...
StarcoderdataPython
1799304
import carla LEAD_VEHICLE_SPEED = 37 #mph LEAD_X_INIT = -379.6 LEAD_Y_INIT = -17.6 LEAD_Z_INIT = 2.0 LEAD_X_INIT_END = -379.6 LEAD_Y_INIT_END = 0 LEAD_Z_INIT_END = 2.0 INIT_ROUTE = [carla.libcarla.Location(x=LEAD_X_INIT, y=LEAD_Y_INIT, z=0),carla.libcarla.Location(x=LEAD_X_INIT_END, y=LEAD_Y_INIT_END, z=0)] convoy = ...
StarcoderdataPython
1600068
<gh_stars>1-10 """ipshaman Python API driver""" from ipshaman.core.client import Client __all__ = [ 'Client', ] __version__ = '0.0.4'
StarcoderdataPython
1653239
from django.shortcuts import render from django.views.generic import ListView, CreateView, DetailView, UpdateView from django.contrib.auth.decorators import permission_required, login_required from django.utils.decorators import method_decorator from django.contrib import messages from django.shortcuts import redirect,...
StarcoderdataPython
97483
class zoo: def __init__(self,stock,cuidadores,animales): pass class cuidador: def __init__(self,animales,vacaciones): pass class animal: def __init__(self,dieta): pass class vacaciones: def __init__(self): pass class comida: def __init__(self,dieta): pass clas...
StarcoderdataPython
3258241
import numpy as np import tensorflow as tf # this is kind of hacky, model_class is the vae_gan class but its parent abstract-class is in the same folder from jernej_code_vae_gan import Model as model_class, utils from jernej_code_vae_gan.mnist import mnist_data from jernej_code_vae_gan.report import Report import jern...
StarcoderdataPython
1746666
from nose.plugins import attrib gpu = attrib.attr('gpu') cudnn = attrib.attr('gpu', 'cudnn')
StarcoderdataPython
41466
import logging import textwrap from discord.ext import commands from miyu_bot.bot.bot import D4DJBot from miyu_bot.commands.common.fuzzy_matching import romanize, FuzzyMatcher class Utility(commands.Cog): bot: D4DJBot def __init__(self, bot): self.bot = bot self.logger = logging.getLogger(_...
StarcoderdataPython
1795620
import pandas as pd import json from jsonschema import validate from os import path import sys import PySimpleGUI as sg raw_data = None class_list = None DayInfo = None delta_max = None UUID_to_email = None def set_data_vars(data_path, json_path): """ Sets global data variables to be used in ``ElementCollec...
StarcoderdataPython
9147
from typing import List, Union import numpy as np import pandas_datareader as pdr import pandas as pd import matplotlib.pyplot as plt def rsi(symbol :str ,name :str, date :str) -> None : """ Calculates and visualises the Relative Stock Index on a Stock of the company. Parameters: symbol(str) : Sy...
StarcoderdataPython
1667223
<reponame>AgeYY/prednet<filename>predusion/tools.py import numpy as np def tensor_sta(fir_rate, stimuli, n_tao): ''' spikes triggered average. input: fir_rate (array like, float, [n_time_step, ...]) stimuli (array like, float, [n_time_step, ...]): should have the same n_time_step as fir_rate ...
StarcoderdataPython
1664118
from uuid import UUID, uuid4 import numpy as np from torchdemon.models import InferenceInputData def uuid_const() -> UUID: return UUID("009b7240-c7e5-4df3-8722-c1be32390106") def uuid_rand() -> UUID: return uuid4() def ndarray_randint(*args: int) -> np.ndarray: return np.random.randint(0, 10, size=a...
StarcoderdataPython
3303283
<reponame>chenrb/bk-sops """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 <NAME>, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance...
StarcoderdataPython
81879
"""dummies.py helper classes for testing without a connection to Pokemon Showdown by Annika""" import psclient # pylint: disable=super-init-not-called class DummyWebsocket: """Dummy websocket class """ def __init__(self, host): self.host = host class DummyConnection(psclient.Connection): ...
StarcoderdataPython
1721233
from abc import ABCMeta, abstractmethod import numpy as np import pandas as pd from divmachines.utility.helper import check_random_state def _get_cv(cv): try: cv = CROSS_VALIDATOR[cv] except KeyError: raise ValueError("Consistent Cross Validator must be provided") return cv class CrossVa...
StarcoderdataPython
3217094
<reponame>tomasdubec/openstack-cinder # Copyright 2011 OpenStack LLC. # 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/licens...
StarcoderdataPython
1624412
<gh_stars>1-10 import requests from bs4 import BeautifulSoup import pprint res = requests.get('https://news.ycombinator.com/news') soup = BeautifulSoup(res.text, 'html.parser') ## html.parser gives us an html doc instead of string which we can than manipulate links = soup.select('.storylink') subtext = soup.select('.s...
StarcoderdataPython
118457
<reponame>murd0/codonPython<gh_stars>0 from setuptools import setup, find_packages setup( name='codonPython', version='0.1', license='BSD', packages=['codonPython',], install_required=[ 'numpy', 're', 'pandas', 'random', 'sqlalchemy' ], author='NHS Digital DIS Team', author_email='<EMAIL>', url='htt...
StarcoderdataPython
192484
<filename>dailyReport/migrations/0008_auto_20220109_1959.py<gh_stars>0 # Generated by Django 3.2 on 2022-01-09 18:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dailyReport', '0007_auto_20220109_1951'), ] operations = [ migrations.C...
StarcoderdataPython
4814880
import time import shutil # from manimlib.scene.scene_file_writer import SceneFileWriter from manimlib import Scene, Point, Camera, ShowCreation, Write, Color, VGroup, VMobject from manimlib.utils.rate_functions import linear, smooth from manimlib.extract_scene import get_scene_config import manimlib.config from maniml...
StarcoderdataPython
1702089
# (c) 2019 Red Hat Inc. # # This file is part of Ansible # # Ansible 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. # # Ansible is dis...
StarcoderdataPython
37994
<gh_stars>1-10 from collections import Counter from konlpy.tag import Hannanum import pytagcloud f = open('D:\\KYH\\02.PYTHON\\crawled_data\\cbs2.txt', 'r', encoding='UTF-8') data = f.read() nlp = Hannanum() nouns = nlp.nouns(data) count = Counter(nouns) tags2 = count.most_common(200) taglist = pytagcloud.make_tags(...
StarcoderdataPython
46300
<filename>backend/apps/users/filters.py from django_filters import rest_framework as filters from django.db.models import Q from django.contrib.auth import get_user_model from users.models import tGroup User = get_user_model() class UsersFilter(filters.FilterSet): ''' 用户过滤 ''' username = filters.Ch...
StarcoderdataPython
1780897
<gh_stars>0 """ Description: filereader client """ import os import logging import csv from core.general.exceptions import SIDException from core.general.sidhelper import generate_filename, convert_field class Reader(): """ The class responsiblities are: Read csv file, head...
StarcoderdataPython
186162
class HandlerMissingException(Exception): """Raised when an event handler is missing a handler for a specific event.""" pass class DataTypeError(Exception): """Raised when data type doesn't correspond to the connection's data type.""" pass class HeaderSizeError(Exception): """Raised when the hea...
StarcoderdataPython
3303711
from penteston.onenote import OneNoteAPI from jinja2 import Environment, FileSystemLoader import json import argparse import pyperclip def main(ona): parser = argparse.ArgumentParser() parser.add_argument('profile', metavar='profile', type=str, help='Path to Configuration JSON') pa...
StarcoderdataPython
12294
<reponame>kplachkov/UkDatabase import pymongo from bson.json_util import dumps from pymongo import MongoClient from UkDatabaseAPI.database.database import Database from UkDatabaseAPI.database.query_builder.mongo_query_builder import MongoQueryBuilder MONGO_URI = "mongodb://localhost:27017" """str: The MongoDB URI."""...
StarcoderdataPython
3237908
# -*- coding: utf-8 -*- # Copyright (c) 2020, <NAME> and Contributors # License: QL. See license.txt import frappe import os, json from frappe import _ from frappe.modules import scrub, get_module_path from frappe.utils import ( flt, cint, cstr, get_html_format, get_url_to_form, gzip_decompress ) from frappe.de...
StarcoderdataPython
3274120
from ct.crypto import cert from observation import Observation class IpAddressObservation(Observation): def __init__(self, description, *args, **kwargs): super(IpAddressObservation, self).__init__( "IPAddres: " + description, *args, **kwargs) class IPv6(IpAddressObservation): def __in...
StarcoderdataPython
68211
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import io from ..file import _File from .base import NonstandardExtHDU from .hdulist import HDUList from ..header import Header, _pad_length from ..util import fileobj_name from ....extern.six import string_types from ....utils import lazypro...
StarcoderdataPython
1782256
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
StarcoderdataPython
3312619
''' @author: quarkonics ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import zstackwoodpecker.operations.resource_operations as res_ops import zstackwoodpecker.operations.export_operations as exp_ops import zsta...
StarcoderdataPython
1691859
from app import create_app,db from flask_script import Manager,Server from app.models import User,Post from flask_migrate import Migrate,MigrateCommand app = create_app('development') app = create_app('production') manager = Manager(app) manager.add_command('server',Server) migrate = Migrate(app,db) manager.add_comman...
StarcoderdataPython
1717080
<reponame>HarinarayananP/Flask-Backend-AirPolutionMonitoring # -*- encoding: utf-8 -*- """ Copyright (c) 2019 - present AppSeed.us """ from flask_login import UserMixin from sqlalchemy import Binary, Column, Integer, String, DateTime, Boolean, ForeignKey, Float from app import db, login_manager from app.base.util im...
StarcoderdataPython
1691943
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + [markdown] id="view-in-github" colab_type="text" #...
StarcoderdataPython
108980
import logging import logging.config import os from os import path from pathlib import Path import yaml logger = logging.getLogger(__name__) def get_logging_cfg(): cfg_file = os.getenv('LOGGING_CFG', './config/logging-cfg-local.yml') if 'LOGS_DIR' not in os.environ: # Build paths inside the project ...
StarcoderdataPython
3316141
from setuptools import setup, find_packages def get_version_and_cmdclass(package_path): """Load version.py module without importing the whole package. Template code from miniver """ import os from importlib.util import module_from_spec, spec_from_file_location spec = spec_from_file_location(...
StarcoderdataPython
3258997
<filename>landmasterlibrarygui/pdf_rotater.py # pdf_rotater.py # code in shift-jis import os, sys # IMPORT module FROM LandmasterLibrary import dir_editor sep = dir_editor.decide_seperator() # String seperator of directory. import file_list_getter def make_vertical(folder_list : list): ''' folderLi...
StarcoderdataPython
1617907
<gh_stars>0 # Generated by Django 2.2.2 on 2019-08-02 14:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0070_auto_20190802_1331'), ] operations = [ migrations.AddField( model_name='people', name='orga...
StarcoderdataPython
3235798
from enum import Enum import geopandas as gpd from itertools import product import numpy as np import pandas as pd from pathlib import Path import pkg_resources from typing import Union from balsa.routines import distance_matrix, read_mdf from balsa.logging import get_model_logger from cheval import LinkedDataFrame f...
StarcoderdataPython