id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1736149 | import argparse
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn, optim
from model import MyAwesomeModel
class TrainOREvaluate(object):
""" Helper class that will help launch class methods as commands
from a single ... | StarcoderdataPython |
3364168 | '''
All Blueprint routes regarding rendering ag templates
'''
from flask import Blueprint, render_template
from app.models.ag import AG, AGSchema, AGSchemaIntern, AGMessageSchema
from app.models import db
from app.util import requires_auth
from app.util.assocations import requires_mentor, requires_membership, requires... | StarcoderdataPython |
52746 | <gh_stars>1-10
"""
These settings are only needed if you are planning to push to S3, GitHub or data.world.
If you only are only saving to local files, then these are not needed.
"""
S3_BUCKETS = {
# 'bucket': name of the bucket
# 'key': syntax: a_folder/another_folder
#
# For the 'scrub' bucket, one su... | StarcoderdataPython |
3218036 | <reponame>pbh/pybrid<gh_stars>1-10
import pybrid
import os
class WolffhermanReport(pybrid.PybridReport):
AUTHOR = 'isabellamills'
NAME = 'wolffhermanreport'
GROUPS = ['bauchsauer', 'group1']
def write(self, output_dir):
f = file(os.path.join(output_dir, 'index.html'), 'w')
f.write... | StarcoderdataPython |
81115 | linkedin_email = # place your linkedin login email
linkedin_password = # place your linkedin login password | StarcoderdataPython |
1670733 | import numpy as np
import torch
import torch.nn as nn
def aggr_by_one(model, index_list=None):
if not hasattr(model, 'aggr_mask'):
model.aggr_mask = dict()
if index_list is None:
index_list = model.conv_index[1:-1]
for ind in index_list:
W = model.features[ind].weight.data
... | StarcoderdataPython |
1783703 | <filename>stupidfuckingbot.py
#i have no idea wtf i am doing
import os
import discord
import configparser
import random
from discord.ext import commands
config = configparser.ConfigParser()
config.read('settings.ini')
client = commands.Bot(command_prefix = 'l.')
frogdir = "animals/frog"
@client.event
async def on_re... | StarcoderdataPython |
1632450 | <filename>rest_registration/api/views/__init__.py<gh_stars>100-1000
from .change_password import change_password # noqa
from .login import login, logout # noqa
from .profile import profile # noqa
from .register import register, verify_registration # noqa
from .register_email import register_email, verify_email # n... | StarcoderdataPython |
14463 | <reponame>aiddun/jazzCNN
import numpy as np
from numpy import random
import glob
import scipy.io.wavfile
np.random.seed(4)
def preprocess(periods, testCategoryNum):
periodList = periods
catNum = len(periodList)
def createpathlist():
print("Loading file paths.")
x = []
y = []
... | StarcoderdataPython |
3256465 | <filename>filters.py
from astropy.io import fits
import numpy as np
from catalog_builder import build_catalog
from astropy.table import Table
hdu_list = fits.open("data/magphys_in.fits")
#print(hdu_list.info())
#print(hdu_list[1].header)
#print(hdu_list[1].columns.info())
#print(hdu_list[1].data)
data_field = hdu_lis... | StarcoderdataPython |
3380126 | import asyncio
import json
import logging
import os
import re
import shutil
import string
from collections import Counter
from dataclasses import dataclass, asdict, field
from random import random
from typing import List, Optional, Dict, Generator
import aiofiles
import github
import time
import github_util
git_hub ... | StarcoderdataPython |
4647 | #!/usr/bin/python2.5
# Copyright (C) 2007 Google Inc.
#
# 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 la... | StarcoderdataPython |
51669 | <reponame>zbowling/mojo<filename>mojo/tools/testing/mojom_fetcher/mojom_gn_tests.py
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import io
import os.path
import unittest
from fakes import FakeMojomFile... | StarcoderdataPython |
1758210 | <filename>year_2020/day_18_2020.py
from typing import List
from operator import add, mul
from util.helpers import solution_timer
from util.input_helper import read_entire_input
data = read_entire_input(2020,18)
def parse(data) -> List[List[str]]:
return [tokenise(element) for element in data]
def tokenise(exp: s... | StarcoderdataPython |
4814301 | from .fixtures import *
from tenable.errors import *
def test_event_field_name_typeerror(api):
with pytest.raises(TypeError):
api.audit_log.events((1, 'gt', '2018-01-01'))
def test_event_filter_operator_typeerror(api):
with pytest.raises(TypeError):
api.audit_log.events(('date', 1, '2018-01-01... | StarcoderdataPython |
97116 | """
*Attribute-Exact-Value-Select*
Select based on attribute value.
"""
from abc import ABCMeta
from ._select import AttributeValueSelect
__all__ = ["AttributeExactValueSelect"]
class AttributeExactValueSelect(
AttributeValueSelect,
):
__metaclass__ = ABCMeta
| StarcoderdataPython |
1673785 | import datetime
import pandas as pd
from ut_calendar_scraper.holiday import Holiday
class Semester:
def __init__(self,title,start_year,start_month,start_day,end_year,end_month,end_day,holidays=[]):
self.set_title(title)
self.set_start_date(start_year,start_month,start_day)
self.set_end_date... | StarcoderdataPython |
179975 | from pyinspect import Report
from pyinspect._colors import orange, mocassin
from rich.bar import Bar
from rich.color import Color
from .note import Note
from ._metadata import make_note_metadata
class Todo(Note):
def __init__(self, note_name, raise_error=True):
"""
A special type of note for ... | StarcoderdataPython |
1781122 | <filename>server/core/authMech/jwt.py<gh_stars>0
"""
This is Json Web Token(JWT) module for authorization mechanism in endpoints/ APIs services.
It follows RFC 7519 guidelines and easy maintainable, bare computational needs.
It is featured with configurable token expiry and token hash algo validation.
"""
# Author : Kr... | StarcoderdataPython |
3202501 | <filename>commands/Utility.py
from discord import guild, Spotify
from discord.ext import commands
import discord
import json
class Utility(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.bot_has_guild_permissions(send_messages=True)
@commands.cooldown(1, 60, commands.BucketType.g... | StarcoderdataPython |
3358077 | import time
from model import *
from utils import *
from game import VisibleGame
import p5
def run_model(mode):
actor = load_model('actor')
actor.eval()
critic = load_model('critic')
critic.eval()
def run_episode(show=True):
'''
play the game and remember what happened
'''
... | StarcoderdataPython |
3224435 | <gh_stars>1-10
import numpy as np
import random as rand
import matplotlib.pyplot as plt
class component:
def __init__(self,num_node):
self.num_node = num_node
self.parent = [i for i in range(num_node)]
self.weight = [0 for i in range(num_node)]
self.size = [1 for i in range(num_node)... | StarcoderdataPython |
1697497 | import requests
from bs4 import BeautifulSoup
class YtQueryParser:
"""
parses youtube page with search query
parses all the attrbutes for a search query results
"""
def __init__(self, query):
self.yt_query_url = "http://youtube.com/results?search_query=" + query
print(self.yt_query_url)
self.yt_links_dura... | StarcoderdataPython |
2755 | <gh_stars>0
from haven import haven_chk as hc
from haven import haven_results as hr
from haven import haven_utils as hu
import torch
import torchvision
import tqdm
import pandas as pd
import pprint
import itertools
import os
import pylab as plt
import exp_configs
import time
import numpy as np
from src import models
f... | StarcoderdataPython |
32911 | #!/usr/bin/env python
import setpath
from bike.testutils import *
from bike.transformer.save import save
from moveToModule import *
class TestMoveClass(BRMTestCase):
def test_movesTheText(self):
src1=trimLines("""
def before(): pass
class TheClass:
pass
def after(): pas... | StarcoderdataPython |
3216724 | <gh_stars>10-100
"""user note relation
Revision ID: 501e2f945ff9
Revises: <PASSWORD>
Create Date: 2015-07-06 21:21:47.558753
"""
# revision identifiers, used by Alembic.
revision = '501e2f945ff9'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto gener... | StarcoderdataPython |
3245928 | import unittest
from io import StringIO
from collections import namedtuple
import pandas as pd
from pandas.testing import assert_frame_equal, assert_series_equal
import xlsxwriter
import gptables
from gptables.core.wrappers import GPWorkbook
from gptables.core.wrappers import GPWorksheet
from gptables import Theme
fr... | StarcoderdataPython |
198482 | import asyncio
import contextlib
import logging
from typing import (Any, Dict, Iterator, List,
Optional, Sequence, Set, Tuple, Union)
from opentrons import types, hardware_control as hc, commands as cmds
from opentrons.commands import CommandPublisher
import opentrons.config.robot_configs as rc
from... | StarcoderdataPython |
195906 | #%%
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import plot_confusion_matrix
from nltk.corpus import stopwords
import pandas as pd
import pickle
import matplotlib.pyplot ... | StarcoderdataPython |
3354704 | <reponame>sozu/py-pyracmon
"""
This module exports types and functions for configurations.
`PyracmonConfiguration` is a class exposing configurable attributes.
An instance of the class held in this module is treated as global configuration. `pyracmon` is an only awy to change it.
Changes done in ``with`` block i... | StarcoderdataPython |
142047 | import time
import torch
import onnx
import os
import numpy as np
from mmcv.tensorrt import (TRTWrapper, onnx2trt, save_trt_engine,
is_tensorrt_plugin_loaded)
assert is_tensorrt_plugin_loaded(), 'Requires to complie TensorRT plugins in mmcv'
def gen_trt(onnx_file='sample.onnx', tr... | StarcoderdataPython |
194050 | #!/usr/bin/env python
import argparse, grpc, sys, os, socket, random, struct, time
from time import sleep
import time
import Queue
import socket
import struct
from scapy.all import *
import matplotlib.pyplot as plt
import thread
import csv
from fcntl import ioctl
import IN
AVERAGE_NUM = 30
AVERAGE_NUM2 = 1
def main(... | StarcoderdataPython |
133312 | """
REST API Documentation for the NRS TFRS Credit Trading Application
The Transportation Fuels Reporting System is being designed to streamline compliance reporting for transportation fuel suppliers in accordance with the Renewable & Low Carbon Fuel Requirements Regulation.
OpenAPI spec version: v1
... | StarcoderdataPython |
3250864 | <gh_stars>1-10
import hashlib
def sha512half(s):
return hashlib.sha512(s).digest()[0:32]
def hash160(s):
h = hashlib.sha256(s).digest()
m = hashlib.new('ripemd160')
m.update(h)
t = m.digest()
return t
def sha256hash(s):
s = s if s else ' '
hash1 = hashlib.sha256(s).digest()
hash2 = hashlib.sha256(hash... | StarcoderdataPython |
1727852 | <reponame>wayneferdon/WallpaperEngine.NeteaseMusicLyricDesktop
from pykakasi import kakasi
import datetime
import json
import re
import os
import requests
import time
import sqlite3
from enum import Enum
APPDATA = os.getenv("LOCALAPPDATA")
LOGPATH = os.path.expanduser(APPDATA + "/Netease/CloudMusic/cloudmusic.elog")
... | StarcoderdataPython |
3301575 | <reponame>vishwanath1306/mltrace
from mltrace.db.base import Base
from mltrace.db.models import ComponentRun, PointerTypeEnum
from sqlalchemy import create_engine
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.schema import (
DropConstraint,
DropTable,
MetaData,
Table,
ForeignKey... | StarcoderdataPython |
1779540 | <reponame>animesh/DeepRT
import pandas as pd
from pydicom import read_file
import re
import logging
class DicomTable:
def __init__(self, dicom_path):
self.dicom_path = dicom_path
self.dicom_file = read_file( self.dicom_path )
self.record_lookup = self.get_patient_data()
self.record_... | StarcoderdataPython |
123068 | <gh_stars>0
import click
from .core import search
from .common import copy_to_clipboard, find_subtitle
@click.command()
@click.argument('moviename', required=False)
@click.option('--subtitle', '-s', help='Given keyword(usually the file name) to search')
def main(moviename, subtitle):
if moviename:
search... | StarcoderdataPython |
3206400 | <gh_stars>0
from django.contrib.auth import authenticate, login
from django.urls import reverse_lazy
from django.views.generic.edit import FormView
from django.contrib.auth.views import LoginView, LogoutView
from app_users.forms import ChatUserRegistration
class ChatUserRegisterView(FormView):
form_class = ChatUs... | StarcoderdataPython |
1660459 | # coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... | StarcoderdataPython |
3256880 | <reponame>tmanabe/PairwisePreferenceMultileave
import numpy as np
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import utils.rankings as rnk
from multileaving.ProbabilisticMultileave import ProbabilisticMultileave
class SampleOnlyScoredMultileave(ProbabilisticMultileave):
def __in... | StarcoderdataPython |
1717608 | from Python_lab02_The_Life.models.position_model import PositionModel
class CellModel:
"""Cell representation"""
def __init__(self, position: PositionModel):
"""C'stor"""
self.__alive = False
self.__position = position
def change(self) -> None:
"""Change living state of ce... | StarcoderdataPython |
3396007 | import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
out_file = sys.argv[1]
x_label = sys.argv[2]
y_label = sys.argv[3]
names = []
X = []
Y = []
i = 0
for l in sys.stdin:
A = l.rstrip().split()
if len(A) == 3:
names.append(A[0])
X.append(float(A[1]))
Y.app... | StarcoderdataPython |
4828158 | <reponame>jessamynsmith/django-enumfields
# -- encoding: UTF-8 --
import uuid
try:
from django.contrib.auth import get_user_model
except ImportError: # `get_user_model` only exists from Django 1.5 on.
from django.contrib.auth.models import User
get_user_model = lambda: User
from django.core.urlresolvers... | StarcoderdataPython |
14953 | <filename>src/quality_control/bin/createSpotDetectionQCHTML.py
import json
from bs4 import BeautifulSoup
import pandas as pd
import sys
# Argparsing
argument_index = 1
template = sys.argv[argument_index]
argument_index +=1
recall_json = sys.argv[argument_index]
argument_index +=1
recall_plot = sys.argv[argument_inde... | StarcoderdataPython |
3222047 | from gameComponents import gameVars
# Defining a win or lose function
def winorlose(status):
if status == "won":
pre_message = "You are the yuuuuuuugest winner ever! "
else:
pre_message = "You done trumped it, loser! "
print(pre_message + "Would you like to play again?")
choice = input("Y / N? ... | StarcoderdataPython |
1656100 | <gh_stars>0
__version__ = '0.74.0'
| StarcoderdataPython |
1623482 | <reponame>sourcery-ai-bot/Python-Curso-em-Video
# Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa.
# Pergunte o valor da casa, o salário do comprador e em quantos anos ele vai pagar.
# A prestação mensal não pode exceder 30% do salário ou então o empréstimo será negado.
vlrcasa = float... | StarcoderdataPython |
3329720 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
import os
import re
import subprocess
import sys
from string import Template
DOCKER_IMAGE_NAME_RE = re.compile(r"^([a-zA-Z0-9_.]+/)?[a-zA-Z0-9_.]+$")
DOCKER_IMAGE_TAG_RE = re.compile(r"^[a-zA-Z0-9_.]+$")
ARCHIVE_NAME_VALID_CHAR_RE = re.compile... | StarcoderdataPython |
1661858 | <gh_stars>0
import random
from jmetal.core.problem import Problem
from jmetal.core.solution import FloatSolution, CompositeSolution, IntegerSolution
from AlgoritmoGenetico.Problema.Reducao_Regras import Reducao
from SistemaFuzzy.Model.Regra import Regra
from SistemaFuzzy.Raciocinio.Geral import Classificacao
from Algor... | StarcoderdataPython |
100342 | <reponame>calebho/gameanalysis
"""Module for performing game analysis"""
__version__ = '8.0.3'
| StarcoderdataPython |
3249463 | import time
from debugwire import DWException
def hexdump(data):
return " ".join("{:02x}".format(b) for b in data)
class BaseInterface:
def __init__(self, enable_log=False):
self.enable_log = enable_log
def _log(self, msg):
if self.enable_log:
print(msg)
class BaseSerialInter... | StarcoderdataPython |
91956 | <gh_stars>0
"""
Produces color tables on stdout
"""
from mdv import tools
from mdv.plugs import plugins
from mdv.plugins import color_table_256, color_table_256_true
def colors_4():
return dict([(str(k - 10) + ' ', str(k)) for k in range(40, 48)])
def colors_8():
return color_table_256.colors
def color... | StarcoderdataPython |
1673075 | <reponame>BubuLK/sfepy
#!/usr/bin/env python
"""
Plot mesh connectivities, facet orientations, global and local DOF ids etc.
To switch off plotting some mesh entities, set the corresponding color to
`None`.
"""
from __future__ import absolute_import
import sys
sys.path.append('.')
from argparse import ArgumentParser
... | StarcoderdataPython |
87512 | #
# This script will reboot the AWS instance based on the instance-id
#
# Pre requisite: need to have aws cli installed first!
#
import os
import time
print(time.ctime())
#time.sleep(600)
aws_cmd1 = 'aws ec2 describe-instances --query "Reservations[].Instances[].InstanceId" --filter "Name=instance-state-name,Values... | StarcoderdataPython |
4803068 | <filename>pewpew/hdf5/reader.py
from ..base import StreamElement
import logging
import h5py
import os
class Reader(StreamElement):
log = logging.getLogger('pewpew.hdf5.reader')
def on_start(self):
self.file_list = self.config.get('file_list', [])
self.repeat = self.config.get('repeat', False... | StarcoderdataPython |
1732947 | <filename>mython/trampoline.py
#! /usr/bin/env python
# ______________________________________________________________________
"""
Defines a set of utilities for LL(1) parsing using a trampoline
instead of a call stack.
The trampoline uses generators and a heap-based stack instead of the
Python call stack.
"""
# _____... | StarcoderdataPython |
1684238 | # -*- coding: utf-8 -*-
"""Generate the coverage.rst and coverage.rst files from test
results."""
from __future__ import print_function
import os
import sys
from docs_common import check_cclib
# Import cclib and check we are using the version from a subdirectory.
import cclib
check_cclib(cclib)
def generate_cove... | StarcoderdataPython |
3228769 | <reponame>jhm-/nhlscrappo
from nhlscrappo import __version__
from distutils.core import setup
from setuptools import find_packages
def _read(file):
return open(file, 'rb').read()
setup(name="nhlscrappo",
version=__version__,
description="Web scraping API for NHL.com Real Time Shot System (RTSS) report... | StarcoderdataPython |
164891 | <filename>home/migrations/0006_remove_banner_site.py
# Generated by Django 3.1.7 on 2022-02-28 18:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0005_banner'),
]
operations = [
migrations.RemoveField(
model_name='banner'... | StarcoderdataPython |
1640273 | import argparse
import json
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from datasets.phototourism import build_tourism
from models.nerf import build_nerf
from models.rendering import get_rays_tourism, sample_points, volume_render
from utils.tour_video import create_interpolatio... | StarcoderdataPython |
157423 | <reponame>niooss-ledger/tpm2-pytss
"""
SPDX-License-Identifier: BSD-2
"""
from distutils import spawn
import logging
import os
import random
import socket
import subprocess
import sys
import tempfile
import time
import unittest
from time import sleep
from ctypes import cdll
from tpm2_pytss import *
class BaseTpmSi... | StarcoderdataPython |
64283 | <filename>tests/units/test_prefixes.py
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license, see LICENSE.
"""
Tests for the hepunits.units.prefixes module.
"""
from pytest import approx
from math import log
from hepunits.units import mega, micro, yotta, yocto, kibi, tebi
def test_prefixes_e6():
... | StarcoderdataPython |
1785016 | <gh_stars>1-10
# Generated by Django 3.0.4 on 2020-03-30 16:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('client', '0010_auto_20200402_1202'),
]
operations = [
migrations.RemoveField(
model_name='volunteer',
name='f... | StarcoderdataPython |
4821926 | <reponame>moshi4/GBKviz<filename>tests/test_draw_genbank_fig.py
from pathlib import Path
from typing import List
from gbkviz.draw_genbank_fig import DrawGenbankFig
from gbkviz.genbank import Genbank
def test_draw_genbank_fig(genbank_files: List[Path], tmp_path: Path):
"""test draw_genbank_fig"""
gbk_list = [... | StarcoderdataPython |
74995 | <gh_stars>1-10
"""
Pokazuje losowe zdjęcie z losowej galerii z losowego zamku (Może trochę zająć - 3 synchroniczne zapytania).
"""
from asyncio import run
from io import BytesIO
from random import choice
from PIL import Image # pip install pillow
from pymondis import Client
async def main():
async with Client... | StarcoderdataPython |
147652 | <reponame>beckerr-rzht/python-eduvpn-client
from typing import Optional, Iterable, Callable, List, Dict
import enum
from functools import lru_cache
from gi.repository import Gtk, GObject
from eduvpn.server import (
AnyServer as Server, InstituteAccessServer,
OrganisationServer, SecureInternetLocation, CustomSer... | StarcoderdataPython |
116451 | #! /usr/bin/env python
# IDLE Behavior
# WARNING! if person tracking is acting crazy, check that
# the person tracker node is using the correct camera!!
import rospy
import actionlib
import behavior_common.msg
import time
import rospkg
import rosparam
from std_msgs.msg import Float64
from std_msgs.msg import String... | StarcoderdataPython |
82374 | <gh_stars>0
from __future__ import unicode_literals
from .models import elb_backend
mock_elb = elb_backend.decorator
| StarcoderdataPython |
3222336 | <filename>solutions/1.5.py
# One Away
def one_away(string_1, string_2):
# One Character Removed from String 2
if (len(string_1) - len(string_2)) == 1:
for pos in range(len(string_1)):
if string_1[pos] != string_2[pos]:
if string_1[pos + 1:] == string_2[pos:]:
... | StarcoderdataPython |
1675412 | <reponame>adriangrepo/qreservoir
import unittest
import logging
from PyQt4.QtGui import QApplication, QWidget
from PyQt4.QtTest import QTest
import sys
from db.test.dummydbsetup import DummyDbSetup
from gui.wellplot.model.wellplotmodelaccess import WellPlotModelAccess
from db.windows.wellplot.template.wellplottempl... | StarcoderdataPython |
2671 | import logging
import os
import pickle
import sys
import threading
import time
from typing import List
from Giveme5W1H.extractor.root import path
from Giveme5W1H.extractor.tools.util import bytes_2_human_readable
class KeyValueCache(object):
def __init__(self, cache_path):
"""
:param cache_path: ... | StarcoderdataPython |
164005 | """
Internal tools needed to query the index based on rectangles
and position/radius. Based on tools in argodata:
https://github.com/ArgoCanada/argodata/blob/master/R/utils.R#L54-L165
"""
import warnings
import numpy as np
def geodist_rad(long1, lat1, long2, lat2, R=6371.010):
delta_long = long2 - long1
delt... | StarcoderdataPython |
1690121 | ### please change the corresponding path prefix ${PATH}
import sys, os, errno
import numpy as np
import csv
import json
import copy
assert len(sys.argv) == 2, "Usage: python log_analysis.py <test_log>"
log = sys.argv[1]
with open(log, 'r') as f:
lines = f.read().splitlines()
split='test'
with open('${PATH}/Charade... | StarcoderdataPython |
4803100 | """
Cokriging example from [Forrester 2007] to show
MultiFiMetaModel and MultiFiCoKrigingSurrogate usage
"""
import numpy as np
from openmdao.main.api import Assembly, Component
from openmdao.lib.datatypes.api import Float
from openmdao.lib.drivers.api import CaseIteratorDriver
from openmdao.lib.components.api impor... | StarcoderdataPython |
4811517 | <filename>record_a_gif.py<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 30 17:16:29 2020
@author: yiningma
"""
import os
import imageio
import numpy as np
import gym
from Utils.envGym import envGym
from Utils.model_loader import model_loader
def record(model,env,seed,max_l... | StarcoderdataPython |
3225363 | <gh_stars>10-100
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
.. module:: __init__
:synopsis: module that contains classes that mapped to the configuration file.
"""
from abc import abstractmethod
from typing import (
List,
Union,
Dict,
Tuple
)
from mockintosh.constants import PYBARS, JINJA
fro... | StarcoderdataPython |
1606474 | # -*- coding: utf-8 -*-
"""
Created on Wed May 27 18:55:22 2020
@author: Lucas
"""
print ("Conversor de unidade de medida")
velocidade = float(input("Digite sua velocidade: "))
print ("""Para qual velocidade pretende converter?
[1] Para Km/m
[2] Para m/s""")
opção = int(input("Sua opção: "))
if opção ==... | StarcoderdataPython |
3202946 | from typing import Tuple
import matplotlib.pyplot as plt
import pandas as pd
from polar_bearings.opt_pah_finder_robotics.potential_field_planning import (
potential_field_planning,
)
def main(
filepath: str = "ice_thickness_01-01-2020.csv",
rescaling_factor: int = 2,
grid_size: float = 0.1,
robo... | StarcoderdataPython |
1721576 | <gh_stars>0
# MIT License
#
# Copyright (c) 2018 <NAME>, <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | StarcoderdataPython |
3352654 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 2 19:55:38 2018
@author: saschajecklin
"""
import sys
import os
sys.path.append("..")
#from scores.score_logger import ScoreLogger
from connect4game import Connect4
import random
import numpy as np
from collections import deque
import tensorflow a... | StarcoderdataPython |
3327959 | <reponame>faircloth-lab/itero
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
(c) 2018 <NAME> || http://faircloth-lab.org/
All rights reserved.
This code is distributed under a 3-clause BSD license. Please see
LICENSE.txt for more information.
Created on 14 April 2018 16:10 CDT (-0500)
"""
from __future__ import... | StarcoderdataPython |
68350 | <reponame>HatsuneMiku4/reaver
import reaver.envs
import reaver.models
import reaver.agents
import reaver.utils
| StarcoderdataPython |
3391316 | ########################################################################
# amara/bindery/model/examplotron.py
"""
Examplotron specialization of bindery node XML model tools
"""
__all__ = [
'examplotron_model',
]
import sys
#import re
import warnings
import copy
from cStringIO import StringIO
from itertools import *
... | StarcoderdataPython |
1690734 | #!/usr/bin/env python
import os
import sys
sys.path.append('/home/bithika/src/House-Number-Detection')
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.io import loadmat
from skimage import color
from skimage import io
from sklearn.model_selection import train_test_split
from sklearn... | StarcoderdataPython |
3393073 | # coding: utf8
"""
ref
1. http://disi.unitn.it/moschitti/Tree-Kernel.htm
2. http://disi.unitn.it/moschitti/Teaching-slides/slides-AINLP-2016/SVMs-Kernel-Methods.pdf
3. code: http://joedsm.altervista.org/pythontreekernels.htm
4. wiki: https://en.wikipedia.org/wiki/Tree_kernel
"""
from __future__ import print_function
im... | StarcoderdataPython |
30527 | <reponame>payoto/graphcore_examples
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
# Copyright 2021 RangiLyu.
#
# 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.apac... | StarcoderdataPython |
3248548 | <gh_stars>0
# MIT License
#
# Copyright (c) 2017 <NAME>, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | StarcoderdataPython |
126556 | <reponame>Geson-anko/JARVIS3
import torch
from torch.nn import (
Module,Linear,
Conv1d,BatchNorm1d,AvgPool1d,
ConvTranspose1d,Upsample,
)
import os
import random
from .config import config
class Encoder(Module):
input_size:tuple = (1,config.futures,config.length,2)
output_size:tuple = (1,64,8)
... | StarcoderdataPython |
1686676 | <filename>termapp/overlay_event.py
#!/usr/bin/env python3
import urwid
class OverlayEvent(urwid.WidgetWrap):
def __init__(
self,
first_widget,
second_widget,
width = 15,
height = 10,
vertical_align = "middle",
horizontal_align = "center"
):
# C... | StarcoderdataPython |
3391271 | <filename>fluent.syntax/tests/syntax/__init__.py
import textwrap
def dedent_ftl(text):
return textwrap.dedent(f"{text.rstrip()}\n")
| StarcoderdataPython |
3395252 | <reponame>LemuelPuglisi/TutoratoTap<filename>Lesson_n5/examples/titanic_survival_prediction_pipeline.py<gh_stars>1-10
""" Train an Random Forest Classifier model that can predict if an actor
survived on the Titanic.
"""
import shutil
import pyspark.sql.functions as funcs
from pyspark import SparkFiles
from pysp... | StarcoderdataPython |
1744943 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from test_import import *
if __name__ == "__main__":
test_name = sys.argv[1]
test_dir = sys.argv[2]
tmp_dir = sys.argv[3]
rc = run_pyfunnel(test_dir)
assert rc == 0, "Binary status code for {}: {}.".format(test_dir, rc)
dif_err = dif_test(test_di... | StarcoderdataPython |
3383100 | from dbkcore.core import BaseObject, trace, Log
from pyspark.sql.dataframe import DataFrame as PyDataFrame
import pyspark.sql.functions as F
from pyspark.sql import SparkSession
from pyspark.sql.utils import AnalysisException
from enum import Enum
# from abc import ABC, abstractmethod
from abc import abstractmethod
imp... | StarcoderdataPython |
162997 | <reponame>DirkyJerky/Uni<gh_stars>0
import numpy as np
from matplotlib import pyplot as plt
T=60 # final simulation time
N=100 # Step count
h=T/N # Step size
beta = 0.5 # S->I growth
gamma = 0.25 # I->R growth
rho1 = 0.01 # Group 1->2 growth
rho2 = 0.01 # Group 2->1 growth
Phi = np.zeros((N+1,6)) # Array for storin... | StarcoderdataPython |
194473 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, os, sys
from frappe.modules import load_doctype_module
from frappe.utils.nestedset import rebuild_tree
from frappe.utils import update_progress_bar
import static... | StarcoderdataPython |
4724 | <gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright © 2012-2016 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the “License”); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2... | StarcoderdataPython |
1774744 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from math import pi
import funcs as f
from importlib import reload
import dataframe_cleaner
reload(radar1_class)
import radar1_class
from radar1_class import Radar1
import unidecode
from unidecode import unidecode
#final list of columns to choose fr... | StarcoderdataPython |
54355 | import argparse
from PIL import Image
import numpy as np
import onnxruntime as rt
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="StyleTransferONNX")
parser.add_argument('--model', type=str, default=' ', help='ONNX model file', required=True)
parser.add_argument('--input', type=str, d... | StarcoderdataPython |
1732916 | import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
def train_knn(X, Y):
"""Trains a K-nearest-neighbors classifier on data X and labels Y, and retu... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.