id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
1764900
# Code def rot13(x): alpha = "ABCDEFGHIJKLMNOPQRST" return alpha[0]
StarcoderdataPython
3468879
<gh_stars>0 import pytest import m26 def assert_almost_equal(x, y, threshold=0.0001): assert(abs(x - y) < threshold) def test_constructor_miles(): d = m26.Distance() assert(d.value == 0) assert(d.uom == 'm') d = m26.Distance(26.2) assert(d.value == 26.2) assert(d.uom == 'm') ass...
StarcoderdataPython
8008332
# -*- coding:utf-8 -*- """ @author: 古时月 @file: Fight.py @time: 2021/5/8 13:37 """ import win32com.client import traceback import pyautogui from functions import * pyautogui.FAILSAFE = True class fight: def __init__(self): self._name = "" self._hwnd = 0 self.hwnd2 = 0 self.hwnds= [...
StarcoderdataPython
5076201
<reponame>SimonBoothroyd/nagl import abc import dgl import torch.nn from pydantic import BaseModel from typing_extensions import Literal class PostprocessLayer(torch.nn.Module, abc.ABC): """A layer to apply to the final readout of a neural network.""" @classmethod @abc.abstractmethod def from_config...
StarcoderdataPython
8064055
<gh_stars>10-100 #!/usr/bin/env python # coding: utf-8 import os import pandas as pd import numpy as np from tqdm import tqdm from sklearn.metrics import roc_auc_score from sklearn.model_selection import StratifiedKFold import lightgbm as lgb class ModelExtractionCallback(object): """ original author : momij...
StarcoderdataPython
47455
<gh_stars>0 # Generated by Django 2.2.13 on 2020-09-27 03:14 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('shows', '00...
StarcoderdataPython
125693
<filename>PyScraper/module1.py import glob import imageio import matplotlib.pyplot as plt from matplotlib.image import imread import numpy as np import os import PIL from tensorflow.keras import layers import time from IPython import display from PIL import Image, ImageOps import glob import numpy as np IMG_DIR = './d...
StarcoderdataPython
11340847
import numpy as np import astropy.io.fits as pyfits import astropy.wcs as pywcs import os from six import string_types from xcs_soxs.utils import mylog, parse_value, get_rot_mat, \ downsample from xcs_soxs.instrument_registry import instrument_registry from tqdm import tqdm def wcs_from_event_file(f): h = f["...
StarcoderdataPython
1637637
<gh_stars>0 import os import numpy as np import tensorflow as tf os.environ["CUDA_VISIBLE_DEVICES"] = '' # Load TFLite model and allocate tensors. interpreter = tf.lite.Interpreter(model_path="saved_models/CNN1d_CTC_PinYin_Sample_lessDropout/MagicData/(gpu_n=1)(feature_name=mel)(label_type=pinyin)/best_val_loss(epoch=...
StarcoderdataPython
6703672
class ContextualHelp(object): """ Contains the details for how Revit should allow invocation of contextual help for an item added by an application. ContextualHelp(helpType: ContextualHelpType,helpPath: str) """ def Launch(self): """ Launch(self: ContextualHelp) Launches and d...
StarcoderdataPython
6450066
from setuptools import setup, find_packages from os.path import join, dirname import pyrecsys with open('requirements.txt') as f: reqs = f.read().splitlines() setup( name='pyrecsys', version=pyrecsys.__version__, packages=['pyrecsys', 'pyrecsys._polara.lib'], author = "<NAME>", author_email =...
StarcoderdataPython
6618288
<reponame>Sudani-Coder/python ## project: 9 # text analyzer vowels = ("a", "e", "i", "o", "u") def count_char(text, char): count = 0 for each in text: if each == char: count += 1 return count def count_vowels(text): count = 0 for each in text: if each in vowels: ...
StarcoderdataPython
3378971
from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse from scrapy.utils.url import urljoin_rfc from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader class Phones4uSpider(BaseSpider): name = 'phones4u.co.uk...
StarcoderdataPython
5127894
# -*- coding: utf-8 -*- """ server.common.validators ~~~~~~~~~~~~~~~~~~~~~~~~ """ def validate_phone_number(phone_number: str): """Validates Phone Number Strings""" if not phone_number.isdecimal() or len(phone_number) != 10: raise ValidationError("Value is not a 10-digit phone number!")
StarcoderdataPython
1888559
class Caesar: def caesar(cleartext, key, alphabet, cipher): result = "" cleartext = cleartext.lower() if not cipher: key = len(alphabet) - key for x in cleartext: if x not in alphabet: result += x else: i = al...
StarcoderdataPython
1744726
from __future__ import annotations from typing import Any, Iterable, Literal, Sequence import attr import networkx as nx __all__ = ["PoSet", "Pair", "Chain", "CMP"] Pair = tuple[Any, Any] Chain = Sequence[Any] CMP = Literal["<", ">", "||", "="] @attr.frozen class PoSet: """Hasse diagram representation of par...
StarcoderdataPython
29630
import unittest from unittest.mock import patch, Mock from werkzeug.datastructures import FileStorage import io import json from app import app from app.models.base import db from app.models.user import User from app.auth.views import UserPassportphotoView from app.auth import views class AuthUploadPassportPhotoTes...
StarcoderdataPython
1738398
<reponame>naderm/django_rest_omics from proteomics import models from rest_framework import serializers # Serializers define the API representation. class PeptideMethodSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = models.PeptideMethod class MSMethodSerializer(serializers.Hyperl...
StarcoderdataPython
1664612
#!/usr/bin/env python 2.x import socketserver, socket import threading from os.path import exists, isfile from time import sleep, strftime, time, localtime import signal from aes import myAES from os import system, fork, kill from sys import argv from random import shuffle, randrange HOST = '' PORT = 10007 aes = myAE...
StarcoderdataPython
9668882
from jinja2.utils import soft_unicode ''' USAGE: - debug: msg: "{{ vpc.subnets | get_public_subnets_ids('Type','Public') }}" ''' class FilterModule(object): def filters(self): return { 'get_public_subnets_ids': get_public_subnets_ids, } def get_public_subnets_ids(list, tag_key, ...
StarcoderdataPython
3224623
<reponame>andraantariksa/code-exercise-answer def convertTabs(code, x): return code.replace("\t", " " * x)
StarcoderdataPython
5026495
<reponame>NunoEdgarGFlowHub/poptorch #!/usr/bin/env python3 # Copyright (c) 2020 Graphcore Ltd. All rights reserved. import torch import poptorch import pytest # Tensors # Creation ops (we don't support many of these) # torch.numel, torch.tensor, torch.sparse_coo_tensor, torch.as_tensor, torch.as_strided, torch.fro...
StarcoderdataPython
8081570
# noqa: D100 from birdy.client import notebook def test_is_notebook(): # noqa: D103 # we expect True or False but no exception notebook.is_notebook()
StarcoderdataPython
1948987
from esahub import scihub, utils, checksum, check, main import unittest import contextlib import logging import re import datetime as DT import pytz import os import sys import subprocess from shapely.wkt import loads as wkt_loads from esahub.tests import config as test_config from esahub import config logger = loggin...
StarcoderdataPython
4873691
from random import Random from dataclasses import dataclass, InitVar from typing import List, Dict, Optional, Set, Tuple, Iterable from bson import ObjectId from game.pkchess.character import Character from game.pkchess.exception import ( MapTooFewPointsError, MapDimensionTooSmallError, MapShapeMismatchError, Map...
StarcoderdataPython
6622140
import capture import getmap import cutmap if __name__ == '__main__': # 59.9055,24.7385,60.3133,25.2727 赫尔基辛 # 60.1607,24.9191,60.1739,24.9700 # 60.16446,24.93824,60.16776,24.95096 # 60.1162,24.7522,60.3041,25.2466 name = "Helsinki" tif_file = "google_17m.tif" tfw_file = "google_17m.tfw" ...
StarcoderdataPython
3432851
# Copyright (c) 2018 Cloudify Platform Ltd. 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 ap...
StarcoderdataPython
6605313
#!/usr/bin/env python import torch import torchvision import base64 import cupy import cv2 import flask import getopt import gevent import gevent.pywsgi import glob import h5py import io import math import moviepy import moviepy.editor import numpy import os import random import re import scipy import scipy.io import...
StarcoderdataPython
11322070
import datetime import simplejson as json import peewee import redis import os from app.database import db from app.settings import AppConfig from app.models.FeeModel import FeeModel from app.util.nanote import Nanote from app.util.dateutil import format_js_iso # Redis stores message counts, because postgres count is...
StarcoderdataPython
6529685
from argparse import Namespace def namespace(d): assert isinstance(d, dict) return Namespace(**d) class FeedArgsDict: def __init__(self, func, args={}, force_return=None): assert callable(func) args = namespace(args) self.func = func self.args = args self.force_re...
StarcoderdataPython
5114391
import numpy as np import colorsys def get_colors(num_colors): colors=[] for i in np.arange(0., 360., 360. / num_colors): hue = i/360. lightness = (50 + np.random.rand() * 10)/100. saturation = (90 + np.random.rand() * 10)/100. colors.append(colorsys.hls_to_rgb(hue, lightness, saturation)) return colors co...
StarcoderdataPython
6683310
import datetime import os from django.test import Client, TestCase from django.db import transaction from django.db.utils import IntegrityError from django.contrib.auth import get_user_model from django.urls import reverse from decimal import Decimal from formsaurus.models import ( Survey, Submission, FileUpload...
StarcoderdataPython
127395
from PIL import ImageDraw, Image import numpy as np import hashlib import random # array_list = [1] background_color = '#F2F1F2' colors = ['#CD00CD', 'Red', 'Orange', "#66FF00", "#2A52BE"] def generate_array(bytes): ## Generate array for i in range(100): # Array 6 * 12 need_array = np.arr...
StarcoderdataPython
8013526
from datetime import datetime import merra_urls import threaded_downloader urls = merra_urls.url_generator( time_interval=(datetime(2020, 3, 30), datetime(2020, 3, 31)), lat_interval=(26, 37), lon_interval=(-107, -93), collections=[ { "collection": "tavg1_2d_slv_Nx", "sh...
StarcoderdataPython
3566733
import unittest from orderedattrdict import AttrDict from gramex.handlers.basehandler import check_membership def check(auth, **kwargs): return class TestMembership(unittest.TestCase): '''Test check_membership''' def check(self, condition, **kwargs): user = AttrDict(current_user=AttrDict(kwargs...
StarcoderdataPython
6501707
# Generated by Django 2.1.7 on 2019-02-23 03:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('beers', '0015_auto_20190221_2323'), ] operations = [ migrations.AddField( model_name='beer', name='stem_and_stein_pk...
StarcoderdataPython
241452
<filename>draft/wifi/client_udp_video.py<gh_stars>0 #!/usr/bin/env python3 import cv2, socket, base64, numpy as np server_address = ("127.0.0.1", 9999) buff_size = 65536 # max buffer size client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, b...
StarcoderdataPython
5131659
import logging import requests from base64 import b64decode from hashlib import sha1 from onelogin.saml2.utils import OneLogin_Saml2_Utils from onelogin.saml2.xml_templates import OneLogin_Saml2_Templates from onelogin.saml2.constants import OneLogin_Saml2_Constants from onelogin.saml2.ssl_adapter import SSLAdapter ...
StarcoderdataPython
1955650
<filename>main.py<gh_stars>1-10 # Importing necessary modules import time import pyttsx3 import os import itertools # Setting up a few properties ROOT_DIR = os.getcwd() POEM_DIR = ROOT_DIR + "\\poems" os.chdir(POEM_DIR) FILES_LIST = os.listdir() speaker = pyttsx3.init() speaker.setProperty("rate",150) # An importan...
StarcoderdataPython
9774598
#!/usr/bin/env python # -*- coding: utf-8 -*- import xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow import audit as project_audit import data as project_data from collections import defaultdict def get_element(osm_file, tags=('node', 'way', 'relation')): """Yield element if it is the right ty...
StarcoderdataPython
1809080
# Generated by Django 1.9.5 on 2016-04-23 13:43 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("djangocms_page_meta", "0004_auto_20160409_1852"), ] operations = [ migrations.AddField( model_name="pagemeta", name=...
StarcoderdataPython
1919742
<gh_stars>1-10 import numpy as np from collections import Counter from pathlib import Path from typing import Iterable, List Sample_Input = """3,4,3,1,2 """ def parse_input(input: str) -> tuple: lines = input.strip().split(",") return list(map(int, lines)) def simulate(fish: Iterable[int], days: int) -> i...
StarcoderdataPython
3232313
<filename>functions.py # file with functions used in Main.py import pycountry, sys def date_change(date): '''This function creates a new date in expected output format and detects errors in given "date" parameter. Example: MM/DD/YYYY to YYYY-MM-DD''' if not date: # detect empty 'date' par...
StarcoderdataPython
5139802
from starlette.middleware.base import BaseHTTPMiddleware from core.logger import logger # 自定义访问日志中间件,基于BaseHTTPMiddleware的中间件实例 class RequestLoggerMiddleware(BaseHTTPMiddleware): # dispatch 必须实现 async def dispatch(self, request, call_next): logger.info(f"{request.method} url:{request.url}\nheaders: {...
StarcoderdataPython
389596
<reponame>tarunvelagala/python-75-hackathon<filename>date-time-1.py # HANDLING DURATION from datetime import * dt = datetime(2018, 12, 20, 13, 2, 10) duration = timedelta(days=15, hours=10, minutes=30) print(dt+duration) print(dt-duration) # to measure the time taken by the program from time import * t1 = perf_counte...
StarcoderdataPython
1648989
''' @Author: <NAME> @Date: 2021-01-07 15:04:21 @Description: 这个是训练 mixed model 的时候使用的 @LastEditTime: 2021-02-06 22:40:20 ''' import os import numpy as np import time import torch from torch import nn, optim from TrafficFlowClassification.TrafficLog.setLog import logger from TrafficFlowClassification.utils.setConfig im...
StarcoderdataPython
11334415
<reponame>evantzhao/nlp-ner-analysis<gh_stars>0 class Constants: START = "<START(*)>" END = "</END(STOP)>" BPER = 0 BLOC = 1 BORG = 2 BMISC = 3 IPER = 4 ILOC = 5 IORG = 6 IMISC = 7 OTHER = 8 ALL_TAGS = {BPER, BLOC, BORG, BMISC, IPER, ILOC, IORG, IMISC, OTHER} TAG_TO_...
StarcoderdataPython
23880
import sys from collections.abc import Mapping import firebase_admin from firebase_admin import credentials from firebase_admin import firestore # Use a service account cred = credentials.Certificate('./service-account-key.json') firebase_admin.initialize_app(cred) db = firestore.client() for row in sys.stdin: ...
StarcoderdataPython
1670832
<reponame>mrcbarbier/diffuseclique from wagutils import * import itertools from statsmodels.nonparametric.smoothers_lowess import lowess import pickle from json import dump,load import scipy.linalg as la def reldist_type2(x, y): xm, ym = np.mean(x), np.mean(y) slope = np.mean((x - xm) * (y - ym) ** 2) / np....
StarcoderdataPython
4896412
<reponame>jeikabu/lumberyard from __future__ import print_function, absolute_import import itertools from .typeconv import TypeManager, TypeCastingRules from numba import types default_type_manager = TypeManager() def dump_number_rules(): tm = default_type_manager for a, b in itertools.product(types.number_...
StarcoderdataPython
1970542
<filename>src/13/13073.py """ 13073. Sums 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 920 ms 해결 날짜: 2020년 9월 19일 """ def main(): for _ in range(int(input())): N = int(input()) print(f'{N * (N + 1) // 2} {N ** 2} {N * (N + 1)}') if __name__ == '__main__': main()
StarcoderdataPython
4871598
<reponame>dmklee/nuro-arm<filename>nuro_arm/robot/pybullet_simulator.py import pybullet_data import pybullet as pb import numpy as np import os import nuro_arm from nuro_arm import transformation_utils, constants class PybulletSimulator: def __init__(self, headless=True, client=N...
StarcoderdataPython
3341076
import math import torch from torch.utils.data import Dataset, DataLoader class MyDataset(Dataset): def __init__(self, data, window, target_cols): self.data = torch.Tensor(data) self.window = window self.target_cols = target_cols self.shape = self.__getshape__() self.size ...
StarcoderdataPython
8183755
<reponame>ShuaibinLi/RL_baselines import torch import numpy as np device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class DDPGAgent(object): def __init__(self, algorithm, act_dim, expl_noise=0.1): self.alg = algorithm self.act_dim = act_dim self.expl_noise = expl_noise...
StarcoderdataPython
6420027
import random import re from datetime import datetime from info.libs.yuntongxun.sms import CCP from info.models import User from info.utils.response_code import RET from . import passport_blue from info import redis_store, constants, db from flask import request, abort, make_response, current_app, jsonify, session fro...
StarcoderdataPython
6648502
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import os import random import signal import sys import threading import time import unittest import ray.plasma as plasma from ray.plasma.utils import (random_object_id, generate_metadata, ...
StarcoderdataPython
3362661
import unittest from solve import Sudoku test_sudoku = [[5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0, 9, 8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0, 2, 0, 0, 0, 6], ...
StarcoderdataPython
3499494
import os from flask_socketio import SocketIO from celery.utils.log import get_task_logger from celery.signals import after_setup_task_logger, after_setup_logger from AXIOME3_app.extensions import celery from AXIOME3_app.tasks.utils import ( configure_celery_task_logger, log_status, emit_message, run_command, cl...
StarcoderdataPython
12855931
<reponame>exhuma/metafilter from ConfigParser import SafeConfigParser from cStringIO import StringIO import sqlalchemy from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy.orm import sessionmaker from os.path import sep from hashlib import md5 from datetime import datetime, timedelta im...
StarcoderdataPython
1604329
<reponame>csnardi/openstates-core # Generated by Django 3.2.2 on 2021-10-13 19:07 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("data", "0041_personoffice"), ] operations = [ migrations.DeleteModel( name="PersonContactDetail", ...
StarcoderdataPython
8043597
# # OtterTune - upload_batch.py # # Copyright (c) 2017-18, Carnegie Mellon University Database Group # import logging import os import urllib2 import glob import numpy as np from poster.encode import multipart_encode from poster.streaminghttp import register_openers register_openers() # Logging LOG = logging.getLog...
StarcoderdataPython
46955
from django.db.models.signals import post_save from django.dispatch import receiver from company.models import Company from company.tasks import deploy_new_company @receiver(post_save, sender=Company) def company_created(sender, instance, created, **kwargs): if created: deploy_new_company.delay(instance....
StarcoderdataPython
1999326
<filename>examples/simulations/gyroscope1.py """ Simulation of a gyroscope hanging from a spring. """ # (adapted by <NAME> from <NAME>, 2009) from __future__ import division, print_function from vtkplotter import * # ############################################################ parameters dt = 0.005 # time step ks = 1...
StarcoderdataPython
3395042
# -*- coding: utf-8 -*- """ ====================================================== Test_mtom_attachment :mod:`tests.test_mtom_attachment` ====================================================== """ import os from os.path import join, basename import tempfile import shutil import email import hashlib from lxml import et...
StarcoderdataPython
11309662
from pyfann import libfann connection_rate = 1 learning_rate = 0.7 num_input = 2 num_hidden = 4 num_output = 1 desired_error = 0.0001 max_iterations = 100000 iterations_between_reports = 1000 ann = libfann.neural_net() ann.create_sparse_array(connection_rate, (num_input, num_hidden, num_output)) ann.set_learning_rat...
StarcoderdataPython
343692
from django import forms from django.shortcuts import get_object_or_404 from .models import Event from ..users.models import User class ConfirmAttendanceForm(forms.Form): def confirm_attendance(self): print(self.data) event_id = int(self.data['event_id']) username = self.data['username'] ...
StarcoderdataPython
6458303
#%% ''' http://epistasislab.github.io/tpot/api/#classification https://machinelearningmastery.com/tpot-for-automated-machine-learning-in-python/ ''' import os, sys import pandas as pd import numpy as np import joblib from sklearn.model_selection import train_test_split import pathlib from tpot import TPOTClassifier fro...
StarcoderdataPython
9765448
<gh_stars>0 #!/usr/bin/python3 import os.path from pathlib import Path import sys import getpass from evdev import InputDevice, list_devices devices = [InputDevice(fn) for fn in list_devices()] if len(devices) == 0: print( f"Could not find a RFID device, make sure it is plugged in.\nIf it is plugged in y...
StarcoderdataPython
5037755
<filename>src/environment/wrappers/noop_reset_env.py<gh_stars>10-100 """An environment wrapper to preform null operations on reset.""" import gym class NoopResetEnv(gym.Wrapper): """An environment wrapper to preform null operations on reset.""" def __init__(self, env, noop_max=30): """ Sample...
StarcoderdataPython
1775925
#!/usr/bin/env python # # sim-lbeg.py # for simulating LBEG beam from point A to B in the LANSCE linac # import sys import os # define directory to packages and append to $PATH par_dir = os.path.abspath(os.path.pardir) print par_dir lib_dir = os.path.join(par_dir,"bin") print lib_dir sys.path.append(lib_dir) pkg_dir = ...
StarcoderdataPython
9647169
<filename>CSIKit/visualization/plot_szenario.py """ Classes to Plot a szenario belog different measurements """ from cmath import phase from typing import Dict, List, Tuple import os import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from CSIKit.csi import IWLCSIFrame as CsiEntry fr...
StarcoderdataPython
388869
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import importlib import time import random import numpy as np from pyhocon import ConfigFactory import torch import torch.nn as nn from tensorboardX import SummaryWriter from data.modelnet import AdaptiveModelNetDataset from utils import pointcloud_utils as put fr...
StarcoderdataPython
9648721
""" Provides helper functions used throughout the InvenTree project """ import io import re import json import os.path from PIL import Image from decimal import Decimal, InvalidOperation from wsgiref.util import FileWrapper from django.http import StreamingHttpResponse from django.core.exceptions import ValidationEr...
StarcoderdataPython
5021460
<reponame>JJ/swarm-ga-worker<filename>worker/main.py from ga_worker import * from pso_worker import * import redis import json import os import time import base64 import uuid TOPIC_CONSUME = "population-objects" TOPIC_PRODUCE = "evolved-population-objects" WORKER_ID = str (uuid.uuid4()) r = redis.StrictRedis(ho...
StarcoderdataPython
3333036
<reponame>impastasyndrome/DS-ALGO-OFFICIAL<gh_stars>10-100 # time complexity: O(m+n) class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if not matrix or len(matrix) == 0 or not matrix[0]: ...
StarcoderdataPython
4995915
# -*- coding: utf-8 -*- import scrapy from scrapy.http import Request from work.items import ShopItem import re class SierratradingpostSpider(scrapy.Spider): name = 'sierratradingpost' allowed_domains = ['www.sierratradingpost.com'] start_urls = ['https://www.sierratradingpost.com/'] custom_settings ...
StarcoderdataPython
3386394
import pandas as pd import plotly.graph_objects as go def vis_pentagon(dataset, dirplace, d1, d2, d3, d4, d5, target, nclass, ntest): c_list = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] da1_list = [0, 0, 0, 0, 0, 0,...
StarcoderdataPython
181547
<reponame>MarcoYLyu/scytale #!/usr/bin/env python3 from . import lattice from . import crypto from . import factor from . import ecurve from .crypto import * from .ecurve import * from .factor import * from .lattice import * from .algorithm import * __all__ = ['crypto', 'ecurve', 'factorization', 'lattice']
StarcoderdataPython
6501064
<reponame>stoimenoff/ultimate-tic-tac-tie<filename>tests/ai_test.py import unittest from unittest.mock import patch, PropertyMock from ultimatetictactoe.game.players.ai import * from ultimatetictactoe.game.boards import Macroboard, GameEndedError, Square class TestBots(unittest.TestCase): MOVES = [(2, 2), (7, 6)...
StarcoderdataPython
9702075
<reponame>KaloyankerR/python-fundamentals-repository import math n = int(input()) p = int(input()) courses = math.ceil(n / p) print(courses)
StarcoderdataPython
3265314
<reponame>TNRIS/api.tnris.org<filename>src/data_hub/tnris_org/bulk_actions.py # # BULK ACTIONS # used in admin console list display # def close_registration(modeladmin, request, queryset): queryset.update(registration_open=False) close_registration.short_description = "Close Registration" def open_registration(...
StarcoderdataPython
6556837
<gh_stars>0 #! /usr/bin/env python # A script to calculate the time integration parameters for generalized alpha time integration # for both, structure and fluid. # # Generalized-alpha time integration for structural dynamics follows "<NAME>. & <NAME>. A Time Integration Algorithm for Structural Dynamics With Improv...
StarcoderdataPython
4932836
<filename>fibertree/codec/matrix-vector-knkn.py from swoop import * ## Test program: Tiled K-Stationary vector-matrix multiplication # # Z_n = A_k * B_kn # Tiled: # Z_n1n0 = A_k1k0 * B_k1n1k0n0 # #for k1, (a_k0, b_n1) in a_k1 & b_k1: # for n1, (z_n0, b_n0) in z_n1 << b_n1: # for k0, (a, b_n0) in a_k0 & b_k0:...
StarcoderdataPython
3486410
<reponame>bhv/covid-19-growth<filename>lib/us.py import pandas as pd from operator import itemgetter import etl from pprint import pprint as pp # Dataframes # `df_us` A Dictionary of case, death, and recovery dataframes for the US # `df_us_states` A Dictionary of state-level case, death, and recovery dataframes for t...
StarcoderdataPython
32905
import unittest from app.models import Source class testSource(unittest.TestCase): """ SourcesTest class to test the behavior of the Sources class """ def setUp(self): """ Method that runs before each other test runs """ self.new_source = Source('abc-news','ABC news','Yo...
StarcoderdataPython
6435727
<filename>ndic/tests/test_search.py # -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from unittest import TestCase import mock import requests from ndic.search import search from ndic.exceptions import NdicConnectionError class NdicTestCase(TestCase): def test_search_korean_wor...
StarcoderdataPython
6578991
<filename>kws/augmentations/wave_augmentations/__init__.py from kws.augmentations.wave_augmentations.wave_augmentations import WaveAugs __all__ = [ 'WaveAugs' ]
StarcoderdataPython
1904056
from direct.directnotify import DirectNotifyGlobal from direct.showbase.PythonUtil import invertDictLossless from toontown.coghq import StageRoomSpecs from toontown.toonbase import ToontownGlobals from direct.showbase.PythonUtil import normalDistrib, lerp import random def printAllCashbotInfo(): print('roomId: roo...
StarcoderdataPython
5025061
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RGitcreds(RPackage): """Query 'git' Credentials from 'R'. Query, set, delete credenti...
StarcoderdataPython
1640504
# Generated by Django 2.1.8 on 2019-05-15 12:04 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0004_recipe'), ] operations = [ migrations.RenameField( model_name='recipe', old_name='Ingredient', new_...
StarcoderdataPython
85931
<reponame>tmenegaz/django<gh_stars>0 #!/home/tmenegaz/Documentos/cimatec/2016.2/escolaTecnica/mundoSenai/django/aula/aulaDjango/py3.5/bin/python3.5 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
StarcoderdataPython
1753988
<filename>core-python/Core_Python/regexpkg/Regex_Example1.py ''' Fill in the code to check if the text passed contains the vowels a, e and i, with exactly one occurrence of any other character in between. ''' import re def check_aei (text): result = re.search(r"a.e.i", text) return result != None print(check_...
StarcoderdataPython
4904835
<gh_stars>0 import numbers import numpy as np import pickle class euclidean_tVec( object ): # def __init__( self ): # self.Type = "Euclidean_Tangent" # self.nDim = 3 # self.tVector = [ 0, 0, 0 ] def __init__( self, nDim ): self.Type = "Euclidean_Tangent" self.nDim = nDim self.tVector = np.zeros( nDim ) ...
StarcoderdataPython
6660749
#!/usr/bin/env python # _*_coding:utf-8 _*_ #@Time    :2019/4/17 0017 下午 5:11 #@Author  :喜欢二福的沧月君(<EMAIL>) #@FileName: train.py #@Software: PyCharm import numpy as np import pandas as pd titanic_survival= pd.read_csv("titanic_train.csv") #print(titanic_survival.head) """ age中有缺失值 求平均值 age=titanic_...
StarcoderdataPython
1606768
<reponame>idris-rampurawala/form-fueled from app.pagination import DefaultCursorPagination from django.conf import settings from django.db.models import Prefetch from rest_framework.exceptions import NotFound from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_f...
StarcoderdataPython
3550053
from tensorflow.keras import backend as K from tensorflow.keras.callbacks import ModelCheckpoint import unet import candle def initialize_parameters(): unet_common = unet.UNET( unet.file_path, 'unet_params.txt', 'keras', prog='unet_example', desc='UNET example' ) ...
StarcoderdataPython
4916895
<reponame>jean3108/TwoPlayer-Game from abc import ABC, abstractmethod from twoPlayerAiGame.aiAlgorithms import minmaxDecision, negamaxDecision, randomDecision, humanDecision class StateGame(ABC): """ Class wich represent a state of a two-player game """ @abstractmethod def __init__(self,...
StarcoderdataPython
8067386
from flask import Blueprint ac = Blueprint('ac', __name__) @ac.route('/login') def login(): return 'login' @ac.route('/logout') def logout(): return 'logout'
StarcoderdataPython
8162889
<reponame>imapi/Permission-Resolver<filename>permission_resolver/permission_resolver.py #!/usr/bin/python3 # -*- coding: utf-8 -*- from io import TextIOWrapper from pathlib import PureWindowsPath, PurePosixPath from typing import List, Union import argparse class TreeItem: def __init__(self, name: str, ...
StarcoderdataPython
380088
#!/usr/bin/env python # Force Python 2 to use float division even for ints from __future__ import division from __future__ import print_function import importlib import stacktrain.config.general as conf import stacktrain.core.cond_sleep as cs kc = importlib.import_module("stacktrain.%s.keycodes" % conf.provider) # -...
StarcoderdataPython