id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6691170
nums = [float(x) for x in input("Please enter three numbers: ").split()] print("Average is %0.3f" % (sum(nums)/3, ))
StarcoderdataPython
9612288
from utils import hex_to_lbin, lbin_to_hex def ccf(cpu): # ccf # -00c # TODO: optimize this ugly thing (flag extraction should be standard) flag, z = hex_to_lbin(cpu.registers['F'])[4], \ hex_to_lbin(cpu.registers['F'])[7] flag = 0 if flag else 1 flag = [0, 0, 0, 0, flag, 0, 0, z...
StarcoderdataPython
12820882
import ipaddress import click from tabulate import tabulate # pylint: disable=import-error from helpers.api import APIv2 # pylint: disable=import-error,no-name-in-module from helpers.logger import Logger # pylint: disable=import-error,no-name-in-module from helpers.config import config # pylint: disable=import-error,no...
StarcoderdataPython
4921539
# # Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
StarcoderdataPython
140460
import numpy as np import teaserpp_python from Config import Config import gtsam as gt from gtsam import (Cal3_S2, GenericProjectionFactorCal3_S2, NonlinearFactorGraph, NonlinearISAM, Pose3, PriorFactorPoint3, PriorFactorPose3, Rot3, PinholeCameraCal3_S2, Values,...
StarcoderdataPython
4893769
from . import _dbg from . import gs from .margo import mg from .margo_render import render_src from .margo_state import actions, ViewPathName import os import sublime import sublime_plugin class MargoEvents(sublime_plugin.EventListener): def on_query_completions(self, view, prefix, locations): return mg.event('quer...
StarcoderdataPython
3510402
s = raw_input('string: ') rotate = raw_input('rotate by: ') r = int(rotate) def rotate_word(s, r): """ Rotate each char in a string by through the alphabet by the given amount. Wrap around to the beginning (if necessary). """ r_s = '' for c in s: num = ord(c) r_num = num + r ...
StarcoderdataPython
1868481
<gh_stars>0 class MergeSort(object): def __init__(self, list): self.list = list self.numReversePairs = 0 def sort(self): aux = [0 for _ in self.list] self.mergesort(self.list, 0, len(self.list), aux) def mergesort(self, list, l, h, aux): if h <= l+1: return mid = (l+h)//2 self.mergesort(list, l...
StarcoderdataPython
9721950
import random from PyQt5.QtCore import QSize from PyQt5.QtGui import QFont from PyQt5.QtWidgets import QDialog, QCheckBox, QPushButton, QMessageBox, QTextEdit from src.UI.util import create_line, create_multi_line from src.backend.word_book import WordBook class UiReview(QDialog): words = [] current = -1 ...
StarcoderdataPython
5062178
<gh_stars>100-1000 from .kwta import kWTA from .lp_relu import LP_ReLU1, LP_ReLU2 from .frelu import FReLU
StarcoderdataPython
268830
<filename>mecache/core.py import time import pickle import hmac from hashlib import sha1 from functools import wraps class Aboriginal: @staticmethod def keyf(*args, **kwargs): key = pickle.dumps([args, kwargs]) mac = hmac.new(b'mecache', msg=key, digestmod=sha1) return str(mac.hexdige...
StarcoderdataPython
8125160
from .correlation import fig_correlation from .metric import fig_metric from .posterior import fig_posterior
StarcoderdataPython
8016978
#!/usr/bin/env python # ### INSTRUCTOR COMMENTS: # Note that the phrases "Module description" and "Function docstring" should not # actually appear in docstrings. Instead, you should put the name and/or brief # description of what the function/module does. # """Module Description This function takes the input the use...
StarcoderdataPython
3516173
import json import gzip from twython import TwythonError from hoover.auth import twython_from_key_and_auth from hoover.rate_control import RateControl def json_split(json_str): if len(json_str.split('}{')) == 1: return [json_str.strip()] parts = [] depth = 0 part = '' for i, c in enumerate...
StarcoderdataPython
6689819
<filename>test.py import sockslib socket = sockslib.SocksSocket() socket.set_proxy(('127.0.0.1', 9050), [sockslib.NoAuth(), sockslib.UserPassAuth('username', 'password')]) socket.connect(('myexternalip.com', 80)) socket.sendall(b"GET /raw HTTP/1.1\r\nHost: myexternalip.com\r\n\r\n") print(socket.recv(1024))
StarcoderdataPython
5187723
<filename>lifecycle/ingest/tooling/unknown.py def unknown(command): print(command.zone + " is not implemented.\n") return 1
StarcoderdataPython
1971880
data="""Ground, 2 Vegetation, 5 Building, 6 Water, 9 Transmission Tower, 15 Bridge Deck, 17 Overhead Structure, 19 Wire, 64 Car, 65 Truck, 66 Boat, 67 Barrier, 68 Railroad Car, 69 Elevated Walkway, 70 Covered Walkway, 71 Pier/Dock, 72 Fence, 73 Tower, 74 Crane, ...
StarcoderdataPython
11316162
''' ------------------------------------ Assignment 10 - EE2703 (Jan-May 2020) Done by <NAME> (EE18B122) Created on 02/05/20 Last Modified on 02/05/20 ------------------------------------ ''' # Imports import csv import numpy as np import numpy.fft as fft import matplotlib.pyplot as plt import scipy.signal as sgnl # ...
StarcoderdataPython
79749
<reponame>tranconbv/ironpython-stubs class ApplicationId(object): """ Contains information used to uniquely identify a manifest-based application. This class cannot be inherited. ApplicationId(publicKeyToken: Array[Byte],name: str,version: Version,processorArchitecture: str,culture: str) """ def ZZZ(self...
StarcoderdataPython
1944386
<reponame>Sieva-cmd/Myblog<filename>config.py import os class Config: RANDOM_QUOTE_API_KEY =os.environ.get('RANDOM_QUOTE_API_KEY') SECRET_KEY =os.environ.get('SECRET_KEY') SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://moringa:sieva@localhost/blog' SQLALCHEMY_TRACK_MODIFICATIONS = False UPLOADED...
StarcoderdataPython
3493528
"""Riemannian Adam optimizer implementation. Becigneul, Gary, and <NAME>. "Riemannian Adaptive Optimization Methods." International Conference on Learning Representations. 2018. """ from tensorflow.python.eager import def_function from tensorflow.python.framework import ops from tensorflow.python.keras import backend_...
StarcoderdataPython
6420135
<reponame>dougn/trtis-cidmgr # Copyright (c) 2019, <NAME>. All rights reserved. import sys, os, os.path import argparse import shutil from . import util from .version import __version__ _LIB= util.name2lib('cidmgr') _template = os.path.join(os.path.dirname( os.path.abspath(__file__)), 'config.pbtxt.i...
StarcoderdataPython
1858539
# # Convert a csv to a multiline json # utility to convert also with the goal to use the # json2cerberus utility afterwatrs to create a schema from a csv # (csv->json->schema) # # khz 2018 # update: 18.3.2019: added option to convert str types to int and float. See --convstr import csv import simplejson as json impo...
StarcoderdataPython
3534474
<filename>tracewing.py from astropy.io import ascii from matplotlib import pyplot from matplotlib.patches import Polygon import numpy as np import lacewing import kinematics import sys def traceback(argv=None): if argv is None: argv = sys.argv name,coord,era,edec,pmra,epmra,pmdec,epmdec,rv,erv,plx...
StarcoderdataPython
126686
<filename>hubblestack/utils/signing.py # coding: utf-8 """ hubblestack/utils/signing.py is a collection of tools that facility repo signing and verification. The settings for the signing and verification (and their defaults) are as follows. repo_signing: # defaults require_verify: false ca...
StarcoderdataPython
8175736
# Copyright 2021 Sony Semiconductors Israel, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
StarcoderdataPython
6631434
""" run the comparisons using asyncio """ import asyncio import asks import regex import settingsmay2021 as settings import aiohttp import langdetect import os import schedule from time import sleep from flask_bootstrap import Bootstrap from collections import OrderedDict from flask_wtf import FlaskForm from wtforms i...
StarcoderdataPython
3224225
def move(n, a, b, c): if n == 1: print(a, '-->', c) pass else: move(n-1, a, c, b) move(1, a, b, c) move(n-1, b, a, c) pass move(10,'a','b','c')
StarcoderdataPython
1716520
# # @lc app=leetcode id=203 lang=python3 # # [203] Remove Linked List Elements # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def removeElements(self, head: ListNode, val: int) -> ListNode: ...
StarcoderdataPython
3560578
<reponame>anubhab-code/Competitive-Programming def reverseWords(string): return ' '.join(reversed(string.split()))
StarcoderdataPython
347389
<gh_stars>0 # ---------------------------------------------------------------------------- # Copyright 2014-2016 Nervana Systems Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ht...
StarcoderdataPython
6669268
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Fri Dec 3 23:20:58 2021 @author: <NAME> """ """ Bingo is played on a set of boards each consisting of a 5x5 grid of numbers. Numbers are chosen at random, and the chosen number is marked on all boards on which it appears. (Numbers may not appear on all boards.) I...
StarcoderdataPython
5059973
<reponame>ismailalptug/Image-Quantization import numpy as np import cv2 def quantizeImage(image, q): quaLevel = q new_img = np.uint8(np.floor(np.double(image)/(256/quaLevel))) norm_image = cv2.normalize(new_img, None, 0, 255, norm_type=cv2.NORM_MINMAX) cv2.imshow("Quantized", norm_image) ...
StarcoderdataPython
6471437
<reponame>taxmeifyoucan/lnbits async def m001_initial(db): await db.execute( f""" CREATE TABLE IF NOT EXISTS streamalerts.Services ( id {db.serial_primary_key}, state TEXT NOT NULL, twitchuser TEXT NOT NULL, client_id TEXT NOT NULL, client...
StarcoderdataPython
6431014
import json import shutil import glob from os import makedirs from os import listdir from os.path import isdir from os.path import basename from datetime import datetime class DBmanage: def __init__(self): self.databasePath = './database/' self.subFolderPath = self.databasePath + self.getCrawlDat...
StarcoderdataPython
1684136
<filename>dependencytrack/__init__.py # Copyright 2020 <NAME> <EMAIL> # SPDX-License-Identifier: GPL-2.0+ import logging import requests from .projects import Projects from .components import Components from .licenses import Licenses from .bom import Bom from .exceptions import AuthenticationError, DependencyTrackApi...
StarcoderdataPython
9795363
from django.core.management import call_command from django.test import TestCase from models import Game class TestGame(Game): class Meta: proxy = True class TestGameModule(TestCase): def test_game_instance(self): gi = TestGame.get_instance() self.assertEqual(gi.name, 'TestGame') ...
StarcoderdataPython
1846766
<filename>tests/test_parser.py import pytest from awkwardql.parser import (parse, Symbol, Literal, Assignment, Pack, Histogram, Cut, Call, With, Axis, GetAttr, Block, Vary, Trial) def test_whitespace(): assert parse(r"") == [] assert parse(r"""x """)...
StarcoderdataPython
3442709
<reponame>gubschk/CDEWIP # -*- coding: utf-8 -*- """ chemdataextractor.nlp ~~~~~~~~~~~~~~~~~~~~~ Chemistry-aware natural language processing framework. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals ...
StarcoderdataPython
9665514
<filename>learning_tools/keras-rl/dqn/dqn_complex.py import numpy as np import gym from keras.models import Sequential from keras.layers import Dense, Activation, Flatten from keras.optimizers import Adam from rl.agents.dqn import DQNAgent from rl.policy import BoltzmannQPolicy, LinearAnnealedPolicy from rl.memory im...
StarcoderdataPython
8045839
<reponame>marcortiz11/FastComposedModels<gh_stars>0 import numpy as np def __spin_roulette(fit_vals, mask=None): """ Action if spinning the wheel :param fit_vals: Fitness values of the population :param mask: Boolean vector. Tells which individuals consider this time :return: index of selected in...
StarcoderdataPython
365297
import math from iso639 import languages from langdetect import detect from nltk.corpus import stopwords from nltk.tokenize import sent_tokenize, word_tokenize class Utils(object): """ Utilities class. """ @staticmethod def get_sentences(text): sentences = [] for sentence in sent...
StarcoderdataPython
4884014
import datetime import os from typing import Generator, List from celery.utils.log import get_task_logger from dynamicannotationdb.key_utils import build_segmentation_table_name from dynamicannotationdb.models import SegmentationMetadata from sqlalchemy import and_, func, text from sqlalchemy.exc import ProgrammingErr...
StarcoderdataPython
3494439
<reponame>paregorios/make-project #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Python 3 tests template (changeme)""" import logging from nose.tools import assert_equal, assert_false, assert_true, raises from os.path import abspath, join, realpath from unittest import TestCase logger = logging.getLogger(__name__)...
StarcoderdataPython
4894489
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import math import os import pprint from typing import List import numpy as np import torch from classy_vision.generic.distribu...
StarcoderdataPython
3389755
<filename>tests/test2.py import bottle import snifter from gevent.wsgi import WSGIServer app = bottle.Bottle() @app.route('/') def home(): session = bottle.request['snifter.session'] if session.get('name') is None: session['name'] = 'World' return 'Please refresh!' return 'Hello, %s!' % ...
StarcoderdataPython
6667094
<reponame>oyvindbusk/fullFres<filename>tests/tests.py import pytest import pandas as pd import datatest as dt if __name__ == '__main__': unittest.main()
StarcoderdataPython
5101285
<gh_stars>100-1000 from pxr import Tf if hasattr(Tf, 'PreparePythonModule'): Tf.PreparePythonModule('_AL_USDTransaction') else: from . import _AL_USDTransaction Tf.PrepareModule(_AL_USDTransaction, locals()) del Tf try: import __DOC __DOC.Execute(locals()) del __DOC except Exception: try: ...
StarcoderdataPython
6512592
<filename>exercises/003_Variables/variables_001.py ## Python INTRO for TD Users ## <NAME> ## May, 2018 ## Understanding python variables and dinamic typing. # Declare a variable and initialize it as an integer value a = 0 print(a) # re-declaring the variable as an character strings works a = 'Hola Barcelona!' print...
StarcoderdataPython
1891004
"""lightweight test for pysal metapckage that functions import.""" def test_imports(): from tobler.dasymetric import masked_area_interpolate from tobler.area_weighted import area_interpolate from tobler.model import glm, glm_pixel_adjusted
StarcoderdataPython
8107090
<gh_stars>0 from trame.internal import ( change, Controller, flush_state, get_cli_parser, get_state, get_version, is_dirty, is_dirty_all, port, start, State, stop, trigger, update_state ) from trame.layouts import update_layout __version__ = get_version() state = State() """This object provides pythonic access to...
StarcoderdataPython
6419843
<reponame>eterevsky/pygui import unittest from unittest.mock import Mock, patch from .layout import RootLayout, HStackLayout, VStackLayout, LayersLayout from .observable import Attribute, Observable, make_observable from .pane import Pane from .view import View, HAlign, VAlign class MyView(View): def __init__(se...
StarcoderdataPython
6689901
<reponame>Priyansh2/LeetCode-Solutions # Time: O(nlogn) # Space: O(n) import collections # hash, sort class Solution(object): def findWinners(self, matches): """ :type matches: List[List[int]] :rtype: List[List[int]] """ lose = collections.defaultdict(int) players...
StarcoderdataPython
8159977
<filename>pirates/util/PythonUtilPOD.py<gh_stars>1-10 from panda3d.direct import get_config_showbase from panda3d.core import Camera from direct.showbase.PythonUtil import getSetter, getSetterName import sys def mostDerivedLast(classList): """pass in list of classes. sorts list in-place, with derived classes a...
StarcoderdataPython
6493045
<gh_stars>1-10 """input validation adapted in part from scikit-learn under license https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/validation.py """ import numpy as np def is_1d_or_row_or_column(y): """validate that a vector is 1-dimensional, or is a row or column vector that is safe t...
StarcoderdataPython
3509007
<filename>pusherable/example/models.py<gh_stars>10-100 # -*- coding: utf-8 -*- from django.db import models class PusherableExample(models.Model): text = models.TextField()
StarcoderdataPython
3594139
<filename>ck/tweet/migrations/0004_response_priority.py # Generated by Django 3.2.6 on 2021-09-06 08:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tweet', '0003_response'), ] operations = [ migrations.AddField( model_na...
StarcoderdataPython
1675106
# Copyright (c) 2022 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 # # Unless required by appli...
StarcoderdataPython
3483367
<reponame>aless80/devilry-django from django.contrib.contenttypes.models import ContentType from devilry.devilry_import_v2database.models import ImportedModel from django import test from django.conf import settings from django.utils.dateparse import parse_datetime from model_mommy import mommy from devilry.apps.cor...
StarcoderdataPython
4889365
WTF_CSRF_ENABLED = True SECRET_KEY = 'you-will-never-guess' OPENID_PROVIDERS = [ {'name': 'Google', 'url': 'https://www.google.com/accounts/o8/id'}, {'name': 'Yahoo', 'url': 'https://me.yahoo.com'}, {'name': 'AOL', 'url': 'http://openid.aol.com/<username>'}, {'name': 'Flickr', 'url': 'http://www.flickr...
StarcoderdataPython
1963489
<reponame>smnikolakaki/submodular-linear-cost-maximization """ This job processes guru dataset and exports the processed data object """ import logging import pandas as pd from data.data_provider import DataProvider from data.data_exporter import DataExporter from sklearn.preprocessing import MultiLabelBinarizer from ...
StarcoderdataPython
1959585
<reponame>pdghawk/deepQ-pong # Copyright 2019 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
StarcoderdataPython
11362779
<reponame>nicofff/baas<filename>solvers/random_solver.py<gh_stars>1-10 import base_solver as base import game from lib import helpers STATE_MISS = 0 STATE_HIT = 1 STATE_UNKNOWN = 2 class RandomSolver(base.BaseSolver): def mark_tile_used(self,tile): self.remaining_tiles.remove(tile) def get_next_target(self): ...
StarcoderdataPython
8151664
from uuid import uuid4 from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from actor.models import Actor def current_year() -> int: return timezone.now().year # pragma: no cover class Movie(models.Model): """Movie/Film details.""" i...
StarcoderdataPython
3288376
#!/usr/bin/python # -*- coding: utf-8 -*- ### # Copyright (2016-2017) 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 may obtain a copy of the License at # # http://www.apache.org/licen...
StarcoderdataPython
395921
NAME = 'diary.py' ORIGINAL_AUTHORS = [ '<NAME>' ] ABOUT = ''' Keeps a record of your diary ''' COMMANDS = ''' >>>.diary record <diary entry> Adds to that day's diary entry >>>.diary show <date> Will show the diary entry of specified date (can also accept "today", "yesterday") >>>.diary delete Will delete today...
StarcoderdataPython
11305034
<filename>Helpers/GlobalSettings.py from typing import Type, Any, List, Dict, Set, Tuple, Union, Optional, Iterator, Iterable, Callable from Helpers.Torches import * class Gsv: mean = 'mean' activation = 'activation' rnn = 'rnn' concat = 'concatenation' product = 'product' graph_uqi = 'uqi' ...
StarcoderdataPython
1783703
<filename>stupidfuckingbot.py #i have no idea wtf i am doing import os import discord import configparser import random from discord.ext import commands config = configparser.ConfigParser() config.read('settings.ini') client = commands.Bot(command_prefix = 'l.') frogdir = "animals/frog" @client.event async def on_re...
StarcoderdataPython
396031
import os from flask import Flask from .database import Database def create_app(config=None, instance_path=None): # create the app if instance_path is not None: app = Flask( __name__, instance_path=instance_path, instance_relative_config=True ) else: app = Flask(__name_...
StarcoderdataPython
332378
from ctypes import Structure, c_ulong, POINTER, cast, addressof, py_object, c_long, c_void_p from common import get_object_field_or_null, EMPTY, DUMMY class PyDictKeyEntry(Structure): _fields_ = [ ('me_hash', c_long), ('me_key', py_object), ('me_value', py_object), ] class PyDictKeys...
StarcoderdataPython
3466954
<filename>make_mesh.py import sys from glob import glob import skimage from skimage import measure import nibabel import numpy import os from math import floor import argparse # def remove_inner_surface(img_data,mask,treshhold=0): """ Replace inner data of the given volume with a smoothed, uniform masking to avoid ge...
StarcoderdataPython
9670136
import textwrap import zipfile import pytest @pytest.fixture def fancy_wheel(tmp_path): path = tmp_path / "fancy-1.0.0-py2.py3-none-any.whl" files = { "fancy/": b"""""", "fancy/__init__.py": b"""\ def main(): print("I'm fancy.") """, "fancy/__main__...
StarcoderdataPython
12836753
# The MIT License (MIT). # Copyright (c) 2015, <NAME> & contributors. from imapfw.interface import implements, checkInterfaces from imapfw.conf import Parser from .interface import ActionInterface # Annotations. from imapfw.annotation import ExceptionClass @checkInterfaces() @implements(ActionInterface) class Unit...
StarcoderdataPython
8099690
<filename>catkin_ws/src/00-infrastructure/easy_regression/include/easy_regression/conditions/interface.py from abc import abstractmethod, ABCMeta from collections import namedtuple from duckietown_utils.exceptions import DTConfigException from duckietown_utils.instantiate_utils import indent from duckietown_utils.syst...
StarcoderdataPython
6410960
<reponame>cnrpman/epickitchen-on-youcook2<filename>youcook2/clip_cutting.py import os import os.path import sys import shutil import argparse import math from tqdm import tqdm def opts(): parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('--path', default='./', ...
StarcoderdataPython
4935355
<reponame>fengyiqi/screentl import datetime import random import re from moviepy.editor import * TODAY = datetime.date.today().strftime('%Y-%m-%d') def make_video(folder: str = TODAY, fps: int = 25, audio_loc: str = 'audio', text: str = TODAY ): """ ...
StarcoderdataPython
6698327
<filename>seafobj/backends/base.py #coding: UTF-8 import zlib from seafobj.exceptions import GetObjectError class AbstractObjStore(object): '''Base class of seafile object backend''' def __init__(self, compressed, crypto=None): self.compressed = compressed self.crypto = crypto def read_ob...
StarcoderdataPython
5183553
<gh_stars>0 """ Provide an implementation of the optimal drop-off location searcher. """ from statprly.optimal_drop_off_location_searcher.interfaces import BaseOptimalDropOffLocationSearcher class OptimalDropOffLocationSearcher(BaseOptimalDropOffLocationSearcher): """ Implementation of the optimal drop-off lo...
StarcoderdataPython
4934042
import tweepy import os from dotenv import load_dotenv load_dotenv() TWITTER_API_KEY = os.getenv("TWITTER_API_KEY") TWITTER_API_SECRET = os.getenv("TWITTER_API_SECRET") TWITTER_ACCESS_TOKEN = os.getenv("TWITTER_ACCESS_TOKEN") TWITTER_ACCESS_TOKEN_SECRET = os.getenv("TWITTER_ACCESS_TOKEN_SECRET") BASILICA_API_KEY = o...
StarcoderdataPython
1816674
"""定义learning_logs的URL模式""" from django.conf.urls import url from . import views urlpatterns = [ # 主页 url(r'^$', views.index, name='index'), url(r'^topics/$', views.topics, name='topics'), url(r'^topics/(?P<topic_id>\d+)/$', views.topic, name='topic'), url(r'^new_topic/$', views.new_topic, name='n...
StarcoderdataPython
297768
# import pickle from log_info import log_warning, log_info def save_file(content, file_path, mode="w", encoding="utf-8"): """Wrapper function to write string or binary content to a file.""" if content is None: log_warning(f"File content is empty: save_file({content}, {file_path}, {mode}, {encoding})")...
StarcoderdataPython
8140216
# -*- coding: utf-8 -*- from node.utils import UNSET from pkg_resources import iter_entry_points from yafowil.compat import BYTES_TYPE from yafowil.compat import IS_PY2 from yafowil.compat import LONG_TYPE from yafowil.compat import STR_TYPE from yafowil.compat import UNICODE_TYPE import inspect import json import logg...
StarcoderdataPython
8051942
<reponame>artexmg/resp-science<filename>respscience/process_file.py import sys import os import convert_to_excel if __name__ == "__main__": if len(sys.argv) > 1: input_path = sys.argv[1] else: input_path = "." if len(sys.argv) > 2: output_path = sys.argv[2] else: output_...
StarcoderdataPython
4833128
#@<OUT> mysqlx.Type NAME Type - Data type constants. SYNTAX mysqlx.Type DESCRIPTION The data type constants assigned to a Column object retrieved through RowResult.get_columns(). PROPERTIES BIGINT A large integer. BIT A bit-value type. BYTES ...
StarcoderdataPython
1925604
import os BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = "abc123" INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'airavata_django_portal_sdk', ] GATEWAY_DATA_STORE_DIR = "/tmp" GATEWAY_DATA_STORE_RESOURCE_ID = "resourceId" DATABASES = { 'de...
StarcoderdataPython
1843036
# -*- coding: utf-8 -*- from PyQt4.QtCore import * from PyQt4.QtGui import * from PyKDE4.plasma import Plasma from PyKDE4 import plasmascript from PyKDE4.kdecore import * from PyKDE4.kdeui import * class <%= options[:project_name].capitalize %>(plasmascript.Applet): def __init__(self,parent,args=None): plasmascript...
StarcoderdataPython
4842055
"""Python client for Sift Science's API. See: https://siftscience.com/docs/references/events-api """ import json import requests import requests.auth import sys if sys.version_info[0] < 3: import urllib _UNICODE_STRING = basestring else: import urllib.parse as urllib _UNICODE_STRING = str import sift ...
StarcoderdataPython
5184786
<reponame>calind/zipa import httpretty import pytest from requests.exceptions import HTTPError from zipa import api_test_com as t def pretty_api(): httpretty.register_uri(httpretty.GET, 'https://api.test.com/item/a', status=200, content_type='application/json...
StarcoderdataPython
11293031
# -*- coding: utf-8 -*- """ Basic HTTP access interface. This module handles communication between the bot and the HTTP threads. This module is responsible for - Setting up a connection pool - Providing a (blocking) interface for HTTP requests - Translate site objects with query strings into urls - U...
StarcoderdataPython
1839624
<filename>jade/basic/TKinter/ImageFrame.py from Tkinter import * class ImageFrame(Frame): def __init__(self, _tk_, file_path, **options): Frame.__init__(self, _tk_, **options) #DesignPhoto =PhotoImage(file = file_path) DesignPhoto = PhotoImage(file = file_path) self.Photo = Label(m...
StarcoderdataPython
1631315
<reponame>LucasFidon/fetal-brain-segmentation-partial-supervision-miccai21<filename>src/network_architectures/custom_3dunet/unet.py # -*- coding: utf-8 -*- """ Main module. Based on https://github.com/fepegar/unet/tree/master/unet """ from typing import Optional import torch.nn as nn from src.network_architectures.cu...
StarcoderdataPython
47687
<gh_stars>1-10 from Model import Model from Config import Config from math import ceil import readfile import customer_init import numpy as np import time import datetime import util import os import random from tempfile import TemporaryFile from customer_init import orthogonal_initializer import tensorflow as tf from ...
StarcoderdataPython
11214364
from __future__ import unicode_literals # import frappe # from _future_ import unicode_literals import frappe import frappe.utils import moneris_payment import json import datetime from frappe import _ from frappe.utils import getdate,nowdate from frappe.utils import cint, fmt_money from datetime import da...
StarcoderdataPython
6551416
<reponame>Phillistan16/fastestimator # Copyright 2019 The FastEstimator 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/LI...
StarcoderdataPython
3541911
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Unlimited developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import sys import logging import types import copy import os import os.path import test_framework.util fro...
StarcoderdataPython
6547126
<gh_stars>1-10 import pandas as pd import numpy as np from ppandas.helper.bayes_net_helper import BayesNetHelper class QueryHelper(): def __init__(self, mapping): self.mapping = mapping def query(self, bayes_net, query_vars, evidence_vars): # if evidence vars is mismatched and was assigned sp...
StarcoderdataPython
12815893
#!/usr/bin/env python import numpy as np import sys import scipy.io as io_mat from subprocess import call import os import matplotlib #matplotlib.use('Svg') import matplotlib.pyplot as plt font = {'weight' : 'normal', 'size' : 12} matplotlib.rc('font', **font) name_sol = sys.argv[1] matfile = [name_sol+ ...
StarcoderdataPython
12820258
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: urls.py Description : Author : Afa date: 2017/4/13 ------------------------------------------------- Change Activity: 2017/4/13: --------------------------------------------...
StarcoderdataPython
9616440
""" Author: <NAME> (https://github.com/ktxlh) """ ############################################################################## # Configurations # ############################################################################## # See Piazza URL for your IDs: ht...
StarcoderdataPython
4831016
<filename>targeneintersect/targeneintersect.py # -*- coding: utf-8 -*- """Main module.""" import pybedtools def target_gene_intersect(genes, dataframe): """Uses pybedtools intersect to find target genes for dataframe""" gene_frame = pybedtools.BedTool(genes) cols_ = dataframe.shape[1] keep = list(ra...
StarcoderdataPython