id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
3222674
# Copyright 2017 The TensorFlow Authors. 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 applica...
StarcoderdataPython
1892757
""" Census Data DAS Analysis: Part 2 5/21/21 - for all states, take DAS data for each ε level and join to 2010 block data with comparable variables - export joined data for each state in csv and shp format """ import pandas as pd import geopandas as gpd import maup import os def checkDataFrame(df): ''' ...
StarcoderdataPython
11330228
"""Value related classes. DOM Level 2 CSS CSSValue, CSSPrimitiveValue and CSSValueList are **no longer** supported and are replaced by these new classes. """ __all__ = ['PropertyValue', 'Value', 'ColorValue', 'DimensionValue', 'URIValue', 'CSSFunction', ...
StarcoderdataPython
6579348
WoqlLimitStart = { "@type": "Limit", "limit": 10, "query": { "@type": "Triple", "subject": { "@type": "NodeValue", "variable": "Subject", }, "predicate": { "@type": "NodeValue", "variable": "Predicate", }, "objec...
StarcoderdataPython
1665535
<gh_stars>0 from sqlalchemy.orm import Session import datetime from ..models.tables_definitions import Role_Type from ..schemas.role_type import RoleCreate async def get_roles(db: Session, skip: int = 0, limit: int = 200): roles = db.query(Role_Type).offset(skip).limit(limit).all() return roles async def get...
StarcoderdataPython
3344407
from imutils import contours import numpy as np import argparse import imutils import cv2 import myutils # 启动参数 ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required=True, help="path to imput image") ap.add_argument("-t", "--template", required=True, help="path to template OCR-A image") args = vars(...
StarcoderdataPython
174153
<gh_stars>10-100 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License...
StarcoderdataPython
3346997
#!/usr/bin/env python ''' =============================================================================== Barcode detect and decode pipeline. =============================================================================== ''' import os import numpy as np import cv2 as cv from tests_common import NewOpenCVTests class ...
StarcoderdataPython
8126661
<reponame>DeepRank/DeepRank_VariantPred from enum import Enum class VariantClass(Enum): BENIGN = 0 PATHOGENIC = 1 class PdbVariantSelection: """Refers to a variant in a pdb file. Args: pdb_path (str): on disk file path to the pdb file chain_id (str): chain within the pdb file, where...
StarcoderdataPython
1952461
#!/usr/bin/env python """ Copyright (c) 2020 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publi...
StarcoderdataPython
12839073
import glob mult=1 with open("combined_blocks_clustered.csv", 'w') as outfile: for f in glob.glob("*hierarchical_clusters.csv"): print f with open(f, 'rU') as infile: if mult==1: outfile.write(infile.next()) else: infile.next() for line in infile: line = line.strip()...
StarcoderdataPython
1872745
<gh_stars>1-10 # Getting user input to get length of sequence n = int(input("Fibonacci Sequence of how many digits: ")) # Declaration of variables and first and second digit n1, n2 = 0, 1 sum = 0 list = [] # Conditions to print the fibonacci sequence if n == 1: print(list.append(n1)) elif n <= 0: print("Ente...
StarcoderdataPython
1681598
""" Ada and Dishes Chef Ada is preparing N dishes (numbered 1 through N). For each valid i, it takes Ci minutes to prepare the i-th dish. The dishes can be prepared in any order. Ada has a kitchen with two identical burners. For each valid i, to prepare the i-th dish, she puts it on one of the burners and after Ci min...
StarcoderdataPython
3325158
<gh_stars>0 """Sphinx configuration file.""" import geomstats project = 'Geomstats' copyright = '2019-2020, Geomstats, Inc.' author = 'Geomstats Team' release = version = geomstats.__version__ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.doctest', 'sphinx.ext.githubpages',...
StarcoderdataPython
363706
<gh_stars>1-10 import argcomplete import getpass import logging import StringIO import sys import traceback import zipfile from .base import BaseClient from .config import config from conpaas.core import https ## TODO: should be configurable in cps-tools.conf DEFAULT_CREDIT = 50 try: import sqlalchemy im...
StarcoderdataPython
5032132
from apps.ImageSearch.algs.BestMarginalNN.BestMarginalNN import BestMarginalNN as MyAlg
StarcoderdataPython
3573110
def sort_chars(s): count = [0 for _ in range(0,256)] for c in s: count[int(ord(c))] += 1 slist = [] for i in range(0,256): while(count[i]): slist.append(chr(i)) count[i] -= 1 return "".join(slist) print(sort_chars("bcdedfa")) print(sort_chars("abd")) pr...
StarcoderdataPython
3509357
<filename>anthill/platform/models.py # For more details, see # http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#declare-a-mapping from anthill.framework.db import db from sqlalchemy.ext.declarative import declared_attr class BaseApplication(db.Model): __abstract__ = True id = db.Column(db.Integer, prim...
StarcoderdataPython
9749737
<reponame>snesnehne/MatPy import subprocess """ Compiles the Fortran code """ bashCommand = "make fortran" process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
StarcoderdataPython
8086480
<filename>testip.py<gh_stars>1-10 # +---------------------------------------------------------------------- # | Python-SimpleProxyPool # +---------------------------------------------------------------------- # | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) # +------------------------------------------------...
StarcoderdataPython
3598154
t = int(input()) for i in range(t): p,m=[int(i) for i in sinput().split()] if(p<m): print(0) else: print(" ",p-m)
StarcoderdataPython
1798961
from django.views.generic import TemplateView from django.shortcuts import render from django.views import View from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.conf import settings from django.urls import reverse from django.http import JsonResp...
StarcoderdataPython
5143845
<gh_stars>1-10 import glob import os from setuptools import setup # get all of the scripts scripts = glob.glob(os.path.join("bin", "*")) # read in the description from README with open("README.md") as stream: long_description = stream.read() github_url='https://github.com/deanmalmgren/todoist-tracker' # read in...
StarcoderdataPython
11223533
<reponame>jdrumgoole/atlascli import shutil import unittest import os from atlascli.atlasapi import AtlasAPI from atlascli.config import Config class TestConfig(unittest.TestCase): def setUp(self): if Config.PUBLIC_KEY_ENV in os.environ: del os.environ[Config.PUBLIC_KEY_ENV] if Confi...
StarcoderdataPython
1872479
# pylint: disable=undefined-variable, import-error, no-name-in-module, no-member import sys from operator import div from log import dump from search import mdlsearch from update import mdlupdate from validate import validatepreferences AGENT_NAME = "MyDramaList.com" def Start(): Log.Info("Initializing MyDrama...
StarcoderdataPython
6552987
import networkx as nx from ..AssemblyMixError import AssemblyMixError class ConnectorsMixin: """Mixin for AssemblyMix""" def autoselect_connectors(self, connectors_records): """Select connectors necessary for circular assemblie(s) in this mix. This method assumes that the parts provided ...
StarcoderdataPython
8115696
<reponame>csjliang/DASR import torch from torch import nn as nn from torch.nn import functional as F from basicsr.utils.registry import ARCH_REGISTRY from .arch_util import ResidualBlockNoBNDynamic, make_layer, Dynamic_conv2d @ARCH_REGISTRY.register() class MSRResNetDynamic(nn.Module): def __init__(self, num_in_...
StarcoderdataPython
11396945
<reponame>sachaservan/ProSecCo #!/usr/bin/python import csv import sys def convert(infile, outfile, n): with open(infile) as fin, open(outfile, 'w') as fout: start = False o=csv.writer(fout) for line in fin: if start: if line == "END_DATA\n": ...
StarcoderdataPython
1972415
import mobot from mobot_utils.image_grid import ImageGrid import torch import torchvision import numpy as np import time class PersonFollowerAgent(mobot.Agent): def __init__(self): super().__init__() self.image_grid = ImageGrid(self) self.camera.register_callback(self.camera_cb) ...
StarcoderdataPython
8059613
import FWCore.ParameterSet.Config as cms ## ## Set standard binning for the DMR histograms ## from Alignment.OfflineValidation.TrackerOfflineValidationSummary_cfi import * # do the parameter setting before cloning, so the clone gets these values TrackerOfflineValidationSummary.TH1DmrXprimeStripModules.Nbinx = 50 Trac...
StarcoderdataPython
3345654
<reponame>mkubux/egenix-mx-base """ mx Extension Series for Python Copyright (c) 1998-2000, <NAME>; mailto:<EMAIL> Copyright (c) 2000-2015, eGenix.com Software GmbH; mailto:<EMAIL> See the documentation for further information on copyrights, or contact the author. All Rights Reserved. IMPORTANT: ...
StarcoderdataPython
167942
<reponame>fregu856/CS224n """ - ASSUMES: that the image dataset has been manually split such that all test images are stored in "coco/images/test/" and all val images are stored in "coco/images/val". - DOES: creates two files (val_img_ids, test_img_ids) containing the img ids for all val and test imgs, res...
StarcoderdataPython
9670472
<gh_stars>0 from django.shortcuts import render, redirect from .forms import diarista_forms from .models import Diarista # Create your views here. def cadastrar_diarista(request): if request.method == "POST": form_diarista = diarista_forms.DiaristaForm(request.POST, request.FILES) if form_diarist...
StarcoderdataPython
1706590
<reponame>Nintendofan885/wiki-detox import pandas as pd import numpy as np import matplotlib.pyplot as plt import time import datetime from scipy import stats def create_column_of_counts(df, col): return df.apply(lambda x: col in str(x)) def create_column_of_counts_from_nums(df, col): return df.apply(lambda ...
StarcoderdataPython
4903904
<gh_stars>10-100 LIST_OF_EXPERIMENTS_RESPONSE_JSON = { "data": [ { "dtCreated": "2019-03-21T07:47:05.616096+00:00", "dtDeleted": None, "dtFinished": None, "dtModified": "2019-03-21T07:47:05.616096+00:00", "dtProvisioningFinished": None, ...
StarcoderdataPython
4844136
#!/usr/bin/env python3 import time from src.frame_producer import StreamVideo from src.params import * from src.utils import clear_topic, set_topic, get_video_feed_url from web import app # Clear Broadcast topic, new query images to be used. clear_topic(TARGET_FACE_TOPIC) if CLEAR_PRE_PROCESS_TOPICS: # Clear ra...
StarcoderdataPython
11290150
import requests as req import pics # SERVER = "http://192.168.22.4:5000/" SERVER = "http://192.168.0.114:5000/" H3 = SERVER+'h3/' SPI = H3+'spi' FORTH = H3+'forth' SCREND = 9 class Colors(): pass class Base(): def __init__(self, endpoint): self.endpoint = endpoint def post(self, abytesarray=No...
StarcoderdataPython
6457406
<reponame>wildintellect/tasking-manager import io from distutils.util import strtobool from flask import send_file, Response from flask_restful import Resource, current_app, request from schematics.exceptions import DataError from server.models.dtos.mapping_dto import MappedTaskDTO, LockTaskDTO, StopMappingTaskDTO fr...
StarcoderdataPython
11280758
<filename>playhouse/cli.py import os import sys import yaml import argparse import textwrap from colorama import Fore, Style from .image import get_layers, list_images, del_images from .nodes import Node, merge_to_tree, flatten_tree def parse_args(): parser = argparse.ArgumentParser( prog='rmi', f...
StarcoderdataPython
3581037
"""Displays game info for all games in a given day.""" from datetime import datetime from nbapy import constants from nbapy.nba_api import NbaAPI class Scoreboard: """A scoreboard for all games for a given day. Displays current games plus info for a given day Args: month: Specified month (1-12...
StarcoderdataPython
6623370
class Range: def __init__(self, start=0, end=None, modulo=None): self.start = start self.end = end self.modulo = modulo def __call__(self, value): if self.start is not None and value < self.start: return False if self.end is not None and value >= self.end: ...
StarcoderdataPython
3327441
# -*- coding: utf-8 -*- """ Created on Sat Aug 21 14:36:08 2021 @author: Administrator """ #%% # ============================================================================= # ============================================================================= # # 문제 11 유형(DataSet_11.csv 이용) # 구분자 : comma(“,...
StarcoderdataPython
9688898
<gh_stars>1-10 from pyvibdmc.simulation_utilities import * def sample_h4o2_pot(cds, model, extra_args): descriptor = extra_args['descriptor'] batch_size = extra_args['batch_size'] cds = descriptor.run(cds) pots_wn = (model.predict(cds, batch_size=batch_size)).flatten() return Constants.convert(pot...
StarcoderdataPython
4926861
import datetime import warnings import contextlib import requests from urllib3.exceptions import InsecureRequestWarning def main(): url = input("What's the URL? ").strip() times = int(input("How many rounds <num>? ")) print(f"Running timing against {url}, {times} times.") total_time = 0.0 with ...
StarcoderdataPython
4940969
<filename>Module01/AdvOOP/OverrideCallBase.py class Animal: def __init__(self): print("================= Animal ctor") def eat(self): print("Animal eat meat") class Cat(Animal): def __init__(self): ####################################### # Third __init__ method to call b...
StarcoderdataPython
8004863
<reponame>alfredo-milani/VideoConverter import atexit import sys from mediaconversion import MediaObserver from model import ConverterConfig from util import Common from util.Validation import Validation class Application(object): """ Launcher """ def __init__(self): super().__init__() ...
StarcoderdataPython
233771
<reponame>RichardScottOZ/geoapps import numpy as np from scipy.interpolate import LinearNDInterpolator import matplotlib.pyplot as plt from scipy.interpolate import griddata from scipy.spatial import cKDTree from scipy.interpolate.interpnd import _ndim_coords_from_arrays from matplotlib.colors import LightSource, Norma...
StarcoderdataPython
1914075
<filename>api/serializers.py from rest_framework import serializers from rest_framework.validators import UniqueValidator from .models import Category, Comment, Genre, Review, Title, User from .validations import uniq_review class ObtainCodeSerializer(serializers.Serializer): email = serializers.EmailField( ...
StarcoderdataPython
6597641
class UserInterface: def __init__(self): pass def user_wanna_play(self, user_input): return user_input.lower() == 'p'
StarcoderdataPython
5033738
<reponame>smsmith97/UK-Polling-Stations from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = "FYL" addresses_name = "2021-02-17T15:08:06.810442/Democracy_Club__06May2021.csv" stations_name = "2021-02-17T15:08:06.8...
StarcoderdataPython
8033144
from . import Timecode from . import Event class VFXEvent(Event): def __init__(self, vfx_id=None, vfx_element=None, sequence_name=None, vfx_brief=None, vfx_loc_tc=None, vfx_loc_color=None, frame_count_start=None, scan_start_tc=None, scan_end_tc=None, ...
StarcoderdataPython
1801351
<gh_stars>0 """ Copyright (c) 2015 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ from __future__ import print_function, unicode_literals, absolute_import import json import logging import os import sys import t...
StarcoderdataPython
3402778
<reponame>JeaustinSirias/Backend-Test-Sirias from __future__ import absolute_import, unicode_literals from .celery import func __all__ = ('func',)
StarcoderdataPython
11384643
<filename>PfamScripts/adda/scripts/txt2html_annotation.py """convert a text file from annotation output into html format.""" import sys, re, string, os, getopt param_cluster = [] param_ref = [] try: optlist, args = getopt.getopt(sys.argv[1:], "c:r:", ...
StarcoderdataPython
11240048
<reponame>Elenterius/DS-MM-CF from typing import Optional, List import requests from requests import Response class CFCoreApi: """A simple helper class for the CurseForge Core API""" _api_key: str = None base_url: str = "https://api.curseforge.com" game_ids: dict = { "minecraft": 432, } def __init__(self,...
StarcoderdataPython
9794156
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.http.response import Http404 class WeChatInfo(object): def __init__(self, **kwargs): for k, v in kwargs.items(): setattr(self, k, v) @property def appname(self): return self._appname @property ...
StarcoderdataPython
3276849
<reponame>HumbleSmarts/Cafemanagementsystem from datetime import date from tkinter import* import tkinter import tkinter.ttk import tkinter.messagebox as messagebox import random import time import datetime from tkinter import * from random import triangular """def register_user(): username_info = username.get()...
StarcoderdataPython
3320112
# names = (input("Enter Name: ") # ages = int(input("Enter Age: ")) # input() # for x in ages: # if x >= 18: # # nim.append(x) # else: # num.append(x) # print(f"% 2{nim}") # # print(f"% 1{num}") # for x in lst: # if x % 2 != 0: # print(f"first %2: {x}") names =[] ages =[] a = 0 ...
StarcoderdataPython
3434722
import sys from sage.misc.temporary_file import tmp_filename from sage.plot.colors import rainbow import os, sys #Setup the html page for d3js and for hosting the graph def gen_html_code(JSONgraph): try : js_code_file = open(pathRepo+"/JS_Graph_Sage/src/HTML/base_html.html", 'r') #Open the html page whic...
StarcoderdataPython
1872294
# Versão2 otimizada, menos código, menos uso de memória. from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.firefox.launch() page = browser.new_page() # Este range é setado manualmente, significa a quantidade de páginas/imagens que serão baixadas. # O proces...
StarcoderdataPython
11347524
import json config = {} def Readfromfile(filename): global config with open(filename,'r') as config_file: s = config_file.read() config = json.loads(s)
StarcoderdataPython
1653795
from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart # Python code to illustrate Sending mail from alstom email id import smtplib, datetime def sendSummaryEmail(message, ExpiryDays, fromEmailId, pwdOfEmail, toEmailId, LicenseAdminName, ccEmailId): try: print("\nSending ...
StarcoderdataPython
1894872
"""Initial database setup Revision ID: <KEY> Revises: Create Date: 2021-03-17 13:38:33.981641 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated b...
StarcoderdataPython
1891161
# -*- coding: utf-8 -*- """ Created on Fri May 1 00:05:50 2020 @author: <NAME> """ from PIL import Image ,ImageEnhance # img=image.open('anyimage.format') # img1.save('any name.format') # img1.show() # to reduce size of an image Max_size=(250,250) img1.thumbnail(Max_size) img1.save('ldfljf.form...
StarcoderdataPython
9633500
import time from bitalino import BITalino import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation import numpy as np import csv macAddress = "/dev/tty.BITalino-51-FB-DevB" xdata, ydata = [], [] running_time = 100 batteryThreshold = 30 acqChannels = [0] samplingRate = 100 nSamples = 1 digit...
StarcoderdataPython
3418003
import json from django import template from django.utils.safestring import mark_safe from jsonfield.utils import TZAwareJSONEncoder register = template.Library() @register.filter def jsonify(value): # If we have a queryset, then convert it into a list. if getattr(value, 'all', False): value = list(...
StarcoderdataPython
83522
# -*- coding: UTF-8 -*- # SPDX-License-Identifier: MIT from __future__ import print_function, unicode_literals from pythonic_testcase import * from pymta.api import IMTAPolicy from pymta.command_parser import SMTPCommandParser from pymta.compat import basestring, b64encode from pymta.test_util import BlackholeDelive...
StarcoderdataPython
8191940
import spacy import random from train_dataset import dataset def train_spacy(dataset,iterations): TRAIN_DATA = dataset nlp = spacy.blank('en') # create blank Language class # create the built-in pipeline components and add them to the pipeline # nlp.create_pipe works for built-ins that a...
StarcoderdataPython
3289647
# -*- coding: utf-8 -*- # # __init__.py — Model initialisation code # # This file is part of debexpo - https://alioth.debian.org/projects/debexpo/ # # Copyright © 2008 <NAME> <<EMAIL>> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentat...
StarcoderdataPython
133259
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. # external from lxml import etree import mixbox.xml from mixbox.fields import TypedField from mixbox.vendor.six import BytesIO, iteritems # internal import stix from stix.indicator.test_mechanism import _BaseTestMe...
StarcoderdataPython
9733622
<reponame>dks1018/CoffeeShopCoding import time # You can edit this code and run it right here in the browser! # First we'll import some turtles and shapes: from turtle import * from shapes import * # Create a turtle named Tommy: tommy = Turtle() tommy.shape("turtle") tommy.speed(10) # Draw three circles: draw_circ...
StarcoderdataPython
3320614
<gh_stars>1-10 """ Execute custom print messages. """ import argparse import pathlib import textwrap from typing import List import colorama from cushead import info from cushead.console.arguments import files_creator def show_presentation() -> None: """ Print the presentation message. """ presentat...
StarcoderdataPython
3529290
import io from inspect import signature import torch from torch import nn from torchvision import transforms class ConvertToPyTorchModel(nn.Module): def __init__(self, base_model, classify_fn_args, classify=None, normalization=None, class_sublist=None, adversarial_attack=None): super().__...
StarcoderdataPython
1932881
<gh_stars>10-100 import torch import genbmm class HMM(torch.nn.Module): """ Hidden Markov Model. (For now, discrete observations only.) - forward(): computes the log probability of an observation sequence. - viterbi(): computes the most likely state sequence. - sample(): draws a sample from p(x). """ def __ini...
StarcoderdataPython
3540813
from .viz import CircleViz, GraduatedCircleViz, HeatmapViz, ClusteredCircleViz, ImageViz, RasterTilesViz, ChoroplethViz, LinestringViz __version__ = "0.9.0" __all__ = ['CircleViz', 'GraduatedCircleViz', 'HeatmapViz', 'ClusteredCircleViz', 'ImageViz', 'RasterTilesViz', 'ChoroplethViz', 'LinestringViz']
StarcoderdataPython
47380
<gh_stars>0 import bcrypt from fastapi_jwt_auth import AuthJWT from passlib.context import CryptContext from .schemas import UserInDB, UserPassword pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") class Authenticate: def create_salt_and_hashed_password( self, *, plaintext_password: str ...
StarcoderdataPython
12830657
import math import torch from sklearn.utils.extmath import cartesian import numpy as np from torch.nn import functional as F import os import time from sklearn.metrics.pairwise import pairwise_distances from sklearn.neighbors.kde import KernelDensity import skimage.io from torch import nn torch.set_default_dtype(torc...
StarcoderdataPython
1820506
<reponame>TM6501/gym-jsbsim-envAddons from gym_jsbsim.task import Task from gym_jsbsim.catalogs.catalog import Catalog as c from gym import spaces import math import random import numpy as np """ @author <NAME> A task in which the agent must perform steady, level flight maintaining its initial heading. On...
StarcoderdataPython
4944120
from .users import RegisterForm,LoginForm from .posts import PostsForm
StarcoderdataPython
1721257
import json import typing import random import os import re import backend.logic_engine class Question: def __init__(self, identifier: str, source: str, prompt: str, input_method: str, correct_grammar: str, correct_formula: str, prohibited_formula: str) -> typing.NoReturn: # User created...
StarcoderdataPython
3513663
<filename>experiments/widget_utils.py """Helpers for ipython widgets."""
StarcoderdataPython
12812198
import pytest from psipy.io import util def test_HDF4_error(tmp_path): with pytest.raises(FileNotFoundError): util.HDF4File(tmp_path / 'not_a_file.hdf')
StarcoderdataPython
8191712
from django.conf import settings from django.shortcuts import render from django.views import View from .models import TeamMember class TeamView(View): template_name = 'team/index.html' def get(self, request): teams = TeamMember.objects.get_teams( unpublished=settings.TEDXNTUA_SHOW_UNPUB...
StarcoderdataPython
3387001
<reponame>ckamtsikis/cmssw import FWCore.ParameterSet.Config as cms l1GtPrescaleFactorsTechTrig = cms.ESProducer("L1GtPrescaleFactorsTechTrigTrivialProducer", PrescaleFactorsSet = cms.VPSet( cms.PSet( PrescaleFactors = cms.vint32( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
StarcoderdataPython
6436342
#!/usr/bin/env python """Convert ======= """ from nose.tools import * from networkx import * from networkx.convert import * from networkx.algorithms.operators import * from networkx.generators.classic import barbell_graph,cycle_graph class TestConvert(): def test_simple_graphs(self): for dest, source in ...
StarcoderdataPython
106500
import datetime from django.db import models from django.utils import timezone from django.contrib.auth.models import AbstractUser from django.core.validators import MinValueValidator, MaxValueValidator # Create your models here. class Question(models.Model): question_text = models.CharField(max_length=200) pu...
StarcoderdataPython
3469031
# Generated by Django 3.1.6 on 2021-03-10 20:35 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("corpus", "0003_revise_collections"), ] operations = [ migrations.AlterModelOptions( name="fragment", options={"order...
StarcoderdataPython
5152839
import cv2 import numpy as np def empty(a): pass def stackImages(scale,imgArray): rows = len(imgArray) cols = len(imgArray[0]) rowsAvailable = isinstance(imgArray[0], list) width = imgArray[0][0].shape[1] height = imgArray[0][0].shape[0] if rowsAvailable: for x in range ( 0, ...
StarcoderdataPython
9609361
# Copyright (c) The InferLO authors. All rights reserved. # Licensed under the Apache License, Version 2.0. import numpy as np import inferlo from inferlo import GenericGraphModel from inferlo.datasets import Dataset from inferlo.testing import grid_potts_model dataset_loader = inferlo.datasets.DatasetLoader() def ...
StarcoderdataPython
159570
<reponame>sviatoplok/apis-core<gh_stars>1-10 from django.contrib.contenttypes.models import ContentType from rest_framework.generics import ListAPIView from .serializers import * from apis_core.apis_relations.models import PersonInstitution from django_filters.rest_framework import DjangoFilterBackend from rest_framewo...
StarcoderdataPython
3574677
<reponame>ltfred/site # Generated by Django 2.2.13 on 2020-09-21 16:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("blog", "0003_auto_20200915_1936"), ] operations = [ migrations.CreateModel( name="SiteConfig", ...
StarcoderdataPython
3308537
<gh_stars>0 class ConstantError(Exception): def __init__(self, message="Can't redfine constants"): self.message = message super().__init__(self.message) def constant(f): def fset(self, value): raise ConstantError def fget(self): return f() return property(fget, fset)...
StarcoderdataPython
8028807
<filename>supplychainpy/simulations/simulation_summary.py from decimal import Decimal class MonteCarloSummary: """ """ def __init__(self): self._opening_stock_average self._opening_stock_min self._opening_stock_max self._opening_stock_final self._opening_stock_std ...
StarcoderdataPython
5139399
<filename>tetrisSimulation.py import logging from tkinter import scrolledtext from typing import Tuple, List from logging import getLogger import neat import pickle from tetrisClasses import Board, Piece, Move, TetrisPlacementState from tetrisUtilities import get_all_drop_moves, get_all_drop_boards, is_state_legal, is...
StarcoderdataPython
4929856
"""Test illud.output.""" from illud.output import Output # pylint: disable=unused-import
StarcoderdataPython
1925342
default_app_config = 'apps.summary.apps.SummaryConfig'
StarcoderdataPython
125123
<filename>src/similarity.py<gh_stars>1-10 import os import sys import numpy as np import math from package.ranking import * from gensim.models import FastText def main(file, data): word_vecs_norm = {} word_vecs = {} model = FastText.load(file) wv = model.wv del model for word in wv.index2word: word_vecs_norm[...
StarcoderdataPython
1735630
from random import randint from django.shortcuts import get_object_or_404, render from django.views.generic.list import ListView from django.contrib.auth.models import User from django.db.models import Q from .models import Quote, Author class QuoteList(ListView): model = Quote template_name = 'quotes/list....
StarcoderdataPython
12856112
import numpy import numpy.linalg def distance_sum(inputs, references): """Sum of all distances between inputs and references Each element should be in a row! """ norms = numpy.zeros(inputs.shape[0]) for i in xrange(references.shape[0]): norms += numpy.apply_along_axis(numpy.linalg.norm, 1...
StarcoderdataPython
1902332
import os from data_manager import DataManager as dm import cv2 from numpy.random import randint import numpy as np from imgaug import augmenters as iaa from util import check_directory,check_cv2_imwrite ROOT_DIR = os.getcwd() if ROOT_DIR.endswith('src'): ROOT_DIR = os.path.dirname(ROOT_DIR) OLD_DATA_DIR = os.pat...
StarcoderdataPython