id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3242596
<gh_stars>1-10 import numpy as np input_vectors = np.array([ [0.1 , 0.1 , 0.1 , 0.1], [.01 ,.001 , 0.6 , 0.8 ], [0.3 , 0.3 , 0.3 , 0.3], [0.0 , 0.8 , 0.0 , 0.0], [1.0 , 0.9 , 0.95, 0.82], [0.35,0.95 , 0.24, 0.76]]) rate, spread, size, input_size = .4, .2, len(input_vect...
StarcoderdataPython
1693656
from .base import * from .config import * from .pipelines import *
StarcoderdataPython
3276913
#!/usr/bin/python def logAndPrint(logf, message): print(message) with open(logf, 'a+') as f: f.write(message)
StarcoderdataPython
3201154
from torchseq.utils.tokenizer import Tokenizer class ParaphrasePair: def __init__(self, sent1_text, sent2_text, template=None, is_paraphrase=True, tok_window=64): if "artist appear below the euro symbol" in sent2_text: print("Found the dodgy pair", sent1_text, sent2_text) self._s1_do...
StarcoderdataPython
3369750
<filename>archive/p/python/roman-numeral.py # Python program to convert Roman Numerals # to Numbers import sys # This function returns value of each Roman symbol def value(r): if (r == 'I'): return 1 if (r == 'V'): return 5 if (r == 'X'): return 10 if (r == 'L'): ...
StarcoderdataPython
9039
import sys, os sys.path.append("C:/Users/Delgado/Documents/Research/rheology-data-toolkit/rheodata/extractors") import h5py import pandas as pd from antonpaar import AntonPaarExtractor as APE from ARES_G2 import ARES_G2Extractor # %% sys.path.append("C:/Users/Delgado/Documents/Research/rheology-data-toolkit/rheodata"...
StarcoderdataPython
1758175
<gh_stars>1000+ import datetime import json import logging import requests from core.analytics import OneShotAnalytics from core.errors import ObservableValidationError from core.observables import Hostname, Email, Ip, Hash class ThreatCrowdAPI(object): """Base class for querying the ThreatCrowd API.""" @s...
StarcoderdataPython
3295768
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
105506
import pathlib import tempfile import cbor2 from retry import retry from pycardano import * from .base import TestBase class TestMint(TestBase): @retry(tries=4, delay=6, backoff=2, jitter=(1, 3)) def test_mint(self): address = Address(self.payment_vkey.hash(), network=self.NETWORK) # Load ...
StarcoderdataPython
184015
import os import json import requests from cloudshell.helpers.app_import.build_app_xml import app_template from cloudshell.helpers.app_import.upload_app_xml import upload_app_to_cloudshell from cloudshell.api.cloudshell_api import InputNameValue from cloudshell.shell.core.session.logging_session import LoggingSessionC...
StarcoderdataPython
155553
from sklearn.decomposition import PCA import pandas as pd from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt df = pd.read_csv("Iris.csv") labels = df['Species'] X = df.drop(['Id','Species'],axis=1) X_std = StandardScaler().fit_transform(X) pca = PCA(n_components=4) X_transform = p...
StarcoderdataPython
96012
<reponame>NREL/engage """ Unit tests for Django app 'api' models - api/models/configuration. """ from mock import patch from django.contrib.auth.models import User from django.test import TestCase from django.utils.html import mark_safe from django.utils.safestring import SafeString from api.models.engage import Help...
StarcoderdataPython
3280387
import pybullet import math def groundVertices(size, basez, world, base_position, view_range, chunk_view_adjustment): """This is a function which takes a set of vertices, the size of the desired square and base z and returns the triangles for OpenGL to render. It also creates the collision shape for the terrai...
StarcoderdataPython
3270506
import copy import torch.optim as optim import torch.nn as nn import torch.nn.functional as F import math from optimizers.buffer import DataLoaderBuffer from optimizers.scheduler import ReduceLROnPlateau class TorchSGD: r""" Implements a stochastic gradient descent optimizer, which serves as the default optim...
StarcoderdataPython
3308611
<reponame>bela127/tf-custom-multi-gpu-training<gh_stars>1-10 import tensorflow as tf from addict import Dict def standart_callbacks(): callbacks = Dict() callbacks.load_ckpt = None callbacks.warmup = None callbacks.input_pre = input_pre return callbacks def i...
StarcoderdataPython
1682752
<gh_stars>1000+ import spacy nlp = spacy.load("es_core_news_sm") doc = nlp("Por Berlín fluye el río Esprea.") # Obtén todos los tokens y los part-of-speech tags token_texts = [token.text for token in doc] pos_tags = [token.pos_ for token in doc] for index, pos in enumerate(pos_tags): # Revisa si el token actual ...
StarcoderdataPython
109682
<reponame>NSLS-II-OPLS/profile_collection def ps(uid='-1',det='default',suffix='default',shift=.5,logplot='off',figure_number=999): ''' function to determine statistic on line profile (assumes either peak or erf-profile)\n calling sequence: uid='-1',det='default',suffix='default',shift=.5)\n det='defaul...
StarcoderdataPython
4825131
<filename>payments/tests/test_expire_too_old_unpaid_orders.py from datetime import timedelta import pytest from django.core import management from django.utils.timezone import now from resources.models import Reservation from ..factories import OrderFactory from ..models import Order, OrderLogEntry PAYMENT_WAITING_...
StarcoderdataPython
3300606
""" Quiz: readable_timedelta Write a function named readable_timedelta. The function should take one argument, an integer days, and return a string that says how many weeks and days that is. For example, calling the function and printing the result like this: print(readable_timedelta(10)) should output the followin...
StarcoderdataPython
67025
# generate_javascript_layers.py # Script that generates a javascript file named layers.js # This is done via a list of hardcoded layers to translate into the correct format # The file thus generated is then served to clients to be used by the javascript interface, # allowing easier maintenance of the software # Built-...
StarcoderdataPython
1763620
<filename>Latest/venv/Lib/site-packages/pyface/tests/test_clipboard.py from __future__ import absolute_import import unittest from ..clipboard import clipboard class TestObject(object): def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) def __eq__(...
StarcoderdataPython
1681310
<gh_stars>1-10 from enum import Enum, auto class RandomStrategy(Enum): SECRETS_CHOICE = auto() SECRETS_RANDOM = auto() RANDOM_LIB = auto()
StarcoderdataPython
1674290
from hpp.corbaserver.manipulation import Robot, loadServerPlugin, createContext, newProblem, ProblemSolver, ConstraintGraph, Rule, Constraints, CorbaClient from hpp.gepetto.manipulation import ViewerFactory import sys, argparse # parse arguments defaultContext = "corbaserver" p = argparse.ArgumentParser (description= ...
StarcoderdataPython
3312999
<reponame>aliyun/dingtalk-sdk<filename>dingtalk/python/alibabacloud_dingtalk/workflow_1_0/models.py # -*- coding: utf-8 -*- # This file is auto-generated, don't edit it. Thanks. from Tea.model import TeaModel from typing import List, Dict, Any class SelectOption(TeaModel): def __init__( self, key:...
StarcoderdataPython
3382722
import os import re import uuid import json import logging import operator import tornado.web import tornado.ioloop import tempfile from tornado.concurrent import Future from tornado import gen import sandstone.lib.decorators from sandstone import settings from sandstone.lib.handlers.base import BaseHandler from sand...
StarcoderdataPython
3384405
#Making Database Migrations import psycopg2 import psycopg2.extras import os from .initial1 import migrations from config import BaseConfig from ..utils import db_config class Database: def __init__(self): self.config = db_config() self.database = self.config.get('database') def migrate(self...
StarcoderdataPython
3321987
<filename>alarms/src/twiml_messages.py # Copyright 2010-2019 <NAME>, <NAME> # # 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 # # ...
StarcoderdataPython
3281663
map=[] with open("Day3\Aoc3.txt", "r") as data: map = data.readlines() map = [line.strip() for line in map] #print(map) slopes = [(1,1),(3,1),(5,1),(7,1),(1,2)] totalTrees = [] for slopes in slopes: tree = '#' treeCount = 0 x = 0 y = 0 while y+1 < len(map): x+=slopes[0] ...
StarcoderdataPython
197287
<filename>app/main/forms.py from flask_wtf import FlaskForm from wtforms import StringField,TextAreaField,SubmitField,SelectField from wtforms.validators import Required class PitchForm(FlaskForm): title = StringField('Pitch title', validators=[Required()]) text = TextAreaField('Text', validators=[Required()...
StarcoderdataPython
3213262
import numpy as np import base64 def MeshViewer(R, L, F, U, f1, f2): source = """ <!--<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - dashed lines example</div>--> <div id="container"></div> <script src="https://threejs.org/build/three.js"></script...
StarcoderdataPython
168296
<gh_stars>0 #!/usr/bin/python """Standalone utility functions for Mininet tests.""" import os import socket FAUCET_DIR = os.getenv('FAUCET_DIR', '../src/ryu_faucet/org/onfsdn/faucet') RESERVED_FOR_TESTS_PORTS = (179, 5001, 5002, 6633, 6653, 9179) def mininet_dpid(int_dpid): """Return stringified hex version, ...
StarcoderdataPython
3236074
''' Utilities for loading config files, etc. ''' import os import json from copy import deepcopy def config_files(): ''' Get list of currently used config files. ''' sensu_loaded_tempfile = os.environ.get('SENSU_LOADED_TEMPFILE') sensu_config_files = os.environ.get('SENSU_CONFIG_FILES') if s...
StarcoderdataPython
1782737
<gh_stars>1-10 from django.core.urlresolvers import reverse from admin_tools.dashboard import modules, Dashboard from admin_tools.utils import get_admin_site_name from crate.web.dashboard.modules import StatusModule, RedisStatusModule class CrateIndexDashboard(Dashboard): def init_with_context(self, context): ...
StarcoderdataPython
3366665
<filename>c1_2_processes/s13_ex1_19.py from util import logl from util import square from util import even def fib(n): return fib_iter(1, 0, 0, 1, n) def fib_iter(a, b, p, q, count): logl("(" + str(a) + ", " + str(b) + ", " + str(p) + ", " + str(q) + ", " + str(count) + ")") if count == 0: ...
StarcoderdataPython
136705
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-01-31 18:21 from __future__ import unicode_literals try: from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.contrib.contenttypes.models import ContentType from django.db import DEFAULT_DB_ALIA...
StarcoderdataPython
59842
""" Services This module is reponsible to handle all interactions to the database and bussiness rules """ import typing import environs import dotenv import requests import sqlalchemy.orm from . import models, schemas, cache env = environs.Env() dotenv.load_dotenv() SECRET_KEY_RECAPTCHA = env("RECAPTCHA_SECRET_K...
StarcoderdataPython
128763
<gh_stars>1-10 import tweepy import csv import numpy as np from textblob import TextBlob from keras.models import Sequential from keras.layers import Dense consumer_key = '0FAwDEdtG0DlUCHdKgICtLmHf' consumer_secret = '<KEY>' access_token = '<KEY>' access_token_secret = '<KEY>' auth = tweepy.OAuthHandler(consumer_key,...
StarcoderdataPython
115041
<reponame>mahmoudmohsen213/tsp-aco # Input file structure: # The first line contains exactly two integers n the number of nodes and m the # number of edges. # Follow, m lines, each line represent and edge and contains exactly three # integers u the source node, v the destination node, and c the edge weight. # The ...
StarcoderdataPython
147410
########################################################################## # Autor: WizIO 2021 <NAME> # http://www.wizio.eu/ # https://github.com/Wiz-IO/wizio-gsm # # Support: Comet Electronics # https://www.comet.bg/en ########################################################################## from os...
StarcoderdataPython
3286309
<reponame>MingxuZhang/python-polar-coding import numpy as np from python_polar_coding.polar_codes.base import BaseDecoder from .decoding_path import SCPath class SCListDecoder(BaseDecoder): """SC List decoding.""" path_class = SCPath def __init__(self, n: int, mask: np.array, ...
StarcoderdataPython
74747
<reponame>livefire2015/DataEngineeringProject class Config: PROXY_WEBPAGE = "https://free-proxy-list.net/" TESTING_URL = "https://google.com" REDIS_CONFIG = { "host": "redis", "port": "6379", "db": 0 } REDIS_KEY = "proxies" MAX_WORKERS = 50 NUMBER_OF_PROXIES =...
StarcoderdataPython
1628728
<filename>safe_relay_service/relay/migrations/0026_auto_20200626_1531.py # Generated by Django 3.0.7 on 2020-06-26 15:31 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('relay', '0025_auto_20200429_1101'), ] operations = [ migrations.AlterUnique...
StarcoderdataPython
1799648
# -*- coding: utf-8 -*- from abc import abstractmethod from typing import Optional from PySDDP.dessem.script.templates.arquivo_entrada import ArquivoEntrada class InfofcfTemplate(ArquivoEntrada): """ Classe que contem todos os elementos comuns a qualquer versao do arquivo Infofcf do Dessem. Esta classe t...
StarcoderdataPython
4816011
<filename>combine_gtfs_feeds/cli/log_controller.py import logging from functools import wraps from time import time import datetime import os, sys, errno import yaml import shutil from shutil import copy2 as shcopy def setup_custom_logger(name, output_dir): if os.path.exists(os.path.join(output_dir, "run_log.txt"...
StarcoderdataPython
47184
<gh_stars>1-10 import torch import numpy as np from PIL import Image import random import math import seaborn as sns from sklearn import metrics import matplotlib.pyplot as plt def adjusted_classes(y_scores, threshold): """ This function adjusts class predictions based on the prediction threshold (t). Will...
StarcoderdataPython
3297969
#Adapted from: http://stackoverflow.com/questions/32671306/how-can-i-read-keyboard-input-in-python #usr/bin/env python import sys #Tries a couple of potentialy built in packages to enable the retrival of single charecters from the keybaord. try: import tty, termios except ImportError: try: import msv...
StarcoderdataPython
1684882
from __future__ import absolute_import, unicode_literals import datetime import phonenumbers import pytz import regex from abc import ABCMeta, abstractmethod from datetime import timedelta from enum import Enum from ordered_set import OrderedSet from temba_expressions import conversions from temba_expressions.dates i...
StarcoderdataPython
127722
<filename>utility/genkey.py """ Generates an Admin-key and DB-key for you Call using `python genkey.py your-password` """ import sys import re import bcrypt def bad_password(password): """ checks for valid password """ return len(password) < 8 or re.match('^[A-Za-z0-9@#$%^&\*\.+=]+$', password) is Non...
StarcoderdataPython
1648183
<filename>rlpy/Domains/PacmanPackage/__init__.py<gh_stars>100-1000 from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import # When reinforcement module is imported, the following submodules will be # imported. from future import...
StarcoderdataPython
3384391
<gh_stars>1-10 import argparse import os import pandas as pd from datetime import timedelta ''' Get formatted PJM hourly metered loads. Input: Hourly metered load data, downloaded from PJM DataMiner2 (for RTO region). Link: https://dataminer2.pjm.com/feed/hrl_load_metered/definition (Note: Old ...
StarcoderdataPython
1608552
import unittest from pyning.tail_recursion.exponent import loop_exp from pyning.utils.testutils import BaseTest class ExponentLoopTest(BaseTest): def test_0_exp_3(self): self.check(f=loop_exp, xr=0, b=0, p=3) def test_1_exp_3(self): self.check(f=loop_exp, xr=1, b=1, p=3) def test_2_exp...
StarcoderdataPython
144649
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
StarcoderdataPython
123039
#!/usr/bin/env python # File name: chop_chain_joiner.py # Author: <NAME> # Date created: 5/24/2017 # Date last modified: 5/24/2017 # Python Version: 3.6 """ Description: This script 'fills in' missing residues in PDB files and creates a fixed PDB file. In order to fill in the gaps, Modeller is used to create a homolog...
StarcoderdataPython
1724145
<filename>tailcoat/plugins/maya/publish/validate_normals_unlocked.py import pyblish.api from maya import cmds class SelectNormalsLocked(pyblish.api.Action): label = "Normals Locked" on = "failed" icon = "hand-o-up" def process(self, context, plugin): cmds.select(plugin.locked) class UnlockN...
StarcoderdataPython
68430
import time import random import os import os.path as osp from mmseg.datasets.builder import DATASETS from mmseg.datasets.ainno import AinnoDataset CLASSES = ['background', 'huahen', 'zangwu', 'laji'] LABELS = [0, 1, 2, 3] PALETTE = [[0, 0, 0], [0, 0, 255], [255, 0, 0], [0, 255, 0]] @DATASETS.register_module() clas...
StarcoderdataPython
153344
""" Artificial Intelligence for Humans Volume 1: Fundamental Algorithms Python Version http://www.aifh.org http://www.jeffheaton.com Code repository: https://github.com/jeffheaton/aifh Copyright 2013 by <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you...
StarcoderdataPython
1637378
# coding: utf-8 from __future__ import unicode_literals from itertools import chain from .private import format_arg, format_kwarg class GentyArgs(object): """ Store args and kwargs for use in a genty-generated test. """ def __init__(self, *args, **kwargs): super(GentyArgs, self).__init__() ...
StarcoderdataPython
172679
from django.apps import AppConfig class Games(AppConfig): name = 'games' verbose_name = '24h du Jeu'
StarcoderdataPython
1770151
import collections import numpy as np import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import sarnet_td3.common.ops as ops RRLCellTuple = collections.namedtuple("RRLCellTuple", ("memory")) class RRLCell(tf.compat.v1.nn.rnn_cell.RNNCell): """ Input: Query: Query from the agent "i" recurren...
StarcoderdataPython
19814
from __future__ import print_function import warnings import numpy as np C4 = 261.6 # Hz piano_max = 4186.01 # Hz piano_min = 27.5000 # Hz - not audible __all__ = ['cent_per_value','get_f_min','get_f_max','FrequencyScale'] def cent_per_value(f_min, f_max, v_min, v_max): """ This function takes in a freque...
StarcoderdataPython
1640775
from .base import Field class ReferenceField(Field): @classmethod def make_property(cls, name): def _set(self, value): field = self.__fields__.get(name) self.__values__[name] = field.create(value) def _get(self): return self.__values__[name] return...
StarcoderdataPython
3220807
import torch import torch.nn as nn class Discriminator2(nn.Module): def __init__(self, n_h): super(Discriminator2, self).__init__() self.f_k = nn.Bilinear(n_h, n_h, 1) for m in self.modules(): self.weights_init(m) def weights_init(self, m): if isinstance(m, nn.Bili...
StarcoderdataPython
3207856
<gh_stars>1-10 # This file was *autogenerated* from the file matrices.sage from sage.all_cmdline import * # import sage library _sage_const_3 = Integer(3); _sage_const_32 = Integer(32); _sage_const_16 = Integer(16); _sage_const_5 = Integer(5)#!/usr/bin/env sage from generatormatrix import * import os import errno...
StarcoderdataPython
3262957
<reponame>geohazards-tep/dcs-sar-flood-tool<gh_stars>1-10 # vim: ts=8:expandtab:cpo+=I:fo+=r """ cache ===== Library for caching functions and method outputs. Two caching methods are provided: LRU store the last N results of the function/method Persistent store results on a...
StarcoderdataPython
1604082
import LPRLite as pr import cv2 import os import numpy as np from PIL import ImageFont from PIL import Image from PIL import ImageDraw def compute_iou(rec1, rec2): """ computing IoU :param rec1: (y0, x0, y1, x1), which reflects (top, left, bottom, right) :param rec2: (y0, x0, y1, x1) ...
StarcoderdataPython
1676300
<gh_stars>0 import websocket, json, pprint, talib, numpy import config from binance.client import Client from binance.enums import * SOCKET = "wss://stream.binance.com:9443/ws/ethusdt@kline_1m" RSI_PERIOD = 14 RSI_OVERBOUGHT = 70 RSI_OVERSOLD = 30 TRADE_SYMBOL = 'ETHUSD' TRADE_QUANTITY = 0.05 closes = [...
StarcoderdataPython
4813538
<reponame>pioneers/PieCentral2 """To Install: Run `pip install --upgrade google-api-python-client`""" from __future__ import print_function import os import csv import httplib2 # pylint: disable=import-error from googleapiclient import discovery # pylint: disable=import-error,no-name-in-module from oauth2client impo...
StarcoderdataPython
130231
<filename>src/applications/player/admin.py from django.contrib import admin # Locals Models from .models import Player, Guild class PlayerAdmin(admin.ModelAdmin): list_display = ("id", "account_id", "name", "level", "exp", "last_play", "ip") search_fields = ["name"] class GuildAdmin(admin.ModelAdmin): ...
StarcoderdataPython
1718472
#!/usr/local/bin/python3 # Generate and print a random password of a specified length # using a secure RNG. import string import sys import secrets characters = string.ascii_letters + string.digits try: length = int(sys.argv[1]) except (ValueError, IndexError): length = 43 # fewest to ensure 256 bits of entr...
StarcoderdataPython
3277176
# Copyright 2015 Google 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.0 # # Unless required by applicable law or a...
StarcoderdataPython
1624556
from sequences.majority import * class TestMajority: def test_given_empty_array_then_return_none(self): assert majority_element([]) is None def test_given_array_of_length_one(self): assert majority_element([1]) == 1 def test_given_array_of_length_two(self): assert majo...
StarcoderdataPython
1777134
""" Use Blender to render a scene to one or more image files. """ # Copyright (c) 2021 <NAME>. All rights reserved. import math import pickle import os import json import sys from typing import Optional import bpy import bpy.types as btypes # TODO: there is probably a better way to find the script directory at ru...
StarcoderdataPython
1711455
<gh_stars>1-10 import pytest from setuptools.config import read_configuration import zoloto def test_exposes_version() -> None: assert hasattr(zoloto, "__version__") def test_exposes_marker() -> None: assert zoloto.Marker == zoloto.marker.Marker def test_exposes_marker_type() -> None: assert zoloto.M...
StarcoderdataPython
161049
from .forest import RandomForestClassifier, RandomForestRegressor from .boosting import GradientBoostingRegressor, GradientBoostingClassifier from .voting import VotingClassifier __all__ = ['RandomForestClassifier','RandomForestRegressor','VotingClassifier', 'GradientBoostingRegressor','GradientBoostingClassifier']
StarcoderdataPython
3291052
<gh_stars>0 import os, shutil, glob, random from wpkit.fsutil import copy_files_to def newdir(out_dir): if os.path.exists(out_dir): shutil.rmtree(out_dir) os.makedirs(out_dir) def split_train_val(data_dir, train_dir, val_dir, val_split=0.1, num_val=None, ext='.jpg', shuffle=True, sort=False): newdir(tra...
StarcoderdataPython
33779
<gh_stars>0 from nexpose_rest.nexpose import _GET def getPolicies(config, filter=None, scannedOnly=None): getParameters=[] if filter is not None: getParameters.append('filter=' + filter) if scannedOnly is not None: getParameters.append('scannedOnly=' + scannedOnly) code, data = _GET('/...
StarcoderdataPython
1614286
<filename>geo/o2ld.geo.py #!/usr/bin/env python from ipdata import ipdata from pprint import pprint f = open('/home/cam/projects/project_secrets/geo.key', 'r') #print(f) # debugging#don't print API keys apiKey = f.readline().strip() # strips away \n at EOL ipdata = ipdata.IPData(apiKey) # api key goes here # gonna d...
StarcoderdataPython
89484
<filename>tests/kyu_7_tests/test_digitize.py<gh_stars>10-100 import unittest from katas.kyu_7.digitize import digitize class DigitizeTestCase(unittest.TestCase): def test_equals(self): self.assertEqual(digitize(123), [1, 2, 3]) def test_equals_2(self): self.assertEqual(digitize(1), [1]) ...
StarcoderdataPython
62354
import subprocess import tempfile import unittest COMMON_SUBPROCESS_ARGS = { 'timeout': 5, 'stdout': subprocess.PIPE, 'universal_newlines': True } class TestCommandLineInterface(unittest.TestCase): def test_simple_invocation(self): """Test simple execution: read from stdin, write to stdout""...
StarcoderdataPython
3319911
#!/usr/bin/env python3 from aws_cdk import core from image_recognition_processing.image_recognition_processing import ImageRecognitionProcessingStack app = core.App() ImageRecognitionProcessingStack(app, "reinvent-dop336-2019") app.synth()
StarcoderdataPython
3378375
<reponame>iamovrhere/lpthw import time tabby_cat = "\tGet it? Because tabs!" persian_cat = "Split \non a line;\n was this meant to be a pun?" backslash_cat = "I'm \\ a \\ cat?" fat_cat = """ I'' do a list: \t* Cat food \t* Fishes \t* Catnip\n\t* Grass? """ print tabby_cat print persian_cat print backslash_cat print ...
StarcoderdataPython
3397540
<gh_stars>0 class Solution: def countStudents(self, students: List[int], sandwiches: List[int]) -> int: flag = 0 n_stu = len(students) queue = deque(students) san_index = 0 while flag < n_stu: s = queue.popleft() if s== sandwiches[san_index]: ...
StarcoderdataPython
1631664
<filename>python/primary/func_return.py<gh_stars>1-10 #!/usr/bin/python # Filename: func_key.py def maximun(a, b): if a>b: return a else: return b print(maximun(2,5))
StarcoderdataPython
3368914
<gh_stars>1-10 from survae.data.datasets.image.supervised_wrappers.mnist import SupervisedMNISTDataset from survae.data.datasets.image.supervised_wrappers.cifar10 import SupervisedCIFAR10Dataset from survae.data.datasets.image.supervised_wrappers.celeba import SupervisedCelebADataset from survae.data.datasets.image.sup...
StarcoderdataPython
3269820
SMS_SENDSMS = "https://open.ucpaas.com/ol/sms/sendsms" MOBILE_NONE_SMS = { "sid": '9af4399595c7658687fe927341449d07', "token": 'dc43<PASSWORD>535<PASSWORD>', "appid": '8b1338016ca24ed5918bdd2ad3ff5b6a', "templateid": "526540", "param": None, "mobile": None, }
StarcoderdataPython
129943
<reponame>andrii-grytsenko/NBU_CurrencyExchange_Rates_Bot import keyboard as kbd STATES = { "START": { "description": "Initial state", "keyboard": kbd.kbd_main_screen, "message": """ Welcome! I am ready to inform You about actual currency exchange rates provided by National bank of Ukraine...
StarcoderdataPython
4410
<gh_stars>1-10 import io import time import datetime from readme_metrics.Metrics import Metrics from readme_metrics.MetricsApiConfig import MetricsApiConfig from readme_metrics.ResponseInfoWrapper import ResponseInfoWrapper from werkzeug import Request class MetricsMiddleware: """Core middleware class for ReadMe...
StarcoderdataPython
3308571
<reponame>amirhRahimi1993/info<filename>Super_users/migrations/0010_auto_20180524_1233.py # Generated by Django 2.0.2 on 2018-05-24 12:33 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('Super_users', '0009_auto_20180524_...
StarcoderdataPython
1689855
<filename>solidfire/common/__init__.py<gh_stars>10-100 #!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright &copy; 2014-2016 NetApp, Inc. All Rights Reserved. # # CONFIDENTIALITY NOTICE: THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION OF # NETAPP, INC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR ...
StarcoderdataPython
1620376
<filename>admirarchy/tests/testapp/models.py from django.db import models class AdjacencyListModel(models.Model): title = models.CharField(max_length=100) parent = models.ForeignKey( 'self', related_name='%(class)s_parent', on_delete=models.CASCADE, db_index=True, null=True, blank=True) def __s...
StarcoderdataPython
3229835
import numpy as np import logging from scipy.sparse import csr_matrix from .segmentanalyzer import SegmentSplitter from ..peakcollection import Peak from .graphs import PosDividedLineGraph, SubGraph from .reference_based_max_path import max_path_func class SparseMaxPaths: def __init__(self, sparse_values, graph,...
StarcoderdataPython
8581
<gh_stars>1-10 #!/usr/bin/env python # encoding: utf-8 import sys import getopt import re import os import pylab as plt import numpy as np # Define the variables for which the residuals will be plotted variables = ["Ux", "Uy", "T", "p_rgh", "k", "epsilon"] # Get the arguments of the script def usage(): print("Us...
StarcoderdataPython
1623433
<reponame>tfxsoftware/Nutricionista-TKINTER from tkinter import * from tkinter.ttk import Treeview from tkinter import ttk from tkinter import messagebox import sqlite3 ## BACKEND ## class funcoes(): def calcular_imc(self): if (self.cadastro_entry_altura.get() == "") or (self.cadastro_entry_pe...
StarcoderdataPython
80487
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 15 10:00:19 2020 Generate measurements. @author: <NAME> """ import os import time as tm import numpy as np from joblib import Parallel, delayed import multiprocessing from VoterModel import markov_jump_process from auxiliary.auxiliar...
StarcoderdataPython
168198
from django.urls import include, path from rest_framework import routers from . import views router = routers.DefaultRouter() router.register(r"", views.AnalysisViewSet, basename="Analysis") urlpatterns = [path("v1/analysis/", include(router.urls))]
StarcoderdataPython
76246
from django.db import models from django.contrib.auth.models import User # Create your models here. class catalogModel(models.Model): class Meta: managed=False permissions = ( ('catalog_admin', 'Catalog Admin'), ('catalog_create','Create Catalog Collections'), )
StarcoderdataPython
1622232
from twisted.internet import reactor from scrapy.crawler import CrawlerRunner from .modules import cnn_spider from scrapy.utils.project import get_project_settings from scrapy.settings import Settings from . import settings as import_settings import os import sys from sys import path def run_spider(): try: ...
StarcoderdataPython
3257515
#024 - Verificando as primeiras letras de um texto cid = str(input('em que cidade voce nasceu? ')).split() print(cid[:5].upper() == 'SANTO')
StarcoderdataPython
4807095
<filename>src/bootstrapData.py import sys import numpy as np data = open(sys.argv[1],"r").readlines() m=[] e=[] si=[[] for i in range(7)] for dat in data: if "#" not in dat: observables = dat.split() m.append(float(observables[3])) e.append(float(observables[4])) for j in range(7...
StarcoderdataPython
1616696
#!/usr/bin/env python3 class Solution: def maxDistance(self, colors: [int]) -> int: max_distance = 0 for i in range(len(colors)): distance = 0 if max_distance>(len(colors) - i): return max_distance for j in range(i, len(colors)): if colors[j]!=colors[i]: distance = (j-i) max_distance = m...
StarcoderdataPython