id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5033633
import gensim if __name__ == '__main__': print('loading pretrained model') model = gensim.models.KeyedVectors.load_word2vec_format('43/model.txt', binary=False, unicode_errors='replace') model = gensim.models.KeyedVectors.load_word2vec_format('43/model.txt', binary=False, unicode_errors='replace') whil...
StarcoderdataPython
1988818
<reponame>shin5ok/spanner-orm-app<gh_stars>0 #!/usr/bin/env python from sqlalchemy import * import click import os import json import logging from typing import * CONN_STRING: str = os.environ.get("CONN", "") print(CONN_STRING) engine = create_engine("spanner:///"+CONN_STRING) debug_flag: bool = "DEBUG" in os.enviro...
StarcoderdataPython
3248288
<reponame>carium-inc/moto<gh_stars>0 from __future__ import unicode_literals import time import json import boto3 from moto.core import BaseBackend, BaseModel class SecretsManager(BaseModel): def __init__(self, region_name, **kwargs): self.secret_id = kwargs.get('secret_id', '') self.version_i...
StarcoderdataPython
1978428
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django import http from django.shortcuts import render from django.conf import settings def home(request): re...
StarcoderdataPython
6616225
# apps/contact/models.py # Django modules from django.db import models from django.utils.timezone import datetime from django.contrib.auth.models import User # Django locals # Create your models here. class Contact(models.Model): manager = models.ForeignKey(User, on_delete=models.RESTRICT, default=None) name =...
StarcoderdataPython
6475010
""" Creates a tree of digital twins. Creates digital twin documents to a new timestamped folder named "twintree-<timestamp>". Each twin document is created in its own folder as "index.yaml" file. Arguments: 1: The depth of the tree, i.e. the number of relationships from highest to lowest. Must be at least...
StarcoderdataPython
4865405
# Generated by Django 2.0.7 on 2018-07-11 19:42 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ingest', '0007_update-django'), ] operations = [ migrations.RemoveField( model_name='agendaitem', name='meeting_id',...
StarcoderdataPython
11200366
<reponame>zx273983653/vulscan from __future__ import unicode_literals from django.apps import AppConfig class AppscanConfig(AppConfig): name = 'appscan'
StarcoderdataPython
233423
# 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"); you may not u...
StarcoderdataPython
6594903
from pymongo import MongoClient client = MongoClient('localhost', 27020) db = client['machine'] collection = db['posts']
StarcoderdataPython
9642872
import argparse import os import numpy as np import logging from collections import defaultdict import pickle from helpful_functions import readEmbeddings, normalize from mylib import semantic_neighbors def readArgs (): parser = argparse.ArgumentParser (description="Near negihbors for words") parser.add_argument ("-...
StarcoderdataPython
9731339
<gh_stars>1-10 docs_file_path = 'docs/index.html' docs_file_content = open(docs_file_path, 'r').read()[:-len('</html>')] docs_file = open(docs_file_path, 'w') metrika_file_content = open('docs/metrika_code.txt', 'r').read() docs_file.write(docs_file_content + metrika_file_content + '</html>')
StarcoderdataPython
1865559
"""Generate a time space diagram for some networks. This method accepts as input a csv file containing the sumo-formatted emission file, and then uses this data to generate a time-space diagram, with the x-axis being the time (in seconds), the y-axis being the position of a vehicle, and color representing the speed of...
StarcoderdataPython
8195943
<filename>AdelaiDet/detectron2/projects/DensePose/densepose/data/samplers/densepose_uniform.py<gh_stars>0 # Copyright (c) Facebook, Inc. and its affiliates. import random import torch from .densepose_base import DensePoseBaseSampler class DensePoseUniformSampler(DensePoseBaseSampler): """ Samples DensePose ...
StarcoderdataPython
11385399
# -*- coding: utf-8 -*- """ bromelia.exceptions ~~~~~~~~~~~~~~~~~~~ This module implements the central Diameter application object. It works as per Peer State Machine defined in RFC 6733 in order to establish a Diameter association with another Peer Node. :copyright: (c) 2020-present <NAM...
StarcoderdataPython
11296209
<filename>orchestra/contrib/contacts/filters.py from django.contrib.admin import SimpleListFilter from django.utils.translation import ugettext_lazy as _ from .models import Contact class EmailUsageListFilter(SimpleListFilter): title = _("email usages") parameter_name = 'email_usages' def lookups(se...
StarcoderdataPython
8140351
import pytest from hypothesis import given, strategies as st from antidote import Tag, Tagged from antidote.core import DependencyContainer, DependencyInstance from antidote.exceptions import DependencyNotFoundError, DuplicateTagError from antidote.providers.tag import TaggedDependencies, TagProvider class Service: ...
StarcoderdataPython
1913668
<gh_stars>0 """_app URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Cl...
StarcoderdataPython
8017325
<filename>2020/Day 02/part1.py<gh_stars>1-10 answer = 0 with open("input.txt", 'r', encoding="utf-8") as file: for line in file: boundaries, charecter, string = line.split() lowest, highest = map(int, boundaries.split('-')) charecter = charecter.rstrip(':') if lowest <= string.cou...
StarcoderdataPython
4918585
<reponame>AlexGolovaschenko/PoultryCam<gh_stars>0 from django.contrib import admin from .models import Photo, PhotoMetaData class PhotoMetaDataInline (admin.StackedInline): model = PhotoMetaData class PhotoAdmin (admin.ModelAdmin): list_display = ['__str__', 'upload_date', 'marker'] inlines = [PhotoMetaDataInli...
StarcoderdataPython
6452880
from flask import Blueprint, send_from_directory from os.path import dirname, join blueprint = Blueprint('controller', __name__) rootDir = join(dirname(dirname(__file__)), 'web') dbDir = join(dirname(dirname(__file__)), 'db') @blueprint.route('/') def root(): return send_from_directory(rootDir, 'index.html') @b...
StarcoderdataPython
8063543
import os from django.contrib.sites.models import Site one = Site.objects.all()[0] one.domain = os.environ.get('DOMAIN') one.name = os.environ.get('NAME') one.save()
StarcoderdataPython
3348725
<gh_stars>10-100 from rest_framework import serializers from .models import Invoice, Item class ItemSerializer(serializers.ModelSerializer): class Meta: model = Item read_only_fields = ( "invoice", ) fields = ( "id", "title", "quan...
StarcoderdataPython
246715
""" Stat objects make life a little easier """ class CoreStat(): """ Core stats are what go up and down to modify the character """ def __init__(self, points=0): points = int(points) if points < 0: points = 0 self._points = points self._current = self.base s...
StarcoderdataPython
4842704
import ipyparallel class remote_iterator: """Return an iterator on an object living on a remote engine.""" def __init__(self, view, name): self.view = view self.name = name def __iter__(self): return self def __next__(self): it_name = '_%s_iter' % self.name sel...
StarcoderdataPython
5045278
<gh_stars>10-100 # Derived from: https://gist.githubusercontent.com/stantonk/b0a937ca9c035a83b14c/raw/bff09b6977579057cec7812e41d2e486a07a14b2/get_valid_tlds.py # <NAME>, Jask Labs Inc. # Jan 2017 # requirements.txt # pip install requests # pip install BeautifulSoup4 import codecs import requests from bs4 import Beaut...
StarcoderdataPython
1830822
from ._auto_fight import AutoFight from ._normal_fight import NormalFight from kf_lib.ui import cls, pak, yn def get_prefight_info(side_a, side_b=None, hide_enemy_stats=False, basic_info_only=False): fs = side_a[:] if side_b: fs.extend(side_b) s = '' first_fighter = fs[0] size1 = max([len(...
StarcoderdataPython
8067331
<gh_stars>0 from xmlrpc.server import SimpleXMLRPCServer import argparse import threading import shelve from typing import * class Server: _rpc_methods_ = ['add', 'delete', 'run', 'check', 'duels'] def __init__(self, address): self._strategies = shelve.open('ten_castles') self._srv = SimpleXM...
StarcoderdataPython
1869340
<filename>Ejercicios/Escritura de archivos.py try: f = open("new.txt","r") print("Archivo") except: exit() print("Error") #leer archivo #print(f.read()) #rint(f.read(50)) #print("Nueva linea",f.readline()) while True: print(f.readline()) if f.readline() == "": break ...
StarcoderdataPython
1840266
<reponame>mail2nsrajesh/python-monascaclient<filename>examples/check_monasca.py<gh_stars>0 #!/usr/bin/env python # # (C) Copyright 2016 Hewlett Packard Enterprise Development LP # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You ma...
StarcoderdataPython
1823170
<reponame>jshower/models #Copyright (c) 2016 PaddlePaddle 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 # # U...
StarcoderdataPython
1619933
<gh_stars>0 from RemoveWindowsLockScreenAds.RemoveWindowsLockScreenAds import GetAdSettingsDirectory, AdRemover
StarcoderdataPython
336315
# This script will track two lists through a 3-D printing process # Source code/inspiration/software # Python Crash Course by <NAME>, Chapter 8, example 8+ # Made with Mu 1.0.3 in October 2021 # Start with a list of unprinted_designs to be 3-D printed unprinted_designs = ['iphone case', 'robot pendant', '...
StarcoderdataPython
9687999
<reponame>goubertbrent/oca-backend # -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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/LICE...
StarcoderdataPython
4800896
# Generated by Django 3.1.2 on 2021-07-29 18:25 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('permission', '0004_auto_20210729_1815'), ] operations = [ migrations.AlterField( model_name='me...
StarcoderdataPython
11252280
from robot import logging,Conversation import numpy as np logger = logging.getLogger(__name__) def active(): global times, cuple list = [] time_list = [] days = [] t_dict = {} l = [] # 获取保存激活log里面的每一行 logs = logging.read_active_log().splitlines() # 进行遍历取值,进行切片,保留后面的时间 for log i...
StarcoderdataPython
1888405
<reponame>MihailMarkovski/Python-Advanced-2020<filename>Exams/Exam _27_June_2020/03_list_manipulator.py from collections import deque def list_manipulator(numbers, command, side, *args): new_list = deque(numbers) if command == 'add': new_nums = list(args) if side == 'beginning': ne...
StarcoderdataPython
1734527
# package org.apache.helix.store #from org.apache.helix.store import * class PropertyStat: """ """ def __init__(self): this(0, 0) """ Parameters: long lastModifiedTime int version """ def __init__(self, lastModifiedTime, version): _lastModifiedTime =...
StarcoderdataPython
157395
from pysal.common import simport, requires from pysal.cg import asShape from pysal.contrib import pdutilities as pdio from pysal.core import FileIO import pandas as pd class Namespace(object): pass @requires('geopandas') def geopandas(filename, **kw): import geopandas return geopandas.read_file(filename, ...
StarcoderdataPython
3295187
<filename>sensor.community/real-time-plotting.py #setting up packages import pandas as pd import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation import plotly.express as px import datetime import wget import os date = datetime.date.today() date = str(date) filename = 'data-esp8266-12776407-'+ ...
StarcoderdataPython
6471916
import glob import os import re import yaml from oonib import errors as e from oonib.handlers import OONIBHandler from oonib import log from oonib.config import config class DeckDescHandler(OONIBHandler): def get(self, deckID): # note: # we don't have to sanitize deckID, because it's already chec...
StarcoderdataPython
6586447
# Image processing library functions import numpy as np from img_lib import list_images, rotate_image, translate_image, shear_image from img_lib import change_brightness_image, motion_blur_image, scale_image def random_transform_image(image): if np.random.randint(2) == 0: return image transfo...
StarcoderdataPython
9633248
<reponame>butaihuiwan/meiduo_demo<gh_stars>0 from django.conf import settings from django.contrib.auth.models import AbstractUser from django.db import models from itsdangerous import TimedJSONWebSignatureSerializer, BadData # Create your models here. class User(AbstractUser): mobile = models.CharField(max_len...
StarcoderdataPython
9781618
<filename>CPAC/randomise/pipeline.py from CPAC.pipeline import nipype_pipeline_engine as pe import nipype.interfaces.utility as util from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, traits, File, TraitedSpec from nipype.interfaces import fsl from nilearn import input_data, masking, image, data...
StarcoderdataPython
5126537
#!/usr/bin/env python3 from ply import lex _SINGLE_QUOTE = "'" _DOUBLE_QUOTE = '"' tokens = ( 'IMPORT_EXPRESSION_START', 'IMPORT_EXPRESSION_END', 'STRING_OR_BYTES_LITERAL', 'STRING_LITERAL', 'BYTES_LITERAL', 'STRING_PREFIX', 'SHORT_STRING', 'LONG_STRING', 'SHORT_STRING_ITEM', 'LONG_STRING_ITEM', 'SHO...
StarcoderdataPython
57176
<gh_stars>1-10 from django.apps import AppConfig class SupplementaryContentConfig(AppConfig): name = "supplementary_content" verbose_name = "Supplementary content for regulations"
StarcoderdataPython
91942
# -*- coding: utf-8 -*- from tests.utils import fix_bs4_parsing_spaces from tests.data.dummy import LINKS def test_anchor_format(): """Test annotate elements with default and manipulated config.""" RLINKS = [ {"A": {"type": "letterA", "score": 42}}, {"AA": {"type": "letterA", "score": 42}}...
StarcoderdataPython
9765759
<gh_stars>10-100 # Copyright (C) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of ...
StarcoderdataPython
32246
<filename>multi_parser/shared/__init__.py from .request import * from .response import *
StarcoderdataPython
66913
<gh_stars>1-10 """ Curricula for M6 Milestone In this curriculum, we cover the following: * Object vocabulary: “mommy, daddy, baby, book, house, car, water, ball, juice, cup, box, chair, head, milk, hand, dog, truck, door, hat, table, cookie, bird” * Modifier vocabulary: basic color terms (red, blue, green, white, blac...
StarcoderdataPython
219816
""" BSD 3-Clause License Copyright (c) 2017, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions an...
StarcoderdataPython
1675695
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2012 OpenStack Foundation. # 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....
StarcoderdataPython
11346354
<reponame>tlambert-forks/pyclesperanto_prototype<filename>tests/test_sum_z_projection.py<gh_stars>10-100 import pyclesperanto_prototype as cle import numpy as np def test_sum_z_projection(): test1 = cle.push(np.asarray([ [ [1, 0, 0, 0, 9], [0, 2, 0, 8, 0], [3, 0, 1, 0, 1...
StarcoderdataPython
1682777
<filename>tests/m2m_through/tests.py from datetime import datetime from operator import attrgetter from django.db import IntegrityError from django.test import TestCase from .models import ( CustomMembership, Employee, Event, Friendship, Group, Ingredient, Invitation, Membership, Person, PersonSelfRefM2M, Rec...
StarcoderdataPython
11281999
<filename>tensornet/models/__init__.py from .base_model import BaseModel from .resnet import ( ResNet, resnet18, resnet34, resnet50, resnet101, resnet152, resnext50_32x4d, resnext101_32x8d, wide_resnet50_2, wide_resnet101_2, ) from .dsresnet import DSResNet from .mobilenetv2 import MobileNetV2, mobilenet_v2...
StarcoderdataPython
4876957
import torch from torch import nn class ConvBNLayer(nn.Module): def __init__(self, cin, cout, ksize): super(ConvBNLayer, self).__init__() self.conv = nn.Conv2d(cin, cout, ksize, padding=1) self.bn = nn.BatchNorm2d(cout) self.relu = nn.ReLU() def forward(self, x): x = self.conv(x) x = sel...
StarcoderdataPython
365834
<gh_stars>0 # !/usr/bin/env python3 # -*- config: utf-8 -*- from tkinter import * # Напишите программу, в которой на главном окне находятся холст и кнопка # "Добавить фигуру". Кнопка открывает второе окно, включающее четыре поля для ввода # координат и две радиокнопки для выбора, рисовать ли на холсте прямоу...
StarcoderdataPython
6610285
from . import FixtureTest class EarlyFootway(FixtureTest): def test_footway_unnamed_national(self): # highway=footway, no name, route national (Pacific Crest Trail) self._run_test( ['https://www.openstreetmap.org/way/83076573', 'https://www.openstreetmap.org/relation/1225...
StarcoderdataPython
1890274
import unittest from metaheuristic_algorithms.firefly_algorithm import FireflyAlgorithm from metaheuristic_algorithms.function_wrappers.nonsmooth_multipeak_function_wrapper import NonsmoothMultipeakFunctionWrapper class TestFireflyAlgorithm(unittest.TestCase): def test_find_glocal_maximum_for_nonsmooth_multipeak_...
StarcoderdataPython
4891001
# Generated by Django 3.0.6 on 2020-06-01 17:08 import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('lots', '0002_auto_20200601_1708'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
3256020
from pyCardDeck import * # noinspection PyPep8Naming def test_BaseCard(): card = BaseCard("BaseCard") assert str(card) == "BaseCard" assert repr(card) == "BaseCard({'name': 'BaseCard'})" # noinspection PyPep8Naming def test_PokerCard(): card = PokerCard("Hearts", "J", "Jack") assert str(card) ==...
StarcoderdataPython
5086955
# -*- coding: utf-8 ; test-case-name: bridgedb.test.test_configure -*- # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: please see the AUTHORS file for attributions # :copyright: (c) 2013-2015, Isis Lovecruft # (c) 2013-2015, <NAME> # (c) 2007-2015, <NAME> # ...
StarcoderdataPython
6652975
import traceback from copy import deepcopy from alarm.page.ding_talk import DingTalk from hupun_operator.page.warehouse.extra_store_query import ExtraStoreQuery from hupun_operator.page.warehouse.extra_store_setting import ExtraStoreSetting from hupun_slow_crawl.model.es.store_house import StoreHouse from mq_handler.b...
StarcoderdataPython
3395407
#!/usr/bin/env python3 "" z = '' x = "m" """ Documentation # a comment inside of a documentation comment """ def test(): print('##nope#####') ''' documentation #another comment inside of a documentation comment \" \''' \''\' \'\'' ''' x = "#not a comment" y = "# and another non-comment" z = '#not a comment' y ...
StarcoderdataPython
6654455
""" ## SCRIPT HEADER ## Created By : <NAME> Email : <EMAIL> Start Date : 02 May 2021 Info : """ import FrMaya.core as fmc import pymel.core as pm def select_joint_from_skincluster(): sel = pm.ls(os = True) skin_nodes = [] for o in sel: skin_nodes.extend(fmc.get_skincluster_nod...
StarcoderdataPython
1929081
<reponame>Leaflowave/PrivCQ<gh_stars>0 import group_frequency_oracle as freq import linecache import random def query_on_adult_dim2(oraclePath,oracleInterval,queryPath,trueOraclePath,aggregation="count"): # adult_2 equal 5 and 7 queriesStr=linecache.getline(queryPath,1) queries=eval(queriesStr) ...
StarcoderdataPython
6447421
<reponame>Darlingcris/Desafios-Python<filename>desafio086b.py<gh_stars>0 #Crie um programa que declare uma matriz de dimensão 3×3 e preencha com valores lidos pelo teclado. No #final, mostre a matriz na tela, com a formatação correta. matriz=[[],[],[]] for n in range(0,3): valor=int(input(f"Digite um valor para...
StarcoderdataPython
4876363
<reponame>Chenct-jonathan/LokiHub #!/usr/bin/env python3 # -*- coding:utf-8 -*- from pprint import pprint import os import json from latent_search_engine import se from nlu.IOHbot import LokiResult, runLoki from linebot.models import ( MessageEvent, TextMessage, TextSendMessage, ) from linebot.exceptions import ( ...
StarcoderdataPython
317089
<reponame>stevemk14ebr/swiffas from . import swfparse from . import avm2 # make top level parsers also module top level from .swfparse import SWFParser from .avm2 import ABCFile
StarcoderdataPython
9605318
<gh_stars>0 from .np_blockwise import blockwise_expand, blockwise_contract from .np_rand3drot import random_rotation_matrix from .scipy_hungarian import linear_sum_assignment from .gph_uno_bipartite import uno #from .mpl import plot_coord from .misc import (distance_matrix, update_with_error, standardize_efp_angles_uni...
StarcoderdataPython
11249974
# Copyright 2021 <NAME>, alvarobartt @ GitHub # See LICENSE for details. import streamlit as st import requests from utils import image2tensor, prediction2label from constants import REST_URL, MAPPING # General information about the UI st.title("TensorFlow Serving + Streamlit! ✨🖼️") st.header("UI to use a TensorFl...
StarcoderdataPython
1906601
import tensorflow as tf import _pickle as cPickle from .format import CocoMeta,PoseInfo def generate_train_data(train_imgs_path,train_anns_path,dataset_filter=None,input_kpt_cvter=lambda x: x): # read coco training images contains valid people data = PoseInfo(train_imgs_path, train_anns_path, with_mask=True, d...
StarcoderdataPython
9612954
"""Tests for editorial app."""
StarcoderdataPython
304981
<reponame>w-cheng/docker-nlp # Copyright (c) Jupyter Development Team. from jupyter_core.paths import jupyter_data_dir import subprocess import os import errno import stat c = get_config() c.NotebookApp.ip = '*' c.NotebookApp.port = 8888 c.NotebookApp.open_browser = False c.NotebookApp.token = '' # Set a password if ...
StarcoderdataPython
3572458
import numpy as np import pandas as pd import random import time from sklearn.utils import shuffle import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import random from torch.utils.data import DataLoader from torch.nn.functional import relu,leaky_relu from torch.nn import Lin...
StarcoderdataPython
347087
<gh_stars>1-10 #!/usr/bin/env python3 import gym import numpy as np import tensorflow as tf import tensorflow.contrib.summary # Needed to allow importing summary operations class Network: def __init__(self, threads, seed=42): # Create an empty graph and a session graph = tf.Graph() graph.se...
StarcoderdataPython
8005888
<gh_stars>1-10 from distutils.core import setup setup(name='again', version='1.2.20', author='<NAME>', author_email='<EMAIL>', url='https://github.com/kashifrazzaqui/again', description='Python decorators for type and value checking at runtime. Also, some boilerplate code for making class...
StarcoderdataPython
6539112
# Natural Language Toolkit: Dependency Trees # # Author: <NAME> <<EMAIL>> # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT
StarcoderdataPython
3210011
""" We will use this script to perform measurements on the library. Also maybe we can use it to implement certain managmenet tasks. """ from rfeature import types from rfeature import util import argparse def init_args(): ap=argparse.ArgumentParser(description=__doc__) ap.add_argument("-v","--verbose",require...
StarcoderdataPython
1939726
<gh_stars>10-100 #!/usr/bin/env python3 import datetime import os import subprocess import sys import tempfile import warnings from Bio import SeqIO from Bio.Seq import Seq #====================================================================================================================== GFFREAD = 'gffread -C ...
StarcoderdataPython
9617215
print('Importing libs...') import pandas as pd # Import local libraries import sys sys.path.append('.') from TFIDF import TFIDF from W2V import W2V from KDTREE import KDTREE if __name__ == '__main__': print('-' * 80) print('Reading files...') faq = pd.read_csv('../data/interim/faq-text-separated.csv',...
StarcoderdataPython
9659502
# pylint: disable=unused-argument,redefined-outer-name import os from pathlib import Path import pytest from aiida.manage.tests import TestManager @pytest.fixture(scope="session") def top_dir() -> Path: """Return Path instance for the repository's top (root) directory""" return Path(__file__).parent.parent....
StarcoderdataPython
1685216
import difflib import json import logging import os import re from typing import Dict, Pattern from . import Wrapper from .Events import * RegexMatches = List[Match[str]] class TextProcessor(object): def __init__(self, wrapper: "Wrapper.Wrapper"): """ Initializes a new text processor :p...
StarcoderdataPython
95333
import csv import os import sys import time import numpy as np import matplotlib.pyplot as plt from path import Path from vector_math import * from find_matches import * from file_paths import * #******************** #**** this function reads a CSV file and returns a header, and a list that has been converted to fl...
StarcoderdataPython
11257239
<filename>kaishi_chushibanben.py import logging from logging.handlers import RotatingFileHandler from flask import Flask from flask.ext.wtf import CSRFProtect from flask_sqlalchemy import SQLAlchemy from redis import StrictRedis from flask_session import Session from flask_migrate import Migrate,MigrateCommand from fla...
StarcoderdataPython
8096042
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: <NAME> # @Date: 2015-10-16 10:06:16 # @Last Modified by: codykochmann # @Last Modified time: 2015-10-16 11:53:14 bashrc_file="~/.bashrc" bash_aliases_file="~/.bash_aliases" remote_alias_link="http://bit.ly/codys-aliases" def append_to_file(filename,input_s...
StarcoderdataPython
624
import numpy as np import argparse import composition import os import json import torch from spinup.algos.pytorch.ppo.core import MLPActorCritic from spinup.algos.pytorch.ppo.ppo import ppo from spinup.utils.run_utils import setup_logger_kwargs from spinup.utils.mpi_tools import proc_id, num_procs def parse_args()...
StarcoderdataPython
393410
<gh_stars>1-10 """ Test similarities ----------------- Collection of tests for the similarities module. """ import numpy as np from ..Similarities.aux_functions import KL_divergence, average_prob,\ Jensen_Shannon_divergence from ..Similarities.dtw import dtw from ..Similarities.magnitude_similarities import gene...
StarcoderdataPython
1647924
""" Manually subscribing each :mod:`Source <snsary.sources.source>` to each :mod:`Output <snsary.outputs.output>` is repetitive, especially when there are multiple Outputs. MultiSource combines multiple Sources as one. Just like a :mod:`Sensor <snsary.sources.sensor>`, a MultiSource also exposes a stream to make it eas...
StarcoderdataPython
8103991
<reponame>ndrplz/computer_vision_utils<filename>tensor_manipulation.py import cv2 import numpy as np def resize_tensor(tensor, new_shape): """ Resize a numeric input 3D tensor with opencv. Each channel is resized independently from the others. Parameters ---------- tensor: ndarray Num...
StarcoderdataPython
6405074
"""### Data Pre-processing""" # Commented out IPython magic to ensure Python compatibility. # Importing Modules import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt # %matplotlib inline from tqdm import tqdm from sklearn.experimental import enable_iterative_imputer from sklea...
StarcoderdataPython
1885480
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-11-12 14:11 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateM...
StarcoderdataPython
3333988
import os import sys import glob import csv import pandas as pd def mkdir_fol(path): if not os.path.exists(path): os.mkdir(path) out_dir = os.environ.get('OUT_DIR') if out_dir is None: out_dir = "../data/output" in_fol = str(out_dir)+'/heatmap_txt' out_fol = str(out_dir)+'/heatmap_txt_3classes_separ...
StarcoderdataPython
11214757
<reponame>manailin/facebookresearch-ParlAI # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the ...
StarcoderdataPython
6490387
# coding=utf-8 from setuptools import find_packages, setup import pathlib import os MAIN_DIR = pathlib.Path(__file__).absolute().parent def get_packages(): base_file = MAIN_DIR / "requirements" / "base.in" response = [] with base_file.open("r") as file: for line in file: line = line...
StarcoderdataPython
1986005
<gh_stars>10-100 # Author: <NAME>, TU Darmstadt (<EMAIL>) # Parts of this code were adapted from https://github.com/NVlabs/pacnet import copy import torch import pac class NormalizedPacConv2d(pac.PacConv2d): """Implements a pixel-adaptive convolution with advanced normalization.""" def __init__(self, ...
StarcoderdataPython
4940297
<reponame>OpenGeoscience/data_queues<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware Inc. and Epidemico Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this fi...
StarcoderdataPython
6598249
<filename>chargebee/compat.py<gh_stars>10-100 import sys try: import simplejson as json except ImportError: import json py_major_v = sys.version_info[0] py_minor_v = sys.version_info[1] if py_major_v < 3: from urllib import urlencode from urlparse import urlparse elif py_major_v >= 3: from urlli...
StarcoderdataPython
4824730
<reponame>JBlaschke/lcls2<gh_stars>0 """ Smalldata (v2) Parallel data analysis with MPI send/recv Analysis consists of two different process types: 1. clients > these perform per-event analysis > are associted with one specific server > after processing `batch_size` events, send a dict of data over...
StarcoderdataPython
11302269
import cv2 import numpy as np #Read the Rust Photograph img = cv2.imread(r'C:\Users\HP\imageprocessing\resources\rust-1-e1488346306943-1288x724.jpg', 1) #Set different boundaries for different shades of rust boundaries1 = [ ([58, 57, 101], [76, 95, 162]) ] boundaries2 = [ ([26, 61, 111], [81, 144, 202]) ] bo...
StarcoderdataPython