id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
74956
# -*- coding: utf-8 -*- u''' This script evaluates the performance of the following outlier detection method: - Consensus Regularized Multi-View Outlier Detection (CMOD) - DMOD - HOAD Arguments: -c, --config: JSON file with the information required to insert data -N, --datasetName: name of the im...
StarcoderdataPython
1705065
from unittest import TestCase from regulations.generator.layers import tree_builder from regulations.generator.node_types import REGTEXT import itertools class TreeBuilderTest(TestCase): def build_tree(self): child = { 'text': 'child text', 'children': [], 'label_id':...
StarcoderdataPython
1680823
<gh_stars>10-100 """An example of solving a reinforcement learning problem by using evolution to tune the weights of a neural network.""" import os import sys import gym from gym import spaces from matplotlib import pyplot as plt import numpy as np from leap_ec import Individual, Representation, test_env_var from le...
StarcoderdataPython
63029
<gh_stars>0 import socket import sys import time import pigpio from threading import Thread import os host = '192.168.1.64' port = 80 red = 27#17#22 green = 17#27 blue = 22#17 BOWL = 'Empty' ROOM = b'Mild' MODE = 'TEMP' DEPTH = b'Empty' p = pigpio.pi() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def reset()...
StarcoderdataPython
3220834
import os import sys import pygame import pygame_gui # setting path sys.path.append(os.path.join(".")) from pysimgame.utils.gui_utils import UI_TOGGLEBUTTON_TOGGLED, UIToggleButton pygame.init() pygame.display.set_caption("Quick Start") window_surface = pygame.display.set_mode((1400, 1000)) manager = pygame_gui.U...
StarcoderdataPython
3204287
<reponame>fitoprincipe/gee-composite<filename>geecomposite/widgets/export.py<gh_stars>1-10 from geetools import batch from ipywidgets import * class toAsset(VBox): def __init__(self, **kwargs): super(toAsset, self).__init__(**kwargs) layout = Layout(width='500px') self.bapwidget = kwargs.g...
StarcoderdataPython
3280840
from django.contrib import admin from user.models import User # Register your models here. admin.site.register(User)
StarcoderdataPython
1631937
<filename>files/models.py<gh_stars>1-10 from django.db import models from django.utils import timezone # Create your models here. class Photo(models.Model): """ Photos Table """ client = models.OneToOneField("home.Client", on_delete=models.CASCADE) passport = models.ImageField("Passport Size", bla...
StarcoderdataPython
178695
<filename>run_placesCNN_basic.py # PlacesCNN for scene classification # # by <NAME> # last modified by <NAME>, Dec.27, 2017 with latest pytorch and torchvision (upgrade your torchvision please if there is trn.Resize error) import torch from torch.autograd import Variable as V import torchvision.models as models from t...
StarcoderdataPython
42256
<filename>self_finance/front_end/routes/reference.py from flask import render_template from self_finance.front_end import app def _standard_render(): return render_template("reference.html") @app.route('/reference') def reference(): return _standard_render()
StarcoderdataPython
1747017
import sys import pygame from time import sleep from settings import Settings from ship import Ship from bullet import Bullet from alien import Alien from game_stats import GameStats from button import Button from scoreboard import Scoreboard from difficulty import Difficulty class AlienInvasion: '''docs...
StarcoderdataPython
64837
<gh_stars>1-10 from os import environ from cocotb_usb.host import UsbTest from cocotb_usb.host_valenty import UsbTestValenty TARGET = environ.get('TARGET') def get_harness(dut, **kwargs): ''' Helper function to assign test harness object. Object is chosen using ``TARGET`` environment variable. ''' ...
StarcoderdataPython
27537
import os import glob import json import unittest import satsearch.config as config from satstac import Item from satsearch.search import SatSearchError, Search class Test(unittest.TestCase): path = os.path.dirname(__file__) results = [] @classmethod def setUpClass(cls): fnames = glob.glob...
StarcoderdataPython
101067
import torch from torch.utils.data import DataLoader, TensorDataset from argparse import Namespace import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np import h5py import json import os def load_data_1scale(hdf5_file, ndata, batch_size, singlescale=True): with h5py.File(hdf5_file...
StarcoderdataPython
4833595
from viusitemapparser.sitemap_file import SitemapFile import logging from viusitemapparser.url_functions import check_if_url import requests import os.path def get_file(filename): result_file = SitemapFile(filename) try: # If remote file: use requests if check_if_url(filename): re...
StarcoderdataPython
3271661
<reponame>gabrielgomesml/AlgorithmAndDataStructureActivities<gh_stars>0 class GrafoLista: def __init__(self, iteravel, ponderado=False, direcionado=False): self.iteravel = iteravel self.ponderado = ponderado self.direcionado = direcionado self.listaDeAdj = {} self.criarListas...
StarcoderdataPython
26800
'''def operations(a,b,c): if(c=='+'): return a+b elif(c=='-'): return a-b elif(c=='*'): return a*b elif(c=='/'): return a/b elif(c=='%'): return a%b elif(c=='**'): return a**b elif(c=='//'): return a//b else: ...
StarcoderdataPython
89340
<filename>hello-python/hello-world.py<gh_stars>1-10 #!/usr/bin/python print "Hello, World."
StarcoderdataPython
3395474
from shapely.geometry import Point import geopandas as gpd pnt1 = Point(80.99456, 7.86795) pnt2 = Point(80.97454, 7.872174) points_df = gpd.GeoDataFrame({"geometry": [pnt1, pnt2]}, crs="EPSG:4326") points_df = points_df.to_crs("EPSG:5234") points_df2 = points_df.shift() # We shift the dataframe by 1 to align pnt1 wit...
StarcoderdataPython
3389187
#!/usr/bin/env python import os from app import create_app, freezer from flask.ext.script import Manager from config import basedir from itertools import chain from jinja2 import Template import datetime app = create_app(os.getenv('FLASK_CONFIG') or 'default') manager = Manager(app) @manager.command def build(): ...
StarcoderdataPython
138084
<filename>src/cars/CarHuman.py<gh_stars>1-10 from src.cars.Car import Car class CarHuman(Car): def __init__(self, track): super(CarHuman, self).__init__(track)
StarcoderdataPython
56730
<gh_stars>0 import sys import tensorflow as tf2 DEFAULT_GPU_LIST = [0, 1, 2] SCALE = 2 MEMORY_LENGTH = 1000000 STACK_LENGTH = 4 BATCH_SIZE = 64 LEARNING_RATE = 0.00025 GAMMA = 0.9 EPSILON = 1.0 EPSILON_MIN = 0.01 EPSILON_DECAY = 0.00003 GIVEN_GPU = [eval(sys.argv[1])] if len(sys.argv) > 1 else DEFAULT_GPU_LIST ...
StarcoderdataPython
4454
<reponame>claws/adsb import asyncio import datetime import logging import socket from . import protocol from typing import Tuple from asyncio import AbstractEventLoop logger = logging.getLogger(__name__) class Server(object): def __init__( self, host: str = "localhost", port: int = 3...
StarcoderdataPython
3366838
<filename>quad_mesh_to_rgba/coastlines.py import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import cartopy import bokeh.plotting figure = bokeh.plotting.figure(sizing_mode='stretch_both', match_aspect=True) # Struggling to find appropriate extent for cartopy f...
StarcoderdataPython
124383
#!/usr/bin/env python3 # -*- coding: utf-8 -*- '第 0009 题:一个HTML文件,找出里面的链接。' __author__ = 'Drake-Z' import os, re from html.parser import HTMLParser from html.entities import name2codepoint class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == 'a': for (variables, ...
StarcoderdataPython
39971
<gh_stars>1-10 import os import tensorflow as tf import random import numpy as np import matplotlib.pyplot as plt # uncomment for inline for the notebook: # %matplotlib inline import pickle # enter the directory where the training images are: TRAIN_DIR = 'train/' IMAGE_SIZE = 512 train_image_file_names = [TRAIN_DIR+i...
StarcoderdataPython
1786763
# -*- coding: latin-1 -*- # This program is public domain # Author: <NAME> """ Define unit conversion support for NeXus style units. The unit format is somewhat complicated. There are variant spellings and incorrect capitalization to worry about, as well as forms such as "mili*metre" and "1e-7 seconds". This is a mi...
StarcoderdataPython
3287665
<gh_stars>0 import logging import sched import sys import winsound import webbrowser from scraper import init_scrapers from termcolor import colored class Engine: def __init__(self, args, config, driver): self.refresh_interval = config.refresh_interval self.max_price = config.max_price sel...
StarcoderdataPython
130900
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
StarcoderdataPython
3207387
"""Calculate Intersection-Over-Union(IOU) of two bounding boxes.""" import numpy as np def bbox_iou(bbox_a, bbox_b): """Calculate Intersection-Over-Union(IOU) of two bounding boxes. Parameters ---------- bbox_a : numpy.ndarray An ndarray with shape :math:`(N, 4)`. bbox_b : numpy.ndarray ...
StarcoderdataPython
181194
import logging from argparse import ArgumentParser import yaml from src.app import Application class ConfigFromCLI: def __init__(self): self._host = '127.0.0.1' self._port = 8000 self._set_config() def _set_config(self): config = self._get_config_from_file() if confi...
StarcoderdataPython
3302703
from src.wrapper.sh1106 import Screen from src.modules.clock_module import Module as ClockModule from src.modules.temperature_module import Module as TemperatureModule from PIL import Image, ImageDraw, ImageFont import os font_path = os.path.join('assets', 'Font.ttf') class MenuItem: def __init__(self, title, mod...
StarcoderdataPython
3321834
import sys import importlib import bpy from pathlib import Path # running as a script from terminal: path_script = Path(__file__) # running as a script from within blender: #path_script = Path(bpy.context.space_data.text.filepath) path_repo = path_script.parent.parent sys.path.append(str(path_repo.joinpath('LIB'))) ...
StarcoderdataPython
1777
<reponame>MaxwellDPS/healthchecks import os from django.conf import settings from django.template.loader import render_to_string from django.utils import timezone import json import requests from urllib.parse import quote, urlencode from hc.accounts.models import Profile from hc.lib import emails from hc.lib.string i...
StarcoderdataPython
4815585
<reponame>justinshenk/simba<filename>simba/data_plot.py import os import pandas as pd import statistics import numpy as np import cv2 from configparser import ConfigParser, MissingSectionHeaderError, NoOptionError, NoSectionError import glob from simba.drop_bp_cords import * def data_plot_config(configini, Se...
StarcoderdataPython
3303218
# Pick pivot # Partition in lower and higher part # Recursively sort lower and higher def quicksort(in_list): if len(in_list)<2: return in_list pivot_index = int(len(in_list)/2) #choice of pivot? pivot_val = in_list[pivot_index] # in place? lower_list = [val for i,val in enumerate(in_list) if va...
StarcoderdataPython
1716285
<filename>src/genie/libs/parser/iosxe/tests/ShowIpNhrpNhs/cli/equal/golden_output_2_expected.py expected_output = { "Tunnel100": { "nhs_ip": { "172.16.58.3": { "nhs_state": "RE", "nbma_address": "172.16.17.32", "priority": 0, "clust...
StarcoderdataPython
196481
<gh_stars>0 import inspect import logging import os import time import traceback from AndroidRunner.Devices import Devices from AndroidRunner.PluginHandler import PluginHandler from AndroidRunner.util import makedirs import paths # noinspection PyUnusedLocal class PluginTests(object): def __init__(self, config)...
StarcoderdataPython
1751411
<reponame>jayvdb/django-compat-patcher from __future__ import absolute_import, print_function, unicode_literals import os, sys, random import pytest import _test_utilities from django_compat_patcher.registry import get_relevant_fixers, get_relevant_fixer_ids, get_fixer_by_id from django_compat_patcher.utilities impo...
StarcoderdataPython
1706427
<gh_stars>0 # python list generator print '************** Generator Test Programs **************' l = [x * x for x in range(10)] print l g = (x * x for x in range(10)) print g for x in g: print x def fib(max): n, a, b = 0, 0, 1 while n < max: yield b a, b = b, a + b n = n + 1 fo...
StarcoderdataPython
1793104
from .supertype import supertype
StarcoderdataPython
151115
# This program has been developed by students from the bachelor Computer Science at Utrecht University within the # Software and Game project course # ©Copyright Utrecht University Department of Information and Computing Sciences. """Contains test data.""" test_get_assignments_data = \ { "courses": [ ...
StarcoderdataPython
198577
#! usr/bin/env python # coding:utf-8 #===================================================== # Copyright (C) 2020 * Ltd. All rights reserved. # # Author : Chen_Sheng19 # Editor : VIM # Create time : 2020-06-09 # File name : # Description : product TFRecord data from image file # #==========================...
StarcoderdataPython
3251633
<filename>check_data_quality/cc/checkrn.py #!/usr/bin/env python # -*- coding:utf-8 -*- import sys import os import codecs # gbk gb18030 def checkFile(filePath, readCode='utf_8_sig'): dir_name = os.path.dirname(filePath) new_file_name = os.path.splitext(os.path.basename(filePath))[0] \ +...
StarcoderdataPython
35489
import mock import pytest from prf.tests.prf_testcase import PrfTestCase from pyramid.exceptions import ConfigurationExecutionError from prf.resource import Resource, get_view_class, get_parent_elements from prf.view import BaseView class TestResource(PrfTestCase): def test_init_(self): res = Resource(se...
StarcoderdataPython
3211871
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 30 02:03:04 2019 @author: linyizi """ class LDA_original: @staticmethod def _convergence_(new, old, epsilon = 1.0e-3): ''' Check convergence. ''' delta = abs(new - old) return np.all(delta) < eps...
StarcoderdataPython
1684175
<reponame>PhilippMatthes/carnivora<filename>carnivora/instabot/driver.py import datetime import threading import os from traceback import format_exc from selenium import webdriver # For webpage crawling from time import sleep import platform from selenium.common.exceptions import TimeoutException, NoSuchElementExc...
StarcoderdataPython
3384895
import torch import torch.nn as nn import numpy as np __all__ = ['Pruner'] class Pruner: def __init__(self, net, rank_type='l2_weight', num_class=1000, \ safeguard=0, random=False, device='cuda', resource='FLOPs'): self.net = net self.rank_type = rank_type self.chains = {} # chain...
StarcoderdataPython
148757
# 创建了新的tags标签文件后必须重启服务器 from django import template from ..models import Ouser from comment.models import CommentUser register = template.Library() @register.simple_tag() def get_user_data(uid): """返回用户的信息""" user = Ouser.objects.filter(id=uid) if user: return user[0] else: return ''...
StarcoderdataPython
190136
<reponame>teslafields/code-challenges<filename>longest_palindromic.py class Solution: def longestPalindrome(self, s): slen = len(s) longest = '' longest_len = 0 for i in range(1, slen-1): loops+=1 l, r = i-1, i+1 subs = s[i] while l >=...
StarcoderdataPython
103211
<reponame>sroet/openpathsampling-cli from paths_cli.compiling.core import InstanceCompilerPlugin from paths_cli.plugin_management import OPSPlugin class CategoryPlugin(OPSPlugin): """ Category plugins only need to be made for top-level """ def __init__(self, plugin_class, aliases=None, requires_ops=(1...
StarcoderdataPython
1667458
# Generated by Django 3.1.2 on 2020-12-25 21:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mvp', '0010_brandcollector'), ] operations = [ migrations.AddField( model_name='brandcollector', name='message', ...
StarcoderdataPython
1645865
<gh_stars>0 import abc import os import time import typing import requests from flask import current_app from urllib.parse import urlencode from src.models.bright import HealthCheck, HealthCheckStatus __all__ = ("BrightAPI",) class BrightBase(abc.ABC): """Base class for Bright API.""" default_headers = {"...
StarcoderdataPython
21212
import unittest import os import json import pandas as pd import numpy as np class TestingExercise2_07(unittest.TestCase): def setUp(self) -> None: ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(ROOT_DIR, '..', 'dtypes.json'), 'r') as jsonfile: self.dtyp =...
StarcoderdataPython
1799776
import sys import os import tempfile import unittest import sd3.cfa.graph import sd3.cfa.shortestpath class TestGraph(unittest.TestCase): def test_edge(self): node_src_id = 1 node_dest_id = 2 node_src = sd3.cfa.graph.Node(node_src_id) node_dest = sd3.cfa.graph.Node(node_dest_id) ...
StarcoderdataPython
3327075
""" This module contains functions related to orbit calculations """ # Standard library imports from typing import Any,Dict,List,Tuple,Sequence #https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html # Third party imports import pandas as pd import numpy as np from numpy import rad2deg, deg2rad from numpy.linalg ...
StarcoderdataPython
3201119
<reponame>kushbanga/phylib # -*- coding: utf-8 -*- from __future__ import print_function """Simple event system.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ from contextlib import contextm...
StarcoderdataPython
1793854
<filename>LevelSpectroscopy/main.py execfile('interall.py') execfile('../util.py/energy.py') import numpy as np L = 8 Delta = 0.5 deltas = np.linspace(0.0, 1.0, 21) common_params = { 'model' : 'Spin', 'lattice' : 'chain lattice', 'method' : 'Lanczos', 'L' : L, '2S' : 2, '2Sz' : 0} with open...
StarcoderdataPython
3370383
if __name__ == '__main__': w = input() # Setting all flags to False. p = False; q = False; r = False; s = False; t = False; # Looping through all the characters from the given input. for i in w: if not(p) and i.isalnum(): # Checking if character alpha numeric or not. ...
StarcoderdataPython
3242735
test = { 'name': 'Problem 6', 'points': 2, 'suites': [ { 'cases': [ { 'answer': 'Grouping the restaurants into k clusters by location.', 'choices': [ 'Grouping the restaurants into k clusters by location.', 'Finding the mean rating of restaurants for k...
StarcoderdataPython
1725835
""" Tests for the utilities module. """ from __future__ import (absolute_import, division, print_function) import numpy as np from gridded.pyugrid import util class DummyArrayLike(object): """ Class that will look like an array to this function, even though it won't work! Just for tests. All it do...
StarcoderdataPython
3341653
""" The MIT License (MIT) Copyright (c) 2014 <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, modify, me...
StarcoderdataPython
1618871
<filename>NOL_model/diff_renderer.py import tensorflow as tf import dirt import dirt.matrices as matrices import dirt.lighting as lighting import sys,os import numpy as np from tensorflow.keras.layers import Layer def build_projection(cam, w=640, h=480, x0=0, y0=0, nc=0.1, fc=10.0): q = -(fc + nc) / float(fc - n...
StarcoderdataPython
1645908
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ To prompt if login requires """ from PyInquirer import prompt def login(crawler): answer = prompt([ { 'type': 'confirm', 'name': 'login', 'message': 'Do you want to log in?', 'default': False }, ]...
StarcoderdataPython
135631
from collections import defaultdict class Graph: def __init__(self, vertices): self.V = vertices self.graph = [] def addEdge(self, u, v, w): self.graph.append([u, v, w]) def find(self, parent, i): if parent[i] == i: return i return self.fin...
StarcoderdataPython
1754839
from __future__ import with_statement from difflib import SequenceMatcher import os from unittest import TestCase import sys import django from django import template from django.conf import settings from django.template.loader import render_to_string from django.template.engine import Engine import pep8 from sekizai...
StarcoderdataPython
173965
<gh_stars>0 import os import sys import time import uuid from datetime import datetime from numpy import mean from numpy.core import long from ios_device.servers.DTXSever import InstrumentRPCParseError from ios_device.servers.Instrument import InstrumentServer from ios_device.util.utils import kperf_data sys.path.ap...
StarcoderdataPython
3261864
<gh_stars>1-10 import numpy as np COLORS = np.array([[1, 0, 1], [0, 0, 1], [0, 1, 1], [0, 1, 0], [1, 1, 0], [1, 0, 0]]) IMG_EXTENSIONS = (".jpg", ".png")
StarcoderdataPython
1769218
#!/usr/bin/env python3 import argparse import json import uuid import requests import sys from string import Formatter from errors import UserError, RequestError from request_utils import Requests from environment_utils import Environments class Cli(object): def __init__( self, requests_filename='...
StarcoderdataPython
3263452
import sys n = int(input()) for i in range(n): x = int(input()) #if x / 4 gives rest 0, then the polygon is beautiful if (x%4 == 0): print('YES') else: print('NO')
StarcoderdataPython
24834
<reponame>zacespinosa/homicidal_chauffeur import random as random import numpy as np from dynamics import Simulator, Pursuer, Evader def test_evader(): num_d_states = 25 num_phi_states = 20 num_phi_d_states = 20 num_actions = 10 num_states = num_d_states*num_phi_states*num_phi_d_states num_epochs = 1000 p = P...
StarcoderdataPython
3250331
<filename>Demo/Code/main.py # -*- coding: UTF-8 -*- import sys from PyQt5 import QtWidgets, QtCore, QtGui from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtWidgets import (QWidget, QPushButton, QApplication) import math from run import deep_rnn_annotate # coordinates of t...
StarcoderdataPython
4839502
<gh_stars>0 #Reduce deixou de ser uma função integrada entao temos que chamar importando functools #recebe 2 parametros, Função e iteravel #So utilize reduce se for necessariamente precisa dela. Seria melhor utilizar um loop FOR #Para entender o reduce: #imagine uma coleção de dados: # Dados = a1,a2,a3,a4,a5...an #...
StarcoderdataPython
21282
<filename>tests/test_engine.py import re import pytest from hiku import query as q from hiku.graph import Graph, Node, Field, Link, Option, Root from hiku.types import Record, Sequence, Integer, Optional, TypeRef from hiku.utils import listify from hiku.engine import Engine, pass_context, Context from hiku.builder im...
StarcoderdataPython
3307166
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
StarcoderdataPython
174505
# BLOGSTER by <NAME> # a.k.a. "The Black Unicorn" a.k.a. "<NAME>". # Licensed under the MIT license. import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blogster.settings') application = get_wsgi_application()
StarcoderdataPython
3278646
<gh_stars>1-10 import requests from pprint import pprint import json # input your information user = {'userid': '', 'password': ''} r = requests.post("http://127.0.0.1:8000/post/get_tasks", params=user) # POST user data print(json.dumps(r.json(), ensure_ascii=False))
StarcoderdataPython
3325382
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import random sys.path.append('.') from twisted.internet import reactor from . import driver from . import multiplexer from . import record_layer from . import updater from . import conf EVENT_LOOP_FREQUENCY_S = 0.01 AUTOUPDATE_DELAY = 5 class Server(object...
StarcoderdataPython
133031
<filename>penin/core/mdns/__init__.py """Support for discovering local devices and services.""" from netdisco.discovery import NetworkDiscovery def discover_devices(): """Discover local devices and services.""" data = {} netdis = NetworkDiscovery() netdis.scan() for device_type in netdis.discove...
StarcoderdataPython
3340147
'''import pygame pygame.init() pygame.mixer.music.load('musica.mp3') pygame.mixer.music.play() pygame.event.wait()''' from pygame import mixer mixer.init() mixer.music.load('musica.mp3') mixer.music.play() import time time.sleep(360)
StarcoderdataPython
3368079
<gh_stars>0 import os from joblib import Parallel, delayed from os.path import join from pathlib import Path import random import shutil import scraper import remove_applause import re import subprocess import num2words import pydub from pydub import AudioSegment from tqdm import tqdm import logging logger = logging.g...
StarcoderdataPython
1746480
<reponame>prdonahue/overholt # -*- coding: utf-8 -*- """ overholt.api.users ~~~~~~~~~~~~~~~~~~ User endpoints """ from flask import Blueprint from flask_login import current_user from ..services import users from . import route bp = Blueprint('users', __name__, url_prefix='/users') @route(bp, '/') def...
StarcoderdataPython
190855
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('README.rst') as f: readme = f.read() with open('LICENSE') as f: license = f.read() setup( name='bifs', version='0.2.0', description='Implementation of Bayesian Imaging in Fourier Space (BIFS)', long_description=re...
StarcoderdataPython
3349334
<gh_stars>0 """ TMVA reader runs with additional information """ from __future__ import division, print_function, absolute_import import sys import array import pandas from root_numpy.tmva import evaluate_reader from . import tmva import six from six.moves import cPickle as pickle __author__ = '<NAME>' def t...
StarcoderdataPython
69871
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from math import ceil from typing import Optional, Tuple, Type, cast from ax.core.parameter import Choi...
StarcoderdataPython
96402
# Sprite classes for platform game import pygame import random from settings import * vec = pygame.math.Vector2 class Spritesheet1: # Utility class for loading and parsing spritesheets def __init__(self, filename): self.spritesheet1 = pygame.image.load(filename).convert() def get_image(self, x, ...
StarcoderdataPython
119910
import os from pprint import pprint from typing import List, Tuple from logger import log_settings from local_db import LocalDb, local_db_name from dir_tree import CreateTree app_log = log_settings() local_path = "k:\\data\\paper_dtdt\\some_other\\" class ParseFiles: def __init__(self, tb_item): self._ro...
StarcoderdataPython
4834155
# Generated by Django 2.2.3 on 2019-07-15 17:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('movieapi', '0002_auto_20190715_1735'), ] operations = [ migrations.AddField( model_name='movie', name='director', ...
StarcoderdataPython
50031
from hivemind import app from flask import flash, redirect, render_template, request, url_for from mcipc.query import Client as QClient @app.route('/', methods=['GET', 'POST']) def index(): if request.method == 'GET': with QClient("diseased.horse", 25565) as q: stats = q.full_stats ...
StarcoderdataPython
1798441
<gh_stars>0 from django.shortcuts import render from InputOutputFiles import Speech_to_Text as listen from InputOutputFiles import Text_to_Speech as speak import base def index(request): return render(request, 'search/search.html', {'query':"", 'output':""}) def listenSearchQuery(request): speak.say(...
StarcoderdataPython
115756
<reponame>jovanbrakus/cherrypy-example __author__ = '<NAME> <<EMAIL>>' __contact__ = '<EMAIL>' __date__ = '31 May 2012'
StarcoderdataPython
1758562
<filename>convert_scores_to_average.py<gh_stars>1-10 import glob import sys import os pattern = sys.argv[1] def file_to_scores(f): new_f = open(f,'r') s = '' for i in new_f.readlines(): s = s + i j = s.split('\n') rouge_1_f = float(j[2].split(':')[1].split()[0]) ...
StarcoderdataPython
39293
#Title: Notification Processor #Tags:plyer,python #Can process notification of your choice #plyer:built in module help you to find more information from plyer import notification def notifyme(title, message): notification.notify( title=title, message=message, app_icon='Write your icon...
StarcoderdataPython
4817067
<filename>HackerRank/Beautiful_Triplets.py ```py def beautifulTriplets(d, arr): c = 0 for i in arr: if i + d in arr and i + d*2 in arr: c += 1 return c if __name__ == '__main__': first_multiple_input = input().rstrip().split() n, d =...
StarcoderdataPython
3393422
import os os.environ['AIRFLOW__CORE__UNIT_TEST_MODE'] = 'True'
StarcoderdataPython
1708926
import sys import os from datetime import datetime, timedelta import numpy as np import xarray as xr path = str(sys.argv[1]) name = str(sys.argv[2]) level = str(sys.argv[3]) member = int(sys.argv[4]) path_wrfref = os.getenv("PATH_WRFREF") f = xr.open_dataset(path).squeeze() initialization = datetime.strptime(f.ini...
StarcoderdataPython
4836961
<reponame>bkenan/rl_offline<gh_stars>1-10 from abc import abstractmethod from typing import Optional, Sequence, Tuple import numpy as np import torch from ...gpu import Device from ...preprocessing import ActionScaler, RewardScaler, Scaler from ...torch_utility import ( eval_api, get_state_dict, map_locat...
StarcoderdataPython
3285603
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin import collections import logging import os import sys import tempfile from flexget import plugin from flexget.event import event log = logging.getLogger('subtitles') try: ...
StarcoderdataPython
4835389
<reponame>RusticiSoftware/SCORMCloud_GoogAppEngApp<filename>cron/autoexpire.py #!/usr/bin/env python # encoding: utf-8 """ reminders.py Copyright (c) 2010 <NAME>. All rights reserved. """ import cgi import os import datetime from datetime import timedelta from google.appengine.dist import use_library use_library('d...
StarcoderdataPython
4808085
from django.http import Http404 from django.shortcuts import render, get_object_or_404, redirect from .models import Product from .forms import ProductForm, RawProductForm def product_create_view(request): form = ProductForm(request.POST or None) if form.is_valid(): form.save() form = ProductF...
StarcoderdataPython