id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1731552
<filename>src/hmf/mass_function/hmf.py """ The primary module for user-interaction with the :mod:`hmf` package. The module contains a single class, `MassFunction`, which wraps almost all the functionality of :mod:`hmf` in an easy-to-use way. """ import numpy as np import copy from scipy.optimize import minimize from ...
StarcoderdataPython
3365475
#!/usr/bin/env python # # Author: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # ''' Section IV.A of AVAS paper arXiv:1701.07862 [physics.chem-ph] ''' from functools import reduce import numpy from pyscf import gto from pyscf import scf from pyscf import mcscf from pyscf import fci from pyscf.mcscf import avas #====...
StarcoderdataPython
1785400
<gh_stars>1-10 ### Wrapper around the pyrender library that allows to ### 1. disable antialiasing ### 2. render a normal buffer ### This needs to be imported before pyrender or OpenGL is imported anywhere import matplotlib.pyplot as plt import os import sys if 'pyrender' in sys.modules: raise ImportError('The mesh...
StarcoderdataPython
155111
<filename>src/haws/scripts/nn_ddrn.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: <NAME> """ from __future__ import division from pylab import * from math import * from matplotlib.pyplot import * from matplotlib.patches import Ellipse, Arc from scipy import * from scipy.integrate import odeint from pyla...
StarcoderdataPython
1655534
<gh_stars>0 import os from pkgutil import get_data import torch import dgl import numpy as np import requests import zipfile from scipy.spatial.distance import pdist, squareform from data.tsp import distance_matrix_tensor_representation import tqdm from toolbox import utils class TSP_BGNN_Generator(torch.utils.data.Da...
StarcoderdataPython
1666780
<reponame>samip5/python-discord-bot import datetime import socket import time from contextlib import closing from bot.constants import RabbitMQ THIRTY_SECONDS = datetime.timedelta(seconds=30) def wait_for_rmq(): start = datetime.datetime.now() while True: if datetime.datetime.now() - start > THIRTY...
StarcoderdataPython
120435
import pandas as pd LOAD_CAPIQ_CAT_A_INDEX_str = ["2014-12-31 00:00:00", "2015-12-31 00:00:00", "2016-12-31 00:00:00", "2017-12-31 00:00:00", "2018-12-31 00:00:00"] LOAD_CAPIQ_CAT_A_INDEX = [pd.to_datetime(val) for val in LOAD_CAPIQ_CAT_A_INDEX_str] LOAD_CAPIQ_CAT_A_INDEX_DATA_DICT = dict( revenue=pd.Series( ...
StarcoderdataPython
1788062
<filename>main/forms.py<gh_stars>0 from django.forms import ModelForm, Form from main.models import User from django import forms class LoginForm(Form): email = forms.EmailField(label="email") password = forms.CharField(widget=forms.PasswordInput(), label="hasło") class Registe...
StarcoderdataPython
90961
<reponame>dymaxionlabs/satlomas-back # Generated by Django 3.0.5 on 2020-04-28 02:25 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('lomas_changes', '0011_changesmask_mask'), ] operations = [ migrations....
StarcoderdataPython
4835849
<filename>run/api/resources/getSensorData.py import numpy as np import time from google.cloud import bigquery from common.params import URL_PARAMS, PARAMS_HELP_MESSAGES, list_param, multi_area, bool_flag from flask_restful import Resource from flask_restful.reqparse import RequestParser from flask_restful.inputs impor...
StarcoderdataPython
86044
from calendar import monthrange from datetime import date from flask import abort, Blueprint, flash, Markup, redirect, render_template, request, session, url_for from sqlalchemy.orm.exc import NoResultFound from app import app, db from app.users.decorators import login_required from .forms import TicketSearchForm, Ti...
StarcoderdataPython
3285896
<gh_stars>0 # # Author: <NAME> # created Date: 12-10-2019 import subprocess from subprocess import Popen import json class ExeCmd: def __init__(self): pass def run(self, cmd): process = Popen([cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) output, errors = process....
StarcoderdataPython
81908
<filename>tests/test_match.py<gh_stars>100-1000 import sys import os sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..')) from qfc.core import filter_files, get_weight def _equals(marks_list1, marks_list2): l1 = sorted(marks_list1) l2 = sorted(marks_list2) if len(l1) != len(l2): return F...
StarcoderdataPython
3391918
<gh_stars>0 """ Implements the Nelder-Mead algorithm for maximizing a function with one or more variables. test changes """ import numpy as np from numba import njit from collections import namedtuple results = namedtuple('results', 'x fun success nit final_simplex') @njit def nelder_mead(fun, x0, bounds=np.array...
StarcoderdataPython
126025
import discord import asyncio import yaml import pandas as pd import urllib.request, urllib.error from xml.sax.saxutils import unescape from bs4 import BeautifulSoup client = discord.Client() @client.event async def on_ready(): print('Logged in as' + client.user.name) print(client.user.id) print('------')...
StarcoderdataPython
3285696
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Building damage inference script.""" import argparse import os import numpy as np import rasterio import rasterio.mask import rasterio.warp import torch.nn.functional as F import torch from models import SiamUnet from tor...
StarcoderdataPython
3300150
<filename>fjord/base/tests/test_utils.py<gh_stars>0 # -*- coding: utf-8 -*- import datetime from django.test.client import RequestFactory from fjord.base.tests import reverse, TestCase from fjord.base.utils import ( actual_ip_plus_context, instance_to_key, key_to_instance, smart_bool, smart_date, ...
StarcoderdataPython
3390982
"""A connector for Teams.""" from .teams import TeamsConnector # noqa: F401
StarcoderdataPython
1781384
import bpy from .road import Road from .road_props import RoadProperty class BTOOLS_OT_add_road(bpy.types.Operator): """Create road""" bl_idname = "btools.add_road" bl_label = "Add Road" bl_options = {"REGISTER", "UNDO", "PRESET"} props: bpy.props.PointerProperty(type=RoadProperty) @classm...
StarcoderdataPython
3373253
<reponame>erick-dsnk/tameris<gh_stars>1-10 from typing import Callable class EventHandler: def __init__( self, on_ready: Callable = None, on_guild_create: Callable = None, on_guild_delete: Callable = None, on_guild_update: Callable = None, on_guild_ban_add: Callable...
StarcoderdataPython
1788942
''' Run this script from the command line. The first argument after the script is the filename to read data from. The second argument after the script is the geography level to process - the options are "tract" and "county". This script assumes that the first column of the input file is a geoid and that the last column...
StarcoderdataPython
18744
<gh_stars>1-10 import sys from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QApplication,QDialog from PyQt5.uic import loadUi import requests import urllib.request from selenium import webdriver class INSTADOWNLOAD(QDialog): def __init__(self): super(INSTADOWNLOAD,self).__init__() ...
StarcoderdataPython
4826504
<gh_stars>1-10 # Medium # https://leetcode.com/problems/delete-operation-for-two-strings/ # Time Complexity: O(N * M) # Space Complexity: O(N * M) class Solution: def minDistance(self, word1: str, word2: str) -> int: # Find the longest common substring because # that would be the word we need to ma...
StarcoderdataPython
3342062
<gh_stars>1-10 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'WhereforeGUI.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5...
StarcoderdataPython
1770784
<gh_stars>0 from datetime import datetime from decimal import Decimal import transaction from urllib.parse import quote_plus from sqlalchemy import engine_from_config from pyramid.config import Configurator from pyramid.request import Request, Response from pyramid.renderers import JSON from pyramid.authentication im...
StarcoderdataPython
3347659
<gh_stars>0 # Authentication parameters for Azure Blob Sotrage AccountName = 'uvesdata' AccountKey = '' ContNameAnalysis = 'analysis' ContNameDesc = 'descriptor' ContNameDescCor = 'descriptorcorrupt' ContNameProc = 'processed' ContNameProcCor = 'processedcorrupt' ContNameUnC = 'uncompressed' ContNameZ = 'raw'
StarcoderdataPython
3225830
<gh_stars>0 import unittest from ctci.structs.stack import Stack class TestStackPush(unittest.TestCase): def setUp(self): self.a = Stack() def test_one(self): self.a.push(1) self.assertEqual(self.a.peek(), 1) def test_two(self): self.a.push(1) self.a.push(2) ...
StarcoderdataPython
3201237
# Copyright (c) 2018 Dolphin Emulator Website Contributors # SPDX-License-Identifier: MIT from django.conf import settings from django.http import Http404 from django.shortcuts import get_object_or_404 from django.urls import reverse from django.utils.translation import ugettext as _ from dolweb.blog.models import Blo...
StarcoderdataPython
1694474
<filename>AoC2020/Day_12/day_12.py import re LEFT = { 'E': 'N', 'N': 'W', 'W': 'S', 'S': 'E' } RIGHT = { 'E': 'S', 'S': 'W', 'W': 'N', 'N': 'E' } with open('input.txt') as f: dirs = f.readlines() with open('tst.txt') as f: tst ...
StarcoderdataPython
1690246
<reponame>EOSIO/doxybook import os import re import xml.etree.ElementTree from typing import List from doxybook.markdown import Md, MdDocument, MdCode, MdCodeBlock, MdBold, MdItalic, MdLink, MdHeader, MdList, MdParagraph, MdRenderer, MdLine, MdTable, MdTableRow, MdTableCell, Text, Br from doxybook.node import Node fro...
StarcoderdataPython
67821
<filename>run.py<gh_stars>0 # -*- coding: utf-8 -*- import os from flask import Flask, render_template, request, flash, url_for from flask_pymongo import PyMongo from werkzeug.utils import redirect, secure_filename from integration.mail import send_mail from integration.bucket import create_file UPLOAD_FOLDER = 'upl...
StarcoderdataPython
88972
from Hw.H5_CNN_Explaination.data import ImgDataset from Hw.H5_CNN_Explaination.utils import * from Hw.H5_CNN_Explaination.model import Classifier from Hw.H3_CNN.model import CNN5 from Hw.H3_CNN.utils import get_best_checkpoint_path, test, evaluate import copy import matplotlib.pyplot as plt import numpy as np from lime...
StarcoderdataPython
135638
<filename>6. Mitosis Simulation/mitosis_sim.py # desc: In this coding challenge (originally done at The Coding Train), I attempt to code a mitosis simulation in pygame. # A part of Coding Train's Challenges implementation in Python series. # @author: PseudoCodeNerd # Importing libraries import pygame, sys, random, mat...
StarcoderdataPython
113592
<gh_stars>10-100 # Copyright 2021 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 """ Functional test aiming at verifying the end-to-end operation of the ingestion plugins chaining functionality """ import logging import os from unittest import mock from click.testing import Result from vdk.plugin.test_utils.ingest...
StarcoderdataPython
1652987
<reponame>niveditha8927/Alzheimers-Detection-using-Siamese import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm import tensorflow as tf import pickle from tensorflow.keras import backend as K from tensorflow.keras.layers import Input, Dense, Lambda, Layer, Add, Multiply, add, Activation fro...
StarcoderdataPython
1739823
# -*- coding: utf-8 -*- """ Created on Sat Dec 7 15:30:26 2019 @author: nipun """ """ PROBLEM 4, PART B """ from sklearn.datasets import fetch_lfw_people from sklearn.decomposition import PCA as RandomizedPCA import matplotlib.pyplot as plt import numpy as np faces = fetch_lfw_people(min_fa...
StarcoderdataPython
3232029
''' Author: zhuqipeng Date: 2021-09-04 17:08:24 version: 3.5 LastEditTime: 2021-09-04 17:54:00 LastEditors: zhuqipeng Description: FilePath: \Canny detect\code\Prewitt.py ''' from Gaussian_Kernel import Gaussian_Smooth import numpy as np from conv import conv from Non_maximum import Non_maximum from Hyste...
StarcoderdataPython
1670557
class ListenError(Exception): pass class KanaError(ListenError): pass
StarcoderdataPython
3343018
<filename>xicsrt/visual/xicsrt_2d__matplotlib.py<gh_stars>1-10 # -*- coding:utf-8 -*- """ .. Authors <NAME> <<EMAIL>> <NAME> <<EMAIL>> <NAME> <<EMAIL>> A set of tools for 2d visualization of the XICSRT results """ import numpy as np import logging from matplotlib import pyplot from xicsrt.util import mir...
StarcoderdataPython
1691150
#!/usr/bin/env python3 # coding=utf-8 # ***************************************************** # struts-check: Check for Apache Struts Vulnerability CVE-2017-5638 # based on code from https://github.com/mazen160/struts-pwn # struts-pwn: Apache Struts CVE-2017-5638 Exploit # Author: <NAME> <Mazin AT MazinAhmed DOT net> #...
StarcoderdataPython
86862
# Programa baseado no algoritmo de Zeller, que calcula o dia da semana em que uma determinada data caiu (ou cairá). year = 2017 month = 1 day = 9 def zellerAlgorithm(year, month, day): if month in [1, 2]: y1 = year - 1 m1 = month + 12 else: y1 = year m1 = month y2 = y1 % 10...
StarcoderdataPython
1766980
# Copyright <NAME> 2013. BSD 3-Clause license, see LICENSE file. import sys try: from unittest2 import TestCase, main except ImportError: from unittest import TestCase, main from ..ansi import Fore, Back, Style from ..ansitowin32 import AnsiToWin32 stdout_orig = sys.stdout stderr_orig = sys.stderr class An...
StarcoderdataPython
1731347
<gh_stars>0 import hashlib def toHex(value): return binascii.hexlify(value).upper().decode('utf-8') def hexToByteArray(value): return bytearray.fromhex(value) def toString(value): if isinstance(value, bytes): value = value.decode() elif isinstance(value, bytearray): value = value.deco...
StarcoderdataPython
4826293
import os import xml.etree.ElementTree as ET from .filehandler import FileHandler def get_data_dir(): home_dir = os.environ.get('HOME') data_dir = os.environ.get('XDG_DATA_HOME', os.path.join(home_dir, '.local/share')) data_dir = os.path.join(data_dir, 'eberjand/rom_dats') return data_dir def clean_fi...
StarcoderdataPython
1646389
<filename>wiki_migrate.py<gh_stars>0 """ Generate local wiki files based on Trac DB file. Accepted DB formats: * SQlite3 DB (.db3) * PSQL dump (.psql) """ import os import sqlite3 import subprocess import sys from datetime import datetime from config import USER_MAPPING, DEFAULT_GITHUB_USER, FILE_EXTENSION # Set to ...
StarcoderdataPython
184442
import numpy as np import matplotlib.pyplot as plt import torch from collections import namedtuple Transition = namedtuple('Transition', ('state', 'action', 'next_state', 'reward', 'done')) class DeepRLTrainer: NB_EPISODES = 3000 SAVE_EVERY = 500 INFO_EVERY = 50 SOFT_MAX = False DEVICE = 'cpu'...
StarcoderdataPython
1653561
from PyQt5 import QtGui from pathlib import Path import datetime class PopUp: @staticmethod def question_yes_no(parent, title, message): """ Shows a Pop up question dialog with yes and no buttons. :param parent: Parent window for the dialog. :param title: Title of the dialog. ...
StarcoderdataPython
10554
<filename>apps/dc_tools/odc/apps/dc_tools/fs_to_dc.py<gh_stars>10-100 import json from pathlib import Path import click import datacube from datacube.index.hl import Doc2Dataset from odc.apps.dc_tools.utils import ( index_update_dataset, update_if_exists, allow_unsafe, transform_stac, ) from ._stac imp...
StarcoderdataPython
4949
<filename>src/brewlog/home/__init__.py from flask import Blueprint home_bp = Blueprint('home', __name__) from . import views # noqa
StarcoderdataPython
1736140
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * from . import jims from . import joes counter = 0 # Global class AboutScope(Koan): # # NOTE: # Look in jims.py and joes.py to see definitions of Dog used # for this set of tests # def test_dog_is_not_available_in_th...
StarcoderdataPython
1723906
<reponame>Oueee/SOS import multiprocessing NB_ILOTS = multiprocessing.cpu_count() NB_INDIVUDUALS = 14 ILOTS_LIST = [] PERCENTAGE_TRANSMISSION_STATS = 10
StarcoderdataPython
3288628
<reponame>AngelRuizMoreno/Jupyter_Dock_devel ################################################################################ ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public ## License as published by the Free Software Foundation; either ...
StarcoderdataPython
1671273
from hierarc.Likelihood.SneLikelihood.sne_likelihood import SneLikelihood import pytest import numpy as np class TestSnePantheon(object): def setup(self): np.random.seed(42) # define redshifts num = 30 # number of Sne zcmb = np.linspace(start=0.01, stop=0.8, num=num) zhel...
StarcoderdataPython
11034
<reponame>daquexian/caffe-int8-convert-tools<gh_stars>0 # -*- coding: utf-8 -*- # SenseNets is pleased to support the open source community by making caffe-int8-convert-tool available. # # Copyright (C) 2018 SenseNets Technology Ltd. All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); you...
StarcoderdataPython
3357110
<filename>articals/api.py<gh_stars>1-10 from .models import Artical, Comment from rest_framework import viewsets, permissions from .serializers import ArticalSerializer, CommentSerializer from django.contrib.auth.models import User from accounts.serializers import UserSerializer # artical veiwset class ArticalViewSe...
StarcoderdataPython
3297058
<filename>lineranges/parse_settings.py from .lineranges import Line class Parser(object): def __init__(self): self.input_lines = [] self.out_lines = [] self.current_line = 0 def fromFile(self, filepath): with open(filepath, 'rt') as f: self.fromString(f.read()) ...
StarcoderdataPython
107278
<reponame>revanthsenthil/dCoder_select<filename>Easy/TheySeeMePalindroming.py """ Problem Description: In india there is a puzzle"5 characters my name, reverse- forward is the same." You will be presented with a 5 character String, you have to tell whether it satisfy above puzzle, if yes output "Yes" else "No" Input: ...
StarcoderdataPython
144153
<gh_stars>0 #! /usr/bin/env python # # Probably we are python2, but use python3 syntax as much as possible from __future__ import print_function, unicode_literals import argparse import json import os import subprocess import sys import unittest def setupConfigurableTest(io=10, threads=1, procs=1, usleep=10, pause=1,...
StarcoderdataPython
1616985
#! /usr/bin/env python print 'v2' import os import re import sys import imp import os.path as op import numpy as np import matplotlib import matplotlib.pyplot as plt import pandas as pd # for dprime from scipy.stats import norm from math import exp,sqrt Z = norm.ppf def gather_experiment_info(exp_name=None, dirs=No...
StarcoderdataPython
24807
import unittest from datetime import datetime, timezone from pandas import DatetimeTZDtype from parameterized import parameterized import pandas as pd from aiokraken.utils.timeindexeddataframe import TimeindexedDataframe """ Test module. This is intended for extensive testing, using parameterized, hypothesis or simi...
StarcoderdataPython
130868
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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-...
StarcoderdataPython
57730
<reponame>karthikn72/enhancement-proposals #!/usr/bin/env python3 -u # coding: utf-8 __author__ = ["<NAME>"] __all__ = []
StarcoderdataPython
1648129
<gh_stars>1-10 from __future__ import absolute_import import re class Assignment: def matches(self, expression): ''' >>> assignment = Assignment() >>> assignment.matches('a=5') True >>> assignment.matches(' a = 5 ') True >>> assignment.matches('5=5')...
StarcoderdataPython
93324
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Mon Jun 24 21:22:23 2019 @author: simon """ import os import requests from io import StringIO import pandas as pd from datetime import datetime, date # 爬取資料 def crawl_legal_person(date): # datestr = date.strftime('%Y%m%d') datestr = date...
StarcoderdataPython
1730558
<reponame>tkralphs/FinancialModels<filename>ShortTermFinancing/short_term_financing_data.py ####################################################################### # # # This file is part of a collection developed first for a course in # # financi...
StarcoderdataPython
1696042
<filename>app/runner.py<gh_stars>1-10 #!/usr/bin/env python3 import subprocess, json, sys import logging as log import argparse import os import pprint import uuid import base64 from trivy import Trivy from api import Api from datetime import datetime report = {} def getNamespaces(reportsummary): print('INFO: Lo...
StarcoderdataPython
155052
from pyspark.context import SparkContext from pyspark.sql.session import SparkSession import os from pyspark.sql.functions import col,lit def convert_columns_to_string(schema): print(schema) lst=[] for name in set(schema): lst.append("cast(`{col}` as string) as `{col}`".format(col=name)) ...
StarcoderdataPython
1796012
<gh_stars>1-10 import csvio import numpy as np from sklearn.decomposition import PCA from sklearn import svm X = csvio.load_csv_data("../data/train_inputs.csv") X = np.array(X) y = csvio.load_csv_data("train_outputs.csv") pca = PCA(n_components=500) pcaX = pca.fit_transform(X) X_kaggle = csvio.load_csv_data("test_inp...
StarcoderdataPython
143013
import argparse import ctypes import ipaddress import math import random import signal import socket import selectors import statistics import struct import sys import textwrap import time # The C equivalent of the test header is # struct udpTestHeader_s { # int msgIndex; # int packetIndex; # double timest...
StarcoderdataPython
1692664
# Copyright (c) 2021 Food-X Technologies # # This file is part of foodx_devops_tools. # # You should have received a copy of the MIT License along with # foodx_devops_tools. If not, see <https://opensource.org/licenses/MIT>. from foodx_devops_tools.release_flow_entry import release_flow from tests.ci.support.click_run...
StarcoderdataPython
74581
<gh_stars>10-100 import turtle import random class Point: # I use my point class for convenience def __init__(self, x=0, y=0): self.x = x self.y = y def mid_point(self, target): return Point(0.5 * (self.x + target.x), 0.5 * (self.y + target.y)) Tom = turtle.Turtle() Tom.speed(0...
StarcoderdataPython
3252304
<gh_stars>0 import os import sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) from PIL import Image import logging logging.basicConfig(level=logging.INFO) from pixelsort.main import pixelsort from pixelsort.util import id_generator from pi...
StarcoderdataPython
1600239
<filename>castoredc_api/tests/test_integration/test_special_cases.py from castoredc_api import CastorStudy from castoredc_api.auth import auth_data class TestSpecialCases: """Tests special cases of integration between CastorEDCClient and the CastorObjects that map the study structure and data.""" def tes...
StarcoderdataPython
1627570
<filename>util/DBUtilities.py<gh_stars>0 import sqlalchemy from sqlalchemy.pool import NullPool from dotenv import load_dotenv import os dotenv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '.env')) load_dotenv(dotenv_path) def connect(PoolConnection=False): '''Returns a connection and a me...
StarcoderdataPython
3236732
<reponame>karpierz/libcurl #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | # / __| | | | |_) | | # | (__| |_| | _ <| |___ # ...
StarcoderdataPython
1611580
# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the ""Software""), ...
StarcoderdataPython
1737999
from rcmh import config,group,chain grupo_inicial = group.Group(config.diag_columns,config.groups,None) cadena = chain.Chain(type='poisson',group=grupo_inicial) cadena.walks(100)
StarcoderdataPython
134762
"""Interaction between the reference machinery and content objects.""" import gocept.reference.interfaces import gocept.reference.reference import transaction import zope.component import zope.container.interfaces import zope.interface import zope.location import zope.traversing.api import zope.traversing.interfaces ...
StarcoderdataPython
54163
<filename>pdfmerge/migrations/0003_auto_20190616_1823.py # Generated by Django 2.1.3 on 2019-06-16 12:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pdfmerge', '0002_auto_20190616_1800'), ] operations = [ migrations.RemoveField( ...
StarcoderdataPython
3083
from django.contrib.contenttypes.models import ContentType from rest_framework import serializers, exceptions from greenbudget.lib.rest_framework_utils.fields import ModelChoiceField from greenbudget.lib.rest_framework_utils.serializers import ( EnhancedModelSerializer) from greenbudget.app.budget.models import B...
StarcoderdataPython
3372873
from trainloops.listeners.ae_image_sample_logger import AEImageSampleLogger from trainloops.listeners.model_saver import ModelSaver from trainloops.vae_train_loop import VaeTrainLoop from models.conv28_vaegan.encoder import VAEGANEncoder28 from models.conv28_vaegan.generator import VAEGANGenerator28 from data.celeba_cr...
StarcoderdataPython
1718014
<filename>db_tools/db_tools.py # -*- coding: utf-8 -*- """Main module.""" def test_func(): print("boo!") def new_func(): pass def read_redcap(): pass
StarcoderdataPython
1622064
import unittest from config import * from main import app class TestConfigVariableSetting(unittest.TestCase): def test_testing_app_variables(self): """ tests if app takes correct variables after being set up as test""" self.app = app self.app.config.from_object('config.TestingConfig') ...
StarcoderdataPython
156103
import numpy as np import os import csv import sys import tensorflow as tf import matplotlib.pyplot as plt from sklearn.decomposition import PCA from keras.callbacks import EarlyStopping, Callback from keras.models import Model, Sequential, load_model from keras.layers import Input, Dense, Dropout, Fla...
StarcoderdataPython
139770
import sys import base64 import json import os.path if len(sys.argv) < 3: print("USAGE: pdfp-extract.py [pdfp_path] [output_path]") sys.exit() f = open(sys.argv[1]) pdfp = f.read() f.close() pdfp = pdfp.replace("local_pdf(", "").replace(")", "") pdfp = json.loads(pdfp) pdf = base64.b64decode(pdfp['pdf']) ...
StarcoderdataPython
80663
<gh_stars>0 import matplotlib.pyplot as plt import numpy as np from ezmodel.models.idw import InverseDistanceWeighting from ezmodel.util.sample_from_func import sine_function idw = InverseDistanceWeighting() # create some data to test this model on X, y, _X, _y = sine_function(20, 1000) # let the model fit the data...
StarcoderdataPython
1720028
from types import MethodType from typing import * # noqa: F401 F403 (because of the argspec factory) from typing import Any, Dict, Union, Callable, Iterable, Optional from inspect import Parameter, unwrap, isabstract import inspect import wrapt import typing_extensions # noqa: F401 import pandas as pd from omnipat...
StarcoderdataPython
3336798
import socket servidor = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) servidor.bind(('', 5000)) while True: mensagem_bytes, endereco_ip_client = servidor.recvfrom(2048) mensagem_resposta = mensagem_bytes.decode().upper servidor.sendto(mensagem_resposta.encode(), endereco_ip_client) print(...
StarcoderdataPython
45014
import sys from itertools import permutations read = sys.stdin.readline n = int(read()) arr = list(map(int, read().split())) # 순열로 조합한다. cases = list(permutations(arr)) result = 0 for card in cases: ans = 0 for idx in range(n - 1): ans += abs(card[idx] - card[idx + 1]) result = max(result, ans...
StarcoderdataPython
3270101
<reponame>TeamSerpentine/pycman-release<gh_stars>1-10 """ Date created: 2019/03/15 Python Version: 3.7 License: MIT License Take a look at the pycman repository or the MIT license for more information on the use and reuse of pycman. """ import os from pycman.core.controller.controller import Controll...
StarcoderdataPython
3319341
<reponame>GMLC-TDC/HELICS-Characterization-Tests<gh_stars>0 """ Test suite script to exercise co-simulation platforms and quantify their performance. Currently this suite is able to test both FNCS and HELICS """ ##########################################################################################################...
StarcoderdataPython
1640359
<reponame>stevebob/camkes-cli<gh_stars>0 import multiprocessing import toml from . import common def make_subparser(subparsers): parser = subparsers.add_parser('init', description="Initialize an existing project") parser.add_argument('--jobs', type=int, help="Number of threads to use when downloading code", ...
StarcoderdataPython
76395
<reponame>dbkernel/DrawTiger<gh_stars>0 # coding=utf-8 from turtle import * import time COLOR = '#B2814D' def set_start(x, y, w, c=COLOR): penup() setx(x) sety(y) setheading(towards(0, 0)) width(w) pencolor(c) pendown() speed(0) def left_rotate(time, angle, length)...
StarcoderdataPython
3374028
<gh_stars>10-100 from sklearn.neural_network import MLPClassifier clf = MLPClassifier(solver='lbfgs',alpha=1e-5,max_iter=200,\ activation='relu',hidden_layer_sizes=(10,30,10),\ random_state=1, shuffle=True) clf.fit(XA,yA) yP = clf.predict(XB) assess(yP)
StarcoderdataPython
1689568
from typing import Optional import torch from detectron2.structures import ImageList from torch import nn from torch.nn import functional as F class SeparableConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, padding=1): super().__init__() self.depthwise = nn.Conv2d( ...
StarcoderdataPython
1641588
<reponame>BrnoPCmaniak/netbox import django.db.models.deletion from django.db import migrations, models import ipam.fields class Migration(migrations.Migration): replaces = [('ipam', '0003_ipam_add_vlangroups'), ('ipam', '0004_ipam_vlangroup_uniqueness'), ('ipam', '0005_auto_20160725_1842'), ('ipam', '0006_vrf_...
StarcoderdataPython
3253790
import os from train_utils import get_data import torchvision.utils as vutils from torch.utils.data import DataLoader def generate(dataname, path, save_path, batch_size=64, device='cpu'): dataset = get_data(dataname=dataname, path='../datas/%s' % path) real_loader = DataLoader(dataset=dataset, batch_size=batc...
StarcoderdataPython
3261514
<gh_stars>100-1000 import io import json import boto3 import numpy as np import pandas as pd import requests from PIL import Image, ImageFilter from lib import mwo_image_slicer client = boto3.client('rekognition') #instantiate AWS client test_imgs_path = "E:/MWO/mwo_data/data/test_data/" #test images folder def c...
StarcoderdataPython
3257666
# -*- coding: utf-8 -*- """ Created on Mon Dec 04 10:13:10 2017 @author: PJ """ import numpy as np import matplotlib.pyplot as plt import scipy.io as sio def generate(popSize,m): ''' generate a random Individual for HLO ''' Bpop = np.random.randint(2,size=(popSize,m)) return Bpop def B2R(popSize...
StarcoderdataPython
3343178
<filename>graphs_and_plots/plt_histogram.py import matplotlib.pyplot as plt ages = [10,56,45,78,25,36,95,84,19,65,29,45,78,10,22,55,99,46,50,78,83,93,97,102,103,8,13,58,65,75,12,59,30,56,90,70,40,59,29,34,51,53,82,88] ## HISTOGRAM ## values of x for x in range ages ## uncomment the # ids = [x for x in r...
StarcoderdataPython