id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8015762
import random as r from os import path import math filename = "bmem.mem" sprite_size = 256 sprite_width = 16 nsprites = 35 nloc = 1024 def rhex(): h = str(hex(math.floor(r.random() * 16)))[2:] return h def rcolor(): return rhex() + rhex() + rhex() hexmem = "" for i in range(nsprites): sprite_fil...
StarcoderdataPython
9788673
import src.AutoBugTracker as autoBugTracker import src.ReadConfig as readConfig from flask import Flask app = Flask(__name__) @app.route("/submitBug", methods=["POST"]) def issueBug(): execute = autoBugTracker.AutoBugTracker() execute.issueBugReport() return "200" if __name__ == '__main__': readCon...
StarcoderdataPython
5009215
<gh_stars>1-10 from typing import Type from mcscript.backends.mc_datapack_backend.McDatapackBackend import McDatapackBackend BACKENDS = [McDatapackBackend] def get_default_backend() -> Type[McDatapackBackend]: return McDatapackBackend
StarcoderdataPython
9746085
<reponame>WWakker/mtalg import mtalg def set_num_threads(num_threads: int): """Set number of threads for subsequent MRNGs and algebra functions Args: num_threads: Number of threads """ if not isinstance(num_threads, int): raise ValueError(f'Number of threads must be an integer, found:...
StarcoderdataPython
11222404
from flask_restplus import Namespace,Resource,fields,reqparse import Crypto from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP from Crypto import Random from core import Configs import pickle import json from flask import send_file import ast api = Namespace('public_key_exchange_api',description = ...
StarcoderdataPython
5076989
def find_cells_by_set_id(needle, haystack): for cell_set in haystack: if cell_set["key"] == needle: return cell_set["cellIds"] if cell_set.get("children", None): result = find_cells_by_set_id(needle, cell_set["children"]) if result: return result...
StarcoderdataPython
6622686
def graphplot(dfcol1,dfcol2,path): plt.subplot(321) plt.plot(dfcol1,dfcol2) #line chart plt.title(path) # plt.show() plt.subplot(322) plt.bar(dfcol1,dfcol2) #bar chart plt.title(path) plt.subplot(323) plt.hist(dfcol1,dfcol2) #histogram p...
StarcoderdataPython
3204042
<gh_stars>1-10 #!/usr/bin/env python import battle import jsonobject import logging import model logger = logging.getLogger('kcaa.kcsapi.expedition') class Expedition(model.KCAAObject): """Information about the current expedition.""" fleet_id = jsonobject.JSONProperty('fleet_id', value_type=int) """ID...
StarcoderdataPython
4997415
########################################################################## # If not stated otherwise in this file or this component's Licenses.txt # file the following copyright and licenses apply: # # Copyright 2018 RDK Management # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use th...
StarcoderdataPython
11200308
<filename>setup.py from distutils.core import setup setup( name='lockboxcli', version='0.0.5', author='<NAME>', author_email='<EMAIL>', packages=['lockboxcli', 'lockboxcli.tests'], install_requires=[ 'future', ], scripts=[], url='http://pypi.python.org/pypi/lockboxcli/', l...
StarcoderdataPython
8087959
<gh_stars>1-10 #coding:utf-8 from flask import Flask app = Flask(__name__) app.secret_key = "UIsadl;oi3&*(&9023sd" import users import demo import dell_racadm import dell_racadm_disk import dell_racadm_toolkit import dell_racadm_warning import dell_racadm_info_update import dell_racadm_page
StarcoderdataPython
9692581
CLIP_MODEL = "ViT-B-32.pt"
StarcoderdataPython
218949
<reponame>florardu/Parse_Jest_To_CSV from personalValues import PROJECT_ID from personalValues import TEST_FILES testPlanID = input("\nPlease input the parent test plan ID: ") for i in range( len(TEST_FILES) ): print( "\n" + str(i) + " - " + TEST_FILES[i]) filePath = TEST_FILES[ int(input("\nPlease cho...
StarcoderdataPython
11303501
<filename>tests/test_warnings.py<gh_stars>10-100 # -*- coding: utf-8 -*- import subprocess from goodplay_helpers import smart_create def test_goodplay_runs_fine_without_any_warnings(tmpdir): smart_create(tmpdir, ''' ## inventory 127.0.0.1 ansible_connection=local ## test_playbook.yml - hosts: 1...
StarcoderdataPython
1721799
<reponame>DemocracyClub/monitoring from django.test import TestCase from .models import Screenshot from url_store.models import URL from screenshots.utils import WebPageScreenshot class TestSCreenShot(TestCase): # def test_single_page(self): # s = WebPageScreenshot() # x = s.capture('https://demo...
StarcoderdataPython
3305376
""" comm_module.py contains support functions for the communication nodes, both on the agents and on the ground station. For consistency all frame conversions are done on the ground station """ import time import rospy import serial try: from frame_module import FrameConvertor except: print '' from xbee_module ...
StarcoderdataPython
1933965
from rest_framework.permissions import BasePermission, SAFE_METHODS # Custom permission to only allow owners of an object to edit it. class IsOwnerOrReadOnly(BasePermission): def has_object_permission(self, request, view, obj): if request.method in SAFE_METHODS: return True return obj...
StarcoderdataPython
5090046
<reponame>moth1995/WE10JL_OF_Team_Editor from editor.club import Club def get_players_clubs(of, team_id): team_id-=first_club_team_id players=[] for i in range (0, 32): players.append(int.from_bytes(of.data[clubs_players_relink_offset + (i * 2) + (team_id * clubs_players_relink_size) : clubs_player...
StarcoderdataPython
9641356
#cek deret geometri def tentukanDeretGeometri(arr): r=arr[1]/arr[0] for i in range(1,len(arr)): # print(arr[i]/arr[i-1]) if arr[i]/arr[i-1] != r: return False return True #test case print(tentukanDeretGeometri([1, 3, 9, 27, 81])) # True print(tentukanDeretGeometri([2, 4, 8, ...
StarcoderdataPython
1913991
<reponame>sankhesh/vcs-scripts<gh_stars>0 #!/usr/bin/env python import vcs import cdms2 f = cdms2.open(vcs.sample_data + "/clt.nc") s = f("clt") x = vcs.init() x.plot(s) s2 = cdms2.MV2.masked_greater(s, 50.) gm = x.createboxfill() gm.missing = [50, 50, 50, 50] x.plot(s2, gm) x.png('121_boxfill_mask_opacity_' + str(gm...
StarcoderdataPython
8156502
from bddrest import status, when, response, given def test_querystring(app, Given): @app.route() def get(req, *, baz=None): return f'{req.query.get("foo")} {baz}' with Given('/?foo=bar&baz=qux'): assert status == 200 assert response.text == 'bar qux' when(query=given - '...
StarcoderdataPython
3290429
""" Static analysis module. """ import r2pipe import subprocess import logging.config from lisa.core.base import AbstractSubAnalyzer from lisa.config import logging_config logging.config.dictConfig(logging_config) log = logging.getLogger() class StaticAnalyzer(AbstractSubAnalyzer): """Provides static analy...
StarcoderdataPython
9647978
############################################################################### # Program: build_visitmodule.py # # Purpose: This program builds the VisIt Python module. # # Programmer: <NAME> # Creation: Wed Nov 22 12:41:39 PDT 2006 # # Note: The "visitmodule" module is a self-contained (no library dependencies) # ...
StarcoderdataPython
288281
""" Copyright (c) 2018 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 to in wri...
StarcoderdataPython
1790803
#--coding:UTF-8-- import base64 import getopt import os import json import re import sys import urllib from urllib import request import bakthread import requests banner = ''' _ _ _ _ | |_ ___ | |__ ___ | |_ ___ ___ | |__ | . \<_> || / // | '| . |/ ._>/ | '| / / |___/<___||_\_\\_|_....
StarcoderdataPython
12838535
""" A module for defining inventories of unstable nuclides """ import collections from .exceptions import UnphysicalValueException class UnstablesInventory(): """ A simple data structure to represent inventory data. A list of zais and activities (Bq). Note that this should only be us...
StarcoderdataPython
6451711
from PyQt5 import QtCore, QtWidgets, Qt from PyQt5.QtWidgets import * import os import xml.etree.cElementTree as et class Ui_MainWindow(QtWidgets.QMainWindow): def __init__(self): self.count = 0 super(Ui_MainWindow,self).__init__() self.setupUi(self) self.retranslateUi(s...
StarcoderdataPython
1957149
<filename>Software/Sandbox/DNL/Variedad central.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 5 19:32:23 2019 @author: matias """ import numpy as np import sympy as sp from numpy import linalg as LA from numpy.linalg import inv a = np.matrix([[1,4,0,1,0],[0,4,0,0,0],[0,0,-4,0,0],[0,0,0,-1...
StarcoderdataPython
6548672
from node_exec.base_nodes import defNode, defInlineNode, BaseCustomNode from PySide2.QtWidgets import QFileDialog IDENTIFIER = 'File Dialog' @defNode("Choose Existing Directory", isExecutable=True, returnNames=["directory"], identifier=IDENTIFIER) def chooseExistingDirectory(parentWindow=None, initialDir=""): ret...
StarcoderdataPython
3299947
<reponame>aspose-email-cloud/aspose-email-cloud-python # coding: utf-8 # ---------------------------------------------------------------------------- # <copyright company="Aspose" file="EmailAddress.py"> # Copyright (c) 2018-2020 Aspose Pty Ltd. All rights reserved. # </copyright> # <summary> # Permission is...
StarcoderdataPython
3460282
<filename>scanpy/tests/helpers.py """ This file contains helper functions for the scanpy test suite. """ from itertools import permutations import scanpy as sc import numpy as np from anndata.tests.helpers import asarray, assert_equal # TODO: Report more context on the fields being compared on error # TODO: Allow s...
StarcoderdataPython
1999122
def FloatVector (X): import numpy return numpy.array(X, dtype=float) def FloatVectorNormSquared (X): # return x.transpose().dot(x) return sum(x**2 for x in X.flat) def FloatMatrix (X): import numpy rows = len(X) cols = len(X[0]) return numpy.ndarray(shape=(rows,cols), dtype=float, buff...
StarcoderdataPython
5193533
<filename>src/api/factory.py ''' Flask App Factory ''' from flask import Flask, jsonify from api.controllers.abstraction_views import abstraction_bp from api.utils import logger from api.utils.exceptions import InvalidUsage logger = logger.create_logger(__name__) def create_app(config=None, environment=None): ''...
StarcoderdataPython
1714371
from typing import List from requests.adapters import HTTPAdapter from util import BaseMiddleware class MiddlewareAdapter(HTTPAdapter): middlewares: List[BaseMiddleware] def __init__(self, middlewares: List[BaseMiddleware]): super(MiddlewareAdapter, self).__init__() self.middlewares = middl...
StarcoderdataPython
1724604
<gh_stars>1-10 # -*- coding: utf-8 -*- import os import cv2 import glob import numpy as np from face import get_landmark, LandmarkIndex from __init__ import tar_dir def process_proxy(tar_id, rsize, line, ksize=15, sigma=1e2, k=1): # process teeth proxies to get their landmarks and high-pass filters ...
StarcoderdataPython
8080815
<reponame>tefra/xsdata-w3c-tests<filename>output/models/ms_data/regex/re_s14_xsd/__init__.py<gh_stars>1-10 from output.models.ms_data.regex.re_s14_xsd.re_s14 import Doc __all__ = [ "Doc", ]
StarcoderdataPython
8181756
<filename>nibabel/nicom/tests/test_csareader.py<gh_stars>1-10 """ Testing Siemens CSA header reader """ from os.path import join as pjoin import numpy as np from .. import csareader as csa from .. import dwiparams as dwp from nose.tools import assert_true, assert_false, \ assert_equal, assert_raises from numpy...
StarcoderdataPython
5191499
'''input 02/08/10 ''' a = input().split("/") print("{1}/{0}/{2}".format(a[0], a[1], a[2])) print("{2}/{1}/{0}".format(a[0], a[1], a[2])) print("{}-{}-{}".format(a[0], a[1], a[2]))
StarcoderdataPython
11222357
<gh_stars>1-10 raise NotImplementedError("ssl is not yet implemented in Skulpt")
StarcoderdataPython
4931788
<gh_stars>0 import functools import json from typing import Any, Awaitable, Callable import launch import launch_ros import rclpy import rclpy.task from autobahn.twisted.websocket import WebSocketClientFactory, WebSocketClientProtocol from rcl_interfaces.srv import GetParameters from rclpy.executors import SingleThrea...
StarcoderdataPython
6463244
<reponame>gang-tetris/test-amqp-server<filename>src/server.py #!/usr/bin/env python from pika import BlockingConnection, ConnectionParameters from .client import PersonRpcClient from pika import BasicProperties import json DEFAULT_QUEUE = 'rpc_queue' DEFAULT_HOST = 'rabbit' class Server(object): def __init__(self...
StarcoderdataPython
8136878
# 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 # distributed under the ...
StarcoderdataPython
3261148
<reponame>hanseungwook/tre_code import tensorflow_probability as tfp from density_estimators.flows import Flow from tensorflow import layers from tensorflow.keras.models import Model from tensorflow.keras import layers as k_layers from tensorflow.keras import regularizers from tensorflow.keras import initializers from...
StarcoderdataPython
8030149
titulo = ["DESCRIÇÃO", "Nº LÂMPADAS", "P.U. LÂMPADAS", "P.T. LÂMPADAS", "TUG - 100 VA", "TUG - 650 VA", "P.T. TUG`S"] linha = 120 * "-" print(linha) print('|{:^118}|'.format("PREVISÃO DE CARGAS")) print(linha) print('|{:^26}|{:^13}|{:^15}|{:^15}|{:^14}|{:^14}|{:^15}|'.format(*titulo)) print(linha)
StarcoderdataPython
5067849
import os import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ["MOLECULE_INVENTORY_FILE"] ).get_hosts("all") def test_installed_packages(host): packages = [ "apt-transport-https", "cron", "git", "go-server", ...
StarcoderdataPython
1940887
<filename>public/Base64.py<gh_stars>0 adbd = base64.b64encode(crypto)
StarcoderdataPython
6533983
<reponame>ComputationalChemistry-NMSU/terse<filename>Parsers/NBO.py if __name__ == "__main__": import sys,os selfname = sys.argv[0] full_path = os.path.abspath(selfname)[:] last_slash = full_path.rfind('/') dirpath = full_path[:last_slash] + '/..' print "Append to PYTHONPATH: %s" % (dirpath) ...
StarcoderdataPython
8098444
from discord.ext import commands import discord import platform class aboutCommand(commands.Cog): def __init__(self, bot): self.bot = bot # About Command @commands.command(pass_context=True) async def about(self, ctx): embed = discord.Embed( title=f'About {self.bot.user.na...
StarcoderdataPython
3526043
<filename>rpn/visualize.py from keras.preprocessing.image import load_img, img_to_array from sources.feature_extractor.processing import prepare_feature_extractor from sources.rpn.generation import RPNconfig from keras.models import Model, load_model from sources.rpn.rpn import clean_rpn_model, ThresholdedRegularizer, ...
StarcoderdataPython
359754
<filename>tests/test_expire.py from __future__ import absolute_import import redisext.counter import redisext.key import redisext.serializer from . import fixture class ExpireCounter(redisext.counter.Counter, redisext.key.Expire): EXPIRE = 60 CONNECTION = fixture.Connection SERIALIZER = redisext.seriali...
StarcoderdataPython
8159564
"""pconfig elements tests.""" import pytest from tzf.pyramid_yml import scripts def test_simplevalue(): """Test for simple value.""" line = scripts.printer(1) # value passed should be represented by type in round parenthesis assert line == '1 (int)' @pytest.mark.parametrize('configvalue, countlines...
StarcoderdataPython
1975914
from fastapi import APIRouter, Depends, File, UploadFile, HTTPException, Header, status from typing import List, Union import os from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.orm import Session from app.database import crud from app.database.conn import get_db, get_s3 from app.config.config import BUCKET_N...
StarcoderdataPython
6700820
from flask import render_template, flash, redirect, url_for, Response from app import app from app.forms import TagForm import re import psycopg2 from SECRETS import SECRETS DB = psycopg2.connect(dbname=SECRETS['dbname'], user=SECRETS['user'], host=SECRETS['host'], password=<PASSWORD>['password'], ...
StarcoderdataPython
283882
<gh_stars>0 #!/usr/bin/env python import os, logging log_format = "[%(asctime)s: %(levelname)s/%(name)s/%(funcName)s] %(message)s" logging.basicConfig(format=log_format, level=logging.INFO) logger = logging.getLogger(os.path.splitext(os.path.basename(__file__))[0]) def norm_path(path): """Normalize path.""" ...
StarcoderdataPython
9686711
<reponame>manoadamro/jason<filename>jason/token/error.py<gh_stars>0 from .. import error BatchValidationError = error.BatchValidationError class TokenValidationError(Exception): ...
StarcoderdataPython
1641210
# Author: <NAME> <<EMAIL>> # Copyright (c) 2020 <NAME> # # This file is part of Monet. from .pca_model import PCAModel from .compressed_data import CompressedData from .monet_model import MonetModel
StarcoderdataPython
1600308
<filename>cursoEmVideo/Python/Mundo 1/Exercicios/ex016.py # crie um programa que leia um numero real qualquer pelo tecaldo # e mostre na tela a sua porção inteira # ex: 6.127 # o Número 6.127 tem a parte inteira 6 # #from math import trunc #num = float(input('digite um numero quebrado: ')) #print('O número {} tem a par...
StarcoderdataPython
11373228
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
StarcoderdataPython
301308
from django.contrib import admin from . models import Account # Register your models here. admin.site.register(Account)
StarcoderdataPython
8184500
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('crowdsourcing', '0069_merge'), ] operations = [ migrations.AlterField( model_name='module', name='st...
StarcoderdataPython
3545231
<gh_stars>0 from __future__ import absolute_import from decorum.decorum import Decorum, decorator __all__ = ['Decorum', 'decorator'] __version__ = '0.5.1'
StarcoderdataPython
4850324
<filename>2019/day-01/part1.py #!/usr/bin/env python def solve(input): sum = 0 for line in input: sum += int(line) // 3 -2 print(sum) # with open('test.txt', 'r') as f: # input = f.read().splitlines() # solve(input) with open('input.txt', 'r') as f: input = f.read().splitlines() ...
StarcoderdataPython
4942822
import numpy as np import argparse import cv2 as cv def draw_labels_and_boxes(img, boxes, confidences, classids, idxs, colors, labels): if len(idxs) > 0: for i in idxs.flatten(): x, y = boxes[i][0], boxes[i][1] w, h = boxes[i][2], boxes[i][3] color = [int(c) for c in c...
StarcoderdataPython
3293823
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
StarcoderdataPython
4950773
<filename>Attacks/AttackMethods/AttackUtils.py #!/usr/bin/env python # -*- coding: utf-8 -*- # ************************************** # @Time : 2018/9/7 23:05 # @Author : <NAME> # @Lab : nesa.zju.edu.cn # @File : AttackUtils.py # ************************************** import matplotlib.pyplot as plt impor...
StarcoderdataPython
5185626
<reponame>andyjessen/great_expectations<gh_stars>0 from dataclasses import dataclass from enum import Enum from typing import List import altair as alt class PlotMode(Enum): DESCRIPTIVE = "descriptive" PRESCRIPTIVE = "prescriptive" @dataclass(frozen=True) class PlotResult: """Wrapper object around Data...
StarcoderdataPython
3325833
#!/usr/bin/python3 import os import re IGNORE = ['rename.py', 'README.md', '.git', '.gitignore'] for it in [f for f in os.listdir() if f not in IGNORE]: novo_nome = re.sub(r'(?P<letra>[A-Z])', lambda x: f'_{x.group("letra")}'.lower(), it) novo_nome = novo_nome if novo_nome[0] != '_' else novo_nome[1:] os...
StarcoderdataPython
201664
from django.utils.translation import ugettext_noop from casexml.apps.case.models import CommCareCase from corehq.apps.hqwebapp.doc_info import get_doc_info from corehq.apps.locations.models import SQLLocation from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn from corehq.apps.reports.filters....
StarcoderdataPython
1613998
""" Copyright 2018-2019 CS Systèmes d'Information 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
1780214
<reponame>opayelle/raddar from fastapi import APIRouter, Depends from sqlalchemy.orm import Session from raddar.core import dependencies from raddar.crud import crud from raddar.schemas import schemas from raddar.lib.managers.detect_secrets_manager import project_analysis router = APIRouter() @router.get( "/{p...
StarcoderdataPython
3448270
import ctypes; class iBaseType(object): @classmethod def fuGetSize(cSelf): return ctypes.sizeof(cSelf); @classmethod def foFromAddress(cSelf, uAddress): return cSelf.from_address(uAddress); @classmethod def foFromBytesString(cSelf, sData, uOffset = 0): return cSelf.from_buffer_copy(sDat...
StarcoderdataPython
23655
"""Returns words from the given paragraph which has been repeated most, incase of more than one words, latest most common word is returned. """ import string def mostCommonWord(paragraph: str) -> str: # translate function maps every punctuation in given string to white space words = paragraph.translate(st...
StarcoderdataPython
4918501
<reponame>ngduyanhece/ConvLab # Modified by Microsoft Corporation. # Licensed under the MIT license. ''' The memory module Contains different ways of storing an agents experiences and sampling from them ''' from .onpolicy import * from .prioritized import * # expose all the classes from .replay import *
StarcoderdataPython
3499729
# -*- coding: utf-8 -*- """Holds exceptions for the application.""" class NotFoundException(Exception): """An exception occurred when looking for some model entity.""" pass
StarcoderdataPython
5163805
import os from shutil import rmtree from dill.source import getsource from jinja2 import Environment, PackageLoader, contextfilter, Markup from fractal.core.utils.string import snake_to_camel, camel_to_snake env = Environment( loader=PackageLoader('fractal_generator', 'generator/templates'), ) from fractal_gene...
StarcoderdataPython
5199512
<filename>tests/test_utils.py import numpy as np import pytest from utils import rotate_all sq = 1/np.sqrt(2) testdata0 = [ (np.array([[0., 1.], [1., 0.], [0., -1.]], dtype=float), np.pi, np.array([[0., -1.], [-1., 0.], [0., 1.]], dtype=float)), (np.array([[0., 1.], [1., 0.], [0., -1.]], dtype=float), -...
StarcoderdataPython
12841111
<filename>tests/data23/recipe-577194.py class Thing(object): """A thing, does stuff.""" def __init__(self): self.special = "My special value!" def process(self, default=True): """Accept any argument with no special processing (except True).""" if default is True: # Notice I'm checki...
StarcoderdataPython
4851904
import json import os from dotenv import load_dotenv from flask import Flask, render_template, request, redirect, url_for, flash, abort, session from deta import Deta from flask_qrcode import QRcode import requests app = Flask(__name__) jdoodle_url = 'https://api.jdoodle.com/v1/execute' load_dotenv() @app.errorhandl...
StarcoderdataPython
3356223
import io import os import re import sys from setuptools import setup, Extension, Command MINIMUM_CYTHON_VERSION = '0.20' BASE_DIR = os.path.dirname(__file__) PY2 = sys.version_info[0] == 2 DEBUG = False # kludge; http://stackoverflow.com/a/37762853 try: CLANG = os.environ['CC'] == 'clang' except KeyError: CL...
StarcoderdataPython
3553101
<filename>tools/c7n_azure/c7n_azure/constants.py CONST_DOCKER_VERSION = 'DOCKER|microsoft/azure-functions-python3.6:v2.0.11933-alpha' CONST_FUNCTIONS_EXT_VERSION = 'beta'
StarcoderdataPython
9676124
<gh_stars>10-100 """Get update functions from ConfigDicts.""" from typing import Callable, Tuple import jax.numpy as jnp import kfac_ferminet_alpha import kfac_ferminet_alpha.optimizer as kfac_opt import optax from ml_collections import ConfigDict import vmcnet.mcmc.position_amplitude_core as pacore import vmcnet.phy...
StarcoderdataPython
3323958
<reponame>mpol/iis<filename>iis-3rdparty-madis/src/main/resources/eu/dnetlib/iis/3rdparty/scripts/madis/lib/jaydebeapi/__init__.py from dbapi2 import *
StarcoderdataPython
1800109
<filename>desafio2/get_message_id.py<gh_stars>0 import email, getpass, imaplib, os, sys detach_dir = '.' # directory where to save attachments (default: current) user = input("Enter your GMail username:") pwd = <PASSWORD>("Enter your password: ") def read_email(): try: # connecting to the gmail imap ser...
StarcoderdataPython
3446829
<filename>missatges/forms.py from ampadb.support import Forms from django import forms _MD_TEXT = 'Suporta <a href="/markdown">Markdown</a>' class ComposeForm(Forms.Form): a = forms.CharField(disabled=True, required=False) # pylint: disable=invalid-name assumpte = forms.CharField(max_length=80) missatge...
StarcoderdataPython
12818616
import logging import requests from collector_base import AbstractCommitCollector import pelorus # import urllib3 # urllib3.disable_warnings() class GiteaCommitCollector(AbstractCommitCollector): _prefix_pattern = "%s/api/v1/repos/" _defaultapi = "try.gitea.io/api/v1" _prefix = _prefix_pattern % _defa...
StarcoderdataPython
356431
<filename>biostar/recipes/management/commands/import.py import toml, json, os, io, base64 from django.core.management.base import BaseCommand from django.conf import settings from biostar.recipes.models import Analysis, Project, Data, image_path, Access from biostar.accounts.models import User, Profile from biostar.rec...
StarcoderdataPython
1724058
""" Make a program that identifies leap years. """ c = {'cl' : '\33[m', 'w' : '\33[1;37m'} from datetime import date year = int(input('Enter a year or 0 for current year.\n'.format())) leap_year = False if year == 0: year = date.today().year if (year % 4 == 0 and year % 100 != 0) or (year %400 == 0): leap_ye...
StarcoderdataPython
167412
from django import forms from django.contrib.auth.forms import UserCreationForm from .models import CustomUser CHARTS = ( ('Bar Chart', 'Individual Scores'), ('Line Chart', 'Academic Growth'), ('Scatterplot', 'Gender-wise Scores'), ) class CustomUserCreationForm(UserCreationForm): class Meta: ...
StarcoderdataPython
11358251
<filename>src/finitestate/firmware/schemas/schema_device_vulnerabilities.py import pyspark.sql.types device_vulnerabilities_schema = pyspark.sql.types.StructType([ pyspark.sql.types.StructField('aggregate_id', pyspark.sql.types.StringType()), pyspark.sql.types.StructField('brand_id', pyspark.sql.types.StringTy...
StarcoderdataPython
11340497
""" Django settings for ruenoor project. Generated by 'django-admin startproject' using Django 1.8.1. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build path...
StarcoderdataPython
8064711
<filename>sysinv/cgts-client/cgts-client/cgtsclient/v1/ptp_interface_shell.py ######################################################################## # # Copyright (c) 2021 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # ######################################################################## from ...
StarcoderdataPython
11225771
def extension(): return { 'functions': [ 'getCharacter' ], 'types': [ 'caracter' ] } def builtInTypesExtension(self, current_char): lexeme = None evaluation = None if(current_char == '\''): lexeme = self.getCaracter() ...
StarcoderdataPython
8012082
# Generated by Django 3.0.6 on 2020-05-17 23:25 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
StarcoderdataPython
1749521
<filename>src/garage/tf/models/categorical_cnn_model.py """Categorical CNN Model. A model represented by a Categorical distribution which is parameterized by a convolutional neural network (CNN) followed a multilayer perceptron (MLP). """ import tensorflow as tf from garage.tf.models.categorical_mlp_model imp...
StarcoderdataPython
5100613
#!/usr/bin/env python """ .. py:currentmodule:: FileFormat.Results.ElectronParameters .. moduleauthor:: <NAME> <<EMAIL>> MCXRay electron parameters results file. """ # Script information for the file. __author__ = "<NAME> (<EMAIL>)" __version__ = "" __date__ = "" __copyright__ = "Copyright (c) 2012 Hendri...
StarcoderdataPython
11241278
<reponame>gogasca/news_ml<filename>main/TextD.py """Class which represents text when performing texts tasks""" from api.version1_0.database import DbHelper from utils.reporting import Generator from services.nlp import utils as nlp_utils class TextD(object): """ Text Object to analyze """ def __init...
StarcoderdataPython
249307
<filename>2019/day13.py<gh_stars>0 import cv2 import numpy as np import queue import logging import copy import pickle from intcode import * GAME_SIZE = 40 GAME_SHAPE = (GAME_SIZE, GAME_SIZE) BLOCK_SIZE = 10 BLOCK_SHAPE = (BLOCK_SIZE, BLOCK_SIZE) EMPTY = np.zeros(BLOCK_SHAPE, dtype=np.uint8) WALL = np.ones(BLOCK_SHA...
StarcoderdataPython
3233454
""" Problem 6: Sum square difference https://projecteuler.net/problem=6 The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 552 = 3025 Hence the difference between the sum of the squares of the first ...
StarcoderdataPython
5001457
<filename>sendmsg/sendmsg.py import discord from cogs.utils import checks from discord.ext import commands class SendMsg: """Say stuff wherever. Owner only.""" def __init__(self, bot): self.bot = bot @checks.is_owner() @commands.command() async def sendmsg(self, destination: discord.Chan...
StarcoderdataPython
343312
<reponame>randylirano/WorkStation from django.db.utils import IntegrityError from rest_framework import generics, mixins, serializers from .models import Background, Workspace from .serializers import WorkspaceSerializer, BackgroundSerializer class WorkspaceListView( mixins.ListModelMixin, mixins.CreateModelMixi...
StarcoderdataPython