id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3280931
import os import re import subprocess import tempfile import uuid from pathlib import Path, PurePath import pkg_resources from grpc_tools.protoc import main as protoc from snet import snet_cli from common import utils from common.boto_utils import BotoUtils from utility.config import PROTO_DIRECTORY_REGEX_PATTERN, PR...
StarcoderdataPython
3377246
<reponame>PacktPublishing/ProgrammingAIBusinessApplications<gh_stars>10-100 import pandas as pd import matplotlib matplotlib.use('Agg') # for saving figures import matplotlib.pyplot as plt from sklearn.metrics import mean_squared_error series = pd.read_csv('daily-users.csv', header=0, parse_dates=[0], index_col=0, squ...
StarcoderdataPython
4803620
<filename>output/models/saxon_data/open/open040_xsd/__init__.py from output.models.saxon_data.open.open040_xsd.open040 import ( Alpha, Doc, ) from output.models.saxon_data.open.open040_xsd.open040x import Beta __all__ = [ "Alpha", "Doc", "Beta", ]
StarcoderdataPython
3257384
<gh_stars>0 ######### initial 8 hash values ########### initial_hash_values = [ '6a09e667', 'bb67ae85', '3c6ef372', 'a54ff53a', '510e527f', '9b05688c', '1f83d9ab', '5be0cd19' ] # 64 SHA-256 constants sha_256_constants = [ '428a2f98', '71374491', 'b5c0fbcf', 'e9b5dba5', '3956c25b', '59f111f1', '923f82a4...
StarcoderdataPython
1718771
<gh_stars>0 from analysis_script import KlinMikroTools run = KlinMikroTools() xl, sheetnames = run.load_excel("qlikview_fryslista_union.xlsx") keys, allData = run.load_data_excel(xl, "Sheet3", True) allAP = run.fix_AP(allData, 0, 2) for sheet in sheetnames: keys, data = run.load_data_excel(xl, ...
StarcoderdataPython
1658258
<gh_stars>1-10 import redis r=redis.Redis(password='<PASSWORD>') # 任务信息:任务类别_发送者_接受者_内容 task='%s_%s_%s_%s'%('sendMail','<EMAIL>','<EMAIL>','hello world') # 添加任务 r.lpush('pylk1',task)
StarcoderdataPython
1688132
import cv2 import glob, os import numpy as np import imutils import pytesseract import re import time import CSVHelper import multiprocessing import concurrent.futures as cf DEBUG = False def showIMG(mat, name, delay=0): if not DEBUG: return cv2.namedWindow(name, cv2.WINDOW_KEEPRATIO) cv2.imshow(n...
StarcoderdataPython
1656769
from mininet.topo import Topo from mininet.net import Mininet from mininet.log import setLogLevel from mininet.cli import CLI from mininet.node import OVSSwitch, Controller, RemoteController from time import sleep class MyTopo(Topo): "Single switch connected to n hosts." def build(self): s0 = self.ad...
StarcoderdataPython
3364295
import os import pandas as pd project_root = os.path.dirname(os.path.dirname(__file__)) csv_path = os.path.join(project_root, "Resources", "election_data.csv") ballots_df = pd.read_csv(csv_path) vote_count = ballots_df['Candidate'].value_counts() results_df = vote_count.to_frame(name = "votes") results_df['percentage...
StarcoderdataPython
164382
<filename>main.py import discord from discord.ext import commands, tasks import json import random from instagramy import * from instascrape import * import os import tweepy import nest_asyncio from dotenv import load_dotenv from sessID import * from wit import Wit load_dotenv() nest_asyncio.apply() t...
StarcoderdataPython
40412
<filename>metrics.py import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.functional import cross_entropy from torch.nn.modules.loss import _WeightedLoss EPSILON = 1e-32 class LogNLLLoss(_WeightedLoss): __constants__ = ['weight', 'reduction', 'ignore_index'] def __init__(self,...
StarcoderdataPython
3287742
from .generate_overland_flow_Bates import OverlandFlowBates from .generate_overland_flow_deAlmeida import OverlandFlow from .generate_overland_flow_implicit_kinwave import KinwaveImplicitOverlandFlow from .generate_overland_flow_kinwave import KinwaveOverlandFlowModel __all__ = [ "OverlandFlowBates", "Overland...
StarcoderdataPython
3392946
<gh_stars>0 # -------------- # Import packages import numpy as np import pandas as pd from scipy.stats import mode # code starts here bank= pd.read_csv(path, sep= ',') categorical_var= bank.select_dtypes(include= 'object') print("Categorical values-\n",categorical_var.head()) numerical_var= bank.select_dtypes(inc...
StarcoderdataPython
37660
<reponame>CodePuzzler/100-Days-Of-Code-Python<filename>Day18/turtle_dashed_line.py # Day18 of my 100DaysOfCode Challenge # Draw a dashed line using Turtle Graphics from turtle import Turtle, Screen groot = Turtle() for _ in range(15): groot.forward(10) groot.penup() groot.forward(10) groot.pendown() ...
StarcoderdataPython
1672724
<filename>0-notes/job-search/Cracking_the_Coding_Interview/C03StacksQueues/questions/3.1-question.py<gh_stars>0 # 3.1 Three in One # Describe how you could use a single array to implement three stacks.
StarcoderdataPython
100174
import pytest from typescript_python_boilerplate.exceptions import ValidationError from typescript_python_boilerplate.interoperability import validator def test_validate_jschatevent(): print(validator.error_handler) assert validator.validate( { 'type': 'message', 'localId': '3...
StarcoderdataPython
3376758
<reponame>pricklypear2013/Absolute-Zero-Wallet ELECTRUM_VERSION = "1.9.8" # version of the client package PROTOCOL_VERSION = '0.9' # protocol version requested NEW_SEED_VERSION = 6 # bip32 wallets OLD_SEED_VERSION = 4 # old electrum deterministic generation SEED_PREFIX = '01' # the hash of th...
StarcoderdataPython
37449
#!/usr/bin/env python from app import app app.run(host = '0.0.0.0', port = 8089, debug = True, threaded = False, processes = 1)
StarcoderdataPython
3378740
<gh_stars>0 tate = int(input("タテ:")) yoko = int(input("ヨコ:")) print("模様を入力してください(空白を入力して終了)") pList = None #パターンリストの初期化 max = 0 #模様の最大文字数 while True: pattern = input() if len(pattern) > 0: #模様が入力された場合の繰り返し処理 if pList == None: pList = [0] else: nowpList = [0] #模様一時保管用...
StarcoderdataPython
3259869
<reponame>chuckwondo/aws-lambda-typing #!/usr/bin/env python import sys if sys.version_info >= (3, 8): from typing import List, Optional, Set, TypedDict else: from typing import List, Optional, Set from typing_extensions import TypedDict class MQMessageDestination(TypedDict): """ MQMessageDesti...
StarcoderdataPython
1849
"""A pure Python implementation of import.""" __all__ = ['__import__', 'import_module', 'invalidate_caches'] # Bootstrap help ##################################################### # Until bootstrapping is complete, DO NOT import any modules that attempt # to import importlib._bootstrap (directly or indirectly)....
StarcoderdataPython
1799111
from abc import ABC, abstractmethod from typing import List class QubicObserver(ABC): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @abstractmethod def notify(self, qubic): raise NotImplementedError class QubicSubject(ABC): __observers: List[QubicObserver] def __init__(self, *arg...
StarcoderdataPython
1774371
<gh_stars>1-10 # -*- coding:UTF-8 -*- # # Tencent is pleased to support the open source community by making QTA available. # Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the BSD 3-Clause License (the "License"); you may not use this # file except in compliance with t...
StarcoderdataPython
4801998
""" Equivalencies between different kinds of units """ # ----------------------------------------------------------------------------- # Copyright (c) 2018, yt Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the LICENSE file, distributed with this software. # ...
StarcoderdataPython
1709111
<reponame>sjsafranek/django_wiki """wikiengine URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', ...
StarcoderdataPython
1760318
class Solution: # @param {integer} numCourses # @param {integer[][]} prerequisites # @return {boolean} def canFinish(self, numCourses, prerequisites): g = {v: [] for v in xrange(numCourses)} deg = {v: 0 for v in xrange(numCourses)} s = set(range(numCourses)) for u, v in ...
StarcoderdataPython
4820010
<filename>python-fundamentals/lambda_functions.py #!/usr/bin/python3 # -*- coding: utf-8 -*- def main(): pass # def devide(x,y): # return x / y # The same as above devide = lambda x, y: x / y ## Calling directly without name (lambda x, y: x / y)(15, 3) ## Calling directly without name and printing print((lambd...
StarcoderdataPython
97240
<reponame>glc12125/ML_for_trading<filename>01-02/slice_and_plot.py """Utility functions""" import os import pandas as pd import matplotlib.pyplot as plt def plot_selected(df, columns, start_index, end_index): """Plot the desired columns over index values in the given range.""" plot_data(df[start_index:end_in...
StarcoderdataPython
4829926
import io from pathlib import Path from textwrap import dedent import numpy as np import openpyxl import pandas as pd import pytest from pytest import fixture, raises try: from openpyxl.worksheet.worksheet import Worksheet except ImportError: # openpyxl < 2.6 from openpyxl.worksheet import Worksheet from o...
StarcoderdataPython
3272134
from .lims_internalStandards_postgresql_models import * from SBaaS_base.sbaas_base_query_update import sbaas_base_query_update from SBaaS_base.sbaas_base_query_drop import sbaas_base_query_drop from SBaaS_base.sbaas_base_query_initialize import sbaas_base_query_initialize from SBaaS_base.sbaas_base_query_insert import...
StarcoderdataPython
1744660
from tools.utils.platform import ICTYPE_2_MGDTYPE #========================================================================== def _invert_dict(dict_): bins = {} for key, value in dict_.items(): bin = bins.setdefault(value, []) bin.append(key) return bins def _choose_best_na...
StarcoderdataPython
122266
<reponame>mkmoisen/blog """ Pull script to promote code to stage or prod """ import argparse import subprocess import sys import logging import time from blog import db logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) parser = argparse.ArgumentParser() parser.add_argument("-e...
StarcoderdataPython
3277705
from django.conf import settings from django.http import JsonResponse import base64 from django.contrib.auth import get_user_model from django.contrib.auth import login from django.shortcuts import redirect User = get_user_model() def check_incoming_key(encoded): if not encoded: return False return ...
StarcoderdataPython
1766815
<reponame>minhman727/miao-nutrition-assistant from mongoengine import * from src.models.abstract_models.food_model import Food class SampleFood(Food): meta = { "db_alias": "miao", "collection": "sample_foods" }
StarcoderdataPython
1672855
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
StarcoderdataPython
3399799
#!/usr/bin/env python from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine Base = automap_base() engine = create_engine('postgresql://') Base.prepare(engine, reflect=True) if __name__ == '__main__': print(Base) print(dir(Base)) print(Base....
StarcoderdataPython
171206
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from . import ...
StarcoderdataPython
3215808
import os from datetime import datetime, timedelta import numpy def salishseacast_paths(timestart, timeend, path, filetype): """Generate paths for Salish Seacast forcing :arg timestart: date from when to start concatenating :type string: :py:class:'str' :arg timeend: date at which to stop concatena...
StarcoderdataPython
3243404
import subprocess import os import sys NUM_CPUS=64 NUM_CHIPLETS=8 GEM5_DIR="/home/grads/g/ginochacon/gem5_garnet2_CHIPS_sni" OUT_DIR="/home/grads/g/ginochacon/gem5_garnet2_CHIPS_sni/my_outdir/" EXE_PATH = "/home/grads/g/ginochacon/spec_test/benchspec/CPU2006/" args_in = sys.argv[1:] assert(len(args_in) > 0) print(s...
StarcoderdataPython
72157
<reponame>acid-chicken/tweet-generator from django.db import models from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager from django.contrib.auth.hashers import make_password from django.utils import timezone from django.utils.translation import gettext_lazy as _ class CustomUserManag...
StarcoderdataPython
119670
NAME = 'comic.py' ORIGINAL_AUTHORS = [ '<NAME>' ] ABOUT = ''' Returns a random comic from xkcd ''' COMMANDS = ''' >>> .comic returns a url of a random comic ''' WEBSITE = ''
StarcoderdataPython
1747841
#!/usr/bin/python import sys, os import os.path def create(isa,c,filename,lang): if os.path.isfile("template/"+c+".rkt"): filename = "template/"+c+".rkt" fin = open(filename,"r") fout = open(isa + "/" + isa + "-" + c + ".rkt","w") text = fin.read().replace("$-",isa+"-") ...
StarcoderdataPython
1633507
import collections import urllib.parse as urlparse Engine = collections.namedtuple("Engine", ["backend", "string_ports", "options"]) ENGINE_SCHEMES = {} def register(backend, schemes=None, string_ports=False, options=None): if schemes is None: schemes = [backend.rsplit(".")[-1]] elif isinstance(sche...
StarcoderdataPython
1794065
<gh_stars>1-10 import matplotlib.pyplot as plt def set_style(style='blackviz'): plt.rc('figure', facecolor='0.065', autolayout=False, dpi=120) plt.rc('axes', facecolor='0.125', edgecolor='w', grid=True, labelcolor='lightgrey', labelsize='large', prop_cycle=plt.cycler('color', ['deepskyblue', ...
StarcoderdataPython
3338839
from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import from __future__ import generators from __future__ import division import numpy as np from sklearn.datasets import load_boston from sklearn.preprocessing import maxabs_scale from oml.models.glm import L...
StarcoderdataPython
3244315
from __future__ import print_function # Python 2/3 compatibility import boto3 import json import decimal # Helper class to convert a DynamoDB item to JSON. class DecimalEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): if abs(o) % 1 > 0: return ...
StarcoderdataPython
3220130
<reponame>tabatahg/fun_with_regex from openpyxl import Workbook from openpyxl.utils import get_column_letter wb = Workbook() dest_filename = 'empty_book.xlsx' ws = wb.active ws1.title = "range names" for row in range(1, 40): ws1.append(range(600)) ws2 = wb.create_sheet(title="Pi") ws2['F5'] = 3.14 ws3 = wb.cre...
StarcoderdataPython
1605614
<filename>main.py from flask import Flask, render_template app = Flask(__name__) @app.route("/") @app.route('/home') def home_page(): return render_template('home.html', title='Home Page') @app.route('/about') def about(): return render_template('about.html', title='About Page')
StarcoderdataPython
130663
import os import shutil import pytest from jina.flow import Flow from jina.logging.profile import used_memory from jina.proto import jina_pb2 from tests import random_docs cur_dir = os.path.dirname(os.path.abspath(__file__)) @pytest.mark.parametrize('uses', ['binarypb.yml', 'shelfpb.yml']) def test_shelf_in_flow(u...
StarcoderdataPython
1655506
<reponame>shanaka-desoysa/tensorflow<gh_stars>0 # pylint: disable=invalid-name # Import tensorflow and other libraries. from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import matplotlib.pyplot as plt import numpy as np import math #...
StarcoderdataPython
3253152
# coding=utf-8 # Copyright 2021 Google LLC # # 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 ...
StarcoderdataPython
1648684
from cli import cli # Run the CLI utility when executing as '__main__'. if __name__ == "__main__": cli()
StarcoderdataPython
1697347
def print_common(): print("this is common")
StarcoderdataPython
1623183
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # OS.FreeBSD.get_vlans # --------------------------------------------------------------------- # Copyright (C) 2007-2011 The NOC Project # See LICENSE for details # -----------------------------------------------------------...
StarcoderdataPython
4815603
import numpy as np import networkx as nx import pylab as plt import pdb def tensor_mult(a, # n_1 x n_2 x ... x n_d tensor b, # m_{1} x m_{2} x ... x m_{l} tensor a_dims, # list of dimensions of a to broadcast multiply b_dims, # list of dimensions of b to broadcast multipl...
StarcoderdataPython
130580
<filename>Platforms/Twitch/commandindex.py from typing import Callable from Utils.Classes.storeclasses import GlobalStorage import Platforms.Twitch.const as TwitchConst from Platforms.Twitch.Processing.textonly import textOnly command_register:list = [ dict( name="Text dummy", function=textOnly, description="A...
StarcoderdataPython
3313458
def contour(left, right, max_offset=None, loffset=0, roffset=0, left_outer=None, right_outer=None): delta = left.x + loffset - (right.x + roffset) if not max_offset or delta > max_offset: max_offset = delta if not left_outer: ...
StarcoderdataPython
4822880
# # Copyright 2019 Google LLC # # 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 writing,...
StarcoderdataPython
187762
<filename>QLearning_for_Grid_World_Envs/visutils.py<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Sun May 3 18:25:59 2020 @author: RezaKakooee """ #%% import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from plot_environment import PlotEnvironment #%% def plot_obs_history(env...
StarcoderdataPython
1652188
<reponame>shhuan/algorithms # -*- coding: utf-8 -*- """ created by huash06 at 2015-04-16 15:14 Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given binary tree {3,9,20,#,#,15,7}, ...
StarcoderdataPython
3254705
<gh_stars>0 import lib_1D.audio_process as audioproc import lib.dct as dct import lib.idct as idct import lib.bloc_process as bp1 import lib.bloc_process2 as bp2 import lib.live_process as lp import lib.imgRW as irw import lib.tim_process as timproc import lib.basis_image as bigen import lib.Process_2D as P2D from math...
StarcoderdataPython
1717262
<reponame>pfotiad/MITTENS from .mrtrix3 import load_mif from .dsi_studio import load_fib, load_fixels_from_fib
StarcoderdataPython
120401
<reponame>UTokyo-ICEPP/multiml_htautau import torch import gpytorch from gpytorch.distributions import MultitaskMultivariateNormal class MultitaskGPModel(gpytorch.models.ApproximateGP): def __init__(self, inducing_points_num, input_dim, num_latents, num_tasks=8): # Let's use a different set of inducing po...
StarcoderdataPython
3254854
<reponame>google/ehr-predictions<gh_stars>10-100 # coding=utf-8 # Copyright 2021 Google Health Research. # # 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...
StarcoderdataPython
30522
import mimetypes from django.contrib.staticfiles.storage import staticfiles_storage from django.core import signing from django.forms import widgets from django.forms.utils import flatatt from django.utils.safestring import mark_safe from django.utils.html import format_html from django.utils.translation import ugette...
StarcoderdataPython
3289354
################################################################################ # Copyright (C) 2011-2016 <NAME> # # This file is licensed under the MIT License. ################################################################################ from . import utils from . import inference from . import nodes from . impo...
StarcoderdataPython
1782844
import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np from HyperSphere.dummy.plotting.get_data_from_file import get_data from HyperSphere.test_functions.mnist_weight import mnist_weight_baseline from HyperSphere.dummy.plotting.plot_color import algorithm_color def optimum_plot(fun...
StarcoderdataPython
1686057
<gh_stars>0 import pandas as pd import json def flatten_json(json_obj): ''' Flatten an abritary json structure to a 2D dataframe. Subdicts will be expanded to columns and lists will be expanded as rows. INPUT: - json_obj: List of dicts with json data OUTPUT: - df: Dataframe with normalized ...
StarcoderdataPython
39374
<filename>Algorithms/5_Searching/11.py # https://www.hackerrank.com/challenges/short-palindrome/problem #!/bin/python3 import math import os import random import re import sys # # Complete the 'shortPalindrome' function below. # # The function is expected to return an INTEGER. # The function accepts STRING s as para...
StarcoderdataPython
19678
import tensorflow as tf import numpy as np import unittest from dnc.controller import BaseController class DummyController(BaseController): def network_vars(self): self.W = tf.Variable(tf.truncated_normal([self.nn_input_size, 64])) self.b = tf.Variable(tf.zeros([64])) def network_op(self, X):...
StarcoderdataPython
81772
<gh_stars>1-10 from pyretic.lib.corelib import * from pyretic.core import packet from pyretic.lib.query import * ip_h1 = IPAddr('10.0.0.1') ip_h2 = IPAddr('10.0.0.2') ip_mon = IPAddr('10.0.0.3') ip_srv = IPAddr('10.0.0.4') ip_inet = IPAddr('10.0.0.5') def firewall(): # broadcast arp request and arp reply arp ...
StarcoderdataPython
119292
<filename>smartie/smart.py """ Higher level utilities for working with S.M.A.R.T. """ import enum import struct from dataclasses import dataclass, replace from typing import Optional from smartie.structures import SmartDataResponse class Units(enum.IntEnum): UNKNOWN = 0 CELSIUS = 10 MILLISECONDS = 20 ...
StarcoderdataPython
3341766
#Tipo Inteiro (int) #Ponto Flutuante ou Decimal (float) #Complexo (complex) #String (str) #Boolean (bool) #Listas (list) #Tuplas (tuple) #Dicionários (dict) idade = 18 ano = 2002 print(type(idade)) print(type(ano)) altura = 1.80 peso = 73.55 print(type(peso)) print(type(altura)) a = 5+2j b = 20+6j print(type(a)) ...
StarcoderdataPython
4811940
<filename>epynet/lazy_property.py def lazy_property(fn): '''Decorator that makes a property lazy-evaluated. ''' attr_name = fn.__name__ @property def _lazy_property(self): if attr_name not in self._values: self._values[attr_name] = fn(self) return self._values[attr_name]...
StarcoderdataPython
172023
#!/usr/bin/python # Get a list of error terms from the Vale rules and generate a correspoding asiidoc reference. import glob import os import re import shutil import wget, zipfile import git import yaml import json import sys def main(): try: #initialize some variables git_repo = git.Repo(os.pa...
StarcoderdataPython
23056
<reponame>b-cube/Response-Identification-Info import os import glob import json for f in glob.glob('/Users/sparky/Documents/solr_responses/solr_20150922_docs/*.json'): with open(f, 'r') as g: data = json.loads(g.read()) headers = data.get('response_headers', []) if not headers: continue ...
StarcoderdataPython
1675355
<reponame>angguss/ivy # ------------------------------------------------------------------------------ # This module contains the logic for the 'build' command. # ------------------------------------------------------------------------------ import os import sys from .. import site from .. import hooks from .. import...
StarcoderdataPython
4819188
<gh_stars>0 from typing import Optional, List from gtts import gTTS import os import requests import json from telegram import ChatAction from telegram.ext import run_async from Yone import dispatcher from Yone.Plugins.disable import DisableAbleCommandHandler from Yone.Handlers.alternate import typing_action, send_ac...
StarcoderdataPython
3207916
from __future__ import absolute_import, division, print_function from virtualenv.flavors.base import BaseFlavor class WindowsFlavor(BaseFlavor): def bin_dir(self, python_info): if python_info["is_pypy"]: return "bin" else: return "Scripts" python_bin = "python.exe" ...
StarcoderdataPython
1656087
def nextMove(m, grid): # find start node and end node. start_x, start_y = 0, 0 end_x, end_y = 0, 0 # the input x and y were reversed in Hackerrank puzzles. for i in range(m): for j in range(len(grid[i])): if grid[i][j] == "m": start_x = j star...
StarcoderdataPython
1606789
"""tf.tile(input, multm iples, name = None) 解释:这个函数的作用是通过给定的tensor去构造一个新的tensor。 所使用的方法是将input复制multiples次,输出的tensor的第i维有input.dims(i) * multiples[i]个元素, input中的元素被复制multiples[i]次。比如,input = [a b c d], multiples = [2], 那么tile(input, multiples) = [a b c d a b c d]。""" import tensorflow as tf sess = tf.Session() data =...
StarcoderdataPython
3330021
# -*- coding: utf-8 -*- # This file is generated from NI-DMM API metadata version 19.6.0d7 enums = { 'AdcCalibration': { 'values': [ { 'name': 'NIDMM_VAL_ADC_CALIBRATION_AUTO', 'value': -1 }, { 'name': 'NIDMM_VAL_ADC_CALIBRA...
StarcoderdataPython
20144
<reponame>zaibon/tcprouter from gevent import monkey; monkey.patch_all() import logging from gevent.server import StreamServer logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class Receiver(object): """ Interface for a receiver - mimics Twisted's protocols """ def __init__(s...
StarcoderdataPython
1707758
<gh_stars>1-10 # -*- coding: utf-8 -*- from django.contrib import admin from django.db import models from django.apps import apps from django.conf import settings from django.utils.translation import ugettext, ugettext_lazy as _ from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmi...
StarcoderdataPython
1680745
# -*- coding: utf-8 -*- ''' # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # # This file was generated and any changes will be overwritten. ''' from __future__ import unicode_literals from ..model.workbook_chart...
StarcoderdataPython
144444
<gh_stars>100-1000 from conans import ConanFile, tools, AutoToolsBuildEnvironment from conans.errors import ConanInvalidConfiguration import os class TinyAlsaConan(ConanFile): name = "tinyalsa" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.co...
StarcoderdataPython
138808
<gh_stars>10-100 import os import numpy as np # TODO(cpaxton): remove pygame from this #import pygame as pg from costar_task_plan.mcts import Node ''' loop over all MCTS scenarios - generate the scenarios you need to collect the data - create ''' def mctsLoop(env, policies, seed, save, animate, **kwargs): if ...
StarcoderdataPython
3208837
# Classification template # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('diabetes.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, 8].values #taking care of missing data from sklearn.preprocessing import Imputer...
StarcoderdataPython
134952
<filename>nipyapi/canvas.py # -*- coding: utf-8 -*- """ For interactions with the NiFi Canvas. """ from __future__ import absolute_import import logging import six import nipyapi __all__ = [ "get_root_pg_id", "recurse_flow", "get_flow", "get_process_group_status", "get_process_group", "list_all_process_group...
StarcoderdataPython
3674
<filename>mimesis/data/int/development.py """Provides all the data related to the development.""" LICENSES = [ "Apache License, 2.0 (Apache-2.0)", "The BSD 3-Clause License", "The BSD 2-Clause License", "GNU General Public License (GPL)", "General Public License (LGPL)", "MIT License (MIT)", ...
StarcoderdataPython
3274737
<reponame>jonathondilworth/ttds_cw_two_code import unittest from code.evallib import average_precision # TODO: abstract out QuerySet & Query class QuerySet(): def __init__(self, queries): self.queries = queries class Query(): def __init__(self, rel_docs, ret_docs, total_rel_docs=None): ...
StarcoderdataPython
4828080
from django.apps import apps from django.conf import settings from django.core.validators import MinValueValidator from django.db.models import ( Model, PositiveSmallIntegerField, TextField, FloatField, ForeignKey, OneToOneField, ManyToManyField, BooleanField, DateTimeField, QuerySet, Max, Sum, F, SET_NULL...
StarcoderdataPython
3274759
<reponame>fergusdixon/fastapi-example<gh_stars>0 from behave import fixture from fastapi.testclient import TestClient from app.main import app # -- FIXTURE: Use generator-function @fixture def test_client(context, timeout=30, **kwargs): with TestClient(app) as c: yield c
StarcoderdataPython
1763380
<gh_stars>0 from django.db import models # Create your models here. class approvals(models.Model): sct=models.CharField(max_length=15) capitaux_propres=models.FloatField(default=0) passifs_non_courant=models.FloatField(default=0) total_bilan=models.FloatField(default=0) stock=models.FloatField(defa...
StarcoderdataPython
3201483
from ivy import ivy_module as im from ivy.ivy_compiler import ivy_from_string from ivy.tk_ui import new_ui from ivy import ivy_utils as iu prog = """#lang ivy1.5 object obj = { type t } relation r(X:obj.t) action a(x:obj.t) = { local y:obj.t { if some z:s. z = z { y := y } } } type s axiom forall X:s. ...
StarcoderdataPython
3825
# Copyright (c) 2016 Ansible, Inc. # All Rights Reserved. from collections import OrderedDict # Django from django.core.exceptions import PermissionDenied from django.db.models.fields import PositiveIntegerField, BooleanField from django.db.models.fields.related import ForeignKey from django.http import Http404 from ...
StarcoderdataPython
1702358
if +1 + 1 + 2 == 4: # true pass
StarcoderdataPython
4820607
<filename>Helper.py class Switch(object): value = None def __new__(cls, *args, **kwargs): cls.value = args[0] return True def case(*args): return any((arg == Switch.value for arg in args))
StarcoderdataPython
191543
<gh_stars>1-10 # ----------------------------------------------# # hqs.bot © # # by phillip.hqs ∫ Thanks to alphaSnosh # # ----------------------------------------------# from library.cog_info import colors """Not available error""" na_title = 'Sorry...' na_description = 'Th...
StarcoderdataPython
4831239
import os import reframe as rfm import reframe.utility.sanity as sn class LAMMPSBaseCheck(rfm.RunOnlyRegressionTest): def __init__(self): super().__init__() self.valid_prog_environs = ['PrgEnv-gnu'] self.modules = ['LAMMPS'] # Reset sources dir relative to the SCS apps prefix ...
StarcoderdataPython