id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
230839
from django.conf.urls import url from main.views import ThumbnailView urlpatterns = [ url(r'^$', ThumbnailView.as_view(), name='index') ]
StarcoderdataPython
8002083
<reponame>twosigma/uberjob # # Copyright 2020 Two Sigma Open Source, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
StarcoderdataPython
6441520
i = int(input("Enter a number: ")) if i%7 == 0 : print('The number is divisible by 7.') else: print('The number is not divisible by 7.')
StarcoderdataPython
327417
""" ==================== Auto Subplots Adjust ==================== Automatically adjust subplot parameters. This example shows a way to determine a subplot parameter from the extent of the ticklabels using a callback on the :doc:`draw_event</users/event_handling>`. Note that a similar result would be achieved using `...
StarcoderdataPython
6473515
<reponame>bhavinjawade/project-euler-solutions<gh_stars>1-10 # -*- coding: utf-8 -*- ''' File name: code\rounded_square_roots\sol_255.py Author: <NAME> Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #255 :: Rounded Square Roots # # For more information see: # h...
StarcoderdataPython
4880885
<reponame>sohelmsc/DataScience<filename>code/CovidDataAnalysis.py #!/usr/bin/env python # coding: utf-8 # In[ ]: import pandas as pd import numpy as np import pickle import sklearn as sk from scipy.stats import randint as sp_randint from sklearn.metrics import mean_absolute_error from sklearn.model_selection import ...
StarcoderdataPython
5092831
<filename>matplotlib_1.py import matplotlib.pyplot as plt #plt.plot([1,2,3,4],[4,8,6,1],'-o') #adding dot and line #plt.plot([5,6,7,8],'-go') #addind red and dot line #plt.plot([9,10,11,12],'-ro') #plt.title("Design by amogh") #fig, ax = plt.subplots() # Create a figure containing a single axes. #ax.plot([1, 2, ...
StarcoderdataPython
4928998
''' Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3,4] Example 2: Inp...
StarcoderdataPython
121388
<reponame>CymaticLabs/Unity3d.Amqp info = { "friendly_name": "Comment (Block)", "example_template": "comment text", "summary": "The text within the block is not interpreted or rendered in the final displayed page.", } def SublanguageHandler(args, doc, renderer): pass
StarcoderdataPython
3279794
<filename>main.py<gh_stars>1-10 import os import sys import RPi.GPIO as GPIO from time import sleep from rover import Rover from utils.keyboard import getch from utils.stream import start_stream, end_stream from utils.tracking import start_manager from multiprocessing import Process import psutil # right motor in1 = 1...
StarcoderdataPython
8092956
<filename>generator.py<gh_stars>0 ########## import json, ast, yaml import geopandas as gpd import pandas as pd import numpy as np from maputil import ( legend_reader, translate_marker, getting_dictionary ) from geoutil import ( points_reduce, bounds_to_set, set_to_bounds, html_geo_thumb ) def generateDataPackag...
StarcoderdataPython
5165223
#!/usr/bin/env python # Bird Feeder - Feed Birds & Capture Images! # Copyright (C) 2020 redlogo # # This program is under MIT license import cv2 def scale_and_trim_boxes(boxes, image_width, image_height): """ Take care of scaling and trimming the boxes output from model, into something actual image can hand...
StarcoderdataPython
4802444
<reponame>AntixK/Variational_optimizer<gh_stars>0 import math import torch from torch.optim.optimizer import Optimizer from torch.nn.utils import parameters_to_vector, vector_to_parameters from numpy import asarray #=================# # VADAM OPTIMIZER # #=================# class VAdam(Optimizer): ''' Implemen...
StarcoderdataPython
1889220
# Copyright 2020 Xilinx Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
9621710
#BGD ''' batch gradient descent ''' import numpy as np class Adaline(object): #eta learning rata #n_iter times def __init__(self,eta,n_iter): self.eta=eta self.n_iter=n_iter def fit(self,x,y): ''' x=ndarray(n_samples,n_features),training data y=ndarray(n_samples),...
StarcoderdataPython
1893145
<gh_stars>0 ''' @author: <NAME> ''' import os ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) # This is your Project Root MODEL_PATH = os.path.join(ROOT_PATH,"model") print("Working dir " + ROOT_PATH)
StarcoderdataPython
322505
# Generated by Django 2.2.6 on 2019-11-07 22:17 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('foundation', '0001_initial'), ] operations = [ migrations.RenameModel( old_name='CaculatorMemory', new_name='CalculatorMemor...
StarcoderdataPython
1838984
<reponame>MelbourneHighSchoolRobotics/Mindpile<filename>mindpile/Mapping/data/constants.py from mindpile.Mapping.types import List from mindpile.Mapping.utils import MethodCall @MethodCall(target="X3.Lib:GlobalConstBoolean", valueIn=bool, valueOut=bool) @MethodCall(target="X3.Lib:GlobalConstBooleanArray", valueIn=List...
StarcoderdataPython
6695515
<reponame>DanieleMorotti/pymzn # -*- coding: utf-8 -*- import logging from .. import config from enum import Enum from textwrap import TextWrapper from numbers import Integral, Real, Number from collections.abc import Set, Sized, Iterable, Mapping __all__ = ['val2dzn', 'stmt2dzn', 'stmt2enum', 'dict2dzn', 'rebase_...
StarcoderdataPython
1843742
#!/usr/bin/env python import math import re def parse_input_file(filename: str): with open(filename) as input_file: all_lines = input_file.read().splitlines() rule_lines = all_lines[0:all_lines.index('')] rules = {} rule_regex = r'^([a-z ]+): (\d+)-(\d+) or (\d+)-(\d+)$' ...
StarcoderdataPython
3387410
<reponame>cheshire3/cheshire3 u"""Abstract Base Class for Cheshire3 Object Unittests.""" import os try: import unittest2 as unittest except ImportError: import unittest import string from lxml import etree from cheshire3.baseObjects import Session from cheshire3.configParser import C3Object, CaselessDi...
StarcoderdataPython
1908581
<reponame>leduong/richie<gh_stars>100-1000 """ Utility django form field that lets us validate and clean datetimeranges received from the API, ensuring there is at least one date and any supplied date is valid """ import json from django import forms from django.core.exceptions import ValidationError import arrow c...
StarcoderdataPython
6544210
import torch from lagom.core.multiprocessing import BaseWorker class BaseExperimentWorker(BaseWorker): r"""Base class for the worker of parallelized experiment. It executes the algorithm with the configuration and random seed which are distributed by the master. .. note:: If the ...
StarcoderdataPython
8110618
from __future__ import absolute_import import pytest from simple_detect_secrets.core import bidirectional_iterator class TestBidirectionalIterator(object): def test_no_input(self): iterator = bidirectional_iterator.BidirectionalIterator([]) with pytest.raises(StopIteration): iterato...
StarcoderdataPython
3275590
#!/usr/bin/python # -*- coding: utf-8 -*- # <bitbar.title>Temp-io</bitbar.title> # <bitbar.version>v1.0.0</bitbar.version> # <bitbar.author><NAME></bitbar.author> # <bitbar.author.github>awong1900</bitbar.author.github> # <bitbar.desc>TODO</bitbar.desc> # <bitbar.image>TODO</bitbar.image> # <bitbar.dependencies>python...
StarcoderdataPython
60914
<reponame>texas-justice-initiative/jail-population-reports<gh_stars>0 """ TODO: - configure PDF parser (adjust size & also specify columns) """ from typing import Dict, Tuple, Optional from pathlib import Path from uuid import uuid4 import numpy as np import camelot from camelot.core import Table, TableList import pan...
StarcoderdataPython
1770857
# from unet3d.model.mnet import mnet_model2_3d from unet25d.model import isensee25d_model # from unet3d.model import se_unet_3d # from unet3d.model import densefcn_model_3d from unet3d.model import isensee2017_model, unet_model_3d, mnet # from unet3d.model import unet_model_3d, simple_model_3d, eye_model_3d, multiscale...
StarcoderdataPython
9610711
# Generated by Django 2.2.2 on 2019-06-27 15:32 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='XXTMP_PO_HEADERS', fields=[ ('id', models.A...
StarcoderdataPython
1970607
import os import pickle from socket import socket from sys import path import time from OpenSSL import SSL from OpenSSL import crypto import OpenSSL from flask import Flask, json,jsonify,send_file from flask.helpers import flash, url_for from flask import Flask, redirect, url_for, request from flask.templating import r...
StarcoderdataPython
5097851
<reponame>0xtuytuy/unit-crypto-ski-week-poap-bot<filename>botenv/lib/python3.9/site-packages/telegram/forcereply.py #!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2022 # <NAME> <<EMAIL>> # # This program is free software: you can redistribute it and/or ...
StarcoderdataPython
3259562
<filename>user/views.py from django.shortcuts import render,redirect from .models import Image,Profile,User from django.template.context_processors import request from django.contrib.auth.decorators import login_required from .forms import ImageUploadForm,ProfileForm from django.core.paginator import Paginator,EmptyPag...
StarcoderdataPython
252577
<filename>oracles/push_inbound_oracle.py ''' This script implements the push in-bound oracles described in <NAME>. (2019). Integration of the real world to the blockchain via in-bound and outbound oracles (Unpublished Master thesis). Department of Information Systems and Operations, Vienna University ...
StarcoderdataPython
360125
# # Copyright 2013 Pixar # # Licensed under the Apache License, Version 2.0 (the "Apache License") # with the following modification; you may not use this file except in # compliance with the Apache License and the following modification to it: # Section 6. Trademarks. is deleted and replaced with: # # 6. T...
StarcoderdataPython
3390594
# encoding=utf-8 from .user import *
StarcoderdataPython
6659764
import model from keras.optimizers import SGD from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.preprocessing.image import ImageDataGenerator from visual_callbacks import AccLossPlotter import numpy as np def main(): np.random.seed(45) nb_class = 2 width, height = 224, 224 sn = mo...
StarcoderdataPython
5172957
"""Treadmill application configuration.""" import logging import click from treadmill import appenv from treadmill.appcfg import configure as app_cfg _LOGGER = logging.getLogger(__name__) def init(): """Top level command handler.""" @click.command() @click.option('--approot', type=click.Path(exist...
StarcoderdataPython
1858982
# Solved correctly import random import math from snippets import is_prime def problem_10(): "Find the sum of all the primes below two million." # Create a list of primes with the value 2 # This will allow the loop to start at 3, and step by 2 primes = [2] # For all odd integers between 3 an...
StarcoderdataPython
6669447
from Package.vector.vector import Vector import tecplot from tecplot.exception import * from tecplot.constant import * from Package.solvercontrol.splitcontrol import SplitControl from Package.solvercontrol.theorycontrol import TheoryControl import numpy as np import pandas as pd import os tecplot.session.connect(po...
StarcoderdataPython
263265
""" O adaptador é um padrão de design estrutural que permite a colaboração de objetos com interfaces incompatíveis. COMO IMPLEMENTAR: 1. Verifique se você possui pelo menos duas classes com interfaces incompatíveis: Uma classe de serviço útil , que você não pode alterar (ger...
StarcoderdataPython
1892131
<filename>train_MNG.py import argparse import copy import logging import math import random import sys import time import apex.amp as amp import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from preact_resnet import resnet50 as ResNet50 from preact_resnet import NoiseResNet3x3Conv fr...
StarcoderdataPython
6455162
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
StarcoderdataPython
6612452
<filename>bin/gdb/check_GNU_style.py<gh_stars>1-10 #!/usr/bin/env python3 # # Checks some of the GNU style formatting rules in a set of patches. # The script is a rewritten of the same bash script and should eventually # replace the former script. # # This file is part of GCC. # # GCC is free software; you can redistri...
StarcoderdataPython
8084254
<gh_stars>10-100 from typing import Optional, NamedTuple, Callable, List from pathlib import Path import re import numpy from depccg.cat import Category dunder_pattern = re.compile("__.*__") protected_pattern = re.compile("_.*") class Token(dict): def __init__(self, **kwargs): super().__init__(**kwargs)...
StarcoderdataPython
8135246
<reponame>pdvanmeter/meSXR<filename>mst_ida/data/fir.py """ """ from __future__ import division import numpy as np import MDSplus from mst_ida.data.nickal2 import smooth_signal # Constants for the MST FIR diagnostic system fir_chord_names = ['N32', 'N24', 'N17', 'N09', 'N02', 'P06', 'P13', 'P21', 'P28', 'P36...
StarcoderdataPython
8072188
import unittest import numpy as np from PIPS import photdata import PIPS class TestPhotdataUnit(unittest.TestCase): data = np.array([[1,2,3], [4,5,6], [7,8,9]]) def test_photdata_initialization(self): try: object = photdata(self.data) instantiated = True except Exceptio...
StarcoderdataPython
8003063
<gh_stars>1-10 import os from flask import Flask, request from google.cloud import storage from werkzeug.contrib.fixers import ProxyFix from werkzeug.exceptions import HTTPException from utils.generators import Snowflake from utils.mailgun import Mailgun from utils.recaptcha import Recaptcha from utils.responses imp...
StarcoderdataPython
6469243
<filename>extracter.py from docopt import docopt import sys import lxml import requests from bs4 import BeautifulSoup def extracter(url, filePath): try: html = requests.get(url, timeout=3) html_soup = BeautifulSoup(html.text, 'lxml') links = html_soup.findAll('a') links.pop(0) ...
StarcoderdataPython
327081
TEST = 'woo' PATH = 5
StarcoderdataPython
6505922
<reponame>ZackPashkin/toloka-kit from urllib.parse import urlparse, parse_qs import toloka.client as client from .testutils.util_functions import check_headers def test_aggregate_solution_by_pool(requests_mock, toloka_client, toloka_url): raw_request = { 'type': 'WEIGHTED_DYNAMIC_OVERLAP', 'poo...
StarcoderdataPython
9727317
<gh_stars>0 def remove_extra_whitespace(string): return " ".join(string.split())
StarcoderdataPython
9756317
from ..mod_base.base import Base class ExtBase(Base, extends=Base): def test(self) -> str: res = super().test() return "mod2." + res
StarcoderdataPython
11346645
<gh_stars>0 # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2016-2018 Lenovo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
StarcoderdataPython
3512759
import hashlib import json import os import shutil import tempfile from collections import defaultdict from pprint import pformat import pydash from copy import deepcopy from jsonschema import validate from infra_buddy.aws.cloudformation import CloudFormationBuddy from infra_buddy.aws.s3 import S3Buddy, CloudFormatio...
StarcoderdataPython
11266442
<gh_stars>100-1000 import responses from binance.spot import Spot as Client from tests.util import random_str from tests.util import mock_http_response from binance.error import ParameterRequiredError mock_item = {"key_1": "value_1", "key_2": "value_2"} mock_exception = {"code": -1, "msg": "error message"} key = ra...
StarcoderdataPython
11225140
import itertools from musicscore import basic_functions from musicscore.musictree.midi import MidiNote from musurgia.random import Random from musurgia.quantize import get_quantized_positions class MidiGenerator(object): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self...
StarcoderdataPython
3482941
"""Support for the AEMET OpenData service.""" from homeassistant.components.sensor import SensorEntity from .abstract_aemet_sensor import AbstractAemetSensor from .const import ( DOMAIN, ENTRY_NAME, ENTRY_WEATHER_COORDINATOR, FORECAST_MODE_ATTR_API, FORECAST_MODE_DAILY, FORECAST_MODES, FORE...
StarcoderdataPython
11290941
from flask import Blueprint, render_template, request from flaskblog.models import Post main = Blueprint('main', __name__) @main.route("/") @main.route("/home") def home(): # title = "Welcome" page = request.args.get('page', 1, type=int) posts = Post.query.order_by(Post.date_posted.desc()).paginate(page=...
StarcoderdataPython
11325419
"""Support for Big Ass Fans SenseME fan.""" from __future__ import annotations import math from typing import Any from aiosenseme import SensemeFan from homeassistant import config_entries from homeassistant.components.fan import ( DIRECTION_FORWARD, DIRECTION_REVERSE, SUPPORT_DIRECTION, SUPPORT_SET_...
StarcoderdataPython
6520869
""" Routines to create xvg file that represents a histogram of energies from virtual screening execution These routines were developed by: <NAME> - <EMAIL> / <EMAIL> <NAME> - <EMAIL> / <EMAIL> """ import os import analysis def create_xvg_histogram_energy_values(path_analysis, log_sort_dict): """...
StarcoderdataPython
4802727
<filename>finetune.py #!/usr/bin/env python3 import random import os import sys import numpy as np import tensorflow as tf from tensorflow.keras.layers import Input, Dropout, Activation, Reshape, Dense from tensorflow.keras.models import Model import tensorflow_addons as tfa import json from custom_layers import Comb...
StarcoderdataPython
5115368
import os from collections import namedtuple import numpy as np import pybullet as p from pybullet_planning.utils import CLIENT, CLIENTS, GRAVITY, INFO_FROM_BODY, STATIC_MASS from pybullet_planning.utils import is_darwin, is_windows, get_client from pybullet_planning.interfaces.env_manager.savers import Saver from py...
StarcoderdataPython
4882203
#!/usr/bin/python3 import sys import time from .spinner import Spinner from .bar import BarFormat # run demo for frames in ( "|/-\\", ("←↖↑↗→↘↓↙"), ("◐◓◑◒"), ("(o )", "( o )", "( o )", "( o )", "( o)", "( o )", "( o )", "( o )"), (".oO@*"), ("", ".", "..", "..."), ("⠋⠙⠹⠸⠼⠴...
StarcoderdataPython
1631453
#!/usr/bin /python38 from py2neo import Graph, Node from py2neo.data import Relationship from venus.stock_base import StockEventBase from polaris.mysql8 import GLOBAL_HEADER import re graph = Graph('http://localhost:7474', username='neo4j', password='<PASSWORD>') def create_stock_node(): event = StockEventBase(G...
StarcoderdataPython
4866887
from asyncio.events import AbstractEventLoop from typing import List, Union from .base import BaseResource __all__ = [ 'WSAResource' ] class WSAInstrument(object): __slots__ = [ '_id', '_display_name', '_data', ] def __init__(self, data: dict) -> None: self._id = da...
StarcoderdataPython
5126132
<filename>analyze_variants.py import pysam from collections import defaultdict, namedtuple import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost from random import randrange category_data = namedtuple('category_data',['misgenotyped','near_indel', 'in_homopol5...
StarcoderdataPython
6478685
<filename>project/logger.py<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- import re import traceback import logging.config from logging import getLogger class Logger(object): def __init__(self, logger_name="lib", conf_file='config/logging.conf'): logging.config.fileConfig(conf_file) se...
StarcoderdataPython
9731113
<reponame>sharonwoo/BEADSEP20<gh_stars>1-10 from pyspark import * def isNotHeader(l:str): boolean = not (l[0:3] == "host" and l.find("bytes")>0) # Configure Spark conf = SparkConf().setAppName("Create RDD") conf = conf.setMaster("local[*]") spark = SparkContext(conf=conf) spark.setLogLevel("ERROR") # Logs ...
StarcoderdataPython
170913
<filename>tests/unit/test_user.py """ Unit tests for the User object """ import mock import tests.unit import upapi.endpoints import upapi.user class TestUser(tests.unit.TestUserResource): """ Tests upapi.user """ @mock.patch('upapi.user.User.get', autospec=True) def test___init__(self, mock_get)...
StarcoderdataPython
1764550
from __future__ import print_function, division import os import shutil import tempfile import numpy as np from numpy.testing import assert_array_almost_equal_nulp import pytest import six from .. import Model from ..sed import SED from ...util.functions import random_id from .test_helpers import get_test_dust cl...
StarcoderdataPython
86177
import os import json from collections import OrderedDict def sort_meta_dict(input_dict: dict) -> OrderedDict: """ Sorting Meta dictionary in result directory. @param input_dict: @return: """ sorted_tuple = sorted(input_dict.items(), key=lambda item: int(item[0])) return OrderedDict(sorted...
StarcoderdataPython
5140876
from .Base_Action import * class ProfileAction(Base_Action): def __init__(self, action_xml, root_action=None): super(self.__class__, self).__init__(action_xml, root_action) self.shouldUseLaunchSchemeArgsEnv = self.contents.get('shouldUseLaunchSchemeArgsEnv'); self.savedToolIdentifier =...
StarcoderdataPython
11341168
import argparse import sys sys.path.append('../code') import subprocess import matplotlib.pyplot as plt import numpy as np import os import fnmatch import time import pickle from tools import general_tools as gt pathToResults = "../../postProcessing" def main(): # First load a2a, A08 and Control taStat = [] gmSta...
StarcoderdataPython
6513695
# -*- coding: utf-8 -*- # # This file is part of the SKAAlarmHandler project # # # from SKAAlarmHandler import main main()
StarcoderdataPython
3261552
from PyQt4.QtCore import * from PyQt4.QtGui import * import sys import time size = 100 class Compass(QWidget): north = QPolygon([ QPoint(7, 0), QPoint(-7, 0), QPoint(0, -80) ]) south = QPolygon([ QPoint(7, 0), QPoint(-7, 0), QPoint(0, 80) ]) def _...
StarcoderdataPython
9683218
<reponame>gaocegege/treadmill<gh_stars>1-10 """Unit test for treadmill.scheduler """ import datetime import time import unittest import mock import pandas as pd from treadmill import scheduler from treadmill import reports def _construct_cell(): """Constructs a test cell.""" cell = scheduler.Cell('top') ...
StarcoderdataPython
4846006
<filename>python/popart.ir/python_files/ir.py # Copyright (c) 2021 Graphcore Ltd. All rights reserved. """Definition of a class that represents the PopART IR.""" from collections import Counter from typing import Any, Callable import popart._internal.ir as _ir from popart.ir.graph import Graph from popart.ir.context ...
StarcoderdataPython
8179731
from setuptools import setup from os import path # read the contents of your README file this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: long_description = f.read() # setup library setup( name="jiwer", version="2.2.0", de...
StarcoderdataPython
34223
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 9 15:38:54 2020 @author: rayin """ # pic-sure api lib import PicSureHpdsLib import PicSureClient # python_lib for pic-sure # https://github.com/hms-dbmi/Access-to-Data-using-PIC-SURE-API/tree/master/NIH_Undiagnosed_Diseases_Network from python_li...
StarcoderdataPython
9767909
# -*- coding: utf-8 -*- import sys import mock sys.modules['nonexistent_lib_1'] = mock.Mock() sys.modules['nonexistent_lib_2'] = mock.Mock() sys.modules['nonexistent_lib_3'] = mock.Mock() sys.modules['nonexistent_lib_4'] = mock.Mock()
StarcoderdataPython
8091634
import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * def GetSuperComponent(item): if hasattr(item, "SuperComponent"): sc = item.SuperComponent if sc: return sc else: return BeamSystem.BeamBelongsTo(item) if hasattr(item, "HostRailingId"): return item.Document.GetElement(item.HostRailingId) ...
StarcoderdataPython
1895115
# Generated by Django 1.11.7 on 2018-01-24 16:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('waldur_slurm', '0003_allocationusage'), ] operations = [ migrations.AlterField( model_name='allocation', name='cpu_l...
StarcoderdataPython
1621682
def conwayGame(grid): rows = len(grid) cols = len(grid[0]) newgrid = [[0 for r in range(rows)] for c in range(cols)] directions = [(1,0),(-1,0),(0,-1),(0,1),(1,1),(-1,1),(1,-1),(-1,-1)] for r in range(rows): for c in range(cols): totals = 0 for x,y in direction...
StarcoderdataPython
9727844
class Solution: def checkInclusion(self, s1, s2): """ :type s1: str :type s2: str :rtype: bool """ if len(s1) > len(s2): return False missing = collections.Counter(s1) chrs = set(s1) n = len(s1) for i, ch in enumerate(s2): i...
StarcoderdataPython
11372069
# -*- coding: utf-8 -*- """tarea4 """ import numpy as np import scipy as sp import sklearn as sl import time from mpl_toolkits.mplot3d import axes3d from matplotlib import pyplot as plt from matplotlib import cm import pandas as pd import seaborn as sns; sns.set() import matplotlib as mpl # Metodo del Trapecio Inicio_d...
StarcoderdataPython
3423750
# -*- coding: utf-8 -*- from setuptools import setup setup( name='vuzixwrapdev', version='0.0.1', url='https://github.com/lanius/vuzixwrapdev/', license='MIT', author='lanius', author_email='<EMAIL>', description='vuzixwrapdev provides python APIs ' 'for the Vuzix Wrap dev...
StarcoderdataPython
1659843
def period_len(input_list: list, ignore_partial_cycles: bool = False) -> int: r"""listutils.period_len(input_list[, ignore_partial_cycles]) This function returns the length of the period of an input list. Usage: >>> alist = [1, 2, 3, 1, 2, 3, 1, 2, 3] >>> listutils.period_len(alist) 3 If a li...
StarcoderdataPython
11275102
from typing import List from .spacing import full_cosine_spacing, equal_spacing from .spacing import linear_bias_left from numpy import multiply, power, array, hstack, arctan, sin, cos, zeros, sqrt, pi from scipy.optimize import root, least_squares from . import read_dat class PolyFoil(): name: str = None a: L...
StarcoderdataPython
8132832
<reponame>seanmchu/algo-research<gh_stars>0 import matplotlib.pyplot as plt import matplotlib.markers hfont = {'fontname':'serif'} x = [10,50,100,200,300] az = [6424.927458699188,5256.961421300812,4824.796510406505,4397.427268292684, 4197.789814796751] ehyy = [2687.6435760975614,703.1398154471545,395.1273873170729,17...
StarcoderdataPython
1965754
from algos_contrib.CorrelationMatrix import CorrelationMatrix from test.contrib_util import AlgoTestUtils def test_algo(): AlgoTestUtils.assert_algo_basic(CorrelationMatrix, serializable=False)
StarcoderdataPython
4859656
<reponame>martinarnesi/a-walk-in-graphql from sqlalchemy import ForeignKey, Column, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship Base = declarative_base() class Skill(Base): __tablename__ = 'skills' id = Column(String, primary_key=True) name = C...
StarcoderdataPython
1810507
<gh_stars>1-10 from libft.models.sequential import Sequential from libft.models.utils import load_model, save_model __all__ = ['Sequential', 'save_model', 'load_model']
StarcoderdataPython
3527471
<reponame>dockeroo/dockeroo # -*- coding: utf-8 -*- # # Copyright (c) 2016, <NAME>. 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/...
StarcoderdataPython
6608476
import networkx as nx class CausalDiagram(nx.DiGraph): def __init__(self, incoming_graph_data=None, **attr): super().__init__(incoming_graph_data, *attr) assert nx.is_directed_acyclic_graph(self), "Input data is not acyclic!"
StarcoderdataPython
8194640
<reponame>Mandera/generallibrary from generallibrary import ObjInfo, SigInfo import json def _serialize(obj): objInfo = ObjInfo(obj) objInfos = objInfo.get_children(filt=ObjInfo.is_instance) attr_dict = {o.name: o.obj for o in objInfos} attr_dict["_obscure_cls_name"] = objInfo.cls.__name__ if ob...
StarcoderdataPython
8158671
<filename>Desafios/exerc20.py<gh_stars>0 # Exercício Python 20: A Confederação Nacional de Natação precisa de um programa que leia o ano de nascimento de um atleta e mostre sua categoria, de acordo com a idade. import datetime date = datetime.date.today() year = int(date.strftime('%Y')) ano_nasc = int(input('Insira ...
StarcoderdataPython
11329070
# Copyright 2011-2013 <NAME> # Copyright 2011-2013 <NAME> # Copyright 2012-2013 <NAME> # # 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
11308243
<gh_stars>1-10 #Exercício Python 079: Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista. Caso o número já exista lá dentro, ele não será adicionado. No final, serão exibidos todos os valores únicos digitados, em ordem crescente. lista_num = list() while True: valor...
StarcoderdataPython
208751
<reponame>mglantz/insights-core import pytest from itertools import islice from insights import tests from insights.core.dr import get_name, load_components def test_integration(component, compare_func, input_data, expected): actual = tests.run_test(component, input_data) compare_func(actual, expected) def...
StarcoderdataPython
1723729
# -*- coding: utf-8 -*- """ Author: mcncm 2019 DySART job server currently using http library; this should not be used in production, as it's not really a secure solution with sensible defaults. Should migrate to Apache or Nginx as soon as I understand what I really want. Why am I doing this? * Allows multiple clie...
StarcoderdataPython
26638
<filename>scripts/addons/keentools_facebuilder/utils/materials.py # ##### BEGIN GPL LICENSE BLOCK ##### # KeenTools for blender is a blender addon for using KeenTools in Blender. # Copyright (C) 2019 KeenTools # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Gener...
StarcoderdataPython