id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
113290
import numpy as np from IMLearn.learners.classifiers import Perceptron, LDA, GaussianNaiveBayes from typing import Tuple from utils import * from os import path import plotly.graph_objects as go from plotly.subplots import make_subplots from matplotlib import pyplot as plt from math import atan2, pi def load_dataset...
StarcoderdataPython
28447
from django.urls import path from .views import ContactListView urlpatterns = [ path('', ContactListView.as_view()), ]
StarcoderdataPython
92105
from django import template from ..models import InterConsultas register = template.Library() @register.simple_tag def total_inter_consultas(historia_id): """ Devuelve el total de inter consultas para una historia clinica """ return InterConsultas.objects.filter(historia=historia_id).count()
StarcoderdataPython
3387565
<reponame>damo-da/birthday from django.db.models.signals import pre_save from django.dispatch import receiver from .models import Person from helpers.birthday_helper import get_random_superhero from helpers.log import log @receiver(pre_save, sender=Person) def cb(sender, instance, *args, **kwargs): log('Saving {}...
StarcoderdataPython
1798691
#!/usr/bin/python2 import argparse import datetime import json import urllib2 class SiaClient(object): def __init__(self, address): self._address = address self._url_opener = urllib2.build_opener() self._url_opener.addheaders = [('User-Agent', 'Sia-Agent')] def get_current_height(se...
StarcoderdataPython
72397
from config import get_env class EnvConfig(object): """Parent configuration class.""" DEBUG = False CSRF_ENABLED = True SECRET = get_env("SECRET") SQLALCHEMY_DATABASE_URI = get_env("DATABASE_URL") class DevelopmentEnv(EnvConfig): """Configurations for Development.""" DEBUG = True cla...
StarcoderdataPython
165538
"""Assorted plotting functions. AUTHOR: <NAME> <britta.wstnr[at]gmail.com> """ import numpy as np import matplotlib.pyplot as plt from nilearn.plotting import plot_stat_map from nilearn.image import index_img def plot_score_std(x_ax, scores, title=None, colors=None, legend=None): if colors is None: colo...
StarcoderdataPython
3304832
<reponame>ksilo/LiuAlgoTrader<filename>liualgotrader/common/assets.py from typing import Dict from liualgotrader.common.types import AssetType assets_details: Dict[str, Dict] = { "btcusd": { "type": AssetType.CRYPTO, "min_order_size": 0.00001, "tick_precision": 8, }, "ethusd": { ...
StarcoderdataPython
6960
__doc__ = \ """ ======================================================================================= Main-driver :obj:`LogStream` variables (:mod:`mango.application.main_driver.logstream`) ======================================================================================= .. currentmodule:: mango.application.ma...
StarcoderdataPython
3342484
<reponame>PancakeAwesome/CRNN_tensorflow import os import numpy as np import tensorflow as tf import cv2 # +-* + () + 10 digit + blank + space num_classes = 3 + 2 + 10 + 1 + 1 maxPrintLen = 100 tf.app.flags.DEFINE_boolean('restore', False, 'whether to restore from the latest checkpoint') tf.app.flags.DEFINE_string('...
StarcoderdataPython
1674428
<reponame>JohnSaliver/Emergent-Communication-in-MARL # imports for the gym, pytorch and numpy import gym import torch import numpy as np from ProgressionTree import ProgressionTree # define custom environment class from gym class CombinationGame(gym.Env): def __init__(self, number_of_agents, grid_size=10, max_obj_...
StarcoderdataPython
187511
<reponame>vikrosj/fdet-offline """io module""" import os from typing import Tuple, Union, List, Sequence, Dict, Any import cv2 import numpy as np from colour import Color from fdet.utils.errors import DetectorIOError class VideoHandle(): """Help class to iterate over video""" def __init__(self, source: str) ...
StarcoderdataPython
3332100
<filename>Metropolis_Ising.py #!/usr/bin/env python # coding: utf-8 # # Simulación del modelo de Ising bidimensional mediante el Algoritmo de Metropolis # En primer lugar, se importan los paquetes para realizar las gráficas, implementar cálculos y geenrar números aleatorios respectivamente # In[22]: import matplo...
StarcoderdataPython
4839928
# Copyright (c) 2014 <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, merge, publish, dis- # tribu...
StarcoderdataPython
172485
import logging import sys from os.path import isfile import numpy as np from phi import math from phi.field import Scene class SceneLog: def __init__(self, scene: Scene): self.scene = scene self._scalars = {} # name -> (frame, value) self._scalar_streams = {} root_logger = logg...
StarcoderdataPython
1671408
import os import time import datetime import tweepy def get_authorized_api(): consumer_key = os.getenv('GB_CONSUMER_KEY') consumer_secret = os.getenv('GB_CONSUMER_SECRET') access_token = os.getenv('GB_ACCESS_TOKEN') access_token_secret = os.getenv('GB_TOKEN_SECRET') auth = tweepy.OAuthHandler(co...
StarcoderdataPython
53024
import numpy as np import matplotlib.pyplot as plt # documentation # https://matplotlib.org/3.1.3/api/pyplot_summary.html # scatter plot x = np.random.randint(100, size=(100)) y = np.random.randint(100, size=(100)) plt.scatter(x, y, c='tab:blue', label='stuff') plt.legend(loc=2) # plt.show() # line plot x = np.a...
StarcoderdataPython
1696235
<gh_stars>0 def numberOfSteps(steps, m):
StarcoderdataPython
1716762
<filename>mainapp/views.py<gh_stars>1-10 from django.http import HttpResponse from django.shortcuts import render, redirect, get_object_or_404 from django.views.generic import View from .models import Topic, ChatMessage from django.core.exceptions import ObjectDoesNotExist from django.http import Http404 import datetim...
StarcoderdataPython
1772110
<reponame>justanotherfoundry/Glyphs-Scripts<gh_stars>100-1000 #MenuTitle: Build Parenthesized Glyphs # -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals __doc__=""" Creates parenthesized letters and numbers: one.paren, two.paren, three.paren, four.paren, five.paren, six.paren, seve...
StarcoderdataPython
3296546
import asyncio import os import uuid import pandas as pd import pytest from storey import build_flow, CSVSource, CSVTarget, SyncEmitSource, Reduce, Map, FlatMap, AsyncEmitSource, ParquetTarget from .integration_test_utils import _generate_table_name has_azure_credentials = os.getenv("AZURE_ACCOUNT_NAME") and os.gete...
StarcoderdataPython
22921
<reponame>Alpacron/vertex-cover import json import random class Graph: """ Graph data structure G = (V, E). Vertices contain the information about the edges. """ def __init__(self, graph=None): if graph is None: graph = {} is_weighted = graph is not None and any( ...
StarcoderdataPython
84734
class Ssh: def __init__(self,user,server,port,mode): self.user=user self.server=server self.port=port self.mode=mode @classmethod def fromconfig(cls, config): propbag={} for key, item in config: if key.strip()[0] == ";": continue ...
StarcoderdataPython
4818873
author = "wklchris" copyright = "wklchris" exclude_patterns = ['_build', '**.ipynb_checkpoints'] extensions = ['nbsphinx', 'sphinx_copybutton', 'sphinx.ext.extlinks', 'sphinx.ext.mathjax'] html_css_files = ['style.css'] html_static_path = ['../_static'] html_theme = "sphinx_rtd_theme" html_theme_options = {'canonical_u...
StarcoderdataPython
3207818
class Solution: def sumOddLengthSubarrays(self, arr: List[int]) -> int: res = 0 for i in range(len(arr)): sum = 0 for j in range(i,len(arr)): sum += arr[j] if (j - i) % 2 == 0: res += sum return res # using dp http...
StarcoderdataPython
3213696
import enum from contextlib import contextmanager class Param(enum.Enum): """Enum representing a parameter. Param.ON is truthy, everything else is falsey.""" ON = 0 # force on OFF = 1 # force off AUTO = 2 # set using init_params def __bool__(self): return self == Param.ON params ...
StarcoderdataPython
1664732
<reponame>nmusatti/nxpy # nxpy_ply -------------------------------------------------------------------- # Copyright <NAME> 2010 - 2018 # Use, modification, and distribution are subject to the Boost Software # License, Version 1.0. (See accompanying file LICENSE.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) #...
StarcoderdataPython
3251820
<reponame>diviyat/chameleon import fileinput import os import pickle import json import numpy as np import pandas as pd def directory_check(dpath): if not os.path.exists(dpath): os.makedirs(dpath) def write_pandas(df, outdir, fname): directory_check(outdir) outfile = os.path.join(outdir, fname) ...
StarcoderdataPython
37275
<reponame>LorneWu/twstock # -*- coding: utf-8 -*- import datetime import urllib.parse from collections import namedtuple from operator import attrgetter from time import sleep from twstock.proxy import get_proxies import os import json try: from json.decoder import JSONDecodeError except ImportError: JSONDec...
StarcoderdataPython
1785772
import re # Use day_dict and is_leap_year in your tomorrow function day_dict ={ 1 : 31, 2 : 28, 3 : 31, 4 : 30, 5 : 31, 6 : 30, 7 : 31, 8 : 31, 9 : 30, 10 : 31, 11 : 30, 12 ...
StarcoderdataPython
49318
""" Reviewed 03-06-22 Sequence-iteration is correctly implemented, thoroughly tested, and complete. The only missing feature is support for function-iteration. """ from pypy.objspace.std.objspace import * class W_AbstractSeqIterObject(W_Object): from pypy.objspace.std.itertype import iter_typedef as typedef ...
StarcoderdataPython
4836953
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ### # File: api.py # Created: Tuesday, 28th July 2020 12:31:21 pm # Author: <NAME> (<EMAIL>) # ----- # Last Modified: Wednesday, 29th July 2020 1:34:28 am # Modified By: <NAME> (<EMAIL>) # ----- # Copyright (c) 2020 Slishee ### import quran as q from typing import Dict cl...
StarcoderdataPython
3292076
import traceback from .command import CommandMgr from .constants import SYSTEM_USER, SYSTEM_CHANNEL, SHORTHAND_TRIGGER_RE from .listener import ListenerMgr from .job import JobsMgr from .query import Query from .utils import strip from gevent import Greenlet, sleep, spawn_raw, spawn_later from gevent.event import Even...
StarcoderdataPython
1693340
<reponame>WingsUpete/Melanoma-Discriminator ################## Melanoma Discrimator ##################### ### Created by <NAME> on Aug 18th, 2020 ### ### <EMAIL> ### ### Data Source: https://challenge2020.isic-archive.com/ ### ##########################################...
StarcoderdataPython
149452
""" Provides functionality for persistence of data """ import csv import os from abc import ABC, abstractmethod from collections import OrderedDict from dataclasses import dataclass @dataclass class EmissionsData: """ Output object containg experiment data """ timestamp: str experiment_id: str ...
StarcoderdataPython
187749
from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.test import TestCase from django.test.utils import override_settings class AuthBackendTests(TestCase): def setUp(self): self.existing_user = User.objects.create_user(username='test', email='<EM...
StarcoderdataPython
181473
<reponame>NCAR/ldcpy<gh_stars>1-10 from unittest import TestCase import numpy as np import pandas as pd import pytest import xarray as xr import ldcpy from ldcpy.calcs import Datasetcalcs, Diffcalcs times = pd.date_range('2000-01-01', periods=10) lats = [0, 1, 2, 3] lons = [0, 1, 2, 3, 4] test_data = xr.DataArray( ...
StarcoderdataPython
3287381
import boto3 import json import logging import sys import os.path as op from datetime import datetime from satstac import STACError, Collection from satstac.sentinel import transform, SETTINGS, read_remote logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) client = boto3.client('sns', region_name='...
StarcoderdataPython
4824713
<gh_stars>0 import os import csv import geojson import numpy as np import pandas as pd from sklearn.metrics import precision_score root_dir = r"G:\Capstone" pred_label_path = os.path.join(root_dir, "pred_label.csv") layer_path = os.path.join(root_dir, "assets_proc.geojson") csv_dict = {} with open(pred_...
StarcoderdataPython
3309519
# -*- coding: UTF-8 -*- import random ''' 1) Create list ''' # 1 create a = [] print(a) ''' 2) Assignment list ''' a = ['Archie', 'Leon', 'Cynthia', 'Eathson', 'Kevin'] b = [1, 2, 3, 4, 5, 6] print(a) print(b) print('-------cutting line-----') ''' 3) Append/Extend ''' a += ['Mike'] # a.append('Mike') print(a) prin...
StarcoderdataPython
4822499
<filename>setup.py #!/usr/bin/env python __version__ = '1.0.0dev' from setuptools import setup setup( name='upbrew', version=__version__, app=['upbrew.py'], data_files=[], options={ 'py2app': { 'argv_emulation': True, 'plist': { 'LSUIElement': True,...
StarcoderdataPython
3275322
"""Configurator is responsible to carry out the task of populating the datastructure from given set of input variables and return them to the original caller of this module. """ from exception import * class Configurator(): """Configurator generates the datastructure which contains various variables required...
StarcoderdataPython
1627656
from django import forms class CreateRequestForm(forms.Form): new_request_name = forms.TextInput(attrs={'max_length': 100, 'class': "form-control", 'placeholder': "Give your request a name"}) new_request_name = new_request_name.render('requestname', '') new_hashtag = forms.TextInput(attrs={'max_length': 50...
StarcoderdataPython
143806
<reponame>ckamtsikis/cmssw<filename>JetMETAnalysis/METSkims/python/RECOSIMSumET_EventContent_cff.py import FWCore.ParameterSet.Config as cms from Configuration.EventContent.EventContent_cff import * from JetMETAnalysis.METSkims.sumET_EventContent_cff import * RECOSIMSumETEventContent = cms.PSet( outputCommands = c...
StarcoderdataPython
48156
<filename>src/python/search/search.py import pytest def sequence_search(alist, item): pos = 0 found = False while pos<len(alist) and not found: if item == alist[pos]: found = True break pos += 1 return found @pytest.mark.parametrize("test_input, item, expecte...
StarcoderdataPython
3337317
<filename>tests/unit_tests/test_resolver.py import unittest from resolve.resolver import Resolver class TestResolver(unittest.TestCase): def test_resolver_can_be_initialized(self): resolver = Resolver(testing=True) self.assertIsNotNone(resolver) self.assertIsNone(resolver.modules) if __nam...
StarcoderdataPython
3374678
__author__ = 'fbidu' BASE_URL = "https://raw.githubusercontent.com/github/gitignore/master/" GITIGNORE_URL = "" def has_gitignore(): import os return os.path.isfile("./.gitignore") def get_https_response(host, path): import httplib conn = httplib.HTTPSConnection(host) conn.request('HEAD', path) ...
StarcoderdataPython
127002
from pathlib import Path from allennlp.models import Model from allennlp.data import Instance from allennlp.data import Vocabulary from allennlp.data import DataLoader from allennlp.data import DatasetReader from typing import Any, Tuple, Iterable from allennlp.training.trainer import Trainer from allennlp.training.tra...
StarcoderdataPython
66784
<gh_stars>0 # ====================================================================================================================== # File: Model/Fermentation.py # Project: AlphaBrew # Description: A base for fermenting a beer. # Author: <NAME> <<EMAIL>> # Copyright: (c) 2020 <NAME> # ----...
StarcoderdataPython
3281731
import requests import pytest from test_util import stat_assert def test_connection(server, req): res = req.get(server.api("/index")) if res.status_code != 200: pytest.exit("Could not connect to local API server") stat_assert(res, 200) def test_404(server, req): res = req.get(server.api("/non...
StarcoderdataPython
154464
<filename>tests/test_model.py # coding=utf-8 import json import pickle from datetime import datetime, date from concurrent.futures import ThreadPoolExecutor, as_completed from mock import patch, Mock from olo import Field, DbField, Model from olo.key import StrKey from olo.libs.aes import encrypt from olo.utils impor...
StarcoderdataPython
1769771
<filename>Timer/demo.py #! python3 import time def loop(): i = 100000 while i: i = i - 1 def run(): ''' process_time <include> cpu sleep time > Return the value (in fractional seconds) of the sum of the system and user CPU time of the current process. > (sum of mulit core process ti...
StarcoderdataPython
3373622
<reponame>Uamhan/mBot from music21 import converter,instrument,note,chord,stream import tensorflow as tf from keras.layers import Dense, Conv2D, Dropout, Flatten, MaxPooling2D,LSTM,Activation from keras.models import Sequential import keras.models import numpy as np from keras.utils import np_utils from keras.callbacks...
StarcoderdataPython
191305
from .model import VNet3D
StarcoderdataPython
1716599
''' @version: Python 3.7.3 @Author: Louis @Date: 2020-06-15 13:27:40 LastEditors: Louis LastEditTime: 2020-08-24 15:00:39 ''' import os import logging from .txx_os import make_parent_dir from .txx_consts import TODAY def single_lvl_logger(log_file=None, global_level=logging.INFO, handler_level=logging.INFO): """...
StarcoderdataPython
1687205
<gh_stars>0 # Time: O(n) # Space: O(1) import bisect class Solution(object): def sampleStats(self, count): """ :type count: List[int] :rtype: List[float] """ n = sum(count) mi = next(i for i in range(len(count)) if count[i]) * 1.0 ma = next(i for i in reve...
StarcoderdataPython
163449
#!/usr/bin/python3 # # Python script that regenerates the README.md from the embedded template. Uses # ./generate_table.awk to regenerate the ASCII tables from the various *.txt # files. from subprocess import check_output attiny_results = check_output( "./generate_table.awk < attiny.txt", shell=True, text=True) ...
StarcoderdataPython
3283660
<gh_stars>1-10 from rest_framework.test import APITestCase from socialdistribution.models import Inbox import base64 class InboxTests(APITestCase): url = "/service/author/" auth_str = base64.b64encode(b'socialdistribution_t18:c404t18').decode() def create_account(self): # create author account...
StarcoderdataPython
1632574
import tensorflow as tf def mask_busy_gpus(leave_unmasked=1, random=True): try: command = "nvidia-smi --query-gpu=memory.free --format=csv" memory_free_info = _output_to_list(sp.check_output(command.split()))[1:] memory_free_values = [int(x.split()[0]) for i, x in enumerate(memory_free_info)] availa...
StarcoderdataPython
85974
<filename>tests/tests.py """ Author: <NAME> (<EMAIL>) Copyright © 2021, United States Government, as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved. The HybridQ: A Hybrid Simulator for Quantum Circuits platform is licensed under the Apache License, Version 2...
StarcoderdataPython
1608578
"""This module contains tests for DataTestCase. """ import pytest from pywrangler.util.testing.datatestcase import DataTestCase, TestCollection @pytest.fixture def datatestcase(): class TestCase(DataTestCase): def input(self): return self.output["col1"] def output(self): ...
StarcoderdataPython
1638947
<filename>test/cluster/kmeans.py from numpy import array from scipy.cluster.vq import vq, kmeans, whiten from dml.CLUSTER.kmeans_iter import KMEANSC import matplotlib.pyplot as plt features=array([ [13.45,11.95], [14.15,11.75], [14.8,11.25], [15.35,10.35], [15,9.55], [14.05,9.3], [13.05,10.2], [13.5,11.3], [14.4,10.95]...
StarcoderdataPython
148543
from fastapi.requests import Request from semantic_version import Version from fastapi_versioned import VersionRouter version = VersionRouter(Version("0.0.2")) @version.router.get("/test2") def route(request: Request): return {"version": str(request.app.version)}
StarcoderdataPython
1795861
<reponame>2DU/openNAMU-PYnamu from .tool.func import * def main_func_setting_main(db_set): with get_db_connect() as conn: curs = conn.cursor() if admin_check() != 1: return re_error('/ban') setting_list = { 0 : ['name', 'Wiki'], 2 : ['frontpage'...
StarcoderdataPython
1750924
<reponame>mailslurp/mailslurp-client-python # coding: utf-8 """ MailSlurp API MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and ...
StarcoderdataPython
1774056
import os import numpy as np import sys import lstm def combinador1(clases): cw, cc = clases.shape acum = np.empty_like (clases[0]) out = "" LSTM = lstm.LSTM_Pred('') for i in range(0,cw): maxj = 0 for j in range(0,cc): if clases[i][maxj]<clases[i][j]: ...
StarcoderdataPython
102219
<filename>psltdsim/mirror/sumLoad.py def sumLoad(mirror): """Returns system sums of active PSLF load as [Pload, Qload]""" sysPload = 0.0 sysQload = 0.0 # for each area for area in mirror.Area: # reset current sums area.cv['P'] = 0.0 area.cv['Q'] = 0.0 # sum each acti...
StarcoderdataPython
3299185
<filename>examples/gui_example3_batch.py #!python from _gui import usage_gui usage_gui(None)
StarcoderdataPython
3360570
<filename>emql/adapters/geosearch.py<gh_stars>1-10 # 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 r...
StarcoderdataPython
1689343
# -*- coding: utf-8 -*- import hashlib import math import os import sys import errno import datetime import re import struct import json import logging import shutil import puremagic import urllib import base64 import pyhindsight.lib.ccl_chrome_indexeddb.ccl_blink_value_deserializer from pyhindsight.browsers.webbrowse...
StarcoderdataPython
103485
<filename>src/server/save_map_img.py import gen_map from PIL import Image, ImageDraw import time import color_picker generator = gen_map.MapGenerator(size_x=300, size_y=300) color_pick = color_picker.ColorPicker() s_time_gen_world = time.time() generator.generate_world() print('Time spent for generating world -', t...
StarcoderdataPython
1715521
#!/usr/bin/env python # -*- coding: UTF-8 -*- import mne import numpy as np from braininvaders2012 import download as dl import os import glob import zipfile from scipy.io import loadmat BI2012a_URL = 'https://zenodo.org/record/2649069/files/' class BrainInvaders2012(): ''' We describe the experimental proce...
StarcoderdataPython
1708228
import pandas as pd from bin import pricinginfo def ST(instrument, interval, number, multiplier, length): data, times = pricinginfo(instrument, interval, number, dfs=1) data['tr0'] = abs(data["High"] - data["Low"]) data['tr1'] = abs(data["High"] - data["Close"].shift(1)) data['tr2'] = abs(data...
StarcoderdataPython
3212288
# class placeholders class Container: pass class NativeArray: pass class NativeVariable: pass class Array: pass class Variable: pass class Framework: pass class Device: pass class Node: pass class Dtype: pass # global constants _MIN_DENOMINATOR = 1e-12 _MIN_BASE = ...
StarcoderdataPython
33757
<filename>tests/components/geofency/__init__.py """Tests for the Geofency component."""
StarcoderdataPython
3237289
"""Bazel rules for nucleus_py_* targets that can depend on C++ code.""" # A provider with one field, transitive_deps. CppFilesInfo = provider(fields = ["transitive_deps"]) def get_transitive_deps(deps): """Return all the transitive dependencies of deps.""" return depset( deps, transitive = [de...
StarcoderdataPython
3312693
import requests import json def photo_tag(image_url): """图像分类 API""" endpoint = "Your endpoint" # 自行填写 subscription_key = "Your subscription key" # 自行填写 # base url analyze_url = endpoint + "vision/v3.1/analyze" headers = {'Ocp-Apim-Subscription-Key': subscription_key} # 参数 params = {...
StarcoderdataPython
1634801
import torch import numpy as np import torch.nn as nn from torch.nn import init from torch.autograd import Variable hasCuda = torch.cuda.is_available() class MLDecoder(nn.Module): """ This module is for prediction of the tags using a decoder RNN. It has 3 variants for ML training: 1-TF: Teachor Fo...
StarcoderdataPython
1680093
#!/usr/bin/env python """ Code for linting modules in the nf-core/modules repository and in nf-core pipelines Command: nf-core modules lint """ from __future__ import print_function import logging from nf_core.modules.modules_command import ModuleCommand import operator import os import questionary import re import r...
StarcoderdataPython
3262675
""" Unit OVS functionality """ import pytest from fmcheck.ovs import OVS from fmcheck.switch import Switch from fmcheck.ssh import NoviflowSSH import logging def return_switch(): return {'switch': [{'name': 's11', 'dpid': '64', 'ip': '172.24.86.98', 'password': '<PASSWORD>', 'type': 'ovs', 'protocols': 'OpenFlo...
StarcoderdataPython
3390559
<reponame>fyrestartr/Readers-Underground<gh_stars>1-10 from os import listdir, remove from os.path import join, normpath from utils.zip import unzip class FolderItemsUnzipper: def __init__(self, folder_path): self.folder_path = folder_path def run(self): for file in listdir(self.folder_path):...
StarcoderdataPython
81007
<gh_stars>0 ### # Test script for new WikiPathways webservice API # author: msk (<EMAIL>) ### import requests import getpass from lxml import etree as ET ################################## # variables username = 'Mkutmon' gpml_file = 'test.gpml' basis_url = 'http://pvjs.wikipathways.org/wpi/webservicetest/' #######...
StarcoderdataPython
1728449
''' This module is created to enable simulation of games between bots MCTS v MCTS + NN ''' import argparse from copy import deepcopy import numpy as np import matplotlib.pyplot as plt from matplotlib import colors from matplotlib.ticker import PercentFormatter from board import Board import math from bot import Node fr...
StarcoderdataPython
3310848
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from ansible.parsing.dataloader import DataLoader from ansible.vars import VariableManager from ansible.inventory import Inventory from ansible.playbook.play import Play from ansible.executor.task_queue_manager import TaskQueueManager from ansible.executor.playb...
StarcoderdataPython
1725175
from django.db import models # from django.db.models.expressions import F # from django.db.models.fields.files import ImageField # Create your models here. class tourModel(models.Model): title = models.CharField(max_length=100, blank=False) date = models.DateField(auto_now_add=False) image = mode...
StarcoderdataPython
38315
<filename>deployment/cloudformation/data.py """Handles template generation for Cac Data Plane stack""" from troposphere import ( Parameter, Ref, Output, Tags, GetAtt, ec2, rds, route53 ) from .utils.constants import RDS_INSTANCE_TYPES from majorkirby import StackNode class BaseFacto...
StarcoderdataPython
3358487
"""A module for handling potentials. This module contains several different classes representing potentials, each having methods to compute relevant nondimensional quantities as functions of nondimensional force or stretch. This module also contains the parent class ``Potential`` that is used to assign a potenti...
StarcoderdataPython
4815945
<reponame>CarlKCarlK/InstallTest import fastlmmclib.quadform as qf # noqa print("OK")
StarcoderdataPython
3381343
<reponame>nameismahipal/Python-Projects<gh_stars>0 num = int(input('Enter a number : ')) for i in range(1, 13): print(num, 'x', i, '=', num*i)
StarcoderdataPython
1612597
<reponame>ezeeyahoo/earthenterprise #!/usr/bin/env python2.7 # # 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...
StarcoderdataPython
4836727
<filename>apps/participants/admin.py<gh_stars>1-10 from django.contrib import admin from apps.participants.models import Participant admin.site.register(Participant)
StarcoderdataPython
120626
<gh_stars>1-10 """ [<NAME>] (Edge Detection Object) https://github.com/vikas-ukani/ """ def detect (image_name): # Import Necessary Packages import sys # system important import cv2 # computer visualization import numpy as np # multi-dimensional array # linear algebra # Get arguments from com...
StarcoderdataPython
101953
<gh_stars>0 import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns def load_and_process(path): # Method Chain 1 (Load data and deal with missing data) df1 = ( pd.read_csv(path) .loc[lambda x: ~x['Marital_Status'].str.contains("Unknown", na=False)] ...
StarcoderdataPython
1713686
<filename>horizon_bsn/content/connections/routerrules/rulemanager.py # Copyright 2013, Big Switch Networks # # 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.apa...
StarcoderdataPython
141732
import json import sys from collections import defaultdict from LifFileParser import LifFileParser import copy import re # Split the tokens containing hyphen inside into separate tokens # Return a new annotation list for LIF file def split_hyphen(annotations): update_annotations = [] current_id = 0 for ann ...
StarcoderdataPython
92158
from abc import ABC, abstractmethod from urllib.parse import urlencode import logging import csv import pandas as pd from helper import retrieve_website from jobs import StepstoneJob class BaseParser(ABC): def __init__(self): self.jobs = [] self._create_startinglink() @abstractmethod def ...
StarcoderdataPython
3296571
import os import torch from torchvision import transforms, datasets import torchvision import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.optim a...
StarcoderdataPython
146113
from setuptools import setup, find_packages setup( name="cfddns", version="0.1", packages=['cfddns'], entry_points={ 'console_scripts': ["cfddns = cfddns:main"], }, install_requires=["cloudflare", "pyyaml"], )
StarcoderdataPython
4839870
"""Multilinear Principal Component Analysis. """ # Copyright (c) 2022, <NAME>; # Copyright (c) 2007-2022 The scikit-learn developers. # License: BSD 3 clause import numpy as np from scipy import linalg from .utils import tensor class MultilinearPCA: """Multilinear Principal Component Analysis (MPCA). PCA b...
StarcoderdataPython
117565
<filename>droidlet/lowlevel/locobot/remote/pyrobot/core.py # 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. class Robot: def __init__( self, robot_name, common_con...
StarcoderdataPython