id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
3467324 | <reponame>aivazis/ampcor
# -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
# parasim
# (c) 1998-2021 all rights reserved
#
# pull the action protocol
from ..shells import action
# and the base panel
from ..shells import command
# pull in the command decorator
from .. import foundry
# commands
@foundry(implements=action,... | StarcoderdataPython |
1873136 | <reponame>amcclead7336/Enterprise_Data_Science_Final<filename>venv/lib/python3.8/site-packages/vsts/test/v4_0/models/suite_entry.py<gh_stars>0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the... | StarcoderdataPython |
322006 | <filename>istio/datadog_checks/istio/metrics.py
# (C) Datadog, Inc. 2020 - Present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
GENERIC_METRICS = {
'go_gc_duration_seconds': 'go.gc_duration_seconds',
'go_goroutines': 'go.goroutines',
'go_info': 'go.info',
'go_memstats_al... | StarcoderdataPython |
8169604 | # https://hackernoon.com/gradient-boosting-and-xgboost-90862daa6c77
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.metrics import classification_report
import numpy as np
import matplo... | StarcoderdataPython |
6413789 | <reponame>dave-tucker/hp-sdn-client
#!/usr/bin/env python
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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:/... | StarcoderdataPython |
8093794 | <gh_stars>10-100
# ===============================================================================
# Copyright 2021 ross
#
# 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.... | StarcoderdataPython |
3516081 | <gh_stars>0
class ErrorLog:
def __init__(self, _servername, _timestamp, _type, _msg):
self.servername = _servername
self.timestamp = _timestamp
self.typ = _type
self.msg = _msg
def get_servername(self):
return self.servername
def get_timestamp(self):
... | StarcoderdataPython |
5088990 | import torch
def log_likelihood(nbhd_means, feature_means, feature_vars, k, past_comps = []):
# given neighborhood expression data, construct likelihood function
# should work in pytorch
n_samples = nbhd_means.shape[0]
nbhd_means = torch.tensor(nbhd_means).double()
feature_means = torch.tensor(fe... | StarcoderdataPython |
390346 | from django.urls import path
from . import views as v
app_name = 'core'
urlpatterns = [
path('', v.index, name='index'),
path('form_submit', v.form_submit, name='form_submit'),
path('api/pokemon/<slug:slug>', v.get_pokemon, name='get_pokemon'),
] | StarcoderdataPython |
47806 | # encoding: utf-8
import os
import re
import sys
import gzip
import time
import json
import socket
import random
import weakref
import datetime
import functools
import threading
import collections
import urllib.error
import urllib.parse
import urllib.request
import collections.abc
import json_dict
from . import util... | StarcoderdataPython |
6528648 | <filename>python_examples/util.py
from itertools import islice
import numpy as np
def data_generator(files, batch_size, n_classes):
while 1:
lines = []
for file in files:
with open(file,'r',encoding='utf-8') as f:
header = f.readline() # ignore the header
... | StarcoderdataPython |
1662948 | import re
import random
import requests
import table
import user_agent_list
from bs4 import BeautifulSoup
class HtmlPage:
user_agent_number = 7345
def __init__(self, url):
self.url = url
def get_html(self, creds, proxy_pass):
have_a_try = 3
if not proxy_pass:
... | StarcoderdataPython |
12822 | from django.urls import reverse
from rest_framework import status
from .base import BaseTestCase
class FollowTestCase(BaseTestCase):
"""Testcases for following a user."""
def test_follow_user_post(self):
"""Test start following a user."""
url = reverse('follow', kwargs={'username': 'test2'})
... | StarcoderdataPython |
9676225 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: <NAME>
# Description : FFT Baseline Correction
import sys, os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, SpanSelector
from matplotlib import gridspec
import scipy.fftpack
... | StarcoderdataPython |
3201542 | ##########################################################################
# Geometry data
##
class GeometryData:
""" Class which holds the geometry data of a ObjId
"""
def __init__(self, subdetid = 0, discriminator = ()):
self.subdetid = subdetid
self.discriminator = discriminator
# ObjI... | StarcoderdataPython |
1770434 | from os import path
import sys
sys.path.append(path.join(path.dirname(__file__), path.pardir, path.pardir))
| StarcoderdataPython |
109858 | import pandas as pd
import seaborn as sns
from datetime import datetime
import matplotlib.patches as patches
from ..common import log
from ..util.completion import completion_idx_has_data
def completion_plot(completion, modalities, start, end, freq,
ax=None, cmap=None, x_tick_mult=24, x_tick_fmt="%y-%m-%d %H:%M",... | StarcoderdataPython |
4993721 | <reponame>parsoyaarihant/CS726-Project-2048-Using-RL<gh_stars>0
import random
import logic
import constants as c
class GameGrid():
def __init__(self):
self.commands = {c.KEY_UP: logic.up, c.KEY_DOWN: logic.down,
c.KEY_LEFT: logic.left, c.KEY_RIGHT: logic.right,
... | StarcoderdataPython |
6582731 | <filename>psydac/linalg/tests/test_pcg.py
import numpy as np
import pytest
#===============================================================================
@pytest.mark.parametrize( 'n', [8, 16] )
@pytest.mark.parametrize( 'p', [2, 3] )
def test_pcg(n, p):
"""
Test preconditioned Conjugate Gradient algorithm o... | StarcoderdataPython |
3533318 | from mathlib.math import CustomMath
def test_sum_two_arguments():
first = 2
second = 11
custom_math = CustomMath()
result = custom_math.sum(first,second)
assert result == (first+second)
| StarcoderdataPython |
8000389 | <gh_stars>1-10
"""
Create doc-doc edges
Steps:
1. Load all entities with their relations
2. Load relevant relations
3. Create adjacency matrix for word-word relations
4. Count number of relation between two documents
5. Weight relations and set a doc-doc edge weight
"""
from collections import defaultdict
from math im... | StarcoderdataPython |
9746323 | from django.contrib import admin
from common.actions import make_export_action
from search.models.alias import Alias
from search.models import SuggestionLog
from search.models.session_alias import SessionAlias
class AliasAdmin(admin.ModelAdmin):
list_display = ('id', 'alias', 'target')
actions = make_export_... | StarcoderdataPython |
11299897 | <filename>L1Trigger/L1TCalorimeter/python/hackConditions_cff.py
#
# hachConditions.py Load ES Producers for any conditions not yet in GT...
#
# The intention is that this file should shrink with time as conditions are added to GT.
#
import FWCore.ParameterSet.Config as cms
import sys
from Configuration.Eras.Modifier_... | StarcoderdataPython |
1678043 | <reponame>HSunboy/hue<filename>desktop/core/ext-py/eventlet-0.21.0/eventlet/hubs/poll.py<gh_stars>1-10
import errno
import sys
from eventlet import patcher
select = patcher.original('select')
time = patcher.original('time')
from eventlet.hubs.hub import BaseHub, READ, WRITE, noop
from eventlet.support import get_errn... | StarcoderdataPython |
11263779 | # class Node:
# def __init__(self,value,next= None):
# self.value = value
# self.next = next
# class LinkedList:
# def __init__(self, head= None):
# self.head = head
# def __str__(self):
# current = self.head
# output = ""
# while current is not None:
# ... | StarcoderdataPython |
6521537 | """Generating spectra with Fluctuating Gunn Peterson Approximation (FGPA)
- The code is MPI working on Illustris and MP-Gadget snapshots. The packages needed are :
- astropy
- fake_spectra
To get the FGPA spectra, refer to the helper script at
https://github.com/mahdiqezlou/LyTomo_Watershed/tree/dist/helper... | StarcoderdataPython |
1652657 | from flask import Flask
# from config import Config
app = Flask(__name__)
from application import routes | StarcoderdataPython |
9793758 | <gh_stars>1-10
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from benchmarks import media_router_dialog_metric
from benchmarks import media_router_cpu_memory_metric
from telemetry.page import page_test
... | StarcoderdataPython |
1643201 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os.path
MPATH = "44'/77'/"
WIF_PREFIX = 212 # 212 = d4
MAGIC_BYTE = 30
TESTNET_WIF_PREFIX = 239
TESTNET_MAGIC_BYTE = 139
DEFAULT_PROTOCOL_VERSION = 70913
MINIMUM_FEE = 0.0001 # minimum QMC/kB
starting_width = 933
starting_height = 666
... | StarcoderdataPython |
124186 | from pathlib import Path
import configparser
from logger import logger
def change_config(**options):
"""takes arbitrary keyword arguments and
writes their values into the config"""
# overwrite values
for k, v in options.items():
config.set('root', k, v)
# write back, but without the mand... | StarcoderdataPython |
6501686 | <filename>arachnado/downloadermiddlewares/droprequests.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import warnings
from scrapy.exceptions import IgnoreRequest
class DropRequestsMiddleware:
"""
Downloader middleware to drop a requests if a certain condition is met.
It calls ``spider.... | StarcoderdataPython |
9617432 | <filename>django_cloud_deploy/cli/prompt.py
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | StarcoderdataPython |
12838605 | <reponame>SMAKSS/processout-python
try:
from urllib.parse import quote_plus
except ImportError:
from urllib import quote_plus
import processout
from processout.networking.request import Request
from processout.networking.response import Response
# The content of this file was automatically generated
class ... | StarcoderdataPython |
3259759 | import errno
import os
from pyclfsm import State, StateMachine, StateVariable, StateMachineVariable, Visitor
def main(output):
state_machine_variables = [StateMachineVariable('int', 'currentState', 'state no')]
state_machine_includes = '''#include <iostream>
#include <cmath>
#include "CLMacros.h"
'''
on... | StarcoderdataPython |
9665993 | from nilearn.image import resample_img
import nibabel as nib
import os
import numpy as np
datafolder = "/Users/Joke/Desktop/validating-fmri/data"
subs = list(np.unique([x.split("_")[0] for x in os.listdir(os.path.join(datafolder,"CNP_rest"))]))
for sub in subs:
anatfile = os.path.join(datafolder,"CNP_rest/%s_T1w... | StarcoderdataPython |
6668523 | <gh_stars>1-10
from config import Config
from dd_tensorflow_model import Code2VecModel
import sm_helper as hp
###############################################################
g_model = None
g_all_data = []
g_cnt_dict = {}
###############################################################
if __name__ == '__main__':
... | StarcoderdataPython |
1672058 | <reponame>aleonlein/acq4
from __future__ import print_function
from mmstage import MicroManagerStage
| StarcoderdataPython |
323641 | from django.apps import AppConfig
class Models3CwappConfig(AppConfig):
name = 'models3cwapp'
| StarcoderdataPython |
9793558 | <filename>Extraction_quizlet3.py
from util import *
from document_reader import *
import os
folder_name = '/shared/kairos/Data/LDC2020E30_KAIROS_Quizlet_3_Source_Data_and_Graph_G/data/source/ltf/ltf/'
documents = list()
for tmp_file_name in os.listdir(folder_name):
if 'xml' in tmp_file_name:
extracted_data... | StarcoderdataPython |
184736 | """ Pipe-Soil Interaction module """
from math import pi, sin, tan, exp, sqrt, radians
import numpy as np
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from uhb import general
#########
# GENERAL
#########
def cot(a):
return 1 / tan(a)
def calculate_soil_weight(gamma, D, H):
ret... | StarcoderdataPython |
1627670 | # -*- coding: utf-8 -*-
# @Time : 2021/3/13 17:25
# @Author : DannyDong
# @File : Forward.py
# @describe: 前置条件
import time
import random
import string
# 前置条件-Mock数据
class ForwardMock(object):
def __init__(self):
self.num = random.randint(99, 1000)
eng_list = string.ascii_letters
se... | StarcoderdataPython |
1930174 | from django.contrib.auth.mixins import AccessMixin
from django.http import HttpResponseRedirect
from django.urls import reverse_lazy
from allauth_2fa.utils import user_has_valid_totp_device
class ValidTOTPDeviceRequiredMixin(AccessMixin):
no_valid_totp_device_url = reverse_lazy('two-factor-setup')
def dispa... | StarcoderdataPython |
3293037 | <filename>mssql_dataframe/__init__.py<gh_stars>0
from mssql_dataframe.package import SQLServer # noqa: F401
| StarcoderdataPython |
8189259 | <gh_stars>1-10
from .dict_flatten_accessor import mod_config, get_config
import os
from miscellanies.yaml_ops import load_yaml
def _apply_mixin_rule(rule: dict, config, value, action=None):
query_path = rule['path']
# 'replace' action is the default action
if action is None:
if 'action' not in ru... | StarcoderdataPython |
8003437 | <filename>cellacdc/models/YeaZ/acdcSegment.py<gh_stars>10-100
import os
import pathlib
import numpy as np
import skimage.exposure
import skimage.filters
from .unet import model
from .unet import neural_network
from .unet import segment
from tensorflow import keras
from tqdm import tqdm
from cellacdc import myutils... | StarcoderdataPython |
1831495 | __author__ = '<NAME> <<EMAIL>>'
from abc import ABCMeta, abstractmethod
from prxgt.domain.filter.filter import Filter
from prxgt.domain.instance import Instance
class ProcessorBase(metaclass=ABCMeta):
"""
Processor interface to be implemented for various data structure schemas.
"""
@abstractmethod
... | StarcoderdataPython |
9748646 | from django.urls import path
from . import views
urlpatterns = [
path('drone-categories/', views.DroneCategoryList.as_view(),
name=views.DroneCategoryList.name),
path('drone-categories/<int:pk>', views.DroneCategoryDetail.as_view(),
name=views.DroneCategoryDetail.name),
path('drones/', vie... | StarcoderdataPython |
1912071 | <reponame>hackerwins/polyaxon
from typing import Dict
from django.db import connection
from checks.base import Check
from checks.results import Result
class PostgresCheck(Check):
@staticmethod
def pg_health() -> Result:
try:
with connection.cursor() as cursor:
cursor.exec... | StarcoderdataPython |
5106162 | <reponame>Damego/Asteroid-Discord-Bot
import datetime
from enum import IntEnum
import genshin
from discord import Embed
from discord.ext import tasks
from discord_slash import SlashContext
from discord_slash.cog_ext import cog_subcommand as slash_subcommand
from utils import AsteroidBot, Cog, SystemChannels, UIDNotBin... | StarcoderdataPython |
8192250 | <reponame>jnthn/intellij-community
b'{}'.format(0)
u'{}'.format(0)
| StarcoderdataPython |
6502517 | <filename>scans/Kattendijkekroniek-KB_1900A008/writexml.py<gh_stars>1-10
import os, os.path, glob
import json
from pprint import pprint
from lxml import html
import requests
def finditem(obj, key):
if key in obj: return obj[key]
for k, v in obj.items():
if isinstance(v,dict):
it... | StarcoderdataPython |
11211746 | <reponame>player1537-forks/spack
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RGgbio(RPackage):
"""Visualization tools for genomic data... | StarcoderdataPython |
3457489 | <gh_stars>1-10
from enum import auto, Enum
import logging
import pathlib
from .yaml import load_yaml
import tomli
from .cache import Cache
from .signals import document_loaded
from typing import (
Any,
Callable,
Dict,
Generic,
Iterable,
List,
Literal,
Optional,
Type,
TypeVar,
... | StarcoderdataPython |
5027036 | #!/usr/bin/env python
# Copyright 2013 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | StarcoderdataPython |
1668802 | <reponame>xram64/AdventOfCode2021<filename>day03/day03.py<gh_stars>1-10
## Advent of Code 2021: Day 3
## https://adventofcode.com/2021/day/3
## <NAME> | github.com/xram64
## Answers: [Part 1]: 3633500, [Part 2]: 4550283
import sys
# Return most commonly-found bit, breaking ties in favor of '1'
def get_most_common_bit... | StarcoderdataPython |
1950605 | class LimitOffsetPagination(object):
limit = 10
offset = 0
def __init__(self, req):
self.req = req
self.count = None
def paginate_queryset(self, queryset):
self.count = queryset.count()
self.limit = self.req.get_param_as_int('limit', default=self.limit)
self.off... | StarcoderdataPython |
220067 | <gh_stars>0
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS ... | StarcoderdataPython |
58075 | <reponame>manojgupta3051994/ga-learner-dsmp-repo<gh_stars>0
# --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
data = np.genfromtxt(path,delimiter=',',skip_heade... | StarcoderdataPython |
8151631 |
import gensim as gs
import os
import numpy as np
import codecs
import re
import logging # Log the data given
import sys
import ast
import ConfigParser
from langdetect import detect
from nltk.corpus import stopwords
stopword = set(stopwords.words("english"))
#for LDA
from nltk.tokenize import RegexpTokenizer
from nlt... | StarcoderdataPython |
4882260 | """
factor.py
Defines variables, variable sets, and dense factors over discrete variables (tables) for graphical models
Version 0.1.0 (2021-03-25)
(c) 2015-2021 <NAME> under the FreeBSD license; see license.txt for details.
"""
import numpy as np
#import autograd.numpy as np
from sortedcontainers import SortedSet as... | StarcoderdataPython |
4999815 | import logging
from spaceone.core.manager import BaseManager
from spaceone.monitoring.model.event_model import Event
_LOGGER = logging.getLogger(__name__)
class EventManager(BaseManager):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.event_model: Event = self.locat... | StarcoderdataPython |
11353625 | from .Error import *
from .tools import * | StarcoderdataPython |
5175236 | <filename>app/utils/mathLib.py
import numpy as np
import scipy.linalg as la
def constructor_matrix(M):
"""
Building matrix
"""
return np.matrix(M).transpose()
def minimum_squares(X, Y):
"""
That function shows least squares of the values
"""
media_X = np.mean(X)
media_Y = np.mean(Y)
erro_x = X-med... | StarcoderdataPython |
396539 | <gh_stars>0
from fintech_ibkr.synchronous_functions import *
| StarcoderdataPython |
300994 | import os
import models
from flask_wtf import Form
from wtforms import StringField, PasswordField, TextAreaField, BooleanField, FileField
from wtforms.validators import ValidationError, DataRequired, regexp, Email, EqualTo, Length
from flask_bcrypt import check_password_hash
if 'HEROKU' in os.environ:
AUTH_PASS =... | StarcoderdataPython |
9661229 | #!/usr/bin/env python
""" This is basically scratchpad code for playing with the AVISA system. """
import argparse
import json
import pprint
import time
import uuid
import requests
AVISA = 'http://10.22.237.210:8080'
AVISA_STATUSES = {1: "New / Not Started",
2: "Started / In Progress",
... | StarcoderdataPython |
12822199 | <reponame>alisiahkoohi/survae_flows
from .mlp import *
from .autoregressive import *
from .matching import *
| StarcoderdataPython |
3297796 | <filename>synoptic/accessors.py
## <NAME>
## April 27, 2021
"""
=====================================
Custom Pandas Accessor for SynopticPy
=====================================
So, I recently learned a cool trick--using Pandas custom accessors
to extend Pandas DataFrames with custom methods. Look more about them
her... | StarcoderdataPython |
23538 | <filename>tests/mock_dbcli_config.py
mock_dbcli_config = {
'exports_from': {
'lpass': {
'pull_lastpass_from': "{{ lastpass_entry }}",
},
'lpass_user_and_pass_only': {
'pull_lastpass_username_password_from': "{{ lastpass_entry }}",
},
'my-json-script': ... | StarcoderdataPython |
1844418 | <filename>sciibo/bot/ai.py
from __future__ import division
import collections
import random
import time
from sciibo.core.helpers import nextcard, fitson
class CalculationTimeout(Exception):
pass
def enumerate_unique(cards):
"""
Enumerate but eliminate duplicates.
"""
seen = set()
for n, ca... | StarcoderdataPython |
1842552 | from termcolor import cprint, colored
from random import randint
INDENT = ' ' * 2
def pad(str, length, padder=' '):
while len(str) < length:
str = padder + str
return str
def print_rank(list, color, head=''):
if head != '':
cprint(head, color, attrs=['bold'])
for i, item in enumerat... | StarcoderdataPython |
11214779 | import bpy
import pyblish.api
from pype.api import get_errored_instances_from_context
class SelectInvalidAction(pyblish.api.Action):
"""Select invalid objects in Blender when a publish plug-in failed."""
label = "Select Invalid"
on = "failed"
icon = "search"
def process(self, context, plugin):
... | StarcoderdataPython |
4950266 | <filename>examples/simple/discover_devices.py
from pupil_labs.realtime_api.simple import discover_devices, discover_one_device
# Look for devices. Returns as soon as it has found the first device.
print("Looking for the next best device...\n\t", end="")
print(discover_one_device(max_search_duration_seconds=10.0))
# L... | StarcoderdataPython |
3373933 | """
Test CBlocks functionality.
"""
# pylint: disable=missing-docstring, no-self-use, protected-access
# pylint: disable=invalid-name, redefined-outer-name, unused-argument, unused-variable
# pylint: disable=wildcard-import, unused-wildcard-import
import pytest
import edzed
from .utils import *
def test_connect_o... | StarcoderdataPython |
3207361 | <reponame>vsiddhu/qinfpy<gh_stars>0
#zerOut(mt) : Removes small entries in array
import copy
import numpy as np
__all__ = ['zerOut']
def zerOut(array, tol = 1e-15):
r"""Takes as input an array and tolerance, copies it, in this copy,
nulls out real and complex part of each entry smaller than th... | StarcoderdataPython |
3481407 | <reponame>dimka665/dropbox
#!/usr/bin/env python
"""Desktop Tasks app using Tkinter.
This uses a background thread to be notified of incoming changes.
It demonstrates, among others:
- How to call await() in a loop in a background thread efficiently:
Use make_cursor_map() to feed the 'deltamap' return value back
... | StarcoderdataPython |
3513805 | import torch
def encode_data(dataset, tokenizer, max_seq_length=128):
"""Featurizes the dataset into input IDs and attention masks for input into a
transformer-style model.
NOTE: This method should featurize the entire dataset simultaneously,
rather than row-by-row.
Args:
dataset: A Pandas ... | StarcoderdataPython |
11393047 | import numpy as np
from sklearn.cluster import MiniBatchKMeans
from sklearn.metrics import silhouette_samples, silhouette_score
def vectorize(list_of_docs, model):
"""Generate vectors for list of documents using a Word Embedding
Args:
list_of_docs: List of documents
model: Gensim's Word Embe... | StarcoderdataPython |
5190152 | #############################################################################
##
## Copyright (C) 2019 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Qt for Python examples of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:BSD$
## You may use this file under the terms of the BSD lic... | StarcoderdataPython |
1700544 | <gh_stars>1-10
#import fire
from pprint import pprint
from copy import deepcopy
from .framework import Framework
from .dataset import TACRED
class GridSearch(object):
""" Grid Search algorithm implementation to search for optimal
hyperparameter setup.
TODO: Finish the implementation
Usage:
... | StarcoderdataPython |
6444966 | <reponame>twaddle-dev/CoVid-19
from Crypto.Hash import (
keccak,
)
from eth_hash.preimage import (
BasePreImage,
)
def keccak256(prehash: bytes) -> bytes:
hasher = keccak.new(data=prehash, digest_bits=256)
return hasher.digest()
class preimage(BasePreImage):
_hash = None
def __init__(self,... | StarcoderdataPython |
1814924 | import json
import os
from os import makedirs
from os.path import exsits, getmtime, join, splitext
import time
def jsonize(dct):
""" Remvoes non-json elements from a dictionary.
Converts VirtualFile objects to the integral value 1.
Content stored in VirtualFile is lost. Write to file to avoid loss.
R... | StarcoderdataPython |
11273810 | <reponame>linz/topo-processor<filename>topo_processor/cli/validate.py
import os
from functools import wraps
import click
import linz_logger
from linz_logger import LogLevel, get_log, logger, set_level
from topo_processor.file_system.get_fs import is_s3_path
from topo_processor.stac import DataType, collection_store, ... | StarcoderdataPython |
1939460 | import argparse
import pegasusio as io
import numpy as np
import pandas as pd
from collections import namedtuple
from typing import List, Dict, Tuple
demux_type_dict = {'SNG': 'singlet', 'DBL': 'doublet', 'AMB': 'unknown'}
SNP = namedtuple('SNP', ['CHROM', 'POS', 'REF', 'ALT'])
def check_colnames(fields: List[str]... | StarcoderdataPython |
6454363 | <reponame>rginjapan/DeepLIO<filename>deeplio/losses/__init__.py
from .losses import HWSLoss, LWSLoss, GeometricConsistencyLoss
def get_loss_function(cfg, device):
loss_cfg = cfg['losses']
loss_name = loss_cfg['active'].lower()
loss_type = loss_cfg.get(loss_name, {})
params = loss_type.get('params', {}... | StarcoderdataPython |
1691038 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException
DOCUMENTATION = '''
module: openshift_v1_image_stream_tag_list
short_description: OpenShift ImageStreamTagList
description:
- Retrieve a list of image_stream_tags. List operati... | StarcoderdataPython |
4881849 | <gh_stars>0
# class Solution(object):
# def reverseWords(self, s):
# """
# :type s: a list of 1 length strings (List[str])
# :rtype: nothing
# """
# stack = []
# final_string = ""
# for item in s:
# if item != " ":
# stack.append(it... | StarcoderdataPython |
3382652 | import unittest
import numpy as np
import pysal
#import pysal.spreg as EC
from scipy import sparse
from pysal.contrib.handler import Model
from functools import partial
OLS = partial(Model, mtype='OLS')
PEGP = pysal.examples.get_path
class TestOLS(unittest.TestCase):
def setUp(self):
db = pysal.open(PEG... | StarcoderdataPython |
9693589 | import pytest
import torch
from torch import nn
from deepqmc import Molecule
from deepqmc.fit import LossEnergy, fit_wf
from deepqmc.physics import local_energy
from deepqmc.sampling import LangevinSampler
from deepqmc.wf import PauliNet
from deepqmc.wf.paulinet.gto import GTOBasis
from deepqmc.wf.paulinet.schnet impo... | StarcoderdataPython |
6463974 | <reponame>enmanuelbt92/docs
# Copyright 2015 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
#
... | StarcoderdataPython |
4991833 | <reponame>LoopSun/Django-starter<filename>neptune/conf/__init__.py
from .secret import *
from .base import *
from .debug import *
from .database import *
from .log import *
from .static import *
from .api import *
from .customer import *
from .email import *
from .celery import *
| StarcoderdataPython |
3220926 | <filename>jmetal/util/aggregative_function.py
from abc import ABCMeta, abstractmethod
from jmetal.util.point import IdealPoint
"""
.. module:: aggregative_function
:platform: Unix, Windows
:synopsis: Implementation of aggregative (scalarizing) functions.
.. moduleauthor:: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
"""... | StarcoderdataPython |
3269617 | <filename>tester_web/__init__.py
from flask import Flask
from flask_cors import CORS
from tester_web.user.api import api
from tester_web.user.project import project
from tester_web.user.scripts import scripts
from tester_web.user.test_results import results
app = Flask(__name__)
CORS(app, supports_credenti... | StarcoderdataPython |
121533 | <reponame>zekroTJA/pytter
import os
import sys
from pytter import Client, Credentials
def main():
creds = Credentials(
consumer_key=os.environ.get('tw_consumer_key'),
consumer_secret=os.environ.get('tw_consumer_secret'),
access_token_key=os.environ.get('tw_access_token_key'),
acces... | StarcoderdataPython |
4815807 | #!/usr/bin/python3
import subprocess
from dg_storage import *
from shutil import copyfile
import re
import tempfile
import multiprocessing
RE = re.compile(r'RE\[([^\]]+)\]')
def score_game(sgf):
"""
Returns the winner of the game in the given SGF file as
judged by `gnugo`.
"""
with tempfile.Nam... | StarcoderdataPython |
11230099 | <gh_stars>0
# -*- coding: utf-8 -*-
from sys import argv
import socketserver
from json import loads
from time import strftime, time
from models import *
class ChatServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
daemon_threads = True
allow_reuse_address = True
users = []
messages = []
... | StarcoderdataPython |
8188703 | <reponame>pfnet/chainerchem
import chainer
from chainer import functions
def shifted_softplus(x, beta=1, shift=0.5, threshold=20):
"""shifted softplus function, which holds f(0)=0.
Args:
x (Variable): Input variable
beta (float): Parameter :math:`\\beta`.
shift (float): Shift Paramet... | StarcoderdataPython |
6400681 | # Copyright (c) 2021 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
#
# Unle... | StarcoderdataPython |
160931 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | StarcoderdataPython |
3515758 | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# 实例化一个启动参数对象
chrome_options = Options()
# 设置浏览器窗口大小
chrome_options.add_argument('--window-size=1366, 768')
# 启动浏览器
driver = webdriver.Chrome(chrome_options=chrome_options)
url = 'https://www.geekdigging.com/'
driver.get(url... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.