id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1746851
<reponame>kstaken/salt try: from mock import MagicMock, patch has_mock = True except ImportError: has_mock = False patch = lambda x: lambda y: None from saltunittest import TestCase, skipIf from salt.modules import pip pip.__salt__ = {"cmd.which_bin":lambda _:"pip"} @skipIf(has_mock is False, "mock p...
StarcoderdataPython
3247766
<gh_stars>0 from fabric.context_managers import hide import re from calyptos.plugins.debugger.debuggerplugin import DebuggerPlugin class CheckComputeRequirements(DebuggerPlugin): def debug(self): # Supported CentOS/RHEL OS version for each component self.os_version = 6 # Default clock skew ...
StarcoderdataPython
89023
<filename>constants.py<gh_stars>1-10 for name in 'channel pitch time duration velocity'.split(): globals()[name.upper()] = name
StarcoderdataPython
42606
<filename>app/moisturechecker/app.py import paho.mqtt.client as mqtt from gpiozero import Button as Sensor import os def on_event(client, topics, message): def func(): for topic in topics: client.publish(topic, message) return func if __name__ == '__main__': mqtt_url = os.environ['g...
StarcoderdataPython
3367688
"""Constants for the Harmony component.""" DOMAIN = "harmony" SERVICE_SYNC = "sync" SERVICE_CHANGE_CHANNEL = "change_channel" PLATFORMS = ["remote", "switch"] UNIQUE_ID = "unique_id" ACTIVITY_POWER_OFF = "PowerOff" HARMONY_OPTIONS_UPDATE = "harmony_options_update" ATTR_DEVICES_LIST = "devices_list" ATTR_LAST_ACTIVITY =...
StarcoderdataPython
25923
<filename>src/cuda_ai/mean.py # -*- coding: utf-8 -*- """ Created on Sun May 21 15:35:38 2017 @author: Liron """ import numpy as np np.set_printoptions(threshold=np.nan) data = np.genfromtxt("cuda_times.csv", delimiter=",", usecols=(0,1), max_rows=97, skip_header=96+96+96) print data[0] print data[data.shape[0]-1] ...
StarcoderdataPython
3313809
# -*- coding:utf8 -*- # File : progress.py # Author : <NAME> # Email : <EMAIL> # Date : 2/26/17 # # This file is part of TensorArtist. from tartist.core.utils.thirdparty import get_tqdm_defaults import tqdm import numpy as np def enable_epoch_progress(trainer): pbar = None def epoch_progress_on_iter_a...
StarcoderdataPython
159374
<gh_stars>0 """! @file # Class Documenter @package src """ ## build a profile of each function and include in the documentation INCLUDE_FUNCTION_PROFILE = True ## pull inline comments up to function docstring INCLUDE_INLINE_COMMENTS = False import sys, os from util.log import setup_logging logger = setup_loggin...
StarcoderdataPython
113283
import os from flask import Flask, jsonify, send_file from flask_cors import CORS from flask_jwt_extended import JWTManager from api.login import blueprint as login_blueprint from api.odoo import blueprint as odoo_blueprint app = Flask(__name__) ALLOW_ALL_ORIGINS = os.getenv("ALLOW_ALL_ORIGINS") if ALLOW_ALL_ORIGINS...
StarcoderdataPython
3276961
<gh_stars>1-10 if __name__ == '__main__': from compute_realizability import * else: from contracts.compute_realizability import * if len(sys.argv) > 2: i = int(sys.argv[1]) j = int(sys.argv[2]) synthesize_by_ij(i,j) elif len(sys.argv) > 1 and sys.argv[1] == 'all': check_all() else: print('C...
StarcoderdataPython
3316910
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2012 <NAME> <<EMAIL>> """extracts the openrave version from the root CMakeLists.txt file and returns it """ import sys if __name__=='__main__': data = open(sys.argv[1],'r').read() indices = [data.find('OPENRAVE_VERSION_MAJOR'), data.find('OPENRAVE_V...
StarcoderdataPython
1720860
from traitlets import Bool, validate from .Material_autogen import Material as MaterialAutogen class Material(MaterialAutogen): # Do not sync this automatically: needsUpdate = Bool(False) @validate('needsUpdate') def onNeedsUpdate(self, proposal): if proposal.value: content = { ...
StarcoderdataPython
3303240
from django.test import override_settings from django.urls import reverse class TestSettings: @override_settings(COMPRESS_ENABLED=True) def test_compression(self, django_app, volunteer): response = django_app.get(reverse("core:index"), user=volunteer) assert response.status_code == 200
StarcoderdataPython
1614232
import logging from aiohttp import web from eth_typing import BLSSignature from eth_utils import decode_hex, encode_hex, humanize_hash from lahja.base import EndpointAPI from ssz.tools.dump import to_formatted_dict from ssz.tools.parse import from_formatted_dict from eth2.beacon.chains.base import BaseBeaconChain fro...
StarcoderdataPython
185896
<filename>models/models.py from __future__ import print_function def create_model(opt): if opt.model == 'sr_resnet': from .sr_resnet_model import SRResNetModel model = SRResNetModel() elif opt.model == 'sr_resnet_test': from .sr_resnet_test_model import SRResNetTestModel model =...
StarcoderdataPython
3220855
<filename>Beginnings.py ''' * * * Sheet music generator using ABC notation * * * ''' # The bread and butter of proc-gen import random as r # Some basic values related to ABC: # Song number X='1' # First song, increase this to make an opus # Title T="Beginnings" # Song title # Key keys=['C','C# ','D','D# ','E','F','F# ...
StarcoderdataPython
3315792
<filename>lanedetect.py import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 import os from lanedetect_helpers import process_image from moviepy.editor import VideoFileClip from IPython.display import HTML def lane_detect_images(): test_data_dir = "test_images/" # Rea...
StarcoderdataPython
3258953
from datetime import date import factory from factory import fuzzy from dataactcore.models import domainModels class SF133Factory(factory.Factory): class Meta: model = domainModels.SF133 sf133_id = None agency_identifier = fuzzy.FuzzyText() allocation_transfer_agency = fuzzy.FuzzyText() ...
StarcoderdataPython
1722212
''' LANGUAGE: Python AUTHOR: <NAME> GITHUB: https://github.com/Chandra-Sekhar-Bala ''' print('Hello, World!')
StarcoderdataPython
80907
import math opposite = int(input("Enter the opposite side: ")) adjacent = int(input("Enter the opposite side: ")) hypotenuse = math.sqrt(math.pow(opposite, 2) + math.pow(adjacent, 2)) print(f'hypotenuse = {hypotenuse}')
StarcoderdataPython
1739491
<filename>mixpyBuild/FileDialog.py from tkinter import * import tkinter.filedialog def getOneFile(): fn = tkinter.filedialog.askopenfilename() return fn def getManyFiles(): files = tkinter.filedialog.askopenfilenames() if files: ofiles = [] for filename in files: ofiles.append(filename) return ofiles def...
StarcoderdataPython
1743395
<reponame>crowdbotics-apps/nccaa-rfp-33947<filename>backend/inquiry/apps.py<gh_stars>0 from django.apps import AppConfig class InquiryConfig(AppConfig): name = 'inquiry'
StarcoderdataPython
3573
<reponame>startupgrind/mezzanine __version__ = "4.3.1.post1"
StarcoderdataPython
3379911
""" This module provides functions for time evolution of a state given as MPS, MPO or PMPS via the tMPS algorithm. This is based on functions which calculate the time evolution of an operator in MPS, MPO or PMPS form from Hamiltonians acting on every single and every two adjacent sites. tMPS is a method to evolve a o...
StarcoderdataPython
1704421
<reponame>line/networking-sr # 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 t...
StarcoderdataPython
3255589
<reponame>santoshmano/pybricks<gh_stars>0 def print_board(board): print("N-queens Board") [print(_) for _ in board] def create_board(size): return [[0 for _ in range(size)] for _ in range(size)] def is_safe(board, row, col): for r in range(len(board)): if board[r][col] == 1: return...
StarcoderdataPython
170228
#!/usr/bin/env python3 import os import sys import json from pathlib import Path from shutil import copyfile appName = "Warspite Map Exporter" appVer = "1.0.1.0" appDesc = """Corrects paths and moves maps and their dependencies.""" sImgFormats = [ ".png", ".jpg", ".webp", ".tiff" ] def DoesParameter...
StarcoderdataPython
3205735
# -*- coding: utf-8 -*- from AccessControl.unauthorized import Unauthorized from plone import api from plone.app.testing import setRoles from plone.app.testing import SITE_OWNER_NAME from plone.app.testing import SITE_OWNER_PASSWORD from plone.app.testing import TEST_USER_ID from plone.dexterity.interfaces import IDext...
StarcoderdataPython
43895
# -*- coding: utf-8 -*- # Import libraries from api from visual_api import * class MplCanvas(FigureCanvas): """Base MPL widget for plotting Parameters ---------- FigureCanvas : FigureCanvasQTAgg Canvas for plotting Returns ------- None """ def __init__(self, parent=N...
StarcoderdataPython
1638569
<filename>api/__init__.py import geojson, datetime, pytz, json, os, importlib, datetime, math from housepy import server, config, log, util, strings from mongo import ASCENDING, DESCENDING, ObjectId """ Basically, it's like this: /api/<view>/<output>?<query> The view is what kind of thing you want back (eg, a...
StarcoderdataPython
1705106
<gh_stars>10-100 # -*- coding: utf-8 -*- """ Created on Mon Sep 24 09:08:21 2018 @author: Xian_Work """ import scipy from scipy.optimize import fmin, brute from model_plotting import norm , compute_dist,gen_evolve_share_series, mk_mix_agent #Import parameters and other UI modules param_path="../Parameters/params_ui....
StarcoderdataPython
68183
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 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 requir...
StarcoderdataPython
3269959
<filename>Easy/ValidQuadrilateral.py """ Problem Statement John loves gardening. He believes that for good growth of the plant, the land should be quadrilateral. Given angles of 4 sides of the land. Find whether the land is a valid quadrilateral or not. A quadrilateral is valid if the sum of all four angles is equal to...
StarcoderdataPython
3286518
import numpy as np class Genome: def __init__(self, x_dim, y_dim, random_weights=True): self.genome_type = "survived" self.x_dim = x_dim self.y_dim = y_dim self.h_dim = 1 self.score = 0 self.fitness = 0 # fixed bias for simplicity # for optimal search...
StarcoderdataPython
3344911
<reponame>YungTimAllen/RSVP-TE-Lab-Builder #!/usr/bin/env python3 """Script for rendering config for topologies defined by a YAML file""" from argparse import ArgumentParser, Namespace import yaml from jinja2 import Template def main(args: Namespace): """First method called when ran as a script""" with open(a...
StarcoderdataPython
3237346
<reponame>mathisloge/mapnik-vector-tile { "includes": [ "common.gypi" ], 'variables': { 'MAPNIK_PLUGINDIR%': '', 'enable_sse%':'true', 'common_defines' : [ 'MAPNIK_VECTOR_TILE_LIBRARY=1' ] }, "targets": [ { 'target_name': 'make_vector_tile', 'type': 'none', ...
StarcoderdataPython
3326385
<filename>dakotathon/plugins/__init__.py """Components that can be called by Dakota."""
StarcoderdataPython
3325110
from abc import ABC, abstractmethod from typing import Dict, Union class Variable(ABC): """ Abstract variable class Args: type (str): The variable type name (str): The variable name value: (int, float): The variable value Attributes: type (str): The variable type ...
StarcoderdataPython
3249690
<gh_stars>0 from numpy import * from numpy.random import * from LabFuncs import * from Params import * from HaloFuncs import * from WIMPFuncs import * import pandas # Halo params HaloModel = SHMpp v0 = HaloModel.RotationSpeed v_esc = HaloModel.EscapeSpeed beta = HaloModel.SausageBeta sig_beta = HaloModel.SausageDisper...
StarcoderdataPython
3311907
<reponame>kcarnold/sentiment-slant-gi18 import kenlm import heapq import pickle import os import sys import numpy as np import nltk import cytoolz import joblib import random from scipy.misc import logsumexp import itertools from functools import partial from .paths import paths from .tokenization import tokenize_mid_...
StarcoderdataPython
1712047
"""RKI Covid numbers integration.""" import asyncio from datetime import timedelta import logging import aiohttp import async_timeout from homeassistant import config_entries, core from homeassistant.helpers import update_coordinator from homeassistant.helpers.aiohttp_client import async_get_clientsession from rki_cov...
StarcoderdataPython
1648025
import logging import os.path from flask import request from flask_restplus import Resource, fields from common import api, main log = logging.getLogger(__name__) # This collects the API operations into named groups under a root URL. example_ns = api.namespace('example', description="Example operations") Example...
StarcoderdataPython
1640837
<reponame>franpoz/tirma class StarInfo: def __init__(self, object_id=None, ld_coefficients=None, teff=None, lum=None, logg=None, radius=None, radius_min=None, radius_max=None, mass=None, mass_min=None, mass_max=None, ra=None, dec=None): self.object_id = object_id self.ld_coefficient...
StarcoderdataPython
159225
<filename>operations/subtraction.py from operations.operation import Operation class Subtraction(Operation): """ Representing an operation to perform Subtraction """ TAG = 'subtraction' __slots__ = ('minuend', 'subtrahend') def __init__(self): self.minuend = None self.subtrahe...
StarcoderdataPython
3291835
<gh_stars>1-10 #!/usr/bin/env python from math import * # https://www.allaboutcircuits.com/textbook/alternating-current/chpt-3/ac-inductor-circuits/ # a pure inductor circuit (AC current with inductor) will have V(t) 90 phase ahead of I(t) and the power can be negative # implying we can absorb power from the circuit ...
StarcoderdataPython
3369501
<reponame>strawpants/cate # The MIT License (MIT) # Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors # # 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...
StarcoderdataPython
4824819
<reponame>scottwedge/OpenStack-Stein # Copyright (c) 2013 Bull. # # 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 applic...
StarcoderdataPython
1695143
<reponame>tusharsarkar3/XBNet import torch import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from XBNet.training_utils import training,predict from XBNet.models import XBNETClassifier from XBNet.run import run_XBNET from os import...
StarcoderdataPython
3399523
<reponame>tiaanswart/NZBankRegisterJSON # import the modules import csv import json # reader dict collection bankAndBranchDict = [] # https://www.paymentsnz.co.nz/resources/industry-registers/bank-branch-register/ # read bank branch registry with open("Bank_Branch_Register.csv", 'r') as csvfile: reader = csv.Dict...
StarcoderdataPython
1641576
<reponame>mhtb32/tl-env import pytest from tl_env.logic.automaton import Automaton, TransitionError def test_add_state(): a = Automaton() a.add_state(1) # add int node a.add_state('q1') # add str node assert a.states <= {1, 'q1'} a.clear() a.add_state(1, type_='init') a.add_state(2, t...
StarcoderdataPython
1702097
<gh_stars>1-10 import sys sys.path.append('../implementations/') from implementations.dimensions import dimensions for dimension in dimensions: print(dimension)
StarcoderdataPython
189367
<reponame>pusinuke/Python_projects #Coursera capstone project #week3 #2020 02 17 from bs4 import BeautifulSoup import requests source = requests.get('https://en.wikipedia.org/wiki/List_of_postal_codes_of_Canada:_M').text soup = BeautifulSoup(source, 'lxml') for table in soup.find_all('table'): # line = table.tr.t...
StarcoderdataPython
60378
import pandas as pd from os import listdir from datetime import datetime as dtt import logging import json logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class WalletManager: def __init__(self, client, states): self.binance = client self.states = states self._wallet_h...
StarcoderdataPython
131314
<reponame>paul-nameless/beanie from typing import Type, TYPE_CHECKING, Optional, Union, Mapping from pymongo.client_session import ClientSession from beanie.odm.interfaces.session import SessionMethods from beanie.odm.interfaces.update import ( UpdateMethods, ) from beanie.odm.operators.update import BaseUpdateOp...
StarcoderdataPython
3256168
<reponame>dimkarakostas/advent-of-code from collections import defaultdict from math import ceil product_requirements, reaction_amounts = {}, {} for l in open('input14').readlines(): reaction = [r.split(',') for r in l.strip().split('=>')] inputs, output = reaction[0], reaction[1][0] inputs = [i.strip().sp...
StarcoderdataPython
1669418
from unittest import TestCase from unittest.mock import MagicMock, patch from piccolo.apps.meta.commands.version import version class TestVersion(TestCase): @patch("piccolo.apps.meta.commands.version.print") def test_version(self, print_: MagicMock): version() print_.assert_called_once()
StarcoderdataPython
4807190
<filename>dnachisel/builtin_specifications/EnforceSequence.py<gh_stars>100-1000 """Implement EnforceSequence (DO NOT USE YET: Work in progress, stabilizing)""" # TODO: factorize with self.sequence ? import numpy as np from ..Specification import Specification, SpecEvaluation from ..Location import Location from ..bi...
StarcoderdataPython
4829383
from mango.relations import base from mango.relations.constants import CASCADE __all__ = [ "OneToOneRel", "OneToManyRel", "ManyToOneRel", "ManyToManyRel", ] class OneToOneRel(base.Relation): def __init__( self, cls=None, name=None, rev_name=None, ...
StarcoderdataPython
135727
<filename>catalog/migrations/0005_auto_20220324_0011.py<gh_stars>1-10 # Generated by Django 3.2.12 on 2022-03-23 21:11 import catalog.validators from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ...
StarcoderdataPython
3241383
import util from os import system from random import randint import tempfile def config_version(stack, version): config = "tconfig" + str(randint(1000, 5000)) fp = tempfile.NamedTemporaryFile(delete=False) version_as_bytes = str.encode(version) fp.write(b'%s' % version_as_bytes) fp.close() pr...
StarcoderdataPython
174227
import cv2 as cv img = cv.imread('data/pic1.jpg') cv.imshow('pic1', img) # RGB rgb = cv.cvtColor(img, cv.COLOR_BGR2RGB) cv.imshow('rgb', rgb) # HSV hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV) cv.imshow('hsv', hsv) # LAB lab = cv.cvtColor(img, cv.COLOR_BGR2LAB) cv.imshow('lab', lab) # grayscale gray = cv.cvtColor(img...
StarcoderdataPython
3307813
import uuid from django.test import TestCase from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from orders.domain.exceptions.invalid_uuid import InvalidUUID from orders.domain.exceptions.order_does_not_exist import OrderDoesNotExist from orders.infrastructure....
StarcoderdataPython
3224751
class Main: def __init__(self): self.li = [] for i in range(0, 4): self.li.append(int(input())) def difference(self): return self.li[0] * self.li[1] - self.li[2] * self.li[3] def output(self): print("DIFERENCA = {dif}".format(dif=self.difference())) if __name__...
StarcoderdataPython
1779173
global_catalyst_coprocessor = None def initialize(coprocessing_script): global global_catalyst_coprocessor import paraview paraview.options.batch = True paraview.options.symmetric = True from paraview.vtk.vtkPVClientServerCoreCore import vtkProcessModule def coprocess(dataset, timestep, time): ...
StarcoderdataPython
1670008
<reponame>daserzw/oidc-swamid-federation #!/usr/bin/env python3 import json import os import sys from urllib.parse import quote_plus for _dir in ['entities']: if not os.path.isdir(_dir): os.makedirs(_dir) mdss_sign_key = open('public/mdss.json').read() for entity in sys.argv[1:]: einfo = json.loads(o...
StarcoderdataPython
1728039
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-31 21:50 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('crowdsourcing', '0003_taskworker_attempt'), ] operations = [ migrations.Alt...
StarcoderdataPython
1679605
from typing import Union, BinaryIO, TYPE_CHECKING import numpy as np if TYPE_CHECKING: from ...types import T class VideoDataMixin: """Provide helper functions for :class:`Document` to support video data. """ def load_uri_to_video_blob(self: 'T', only_keyframes: bool = False) -> 'T': """Convert...
StarcoderdataPython
151420
<filename>mvn/test/__init__.py import os import sys import subprocess #import nose def main(argv = None): if argv is None: argv = [] [testPath,filename] = os.path.split(__file__) [mvnPath,_] = os.path.split(testPath) resultPath = os.path.join(testPath,'results.txt') targets = ...
StarcoderdataPython
4832493
from abc import ABC class AbstractType(ABC): def __init__(self, module_name: str, class_name: str): self._module_name = module_name self._class_name = class_name @property def module_name(self): return self._module_name @property def class_name(self): return self....
StarcoderdataPython
1661756
from .verbs import * # preceed w/ underscore so it isn't exported by default # we just want to register the singledispatch funcs from .dply import vector as _vector from .dply import string as _string
StarcoderdataPython
3236638
<filename>7KYU/reverse.py def reverse(n: int) -> int: """ This function takes in input 'n' and returns 'n' with all digits reversed. Assume positive 'n'. """ reversed_n = [] while n != 0: i = n % 10 reversed_n.append(i) n = (n - i) // 10 return int(''.join(map(str, reversed_n)))
StarcoderdataPython
3301852
<reponame>cdeepakroy/SMQTK import abc import collections import os from smqtk.representation import SmqtkRepresentation from smqtk.utils import plugin class DataSet (collections.Set, SmqtkRepresentation, plugin.Pluggable): """ Abstract interface for data sets, that contain an arbitrary number of ``DataEl...
StarcoderdataPython
3366649
<reponame>HanseMerkur/nitro-python # # Copyright (c) 2008-2015 Citrix Systems, 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
4801369
# -*- coding: utf-8 -*- """Find a Buyer - Confirm Identity - with letter page""" import logging from requests import Response, Session from directory_tests_shared import PageType, Service, URLs from tests.functional.utils.context_utils import Actor from tests.functional.utils.request import Method, check_response, ma...
StarcoderdataPython
1719251
<filename>dnstable_manager/util.py # Copyright (c) 2015 by Farsight Security, 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...
StarcoderdataPython
1734842
<gh_stars>1-10 import os import pyapr from skimage import io as skio def main(): """ This demo shows how to convert an image to an APR using a fixed set of parameters. """ # Read in an image io_int = pyapr.filegui.InteractiveIO() fpath = io_int.get_tiff_file_name() # get image file path from...
StarcoderdataPython
1675295
from flask import render_template,request,redirect,url_for,abort from . import main from ..models import User,Pitch,Comment from .forms import UpdateProfile,PitchForm,CommentForm from .. import db,photos from flask_login import login_required,current_user from datetime import datetime @main.route('/') def index(): ...
StarcoderdataPython
1658215
<reponame>k4rth33k/gdrivefs import re import json import os from fsspec.spec import AbstractFileSystem, AbstractBufferedFile from googleapiclient.discovery import build from googleapiclient.errors import HttpError from google.auth.credentials import AnonymousCredentials import pydata_google_auth scope_dict = {'full_...
StarcoderdataPython
3238312
from .board import * def penalty_action(board: Board) -> Action: goal_vector = Vector.from_point( board.ball.position - board.opponent_goal_position ) ball_vector = Vector.from_point( board.ball.position - board.controlled_player.position ) if board.ball.position.x > 0: ret...
StarcoderdataPython
1312
<gh_stars>10-100 #!/usr/local/bin/python # -*- coding: utf-8 -*- """ - LICENCE The MIT License (MIT) Copyright (c) 2016 <NAME> Ericsson AB (EU FP7 CityPulse Project) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to d...
StarcoderdataPython
1728940
""" Module to featurize CIFs using JarvisCFID Author: <NAME> Email: <EMAIL> """ import os import pandas as pd import numpy as np import pymatgen as pmg import timeout_decorator import pathlib import joblib from matminer.featurizers.structure import JarvisCFID class use_cfid(): """ Class to generate Jarvis...
StarcoderdataPython
1623837
<filename>dnplab/widgets/manual_align.py import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button, RadioButtons def manual_align(data, dim): """Manually align spectra""" coord = data.coords[dim] max_index = int(data.size / (coord.size**2.0)) fig, ax = plt.sub...
StarcoderdataPython
3241269
<filename>Timbuchalka/Section-1/Experementing/English holiday homework.py<gh_stars>1-10 english_homework = [ "\t\t\t\t\t\t\t\t\t\t\t" , "Write A letter to an editor" , "Write a diary entry" ,"The School of the future had no books and no teacher. Write an crticle based on the lesson - The fun they had." , "Write a lette...
StarcoderdataPython
3207861
<reponame>rokj/django_basketball<filename>basketball/templatetags/replace.py # -*- coding: utf-8 -*- from django import template from datetime import datetime from django.conf import settings from common.functions import replace register = template.Library() register.filter("replace", replace)
StarcoderdataPython
104488
<filename>oozappa/_structure/_environment/fabfile/__init__.py # -*- coding:utf8 -*- from fabric.api import task, local, run, sudo, env from oozappa.config import get_config, procure_common_functions _settings = get_config() procure_common_functions() # your own task below
StarcoderdataPython
3275178
<reponame>jdmoorman/clapsolver<filename>setup.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" import platform import sys import setuptools from setuptools import Extension, find_packages, setup from setuptools.command.build_ext import build_ext with open("README.md") as readme...
StarcoderdataPython
1685833
<filename>software/jetson/ArduCAM/MIPI_Camera/RPI/python/imx230_postProcess/postProcess.py import sys import cv2 as cv import numpy as np import os import arducam_mipicamera as arducam def align_down(size, align): return (size & ~((align)-1)) def align_up(size, align): return align_down(size + align - 1, align...
StarcoderdataPython
1768800
# Databricks notebook source # DBTITLE 1,Define path variables import glow spark = glow.register(spark) vcf_path = '/databricks-datasets/genomics/variant-splitting/01_IN_altered_multiallelic.vcf' # COMMAND ---------- # DBTITLE 1,Load a VCF into a DataFrame original_variants_df = (spark.read .format("vcf") .option...
StarcoderdataPython
3395539
<gh_stars>0 """ Renders form for creating new users, and writes new users to database get(): Renders new user signup form post(): If user input is valid, creates new user """ import handler as handler import models.user as db_user # facilitates creation and query for users import helpers.form_data as valid...
StarcoderdataPython
151605
import napalm driver = napalm.get_network_driver("ios") conn_details = { "hostname" : 'sandbox-iosxe-recomm-1.cisco.com', "username" : 'developer', "password" : '<PASSWORD>', "optional_args": { "port": 22 } } device = driver(**conn_details) device.open() to_ping = [ "10.0.0.1" ] for ...
StarcoderdataPython
174876
<filename>soft_delete_model_mixin/managers.py<gh_stars>0 from django.db import models from .querysets import SoftDeleteQuerySet class SoftDeleteModelManager(models.Manager): def get_queryset(self): return SoftDeleteQuerySet(self.model, using=self._db).not_deleted_items()
StarcoderdataPython
34806
from bgfactory.components.constants import HALIGN_LEFT, HALIGN_CENTER, HALIGN_RIGHT import pangocffi as pango PANGO_SCALE = 1024 def convert_to_pango_align(halign): if halign == HALIGN_LEFT: return pango.Alignment.LEFT elif halign == HALIGN_CENTER: return pango.Alignment.CENTER elif hali...
StarcoderdataPython
3357540
# coding: utf-8 import datetime from pytest import approx import scipy as sp from scipy.stats import multivariate_normal from ..linear import RandomWalk def test_rwodel(): """ RandomWalk Transition Model test """ # State related variables state_vec = sp.array([[3.0]]) old_timestamp = datetime.datet...
StarcoderdataPython
1727830
import scipy as sp import scipy.linalg as la import matplotlib.pyplot as plt def Problem1(): x = sp.linspace(-5, 5, 10) plt.plot(x, x*3, 'kD') plt.show() def Problem2(x): x = sp.arange(x) return sp.array([x*i for i in xrange(x)]) def Problem3(x): numbers = sp.arange(x) return sp.outer...
StarcoderdataPython
1736086
<filename>aisutils/daemon.py<gh_stars>10-100 #!/usr/bin/env python __author__ = '<NAME>' __version__ = '$Revision: 11839 $'.split()[1] __revision__ = __version__ __date__ = '$Date: 2009-05-05 17:34:17 -0400 (Tue, 05 May 2009) $'.split()[1] __copyright__ = '2007, 2008' __license__ = 'Apache 2.0' __doc__ = '...
StarcoderdataPython
1745445
import os from glob import glob from setuptools import setup package_name = 'pybullet_ros' submodules = [os.path.join(package_name, sub) for sub in ['plugins', 'sdf']] data_files = [ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['p...
StarcoderdataPython
1769341
<filename>users/urls.py from django.urls import path from .api import CheckVerificationCodeView, EmailView urlpatterns = [ path("user/email/", EmailView.as_view(), name="send-verification-code"), path( "user/email/check/", CheckVerificationCodeView.as_view(), name="check-verification-c...
StarcoderdataPython
3273577
<filename>exasol_advanced_analytics_framework/deployment/scripts_deployer.py import pyexasol import logging from jinja2 import Environment, PackageLoader, select_autoescape from exasol_advanced_analytics_framework.deployment import constants, utils from exasol_advanced_analytics_framework.deployment.bundle_lua_scripts ...
StarcoderdataPython
7703
import tensorflow as tf import numpy as np from graphsage.models import FCPartition from graphsage.partition_train import construct_placeholders from graphsage.utils import load_graph_data, load_embedded_data, load_embedded_idmap flags = tf.app.flags FLAGS = flags.FLAGS # flags.DEFINE_integer('dim_1', ...
StarcoderdataPython
176545
<reponame>Duke-GCB/bespin-api # -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2018-06-15 15:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('data', '0051_auto_20180615_1536'), ] operations = [ ...
StarcoderdataPython