id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
278660
<reponame>rmulumba/nairobi_ambulance_location import train_kmeans import predictions """ Training the ML model and making predictions. """ if __name__ == "__main__": train_kmeans.train() predictions.create_prediction_file()
StarcoderdataPython
6660059
<filename>tests/integration/routes/test_slash_command.py import json from typing import Dict, Any # noqa: F401 from unittest.mock import MagicMock from flask import Response # noqa: F401 from werkzeug.test import Client from tests.data import get_mock_data from tests.integration.routes import get_test_bot _ENDPOIN...
StarcoderdataPython
11312136
import networkx as nx import matplotlib.pyplot as plt from networkx.algorithms import bipartite try: from AlgorithmSolver.Node import Node except Exception as e: from .Node import Node currUser = Node('Ego_Node', 'SOURCE', '0','0','0','0',[]) def hierarchy_pos(G, root, width=1., vert_gap = 0.2, vert_loc = 0, ...
StarcoderdataPython
6569360
<gh_stars>0 """ Runs a series of moves on a quantum chess board then displays the result. Run with: python -m recirq.quantum_chess.experiments.batch_moves \ FILENAME --processor_name=PROCESSOR_NAME \ --position=FEN FILENAME is a filename with moves in the move format described by recirq.quantum_chess.mo...
StarcoderdataPython
4902038
<reponame>pw0908/RMG-Py #!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # # # RMG - Reaction Mechanism Generator # # ...
StarcoderdataPython
44254
<reponame>AllenJSebastian/tripleo-common # Copyright 2016 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
StarcoderdataPython
6587514
Mullins_2006 = { "a_eff" : 7.5, "r_av" : 0.81764, "f_decay" : 1.0, "c_hb" : 85580.0, "sigma_hb" : 0.0084, "q_0" : 79.53, "r_0" : 66.69, "z" : 10, "alpha_prime" : 16466.72 } Saidi_2002 = { "a_eff" : 6.22, "f_decay" : 3.57, "c_hb" : 42790.0, "sigma_hb" : 0.00764, "q_0" : 79.53, "r_0" : 66...
StarcoderdataPython
3304468
# Authors: <NAME> # License: BSD 3 Clause """ PyMF CUR-like Sparse Column Based Matrix Reconstruction via Greedy Approximation[1] GREEDYCUR: class for CUR-like decompositions using the GREEDY[2] algorithm. [1] <NAME>., <NAME>. and <NAME>. (2006), 'Fast Monte Carlo Algorithms III: Computing a Compressed Approixmat...
StarcoderdataPython
1793258
<reponame>vishwas-21/Project-Euler import time start = time.time() # p(n) = p(n - 1) + p(n - 2) - p(n - 5) - p(n - 7) ... where 1, 2, 5, 7 are pentagonal numbers arr = [1, 1] n = 2 MOD = 1000_000 while True: i = 1 k = 1 pa = 0 while True: a = (3 * i * i - i) // 2 b = (3 * i * i + i) // ...
StarcoderdataPython
1641475
import sys from pathlib import Path botlistbot_path = str((Path(__file__).parent.parent / "botlistbot").absolute()) sys.path.append(botlistbot_path) from pprint import pprint from peewee import Proxy from playhouse.db_url import connect from playhouse.migrate import PostgresqlMigrator import appglobals from models...
StarcoderdataPython
5000393
# -*- coding: utf-8 -*- # # Author: <NAME>, Finland 2015-2017 # # This file is part of Kunquat. # # CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/ # # To the extent possible under law, Kunquat Affirmers have waived all # copyright and related or neighboring rights to Kunquat. # from .procparams ...
StarcoderdataPython
8108815
""" Module for notifications via Twilio .. versionadded:: 2014.7.0 :depends: - twilio python module :configuration: Configure this module by specifying the name of a configuration profile in the minion config, minion pillar, or master config (with :conf_master:`pillar_opts` set to True). .. warning: Settin...
StarcoderdataPython
237871
from intent_parser.intent_parser import IntentParser from intent_parser.lab_experiment import LabExperiment import logging class IntentParserFactory(object): """ Creator for Intent Parser """ logger = logging.getLogger('intent_parser') def __init__(self, datacatalog_config, sbh, sbol_dictionary):...
StarcoderdataPython
3521769
<reponame>unbrokenguy/machine_learning<filename>kNN/main.py from collections import Counter from dataclasses import dataclass from enum import Enum from typing import Tuple import numpy as np import pygame import random from scipy.stats import mode N = 3 R = 4 FPS = 5 POINTS_NUMBER = 10 MIN_NEIGHBOURS...
StarcoderdataPython
8041418
#!/usr/bin/env python """Glide Usage: glide.py show-projects glide.py create-project <project_name> glide.py select-project <project_name> glide.py show-themes glide.py show-layouts <theme_name> glide.py show-pages glide.py create-page <page_name> <theme_name> <layout_name> glide.py build glide.py t...
StarcoderdataPython
320655
<filename>DS_str_method.py ''' Description : Data Structure Using String Method Function Date : 07 Feb 2021 Function Author : <NAME> Input : str Output : str ''' # This is a string object name = 'prasad' if name.startswith('pra'): print ('Yes, the string starts ...
StarcoderdataPython
1934449
import itertools from problems import mymath def solve(): digits_sorted = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] permutations = itertools.permutations(digits_sorted) correct_products = set() for digit_string in permutations: for i in range(1, 5): if int(''.join(digit_str...
StarcoderdataPython
9630750
<reponame>cedricraud/rdr2-photomode-extractor import os import errno # You might need to adjust this path depending on your locale dir = os.path.expanduser('~') + "\Documents\Rockstar Games\Red Dead Redemption 2\Profiles" print("Opening %s" % dir) def mkdir_p(path): try: os.makedirs(path) except OSErr...
StarcoderdataPython
165143
from odoo.tests.common import TransactionCase class TestProductTemplate(TransactionCase): def test_name_search(self): partner = self.env['res.partner'].create({ 'name': 'Azure Interior', }) seller = self.env['product.supplierinfo'].create({ 'name': partner.id, 'price': 1...
StarcoderdataPython
5171730
<gh_stars>0 import sys from PyQt5 import QtWidgets, uic from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5 import QtGui, QtCore import PyQt5 import numpy as np import cv2 import qimage2ndarray import pyqtgraph as pg from Porosity import findSectionMask, porosityBasic class MainWindow(QMainWindow): ...
StarcoderdataPython
1998404
<gh_stars>1-10 import pip import unittest import sys import io # Optional imports try: import IPython except ImportError: IPython = False from SimPEG import Versions class TestVersion(unittest.TestCase): def catch_version_stdout(self, *args, **kwargs): # Check the default stdout = sys....
StarcoderdataPython
9667915
# coding: utf-8 from datetime import datetime, timedelta from re import compile from openerp import SUPERUSER_ID from openerp.osv import fields, osv from documentos_discente import _MESES class Registro(osv.Model): _name = "ud.monitoria.registro" _description = u"Modelo de configuração e registro de semestr...
StarcoderdataPython
335035
import torch from bert_seq2seq import load_gpt from transformers import AutoTokenizer device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model_path = "./state_dict/gpt_auto_story.bin" if __name__ == "__main__": tokenizer = AutoTokenizer.from_pretrained("pranavpsv/gpt2-genre-story-generator") ...
StarcoderdataPython
8094117
<filename>tests/lit.py # -*- coding: utf-8 -*- from tests import HangulizeTestCase from hangulize.langs.lit import Lithuanian class LithuanianTestCase(HangulizeTestCase): lang = Lithuanian() def test_people(self): self.assert_examples({ '<NAME>us': '발다스 아담쿠스', 'Virgilijus Ale...
StarcoderdataPython
3476981
<filename>homeworks/01/problem6.py import cv2 as cv img = cv.imread('data/pic2.jpg') cv.imshow('Original', img) cv.rectangle(img, (10, 10), (600, 600), (0, 165, 255), thickness = 2) cv.imshow('Changed', img) cv.waitKey(0)
StarcoderdataPython
6413354
from data import expb, ballots, expb_incountry # TODO: replace this one liner with a readable code missing_from_ballots = [i for i in range(len(expb)) if expb['סמל ישוב'][i] != 99999 and not any((ballots['סמל קלפי'] == expb['מספר קלפי'][i]) [(ballots['סמל ישוב בחירות'] == expb['סמל ישוב'][i])])] if len(missing_...
StarcoderdataPython
329168
from rest_framework import routers from .api import BusinessViewSet router = routers.DefaultRouter() router.register('api/businesses', BusinessViewSet, 'businesses') urlpatterns = router.urls
StarcoderdataPython
9738458
<reponame>SuviVappula/tilavarauspalvelu-core<gh_stars>0 # Generated by Django 3.1.13 on 2022-01-17 13:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('reservations', '0025_fix_reservee_id_verbose_name'), ] operations = [ migrations.Ad...
StarcoderdataPython
6570940
#!/usr/bin/env python #-*- coding: utf-8 -*- # # Modules to import # import csv, json # # Custom functions # def nbSyllables(word, sep): """ Counts the number of syllables in a word @param String word: the word @param String sep: the separator to use """ return len(word.split(s...
StarcoderdataPython
9712843
# Copyright (c) 2022. 3Docx.org, see the LICENSE. import logging import pytest LOGGER = logging.getLogger(__name__) @pytest.fixture(scope='function') def example_fixture(): LOGGER.info("Setting Up Example Fixture...") yield LOGGER.info("Tearing Down Example Fixture...")
StarcoderdataPython
4949629
import discord blank = '<:black:588903518912380939>' red = '<:red:588903539926106112>' yellow = '<:yellow:588903561149153280>' height = 6 width = 7 class c4game: def __init__(self): self.currentPiece = red self.cols = [[blank]*height for i in range(width)] def place(self, col): ...
StarcoderdataPython
4829293
<reponame>3vivekb/hail import argparse import hail as hl parser = argparse.ArgumentParser() parser.add_argument('-v', required=True, choices=['150', '151'], help='dbSNP build to load.') parser.add_argument('-b', required=True, choices=['GRCh37', 'GRCh38'], help='Reference genome build to load.') args = parser.parse_a...
StarcoderdataPython
4867274
<reponame>nane121/HacktoberFest2020 def display_board(board): print("\n"*100) #to clear the board before every move print(board[7],'|',board[8],'|',board[9]) print("--+---+--") print(board[4],'|',board[5],'|',board[6]) print("--+---+--") print(board[1],'|',board[2],'|',board[3]) def ...
StarcoderdataPython
9763078
<gh_stars>1-10 """RAML (REST API Markup Language) errors.""" __all__ = 'ApiError RequestError ParameterError AuthError'.split() class ApiError(Exception): default_status = 500 def __init__(self, message, *args, **data): self.args = args self.data = data self.status = data.get('status'...
StarcoderdataPython
6523583
<gh_stars>1-10 import hashlib import numpy as np import tfsnippet as spt from .base import StandardImageDataSet, registry __all__ = ['load_static_mnist', 'StaticMNISTDataSet'] TRAIN_URI = 'http://www.cs.toronto.edu/~larocheh/public/datasets/' \ 'binarized_mnist/binarized_mnist_train.amat' TRAIN_MD5 = '...
StarcoderdataPython
9718868
# # A wrapper script that trains the SELDnet. The training stops when the SELD error (check paper) stops improving. # import os import sys import numpy as np import matplotlib.pyplot as plot import cls_data_generator import evaluation_metrics import keras_model import parameter import utils import time import datetime...
StarcoderdataPython
5032155
<filename>config/gunicorn.py # Gunicorn configuration file. import os from dotenv import load_dotenv from pathlib import Path import multiprocessing BASE_DIR = Path('.').resolve() ENV_PATH = BASE_DIR.joinpath('.env') load_dotenv(dotenv_path=ENV_PATH) bind = os.getenv('APP_HOST') + ":" + os.getenv('APP_PORT') backl...
StarcoderdataPython
1937077
''' Copyright (c) 2020-21, NVIDIA CORPORATION. All rights reserved. NVIDIA CORPORATION and its licensors retain all intellectual property and proprietary rights in and to this software, related documentation and any modifications thereto. Any use, reproduction, disclosure or distribution of this software and related d...
StarcoderdataPython
4815753
# -*- coding: utf-8 -*- from __future__ import absolute_import from ..base import BaseCommand import telegram class SlapCommand(BaseCommand): def get_description(self): return "I smell fish..." def run(self, messageObj, config): self.send_message( chat_id=messageObj.get('chat').ge...
StarcoderdataPython
3477595
__author__ = 'sdeni' from threading import Event from HomeExplorerEngine.WSController.motor import Motor from WSController.common_consts import * class EngineController(object): def __init__(self): self.action_event = Event() self.motor_ahead_left = Motor(PIN_AHEAD_LEFT_FORWARD, PIN_AHEAD_LEFT_B...
StarcoderdataPython
1855023
import sys import os import numpy as np from torch.utils.data import DataLoader import random import pickle import copy sys.path.append(os.path.dirname(os.path.dirname(os.getcwd()))) from robustness.timeseries_robust import timeseries_robustness from robustness.tabular_robust import tabular_robustness from tqdm import ...
StarcoderdataPython
1660256
import os.path as osp import numpy as np import torch import torch.nn.functional as F from model.trainer.base import Trainer from model.trainer.SnaTCHer_helpers import ( get_dataloader, prepare_model, ) from model.utils import ( count_acc, ) from tqdm import tqdm from sklearn.metrics import roc_curve, roc_auc...
StarcoderdataPython
5086045
# Elaborar um programa que leia seis elementos (valores inteiros) para as matrizes A e B de uma dimensão do tipo vetor. Construir as matrizes C e D de mesmo tipo e dimensão. A matriz C deve ser formada pelos elementos de índice ímpar das matrizes A e B e a matriz D deve ser formada pelos elementos de índice par das ma...
StarcoderdataPython
6452908
import discord from discord.ext import commands from wwbot.game_phase import game_phase, set_game_phase, GamePhases from wwbot.permissions import chk_gamemaster, chk_gm_channel from wwbot.db import Player from wwbot.util import fetch_guild from wwbot.config import conf from wwbot.roles import everyone_has_a_role clas...
StarcoderdataPython
110031
<reponame>saqib-i5/dsmp-pre-work # -------------- # Code starts here class_1 = ['<NAME>' , '<NAME>' , '<NAME>' , '<NAME>'] class_2 = ['<NAME>' , '<NAME>' , '<NAME>'] new_class = class_1+class_2 print(new_class) new_class.append('<NAME>') print(new_class) new_class.remove('<NAME>') print(new_class) # Code ends here ...
StarcoderdataPython
168985
<reponame>andrewmilas10/courier-python<filename>tests/test_automations.py import json import responses import pytest from os import environ from trycourier.client import Courier from trycourier.exceptions import CourierAPIException @responses.activate def test_success_invoke(): responses.add( responses.PO...
StarcoderdataPython
11209820
""" Author = "<NAME>" This class builds upon the abstract processor. It takes two data frames and adds the rows behind each other. This is used here the add all the single rows together to then run the SingleColumnAdder.py only once. It would be better if this function could take more than two data frames and concat b...
StarcoderdataPython
1683510
<filename>Numbers/factorial_of_a_number.py '''Program to find the factorial of a number using recursion''' #Taking number from user and finding its factorial using loop n = int(input()) fact=1 for i in range(1,n+1): fact*=i print(fact)
StarcoderdataPython
6550999
import os from os import path, mkdir, remove import requests from zipfile import ZipFile class download_dataset: '''This class is used to download and prepare (unzip) codeneuro dataset. The methods are loosly based on download util module created by <NAME>: https://github.com/alexklibisz ''' ...
StarcoderdataPython
5164711
import sys import os # os.chdir(os.path.join(os.getenv('HOME'), 'RAFT')) sys.path.append('./core') import argparse import cv2 import glob import numpy as np import torch from PIL import Image from raft import RAFT from utils.utils import InputPadder import yaml def file_path(string): if os.path.isfile(string): ...
StarcoderdataPython
6434762
<filename>setup.py # -*- coding: utf-8 -*- from setuptools import setup with open('README.rst', 'r') as fh: text = fh.read() setup( name='frozenobj', description='Get a python_frozen reference to an object.', long_description=text, url='https://github.com/mverleg/python_frozen', author='<NAME>', maintainer=...
StarcoderdataPython
11313476
<reponame>Daetalus/Algorithms #!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import division from __future__ import unicode_literals from __future__ import print_function aux = list() # Classical merge sort def merge(list_a, low, mid, high): i = low j = mid + 1 for k in range(low, high): ...
StarcoderdataPython
3544434
<reponame>nicholas-moreles/blaspy """ Copyright (c) 2014-2015-2015, The University of Texas at Austin. All rights reserved. This file is part of BLASpy and is available under the 3-Clause BSD License, which can be found in the LICENSE file at the top-level directory or at http://opensource.org/lic...
StarcoderdataPython
3498721
<reponame>Vectopia/Projects """ Feel free to add more test classes and/or tests that are not provided by the skeleton code! Make sure you follow these naming conventions: https://docs.pytest.org/en/reorganize-docs/goodpractices.html#test-discovery for your new tests/classes/python files or else they might be skipped. "...
StarcoderdataPython
9785948
<filename>plotting_code/plot_line_data.py ''' Plot theory HI lines along with their corresponding observed data run script from radio-z/plotting_scripts data comes from root_dir plots go into plot_dir ''' import numpy as np import pandas as pd from matplotlib import pyplot as plt from matplotlib import rc import pdb ...
StarcoderdataPython
8126423
import logging, os, csv from .component_contribution_trainer import ComponentContribution from .thermodynamic_constants import default_T if not os.path.isdir('res'): os.mkdir('res') OUTPUT_CSV = 'res/cc_compounds.csv' if __name__ == '__main__': logger = logging.getLogger('') logger.setLevel(logging.DEBUG...
StarcoderdataPython
9711011
#!/usr/bin/env python import unittest import shrapy.html_generation as html class TestHtmlGeneration(unittest.TestCase): def test_simple_person_schema(self): schema = { 'title': 'Superhero Registration Act', 'description': 'All super-powered individuals are required to surrender th...
StarcoderdataPython
4824520
<reponame>v-Ajnava/azure-sdk-for-python # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft...
StarcoderdataPython
5006979
<gh_stars>1-10 """ Parses the native debian sources format into panbuild's project format. """ import json # import os import fileinput if __name__ == '__main__': source_packages = {} current_package_name = "" current_package = {} for line in fileinput.input(): line_parts = line.split(':') ...
StarcoderdataPython
9717383
# -*- coding: utf-8 -*- """ /*************************************************************************** MapMd Utility Class. A QGIS plugin This plugin uses Map.md API. Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ ---------...
StarcoderdataPython
8081356
<filename>0.3.7/src/mfccCooker.py from MFCC import mfcc from os.path import join,split from glob import glob from SignalProcessor import Signal MAIN_DIR = '../' WAVE_FOLDER = MAIN_DIR + 'wav/' COOKED_FOLDER = WAVE_FOLDER + 'single-cooked/' MFCC_DIR = MAIN_DIR + 'mfcc/single/' def cook(): for wavfilename in glob(...
StarcoderdataPython
6612423
from tests.utils.git_test import AbstractGitReposTest import mock from gifi.command import CommandException from gifi.utils.configuration import Configuration, configuration_command class ConfigurationTest(AbstractGitReposTest): def test_happy_path(self): config = self._create_test_config() asser...
StarcoderdataPython
223856
import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg import pickle # Read in an image and grayscale it image = mpimg.imread('signs_vehicles_xygrad.png') # Define a function that applies Sobel x or y, # then takes an absolute value and applies a threshold. # Note: calling yo...
StarcoderdataPython
9728467
<reponame>16pierre/azure-sdk-for-python # coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ----------------------------...
StarcoderdataPython
195008
<gh_stars>10-100 # -*- coding: utf-8 -*- import numpy as np def kron_N(x): """ Computes N = N_1 x N_2 x ... x N_D i.e. the total number of rows in a kronecker matrix Parameters ---------- x : :class:`numpy.ndarray` An array of arrays holding matrices/vectors [x1, x2, ..., xD] R...
StarcoderdataPython
37400
<reponame>schallerdavid/perses import os import pytest import unittest from perses.rjmc.atom_mapping import AtomMapper, AtomMapping, InvalidMappingException from openff.toolkit.topology import Molecule ################################################################################ # LOGGER ##########################...
StarcoderdataPython
6498956
# Copyright (c) 2019 The Regents of the University of Michigan # All rights reserved. # This software is licensed under the BSD 3-Clause License. import os from setuptools import find_packages, setup requirements = [ "flask>=1.0", "flask-assets>=2.0", "flask-turbolinks", "jsmin", "libsass", "n...
StarcoderdataPython
6558522
#!/usr/bin/env python import rospy import os from autorace_challenge_1.srv import * rospy.init_node('autorace_command') def client_request(cmd): rospy.wait_for_service('/autorace/command') try: f=rospy.ServiceProxy('/autorace/command',TurtlebotCommand) resp=f(cmd) return resp.back except rospy.ServiceProxy as ...
StarcoderdataPython
266187
# $Id$ # # Copyright (C) 2000-2008 <NAME> and Rational Discovery LLC # All Rights Reserved # """ code for dealing with Bayesian composite models For a model to be useable here, it should support the following API: - _ClassifyExample(example)_, returns a classification Other compatibility notes: 1) To use _Co...
StarcoderdataPython
9755907
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 import re import time from pages.page import Page from framework.utils.data_fetcher import * from pages.projectdatasenderspage.project_data_senders_page import ProjectDataSendersPage from pages.projectoverviewpage.project_overview_locator import DATASENDERS_TAB from pages.su...
StarcoderdataPython
3412239
import pytest import os from turf.helpers import line_string, feature_collection from turf.invariant import get_coords_from_features from turf.rhumb_destination import rhumb_destination from turf.utils.error_codes import error_code_messages from turf.utils.exceptions import InvalidInput from turf.utils.test_setup imp...
StarcoderdataPython
6549023
''' @Author: dengzaiyong @Date: 2021-08-21 15:16:08 @LastEditTime: 2021-08-27 19:37:08 @LastEditors: dengzaiyong @Desciption: 使用hnswlib训练hnsw模型 @FilePath: /JDQA/retrieval/hnsw_hnswlib.py ''' import os import numpy as np import pandas as pd from gensim.models import KeyedVectors import hnswlib import config from prepro...
StarcoderdataPython
6642460
a = int(input()) b = int(input()) print(*[i for i in range(a, b + 1)])
StarcoderdataPython
392502
<gh_stars>1-10 # -*- coding: utf-8 -*- from numpy import NaN as npNaN from pandas import concat, DataFrame, Series from pandas_ta.utils import get_drift, get_offset, verify_series, signals def rsx(close, length=None, drift=None, offset=None, **kwargs): """Indicator: Relative Strength Xtra (inspired by Jurik RSX)"...
StarcoderdataPython
3296609
<reponame>bergran/pokemon_project_example from django.db import models class Team(models.Model): name = models.CharField(max_length=100, db_index=True) user = models.ForeignKey( "auth.User", on_delete=models.CASCADE, related_name="teams" ) pokemon = models.ManyToManyField( "pokemon.Po...
StarcoderdataPython
11369512
#!/usr/bin/env python3 """ abstraction of a boolean enumeration problem. such problems are meant to get a single character's value in a blind system such as a blind SQLi injection. * wanted_data_coordinates is a tuple defining the /coordinates/ of data we want (bound to implementation of the connector). For example ...
StarcoderdataPython
5174945
import os from jinja2 import Template from flask import jsonify, render_template, make_response, send_from_directory, url_for, Response from app.api import bp from app.api import tq_ip import json @bp.route('/ping', methods=['GET']) def ping(): return jsonify('Pong!') @bp.route('/vars', methods=['GET']) def t...
StarcoderdataPython
6642795
<reponame>thermalpilot/opennero """ This is a sample template for the log config file. Copy this file to 'logConfig.py' to have the system recognize your default logging type specifications. """ # This variable specifies which typed log messages that the client should listen to and report ignore_types = [] # a...
StarcoderdataPython
4808965
<reponame>dael-victoria-reyes/data-act-broker-backend import logging import unicodedata from urllib.parse import urlparse from suds import sudsobject from suds.client import Client from suds.plugin import MessagePlugin from suds.transport.https import HttpAuthenticated from suds.xsd import doctor from dataactcore.con...
StarcoderdataPython
9711745
<filename>docs/rips/generated/generated_classes.py<gh_stars>1-10 from rips.pdmobject import PdmObjectBase class CellFilterCollection(PdmObjectBase): """ Attributes: active (str): Active """ __custom_init__ = None #: Assign a custom init routine to be run at __init__ def __init__(self, pb2_o...
StarcoderdataPython
1827465
<reponame>gustavocidornelas/fused-multimodal-emotion ################################## # Paths ################################## data_path = '../data/processed-data/' ################################## # General ################################## num_categories = 4 ################################## # Training ####...
StarcoderdataPython
11376780
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 10 13:11:27 2020 @author: hamishgibbs """ import graph_tool as gt import numpy as np import pandas as pd from graph_tool import inference as gti import igraph as ig import leidenalg from infomap import Infomap def od_df(df): df = df.loc[...
StarcoderdataPython
8045903
import pytest from parler.utils.context import switch_language from notifications.models import NotificationType, NotificationTemplate, render_notification_template @pytest.fixture(scope='function') def notification_type(): setattr(NotificationType, 'TEST', 'test') yield NotificationType.TEST delattr(Not...
StarcoderdataPython
6614530
from flask import Flask from marshmallow import Schema, fields, pre_load, validate from flask_marshmallow import Marshmallow from sqlalchemy import UniqueConstraint from flask_sqlalchemy import SQLAlchemy ma = Marshmallow() db = SQLAlchemy() class Client(db.Model): __tablename__ = 'clients' id = db.Column(d...
StarcoderdataPython
3279975
# -*- coding: utf-8 -*- import csv import os import platform import codecs import re import sys from datetime import datetime import pytest import numpy as np from pandas._libs.lib import Timestamp import pandas as pd import pandas.util.testing as tm from pandas import DataFrame, Series, Index, MultiIndex from pand...
StarcoderdataPython
80423
#!/usr/bin/env python # Copyright 2016 Attic Labs, Inc. All rights reserved. # Licensed under the Apache License, version 2.0: # http://www.apache.org/licenses/LICENSE-2.0 # This tool updates the npm version of @attic/noms, @attic/eslintrc, etc in all package.json files. # # Run this whenever the version of an npm pa...
StarcoderdataPython
3329846
# DeleteObject use to delete things in the maya render # It has front delete and end delete import maya.cmds as cmds # Usage:DeleteObject.frontDelete('Set') # Usage:DeleteObject.frontDelete('tx2') def frontDelete(info): #SetList = cmds.ls('*Set') SetList = cmds.ls('*'+str(info)) if len(SetList) > 0: ...
StarcoderdataPython
6555129
import array as arr numarr = arr.array('i',[10,20,30,40,50,60,70,80]) print(numarr[3:6]) # 4th to 6th print(numarr[:-3]) #beginning to 5th print(numarr[3:]) #4th to end print(numarr[:]) #beginning to end
StarcoderdataPython
47046
<gh_stars>1-10 import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import csv, os, argparse def parser(): parser = argparse.ArgumentParser(description='Extract max region from irradiance image') parser.add_argument('fname', help='Input file name') parser.add_argume...
StarcoderdataPython
6703362
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import dace import numpy as np @dace.program def simple_array_conversion(A: dace.int32[10]): return dace.int64(A) def test_simple_array_conversion(): A = np.random.randint(0, 1000, size=(10, ), dtype=np.int32) B = simple_array_c...
StarcoderdataPython
11389799
syntax = "Packages/JavaScript/JavaScript.tmLanguage" def test_basic_block_opening(helper): "Test that empty doc blocks are created" helper.insert('/**') helper.run() return [ "/**", " * |", " */" ] def test_basic_function(helper): "Test that function template is added"...
StarcoderdataPython
212614
import os import KratosMultiphysics as Kratos import KratosMultiphysics.DEMApplication as Dem from KratosMultiphysics.DEMApplication.DEM_analysis_stage import DEMAnalysisStage class StructuresCoupledDEMAnalysisStage(DEMAnalysisStage): def __init__(self, model,parameters): super(StructuresCoupledDEMAnalys...
StarcoderdataPython
4844592
from bge import logic def main(cont): own = cont.owner own.linearVelocity[1] = 0.0 own.linearVelocity[0] = 0.0 #active animation cont.activate('idle')
StarcoderdataPython
165254
from utils import create_input_files if __name__ == '__main__': # Create input files (along with word map) create_input_files(dataset='aicc', karpathy_json_path='/workspace/data/aicc_caption/dataset_aicc.json', image_folder='/workspace/data/aicc_caption/images', ...
StarcoderdataPython
1654296
import bpy from bpy.props import * from ...nodes.BASE.node_base import RenderNodeBase from mathutils import Color, Vector def update_node(self, context): if self.operate_type == 'COMBINE': self.remove_output('x') self.remove_output('y') self.remove_output('z') self.remove_input('in...
StarcoderdataPython
3573552
import contextlib from itertools import chain import logging import sys import time from typing import Any, Dict, List import torch import numpy as np import os from fairseq.modules import TransformerSentenceEncoderLayer from fairseq.models.roberta import RobertaModel # INSTRUCTIONS # Run this script in the I-BERT di...
StarcoderdataPython
11262744
"""Network-related classes.""" import logging import threading import time import queue from types import SimpleNamespace from typing import Dict, List, Optional, Iterable import grpc from orbitx import common from orbitx import physics from orbitx import orbitx_pb2 as protos from orbitx import orbitx_pb2_grpc as gr...
StarcoderdataPython
6421769
# Copyright 2020 Google LLC # Copyright 2020 Amazon # # 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
3414239
<gh_stars>1000+ import json import logging import time from typing import Any, Dict, Text from unittest import mock from unittest.mock import Mock from aioresponses import aioresponses import pytest from sanic.compat import Header from sanic.request import Request from rasa.core.channels import SlackInput from rasa.s...
StarcoderdataPython
3267799
<filename>scratch/ebm_cat_tf.py """ Uses a base EBM model for learning an architecture which we can then apply transfer learning or fine-tuning Reference: https://tensorflow.google.cn/recommenders/examples/featurization?hl=zh-cn Adding categorical support... """ import copy from collections.abc import Iterable import...
StarcoderdataPython