id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3256295
from identity.setup.participant_identifier_types import ParticipantIdentifierTypeName from identity.setup.redcap_instances import REDCapInstanceDetail from identity.setup.studies import StudyName from identity.ecrfs.setup import crfs, RedCapEcrfDefinition crfs.extend([ RedCapEcrfDefinition({ 'crfs': [ ...
StarcoderdataPython
3256537
<gh_stars>0 import os, sys, string, random, textwrap from datetime import datetime def convert(string): return "".join([hex(c) for c in string]) def randname(): return "".join([random.choice(string.ascii_letters) for i in range(10)]) def populate(basePath, data, depth, width, fpl): global index ...
StarcoderdataPython
157390
from django.urls import path from . import views from .views import AutoCreate urlpatterns = [ path('owner/<int:owner_id>/', views.detail), path('', AutoCreate.as_view()) ]
StarcoderdataPython
1798197
<filename>bigList.py import collections class BigListError(StandardError): pass class bigList: """A list-like structure for managing allot (possibly infinite) data.""" def __init__(self, prefix, iterable=None, minChunkSize=2**8, database = None): if database == None: raise BigListError(...
StarcoderdataPython
1656622
def get_new_color(colors): """ function takes list of colors and it calculates new color, which is similar to others. :param colors: list of colors that are used as basis for calculating similarity. :return: color in a tuple, that has 3 values for RGB. Example: (200, 100, 200) """ import rando...
StarcoderdataPython
199082
<gh_stars>1-10 # This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico 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. from __future__ import unicode_literals from flask import request, session from werkzeug.e...
StarcoderdataPython
1616122
<filename>tests.py import unittest import parametrized class IsParametrizedTestCase(unittest.TestCase): def setUp(self): def stub_method(_): pass self.stub_method = stub_method def test_is_parametrized_true(self): """ """ self.stub_method.parametrized = T...
StarcoderdataPython
4831877
import math from gennav.planners import Planner from gennav.utils import RobotState, Trajectory from gennav.utils.common import Node from gennav.utils.geometry import Point # from gennav.utils.samplers import uniform_adjustable_random_sampler as sampler class RRT(Planner): """RRT Planner Class. Attributes: ...
StarcoderdataPython
1664282
<reponame>havenmoney/platform-clients<gh_stars>0 import haven from haven.authed_api_client import AuthedApiClient from datetime import datetime from dateutil.tz import tzutc def main(): config = haven.Configuration(host="https://haven.dev/api") api = haven.DefaultApi(AuthedApiClient( id="YOUR_ID_HERE...
StarcoderdataPython
195296
from footmark.market.productobject import TaggedPRODUCTObject class Product(TaggedPRODUCTObject): def __init__(self, connection=None): super(Product, self).__init__(connection) def __repr__(self): return 'Product:%s' % self.id def __getattr__(self, name): if name == 'price': ...
StarcoderdataPython
104599
<reponame>XedaHQ/xeda<filename>xeda/flow_runner/default_runner.py import multiprocessing import sys import re import logging import pkg_resources import json from ..flows.settings import Settings from ..flows.flow import Flow, FlowFatalException, my_print from ..utils import camelcase_to_snakecase, load_class, dict_me...
StarcoderdataPython
51013
a = int (input(' enter the first number ')) b = int (input('enter the second number ')) z = a + b print(a+b)
StarcoderdataPython
1667029
<gh_stars>0 from django.test import TestCase from unittest.mock import patch, Mock from django.core.mail import EmailMultiAlternatives from core.emails.notifications import RecentDishesEmailNotification from core.emails.notification_service import EmailNotificationService def pass_side_effect(): pass class Test...
StarcoderdataPython
1745824
<reponame>rackerlabs/cinder # Copyright 2015 SimpliVity Corp. # # 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 ...
StarcoderdataPython
146991
<reponame>davidc/denonavr from . import denon as Denon import argparse def main(): p = argparse.ArgumentParser(description="Remote Denon controller") p.add_argument('-H','--host',help="IP or host of the denon system to connect to",required=True) p.add_argument('-z','--zone',help="The zone to use (default: MAIN...
StarcoderdataPython
1769441
# Program to load model and predict class # Input: xgb_model.py %1 where %1 is a csv file of features # Output: array of predictions import os import sys import xgboost as xgb import pandas as pd import json import pickle as pkl # Load model xgb_model = pkl.load(open('xgb_model.pkl','rb')) # Read csv file inputcvs =...
StarcoderdataPython
1758431
<reponame>LipotesOps/octo-fibula # -*- coding: utf-8 -*- # flake8: noqa from __future__ import division, absolute_import from .base import TaskSpec from .AcquireMutex import AcquireMutex from .Cancel import Cancel from .CancelTask import CancelTask from .Celery import Celery from .Choose import Choose from .ExclusiveCh...
StarcoderdataPython
3345175
from .. import exceptions class SyncError(exceptions.Error): """Errors related to synchronization.""" class SyncConflict(SyncError): """ Two items changed since the last sync, they now have different contents and no conflict resolution method was given. :param ident: The ident of the item. ...
StarcoderdataPython
3383413
<filename>tests/s3_manager_test.py<gh_stars>0 import pytest from logger import logger from ..manager.s3_manager import download_from_s3, upload_to_s3_repo_sofr @pytest.mark.skip(reason="temp") def test_download_from_s3(): download_path = "/tmp/package.zip" s3_path = "s3://eternity02.deployment/lambda/data-coll...
StarcoderdataPython
1652146
''' Leetcode:120. Triangle Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4], [6,5,7], [4,1,8,3] ] The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11). N...
StarcoderdataPython
144313
<reponame>reuben/python-progressbar import time import timeit import pytest import logging import freezegun import progressbar LOG_LEVELS = { '0': logging.ERROR, '1': logging.WARNING, '2': logging.INFO, '3': logging.DEBUG, } def pytest_configure(config): logging.basicConfig( level=LOG_LE...
StarcoderdataPython
3290901
<gh_stars>0 from distutils.core import setup from setuptools import find_packages setup( name='agora-api', version='0.25.1', description='Agora API for Python', author='<NAME>', author_email='<EMAIL>', url='https://github.com/kinecosystem/agora-api', license='MIT', packages=find_packag...
StarcoderdataPython
1624785
<filename>work/test3.py import pycurl from StringIO import StringIO num = "asdfghjkl" msg = "cool beans" buffer = StringIO() c = pycurl.Curl() c.setopt(c.URL, 'http://textbelt.com/text') c.setopt(c.POSTFIELDS, 'number=%s&message=%s' %(num, msg)) c.setopt(c.WRITEDATA, buffer) c.perform() c.close() body = buffer.getval...
StarcoderdataPython
4825402
import re, subprocess from smsgateway.sources.sms import command_list from smsgateway.config import * from smsgateway.sources.utils import * service_commands = ['start', 'restart', 'stop', 'enable', 'disable', 'status'] service_regex = re.compile('^(?P<command>[a-zA-Z]+) (?P<service>.+)$') def run_cmd(args): ret...
StarcoderdataPython
1657984
<reponame>HoussemCharf/DiscordBot<gh_stars>1-10 from config import log_file from config import file_logging_level from config import stream_logging_level from config import logging_sdtout from config import logging_file from config import logging_format import logging def get_logger(name: str=__name__, flevel=file_lo...
StarcoderdataPython
1664363
# https://www.w3resource.com/python-exercises/math/python-math-exercise-57.php import math def sd_calc(data): n = len(data) if n <= 1: return 0.0 mean, sd = avg_calc(data), 0.0 # calc stan. dev, for el in data: sd += (float(el)-mean)**2 sd = math.sqrt(sd/float(n-1)) retur...
StarcoderdataPython
1692700
<reponame>atkirtland/pyffe import pyffe from pyffe import Model import caffe from caffe import layers as L def conv_bn(bottom, nout, ks=3, stride=1, pad=0, learn=True): if learn: param = [dict(lr_mult=1, decay_mult=1), dict(lr_mult=2, decay_mult=0)] else: param = [dict(lr_mult=0, decay_mult=0...
StarcoderdataPython
4831313
# -*- coding: utf-8 -*- """ Created on Sun Aug 3 10:13:16 2014 @author: zzhang """ import random import pickle class Roman2num: def __init__(self, fname): self.int2roman = {} self.roman2int = {} self.fname = fname self.outfname = fname + '.pk' def buil...
StarcoderdataPython
54464
<gh_stars>1-10 import csv employees = [ { "first_name": "Bill", "last_name": "Lumbergh", "job_title": "Vice President", "hire_date": 1985, "performance_review": "excellent" }, { "first_name": "Michael", "last_name": "Bolton", "job_title": "Programmer", "hire_date": 1995, "pe...
StarcoderdataPython
1753712
<filename>boardslice.py from constants import point_symbol, PointState class BoardSlice(object): def __init__(self, row_offset, column_offset, slice2d, row_labels, parent): self._slice2d = slice2d self._row_offset = row_offset self._column_offset = column_offset self._row_l...
StarcoderdataPython
1729039
_MODELS = {} def register_model(name=None): """Register a model. name defaults to class name snake-cased.""" print("[###] Register model: {}".format(name)) ''' def decorator(model_cls, registration_name=None): """Registers & returns model_cls with registration_name or default name.""" model_name = re...
StarcoderdataPython
3237562
<gh_stars>1-10 import unittest import json import responses from .util import create_task from cumulusci.tasks.salesforce.activate_flow import ActivateFlow from cumulusci.core.exceptions import TaskOptionsError class TestActivateFlow(unittest.TestCase): @responses.activate def test_activate_some_flow_processe...
StarcoderdataPython
107287
# Copyright 2018 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
StarcoderdataPython
160992
<gh_stars>1-10 from deepmath.deephol import prover_util import tensorflow as tf def _prove_one(self, tree, task): """Searches for a proof via BFS. Args: tree: Search tree with a single goal node to be proved. task: ProverTask to be performed. Returns: None on success and error message o...
StarcoderdataPython
3333341
<filename>onir_pt/__init__.py import sys import os import hashlib import math import io import tempfile import inspect import torch import json import tarfile import transformers from pathlib import Path from collections import namedtuple, Counter, OrderedDict from typing import Union, Dict, Tuple import pandas as pd i...
StarcoderdataPython
4830520
<filename>landlab/components/flow_director/tests/test_flow_director.py """Test the flow director components. @author: krb """ # Created on Thurs Nov 12, 2015 import os import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from landlab import CLOSED_BOUNDARY, HexMode...
StarcoderdataPython
1703588
<gh_stars>0 # https://fenicsproject.org/qa/8978/solid-mechanics-topology-optimization-local-minimum-error/?show=13005#c13005 from mshr import * from dolfin import * from dolfin_adjoint import * import pyipopt ## Geometry and elasticity t, h, L = 2., 1., 4. # Thickness, height and length Rect...
StarcoderdataPython
3295267
<filename>tests/test_simulator.py<gh_stars>1-10 from sensor_simulator import get_data_with_simulated from _setup import ex_vars def test_get_data_with_simulated(): # test all devices we have at head for device in ex_vars: for data in get_data_with_simulated(device.head()): assert isinstanc...
StarcoderdataPython
68235
<reponame>chriscyang/musicon import datetime import urllib2 from django.contrib import auth from django.core.context_processors import csrf from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse from django.http import HttpResponseRedirect from django.shortcuts import render from dj...
StarcoderdataPython
1684693
<gh_stars>10-100 import os import cv2 import toml import argparse import numpy as np import torch from torch.nn import functional as F import utils from utils import CONFIG import networks def single_inference(model, image_dict, TTA=False): with torch.no_grad(): image, trimap = image_dict['image'], i...
StarcoderdataPython
93727
<reponame>TCDPaintYourself/paint-yourself-api import io import typing import cv2 as cv import numpy as np from fastapi import Depends from paint_yourself_api.schemas import StyledImageThemeEnum from paint_yourself_api.services.vgg_style_transfer import ( StyleTransfer, get_style_transfer, ) class ImageStyle...
StarcoderdataPython
1737102
<gh_stars>1-10 import matplotlib.pyplot as plt import os import collections import time import random import cv2 import numpy as np import torch import torch.nn.functional as F from PIL import Image from blur_model import BlurModel from dewarp import get_dewarping_matrix from load_hdc import load_hdc def optimize_mode...
StarcoderdataPython
3316929
<filename>odoohub/views.py import jwt import datetime from django.http import JsonResponse, HttpResponse from django.contrib.auth import authenticate, logout from django.views.decorators.http import require_http_methods from django.views.decorators.csrf import csrf_exempt from django.conf import settings # Create your...
StarcoderdataPython
1682376
import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pandas as pd planets = pd.read_csv("planets.csv", sep=',') sns.set(style="ticks") # Initialize the figure with a logarithmic x axis f, ax = plt.subplots(figsize=(7, 6)) ax.set_xscale("log") # Load the example planets dataset # replace ...
StarcoderdataPython
1655144
import time import logging from rabbitmq.RabbitMq import RabbitMqConfig,ServerMq from monitor.stream import get_system_data logger = logging.getLogger(__name__) sysconfig = RabbitMqConfig(queue="entry",host="localhost",routing_key="entry") SystemServer = ServerMq(config=sysconfig) while True: try: data...
StarcoderdataPython
1681885
#!/usr/bin/env python #-*- coding:utf-8 -*- """Static file generator for Django.""" import logging import os import stat import tempfile import urlparse import shutil from django.utils.functional import Promise from django.http import HttpRequest, QueryDict from django.db.models.base import ModelBase from django.db....
StarcoderdataPython
3322848
<reponame>tuna2134/cb0t.py import requests from .error import * import re class cb0t: def create(self, url:str): """ This can create shorten url. """ r = requests.post("https://cb0t.cc/api/create", data = {"url": url}) if r.status_code == 400: raise Invalidurl("I...
StarcoderdataPython
11512
#Integer division #You have a shop selling buns for $2.40 each. A customer comes in with $15, and would like to buy as many buns as possible. #Complete the code to calculate how many buns the customer can afford. #Note: Your customer won't be happy if you try to sell them part of a bun. #Print only the result, any o...
StarcoderdataPython
4841629
from wagtail.contrib.modeladmin.options import ( ModelAdmin, modeladmin_register) from origins.models import Nomen class NomenAdmin(ModelAdmin): model = Nomen menu_label = 'Nomen' # ditch this to use verbose_name_plural from model menu_icon = 'pilcrow' # change as required menu_order = 200 # wi...
StarcoderdataPython
4815005
# Copyright (c) 2019 Toyota Research Institute import abc from taburu.table import ParameterTable, HashedParameterArray from taburu.event import ParametersAdded class Aggregate(abc.ABC): @classmethod @abc.abstractmethod def from_events(cls, events): pass class ParameterTables(Aggregate): @c...
StarcoderdataPython
3257374
<filename>raw_code/pulson440/align.py ''' COMMENT PROGRAM DESCRIPTION HERE ''' #SOMEONE WRITE DOCUMENTATION FOR ARGUMENTS #imports desired libs import pandas as pd import numpy as np import pickle import matplotlib.pyplot as plt #opens and loads pickle file with open('Mandrill_1way_Misaligned3_data.p...
StarcoderdataPython
3391119
<filename>mk42/apps/users/apps.py # -*- coding: utf-8 -*- # mk42 # mk42/apps/users/apps.py from __future__ import unicode_literals from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ __all__ = [ "Config", ] class Config(AppConfig): """ Users app config. """ ...
StarcoderdataPython
82501
<filename>task/__init__.py # # __init__.py # # """ Generic __init__.py to allow from Package.path import * to work correctly. """ from os.path import basename, dirname, splitext import glob allmods = [] leftpath = dirname(__file__) for filename in glob.glob("%s/*.py" % leftpath): if filename.find("_...
StarcoderdataPython
1655782
<reponame>jacques-saraydaryan/ros_map_manager<gh_stars>0 #!/usr/bin/env python __author__ = 'jsaraydaryan' import rospy from convert_2d_to_3d.srv import get3Dfrom2D from darknet_ros_msgs.msg import BoundingBox,BoundingBoxes from robocup_msgs.msg import Entity, Entity2D, EntityList from std_msgs.msg import String from ...
StarcoderdataPython
1764803
<filename>EM_Algorithm/EM_toss_coin.py import numpy as np import math import matplotlib.pyplot as plt ## E-M Coin Toss Example as given in the EM tutorial paper by <NAME>* ## def get_binomial_log_likelihood(obs,probs): """ Return the (log)likelihood of obs, given the probs""" # Binomial Distribution Log PDF ...
StarcoderdataPython
38109
# -*- coding: utf-8 -*- """Python lager brewed by a loguru""" import asyncio from functools import wraps from time import time from typing import Union from loguru import logger from lager.const import LOG_LEVELS __all__ = ['loglevel', 'flog', 'handlers', 'logger', 'log', 'LOG', 'ln', 'LN'] logger.t = logger.trac...
StarcoderdataPython
1656517
<reponame>YKato521/ironpython-stubs class ToolStripPanelRenderEventArgs(EventArgs): """ Provides data for System.Windows.Forms.ToolStripPanel drawing. ToolStripPanelRenderEventArgs(g: Graphics,toolStripPanel: ToolStripPanel) """ @staticmethod def __new__(self, g, toolStripPanel): ...
StarcoderdataPython
19218
<reponame>KloudTrader/libkloudtrader<filename>setup.py from distutils.core import setup setup( name='libkloudtrader', version='1.0.0', author='KloudTrader', author_email='<EMAIL>', packages=['libkloudtrader'], url='https://github.com/KloudTrader/kloudtrader', license='LICENSE', descript...
StarcoderdataPython
3254106
with open("input.txt") as x: lines = x.read().splitlines() mask = {} mem = {} for li in lines: if li.startswith("mask"): mask = {} msk = list(li.split(" = ")[1]) for i, mch in enumerate(msk): if mch == "X": continue else: mask[i]...
StarcoderdataPython
3216531
<reponame>chargio/using-koku-api-test # coding: utf-8 """ Cost Management The API for Project Koku and OpenShift cost management. You can find out more about Cost Management at [https://github.com/project-koku/](https://github.com/project-koku/). # noqa: E501 The version of the OpenAPI document: 1.0.0 ...
StarcoderdataPython
3391303
#!/usr/bin/env python3 import os import subprocess import sys try: import toml except ModuleNotFoundError: print('missing toml package; try "pip3 install --user toml"') sys.exit(1) SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) REPO_DIR = os.path.join(SCRIPT_DIR, os.pardir) def run_cmd(*cmd): ...
StarcoderdataPython
3236273
<filename>app/app/api/domain/services/factories/UserCommandRepositoryFactory.py from app.api.data.command.UserMongoCommandRepository import UserMongoCommandRepository class UserCommandRepositoryFactory: def create_user_command_repository(self): return UserMongoCommandRepository()
StarcoderdataPython
1702966
class Solution(object): def titleToNumber(self, columnTitle): """ :type columnTitle: str :rtype: int """ # Runtime: 24 ms # Memory: 13.5 MB num = 0 for idx, char in enumerate(columnTitle[::-1]): num += (ord(char) - 64) * 26 ** idx # Base 2...
StarcoderdataPython
73782
<reponame>JuanuMusic/PoHelper # General Declarations import sqlite3 import time class dbEngine(): def __init__(self, log): """ SQLite Database handler Usage: Use execute method for execute sql sentences on the database and get the results """ self.connection = sqlite...
StarcoderdataPython
26797
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
StarcoderdataPython
3259290
<reponame>EleutherAI/pile-CC-filtering import numpy as np x = list(map(float, open('scores.txt'))) def ct_accept(alpha): ct = 0 for score in x: # from https://arxiv.org/pdf/2005.14165.pdf P.43 if np.random.pareto(alpha) > 1 - score: ct += 1 return ct for alpha in [1,2,3,4,5,6,7...
StarcoderdataPython
78791
<gh_stars>10-100 import abc class AbstractClassifier(abc.ABC): def __init__(self): pass @abc.abstractmethod def train(self, text, labels): pass @abc.abstractmethod def predict(self, text): pass
StarcoderdataPython
1706390
# CanCyber Zeek Module Updater Python Script v2.1.01 2020 03 22 import os import requests import re import time url = "https://tool.cancyber.org/get/indicators" local = os.path.dirname(os.path.realpath(__file__)) def download(filename, name): print(filename) try: mtime = int(os.path.getmtime(local + '/' ...
StarcoderdataPython
3226139
from dataclasses import dataclass, field from typing import Optional from transformers import AutoModelForTokenClassification, AutoConfig from transformers import HfArgumentParser import transformers import torch import logging import os from collections import OrderedDict from tqdm import tqdm os.environ["WANDB_DISABL...
StarcoderdataPython
3303708
import selenium import glob from numpy import arange from random import sample from sys import exit from time import sleep from progress.spinner import Spinner from progress.bar import ChargingBar from threading import Thread from selenium import webdriver from selenium.webdriver.firefox.options import Option...
StarcoderdataPython
66340
<filename>scripts/UCSC Phys 133/meter.py import numpy as np import matplotlib.pyplot as plt import scope_utilities.vector_impedance_meter as vm save_directory = "C:/electronics/vector_impedance_meter/datasets/" vm.meter(save_directory=save_directory)
StarcoderdataPython
1647258
<filename>microcosm_caching/tests/test_build_info.py """ Unit tests for build_info """ from microcosm.api import create_object_graph, load_from_dict from hamcrest import assert_that, is_ class TestBuildInfo: def test_cached(self): graph = create_object_graph( "test", testing=Tru...
StarcoderdataPython
1764768
<reponame>noaa-ocs-modeling/seabed<filename>examples/descriptions_within_bounds.py<gh_stars>0 import numpy from seabed.ngdc import NGDCSeabedDescriptions if __name__ == '__main__': # define bounds bounds = numpy.array([[-77, 39], [-75, 40]]) # retrieve a list of the first 5 surveys first_5_surveys = ...
StarcoderdataPython
3300808
def matriz_quadrada(): while True: try: numero = int(input()) if 5 <= numero <= 101 and numero % 2 != 0: matri = construindo_matriz(numero) imprime_matriz(matri) except ValueError: break except EOFError: break ...
StarcoderdataPython
4830323
<gh_stars>0 from abc import ABC, abstractmethod # pylint: disable=W0105 """ Transport that is used to secure a connection. This transport is chosen by a security transport multistream module. Relevant go repo: https://github.com/libp2p/go-conn-security/blob/master/interface.go """ class ISecureTransport(ABC): @...
StarcoderdataPython
3240324
from flask import Flask, render_template, request, url_for import urllib import json app = Flask(__name__) app.config['DEBUG'] = True # Note: We don't need to call run() since our application is embedded within # the App Engine WSGI application server. @app.route('/') def hello(): """Return a friendly HTTP greet...
StarcoderdataPython
1729262
<filename>timelog/server/config.py class Config(object): SQLALCHEMY_TRACK_MODIFICATIONS = False class DevelopmentConfig(Config): DEBUG = True SQLALCHEMY_ECHO = True class ProductionConfig(Config): DEBUG = False app_config = { 'development': DevelopmentConfig, 'production': ProductionConfig }
StarcoderdataPython
165566
<gh_stars>1-10 # abc for a client. from abc import ABCMeta, abstractmethod class Client: __metaclass__ = ABCMeta @abstractmethod def __init__(self, instance_name, context, params): pass @abstractmethod def add_device(self, device_id, time, properties): """Add a device (if exists t...
StarcoderdataPython
20028
<reponame>GeRDI-Project/HarvesterControlCenter<gh_stars>0 """ This is the views module which encapsulates the backend logic which will be riggered via the corresponding path (url). """ import collections import json import logging from django.conf import settings from django.contrib import messages from django.contrib...
StarcoderdataPython
1724116
#!usr/bin/env python import or_gym import pyomo.environ as pe from pyomo.core.util import prod import numpy as np import networkx as nx import pandas as pd from scipy.stats import * import math def net_im_stoch_lp_model(env, window_size=np.Inf, perfect_information = False, use_expectation=False): base_values = {...
StarcoderdataPython
1718899
<reponame>jonl112/Software import software.python_bindings as tbots from proto.import_all_protos import * from software.simulated_tests.validation import ( Validation, create_validation_geometry, create_validation_types, ) class ExcessivelyDribbling(Validation): """Checks if any friendly robot is ex...
StarcoderdataPython
3200177
import random import math class NeuralNetwork: learning_rate = 0.5 def __init__(self,input_num,hidden_num,output_num,input_hidden_weights=None, input_hidden_bias=None,hidden_output_weights=None,hidden_output_bias=None): self.input_num = input_num # 构建掩藏层 ...
StarcoderdataPython
3312645
<filename>tests/test_train.py import tempfile import os from typing import Text import pytest from _pytest.capture import CaptureFixture from _pytest.monkeypatch import MonkeyPatch import rasa.model from rasa.train import train_core, train_nlu, train from tests.core.test_model import _fingerprint @pytest.mark.para...
StarcoderdataPython
102139
#!/usr/bin/env python import rospy import sys import unittest from std_msgs.msg import Empty, String PKG = 'scalable_individual_tests' NAME = 'test_vfk_msb_client' class TestVFKMSBClient(unittest.TestCase): @classmethod def setUpClass(cls): rospy.init_node('vfk_msb_testing_node') cls.start ...
StarcoderdataPython
1652788
from unittest import TestCase import numpy as np import seistools.integration class test_rk_ls(TestCase): def setUp(self): self.rkls1 = seistools.integration.rk_ls(1) self.rkls2 = seistools.integration.rk_ls(2) self.rkls3 = seistools.integration.rk_ls(3) self.rkls4 = seistools.int...
StarcoderdataPython
3272842
<filename>ornithology/meta.py # Copyright 2019 HTCondor Team, Computer Sciences Department, # University of Wisconsin-Madison, WI. # # 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:...
StarcoderdataPython
184708
import sys import os if len(sys.argv) < 3: print("Arguments: <source dir> <dest file>") sys.exit(1) # Open file for writing source = sys.argv[1] with open(sys.argv[2], "w") as dest: # File header dest.write("// Copyright 2016 <NAME>\n") dest.write("// https://github.com/cadouthat/webgl-chess\n\n") # Enumerate f...
StarcoderdataPython
3362041
<reponame>dpoehls/textual from typing import TYPE_CHECKING from contextvars import ContextVar if TYPE_CHECKING: from .app import App active_app: ContextVar["App"] = ContextVar("active_app")
StarcoderdataPython
3383833
<gh_stars>0 # ''' Project Euler - Problem 1 - Multiples of 3 and 5 https://projecteuler.net/problem=1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. ''' import sys def main(): ...
StarcoderdataPython
136935
import math import cloudpickle import torch import numpy as np from collections import OrderedDict def save_checkpoint(state, filename='checkpoint.pkl'): data = cloudpickle.dumps(state) with open(filename, 'wb') as fi: fi.write(data) def load_checkpoint(filename='checkpoint.pkl'): with open(fil...
StarcoderdataPython
3213720
import setuptools setuptools.setup(name='pybern', version='1.0-r1', description='Python Modules to Assist Bernese-based GNSS processing', url='', author='<NAME>, <NAME>', author_email='<EMAIL>, <EMAIL>', packages=setuptools.find_packages(),#['pystrain', 'pystrain.geodesy', 'pystrain.iotools'], ...
StarcoderdataPython
3390678
# from .app import create_app # app = create_app() # from . import routes __version__ = '0.1.0'
StarcoderdataPython
91027
<gh_stars>0 """A ScanManifest defines the output of a complete scan.""" from dataclasses import dataclass from typing import Any, Dict, List @dataclass(frozen=True) class ScanManifest: """A ScanManifest defines the output of a complete scan. It contains pointers to the per-account scan result artifacts and s...
StarcoderdataPython
6334
<reponame>UMCollab/ODM #!/usr/bin/env python3 # This file is part of ODM and distributed under the terms of the # MIT license. See COPYING. import json import sys import odm.cli def main(): cli = odm.cli.CLI(['action']) client = cli.client if cli.args.action == 'list-users': print(json.dumps(c...
StarcoderdataPython
3273811
import os,sys,re import numpy as np import subprocess from multiprocessing import Process,Pool import pickle from Bio.Blast import NCBIXML from Bio import pairwise2 from Bio.SubsMat import MatrixInfo as matlist from Bio.SeqIO.FastaIO import SimpleFastaParser import math from math import log, exp from getNatureA import ...
StarcoderdataPython
1654420
<reponame>sebras/berkeman-ExpertmakerAccelerator ############################################################################ # # # Copyright (c) 2017 eBay Inc. # # ...
StarcoderdataPython
102441
<reponame>jkrueger1/nicos<gh_stars>0 description = 'STRESS-SPEC setup with Eulerian cradle' group = 'basic' includes = [ 'standard', 'sampletable', ] sysconfig = dict( datasinks = ['caresssink'], ) devices = dict( chis = device('nicos.devices.generic.Axis', description = 'Simulated CHIS axis...
StarcoderdataPython
117932
<gh_stars>10-100 import requests import json requests.packages.urllib3.disable_warnings() gm_user = "admin" gm_pwd = "<PASSWORD>" url = "https://192.168.0.200/wapi/v2.7/" s = requests.Session() s.auth = (gm_user, gm_pwd) mri_url = "192.168.0.201" mri_user = "admin" mri_pwd = "<PASSWORD>" def get_networks_to_add(): ...
StarcoderdataPython
1614965
""" Welcome to the `mx_utils` package's documentation! Author: <NAME> `mx_utils` contains a series of methods that have been helpful to me in my work as a developer/data analyst at my current job. I decided to take the various code snippets I have floating around in various different projects and bring together thos...
StarcoderdataPython
1721989
class Animal: fur_color = "Orange" def speak(self): print("Raawwwwrr") def eat(self): pass def chase(self): pass class Tiger(Animal): def speak(self): print("They're GREEEEAATTTTTT") class HouseCat(Animal): fur_color = "Black" def speak(self): p...
StarcoderdataPython