id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6432229
import json import logging import os from unittest.mock import patch import wikimedia_commons as wmc RESOURCES = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'tests/resources/wikimedia' ) logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s: %(message)s', level=logging.DEBUG,...
StarcoderdataPython
1817333
# internal to the class is # - the matrix used for calulation # - the dict mapping Cn to concept name # - a list of concepts # - a list of relations # only add, no delete # import numpy as np import itertools import json import networkx as nx import math class Concept: def __init__(self, node, name, wordclo...
StarcoderdataPython
9713586
from ..rfc6749 import TokenEndpoint from ..rfc6749 import ( OAuth2Error, InvalidRequestError, UnsupportedTokenTypeError ) class RevocationEndpoint(TokenEndpoint): """Implementation of revocation endpoint which is described in `RFC7009`_. .. _RFC7009: https://tools.ietf.org/html/rfc7009 """ #:...
StarcoderdataPython
3218482
""" Provide a mock binary sensor platform. Call init before using it in your tests to ensure clean test data. """ from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity from tests.common import MockEntity ENTITIES = {} def init(empty=False): """Initialize the platform with entiti...
StarcoderdataPython
5174026
import math print(math.ceil(3.9)) print(math.floor(3.9)) x = 3.9 print(round(x)) x = 3.9 print(abs(-3.9))
StarcoderdataPython
5121890
<filename>scripts/pyautogui-full-vs-region.py #!/usr/bin/env python """This file illustrates the similar run time between regions and full screenshots""" from __future__ import print_function import time import pyautogui print('Using a region') START = time.time() SCREEN_WIDTH, SCREEN_HEIGHT = pyautogui.size() MOUSE...
StarcoderdataPython
11242990
<reponame>DEvHiII/aoc-2018 import re import datetime as datetime class Parser: # [1518-11-01 00:00] Guard #10 begins shift # [1518-11-01 00:05] falls asleep # [1518-11-01 00:25] wakes up def parse(self, line): expression = '^\\[([-0-9: ]+)\\] (Guard #([0-9]+) begins shift|falls asleep|w...
StarcoderdataPython
193620
<reponame>numb3r33/Kaggle_Home_Credit<filename>src/v71.py import pandas as pd import numpy as np import scipy as sp import argparse import os import gc import time from base import * from features import * from datetime import datetime from sklearn.externals import joblib from sklearn.model_selection import cross_va...
StarcoderdataPython
8023055
<reponame>GeorgeBatch/ultrasound-nerve-segmentation # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python ##############################################################################################...
StarcoderdataPython
1745593
"""Utility Functions""" import logging from collections import namedtuple # pytype: disable=pyi-error def get_logger(logname): """Create and return a logger object.""" logger = logging.getLogger(logname) return logger def log_method(method): """Generate method for logging""" def wrapped(self, ...
StarcoderdataPython
1924251
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
StarcoderdataPython
251501
<reponame>lefevre-fraser/openmeta-mms from .mgardfconverter import MgaRdfConverter
StarcoderdataPython
11346643
import dash import dash_core_components as dcc import dash_html_components as html import pandas as pd from Reporte_funciones import * df = pd.read_csv( 'https://gist.githubusercontent.com/chriddyp/' 'c78bf172206ce24f77d6363a2d754b59/raw/' 'c353e8ef842413cae56ae3920b8fd78468aa4cb2/' 'usa-agricultural-...
StarcoderdataPython
6703921
<gh_stars>1-10 import numpy as np import platform import os import sys from common.kalman.ekf import FastEKF1D, SimpleSensor # radar tracks SPEED, ACCEL = 0, 1 # Kalman filter states enum rate, ratev = 20., 20. # model and radar are both at 20Hz ts = 1./rate freq_v_lat = 0.2 # Hz k_v_lat = 2*np.pi*freq_v_lat*ts...
StarcoderdataPython
3206233
__author__ = 'vid' import os import math import natsort def q2(fi): return ((4*math.pi*1.33*math.sin(fi*math.pi/360))/(532*10**(-9)))**2 pot = os.getcwd() seznam = os.listdir(pot) slovar = {} seznam = natsort.natsorted(seznam) print(seznam) for a in seznam: if a[-4:] == '.ASC': b = a.split('_') ...
StarcoderdataPython
3319534
from requests import Response from otscrape.core.base.extractor import Extractor class RequestText(Extractor): def __init__(self, target=None, *, bytes_result=False, encoding=None, project=True, replace_error=None): super().__init__(target=target, project=project, replace_error=replace_error) sel...
StarcoderdataPython
1758596
<filename>src/util/community_info/api_info_center.py import json import os import networkx as nx from ..config import COMMUNITY_FREQUENCY_STORE_PATH, JAVADOC_GLOBAL_NAME, LATEST_COMMUNITY_MAP_PATH, MENIA_WHOLE_PREDICTION_STORE_PATH from ..utils import normalize class APIinfoCenter: def __init__(self, doc_name: s...
StarcoderdataPython
4920156
<filename>fleet-rec/fleetrec/run.py import argparse import os import yaml from paddle.fluid.incubate.fleet.parameter_server import version from fleetrec.core.factory import TrainerFactory from fleetrec.core.utils import envs from fleetrec.core.utils import util engines = {"TRAINSPILER": {}, "PSLIB": {}} clusters = [...
StarcoderdataPython
4880358
<filename>spikeforest/spikeforest_analysis/computerecordinginfo.py import mlprocessors as mlpr import json import spikeextractors as si from .sfmdaextractors import SFMdaRecordingExtractor, SFMdaSortingExtractor # _CONTAINER = 'sha1://5627c39b9bd729fc011cbfce6e8a7c37f8bcbc6b/spikeforest_basic.simg' # _CONTAINER = 'sh...
StarcoderdataPython
258676
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import onnx from onnx import helper from onnx.helper import make_opsetid from onnx import TensorProto input_info = helper.make_tensor_value_info('input', TensorProto.BFLOAT16, [1, 5]) output_info = helper.make_tensor_value_i...
StarcoderdataPython
4809184
from rich._tools import iter_first, iter_last, iter_first_last, ratio_divide def test_iter_first(): assert list(iter_first([])) == [] iterable = iter_first(["apples", "oranges", "pears", "lemons"]) assert next(iterable) == (True, "apples") assert next(iterable) == (False, "oranges") assert next(it...
StarcoderdataPython
12840344
"""check_read_rom.py get ROMID of 1-wire device. assume only one 1-wire device on the bus. """ import tpow.usb9097 import tpow.device import cfg bus = tpow.usb9097.USB9097(cfg.com_port) # USB9097('COM3') id_little = tpow.device.read_rom(bus) id_big = [a for a in reversed(id_little)] print(" ".join(['%02X' % ord(a) ...
StarcoderdataPython
1895706
<filename>pythia/datasets/multi_dataset.py # Copyright (c) Facebook, Inc. and its affiliates. """ MultiDataset class is used by DatasetLoader class to load multiple datasets and more granular """ import sys import numpy as np from torch.utils.data import Dataset from torch.utils.data import DataLoader from pythia.co...
StarcoderdataPython
3482012
<reponame>noxtoby/MedICSS2019-TADPOLE # import sys # sys.path.append('..') from os.path import join from tadpole.io import load_tadpole_data, write_submission_table from tadpole.validation import get_test_subjects from tadpole.submission import create_submission_table from tadpole.models.simple import create_predict...
StarcoderdataPython
6645604
############################################################################### # Simple models of the effect of blurring and churning on the properties of # the Milky Way ############################################################################### from functools import wraps import numpy from scipy import integrat...
StarcoderdataPython
67994
<reponame>thesealion/django-social-auth import json from django.core.exceptions import ValidationError from django.db import models from django.utils.encoding import smart_unicode class SubfieldBase(type): """ A metaclass for custom Field subclasses. This ensures the model's attribute has the descriptor p...
StarcoderdataPython
84629
#!/usr/bin/python3 # -*- coding: utf-8 -*- import subprocess import sys import os import argparse from timeit import default_timer as timer def beep(): notes = [(0.25, 440), (0.25, 480), (0.25, 440), (0.25, 480), (0.25, 440), (0.25, 480), (0.25, 440), (0.5, 520)] try: import winsound ...
StarcoderdataPython
12854
# -*- coding: utf-8 *-* import logging from unittest import TestCase from nicepy import assert_equal_struct, multi_assert_equal_struct, pretty_repr, permuteflat log = logging.getLogger(__name__) class Foo(object): def __init__(self, **kwargs): for k, v in kwargs.iteritems(): self[k] = v ...
StarcoderdataPython
9635125
<reponame>NicholasBake/GreenEditor<gh_stars>1-10 from gui.Gui import guiLoad if __name__ == "__main__": guiLoad()
StarcoderdataPython
6609515
import os def get_test_conf_file(): my_dir = os.path.dirname(os.path.realpath(__file__)) panoptes_test_conf_file = os.path.join(my_dir, 'config_files/test_panoptes_config.ini') return my_dir, panoptes_test_conf_file
StarcoderdataPython
3590655
def test(array): for i in range(len(array)): if isprime(i) > 2: array[i] = "Composite" else: array[i] = "Prime" def isprime(input): counter = 0 for i in range(1,input+1): if((input%i == 0)): counter = counter + 1 return counter arr = [None] *...
StarcoderdataPython
9659124
<gh_stars>100-1000 # -*- coding: utf-8 -*- """This package defines various utilities classes. """
StarcoderdataPython
3575436
<filename>server/admin_tools/service_tools/service_status.py #!/usr/bin/python #************************************************************************** # This file is part of eBioKit 2017 Admin tools. # Copyright <NAME>, SLU, Sweden 2017 # # This tool updates the configuration for the eBioKit services. # # Versi...
StarcoderdataPython
9681186
# -*- coding: iso-8859-1 -*- from __future__ import print_function, division import sys if( sys.version_info[0] == 2 ): range = xrange import math import qm3.maths.matrix try: import qm3.actions._minimize has_minimize_so = True except: has_minimize_so = False def __grms( vec ): # o = 0.0 # f...
StarcoderdataPython
12820994
""" Server-Sent Events implementation for streaming. Based on: https://bitbucket.org/btubbs/sseclient/src/a47a380a3d7182a205c0f1d5eb470013ce796b4d/sseclient.py?at=default&fileviewer=file-view-default """ # currently excluded from documentation - see docs/README.md import re import time import urllib3 from ldclient....
StarcoderdataPython
369377
<filename>ipynb.py # -*- coding: utf-8 -*- # # This software is licensed as some open-source license; which is # yet to be decided. # # Author: <NAME> <<EMAIL>> # # Trac support for IPython Notebook attachments # # Loosely based on the ReST support by # <NAME>, <NAME>, and <NAME>. # (@trac/mimeview/rst.py) # ...
StarcoderdataPython
12856781
<reponame>yewzijian/RegTR<gh_stars>10-100 import torch import torch.nn as nn from utils.se3_torch import se3_transform_list _EPS = 1e-6 class CorrCriterion(nn.Module): """Correspondence Loss. """ def __init__(self, metric='mae'): super().__init__() assert metric in ['mse', 'mae'] ...
StarcoderdataPython
259838
<reponame>yuchiu/scraper-practice try: from urllib.parse import urlencode except ImportError: from urlparse import urlencode # pylint: disable=E0401 import requests # pylint: disable=E0401 from requests.exceptions import RequestException # pylint: disable=E0401 import json import re def get_page_index(offs...
StarcoderdataPython
3233111
import requests from dashboard.Image import draw_black, draw_red, get_enhanced_icon, h_red_image, small_font, medium_font from dashboard.Config import open_weather_map_api_key, lat, lon, units, unit_letter def print_weather(): weather = get_weather() icon = get_enhanced_icon(weather['icon_path'], 45, False) h_red...
StarcoderdataPython
6508163
class SilkError(Exception): pass class SilkNotConfigured(SilkError): pass class SilkInternalInconsistency(SilkError): pass
StarcoderdataPython
4883022
<filename>Dev/Tests/firmware_checker.py # firmware_checker.py v_0_4_0 from cyberbot import * class firmware(): def __init__(self): bot().send_c(98) self.v=bot().read_r() def version_info(self): #v=self.v p=self.v%100 mi=((self.v%10000)-p)/100 ma=((self.v%1000000)-mi-p)/10000 print("Firmware: v%d.%d.%d" ...
StarcoderdataPython
139471
<gh_stars>100-1000 from distutils.core import setup, Extension marisa_module = Extension("_marisa", sources=["marisa-swig_wrap.cxx", "marisa-swig.cxx"], libraries=["marisa"]) setup(name = "marisa", ext_modules = [marisa_module], py_modules = ["marisa"])
StarcoderdataPython
1961563
<gh_stars>1-10 import numpy as np from scipy.optimize import least_squares from scipy.integrate import odeint def sol_u(t, u0, alpha, beta): return u0*np.exp(-beta*t) + alpha/beta*(1-np.exp(-beta*t)) def sol_s(t, s0, u0, alpha, beta, gamma): exp_gt = np.exp(-gamma*t) if beta == gamma: s = s0*exp_g...
StarcoderdataPython
6545858
import argparse from collections import Counter import csv import math import sys from time import perf_counter from cubicasa import Cubicasa, ROOM_TYPES, FIXTURE_TYPES def get_headers(): headers = [ "path", "type", "classes", "floor_index", "num_sides", "area", ...
StarcoderdataPython
4923
import tensorflow as tf @tf.function def BinaryAccuracy_Infiltrates(y_true, y_pred, i=0): return tf.keras.metrics.binary_accuracy(y_true[:, i], y_pred[:, i]) @tf.function def BinaryAccuracy_Pneumonia(y_true, y_pred, i=1): return tf.keras.metrics.binary_accuracy(y_true[:, i], y_pred[:, i]) @tf.function def...
StarcoderdataPython
9737010
import collections import logging import os import sys from datarobot_batch_scoring.consts import (WriterQueueMsg, Batch, ProgressQueueMsg) from datarobot_batch_scoring.reader import (fast_to_csv_chunk, slow_to_csv_chunk) from data...
StarcoderdataPython
11380528
from reliability.ALT_probability_plotting import ALT_probability_plot_Normal from reliability.Datasets import ALT_temperature import matplotlib.pyplot as plt ALT_probability_plot_Normal(failures=ALT_temperature().failures, failure_stress=ALT_temperature( ).failure_stresses, right_censored=ALT_temperature().right_censor...
StarcoderdataPython
1880463
<reponame>spatric5/robosuite import numpy as np import random from collections import deque class MemoryBuffer: def __init__(self, size): self.buffer = deque(maxlen=size) self.maxSize = size self.len = 0 def sample(self, count): """ samples a random batch from the replay memory buffer :param count: ba...
StarcoderdataPython
5132742
#!/usr/bin/env python import os import json import torch import pprint import argparse import importlib import numpy as np import cv2 import matplotlib matplotlib.use("Agg") from config import system_configs from nnet.py_factory import NetworkFactory from config import system_configs from utils import crop_image, no...
StarcoderdataPython
358619
# -*- coding: utf-8 -*- ''' Client for creating a nicely formatted PDF calendar for a specified year or the current year (default). ''' # builtins import calendar import sys from datetime import date, time, timedelta # 3rd party from reportlab.lib import colors from reportlab.lib.pagesizes import inch, letter fro...
StarcoderdataPython
3455510
import numpy as np import scipy.linalg from itertools import permutations, combinations_with_replacement from termcolor import colored import warnings from desc.backend import jnp, put from desc.utils import issorted, isalmostequal, islinspaced from desc.io import IOAble class Transform(IOAble): """Transforms fr...
StarcoderdataPython
9716016
<reponame>helix84/activae # -*- coding: utf-8 -*- # # Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are...
StarcoderdataPython
279342
<reponame>GuzalBulatova/sktime<gh_stars>0 # -*- coding: utf-8 -*- """SummaryClassifier test code.""" import numpy as np from numpy import testing from sklearn.ensemble import RandomForestClassifier from sktime.classification.feature_based import SummaryClassifier from sktime.datasets import load_basic_motions, load_un...
StarcoderdataPython
3503585
<filename>XrayDataPlots/plotDstarsMeasurability.py<gh_stars>0 # Description: Generate the list of dstars and measurability as lists for plotting by matplotlib. # Source: NA """ from iotbx.reflection_file_reader import any_reflection_file hkl_file = any_reflection_file("${1:3hz7}.mtz") miller_arrays = hkl_file.as_mil...
StarcoderdataPython
11308355
<gh_stars>0 """ 068 - Faça um programa que jogue par ou ímpar com o computador. O jogo só será interrompido quando o jogador perder, mostrando o total de vitórias consecutivas que ele conquistou no final do jogo. """ from random import randint print('=-='*11) print('VAMOS JOGAR PAR OU ÍMPAR'.center(33)) print('=-='*11...
StarcoderdataPython
58001
def incrementing_time(start=2000, increment=1): while True: yield start start += increment def monotonic_time(start=2000): return incrementing_time(start, increment=0.000001) def static_time(value): while True: yield value
StarcoderdataPython
3219714
<reponame>tucan9389/mobile-pose-estimation-for-TF2 # Copyright 2019 <NAME> (<EMAIL>) # 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 # # Unle...
StarcoderdataPython
12862013
<gh_stars>1-10 # -*- coding: utf-8 -*- """Ant_Algorithm.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1Zjt1SInhoaFEqSmsPjEfWQE7jhugAvZA # **ANT ALGORITHM BY KELOMPOK 9** 1. <NAME> - 18081010002 2. <NAME> - 18081010013 3. <NAME> - 18081010033 4....
StarcoderdataPython
11328497
#!/usr/bin/env python3 from io import BytesIO import ipywidgets as widgets class _pre(): def __init__(self, value=''): self.widget = widgets.HTML() self.value = value @property def value(self): return self._value @value.setter def value(self, value): self._value...
StarcoderdataPython
170547
<filename>dashboard/migrations/0049_auto_20210902_0254.py # Generated by Django 3.2.5 on 2021-09-02 02:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dashboard', '0048_auto_20210831_0719'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
1787733
<reponame>DdOtzen/espCarStuff """ Blynk is a platform with iOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. You can easily build graphic interfaces for all your projects by simply dragging and dropping widgets. Downloads, docs, tutorials: http://www.blynk.cc Sketch generator: ...
StarcoderdataPython
9645136
<reponame>Erfi/dorathewordexplorer<gh_stars>0 """darvag URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: ...
StarcoderdataPython
8151496
import argparse from beautifultable import BeautifulTable from stests.core import cache from stests.core import factory from stests.core.utils import args_validator from stests.core.utils import cli as utils from stests.core.utils import env # CLI argument parser. ARGS = argparse.ArgumentParser("List set of nodes r...
StarcoderdataPython
6500490
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from contrail_api_cli.command import Command, Arg from contrail_api_cli.resource import Resource from contrail_api_cli.exceptions import ResourceNotFound from ..utils import RouteTargetAction class SetGlobalASN(Command): description = "...
StarcoderdataPython
3364601
""" Copyright 2017 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 law or agreed to in writing, software dis...
StarcoderdataPython
239174
<filename>ci_release_publisher/temporary_store_release.py # -*- coding: utf-8 -*- from enum import Enum, unique from github import GithubObject import logging import re from . import config from . import enum from . import env from . import github from . import travis _tag_suffix = 'tmp' def _tag_name(travis_branch...
StarcoderdataPython
5091871
<gh_stars>1-10 from rest_framework import viewsets, filters from rest_framework.authentication import TokenAuthentication from rest_framework.permissions import IsAuthenticated from core.models import Detail, Order from order.serializers import OrderStatusUpdateSerializer, \ OrderStatusRetrieveSerializer, OrderSer...
StarcoderdataPython
5052204
import logging from ...util import none_or from ..errors import MalformedResponse from .collection import Collection logger = logging.getLogger("mw.api.collections.users") class Users(Collection): """ A collection of information about users """ PROPERTIES = {'blockinfo', 'implicitgroups', 'groups',...
StarcoderdataPython
45011
<reponame>4dcu-be/WinstonCubeSim<filename>main.py<gh_stars>0 from cubedata import RichCubeData as CubeData import click @click.command() @click.option("--url", is_flag=True) @click.argument("path", required=True, type=str) def run(path, url): cube_data = CubeData(draft_size=90) if url: cube_data.read_...
StarcoderdataPython
8140612
<reponame>bio-hpc/metascreener ############################################################################ # # Author: <NAME> # # Copyright: <NAME> TSRI 201 # ############################################################################# """ Module implementing the commands that are present when instanciating an AppFra...
StarcoderdataPython
5132867
<filename>GetWeiboCookies/SelemiumCaptcha.py import base64 import datetime import json import os import random import re import requests from pymongo.errors import DuplicateKeyError from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webd...
StarcoderdataPython
5133743
<gh_stars>1-10 """ @Author: huuuuusy @GitHub: https://github.com/huuuuusy 系统: Ubuntu 18.04 IDE: VS Code 1.36 工具: python == 3.7.3 """ """ 思路: 和268题目的思路一致,用集合存储数字,然后检索 结果: 执行用时 : 500 ms, 在所有 Python3 提交中击败了23.87%的用户 内存消耗 : 23.8 MB, 在所有 Python3 提交中击败了5.06%的用户 """ class Solution: def findDisappearedNumbe...
StarcoderdataPython
6661814
<gh_stars>0 from django.shortcuts import render, redirect from django.contrib.auth.models import User from django.db.models import Q from django.http import JsonResponse from django.utils.translation import gettext as _ from django.core.exceptions import ObjectDoesNotExist from django.utils.datastructures...
StarcoderdataPython
221929
<reponame>Dodoliko/XX4 from lib import MemAccess from lib import offsets from lib.MemAccess import * def isValid(addr): return ((addr >= 0x10000) and (addr < 0x0000001000000000)) def isValidInGame(addr): return ((addr >= 0x140000000) and (addr < 0x14FFFFFFF)) def numOfZeros(value): tmp = value ret...
StarcoderdataPython
58931
import numpy as np from PySide import QtGui, QtCore import sharppy.sharptab as tab from sharppy.sharptab.constants import * ## Written by <NAME> - OU School of Meteorology ## and <NAME> - CIMMS __all__ = ['backgroundWatch', 'plotWatch'] class backgroundWatch(QtGui.QFrame): ''' Draw the background frame and ...
StarcoderdataPython
3397982
<reponame>ebezzam/snips-workshop-macos #!/usr/bin/env python2 # -*- coding: utf-8 -*- from hermes_python.hermes import Hermes import pyowm import io INTENT_HOW_ARE_YOU = "bezzam:how_are_you" INTENT_GOOD = "bezzam:feeling_good" INTENT_BAD = "bezzam:feeling_bad" INTENT_ALRIGHT = "bezzam:feeling_alright" GET_TEMPERATURE ...
StarcoderdataPython
8137496
<gh_stars>1-10 from datetime import datetime import subprocess import requests import json import re COMMAND = ['fail2ban-client', 'status', 'ufw-port-scan'] API_URL = 'https://api.github.com/gists/' GIST_ID = '000' USER_NAME = '000' PAT = '<PASSWORD>' LOG_FILE_NAME = '000' now = datetime.now() now_str = str(now.year...
StarcoderdataPython
3201968
<reponame>chrisbahnsen/aau-rainsnow-eval import json import os import copy from Evaluate import cocoTools sourceJsonPath = './rainSnowGt.json' destDir = '' with open('./splitSequenceTranslator.json') as f: splitSequenceTranslator = json.load(f) # List rain removal methods here methods = ['baseline', ...
StarcoderdataPython
9630054
from django import forms from django.core import validators class SignUpForm(forms.Form): firstName = forms.CharField(min_length=3, max_length=20, widget=forms.TextInput(attrs={'class':'form-control form-input', 'placeholder': 'John'})) lastName = forms.CharField(min_length=3, max_length=20, label='Last Name:...
StarcoderdataPython
183845
# -*- coding: utf-8 -*- """---------------------------------------------------------------------------- Author: fengfan <EMAIL> Date: 2017/1/10 Description: Sunshine RPC Module History: 2017/1/10, create file. ----------------------------------------------------------------------------""" import sys import uuid i...
StarcoderdataPython
289805
""" Demonstrates swapping the values of two variables """ number1 = 65 #Declares a variable named number1 and assigns it the value 65 number2 = 27 #Declares a variable named number2 and assigns it the value 27 temp_number = number1 #Copies the reference of n...
StarcoderdataPython
3429865
import string # the class-based expressions are mostly for organization # but sometimes they're just too clunky LEFT_BRACKET = '[' RIGHT_BRACKET = ']' class FormalDefinition(object): """ The basic operators and elements of a regular expression """ empty_string = '^$' alternative = '|' OR =...
StarcoderdataPython
1717850
''' (c) University of Liverpool 2019 All rights reserved. @author: neilswainston ''' # pylint: disable=invalid-name # pylint: disable=wrong-import-order from sklearn.metrics import classification_report, confusion_matrix from liv_learn.keras import classify_lstm from liv_learn.utils.biochem_utils import fasta_to_df,...
StarcoderdataPython
3369987
from simbatch.core import core as batch from simbatch.core.actions import SingleAction import pytest @pytest.fixture(scope="module") def sib(): # TODO pytest-datadir pytest-datafiles vs ( path.dirname( path.realpath(sys.argv[0]) ) sib = batch.SimBatch(5, ini_file="config_tests.ini") return s...
StarcoderdataPython
4806755
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- """ Step 3X Preprocessing: Feature Selection License_info: ISC ISC License Copyright (c) 2020, <NAME> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright ...
StarcoderdataPython
151673
<reponame>chrisseto/pycon2020-big-o-no import random from django.db import transaction from django.core.management.base import BaseCommand, CommandError from faker import Faker from app.models import * class Command(BaseCommand): help = 'Populate the database will fake data' def handle(self, *args, **options)...
StarcoderdataPython
84548
# BSD 3-Clause License # # Copyright (c) 2016-19, University of Liverpool # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notic...
StarcoderdataPython
3272244
from odynn import optim, utils import pandas as pd import seaborn as sns import pylab as plt import numpy as np from odynn.models import cfg_model from odynn import neuron as nr from odynn import nsimul as ns from sklearn.decomposition import PCA def corr(df): corr = df.corr() # Set up the matplotlib figur...
StarcoderdataPython
3474162
#!/usr/bin/python # -*- coding:utf-8 -*- # B, M, E, S: Beginning, Middle, End, Single 4 tags import sys,os import CRFPP # linear chain CRF model path, need str input, convert unicode to str pkg_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DEFAULT_MODEL = str(os.path.join(pkg_path, "data/seg/data...
StarcoderdataPython
4993407
class Solution(object): def reverseVowels(self, s): """ :type s: str :rtype: str """ s = list(s) vowels = [(i, c) for i, c in enumerate(s) if c in 'aeiouAEIOU'] LV = len(vowels) for vi, (i, c) in enumerate(vowels): i2, c2 = vowels[LV-vi-1] s[i] = c2 return ''.join(s) print Solution().reverseV...
StarcoderdataPython
1620190
#Crear una clase Persona que tenga como atributos el "cedula, nombre, apellido y la edad # (definir las propiedades para poder acceder a dichos atributos)". Definir como responsabilidad # una cuncion para mostrar ó imprimir. Crear una segunda clase Profesor que herede de la clase Persona. # Añadir un atributo suel...
StarcoderdataPython
5150642
class Submarine: def __init__(self): self.horizontal_position: int = 0 # depth (inverse axis) self.vertical_position: int = 0 # navigation of submarine from submarine_navigation import SubmarineNavigation self.submarine_navigation = SubmarineNavigation(self) de...
StarcoderdataPython
1763573
<reponame>usgin/nrrc-repository from django.http import HttpResponseNotAllowed, HttpResponseForbidden from django.contrib.auth.decorators import login_required from metadatadb.proxy import proxyRequest, can_edit, hide_unpublished def oneFile(req, resourceId, fileName): allowed = [ 'GET', 'DELETE' ] if req.meth...
StarcoderdataPython
3420812
<filename>sorting/python/selection-sort.py def sort(arr): for i in range(len(arr)): min_idx = i for j in range(i+1, len(arr)): if arr[min_idx] > arr[j]: min_idx = j arr[i], arr[min_idx] = arr[min_idx], arr[i] return arr arr = list(map(int,input("Enter Numbers: ").split())) print(...
StarcoderdataPython
6568355
<filename>src/grocsvs/stages/visualize.py import collections import numpy import os import pandas from grocsvs import graphing from grocsvs import step from grocsvs import structuralvariants from grocsvs import utilities from grocsvs.stages import final_clustering from grocsvs.stages import genotyping from grocsvs.st...
StarcoderdataPython
3560009
<filename>mlxtend/mlxtend/evaluate/bootstrap_outofbag.py # <NAME> 2014-2020 # mlxtend Machine Learning Library Extensions # # Bootstrap functions # Author: <NAME> <<EMAIL>> # # License: BSD 3 clause import numpy as np class BootstrapOutOfBag(object): """ Parameters ---------- n_splits : int (default...
StarcoderdataPython
6677463
<filename>src/probnum/utils/__init__.py from .argutils import * from .arrayutils import * from .fctutils import * from .randomutils import * # Public classes and functions. Order is reflected in documentation. __all__ = [ "atleast_1d", "atleast_2d", "as_colvec", "as_numpy_scalar", "as_random_state"...
StarcoderdataPython
3378998
""" Classes and functions for configuring BIG-IQ """ # Copyright 2014 F5 Networks 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 # # Un...
StarcoderdataPython
4938794
<reponame>GQAssurance/selenium SE_VERSION = "4.0.0-alpha-3"
StarcoderdataPython
12804803
from samplemodule import message def test_message(): assert message == 'Hello World'
StarcoderdataPython