id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3228792
import unittest from programy.utils.logging.ylogger import YLogger from programy.utils.logging.ylogger import YLoggerSnapshot from programy.context import ClientContext from programytest.aiml_tests.client import TestClient from programy.config.bot.bot import BotConfiguration from programy.bot import Bot from program...
StarcoderdataPython
36543
<reponame>thoughteer/edera """ This module declares all custom exception classes. """ import edera.helpers class Error(Exception): """ The base class for all exceptions within Edera. """ class ExcusableError(Error): """ The base class for all "excusable" errors. They barely deserve a warni...
StarcoderdataPython
3353621
# -*- coding: utf-8 -*- from __future__ import absolute_import import six from collections import OrderedDict def join(strings, indent=0): joiner = ' \\\n{}'.format(' ' * indent) if indent else ' ' return joiner.join(str(_).strip() for _ in strings if _) class OptionsDict(OrderedDict): def add_option(se...
StarcoderdataPython
3281739
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import...
StarcoderdataPython
3304617
import logging from os import environ from os.path import join, relpath, splitext from mergedeep import merge import yaml from envyaml import EnvYAML from dagger.config_finder.config_finder import ConfigFinder from dagger.pipeline.pipeline import Pipeline from dagger.pipeline.task_factory import TaskFactory import da...
StarcoderdataPython
3333933
# Generated by Django 3.0.5 on 2021-01-08 17:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("api", "0009_auto_20210108_1550"), ] operations = [ migrations.AlterField( model_name="device", name="device_id", ...
StarcoderdataPython
3231408
def display_board(board): print(board[7]+'|'+board[8]+'|'+board[9]) print('-|-|-') print(board[4]+'|'+board[5]+'|'+board[6]) print('-|-|-') print(board[1]+'|'+board[2]+'|'+board[3]) def player_input(): marker = '' while marker != 'X' and marker != 'O': marker = input('player 1, chos...
StarcoderdataPython
3234553
<filename>edacom.py #!/usr/bin/env python """ Runs on one Raspberry Pi inside each of the beamformer control boxes, to send pointing commands to the eight beamformers connected to that box. On startup, it: -Checks that the hostname (as reported by 'hostname -A') is either 'eda1com or 'eda2com', and exits if not. ...
StarcoderdataPython
4809198
# Copyright 2018 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 datetime import logging import os import subprocess import sys import threading import time class TestWorkerThread(threading.Thread): """Runs ./te...
StarcoderdataPython
4835856
<filename>pytorch/utils/util.py import numpy as np import torch import torch.distributed as dist from sklearn.metrics import confusion_matrix class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self): self.val = 0 self.avg = 0 self.sum = 0 ...
StarcoderdataPython
1623894
# flake8: noqa from .authorization_server import AuthorizationServer from .resource_protector import ResourceProtector, current_credential
StarcoderdataPython
1782460
import bpy from bpy import data as D from bpy import context as C from mathutils import * from math import * st = D.texts['shaderTrees.py'].as_module() mat=st.Material(name='test') mat.p4 = { 'KdColor': [1.0, 1.0, 1.0, 1.0], 'KaColor': [0.0, 0.0, 0.0, 0.0], 'KsColor': [0.0, 0.0, 0.0, 1.0], 'Textu...
StarcoderdataPython
175337
<filename>tests/qalpha_test.py # Copyright 2020 Google LLC # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
StarcoderdataPython
1752836
from __future__ import absolute_import, division, print_function import inspect import sys from cfn_model.parser.PolicyDocumentParser import PolicyDocumentParser from cfn_model.model.Policy import Policy def lineno(): """Returns the current line number in our program.""" return str(' - IamUserParser- line nu...
StarcoderdataPython
3375782
<filename>malinka/test/pwmtest.py #!/usr/bin/env python import sys import time import codecs import struct import sched from threading import Timer # import pigpio from malinka.pwm.pigpioclock import Clock #pi1 = pigpio.pi() # pi1 accesses the local Pi's gpios clk = Clock(None) s = sched.scheduler(time.time,...
StarcoderdataPython
45600
import unittest import tempfile import numpy as np import coremltools import os import shutil import tensorflow as tf from tensorflow.keras import backend as _keras from tensorflow.keras import layers from coremltools._deps import HAS_TF_2 from test_utils import generate_data, tf_transpose class TensorFlowKerasTests...
StarcoderdataPython
197415
from opentuner.resultsdb.models import * class DriverBase(object): """ shared base class between MeasurementDriver and SearchDriver """ def __init__(self, session, tuning_run, objective, tuning_run_main, args, ...
StarcoderdataPython
1762590
<filename>clustering_proxy_log/Transform_pcap.py #HTTP requestのみのDFを作成中 他にHTTP responceのみのDFを作ってackで関連を見る import dpkt import pandas as pd import re import datetime import socket from dpkt.compat import compat_ord def mac_addr(address): """Convert a MAC address to a readable/printable string Args: ...
StarcoderdataPython
1624471
""" The MIT License (MIT) Copyright (c) 2020 <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, modify, mer...
StarcoderdataPython
3282708
<reponame>Bartzi/handwriting-determination import os from image_transformations import otsu_threshold, lighter_otsu_threshold, adaptive_gaussian_threshold, \ etched_lines IMAGE_FORMATS = ('.png', '.JPG', 'jpg', '.JPEG', '.jpeg') BASE_DIR = "[path to base dir]" WORD_PATH = os.path.join(BASE_DIR, 'words') PHOTOS_P...
StarcoderdataPython
27657
<reponame>DazEB2/SimplePyScripts<gh_stars>100-1000 #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' def upper_print(f): def wrapper(*args, **kwargs): f(*[i.upper() if hasattr(i, 'upper') else i for i in args], **kwargs) return wrapper if __name__ == '__main__': text = 'hel...
StarcoderdataPython
86371
<reponame>Manug-github/Automating-Real-World-Tasks-with-Python #!/usr/bin/env python3 import os import sys import shutil import socket import psutil import emails def check_disk_full(): """Return True if there isn't enough disk space, False otherwise.""" du = shutil.disk_usage("/") percent_free = 100 * du...
StarcoderdataPython
4837188
import itertools import os from Character import get_characters from Options import Options_ from LocationRandomizer import get_npcs from MonsterRandomizer import change_enemy_name from Utils import (CHARACTER_PALETTE_TABLE, EVENT_PALETTE_TABLE, FEMALE_NAMES_TABLE, MALE_NAMES_TABLE, MOOGLE_NAMES_TAB...
StarcoderdataPython
1734074
<filename>nino/client.py<gh_stars>1-10 from __future__ import annotations import typing as t import aiohttp from .http import HTTPClient from .paginator import PaginatedQuery __all__ = ("Client",) class Client: """ The client that is used to communicate with the AniList API. Attributes: token...
StarcoderdataPython
1667207
<reponame>andela-cnnadi/python-fire from functools import wraps def validate_payload(func): @wraps(func) def func_wrapper(instance, payload): native_types = [bool, int, float, str, list, tuple, dict] if type(payload) not in native_types: raise ValueError("Invalid payload specified"...
StarcoderdataPython
142175
<reponame>ZuuZaa/defacto_price_parser #for request headers headers = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '3600', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20...
StarcoderdataPython
3314193
consumer_key = 'CONSUMER_KEY' consumer_secret = 'CONSUMER_SECRET' access_token = 'ACCESS_TOKEN' access_token_secret = 'ACCESS_TOKEN_SECRET'
StarcoderdataPython
131313
#!/usr/bin/python import string from sys import argv firmware = argv[1] f0 = open(firmware+"_0.hex", "w"); f1 = open(firmware+"_1.hex", "w"); f2 = open(firmware+"_2.hex", "w"); f3 = open(firmware+"_3.hex", "w"); main_file = open(firmware+".hex", "r"); text = main_file.readlines(); for line in text: if(line ==...
StarcoderdataPython
1688283
import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ # SECURITY WARNING: keep the...
StarcoderdataPython
1756870
<gh_stars>10-100 # -*- coding: utf-8 -*- vim:fileencoding=utf-8: "Error handler tailored for Palo Alto (PANOS) devices." from .default import DefaultErrorHandler import re class PanosErrorHandler(DefaultErrorHandler): _ERROR_MATCHES = [ re.compile(r'invalid', flags=re.I), r...
StarcoderdataPython
1612786
from random import choice sample_requests = [ "Get me a cheeseburger!", "May I obtain a burrito?", "I want a gyro" ] def init_confirm(): return "Everything's set up now! Send me a request like \"" + choice(sample_requests) + "\"" def order_confirm(item, restaurant, cost, delivery_time): start_s...
StarcoderdataPython
1672868
# -*- coding: UTF-8 -*- from Stock import Stock import numpy as np import os import json import sys import time import datetime def getAllFiles(dirname="../sync_data/download"): files = None for dirpath, dirnames, filenames in os.walk(dirname): files = [os.path.join(dirpath, filename) for filename in ...
StarcoderdataPython
1697340
import math def is_prime(n): if n < 2: return False elif n < 4: return True else: for i in range(2, int(math.sqrt(n)) + 1): if n % i == 0: return False return True T = int(input().strip()) for t in range(T): n = int(input().strip()) pri...
StarcoderdataPython
1606860
# This file is part of Flask-Multipass-CERN. # Copyright (C) 2020 - 2021 CERN # # Flask-Multipass-CERN is free software; you can redistribute # it and/or modify it under the terms of the MIT License; see # the LICENSE file for more details. import logging from datetime import datetime from functools import wraps from ...
StarcoderdataPython
183458
km = float(input('Qual vai ser a distância da viagem: ')) if km <= 200: print('O valor a ser pago é de: R${:.2f}'.format(km * 0.50)) else: print('O valor a ser pago é de: R${:.2f}'.format(km * 0.45))
StarcoderdataPython
1622975
vulners_api_key = ""
StarcoderdataPython
1721331
''' Function: 定义金币等掉落的物品 Author: Charles 微信公众号: Charles的皮卡丘 ''' import pygame import random '''定义食物类''' class Food(pygame.sprite.Sprite): def __init__(self, images_dict, selected_key, screensize, **kwargs): pygame.sprite.Sprite.__init__(self) self.screensize = screensize self.i...
StarcoderdataPython
1797223
<gh_stars>1-10 # coding=utf-8 # Copyright 2022 The OpenBMB team. # # 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 appl...
StarcoderdataPython
1614095
# Add all the torch configs here import hddm import pickle import os class TorchConfig(object): def __init__(self, model=None): self.network_files = { "ddm": "d27193a4153011ecb76ca0423f39a3e6_ddm_torch_state_dict.pt", "angle": "eba53550128911ec9fef3cecef056d26_angle_torch_state_dic...
StarcoderdataPython
3330759
class InternalRequestError(Exception): """ Raised when getting content from a url fails. This could be due to a network error, bad url, bad request, bad status, etc. """ class UnknownContentType(Exception): """ Raised when the content type of the response is not known. """
StarcoderdataPython
1765082
#!/usr/bin/env python # Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
StarcoderdataPython
137555
<gh_stars>10-100 import os import subprocess import sys filedir = "DFDC-Kaggle" outdir = "DFDC-Kaggle_image" def mkdir(path): try: os.makedirs(path) except: pass def main(video_file, video_id): videopath = os.path.join(filedir, video_file) mkdir(os.path.join(outdir, video_id)) ...
StarcoderdataPython
189566
<filename>gpu_speed_test.py # Calculate the computation times for several matrix sizes on GPU # Author: <NAME> (<EMAIL>) from __future__ import print_function import os os.environ["CUDA_VISIBLE_DEVICES"] = os.environ['SGE_GPU'] import numpy as np import tensorflow as tf import time import socket def get_times(matrix...
StarcoderdataPython
331
<reponame>civodlu/trw #from trw.utils import collect_hierarchical_module_name, collect_hierarchical_parameter_name, get_batch_n, to_value, \ # safe_lookup, len_batch from .export import as_image_ui8, as_rgb_image, export_image, export_sample, export_as_image from .table_sqlite import TableStream, SQLITE_TYPE_PATTERN...
StarcoderdataPython
162091
## Project: SudokuSolver ## Element: ExtraFunctions -> Additional functions for plotting, and "string-to-dictionary" conversion of the Sudoku from collections import defaultdict rows = 'ABCDEFGHI' cols = '123456789' boxes = [r + c for r in rows for c in cols] def extract_units(unitlist, boxes): """ **Function ...
StarcoderdataPython
3232230
<reponame>mail2nsrajesh/python-troveclient # Copyright [2015] Hewlett-Packard Development Company, L.P. # 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 # # ...
StarcoderdataPython
145325
#!/usr/bin/env python # wujian@2019 import argparse import numpy as np from libs.ssl import ml_ssl, srp_ssl, music_ssl from libs.data_handler import SpectrogramReader, NumpyReader from libs.utils import get_logger, EPSILON from libs.opts import StftParser, str2tuple logger = get_logger(__name__) def add_wta(mas...
StarcoderdataPython
1613392
<filename>example/android/with_keras.py from sepmachine.pipeline import BasePipeline from sepmachine.handler import KerasHandler from sepmachine.capture import AdbCapture video_path = "../../demo1.mp4" model_path = "../../output.h5" empty_cap = AdbCapture("123456F") handler = KerasHandler(model_path=model_path) pipe...
StarcoderdataPython
54777
expected_output = { "aal5VccEntry": {"3": {}, "4": {}, "5": {}}, "aarpEntry": {"1": {}, "2": {}, "3": {}}, "adslAtucChanConfFastMaxTxRate": {}, "adslAtucChanConfFastMinTxRate": {}, "adslAtucChanConfInterleaveMaxTxRate": {}, "adslAtucChanConfInterleaveMinTxRate": {}, "adslAtucChanConfMaxInter...
StarcoderdataPython
3362819
from __future__ import annotations import typing from solana.publickey import PublicKey from solana.transaction import TransactionInstruction, AccountMeta import borsh_construct as borsh from .. import types from ..program_id import PROGRAM_ID class PlayArgs(typing.TypedDict): tile: types.tile.Tile layout = bor...
StarcoderdataPython
139443
# pylint: disable=no-self-use,invalid-name,protected-access from __future__ import division from __future__ import absolute_import from nltk.tree import Tree from allennlp.data.dataset_readers import PennTreeBankConstituencySpanDatasetReader from allennlp.common.testing import AllenNlpTestCase from allennlp.data.da...
StarcoderdataPython
183567
<filename>ws_icra2022/src/my_pkg/ur5_eyeInhand/frompitoangle.py<gh_stars>0 #!/usr/bin/env python def getpi(listb): lista=[] listcc=[] for i in listb: temp=i/180*3.14 lista.append((temp,i)) listcc.append(temp) return lista def getangle(listb): lista=[] for i in listb: ...
StarcoderdataPython
3321376
<filename>day06/Thead_demo2.py #!/usr/bin/env python # -*- coding:utf-8 -*- ''' t1.join(timeout) #设置子线程等待主线程的时间 t1.join() #join是设置等待时间 如果子线程没有完成就一直等待 t1.join(5) #设置5是等待子线程5秒,5秒后不再等待继续主线程 ''' from threading import Thread def Foo(arg): print arg print 'before' t1 = Thread(target=Foo,args=(...
StarcoderdataPython
3378749
<reponame>CiscoSystems/heat<gh_stars>1-10 # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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/LICE...
StarcoderdataPython
1792972
<reponame>aaditkamat/competitive-programming # Title: Product of Array Except Self # Runtime: 140 ms # Memory: 20.8 MB class Solution: def get_left_products(self, nums: List[int]) -> List[int]: curr_prod = 1 left_prod = [] for num in nums[: : -1]: left_prod.append(curr_prod * nu...
StarcoderdataPython
3280389
#!/usr/bin/env python # This script will be run by bazel when the build process starts to # generate key-value information that represents the status of the # workspace. The output should be like # # KEY1 VALUE1 # KEY2 VALUE2 # # If the script exits with non-zero code, it's considered as a failure # and the output wil...
StarcoderdataPython
3270619
import os import sys import pkg_resources import numpy as np from matplotlib.image import imread import obrero.cal as ocal import obrero.plot as oplot import obrero.experimental.enso as oenso # path where stored logo DATA_PATH = pkg_resources.resource_filename('obrero', 'data/') def _add_text_axes(axes, text): ...
StarcoderdataPython
4804252
<filename>is_number/__init__.py<gh_stars>0 """Utility functions to calculate if an object is a number and other things.""" from .core import is_it_number, is_float, add_numbers, get_array_shape # from module1 import square_plus_one # from ._version import get_versions # __version__ = get_versions()["version"] # del ge...
StarcoderdataPython
31784
import logging import pytest from selenium.webdriver.remote.remote_connection import LOGGER from stere.areas import Area, Areas LOGGER.setLevel(logging.WARNING) def test_areas_append_wrong_type(): """Ensure a TypeError is raised when non-Area objects are appended to an Areas. """ a = Areas() ...
StarcoderdataPython
3238152
<gh_stars>0 USER_AGENT = { # 塞班系统:诺基亚手机浏览器(7.3.1.26) "Symbian": ( "Mozilla/5.0 (SymbianOS/9.3; Series60/3.2 NokiaE5-00/071.003; Profile/MIDP-2.1 Configuration/CLDC-1.1) " "AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.26 Mobile Safari/533.4 3gpp-gba"), # Windows系统(Win10):Chrome浏览...
StarcoderdataPython
3322284
<filename>24_DynamicProgramming2/Step02/wowo0709.py import sys input = sys.stdin.readline N = int(input()) sizes = [[x for x in map(int,input().split())] for _ in range(N)] dp = [[0 for _ in range(N)] for _ in range(N)] for d in range(1,N): for start in range(N-d): end = start + d for i in range(s...
StarcoderdataPython
3259137
<gh_stars>0 import numpy as np import networkx as nx import copy from math import log2 """ Implementation of the hierarchy coordinates via networkX from Hierarchy in Complex Networks: The Possible and the Actual [B Corominas-Murtra - 2013] [*] - Supporting Information Though implemented for unweighted networkX grap...
StarcoderdataPython
3306496
#!/usr/bin/env python3 import sys, os, gzip, math infile = gzip.open(sys.argv[1]) nind = float(sys.argv[2]) outfile = open(sys.argv[3], "w") N = 5000 pos2gpos = dict() poss = list() line = infile.readline() while line: line = line.strip().split() pos = int(line[1]) gpos = float(line[2]) pos2gpos[pos] = gpos po...
StarcoderdataPython
4815807
#!/usr/bin/python3 import subprocess from dg_storage import * from shutil import copyfile import re import tempfile import multiprocessing RE = re.compile(r'RE\[([^\]]+)\]') def score_game(sgf): """ Returns the winner of the game in the given SGF file as judged by `gnugo`. """ with tempfile.Nam...
StarcoderdataPython
4816357
<filename>pyinsteon/device_types/plm.py<gh_stars>10-100 """Insteon Powerline Modem (PLM).""" from ..aldb.plm_aldb import PlmALDB from .modem_base import ModemBase class PLM(ModemBase): """Insteon PLM class.""" def __init__( self, address="000000", cat=0x03, subcat=0x00, ...
StarcoderdataPython
61918
from itertools import permutations from string import ascii_lowercase INPUT_PATH = 'input.txt' def get_input(path=INPUT_PATH): """Get the input for day 5. This should all be one long string. I tested with the given input and we don't need to join the lines but it's just a bit less brittle this way.""" ...
StarcoderdataPython
131562
<filename>1-alltodoor.py import csv import pandas as pd from csv import reader, writer A1A2_data1 = [] highway_traffic_data = [] highway_traffic_data_first = [] highway_traffic_next = [] highway_traffic_pre = [] def read_csv_file(filename): with open(filename, encoding='utf-8', newline='') as file: for row ...
StarcoderdataPython
172993
from tests.test_base import app, client, login _SCRIPT_ID_HELLO = "pyscriptdemo.helloworld.HelloWorld" _SCRIPT_ID_HELLO_WITH_PARAMS = "pyscriptdemo.helloworld.HelloWorldWithParams" def test_hello(app, client): login(client) response = client.post("/api/scripts/" + _SCRIPT_ID_HELLO + "/_run") assert resp...
StarcoderdataPython
52100
<reponame>UAEKondaya1/expressvpn_leak_testing import ctypes import netifaces import NetworkManager # pylint: disable=import-error from xv_leak_tools.exception import XVEx from xv_leak_tools.log import L from xv_leak_tools.process import check_subprocess class _NetworkObject: def __init__(self, conn): sel...
StarcoderdataPython
3379368
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Any, Mapping, Optional, Union, List, Iterator from collections import OrderedDict import logging import time import itertools import yaml import os import shutil import pathlib TItems = Union[Mapping, str] # do...
StarcoderdataPython
49667
<filename>gallery/mode/photo_manager.py # -*- coding: utf-8 -*- ''' Created on Mar 19, 2015 @author: Bob.Chen ''' import sys import urllib2 import time from PIL import Image from constant import PHOTO_DATA_ROOT from common import Logger, RandomID, getPhotoUrl, getPhotoPath from error_api import Err from gallery.models...
StarcoderdataPython
3249721
import os from datetime import datetime def log_parameters(filename, parameters, task_name): filename = os.path.join(parameters["root_data"], filename) with open(filename, "w") as fwlog: fwlog.write(f"{task_name.upper()} LOG FILE\n") fwlog.write(f"Date and time : {datetime.now()}\n") f...
StarcoderdataPython
3280050
def get_envlist(env_type): """ get list of env names wrt the type of env """ try: l = all_env_list[env_type] except: print('Env Type {:s} Not Found!'.format(env_type)) return l all_env_list={ ## Gym # Atari 'atari':[ 'AirRaid-v0', 'AirRaid-v4', 'AirRaidDeterministi...
StarcoderdataPython
1709912
<reponame>PranjalPansuriya/JavaScriptEnhancements import sublime, sublime_plugin import os from ..libs import NodeJS from ..libs import util from ..libs import FlowCLI class JavascriptEnhancementsGoToDefinitionCommand(sublime_plugin.TextCommand): def run(self, edit, **args): view = self.view if args and "poi...
StarcoderdataPython
1654397
# -*- coding: utf-8 -*- """ Copyright 2017 <NAME> Created on Sun Apr 23 11:52:59 2017 @author: ekobylkin This is an example on how to prepare data for autosklearn-zeroconf. It is using a well known Adult (Salary) dataset from UCI https://archive.ics.uci.edu/ml/datasets/Adult . """ import pandas as pd # wget https://ar...
StarcoderdataPython
59695
<reponame>jmenzelupb/MSMP-xmas # MSMP christmas challenge # <NAME>, 20.12.2017 import numpy as np import matplotlib.pyplot as plt import pylab # load Data da = np.load('Daten.npz') temps = np.array([5, 7.5, 10, 12.5, 15, 17.5, 20, 22.5, 25, 27.5, 30, 32.5, 35, 37.5, 40, 42.5, 45, 47.5, 50, 52.5, 55, 57.5, 60, 62.5, 6...
StarcoderdataPython
3228113
<reponame>vespa-mrs/vespa<gh_stars>0 # Python modules # 3rd party modules import numpy as np # Our modules def minf_parabolic_info(xa, xb, xc, func, info, maxit=100, tol=np.sqrt(1.e-7), pn=0, ...
StarcoderdataPython
1706557
<filename>fusioncharts/samples/linked_chart_single_level.py from django.shortcuts import render from django.http import HttpResponse # Include the `fusioncharts.py` file that contains functions to embed the charts. from ..fusioncharts import FusionCharts # Loading Data from a Static JSON String # Example to create a...
StarcoderdataPython
1614811
# Generated by Django 3.0.6 on 2020-05-13 22:15 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('gea', '0003_auto_20200506_1813'), ] operations = [ migrations.AlterField( model_name='anteceden...
StarcoderdataPython
1635303
<reponame>Nurgak/IoT-RGB-LED-Matrix-Socket #!/usr/bin/env python3 """! Animation saving server script.""" import socket import logging from threading import Thread import numpy as np from PIL import Image class Save(Thread): """! Animation saving server class.""" __frame_array = [] __TIMEOUT = 3 __FR...
StarcoderdataPython
1718501
<filename>DEPRECATED/optimize_tau_c.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by <NAME> for Low runoff variability driven by a dominance of snowmelt inhibits clear coupling of climate, tectonics, and topography in the Greater Caucasus Mountains If you use this code or derivatives, please cite the ...
StarcoderdataPython
4414
__author__ = "<NAME>" __copyright__ = "Copyright 2017, Stanford University" __license__ = "MIT" import sys from deepchem.models import KerasModel from deepchem.models.layers import AtomicConvolution from deepchem.models.losses import L2Loss from tensorflow.keras.layers import Input, Layer import numpy as np import t...
StarcoderdataPython
77020
import logging import numpy as np import sklearn.preprocessing as prep from sklearn.linear_model import LogisticRegression from sklearn.svm import LinearSVC from sklearn.utils import check_random_state from csrank.objectranking.object_ranker import ObjectRanker from csrank.tunable import Tunable from csrank.util impo...
StarcoderdataPython
3323054
from django.shortcuts import render from bs4 import BeautifulSoup import requests # Create your views here. def home(request): return render(request, 'home.html') def result(request): search=request.GET['keyword'] url = 'https://search.naver.com/search.naver?where=news&sm=tab_jum&query={}'.format(search) req ...
StarcoderdataPython
129687
from . import commands from .task import BaseTask from .utils import echo from .worker import Worker
StarcoderdataPython
108428
import unittest import json from stampman.helpers import mail_, config_ class EmailTest(unittest.TestCase): """Tests for the Email helper class""" def setUp(self): self._valid_sender = ("Test", "<EMAIL>") self._invalid_sender = ("Test", "this_is_not_a_valid_e_mail_address") self._val...
StarcoderdataPython
1789814
import numpy as np from collections import Counter import collections import csv import re def lottery_analysis(): counter = 0 list_counter = 0 output_list = [] pre_change_list = [] post_change_list = [] raw_list = np.loadtxt(open("/home/rane/testing/winning_numbers.csv", "rb"), dtype='str', de...
StarcoderdataPython
1769832
import os import pytest from bw2data.tests import bw2test import bw2regional from bw2regional.base_data import ( Topography, create_world_collections, create_ecoinvent_collections, create_restofworlds_collections, geocollections, topocollections, ) def nope(*args, **kwargs): return os.pa...
StarcoderdataPython
12391
<gh_stars>1000+ #from http://rosettacode.org/wiki/Greatest_subsequential_sum#Python #pythran export maxsum(int list) #pythran export maxsumseq(int list) #pythran export maxsumit(int list) #runas maxsum([0, 1, 0]) #runas maxsumseq([-1, 2, -1, 3, -1]) #runas maxsumit([-1, 1, 2, -5, -6]) def maxsum(sequence): """Retu...
StarcoderdataPython
33641
from django.conf.urls import patterns, url # App specific URL patterns urlpatterns = patterns("djkatta.cabshare.views", # post new req url(r'new_post/$', 'new_post', name='new_post'), # view posts by the user url(r'my_posts/$', 'my_posts', name='my_posts'), # modify old req url(r'(?P<post_id...
StarcoderdataPython
1661326
from data_facility_admin.models import Dataset, DataProvider, Category, Keyword from collections import namedtuple import json import logging logger = logging.getLogger(__name__) FieldMapping = namedtuple('FieldMapping', ['dataset', 'gmeta', 'to_model', 'to_json']) DATA_CLASSIFICATION_MAPPING = [ FieldMapping(Da...
StarcoderdataPython
1665296
''' This module implements routines use to construct the yy_action[] table. ''' from struct import * from ccruft import struct # The state of the yy_action table under construction is an instance # of the following structure. # # The yy_action table maps the pair (state_number, lookahead) into an # action_number. ...
StarcoderdataPython
3247216
import unittest from katas.kyu_7.every_archer_has_its_arrows import archers_ready class ArchersReadyTestCase(unittest.TestCase): def test_true(self): self.assertTrue(archers_ready([5, 6, 7, 8])) def test_false(self): self.assertFalse(archers_ready([])) def test_false_2(self): se...
StarcoderdataPython
1698881
<filename>DriveDownloader/netdrives/sharepoint.py ############################################# # Author: <NAME> # # E-mail: <EMAIL> # # Homepage: https://github.com/hwfan # ############################################# import urllib.parse as urlparse from DriveDownload...
StarcoderdataPython
3215841
from biothings.hub.datatransform.datatransform import DataTransform from biothings.hub.datatransform.datatransform import IDStruct from biothings.hub.datatransform.datatransform import DataTransformEdge from biothings.hub.datatransform.datatransform import RegExEdge from biothings.hub.datatransform.datatransform import...
StarcoderdataPython
1614894
<reponame>jergeno/DadBotV2.0 from collections import defaultdict import re import yaml import sys import os import mysql.connector import random if "DadBot" not in str(os.getcwd()): os.chdir("./DadBot") with open("config.yaml") as file: config = yaml.load(file, Loader=yaml.FullLoader) class ImC...
StarcoderdataPython
173148
<filename>phoenix/tests/integration/test_datadog.py from unittest.mock import patch from phoenix.integration.datadog import get_all_slack_channels @patch("phoenix.integration.datadog.api.Monitor.get_all") def test_get_all_slack_channels(mocked_get_all): mocked_get_all.return_value = ( "@slack-alerts{{/is...
StarcoderdataPython
33830
<reponame>DiegoDBLe/Python-Linkedin # # Escrevendo arquivos com funções do Python # def escreveArquivo(): arquivo = open('NovoArquivo.txt', 'w+') arquivo.write('Linha gerada com a função Escrevendo Arquivo \r\n') arquivo.close() #escreveArquivo()] def alteraArquivo(): arquivo = open('NovoArquivo.t...
StarcoderdataPython
51389
from __future__ import absolute_import, unicode_literals import logging from django import forms from django.core.exceptions import PermissionDenied from django.utils.translation import ugettext_lazy as _ from acls.models import AccessEntry from permissions.models import Permission from .models import Folder from ....
StarcoderdataPython
135474
#!/usr/bin/python3 # -*- coding: utf-8 -*- # continuously publish VE.Direct data to the topic prefix specified import argparse, os import paho.mqtt.client as mqtt from vedirect import VEDirect import logging log = logging.getLogger(__name__) if __name__ == '__main__': parser = argparse.ArgumentParser(descriptio...
StarcoderdataPython