id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6578404
<reponame>Ouranosinc/malleefowl import pytest from pywps import Service from pywps.tests import assert_response_success from .common import TESTDATA, client_for from malleefowl.processes.wps_esgsearch import ESGSearchProcess @pytest.mark.online def test_dataset(): client = client_for(Service(processes=[ESGSearc...
StarcoderdataPython
5093303
#!/usr/bin/env python # https://bugs.python.org/issue6634 import os import sys import time import threading as mt def work(): print 'exit now' # NOTE: This should call the python interpreter to exit. # This is not the case, only the thread is terminated. sys.exit() def test(): child = m...
StarcoderdataPython
1981346
<reponame>jwparktom/convit # Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the CC-by-NC license found in the # LICENSE file in the root directory of this source tree. # import os import json import random from torchvision import datasets, transforms from torc...
StarcoderdataPython
4952749
from flask import request, Blueprint from cusg.utils.http import error_response from cusg.events.factorys import event_handler_for from cusg.utils.permissions import restricted instruction_document_blueprint = Blueprint('instruction_document', __name__) @instruction_document_blueprint.errorhandler(Exception) def ha...
StarcoderdataPython
6515528
def grader(score): if (score > 1) or (score < 0.6): return 'F' elif 0.8 < score <= 1: return 'A' elif 0.7 < score <= 0.8: return 'B' elif 0.6 < score <= 0.7: return 'C' elif score >= 0.6: return 'D'
StarcoderdataPython
6538416
import argparse from datetime import datetime import csv import pdfplumber # headers in the PDF that we'll target INCOLS = ['COUNTY', 'GENDER', 'ACN', 'APV', 'DEM', 'GRN', 'LBR', 'REP', 'UAF', 'UNI'] # headers for the CSV OUTCOLS = ['report_date', 'county', 'gender', 'party', 'returned_votes'] def table...
StarcoderdataPython
1832134
<filename>cartpole_control/cartpole_control/controllers.py """ controllers.py Controllers for cartpole swingup and balancing Two methods: MPC and Energy-shaping Publishes effort (force) command at specified rate Implement handlers for state messages """ import math import time import matplotlib.pyplot as plt import ...
StarcoderdataPython
4929336
BINARY_MODE = 'binary' MULTICLASS_MODE = 'multiclass' MULTILABEL_MODE = 'multilabel' NN_FILL_DOWNSAMPLE = '0' NN_FILL_UPSAMPLE = '1' MISSING_DATA_FLAG = '2'
StarcoderdataPython
1921625
<gh_stars>0 # __ __ ____ __ # / /____ _ ____ ___ ____ _ / / / __ ) ____ / /_ # __ / // __ `// __ `__ \ / __ `// / / __ |/ __ \ / __/ # / /_/ // /_/ // / / / / // /_/ // / / /_/ // /_/ // /_ # \____/ \__,_//_/ /_/ /_/ \__,_//_/______/_____/ \...
StarcoderdataPython
6617015
<gh_stars>0 from django import forms from clientpage.models import * class OrganizerForm(forms.ModelForm): class Meta: model = Locations fields = ['name','phonenumber','image', 'latitude', 'longitude', 'address','description']
StarcoderdataPython
4837319
<filename>opensauce/snack.py """F0 and formant estimation using Snack Sound Toolkit Snack can be called in several ways: 1) On Windows, Snack can be run via a standalone binary executable 2) Snack can be called through the Python/Tkinter inteface 3) Snack can be called on the system command line through the Tcl ...
StarcoderdataPython
3213691
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # 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...
StarcoderdataPython
3321734
from app.account.views import account # noqa
StarcoderdataPython
4948198
<reponame>justindavies/Fluid #!/usr/bin/python from utils import * import pandas as pd from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation, Flatten from keras.layers.recurrent import LSTM, GRU from keras.layers import Convolution1D, MaxPooling1D, AtrousConvolution1D,...
StarcoderdataPython
3513895
#! /usr/bin/env python3.6 import tkinter as tk from ColorList import color_list root = tk.Tk() root.title("Ubuntu Color Display for Tkinter") frame = tk.Frame(root) frame.configure(background = 'slate gray') frame.pack(fill = 'both', expand = True, side = 'top') ''' These two for loops configure the columns and rows...
StarcoderdataPython
12838463
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ MCMC-estimation of status transition rates from IUCN record Created on Mon Oct 28 14:43:44 2019 @author: <NAME> (<EMAIL>) """ import numpy as np np.set_printoptions(suppress=True) import pandas as pd import os,sys import datetime from scipy.optimize import curve_fit ...
StarcoderdataPython
391418
<gh_stars>10-100 import re import os class CommandHandler(object): def __init__(self, command_tokens, stdout, stderr): self.cmd_tokens = command_tokens self.cmd_str = " ".join(command_tokens) self.stdout = [l.strip() for l in stdout.split("\n") if len(l.strip()) > 0] self.stderr = ...
StarcoderdataPython
1728067
import json import logging import requests from functools import reduce from urllib.parse import urljoin from flask import Blueprint, render_template, flash, redirect, url_for, current_app from app import db from app.planet.models import Planet planet_bp = Blueprint('planet', __name__) @planet_bp.route('/') def i...
StarcoderdataPython
3398110
import argparse import os import os.path as osp from shutil import copyfile import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--annotation_path", default="/data/coco_train.json") parser.add_argument("--image_root", default="/data/train") parse...
StarcoderdataPython
1781532
import math x = 0.112861 print(type(x)) # float # complex son deb kvadrat ildiz ostidagi -1 son olinadi # complex sonlar "j" bilan yoziladi y = 10+5j print(type(y)) print(y) # type conversion (data typni o`zgartirish) # convert from int to float a = 10; # x is integer b = float(a) # we are...
StarcoderdataPython
11329710
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2014 The python-semanticversion project # This code is distributed under the two-clause BSD License. """Test the various functions from 'base'.""" from .compat import unittest, is_python2 from semantic_version import base class ComparisonTestCase(un...
StarcoderdataPython
11344884
#!/usr/bin/python # # Copyright 2016 Red Hat | Ansible # 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 = ''' --- module: docker_prune short_description: Allows to prune va...
StarcoderdataPython
3398983
<filename>examples/doc-example-6.py #!/usr/bin/python """Simple Hyperion client request demonstration.""" import asyncio import logging import sys from hyperion import client HOST = "hyperion" PRIORITY = 20 async def instance_start_and_switch(): """Wait for an instance to start.""" instance_ready = asyncio...
StarcoderdataPython
3210614
import os from os.path import dirname, realpath, isdir, join thisDir = dirname(realpath(__file__)) fns = os.listdir(thisDir) with open('hide.txt') as f: ignore = f.readlines() ignore = [s.rstrip('\n') for s in ignore] sketches = [] for folder in fns: fp = join(thisDir, folder) if not isdir(fp) or folder...
StarcoderdataPython
11354575
#!/usr/bin/env python import django from django.conf import settings from django.core.management import call_command SECRET_KEY = 'fake-key' DEBUG = True INSTALLED_APPS = ( # Required contrib apps. 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.site...
StarcoderdataPython
3405658
<reponame>maltahan/DS28E38Upycraft try: import usocket as socket except: import socket import binascii import json import ds28e38 import onewire import _onewire as _ow import network import time import os import struct challenge = b'\x00\x00\x00\x00\x00\x0...
StarcoderdataPython
9628084
<reponame>NNTin/Dota-2-Meta-Analyzer import requests import time from steamapi.steamapikey import SteamAPIKey #from reddit.botinfo import message message = False def getMatchDetails(matchID, q=None): try: response = {} attempt = 0 while response == {}: if message: print('[get...
StarcoderdataPython
4881347
<reponame>suyash248/data_structures<filename>Tree/pathToTarget.py<gh_stars>1-10 from Tree.commons import insert, print_tree, is_leaf # Time complexity: O(n) def path_to_target_util_v1(root, target_key, path=[]): if root == None: return False if root.key == target_key: path.append(root.key) ...
StarcoderdataPython
239939
<gh_stars>0 # Space: O(l) # Time: O(m * n * l) class Solution: def exist(self, board, word) -> bool: column_length = len(board) row_length = len(board[0]) word_length = len(word) def dfs(x, y, index): if index >= word_length: return True if (not 0 <= x < r...
StarcoderdataPython
8006711
<reponame>kienpt/site_discovery_public """ Perform the ranking of the candidate websites with respect to seed websites """ import sys sys.path.append("utils") from urlutility import URLUtility import heapq from fetcher import Fetcher from jaccard_similarity import Jaccard_Similarity from cosine_similarity import Cos...
StarcoderdataPython
384749
<reponame>DALME/dalme<filename>dalme_app/models/reference.py from django.db import models from dalme_app.models._templates import dalmeIntid, dalmeUuid import django.db.models.options as options options.DEFAULT_NAMES = options.DEFAULT_NAMES + ('in_db',) class AttributeReference(dalmeUuid): name = models.CharFiel...
StarcoderdataPython
171200
from stn import spatial_transformer_network as transformer from tensorflow.keras import layers, Model class STModel(object): def __init__(self, input_shape): self.inpt = layers.Input(input_shape) self.output = self.transformer_net(self.inpt, self.localization_net(self.inpt)) return Mod...
StarcoderdataPython
1821160
import random import uuid from typing import Any, Callable, List from unittest.mock import Mock import attr from _pytest.monkeypatch import MonkeyPatch from assertpy import assert_that from mongomock import MongoClient import shotgrid_leecher.repository.shotgrid_hierarchy_repo as repository import shotgrid_leecher.ut...
StarcoderdataPython
9602099
<gh_stars>1-10 from tortoise import Tortoise from app.config import config async def init(): await Tortoise.init( { "connections": { "default": { "engine": "tortoise.backends.asyncpg", "credentials": { "host": con...
StarcoderdataPython
9611746
import requests from bs4 import BeautifulSoup name = '<NAME>' name = (name.split()) search = 'https://www.google.co.uk/search?q=' for word in name: search += word+'+' print(search[:-1]) result = requests.get(search[:-1]) if result.status_code == requests.codes.ok: soup = BeautifulSoup(result.content,'lxml') ...
StarcoderdataPython
1981672
<filename>casbin_redis_watcher/options.py import redis import uuid class WatcherOptions: addr = None sub_client = None pub_client = None channel = None ignore_self = None local_ID = None optional_update_callback = None def init_config(self): if self.local_ID == "": ...
StarcoderdataPython
4833421
<reponame>discovery-131794/django_local_library from django.forms.forms import Form from django.forms.models import ModelForm from django.forms.fields import CharField, DateField from .models import BookInstance from datetime import date, timedelta from django.core.exceptions import ValidationError from .models import ...
StarcoderdataPython
202304
from .taxable import TaxableTx from .entry_config import CRYPTO, TRANSFERS_OUT debit_base_entry = {'side': "debit", **TRANSFERS_OUT} credit_quote_entry = {'side': "credit", **CRYPTO} entry_template = { 'debit': debit_base_entry, 'credit': credit_quote_entry } class Send(TaxableTx): def __init__(self, **...
StarcoderdataPython
324965
from microbit import * class MIDI(): NOTE_ON = 0x90 NOTE_OFF = 0x80 CHAN_MSG = 0xB0 CHAN_BANK = 0x00 CHAN_VOLUME = 0x07 CHAN_PROGRAM = 0xC0 uart.init(baudrate=31250, bits=8, parity=None, stop=1, tx=pin0) @staticmethod def send(b0, b1, b2=None): if b2 is None: m = bytes([b...
StarcoderdataPython
9653966
# -*- coding: utf-8 -*- """ Created on Sun Oct 24 18:44:10 2021 @author: s14761 """ import numpy as np #Fin t such that the equilibrium is in mixed strategies def determine_tmax(al, ah, T, t, P): tmax=P*(ah-T)*(al+T)/((T*ah)-(al*al)) bl_hat=t*T/(al+T) bh_hat=(P*(ah-T)+(t*al))/(al+ah) ...
StarcoderdataPython
180385
<reponame>fvenya7/examen from tkinter import Tk,Frame,Label,Button,Entry,Scale,StringVar,IntVar,Toplevel,ttk import tkinter as tk import catalogo from editar_excel import list1 class Ventana_Principal(Frame): def __init__(self,master=None): super().__init__(master, width=600, height=400) self.master=ma...
StarcoderdataPython
3403308
<filename>platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/sol/calculators/calc_fpll.py from pyradioconfig.calculator_model_framework.Utils.LogMgr import LogMgr from pyradioconfig.parts.ocelot.calculators.calc_fpll import calc_fpll_ocelot from pycalcmodel.core.variable import ModelVariableFormat, CreateMo...
StarcoderdataPython
6577120
<filename>mevis/_internal/args.py from collections.abc import Iterable as _Iterable def check_arg(value, name, allowed_types=None, allowed_values=None, allow_none=False): """Check if a user-provided argument has a valid type and value. Parameters ---------- value : any type Value that a user ...
StarcoderdataPython
4802166
<reponame>openeuler-mirror/radiaTest import json from flask import g from flask_restful import Resource from flask_pydantic import validate from server import socketio, casbin_enforcer from server.utils.auth_util import auth from server.utils.response_util import response_collect from server.schema.task import * from ....
StarcoderdataPython
11316803
from unittest import TestCase from doctest import DocTestSuite from cr8 import java_magic from cr8.java_magic import _parse_java_version class JavaVersionParsingTest(TestCase): def assertVersion(self, line, expected): version = _parse_java_version(line) self.assertEqual(version, expected) de...
StarcoderdataPython
8194784
<filename>src/ploomber/sources/inspect.py """ Extensions for the inspect module """ import inspect def getfile(fn): """ Returns the file where the function is defined. Works even in wrapped functions """ if hasattr(fn, '__wrapped__'): return getfile(fn.__wrapped__) else: return...
StarcoderdataPython
12864307
import os from xappt_qt.__version__ import __version__, __build__ from xappt_qt.plugins.interfaces.qt import QtInterface # suppress "qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow)" os.environ['QT_LOGGING_RULES'] = '*.debug=false;qt.qpa.*=false' version = tuple(map(int, __version__.split('.'))) + (__build__, )...
StarcoderdataPython
5021372
<reponame>Chkoda/Deep-Learning-Model-Evaluation from __future__ import print_function import sys import os import math from optparse import OptionParser from keras.models import load_model, Model from argparse import ArgumentParser from keras import backend as K import numpy as np import h5py import matplotlib matplotl...
StarcoderdataPython
11321447
<reponame>uktrade/jupyterhub-data-auth-admin import psycopg2 import pytest from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.test import Client, TestCase, override_settings from dataworkspace.apps.core.utils import database_dsn fro...
StarcoderdataPython
1736003
# -*- coding:utf-8 -*- # # Copyright (C) 2008 The Android Open Source Project # # 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 re...
StarcoderdataPython
8035243
<gh_stars>0 import nose.tools from nose import with_setup import sys import numpy as np import datetime # my module from nwispy import nwispy_helpers as helpers # define the global fixture to hold the data that goes into the functions you test fixture = {} def setup(): """ Setup fixture for testing """ pri...
StarcoderdataPython
6468645
import argparse import os import sys from junit_xml_parser import ( validate_junit_xml_file, validate_junit_xml_archive, parse_test_result ) from report_data_storage import KustoConnector def _run_script(): parser = argparse.ArgumentParser( description="Upload test reports to Kusto.", ...
StarcoderdataPython
9723277
<filename>gimmemotifs/cli.py #!/usr/bin/env python # Copyright (c) 2013-2019 <NAME> <<EMAIL>> # # This module is free software. You can redistribute it and/or modify it under # the terms of the MIT License, see the file COPYING included with this # distribution. import os import sys import argparse from gimmemotifs.con...
StarcoderdataPython
8065409
import create_bwc_index import logging import os import random import shutil import subprocess import sys import tempfile def fetch_version(version): logging.info('fetching ES version %s' % version) if subprocess.call([sys.executable, os.path.join(os.path.split(sys.argv[0])[0], 'get-bwc-version.py'), version]) != ...
StarcoderdataPython
9615104
#!/usr/bin/env python3 def rk4(m , h_eff , i_s , dt): k = np.zeros((4,3)) mm = np.zeros((3,3)) m_new = np.zeros((1,3)) # Step 0 k[0 , :] = dm(m , h_eff , i_s) mm[0 , :] = m + k[0 , :] * dt / 2 # Step 1 k[1 , :] = dm(mm[0 , :] , h_eff , i_s) mm[1 , :] = m + k[1 , :] ...
StarcoderdataPython
11399198
import uuid as _uuid from copy import copy as _copy import os as _os from Acquire.Service import Service as _Service from ._errors import StorageServiceError __all__ = ["StorageService"] class StorageService(_Service): """This is a specialisation of Service for Storage Services""" def __init__(self, other...
StarcoderdataPython
9732764
# -*- coding: utf-8 -*- """Module containing useful 1D plotting abstractions on top of matplotlib.""" import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable from matplotlib.collections import LineCollection from matplotlib.colors import Normalize from sliceplots.util import _idx_from_val, _make_a...
StarcoderdataPython
4929166
<gh_stars>0 """ radiomanager.models.types ========================= Custom SQLAlchemy data types """ import uuid from sqlalchemy.types import BINARY, TypeDecorator class UUID(TypeDecorator): """ UUID SQLAlchemy type adapter. Based on https://docs.sqlalchemy.org/en/rel_0_9/core/custom_types.html?highlight=gu...
StarcoderdataPython
237841
import sys import json import time import beanstalkc import tornado.ioloop import tornado.web from threading import Thread from job import jobs, JobInfo from train import Trainer from predict import Predictor from config import BEANSTALK_HOST, BEANSTALK_PORT, BEANSTALK_YAML from constant import TRAIN, PREDICT io_loo...
StarcoderdataPython
3477549
import argparse import pathlib import os import h5py import numpy as np def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--dataset_dir', default="s3dis_raw", type=str, help='Path to .npy format dataset') parser.add_argument('--output_dir', default="", type=str, help='Path to outp...
StarcoderdataPython
185788
<reponame>abirabedinkhan/Ducky-Script-Compiler import time import pyautogui import keyboard import sys import os import requests try: duckyScriptPath = sys.argv[1] except: duckyScriptPath = 'payload.dd' f = open(duckyScriptPath,"r",encoding='utf-8') duckyScript = f.readlines() duckyScript = [x.strip(...
StarcoderdataPython
6467293
<reponame>canavandl/colour #!/usr/bin/env python # -*- coding: utf-8 -*- """ Defines unit tests for :mod:`colour.models.rgb` module. """ from __future__ import division, unicode_literals import numpy as np import sys if sys.version_info[:2] <= (2, 6): import unittest2 as unittest else: import unittest from...
StarcoderdataPython
3320870
<reponame>alexpulver/flask-webapi<gh_stars>0 from flask_restful import Resource class Endpoint(Resource): def get(self): return 'Got get', 200 def post(self): return 'Got post', 201
StarcoderdataPython
41815
<reponame>chuanhao01/MSP_Learn_Python_Turtle import turtle pen = turtle.Turtle() pen.speed("slowest") # Let's draw something a little more interesting, a 2d grid of squares # How would you draw a grid of squares? # For each row in the grid, draw a certain number of squares (number of columns) square_width = 50 num_r...
StarcoderdataPython
1951487
<reponame>Muix2015/Personal_Website<gh_stars>0 from django.db import models # Create your models here. class Rate(models.Model): # GJJ = models.FloatField(default=0, max_digits=4, decimal_places=2) # SYDK = models.FloatField(default=0, max_digits=4, decimal_places=2) GJJ = models.DecimalField(default=0, max_digits...
StarcoderdataPython
1673849
# # Copyright (c) 2017 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 applicable law or agreed t...
StarcoderdataPython
1816744
<gh_stars>1-10 from .assets import AssetsInfoViewSet,AssetsViewSet,ServerCount,VmCount from .tag import TagViewSet from .idc import IDCViewSet from .other import TestConnectApiView
StarcoderdataPython
9716890
<filename>hafta_2/11.py i = 0 while(i<10): print i if i == 5: # Dongu 5 e esit olunca duruyor. print "Dongu Duruyor..." break i = i + 1 print "program sonlandi!"
StarcoderdataPython
65398
<reponame>himicakumar/cs3240-labdemo def greeting(msg): print(msg)
StarcoderdataPython
11304131
<reponame>HITROS/omtb_ml #!/usr/bin/env python ############################################################################## # Copyright 2019 HITROS CO., LTD. # # 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 ...
StarcoderdataPython
1762190
<gh_stars>10-100 import random from queue import * def gcd(a,b): while b: a,b=b,a%b return a def expo(a,b): x,y=1,a while(b>0): if(b&1): x=x*y y=y*y b>>=1 return x primes=[0]*100000 def sieve(): primes[1]=1 primes[2]=2 j=4 while(j<100000): primes[j]=2 j+=2 j=3 while(j<100000): if primes...
StarcoderdataPython
1948417
<filename>Ano_1/LabI/Projeto Final - Moura/repositoryContent/ImageEditor/textEditor.py from PIL import Image, ImageDraw, ImageFont from PIL import ExifTags import math import sys import ImageEditor.text_write_styles #coding: utf-8 #text split-----------------------------------------------------------------------------...
StarcoderdataPython
6688612
<reponame>brown-ccv/workshop-python-2020 test = { 'name': '8.1', 'suites': [ { 'cases': [ { 'code': r""" >>> # It looks like your variable is not named correctly. >>> # Maybe there's a typo? >>> 'res1_int' in vars() True """ }, ...
StarcoderdataPython
6656904
<reponame>mehrdad1373pedramfar/restfulpy<filename>restfulpy/tests/test_server_timestamp.py from bddrest import response, status, when from nanohttp import json, Controller, settings from restfulpy.testing import ApplicableTestCase class Root(Controller): @json def index(self): return 'index' class...
StarcoderdataPython
1632604
from django.template import Library from _1327.information_pages.models import InformationDocument register = Library() @register.filter def can_user_see_author(document, user): if document.show_author_to == InformationDocument.SHOW_AUTHOR_TO_EVERYONE: return True elif document.show_author_to == InformationDocu...
StarcoderdataPython
5001127
import psutil import platform import datetime import logging from kalliope.core.NeuronModule import NeuronModule, InvalidParameterException logging.basicConfig() logger = logging.getLogger("kalliope") class System_status(NeuronModule): def __init__(self, **kwargs): super(System_status, self).__init__(**...
StarcoderdataPython
8044404
#!/home/byrone/Desktop/Project/Album/virtual/bin/python3.6 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
StarcoderdataPython
94719
<reponame>stanford-oval/trade-dst import argparse import nltk from nltk.corpus import stopwords # nltk.download('stopwords') from collections import Counter import numpy as np from matplotlib import pyplot as plt import json parser = argparse.ArgumentParser() parser.add_argument('--input_file') parser.add_argument('-...
StarcoderdataPython
3577097
"""Peewee migrations -- 001_create_prefix_table.py.""" import peewee as pw class Prefix(pw.Model): guild_id = pw.BigIntegerField(primary_key=True) prefix = pw.CharField(max_length=25) def migrate(migrator, database, fake=False, **kwargs): """Write your migrations here.""" migrator.create_model(Pre...
StarcoderdataPython
164089
<reponame>mariotaku/nanovg import ctypes ################################################################################ class _NVGrgba4(ctypes.Structure): # Internal _fields_ = [('r', ctypes.c_float), ('g', ctypes.c_float), ('b', ctypes.c_float), ('a', ctypes.c_fl...
StarcoderdataPython
11312783
<reponame>rglaue/bakauditor import os from functools import lru_cache from datetime import datetime from types import SimpleNamespace @lru_cache(maxsize=4096) def get_zfs_snapshots(ssh=None): ssh_cmd = '' if not ssh else 'ssh {} '.format(ssh) result = [] with os.popen('{}zfs list -p -t snapshot'.format(...
StarcoderdataPython
5015
<reponame>d53dave/python-crypto-licensecheck import sys from Crypto.Signature import pkcs1_15 from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA def sign_data(key, data, output_file): with open(key, 'r', encoding='utf-8') as keyFile: rsakey = RSA.importKey(keyFile.read()) signer = pkc...
StarcoderdataPython
1651355
from .application import ApplicationModel from .using_application import UsingApplicationModel
StarcoderdataPython
188498
<reponame>AquaDiva-INFRA1/ad-query-proxy #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 28 16:06:14 2020 @author: <NAME> """ from parsers.bibtex import parse def test_parse() -> None: source = "tests/resources/bibtex.bib" with open(source, encoding="utf-8") as data: for bibdict...
StarcoderdataPython
5018266
# 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, software # d...
StarcoderdataPython
4956528
# Generated by Django 3.1.8 on 2021-05-14 14:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('metadata', '0012_update_services'), ] operations = [ migrations.AddField( model_name='administrativearea', name='are...
StarcoderdataPython
1748832
r""" ECEI2D ======= contains 2D version of synthetic Electron Cyclotron Emission Imaging Diagnostic. Unit Conventions ----------------- In ECEI2D, Gaussian unit is used by default. The units for common quantities are: length: centi-meter time: second mass: gram magnetic field: Gauss temperature: ...
StarcoderdataPython
1644581
from __future__ import annotations from abc import abstractmethod from typing import TYPE_CHECKING, Callable, Iterable, List, Optional, Tuple, Union from open_mafia_engine.core.enums import ActionResolutionType from open_mafia_engine.core.event_system import ( Action, EPostAction, EPreAction, Event, ...
StarcoderdataPython
4989166
import argparse import os from liquidcss.workspace import WorkSpace from liquidcss.settings import Settings, Messages, DocConfig from liquidcss.utils import create_file_key, display_output """ Command: liquidcss status Description: Displays information about the files registered with the WorkSpace. Positional A...
StarcoderdataPython
5020885
<gh_stars>0 import datetime from django.db import models from django.utils import timezone from django.urls import reverse from autoslug import AutoSlugField class Donor(models.Model): name = models.CharField(max_length=200, unique=True) abbrev = models.CharField(max_length=20, unique=True) def __str__(...
StarcoderdataPython
3276642
from __future__ import print_function, division from dials.array_family import flex from xfel.merging.application.worker import worker from xfel.merging.application.reflection_table_utils import reflection_table_utils try: import resource import platform def get_memory_usage(): # getrusage returns kb on linu...
StarcoderdataPython
6638999
"""GetAsyncRequest message tests.""" from pyof.v0x04.controller2switch.get_async_request import GetAsyncRequest from tests.unit.test_struct import TestStruct class TestGetAsyncRequest(TestStruct): """Test the GetAsyncRequest message.""" @classmethod def setUpClass(cls): """Configure raw file and ...
StarcoderdataPython
26484
from pyexocross.hitran.hitran import HITRANLinelist from pyexocross.pyexocross import PyExocross from pyexocross.exomol.exomolbroads import ExomolBroadener import numpy as np from pyexocross.util import create_grid_res, convert_to_wavenumber from pyexocross.writer.hdf5writer import HDF5Writer import matplotlib.pyplot a...
StarcoderdataPython
3243410
import os import dbl import discord from discord.ext import commands, tasks from ansura import AnsuraBot class DBL(commands.Cog): def __init__(self, bot: AnsuraBot): self.bot = bot self.token = os.getenv("DBL") self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) @tasks.l...
StarcoderdataPython
4911336
<filename>select_market.py """ Market selection module """ import pymysql.cursors from app_head import get_head from app_body import get_body from app_page import set_page from app_ogp import set_ogp from app_metatags import get_metatags from app_title import get_title from bootstrap import get_bootstrap from app_loadi...
StarcoderdataPython
1685210
<reponame>Jason-Khan/mmediting import torch.nn as nn import torch from mmedit.models.builder import build_component from mmedit.models.registry import BACKBONES import torch.nn.functional as F from mmseg.core import add_prefix from mmseg.ops import resize from ... import builder from mmcv.runner import auto_fp16, lo...
StarcoderdataPython
6509462
from coalib.bearlib.abstractions.Linter import linter from dependency_management.requirements.PipRequirement import PipRequirement @linter(executable='cppclean', output_format='regex', output_regex=r'.+:(?P<line>\d+):(?P<message>.*)') class CPPCleanBear: """ Find problems in C++ source code th...
StarcoderdataPython
1813787
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class ToughAnimationCasesPage(page_module.Page): de...
StarcoderdataPython
5047405
<reponame>poldracklab/bids-core import os import copy import logging import pymongo import datetime logging.basicConfig( format='%(asctime)s %(name)16.16s %(filename)24.24s %(lineno)5d:%(levelname)4.4s %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG, ) log = logging.getLogger('scitran.api')...
StarcoderdataPython
6650607
<filename>vkmodels/objects/comment.py import dataclasses import enum import typing from vkmodels.bases.object import ObjectBase @dataclasses.dataclass class Thread( ObjectBase, ): count: int can_post: typing.Optional[bool] = None groups_can_post: typing.Optional[bool] = None items: typing.Optiona...
StarcoderdataPython