id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
32059
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-06-11 05:18 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('announcements', '0001_initial'), ] operations = [ ...
StarcoderdataPython
3285641
# Created By: <NAME> # Created On: 2011-02-01 # Copyright 2015 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.htm...
StarcoderdataPython
99898
# <NAME> (wtt53) # Software Testing and QA # Assignment 1: Test Driven Development # Retirement: Takes current age (int), annual salary (float), # percent of annual salary saved (float), and savings goal (float) # and outputs what age savings goal will be met def calc_retirement(age, salary, percent, goal): # ca...
StarcoderdataPython
1782212
<reponame>catherinekuhn17/project5 # write your silhouette score unit tests here import pytest from cluster import KMeans from cluster import make_clusters from cluster import Silhouette import unittest def test_score_range(): ''' unit test to assert that all scores fall between 0 and 1 ''' mat,_ = mak...
StarcoderdataPython
1673686
import re import nltk from nltk.corpus import stopwords from database.mongoclientclass import MongoClientClass from scraping.Constants import QUESTION_BLACK_LIST, LINK, TITLE, TAGS, ANSWER # def readFile(fileName): # with open(fileName, 'r') as myfile: # return myfile.read() def stripExtra(text): ...
StarcoderdataPython
1738118
<gh_stars>0 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ethernet.ui' # # Created: Mon Jan 18 16:33:27 2016 # by: pyside-uic 0.2.15 running on PySide 1.2.4 # # WARNING! All changes made in this file will be lost! import struct import time from cStringIO import StringIO from PySi...
StarcoderdataPython
191254
<gh_stars>1-10 # -*- coding: utf-8 -*- print("run imports...") from selenium import webdriver from selenium.webdriver.common.keys import Keys import os import urllib.request def scrapClass(searchterm, no_images): #searchterm = 'asus rog laptop' # will also be the name of the folder url = "https://www.google.c...
StarcoderdataPython
3283936
from flask import Blueprint home = Blueprint(name="home", import_name=__name__, url_prefix="/", static_folder="static", template_folder="templates") from . import views
StarcoderdataPython
108881
import os from django.db import models from django.db.models.signals import post_delete from django.dispatch import receiver from django.utils.crypto import get_random_string def upload_obfuscated_filename(instance, orig_filename): _filename, _ext = os.path.splitext(orig_filename) _fn = get_random_string(len...
StarcoderdataPython
1705371
<filename>lclpy/io/__init__.py """This package conatains functions for the input and output of data."""
StarcoderdataPython
4830721
<reponame>PixPanz/byte_le_royale_2021 from game.common.TrUpgrades.baseUpgradeObject import BaseUpgradeObject from game.common.enums import * from game.common.stats import * class RabbitFoot(BaseUpgradeObject): def __init__(self): super().__init__(ObjectType.rabbitFoot, RabbitFootLevel.level_zero) ...
StarcoderdataPython
3287676
<reponame>hiro345g/raspi_magazine_201610_toku1 # -*- coding: utf-8 -*- # from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column from sqlalchemy.dialects.sqlite import \ BLOB, BOOLEAN, CHAR, DATE, DATETIME, DECIMAL, FLOAT, \ INTEGER, NUMERIC, SMALLINT, TEXT, TIME, TIMESTAMP, \ ...
StarcoderdataPython
4818884
<filename>main.py from azureml.core import Run from azureml.core import Workspace from azureml.core.authentication import ServicePrincipalAuthentication from azureml.core.datastore import Datastore from azureml.core.dataset import Dataset from azureml.data.data_reference import DataReference from azureml.pipeline.core ...
StarcoderdataPython
4811709
# Generated by Django 3.0.8 on 2020-10-21 20:41 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('store', '0005_auto_20201021_2058'), ] operations = [ migrations.AlterField( model_name='orderitem'...
StarcoderdataPython
1696777
# -*- coding: utf-8 -*- """Solar resource downscaling utility methods. Created on April 8 2019 @author: gbuster """ import numpy as np import pandas as pd import logging from rex.utilities.solar_position import SolarPosition from rex.utilities.utilities import get_lat_lon_cols from nsrdb.all_sky import CLEAR_TYPES ...
StarcoderdataPython
14360
from pythonneat.neat.Species import Species import pythonneat.neat.Speciation as Speciation import pythonneat.neat.utils.Parameters as Parameters current_genomes = [] def add_genome(genome): """Adds genome to the species list based on its compatability distance to already existing species Inputs: ge...
StarcoderdataPython
1608861
<reponame>connorpekovic/djangox import uuid from django.contrib.auth.models import AbstractUser from django.db import models # User ID needs to be UUID class CustomUser(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) ...
StarcoderdataPython
1678330
import json import glob fileList = glob.glob('./*.json') allLogs = [] for fileDir in fileList: print('Merging ' + fileDir + '...') file = open(fileDir) data = json.load(file) for log in data: allLogs.append(log) file.close() with open('allCombinedLogs.json', 'w') as f: json.dump(allL...
StarcoderdataPython
144768
import click def validate_output_value(ctx, param, value): value = str(value).lower() if value not in ['json', 'table', 'yaml']: raise click.BadParameter(value + '. Possible values: json | table | yaml') return value
StarcoderdataPython
97817
############################################################################## # # Copyright (c) 2007 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
StarcoderdataPython
3326406
import sys from PyQt5.QtCore import QTimer from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QLabel class Animation(QLabel): def __init__(self, path="", parent=None, framerate=150,**kwargs): if parent is None: print("No parent, opening a new window...") self._auto_init() ...
StarcoderdataPython
41763
# coding=utf-8 # Copyright 2014, <NAME> http://github.com/rafi # vim: set ts=8 sw=4 tw=80 et : import logging import requests from beets.plugins import BeetsPlugin from beets import ui from beets import dbcore from beets import config log = logging.getLogger('beets') api_url = 'http://ws.audioscrobbler.com/2.0/?meth...
StarcoderdataPython
1612032
validador = True qtd = 0 vitInter = 0 vitGremio = 0 empates = 0 while(validador == True): vet = [int(i) for i in input().split()] inter = vet[0] gremio = vet[1] qtd += 1 if inter > gremio: vitInter += 1 elif inter < gremio: vitGremio += 1 else: empates += 1 no...
StarcoderdataPython
156459
<reponame>ErikThorsell/advent-of-code-python """TEST MODULE TEMPLATE""" from advent_of_code.y2021.d1 import solution_1 from advent_of_code.y2021.d1 import solution_2 def test_solution_1(): example_input = [ 199, 200, 208, 210, 200, 207, 240, 269, ...
StarcoderdataPython
1605900
#@njit def time_step_at_shape_at_pixel(self, h, neighboring_ids): '''maybe this task is best outside of this .py file. use trimesh in a different myocardial_tissue.py''' #TODO: define mechanical parameters from kwargs neighboring_ids = self.get_neighboring_ids() #TODO: make this call asynchronous when all neigh...
StarcoderdataPython
3362048
<filename>ibm_platform_services/usage_reports_v4.py # coding: utf-8 # (C) Copyright IBM Corp. 2021. # # 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/LI...
StarcoderdataPython
1687838
<filename>exercicios-python/curso-python/ex002.py n1 = int(input('Digite um valor:')) n2 = int(input('Digite outro valor: ')) a = n1 + n2 s = n1 - n2 m = n1 * n2 d = n1 / n2 di = n1 // n2 rd = n1 % n2 p = n1 ** n2 print('A soma é {} A subtração é {} A multiplicação é {} A divisão é {} A divisão inteira é {} O resto d...
StarcoderdataPython
1718872
""" Contains the Results endpoints (views) """ import django_rq from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from core.serializers import JobResultSerializer class ResultsView(APIView): def get(self, request, job_id, *args, **kwargs): ...
StarcoderdataPython
19987
<gh_stars>0 from abc import ABC,abstractmethod import os import binascii import subprocess import time import datetime import platform import tempfile import requests import json import aiohttp from sanic import response from asyncinit import asyncinit from errors_module.errors import MnemonicRequiredError from error...
StarcoderdataPython
196110
<filename>old/SimpleElectroSim/python/electro_sim.py #imports from shapely.geometry import Point import numpy as np import random import math from decimal import * from time import sleep import copy try: from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * except: print "OpenGL wra...
StarcoderdataPython
3310479
<filename>excelpro3/utils/myutil.py # -*- encoding: utf-8 -*- """ myutil.py Created on 2018/1/3 13:58 Copyright (c) 2018/1/3, @author: 小马同学(<EMAIL>) """ import re import datetime import decimal import time _clean_strs = ( '\xe3\x80\x80', # '\x1c', # '\x1d', # '\x3f' ) def number2char(number): ...
StarcoderdataPython
1610959
<filename>output/models/nist_data/atomic/unsigned_byte/schema_instance/nistschema_sv_iv_atomic_unsigned_byte_max_inclusive_3_xsd/__init__.py from output.models.nist_data.atomic.unsigned_byte.schema_instance.nistschema_sv_iv_atomic_unsigned_byte_max_inclusive_3_xsd.nistschema_sv_iv_atomic_unsigned_byte_max_inclusive_3 i...
StarcoderdataPython
1747447
# pylint:disable=wildcard-import # pylint:disable=unused-import # pylint:disable=unused-variable # pylint:disable=unused-argument # pylint:disable=redefined-outer-name # pylint:disable=bare-except from pathlib import Path from asyncio import Future import pytest import yaml from simcore_service_deployment_agent impor...
StarcoderdataPython
3224920
<reponame>neutronest/eulerproject-douby from math import sqrt def f(v, a, b): return v * v + a * v + b def isPrime(v): if v <= 1: return False for i in xrange(2, int(sqrt(v) + 1)): if v != i and v % i == 0: return False return True maxv = 0 ans = None for a in xrang...
StarcoderdataPython
26940
<filename>day1/debugme.py def convert_fizzbuzz(n: int) -> str: s = str(n) if n % 3 == 0 and n % 5 == 0: s = "FizzBuzz" if n % 3 == 0: s = "Fizz" if n % 5 == 0: s = "Buzz" return s def fizzbuzz() -> None: """ 1から100までの整数nに対して * nが3の倍数かつ5の倍数の時はFizzBuzz * nが3の倍...
StarcoderdataPython
1749552
import pytest from teos.watcher import InvalidTransactionFormat from test.teos.conftest import generate_blocks from test.teos.unit.conftest import get_random_value_hex, fork hex_tx = ( "0100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402" "204e45e16932b8af514961a1d3a1a...
StarcoderdataPython
1734371
class Solution: def minPartitions(self, n: str) -> int: return (int(max(list(str(n))))) n = 32 res = Solution().minPartitions(n) print(res)
StarcoderdataPython
3379068
<gh_stars>1-10 import discord from discord.ext import commands class AgentMaps(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(aliases = ['sargeorg' , 'brimorg']) async def brimstoneorg(self, ctx): embed = discord.Embed( colour=discord.Colour.blurple(),...
StarcoderdataPython
3245686
# This game uses the pygame library. It may usually be installed # by running something like "pip install pygame". # The only controls are: # Left arrow: turn left # Right arrow: turn right from random import randint import pygame class Direction: west = (-1, 0) east = (1, 0) north = (0,...
StarcoderdataPython
134549
""" Entradas Horas trabajadas-->float-->ht Pago por hora-->float-->ph Salidas Pago junto con la horas-->float-->pa=ht*ph Descuento por los impuestos-->float-->des1=pa*0.20 y des2=pa-des1 """ ht=float(input("Digite las horas que ha trabajado: ")) ph=float(input("Digite el pago por hora: ")) pa=ht*ph des1=pa*0.20 des2=p...
StarcoderdataPython
3308721
import picamera import pygame import pygame_gui import time import io import os from datetime import datetime def setup_pygame(): pygame.init() # Set the cursor to invisible. We use a transparent cursor for this as set_visible breaks the touch screen pygame.mouse.set_cursor((8,8),(0,0),(0,0,0,0,0,0,0,0),(...
StarcoderdataPython
3220469
"""Benchmarks for `numpy.lib`.""" from __future__ import absolute_import, division, print_function from .common import Benchmark import numpy as np class Pad(Benchmark): """Benchmarks for `numpy.pad`.""" param_names = ["shape", "pad_width", "mode"] params = [ [(1000,), (10, 100), (10, 10, 10)...
StarcoderdataPython
1616945
<gh_stars>10-100 # -*- coding: utf-8 -*- import zipfile import torch import requests from io import BytesIO from torch.utils import data import sys import collections class Vocab(object): # This class is saved in d2l. def __init__(self, tokens, min_freq=0, use_special_tokens=False): # sort by frequency a...
StarcoderdataPython
129792
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: extentMessages.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as...
StarcoderdataPython
3332471
<reponame>lukovnikov/teafacto import elasticsearch, re, sys from teafacto.util import tokenize, argprun class SimpleQuestionsLabelIndex(object): def __init__(self, host="drogon", index="simplequestions_labels"): self.host = host self.indexp = index def index(self, labelp="labels.map"): ...
StarcoderdataPython
1641847
#!/usr/bin/env python # -*- encoding: utf-8 -*- import sys from setuptools import setup name='pyruter' description='Utility for accessing subway information in Oslo, Norway.' version='1' author='<NAME>' author_email='<EMAIL>' packages=['ruter'] install_requires=['requests', 'dateutils'] scripts=[] setup(name=name,...
StarcoderdataPython
1623303
<gh_stars>1-10 from pytest import fixture from scrabble.transport.msg import (AuthMessageRequest, AuthMessageRequestPayload, AuthMessageResponse, AuthMessageResponsePayload, EndConnectionMessage, EndConnectionPayload, NewConnectionMessage, NewConn...
StarcoderdataPython
3334950
<gh_stars>0 __all__ = [ "DataLoaderCollection", "Trainer" ] from .data_loader_collection import DataLoaderCollection from .trainer import Trainer
StarcoderdataPython
1716961
<filename>src/gamemaker/write.py from os import path from logic import settings def tofile(planets: [], config: settings.Settings): level_directory = path.join(config.directory, "ReadOnlyFiles") for planet in planets: try: file = open(path.join(level_directory, planet.name + ".plan...
StarcoderdataPython
1764310
<reponame>gixproject/polls from django.contrib import admin from django.urls import path, include from drf_yasg import openapi from drf_yasg.views import get_schema_view from rest_framework import permissions from polls.api.v1.urls import urlpatterns as polls_v1 schema_view = get_schema_view( openapi.Info( ...
StarcoderdataPython
3391484
from worker import Worker from writer import Writer from Queue import Queue class Backup: def __init__(self, target, out, threads, verbose): if target[-1] != '/': target += '/' self.THREADS_LIMIT = threads self.queue = Queue() self.writer = Writer(out) self.writ...
StarcoderdataPython
1615325
from unittest import TestCase from app.fila import Fila class TestFila(TestCase): @classmethod def setUpClass(cls): cls.arquivo = 'arquivo.txt' print('setUpClass') @classmethod def tearDownClass(cls): print('tearDownClass') from os import remove remove(cls.arqu...
StarcoderdataPython
114373
<reponame>hexgis/hex_raster_processor #!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright (c) 2011-2013 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated docum...
StarcoderdataPython
4811632
import dojo.dojo as d def test(): print(dir(d)) assert(d.test_function() is True)
StarcoderdataPython
1643150
#!/usr/bin/env python3 __title__ = 'Script to add hosts to a Host Group based on IP' __version__ = '2.0' __author__ = '<EMAIL>' __copyright__ = 'Vectra AI, Inc.' __status__ = 'Production' ''' Opens a list of IPs or subnets formatted one per line, collects Cognito hosts with those IPs, adds the hosts in turn to the gr...
StarcoderdataPython
3327722
<reponame>JF-png/jfAI<gh_stars>0 from bs4 import BeautifulSoup import requests import geocoder import time import datetime import pyowm #переменные DOLLAR_RUB = 'https://www.google.com/search?sxsrf=ALeKk01NWm6viYijAo3HXYOEQUyDEDtFEw%3A1584716087546&source=hp&ei=N9l0XtDXHs716QTcuaXoAg&q=%D0%B4%D0%BE%D0%BB%D0%BB%D...
StarcoderdataPython
83253
<reponame>matisup10/industrialbenchmark # coding=utf-8 from __future__ import division import numpy as np from numpy import pi, sin, sign from industrial_benchmark_python.goldstone.nlgp import nlgp ''' The MIT License (MIT) Copyright 2017 Siemens AG Author: <NAME> Permission is hereby granted, free of charge, to any...
StarcoderdataPython
4833840
<reponame>davidjurgens/prosocial-conversation-forecasting<filename>src/features/tpcdata.py import sys import os import gzip from collections import Counter import argparse import pyspark import string from nltk.tokenize import TreebankWordTokenizer tokenizer = TreebankWordTokenizer() letter_set = set(string.ascii_up...
StarcoderdataPython
3213061
__author__ = '<NAME>' import datetime import re import bs4 import requests def main(): pass timeout = 3 def get_share_price(ticker=''): """ This function gets the share price for the given ticker symbol. It performs a request to the nasdaq url and parses the response to find the share price. ...
StarcoderdataPython
1649070
from flask import Flask from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from flask_login import LoginManager from config import Config app = Flask(__name__) bootstrap = Bootstrap(app) app.config.from_object(Config) db = SQLAlchemy(app) migrate = Migrate(...
StarcoderdataPython
156104
<gh_stars>10-100 """Offline protocol optimization Setting ------- Given simulation results from an initial alchemical protocol, we would like to construct a new protocol whose intermediates are more "evenly spaced" according to something like "thermodynamic distance". Approach -------- * Define a "thermodynamic dista...
StarcoderdataPython
167426
<gh_stars>0 import json import time import pdb import re import traceback from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditi...
StarcoderdataPython
1794412
# -*- coding: utf-8 -*- """ # =========================================================================== # =========================================================================== # !== <NAME> == # !== <NAME> ...
StarcoderdataPython
161535
import pickle import json import fasttext import fasttext.util from DataLoader import load_unique_words # !wget https://github.com/facebookresearch/fastText/archive/v0.9.2.zip # import zipfile # target = 'v0.9.2.zip' # handle = zipfile.ZipFile(target) # handle.extractall() # handle.close() # cd ../fastText-0.9.2 ...
StarcoderdataPython
3330425
<gh_stars>1000+ print('main.py was successfully called') print('this is the new main.py') import sys print('python version is: ' + sys.version) print('python path is', sys.path) import os print('imported os') print('contents of this dir', os.listdir('./')) from flask import ( Flask, render_template, requ...
StarcoderdataPython
1779698
import abc #CLASE ABSTRACTA class Page(metaclass=abc.ABCMeta): @abc.abstractmethod def url(self): pass def folder(self): pass def link(self): pass def titulo(self): pass def desc(self): pass def fromato(self): pass #CLASE BASE IMPLEMENTAMOS C...
StarcoderdataPython
3390921
""" :title: HLSPFile.py :author: <NAME> :contact: <EMAIL> The class defined here can be used to construct a file to track information about a High-Level Science Product that will be needed for various stages of HLSP ingestion to MAST and CAOM. Methods are also provided to add new information, update existing param...
StarcoderdataPython
1731474
# -*- coding: utf-8 -*- __author__ = 'yijingping' import redis import json from django.conf import settings from hashlib import md5 from django.shortcuts import redirect REDIS_POOL = None def get_redis_pool(): global REDIS_POOL if not REDIS_POOL: REDIS_POOL = redis.ConnectionPool(**settings.REDIS_OPTI...
StarcoderdataPython
137206
from user import users print('Welcome to My Bank') card_insert = input('Press I to insert your Card: ') if card_insert in ('I', 'i'): attempts = 0 while attempts < 3: pin_inp = input('Please Enter your PIN: ') if int(pin_inp) not in users: print('PIN is wrong. Please r...
StarcoderdataPython
3297779
from .context import revas from revas import UnauthorizedToken import os import mock import pytest @pytest.fixture() def assigner(): os.environ['UDACITY_AUTH_TOKEN'] = 'some auth token' yield revas.Assigner() @mock.patch('revas.reviewsapi.ReviewsAPI.certifications') def test_retrieve_certifications_list(moc...
StarcoderdataPython
3217245
<reponame>IBM/covid19-india-data import sqlite3 from .db import DB class ContainmentZonesTable(DB): def __init__(self): self.table_name = 'PB_containment_zone' self.table_desc = 'Details about larger containment zones, with population contained in each. Table starting from Page 4 or 5 and can ext...
StarcoderdataPython
3347670
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,too-few-public-methods,inconsistent-return-statements,redefined-outer-name import json import pytest from aws_cdk import core from account_foundations.networking_stack import NetworkingStack @pytest.fixture def setup_n...
StarcoderdataPython
4824746
<filename>gui.py from tkinter import * import time import tkinter.messagebox from nltk import chat saved_username = ["You"] window_size = "500x500" class ChatInterface(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.master = master self.tl_bg = "#EEEEEE" ...
StarcoderdataPython
4840300
import statsmodels.sandbox.stats.multicomp import scipy.stats def _calculate_normalized_masked_expression(X, mask): return (X[mask, :] > 0).sum(0).A.squeeze() / len(mask) def _get_gene_mask(X, mask1, mask2, min_fraction_expressed): """ """ X_1 = _calculate_normalized_masked_expressi...
StarcoderdataPython
125410
import sqlite3 import os def do_migration(db_dir): db_path = os.path.join(db_dir, "lbrynet.sqlite") connection = sqlite3.connect(db_path) cursor = connection.cursor() cursor.executescript( """ create table reflected_stream ( sd_hash text not null, reflector_add...
StarcoderdataPython
3223034
<filename>admin/pageaudit/report/models.py import json from urllib import parse from django.contrib.postgres.fields import JSONField from django.contrib.auth.models import User, Group from django.db import models from django.db.models import Avg, Max, Min, Q, Sum, F from collections import namedtuple from .helpers im...
StarcoderdataPython
93598
<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from django.utils import timezone from .testutils import ( create_test_process_instance, create_fake_scheduled_process_task, create_fake_offset_scheduled_process_task ) from ..models import ( P...
StarcoderdataPython
161492
<reponame>smaranjitghose/AutoPromNightpy import collections #The preferrence lists of the boys preferred_rankings_boys = { 'ryan': ['lizzy', 'sarah', 'zoey', 'daniella'], 'josh': ['sarah', 'lizzy', 'daniella', 'zoey'], 'blake': ['sarah', 'daniella', 'zoey', 'lizzy'], 'connor': ['lizzy', 'sarah', 'zoey', 'danie...
StarcoderdataPython
111150
<reponame>AnacletoLAB/meta_models """Class implementing meta-model for a Dense Layer.""" from typing import Dict from .dense_meta_layer import DenseMetaLayer class HeadMetaLayer(DenseMetaLayer): """Class implementing meta-layer for Head layers. The Head meta-layer is a single neuron Dense layer with sigmoid...
StarcoderdataPython
1787292
import requests from loguru import logger from utils.config import config def get_proxies(): sub_convert_url = config['converterAPI'] + "/sub" ret = requests.get(sub_convert_url, params={"url": config['subURL'], "target": "clash", ...
StarcoderdataPython
3351708
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 1 14:41:43 2021 @author: orram """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ added the explore relations part after 735561 """ import os import sys import gc sys.path.insert(1, '/home/labs/ahissarlab/arivkind/imagewalker')...
StarcoderdataPython
3366866
import multiprocessing as mp CPU_COUNT = mp.cpu_count()
StarcoderdataPython
3266686
#!/usr/bin/env python3 import sqlite3 import subprocess from retry import retry class Instance: @staticmethod def get_machine_types(conf, min_mem): service = conf['Platform']['service'] service = service.lower() cpu_list = conf['Profiling'].get('thread', [2]) if service in ['...
StarcoderdataPython
3267446
from sqlite3 import Cursor from typing import TYPE_CHECKING, Dict, List, Literal, NamedTuple, Optional, Tuple, Union from eth_utils import is_checksum_address from rotkehlchen.accounting.structures.balance import BalanceType from rotkehlchen.assets.asset import Asset from rotkehlchen.chain.substrate.types import Kusa...
StarcoderdataPython
3236723
import pandas as pd from .dictionary import Dictionary, CharDictionary import pickle from typing import Dict, List import torch import os import numpy as np # from torchpie.config import config MULTIPLE_CHOICE_TASKS = ['action', 'transition'] def load_csv_from_dataset(task: str, split: str) -> pd.DataFrame: retu...
StarcoderdataPython
1613084
import shutil import struct from collections import defaultdict from pathlib import Path import lmdb import numpy as np import torch.utils.data from tqdm import tqdm class AvazuDataset(torch.utils.data.Dataset): """ Avazu Click-Through Rate Prediction Dataset Dataset preparation ...
StarcoderdataPython
1700031
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: UTF-8 -*- import os, sys, hashlib, argparse from pyasn1_modules import pem, rfc2459 from pyasn1.codec.der import decoder, encoder from pyasn1.type.univ import OctetString def parse_certificate(certificate_path): fqdns = set() substrate = pem.readPemFromFile(o...
StarcoderdataPython
115246
# This class parses a gtfs text file class Reader: def __init__(self, file): self.fields = [] self.fp = open(file, "r") self.fields.extend(self.fp.readline().rstrip().split(",")) def get_line(self): data = {} line = self.fp.readline().rstrip().split(",") for e...
StarcoderdataPython
1673295
# ---------------------------------------------------- # # Analizy FDTD potrzebne dla symulatora dyfuzorów # autor: <NAME> # data: 27.01.2021 # e-mail: <EMAIL> # ---------------------------------------------------- # import numpy as np import matplotlib.pyplot as plt from scipy import signal from _imports.sim_co...
StarcoderdataPython
3375187
import sys from music_artist import MusicArtist def main(): try: artist_name = sys.argv[1] artist = MusicArtist(artist_name) print(f"***Showing Results for {artist.name}***") print("***Genres:***") print(artist.genres()) print("***Albums:***") print(artist.al...
StarcoderdataPython
147544
# Generated by Django 2.1.2 on 2018-11-13 21:17 import django.db.models.deletion import i18nfield.fields from django.db import migrations, models from prtx_faq.prtx import PRTX class Migration(migrations.Migration): initial = True dependencies = [ (('event', '0017_auto_20180922_0511') if PRTX == 'p...
StarcoderdataPython
1735032
from django import forms from django.utils.translation import ugettext_lazy as _ from hujan_ui import maas from hujan_ui.installers.models import Server class AddServerForm(forms.ModelForm): machine = forms.ChoiceField(label='Name') class Meta: model = Server fields = ['machine', 'ip_address...
StarcoderdataPython
3271821
import gym from time import sleep import numpy as np import gym_snake import argparse parser = argparse.ArgumentParser() parser.add_argument('--env', type=str, default='snake-single-v0', help="""\ Select environment ID. """) FLAGS, unparsed = parser.parse_known_args() env = gym.make(FLAGS.env) def keyboard_input(...
StarcoderdataPython
1697146
from pyrocko import moment_tensor as mtm magnitude = 5.4 exp = mtm.magnitude_to_moment(magnitude) # convert the mag to moment in [Nm] # init pyrocko moment tensor m = mtm.MomentTensor( mnn = 0.04*exp, mee = 0.6*exp, mdd = -0.63*exp, mne = 0.04*exp, mnd = 0.5*exp, med = 0.21*exp) print(m) #...
StarcoderdataPython
75283
from flask import jsonify from models.mongo import Document from bs4 import BeautifulSoup import bs4 from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.ex...
StarcoderdataPython
3271022
#!/usr/bin/env python3 """ This document is created by magic at 2018/8/20 """ class Kruskal: """ 克鲁斯克算法——最小生成树 """ def __init__(self): self.parent = dict() self.rank = dict() def make_set(self, vertex): self.parent[vertex] = vertex self.rank[vertex] = 0 def ...
StarcoderdataPython
65944
<gh_stars>1-10 from webapp import models from webapp.extensions import app import flask import logging import datetime from sqlalchemy import inspect logger = logging.getLogger(__name__) def object_as_dict(obj): return {c.key: getattr(obj, c.key) for c in inspect(obj).mapper.column_attrs} def link...
StarcoderdataPython
4817399
<reponame>KoolChain/Germine from germine.api_base import WebApi class CryptonoteApi(WebApi): def get_balance(self, wallet): json = self.request("/miner/{}/stats".format(wallet.public_identifier)) return { "due": json["amtDue"], #"paid": json["totalPaid"], }
StarcoderdataPython
152700
<gh_stars>1-10 """ It parses CyanogenMod wiki to get devices specifications and save it to devices.json. The wiki informations is released under the Creative Commons Attribution-Share Alike 3.0 Unported license (CC-BY-SA). For more info go to: 1) http://wiki.cyanogenmod.org/w/CyanogenMod:Copyrights 2) http://creativ...
StarcoderdataPython
1723057
<reponame>JessicaHolm/gothello # Class that manages the transposition table. # Code adapted from the Wikipedia page for Zobrist hashing. # https://en.wikipedia.org/wiki/Zobrist_hashing import random class Table(object): # Create a array of 20 bits for all possible combinations of piece and position. def ...
StarcoderdataPython